Skip to content

Commit 0629ac0

Browse files
Replay Mode options & rework settings menu (v1.3.2.0)
New Options: * Replay Mode Settings: * Disable Cinematic Cameras - View the map without being dragged away by scripted events. * Pause at Start - Pause at match start while in replay mode. * Finish Pre-Spectate Time - Set the wait time before entering spectate mode after finishing a level. * Local Replay Trimming - Change how local replays past the limit are deleted: * Never - Ignore the limit and never delete replays. * Current Run Only - Never delete existing replays, but don't add the current run if its past the placement limit. * Always - Always remove replays past the limit after finishing a run. Changes: * Most settings have been moved into new Limits submenu to cleanup root menu. Data effect, LOD, and Car style have been kept in the root menu. * Data Effect can now be disabled for Replay Mode as well. Option changed to a Ghost Mode/Replay Mode listbox. * Steam Rivals use for Ghost/Replay option changed to a Ghost Mode/Replay Mode listbox. Refactors: * Some enum types moved to Data/ subfolder and namespace. * All settings enums given a GetSettingsEntries static method in their extensions class, to get the dictionary that's normally used for ListBoxes. * Car Styles enum moved outside the Mod class.
1 parent 185cb87 commit 0629ac0

19 files changed

Lines changed: 953 additions & 551 deletions

File tree

Distance.ReplayIntensifies/ConfigurationLogic.cs

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Distance.ReplayIntensifies.Randomizer;
1+
using Distance.ReplayIntensifies.Data;
2+
using Distance.ReplayIntensifies.Randomizer;
23
using Reactor.API.Configuration;
34
using System;
45
using System.Collections.Generic;
@@ -33,6 +34,13 @@ public bool FillWithLocalReplays
3334
}
3435

3536

37+
private const string LocalReplayTrimming_ID = "leaderboards.local_replay_trimming";
38+
public LocalLeaderboardTrimming LocalReplayTrimming
39+
{
40+
get => Get<LocalLeaderboardTrimming>(LocalReplayTrimming_ID);
41+
set => Set(LocalReplayTrimming_ID, value);
42+
}
43+
3644
private const string MaxSavedLocalReplays_ID = "leaderboards.max_saved_local_replays";
3745
public int MaxSavedLocalReplays
3846
{
@@ -119,26 +127,19 @@ public bool EnableUnrestrictedOpponentColors
119127
set => Set(EnableUnrestrictedOpponentColors_ID, value);
120128
}
121129

122-
private const string ShowDataEffectInGhostMode_ID = "visual.data_effect_in_ghost_mode";
123-
public bool ShowDataEffectInGhostMode
130+
private const string UseDataEffectForMode_ID = "visual.use_data_effect_for_mode";
131+
public GhostOrReplay UseDataEffectForMode
124132
{
125-
get => Get<bool>(ShowDataEffectInGhostMode_ID);
126-
set => Set(ShowDataEffectInGhostMode_ID, value);
133+
get => Get<GhostOrReplay>(UseDataEffectForMode_ID);
134+
set => Set(UseDataEffectForMode_ID, value);
127135
}
128136

129137

130-
private const string UseRivalStyleForGhosts_ID = "visual.use_rival_style_for_ghosts";
131-
public bool UseRivalStyleForGhosts
138+
private const string UseRivalStyleForMode_ID = "visual.use_rival_style_for_mode";
139+
public GhostOrReplay UseRivalStyleForMode
132140
{
133-
get => Get<bool>(UseRivalStyleForGhosts_ID);
134-
set => Set(UseRivalStyleForGhosts_ID, value);
135-
}
136-
137-
private const string UseRivalStyleForReplays_ID = "visual.use_rival_style_for_replays";
138-
public bool UseRivalStyleForReplays
139-
{
140-
get => Get<bool>(UseRivalStyleForReplays_ID);
141-
set => Set(UseRivalStyleForReplays_ID, value);
141+
get => Get<GhostOrReplay>(UseRivalStyleForMode_ID);
142+
set => Set(UseRivalStyleForMode_ID, value);
142143
}
143144

144145
private const string UseRivalStyleForSelf_ID = "visual.use_rival_style_for_self";
@@ -284,6 +285,28 @@ public bool RandomCustomCarsSplitDefaultWeight
284285
set => Set(RandomCustomCarsSplitDefaultWeight_ID, value);
285286
}
286287

288+
289+
private const string ReplayModeDisableCinematicCameras_ID = "replaymode.disable_cinematic_cameras";
290+
public bool ReplayModeDisableCinematicCameras
291+
{
292+
get => Get<bool>(ReplayModeDisableCinematicCameras_ID);
293+
set => Set(ReplayModeDisableCinematicCameras_ID, value);
294+
}
295+
296+
private const string ReplayModePauseAtStart_ID = "replaymode.pause_at_start";
297+
public bool ReplayModePauseAtStart
298+
{
299+
get => Get<bool>(ReplayModePauseAtStart_ID);
300+
set => Set(ReplayModePauseAtStart_ID, value);
301+
}
302+
303+
private const string FinishPreSpectateTime_ID = "replaymode.pre_spectate_time";
304+
public float FinishPreSpectateTime
305+
{
306+
get => Get<float>(FinishPreSpectateTime_ID);
307+
set => Set(FinishPreSpectateTime_ID, value);
308+
}
309+
287310
#endregion
288311

289312
#region Cached
@@ -319,8 +342,7 @@ public bool GetCarOutline(bool isGhost, bool isCarRival)
319342

320343
public bool IsCarSteamRival(bool isGhost, ulong userID)
321344
{
322-
if (this.EnableSteamRivals &&
323-
((isGhost && this.UseRivalStyleForGhosts) || (!isGhost && this.UseRivalStyleForReplays)))
345+
if (this.EnableSteamRivals && this.UseRivalStyleForMode.HasGhostOrReplay(isGhost))
324346
{
325347
return IsSteamRival(userID, false);
326348
}
@@ -364,11 +386,11 @@ public bool IsCarRandomnessEnabled(bool isOnline, bool isCarRival, string carNam
364386
}
365387
else if (isOnline)
366388
{
367-
return this.UseRandomCarsFor.HasFlag(LocalOrOnline.Online);
389+
return this.UseRandomCarsFor.HasFlag(LocalOrOnline.Online_Replays);
368390
}
369391
else
370392
{
371-
return this.UseRandomCarsFor.HasFlag(LocalOrOnline.Local);
393+
return this.UseRandomCarsFor.HasFlag(LocalOrOnline.Local_Replays);
372394
}
373395
}
374396
return false;
@@ -712,6 +734,7 @@ public void Awake()
712734
Get(MaxSelectedReplays_ID, 20);
713735
Get(FillWithLocalReplays_ID, false);
714736

737+
Get(LocalReplayTrimming_ID, LocalLeaderboardTrimming.Current);
715738
Get(MaxSavedLocalReplays_ID, 500);
716739
Get(MaxOnlineLeaderboards_ID, 1000);
717740

@@ -723,22 +746,21 @@ public void Awake()
723746
this.MaxLevelOfDetail = Get(MaxDetailLevel_ID, Mod.MaxMaxLevelOfDetail);
724747
this.MinLevelOfDetail = Get(MinDetailLevel_ID, CarLevelOfDetail.Level.Speck);
725748
Get(EnableUnrestrictedOpponentColors_ID, false);
726-
Get(ShowDataEffectInGhostMode_ID, false);
749+
Get(UseDataEffectForMode_ID, GhostOrReplay.Replay_Mode);
727750

728751
// Experimental (disabled by default)
729752
Get(EnableSteamRivals_ID, false);
730753
Convert(SteamRivals_ID, new Dictionary<ulong, string>(), overwriteNull: true);
731754
Get(HighlightRivalsInLeaderboards_ID, true);
732-
Get(UseRivalStyleForGhosts_ID, true);
733-
Get(UseRivalStyleForReplays_ID, false);
755+
Get(UseRivalStyleForMode_ID, GhostOrReplay.Ghost_Mode);
734756
Get(UseRivalStyleForSelf_ID, false);
735757
Get(RivalBrightness_ID, 1.0f);
736758
Get(RivalOutline_ID, true);
737759
Get(RivalDetailType_ID, CarLevelOfDetail.Type.Networked);
738760

739761
// Randomized Cars
740762
Get(EnableRandomizedCars_ID, false);
741-
Get(UseRandomCarsFor_ID, LocalOrOnline.Local);
763+
Get(UseRandomCarsFor_ID, LocalOrOnline.Local_Replays);
742764
Get(UseRandomRivalCars_ID, false);
743765
Get(RandomRespectBackerCars_ID, true);
744766

@@ -753,6 +775,11 @@ public void Awake()
753775
Get(RandomCustomCarsDefaultWeight_ID, 0.0f);
754776
Get(RandomCustomCarsSplitDefaultWeight_ID, false);
755777

778+
// Replay Mode
779+
Get(ReplayModeDisableCinematicCameras_ID, false);
780+
Get(ReplayModePauseAtStart_ID, false);
781+
Get(FinishPreSpectateTime_ID, 5f);
782+
756783
// Save settings, and any defaults that may have been added.
757784
Save();
758785
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
4+
namespace Distance.ReplayIntensifies.Data
5+
{
6+
public enum CarStyle
7+
{
8+
Ghost_Outline,
9+
Ghost_NoOutline,
10+
Networked_Outline,
11+
Networked_NoOutline,
12+
Replay_Outline,
13+
Replay_NoOutline,
14+
}
15+
16+
public static class CarStyleExtensions
17+
{
18+
public static CarStyle[] GetSupportedMethodsList()
19+
{
20+
return new CarStyle[]
21+
{
22+
CarStyle.Ghost_Outline,
23+
CarStyle.Ghost_NoOutline,
24+
CarStyle.Networked_Outline,
25+
CarStyle.Networked_NoOutline,
26+
CarStyle.Replay_Outline,
27+
CarStyle.Replay_NoOutline,
28+
};
29+
}
30+
31+
public static Dictionary<string, CarStyle> GetSettingsEntries()
32+
{
33+
return GetSupportedMethodsList().ToDictionary(m => m.GetSettingName());
34+
}
35+
36+
public static string GetSettingName(this CarStyle carStyle)
37+
{
38+
string name = carStyle.ToString().Replace('_', ' ');
39+
if (carStyle.HasOutline())
40+
{
41+
name = name.Replace(" Outline", " (Outline)");
42+
}
43+
else
44+
{
45+
name = name.Replace(" NoOutline", " (no Outline)");
46+
}
47+
return name;
48+
}
49+
50+
51+
public static CarStyle ToCarStyle(CarLevelOfDetail.Type detailType, bool outline)
52+
{
53+
switch (detailType)
54+
{
55+
case CarLevelOfDetail.Type.Ghost:
56+
return (outline) ? CarStyle.Ghost_Outline : CarStyle.Ghost_NoOutline;
57+
58+
case CarLevelOfDetail.Type.Networked:
59+
return (outline) ? CarStyle.Networked_Outline : CarStyle.Networked_NoOutline;
60+
61+
case CarLevelOfDetail.Type.Replay:
62+
return (outline) ? CarStyle.Replay_Outline : CarStyle.Replay_NoOutline;
63+
64+
default:
65+
goto case CarLevelOfDetail.Type.Ghost; // Fallback for invalid type
66+
}
67+
}
68+
69+
public static bool HasOutline(this CarStyle carStyle)
70+
{
71+
switch (carStyle)
72+
{
73+
case CarStyle.Ghost_Outline:
74+
case CarStyle.Networked_Outline:
75+
case CarStyle.Replay_Outline:
76+
return true;
77+
78+
case CarStyle.Ghost_NoOutline:
79+
case CarStyle.Networked_NoOutline:
80+
case CarStyle.Replay_NoOutline:
81+
return false;
82+
83+
default:
84+
return false; // Fallback for invalid type
85+
}
86+
}
87+
88+
public static CarLevelOfDetail.Type GetDetailType(this CarStyle carStyle)
89+
{
90+
switch (carStyle)
91+
{
92+
case CarStyle.Ghost_Outline:
93+
case CarStyle.Ghost_NoOutline:
94+
return CarLevelOfDetail.Type.Ghost;
95+
96+
case CarStyle.Networked_Outline:
97+
case CarStyle.Networked_NoOutline:
98+
return CarLevelOfDetail.Type.Networked;
99+
100+
case CarStyle.Replay_Outline:
101+
case CarStyle.Replay_NoOutline:
102+
return CarLevelOfDetail.Type.Replay;
103+
104+
default:
105+
return CarLevelOfDetail.Type.Ghost; // Fallback for invalid type
106+
}
107+
}
108+
}
109+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
5+
namespace Distance.ReplayIntensifies.Data
6+
{
7+
[Flags]
8+
public enum GhostOrReplay
9+
{
10+
Neither = 0,
11+
Ghost_Mode = 0x1,
12+
Replay_Mode = 0x2,
13+
Ghost_And_Replay_Mode = Ghost_Mode | Replay_Mode,
14+
}
15+
16+
public static class GhostOrReplayExtensions
17+
{
18+
public static GhostOrReplay[] GetSupportedMethodsList()
19+
{
20+
return new GhostOrReplay[]
21+
{
22+
GhostOrReplay.Neither,
23+
GhostOrReplay.Ghost_Mode,
24+
GhostOrReplay.Replay_Mode,
25+
GhostOrReplay.Ghost_And_Replay_Mode,
26+
};
27+
}
28+
29+
public static Dictionary<string, GhostOrReplay> GetSettingsEntries()
30+
{
31+
return GetSupportedMethodsList().ToDictionary(m => m.GetSettingName());
32+
}
33+
34+
public static string GetSettingName(this GhostOrReplay ghostOrReplayMethod)
35+
{
36+
string name = ghostOrReplayMethod.ToString().Replace('_', ' ');
37+
name = name.Replace(" And ", " & ");
38+
return name;
39+
}
40+
41+
public static bool HasGhostOrReplay(this GhostOrReplay ghostOrReplayMethod, bool isGhost)
42+
{
43+
if (isGhost)
44+
{
45+
return ghostOrReplayMethod.HasFlag(GhostOrReplay.Ghost_Mode);
46+
}
47+
else
48+
{
49+
return ghostOrReplayMethod.HasFlag(GhostOrReplay.Replay_Mode);
50+
}
51+
}
52+
}
53+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
4+
namespace Distance.ReplayIntensifies.Data
5+
{
6+
public enum LocalLeaderboardTrimming
7+
{
8+
Never, // Never trim replays
9+
Current, // Only trim current replay (if past limit)
10+
Always, // Always trim replays
11+
}
12+
13+
public static class LocalLeaderboardTrimmingExtensions
14+
{
15+
public static LocalLeaderboardTrimming[] GetSupportedMethodsList()
16+
{
17+
return new LocalLeaderboardTrimming[]
18+
{
19+
LocalLeaderboardTrimming.Never,
20+
LocalLeaderboardTrimming.Current,
21+
LocalLeaderboardTrimming.Always,
22+
};
23+
}
24+
25+
public static Dictionary<string, LocalLeaderboardTrimming> GetSettingsEntries()
26+
{
27+
return GetSupportedMethodsList().ToDictionary(m => m.GetSettingName());
28+
}
29+
30+
public static string GetSettingName(this LocalLeaderboardTrimming localLeaderboardTrimmingMethod)
31+
{
32+
string name = localLeaderboardTrimmingMethod.ToString().Replace('_', ' ');
33+
switch (localLeaderboardTrimmingMethod)
34+
{
35+
case LocalLeaderboardTrimming.Current:
36+
name = "Current Run Only";
37+
break;
38+
}
39+
return name;
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)