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): grid keys stay on the 18-key block, grid wins the bar
Olcay Seygan6f06c2531773
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f8a8f4322..0cd6d6f04 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -29,6 +29,7 @@ found and fixed — EA's own, not port damage.**- 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.- 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.## One interface@@ -36,7 +37,7 @@ found and fixed — EA's own, not port damage.**- 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, 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 188 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.- Export and Import on the Hotkeys page take your keys to a file and back, for another PC or a fresh install. Before an import the page tells you how many keys it changes and how many would clash; a file with a line it cannot read changes nothing and quotes that line. Keys for a mod you have not installed come along and wait for 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.+- 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 and B over N the last, so every key on the bar sits in the 18-key block under your left hand and sell stays on N. With the grid on, the grid wins: attack move, stop, guard and rally point take the key of the place they stand on like any other button. The letter on each button changes to match, and type select, select all, stop and the rest that sat on those letters step aside to Z or to keys right of the letters, with the page showing where each went.## The command bar moves to the middle@@ -46,7 +47,7 @@ found and fixed — EA's own, not port damage.**- Your general's powers grow out of the console's right end, a column for each F key with its powers stacked up it, and only the powers you have take any room.- A single unit's name and health stand beside its portrait, and a veteran gets his gold stars there too. Under them sit its main weapon's damage, damage a second and range, and how much of the damage from gunfire, tank shells and rockets its armour stops: +50% in green for a unit that takes half, a minus in red for one that takes more. A Terrorist, or a Combat Bike with one riding it, used to read 999,999 damage and millions a second, the figures of the stand-in charge that kills the rider so his real bomb can go off. They read the bomb now, 500 for the Terrorist's dynamite and 700 for the bike's, and a bomb that goes off once has no damage a second. Your own units and your allies' show as they stand, so a veteran's bonus, a Composite Armor upgrade or Hold the Line shows the moment it lands. An enemy's show only what his veterancy stars already tell you, never his upgrades or battle plans. Click an enemy and his health reads as a share, 64%, because 512/800 would tell you he bought Composite Armor; the upgrade icons under his portrait stay grey for everything his side researched, where retail lit Composite Armor or Supply Lines for anyone who clicked, and light only for what the unit visibly carries, a drone or an Overlord's turret. A group shows every type it holds in the same box, five to a row. Click a type there and only those stay selected; shift-click it and they leave the selection, so the two Rangers that tagged along with your tanks are one click from gone. Watching a match with nothing selected, the empty portrait box is gone and the console is the radar alone; click a unit and the box comes back. Following nobody, the experience bar beside the radar is gone too, since there is no general's rank to fill it.- The match clock hangs from the middle of the top edge with your money in its own box under it. Superweapon countdowns in the top right corner are as big as your general's power buttons. Hold Tab and the scoreboard drops down from it.-- Peace time has its own plate under your money, so the truce clock never pushes the match clock aside. When the last ten seconds start, the countdown hangs straight off that plate.+- Peace time counts down in red at the end of the info strip in the top right corner, PEACE 4:59, down to the last second, and nothing pops up over the middle of the battlefield any more. It stays there with Info Box switched off, alone on the strip, because the truce is a rule of the match. The strip itself was missing from the released game; it is on for everyone now.- A superweapon built, charged or fired anywhere on the map flashes its name in big letters under the clock: "Nuclear Missile launched". Yours are white, an ally's blue, an enemy's red. Each line stays four seconds and fades out. When several land at once they queue and hurry through, two seconds each with one more waiting and one second with a pile behind it, so the last news never sits stale.- Your production queue stands on the console over your selection, five to a row, each row only as long as what is in it. The event feed runs down from the menu key in the top left corner, and the chat sits under it.- Point at the attack, hold position or move key and a card says what it does, in English or Turkish. Those three are painted onto the grid rather than given to a unit, so the game had no card for them and showed nothing. The card stands on top of the command bar like every other button's.@@ -892,7 +893,7 @@ A third pass went through the generals' powers, promotions and unit abilities.- You pick who wears one. `HealthBars` in `Options.ini` takes 0 for everyone, 1 for smart, 2 for the selection only and 3 for nobody. Smart is the one worth trying: a bar over a unit at full health tells you what its absence would have told you, so healthy units go bare and anything that has been hit stays marked, with whatever you have selected or are pointing at readable either way. 2 is what the original game did. The default is 0, so nothing changes until you change it.- A health bar keeps its size against the unit at any resolution. It was a fixed number of pixels wide and three tall, so the bigger the screen the thinner the thread over a tank.-- Health bars are in the owner's colour instead of green to red. A building going up fills its bar in that same colour as it rises, so a glance across the map says whose expansion it is - the seconds written over it already say it is not finished. A disabled building keeps the blue.+- Health bars are green to red again, the way Zero Hour drew them: green at full health, yellow at half, red near the end. For a while they wore the owner's colour, and a red player's healthy tank looked like one about to die. A disabled building keeps the blue.- A building's bar sits above its roof rather than inside its art.- A unit that is inside a transport and also disabled wears the blue bar. Being carried and being knocked out were asked as one question, so the two together answered no: a squad EMP'd inside a bunker, or hacked while riding a Battle Bus, looked perfectly healthy from outside.- A building being captured wears a capture clock under its health bar, filling in the colour of whoever is taking it. The building flashes while a rifleman works on it, which says somebody is at the door and nothing about whether that is nearly over: the choice between driving across to shoot him and carrying on with your fight was made blind. The bar runs from the moment he reaches the door to the moment the building changes hands, and Black Lotus hacking one gets the same bar.diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h b/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.hindex d0b725ae7..2134e83d3 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h@@ -112,9 +112,9 @@ public:/** The key a command button gets: the one the player gave it in Hotkeys.ini (the launcher's* 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 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+ * button alone; upper case. Attack move, stop, guard, rally point, evacuate and sell have 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, fixed orders too, and any other button* (barSlot -1) loses a letter the grid uses. */static WideChar playerButtonKey( const AsciiString& button, WideChar labelKey, Int barSlot,Int commandType );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cppindex 5257fd455..be5048ae8 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp@@ -307,15 +307,15 @@ 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, G, Y and H- * belong to the fixed orders (FIXED_KEYS), so their places take a key off the grid instead: J, K,- * 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', 'R', 'F', 'T', 'M', 'U', 'L' };+ * first six columns and the last column, slots 13 and 14, takes B over N from the keyboard's third+ * row, so sell keeps its N. With grid keys on the grid wins on the bar: a fixed order (FIXED_KEYS)+ * takes its place's key like any other button. The launcher's Hotkeys page draws the same table+ * (hotkeys.js, GRID_KEYS). */+static const WideChar GRID_KEYS[] = { 'Q', 'A', 'W', 'S', 'E', 'D', 'R', 'F', 'T', 'G', 'Y', 'H', 'B', 'N' };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,+/** The owner's fixed keys, 2026-10-12, on every bar while grid keys are off: 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'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). */@@ -423,11 +423,11 @@ WideChar HotKeyManager::playerButtonKey( const AsciiString& button, WideChar lablower.toLower();Int ownMod = -1;const std::string bare = withoutModPrefix( lower.str(), &ownMod );+ if( s_commandGrid && barSlot >= 0 )+ return barSlot < GRID_KEY_COUNT ? GRID_KEYS[ barSlot ] : 0;const WideChar fixed = fixedButtonKey( AsciiString( bare.c_str() ), commandType );if( fixed != 0 )return fixed;- if( s_commandGrid && barSlot >= 0 )- return barSlot < GRID_KEY_COUNT ? GRID_KEYS[ barSlot ] : 0;WideChar letter = labelKey;findPlayerKey( bare, ownMod, &letter );