Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameclient): pack the command grid to the top left, pin worker keys, add a move key

Olcay Seygan852026d17da3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3683d9e7c..aeda7f151 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -624,7 +624,7 @@ 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.
-- The command bar is laid out anew, all of it running rightwards from the bottom left corner, and it is smaller: at 1920x1080 it stands 248 pixels tall where the old bar took 312, and it ends a third of the way across, so the rest 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 under-attack light, the skills key with your rank's stars on that, and over the stars the idle worker button whenever a worker stands idle. Next to it is one grid of eighteen buttons, six across and three down, and every button is its own key: Q W E R T Y over A S D F G H over Z X C V B N. No more two-key building shortcuts and no second bars: a dozer's buildings, a factory's units, a unit's abilities and upgrades and its orders all share the grid, each a single press. The orders stay put whatever you select. For a unit, A attacks, S stops, D attack-moves, Z ejects the passengers, X guards and C holds position; for a building, N sells it, B sets its rally point and Z empties its garrison. Everything else fills the free places from Q along the rows, what a building makes first and its upgrades after. Only the buttons your selection has are drawn, and the rest of the grid is bare steel. Its buttons are a fifth bigger than the rest of the bar's, so what you build stands out. Attack and hold position are buttons now, where no unit ever had one, with pictures painted to sit among the game's own: a crosshair on a red plate over a burning sky, a raised palm on a blue one. Over the grid runs a portrait bar only as long as what it holds. Select one unit and its upgrades follow its portrait; select a group and the bar holds every kind of unit in it once, each with how many you have, the one Tab has picked lit and the rest dimmed. The power bar stands up at the grid's right end. Your money has moved to the middle of the screen's top edge. The Legacy mouse and keyboard and the W A S D camera are gone from the Options screen: there is one way to play, and an Options.ini that still names them loads as it always did.
+- The command bar is laid out anew, all of it running rightwards from the bottom left corner, and it is smaller: at 1920x1080 it stands 248 pixels tall where the old bar took 312, and it ends a third of the way across, so the rest 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 under-attack light, the skills key with your rank's stars on that, and over the stars the idle worker button whenever a worker stands idle. Next to it is one grid of eighteen buttons, six across and three down, and every button is its own key: Q W E R T Y over A S D F G H over Z X C V B N. No more two-key building shortcuts and no second bars: a dozer's buildings, a factory's units, a unit's abilities and upgrades and its orders all share the grid, each a single press. The orders stay put whatever you select. For a unit, A attacks, S stops, D attack-moves, V moves, Z ejects the passengers, X guards and C holds position; for a building, N sells it, B sets its rally point and Z empties its garrison. Workers keep three of their own: N clears mines on every side's worker and dozer, H swaps a GLA worker between real and fake buildings, and B is the Demolition worker's suicide charge. Everything else packs into the top left corner, two rows at a time, Q A W Z S E X D R C and on, so the buildings you reach for most sit under your fingers; what a building makes comes first and its upgrades after. Only the buttons your selection has are drawn, and with nothing selected the grid is gone altogether and only the power bar stands. Its buttons are a fifth bigger than the rest of the bar's, so what you build stands out. Attack, hold position and move are buttons now, where no unit ever had one, with pictures painted to sit among the game's own: a crosshair on a red plate over a burning sky, a raised palm on a blue one, an arrow on a green diamond. V, or a click on the arrow, is a move for the left button: the next click on the ground sends the selection there, and a drag lays them out along the line the way a right drag does. Over the grid runs a portrait bar only as long as what it holds. Select one unit and its upgrades follow its portrait; select a group and the bar holds every kind of unit in it once, each with how many you have, the one Tab has picked lit and the rest dimmed. The power bar stands up at the grid's right end. Your money has moved to the middle of the screen's top edge. The Legacy mouse and keyboard and the W A S D camera are gone from the Options screen: there is one way to play, and an Options.ini that still names them loads as it always did.
- 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 stands in a steel groove of its own at the right end of the command grid, twenty cells that light up from the bottom with your production and fill the groove when full, the consumption marked by a white needle across it. The money hangs from the top edge of the screen in a steel plate of its own, the figure in a dark well. 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 tab over your rank's stars, where it no longer hides the end of the power bar. Each button stands in its own dark cell with steel running between them, 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, standing at its right end, and is as tall as the grid on every side, where it used to change length from one faction to the next. 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 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.
diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt
index 0d9928b98..e0bea1e4b 100644
--- a/GeneralsMD/Code/CMakeLists.txt
+++ b/GeneralsMD/Code/CMakeLists.txt
@@ -666,7 +666,7 @@ add_custom_command(TARGET generals POST_BUILD
${CMAKE_CURRENT_SOURCE_DIR}/Data/Install_Final.bmp
${CMAKE_CURRENT_SOURCE_DIR}/../Run/
# The three command bar plates per side, the smoke signals' ground marks and the
- # SupW uplink's pink laser strip (Tools/pink_laser.py) and the attack and hold position cameos
+ # SupW uplink's pink laser strip (Tools/pink_laser.py) and the attack, hold and move cameos
# (Tools/order_cameos.py). A loose
# texture beats every .big, so these land in Run/Art/Textures where the W3D file
# system looks first.
@@ -838,8 +838,8 @@ if(Python3_Interpreter_FOUND)
# synthetic one and checks the block parser did not eat an End or duplicate a key.
add_test(NAME vfx_tune_selfcheck
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Tools/vfx_tune.py selfcheck)
- # Tools/order_cameos.py paints the command bar's attack and hold position cameos: two whole
- # pictures in the places the mapped images name, told apart by colour, the same every run.
+ # Tools/order_cameos.py paints the command bar's attack, hold position and move cameos: three
+ # whole pictures in the places the mapped images name, told apart by colour, the same every run.
add_test(NAME order_cameos_selfcheck
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Tools/order_cameos.py selfcheck)
# The options screen is three tracked files that have to agree: TheOptionCatalog names a widget,
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedOrders.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedOrders.tga
index d8c5e2361..38bb8ffa8 100644
Binary files a/GeneralsMD/Code/Data/Art/Textures/ReforgedOrders.tga and b/GeneralsMD/Code/Data/Art/Textures/ReforgedOrders.tga differ
diff --git a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedOrders.ini b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedOrders.ini
index f1242aa35..f5fb77199 100644
--- a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedOrders.ini
+++ b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedOrders.ini
@@ -1,11 +1,11 @@
-; The command bar's attack and hold position cameos, painted by Tools/order_cameos.py into
-; Art/Textures/ReforgedOrders.tga. ControlBar.html draws them on the page's two order keys.
+; The command bar's attack, hold position and move cameos, painted by Tools/order_cameos.py into
+; Art/Textures/ReforgedOrders.tga. ControlBar.html draws them on the page's three order keys.
; Mapped images are not in the multiplayer INI checksum.
MappedImage ReforgedOrderAttack
Texture = ReforgedOrders.tga
TextureWidth = 128
- TextureHeight = 64
+ TextureHeight = 128
Coords = Left:0 Top:0 Right:60 Bottom:48
Status = NONE
End
@@ -13,7 +13,15 @@ End
MappedImage ReforgedOrderHold
Texture = ReforgedOrders.tga
TextureWidth = 128
- TextureHeight = 64
+ TextureHeight = 128
Coords = Left:64 Top:0 Right:124 Bottom:48
Status = NONE
End
+
+MappedImage ReforgedOrderMove
+ Texture = ReforgedOrders.tga
+ TextureWidth = 128
+ TextureHeight = 128
+ Coords = Left:0 Top:64 Right:60 Bottom:112
+ Status = NONE
+End
diff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
index 4f806cfba..2b1780d30 100644
--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html
+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
@@ -44,10 +44,10 @@
data-each="commandcells" each {{cell.x}} .y .w .h: the command grid's places that hold a command,
six by three, each its key (Q W E R T Y, A S D F G H, Z X C V B N), an
empty one left as steel; its cells are a fifth bigger than the others
- {{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. .key is the key bound
- to that place, "A" and "H" as shipped
+ {{attackkey.x}} ... the attack, hold position and move places, where the page's own keys
+ {{holdkey.x}} ... stand, data-click="order:attack", "order:hold" and "order:move", for a
+ {{movekey.x}} ... selection that attack moves; no command set has a button for any of
+ them. .key is the key bound to that place, "A", "C" and "V" as shipped
data-each="portraitcells" the portrait bar's cells, the portrait's first and then only what it
holds, each {{cell.x}} .y .w .h
{{skilltray.x}} ... the general's powers' tray, a panel as {{centre.x}} is, only as big as the
@@ -261,13 +261,14 @@
.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 wearing cameos
- painted for them (Code/Tools/order_cameos.py, the mapped images ReforgedOrderAttack and
- ReforgedOrderHold), with the game's own lit and pushed overlays over them the way its command
- buttons wear them */
+ /* the command panel's attack, hold position and move: keys over their places' holes wearing
+ cameos painted for them (Code/Tools/order_cameos.py, the mapped images ReforgedOrderAttack,
+ ReforgedOrderHold and ReforgedOrderMove), with the game's own lit and pushed overlays over them
+ the way its command buttons wear them */
.order { background-size: 100% 100%; background-repeat: no-repeat; }
.order.attack { background-image: url(ReforgedOrderAttack); }
.order.hold { background-image: url(ReforgedOrderHold); }
+ .order.move { background-image: url(ReforgedOrderMove); }
.order .glow { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background-size: 100% 100%; background-repeat: no-repeat; }
.order:hover .glow { background-image: url(Cameo_hilited); }
.held .order:hover .glow { background-image: url(Cameo_push); }
@@ -391,6 +392,7 @@
<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 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="glow"></div><div class="keyname">{{attackkey.key}}</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="glow"></div><div class="keyname">{{holdkey.key}}</div></div>
+ <div class="piece order move {{movekey.shown}}" data-click="order:move" style="left: {{movekey.x}}px; top: {{movekey.y}}px; width: {{movekey.w}}px; height: {{movekey.h}}px"><div class="glow"></div><div class="keyname">{{movekey.key}}</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/GameEngine/Include/Common/MessageStream.h b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
index 978085716..8f40a7ed5 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
@@ -300,6 +300,7 @@ public:
MSG_META_TOGGLE_FORCEATTACK, ///< arm force fire for the next order click (fork)
MSG_META_HOLD_POSITION, ///< hold position: guard in place, no pursuit (fork)
MSG_META_TOGGLE_GUARD, ///< arm guard for the next order click or drag (fork)
+ MSG_META_TOGGLE_MOVE, ///< arm a plain move for the next order click or drag (fork)
MSG_META_TOGGLE_PAUSE, ///< pause/unpause, single player and replay only (fork)
MSG_META_TOGGLE_PURCHASE_SCIENCE, ///< open/close the general's promotion screen (fork)
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
index 9c6cadb52..24bde4a89 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
@@ -454,18 +454,27 @@ enum CommandPlace
COMMAND_PLACE_EJECT = COMMAND_PLACE_Z, ///< a transport's passengers out, or a building's garrison
COMMAND_PLACE_GUARD = COMMAND_PLACE_X,
COMMAND_PLACE_HOLD = COMMAND_PLACE_C,
+ COMMAND_PLACE_MOVE = COMMAND_PLACE_V,
COMMAND_PLACE_RALLY = COMMAND_PLACE_B,
- COMMAND_PLACE_SELL = COMMAND_PLACE_N
+ COMMAND_PLACE_SELL = COMMAND_PLACE_N,
+ COMMAND_PLACE_CLEAR_MINES = COMMAND_PLACE_N, ///< a dozer's or worker's
+ COMMAND_PLACE_FAKE_STRUCTURES = COMMAND_PLACE_H, ///< the GLA worker's switch to and from the fakes
+ COMMAND_PLACE_EXPLOSIVE = COMMAND_PLACE_B ///< the Demolition worker's suicide charge
};
+/** The place a command button always stands at by its name, -1 for none: the worker's three, which
+ * share a command type with things that flow. See ControlBar_commandPlaces. */
+Int ControlBar_namedCommandPlace( const char *buttonName );
+
/** 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. Stop, attack move, guard, evacuate,
- * rally point and sell go to their own places. A set with an attack move has attack and hold
- * position too, keys no command set has a button for, so their two places are kept for them; the
- * return is TRUE then. Everything else fills the free places in reading order, Q W E R T Y first:
- * what the set builds (structures, units) in slot order, then the rest - abilities, upgrades,
- * passengers - in slot order, so a building's upgrades come after its production. */
-Bool ControlBar_commandPlaces( const Int *types, Int count, Int *places );
+ * an empty one, `pinned` a place a slot's button always takes by name or -1, and `places` gets a
+ * CommandPlace for each or -1. Pinned buttons, stop, attack move, guard, evacuate, rally point and
+ * sell go to their own places. A set with an attack move has attack, hold position and move too,
+ * keys no command set has a button for, so their places are kept for them; the return is TRUE then.
+ * Everything else is packed toward the top left, Q A W Z S E X D R C F T V G Y B H N, skipping the
+ * places taken: what the set builds (structures, units) in slot order, then the rest - abilities,
+ * upgrades, passengers - in slot order, so a building's upgrades come after its production. */
+Bool ControlBar_commandPlaces( const Int *types, const Int *pinned, 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 {
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 1b27bb3e4..1fdf434bf 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -1098,9 +1098,9 @@ public: // ********************************************************************
void setForceAttackMode( Bool enabled ) { m_forceAttackMode = enabled; }
void setPreferSelectionMode( Bool enabled ) { m_preferSelection = enabled; }
- void toggleAttackMoveToMode( void ) { m_attackMoveToMode = !m_attackMoveToMode; m_forceAttackArmed = FALSE; m_guardArmed = FALSE; }
+ void toggleAttackMoveToMode( void ) { m_attackMoveToMode = !m_attackMoveToMode; m_forceAttackArmed = FALSE; m_guardArmed = FALSE; m_moveArmed = FALSE; }
Bool isInAttackMoveToMode( void ) const { return m_attackMoveToMode; }
- void clearAttackMoveToMode( void ) { m_attackMoveToMode = FALSE; m_forceAttackArmed = FALSE; m_guardArmed = FALSE; m_orderKeyKeptByShift = FALSE; }
+ void clearAttackMoveToMode( void ) { m_attackMoveToMode = FALSE; m_forceAttackArmed = FALSE; m_guardArmed = FALSE; m_moveArmed = FALSE; m_orderKeyKeptByShift = FALSE; }
// an order click with one of the three keys armed spends the key, unless shift is down: then it
// stays armed for the next click, so a row of targets is one key and a row of clicks, and it drops
@@ -1110,17 +1110,22 @@ public: // ********************************************************************
// the attack key arms force fire the way the attack move key arms an attack move: the next
// order click shoots whatever is under it, ground included, and the mode drops again with the
// same call that drops attack move
- void toggleForceAttackArmed( void ) { m_forceAttackArmed = !m_forceAttackArmed; m_attackMoveToMode = FALSE; m_guardArmed = FALSE; }
+ void toggleForceAttackArmed( void ) { m_forceAttackArmed = !m_forceAttackArmed; m_attackMoveToMode = FALSE; m_guardArmed = FALSE; m_moveArmed = FALSE; }
Bool isForceAttackArmed( void ) const { return m_forceAttackArmed; }
- Bool isOrderKeyArmed( void ) const { return m_forceAttackArmed || m_attackMoveToMode || m_guardArmed; } ///< the next left click is an attack, an attack move or a guard
+ Bool isOrderKeyArmed( void ) const { return m_forceAttackArmed || m_attackMoveToMode || m_guardArmed || m_moveArmed; } ///< the next left click is an attack, an attack move, a guard or a move
Bool isForceFireOn( void ) const; ///< the next order click force fires: the attack key armed it
// and the guard key arms guard the same way: the next order click posts the selection on that
// spot, or on that object, and a drag posts them along the line instead of stacking them all
- // on one point. All three modes are one mode at a time
- void toggleGuardArmed( void ) { m_guardArmed = !m_guardArmed; m_attackMoveToMode = FALSE; m_forceAttackArmed = FALSE; }
+ // on one point. All the armed keys are one mode at a time
+ void toggleGuardArmed( void ) { m_guardArmed = !m_guardArmed; m_attackMoveToMode = FALSE; m_forceAttackArmed = FALSE; m_moveArmed = FALSE; }
Bool isGuardArmed( void ) const { return m_guardArmed; }
- Bool isLineOrderArmed( void ) const { return m_attackMoveToMode || m_guardArmed; } ///< a left drag draws an attack move or guard line; force fire's left drag is the attack circle
+
+ // the move key arms the order a right click gives, for the left button: the next order click is
+ // that move, and a left drag the formation line a right drag draws
+ void toggleMoveArmed( void ) { m_moveArmed = !m_moveArmed; m_attackMoveToMode = FALSE; m_forceAttackArmed = FALSE; m_guardArmed = FALSE; }
+ Bool isMoveArmed( void ) const { return m_moveArmed; }
+ Bool isLineOrderArmed( void ) const { return m_attackMoveToMode || m_guardArmed || m_moveArmed; } ///< a left drag draws a move, attack move or guard line; force fire's left drag is the attack circle
// zeroing the repeat clock makes the first quantized step happen on the very next update, so a
// tap of the key is one eighth and a hold is one eighth every CAMERA_SNAP_REPEAT_MS.
@@ -1679,6 +1684,7 @@ protected:
Bool m_attackMoveToMode; ///< are we in attack move mode?
Bool m_forceAttackArmed; ///< is the attack key holding force fire for the next click?
Bool m_guardArmed; ///< is the guard key holding a guard order for the next click?
+ Bool m_moveArmed; ///< is the move key holding a move for the next click?
Bool m_orderKeyKeptByShift; ///< an armed key was clicked with under shift, and drops when shift comes up
Bool m_preferSelection; ///< the shift key has been depressed.
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp
index fbabf1c92..b5bc924b6 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp
@@ -376,6 +376,7 @@ AsciiString GameMessage::getCommandTypeAsAsciiString(GameMessage::Type t)
CHECK_IF(MSG_META_TOGGLE_PURCHASE_SCIENCE)
CHECK_IF(MSG_META_HOLD_POSITION)
CHECK_IF(MSG_META_TOGGLE_GUARD)
+ CHECK_IF(MSG_META_TOGGLE_MOVE)
CHECK_IF(MSG_META_TOGGLE_PAUSE)
CHECK_IF(MSG_META_BEGIN_CAMERA_ROTATE_LEFT)
CHECK_IF(MSG_META_END_CAMERA_ROTATE_LEFT)
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
index cd6a9d920..1646f629c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
@@ -179,6 +179,7 @@ static GameMessage::Type orderAtPlace( Int place )
case COMMAND_PLACE_ATTACK_MOVE: return GameMessage::MSG_META_TOGGLE_ATTACKMOVE;
case COMMAND_PLACE_GUARD: return GameMessage::MSG_META_TOGGLE_GUARD;
case COMMAND_PLACE_HOLD: return GameMessage::MSG_META_HOLD_POSITION;
+ case COMMAND_PLACE_MOVE: return GameMessage::MSG_META_TOGGLE_MOVE;
}
return GameMessage::MSG_INVALID;
}
@@ -191,8 +192,32 @@ static Bool isProduction( Int type )
}
//-------------------------------------------------------------------------------------------------
-Bool ControlBar_commandPlaces( const Int *types, Int count, Int *places )
+Int ControlBar_namedCommandPlace( const char *buttonName )
{
+ static const struct { const char *name; Int place; } NAMED[] =
+ {
+ { "Command_DisarmMinesAtPosition", COMMAND_PLACE_CLEAR_MINES },
+ { "Command_UpgradeGLAWorkerFakeCommandSet", COMMAND_PLACE_FAKE_STRUCTURES },
+ { "Command_UpgradeGLAWorkerRealCommandSet", COMMAND_PLACE_FAKE_STRUCTURES },
+ { "Demo_Command_TertiarySuicide", COMMAND_PLACE_EXPLOSIVE }
+ };
+ for( Int each = 0; each < (Int)ARRAY_SIZE( NAMED ); each++ )
+ if( strcmp( NAMED[ each ].name, buttonName ) == 0 )
+ return NAMED[ each ].place;
+ return -1;
+}
+
+//-------------------------------------------------------------------------------------------------
+Bool ControlBar_commandPlaces( const Int *types, const Int *pinned, Int count, Int *places )
+{
+ // the owner's order of 2026-09-28: down the columns two rows at a time, toward the top left
+ static const Int FILL[ COMMAND_PLACE_COUNT ] =
+ {
+ COMMAND_PLACE_Q, COMMAND_PLACE_A, COMMAND_PLACE_W, COMMAND_PLACE_Z, COMMAND_PLACE_S, COMMAND_PLACE_E,
+ COMMAND_PLACE_X, COMMAND_PLACE_D, COMMAND_PLACE_R, COMMAND_PLACE_C, COMMAND_PLACE_F, COMMAND_PLACE_T,
+ COMMAND_PLACE_V, COMMAND_PLACE_G, COMMAND_PLACE_Y, COMMAND_PLACE_B, COMMAND_PLACE_H, COMMAND_PLACE_N
+ };
+
Bool taken[ COMMAND_PLACE_COUNT ] = { FALSE };
Bool fights = FALSE;
for( Int slot = 0; slot < count; slot++ )
@@ -200,11 +225,11 @@ Bool ControlBar_commandPlaces( const Int *types, Int count, Int *places )
places[ slot ] = -1;
fights = fights || types[ slot ] == GUI_COMMAND_ATTACK_MOVE;
}
- taken[ COMMAND_PLACE_ATTACK ] = taken[ COMMAND_PLACE_HOLD ] = fights;
+ taken[ COMMAND_PLACE_ATTACK ] = taken[ COMMAND_PLACE_HOLD ] = taken[ COMMAND_PLACE_MOVE ] = fights;
for( Int slot = 0; slot < count; slot++ )
{
- const Int place = fixedCommandPlace( types[ slot ] );
+ const Int place = pinned[ slot ] >= 0 ? pinned[ slot ] : fixedCommandPlace( types[ slot ] );
if( place >= 0 && !taken[ place ] )
{
places[ slot ] = place;
@@ -212,7 +237,8 @@ Bool ControlBar_commandPlaces( const Int *types, Int count, Int *places )
}
}
- // production first, then the rest, each into the first free place in reading order
+ // production first, then the rest: a factory whose set opens on an upgrade still puts its units
+ // on Q A W before the upgrade
for( Int pass = 0; pass < 2; pass++ )
{
const Bool wantProduction = ( pass == 0 );
@@ -220,12 +246,12 @@ Bool ControlBar_commandPlaces( const Int *types, Int count, Int *places )
{
if( places[ slot ] >= 0 || types[ slot ] == GUI_COMMAND_NONE || isProduction( types[ slot ] ) != wantProduction )
continue;
- for( Int place = 0; place < COMMAND_PLACE_COUNT; place++ )
+ for( Int each = 0; each < COMMAND_PLACE_COUNT; each++ )
{
- if( !taken[ place ] )
+ if( !taken[ FILL[ each ] ] )
{
- places[ slot ] = place;
- taken[ place ] = TRUE;
+ places[ slot ] = FILL[ each ];
+ taken[ FILL[ each ] ] = TRUE;
break;
}
}
@@ -238,14 +264,16 @@ Bool ControlBar_commandPlaces( const Int *types, Int count, Int *places )
Bool ControlBar::getCommandPlaces( Int *places ) const
{
Int types[ MAX_COMMANDS_PER_SET ];
+ Int pinned[ MAX_COMMANDS_PER_SET ];
for( Int slot = 0; slot < MAX_COMMANDS_PER_SET; slot++ )
{
GameWindow *window = m_commandWindows[ slot ];
const CommandButton *command = ( window && !BitTest( window->winGetStatus(), WIN_STATUS_HIDDEN ) )
? (const CommandButton *)GadgetButtonGetData( window ) : NULL;
types[ slot ] = command ? command->getCommandType() : GUI_COMMAND_NONE;
+ pinned[ slot ] = command ? ControlBar_namedCommandPlace( command->getName().str() ) : -1;
}
- return ControlBar_commandPlaces( types, MAX_COMMANDS_PER_SET, places );
+ return ControlBar_commandPlaces( types, pinned, MAX_COMMANDS_PER_SET, places );
}
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index c7cf42df0..efbfe3b48 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -1307,6 +1307,7 @@ InGameUI::InGameUI()
m_attackMoveToMode = false;
m_forceAttackArmed = false;
m_guardArmed = false;
+ m_moveArmed = false;
m_orderKeyKeptByShift = false;
m_preferSelection = false;
m_isAttackCircling = FALSE;
@@ -4146,6 +4147,7 @@ void InGameUI::reset( void )
m_attackMoveToMode = false;
m_forceAttackArmed = false;
m_guardArmed = false;
+ m_moveArmed = false;
m_orderKeyKeptByShift = false;
m_preferSelection = false;
m_isAttackCircling = FALSE;
@@ -11029,13 +11031,16 @@ static void armSignalFromPage( const std::string &kind )
}
//-------------------------------------------------------------------------------------------------
-/** 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. */
+/** data-click="order:attack", "order:hold" or "order:move", the command panel's orders no command set
+ * has a button for: what the A, C and V keys do, force fire armed for the next click, hold position,
+ * and a move armed for the next click. */
//-------------------------------------------------------------------------------------------------
static void orderFromPage( const std::string &order )
{
if( order == "attack" )
TheInGameUI->toggleForceAttackArmed();
+ else if( order == "move" )
+ TheInGameUI->toggleMoveArmed();
else if( order == "hold" && TheInGameUI->getSelectCount() > 0 )
{
GameMessage *hold = TheMessageStream->appendMessage( GameMessage::MSG_DO_HOLD_POSITION );
@@ -11561,17 +11566,34 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I
putSignalRise( values, nowMs - m_signalsRiseStartMs );
// the command grid against the radar's panel, six by three, every place its key: the orders in the
- // owner's places (ControlBar_commandPlaces) and everything else from Q on in reading order, what a
+ // owner's places (ControlBar_commandPlaces) and everything else packed toward the top left, what a
// set builds before its abilities and upgrades. The power bar stands up in its
// groove inside the grid's frame, after it, the way the experience bar stands in the radar's. The
// money hangs from the screen's top
const IRegion2D commandBox = gridBox( leftBox.hi.x + border, foot, COMMAND_COLUMNS, COMMAND_ROWS,
COMMAND_CELL_WIDTH, COMMAND_CELL_HEIGHT );
+ Int where[ MAX_COMMANDS_PER_SET ];
+ const Bool fights = TheControlBar->getCommandPlaces( where );
+ TheControlBar->labelCommandPlaces( where );
+ Bool taken[ COMMAND_PLACE_COUNT ] = { FALSE };
+ Bool anyCommand = fights;
+ for( Int button = 0; button < COMMAND_BUTTONS; button++ )
+ if( where[ button ] >= 0 )
+ anyCommand = taken[ where[ button ] ] = TRUE;
+ // attack, hold position and move have no button in any command set: the page's keys do what A, C
+ // and V do, for anything that attack moves
+ taken[ COMMAND_PLACE_ATTACK ] = taken[ COMMAND_PLACE_HOLD ] = taken[ COMMAND_PLACE_MOVE ] = fights;
+
+ // with nothing to command, nothing selected, there is no grid and no frame round it, the owner's
+ // call: the power bar keeps its groove where it stands, in a frame of its own that wide
+ const Bool gridShown = centreShown && anyCommand;
IRegion2D power = commandBox;
power.lo.x = commandBox.hi.x + REAL_TO_INT( EXPERIENCE_GAP * scale );
power.hi.x = power.lo.x + REAL_TO_INT( POWER_WIDTH * scale );
IRegion2D centreContent = commandBox;
centreContent.hi.x = power.hi.x;
+ if( !gridShown )
+ centreContent.lo.x = power.lo.x;
const IRegion2D centreBox = framed( centreContent, border, FALSE, FALSE );
putFrame( values, "centre", centreContent, centreBox, centreShown );
putPowerGroove( values, power, centreShown );
@@ -11583,16 +11605,6 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I
const IRegion2D frameRect = windowScreenRect( TheControlBar->getMasterParent() );
TheControlBar->placeWindowAt( controlBarWindow( "CenterBackground" ), frameRect );
TheControlBar->placeWindowAt( controlBarWindow( "CommandWindow" ), frameRect );
- Int where[ MAX_COMMANDS_PER_SET ];
- const Bool fights = TheControlBar->getCommandPlaces( where );
- TheControlBar->labelCommandPlaces( where );
- Bool taken[ COMMAND_PLACE_COUNT ] = { FALSE };
- for( Int button = 0; button < COMMAND_BUTTONS; button++ )
- if( where[ button ] >= 0 )
- taken[ where[ button ] ] = TRUE;
- // 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
- taken[ COMMAND_PLACE_ATTACK ] = taken[ COMMAND_PLACE_HOLD ] = fights;
// a cell only for a place a command stands in; an empty one is the panel's steel
IRegion2D place[ COMMAND_PLACE_COUNT ];
@@ -11612,8 +11624,10 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I
TheControlBar->placeWindowAt( numberedWindow( "ButtonCommand", button + 1 ), place[ where[ button ] ] );
putPageRect( values, "attackkey", place[ COMMAND_PLACE_ATTACK ], centreShown && fights, scale );
putPageRect( values, "holdkey", place[ COMMAND_PLACE_HOLD ], centreShown && fights, scale );
+ putPageRect( values, "movekey", place[ COMMAND_PLACE_MOVE ], centreShown && fights, scale );
values[ "attackkey.key" ] = commandSlotKey( COMMAND_PLACE_ATTACK );
values[ "holdkey.key" ] = commandSlotKey( COMMAND_PLACE_HOLD );
+ values[ "movekey.key" ] = commandSlotKey( COMMAND_PLACE_MOVE );
// 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, and only as long as what it
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
index 2be3f2a96..cb12ca6c8 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
@@ -3542,6 +3542,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
TheInGameUI->toggleGuardArmed( );
break;
+ //-----------------------------------------------------------------------------------------
+ // the move key: the next order click, or a left drag, is the move a right click would give
+ case GameMessage::MSG_META_TOGGLE_MOVE:
+ TheInGameUI->toggleMoveArmed( );
+ break;
+
//-----------------------------------------------------------------------------------------
// the general's promotion screen. It is one click away on the stars button and nowhere on
// the keyboard, which is the wrong way round for something you open the moment a promotion
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp
index b557ad060..c51dc11de 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp
@@ -186,6 +186,7 @@ static const LookupListRec GameMessageMetaTypeNames[] =
{ "TOGGLE_PURCHASE_SCIENCE", GameMessage::MSG_META_TOGGLE_PURCHASE_SCIENCE },
{ "HOLD_POSITION", GameMessage::MSG_META_HOLD_POSITION },
{ "TOGGLE_GUARD", GameMessage::MSG_META_TOGGLE_GUARD },
+ { "TOGGLE_MOVE", GameMessage::MSG_META_TOGGLE_MOVE },
{ "TOGGLE_PAUSE", GameMessage::MSG_META_TOGGLE_PAUSE },
{ "DEPLOY", GameMessage::MSG_META_DEPLOY },
{ "CREATE_FORMATION", GameMessage::MSG_META_CREATE_FORMATION },
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 31f853a37..2cf4312c6 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -3079,94 +3079,102 @@ 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. Nothing
- has a place of its own, so the structures fill the places in reading order and the disarm, an
- ability, comes after them */
- 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 };
- CHECK( !ControlBar_commandPlaces( dozer, SLOTS, places ) );
- CHECK_EQ( places[ 0 ], (Int)COMMAND_PLACE_Q );
- CHECK_EQ( places[ 5 ], (Int)COMMAND_PLACE_Y );
- CHECK_EQ( places[ 6 ], (Int)COMMAND_PLACE_A );
- CHECK_EQ( places[ 8 ], (Int)COMMAND_PLACE_D );
- CHECK_EQ( places[ 9 ], -1 );
- CHECK_EQ( places[ 10 ], (Int)COMMAND_PLACE_F );
- CHECK_EQ( places[ 12 ], (Int)COMMAND_PLACE_G );
- CHECK_EQ( places[ 13 ], (Int)COMMAND_PLACE_H );
+ const Int C = GUI_COMMAND_DOZER_CONSTRUCT;
+ const Int nothingPinned[ SLOTS ] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
+
+ /* AmericaDozerCommandSet: structures in slots 1 to 9, 11 and 13, disarm mines in 14. The disarm
+ is pinned to N by its button's name; the eleven structures pack toward the top left in the
+ owner's order, Q A W Z S E X D R C F */
+ const Int dozer[ SLOTS ] = { C, C, C, C, C, C, C, C, C, N, C, N, C, GUI_COMMAND_FIRE_WEAPON };
+ Int dozerPinned[ SLOTS ];
+ memcpy( dozerPinned, nothingPinned, sizeof( dozerPinned ) );
+ dozerPinned[ 13 ] = ControlBar_namedCommandPlace( "Command_DisarmMinesAtPosition" );
+ CHECK( !ControlBar_commandPlaces( dozer, dozerPinned, SLOTS, places ) );
+ const Int dozerPlaces[ SLOTS ] = { COMMAND_PLACE_Q, COMMAND_PLACE_A, COMMAND_PLACE_W, COMMAND_PLACE_Z,
+ COMMAND_PLACE_S, COMMAND_PLACE_E, COMMAND_PLACE_X, COMMAND_PLACE_D, COMMAND_PLACE_R, -1, COMMAND_PLACE_C, -1,
+ COMMAND_PLACE_F, COMMAND_PLACE_N };
+ for( Int slot = 0; slot < SLOTS; slot++ )
+ CHECK_EQ( places[ slot ], dozerPlaces[ slot ] );
/* AmericaVehicleHumveeCommandSet: three drones, five passengers, evacuate, attack move, guard,
stop. The orders take the owner's places whatever slot they were in - stop S, attack move D,
- eject Z, guard X - and A and C are kept for attack and hold position; the drones fill the top
- row and the passengers run on into F G */
+ eject Z, guard X - and A, C and V are kept for attack, hold position and move; the drones and
+ passengers take what is left in the owner's order, Q W E R F T G Y */
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 };
- CHECK( ControlBar_commandPlaces( humvee, SLOTS, places ) );
- CHECK_EQ( places[ 0 ], (Int)COMMAND_PLACE_Q );
- CHECK_EQ( places[ 5 ], (Int)COMMAND_PLACE_Y );
- CHECK_EQ( places[ 6 ], (Int)COMMAND_PLACE_F );
- CHECK_EQ( places[ 7 ], (Int)COMMAND_PLACE_G );
- CHECK_EQ( places[ 8 ], (Int)COMMAND_PLACE_Z );
- CHECK_EQ( places[ 10 ], (Int)COMMAND_PLACE_D );
- CHECK_EQ( places[ 12 ], (Int)COMMAND_PLACE_X );
- CHECK_EQ( places[ 13 ], (Int)COMMAND_PLACE_S );
+ CHECK( ControlBar_commandPlaces( humvee, nothingPinned, SLOTS, places ) );
+ const Int humveePlaces[ SLOTS ] = { COMMAND_PLACE_Q, COMMAND_PLACE_W, COMMAND_PLACE_E, COMMAND_PLACE_R,
+ COMMAND_PLACE_F, COMMAND_PLACE_T, COMMAND_PLACE_G, COMMAND_PLACE_Y, COMMAND_PLACE_Z, -1, COMMAND_PLACE_D, -1,
+ COMMAND_PLACE_X, COMMAND_PLACE_S };
+ for( Int slot = 0; slot < SLOTS; slot++ )
+ CHECK_EQ( places[ slot ], humveePlaces[ slot ] );
/* ChinaCommandCenterCommandSet: a dozer to build, seven powers, two upgrades, rally, sell. Rally
- stands on B and sell on N whatever slot they were in; the dozer first, then the rest in order */
+ stands on B and sell on N whatever slot they were in; the dozer first on Q, then the rest */
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 };
- CHECK( !ControlBar_commandPlaces( centre, SLOTS, places ) );
- CHECK_EQ( places[ 0 ], (Int)COMMAND_PLACE_Q );
- CHECK_EQ( places[ 1 ], (Int)COMMAND_PLACE_W );
- CHECK_EQ( places[ 6 ], (Int)COMMAND_PLACE_A );
- CHECK_EQ( places[ 9 ], (Int)COMMAND_PLACE_F );
- CHECK_EQ( places[ 12 ], (Int)COMMAND_PLACE_B );
- CHECK_EQ( places[ 13 ], (Int)COMMAND_PLACE_N );
+ CHECK( !ControlBar_commandPlaces( centre, nothingPinned, SLOTS, places ) );
+ const Int centrePlaces[ SLOTS ] = { COMMAND_PLACE_Q, COMMAND_PLACE_A, COMMAND_PLACE_W, COMMAND_PLACE_Z,
+ COMMAND_PLACE_S, COMMAND_PLACE_E, COMMAND_PLACE_X, COMMAND_PLACE_D, COMMAND_PLACE_R, COMMAND_PLACE_C, -1, -1,
+ COMMAND_PLACE_B, COMMAND_PLACE_N };
+ for( Int slot = 0; slot < SLOTS; slot++ )
+ CHECK_EQ( places[ slot ], centrePlaces[ slot ] );
/* a factory whose set opens on an upgrade, nine units after it, a garrison, rally and sell: the
- units take Q W E R T Y and A S D, the upgrade comes after them on F, the garrison's evacuate is
- Z like a transport's */
+ units take Q A W S E X D R C, round the garrison's evacuate on Z, and the upgrade comes after
+ them on F. Without production first the upgrade would have taken Q */
const Int factory[ SLOTS ] = { GUI_COMMAND_OBJECT_UPGRADE, GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_UNIT_BUILD,
GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_UNIT_BUILD,
GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_EVACUATE, N,
GUI_COMMAND_SET_RALLY_POINT, GUI_COMMAND_SELL };
- CHECK( !ControlBar_commandPlaces( factory, SLOTS, places ) );
- CHECK_EQ( places[ 1 ], (Int)COMMAND_PLACE_Q );
- CHECK_EQ( places[ 6 ], (Int)COMMAND_PLACE_Y );
- CHECK_EQ( places[ 7 ], (Int)COMMAND_PLACE_A );
- CHECK_EQ( places[ 9 ], (Int)COMMAND_PLACE_D );
- CHECK_EQ( places[ 0 ], (Int)COMMAND_PLACE_F );
- CHECK_EQ( places[ 10 ], (Int)COMMAND_PLACE_Z );
- CHECK_EQ( places[ 12 ], (Int)COMMAND_PLACE_B );
- CHECK_EQ( places[ 13 ], (Int)COMMAND_PLACE_N );
-
- /* the biggest set there is, the Boss general's dozer, fourteen structures: every one gets a place
- and no two share one */
- Int boss[ SLOTS ];
+ CHECK( !ControlBar_commandPlaces( factory, nothingPinned, SLOTS, places ) );
+ const Int factoryPlaces[ SLOTS ] = { COMMAND_PLACE_F, COMMAND_PLACE_Q, COMMAND_PLACE_A, COMMAND_PLACE_W,
+ COMMAND_PLACE_S, COMMAND_PLACE_E, COMMAND_PLACE_X, COMMAND_PLACE_D, COMMAND_PLACE_R, COMMAND_PLACE_C,
+ COMMAND_PLACE_Z, -1, COMMAND_PLACE_B, COMMAND_PLACE_N };
for( Int slot = 0; slot < SLOTS; slot++ )
- boss[ slot ] = GUI_COMMAND_DOZER_CONSTRUCT;
- ControlBar_commandPlaces( boss, SLOTS, places );
- Bool taken[ COMMAND_PLACE_COUNT ] = { FALSE };
+ CHECK_EQ( places[ slot ], factoryPlaces[ slot ] );
+
+ /* Demo_GLAWorkerCommandSet, the fullest worker: ten structures, the suicide charge, the switch to
+ the fakes and disarm mines. The three are pinned by name to B, H and N, and the structures pack
+ Q A W Z S E X D R C */
+ const Int worker[ SLOTS ] = { C, C, C, C, C, C, C, C, C, C, GUI_COMMAND_FIRE_WEAPON, N,
+ GUI_COMMAND_OBJECT_UPGRADE, GUI_COMMAND_FIRE_WEAPON };
+ Int workerPinned[ SLOTS ];
+ memcpy( workerPinned, nothingPinned, sizeof( workerPinned ) );
+ workerPinned[ 10 ] = ControlBar_namedCommandPlace( "Demo_Command_TertiarySuicide" );
+ workerPinned[ 12 ] = ControlBar_namedCommandPlace( "Command_UpgradeGLAWorkerFakeCommandSet" );
+ workerPinned[ 13 ] = ControlBar_namedCommandPlace( "Command_DisarmMinesAtPosition" );
+ CHECK( !ControlBar_commandPlaces( worker, workerPinned, SLOTS, places ) );
+ const Int workerPlaces[ SLOTS ] = { COMMAND_PLACE_Q, COMMAND_PLACE_A, COMMAND_PLACE_W, COMMAND_PLACE_Z,
+ COMMAND_PLACE_S, COMMAND_PLACE_E, COMMAND_PLACE_X, COMMAND_PLACE_D, COMMAND_PLACE_R, COMMAND_PLACE_C,
+ COMMAND_PLACE_B, -1, COMMAND_PLACE_H, COMMAND_PLACE_N };
for( Int slot = 0; slot < SLOTS; slot++ )
- {
- CHECK( places[ slot ] >= 0 && places[ slot ] < COMMAND_PLACE_COUNT );
- if( places[ slot ] < 0 || places[ slot ] >= COMMAND_PLACE_COUNT )
- continue;
- CHECK( !taken[ places[ slot ] ] );
- taken[ places[ slot ] ] = TRUE;
- }
+ CHECK_EQ( places[ slot ], workerPlaces[ slot ] );
+
+ // the fake set's switch back stands where the switch to it stood, and a name the table lacks has no place
+ CHECK_EQ( ControlBar_namedCommandPlace( "Command_UpgradeGLAWorkerRealCommandSet" ), (Int)COMMAND_PLACE_H );
+ CHECK_EQ( ControlBar_namedCommandPlace( "Command_ConstructGLABarracks" ), -1 );
+
+ /* the biggest set there is, the Boss general's dozer, fourteen structures: every one gets a place,
+ no two share one, and they run the owner's order to G */
+ const Int boss[ SLOTS ] = { C, C, C, C, C, C, C, C, C, C, C, C, C, C };
+ ControlBar_commandPlaces( boss, nothingPinned, SLOTS, places );
+ const Int bossPlaces[ SLOTS ] = { COMMAND_PLACE_Q, COMMAND_PLACE_A, COMMAND_PLACE_W, COMMAND_PLACE_Z,
+ COMMAND_PLACE_S, COMMAND_PLACE_E, COMMAND_PLACE_X, COMMAND_PLACE_D, COMMAND_PLACE_R, COMMAND_PLACE_C,
+ COMMAND_PLACE_F, COMMAND_PLACE_T, COMMAND_PLACE_V, COMMAND_PLACE_G };
+ for( Int slot = 0; slot < SLOTS; slot++ )
+ CHECK_EQ( places[ slot ], bossPlaces[ slot ] );
}
/* CommandMapReforged.ini binds COMMAND_SLOTnn to the key of place nn - 1: the grid reads Q W E R T Y,
A S D F G H, Z X C V B N, so a place's key is where the owner put it on 2026-09-28 - a unit's attack
- on A, stop on S, attack move on D, eject on Z, guard on X, hold on C; a building's sell on N, rally
- point on B and evacuate on Z. No other record may hold one of those letters bare, or it comes
- first in the list and steals the key. */
+ on A, stop on S, attack move on D, eject on Z, guard on X, hold on C, move on V; a building's sell
+ on N, rally point on B and evacuate on Z; a worker's disarm on N, its fakes on H and the Demolition
+ worker's charge on B. No other record may hold one of those letters bare, or it comes first in the
+ list and steals the key. */
TEST(the_command_grid_keys_are_the_places_and_n_sells_and_b_rallies)
{
FILE *fp = fopen( COMMAND_MAP_REFORGED_INI, "rb" );
@@ -3188,27 +3196,52 @@ TEST(the_command_grid_keys_are_the_places_and_n_sells_and_b_rallies)
CHECK_EQ( GRID_KEYS[ COMMAND_PLACE_EJECT ], 'Z' );
CHECK_EQ( GRID_KEYS[ COMMAND_PLACE_GUARD ], 'X' );
CHECK_EQ( GRID_KEYS[ COMMAND_PLACE_HOLD ], 'C' );
+ CHECK_EQ( GRID_KEYS[ COMMAND_PLACE_MOVE ], 'V' );
CHECK_EQ( GRID_KEYS[ COMMAND_PLACE_RALLY ], 'B' );
CHECK_EQ( GRID_KEYS[ COMMAND_PLACE_SELL ], 'N' );
-
- // and the command types that land there, whatever slot of their set they sit in
+ CHECK_EQ( GRID_KEYS[ COMMAND_PLACE_CLEAR_MINES ], 'N' );
+ CHECK_EQ( GRID_KEYS[ COMMAND_PLACE_FAKE_STRUCTURES ], 'H' );
+ CHECK_EQ( GRID_KEYS[ COMMAND_PLACE_EXPLOSIVE ], 'B' );
+ CHECK_EQ( GRID_KEYS[ ControlBar_namedCommandPlace( "Command_DisarmMinesAtPosition" ) ], 'N' );
+ CHECK_EQ( GRID_KEYS[ ControlBar_namedCommandPlace( "Command_UpgradeGLAWorkerFakeCommandSet" ) ], 'H' );
+ CHECK_EQ( GRID_KEYS[ ControlBar_namedCommandPlace( "Demo_Command_TertiarySuicide" ) ], 'B' );
+
+ // a set of nothing but flowing commands fills the grid in the owner's order of 2026-09-28
+ static const char FILL_KEYS[] = "QAWZSEXDRCFTVGYBHN";
+ Int flowing[ COMMAND_PLACE_COUNT ];
+ Int unpinned[ COMMAND_PLACE_COUNT ];
+ Int filled[ COMMAND_PLACE_COUNT ];
+ for( Int slot = 0; slot < COMMAND_PLACE_COUNT; slot++ )
+ {
+ flowing[ slot ] = GUI_COMMAND_SPECIAL_POWER;
+ unpinned[ slot ] = -1;
+ }
+ CHECK( !ControlBar_commandPlaces( flowing, unpinned, COMMAND_PLACE_COUNT, filled ) );
+ for( Int slot = 0; slot < COMMAND_PLACE_COUNT; slot++ )
+ CHECK_EQ( GRID_KEYS[ filled[ slot ] ], FILL_KEYS[ slot ] );
+
+ // and the command types that land there, whatever slot of their set they sit in. A unit that
+ // attack moves keeps A, C and V for the page's attack, hold and move keys: its first flowing
+ // command is Q and its second W
enum { SLOTS = 8 };
const Int unit[ SLOTS ] = { GUI_COMMAND_STOP, GUI_COMMAND_GUARD, GUI_COMMAND_EVACUATE, GUI_COMMAND_ATTACK_MOVE,
- GUI_COMMAND_SPECIAL_POWER, GUI_COMMAND_NONE, GUI_COMMAND_NONE, GUI_COMMAND_NONE };
+ GUI_COMMAND_SPECIAL_POWER, GUI_COMMAND_SPECIAL_POWER, GUI_COMMAND_NONE, GUI_COMMAND_NONE };
Int places[ SLOTS ];
- CHECK( ControlBar_commandPlaces( unit, SLOTS, places ) );
+ CHECK( ControlBar_commandPlaces( unit, unpinned, SLOTS, places ) );
CHECK_EQ( GRID_KEYS[ places[ 0 ] ], 'S' );
CHECK_EQ( GRID_KEYS[ places[ 1 ] ], 'X' );
CHECK_EQ( GRID_KEYS[ places[ 2 ] ], 'Z' );
CHECK_EQ( GRID_KEYS[ places[ 3 ] ], 'D' );
CHECK_EQ( GRID_KEYS[ places[ 4 ] ], 'Q' );
+ CHECK_EQ( GRID_KEYS[ places[ 5 ] ], 'W' );
const Int building[ SLOTS ] = { GUI_COMMAND_SELL, GUI_COMMAND_SET_RALLY_POINT, GUI_COMMAND_EVACUATE,
- GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_NONE, GUI_COMMAND_NONE, GUI_COMMAND_NONE, GUI_COMMAND_NONE };
- CHECK( !ControlBar_commandPlaces( building, SLOTS, places ) );
+ GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_UNIT_BUILD, GUI_COMMAND_NONE, GUI_COMMAND_NONE, GUI_COMMAND_NONE };
+ CHECK( !ControlBar_commandPlaces( building, unpinned, SLOTS, places ) );
CHECK_EQ( GRID_KEYS[ places[ 0 ] ], 'N' );
CHECK_EQ( GRID_KEYS[ places[ 1 ] ], 'B' );
CHECK_EQ( GRID_KEYS[ places[ 2 ] ], 'Z' );
CHECK_EQ( GRID_KEYS[ places[ 3 ] ], 'Q' );
+ CHECK_EQ( GRID_KEYS[ places[ 4 ] ], 'A' );
// every block as name, key and modifiers
Int slotsBound = 0;
diff --git a/GeneralsMD/Code/Tools/order_cameos.py b/GeneralsMD/Code/Tools/order_cameos.py
index f0a8413c2..60b1fc1a5 100644
--- a/GeneralsMD/Code/Tools/order_cameos.py
+++ b/GeneralsMD/Code/Tools/order_cameos.py
@@ -1,9 +1,10 @@
-"""The command bar's attack and hold position cameos, painted in the manner of EA's command cameos
-(SSStop, SSGuard): a sign with a bevelled steel rim and four bolts standing over a painted
-backdrop. No command set has a button for either order, so the game has no picture for them.
+"""The command bar's attack, hold position and move cameos, painted in the manner of EA's command
+cameos (SSStop, SSGuard): a sign with a bevelled steel rim and four bolts standing over a painted
+backdrop. No command set has a button for any of these orders, so the game has no picture for them.
Attack is a red plate with a white crosshair over a burning sky, hold position a blue plate with a
-raised palm over a blue one. Each is painted at four times its size and brought down, which is
+raised palm over a blue one, move a green diamond with a white arrow over an overcast field. Each
+is painted at four times its size and brought down, which is
what softens the edges into the look of the shipped art. The noise is seeded, so the file comes
out the same every time.
@@ -21,8 +22,8 @@ from PIL import Image, ImageDraw, ImageFilter
CAMEO_W, CAMEO_H = 60, 48 # every command cameo in the shipped mapped images
SUPER = 4 # painted at this many times the size
-TEXTURE_W, TEXTURE_H = 128, 64
-CAMEO_PLACES = {"attack": (0, 0), "hold": (64, 0)}
+TEXTURE_W, TEXTURE_H = 128, 128
+CAMEO_PLACES = {"attack": (0, 0), "hold": (64, 0), "move": (0, 64)}
SEED = 20260928
OUT_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Data", "Art", "Textures", "ReforgedOrders.tga")
@@ -164,6 +165,22 @@ def hold(rng):
return image
+def move(rng):
+ image = backdrop(rng, (96, 112, 104), (176, 184, 160), (214, 218, 206), (46, 52, 34))
+ cx, cy = W / 2, H / 2 - SUPER
+ reach = H * 0.47
+ inset = reach * 0.66
+ cx, cy = plate(image, [(cx, cy - reach), (cx + reach, cy), (cx, cy + reach), (cx - reach, cy)], (40, 150, 60),
+ [(cx, cy - inset), (cx + inset, cy), (cx, cy + inset), (cx - inset, cy)])
+ # a road sign's arrow, pointing ahead: a shaft and a head, rounded off by the resize
+ draw = ImageDraw.Draw(image)
+ white = (248, 246, 240)
+ scale = reach / 60.0
+ draw.rectangle((cx - 6 * scale, cy - 2 * scale, cx + 6 * scale, cy + 22 * scale), fill=white)
+ draw.polygon([(cx, cy - 25 * scale), (cx + 19 * scale, cy), (cx - 19 * scale, cy)], fill=white)
+ return image
+
+
def cameo(painted):
small = painted.resize((CAMEO_W, CAMEO_H), Image.LANCZOS)
return small.filter(ImageFilter.UnsharpMask(radius=1, percent=60, threshold=2))
@@ -172,7 +189,7 @@ def cameo(painted):
def texture():
rng = np.random.default_rng(SEED)
sheet = Image.new("RGBA", (TEXTURE_W, TEXTURE_H), (0, 0, 0, 0))
- for name, paint in (("attack", attack), ("hold", hold)):
+ for name, paint in (("attack", attack), ("hold", hold), ("move", move)):
sheet.paste(cameo(paint(rng)).convert("RGBA"), CAMEO_PLACES[name])
return sheet
@@ -184,11 +201,13 @@ def selfcheck():
picture = np.asarray(sheet.crop((x, y, x + CAMEO_W, y + CAMEO_H)), dtype=int)
assert picture[:, :, 3].min() == 255, name # a whole cameo, no hole in it
assert picture[:, :, :3].std() > 30, name # a picture, not a flat fill
- # red plate on the left, blue on the right: the two read apart at a glance
+ # a red plate, a blue one and a green one: the three read apart at a glance
attack_mid = np.asarray(sheet.crop((20, 10, 40, 30)), dtype=int)[:, :, :3].mean(axis=(0, 1))
hold_mid = np.asarray(sheet.crop((64 + 12, 6, 64 + 20, 14)), dtype=int)[:, :, :3].mean(axis=(0, 1))
+ move_side = np.asarray(sheet.crop((17, 64 + 25, 23, 64 + 29)), dtype=int)[:, :, :3].mean(axis=(0, 1))
assert attack_mid[0] > attack_mid[2], attack_mid
assert hold_mid[2] > hold_mid[0], hold_mid
+ assert move_side[1] > move_side[0] and move_side[1] > move_side[2], move_side
assert np.array_equal(np.asarray(texture()), np.asarray(sheet)) # seeded: the same file every time
print("order_cameos selfcheck ok")