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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameengine): control bar follows the country, america for the rest
Olcay Seyganebeb96fdc9d7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ac89e3d1b..940ae7d7f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -27,7 +27,7 @@ found and fixed — EA's own, not port damage.**- Reforged stays on top of every mod. This build's balance, its fixes to EA's data, its AI and its menus load after the mod and win where they touch the same unit, weapon or button, so a mod plays with Reforged's rules. A change that names something the mod renamed or removed is passed over instead of stopping the game, which is how ShockWave starts and plays. A mod's own copy of a file Reforged ships, the skirmish setup screen among them, is ignored, and so are any upscaled art archives it carries. The one exception is the skirmish AI's scripts: a mod's are written for its own generals, so they replace Reforged's, and Reforged's smarter AI plays them.- A `mod.json` in the folder names the mod and its version. The names stand beside the version number in the options menu, in the order the mods were given, and go into every replay you record, so a replay made with mods says which ones, and the replay list marks it as another version when the game is running without them.- Joining a LAN game that runs different mods used to end in a box about a mismatch and nothing else. It names the host's mods now, or tells you the host plays without any.-- Two total conversions in one match. Add `-modfactions` to the mods you give, and each mod's armies join Zero Hour's own instead of replacing them: the faction list reads "ShockWave - USA" and "The End of Days - USA" under plain "USA", and a ShockWave army can fight an End of Days one. Each side builds from its own mod's units, weapons, upgrades and generals' powers, and each looks and sounds like its own mod: a ShockWave tank wears ShockWave's model and textures even where The End of Days replaces the same file, and speaks with ShockWave's voice. The End of Days' Russian command center, its Tor-M1 and some sixty other models used to come out bright pink; they wear the mod's own paint now. Playing a mod's faction, your buttons, build pictures, unit names and tooltips are that mod's, set in our American command bar whichever side you picked. The End of Days' Russia is in the list under its own name. Each mod general's promotion screen holds that mod's own powers, with the mod's pictures, and they unlock with your rank. They sit together with no holes between them, and each power's upgrades stand in the column under it, Paradrop 1 over 2 over 3, the way Zero Hour lays out its own. A mod's faction climbs that mod's own ranks: The End of Days' eight, with its own experience steps and points, where Zero Hour's five used to apply to everyone. ShockWave's and The End of Days' screens used to open empty, because a rank granted only Zero Hour's own rank marks and the mod's powers asked for the mod's. Menus, lobby and colours stay ours whatever mods you load. The skirmish AI lays out a mod's base from the mod's own buildings, but it still trains the army it knows from Zero Hour.+- Two total conversions in one match. Add `-modfactions` to the mods you give, and each mod's armies join Zero Hour's own instead of replacing them: the faction list reads "ShockWave - USA" and "The End of Days - USA" under plain "USA", and a ShockWave army can fight an End of Days one. Each side builds from its own mod's units, weapons, upgrades and generals' powers, and each looks and sounds like its own mod: a ShockWave tank wears ShockWave's model and textures even where The End of Days replaces the same file, and speaks with ShockWave's voice. The End of Days' Russian command center, its Tor-M1 and some sixty other models used to come out bright pink; they wear the mod's own paint now. Playing a mod's faction, your buttons, build pictures, unit names and tooltips are that mod's, set in our command bar for that general's country: a mod's Chinese general gets the Chinese bar, a GLA one the GLA bar, and a nation Zero Hour never had, Russia among them, the American one. Every mod general used to get the American bar. The End of Days' Russia is in the list under its own name. Each mod general's promotion screen holds that mod's own powers, with the mod's pictures, and they unlock with your rank. They sit together with no holes between them, and each power's upgrades stand in the column under it, Paradrop 1 over 2 over 3, the way Zero Hour lays out its own. A mod's faction climbs that mod's own ranks: The End of Days' eight, with its own experience steps and points, where Zero Hour's five used to apply to everyone. ShockWave's and The End of Days' screens used to open empty, because a rank granted only Zero Hour's own rank marks and the mod's powers asked for the mod's. Menus, lobby and colours stay ours whatever mods you load. The skirmish AI lays out a mod's base from the mod's own buildings, but it still trains the army it knows from Zero Hour.- A patch for a mod stays with that mod. Give it with `-modpatch` right after the mod it changes, and its files replace that mod's one for one, even beside a second total conversion: a ShockWave balance patch reaches ShockWave's armies and leaves The End of Days alone. Given first, a patch changes Zero Hour's own files. The launcher's MODS page marks each mod a patch or a full mod, and a `mod.json` can say `"patch": true`. With two full mods switched on the launcher now plays them side by side; before, ShockWave and The End of Days together stopped the game at startup.- Contra and The Power of the West start and play now, The Power of the West beside ShockWave too; every one of those used to crash while loading. Contra's China base fell over the carpet bombers it never had, and one misspelt armour line in The Power of the West stopped the game where Zero Hour itself had shrugged it off. A mod's patch archive named to sort first, like Contra's `!!` one, wins over the rest of the mod again, as it always did in Zero Hour.diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.hindex 1ea1c38d3..a7302afd4 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h@@ -292,7 +292,7 @@ public:private:ControlBarScheme *findSchemeForSide( const AsciiString& side ) const; ///< the widest of that side's schemes the screen can wear- ControlBarScheme *findSchemeForFaction( AsciiString side, const PlayerTemplate *pt, Bool useSmall ) const; ///< a mod faction wears America's (ControlBarIsModFaction)+ ControlBarScheme *findSchemeForFaction( const AsciiString& side ) const; ///< the side's own, else its country's, else America'sControlBarScheme *m_currentScheme; ///< the current scheme that everythign usesCoord2D m_multiplyer;@@ -309,7 +309,7 @@ private://-----------------------------------------------------------------------------// EXTERNALS ////////////////////////////////////////////////////////////////////------------------------------------------------------------------------------/// a mod's faction, which wears our American bar and tray whatever bar the mod ships (owner's call)+/// a mod's faction, which gets our American power tray and our science layout (owner's call)Bool ControlBarIsModFaction( const PlayerTemplate *pt );#endif // __CONTROL_BAR_SCHEME_H_diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cppindex cb258780a..788395f83 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp@@ -1060,10 +1060,10 @@ ControlBarScheme *ControlBarSchemeManager::findSchemeForSide( const AsciiString&}//------------------------------------------------------------------------------/** The owner's call: a mod's faction plays on our bar, ControlBar Pro's American one, whatever its- * side and whatever bar the mod ships. Its buttons, cameos and portrait are still the mod's. Under- * -modfactions that is a faction with a mod index; under a single -mod every faction is the mod's.- * The observer keeps its own bar. */+/** The owner's call: a mod's faction gets our American power tray and our science layout, whatever+ * .wnd the mod names. Its buttons, cameos and portrait are still the mod's. Under -modfactions that+ * is a faction with a mod index; under a single -mod every faction is the mod's. The observer is+ * none. *///-----------------------------------------------------------------------------Bool ControlBarIsModFaction( const PlayerTemplate *pt ){@@ -1072,15 +1072,23 @@ Bool ControlBarIsModFaction( const PlayerTemplate *pt )return pt->getModIndex() >= 0 || ( !TheGlobalData->m_mods.empty() && !TheGlobalData->m_modFactions );}-ControlBarScheme *ControlBarSchemeManager::findSchemeForFaction( AsciiString side, const PlayerTemplate *pt, Bool useSmall ) const+//-----------------------------------------------------------------------------+/** The bar follows the country. A side with a scheme of its own (Boss and Observer among them) wears+ * it; any other wears its country's by name, the way ControlBarPlateForSide reads a side, so a mod's+ * ChinaCyberGeneral gets China's and its AmericaCyberneticGeneral America's. A side of no country we+ * know (Russia, ECA, the civilians) wears America's. The squished bar does not come here. */+//-----------------------------------------------------------------------------+ControlBarScheme *ControlBarSchemeManager::findSchemeForFaction( const AsciiString& side ) const{- if( ControlBarIsModFaction( pt ) )- {- side.set( "America" );- if( useSmall )- side.concat( "Small" );- }- return findSchemeForSide( side );+ ControlBarScheme *scheme = findSchemeForSide( side );+ if( scheme != NULL )+ return scheme;++ if( side.startsWithNoCase( "China" ) )+ return findSchemeForSide( AsciiString( "China" ) );+ if( side.startsWithNoCase( "GLA" ) )+ return findSchemeForSide( AsciiString( "GLA" ) );+ return findSchemeForSide( AsciiString( "America" ) );}Bool ControlBarSchemeManager::isCurrentSchemePainted( void ) const@@ -1147,33 +1155,26 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayerTemplate( const PlayerTif(!pt)return;AsciiString side = pt->getSide();- if(useSmall)- side.concat("Small");// if we don't have a side, set it to Observer shellif(side.isEmpty())side.set("Observer");// picked again every time, even for the side on screen: a new resolution can want a different// scheme for it (findSchemeForSide), and the multiplier below is the screen's- ControlBarScheme *tempScheme = findSchemeForFaction( side, pt, useSmall );- DEBUG_LOG(("setControlBarSchemeByPlayer used %s as its side\n", side.str()));-+ // the squished bar keeps EA's pick: the side's Small scheme, and none ships, so "Default"+ AsciiString smallSide = side;+ smallSide.concat("Small");+ ControlBarScheme *tempScheme = useSmall ? findSchemeForSide( smallSide ) : findSchemeForFaction( side );if(tempScheme){- // setup the multiplyer value- m_multiplyer.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x;+ DEBUG_LOG(("setControlBarSchemeByPlayer gave side %s the scheme of %s\n", side.str(), tempScheme->m_side.str()));+ m_multiplyer.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x;m_multiplyer.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y;m_currentScheme = tempScheme;}else- {- // well, we couldn't findm_currentScheme = findControlBarScheme("Default");- DEBUG_LOG(("There's no ControlBarScheme with a side of %s", side.str()));-// m_currentScheme = NULL;- }- if(m_currentScheme)- m_currentScheme->init();+ m_currentScheme->init();}//-----------------------------------------------------------------------------void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p)@@ -1196,28 +1197,13 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p)side.set("Observer");// picked again every time, even for the side on screen: a new resolution can want a different// scheme for it (findSchemeForSide), and the multiplier below is the screen's- // the neutral and civilian players have no template, and wear ours- const PlayerTemplate *pt = p->getPlayerTemplate();- ControlBarScheme *tempScheme = findSchemeForFaction( side, pt, FALSE );- DEBUG_LOG(("setControlBarSchemeByPlayer used %s as its side\n", side.str()));-- if(tempScheme)- {- // setup the multiplyer value- m_multiplyer.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x;- m_multiplyer.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y;- m_currentScheme = tempScheme;- }- else- {- // well, we couldn't find- m_currentScheme = findControlBarScheme("Default");- DEBUG_LOG(("There's no ControlBarScheme with a side of %s", side.str()));-// m_currentScheme = NULL;- }- if(m_currentScheme)- m_currentScheme->init();-}+ // the neutral and civilian players are of no country, and wear America's+ m_currentScheme = findSchemeForFaction( side );+ DEBUG_LOG(("setControlBarSchemeByPlayer gave side %s the scheme of %s\n", side.str(), m_currentScheme->m_side.str()));+ m_multiplyer.x = TheDisplay->getWidth() / (Real)m_currentScheme->m_ScreenCreationRes.x;+ m_multiplyer.y = TheDisplay->getHeight() / (Real)m_currentScheme->m_ScreenCreationRes.y;+ m_currentScheme->init();+}//-----------------------------------------------------------------------------