Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(gameclient): command bar to the owner's drawing, portrait bar
Olcay Seygand5f865e83429
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1ce618b1d..875327419 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -624,10 +624,11 @@ A third pass went through the generals' powers, promotions and unit abilities.- Both are an ordinary web page with a stylesheet, in the game's Window folder. Change the colours, the sizes or the order there and the next match you watch draws it that way, and the page opens in a browser too.- 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 command bar is laid out anew, all of it running rightwards from the bottom left corner, and the last quarter of the screen's bottom edge is battlefield but for the general's powers in the corner. The radar sits in the corner with your general's experience bar standing beside it, and on its top edge the skills key with your rank's stars, over the under-attack light. Next to it the command panel keeps every order in the same place whatever you select: the unit's own abilities and upgrades along the top, then attack, stop and attack move, then eject, guard and hold position. Attack and hold position are buttons now, where no unit ever had one. Over the panel runs a portrait bar. Select one unit and its upgrades follow its portrait; select a group and every kind of unit in it follows, each with how many you have. A dozer's or a worker's buildings get two bars of their own beside the panel, the first eight on the Q bar and the rest on the W bar, each in the place its two-key shortcut names, with the money and the power bar on top of them.+- 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 power bar lies in a steel groove of its own on the worker bars, 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, with the money in a dark well beside 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, and the steel is laid over the edge of every picture the way a frame holds a card, the whole picture showing inside it. The production queue and the general's powers are framed the same way. 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 beacon button is gone from the bar too; the smoke signals over the radar are how you point your team at a spot. 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. A watcher has nothing to promote and no longer gets the tab, which used to hang half into the screen's corner. Its button goes with it: a watcher who clicked a unit used to find an empty patch of screen there that still showed the promotions tooltip and opened the promotion screen. 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. It comes up the way the Esc menu does, the battlefield behind it dimmed to 65% black and the screen fading in over an eighth of a second; the side's old painted screen no longer fades in over it for the first nine frames. 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. Press one and the pointer turns to a cross; your next click puts the signal there, on the ground or on the radar, and a right click or Escape takes it back; until now a button dropped its smoke in the middle of your view. Every signal now leaves a mark on the ground in your colour for ten seconds, and the radar ping lasts as long: crossed swords to attack, a shield to defend, an eye to look, each in a ring a few tanks across, fading out over its last two seconds. 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.+- The general's powers you have bought and can fire, the column that climbed the right edge of the screen, stand in the bottom right corner 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 side by side in a step of the radar's own steel, on its top edge: the smoke signals Alt+Z, X and C send. Press one and the pointer turns to a cross; your next click puts the signal there, on the ground or on the radar, and a right click or Escape takes it back; until now a button dropped its smoke in the middle of your view. Every signal now leaves a mark on the ground in your colour for ten seconds, and the radar ping lasts as long: crossed swords to attack, a shield to defend, an eye to look, each in a ring a few tanks across, fading out over its last two seconds. 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, then the unit's health, damage, attacks a second, damage a second, range and build time in gold, counted with the upgrades you own. Under them every upgrade that touches the unit and what it does to it: a Gattling Tank's card says Chain Guns takes its damage from 15 to 18 and its damage a second from 37 to 46, a Humvee's that TOW adds a 50 damage missile with a range of 317, and an upgrade you already bought turns gold. Point at the upgrade itself and the card lists the units it changes, Composite Armor putting a Crusader from 480 health to 680. At the bottom, "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.- The readout in the top right corner is a box of its own and always there: the time of day, the match time and the real time beside it, the logic rate and the frame rate, the renderer and the frame number. In a network game it adds how many frames are ready out of the input delay, the room's frame rate and the traffic in and out, and under a unit limit your count against it.- The top of the screen is battlefield. The players, their teams, their superweapons with the seconds left and the match clock are all on Tab, which already had every one of them, so the column of superweapon countdowns that used to sit in the top right is gone while you play, and so is a strip of flags that repeated the scoreboard across the top edge.diff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.htmlindex ce9a24a74..04e058403 100644--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html@@ -1,12 +1,15 @@<!DOCTYPE html><!--- The command bar's frame, drawn where its three plates used to be, and the bar's own buttons. The- command buttons, the radar, the money and the portrait are still the bar's windows and paint over- this page. The promotion button, the under-attack light, the power bar and the- experience bar are the page's to draw: their windows take the clicks and draw nothing. The menu and idle worker- buttons are the page's altogether, pressed through data-click="press:Name"; the chat button is- gone and Enter still opens the chat. Same materials as Window/Html/Spectator.html, whose header- says what the renderer draws and what not.+ The command bar's frame, drawn where its three plates used to be, and the bar's own buttons, laid+ out the way the owner drew them on 2026-09-28 (docs/plans/HUD-REDESIGN.md): the radar in the+ bottom left corner with the experience bar beside it, the command panel with the portrait bar on+ it, the Q and W worker bars with the purse on them; over the radar the skills key on the+ under-attack light and the smoke signals. The command buttons, the radar, the money and the+ portrait are still the bar's windows and paint over this page. The under-attack light, the power+ bar and the experience bar are the page's to draw: their windows take the clicks and draw+ nothing. The menu, idle worker and promotion buttons are the page's altogether, pressed through+ data-click="press:Name"; the chat button is gone and Enter still opens the chat. Same materials+ as Window/Html/Spectator.html, whose header says what the renderer draws and what not.Everything with class "solid" catches clicks for the bar; the rest of the screen is battlefield,whatever the old plates covered. A data-click="press:Name" button must not be solid: its click@@ -27,24 +30,30 @@"yellow" or "red"; the watched player's while watchingdata-each="powercells" the same production as 40 cells, each {{lit}} "lit" up to it, standing at{{x}} pixels inside the frame's lip and {{w}} wide- {{expframe.x}} ... the experience bar's groove down the right panel, .w and .h its inside,+ {{expframe.x}} ... the experience bar's groove beside the radar, .w and .h its inside,{{expframe.innerw}} the width inside its lip; data-each="expcells" itsten rungs from the bottom up, each {{lit}} "lit" up to the way from thisrank to the next, at {{y}} inside the lip, {{h}} tall, {{segh}} withoutits black linedata-each="rankstars" a star for every rank there is, {{lit}} "lit" up to the one reached, at{{x}} inside the 58 wide key so the row is centred on it- data-each="portraitcells" the production queue's nine places over the portrait's, each {{cell.x}} .y .w .h- data-each="commandcells" the fourteen command buttons' places, shown or not, each {{cell.x}} .y .w .h- {{skilltray.x}} ... the general's powers' tray, a panel as {{right.x}} is, only as big as the+ data-each="commandcells" every place a command can go, shown or not, each {{cell.x}} .y .w .h:+ the command panel's twelve (five abilities and upgrades; attack, stop,+ attack move; eject, seek shelter, guard, hold position) and the worker+ bars' eight each+ {{attackkey.x}} ... the attack and hold position places, where the page's own keys stand,+ {{holdkey.x}} ... data-click="order:attack" and "order:hold", for a selection that attack+ moves; no command set has a button for either+ data-each="portraitcells" the portrait bar's places, the portrait's first, each {{cell.x}} .y .w .h+ {{skilltray.x}} ... the general's powers' tray, a panel as {{centre.x}} is, only as big as thepowers shown; data-each="skillcells" a cell behind each power, each{{cell.x}} .y .w .h- {{signals.x}} ... the column of smoke signal buttons against the left panel;+ {{signals.x}} ... the step of smoke signal buttons on the radar panel's top edge;data-click="signal:attack", "signal:defend" or "signal:look" sends oneto the middle of the view; {{signals.shown}} is "hidden" where the keyswould do nothing either, a game with no allies to see the smoke, and{{signal0.drop}} to {{signal2.drop}} how far below its place each button- still is while they rise into the column+ still is while they rise into the stepurl(Name.svg) an SVG file under Window/Html, fitted whole into the box and centred{{blink}} "lit" for half of every second while the general has a promotion tospend, the one thing that blinks: a value that changes lays the whole@@ -53,19 +62,18 @@{{panelN.x}} .y .w .h N 0 to 2, left, centre and right: where the plates would have gone,moving with the bar when it slides or minimises; .w and .h are 0 and{{panelN.shown}} is "hidden" when a minimised bar has stood it down- {{left.x}} .y .w .h the three panels, each a container and a border outside it: .x and .y- {{centre.x}} ... the border's outer corner, .w and .h the container, exactly what it holds- {{right.x}} ... (the radar; the command grid; the portrait and the experience bar), and- .bt .br .bb .bl the border's four widths, out to the screen's edge on the- sides against it- {{alerttab.x}} ... tabs standing on a border's top edge, outside it: the under-attack light- {{starstab.x}} ... on the radar panel's at its left hand end, the rank's stars on the right- panel's at its right hand end, with the promotion button's window under it- {{workertab.x}} ... the idle worker's step, against the centre's border at its bottom left- {{powerblock.x}} ... the power bar's block, the centre's bezel carried on upward as wide as it- {{powerframe.x}} ... the power bar's frame standing on the centre's border, and the money's- {{moneyblock.x}} ... block on the frame, stacked flush; {{powerframe.inner}} the height inside- the frame and its lip+ {{left.x}} .y .w .h the panels, each a container and a border outside it: .x and .y the+ {{centre.x}} ... border's outer corner, .w and .h the container, exactly what it holds (the+ {{portrait.x}} ... radar and the experience bar; the command panel's places; the portrait+ {{qbar.x}} ... bar's; each worker bar's), and .bt .br .bb .bl the border's four widths,+ {{wbar.x}} ... out to the screen's edge on the sides against it+ {{alerttab.x}} ... the under-attack light, a tab on the radar panel's top edge at its left+ {{skillstab.x}} ... hand end, and on it the skills key: the rank's stars, pressed through+ data-click="press:ButtonGeneral" for the promotion screen+ {{purse.x}} ... the steel on the worker bars, level with the command panel's top, and in+ {{workerkey.x}} ... it the idle worker's key, the power bar's frame and the money's well;+ {{powerframe.x}} ... {{powerframe.inner}} the height inside the frame and its lip+ {{moneyblock.x}} ...{{Name.x}} .y .w .h the rectangle of the bar's window Name, {{Name.shown}} "shown" or "hidden"and {{Name.state}} any of "disabled", "hilite", "pushed", for LeftHUD (theradar), RightHUD (the portrait's box), CameoWindow (the portrait),@@ -117,14 +125,8 @@.bezel .shine { position: absolute; height: 1px; background-color: #dde4ea; }.bezel .lit { position: absolute; width: 1px; background-color: #b3bbc4; }.bezel .shade { position: absolute; width: 1px; background-color: #0c1114; }- /* the money's figure is the bar's own window over the block; the well under it is inset from the- block's sides rather than fitted to the figure, whose width the page is not told */- .bezel .inset { position: absolute; left: 5px; right: 5px; top: 1px; bottom: 0; background-color: #020405;- border-top: 1px solid #06090b; border-left: 1px solid #06090b; border-right: 1px solid #b4bec8; }.china .bezel .lit { background-color: #d58a70; }- .china .bezel .inset { border-right-color: #d98a72; }.gla .bezel .lit { background-color: #cabe86; }- .gla .bezel .inset { border-right-color: #cbbf82; }.bezel .sunk { position: absolute; left: -2px; top: -2px; border: 2px solid #06090b;border-bottom-color: #b4bec8; border-right-color: #b4bec8; background-color: #020405; }.china .bezel .steel { background: linear-gradient(to bottom, #c06a52, #7a3120 30%, #3f160f); }@@ -154,24 +156,18 @@.china .commandcell .bevel { border-bottom-color: #d98a72; border-right-color: #d98a72; }.gla .commandcell .bevel { border-bottom-color: #cbbf82; border-right-color: #cbbf82; }- /* over the centre's bezel the power bar's block, the same plate carried on upward as wide as the- bezel, and on it the money's block, stacked flush. Each block's steel runs from a shade lighter- at its top down to the top of the one under it, and a joint over the lower block's lit top edge- makes the three one plate */+ /* the purse, a plate on the worker bars level with the command panel's top: the idle worker's+ key, the power bar's groove and the money's well sunk in it. The money's figure is the bar's+ own window over its well */.stack { box-sizing: border-box; margin: 0; }- .bezel .joint { position: absolute; left: 1px; right: 1px; bottom: -1px; height: 1px; }- .powerblock .steel { background: linear-gradient(to bottom, #b0b8c1, #9aa3ad); }- .powerblock .joint { background-color: #9aa3ad; }- .moneyblock .steel { background: linear-gradient(to bottom, #c3cad2, #b0b8c1); }- .moneyblock .joint { background-color: #b0b8c1; }- .china .powerblock .steel { background: linear-gradient(to bottom, #cf8068, #c06a52); }- .china .powerblock .joint { background-color: #c06a52; }- .china .moneyblock .steel { background: linear-gradient(to bottom, #db957f, #cf8068); }- .china .moneyblock .joint { background-color: #cf8068; }- .gla .powerblock .steel { background: linear-gradient(to bottom, #c8bc84, #b8ab6e); }- .gla .powerblock .joint { background-color: #b8ab6e; }- .gla .moneyblock .steel { background: linear-gradient(to bottom, #d6cb98, #c8bc84); }- .gla .moneyblock .joint { background-color: #c8bc84; }+ .purse .steel { background: linear-gradient(to bottom, #b0b8c1, #7d8691); }+ .china .purse .steel { background: linear-gradient(to bottom, #cf8068, #9a4331); }+ .gla .purse .steel { background: linear-gradient(to bottom, #c8bc84, #8f8249); }+ .moneywell { background-color: #020405; }+ .moneywell .lip { position: absolute; left: 0; top: 0; right: 0; bottom: 0; border: 1px solid #06090b;+ border-bottom-color: #b4bec8; border-right-color: #b4bec8; }+ .china .moneywell .lip { border-bottom-color: #d98a72; border-right-color: #d98a72; }+ .gla .moneywell .lip { border-bottom-color: #cbbf82; border-right-color: #cbbf82; }.well { margin: -3px 0 0 -3px; border: 2px solid #0c1114; border-bottom-color: #4b535e; border-right-color: #4b535e;background-color: rgba(0, 0, 0, 0.35); }@@ -256,27 +252,33 @@.china .step { background: linear-gradient(to bottom, #6a2a1c, #3f160f); border-top-color: #f0b8a4; }.gla .step { background: linear-gradient(to bottom, #665b31, #3c3519); border-top-color: #ebe2b4; }- /* the idle worker: a key in a step against the centre's border at its bottom left, lit down its- left side, and one pixel wider than it is told so it runs over the centre's own lit line */- .worker { border-left: 1px solid #b3bbc4; }- .china .worker { border-left-color: #d58a70; }- .gla .worker { border-left-color: #cabe86; }- /* the step is 30 tall, 31 with its lit edge, and the key 20 with its rim three pixels down, so its- bottom is six over the screen's edge, level with the command buttons' */- .worker .key { left: 3px; top: 3px; }- .worker .icon { background-image: url(Icons/IdleWorker.svg); }- .watching .worker { display: none; }+ /* the idle worker: a key at the purse's left end, over the worker bars */+ .idle .key { left: 0; top: 0; }+ .idle .icon { background-image: url(Icons/IdleWorker.svg); }+ .watching .idle { display: none; }++ /* the command panel's attack and hold position: keys over their places' holes, dark until the+ pointer lifts them as lit steel, a picture in the middle of the 38 by 33 cell */+ .order { background-color: #020405; }+ .order:hover { background: linear-gradient(to bottom, #b3bbc4, #5a626c); }+ .china .order:hover { background: linear-gradient(to bottom, #d58a70, #7a3120); }+ .gla .order:hover { background: linear-gradient(to bottom, #cabe86, #766a3a); }+ .held .order:hover { background: linear-gradient(to bottom, #151a1f, #3a414a); }+ .order .icon { position: absolute; left: 11px; top: 8px; width: 16px; height: 16px;+ background-size: 100% 100%; background-repeat: no-repeat; }+ .order.attack .icon { background-image: url(Icons/OrderAttack.svg); }+ .order.hold .icon { background-image: url(Icons/OrderHold.svg); }/* the under-attack light: a red lamp in a tab on the radar's bezel, dark until the bar blinks it.- The tab is 54 by 14 and the lamp a bar 42 by 10 with its rim */- .alert .led { position: absolute; left: 6px; top: 2px; width: 40px; height: 8px; border: 1px solid #120302;+ The tab is 66 by 14 and the lamp a bar 54 by 10 with its rim */+ .alert .led { position: absolute; left: 6px; top: 2px; width: 52px; height: 8px; border: 1px solid #120302;background: linear-gradient(to bottom, #4a0d08, #2a0604); }- .alert .glint { position: absolute; left: 2px; top: 1px; width: 36px; height: 2px; background-color: #6a2a24; }+ .alert .glint { position: absolute; left: 2px; top: 1px; width: 48px; height: 2px; background-color: #6a2a24; }.alert.disabled .led { border-color: #ff9a80; background: linear-gradient(to bottom, #ff6a50, #d01a08); }.alert.disabled .glint { background-color: #ffe4dc; }- /* the rank: the promotion button, a key like the idle worker's in a tab on the right panel's- bezel, a star on it for every rank there is, gold up to the one reached and dark past it. The+ /* the skills key: the rank, and the promotion button, a key like the idle worker's in a tab on the+ under-attack light, a star on it for every rank there is, gold up to the one reached and dark past it. Thetab is 66 by 22 and the key 60 by 17 with its rim, three pixels in. Under the pointer it comesup as lit steel with a gold rim, and while a promotion waits to be spent it blinks in the side's ownsteel at its brightest, a white rim round it. The stars carry a dark outline so the gold reads@@ -299,7 +301,7 @@.rank.disabled .key .veil { display: block; position: absolute; left: 0; top: 0; width: 58px; height: 15px;background-color: rgba(4, 8, 10, 0.65); }- /* the experience bar: rungs up the right panel's groove, lit gold from the bottom up to the way+ /* the experience bar: rungs up the groove beside the radar, lit gold from the bottom up to the wayfrom this rank to the next, a black line over each */.rungs { position: absolute; left: 1px; top: 1px; bottom: 1px; }.rungs .rung { position: absolute; left: 0; }@@ -311,17 +313,14 @@over the battlefield rather than on the screen's edge */.bezel .base { position: absolute; height: 1px; background-color: #0c1114; }- /* the smoke signals: a step on the radar's bezel's right, dark down its own right, and a joint- over the bezel's dark right line so the two read as one piece. Three keys in it: a crosshair to- attack, a shield to defend, an eye to look */+ /* the smoke signals: a step on the radar's bezel's top edge at its right hand end, dark down its+ own right. Three keys in it side by side: a crosshair to attack, a shield to defend, an eye to+ look */.signals { border-right: 1px solid #0c1114; }- .signals .joint { position: absolute; left: -1px; top: 0; bottom: 0; width: 1px; background: linear-gradient(to bottom, #4f575f, #353c45); }- .china .signals .joint { background: linear-gradient(to bottom, #6a2a1c, #3f160f); }- .gla .signals .joint { background: linear-gradient(to bottom, #665b31, #3c3519); }- /* each key stands at its own top, pushed down by {{signalN.drop}} while it rises: a relatively+ /* each key stands at its own left, pushed down by {{signalN.drop}} while it rises: a relativelyplaced box inside an absolutely placed one is laid out from the screen's corner here, and thecolumn came out in the top left */- .signals .key { left: 3px; }+ .signals .key { top: 2px; }.signal.attack .icon { background-image: url(Icons/SignalAttack.svg); }.signal.defend .icon { background-image: url(Icons/SignalDefend.svg); }.signal.look .icon { background-image: url(Icons/SignalLook.svg); }@@ -336,7 +335,20 @@<div class="shade" style="right: -{{left.br}}px; top: -{{left.bt}}px; bottom: -{{left.bb}}px"></div><div class="sunk" style="width: {{left.w}}px; height: {{left.h}}px"></div></div>+ <div class="piece groove solid stack {{expframe.shown}}" style="left: {{expframe.x}}px; top: {{expframe.y}}px; width: {{expframe.w}}px; height: {{expframe.h}}px">+ <div class="rungs" style="width: {{expframe.innerw}}px"><div class="rung {{lit}}" data-each="expcells" style="top: {{y}}px; height: {{h}}px; width: {{expframe.innerw}}px"><div class="seg" style="width: {{expframe.innerw}}px; height: {{segh}}px"></div></div></div>+ <div class="lip"></div>+ </div><div class="piece tab alert {{alerttab.shown}} {{WinUAttack.state}}" style="left: {{alerttab.x}}px; top: {{alerttab.y}}px; width: {{alerttab.w}}px; height: {{alerttab.h}}px"><div class="led"><div class="glint"></div></div></div>+ <div class="piece tab rank {{skillstab.shown}} {{promotion}} {{blink}} {{ButtonGeneral.state}}" style="left: {{skillstab.x}}px; top: {{skillstab.y}}px; width: {{skillstab.w}}px; height: {{skillstab.h}}px">+ <div class="key" data-click="press:ButtonGeneral"><div class="star {{lit}}" data-each="rankstars" style="left: {{x}}px"></div><div class="veil"></div></div>+ </div>+ <div class="piece step signals solid {{signals.shown}}" style="left: {{signals.x}}px; top: {{signals.y}}px; width: {{signals.w}}px; height: {{signals.h}}px">+ <div class="key signal attack" data-click="signal:attack" style="left: 2px; margin-top: {{signal0.drop}}px"><div class="icon"></div></div>+ <div class="key signal defend" data-click="signal:defend" style="left: 36px; margin-top: {{signal1.drop}}px"><div class="icon"></div></div>+ <div class="key signal look" data-click="signal:look" style="left: 70px; margin-top: {{signal2.drop}}px"><div class="icon"></div></div>+ </div>+<div class="piece frame bezel solid {{centre.shown}}" style="left: {{centre.x}}px; top: {{centre.y}}px; width: {{centre.w}}px; height: {{centre.h}}px; border-width: {{centre.bt}}px {{centre.br}}px {{centre.bb}}px {{centre.bl}}px"><div class="steel" style="left: -{{centre.bl}}px; right: -{{centre.br}}px; top: -{{centre.bt}}px; bottom: -{{centre.bb}}px"></div><div class="shine" style="left: -{{centre.bl}}px; right: -{{centre.br}}px; top: -{{centre.bt}}px"></div>@@ -344,53 +356,44 @@<div class="shade" style="right: -{{centre.br}}px; top: -{{centre.bt}}px; bottom: -{{centre.bb}}px"></div><div class="sunk grid" style="width: {{centre.w}}px; height: {{centre.h}}px"></div></div>- <div class="piece commandcell" data-each="commandcells" style="left: {{cell.x}}px; top: {{cell.y}}px; width: {{cell.w}}px; height: {{cell.h}}px"><div class="edge" style="left: -{{ring}}px; top: -{{ring}}px; right: -{{ring}}px; bottom: -{{ring}}px; border-width: {{ring}}px"></div><div class="bevel"></div></div>- <div class="piece step worker solid {{workertab.shown}} {{ButtonIdleWorker.state}}" style="left: {{workertab.x}}px; top: {{workertab.y}}px; width: {{workertab.w}}px; height: {{workertab.h}}px">- <div class="key" data-click="press:ButtonIdleWorker"><div class="icon"></div><div class="veil"></div></div>+ <div class="piece frame bezel solid {{qbar.shown}}" style="left: {{qbar.x}}px; top: {{qbar.y}}px; width: {{qbar.w}}px; height: {{qbar.h}}px; border-width: {{qbar.bt}}px {{qbar.br}}px {{qbar.bb}}px {{qbar.bl}}px">+ <div class="steel" style="left: -{{qbar.bl}}px; right: -{{qbar.br}}px; top: -{{qbar.bt}}px; bottom: -{{qbar.bb}}px"></div>+ <div class="lit" style="left: -{{qbar.bl}}px; top: -{{qbar.bt}}px; bottom: -{{qbar.bb}}px"></div>+ <div class="shade" style="right: -{{qbar.br}}px; top: -{{qbar.bt}}px; bottom: -{{qbar.bb}}px"></div>+ <div class="sunk grid" style="width: {{qbar.w}}px; height: {{qbar.h}}px"></div></div>- <!-- drawn after the centre, and the money after the power bar, so each block's joint covers the lit- top edge of the block under it -->- <div class="piece bezel solid powerblock {{powerblock.shown}}" style="left: {{powerblock.x}}px; top: {{powerblock.y}}px; width: {{powerblock.w}}px; height: {{powerblock.h}}px">+ <div class="piece frame bezel solid {{wbar.shown}}" style="left: {{wbar.x}}px; top: {{wbar.y}}px; width: {{wbar.w}}px; height: {{wbar.h}}px; border-width: {{wbar.bt}}px {{wbar.br}}px {{wbar.bb}}px {{wbar.bl}}px">+ <div class="steel" style="left: -{{wbar.bl}}px; right: -{{wbar.br}}px; top: -{{wbar.bt}}px; bottom: -{{wbar.bb}}px"></div>+ <div class="lit" style="left: -{{wbar.bl}}px; top: -{{wbar.bt}}px; bottom: -{{wbar.bb}}px"></div>+ <div class="shade" style="right: -{{wbar.br}}px; top: -{{wbar.bt}}px; bottom: -{{wbar.bb}}px"></div>+ <div class="sunk grid" style="width: {{wbar.w}}px; height: {{wbar.h}}px"></div>+ </div>+ <!-- the purse stands on the worker bars; drawn after them, it takes the top of their steel -->+ <div class="piece bezel solid purse {{purse.shown}}" style="left: {{purse.x}}px; top: {{purse.y}}px; width: {{purse.w}}px; height: {{purse.h}}px"><div class="steel" style="left: 0; right: 0; top: 0; bottom: 0"></div><div class="shine" style="left: 0; right: 0; top: 0"></div>- <div class="lit" style="left: 0; top: 0; bottom: 0"></div><div class="shade" style="right: 0; top: 0; bottom: 0"></div>- <div class="joint"></div>+ </div>+ <div class="piece idle {{purse.shown}} {{ButtonIdleWorker.state}}" style="left: {{workerkey.x}}px; top: {{workerkey.y}}px">+ <div class="key" data-click="press:ButtonIdleWorker"><div class="icon"></div><div class="veil"></div></div></div><div class="piece groove solid stack {{powerframe.shown}}" style="left: {{powerframe.x}}px; top: {{powerframe.y}}px; width: {{powerframe.w}}px; height: {{powerframe.h}}px"><div class="cells {{power.state}}" style="height: {{powerframe.inner}}px"><div class="cell {{lit}}" data-each="powercells" style="left: {{x}}px; width: {{w}}px; height: {{powerframe.inner}}px"><div class="seg" style="height: {{powerframe.inner}}px"></div></div></div><div class="lip"></div><div class="needle {{power.consumes}}" style="left: {{power.needle}}%"><div class="stem"></div><div class="cap head"></div><div class="cap foot"></div></div></div>- <div class="piece bezel solid stack moneyblock {{moneyblock.shown}}" style="left: {{moneyblock.x}}px; top: {{moneyblock.y}}px; width: {{moneyblock.w}}px; height: {{moneyblock.h}}px">- <div class="steel" style="left: 0; right: 0; top: 0; bottom: 0"></div>- <div class="shine" style="left: 0; right: 0; top: 0"></div>- <div class="lit" style="left: 0; top: 0; bottom: 0"></div>- <div class="shade" style="right: 0; top: 0; bottom: 0"></div>- <div class="inset"></div>- <div class="joint"></div>- </div>- <div class="piece frame bezel solid {{right.shown}}" style="left: {{right.x}}px; top: {{right.y}}px; width: {{right.w}}px; height: {{right.h}}px; border-width: {{right.bt}}px {{right.br}}px {{right.bb}}px {{right.bl}}px">- <div class="steel" style="left: -{{right.bl}}px; right: -{{right.br}}px; top: -{{right.bt}}px; bottom: -{{right.bb}}px"></div>- <div class="shine" style="left: -{{right.bl}}px; right: -{{right.br}}px; top: -{{right.bt}}px"></div>- <div class="lit" style="left: -{{right.bl}}px; top: -{{right.bt}}px; bottom: -{{right.bb}}px"></div>- <div class="sunk grid" style="width: {{right.w}}px; height: {{right.h}}px"></div>+ <div class="piece moneywell solid {{moneyblock.shown}}" style="left: {{moneyblock.x}}px; top: {{moneyblock.y}}px; width: {{moneyblock.w}}px; height: {{moneyblock.h}}px"><div class="lip"></div></div>+ <div class="piece frame bezel solid {{portrait.shown}}" style="left: {{portrait.x}}px; top: {{portrait.y}}px; width: {{portrait.w}}px; height: {{portrait.h}}px; border-width: {{portrait.bt}}px {{portrait.br}}px {{portrait.bb}}px {{portrait.bl}}px">+ <div class="steel" style="left: -{{portrait.bl}}px; right: -{{portrait.br}}px; top: -{{portrait.bt}}px; bottom: -{{portrait.bb}}px"></div>+ <div class="shine" style="left: -{{portrait.bl}}px; right: -{{portrait.br}}px; top: -{{portrait.bt}}px"></div>+ <div class="lit" style="left: -{{portrait.bl}}px; top: -{{portrait.bt}}px; bottom: -{{portrait.bb}}px"></div>+ <div class="shade" style="right: -{{portrait.br}}px; top: -{{portrait.bt}}px; bottom: -{{portrait.bb}}px"></div>+ <div class="sunk grid" style="width: {{portrait.w}}px; height: {{portrait.h}}px"></div></div>+ <div class="piece commandcell" data-each="commandcells" style="left: {{cell.x}}px; top: {{cell.y}}px; width: {{cell.w}}px; height: {{cell.h}}px"><div class="edge" style="left: -{{ring}}px; top: -{{ring}}px; right: -{{ring}}px; bottom: -{{ring}}px; border-width: {{ring}}px"></div><div class="bevel"></div></div><div class="piece commandcell" data-each="portraitcells" style="left: {{cell.x}}px; top: {{cell.y}}px; width: {{cell.w}}px; height: {{cell.h}}px"><div class="edge" style="left: -{{ring}}px; top: -{{ring}}px; right: -{{ring}}px; bottom: -{{ring}}px; border-width: {{ring}}px"></div><div class="bevel"></div></div>- <div class="piece groove solid stack {{expframe.shown}}" style="left: {{expframe.x}}px; top: {{expframe.y}}px; width: {{expframe.w}}px; height: {{expframe.h}}px">- <div class="rungs" style="width: {{expframe.innerw}}px"><div class="rung {{lit}}" data-each="expcells" style="top: {{y}}px; height: {{h}}px; width: {{expframe.innerw}}px"><div class="seg" style="width: {{expframe.innerw}}px; height: {{segh}}px"></div></div></div>- <div class="lip"></div>- </div>- <div class="piece tab rank {{starstab.shown}} {{promotion}} {{blink}} {{ButtonGeneral.state}}" style="left: {{starstab.x}}px; top: {{starstab.y}}px; width: {{starstab.w}}px; height: {{starstab.h}}px">- <div class="key"><div class="star {{lit}}" data-each="rankstars" style="left: {{x}}px"></div><div class="veil"></div></div>- </div>-- <div class="piece step signals solid {{signals.shown}}" style="left: {{signals.x}}px; top: {{signals.y}}px; width: {{signals.w}}px; height: {{signals.h}}px">- <div class="joint"></div>- <div class="key signal attack" data-click="signal:attack" style="top: 2px; margin-top: {{signal0.drop}}px"><div class="icon"></div></div>- <div class="key signal defend" data-click="signal:defend" style="top: 25px; margin-top: {{signal1.drop}}px"><div class="icon"></div></div>- <div class="key signal look" data-click="signal:look" style="top: 48px; margin-top: {{signal2.drop}}px"><div class="icon"></div></div>- </div>+ <div class="piece order attack {{attackkey.shown}}" data-click="order:attack" style="left: {{attackkey.x}}px; top: {{attackkey.y}}px; width: {{attackkey.w}}px; height: {{attackkey.h}}px"><div class="icon"></div></div>+ <div class="piece order hold {{holdkey.shown}}" data-click="order:hold" style="left: {{holdkey.x}}px; top: {{holdkey.y}}px; width: {{holdkey.w}}px; height: {{holdkey.h}}px"><div class="icon"></div></div><div class="piece frame bezel solid {{skilltray.shown}}" style="left: {{skilltray.x}}px; top: {{skilltray.y}}px; width: {{skilltray.w}}px; height: {{skilltray.h}}px; border-width: {{skilltray.bt}}px {{skilltray.br}}px {{skilltray.bb}}px {{skilltray.bl}}px"><div class="steel" style="left: -{{skilltray.bl}}px; right: -{{skilltray.br}}px; top: -{{skilltray.bt}}px; bottom: -{{skilltray.bb}}px"></div>diff --git a/GeneralsMD/Code/Data/Window/Html/Icons/OrderAttack.svg b/GeneralsMD/Code/Data/Window/Html/Icons/OrderAttack.svgnew file mode 100644index 000000000..a66c5d00c--- /dev/null+++ b/GeneralsMD/Code/Data/Window/Html/Icons/OrderAttack.svg@@ -0,0 +1,4 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">+ <path d="M4 4 17.5 17.5M20 4 6.5 17.5" fill="none" stroke="#eef2f5" stroke-width="2.6" stroke-linecap="round"/>+ <path d="M14.5 20.5 20.5 14.5M9.5 20.5 3.5 14.5" fill="none" stroke="#eef2f5" stroke-width="2.4" stroke-linecap="round"/>+</svg>diff --git a/GeneralsMD/Code/Data/Window/Html/Icons/OrderHold.svg b/GeneralsMD/Code/Data/Window/Html/Icons/OrderHold.svgnew file mode 100644index 000000000..c1b01e240--- /dev/null+++ b/GeneralsMD/Code/Data/Window/Html/Icons/OrderHold.svg@@ -0,0 +1,5 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">+ <path d="M7 22V2.5" fill="none" stroke="#eef2f5" stroke-width="2.4" stroke-linecap="round"/>+ <path d="M8.2 3.5H19.5L16.5 7.75 19.5 12H8.2Z" fill="#eef2f5"/>+ <path d="M3 22H11" fill="none" stroke="#eef2f5" stroke-width="2.4" stroke-linecap="round"/>+</svg>diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.hindex b0c77f12e..a159e8ca4 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h@@ -420,6 +420,32 @@ enum { CTRL_SHIFT_BUILD_QUEUE_COUNT = 100 };Int getBuildBatchCount( void );enum { MAX_COMMANDS_PER_SET = 18 }; // user interface max is 14 (but internally it's 18 for script only buttons!)++/** The places the bar's page lays a command set out in: the command panel's three rows and the two+ * worker bars. See ControlBar_commandPlaces. */+enum CommandPlace+{+ COMMAND_PLACE_SKILL = 0, ///< the command panel's top row, the unit's own abilities and upgrades+ COMMAND_PLACE_SKILLS = 5,+ COMMAND_PLACE_ATTACK = 5, ///< its second row: attack, stop, attack move+ COMMAND_PLACE_STOP,+ COMMAND_PLACE_ATTACK_MOVE,+ COMMAND_PLACE_EJECT, ///< its third row: eject, seek shelter, guard, hold position+ COMMAND_PLACE_SHELTER,+ COMMAND_PLACE_GUARD,+ COMMAND_PLACE_HOLD,+ COMMAND_PLACE_Q, ///< the Q worker bar, one place for each slot of the Q structure chord+ COMMAND_PLACE_W = COMMAND_PLACE_Q + 8, ///< the W worker bar, the W chord's+ COMMAND_PLACE_COUNT = COMMAND_PLACE_W + 8+};++/** Where each of `count` command slots stands: `types` is what each slot holds, GUI_COMMAND_NONE for+ * an empty one, and `places` gets a CommandPlace for each or -1. A stop, an attack move, a guard+ * and an evacuate go to their own places; a structure, a unit to build and a passenger's exit go to+ * the worker bars by slot, the first eight to Q and the rest to W, where the structure chord's keys+ * find them; everything else runs along the top row in slot order and spills into the worker bars'+ * free places. */+void ControlBar_commandPlaces( const Int *types, Int count, Int *places );enum { MAX_RIGHT_HUD_UPGRADE_CAMEOS = 5};enum { MAX_MULTI_SELECT_GROUPS = 36 }; ///< unit types a multi-selection tells apart (6x6 grid, Tab focus)enum {@@ -1045,15 +1071,13 @@ public:* shown, each in its place. */Int placeSpecialPowerShortcutGrid( const ICoord2D *corner, const ICoord2D &cell, Int gap );- /** Puts one of the bar's windows `inset` pixels inside the rectangle layoutPanels gave it, across- * on both sides and down on both, or outside it where the inset is less than nought; nought gives- * it the rectangle back. A rebuild of the layout reads the window as that rectangle. */- void insetPlacedWindow( GameWindow *window, const ICoord2D &inset );- ICoord2D getPlacedInset( GameWindow *window ) const; ///< what insetPlacedWindow last put it in by- /** Moves one of the bar's windows `shift` pixels down, and the places layoutPanels recorded for it- * and everything inside it with it, so a rebuild of the layout reads it as placed there. */- void lowerPlacedWindow( GameWindow *window, Int shift );+ /** Puts one of the bar's windows on `rect`, screen pixels, and leaves its children standing where+ * they were on screen. The place layoutPanels recorded for it moves with it, so a rebuild of the+ * layout reads the window as put there and not as moved in the loader's stretched space. */+ void placeWindowAt( GameWindow *window, const IRegion2D &rect );GameWindow *getSpecialPowerShortcutParent( void ) { return m_specialPowerShortcutParent; }+ /// a multi-selection's type cells, one a selected type, shown or hidden; see updateMultiSelectStrip+ const std::vector< GameWindow * > &getMultiSelectTiles( void ) const { return m_multiSelectTiles; }/// the general's stars are asking to be spent, so the button blinks; see getStarImageBool isGeneralStarFlashing( void ) const { return m_genStarFlash; }diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex 7d834bb78..a4a8f9f69 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -1651,7 +1651,6 @@ struct ControlBarPanelPlacementReal designX, designY, designW, designH;Int placedX, placedY, placedW, placedH;Int slideApplied; ///< how far down applyPanelSlide has actually moved this one, in pixels- ICoord2D inset; ///< how far insetPlacedWindow has put it inside the placed rectangle, each way, in pixels};typedef std::map< GameWindow *, ControlBarPanelPlacement > ControlBarPanelPlacementMap;static ControlBarPanelPlacementMap theControlBarPlacement;@@ -2036,13 +2035,9 @@ void ControlBar::placeInPanel( GameWindow *win, Int panel,win->winGetPosition( &rel.x, &rel.y );win->winGetSize( &size.x, &size.y );- // a window insetPlacedWindow put inside its place is read as the whole place, or every rebuild- // would take the inset for what it was authored at and shrink it againControlBarPanelPlacement &place = theControlBarPlacement[ win ];- size.x += 2 * place.inset.x;- size.y += 2 * place.inset.y;- const Int oldX = oldParentX + rel.x - place.inset.x;- const Int oldY = oldParentY + rel.y - place.inset.y;+ const Int oldX = oldParentX + rel.x;+ const Int oldY = oldParentY + rel.y;if( place.known == FALSE || oldX != place.placedX || oldY != place.placedY ||size.x != place.placedW || size.y != place.placedH )@@ -2111,7 +2106,6 @@ void ControlBar::placeInPanel( GameWindow *win, Int panel,place.panel = panel;place.weHid = FALSE;place.slideApplied = 0;- place.inset.x = place.inset.y = 0;place.placedX = newX;place.placedY = newY;place.placedW = newW;@@ -2161,43 +2155,99 @@ Int ControlBar::getPanelSlideOffset( Int panel ) const}//--------------------------------------------------------------------------------------------------void ControlBar::insetPlacedWindow( GameWindow *window, const ICoord2D &inset )-{- ControlBarPanelPlacement &place = theControlBarPlacement.find( window )->second;- if( place.inset.x == inset.x && place.inset.y == inset.y )+/** A window moved without its place moving was read by the next layoutPanels as moved by somebody+ * else, in the loader's stretched space, and its size taken back through the loader's scale: the+ * command grid, lowered to the bottom edge, came out three quarters as wide after a watcher's+ * selection rebuilt the bar. The children keep their own places, since they stay where they+ * stood on screen. */+//-------------------------------------------------------------------------------------------------+void ControlBar::placeWindowAt( GameWindow *window, const IRegion2D &rect )+{+ ICoord2D screen, size;+ window->winGetScreenPosition( &screen.x, &screen.y );+ window->winGetSize( &size.x, &size.y );+ const Int dx = rect.lo.x - screen.x;+ const Int dy = rect.lo.y - screen.y;+ const Int width = rect.hi.x - rect.lo.x;+ const Int height = rect.hi.y - rect.lo.y;+ if( dx == 0 && dy == 0 && size.x == width && size.y == height )return;- // where placeInPanel put it in its parent, which the parent carries with it wherever it goes- const ControlBarPanelPlacement &parent = theControlBarPlacement.find( window->winGetParent() )->second;- window->winSetPosition( place.placedX - parent.placedX + inset.x, place.placedY - parent.placedY + inset.y );- window->winSetSize( place.placedW - 2 * inset.x, place.placedH - 2 * inset.y );- place.inset = inset;-}+ Int x = 0, y = 0;+ window->winGetPosition( &x, &y );+ window->winSetPosition( x + dx, y + dy );+ window->winSetSize( width, height );+ for( GameWindow *child = window->winGetChild(); child; child = child->winGetNext() )+ {+ child->winGetPosition( &x, &y );+ child->winSetPosition( x - dx, y - dy );+ }-ICoord2D ControlBar::getPlacedInset( GameWindow *window ) const-{- return theControlBarPlacement.find( window )->second.inset;+ // a window made in code, a multi-selection's cell, has no place until the next layoutPanels+ // gives it one, and that one reads it as first seen whatever is written here+ ControlBarPanelPlacement &place = theControlBarPlacement[ window ];+ place.placedX += dx;+ place.placedY += dy;+ place.placedW = width;+ place.placedH = height;}//--------------------------------------------------------------------------------------------------/** A window moved without its place moving was read by the next layoutPanels as moved by somebody- * else, in the loader's stretched space, and its size taken back through the loader's scale: the- * command grid, lowered to the bottom edge, came out three quarters as wide after a watcher's- * selection rebuilt the bar, and the promotion screen measures its cells off it. */-//--------------------------------------------------------------------------------------------------static void lowerPlaces( GameWindow *window, Int shift )+void ControlBar_commandPlaces( const Int *types, Int count, Int *places ){- theControlBarPlacement.find( window )->second.placedY += shift;- for( GameWindow *child = window->winGetChild(); child; child = child->winGetNext() )- lowerPlaces( child, shift );-}+ enum { CHORD_GROUP = 8 };+ Bool taken[ COMMAND_PLACE_COUNT ] = { FALSE };+ for( Int slot = 0; slot < count; slot++ )+ places[ slot ] = -1;-void ControlBar::lowerPlacedWindow( GameWindow *window, Int shift )-{- Int x = 0, y = 0;- window->winGetPosition( &x, &y );- window->winSetPosition( x, y + shift );- lowerPlaces( window, shift );+ // the orders every unit shares, each at its own place+ for( Int slot = 0; slot < count; slot++ )+ {+ Int place = -1;+ switch( types[ slot ] )+ {+ case GUI_COMMAND_STOP: place = COMMAND_PLACE_STOP; break;+ case GUI_COMMAND_ATTACK_MOVE: place = COMMAND_PLACE_ATTACK_MOVE; break;+ case GUI_COMMAND_GUARD:+ case GUI_COMMAND_GUARD_WITHOUT_PURSUIT:+ case GUI_COMMAND_GUARD_FLYING_UNITS_ONLY: place = COMMAND_PLACE_GUARD; break;+ case GUI_COMMAND_EVACUATE: place = COMMAND_PLACE_EJECT; break;+ }+ if( place >= 0 && !taken[ place ] )+ {+ places[ slot ] = place;+ taken[ place ] = TRUE;+ }+ }++ // what a builder, a factory or a transport lists, in the worker bars at its slot's place in its+ // chord group: the structure chord's second key is that place+ for( Int slot = 0; slot < count && slot < 2 * CHORD_GROUP; slot++ )+ {+ const Int type = types[ slot ];+ if( places[ slot ] >= 0 ||+ ( type != GUI_COMMAND_DOZER_CONSTRUCT && type != GUI_COMMAND_UNIT_BUILD && type != GUI_COMMAND_EXIT_CONTAINER ) )+ continue;+ places[ slot ] = ( slot < CHORD_GROUP ? COMMAND_PLACE_Q : COMMAND_PLACE_W ) + slot % CHORD_GROUP;+ taken[ places[ slot ] ] = TRUE;+ }++ // the rest along the top row, then wherever the worker bars have room+ for( Int slot = 0; slot < count; slot++ )+ {+ if( places[ slot ] >= 0 || types[ slot ] == GUI_COMMAND_NONE )+ continue;+ for( Int place = COMMAND_PLACE_SKILL; place < COMMAND_PLACE_COUNT; place++ )+ {+ const Bool spare = place < COMMAND_PLACE_SKILLS || place >= COMMAND_PLACE_Q;+ if( spare && !taken[ place ] )+ {+ places[ slot ] = place;+ taken[ place ] = TRUE;+ break;+ }+ }+ }}//-------------------------------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cppindex ca7d8d99a..91224021f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp@@ -182,21 +182,14 @@ void ControlBar::updateMultiSelectStrip( void )return;//- // a selection of one unit type reads like a single selection: its portrait, upgrade- // cameos and all, with how many are selected written on the portrait+ // the portrait bar's rule, the owner's: the focused type's portrait first and the selected types+ // after it, and no upgrades, which belong to one unit. A selection of one type is one cell with+ // its count. setPortraitByObject hides the cells, so it goes first//- if( m_multiSelectGroupCount == 1 )- {- Drawable *draw = TheGameClient->findDrawableByID( m_multiSelectGroupFirst[ 0 ] );- Object *obj = draw ? draw->getObject() : NULL;- setPortraitByObject( obj ); // also hides the grid cells- if( obj )- GadgetButtonSetCount( m_rightHUDCameoWindow, m_multiSelectGroupSize[ 0 ] );- return;- }-- // the grid replaces the portrait while a mixed multi-selection is up- setPortraitByObject( NULL );+ Drawable *focused = TheGameClient->findDrawableByID( m_multiSelectGroupFirst[ m_multiSelectFocus ] );+ setPortraitByObject( focused ? focused->getObject() : NULL );+ for( Int upgrade = 0; upgrade < MAX_RIGHT_HUD_UPGRADE_CAMEOS; upgrade++ )+ m_rightHUDUpgradeCameos[ upgrade ]->winHide( TRUE );// one cell per selected type with its count; the focused type is the lit one, the rest// wear the darkened overlay statediff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 622aadb43..5b20a4e9c 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -10984,13 +10984,19 @@ static void putExperienceBar( HtmlValues &values, std::vector< HtmlValues > &cel}}-/** The bar's windows the page stands down altogether. The menu and idle worker buttons are the- * page's own, pressed through data-click="press:Name" because they sit where the bar's frame takes- * no clicks; the chat button is gone, and Enter still opens the chat; the minimise button is gone,- * the bar is only as big as what it holds now. */-static const char *const CONTROL_BAR_STOOD_DOWN[] = { "ButtonOptions", "ButtonIdleWorker", "PopupCommunicator", "ButtonLarge" };+/** The bar's windows the page stands down altogether. The menu, idle worker and promotion buttons are+ * the page's own, pressed through data-click="press:Name": the promotion button is the skills key+ * over the radar, above the top of the bar's frame, where a window takes no clicks. The chat button+ * is gone, and Enter still opens the chat; the minimise button is gone, the bar is only as big as+ * what it holds now; the experience bar's windows would take clicks where the page no longer draws+ * them. */+static const char *const CONTROL_BAR_STOOD_DOWN[] =+{+ "ButtonOptions", "ButtonIdleWorker", "PopupCommunicator", "ButtonLarge", "ButtonGeneral", "GeneralsExp", "ExpBarForeground"+};static const std::string PRESS_ACTION = "press:";static const std::string SIGNAL_ACTION = "signal:";+static const std::string ORDER_ACTION = "order:";/** A smoke signal may be sent: the rule the Alt+Z/X/C keys go by, a multiplayer game that is not a* replay, and a player still in it. */@@ -11025,45 +11031,83 @@ static void armSignalFromPage( const std::string &kind )DEBUG_LOG(( "Command bar page: data-click=\"signal:%s\" names no signal\n", kind.c_str() ));}-/** The windows each panel is drawn round, so a panel is only as big as what it holds: the left one- * the radar, the right one the portrait and the experience bar, the centre the command grid. The- * money stands on a step of its own over the centre, drawn from its window's rectangle, and the- * power bar crosses the gap between the two in its groove with no steel of its own. NULL ends- * each list. */+//-------------------------------------------------------------------------------------------------+/** data-click="order:attack" or "order:hold", the command panel's two orders no command set has a+ * button for: what the A and H keys do, force fire armed for the next click, and hold position. */+//-------------------------------------------------------------------------------------------------+static void orderFromPage( const std::string &order )+{+ if( order == "attack" )+ TheInGameUI->toggleForceAttackArmed();+ else if( order == "hold" && TheInGameUI->getSelectCount() > 0 )+ {+ GameMessage *hold = TheMessageStream->appendMessage( GameMessage::MSG_DO_HOLD_POSITION );+ hold->appendIntegerArgument( GUARDMODE_GUARD_WITHOUT_PURSUIT );+ }+ else+ DEBUG_LOG(( "Command bar page: data-click=\"order:%s\" names no order\n", order.c_str() ));+}++/** The radar's window, the left panel's container with the experience bar's groove beside it. NULL+ * ends the list. */static const char *const CONTROL_BAR_LEFT[] = { "LeftHUD", NULL };-static const char *const CONTROL_BAR_RIGHT[] = { "RightHUD", "GeneralsExp", "ExpBarForeground", NULL };-static const char *const CONTROL_BAR_CENTRE[] = { "ObserverPlayerListWindow", NULL };-static const char *const CONTROL_BAR_EXPERIENCE[] = { "GeneralsExp", "ExpBarForeground", NULL };-static const Int COMMAND_BUTTONS = 14; ///< ButtonCommand01 to 14, the grid a player sees-static const Int QUEUE_BUTTONS = 9; ///< ButtonQueue01 to 09, the production queue's three by three over the portrait's place+static const Int COMMAND_BUTTONS = 14; ///< ButtonCommand01 to 14, the command set a player sees+static const Int UPGRADE_CAMEOS = 5; ///< UnitUpgrade1 to 5, a single unit's upgrades in the portrait bar-/** The pieces standing round the panels, 800x600 pixels. */+/** The bar as the owner drew it on 2026-09-28, 800x600 pixels: from the left, the radar with the+ * experience bar beside it, the command panel with the portrait bar on it, and the Q and W worker+ * bars a row lower with the purse, the money and the power bar, on them. Over the radar the skills+ * key stands on the under-attack light at its left hand end and the smoke signals at its right. */enum{- STARS_TAB_WIDTH = 66, ///< the rank's stars, a key in a tab on the right panel's border, which is the promotion button- STARS_TAB_HEIGHT = 22, ///< the key 17 tall with its rim, three pixels down- SKILL_GRID_GAP = 12, ///< between the general's powers' tray and the stars' tab under it+ COMMAND_BUTTON_WIDTH = 50, ///< a command button as ControlBar.wnd authors it, the promotion screen's cell+ COMMAND_BUTTON_HEIGHT = 44,+ CELL_WIDTH = 38, ///< every grid's cell, three quarters of a command button: the whole size+ CELL_HEIGHT = 33, ///< made the owner's drawing a third again as wide+ CELL_GAP = 4, ///< between two cells of the command panel, the worker bars and the portrait bar,+ ///< a ring of half of it round each picture+ COMMAND_COLUMNS = 5,+ COMMAND_ROWS = 3,+ WORKER_COLUMNS = 4, ///< a worker bar is its chord's keys: Q W E R over Z X C V+ WORKER_ROWS = 2,+ PORTRAIT_WIDTH = 44, ///< the portrait's cell, a cell's height at the portrait's own shape+ PORTRAIT_PLACES = 6, ///< the portrait bar's cells after the portrait: a unit's five upgrades and one+ ///< more, which ends the bar where the owner's drawing does+ EXPERIENCE_WIDTH = 12, ///< the experience bar's groove, the radar's height+ EXPERIENCE_GAP = 4, ///< between it and the radar+ PANEL_FOOT = 4, ///< a grid's ring over the screen's bottom edge, the steel under it+ SKILLS_TAB_WIDTH = 66, ///< the skills key, the rank's stars, in a tab on the under-attack light+ SKILLS_TAB_HEIGHT = 22, ///< the key 17 tall with its rim, three pixels down+ ALERT_TAB_WIDTH = 66, ///< the under-attack light, a lamp on the radar panel's border, the key's width+ SIGNAL_BUTTONS = 3, ///< attack, defend, look+ SIGNAL_STEP_WIDTH = 104, ///< the signals' step on the radar panel's border at its right hand end,+ SIGNAL_STEP_HEIGHT = 24, ///< three keys side by side+ PURSE_KEY_WIDTH = 34, ///< the idle worker's key at the purse's left end, with its rim+ PURSE_KEY_HEIGHT = 20,+ PURSE_POWER_HEIGHT = 12, ///< the power bar's groove, frame and lip+ PURSE_MONEY_WIDTH = 104, ///< the money's well at the purse's right end+ PURSE_MONEY_HEIGHT = 18,+ SKILL_GRID_GAP = 12, ///< between the general's powers' tray and what it stands onSKILL_TRAY_BORDER = 6, ///< the tray's steel round its cellsQUEUE_TRAY_BORDER = 3, ///< the production queue's tray's, thinner, since the row runs over the battlefield- SKILL_CELL_GAP = 2, ///< the steel between two cells- SKILL_CELL_PERCENT = 75, ///< a cell's size against a command button's; the whole size stood too big over the portrait- CELL_GAP_LEAST = 2, ///< the least steel between two pictures of a grid, a bevel each side- SIGNAL_BUTTON_SIZE = 24, ///< each smoke signal button's height, a row of the column- SIGNAL_BUTTON_WIDTH = 40, ///< and its width, room for its picture- SIGNAL_BUTTONS = 3, ///< attack, defend, look- ALERT_TAB_WIDTH = 54, ///< the under-attack light, a lamp on the radar panel's border- WORKER_TAB_WIDTH = 39, ///< the idle worker's step, against the command grid panel's border, as wide as the signals' column- WORKER_STEP_HEIGHT = 30, ///< and its height, its key's bottom GRID_BOTTOM_GAP over the screen's bottom edge- GRID_BOTTOM_GAP = 6 ///< the command buttons' bottom over the screen's bottom edge, level with that key's:- ///< the grid's two pixel well and four of steel under it; at 4 the well's lit- ///< bottom edge sat on the screen's last row and the grid looked cut off+ SKILL_CELL_GAP = 2 ///< the steel between two cells of the powers and the production queue};-static const UnsignedInt SIGNAL_RISE_MS = 360; ///< each smoke signal button's climb out of the screen's bottom edge++/** A grid cell's size on screen. */+static ICoord2D cellSize( void )+{+ const Real scale = ControlBarUniformScale();+ ICoord2D cell;+ cell.x = REAL_TO_INT( CELL_WIDTH * scale );+ cell.y = REAL_TO_INT( CELL_HEIGHT * scale );+ return cell;+}+static const UnsignedInt SIGNAL_RISE_MS = 360; ///< each smoke signal button's climb out of the radar's bezelstatic const UnsignedInt SIGNAL_RISE_STAGGER_MS = 90; ///< between one button starting and the next/** `signalN.drop`, N 0 to 2, how far below its place each smoke signal button still is, in page- * pixels, `elapsedMs` after the column came up: each starts a stagger after the one above it and- * slows as it arrives, the whole column's height to nothing. */+ * pixels, `elapsedMs` after the step came up: each starts a stagger after the one on its left and+ * slows as it arrives, the step's height to nothing. */static void putSignalRise( HtmlValues &values, UnsignedInt elapsedMs ){for( Int button = 0; button < SIGNAL_BUTTONS; button++ )@@ -11071,7 +11115,7 @@ static void putSignalRise( HtmlValues &values, UnsignedInt elapsedMs )const Real started = (Real)elapsedMs - (Real)( button * SIGNAL_RISE_STAGGER_MS );const Real progress = min( 1.0f, max( 0.0f, started / SIGNAL_RISE_MS ) );const Real remaining = ( 1.0f - progress ) * ( 1.0f - progress ) * ( 1.0f - progress );- values[ "signal" + std::to_string( button ) + ".drop" ] = std::to_string( REAL_TO_INT( remaining * SIGNAL_BUTTON_SIZE * SIGNAL_BUTTONS ) );+ values[ "signal" + std::to_string( button ) + ".drop" ] = std::to_string( REAL_TO_INT( remaining * SIGNAL_STEP_HEIGHT ) );}}@@ -11136,28 +11180,12 @@ static Bool controlBarUnion( const char *const *names, IRegion2D &box )return found;}-/** `box` grown by so many 800x600 pixels on each side, in screen pixels. */-static IRegion2D grownBy( const IRegion2D &box, Int left, Int top, Int right, Int bottom )-{- const Real scale = ControlBarUniformScale();- IRegion2D grown;- grown.lo.x = box.lo.x - REAL_TO_INT( left * scale );- grown.lo.y = box.lo.y - REAL_TO_INT( top * scale );- grown.hi.x = box.hi.x + REAL_TO_INT( right * scale );- grown.hi.y = box.hi.y + REAL_TO_INT( bottom * scale );- return grown;-}-static void putPageRect( HtmlValues &values, const std::string &name, const IRegion2D &rect, Bool shown );-/** How much steel each block of the centre stack shows round its window, 800x600 pixels. */+/** A panel's steel, 800x600 pixels. */enum{PANEL_BORDER = 8, ///< a panel's border outside its container, on the sides facing the battlefield- STACK_FRAME = 3, ///< the power bar's frame and lip- STACK_POWER_TOP = 5, ///< the power bar's block over its frame- STACK_MONEY_SIDE = 8,- STACK_MONEY_TOP = 1, ///< over the money's line of textPANEL_TAB_HEIGHT = 14 ///< a tab or button standing on a border's top edge};@@ -11218,15 +11246,6 @@ static IRegion2D tabOn( const IRegion2D &box, Int width, Int height, Bool fromRireturn tab;}-//--------------------------------------------------------------------------------------------------/** The centre of the bar as three blocks stacked flush, each narrower than the one under it: the- * command grid's panel, the power bar in its frame on top of that, and the money's block on top of- * the frame. The windows stay where the bar put them; each block reaches down to the next, so- * there is no gap between them, and a block whose window is hidden is left out and the one above- * it sits on the one below. The money's window alone is moved: it is cut to the height of its- * line of text and set down on the block under it, so its block is no taller than the figure.- * Written as centre, powerframe and moneyblock. */-//-------------------------------------------------------------------------------------------------static GameWindow *numberedWindow( const char *prefix, Int number ){char name[ 32 ];@@ -11234,18 +11253,6 @@ static GameWindow *numberedWindow( const char *prefix, Int number )return controlBarWindow( name );}-/** `place` grown by `across` screen pixels on the left and the right and `down` on the top and the- * bottom. */-static IRegion2D reachedBy( const IRegion2D &place, Int across, Int down )-{- IRegion2D cell = place;- cell.lo.x -= across;- cell.lo.y -= down;- cell.hi.x += across;- cell.hi.y += down;- return cell;-}-/** The screen rectangle of one of the bar's windows as it stands now. */static IRegion2D windowScreenRect( GameWindow *window ){@@ -11258,15 +11265,6 @@ static IRegion2D windowScreenRect( GameWindow *window )return rect;}-/** The screen rectangle of the bar's window `prefix` followed by `number` in two digits, shown or- * not, as layoutPanels placed it, before gridGrowth grew it. */-static IRegion2D numberedWindowRect( const char *prefix, Int number )-{- GameWindow *window = numberedWindow( prefix, number );- const ICoord2D inset = TheControlBar->getPlacedInset( window );- return reachedBy( windowScreenRect( window ), inset.x, inset.y );-}-/** The page's ring of steel round a picture with `gap` screen pixels to its neighbour: half of it in* the page's pixels, so two rings meet in the gap, and one at least, which is the bevel. */static Int pageRing( Int gap )@@ -11274,31 +11272,6 @@ static Int pageRing( Int gap )return max( 1, (Int)REAL_TO_INT_FLOOR( gap / ControlBarUniformScale() / 2 ) );}-/** How far a grid's buttons grow into the gaps the layout left between them, and the ring the page- * lays round each picture. */-struct GridGrowth-{- ICoord2D grow; ///< screen pixels, across and down, on each side- Int ring; ///< page pixels-};--/** The buttons grow until the gaps beside and below button `first` are both half the narrower of- * the two, and never under `least` screen pixels. */-static GridGrowth gridGrowth( const char *prefix, Int first, Int beside, Int below, Int least )-{- const IRegion2D place = numberedWindowRect( prefix, first );- const Int across = numberedWindowRect( prefix, beside ).lo.x - place.hi.x;- const Int down = numberedWindowRect( prefix, below ).lo.y - place.hi.y;- const Int gap = max( least, min( across, down ) / 2 );- GridGrowth growth;- growth.grow.x = max( 0, ( across - gap ) / 2 );- growth.grow.y = max( 0, ( down - gap ) / 2 );- growth.ring = pageRing( min( across - 2 * growth.grow.x, down - 2 * growth.grow.y ) );- return growth;-}--static void putPageRect( HtmlValues &values, const std::string &name, const IRegion2D &rect, Bool shown );-/** One cell of a grid for the page: the picture's hole as `cell` and the ring round it. */static void putCell( HtmlValues &entry, const IRegion2D &picture, Int ring ){@@ -11306,104 +11279,80 @@ static void putCell( HtmlValues &entry, const IRegion2D &picture, Int ring )entry[ "ring" ] = std::to_string( ring );}-/** ButtonCommandNN's screen rectangle, `button` 1 to COMMAND_BUTTONS, shown or not. */-static IRegion2D commandButtonRect( Int button )+/** A grid of `columns` by `rows` cells and the ring round them, standing on `bottom` with its left+ * edge on `left`, screen pixels. */+static IRegion2D gridBox( Int left, Int bottom, Int columns, Int rows ){- return numberedWindowRect( "ButtonCommand", button );+ const Real scale = ControlBarUniformScale();+ IRegion2D box;+ box.lo.x = left;+ box.hi.x = left + REAL_TO_INT( columns * ( CELL_WIDTH + CELL_GAP ) * scale );+ box.hi.y = bottom;+ box.lo.y = bottom - REAL_TO_INT( rows * ( CELL_HEIGHT + CELL_GAP ) * scale );+ return box;}-/** The box round the fourteen command buttons, shown or not. */-static IRegion2D commandButtonsBox( void )+/** Cell `column`, `row` of the grid `box` holds, scaled by `share`: a grid of smaller cells in the+ * same room, the portrait bar's when a selection has more types than it has places. */+static IRegion2D gridCell( const IRegion2D &box, Int column, Int row, Real share = 1.0f ){- IRegion2D box;- for( Int button = 1; button <= COMMAND_BUTTONS; button++ )- {- const IRegion2D place = commandButtonRect( button );- if( button == 1 )- box = place;- box.lo.x = min( box.lo.x, place.lo.x );- box.lo.y = min( box.lo.y, place.lo.y );- box.hi.x = max( box.hi.x, place.hi.x );- box.hi.y = max( box.hi.y, place.hi.y );- }- return box;+ const Real scale = ControlBarUniformScale() * share;+ IRegion2D cell;+ cell.lo.x = box.lo.x + REAL_TO_INT( ( CELL_GAP / 2 + column * ( CELL_WIDTH + CELL_GAP ) ) * scale );+ cell.lo.y = box.lo.y + REAL_TO_INT( ( CELL_GAP / 2 + row * ( CELL_HEIGHT + CELL_GAP ) ) * scale );+ cell.hi.x = cell.lo.x + REAL_TO_INT( CELL_WIDTH * scale );+ cell.hi.y = cell.lo.y + REAL_TO_INT( CELL_HEIGHT * scale );+ return cell;}-static void stackCentre( HtmlValues &values, Bool shown, const ICoord2D &grow, IRegion2D ¢re )+//-------------------------------------------------------------------------------------------------+/** The purse, the steel standing on the two worker bars level with the command panel's top: the idle+ * worker's key at its left end, the power bar's groove across the middle and the money's well at+ * its right end, each centred down it. The money's window is moved into its well, cut to its line+ * of text, and the power bar's under its groove, so its tooltip stands on the bar. Written as+ * purse, workerkey, powerframe and moneyblock. */+//-------------------------------------------------------------------------------------------------+static void putPurse( HtmlValues &values, const IRegion2D &purse, Bool shown ){- // the command buttons stand as low as the idle worker's key beside them, GRID_BOTTOM_GAP over the- // screen's bottom edge, wherever the side's layout put themconst Real scale = ControlBarUniformScale();- const Int shift = barBottom() - REAL_TO_INT( GRID_BOTTOM_GAP * scale ) - commandButtonsBox().hi.y - grow.y;- if( shift != 0 )- TheControlBar->lowerPlacedWindow( controlBarWindow( "CommandWindow" ), shift );-- IRegion2D grid, power, money;- const Bool othersFound = controlBarUnion( CONTROL_BAR_CENTRE, grid );-- // with nothing selected the bar hides the command grid, and the panel must not go with it: the- // money and the power bar stood over bare battlefield. The grid's place holds whether it is up,- // and it is the fourteen buttons' place rather than CommandWindow's: the window reaches 34 pixels- // further left, over where retail's beacon button stood, and left an empty strip in the panel- // It is the cells', which reach `grow` past the buttons' places- IRegion2D buttons = reachedBy( commandButtonsBox(), grow.x, grow.y );- if( othersFound )- {- buttons.lo.x = min( buttons.lo.x, grid.lo.x );- buttons.lo.y = min( buttons.lo.y, grid.lo.y );- buttons.hi.x = max( buttons.hi.x, grid.hi.x );- buttons.hi.y = max( buttons.hi.y, grid.hi.y );- }- grid = buttons;- const Bool powerFound = controlBarWindowRect( controlBarWindow( "PowerWindow" ), power );-- // the grid's container is the grid, its border outside it running down to the screen's bottom.- // The power bar is the page's own now, so its frame is free to stand on that border, as wide as- // the grid: each side's layout puts the power window at a width of its own, and the bar changed- // length with the side. The money is set down on the frame, over the grid's middle- centre = framed( grid, REAL_TO_INT( PANEL_BORDER * scale ), FALSE, FALSE );- IRegion2D frame = grownBy( power, STACK_FRAME, STACK_FRAME, STACK_FRAME, STACK_FRAME );- const Int frameHeight = frame.hi.y - frame.lo.y;- frame.lo.x = grid.lo.x;- frame.hi.x = grid.hi.x;- frame.hi.y = centre.lo.y;- frame.lo.y = frame.hi.y - frameHeight;-- // the power bar's block is the centre's bezel carried on upward, as wide as it, so the bar and- // the grid read as two wells in one plate: the centre's top border runs between them- IRegion2D powerBlock;- powerBlock.lo.x = centre.lo.x;- powerBlock.hi.x = centre.hi.x;- powerBlock.hi.y = centre.lo.y;- powerBlock.lo.y = frame.lo.y - REAL_TO_INT( STACK_POWER_TOP * scale );-- // each block stands on the top of the one under it- Int floor = centre.lo.y;- if( powerFound )- floor = powerBlock.lo.y;-+ const Int border = REAL_TO_INT( PANEL_BORDER * scale );+ const Int middle = ( purse.lo.y + purse.hi.y ) / 2;+ struct Row+ {+ static IRegion2D across( Int left, Int right, Int middle, Int height )+ {+ IRegion2D row;+ row.lo.x = left;+ row.hi.x = right;+ row.lo.y = middle - height / 2;+ row.hi.y = row.lo.y + height;+ return row;+ }+ };+ const Int keyLeft = purse.lo.x + border;+ const IRegion2D key = Row::across( keyLeft, keyLeft + REAL_TO_INT( PURSE_KEY_WIDTH * scale ), middle,+ REAL_TO_INT( PURSE_KEY_HEIGHT * scale ) );+ const Int moneyRight = purse.hi.x - border;+ const IRegion2D money = Row::across( moneyRight - REAL_TO_INT( PURSE_MONEY_WIDTH * scale ), moneyRight, middle,+ REAL_TO_INT( PURSE_MONEY_HEIGHT * scale ) );+ const IRegion2D power = Row::across( key.hi.x + border, money.lo.x - border, middle,+ REAL_TO_INT( PURSE_POWER_HEIGHT * scale ) );++ putPageRect( values, "purse", purse, shown );+ putPageRect( values, "workerkey", key, shown );+ putPageRect( values, "powerframe", power, shown );+ putPageRect( values, "moneyblock", money, shown );+ TheControlBar->placeWindowAt( controlBarWindow( "PowerWindow" ), power );++ // the font's height is the line without the drop shadow and the accents over the capitals, and a+ // window that tall had the figure standing out over its block; half as much again holds itGameWindow *moneyWindow = controlBarWindow( "MoneyDisplay" );- Bool moneyFound = controlBarWindowRect( moneyWindow, money );- if( moneyFound && moneyWindow->winGetFont() )+ if( moneyWindow->winGetFont() ){- // the font's height is the line without the drop shadow and the accents over the capitals, and- // a window that tall had the figure standing out over the block; half as much again holds itenum { MONEY_LINE_HALVES = 3 };- const Int height = moneyWindow->winGetFont()->height * MONEY_LINE_HALVES / 2;- Int parentX = 0, parentY = 0;- if( moneyWindow->winGetParent() )- moneyWindow->winGetParent()->winGetScreenPosition( &parentX, &parentY );- const Int left = ( grid.lo.x + grid.hi.x - ( money.hi.x - money.lo.x ) ) / 2;- moneyWindow->winSetPosition( left - parentX, floor - height - parentY );- moneyWindow->winSetSize( money.hi.x - money.lo.x, height );- moneyFound = controlBarWindowRect( moneyWindow, money );- }- IRegion2D block = grownBy( money, STACK_MONEY_SIDE, STACK_MONEY_TOP, STACK_MONEY_SIDE, 0 );- block.hi.y = floor;-- putFrame( values, "centre", grid, centre, shown );- putPageRect( values, "powerframe", frame, powerFound && shown );- putPageRect( values, "powerblock", powerBlock, powerFound && shown );+ TheControlBar->placeWindowAt( moneyWindow, Row::across( money.lo.x, money.hi.x, middle,+ moneyWindow->winGetFont()->height * MONEY_LINE_HALVES / 2 ) );+ }// the page lays boxes out content-box whatever box-sizing says, so the frame's border goes on top// of its width and height: hand it the content, and the height inside its lip for the cells, since@@ -11414,7 +11363,6 @@ static void stackCentre( HtmlValues &values, Bool shown, const ICoord2D &grow, Ivalues[ "powerframe.w" ] = std::to_string( width > 0 ? width : 0 );values[ "powerframe.h" ] = std::to_string( height > 0 ? height : 0 );values[ "powerframe.inner" ] = std::to_string( height > 2 * FRAME_LIP ? height - 2 * FRAME_LIP : 0 );- putPageRect( values, "moneyblock", block, moneyFound && shown );}/** `name`.x, .y, .w and .h in the page's pixels, and `name`.shown "shown" or "hidden". */@@ -11549,136 +11497,203 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I// Every panel is a container exactly as big as what it holds, and a border outside it: steel on// the sides facing the battlefield, out to the screen's edge on the sides against it. Everything- // else - the tabs, the buttons, the signals - stands outside the border.+ // else - the tabs, the keys, the signals - stands outside the border. The layout is the owner's+ // drawing of 2026-09-28: from the left the radar with the experience bar beside it, the command+ // panel with the portrait bar on it, and the Q and W worker bars a row lower with the purse on themconst Real scale = ControlBarUniformScale();const Int border = REAL_TO_INT( PANEL_BORDER * scale );-- // the command and queue buttons grow into the gaps the layout left until the steel between two- // pictures is half what it was, and the page's rings round the pictures meet in what is left.- // The gaps are measured from the placed rectangles, whatever the buttons were last grown by- const Int leastGap = REAL_TO_INT( CELL_GAP_LEAST * scale );- const GridGrowth commandGrowth = gridGrowth( "ButtonCommand", 1, 3, 2, leastGap );- const GridGrowth queueGrowth = gridGrowth( "ButtonQueue", 1, 2, 4, leastGap );- ICoord2D grown;- grown.x = -commandGrowth.grow.x;- grown.y = -commandGrowth.grow.y;- for( Int button = 1; button <= COMMAND_BUTTONS; button++ )- TheControlBar->insetPlacedWindow( numberedWindow( "ButtonCommand", button ), grown );- grown.x = -queueGrowth.grow.x;- grown.y = -queueGrowth.grow.y;- for( Int button = 1; button <= QUEUE_BUTTONS; button++ )- TheControlBar->insetPlacedWindow( numberedWindow( "ButtonQueue", button ), grown );-+ const Int ring = CELL_GAP / 2;+ const Int foot = barBottom() - REAL_TO_INT( PANEL_FOOT * scale );const Bool leftShown = panelCount > 0 && shown[ 0 ];- const Bool rightShown = panelCount > 2 && shown[ 2 ];+ const Bool centreShown = panelCount > 1 && shown[ 1 ];+ HtmlLists lists;- IRegion2D content;- const Bool leftFound = controlBarUnion( CONTROL_BAR_LEFT, content );+ // 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+ GameWindow *radarWindow = controlBarWindow( "LeftHUD" );+ const Bool leftFound = leftShown && !radarWindow->winIsHidden();+ IRegion2D content = windowScreenRect( radarWindow );+ 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 && leftShown );+ putFrame( values, "left", content, leftBox, leftFound );+ putPageRect( values, "expframe", experience, leftFound );+ putExperienceBar( values, lists[ "expcells" ], lists[ "rankstars" ] );++ // on the radar panel's top edge at its left hand end the under-attack light, and on the light the+ // skills key: the rank's stars, and the button that opens the promotion screen. A watcher, or a+ // player beaten, has no promotions to buy, and the bar disables the button for himconst IRegion2D alertTab = tabOn( leftBox, ALERT_TAB_WIDTH, PANEL_TAB_HEIGHT, FALSE );- putPageRect( values, "alerttab", alertTab, leftFound && leftShown );- // the event feed stands on that tab, or on the screen's bottom with the radar folded away- m_feedFloor = leftFound && leftShown ? alertTab.lo.y : barBottom();-- // the three smoke signal buttons, a column standing on the screen's bottom edge against the left- // panel's border; not there at all where the keys would do nothing either, a game with no allies- // to see the smoke- IRegion2D signalColumn;- signalColumn.lo.x = leftBox.hi.x;- signalColumn.hi.x = leftBox.hi.x + REAL_TO_INT( SIGNAL_BUTTON_WIDTH * scale );- signalColumn.hi.y = barBottom();- signalColumn.lo.y = signalColumn.hi.y - REAL_TO_INT( SIGNAL_BUTTON_SIZE * SIGNAL_BUTTONS * scale );- const Bool signalsShown = leftFound && leftShown && signalsAllowed();- putPageRect( values, "signals", signalColumn, signalsShown );+ putPageRect( values, "alerttab", alertTab, leftFound );+ const IRegion2D skillsTab = tabOn( alertTab, SKILLS_TAB_WIDTH, SKILLS_TAB_HEIGHT, FALSE );+ const Bool skillsShown = leftFound && ThePlayerList->getLocalPlayer()->isPlayerActive();+ putPageRect( values, "skillstab", skillsTab, skillsShown );+ // the event feed and the production queue's row stand on the key, or on the light without it+ m_feedFloor = skillsShown ? skillsTab.lo.y : leftFound ? alertTab.lo.y : barBottom();++ // the three smoke signal buttons side by side on the same edge at its right hand end; not there at+ // all where the keys would do nothing either, a game with no allies to see the smoke+ IRegion2D signalStep;+ signalStep.hi.x = leftBox.hi.x;+ signalStep.lo.x = signalStep.hi.x - REAL_TO_INT( SIGNAL_STEP_WIDTH * scale );+ signalStep.hi.y = leftBox.lo.y;+ signalStep.lo.y = signalStep.hi.y - REAL_TO_INT( SIGNAL_STEP_HEIGHT * scale );+ const Bool signalsShown = leftFound && signalsAllowed();+ putPageRect( values, "signals", signalStep, signalsShown );const UnsignedInt nowMs = timeGetTime();if( signalsShown && !m_signalsWereShown )m_signalsRiseStartMs = nowMs;m_signalsWereShown = signalsShown;putSignalRise( values, nowMs - m_signalsRiseStartMs );- IRegion2D centreBox;- // the grid's container holds the pictures and the rings round them- ICoord2D gridOutside;- gridOutside.x = commandGrowth.grow.x + REAL_TO_INT( commandGrowth.ring * scale );- gridOutside.y = commandGrowth.grow.y + REAL_TO_INT( commandGrowth.ring * scale );- stackCentre( values, panelCount > 1 && shown[ 1 ], gridOutside, centreBox );- // the idle worker's key, a smoke signal's size, in a step against the centre panel's border at its- // bottom left, standing on the screen's bottom edge; on the top edge it stood under the power bar- IRegion2D workerStep;- workerStep.hi.x = centreBox.lo.x;- workerStep.lo.x = workerStep.hi.x - REAL_TO_INT( WORKER_TAB_WIDTH * scale );- workerStep.hi.y = barBottom();- workerStep.lo.y = workerStep.hi.y - REAL_TO_INT( WORKER_STEP_HEIGHT * scale );- putPageRect( values, "workertab", workerStep, panelCount > 1 && shown[ 1 ] );- HtmlLists lists;- putPowerBar( values, lists[ "powercells" ] ); // after the stack, whose frame it divides into cells-- // a well behind each of the fourteen command buttons, shown or not, so the grid reads as a grid- // with the steel between its places, and an empty place is a hole in it rather than bare dark+ // the command panel against the radar's: five places across the top for the unit's own abilities+ // and upgrades, then attack, stop and attack move, then eject, seek shelter, guard and hold+ // position. The worker bars stand beside it a row lower, Q then W, and the purse on them is level+ // with its top+ const IRegion2D commandBox = gridBox( leftBox.hi.x + border, foot, COMMAND_COLUMNS, COMMAND_ROWS );+ const IRegion2D centreBox = framed( commandBox, border, FALSE, FALSE );+ putFrame( values, "centre", commandBox, centreBox, centreShown );+ const IRegion2D qBox = gridBox( centreBox.hi.x + border, foot, WORKER_COLUMNS, WORKER_ROWS );+ const IRegion2D qFrame = framed( qBox, border, FALSE, FALSE );+ putFrame( values, "qbar", qBox, qFrame, centreShown );+ const IRegion2D wBox = gridBox( qFrame.hi.x + border, foot, WORKER_COLUMNS, WORKER_ROWS );+ const IRegion2D wFrame = framed( wBox, border, FALSE, FALSE );+ putFrame( values, "wbar", wBox, wFrame, centreShown );+ IRegion2D purse;+ purse.lo.x = qFrame.lo.x;+ purse.hi.x = wFrame.hi.x;+ purse.lo.y = centreBox.lo.y;+ purse.hi.y = qFrame.lo.y;+ putPurse( values, purse, centreShown );+ putPowerBar( values, lists[ "powercells" ] ); // after the purse, whose groove it divides into cells++ // every place a command can go, shown or not, so each grid reads as a grid with the steel between+ // its places and an empty place is a hole in it. A worker bar's place is its chord key's: the+ // second key runs down the columns, Q Z W X E C R V as shipped+ IRegion2D place[ COMMAND_PLACE_COUNT ];+ for( Int each = 0; each < COMMAND_PLACE_COUNT; each++ )+ {+ const Int inBar = ( each - COMMAND_PLACE_Q ) % ( WORKER_COLUMNS * WORKER_ROWS );+ if( each < COMMAND_PLACE_SKILLS )+ place[ each ] = gridCell( commandBox, each, 0 );+ else if( each < COMMAND_PLACE_EJECT )+ place[ each ] = gridCell( commandBox, each - COMMAND_PLACE_ATTACK, 1 );+ else if( each < COMMAND_PLACE_Q )+ place[ each ] = gridCell( commandBox, each - COMMAND_PLACE_EJECT, 2 );+ else+ place[ each ] = gridCell( each < COMMAND_PLACE_W ? qBox : wBox, inBar / WORKER_ROWS, inBar % WORKER_ROWS );+ }std::vector< HtmlValues > &commandCells = lists[ "commandcells" ];- for( Int button = 1; button <= COMMAND_BUTTONS && panelCount > 1 && shown[ 1 ]; button++ )+ for( Int each = 0; each < COMMAND_PLACE_COUNT && centreShown; each++ ){HtmlValues entry;- putCell( entry, windowScreenRect( numberedWindow( "ButtonCommand", button ) ), commandGrowth.ring );+ putCell( entry, place[ each ], ring );commandCells.push_back( entry );}- const Bool rightFound = controlBarUnion( CONTROL_BAR_RIGHT, content );- const IRegion2D rightBox = framed( content, border, FALSE, TRUE );- putFrame( values, "right", content, rightBox, rightFound && rightShown );+ // each command button to the place its command goes to. A click only reaches a window inside+ // every one of its parents, so the buttons' two cover the whole frame; the page's solids still+ // decide what is battlefield+ const IRegion2D frameRect = windowScreenRect( TheControlBar->getMasterParent() );+ TheControlBar->placeWindowAt( controlBarWindow( "CenterBackground" ), frameRect );+ TheControlBar->placeWindowAt( controlBarWindow( "CommandWindow" ), frameRect );+ Int types[ COMMAND_BUTTONS ];+ Int where[ COMMAND_BUTTONS ];+ Bool fights = FALSE;+ for( Int button = 0; button < COMMAND_BUTTONS; button++ )+ {+ GameWindow *window = numberedWindow( "ButtonCommand", button + 1 );+ const CommandButton *command = window->winIsHidden() ? NULL : (const CommandButton *)GadgetButtonGetData( window );+ types[ button ] = command ? command->getCommandType() : GUI_COMMAND_NONE;+ fights = fights || types[ button ] == GUI_COMMAND_ATTACK_MOVE;+ }+ ControlBar_commandPlaces( types, COMMAND_BUTTONS, where );+ for( Int button = 0; button < COMMAND_BUTTONS; button++ )+ if( where[ button ] >= 0 )+ TheControlBar->placeWindowAt( numberedWindow( "ButtonCommand", button + 1 ), place[ where[ button ] ] );+ // attack and hold position have no button in any command set: the page's keys do what A and H do,+ // for anything that attack moves. Seek shelter has nothing behind it and stays a hole+ putPageRect( values, "attackkey", place[ COMMAND_PLACE_ATTACK ], centreShown && fights );+ putPageRect( values, "holdkey", place[ COMMAND_PLACE_HOLD ], centreShown && fights );++ // the portrait bar on the command panel, flush with its left edge: the portrait, then a single+ // unit's upgrades or a multi-selection's types, the owner's rule. More types than places take+ // smaller cells, two rows of them, then three. A watcher has no command panel and keeps the+ // portrait of what he clicked, the bar standing on the screen's bottom edge in its place+ const Bool portraitShown = centreShown || ( panelCount > 2 && shown[ 2 ] );+ IRegion2D portraitBox;+ portraitBox.lo.x = commandBox.lo.x;+ portraitBox.hi.y = centreShown ? centreBox.lo.y - border : foot;+ portraitBox.lo.y = portraitBox.hi.y - REAL_TO_INT( ( CELL_HEIGHT + CELL_GAP ) * scale );+ portraitBox.hi.x = portraitBox.lo.x + REAL_TO_INT( ( PORTRAIT_WIDTH + CELL_GAP + PORTRAIT_PLACES * ( CELL_WIDTH + CELL_GAP ) ) * scale );+ IRegion2D portraitFrame = framed( portraitBox, border, FALSE, FALSE );+ portraitFrame.hi.y = centreShown ? centreBox.lo.y : barBottom();+ putFrame( values, "portrait", portraitBox, portraitFrame, portraitShown );+ TheControlBar->placeWindowAt( controlBarWindow( "RightHUD" ), portraitBox );+ TheControlBar->placeWindowAt( controlBarWindow( "WinUnitSelected" ), portraitBox );+ IRegion2D portraitCell = gridCell( portraitBox, 0, 0 );+ portraitCell.hi.x = portraitCell.lo.x + REAL_TO_INT( PORTRAIT_WIDTH * scale );+ TheControlBar->placeWindowAt( controlBarWindow( "CameoWindow" ), portraitCell );+ IRegion2D placesBox = portraitBox;+ placesBox.lo.x = portraitCell.hi.x + REAL_TO_INT( ring * scale );- // the experience bar's groove down the column the bar's own window and its foreground picture- // shared, the medal on top included, and the rank's stars in a tab on the panel's border at its- // right hand end, the way the under-attack light stands on the radar's at its left- IRegion2D experience;- const Bool experienceFound = controlBarUnion( CONTROL_BAR_EXPERIENCE, experience );- putPageRect( values, "expframe", experience, experienceFound && rightFound && rightShown );- putExperienceBar( values, lists[ "expcells" ], lists[ "rankstars" ] );- // a watcher, or a player beaten, has no promotions to buy, and the bar disables the button for him- const IRegion2D starsTab = tabOn( rightBox, STARS_TAB_WIDTH, STARS_TAB_HEIGHT, TRUE );- const Bool starsShown = rightFound && rightShown && ThePlayerList->getLocalPlayer()->isPlayerActive();- putPageRect( values, "starstab", starsTab, starsShown );-- // the portrait's well is steel with a dark cell for each of the production queue's nine places,- // the grid the side's RightHUD picture used to draw in the side's own colour, blue for America- // While a unit is selected its portrait stands over four of those places and its upgrades in the- // other five: the portrait's four are one cell then, the portrait's ownstd::vector< HtmlValues > &portraitCells = lists[ "portraitcells" ];- GameWindow *portrait = controlBarWindow( "CameoWindow" );- const Bool portraitShown = !portrait->winIsHidden() && !portrait->winGetParent()->winIsHidden();- const IRegion2D portraitRect = windowScreenRect( portrait );- if( portraitShown && rightFound && rightShown )- {- HtmlValues entry;- putCell( entry, portraitRect, queueGrowth.ring );- portraitCells.push_back( entry );+ HtmlValues portraitEntry;+ putCell( portraitEntry, portraitCell, ring );+ if( portraitShown )+ portraitCells.push_back( portraitEntry );+ Int filled = 0;+ for( Int upgrade = 1; upgrade <= UPGRADE_CAMEOS; upgrade++ )+ {+ GameWindow *window = controlBarWindow( "UnitUpgrade" + std::to_string( upgrade ) );+ if( !window->winIsHidden() )+ TheControlBar->placeWindowAt( window, gridCell( placesBox, filled++, 0 ) );+ }+ const std::vector< GameWindow * > &tiles = TheControlBar->getMultiSelectTiles();+ Int tilesShown = 0;+ for( size_t tile = 0; tile < tiles.size(); tile++ )+ if( tiles[ tile ] && !tiles[ tile ]->winIsHidden() )+ tilesShown++;+ Int rows = 1;+ while( tilesShown > rows * rows * PORTRAIT_PLACES )+ rows++;+ filled = 0;+ for( size_t tile = 0; tile < tiles.size(); tile++ )+ {+ if( tiles[ tile ] == NULL || tiles[ tile ]->winIsHidden() )+ continue;+ const IRegion2D cell = gridCell( placesBox, filled / rows, filled % rows, 1.0f / rows );+ TheControlBar->placeWindowAt( tiles[ tile ], cell );+ filled++;+ if( rows > 1 && portraitShown )+ {+ HtmlValues entry;+ putCell( entry, cell, 1 );+ portraitCells.push_back( entry );+ }}- for( Int button = 1; button <= QUEUE_BUTTONS && rightFound && rightShown; button++ )+ for( Int each = 0; each < PORTRAIT_PLACES && rows == 1 && portraitShown; each++ ){- const IRegion2D place = windowScreenRect( numberedWindow( "ButtonQueue", button ) );- if( portraitShown && place.lo.x >= portraitRect.lo.x && place.hi.x <= portraitRect.hi.x + 1 &&- place.lo.y >= portraitRect.lo.y && place.hi.y <= portraitRect.hi.y + 1 )- continue;HtmlValues entry;- putCell( entry, place, queueGrowth.ring );+ putCell( entry, gridCell( placesBox, each, 0 ), ring );portraitCells.push_back( entry );}- // the general's powers ready to fire over the right panel, the first in the corner against the- // screen's right edge, the row growing left as they come and wrapping upward past three, each- // three quarters of a command button. They sit in a tray of the panels' steel only as big as they are, and each- // has a dark cell behind it the way the command grid's buttons do+ // 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 worker bars where three fit there, and over the purse's end where they do notconst 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;ICoord2D corner;corner.x = TheDisplay->getWidth() - trayBorder;- corner.y = starsTab.lo.y - REAL_TO_INT( SKILL_GRID_GAP * scale ) - trayBorder;- const IRegion2D button = commandButtonRect( 1 );- ICoord2D cell;- cell.x = ( button.hi.x - button.lo.x ) * SKILL_CELL_PERCENT / 100;- cell.y = ( button.hi.y - button.lo.y ) * SKILL_CELL_PERCENT / 100;- const Int cellGap = REAL_TO_INT( SKILL_CELL_GAP * scale );- const Int powersShown = TheControlBar->placeSpecialPowerShortcutGrid( rightFound && rightShown ? &corner : NULL, cell, cellGap );+ corner.y = ( (Int)TheDisplay->getWidth() - wFrame.hi.x >= trayWidth ? barBottom() : purse.lo.y - REAL_TO_INT( SKILL_GRID_GAP * scale ) )+ - trayBorder;+ const Int powersShown = TheControlBar->placeSpecialPowerShortcutGrid( centreShown ? &corner : NULL, cell, cellGap );std::vector< HtmlValues > &places = lists[ "skillcells" ];IRegion2D powers;@@ -11711,27 +11726,12 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, Im_cellFrontCells[ CELL_GRID_QUEUE ] = portraitCells;m_cellFrontCells[ CELL_GRID_POWERS ] = places;putFrontWindow( controlBarWindow( "CommandWindow" ), drawCommandGridFront );- // the portrait's grid over the queue, the portrait and its upgrades alike, all RightHUD's+ // the portrait bar's grid over the portrait, its upgrades and a selection's types, all RightHUD'sputFrontWindow( controlBarWindow( "RightHUD" ), drawQueueGridFront );GameWindow *powersParent = TheControlBar->getSpecialPowerShortcutParent();if( powersParent )putFrontWindow( powersParent, drawPowersGridFront );- // the promotion button is the stars' tab: its window moves under the tab and takes the click that- // opens the promotion screen. With no tab drawn it goes too: a watcher who clicked a unit got the- // button enabled again, an empty patch of screen with a tooltip that opened the screen- GameWindow *promotion = controlBarWindow( "ButtonGeneral" );- if( promotion )- promotion->winHide( !starsShown );- if( rightFound && promotion )- {- Int parentX = 0, parentY = 0;- if( promotion->winGetParent() )- promotion->winGetParent()->winGetScreenPosition( &parentX, &parentY );- promotion->winSetPosition( starsTab.lo.x - parentX, starsTab.lo.y - parentY );- promotion->winSetSize( starsTab.hi.x - starsTab.lo.x, starsTab.hi.y - starsTab.lo.y );- }-for( Int each = 0; each < (Int)ARRAY_SIZE( CONTROL_BAR_WINDOWS ); each++ ){const std::string name = CONTROL_BAR_WINDOWS[ each ];@@ -11794,6 +11794,12 @@ Bool InGameUI::handleControlBarPageClick( const ICoord2D *mouse, Bool act )armSignalFromPage( action.substr( SIGNAL_ACTION.size() ) );return TRUE;}+ if( action.compare( 0, ORDER_ACTION.size(), ORDER_ACTION ) == 0 )+ {+ if( act )+ orderFromPage( action.substr( ORDER_ACTION.size() ) );+ return TRUE;+ }if( action.compare( 0, PRESS_ACTION.size(), PRESS_ACTION ) != 0 )return FALSE;if( !act )@@ -11883,9 +11889,8 @@ static void layoutPromotionScreen( GameWindow *parent, PromotionLayout &layout ){const Real scale = ControlBarUniformScale();struct Page { static Int px( Int pagePixels, Real scale ) { return REAL_TO_INT( pagePixels * scale ); } };- const IRegion2D button = commandButtonRect( 1 );- const Int cellWidth = button.hi.x - button.lo.x;- const Int cellHeight = button.hi.y - button.lo.y;+ const Int cellWidth = Page::px( COMMAND_BUTTON_WIDTH, scale );+ const Int cellHeight = Page::px( COMMAND_BUTTON_HEIGHT, scale );const Int gap = Page::px( PROMOTION_CELL_GAP, scale );const Int margin = Page::px( PROMOTION_MARGIN, scale );const Int inset = Page::px( PROMOTION_INSET, scale );@@ -12638,26 +12643,18 @@ void InGameUI::drawProductionStripColumn( Int left, Int bottomY )//-------------------------------------------------------------------------------------------------/** Playing under the bar's page, the strip is a row in the page's steel, Window/Html/Queue.html: a- * tray on the radar's side as the general's powers' is on the portrait's, standing over the- * under-attack light's tab with its first cell against the screen's left edge and the row growing- * right. Each cell is a power's size, the soonest first, the "+N" in a cell of its own at the end,- * and the page's frames are drawn again over the cameos' edges the way the command grid's are. */+ * tray over the radar, standing over the skills key with its first cell against the screen's left+ * edge and the row growing right. Each cell is a power's size, the soonest first, the "+N" in a+ * cell of its own at the end, and the page's frames are drawn again over the cameos' edges the way+ * the command grid's are. *///-------------------------------------------------------------------------------------------------void InGameUI::drawQueueTray( void ){const Real scale = ControlBarUniformScale();- const IRegion2D button = commandButtonRect( 1 );- ICoord2D cell;- cell.x = ( button.hi.x - button.lo.x ) * SKILL_CELL_PERCENT / 100;- cell.y = ( button.hi.y - button.lo.y ) * SKILL_CELL_PERCENT / 100;+ const ICoord2D cell = cellSize();const Int gap = REAL_TO_INT( SKILL_CELL_GAP * scale );const Int trayBorder = REAL_TO_INT( QUEUE_TRAY_BORDER * scale );- IRegion2D content;- controlBarUnion( CONTROL_BAR_LEFT, content );- const IRegion2D alertTab = tabOn( framed( content, REAL_TO_INT( PANEL_BORDER * scale ), TRUE, FALSE ),- ALERT_TAB_WIDTH, PANEL_TAB_HEIGHT, FALSE );-// a cameo wearing an "x5" stands for five, and the "+N" is what none of them showsInt shown = 0;for( Int slot = 0; slot < m_productionStripCount; slot++ )@@ -12666,7 +12663,7 @@ void InGameUI::drawQueueTray( void )IRegion2D cellsBox;cellsBox.lo.x = trayBorder;- cellsBox.hi.y = alertTab.lo.y - REAL_TO_INT( SKILL_GRID_GAP * scale ) - trayBorder;+ cellsBox.hi.y = m_feedFloor - REAL_TO_INT( SKILL_GRID_GAP * scale ) - trayBorder;cellsBox.lo.y = cellsBox.hi.y - cell.y;cellsBox.hi.x = cellsBox.lo.x + cells * cell.x + ( cells - 1 ) * gap;IRegion2D tray = cellsBox;diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex cc52a8ab5..73e9a7f35 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -3090,6 +3090,66 @@ TEST(controlbar_promotion_columns_map_to_the_screens_three_rows)CHECK_EQ( seen8, (1 << MAX_PURCHASE_SCIENCE_RANK_8) - 1 );}+TEST(controlbar_command_places_follow_the_owners_drawing)+{+ enum { SLOTS = 14 };+ Int places[ SLOTS ];+ const Int N = GUI_COMMAND_NONE;++ /* AmericaDozerCommandSet: structures in slots 1 to 9, 11 and 13, disarm mines in 14. The first+ eight go to the Q bar at their slot, the rest to the W bar at their slot less eight, which is+ the place the structure chord's second key names; the disarm is an ability on the top row */+ const Int dozer[ SLOTS ] = { GUI_COMMAND_DOZER_CONSTRUCT, GUI_COMMAND_DOZER_CONSTRUCT, GUI_COMMAND_DOZER_CONSTRUCT,+ GUI_COMMAND_DOZER_CONSTRUCT, GUI_COMMAND_DOZER_CONSTRUCT, GUI_COMMAND_DOZER_CONSTRUCT, GUI_COMMAND_DOZER_CONSTRUCT,+ GUI_COMMAND_DOZER_CONSTRUCT, GUI_COMMAND_DOZER_CONSTRUCT, N, GUI_COMMAND_DOZER_CONSTRUCT, N,+ GUI_COMMAND_DOZER_CONSTRUCT, GUI_COMMAND_FIRE_WEAPON };+ ControlBar_commandPlaces( dozer, SLOTS, places );+ CHECK_EQ( places[ 0 ], (Int)COMMAND_PLACE_Q );+ CHECK_EQ( places[ 7 ], COMMAND_PLACE_Q + 7 );+ CHECK_EQ( places[ 8 ], (Int)COMMAND_PLACE_W );+ CHECK_EQ( places[ 10 ], COMMAND_PLACE_W + 2 );+ CHECK_EQ( places[ 12 ], COMMAND_PLACE_W + 4 );+ CHECK_EQ( places[ 9 ], -1 );+ CHECK_EQ( places[ 13 ], (Int)COMMAND_PLACE_SKILL );++ /* AmericaVehicleHumveeCommandSet: three drones, five passengers, evacuate, attack move, guard,+ stop. The orders take their own places whatever slot they were in; the passengers go to the Q+ bar by slot and the drones along the top */+ const Int humvee[ SLOTS ] = { GUI_COMMAND_OBJECT_UPGRADE, GUI_COMMAND_OBJECT_UPGRADE, GUI_COMMAND_OBJECT_UPGRADE,+ GUI_COMMAND_EXIT_CONTAINER, GUI_COMMAND_EXIT_CONTAINER, GUI_COMMAND_EXIT_CONTAINER, GUI_COMMAND_EXIT_CONTAINER,+ GUI_COMMAND_EXIT_CONTAINER, GUI_COMMAND_EVACUATE, N, GUI_COMMAND_ATTACK_MOVE, N, GUI_COMMAND_GUARD, GUI_COMMAND_STOP };+ ControlBar_commandPlaces( humvee, SLOTS, places );+ CHECK_EQ( places[ 0 ], COMMAND_PLACE_SKILL + 0 );+ CHECK_EQ( places[ 2 ], COMMAND_PLACE_SKILL + 2 );+ CHECK_EQ( places[ 3 ], COMMAND_PLACE_Q + 3 );+ CHECK_EQ( places[ 8 ], (Int)COMMAND_PLACE_EJECT );+ CHECK_EQ( places[ 10 ], (Int)COMMAND_PLACE_ATTACK_MOVE );+ CHECK_EQ( places[ 12 ], (Int)COMMAND_PLACE_GUARD );+ CHECK_EQ( places[ 13 ], (Int)COMMAND_PLACE_STOP );++ /* ChinaCommandCenterCommandSet: a dozer to build, seven powers, two upgrades, rally, sell. Past+ the top row's five the rest spill into the worker bars' free places, and nothing lands on the+ places kept for orders */+ const Int centre[ SLOTS ] = { GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_SPECIAL_POWER, GUI_COMMAND_SPECIAL_POWER,+ GUI_COMMAND_SPECIAL_POWER, GUI_COMMAND_SPECIAL_POWER, GUI_COMMAND_SPECIAL_POWER, GUI_COMMAND_SPECIAL_POWER,+ GUI_COMMAND_SPECIAL_POWER, GUI_COMMAND_OBJECT_UPGRADE, GUI_COMMAND_OBJECT_UPGRADE, N, N,+ GUI_COMMAND_SET_RALLY_POINT, GUI_COMMAND_SELL };+ ControlBar_commandPlaces( centre, SLOTS, places );+ CHECK_EQ( places[ 0 ], (Int)COMMAND_PLACE_Q );+ CHECK_EQ( places[ 5 ], COMMAND_PLACE_SKILL + 4 );+ CHECK_EQ( places[ 6 ], COMMAND_PLACE_Q + 1 );+ CHECK_EQ( places[ 13 ], COMMAND_PLACE_Q + 6 );+ Bool taken[ COMMAND_PLACE_COUNT ] = { FALSE };+ for( Int slot = 0; slot < SLOTS; slot++ )+ {+ if( places[ slot ] < 0 )+ continue;+ CHECK( !taken[ places[ slot ] ] );+ CHECK( places[ slot ] < COMMAND_PLACE_SKILLS || places[ slot ] >= COMMAND_PLACE_Q );+ taken[ places[ slot ] ] = TRUE;+ }+}+TEST(controlbar_seconds_round_up_and_never_reach_zero_early){/* nothing left is the only thing that reads as no number at all */