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.

merge: centred hud, console at the bottom and superweapon alert banner

Olcay Seyganfde4810f1797
diff --cc GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 2e80e0a20,28c660a44..ff397ee46
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@@ -1551,9 -1546,9 +1561,11 @@@ protected
Bool m_controlBarPageLoaded;
Bool m_controlBarPageShown; ///< drawn this frame, so its buttons can be clicked
std::string m_controlBarPage;
+ HtmlValues m_controlBarValues; ///< the page's values, every key written every frame, kept so the nodes are reused
+ HtmlLists m_controlBarLists; ///< its lists the same way, each entry's keys the same every frame
Bool m_controlBarPageHovered; ///< the pointer was on something the page drew, last frame
+ std::vector< IRegion2D > m_controlBarSolids; ///< the page's .solid rectangles on screen, as last drawn
+ std::vector< IRegion2D > m_controlBarKeys; ///< its data-click keys on screen, which stand in the solids
HtmlOverlay * m_netOverlay;
Bool m_netPageLoaded;
std::string m_netPage;
diff --cc GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index b3acc2bc5,bba9bc1c4..f764e2cba
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@@ -11409,16 -11556,86 +11597,86 @@@ static void putFrame( HtmlValues &value
values[ name + ".shown" ] = shown ? "shown" : "hidden";
}
- /** A tab of `width` by `height` 800x600 pixels standing on `box`'s top edge, from its left or its right. */
- static IRegion2D tabOn( const IRegion2D &box, Int width, Int height, Bool fromRight )
+ /** The console's next well, `width` screen pixels wide from `left` between `top` and `bottom`, and
+ * `left` moved on past it and the `gap` of steel after it. */
+ static IRegion2D nextWell( Int &left, Int width, Int top, Int bottom, Int gap )
{
+ IRegion2D well;
+ well.lo.x = left;
+ well.hi.x = left + width;
+ well.lo.y = top;
+ well.hi.y = bottom;
+ left = well.hi.x + gap;
+ return well;
+ }
+
+ /** The header strip over a well of the console, the same width. */
+ static IRegion2D wellHeader( const IRegion2D &well, Real scale )
+ {
+ IRegion2D header = well;
+ header.hi.y = well.lo.y - REAL_TO_INT( HEADER_GAP * scale );
+ header.lo.y = header.hi.y - REAL_TO_INT( HEADER_HEIGHT * scale );
+ return header;
+ }
+
+ /** A well of the console for the page, data-each="wells": {{well.x}} .y .w .h and, when `headed`, the
- * header strip over it, {{header.x}} .y .w .h. */
-static void putWell( std::vector< HtmlValues > &wells, const IRegion2D &well, Bool shown, Bool headed, Real scale )
++ * header strip over it, {{header.x}} .y .w .h. `filled` is how many of the list's entries this frame
++ * has written, and the caller cuts the list to it. */
++static void putWell( std::vector< HtmlValues > &wells, size_t &filled, const IRegion2D &well, Bool shown, Bool headed, Real scale )
+ {
+ if( !shown )
+ return;
- HtmlValues entry;
++ HtmlValues &entry = listEntry( wells, filled++ );
+ putPageRect( entry, "well", well, TRUE, scale );
+ putPageRect( entry, "header", wellHeader( well, scale ), headed, scale );
- wells.push_back( entry );
+ }
+
+ /** A lone unit's name, rank and health for the page, beside its portrait `portrait` in the
+ * selection's well `well`: {{selinfo.x}} .y .w .h, {{sel.name}}, data-each="selstars" a star for
+ * each veterancy level it has, {{sel.health}} "820/1000", {{sel.healthw}} the bar's lit width in
+ * page pixels out of selinfo.w, and {{sel.healthstate}} "green", "yellow" or "red". */
+ static void putSelectedUnit( HtmlValues &values, std::vector< HtmlValues > &stars, const IRegion2D &portrait,
+ const IRegion2D &well, Bool shown )
+ {
+ enum { INFO_GAP = 6, HEALTH_YELLOW_PERCENT = 50, HEALTH_RED_PERCENT = 25, STAR_PITCH = 11 };
const Real scale = ControlBarHudScale();
- IRegion2D tab;
- tab.hi.y = box.lo.y;
- tab.lo.y = tab.hi.y - REAL_TO_INT( height * scale );
- tab.lo.x = fromRight ? box.hi.x - REAL_TO_INT( width * scale ) : box.lo.x;
- tab.hi.x = fromRight ? box.hi.x : box.lo.x + REAL_TO_INT( width * scale );
- return tab;
+ IRegion2D info = portrait;
+ info.lo.x = portrait.hi.x + REAL_TO_INT( INFO_GAP * scale );
+ info.hi.x = well.hi.x - REAL_TO_INT( INFO_GAP * scale );
+ // the drawable the bar's portrait is of, which is the one selected
+ const Drawable *drawable = TheControlBar->getContextDrawable();
+ const Object *object = drawable ? drawable->getObject() : NULL;
+ shown = shown && object != NULL;
+ putPageRect( values, "selinfo", info, shown, scale );
+ stars.clear();
+ if( !shown )
+ return;
+
+ // an enemy in disguise is what he looks like, as his portrait is (ControlBar::setPortraitByObject):
+ // the disguise's name, and no rank or health, which are his own
+ if( drawable->getStealthLook() == STEALTHLOOK_DISGUISED_ENEMY )
+ {
+ values[ "sel.name" ] = WideCharStringToMultiByte( drawable->getTemplate()->getDisplayName().str() );
+ values[ "sel.healthshown" ] = "hidden";
+ return;
+ }
+
+ values[ "sel.name" ] = WideCharStringToMultiByte( object->getTemplate()->getDisplayName().str() );
+ values[ "sel.healthshown" ] = "";
+ for( Int level = LEVEL_VETERAN; level <= object->getVeterancyLevel(); level++ )
+ {
+ HtmlValues star;
+ star[ "x" ] = std::to_string( ( level - LEVEL_VETERAN ) * STAR_PITCH );
+ stars.push_back( star );
+ }
+
+ const BodyModuleInterface *body = object->getBodyModule();
+ const Int health = (Int)REAL_TO_INT_CEIL( body->getHealth() );
+ const Int maxHealth = max( 1, (Int)REAL_TO_INT_CEIL( body->getMaxHealth() ) );
+ const Int percent = health * PERCENT / maxHealth;
+ values[ "sel.health" ] = std::to_string( health ) + "/" + std::to_string( maxHealth );
+ values[ "sel.healthw" ] = std::to_string( atoi( values[ "selinfo.w" ].c_str() ) * health / maxHealth );
+ values[ "sel.healthstate" ] = percent <= HEALTH_RED_PERCENT ? "red" : percent <= HEALTH_YELLOW_PERCENT ? "yellow" : "green";
}
static GameWindow *numberedWindow( const char *prefix, Int number )
@@@ -11649,12 -11856,14 +11897,15 @@@ void InGameUI::drawNetPage( void
if( m_netPage.empty() )
return;
if( m_netOverlay == NULL )
+ {
m_netOverlay = new HtmlOverlay( m_superweaponNormalFont );
+ m_netOverlay->setHudPage( TRUE );
+ }
- HtmlValues values = m_hudValues;
- values[ "side" ] = spectatorSide();
- m_netOverlay->setPage( HtmlTemplate_expand( m_netPage, values, HtmlLists(), lookupGameText ) );
+ // into the readings themselves rather than a copy of them made every frame; nothing else reads
+ // them, and the next sample clears them
+ m_hudValues[ "side" ] = spectatorSide();
+ m_netOverlay->setPage( HtmlTemplate_expand( m_netPage, m_hudValues, HtmlLists(), lookupGameText ) );
m_netOverlay->draw();
}
@@@ -11763,28 -11993,58 +12040,60 @@@ Bool InGameUI::drawControlBarPage( cons
const Int foot = barBottom() - REAL_TO_INT( PANEL_FOOT * scale );
const Bool leftShown = panelCount > 0 && shown[ 0 ];
const Bool centreShown = panelCount > 1 && shown[ 1 ];
- HtmlLists lists;
+ HtmlLists &lists = m_controlBarLists;
- // the radar, and the experience bar's groove beside it as tall as it; its own window stood on the
- // right panel, which is gone. The left panel holds the two. layoutPanels puts the radar at the
- // uniform scale, so it is put again at the HUD's
GameWindow *radarWindow = controlBarWindow( "LeftHUD" );
const Bool leftFound = leftShown && !radarWindow->winIsHidden();
- // the radar stands as tall as the command grid's panel and the power bar's over it together, so its
- // panel's top is level with the power bar's, the owner's call of 2026-09-28, and keeps its shape
- IRegion2D content;
- content.hi.y = foot;
- content.lo.y = content.hi.y - REAL_TO_INT( COMMAND_ROWS * ( COMMAND_CELL_HEIGHT + CELL_GAP ) * scale ) - 2 * border
- - REAL_TO_INT( POWER_WIDTH * scale );
- content.lo.x = border;
- content.hi.x = content.lo.x + ( content.hi.y - content.lo.y ) * RADAR_WIDTH / RADAR_HEIGHT;
- TheControlBar->placeWindowAt( radarWindow, content );
- IRegion2D experience = content;
- experience.lo.x = content.hi.x + REAL_TO_INT( EXPERIENCE_GAP * scale );
- experience.hi.x = experience.lo.x + REAL_TO_INT( EXPERIENCE_WIDTH * scale );
- content.hi.x = experience.hi.x;
- const IRegion2D leftBox = framed( content, border, TRUE, FALSE );
- putFrame( values, "left", content, leftBox, leftFound );
+ // not there at all where the keys would do nothing either, a game with no allies to see the smoke
+ const Bool signalsShown = leftFound && signalsAllowed();
+
+ // every well is the command grid's height and a header over it, but the radar's, which reaches up
+ // through the header's height to the console's top line and keeps its shape in that, the
+ // experience bar's groove beside it. A watcher has no grid and no powers, and his console is the
+ // rest of it
+ const Int wellHeight = REAL_TO_INT( COMMAND_ROWS * ( COMMAND_CELL_HEIGHT + CELL_GAP ) * scale );
+ const Int consoleTopLine = foot - wellHeight - REAL_TO_INT( ( HEADER_GAP + HEADER_HEIGHT ) * scale );
+ const Int radarWidth = ( foot - consoleTopLine ) * RADAR_WIDTH / RADAR_HEIGHT;
+ const Int radarWellWidth = radarWidth + REAL_TO_INT( ( EXPERIENCE_GAP + EXPERIENCE_WIDTH ) * scale );
+ const Int selectionWellWidth = REAL_TO_INT( PORTRAIT_PLACES * ( CELL_WIDTH + CELL_GAP ) * scale );
+ const Int gridWellWidth = REAL_TO_INT( COMMAND_COLUMNS * ( COMMAND_CELL_WIDTH + CELL_GAP ) * scale );
+ const ICoord2D cell = cellSize();
+ const Int cellGap = REAL_TO_INT( SKILL_CELL_GAP * scale );
+ Int consoleWidth = radarWellWidth + border + selectionWellWidth;
+ if( centreShown )
+ consoleWidth += border + gridWellWidth + powersTrayWidth( scale );
+
+ Int wellLeft = ( (Int)TheDisplay->getWidth() - consoleWidth ) / 2;
+ const IRegion2D radarWell = nextWell( wellLeft, radarWellWidth, consoleTopLine, foot, border );
+ const IRegion2D selectionWell = nextWell( wellLeft, selectionWellWidth, foot - wellHeight, foot, border );
+ const IRegion2D gridWell = nextWell( wellLeft, gridWellWidth, foot - wellHeight, foot, border );
+
+ IRegion2D wells;
+ wells.lo.x = radarWell.lo.x;
+ wells.hi.x = centreShown ? gridWell.hi.x : selectionWell.hi.x;
+ wells.lo.y = consoleTopLine;
+ wells.hi.y = foot;
+ const IRegion2D consoleBox = framed( wells, border );
+ const Bool consoleShown = leftFound || centreShown;
+ putFrame( values, "console", wells, consoleBox, consoleShown );
+ m_consoleTop = consoleShown ? consoleBox.lo.y : barBottom();
+ // the production queue stands on the console over the selection's well
+ m_queueCorner.x = selectionWell.lo.x;
+ m_queueCorner.y = m_consoleTop;
+
+ std::vector< HtmlValues > &wellList = lists[ "wells" ];
- putWell( wellList, radarWell, leftFound, FALSE, scale );
- putWell( wellList, selectionWell, consoleShown, TRUE, scale );
- putWell( wellList, gridWell, centreShown, TRUE, scale );
++ size_t wellsFilled = 0;
++ putWell( wellList, wellsFilled, radarWell, leftFound, FALSE, scale );
++ putWell( wellList, wellsFilled, selectionWell, consoleShown, TRUE, scale );
++ putWell( wellList, wellsFilled, gridWell, centreShown, TRUE, scale );
++ wellList.resize( wellsFilled );
+
+ // the radar at the HUD's scale, layoutPanels having put it at the uniform one
+ IRegion2D radar = radarWell;
+ radar.hi.x = radar.lo.x + radarWidth;
+ TheControlBar->placeWindowAt( radarWindow, radar );
+ IRegion2D experience = radarWell;
+ experience.lo.x = experience.hi.x - REAL_TO_INT( EXPERIENCE_WIDTH * scale );
putPageRect( values, "expframe", experience, leftFound, scale );
putExperienceBar( values, lists[ "expcells" ], lists[ "rankstars" ] );
@@@ -11925,113 -12262,109 +12311,101 @@@
for( size_t tile = 0; tile < allTiles.size(); tile++ )
if( allTiles[ tile ] && !allTiles[ tile ]->winIsHidden() )
tiles.push_back( allTiles[ tile ] );
- Int rows = 1;
- while( (Int)tiles.size() > rows * rows * PORTRAIT_PLACES )
- rows++;
- // a column of `rows` tiles is one cell wide. A multi-selection shows each type once, its own tile
- // with its count, the focused one lit: the portrait of the focused type would be that type again,
- // so the owner had it taken off and its window is shrunk to nothing
+ // a group's types fill the well in rows of PORTRAIT_PLACES, three of them; more than that take
+ // cells a half, then a third the size, twice and three times as many rows and columns. A
+ // multi-selection shows each type once, its own tile with its count, the focused one lit: the
+ // portrait of the focused type would be that type again, so the owner had it taken off and its
+ // window is shrunk to nothing
+ Int fold = 1;
+ while( (Int)tiles.size() > fold * fold * PORTRAIT_PLACES * SELECTION_ROWS )
+ fold++;
const Bool multi = !tiles.empty();
- const Int columns = multi ? ( (Int)tiles.size() + rows - 1 ) / rows : (Int)upgrades.size();
- const Int portraitWidth = multi ? 0 : PORTRAIT_WIDTH + CELL_GAP;
-
- IRegion2D portraitBox;
- portraitBox.lo.x = centreShown ? centreBox.hi.x + border : commandBox.lo.x;
- portraitBox.hi.y = foot;
- portraitBox.lo.y = portraitBox.hi.y - REAL_TO_INT( ( CELL_HEIGHT + CELL_GAP ) * scale );
- portraitBox.hi.x = portraitBox.lo.x + REAL_TO_INT( ( portraitWidth + columns * ( CELL_WIDTH + CELL_GAP ) ) * scale );
- const IRegion2D portraitFrame = framed( portraitBox, border, FALSE, FALSE );
- putFrame( values, "portrait", portraitBox, portraitFrame, portraitShown );
- TheControlBar->placeWindowAt( controlBarWindow( "RightHUD" ), portraitBox );
- TheControlBar->placeWindowAt( controlBarWindow( "WinUnitSelected" ), portraitBox );
- IRegion2D portraitCell = gridCell( portraitBox, 0, 0, CELL_WIDTH, CELL_HEIGHT );
- portraitCell.hi.x = portraitCell.lo.x + ( multi ? 0 : REAL_TO_INT( PORTRAIT_WIDTH * scale ) );
+
+ // the cells stand in the middle of the well's height
+ TheControlBar->placeWindowAt( controlBarWindow( "RightHUD" ), selectionWell );
+ TheControlBar->placeWindowAt( controlBarWindow( "WinUnitSelected" ), selectionWell );
+ IRegion2D placesBox = selectionWell;
+ placesBox.lo.y += ( wellHeight - REAL_TO_INT( SELECTION_ROWS * ( CELL_HEIGHT + CELL_GAP ) * scale ) ) / 2;
+ // a lone unit's portrait two cells high in the top left corner, its name, rank and health beside
+ // it, and its upgrades on the row under it
+ IRegion2D portraitCell = gridCell( placesBox, 0, 0, PORTRAIT_WIDTH * PORTRAIT_SCALE, CELL_HEIGHT * PORTRAIT_SCALE + CELL_GAP );
+ if( multi )
+ portraitCell.hi.x = portraitCell.lo.x;
TheControlBar->placeWindowAt( portraitWindow, portraitCell );
- IRegion2D placesBox = portraitBox;
- if( !multi )
- placesBox.lo.x = portraitCell.hi.x + REAL_TO_INT( ring * scale );
+ putSelectedUnit( values, lists[ "selstars" ], portraitCell, selectionWell, portraitShown && !multi );
std::vector< HtmlValues > &portraitCells = lists[ "portraitcells" ];
+ size_t portraitFilled = 0;
if( portraitShown && !multi )
- {
- HtmlValues entry;
- putCell( entry, portraitCell, ring, scale );
- portraitCells.push_back( entry );
- }
+ putCell( listEntry( portraitCells, portraitFilled++ ), portraitCell, ring, scale );
for( size_t upgrade = 0; upgrade < upgrades.size(); upgrade++ )
{
- const IRegion2D cell = gridCell( placesBox, (Int)upgrade, 0, CELL_WIDTH, CELL_HEIGHT );
+ const IRegion2D cell = gridCell( placesBox, (Int)upgrade, PORTRAIT_SCALE, CELL_WIDTH, CELL_HEIGHT );
TheControlBar->placeWindowAt( upgrades[ upgrade ], cell );
- HtmlValues entry;
- putCell( entry, cell, ring, scale );
if( portraitShown && tiles.empty() )
- portraitCells.push_back( entry );
+ putCell( listEntry( portraitCells, portraitFilled++ ), cell, ring, scale );
}
for( size_t tile = 0; tile < tiles.size(); tile++ )
{
- const IRegion2D cell = gridCell( placesBox, (Int)tile / rows, (Int)tile % rows, CELL_WIDTH, CELL_HEIGHT, 1.0f / rows );
+ const Int across = PORTRAIT_PLACES * fold;
+ const IRegion2D cell = gridCell( placesBox, (Int)tile % across, (Int)tile / across, CELL_WIDTH, CELL_HEIGHT, 1.0f / fold );
TheControlBar->placeWindowAt( tiles[ tile ], cell );
- HtmlValues entry;
- putCell( entry, cell, fold > 1 ? 1 : ring, scale );
if( portraitShown )
- putCell( listEntry( portraitCells, portraitFilled++ ), cell, rows > 1 ? 1 : ring, scale );
- portraitCells.push_back( entry );
++ putCell( listEntry( portraitCells, portraitFilled++ ), cell, fold > 1 ? 1 : ring, scale );
}
+ portraitCells.resize( portraitFilled );
- // the general's powers ready to fire, the first in the corner against the screen's right edge, the
- // row growing left as they come and wrapping upward past three, each a cell's size. They sit in a
- // tray of the panels' steel only as big as they are, standing on the screen's bottom edge right of
- // the command grid where three fit there, and over the grid's end where they do not
- const Int trayBorder = REAL_TO_INT( SKILL_TRAY_BORDER * scale );
- const ICoord2D cell = cellSize();
- const Int cellGap = REAL_TO_INT( SKILL_CELL_GAP * scale );
- const Int trayWidth = SPECIAL_POWER_SHORTCUT_COLS * ( cell.x + cellGap ) + 2 * trayBorder;
+ // the general's powers ready to fire, growing out of the console's right hand end, a column for
+ // each group a key picks: F1's against it, its powers going up from the wells' floor, F2's beside
+ // it and so on, four columns for eleven. Only the powers there are have steel, a column of it
+ // under each column of cells as high as its own, so the plate steps down to the right and there
+ // is never an empty place
ICoord2D corner;
- corner.x = TheDisplay->getWidth() - trayBorder;
- const Int panelRight = portraitShown ? max( centreBox.hi.x, portraitFrame.hi.x ) : centreBox.hi.x;
- corner.y = ( (Int)TheDisplay->getWidth() - panelRight >= trayWidth ? barBottom() : powerBox.lo.y - REAL_TO_INT( SKILL_GRID_GAP * scale ) )
- - trayBorder;
+ corner.x = consoleBox.hi.x;
+ corner.y = foot;
const Int powersShown = TheControlBar->placeSpecialPowerShortcutGrid( centreShown ? &corner : NULL, cell, cellGap );
std::vector< HtmlValues > &places = lists[ "skillcells" ];
for( Int slot = 0; slot < powersShown; slot++ )
{
- const Int column = slot % SPECIAL_POWER_SHORTCUT_COLS;
- const Int row = slot / SPECIAL_POWER_SHORTCUT_COLS;
+ const Int column = slot / SPECIAL_POWER_SHORTCUT_COLS;
+ const Int row = slot % SPECIAL_POWER_SHORTCUT_COLS;
IRegion2D place;
- place.hi.x = corner.x - column * ( cell.x + cellGap );
+ place.lo.x = corner.x + column * ( cell.x + cellGap );
place.hi.y = corner.y - row * ( cell.y + cellGap );
- place.lo.x = place.hi.x - cell.x;
+ place.hi.x = place.lo.x + cell.x;
place.lo.y = place.hi.y - cell.y;
- HtmlValues entry;
- putCell( entry, place, pageRing( cellGap, scale ), scale );
- places.push_back( entry );
+ putCell( listEntry( places, slot ), place, pageRing( cellGap, scale ), scale );
}
+ places.resize( (size_t)max( 0, powersShown ) );
+
- // the tray is cut to each row, as the superweapon strip's is: the full rows of three stand in one
- // plate, and a last row of one or two stands on top of it in steel only as wide as it is, against
- // the screen's edge, rather than the whole tray widening round an empty corner
- const Int fullRows = powersShown / SPECIAL_POWER_SHORTCUT_COLS;
- const Int lastColumns = powersShown % SPECIAL_POWER_SHORTCUT_COLS;
- IRegion2D powers;
- powers.hi = corner;
- powers.lo.x = corner.x - ( fullRows > 0 ? SPECIAL_POWER_SHORTCUT_COLS : lastColumns ) * ( cell.x + cellGap ) + cellGap;
- powers.lo.y = corner.y - max( fullRows, 1 ) * ( cell.y + cellGap ) + cellGap;
- IRegion2D tray = powers;
- tray.lo.x -= trayBorder;
- tray.lo.y -= trayBorder;
- tray.hi.x = TheDisplay->getWidth();
- tray.hi.y += trayBorder;
- putFrame( values, "skilltray", powers, tray, powersShown > 0 );
-
- // the step: its bottom is the gap between its row and the one under it
- const Bool stepShown = powersShown > 0 && fullRows > 0 && lastColumns > 0;
- IRegion2D step;
- step.hi.x = corner.x;
- step.hi.y = powers.lo.y - cellGap;
- step.lo.x = corner.x - lastColumns * ( cell.x + cellGap ) + cellGap;
- step.lo.y = step.hi.y - cell.y;
- IRegion2D stepTray = step;
- stepTray.lo.x -= trayBorder;
- stepTray.lo.y -= trayBorder;
- stepTray.hi.x = TheDisplay->getWidth();
- stepTray.hi.y = powers.lo.y;
- putFrame( values, "skillstep", step, stepTray, stepShown );
+ const Int powerEdge = REAL_TO_INT( POWER_TRAY_EDGE * scale );
+ const Int powerColumns = ( powersShown + SPECIAL_POWER_SHORTCUT_COLS - 1 ) / SPECIAL_POWER_SHORTCUT_COLS;
+ std::vector< HtmlValues > &steel = lists[ "powersteel" ];
+ Int columnTop[ MAX_SPECIAL_POWER_SHORTCUTS ];
+ for( Int column = 0; column < powerColumns; column++ )
+ {
+ const Int cells = min( powersShown - column * SPECIAL_POWER_SHORTCUT_COLS, (Int)SPECIAL_POWER_SHORTCUT_COLS );
+ columnTop[ column ] = corner.y - cells * ( cell.y + cellGap ) + cellGap - powerEdge;
+ }
+ for( Int column = 0; column < powerColumns; column++ )
+ {
+ // a column takes the gap left of its cells, and the last the edge right of them too; its own
+ // shade down its right hand side is the part no column beside it covers
+ IRegion2D plate;
+ plate.lo.x = column == 0 ? consoleBox.hi.x - 1 : corner.x + column * ( cell.x + cellGap ) - cellGap;
+ plate.hi.x = corner.x + column * ( cell.x + cellGap ) + cell.x + ( column + 1 == powerColumns ? powerEdge : 0 );
+ plate.lo.y = columnTop[ column ];
+ plate.hi.y = consoleBox.hi.y;
- HtmlValues entry;
++ HtmlValues &entry = listEntry( steel, column );
+ putPageRect( entry, "plate", plate, TRUE, scale );
+ const Int shadeFoot = column + 1 == powerColumns ? plate.hi.y : columnTop[ column + 1 ];
+ entry[ "shadeh" ] = std::to_string( REAL_TO_INT_FLOOR( ( shadeFoot - plate.lo.y ) / scale + 0.5f ) );
- steel.push_back( entry );
+ }
++ steel.resize( (size_t)max( 0, powerColumns ) );
- // each grid's frames again in front of its buttons, drawn by a window after them
- m_cellFrontCells[ CELL_GRID_COMMAND ] = commandCells;
- m_cellFrontCells[ CELL_GRID_QUEUE ] = portraitCells;
- m_cellFrontCells[ CELL_GRID_POWERS ] = places;
+ // each grid's frames again in front of its buttons, drawn by a window after them; the cells go
+ // over to them once this page is expanded
putFrontWindow( controlBarWindow( "CommandWindow" ), drawCommandGridFront );
// the portrait bar's grid over the portrait, its upgrades and a selection's types, all RightHUD's
putFrontWindow( controlBarWindow( "RightHUD" ), drawQueueGridFront );
@@@ -12071,20 -12404,17 +12445,22 @@@
standDownPromotionScreen();
m_controlBarOverlay->setPage( HtmlTemplate_expand( m_controlBarPage, values, lists, lookupGameText ) );
+ // swapped rather than copied: the front windows get this frame's cells, and the lists get the
+ // front windows' old ones to write the next frame over
+ m_cellFrontCells[ CELL_GRID_COMMAND ].swap( commandCells );
+ m_cellFrontCells[ CELL_GRID_QUEUE ].swap( portraitCells );
+ m_cellFrontCells[ CELL_GRID_POWERS ].swap( places );
m_controlBarPageHovered = m_controlBarOverlay->hover( TheMouse->getMouseStatus()->pos );
m_controlBarOverlay->draw();
+ drawReadoutPage( values );
+ drawAlertPage();
drawNetPage();
- std::vector< IRegion2D > solids;
- m_controlBarOverlay->rectsOf( ".solid", solids );
- std::vector< IRegion2D > buttons;
- m_controlBarOverlay->rectsOf( "[data-click]", buttons );
- TheControlBar->setPageSolids( &solids, &buttons );
+ m_controlBarSolids.clear();
+ m_controlBarOverlay->rectsOf( ".solid", m_controlBarSolids );
+ m_controlBarKeys.clear();
+ m_controlBarOverlay->rectsOf( "[data-click]", m_controlBarKeys );
+ TheControlBar->setPageSolids( &m_controlBarSolids, &m_controlBarKeys );
m_controlBarPageShown = TRUE;
return TRUE;
}