Skip to content

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.

fix(gameengine): esc menu without its old flash, full-width watcher promotions

Olcay Seygan55dd9034a9af
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 696dc5455..096a1d118 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -490,7 +490,7 @@ found and fixed — EA's own, not port damage.**
- Watching, the match opens on the middle of the map. An observer has no start position, so the game looked for the camera waypoint of "player zero", did not find it, and fell back to the corner of the map: every match watched from the stands began pointed at empty ground in the south west.
- Watching, you can click a stealth building. The rule that stops you selecting an enemy you cannot see never asked who was asking, so an observer, and a player already knocked out, could see a stealthed structure on the map and not pick it up to read it. A spectator commands nothing and sees everything already, so there is nothing there to give away.
- Watching, the promotions every general has bought are on screen the whole match: a strip of them in the bottom right corner, one row per player in his own colour. There was nowhere else to find this out - the promotion screen filled itself in with the watcher's own player, who has no general and no command sets at all, so a spectator got a blank screen.
-- Watching, clicking one player's unit watches him, and clicking empty ground puts the whole match back. The screen wears his side's metal and the promotions on the right are his alone. The tilde key, or the general's stars on the right of the bar, then opens his promotion screen, on his side's artwork, with his skill points and his rank - greyed out, because they are not yours to spend. With nothing selected the key does nothing and the stars are dark; there is no one general to show.
+- Watching, clicking one player's unit watches him, and clicking empty ground puts the whole match back. The screen wears his side's metal and the promotions on the right are his alone. The promotion key then opens his promotion screen, on his side's artwork, with his skill points and his rank - greyed out, because they are not yours to spend. It is the same size a player's is; picking his unit rebuilt the bar under a watcher and the screen came up a quarter narrower, its pictures squeezed thin. With nothing selected the key does nothing; there is no one general to show.
- A general who has taken Artillery Barrage to level 3 shows one Artillery Barrage on the promotions strip, not three copies of the same picture in a row.
- The strips close up again: across a row the trays slide an eighth of a tray under each other, so a row reads as one run of metal. The cameos never overlap each other, because every tray goes down before any picture does.
- Watching, the top left corner is clear. The promotions and superweapon shelves that stood there are gone: every general's promotions and superweapons are on the Tab scoreboard.
@@ -514,7 +514,7 @@ found and fixed — EA's own, not port damage.**
- The top of the screen is battlefield. The players, their teams, their superweapons with the seconds left and the match clock are all on Tab, which already had every one of them, so the column of superweapon countdowns that used to sit in the top right is gone while you play, and so is a strip of flags that repeated the scoreboard across the top edge.
- The steel between the build buttons, the portrait's grid and the promotion screen's cells is half as wide as it was, so the pictures take the room. The queue's tray has a thinner rim. The portrait and its upgrade icons sit under the portrait's grid, framed the same way as every other picture on the bar.
- The command bar slides up from the bottom of the screen again when a match starts. The new steel frame had been drawn at its final place from the first frame, so the buttons rose into a frame that was already standing.
-- The Escape menu is in the bar's steel too: a plate in your side's colour, no bigger than its keys, in the middle of the screen, the keys sunk in a well and lit gold under the pointer and pressed in when clicked. The Generals logo that took the top third of it is gone. The promotion screen opens across the middle of the screen. Restart reads Surrender or Restart Mission as the game you are in calls for.
+- The Escape menu is in the bar's steel too: a plate in your side's colour, no bigger than its keys, in the middle of the screen, the keys sunk in a well and lit gold under the pointer and pressed in when clicked. The Generals logo that took the top third of it is gone. It opens and closes at once, where the old menu's flash used to light up a patch of the screen where the old, bigger menu had stood. The promotion screen opens across the middle of the screen. Restart reads Surrender or Restart Mission as the game you are in calls for.
## Placing buildings
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
index 8603b197d..307f6b805 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
@@ -1049,6 +1049,9 @@ public:
* it the rectangle back. A rebuild of the layout reads the window as that rectangle. */
void insetPlacedWindow( GameWindow *window, const ICoord2D &inset );
ICoord2D getPlacedInset( GameWindow *window ) const; ///< what insetPlacedWindow last put it in by
+ /** Moves one of the bar's windows `shift` pixels down, and the places layoutPanels recorded for it
+ * and everything inside it with it, so a rebuild of the layout reads it as placed there. */
+ void lowerPlacedWindow( GameWindow *window, Int shift );
GameWindow *getSpecialPowerShortcutParent( void ) { return m_specialPowerShortcutParent; }
/// the general's stars are asking to be spent, so the button blinks; see getStarImage
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
index f206525d1..fb5837458 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
@@ -2175,6 +2175,27 @@ ICoord2D ControlBar::getPlacedInset( GameWindow *window ) const
return theControlBarPlacement.find( window )->second.inset;
}
+//-------------------------------------------------------------------------------------------------
+/** A window moved without its place moving was read by the next layoutPanels as moved by somebody
+ * else, in the loader's stretched space, and its size taken back through the loader's scale: the
+ * command grid, lowered to the bottom edge, came out three quarters as wide after a watcher's
+ * selection rebuilt the bar, and the promotion screen measures its cells off it. */
+//-------------------------------------------------------------------------------------------------
+static void lowerPlaces( GameWindow *window, Int shift )
+{
+ theControlBarPlacement.find( window )->second.placedY += shift;
+ for( GameWindow *child = window->winGetChild(); child; child = child->winGetNext() )
+ lowerPlaces( child, shift );
+}
+
+void ControlBar::lowerPlacedWindow( GameWindow *window, Int shift )
+{
+ Int x = 0, y = 0;
+ window->winGetPosition( &x, &y );
+ window->winSetPosition( x, y + shift );
+ lowerPlaces( window, shift );
+}
+
//-------------------------------------------------------------------------------------------------
/** Put every window where its panel's slide says it should be.
*
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp
index b0753a887..80a4584bf 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp
@@ -332,6 +332,25 @@ static void restartMissionMenu()
TheInGameUI->setClientQuiet( TRUE );
}
+//-------------------------------------------------------------------------------------------------
+/** The menu comes and goes at once. Its transitions flash the rectangles each window had when
+ * they started, and InGameUI::themeQuitMenu lays the menu out compact only as it draws, so the
+ * flashes lit the old layout's places somewhere else on the screen. Skipping the group leaves
+ * every window where the group's end puts it, as the flashes did when they finished. */
+//-------------------------------------------------------------------------------------------------
+static void showQuitMenuLayout( const char *group )
+{
+ TheTransitionHandler->remove( group );
+ TheTransitionHandler->setGroup( group );
+ TheTransitionHandler->remove( group, TRUE );
+}
+
+static void hideQuitMenuLayout( void )
+{
+ if( quitMenuLayout )
+ quitMenuLayout->hide( TRUE );
+}
+
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
void HideQuitMenu( void )
@@ -340,10 +359,7 @@ void HideQuitMenu( void )
// So don't do anything that counts on that menu actually being here.
if(!isVisible)
return;
- if(quitMenuLayout && quitMenuLayout == noSaveLoadQuitMenuLayout)
- TheTransitionHandler->reverse("QuitNoSaveBack");
- else if( quitMenuLayout && quitMenuLayout == fullQuitMenuLayout)
- TheTransitionHandler->reverse("QuitFullBack");
+ hideQuitMenuLayout();
TheInGameUI->setQuitMenuVisible( FALSE );
isVisible = FALSE;
@@ -413,23 +429,7 @@ void ToggleQuitMenu()
if ( !TheGameLogic->isInMultiplayerGame() )
TheGameLogic->setGamePaused(FALSE);
- if(quitMenuLayout && quitMenuLayout == noSaveLoadQuitMenuLayout)
- TheTransitionHandler->reverse("QuitNoSaveBack");
- else if( quitMenuLayout && quitMenuLayout == fullQuitMenuLayout )
- {
- TheTransitionHandler->reverse("QuitFullBack");
- //begin KRISMORNESS
- //TheTransitionHandler->reverse("QuitFull");
- //if( TheTransitionHandler->areTransitionsEnabled() )
- //else
- //{
- // TheTransitionHandler->remove("QuitFull");
- // quitMenuLayout = NULL;
- // isVisible = TRUE;
- // HideQuitMenu();
- //}
- //end KRISMORNESS
- }
+ hideQuitMenuLayout();
}
else
{
@@ -446,8 +446,7 @@ void ToggleQuitMenu()
noSaveLoadQuitMenuLayout = TheWindowManager->winCreateLayout( AsciiString( "Menus/QuitNoSave.wnd" ) );
quitMenuLayout = noSaveLoadQuitMenuLayout;
initGadgetsNoSaveQuit();
- TheTransitionHandler->remove("QuitNoSave");
- TheTransitionHandler->setGroup("QuitNoSave");
+ showQuitMenuLayout( "QuitNoSave" );
}
else
{
@@ -455,8 +454,7 @@ void ToggleQuitMenu()
fullQuitMenuLayout= TheWindowManager->winCreateLayout( AsciiString( "Menus/QuitMenu.wnd" ) );
quitMenuLayout = fullQuitMenuLayout;
initGadgetsFullQuit();
- TheTransitionHandler->remove("QuitFull");
- TheTransitionHandler->setGroup("QuitFull");
+ showQuitMenuLayout( "QuitFull" );
}
// load the quit menu from the layout file if needed
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 6bff1a5d5..a5e5f6948 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -10989,15 +10989,6 @@ static IRegion2D commandButtonsBox( void )
return box;
}
-/** Moves the bar's window Name down by `shift` screen pixels. */
-static void lowerControlBarWindow( const char *name, Int shift )
-{
- GameWindow *window = controlBarWindow( name );
- Int x = 0, y = 0;
- window->winGetPosition( &x, &y );
- window->winSetPosition( x, y + shift );
-}
-
static void stackCentre( HtmlValues &values, Bool shown, const ICoord2D &grow, IRegion2D &centre )
{
// the command buttons stand as low as the idle worker's key beside them, GRID_BOTTOM_GAP over the
@@ -11005,7 +10996,7 @@ static void stackCentre( HtmlValues &values, Bool shown, const ICoord2D &grow, I
const Real scale = ControlBarUniformScale();
const Int shift = barBottom() - REAL_TO_INT( GRID_BOTTOM_GAP * scale ) - commandButtonsBox().hi.y - grow.y;
if( shift != 0 )
- lowerControlBarWindow( "CommandWindow", shift );
+ TheControlBar->lowerPlacedWindow( controlBarWindow( "CommandWindow" ), shift );
IRegion2D grid, power, money;
const Bool othersFound = controlBarUnion( CONTROL_BAR_CENTRE, grid );