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.

feat(gameclient): classic power row, queue, menu fades, supply labels

Olcay Seygan865f39d33b00
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 32f932e65..a7b2693e7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1087,7 +1087,10 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
- Display, graphics, effects, audio, controls, interface and network, behind seven buttons across the top. The original screen was one panel with everything on it at once, and it was already full the day it shipped: the language filter, the keyboard button and four camera checkboxes are all still in there, parked off the right edge where nobody can reach them, because there was nowhere left to put them.
- Every setting sits with the ones that do the same kind of job. Display is the screen and its brightness. Graphics is what the picture costs and how sharp it is, with the glow and the lighting in a group of their own instead of mixed in with the anti-aliasing. Effects is what stands in the world: all seven shadow boxes together, cloud shadows included, then the scenery, then smoke. Controls splits the camera, the orders, building placement and the mouse into four groups, and Interface holds the command bar size, the income readout, the health bars, the colours, the order lines and the language. In Classic the screen leaves out the twelve boxes Classic ignores anyway, from zoom to cursor and grid placement to the HUD size and the health bar choice, and closes the gaps they leave, so a box on that screen always does something.
- Classic Graphics, on the Graphics page, puts the game back the way it looked in 2003 in one click: its own textures and ground in place of the upscaled ones, the old hard shadows, the round dark patch under every tree where Reforged lays the tree's own outline on the ground, and no glow or sharpening over the picture. Leave it off and you have Reforged. The rest of the options stay yours either way, and the box takes effect the next time the game starts.
-- Interface, in the launcher, picks between Classic and Reforged. Classic is the command bar, mouse and hotkeys of Zero Hour 1.04 that your hands still remember; Reforged is the console in the middle, right-click orders and the key grid this version built. Every player starts on Classic, and a game started without the launcher is Classic too. The choice is yours alone: two players on different styles still play the same match and the same replay. It takes effect the next time the game starts. Classic's screen is EA's again: the one-piece command bar in each side's own painting, the radar with its flashing under-attack lamp, the beacon button, six lines of messages in the top left that fade as they did, superweapon countdowns written out by name, the old chat line and quit menu, lettering at the old sizes, and Tab opening diplomacy. What it does not do is stretch. On a 16:9 or 21:9 screen the bar, the menus and every dialog sit in a 4:3 frame in the middle at their drawn shape, and the battlefield runs out to both edges past them; at 2560x1080 that is 560 pixels of ground on either side of the bar. The mouse and keys are 1.04's as well. The left button selects and gives the order, so an enemy under it is an attack and a bunker under your infantry is a way in; the right button drops your selection or takes back a half-given order, and a right drag scrolls the map. Ctrl held is force fire. Alt held lays waypoints, and the white path joining them is drawn again. A guard order holds the range it always held, Shift and a number adds that group to what you have selected, and a build button is one unit a click. The keys are your language's own key map from the game's files, with nothing of Reforged's grid laid over it, and a build button's key is the letter 1.04 gave it, taken from the English name in every language, so a Turkish or German player presses the same key an English one does. The letter sits in the button's corner on the dark badge Reforged puts its grid keys on; the tooltip's name is plain white with no letter picked out. A structure is selected on its own, as it always was. The radar shows no money piles or tech buildings, the piles carry no money over them, and the clock plate, the frame counter and the experience bar under the portrait stay off the screen. So does the peace time plate, though a host's truce still holds. The money readout is the money alone, with no income figure beside it. Health bars and garrison squares look and behave as they do in Reforged, and the Health Bars and empty garrison squares settings are back on Classic's options page. The build buttons are the pictures alone, without the seconds, price and power figures. Those seconds were measured against the wall clock, so on a match running just under full speed a 120 second build read 125. An upgrade bought for a group of buildings goes to the one whose buttons you see. In a network game a Classic player's camera is not sent to observers, as it never was in 1.04. The camera zooms on the middle of the screen ten units a notch, as near and as far as Reforged's camera goes, turns without snapping, and scrolls from the last three pixels of a full screen and not at all in a window, whatever the options say. A move order puts 1.04's animated ring on the ground where it lands, and no marker or line stays behind it. None of it reaches the battle itself: Classic sends the game only the orders 1.04 sent, so a Classic player and a Reforged one share a match, and a replay plays back the same in either.
+- Interface, in the launcher, picks between Classic and Reforged. Classic is the command bar, mouse and hotkeys of Zero Hour 1.04 that your hands still remember; Reforged is the console in the middle, right-click orders and the key grid this version built. Every player starts on Classic, and a game started without the launcher is Classic too. The choice is yours alone: two players on different styles still play the same match and the same replay. It takes effect the next time the game starts. Classic's screen is EA's again: the one-piece command bar in each side's own painting, the radar with its flashing under-attack lamp, the beacon button, six lines of messages in the top left that fade as they did, superweapon countdowns written out by name, the old chat line and quit menu, lettering at the old sizes, and Tab opening diplomacy. What it does not do is stretch. On a 16:9 or 21:9 screen the bar, the menus and every dialog sit in a 4:3 frame in the middle at their drawn shape, and the battlefield runs out to both edges past them; at 2560x1080 that is 560 pixels of ground on either side of the bar. The mouse and keys are 1.04's as well. The left button selects and gives the order, so an enemy under it is an attack and a bunker under your infantry is a way in; the right button drops your selection or takes back a half-given order, and a right drag scrolls the map. Ctrl held is force fire. Alt held lays waypoints, and the white path joining them is drawn again. A guard order holds the range it always held, Shift and a number adds that group to what you have selected, and a build button is one unit a click. The keys are your language's own key map from the game's files, with nothing of Reforged's grid laid over it, and a build button's key is the letter 1.04 gave it, taken from the English name in every language, so a Turkish or German player presses the same key an English one does. The letter sits in the button's corner on the dark badge Reforged puts its grid keys on, a size larger and in gold while the button can be pressed; the tooltip's name is plain white with no letter picked out. A structure is selected on its own, as it always was. The radar shows no money piles or tech buildings, and the clock plate, the frame counter and the experience bar under the portrait stay off the screen. So does the peace time plate, though a host's truce still holds. The money readout is the money alone, with no income figure beside it. Health bars and garrison squares look and behave as they do in Reforged, and the Health Bars and empty garrison squares settings are back on Classic's options page. The build buttons are the pictures alone, without the seconds, price and power figures. Those seconds were measured against the wall clock, so on a match running just under full speed a 120 second build read 125. An upgrade bought for a group of buildings goes to the one whose buttons you see. In a network game a Classic player's camera is not sent to observers, as it never was in 1.04. The camera zooms on the middle of the screen ten units a notch, as near and as far as Reforged's camera goes, turns without snapping, and scrolls from the last three pixels of a full screen and not at all in a window, whatever the options say. A move order puts 1.04's animated ring on the ground where it lands, and no marker or line stays behind it. None of it reaches the battle itself: Classic sends the game only the orders 1.04 sent, so a Classic player and a Reforged one share a match, and a replay plays back the same in either.
+- Classic shows what a factory is building again. Select one with anything queued and its queue takes the portrait's place, the unit in production wearing its build clock, and a click on any entry cancels it; the portrait comes back when the queue runs dry. Until now a Classic factory could queue a hundred units with nothing on screen to count them by. The queue stops at nine, the number of slots that show it, and the build buttons grey out at nine as they did in 1.04. Your general's powers sit in one row over the bar, growing to the left, each one tucked a third under the one to its right, where they used to climb the right edge of the screen three to a row. They carry how many are ready and no key letter.
+- Supply piles stop shouting their cash over the whole map. A small pile shows its amount only while your cursor is on it or close by, in a smaller font; a big supply dock keeps its label all the time. Classic has the same labels now, with the radar still leaving the piles off.
+- The Esc menu and the general's promotion screen close the way they open, in both interfaces. Both used to vanish in a single frame, and Classic's Esc menu had lost its opening flash as well. Classic plays 1.04's flash and fade, forwards to open and backwards to close; Reforged fades its pages out over a little more than a tenth of a second, as fast as they fade in.
- Every graphics setting is on the Graphics and Effects pages. Shadows, clouds, ground lighting, soft water edges, trees, extra animations, heat haze, texture resolution and the particle limit used to hide in a popup that only opened if you picked Custom from the detail box on another page, so choosing High never showed you what High turns on. Pick a preset now and its settings change in front of you; touch any one of them and the box reads Custom. Texture filtering and the number of anisotropic samples, which needed a text editor, sit there too.
- Every page is sorted into titled groups by what the settings do, and the groups sit in the same three columns on every tab. On Graphics the detail preset heads the first column with the texture and particle sliders under it, the picture settings take the second and the terrain the third. The framed boxes the original drew inside each page are gone. They were sized for headings that no longer exist, which is why no two pages started their first setting at the same height.
- The detail box has Ultra above High, and a preset now sets everything it is responsible for. Picking High used to leave antialiasing and texture filtering wherever they happened to be; High now brings 4x antialiasing and 8 anisotropic samples with it, and Low turns both down for the machines that need it. Ultra is High with the particle limit at the top of its slider, 5,000 against High's 3,000, detail that is never dropped when the frame rate dips, 8x antialiasing, 16 anisotropic samples, thick smoke and every new shadow and effect switched on. Glow stays yours whichever you pick: the artwork was painted without it.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
index 6e43a5470..1c681cf12 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
@@ -63,6 +63,7 @@ class PlayerTemplate;
class AudioEventRTS;
class ControlBarSchemeManager;
class UpgradeTemplate;
+class ProductionUpdateInterface;
class GameWindowTransitionsHandler;
class DisplayString;
@@ -425,6 +426,10 @@ enum { CTRL_SHIFT_BUILD_QUEUE_COUNT = 100 };
// the count the modifiers currently held ask for; 1 with nothing held
Int getBuildBatchCount( void );
+// how deep a producer's queue may go from the bar: its own MaxQueueEntries, and in Classic no
+// deeper than the nine queue buttons that show it
+UnsignedInt getQueueCap( const ProductionUpdateInterface *pu );
+
enum { MAX_COMMANDS_PER_SET = 18 }; // user interface max is 14 (but internally it's 18 for script only buttons!)
/** The command grid, six places across and three down, read along the rows. A place is its key:
@@ -1256,6 +1261,8 @@ protected:
void resetContainData( void ); /// reset container data we use to tie controls to objects IDs for containment
void resetBuildQueueData( void ); /// reset the build queue data we use to die queue entires to control
void resetBuildQueueButtons( void ); /// attach the queue button windows and wipe them to empty
+ void populateBuildQueue( Object *producer ); ///< Classic: the producer's queue into the queue buttons
+ void updateClassicBuildQueue( Object *obj, ProductionUpdateInterface *pu ); ///< Classic: queue over the portrait while it holds anything
// the following methods are for populating the context GUI controls for a particular context
static void populateButtonProc( Object *obj, void *userData );
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 573771a1d..f648c864f 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -484,10 +484,16 @@ public: // ********************************************************************
Bool isPromotionPageShown( void ) const { return m_promotionPageLoaded && !m_promotionPage.empty(); }
/** The promotion screen is coming up: its page and the dimmed screen under it fade in from now. */
void openPromotionPage( void );
+ /** The promotion screen is going: the page fades out and hides its window when it is gone. */
+ void closePromotionPage( void ) { m_promotionClosing = TRUE; }
/** The Esc menu hands its look to Window/Html/QuitMenu.html: `parent` draws the page and its keys
* draw nothing and keep their clicks. Left as it is when there is no page. */
void themeQuitMenu( GameWindow *parent );
void drawQuitMenuPage( GameWindow *parent );
+ /** TRUE once the Esc menu is the page's, so the layout's own transitions stay off. */
+ Bool isQuitMenuPageShown( void ) const { return m_quitMenuPageLoaded && !m_quitMenuPage.empty(); }
+ /** The Esc menu is going: the page fades out and hides its window when it is gone. */
+ void closeQuitMenuPage( void ) { m_quitMenuClosingMs = 0; }
/** The command bar's grids of buttons whose cells the page frames in front of the buttons. */
enum CellGrid { CELL_GRID_COMMAND, CELL_GRID_QUEUE, CELL_GRID_POWERS, CELL_GRID_COUNT };
/** The steel frames over one grid's buttons, from Window/Html/ControlBar.html, drawn after them. */
@@ -1632,12 +1638,14 @@ protected:
std::string m_promotionPage;
Int m_promotionShownMs; ///< how far the promotion screen has come up, -1 before its first picture
UnsignedInt m_promotionDrawnAt; ///< the wall clock at its last picture
+ Bool m_promotionClosing; ///< fading out, m_promotionShownMs running back to 0
HtmlOverlay * m_quitMenuOverlay;
std::vector< HtmlOverlay * > m_quitMenuKeyOverlays; ///< one for each of the menu's keys, each fading in on its own
Bool m_quitMenuPageLoaded;
std::string m_quitMenuPage;
Int m_quitMenuShownMs; ///< how far the menu's coming up has run, -1 until its first picture
UnsignedInt m_quitMenuDrawnAt; ///< the wall clock at its last picture: the game is paused under it
+ Int m_quitMenuClosingMs; ///< how far the menu's going has run, -1 while it is not going
Bool m_signalsWereShown; ///< the smoke signal column was up last frame
UnsignedInt m_signalsRiseStartMs; ///< when it last came up, the start of its buttons' rise
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
index caf31a1ab..e8f977232 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
@@ -68,6 +68,7 @@
#include "GameLogic/Module/AutoDepositUpdate.h"
#include "GameLogic/Module/HackInternetAIUpdate.h"
#include "GameLogic/Module/SupplyTruckAIUpdate.h"
+#include "GameLogic/Module/SupplyWarehouseDockUpdate.h"
#include "Common/Upgrade.h"
#include "GameLogic/Module/StealthUpdate.h"
#include "GameLogic/Module/StickyBombUpdate.h"
@@ -90,6 +91,7 @@
#include "GameClient/ParticleSys.h"
#include "GameClient/PlayerColorScheme.h"
#include "GameClient/LanguageFilter.h"
+#include "GameClient/Mouse.h"
#include "GameClient/Shadow.h"
#include "GameClient/GameText.h"
@@ -3125,9 +3127,7 @@ void Drawable::drawIconUI( void )
drawCaption( healthBarRegion );
drawConstructPercent( healthBarRegion );
- // Classic's piles wear no money, as the game shipped
- if( !TheGlobalData->isClassicUI() )
- drawSupplyCash( healthBarRegion );
+ drawSupplyCash( healthBarRegion );
//All Icons Below only draw on ALIVE things, so bail here -------------------------
if( obj->isEffectivelyDead() || obj->isKindOf( KINDOF_IGNORED_IN_GUI )) // object explicitly wants nothing to do with these icons, so...
@@ -4133,7 +4133,10 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion )
/** How much money is still in a supply pile, written over it. The piles were readable only as
* art - a full one and a nearly-empty one differ by a few boxes on the model - so deciding which
* one to send workers to, or whether an expansion is worth taking, meant guessing. Written as
- * cash rather than as boxes because cash is the number the decision is actually about. */
+ * cash rather than as boxes because cash is the number the decision is actually about.
+ * Docks and warehouses (400 boxes at the start) show it all the time; the small piles (150 and
+ * 50) litter the map and show it, smaller, only while the cursor is on or near them. The class
+ * comes from the starting box count, so a big source does not turn small as it drains. */
//-------------------------------------------------------------------------------------------------
void Drawable::drawSupplyCash( const IRegion2D *healthBarRegion )
{
@@ -4157,11 +4160,36 @@ void Drawable::drawSupplyCash( const IRegion2D *healthBarRegion )
if( obj->getShroudedStatus( TheObserverCamera.getShroudPlayerIndex() ) != OBJECTSHROUD_CLEAR )
return;
+ // only a SupplyWarehouseDockUpdate answers getSupplyCashValue with cash, so this finds one
+ static const NameKeyType warehouseModuleKey = TheNameKeyGenerator->nameToKey( "SupplyWarehouseDockUpdate" );
+ const SupplyWarehouseDockUpdate *warehouse = (const SupplyWarehouseDockUpdate *)obj->findUpdateModule( warehouseModuleKey );
+ const Bool largeSource = warehouse->getStartingBoxes() >= 300;
+
+ Coord3D pos;
+ obj->getHealthBoxPosition( pos );
+ ICoord2D screen;
+ if( !TheTacticalView->worldToScreen( &pos, &screen ) )
+ return;
+
+ if( !largeSource && TheInGameUI->getMousedOverDrawableID() != getID() )
+ {
+ // near enough counts too: a small pile's model is a narrow target to land the cursor on
+ const ICoord2D &mouse = TheMouse->getMouseStatus()->pos;
+ Int dx = mouse.x - screen.x;
+ Int dy = mouse.y - screen.y;
+ const Int nearPixels = 60;
+ if( dx * dx + dy * dy > nearPixels * nearPixels )
+ return;
+ }
+
if( m_supplyCashDisplayString == NULL )
{
+ Int pointSize = TheInGameUI->getDrawableCaptionPointSize();
+ if( !largeSource )
+ pointSize -= 2;
m_supplyCashDisplayString = TheDisplayStringManager->newDisplayString();
m_supplyCashDisplayString->setFont( TheFontLibrary->getFont( TheInGameUI->getDrawableCaptionFontName(),
- TheGlobalLanguageData->adjustFontSize( TheInGameUI->getDrawableCaptionPointSize() ),
+ TheGlobalLanguageData->adjustFontSize( pointSize ),
TheInGameUI->isDrawableCaptionBold() ) );
}
@@ -4173,12 +4201,6 @@ void Drawable::drawSupplyCash( const IRegion2D *healthBarRegion )
m_lastSupplyCashDisplayed = cash;
}
- Coord3D pos;
- obj->getHealthBoxPosition( pos );
- ICoord2D screen;
- if( !TheTacticalView->worldToScreen( &pos, &screen ) )
- return;
-
Int width, height;
m_supplyCashDisplayString->getSize( &width, &height );
screen.x -= width / 2;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
index 6480997eb..723da6df2 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
@@ -5865,7 +5865,11 @@ void ControlBar::showPurchaseScience( void )
// the fade holds the screen hidden for nine frames and draws the side's old painting of it fading
// in, which the page has replaced
if (TheGlobalData->m_animateWindows && !TheInGameUI->isPromotionPageShown())
+ {
+ // a fade still running out is ended first, or it would hide the screen it just showed
+ TheTransitionHandler->remove("GenExpFade");
TheTransitionHandler->setGroup("GenExpFade");
+ }
//m_generalsScreenAnimate->registerGameWindow( m_contextParent[ CP_PURCHASE_SCIENCE ], WIN_ANIMATION_SLIDE_TOP, TRUE, 200 );
}
@@ -5874,8 +5878,29 @@ void ControlBar::hidePurchaseScience( void )
{
clearPurchaseScienceColumn();
+ const Bool wasOpen = m_purchaseScienceOpen;
m_purchaseScienceOpen = FALSE;
+ //
+ // Closing plays the opening backwards. The page fades itself out and hides the window when it
+ // is gone; Classic's painted screen runs its fade in reverse, which hides it at the end. The
+ // window stays up meanwhile, which is why the open state is ours and not its hidden flag.
+ //
+ GameWindow *screen = m_contextParent[ CP_PURCHASE_SCIENCE ];
+ if( wasOpen && screen && TheGlobalData->m_animateWindows )
+ {
+ if( !TheInGameUI->isPromotionPageShown() )
+ {
+ TheTransitionHandler->reverse( "GenExpFade" );
+ return;
+ }
+ if( !screen->winIsHidden() )
+ {
+ TheInGameUI->closePromotionPage();
+ return;
+ }
+ }
+
//
// The fade drives winHide on this window itself, frame by frame, and it holds the window hidden
// for its first few frames. So the screen's own hidden flag is not the question "is it open" -
@@ -5890,20 +5915,6 @@ void ControlBar::hidePurchaseScience( void )
{
m_contextParent[ CP_PURCHASE_SCIENCE ]->winHide( TRUE );
}
-// if (!TheGlobalData->m_animateWindows)
-// {
-// if( m_contextParent[ CP_PURCHASE_SCIENCE ] )
-// {
-// m_contextParent[ CP_PURCHASE_SCIENCE ]->winHide( TRUE );
-// }
-// }
-// else
-// {
-// //if (m_generalsScreenAnimate->isFinished())
-// if(TheTransitionHandler->isFinished())
-// TheTransitionHandler->reverse("GenExpFade");
-// //m_generalsScreenAnimate->reverseAnimateWindow();
-// }
}
Bool ControlBar::isPurchaseScienceVisible( void )
@@ -6460,7 +6471,17 @@ void ControlBar::arrangeSpecialPowerShortcutGrid( void )
if( getSpecialPowerTrayLayout( NULL, &cameoSize, &cameoOffset, &columnStep ) == FALSE )
return;
- const Int columns = MIN( m_currentlyUsedSpecialPowersButtons, (Int)SPECIAL_POWER_SHORTCUT_COLS );
+ //
+ // Classic keeps every power on the one row the first stands on, growing to the left, each slot
+ // a third under the one to its right so the row reads as a fanned stack and eleven powers do
+ // not run halfway across the screen. The cover is the right hand third, so the corner the
+ // count is drawn in stays clear on every slot
+ //
+ const Bool classic = barIsClassic();
+ if( classic )
+ columnStep = columnStep * 2 / 3;
+ const Int columns = classic ? m_currentlyUsedSpecialPowersButtons
+ : MIN( m_currentlyUsedSpecialPowersButtons, (Int)SPECIAL_POWER_SHORTCUT_COLS );
const Int widen = ( columns - 1 ) * columnStep;
//
@@ -6485,8 +6506,8 @@ void ControlBar::arrangeSpecialPowerShortcutGrid( void )
if( slot == NULL || button == NULL )
continue;
- const Int column = i % SPECIAL_POWER_SHORTCUT_COLS;
- const Int row = i / SPECIAL_POWER_SHORTCUT_COLS;
+ const Int column = classic ? i : i % SPECIAL_POWER_SHORTCUT_COLS;
+ const Int row = classic ? 0 : i / SPECIAL_POWER_SHORTCUT_COLS;
slot->winSetPosition( firstX + widen - column * columnStep, firstY - row * rowStep );
@@ -7055,8 +7076,12 @@ void ControlBar::drawSpecialPowerShortcutMultiplierText()
// Which key a slot number means is up to CommandMap.ini - getMetaKeyLabel returns
// nothing for an unbound one.
//
+ // Classic's powers wear no key, only how many are ready, as the game shipped
Int keySlot = -1;
- if( m_specialPowerShortcutRow < 0 )
+ if( barIsClassic() )
+ {
+ }
+ else if( m_specialPowerShortcutRow < 0 )
{
if( i % SPECIAL_POWER_SHORTCUT_COLS == 0 )
keySlot = i / SPECIAL_POWER_SHORTCUT_COLS;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp
index cb313da08..730ea4883 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp
@@ -722,6 +722,87 @@ void ControlBar::resetBuildQueueButtons( void )
} // end resetBuildQueueButtons
+//-------------------------------------------------------------------------------------------------
+UnsignedInt getQueueCap( const ProductionUpdateInterface *pu )
+{
+ const UnsignedInt cap = pu->getMaxQueueEntries();
+ return TheGlobalData->isClassicUI() ? MIN( cap, (UnsignedInt)MAX_BUILD_QUEUE_BUTTONS ) : cap;
+}
+
+//-------------------------------------------------------------------------------------------------
+/** Classic's build queue, EA's: the first MAX_BUILD_QUEUE_BUTTONS entries of the producer's queue
+ * on the queue buttons, each a cancel of its own entry. */
+//-------------------------------------------------------------------------------------------------
+void ControlBar::populateBuildQueue( Object *producer )
+{
+ static const CommandButton *cancelUnitCommand = findCommandButton( "Command_CancelUnitCreate" );
+ static const CommandButton *cancelUpgradeCommand = findCommandButton( "Command_CancelUpgradeCreate" );
+
+ resetBuildQueueButtons();
+
+ ProductionUpdateInterface *pu = producer->getProductionUpdateInterface();
+ Int windowIndex = 0;
+ for( const ProductionEntry *production = pu->firstProduction();
+ production && windowIndex < MAX_BUILD_QUEUE_BUTTONS;
+ production = pu->nextProduction( production ), windowIndex++ )
+ {
+ GameWindow *control = m_queueData[ windowIndex ].control;
+ control->winEnable( TRUE );
+ control->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES );
+ if( production->getProductionType() == PRODUCTION_UNIT )
+ {
+ setControlCommand( control, cancelUnitCommand );
+ m_queueData[ windowIndex ].type = PRODUCTION_UNIT;
+ m_queueData[ windowIndex ].productionID = production->getProductionID();
+ GadgetButtonSetEnabledImage( control, production->getProductionObject()->getButtonImage() );
+ GadgetButtonDrawOverlayImage( control, calculateVeterancyOverlayForThing( production->getProductionObject() ) );
+ }
+ else
+ {
+ setControlCommand( control, cancelUpgradeCommand );
+ m_queueData[ windowIndex ].type = PRODUCTION_UPGRADE;
+ m_queueData[ windowIndex ].upgradeToResearch = production->getProductionUpgrade();
+ GadgetButtonSetEnabledImage( control, production->getProductionUpgrade()->getButtonImage() );
+ }
+ }
+
+ m_displayedQueueCount = pu->getProductionCount();
+
+} // end populateBuildQueue
+
+//-------------------------------------------------------------------------------------------------
+/** Classic: the queue stands where the portrait does while the producer has anything in it, the
+ * first entry's build clock on its button, and the portrait comes back when it empties. */
+//-------------------------------------------------------------------------------------------------
+void ControlBar::updateClassicBuildQueue( Object *obj, ProductionUpdateInterface *pu )
+{
+ GameWindow *queue = m_contextParent[ CP_BUILD_QUEUE ];
+ const Bool busy = pu && pu->firstProduction() != NULL;
+ if( !busy )
+ {
+ if( queue->winIsHidden() == FALSE )
+ {
+ queue->winHide( TRUE );
+ setPortraitByObject( obj );
+ }
+ return;
+ }
+
+ // the portrait is put back by anything that re-evaluates the selection, so it is taken off
+ // every frame the queue stands in its place, as EA did
+ setPortraitByObject( NULL );
+ if( queue->winIsHidden() )
+ {
+ queue->winHide( FALSE );
+ populateBuildQueue( obj );
+ }
+ else if( pu->getProductionCount() != m_displayedQueueCount )
+ populateBuildQueue( obj );
+
+ GadgetButtonDrawInverseClock( m_queueData[ 0 ].control, pu->firstProduction()->getPercentComplete(), m_buildUpClockColor );
+
+} // end updateClassicBuildQueue
+
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
@@ -757,9 +838,13 @@ void ControlBar::updateContextCommand( void )
//
// the right HUD always belongs to the selection, so the build queue panel is never shown
// over it: a unit build button carries its own queue (radial progress, count badge,
- // right-click cancels the last one) and the producer's world bar shows the rest
+ // right-click cancels the last one) and the producer's world bar shows the rest. Classic
+ // has none of that, so a lone producer with something queued shows its queue where its
+ // portrait was, as the game shipped
//
- if( m_contextParent[ CP_BUILD_QUEUE ]->winIsHidden() == FALSE )
+ if( TheGlobalData->isClassicUI() && m_currContext == CB_CONTEXT_COMMAND )
+ updateClassicBuildQueue( obj, pu );
+ else if( m_contextParent[ CP_BUILD_QUEUE ]->winIsHidden() == FALSE )
{
m_contextParent[ CP_BUILD_QUEUE ]->winHide( TRUE );
setPortraitByObject( obj );
@@ -1309,12 +1394,13 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
//
// The cap is the queue's own depth (INI MaxQueueEntries, 100 by default here), not the number
// of buttons the build-queue strip happens to have room for - those nine buttons are a display
- // limit and were greying every build button out at nine units.
+ // limit and were greying every build button out at nine units. Classic shows its queue on
+ // those nine buttons, so there they are the cap (getQueueCap).
//
// >=, not ==: a shift-click queues several at once, so an exact-equality test stopped firing
// once the count stepped past the cap.
//
- Bool queueMaxed = pu ? ( pu->getProductionCount() >= pu->getMaxQueueEntries() ) : FALSE;
+ Bool queueMaxed = pu ? ( pu->getProductionCount() >= getQueueCap( pu ) ) : FALSE;
switch( command->getCommandType() )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
index 5faccfc64..5489f5ac7 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
@@ -787,7 +787,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
commandButton->getCommandType() == GUI_COMMAND_OBJECT_UPGRADE )
{
ProductionUpdateInterface *pui = selectedObject->getProductionUpdateInterface();
- if( pui && pui->getProductionCount() >= pui->getMaxQueueEntries() )
+ if( pui && pui->getProductionCount() >= getQueueCap( pui ) )
{
card.warning = TheGameText->fetch( "TOOLTIP:TooltipCannotPurchaseBecauseQueueFull" );
}
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 4f2d2fd26..50e466f5e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp
@@ -335,22 +335,31 @@ static void restartMissionMenu()
}
//-------------------------------------------------------------------------------------------------
-/** 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. */
+/** The menu's coming and going. Drawn as the page, it fades itself in and out: the layout's
+ * 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 would light
+ * the old layout's places somewhere else on the screen. Skipping the group leaves every window
+ * where the group's end puts it. Classic draws the layout where it stands, so its own flashes
+ * play, as the game shipped. */
//-------------------------------------------------------------------------------------------------
static void showQuitMenuLayout( const char *group )
{
TheTransitionHandler->remove( group );
TheTransitionHandler->setGroup( group );
- TheTransitionHandler->remove( group, TRUE );
+ if( !TheGlobalData->m_animateWindows || TheInGameUI->isQuitMenuPageShown() )
+ TheTransitionHandler->remove( group, TRUE );
}
static void hideQuitMenuLayout( void )
{
- if( quitMenuLayout )
+ if( quitMenuLayout == NULL )
+ return;
+ if( !TheGlobalData->m_animateWindows )
quitMenuLayout->hide( TRUE );
+ else if( TheInGameUI->isQuitMenuPageShown() )
+ TheInGameUI->closeQuitMenuPage();
+ else
+ TheTransitionHandler->reverse( quitMenuLayout == noSaveLoadQuitMenuLayout ? "QuitNoSaveBack" : "QuitFullBack" );
}
//-------------------------------------------------------------------------------------------------
@@ -441,6 +450,7 @@ void ToggleQuitMenu()
TheMouse->setCursor( Mouse::ARROW );
TheControlBar->hidePurchaseScience();
+ const char *group;
if ( TheGameLogic->isInMultiplayerGame() || TheGameLogic->isInReplayGame() )
{
// we don't want to show the save load button.
@@ -448,7 +458,7 @@ void ToggleQuitMenu()
noSaveLoadQuitMenuLayout = TheWindowManager->winCreateLayout( AsciiString( "Menus/QuitNoSave.wnd" ) );
quitMenuLayout = noSaveLoadQuitMenuLayout;
initGadgetsNoSaveQuit();
- showQuitMenuLayout( "QuitNoSave" );
+ group = "QuitNoSave";
}
else
{
@@ -456,7 +466,7 @@ void ToggleQuitMenu()
fullQuitMenuLayout= TheWindowManager->winCreateLayout( AsciiString( "Menus/QuitMenu.wnd" ) );
quitMenuLayout = fullQuitMenuLayout;
initGadgetsFullQuit();
- showQuitMenuLayout( "QuitFull" );
+ group = "QuitFull";
}
// load the quit menu from the layout file if needed
@@ -467,7 +477,9 @@ void ToggleQuitMenu()
TheInGameUI->setQuitMenuVisible(FALSE);
return;
}
+ // themed first: whether the page draws it decides whether the layout's flashes play
TheInGameUI->themeQuitMenu( quitMenuLayout->getFirstWindow() );
+ showQuitMenuLayout( group );
//quitMenuLayout->hide(FALSE);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 25c65ea98..2f0bb8cce 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -1280,10 +1280,12 @@ InGameUI::InGameUI()
m_promotionPageLoaded = FALSE;
m_promotionShownMs = 0;
m_promotionDrawnAt = 0;
+ m_promotionClosing = FALSE;
m_quitMenuOverlay = NULL;
m_quitMenuPageLoaded = FALSE;
m_quitMenuShownMs = 0;
m_quitMenuDrawnAt = 0;
+ m_quitMenuClosingMs = -1;
m_controlBarPageShown = FALSE;
m_tooltipOverlay = NULL;
m_tooltipPageLoaded = FALSE;
@@ -13443,7 +13445,11 @@ static const Int PROMOTION_NOT_DRAWN = -1;
void InGameUI::openPromotionPage( void )
{
- m_promotionShownMs = PROMOTION_NOT_DRAWN;
+ // opened again while it was still going, it comes back up from where the going had got to
+ if( m_promotionClosing )
+ m_promotionClosing = FALSE;
+ else
+ m_promotionShownMs = TheGlobalData->m_animateWindows ? PROMOTION_NOT_DRAWN : PROMOTION_FADE_MS;
}
void InGameUI::drawPromotionPage( GameWindow *parent, Bool front )
@@ -13477,16 +13483,26 @@ void InGameUI::drawPromotionPage( GameWindow *parent, Bool front )
screen.hi.y = TheDisplay->getHeight();
putPageRect( values, "screen", screen, TRUE );
- // the back draws first each picture and moves the coming up on for both layers
+ // the back draws first each picture and moves the coming up, or the going, on for both layers;
+ // gone, the screen is hidden and draws no more
if( !front )
{
const UnsignedInt now = Clock_Milliseconds();
- if( m_promotionShownMs == PROMOTION_NOT_DRAWN )
+ const Int step = min( (Int)( now - m_promotionDrawnAt ), PROMOTION_MOST_MS_A_PICTURE );
+ if( m_promotionClosing )
+ m_promotionShownMs = max( 0, m_promotionShownMs ) - step;
+ else if( m_promotionShownMs == PROMOTION_NOT_DRAWN )
m_promotionShownMs = 0;
else
- m_promotionShownMs = min( m_promotionShownMs + min( (Int)( now - m_promotionDrawnAt ), PROMOTION_MOST_MS_A_PICTURE ),
- PROMOTION_FADE_MS );
+ m_promotionShownMs = min( m_promotionShownMs + step, PROMOTION_FADE_MS );
m_promotionDrawnAt = now;
+ if( m_promotionClosing && m_promotionShownMs <= 0 )
+ {
+ m_promotionClosing = FALSE;
+ m_promotionShownMs = 0;
+ parent->winHide( TRUE );
+ return;
+ }
}
overlay->setAlpha( max( 0, m_promotionShownMs ) * OPAQUE_PAGE / PROMOTION_FADE_MS );
@@ -13591,6 +13607,9 @@ enum
* keys had all come in within four pictures: they seemed to pop up with no fade at all. */
static const Int QUIT_MENU_MOST_MS_A_PICTURE = 25;
static const Int QUIT_MENU_NOT_DRAWN = -1; ///< m_quitMenuShownMs until the menu's first picture
+static const Int QUIT_MENU_NOT_CLOSING = -1; ///< m_quitMenuClosingMs while the menu is not going
+/** Far enough into the coming up that every one of the five keys is in and done flashing. */
+static const Int QUIT_MENU_WHOLE_MS = QUIT_MENU_KEY_FIRST_MS + 4 * QUIT_MENU_KEY_STEP_MS + QUIT_MENU_KEY_FLASH_MS;
/** A window of the same layout as `parent`, by its name there. */
static GameWindow *quitMenuWindow( GameWindow *parent, const char *name )
@@ -13615,7 +13634,9 @@ void InGameUI::themeQuitMenu( GameWindow *parent )
if( m_quitMenuPage.empty() )
return;
- m_quitMenuShownMs = QUIT_MENU_NOT_DRAWN;
+ // with window animation off the menu is simply there, every key already in
+ m_quitMenuShownMs = TheGlobalData->m_animateWindows ? QUIT_MENU_NOT_DRAWN : QUIT_MENU_WHOLE_MS;
+ m_quitMenuClosingMs = QUIT_MENU_NOT_CLOSING;
parent->winSetDrawFunc( drawQuitMenu );
for( Int key = 0; key < (Int)ARRAY_SIZE( QUIT_MENU_KEYS ); key++ )
{
@@ -13699,14 +13720,27 @@ void InGameUI::drawQuitMenuPage( GameWindow *parent )
// the coming up starts on the menu's first picture and moves on with the wall clock, but never
// by more than QUIT_MENU_MOST_MS_A_PICTURE a picture
+ // The going is the page fading out over QUIT_MENU_FADE_MS from wherever the coming up had got
+ // to, and the menu hidden at the end of it
const UnsignedInt now = Clock_Milliseconds();
- if( m_quitMenuShownMs == QUIT_MENU_NOT_DRAWN )
+ const Int step = min( (Int)( now - m_quitMenuDrawnAt ), QUIT_MENU_MOST_MS_A_PICTURE );
+ if( m_quitMenuClosingMs != QUIT_MENU_NOT_CLOSING )
+ m_quitMenuClosingMs += step;
+ else if( m_quitMenuShownMs == QUIT_MENU_NOT_DRAWN )
m_quitMenuShownMs = 0;
else
- m_quitMenuShownMs += min( (Int)( now - m_quitMenuDrawnAt ), QUIT_MENU_MOST_MS_A_PICTURE );
+ m_quitMenuShownMs += step;
m_quitMenuDrawnAt = now;
- const Int openMs = m_quitMenuShownMs;
- const Int pageAlpha = min( 255, openMs * 255 / QUIT_MENU_FADE_MS );
+ if( m_quitMenuClosingMs >= QUIT_MENU_FADE_MS )
+ {
+ m_quitMenuClosingMs = QUIT_MENU_NOT_CLOSING;
+ parent->winHide( TRUE );
+ return;
+ }
+ const Int openMs = max( 0, m_quitMenuShownMs );
+ Int pageAlpha = min( 255, openMs * 255 / QUIT_MENU_FADE_MS );
+ if( m_quitMenuClosingMs != QUIT_MENU_NOT_CLOSING )
+ pageAlpha = pageAlpha * ( QUIT_MENU_FADE_MS - m_quitMenuClosingMs ) / QUIT_MENU_FADE_MS;
// a key still fading in is drawn alone on the same page with the rest of it bare, the page having
// no opacity of its own for one element; the keys already whole are on the menu's page
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp
index 1f05fcdf0..399f988aa 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp
@@ -59,6 +59,7 @@
#include "GameClient/Display.h"
#include "GameClient/DisplayStringManager.h"
#include "GameClient/InGameUI.h" // HudReadout_draw, the plate every corner marking stands on
+#include "Common/GlobalData.h"
#include "W3DDevice/GameClient/W3DGameWindow.h"
#include "W3DDevice/GameClient/W3DDisplay.h"
#include "W3DDevice/GameClient/W3DGadget.h"
@@ -107,6 +108,9 @@ static const Int BADGE_LEAST_POINTS = 6;
* nobody found without looking for it. It gets its own size, and an opaque plate under it. */
static const Real COUNT_BADGE_DESIGN_POINTS = 11.0f;
+/** Classic's key letter, the only place its keys are shown. */
+static const Real CLASSIC_KEY_BADGE_DESIGN_POINTS = 10.0f;
+
// getBadgeFont ===============================================================
/** The font the corner markings wear.
*
@@ -185,6 +189,15 @@ static void drawButtonText( GameWindow *window, WinInstanceData *instData )
// left corner, which the button's own art could be any colour under
if( BitTest( window->winGetStatus(), WIN_STATUS_SHORTCUT_BUTTON ) )
{
+ // Classic has no grid places to learn the keys from, so the letter is the one way in: set
+ // larger, and in gold while the button can be pressed
+ if( TheGlobalData->isClassicUI() )
+ {
+ const Bool enabled = BitTest( window->winGetStatus(), WIN_STATUS_ENABLED );
+ drawBadge( window, text->getText(), CLASSIC_KEY_BADGE_DESIGN_POINTS, HUD_READOUT_TOP_LEFT,
+ enabled ? GameMakeColor( 255, 210, 60, 255 ) : textColor );
+ return;
+ }
drawBadge( window, text->getText(), BADGE_DESIGN_POINTS, HUD_READOUT_TOP_LEFT, textColor );
return;
}