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
feat(gameclient): rally on y, sell on n, mines and camo on h
Olcay Seyganf315c74bb253
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bd0241f3c..2ff402e50 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -33,8 +33,8 @@ found and fixed — EA's own, not port damage.**- The choice between a Classic and a Reforged interface is gone. There is one, laid out the way Zero Hour shipped, and the orders Reforged added now live on the keys you already know: A attack-moves, holding Ctrl fires on whatever is under the cursor as it did in 2003, a guard order can cover a patch of ground instead of one spot, and orders queue up one after another. Everything your base is building stands on the screen as a line of text each, the six closest to done first and "+N more" for the rest. Superweapon countdowns are listed the same way, up to eighteen. Both lists are in bold type, the build list in white and each countdown in its owner's colour. The promotion screen no longer darkens the battlefield behind it. Whether the right button gives orders, or the left as in 1.04, is a setting in the launcher.- Every key is yours to move. The launcher's Hotkeys page draws the command bar of every building and unit each general can field, cameos and letters as the game shows them, and a click and a keypress gives any button a new letter or none. Two buttons on one bar that would share a letter are marked before you play. The keyboard commands are there too, from bookmarks and team keys to the camera, along with the ones Zero Hour never bound: select every fighting unit, vehicle or aircraft, every barracks, war factory or airfield, the next idle worker or unit, pause, the general's promotions, the three signals to your allies and the general's powers. Your keys are yours alone; the other players in a match keep theirs, and a match never refuses you for them. Every mod you install brings its own generals to the page, ShockWave's fifteen next to Zero Hour's thirteen, and a key you give a ShockWave button stays with ShockWave.-- Some keys now mean one thing on every bar: A attack move, S stop, G guard, R rally point, V evacuate or sell, C combat drop, and F for land mines, camo netting and the GLA worker's switch to fake buildings. Where a bunker, fire base, palace or tunnel has both evacuate and sell, V empties it and sell moves to O, so a slipped finger never sells a full bunker. The 182 buttons Zero Hour had put on one of those letters take another, kept off the grid keys where the bar leaves room (the Avenger is J now), and no bar gained a clash doing it.-- Grid keys, one switch on the Hotkeys page: a button's key is its place on the bar, so the first button of a Command Center is Q and so is the first of a Barracks, a War Factory or a dozer. The keyboard's Q W E R T Y over A S D F G H covers the first six columns, with the places of A, S, R, F and G, which keep their orders, taking J, K, U, L and M. The bar is two rows deep, so Z X C V B N has no place on it, and the last column is for the mouse. The letter on each button changes to match, and type select, select all, scatter and the rest that sat on those letters step aside, with the page showing where each went.+- Some keys now mean one thing on every bar: A attack move, S stop, G guard, Y rally point, V evacuate, N sell, C combat drop, and H for land mines, camo netting and the GLA worker's switch to fake buildings. Sell sits on its own key, so emptying a bunker can never sell it. The 207 buttons Zero Hour had put on one of those letters take another, kept off the grid keys where the bar leaves room (the Avenger is J now), and no bar gained a clash doing it.+- Grid keys, one switch on the Hotkeys page: a button's key is its place on the bar, so the first button of a Command Center is Q and so is the first of a Barracks, a War Factory or a dozer. The keyboard's Q W E R T Y over A S D F G H covers the first six columns, with the places of A, S, G, Y and H, which keep their orders, taking J, K, M, U and L. The bar is two rows deep, so Z X C V B N has no place on it, and the last column is for the mouse. The letter on each button changes to match, and type select, select all, scatter and the rest that sat on those letters step aside, with the page showing where each went.## The command bar moves to the middlediff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.hindex de423ec04..322d1a1b2 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h@@ -1255,7 +1255,6 @@ protected:GameWindow *m_specialPowerShortcutParent;GameWindow *m_commandWindows[ MAX_COMMANDS_PER_SET ]; ///< command window controls for easy access- Bool m_barHasEvacuate; ///< the command set populateCommand is laying out has an evacuate, which takes sell's V/** A player upgrade is researched once, so it goes to exactly one of the selected buildings -diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h b/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.hindex cac383305..d0b725ae7 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h@@ -113,12 +113,11 @@ public:* Hotkeys page writes it, INI::parseCommandButtonHotKeyDefinition reads it), 0 where the player* took the key away, and labelKey, the letter after the label's '&', where the player left the* button alone; upper case. Attack move, stop, guard, rally point, evacuate and sell always have- * their fixed letters (evacuateOnBar: sell shares the bar with an evacuate) and no other button- * gets one. With grid keys on (INI::parseCommandBarGridDefinition) a button on the command bar,+ * their fixed letters and no other button gets one. With grid keys on (INI::parseCommandBarGridDefinition) a button on the command bar,* barSlot its ButtonCommand number less one, gets its place's key instead, and any other button* (barSlot -1) loses a letter the grid uses. */static WideChar playerButtonKey( const AsciiString& button, WideChar labelKey, Int barSlot,- Int commandType, Bool evacuateOnBar );+ Int commandType );private:typedef std::map<AsciiString, HotKey> HotKeyMap;diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex b836ab67e..8cf3db97f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -1387,7 +1387,6 @@ ControlBar::ControlBar( void ){Int i;m_commandButtons = NULL;- m_barHasEvacuate = FALSE;m_commandSets = NULL;m_controlBarSchemeManager = NULL;m_isObserverCommandBar = FALSE;@@ -4492,7 +4491,7 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *combarSlot = slot;const WideChar letter = HotKeyManager::playerButtonKey( commandButton->getName(),TheGameText ? TheGameText->fetchEnglishHotKey( commandButton->getTextLabel() ) : 0, barSlot,- commandButton->getCommandType(), barSlot >= 0 && m_barHasEvacuate );+ commandButton->getCommandType() );if( letter != 0 ){TheHotKeyManager->addHotKey( button, HotKeyManager::nameOf( letter ) );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cppindex dd87e6f5c..fc6f1e162 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp@@ -384,13 +384,8 @@ void ControlBar::populateCommand( Object *obj )// what goes in each slot: the command set, slot for slotconst CommandButton *slot[ MAX_COMMANDS_PER_SET ];- m_barHasEvacuate = FALSE;- for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) // sell gives V up to an evacuate on the same bar- {+ for( i = 0; i < MAX_COMMANDS_PER_SET; i++ )slot[ i ] = commandSet->getCommandButton( i );- if( slot[ i ] && slot[ i ]->getCommandType() == GUI_COMMAND_EVACUATE )- m_barHasEvacuate = TRUE;- }// populate the button with commands definedconst CommandButton *commandButton;diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cppindex 497e7a919..5257fd455 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp@@ -307,43 +307,41 @@ static std::map< std::string, WideChar > s_playerButtonKeys;/** Grid keys (Hotkeys.ini's CommandBarGrid), by command bar slot: ControlBar.wnd's ButtonCommand01* to 14 stand two rows of seven read down the columns, so Q W E R T Y over A S D F G H take the- * first six columns and the keyboard's third row, Z X C V B N, has no place. A, S, R, F and G+ * first six columns and the keyboard's third row, Z X C V B N, has no place. A, S, G, Y and H* belong to the fixed orders (FIXED_KEYS), so their places take a key off the grid instead: J, K,- * U, L and M. Slots 13 and 14, the last column, get no key. The launcher's Hotkeys page draws+ * M, U and L. Slots 13 and 14, the last column, get no key. The launcher's Hotkeys page draws* the same table (hotkeys.js, GRID_KEYS). */-static const WideChar GRID_KEYS[] = { 'Q', 'J', 'W', 'K', 'E', 'D', 'U', 'L', 'T', 'M', 'Y', 'H' };+static const WideChar GRID_KEYS[] = { 'Q', 'J', 'W', 'K', 'E', 'D', 'R', 'F', 'T', 'M', 'U', 'L' };static const Int GRID_KEY_COUNT = sizeof( GRID_KEYS ) / sizeof( GRID_KEYS[ 0 ] );static Bool s_commandGrid = FALSE;/** The owner's fixed keys, 2026-10-12, on every bar and in both modes: A attack move, S stop,- * G guard, R rally point, V evacuate and sell, C combat drop, and F for land mines, camo netting- * and the GLA's fake and real switches, which go by button name. Where a bar has both evacuate and- * sell, evacuate keeps V and sell takes O. No other button may have one of these letters. The- * launcher holds the same tables (hotkeys.js, FIXED_KEYS). */-static const WideChar FIXED_KEYS[] = { 'A', 'S', 'G', 'R', 'V', 'C', 'F' };-static const WideChar SELL_BESIDE_EVACUATE_KEY = 'O';-static const char *const FIXED_F_BUTTONS[] =+ * G guard, Y rally point, V evacuate, N sell, C combat drop, and H for land mines, camo netting+ * and the GLA's fake and real switches, which go by button name. No other button may have one of+ * these letters. The launcher holds the same tables (hotkeys.js, FIXED_KEYS). */+static const WideChar FIXED_KEYS[] = { 'A', 'S', 'G', 'Y', 'V', 'N', 'C', 'H' };+static const char *const FIXED_H_BUTTONS[] ={"command_upgradechinamines", "command_upgradeempmines", "command_upgradecamonetting", "command_upgradeglacamonetting","command_upgradeglaworkerfakecommandset", "command_upgradeglaworkerrealcommandset"};-static const char FIXED_F_PREFIX[] = "command_becomerealgla"; ///< a fake building's switch to the real one+static const char FIXED_H_PREFIX[] = "command_becomerealgla"; ///< a fake building's switch to the real one-static WideChar fixedButtonKey( const AsciiString& lowerName, Int commandType, Bool evacuateOnBar )+static WideChar fixedButtonKey( const AsciiString& lowerName, Int commandType ){- if( strncmp( lowerName.str(), FIXED_F_PREFIX, sizeof( FIXED_F_PREFIX ) - 1 ) == 0 )- return 'F';- for( Int each = 0; each < (Int)( sizeof( FIXED_F_BUTTONS ) / sizeof( FIXED_F_BUTTONS[ 0 ] ) ); each++ )- if( lowerName.compare( FIXED_F_BUTTONS[ each ] ) == 0 )- return 'F';+ if( strncmp( lowerName.str(), FIXED_H_PREFIX, sizeof( FIXED_H_PREFIX ) - 1 ) == 0 )+ return 'H';+ for( Int each = 0; each < (Int)( sizeof( FIXED_H_BUTTONS ) / sizeof( FIXED_H_BUTTONS[ 0 ] ) ); each++ )+ if( lowerName.compare( FIXED_H_BUTTONS[ each ] ) == 0 )+ return 'H';switch( commandType ){case GUI_COMMAND_ATTACK_MOVE: return 'A';case GUI_COMMAND_STOP: return 'S';case GUI_COMMAND_GUARD: return 'G';- case GUI_COMMAND_SET_RALLY_POINT: return 'R';+ case GUI_COMMAND_SET_RALLY_POINT: return 'Y';case GUI_COMMAND_EVACUATE: return 'V';- case GUI_COMMAND_SELL: return evacuateOnBar ? SELL_BESIDE_EVACUATE_KEY : 'V';+ case GUI_COMMAND_SELL: return 'N';case GUI_COMMAND_COMBATDROP: return 'C';}return 0;@@ -419,13 +417,13 @@ static Bool isOneOf( WideChar letter, const WideChar *letters, Int count )//-----------------------------------------------------------------------------WideChar HotKeyManager::playerButtonKey( const AsciiString& button, WideChar labelKey, Int barSlot,- Int commandType, Bool evacuateOnBar )+ Int commandType ){AsciiString lower = button;lower.toLower();Int ownMod = -1;const std::string bare = withoutModPrefix( lower.str(), &ownMod );- const WideChar fixed = fixedButtonKey( AsciiString( bare.c_str() ), commandType, evacuateOnBar );+ const WideChar fixed = fixedButtonKey( AsciiString( bare.c_str() ), commandType );if( fixed != 0 )return fixed;if( s_commandGrid && barSlot >= 0 )