Skip to content

Commit 8fcb43e

Browse files
CnCRAZERMetadorius
andauthored
DisableGameSpeed support (#53)
* Beginning Stages * rename hook declarations * Restore observer gamespeed changes for skirmish attempt * Fix spaces to tab idents * Testing #3 or w/e * reverse naming scheme to make it not inversed * Remove networking patches Remove networking patches * Simplifies GameSpeedSlider logic Removes the redundant `IsDisabled` method and inverts the logic where it was used. This simplifies the code and makes it easier to understand the enabled/disabled state of the game speed slider. * Redo `DisableGameSpeed`, remove redundant code --------- Co-authored-by: Metadorius <[email protected]>
1 parent 94b62dd commit 8fcb43e

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/Misc/Observers.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,15 @@ DEFINE_HOOK(0x658473, RadarClass__658330_SetObserverFlag, 0x5)
7373

7474
#pragma endregion HouseClass is Observer
7575

76-
// Allow skirmish observer to control gamespeed
77-
// TODO: Allow control speed in skirmish if all human players is Observer
7876
DEFINE_HOOK(0x4E20BA, GameControlsClass__SomeDialog, 0x5)
7977
{
8078
enum { AllowControlSpeed = 0x4E211A, ForbidControlSpeed = 0x4E20C3 };
8179

80+
if (Spawner::Enabled && Spawner::GetConfig()->DisableGameSpeed)
81+
return ForbidControlSpeed;
82+
83+
// Allow skirmish observer to control gamespeed (vanilla game doesn't allow this)
84+
// TODO: Allow control speed in skirmish if all human players is Observer
8285
return (SessionClass::IsSkirmish() && Game::ObserverMode)
8386
? AllowControlSpeed
8487
: 0;

src/Spawner/Spawner.Config.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ void SpawnerConfig::LoadFromINIFile(CCINIClass* pINI)
108108
// Extended Options
109109
{
110110
Ra2Mode = pINI->ReadBool(pSettingsSection, "Ra2Mode", Ra2Mode);
111+
DisableGameSpeed = pINI->ReadBool(pSettingsSection, "DisableGameSpeed", DisableGameSpeed);
111112
QuickMatch = pINI->ReadBool(pSettingsSection, "QuickMatch", QuickMatch);
112113
SkipScoreScreen = pINI->ReadBool(pSettingsSection, "SkipScoreScreen", SkipScoreScreen);
113114
WriteStatistics = pINI->ReadBool(pSettingsSection, "WriteStatistics", WriteStatistics);

src/Spawner/Spawner.Config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ class SpawnerConfig
137137

138138
// Extended Options
139139
bool Ra2Mode;
140+
bool DisableGameSpeed;
140141
bool QuickMatch;
141142
bool SkipScoreScreen;
142143
bool WriteStatistics;
@@ -229,6 +230,7 @@ class SpawnerConfig
229230

230231
// Extended Options
231232
, Ra2Mode { false }
233+
, DisableGameSpeed { false }
232234
, QuickMatch { false }
233235
, SkipScoreScreen { Main::GetConfig()->SkipScoreScreen }
234236
, WriteStatistics { false }

0 commit comments

Comments
 (0)