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(gameengine): keep Pro Rules to LAN and online games

Olcay Seygan6028c1c05139
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96221a891..5bf876c9e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -480,10 +480,10 @@ found and fixed — EA's own, not port damage.**
- 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.
-## Pro Rules, in every skirmish and network game
+## Pro Rules, in every network game
-- A fixed list of units, upgrades and tricks is out of every skirmish, LAN and online match. There is no warning and no penalty after the fact: the button is grey and it stays grey. The campaign and the Generals Challenge play the way they always did.
-- It is one box on the lobby settings page, Pro Rules, ticked unless the host clears it. The host's choice goes to everyone in the room and into the replay, and the lobby remembers it for next time. A host on an older build has no box to send, so that game plays without the list.
+- A fixed list of units, upgrades and tricks is out of every LAN and online match. There is no warning and no penalty after the fact: the button is grey and it stays grey. A skirmish against the computer has the whole arsenal, and so do the campaign and the Generals Challenge.
+- It is one box on the network lobby's settings page, Pro Rules, ticked unless the host clears it. The skirmish lobby has no such box. The host's choice goes to everyone in the room and into the replay, and the lobby remembers it for next time. A host on an older build has no box to send, so that game plays without the list.
- No Particle Cannon and no SCUD Storm. The USA Superweapon General keeps one Particle Cannon, because a general who paid for his superweapons with a weaker army and then may not build any is playing half a faction.
- The Nuclear Missile silo still goes up, since it is where China buys Nuclear Tanks and Uranium Shells. The missile inside it never launches, and nobody's screen counts down to it.
- No Aurora Bomber, the Air Force General's Alpha Aurora included, and no Tactical Nuke upgrade for the Nuke General's MiGs.
diff --git a/GeneralsMD/Code/Data/Window/Menus/SkirmishGameOptionsMenu.wnd b/GeneralsMD/Code/Data/Window/Menus/SkirmishGameOptionsMenu.wnd
index 0b1e50fbb..17cc2fbe2 100644
--- a/GeneralsMD/Code/Data/Window/Menus/SkirmishGameOptionsMenu.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/SkirmishGameOptionsMenu.wnd
@@ -9899,53 +9899,6 @@ WINDOW
IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
END
CHILD
- WINDOW
- WINDOWTYPE = CHECKBOX;
- SCREENRECT = UPPERLEFT: 336 468, BOTTOMRIGHT: 536 492, CREATIONRESOLUTION: 800 600;
- NAME = "SkirmishGameOptionsMenu.wnd:CheckBoxProRules";
- STATUS = ENABLED+IMAGE;
- STYLE = CHECKBOX+MOUSETRACK;
- SYSTEMCALLBACK = "[None]";
- INPUTCALLBACK = "[None]";
- TOOLTIPCALLBACK = "[None]";
- DRAWCALLBACK = "[None]";
- FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
- HEADERTEMPLATE = "TextEntry";
- TOOLTIPTEXT = "TOOLTIP:ProRules";
- TOOLTIPDELAY = -1;
- TEXT = "GUI:ProRules";
- TEXTCOLOR = ENABLED: 254 254 254 255, ENABLEDBORDER: 0 0 0 255,
- DISABLED: 140 138 138 255, DISABLEDBORDER: 64 64 64 255,
- HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
- ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
- IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
- IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
- DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
- IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,
- IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
- HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,
- IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
- IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
- IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
- END
- CHILD
WINDOW
WINDOWTYPE = CHECKBOX;
SCREENRECT = UPPERLEFT: 336 436, BOTTOMRIGHT: 536 460, CREATIONRESOLUTION: 800 600;
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 b692e12ec..319baf279 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
@@ -121,7 +121,6 @@ static NameKeyType staticTextGameSpeedID = NAMEKEY_INVALID;
static NameKeyType comboBoxSuperweaponsID = NAMEKEY_INVALID;
static NameKeyType comboBoxStartingCashID = NAMEKEY_INVALID;
static NameKeyType checkBoxUnitLimitID = NAMEKEY_INVALID;
-static NameKeyType checkBoxProRulesID = NAMEKEY_INVALID;
// Window Pointers ------------------------------------------------------------------------
static GameWindow *staticTextGameSpeed = NULL;
@@ -136,7 +135,6 @@ static GameWindow *textEntryPlayerName = NULL;
static GameWindow *comboBoxSuperweapons = NULL;
static GameWindow *comboBoxStartingCash = NULL;
static GameWindow *checkBoxUnitLimit = NULL;
-static GameWindow *checkBoxProRules = NULL;
static GameWindow *comboBoxPlayer[MAX_SLOTS] = {NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL };
@@ -368,7 +366,6 @@ Bool SkirmishPreferences::write(void)
setStartingCash( TheSkirmishGameInfo->getStartingCash() );
setSuperweaponRestriction( TheSkirmishGameInfo->getSuperweaponRestriction() );
setInt( "UnitLimit", TheSkirmishGameInfo->getUnitLimit() ? 1 : 0 );
- setInt( "ProRules", TheSkirmishGameInfo->getProRules() ? 1 : 0 );
setSlotList();
@@ -1088,7 +1085,6 @@ void InitSkirmishGameGadgets( void )
comboBoxSuperweaponsID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:ComboBoxSuperweapons" ) );
comboBoxStartingCashID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:ComboBoxStartingCash" ) );
checkBoxUnitLimitID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:CheckBoxUnitLimit" ) );
- checkBoxProRulesID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:CheckBoxProRules" ) );
// Initialize the pointers to our gadgets
parentSkirmishGameOptions = TheWindowManager->winGetWindowFromId( NULL, parentSkirmishGameOptionsID );
@@ -1117,10 +1113,6 @@ void InitSkirmishGameGadgets( void )
DEBUG_ASSERTCRASH(checkBoxUnitLimit, ("Could not find the checkBoxUnitLimit"));
if ( checkBoxUnitLimit )
UpdateUnitLimitCheckBox( checkBoxUnitLimit, TheSkirmishGameInfo, TRUE );
- checkBoxProRules = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, checkBoxProRulesID );
- DEBUG_ASSERTCRASH(checkBoxProRules, ("Could not find the checkBoxProRules"));
- if ( checkBoxProRules )
- UpdateProRulesCheckBox( checkBoxProRules, TheSkirmishGameInfo, TRUE );
textEntryPlayerNameID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:TextEntryPlayerName" ) );
textEntryPlayerName = TheWindowManager->winGetWindowFromId( NULL, textEntryPlayerNameID );
@@ -1295,8 +1287,6 @@ void updateSkirmishGameOptions( void )
UpdateSuperweaponComboBox( comboBoxSuperweapons, TheSkirmishGameInfo, TRUE );
if ( checkBoxUnitLimit )
UpdateUnitLimitCheckBox( checkBoxUnitLimit, TheSkirmishGameInfo, TRUE );
- if ( checkBoxProRules )
- UpdateProRulesCheckBox( checkBoxProRules, TheSkirmishGameInfo, TRUE );
Int itemCount = GadgetComboBoxGetLength(comboBoxStartingCash);
for ( Int index = 0; index < itemCount; index++ )
{
@@ -1381,7 +1371,8 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData )
TheSkirmishGameInfo->setStartingCash( prefs.getStartingCash() );
TheSkirmishGameInfo->setSuperweaponRestriction( prefs.getSuperweaponRestriction() );
TheSkirmishGameInfo->setUnitLimit( prefs.getInt( "UnitLimit", 0 ) != 0 );
- TheSkirmishGameInfo->setProRules( prefs.getInt( "ProRules", 1 ) != 0 );
+ // Pro Rules are for people playing each other; a skirmish against the computer never has them.
+ TheSkirmishGameInfo->setProRules( FALSE );
TheSkirmishGameInfo->setMap(prefs.getPreferredMap());
const MapMetaData *md = TheMapCache->findMap(TheSkirmishGameInfo->getMap());
@@ -1669,11 +1660,6 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned
TheSkirmishGameInfo->setUnitLimit( GadgetCheckBoxIsChecked( control ) );
break;
}
- if ( controlID == checkBoxProRulesID )
- {
- TheSkirmishGameInfo->setProRules( GadgetCheckBoxIsChecked( control ) );
- break;
- }
if ( LobbyTabClicked( (NameKeyType)controlID ) )
break;
if ( controlID == buttonExitID )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
index a005db6d1..832a28429 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
@@ -1236,12 +1236,13 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
m_unitCap = 0;
}
- /* Pro Rules hold in the modes people play each other in, when the lobby's check box is ticked.
- A replay asks the mode it was recorded in, or a skirmish that refused an Aurora would play
- back one that built it; the box itself travels in the replay's options string as PR. */
+ /* Pro Rules hold in the modes people play each other in, when the lobby's check box is ticked,
+ and never in a skirmish, which has no box. A replay asks the mode it was recorded in, or a
+ LAN game that refused an Aurora would play back as a skirmish that built it; the box itself
+ travels in the replay's options string as PR. */
const Int proRulesMode = (TheRecorder && TheRecorder->getMode() == RECORDERMODETYPE_PLAYBACK)
? TheRecorder->getGameMode() : m_gameMode;
- m_proRules = (proRulesMode == GAME_SKIRMISH || proRulesMode == GAME_LAN || proRulesMode == GAME_INTERNET)
+ m_proRules = (proRulesMode == GAME_LAN || proRulesMode == GAME_INTERNET)
&& TheGameInfo && TheGameInfo->getProRules();
/* -unitlimit is the lobby's check box for an -autoskirmish run, which has no lobby to tick it
in. A network game reads the host's options string instead, and the switch is cleared for
diff --git a/GeneralsMD/Code/Tools/lobbyroom_layout.py b/GeneralsMD/Code/Tools/lobbyroom_layout.py
index 7b74e06bf..c798da81e 100644
--- a/GeneralsMD/Code/Tools/lobbyroom_layout.py
+++ b/GeneralsMD/Code/Tools/lobbyroom_layout.py
@@ -91,8 +91,7 @@ LAN_COLUMNS = [
# "Allow Superweapons" needs 152 at 800x600.
SKIRMISH_SETTINGS = [
(96, 152, [("StartingCashLabel", "ComboBoxStartingCash"), ("LabelSuperweapons", "ComboBoxSuperweapons")]),
- (88, 112, [("LabelGameSpeed", "SliderGameSpeed", "StaticTextGameSpeed"), ("CheckBoxUnitLimit",),
- ("CheckBoxProRules",)]),
+ (88, 112, [("LabelGameSpeed", "SliderGameSpeed", "StaticTextGameSpeed"), ("CheckBoxUnitLimit",)]),
]
# The LAN page is 84 high over the chat entry, two rows, so Pro Rules takes a third column instead.
LAN_SETTINGS = [
diff --git a/GeneralsMD/Code/Tools/lobbysettings_layout.py b/GeneralsMD/Code/Tools/lobbysettings_layout.py
index 7a757bb5d..4a66356c8 100644
--- a/GeneralsMD/Code/Tools/lobbysettings_layout.py
+++ b/GeneralsMD/Code/Tools/lobbysettings_layout.py
@@ -126,6 +126,10 @@ SUPERWEAPON_CHECKBOX = ("CheckboxLimitSuperweapons", "CheckBoxLimitSuperweapons"
# menu code names them and a missing control is as silent as the rest.
HAND_PLACED_CHECKBOXES = ("CheckBoxUnitLimit", "CheckBoxProRules")
+# Pro Rules are for people playing each other, so the skirmish page lost its box again for v1.0.0 and
+# the selfcheck wants it gone there rather than present.
+NO_PRO_RULES_MENU = "SkirmishGameOptionsMenu"
+
# Cloned from a control that is already on the screen, so they inherit its images and font. A
# layout gets the ones its own page has a row for: the skirmish lobby has no peace time, because a
# skirmish is played against computer players and those do not honour a truce.
@@ -290,7 +294,10 @@ def selfcheck():
for name in HAND_PLACED_CHECKBOXES:
checkbox = layout.find(name)
- if checkbox is None:
+ if menu == NO_PRO_RULES_MENU and name == "CheckBoxProRules":
+ if checkbox is not None:
+ problems.append("%s.wnd still carries %s; a skirmish has no Pro Rules" % (menu, name))
+ elif checkbox is None:
problems.append("%s.wnd has no %s" % (menu, name))
elif page is not None and checkbox not in list(page.walk()):
problems.append("%s.wnd: %s is not on the settings page" % (menu, name))