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): five more player colours

Olcay Seygan526968da4077
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 784dc81cb..522bc4252 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@ found and fixed, EA's own, not port damage.**
---
+## Five more colours
+
+- Crimson, Azure, Salmon, Teal and Lavender join the colour box in every room. EA's list stopped at eight, so the last player into a full room took the one colour left; now he has six to pick from, and everyone's old colours stay as they were. A replay recorded before this change, with a random colour in it, plays out differently.
+
## A handicap for every seat
- The skirmish, LAN and online rooms have a Handicap box at the end of every seat's row, from 100% down to 10%. At 50% every unit that player fields has half its health: his Crusader reads 240 where the same tank reads 480 across the map. His buildings stay at full health.
diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifest
index eabd1b96e..c0fbbbbff 100644
--- a/GeneralsMD/Code/BuildFingerprint.manifest
+++ b/GeneralsMD/Code/BuildFingerprint.manifest
@@ -238,6 +238,7 @@ Data/INI/MappedImages/HandCreated/ReforgedRanksGLA.ini
Data/INI/MappedImages/HandCreated/ReforgedRanksTurkiye.ini
Data/INI/MappedImages/HandCreated/ReforgedRanksUSA.ini
Data/INI/ModernWater.ini
+Data/INI/MultiplayerReforged.ini
Data/INI/ObjectCreationListReforged.ini
Data/INI/ParticleSystemReforged.ini
Data/INI/PlayerTemplateReforged.ini
diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt
index 81b82b127..7352a7646 100644
--- a/GeneralsMD/Code/CMakeLists.txt
+++ b/GeneralsMD/Code/CMakeLists.txt
@@ -2463,6 +2463,7 @@ target_compile_definitions(test_gameengine PRIVATE
GAMEENGINE_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/GameEngine"
FXLIST_REFORGED_INI="${CMAKE_CURRENT_SOURCE_DIR}/Data/INI/FXListReforged.ini"
WEAPON_REFORGED_INI="${CMAKE_CURRENT_SOURCE_DIR}/Data/INI/WeaponReforged.ini"
+ MULTIPLAYER_REFORGED_INI="${CMAKE_CURRENT_SOURCE_DIR}/Data/INI/MultiplayerReforged.ini"
OPTIONS_MENU_WND="${CMAKE_CURRENT_SOURCE_DIR}/Data/Window/Menus/OptionsMenuClassic.wnd"
PLATE_TEXTURE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/Data/Art/Textures")
diff --git a/GeneralsMD/Code/Data/French/Generals.str b/GeneralsMD/Code/Data/French/Generals.str
index e5fbe516e..972508a39 100644
--- a/GeneralsMD/Code/Data/French/Generals.str
+++ b/GeneralsMD/Code/Data/French/Generals.str
@@ -485,6 +485,26 @@ Color:Pink
"Rose"
END
+Color:Crimson
+"Cramoisi"
+END
+
+Color:Azure
+"Azur"
+END
+
+Color:Salmon
+"Saumon"
+END
+
+Color:Teal
+"Sarcelle"
+END
+
+Color:Lavender
+"Lavande"
+END
+
MSG:Testing
"Mary had a little lamb, it's fleece as white as snow."
END
diff --git a/GeneralsMD/Code/Data/German/Generals.str b/GeneralsMD/Code/Data/German/Generals.str
index 82dcd5beb..5ec48b795 100644
--- a/GeneralsMD/Code/Data/German/Generals.str
+++ b/GeneralsMD/Code/Data/German/Generals.str
@@ -441,6 +441,26 @@ Color:Pink
"Rosa"
END
+Color:Crimson
+"Karmesin"
+END
+
+Color:Azure
+"Azur"
+END
+
+Color:Salmon
+"Lachs"
+END
+
+Color:Teal
+"Petrol"
+END
+
+Color:Lavender
+"Lavendel"
+END
+
GUI:ShowBehindBuildings
"Wärmesignatur hinter Gebäuden AN"
END
diff --git a/GeneralsMD/Code/Data/INI/MultiplayerReforged.ini b/GeneralsMD/Code/Data/INI/MultiplayerReforged.ini
new file mode 100644
index 000000000..4ad92a636
--- /dev/null
+++ b/GeneralsMD/Code/Data/INI/MultiplayerReforged.ini
@@ -0,0 +1,35 @@
+; Zero Hour Reforged player colours, loaded after Multiplayer.ini. A slot, a replay and a preference
+; hold a colour as its place in the list, so EA's eight keep theirs and these follow them. Each block
+; appends: the parser compares a block's name with a colour's TooltipName, and those never match.
+;
+; This file lands in the multiplayer checksum.
+
+MultiplayerColor ColorCrimson
+ RGBColor = R:165 G:15 B:45
+ RGBNightColor = R:205 G:45 B:80
+ TooltipName = Color:Crimson
+End
+
+MultiplayerColor ColorAzure
+ RGBColor = R:0 G:165 B:255
+ RGBNightColor = R:0 G:165 B:255
+ TooltipName = Color:Azure
+End
+
+MultiplayerColor ColorSalmon
+ RGBColor = R:240 G:120 B:135
+ RGBNightColor = R:240 G:120 B:135
+ TooltipName = Color:Salmon
+End
+
+MultiplayerColor ColorTeal
+ RGBColor = R:0 G:175 B:140
+ RGBNightColor = R:0 G:175 B:140
+ TooltipName = Color:Teal
+End
+
+MultiplayerColor ColorLavender
+ RGBColor = R:165 G:165 B:255
+ RGBNightColor = R:165 G:165 B:255
+ TooltipName = Color:Lavender
+End
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index d35cfcc24..dd6870f21 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -3704,6 +3704,27 @@ CONTROLBAR:Infa_ToolTipChinaScienceRedGuardTraining
"All Mini-Gunners will be built three ranks above Veteran"
END
+// the fork's player colours (MultiplayerReforged.ini); EA's eight are in the CSF
+Color:Crimson
+"Crimson"
+END
+
+Color:Azure
+"Azure"
+END
+
+Color:Salmon
+"Salmon"
+END
+
+Color:Teal
+"Teal"
+END
+
+Color:Lavender
+"Lavender"
+END
+
// the LAN lobby's error box when the system bound the socket on another adapter; the first %ls is the
// LAN IP chosen in Options, the second the address the system bound instead
GUI:SocketRedirected
diff --git a/GeneralsMD/Code/Data/Russian/Generals.str b/GeneralsMD/Code/Data/Russian/Generals.str
index e1721aa67..1ed02e3cb 100644
--- a/GeneralsMD/Code/Data/Russian/Generals.str
+++ b/GeneralsMD/Code/Data/Russian/Generals.str
@@ -489,6 +489,26 @@ Color:Pink
"Розовый"
END
+Color:Crimson
+"Багровый"
+END
+
+Color:Azure
+"Лазурный"
+END
+
+Color:Salmon
+"Лососевый"
+END
+
+Color:Teal
+"Бирюзовый"
+END
+
+Color:Lavender
+"Лавандовый"
+END
+
MSG:Testing
"Mary had a little lamb, it's fleece as white as snow"
END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index c26016f5b..119f45564 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -489,6 +489,26 @@ Color:Pink
"Pembe"
END
+Color:Crimson
+"Kızıl"
+END
+
+Color:Azure
+"Gök Mavisi"
+END
+
+Color:Salmon
+"Somon"
+END
+
+Color:Teal
+"Turkuaz"
+END
+
+Color:Lavender
+"Lavanta"
+END
+
GUI:ShowBehindBuildings
"Binaların arkasındaki ısı izi AÇIK"
END
diff --git a/GeneralsMD/Code/Data/Ukrainian/Generals.str b/GeneralsMD/Code/Data/Ukrainian/Generals.str
index 70c55e49f..366447498 100644
--- a/GeneralsMD/Code/Data/Ukrainian/Generals.str
+++ b/GeneralsMD/Code/Data/Ukrainian/Generals.str
@@ -489,6 +489,26 @@ Color:Pink
"Рожевий"
END
+Color:Crimson
+"Багряний"
+END
+
+Color:Azure
+"Лазурний"
+END
+
+Color:Salmon
+"Лососевий"
+END
+
+Color:Teal
+"Бірюзовий"
+END
+
+Color:Lavender
+"Лавандовий"
+END
+
MSG:Testing
"Mary had a little lamb, it's fleece as white as snow"
END
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
index d04dd6971..adb2a35c6 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -1146,6 +1146,8 @@ void GameEngine::init( int argc, char *argv[] )
// New sciences only: a name EA already defined stops the load
ini.load( AsciiString( "Data\\INI\\ScienceReforged.ini" ), INI_LOAD_MULTIFILE, &xferCRC );
initSubsystem(TheMultiplayerSettings,"TheMultiplayerSettings", MSGNEW("GameEngineSubsystem") MultiplayerSettings(), &xferCRC, "Data\\INI\\Default\\Multiplayer.ini", "Data\\INI\\Multiplayer.ini");
+ // The fork's player colours, after EA's eight (or a mod's own list)
+ ini.load( AsciiString( "Data\\INI\\MultiplayerReforged.ini" ), INI_LOAD_OVERWRITE, &xferCRC );
initSubsystem(TheTerrainTypes,"TheTerrainTypes", MSGNEW("GameEngineSubsystem") TerrainTypeCollection(), &xferCRC, "Data\\INI\\Default\\Terrain.ini", "Data\\INI\\Terrain.ini");
initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads.ini", "Data\\INI\\Roads.ini");
initSubsystem(TheGlobalLanguageData,"TheGlobalLanguageData",MSGNEW("GameEngineSubsystem") GlobalLanguage, NULL); // must be before the game text
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index f19380cd4..91a96207a 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -1387,6 +1387,70 @@ TEST(fxlist_reforged_ini_parses_and_keeps_its_light)
CHECK_EQ( lit, blocks );
}
+#include "Common/MultiplayerSettings.h"
+
+/* A slot, a replay and a preference hold a colour by its place in the list, so the fork's five have
+ to follow EA's eight and leave them as they were. EA's list is in INIZH.big, so it is copied here. */
+TEST(multiplayer_reforged_ini_appends_five_colours_after_eas_eight)
+{
+ static const struct { const char *tooltip; Int r, g, b, nightR, nightG, nightB; } colours[] =
+ {
+ { "Color:Gold", 221, 226, 13, 221, 226, 13 },
+ { "Color:Red", 255, 0, 0, 255, 0, 0 },
+ { "Color:Blue", 67, 104, 254, 67, 104, 254 },
+ { "Color:Green", 62, 209, 46, 62, 209, 46 },
+ { "Color:Orange", 255, 160, 25, 255, 160, 25 },
+ { "Color:SkyBlue", 50, 215, 230, 50, 215, 230 },
+ { "Color:Purple", 150, 0, 200, 223, 0, 156 },
+ { "Color:Pink", 255, 150, 255, 255, 130, 248 },
+ { "Color:Crimson", 165, 15, 45, 205, 45, 80 },
+ { "Color:Azure", 0, 165, 255, 0, 165, 255 },
+ { "Color:Salmon", 240, 120, 135, 240, 120, 135 },
+ { "Color:Teal", 0, 175, 140, 0, 175, 140 },
+ { "Color:Lavender", 165, 165, 255, 165, 165, 255 },
+ };
+
+ CHECK( bootOnce() );
+
+ std::string eaList;
+ for( Int i = 0; i < 8; ++i )
+ {
+ char block[ 256 ];
+ snprintf( block, sizeof( block ),
+ "MultiplayerColor Color%s\r\n RGBColor = R:%d G:%d B:%d\r\n RGBNightColor = R:%d G:%d B:%d\r\n TooltipName = %s\r\nEnd\r\n\r\n",
+ colours[ i ].tooltip + 6, colours[ i ].r, colours[ i ].g, colours[ i ].b,
+ colours[ i ].nightR, colours[ i ].nightG, colours[ i ].nightB, colours[ i ].tooltip );
+ eaList += block;
+ }
+ writeFile( TEST_INI, eaList.c_str() );
+
+ MultiplayerSettings *savedSettings = TheMultiplayerSettings;
+ TheMultiplayerSettings = NEW MultiplayerSettings;
+
+ CHECK( loadIni( TEST_INI ) );
+ CHECK_EQ( TheMultiplayerSettings->getNumColors(), 8 );
+ CHECK( loadIni( MULTIPLAYER_REFORGED_INI ) );
+ CHECK_EQ( TheMultiplayerSettings->getNumColors(), 13 );
+
+ for( Int i = 0; i < 13 && TheMultiplayerSettings->getNumColors() == 13; ++i )
+ {
+ MultiplayerColorDefinition *def = TheMultiplayerSettings->getColor( i );
+ const RGBColor day = def->getRGBValue();
+ const RGBColor night = def->getRGBNightValue();
+ CHECK_STR( def->getTooltipName().str(), colours[ i ].tooltip );
+ CHECK_NEAR( day.red * 255.0f, colours[ i ].r, 0.01f );
+ CHECK_NEAR( day.green * 255.0f, colours[ i ].g, 0.01f );
+ CHECK_NEAR( day.blue * 255.0f, colours[ i ].b, 0.01f );
+ CHECK_NEAR( night.red * 255.0f, colours[ i ].nightR, 0.01f );
+ CHECK_NEAR( night.green * 255.0f, colours[ i ].nightG, 0.01f );
+ CHECK_NEAR( night.blue * 255.0f, colours[ i ].nightB, 0.01f );
+ }
+
+ delete TheMultiplayerSettings;
+ TheMultiplayerSettings = savedSettings;
+ remove( TEST_INI );
+}
+
/* ReleaseCrashInfo.txt's stack trace is the only stack this port gets - there is
no debugger on the porting machine - and it came back empty on the first real
crash, which is worth catching here rather than in the middle of a launch. */