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): promotion rows in wells of their own, grid over the cameos

Olcay Seygan2d2a2a9dfb9f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8114a9239..84de1af64 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -502,7 +502,7 @@ found and fixed — EA's own, not port damage.**
- A minimised command bar stays minimised. Changing seats, or clicking another player's unit while watching, put the whole bar back up over the battlefield you had just cleared. A new match still opens with the bar up.
- The command bar's frame is drawn new, in the same steel as the boards. Each panel holds one thing and is exactly its size, the radar, the command grid, the portrait with the experience bar, and wears a steel border outside it. Grey for America, red for China, sand for GLA. It slides and minimises with the bar, and like the boards it is a page in the Window folder; take the page away and the old painted bar comes back.
- Every panel of the bar is only as big as what it holds now, and stands on the bottom of the screen. The radar's border runs out to the screen's left edge, the portrait's to the right edge, and the middle is built up like bricks laid flush: the command grid's panel at the bottom, the power bar standing on its border in a steel frame of its own, a row of forty cells that light up from the left with your production and fill the frame from edge to edge when full, the consumption marked by a white needle, and on top of that a narrower block no taller than the money written on it. Everything the old painting filled round them is battlefield again, and a click there lands on the battlefield.
-- The bar's own buttons are drawn to match, steel caps lit gold under the pointer and pressed in when pushed. The menu is a small square with three bars in the screen's top left corner. The idle worker button is a key like the smoke signals', a hard hat on it, in a steel step against the middle panel's bottom left corner, where it no longer hides the end of the power bar, and the build buttons sit down level with it, a few pixels over the bottom of the screen. Each of the fourteen build places is its own dark cell with steel running between them, so an empty place reads as a slot waiting for a button. The power bar is sunk into the same steel plate as the build grid, the plate carried on upward as wide as it, and the money's block sits on top of that plate with no seam between them: the build grid, the power and the money read as one piece. The power bar is as long as the build grid on every side, where it used to change length from one faction to the next, and the money sits over the grid's middle. The build grid's panel no longer carries an empty strip down its left side. There is no chat button any more: Enter opens the chat as it always did. The portrait sits in the radar's lit steel too. The experience bar beside it is ten gold rungs in a sunk groove, climbing from the bottom as you earn your way to the next rank, and your rank stands in a steel tab on the portrait's top right corner, a key sunk in it like the idle worker's with one star for every rank there is, gold up to the one you hold. The portrait's grid is steel between dark cells on every side, where America's was drawn in blue lines that matched nothing else on the bar. That key is the promotions button: point at it and it comes up with a gold rim, it blinks bright in your side's own steel while you have a promotion to spend, and a click opens the promotion screen. That screen is rebuilt in the same steel and half its old size: each rank's promotions stand in a grid of build-button cells five wide, like the command grid, an empty place a dark hole, a heading and a gap over each rank, your rank and the points to spend on one line over the experience bar, and Done in the last row's spare place. A gold rim marks what you have bought and a light one what you can buy now. The bar has no minimise arrow any more: it is only as big as what it holds. The radar sits sunk in a bezel of lit steel, bright along the top and shadowed down the right, and the build grid and the money wear the same steel, the figure in a dark window of its own, and the under-attack light is a long red lamp set in a steel tab on its top left corner, dark until you are hit and then blinking. No words on it, so it reads the same in any language.
+- The bar's own buttons are drawn to match, steel caps lit gold under the pointer and pressed in when pushed. The menu is a small square with three bars in the screen's top left corner. The idle worker button is a key like the smoke signals', a hard hat on it, in a steel step against the middle panel's bottom left corner, where it no longer hides the end of the power bar, and the build buttons sit down level with it, a few pixels over the bottom of the screen. Each of the fourteen build places is its own dark cell with steel running between them, so an empty place reads as a slot waiting for a button. The power bar is sunk into the same steel plate as the build grid, the plate carried on upward as wide as it, and the money's block sits on top of that plate with no seam between them: the build grid, the power and the money read as one piece. The power bar is as long as the build grid on every side, where it used to change length from one faction to the next, and the money sits over the grid's middle. The build grid's panel no longer carries an empty strip down its left side. There is no chat button any more: Enter opens the chat as it always did. The portrait sits in the radar's lit steel too. The experience bar beside it is ten gold rungs in a sunk groove, climbing from the bottom as you earn your way to the next rank, and your rank stands in a steel tab on the portrait's top right corner, a key sunk in it like the idle worker's with one star for every rank there is, gold up to the one you hold. The portrait's grid is steel between dark cells on every side, where America's was drawn in blue lines that matched nothing else on the bar. That key is the promotions button: point at it and it comes up with a gold rim, it blinks bright in your side's own steel while you have a promotion to spend, and a click opens the promotion screen. That screen is rebuilt in the same steel and half its old size: each rank's promotions stand in a grid of build-button cells five wide, like the command grid, an empty place a dark hole, each rank in a steel well of its own with its heading, the wells a plate's thickness apart, the grid's steel laid over the edge of every picture so the picture sits in its cell like a card in a frame, your rank and the points to spend on one line over the experience bar, and Done in the last row's spare place. A gold rim marks what you have bought and a light one what you can buy now. The bar has no minimise arrow any more: it is only as big as what it holds. The radar sits sunk in a bezel of lit steel, bright along the top and shadowed down the right, and the build grid and the money wear the same steel, the figure in a dark window of its own, and the under-attack light is a long red lamp set in a steel tab on its top left corner, dark until you are hit and then blinking. No words on it, so it reads the same in any language.
- The general's powers you have bought and can fire, the column that climbed the right edge of the screen, stand over the portrait now in a tray of the bar's own steel. The first sits in the corner against the right edge of the screen, and each one you gain takes the place to the left of the last, three to a row before a new row starts above, so the tray is only ever as big as what you hold and an empty one takes no room at all. Each power sits on a dark cell three quarters the size of a build button, where the side's old tray art used to frame it. It is always out; there is no button to fold it away.
- Three buttons sit in a step of the radar's own steel, on its right: the smoke signals Alt+Z, X and C send, placed in the middle of your view for your allies to see. Each is a key sunk into the steel with a sharp white picture on it instead of a word: a crosshair to attack, a shield to defend, an eye to look. Point at one and it comes up out of its well as lit steel with a gold rim, and it sinks in darker while you hold the button down. They rise into place one after another from the bottom of the screen when the match starts. A game with nobody on your side to see the smoke, a skirmish against the computer or a replay, has no signal buttons at all.
- Tooltips wear the bar's steel. Point at a build button and a card opens right above it rather than in a fixed box at the side: the name on a steel header in your side's colour with the price in gold at its end, every "Power Supplied: 5" or "Strong: infantry" line of the description laid out as a label and a bold figure, the build time, damage and range under a rule, and "not enough money" or what you still need in a sunk red note at the bottom. Point at something on the battlefield and a small dark box beside the pointer names it, its owner's colour in a stripe down the left edge.
diff --git a/GeneralsMD/Code/Data/Window/Html/Promotion.html b/GeneralsMD/Code/Data/Window/Html/Promotion.html
index 82d49b548..c9ca8d96e 100644
--- a/GeneralsMD/Code/Data/Window/Html/Promotion.html
+++ b/GeneralsMD/Code/Data/Window/Html/Promotion.html
@@ -6,11 +6,12 @@
nothing now and still taking their clicks, and the page draws them. Same materials as
Window/Html/ControlBar.html.
- The game fills in, every frame the screen is up (InGameUI::drawPromotionPage):
+ The game fills in, twice every frame the screen is up (InGameUI::drawPromotionPage):
+ {{layer}} "back" under the promotions' buttons, "front" over them
{{side}} "america", "china" or "gla"
{{held}} "held" while the left mouse button is down
{{panel.x}} .y .w .h the screen's plate
- {{well.x}} ... the well the promotions stand in, under the bar and the points
+ data-each="wells" a well round each row and its heading, {{well.x}} .y .w .h
{{Name.x}} .y .w .h StaticTextTitle, ProgressBarExperience, StaticTextRankPointsAvailable and
ButtonExit, each with {{Name.shown}} and {{Name.state}} ("disabled",
"hilite", "pushed")
@@ -70,17 +71,24 @@
.china .heading .rule { background-color: #7a3120; }
.gla .heading .rule { background-color: #766a3a; }
- /* the grid, as the command bar's: every place a dark cell exactly a button's size, steel between
- them, an empty place a hole with its bevel. A promotion's cell carries a rim a pixel outside
- the button that says where it stands - gold once bought, light steel while it can be bought */
+ /* the page is drawn twice a frame: the back under the promotions, the front over them */
+ .front .under, .back .over { display: none; }
+
+ /* the grid, as the command bar's: every place a dark cell, the well's steel between them. The front
+ lays the same steel over the gap and two pixels into each cell, with a bevel inside it, and the
+ promotion fills the hole exactly, so the grid reads as laid over the promotions; a promotion's
+ bevel is a rim that says where it stands - gold once bought, light steel while it can be bought */
.cell { background-color: #020405; }
- .cell .bevel { position: absolute; left: 0; top: 0; right: 0; bottom: 0; border: 1px solid #06090b;
+ .cell.over { background: none; }
+ .cell .frame { position: absolute; left: -1px; top: -1px; right: -1px; bottom: -1px; border: 3px solid #3a414a; }
+ .china .cell .frame { border-color: #45190f; }
+ .gla .cell .frame { border-color: #423a1c; }
+ .cell .bevel { position: absolute; left: 2px; top: 2px; right: 2px; bottom: 2px; border: 1px solid #06090b;
border-bottom-color: #9aa4ae; border-right-color: #9aa4ae; }
.china .cell .bevel { border-bottom-color: #d98a72; border-right-color: #d98a72; }
.gla .cell .bevel { border-bottom-color: #cbbf82; border-right-color: #cbbf82; }
- .cell .rim { display: none; position: absolute; left: -1px; top: -1px; right: -1px; bottom: -1px; border: 1px solid #e8c24a; }
- .cell.owned .rim { display: block; }
- .cell.ready .rim { display: block; border-color: #eef3f7; }
+ .cell.owned .bevel { border-color: #e8c24a; }
+ .cell.ready .bevel { border-color: #eef3f7; }
/* the close button: a key sunk in the steel, lit steel with a gold rim under the pointer, pressed in
while held */
@@ -94,21 +102,22 @@
</style>
</head>
<body>
-<div class="{{side}} {{held}}">
- <div class="piece plate" style="left: {{panel.x}}px; top: {{panel.y}}px; width: {{panel.w}}px; height: {{panel.h}}px"></div>
- <div class="piece well" style="left: {{well.x}}px; top: {{well.y}}px; width: {{well.w}}px; height: {{well.h}}px"></div>
+<div class="{{layer}} {{side}} {{held}}">
+ <div class="piece plate under" style="left: {{panel.x}}px; top: {{panel.y}}px; width: {{panel.w}}px; height: {{panel.h}}px"></div>
+ <div class="piece well under" data-each="wells" style="left: {{well.x}}px; top: {{well.y}}px; width: {{well.w}}px; height: {{well.h}}px"></div>
- <div class="piece title {{StaticTextTitle.shown}}" style="left: {{StaticTextTitle.x}}px; top: {{StaticTextTitle.y}}px; width: {{StaticTextTitle.w}}px; height: {{StaticTextTitle.h}}px; line-height: {{StaticTextTitle.h}}px">{{title}}</div>
- <div class="piece groove {{ProgressBarExperience.shown}}" style="left: {{ProgressBarExperience.x}}px; top: {{ProgressBarExperience.y}}px; width: {{ProgressBarExperience.w}}px; height: {{ProgressBarExperience.h}}px">
+ <div class="piece title under {{StaticTextTitle.shown}}" style="left: {{StaticTextTitle.x}}px; top: {{StaticTextTitle.y}}px; width: {{StaticTextTitle.w}}px; height: {{StaticTextTitle.h}}px; line-height: {{StaticTextTitle.h}}px">{{title}}</div>
+ <div class="piece groove under {{ProgressBarExperience.shown}}" style="left: {{ProgressBarExperience.x}}px; top: {{ProgressBarExperience.y}}px; width: {{ProgressBarExperience.w}}px; height: {{ProgressBarExperience.h}}px">
<div class="rung {{lit}}" data-each="exprungs" style="left: {{x}}px; width: {{w}}px"><div class="seg"></div></div>
<div class="lip"></div>
</div>
- <div class="piece points {{StaticTextRankPointsAvailable.shown}}" style="left: {{StaticTextRankPointsAvailable.x}}px; top: {{StaticTextRankPointsAvailable.y}}px; width: {{StaticTextRankPointsAvailable.w}}px; height: {{StaticTextRankPointsAvailable.h}}px; line-height: {{StaticTextRankPointsAvailable.h}}px">{{points}}</div>
+ <div class="piece points under {{StaticTextRankPointsAvailable.shown}}" style="left: {{StaticTextRankPointsAvailable.x}}px; top: {{StaticTextRankPointsAvailable.y}}px; width: {{StaticTextRankPointsAvailable.w}}px; height: {{StaticTextRankPointsAvailable.h}}px; line-height: {{StaticTextRankPointsAvailable.h}}px">{{points}}</div>
- <div class="piece heading" data-each="headings" style="left: {{heading.x}}px; top: {{heading.y}}px; width: {{heading.w}}px; height: {{heading.h}}px">{{label}}<div class="rule"></div></div>
- <div class="piece cell {{state}}" data-each="cells" style="left: {{cell.x}}px; top: {{cell.y}}px; width: {{cell.w}}px; height: {{cell.h}}px"><div class="bevel"></div><div class="rim"></div></div>
+ <div class="piece heading under" data-each="headings" style="left: {{heading.x}}px; top: {{heading.y}}px; width: {{heading.w}}px; height: {{heading.h}}px">{{label}}<div class="rule"></div></div>
+ <div class="piece cell under" data-each="cells" style="left: {{cell.x}}px; top: {{cell.y}}px; width: {{cell.w}}px; height: {{cell.h}}px"></div>
+ <div class="piece cell over {{state}}" data-each="cells" style="left: {{cell.x}}px; top: {{cell.y}}px; width: {{cell.w}}px; height: {{cell.h}}px"><div class="frame"></div><div class="bevel"></div></div>
- <div class="piece close {{ButtonExit.shown}} {{ButtonExit.state}}" style="left: {{ButtonExit.x}}px; top: {{ButtonExit.y}}px; width: {{ButtonExit.w}}px; height: {{ButtonExit.h}}px"><div class="label">{{text:GUI:CloseExpScreen}}</div></div>
+ <div class="piece close under {{ButtonExit.shown}} {{ButtonExit.state}}" style="left: {{ButtonExit.x}}px; top: {{ButtonExit.y}}px; width: {{ButtonExit.w}}px; height: {{ButtonExit.h}}px"><div class="label">{{text:GUI:CloseExpScreen}}</div></div>
</div>
</body>
</html>
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 3c56ee085..d69f33301 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -409,7 +409,7 @@ public: // ********************************************************************
Bool handleControlBarPageClick( const ICoord2D *mouse, Bool act );
/** The general's promotion screen, Window/Html/Promotion.html, drawn as `parent`'s picture: the
* screen's windows keep their clicks and the promotions' own cameos paint over it. */
- void drawPromotionPage( GameWindow *parent );
+ void drawPromotionPage( GameWindow *parent, Bool front );
void drawScoreboard( void ); ///< that scoreboard, over everything
/** Window/Html/Tooltip.html is there to draw with, in a match. */
Bool isTooltipPageReady( void );
@@ -1226,6 +1226,7 @@ protected:
std::string m_tooltipPage;
ICoord2D m_tooltipSize; ///< the box as last laid out, in screen pixels, to place the next one by
HtmlOverlay * m_promotionOverlay;
+ HtmlOverlay * m_promotionFrontOverlay; ///< the grid's frames, drawn over the promotions
Bool m_promotionPageLoaded;
std::string m_promotionPage;
Bool m_signalsWereShown; ///< the smoke signal column was up last frame
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index e55edc5d4..71b73ffc5 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -1204,6 +1204,7 @@ InGameUI::InGameUI()
m_controlBarOverlay = NULL;
m_controlBarPageLoaded = FALSE;
m_promotionOverlay = NULL;
+ m_promotionFrontOverlay = NULL;
m_promotionPageLoaded = FALSE;
m_controlBarPageShown = FALSE;
m_tooltipOverlay = NULL;
@@ -1335,6 +1336,8 @@ InGameUI::~InGameUI()
m_controlBarOverlay = NULL;
delete m_promotionOverlay;
m_promotionOverlay = NULL;
+ delete m_promotionFrontOverlay;
+ m_promotionFrontOverlay = NULL;
delete m_tooltipOverlay;
m_tooltipOverlay = NULL;
}
@@ -10985,14 +10988,14 @@ static const struct PromotionRow
enum
{
PROMOTION_COLUMNS = 5, ///< the widest row, the middle one
- PROMOTION_MARGIN = 6, ///< the plate round the well, and the well's gap under the bar
- PROMOTION_INSET = 4, ///< the well round the cells
+ PROMOTION_MARGIN = 6, ///< the plate round the wells, and between one well and the next
+ PROMOTION_INSET = 4, ///< a well round its heading and cells
PROMOTION_CELL_GAP = 2,
+ PROMOTION_FRAME = 3, ///< the front's frame and bevel over a cell's edge; the promotion fills the hole inside
PROMOTION_TITLE = 14, ///< the rank's name's line, the points beside it
PROMOTION_BAR = 7, ///< the experience bar under it
PROMOTION_BAR_GAP = 3,
- PROMOTION_HEADING = 14, ///< a row's heading over its first button
- PROMOTION_SECTION = 8 ///< between one row's last cells and the next row's heading
+ PROMOTION_HEADING = 14 ///< a row's heading over its first button
};
/** One place in the screen's grids, screen pixels, and the promotion's button standing in it: NULL
@@ -11008,7 +11011,7 @@ struct PromotionLayout
{
std::vector< PromotionPlace > places;
std::vector< IRegion2D > headings; ///< one over each row, in PROMOTION_ROWS' order
- IRegion2D well;
+ std::vector< IRegion2D > wells; ///< one round each row and its heading, the same order
};
static GameWindow *promotionWindow( const std::string &name )
@@ -11027,10 +11030,11 @@ static void placePromotionWindow( const std::string &name, Int x, Int y, Int wid
//-------------------------------------------------------------------------------------------------
/** The promotion screen laid out compact, every frame it draws, over the layout's own places: each
* row a grid five places wide in command button cells with a hair of steel between them, the way
- * the command bar's grid is, a heading over it and a gap before the next; the rank's name and the
- * points on one line with the bar under them, and the close button in the last row's fifth place,
- * which no side fills. Centred at the top of the screen where the layout hung it. `layout` gets
- * every place, filled or not, the headings and the well, in screen pixels. */
+ * the command bar's grid is, in a well of its own with its heading, a plate's margin between one
+ * well and the next; the rank's name and the points on one line with the bar under them, and the
+ * close button in the last row's fifth place, which no side fills. Centred at the top of the screen
+ * where the layout hung it. `layout` gets every place, filled or not, the headings and the wells,
+ * in screen pixels. */
//-------------------------------------------------------------------------------------------------
static void layoutPromotionScreen( GameWindow *parent, PromotionLayout &layout )
{
@@ -11043,6 +11047,7 @@ static void layoutPromotionScreen( GameWindow *parent, PromotionLayout &layout )
const Int margin = Page::px( PROMOTION_MARGIN, scale );
const Int inset = Page::px( PROMOTION_INSET, scale );
const Int heading = Page::px( PROMOTION_HEADING, scale );
+ const Int frame = Page::px( PROMOTION_FRAME, scale );
const Int gridWidth = PROMOTION_COLUMNS * cellWidth + ( PROMOTION_COLUMNS - 1 ) * gap;
const Int width = gridWidth + 2 * ( margin + inset );
@@ -11060,16 +11065,21 @@ static void layoutPromotionScreen( GameWindow *parent, PromotionLayout &layout )
parentX = ( TheDisplay->getWidth() - width ) / 2;
parent->winSetPosition( parentX, parentY );
- // the well stands a margin under the bar and the points, and the cells an inset inside it
- const Int wellTop = margin + titleHeight + Page::px( PROMOTION_BAR_GAP + PROMOTION_BAR, scale ) + margin;
- Int y = wellTop + inset;
+ // each row's well stands a margin under the one before, the first a margin under the bar and the
+ // points, and the heading and the cells an inset inside it
+ Int y = margin + titleHeight + Page::px( PROMOTION_BAR_GAP + PROMOTION_BAR, scale );
const Int left = margin + inset;
layout.places.clear();
layout.headings.clear();
+ layout.wells.clear();
for( Int row = 0; row < (Int)ARRAY_SIZE( PROMOTION_ROWS ); row++ )
{
- if( row > 0 )
- y += Page::px( PROMOTION_SECTION, scale );
+ y += margin;
+ IRegion2D well;
+ well.lo.x = parentX + margin;
+ well.hi.x = parentX + width - margin;
+ well.lo.y = parentY + y;
+ y += inset;
IRegion2D title;
title.lo.x = parentX + left;
title.hi.x = title.lo.x + gridWidth;
@@ -11101,32 +11111,37 @@ static void layoutPromotionScreen( GameWindow *parent, PromotionLayout &layout )
else if( number < PROMOTION_ROWS[ row ].count )
{
const std::string name = PROMOTION_ROWS[ row ].buttons + std::to_string( number );
- placePromotionWindow( name, x, top, cellWidth, cellHeight );
+ placePromotionWindow( name, x + frame, top + frame, cellWidth - 2 * frame, cellHeight - 2 * frame );
place.button = promotionWindow( name );
}
layout.places.push_back( place );
}
}
- y += depth * ( cellHeight + gap ) - gap;
+ y += depth * ( cellHeight + gap ) - gap + inset;
+ well.hi.y = parentY + y;
+ layout.wells.push_back( well );
}
- const Int height = y + inset + margin;
- parent->winSetSize( width, height );
- layout.well.lo.x = parentX + margin;
- layout.well.hi.x = parentX + width - margin;
- layout.well.lo.y = parentY + wellTop;
- layout.well.hi.y = parentY + height - margin;
+ parent->winSetSize( width, y + margin );
}
/** The screen's picture, drawn by the page while it is there. */
static void drawPromotionScreen( GameWindow *window, WinInstanceData *instData )
{
- TheInGameUI->drawPromotionPage( window );
+ TheInGameUI->drawPromotionPage( window, FALSE );
+}
+
+/** The grid's frames over the promotions, drawn by the child that draws last. */
+static void drawPromotionScreenFront( GameWindow *window, WinInstanceData *instData )
+{
+ TheInGameUI->drawPromotionPage( window->winGetParent(), TRUE );
}
/** The promotion screen hands its look to the page: the parent draws the page, and every child but
* the promotions' own buttons draws nothing - the side's painting, the titles, the bar and its frame
- * and the close button are the page's. They all keep their clicks. */
+ * and the close button are the page's. They all keep their clicks. The title is moved to the head
+ * of the children, which draw from the tail, so it draws after the promotions and puts the grid's
+ * frames over their edges; it stands clear of every button, so it takes no click from one. */
static void standDownPromotionScreen( void )
{
GameWindow *parent = promotionWindow( "GenExpParent" );
@@ -11140,6 +11155,11 @@ static void standDownPromotionScreen( void )
if( !child->winGetInstanceData()->m_decoratedNameString.startsWith( buttonName.c_str() ) )
child->winSetDrawFunc( drawNothing );
}
+
+ GameWindow *front = promotionWindow( "StaticTextTitle" );
+ if( parent->winGetChild() != front )
+ front->winBringToTop();
+ front->winSetDrawFunc( drawPromotionScreenFront );
}
/** "owned", "ready" or "locked" for one promotion's button, by the state the bar left it in: enabled
@@ -11154,9 +11174,10 @@ static const char *promotionState( GameWindow *button )
//-------------------------------------------------------------------------------------------------
/** The general's promotion screen from Window/Html/Promotion.html, in the place of the side's
* painting. Everything is placed from the screen's own windows, so it goes where the layout and
- * the scheme put them; the promotions are the bar's buttons and paint over it. */
+ * the scheme put them; the promotions are the bar's buttons and paint over the back of the page,
+ * and the `front` of it, the grid's frames, paints over them. */
//-------------------------------------------------------------------------------------------------
-void InGameUI::drawPromotionPage( GameWindow *parent )
+void InGameUI::drawPromotionPage( GameWindow *parent, Bool front )
{
enum
{
@@ -11164,15 +11185,17 @@ void InGameUI::drawPromotionPage( GameWindow *parent )
FULL = 100
};
- if( m_promotionOverlay == NULL )
- m_promotionOverlay = new HtmlOverlay( m_superweaponNormalFont );
+ HtmlOverlay *&overlay = front ? m_promotionFrontOverlay : m_promotionOverlay;
+ if( overlay == NULL )
+ overlay = new HtmlOverlay( m_superweaponNormalFont );
- // laid out here, the parent's own draw, so every child is in its place before it draws
+ // laid out in the parent's own draw, the back, so every child is in its place before it draws
PromotionLayout layout;
layoutPromotionScreen( parent, layout );
HtmlValues values;
HtmlLists lists;
+ values[ "layer" ] = front ? "front" : "back";
values[ "side" ] = spectatorSide();
values[ "held" ] = TheMouse->getMouseStatus()->leftState != MBS_Up ? "held" : "";
@@ -11209,9 +11232,15 @@ void InGameUI::drawPromotionPage( GameWindow *parent )
rungs.push_back( entry );
}
- // the promotions stand in a well of steel, a dark cell for every place of every row, filled or
- // not, as the command grid's are, and each row's heading over it
- putPageRect( values, "well", layout.well, TRUE );
+ // each row of promotions stands in a well of steel, a dark cell for every place, filled or not,
+ // as the command grid's are, its heading over it
+ std::vector< HtmlValues > &wells = lists[ "wells" ];
+ for( size_t row = 0; row < layout.wells.size(); row++ )
+ {
+ HtmlValues entry;
+ putPageRect( entry, "well", layout.wells[ row ], TRUE );
+ wells.push_back( entry );
+ }
GameWindow *exit = promotionWindow( "ButtonExit" );
std::vector< HtmlValues > &cells = lists[ "cells" ];
for( size_t each = 0; each < layout.places.size(); each++ )
@@ -11234,9 +11263,9 @@ void InGameUI::drawPromotionPage( GameWindow *parent )
headings.push_back( entry );
}
- m_promotionOverlay->setPage( HtmlTemplate_expand( m_promotionPage, values, lists, lookupGameText ) );
- m_promotionOverlay->hover( TheMouse->getMouseStatus()->pos );
- m_promotionOverlay->draw();
+ overlay->setPage( HtmlTemplate_expand( m_promotionPage, values, lists, lookupGameText ) );
+ overlay->hover( TheMouse->getMouseStatus()->pos );
+ overlay->draw();
}
//-------------------------------------------------------------------------------------------------