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): skip the flash for a button the menu lacks
Olcay Seygan9bf1bd3ff5b8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2c4f653d7..64ade3736 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -689,6 +689,7 @@ found and fixed — EA's own, not port damage.**- Starting a match with the Direct3D 11 picture on took the game down. Both devices were presenting into the same window, the old one lost itself, and the fog texture then locked a surface that was never made.- A machine whose graphics stack faults while the Direct3D 11 picture is being set up starts the game anyway, on the Direct3D 9 picture. A player's report showed the fault happening inside Windows' own graphics library, before the game got an answer back, and it ended in "Uncaught Exception during initialization". An overlay hooking the graphics calls or a stray dxgi.dll in the game folder is the usual cause. Until now the only way past it was typing -d3d9.- The opening movies froze on their first frame with that picture on. A movie writes a new image every frame into a texture the copy had already taken.+- Opening Single Player could take the game down a quarter of a second in, as the buttons flashed in. The menu's animation list names a Custom Mission button that only the 1.04 patch's main menu has, and on an install whose menu lacks it, every step of the flash skipped the missing button except one, which tried to draw it. That step skips it now too.- Two blocks of 2003 assembly destroyed registers and took down the main menu.- Quitting faulted twice every time; it now takes about half a second.- A long chat message or an unusual map name could kill the process.diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cppindex 87fbb5923..0d1fdb1bd 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp@@ -487,7 +487,9 @@ void ButtonFlashTransition::update( Int frame )}break;}- if(frame > BUTTONFLASHTRANSITION_FADE_TO_BACKGROUND_4 && frame < BUTTONFLASHTRANSITION_FADE_TO_GRADE_IN_1)+ // Every case above leaves a button the .wnd does not have undrawn, and so must this one: the+ // single player groups name ButtonCustomMission, which only the 1.04 patch's MainMenu.wnd carries.+ if(m_win && frame > BUTTONFLASHTRANSITION_FADE_TO_BACKGROUND_4 && frame < BUTTONFLASHTRANSITION_FADE_TO_GRADE_IN_1)m_drawState = BUTTONFLASHTRANSITION_SHOW_BACKGROUND;}diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 5231bea0f..b23d42cf1 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -45,6 +45,7 @@#include "Common/RandomValue.h"#include "GameClient/ClickTolerance.h"#include "GameClient/KeyDownInfo.h"+#include "GameClient/GameWindowTransitions.h"#include "GameLogic/ScenarioDrill.h"#include "Common/ControlServer.h"#include "GameLogic/LogicRandomValue.h"@@ -11777,3 +11778,34 @@ TEST(key_down_info_remembers_each_modifier_combination)info.clearModState( CTRL_MASK | SHIFT_MASK );CHECK( !info.isKeyDown() );}++/* A button flash for a button the layout does not have.+ *+ * WindowTransitions.ini's single player groups name MainMenu.wnd:ButtonCustomMission, and only the+ * 1.04 patch's MainMenu.wnd carries that button, so on another install the window lookup comes+ * back empty. Every step of the flash skipped an empty window except the pause between fading to+ * the background and fading to the gradient, which asked to draw it anyway. A player's crash log+ * ended there, reading address 0x1F0 inside GameWindow::winGetScreenPosition.+ */+class ButtonFlashWithoutWindow : public ButtonFlashTransition+{+public:+ enum+ {+ PAUSE_FIRST_FRAME = BUTTONFLASHTRANSITION_FADE_TO_BACKGROUND_4 + 1,+ PAUSE_LAST_FRAME = BUTTONFLASHTRANSITION_FADE_TO_GRADE_IN_1 - 1,+ NOTHING_TO_DRAW = -1+ };++ Int drawState( void ) const { return m_drawState; }+};++TEST(button_flash_draws_nothing_for_a_button_the_layout_lacks)+{+ ButtonFlashWithoutWindow flash;+ for( Int frame = ButtonFlashWithoutWindow::PAUSE_FIRST_FRAME; frame <= ButtonFlashWithoutWindow::PAUSE_LAST_FRAME; ++frame )+ {+ flash.update( frame );+ CHECK_EQ( flash.drawState(), (Int)ButtonFlashWithoutWindow::NOTHING_TO_DRAW );+ }+}