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): alt-tab no longer leaves you in waypoint mode
Olcay Seyganb7adcb66c8df
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f68738760..dd0f1f720 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -377,6 +377,7 @@ found and fixed — EA's own, not port damage.**- Closing a dialog while another one sits on top of it no longer leaves the game holding a pointer to the window it just freed. Every click, every keypress and the tab order all read that list, so what it caused was a crash with no pattern to it.- Ordering a group to use a special power that can kill the units casting it, the GLA rebel ambush over water being the one that does it every time, no longer walks a list of units that the ambush is deleting underneath.- A replay that never recorded which seat was yours plays instead of crashing before the map loads.+- Alt-tabbing back into the game no longer leaves you in waypoint mode. Alt is the key you hold to lay a route and it is also the key you hold to alt-tab, so the release went to Windows and the game never heard it: every click after that queued another waypoint. Ctrl, shift and the keypad camera keys were the same story.- Alt-tabbing away with an arrow key held no longer leaves the camera sliding that way when you come back. The key release goes to whatever you switched to, so the game never heard it; losing focus now ends the scroll, the middle-button pan and the ALT pitch drag along with it.- Locking Windows mid-battle no longer eats the game. Nothing that renders runs while the screen is locked, and the particle bookkeeping had been filed under rendering, so every explosion while you were away was created and never cleared up. A hundred rocket buggies firing at the ground for a minute is enough to come back to a game that has run out of memory or simply stopped responding.- Lowercasing a long name no longer writes off the end of a 2,048 character buffer and takes the game with it. That path handles every file inside an archive and every map name, including one arriving from a host over the network, so it was reachable from outside.diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex e498b50ea..69d851a28 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -602,6 +602,7 @@ public: // ********************************************************************virtual void setRadiusCursorForRadius(Real radius);virtual void setInputEnabled( Bool enable ); ///< Set the input enabled or disabled+ virtual void clearModifierModes( void ); ///< forget every mode a held key puts us in (see the definition)virtual Bool getInputEnabled( void ) { return m_inputEnabled; } ///< Get the current input statusvirtual void disregardDrawable( Drawable *draw ); ///< Drawable is being destroyed, clean up any UI elements associated with itdiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 708992dea..7805e6454 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -4190,25 +4190,33 @@ void InGameUI::setInputEnabled( Bool enable )if (wasEnabled && !enable){- /*- when input is disabled, clear out all the special "modes" we can be in, since we can miss- the "exit mode" message during the cinematic. e.g., hold down the ctrl key when a cinematic- begins, then release it during the cinematic... since input is disabled, we never see the keyup- and thus think we're still in forceattack when its done, until you jiggle that key again.- (admittedly, this code will actually do the wrong thing if you were to hold down the ctrl- key thru the whole cinematic, but that's even more unlikely...)- */- setForceAttackMode( false ); // CTRL- setForceMoveMode( false ); // apparently unmapped in current CommandMap.ini- setWaypointMode( false ); // ALT- setPreferSelectionMode( false ); // SHIFT- setCameraRotateLeft( false ); // KP4- setCameraRotateRight( false ); // KP6- setCameraZoomIn( false ); // KP8- setCameraZoomOut( false ); // KP2+ clearModifierModes();}}+//-------------------------------------------------------------------------------------------------+/** Forget every "mode" a held key puts us in.+ *+ * Two things can eat the key release that would normally end one of these. A cinematic disables+ * input, so a ctrl held as it starts and let go during it is never seen released, and the game+ * still thinks you are force-attacking when it ends. Losing the window's focus does the same+ * thing and is the one a player meets: alt-tab out with alt held - which is how you alt-tab -+ * and you come back in waypoint mode, laying a route with every click, until you press and+ * release alt once more. WinMain calls this from both focus messages, next to the keyboard's+ * own reset. */+//-------------------------------------------------------------------------------------------------+void InGameUI::clearModifierModes( void )+{+ setForceAttackMode( false ); // CTRL+ setForceMoveMode( false ); // apparently unmapped in current CommandMap.ini+ setWaypointMode( false ); // ALT+ setPreferSelectionMode( false ); // SHIFT+ setCameraRotateLeft( false ); // KP4+ setCameraRotateRight( false ); // KP6+ setCameraZoomIn( false ); // KP8+ setCameraZoomOut( false ); // KP2+}+//-------------------------------------------------------------------------------------------------/** Drawable is being destroyed, clean up any UI elements associated with it. *///-------------------------------------------------------------------------------------------------diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cppindex bf8fb2677..de0b0eafe 100644--- a/GeneralsMD/Code/Main/WinMain.cpp+++ b/GeneralsMD/Code/Main/WinMain.cpp@@ -438,6 +438,8 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message,//if( TheLookAtTranslator )TheLookAtTranslator->resetModes();+ if( TheInGameUI )+ TheInGameUI->clearModifierModes();if (TheWin32Mouse)TheWin32Mouse->lostFocus(FALSE);@@ -471,7 +473,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message,if (TheKeyboard )TheKeyboard->resetKeys();if( TheLookAtTranslator )- TheLookAtTranslator->resetModes(); // see WM_SETFOCUS above+ TheLookAtTranslator->resetModes();+ if( TheInGameUI )+ TheInGameUI->clearModifierModes(); // see WM_SETFOCUS aboveif (TheWin32Mouse)TheWin32Mouse->lostFocus(TRUE);