Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameclient): stop the skirmish game speed slider at 60

Olcay Seyganb04ff3cd81ce
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb50ee475..6c5cbc459 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -470,6 +470,7 @@ found and fixed — EA's own, not port damage.**
- Every lobby now has two tabs over the bottom panel, Info and Lobby Settings, and the one you are looking at is the one greyed out. The host's settings live on the settings page; the map details in skirmish and the chat log in a network game come back the moment you tab away from it.
- Skirmish keeps starting cash and the game speed slider there. LAN and online keep starting cash next to peace time and the superweapon rule. Before this they were scattered around whatever space each of the three lobby screens happened to have left over.
+- The game speed slider stops at 60. Its last notch used to read "--" and started the match at a thousand game frames a second, which no machine can play and every machine tried to. A speed saved on that notch comes back as 60.
- Superweapons are a dropdown instead of a tick box. Allow Superweapons is the game as it plays without a rule. Limit Superweapons leaves each player one Particle Cannon, one Nuclear Missile or one Scud Storm at a time. No Superweapons bars them.
- The USA Superweapon General is the exception to both, because the rule that reads as a handicap to everyone else reads as a deletion to him: three superweapons of his own are what he pays for weaker tanks, weaker infantry and a worse air force with. Under Limit he keeps four of each of his. Under No he keeps one. Play him against a lobby that has banned superweapons and you are playing the army you paid for, not an empty base.
- The tick box was one number for everybody, which is why it could only ever say yes or no. A ticked box in a settings file from an older build reads back as No Superweapons.
diff --git a/GeneralsMD/Code/Data/Window/Menus/SkirmishGameOptionsMenu.wnd b/GeneralsMD/Code/Data/Window/Menus/SkirmishGameOptionsMenu.wnd
index cb71c65c5..a55ae4722 100644
--- a/GeneralsMD/Code/Data/Window/Menus/SkirmishGameOptionsMenu.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/SkirmishGameOptionsMenu.wnd
@@ -9647,7 +9647,7 @@ WINDOW
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
SLIDERDATA = MINVALUE: 15,
- MAXVALUE: 61;
+ MAXVALUE: 60;
SLIDERTHUMBENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 128 128 255, BORDERCOLOR: 255 0 0 255,
IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
index 6cb24a00e..0d7af364f 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
@@ -160,7 +160,10 @@ static Bool buttonPushed = FALSE;
static Bool stillNeedsToSetOptions = FALSE;
void skirmishUpdateSlotList( void );
static void populateSkirmishBattleHonors( void );
-enum{ GREATER_NO_FPS_LIMIT = 60};
+// The slider used to run one notch past 60 to a "--" that started the match at 1000 logic frames a
+// second. It is 15 to 60 now, and a preference saved at the old top notch lands on 60.
+static const Int SKIRMISH_GAME_SPEED_MIN = 15;
+static const Int SKIRMISH_GAME_SPEED_MAX = 60;
Bool doUpdateSlotList = TRUE;
static Int getNextSelectablePlayer(Int start)
@@ -401,14 +404,7 @@ void setFPSTextBox( Int sliderPos )
return;
UnicodeString text;
staticTextGameSpeed->winEnable(TRUE);
- if(sliderPos > GREATER_NO_FPS_LIMIT)
- {
- // set static text to --
- text.set(L"--");
- GadgetStaticTextSetText(staticTextGameSpeed, text);
- return;
- }
- else if( sliderPos == TheGlobalData->m_framesPerSecondLimit )
+ if( sliderPos == TheGlobalData->m_framesPerSecondLimit )
{
// set different color
staticTextGameSpeed->winEnable(FALSE);
@@ -426,10 +422,7 @@ void reallyDoStart( void )
GameWindow *sliderGameSpeed = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, sliderGameSpeedID );
Int maxFPS = GadgetSliderGetPosition( sliderGameSpeed );
DEBUG_LOG(("GameSpeedSlider was at %d\n", maxFPS));
- if (maxFPS > GREATER_NO_FPS_LIMIT)
- maxFPS = 1000;
- if (maxFPS < 15)
- maxFPS = 15;
+ maxFPS = max( SKIRMISH_GAME_SPEED_MIN, min( SKIRMISH_GAME_SPEED_MAX, maxFPS ) );
TheWritableGlobalData->m_mapName = TheSkirmishGameInfo->getMap();
TheSkirmishGameInfo->startGame(0);
@@ -1395,7 +1388,7 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData )
// set up the game speed slider
// NameKeyType sliderGameSpeedID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:SliderGameSpeed" ) );
GameWindow *sliderGameSpeed = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, sliderGameSpeedID );
- Int sliderPos = max(15,min(61,prefs.getInt("FPS", TheGlobalData->m_framesPerSecondLimit)));
+ Int sliderPos = max(SKIRMISH_GAME_SPEED_MIN,min(SKIRMISH_GAME_SPEED_MAX,prefs.getInt("FPS", TheGlobalData->m_framesPerSecondLimit)));
GadgetSliderSetPosition( sliderGameSpeed, sliderPos );
setFPSTextBox(sliderPos);
buttonStart->winSetText(TheGameText->fetch("GUI:Start"));