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(gameclient): no empty slots in a mod general's power tray
Olcay Seyganb7dd550a7597
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 24a7f5e0d..93bc34037 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -30,6 +30,7 @@ found and fixed — EA's own, not port damage.**- 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.+- No empty slots in a mod general's power tray. Mods give unrelated powers the same few types, Contra's small Scud Storm counting as a carpet bomb, so a Contra Cybernetic player's tray picked up another faction's button for a power he only held one of the same type as, then hid it, and an empty frame stood where it had been. The tray offers a button now only for the very power you hold, and a slot whose button goes away takes its frame with it.## One interfacediff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex 806ff03be..f38b84375 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -5730,7 +5730,10 @@ void ControlBar::populateSpecialPowerShortcut( Player *player)// owns a power his own faction's shortcut set has no button for, so the silo could be fired// only by finding it on the map and selecting it. Every other faction's shortcut set is asked// for a button that fires a power this player now holds and nothing above has shown. Powers- // behind a science are left out: a general's power is bought, never captured.+ // behind a science are left out: a general's power is bought, never captured. "Holds" means+ // the very power the button names, not one of its kind: mods reuse the few power types for+ // unrelated powers (Contra's small Scud Storm is a carpet bomb by type), and a type match put+ // another faction's button in the tray that update then hid, an empty slot left behind.//for( Int t = 0; t < ThePlayerTemplateStore->getPlayerTemplateCount(); ++t ){@@ -5741,7 +5744,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player)if( otherSet == NULL )continue;- for( Int b = 0; b < MAX_COMMANDS_PER_SET && currentButton < MAX_SPECIAL_POWER_SHORTCUTS; ++b )+ for( Int b = 0; b < MAX_COMMANDS_PER_SET && currentButton < m_currentlyUsedSpecialPowersButtons; ++b ){const CommandButton *captured = otherSet->getCommandButton( b );if( captured == NULL || !BitTest( captured->getOptions(), NEED_SPECIAL_POWER_SCIENCE ) )@@ -5752,7 +5755,8 @@ void ControlBar::populateSpecialPowerShortcut( Player *player)const SpecialPowerType type = power->getSpecialPowerType();if( std::find( shownPowerTypes.begin(), shownPowerTypes.end(), type ) != shownPowerTypes.end() )continue;- if( player->findMostReadyShortcutSpecialPowerOfType( type ) == NULL )+ const Object *holder = player->findMostReadyShortcutSpecialPowerOfType( type );+ if( holder == NULL || holder->getSpecialPowerModule( power ) == NULL )continue;shownPowerTypes.push_back( type );@@ -5910,7 +5914,9 @@ void ControlBar::updateSpecialPowerShortcut( void )switch( availability ){case COMMAND_HIDDEN:+ // the slot's frame goes with its button, or the tray shows an empty slotwin->winHide( TRUE );+ m_specialPowerShortcutButtonParents[ i ]->winHide( TRUE );break;case COMMAND_RESTRICTED:win->winEnable( FALSE );