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): team frames on the players strip, tab held, superweapons per row
Olcay Seyganda7751f16408
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5f66320ea..e733bfbda 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -507,7 +507,7 @@ found and fixed — EA's own, not port damage.**- Three buttons sit in a step of the radar's own steel, on its right: the smoke signals Alt+Z, X and C send, placed in the middle of your view for your allies to see. Each is a key sunk into the steel with a sharp white picture on it instead of a word: a crosshair to attack, a shield to defend, an eye to look. Point at one and it comes up out of its well as lit steel with a gold rim, and it sinks in darker while you hold the button down. They rise into place one after another from the bottom of the screen when the match starts. A game with nobody on your side to see the smoke, a skirmish against the computer or a replay, has no signal buttons at all.- Tooltips wear the bar's steel. Point at a build button and a card opens right above it rather than in a fixed box at the side: the name on a steel header in your side's colour with the price in gold at its end, every "Power Supplied: 5" or "Strong: infantry" line of the description laid out as a label and a bold figure, 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.-- Every player in the match hangs from the top edge of the screen, your own team on the left, the match clock between two teams. Each one is a general's flag on a small steel plate with that player's colour along its top, and a lamp sits on the plate's bottom edge for their superweapons: green once one can fire, an empty ring while it is still charging, red when they have none. The column of superweapon countdowns that used to sit in the top right is gone while you play; the full list with the seconds is on Tab.+- Every player in the match hangs from the top edge of the screen, your own team on the left. Each one is their general's flag in a hairline frame with the player's colour along its top, and a band of colour under it for their superweapons: green once one can fire, blue while it is still charging, grey when they have none. A team stands in a steel frame of its own with its name under the flags, Team 1 to Team 4 in a four-team game, and the match clock sits between two teams or after everybody else. A free for all is all eight flags in one row, which fits with room to spare. The column of superweapon countdowns that used to sit in the top right is gone while you play; the full list with the seconds is on Tab.- The steel between the build buttons, the portrait's grid and the promotion screen's cells is half as wide as it was, so the pictures take the room. The queue's tray has a thinner rim. The portrait and its upgrade icons sit under the portrait's grid, framed the same way as every other picture on the bar.- The command bar slides up from the bottom of the screen again when a match starts. The new steel frame had been drawn at its final place from the first frame, so the buttons rose into a frame that was already standing.- The Escape menu is in the bar's steel too: a plate in your side's colour with sunk keys that light gold under the pointer and press in when clicked. Restart reads Surrender or Restart Mission as the game you are in calls for.@@ -725,12 +725,12 @@ found and fixed — EA's own, not port damage.**## A scoreboard on Tab-- Tab opens a scoreboard docked to the left edge of the screen, the way Dota docks its own, and closes it again. It is built from your command bar's steel, grey, red or sand for your side, with the match clock in its corner. Each side sits under a band edged green for yours and red for the enemy, and the band says how many of that side are still in the game, 4/4 down to 0/4. Watching, there is a band for every team. With a group selected, Tab still steps through the units in it as before, so the scoreboard wants one unit or none selected.+- Hold Tab and a scoreboard opens in the top left corner of the screen, beside the menu key; let go and it is gone. All eight seats of a full game fit in the top half of a 720 line screen. It is built from your command bar's steel, grey, red or sand for your side, with the match clock in its corner. Each side sits under a band edged green for yours and red for the enemy, and the band says how many of that side are still in the game, 4/4 down to 0/4. Watching, there is a band for every team. With a group selected, Tab still steps through the units in it as before, so the scoreboard wants one unit or none selected.- Every row on your side opens on a stripe of that player's colour, then the general in his metal tray, the player's name and the general under it. Then rank, money in the bank, income per minute, kills and losses, every promotion bought, once, at the level it has reached, and the unit that player has built the most of. Numbers line up on their last digit, and your own row is lit.- Names are written in white and the player's colour goes on the stripe. Dark red on a black panel measured about 2 to 1 and could barely be read. A player who is out goes grey.- An enemy row is a colour, a name and a team and nothing more. What they are playing and what they have in the bank is theirs to know.- Watching a match, everybody gets the full row, with a team column to say who is with whom.-- Under the players, every superweapon in the match: each player who owns one, then each of their superweapons as its picture and the seconds it still needs, soonest first, rimmed in gold once it can fire. Enemies' too, as the old countdown column in the corner showed them.+- Every player's superweapons are on their row, each as its picture and the seconds it still needs, soonest first, rimmed in gold once it can fire: on a line under the name for your side, and beside the name for an enemy, whose row has room for nothing else. Enemies' countdowns are there as the old column in the corner showed them.- The diplomacy screen, where you mute a player, is still on the command bar's button.## Your Razer hardware plays alongdiff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.htmlindex 2fb0689a4..bfd8a9ac7 100644--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html@@ -51,10 +51,12 @@net.in and net.out with {{net.online}} "online" in a network game;net.units and net.cap with {{net.capped}} "capped" under a unit limit{{blink}} "lit" for half of every second, for anything that blinks- data-each="seats" while playing, every player grouped by team, your own first: {{kind}}- "seat" with {{image}} {{color}} and {{weapon}} "ready", "charging" or- "none"; between exactly two teams- an entry of kind "clock" showing {{clock}}, between any others one of "gap"+ data-each="seats" while playing, one entry a team, your own first: {{kind}} "team" with+ {{label}}, "solo" for a player with no ally, or "ffa" for everybody in a+ free for all; its players in places s0 to s7, {{sN.image}} {{sN.color}}+ and {{sN.weapon}} "ready", "charging" or "none", {{sN.state}} "none" on an+ unused place. Kind "clock" shows {{clock}}, between two teams or after+ the rest; kind "gap" stands between any others{{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@@ -341,27 +343,31 @@#net .cappedonly { display: none; }#net .cappedonly.capped { display: block; }- /* the players hanging from the top edge, grouped by team with the clock between two teams: each- their general's flag on a steel plate with their colour along its top, and on its bottom edge,- half in and half out, a lamp for their superweapons: green once one can fire, an empty ring- while none can yet, red when they have none */+ /* the players hanging from the top edge: each their general's flag filling a hairline frame with+ their colour along its top, and under it a band for their superweapons, green once one can+ fire, blue while none can yet, grey when they have none. A team stands in a steel frame of its+ own with its name under the flags; a free for all is everybody side by side. The clock stands+ between two teams, or after everybody else */#seats { left: 180px; right: 180px; top: 0; text-align: center; }- .sseat, .sclock, .sgap { display: inline-block; position: relative; vertical-align: top; }- .sseat { width: 32px; height: 34px; margin: 0 1px; }- .sseat .plate { position: absolute; left: 0; top: 0; width: 30px; height: 26px; border: 1px solid #0c1114; border-top: 0;- background: linear-gradient(to bottom, #6f7782, #3f4650 50%, #1f252c); }- .china .sseat .plate { background: linear-gradient(to bottom, #8e3b2b, #4c1b13 50%, #26100b); }- .gla .sseat .plate { background: linear-gradient(to bottom, #867a45, #48401e 50%, #241f0f); }- .sseat .stripe { position: absolute; left: 0; right: 0; top: 0; height: 3px; }- .sseat .emblem { position: absolute; left: 3px; top: 5px; width: 24px; height: 14px; }- .sseat .lamp { position: absolute; left: 9px; top: 20px; width: 14px; height: 14px; background-size: 100% 100%; }- .sseat .lamp.ready { background-image: url(Icons/LampReady.svg); }- .sseat .lamp.charging { background-image: url(Icons/LampCharging.svg); }- .sseat .lamp.none { background-image: url(Icons/LampNone.svg); }+ .steam, .sffa, .ssolo, .sclock, .sgap { display: inline-block; position: relative; vertical-align: top; }+ .steam { padding: 0 2px 1px 2px; background-color: rgba(4, 8, 10, 0.85); border: 1px solid #8a949f; border-top: 0; }+ .china .steam { border-color: #b8604b; }+ .gla .steam { border-color: #a99d62; }+ .teamname { display: none; }+ .steam .teamname { display: block; line-height: 9px; font-size: 7px; font-weight: bold; color: #e8d27a; }+ .sclock .flags, .sgap .flags, .sclock .teamname, .sgap .teamname, .steam .clocktext, .sffa .clocktext, .ssolo .clocktext, .sgap .clocktext { display: none; }+ .flag { display: inline-block; position: relative; vertical-align: top; width: 32px; height: 26px; margin: 0 1px; }+ .flag.none { display: none; }+ .flag .plate { position: absolute; left: 0; top: 0; width: 30px; height: 21px; border: 1px solid #0c1114; border-top: 0; background-color: #0c1114; }+ .flag .stripe { position: absolute; left: 0; right: 0; top: 0; height: 3px; }+ .flag .emblem { position: absolute; left: 0; top: 3px; width: 30px; height: 18px; }+ .flag .lamp { position: absolute; left: 0; top: 21px; width: 30px; height: 4px; border: 1px solid #0c1114; border-top: 0; }+ .flag .lamp.ready { background-color: #4fd83a; }+ .flag .lamp.charging { background-color: #3a8ee8; }+ .flag .lamp.none { background-color: #6a737c; }.sclock { width: 46px; height: 18px; margin: 0 4px; line-height: 18px; font-size: 10px; font-weight: bold; color: #e8d27a;background-color: rgba(4, 8, 10, 0.9); border: 1px solid #06090b; border-top: 0; border-bottom-color: #b4bec8; border-right-color: #b4bec8; }- .sgap { width: 8px; height: 30px; }- .sclock .plate, .sclock .lamp, .sgap .plate, .sgap .lamp, .sgap .clocktext, .sseat .clocktext { display: none; }+ .sgap { width: 8px; height: 26px; }</style></head><body>@@ -451,8 +457,17 @@<div id="seats" class="piece"><div class="s{{kind}}" data-each="seats">- <div class="plate"><div class="stripe" style="background-color: {{color}}"></div><img class="emblem" src="{{image}}"></div>- <div class="lamp {{weapon}}"></div>+ <div class="flags">+ <div class="flag {{s0.state}}"><div class="plate"><div class="stripe" style="background-color: {{s0.color}}"></div><img class="emblem" src="{{s0.image}}"></div><div class="lamp {{s0.weapon}}"></div></div>+ <div class="flag {{s1.state}}"><div class="plate"><div class="stripe" style="background-color: {{s1.color}}"></div><img class="emblem" src="{{s1.image}}"></div><div class="lamp {{s1.weapon}}"></div></div>+ <div class="flag {{s2.state}}"><div class="plate"><div class="stripe" style="background-color: {{s2.color}}"></div><img class="emblem" src="{{s2.image}}"></div><div class="lamp {{s2.weapon}}"></div></div>+ <div class="flag {{s3.state}}"><div class="plate"><div class="stripe" style="background-color: {{s3.color}}"></div><img class="emblem" src="{{s3.image}}"></div><div class="lamp {{s3.weapon}}"></div></div>+ <div class="flag {{s4.state}}"><div class="plate"><div class="stripe" style="background-color: {{s4.color}}"></div><img class="emblem" src="{{s4.image}}"></div><div class="lamp {{s4.weapon}}"></div></div>+ <div class="flag {{s5.state}}"><div class="plate"><div class="stripe" style="background-color: {{s5.color}}"></div><img class="emblem" src="{{s5.image}}"></div><div class="lamp {{s5.weapon}}"></div></div>+ <div class="flag {{s6.state}}"><div class="plate"><div class="stripe" style="background-color: {{s6.color}}"></div><img class="emblem" src="{{s6.image}}"></div><div class="lamp {{s6.weapon}}"></div></div>+ <div class="flag {{s7.state}}"><div class="plate"><div class="stripe" style="background-color: {{s7.color}}"></div><img class="emblem" src="{{s7.image}}"></div><div class="lamp {{s7.weapon}}"></div></div>+ </div>+ <div class="teamname">{{label}}</div><div class="clocktext">{{clock}}</div></div></div>diff --git a/GeneralsMD/Code/Data/Window/Html/Icons/LampCharging.svg b/GeneralsMD/Code/Data/Window/Html/Icons/LampCharging.svgdeleted file mode 100644index 4cb013432..000000000--- a/GeneralsMD/Code/Data/Window/Html/Icons/LampCharging.svg+++ /dev/null@@ -1,3 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">- <circle cx="6" cy="6" r="4.2" fill="none" stroke="#dfe5ea" stroke-width="1.6"/>-</svg>diff --git a/GeneralsMD/Code/Data/Window/Html/Icons/LampNone.svg b/GeneralsMD/Code/Data/Window/Html/Icons/LampNone.svgdeleted file mode 100644index a5f52c5b2..000000000--- a/GeneralsMD/Code/Data/Window/Html/Icons/LampNone.svg+++ /dev/null@@ -1,3 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">- <circle cx="6" cy="6" r="4.6" fill="#e0402c" stroke="#0c1114" stroke-width="1.2"/>-</svg>diff --git a/GeneralsMD/Code/Data/Window/Html/Icons/LampReady.svg b/GeneralsMD/Code/Data/Window/Html/Icons/LampReady.svgdeleted file mode 100644index 24bd99ae0..000000000--- a/GeneralsMD/Code/Data/Window/Html/Icons/LampReady.svg+++ /dev/null@@ -1,3 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">- <circle cx="6" cy="6" r="4.6" fill="#5ee04a" stroke="#0c1114" stroke-width="1.2"/>-</svg>diff --git a/GeneralsMD/Code/Data/Window/Html/Scoreboard.html b/GeneralsMD/Code/Data/Window/Html/Scoreboard.htmlindex 54b60e8db..27346858e 100644--- a/GeneralsMD/Code/Data/Window/Html/Scoreboard.html+++ b/GeneralsMD/Code/Data/Window/Html/Scoreboard.html@@ -1,6 +1,6 @@<!DOCTYPE html><!--- The scoreboard on Tab, docked to the left edge the way Dota docks its own, in the same steel as+ The scoreboard, up while Tab is held, in the top left corner beside the menu key, in the same steel asthe spectator's page (Window/Html/Spectator.html, whose header says what the renderer draws andwhat it does not). Everyone gets it, playing or watching.@@ -15,10 +15,9 @@has {{portrait}} {{general}} {{rank}} {{cash}} {{income}} {{kills}} {{losses}}, its promotionsas {{skill0}} to {{skill6}}, and {{favourite}} with {{favouritename}}, the unit built most.A hidden seat is an enemy: a name, a colour and a team, nothing else.- data-each="superweapons", every superweapon in the match: per player who has one an entry of- {{kind}} "head" with {{image}} their general, {{color}} and {{name}}, then their countdowns, soonest- first, {{kind}} "weapon" with {{image}} its cameo, {{time}} and {{ready}} "ready" once it can- fire; {{weapons}} is "hidden" while there is none.+ Every seat has its superweapons, soonest first, as {{w0.image}} {{w0.time}} {{w0.state}} to+ {{w5...}}, the state "ready" once it can fire and "none" for an unused place, and {{armed}}+ "armed" when it has any.An image whose name is empty is not drawn, so an unused {{skillN}} leaves no box.Edit the copy under Run/Window/Html and the next match reads it.@@ -42,7 +41,7 @@.china .well { background-color: rgba(26, 10, 8, 0.9); }.gla .well { background-color: rgba(22, 19, 8, 0.9); }- #board { position: absolute; left: 4px; top: 44px; width: 494px; padding-bottom: 3px; }+ #board { position: absolute; left: 26px; top: 4px; width: 494px; padding-bottom: 3px; }/* every column's left edge, shared by the captions and the seats; the Turkish captions are thelong ones, so a number column is as wide as its caption rather than its digits */@@ -86,19 +85,19 @@.defeated .who { color: #8a949f; }.defeated .num, .defeated .cash { color: #8a949f; }- /* the superweapons: a line per player who has one, their general and name, and after it each of- their countdowns as a cameo with its time, gold once it can fire */- .weapons.hidden { display: none; }- .whead { position: relative; height: 20px; margin: 2px 3px 0 3px; }- .whead .tray { position: absolute; left: 4px; top: 1px; width: 24px; height: 18px; }- .whead .emblem { position: absolute; left: 3px; top: 3px; width: 18px; height: 12px; }- .whead .who { position: absolute; left: 32px; top: 0; line-height: 20px; font-weight: bold; }- .whead .cameo, .whead .time, .wweapon .tray, .wweapon .who { display: none; }- .wweapon { display: inline-block; position: relative; width: 58px; height: 20px; margin: 0 0 2px 7px; }- .wweapon .cameo { position: absolute; left: 0; top: 0; width: 24px; height: 20px; border: 1px solid #0c1114; }- .wweapon .time { position: absolute; left: 28px; top: 0; line-height: 20px; font-weight: bold; color: #c9d2d9; }- .wweapon.ready .cameo { border-color: #e8c24a; }- .wweapon.ready .time { color: #f2cf4a; }+ /* a player's superweapons, each a cameo and its seconds, gold once it can fire: on a line of their+ own under a full row, and beside the name on an enemy's row, which has nothing else there */+ .arms { display: none; position: absolute; left: 30px; top: 22px; height: 20px; }+ .armed .arms { display: block; }+ .seatrow.full.armed { height: 44px; }+ .hidden .arms { left: 170px; top: 1px; }+ .arm { position: absolute; top: 0; width: 52px; height: 20px; }+ .arm.none { display: none; }+ .w0 { left: 0; } .w1 { left: 54px; } .w2 { left: 108px; } .w3 { left: 162px; } .w4 { left: 216px; } .w5 { left: 270px; }+ .arm .cameo { position: absolute; left: 0; top: 0; width: 22px; height: 18px; border: 1px solid #0c1114; }+ .arm .time { position: absolute; left: 27px; top: 0; line-height: 20px; font-weight: bold; color: #c9d2d9; }+ .arm.ready .cameo { border-color: #e8c24a; }+ .arm.ready .time { color: #f2cf4a; }</style></head><body>@@ -118,7 +117,7 @@<div class="k{{kind}}" data-each="seats"><div class="band plate {{side}}">{{label}}<span class="count">{{standing}}/{{seats}}</span></div>- <div class="seatrow {{state}}">+ <div class="seatrow {{state}} {{armed}}"><div class="stripe" style="background-color: {{color}}"></div><div class="tray"><img class="emblem" src="{{portrait}}"></div><span class="who c-name">{{name}}</span>@@ -137,16 +136,14 @@<img class="skill" src="{{skill5}}" style="left: 440px"><img class="skill" src="{{skill6}}" style="left: 454px"><img class="favourite c-favourite" src="{{favourite}}">- </div>- </div>-- <div class="weapons {{weapons}}">- <div class="band plate">{{text:GUI:Superweapons}}</div>- <div class="w{{kind}} {{ready}}" data-each="superweapons">- <div class="tray"><img class="emblem" src="{{image}}"></div>- <span class="who" style="color: {{color}}">{{name}}</span>- <img class="cameo" src="{{image}}">- <span class="time">{{time}}</span>+ <div class="arms">+ <div class="arm w0 {{w0.state}}"><img class="cameo" src="{{w0.image}}"><span class="time">{{w0.time}}</span></div>+ <div class="arm w1 {{w1.state}}"><img class="cameo" src="{{w1.image}}"><span class="time">{{w1.time}}</span></div>+ <div class="arm w2 {{w2.state}}"><img class="cameo" src="{{w2.image}}"><span class="time">{{w2.time}}</span></div>+ <div class="arm w3 {{w3.state}}"><img class="cameo" src="{{w3.image}}"><span class="time">{{w3.time}}</span></div>+ <div class="arm w4 {{w4.state}}"><img class="cameo" src="{{w4.image}}"><span class="time">{{w4.time}}</span></div>+ <div class="arm w5 {{w5.state}}"><img class="cameo" src="{{w5.image}}"><span class="time">{{w5.time}}</span></div>+ </div></div></div></div>diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex d0413c71c..6a07b5776 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -400,7 +400,8 @@ public: // ********************************************************************virtual void message( UnicodeString format, ... ); ///< display a message to the uservirtual void message( AsciiString stringManagerLabel, ... );///< display a message to the uservirtual void toggleMessages( void ) { m_messagesOn = 1 - m_messagesOn; } ///< toggle messages on/off- void toggleScoreboard( void ) { m_scoreboardOpen = !m_scoreboardOpen; } ///< the Tab scoreboard, on or off+ void openScoreboard( void ) { m_scoreboardOpen = TRUE; } ///< the Tab scoreboard, up while Tab is held+ void closeScoreboard( void ) { m_scoreboardOpen = FALSE; }Bool pickSpectatorStat( Int commandSlot ); ///< a command bar key while watching: TRUE when it picked a stat/** The command bar's page, Window/Html/ControlBar.html, under the bar's windows: its panels are* where the plates would have gone, in screen pixels. FALSE when there is no page to draw. */diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/ControlServer.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/ControlServer.cppindex 8a5269514..efb742185 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/System/ControlServer.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/ControlServer.cpp@@ -610,11 +610,12 @@ static void handleCommand( const AsciiString &command )return;}- /* key <KEY_name> [ALT] [CTRL] [SHIFT]+ /* key <KEY_name> [ALT] [CTRL] [SHIFT] [HOLD | RELEASE]One press and release, carried the way Keyboard.cpp carries a real one, so the command map, thetranslators and whatever network message sits behind them all see a key. The keyboard itselfis DirectInput and reads only the foreground window, which a script cannot count on holding.- The mouse stays where it is: post the window a WM_MOUSEMOVE first when the key reads it. */+ The mouse stays where it is: post the window a WM_MOUSEMOVE first when the key reads it.+ HOLD sends only the press and RELEASE only the release, for what stays up while a key is held. */if (strncmp( command.str(), "key ", 4 ) == 0){char words[ 256 ];@@ -635,6 +636,8 @@ static void handleCommand( const AsciiString &command )}Int modifiers = KEY_STATE_NONE;+ Bool down = TRUE;+ Bool up = TRUE;for( const char *word = strtok( NULL, " " ); word; word = strtok( NULL, " " ) ){if (strcmp( word, "ALT" ) == 0)@@ -643,19 +646,29 @@ static void handleCommand( const AsciiString &command )modifiers |= KEY_STATE_LCONTROL;else if (strcmp( word, "SHIFT" ) == 0)modifiers |= KEY_STATE_LSHIFT;+ else if (strcmp( word, "HOLD" ) == 0)+ up = FALSE;+ else if (strcmp( word, "RELEASE" ) == 0)+ down = FALSE;else{- replyError( "a modifier is ALT, CTRL or SHIFT" );+ replyError( "a modifier is ALT, CTRL or SHIFT, and HOLD or RELEASE sends half the press" );return;}}- GameMessage *press = TheMessageStream->appendMessage( GameMessage::MSG_RAW_KEY_DOWN );- press->appendIntegerArgument( key );- press->appendIntegerArgument( KEY_STATE_DOWN | modifiers );- GameMessage *release = TheMessageStream->appendMessage( GameMessage::MSG_RAW_KEY_UP );- release->appendIntegerArgument( key );- release->appendIntegerArgument( KEY_STATE_UP | modifiers );+ if (down)+ {+ GameMessage *press = TheMessageStream->appendMessage( GameMessage::MSG_RAW_KEY_DOWN );+ press->appendIntegerArgument( key );+ press->appendIntegerArgument( KEY_STATE_DOWN | modifiers );+ }+ if (up)+ {+ GameMessage *release = TheMessageStream->appendMessage( GameMessage::MSG_RAW_KEY_UP );+ release->appendIntegerArgument( key );+ release->appendIntegerArgument( KEY_STATE_UP | modifiers );+ }replyOk( "\"pressed\":true" );return;}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 180bc0720..6800a0517 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -2242,40 +2242,90 @@ static std::vector< SpectatorStats > gatherSeats( Int &teams )return seats;}+static UnicodeString scoreboardTeamLabel( const GameSlot *slot );++/** The lobby slot `player` sits in, NULL outside a game that has slots. */+static const GameSlot *playerSlot( const Player *player )+{+ for( Int slotNum = 0; TheGameInfo && slotNum < MAX_SLOTS; slotNum++ )+ {+ AsciiString playerName;+ playerName.format( "player%d", slotNum );+ if( ThePlayerList->findPlayerWithNameKey( NAMEKEY( playerName ) ) == player )+ return TheGameInfo->getConstSlot( slotNum );+ }+ return NULL;+}+//--------------------------------------------------------------------------------------------------/** The command bar page's "seats" list, the strip across the top of the screen while playing: every- * player grouped by team, each of kind "seat" with their general and colour, the match clock- * between exactly two teams and a gap between any others. Under each, {{weapon}} says where their- * superweapons stand: "ready" once one can fire, "charging" while none can yet, and "none" when- * they have none. */+/** The command bar page's "seats" list, the strip across the top of the screen while playing, one+ * entry a team: kind "team" with its {{label}}, the lobby's team name, and its players in places+ * s0 to s7, each {{sN.image}} their general, {{sN.color}}, and {{sN.weapon}} where their+ * superweapons stand, "ready" once one can fire, "charging" while none can yet and "none" when they+ * have none; an unused place has {{sN.state}} "none". A player with no ally is an entry of kind+ * "solo", with no frame or name, and a free for all past two players is one entry of kind "ffa",+ * everybody side by side. The match clock, kind "clock", stands between exactly two teams and after+ * the rest otherwise, a "gap" between any other two. *///-------------------------------------------------------------------------------------------------static void fillPlayerSeats( const std::vector< SpectatorStats > &seats, Int teams,const std::vector< SpectatorSuperweapon > &weapons, std::vector< HtmlValues > &entries ){entries.clear();- for( size_t index = 0; index < seats.size(); index++ )+ const Bool freeForAll = teams == (Int)seats.size() && teams > TWO_TEAMS;++ for( size_t first = 0; first < seats.size(); ){- if( index > 0 && seats[ index - 1 ].team != seats[ index ].team )+ HtmlValues group;+ // the lobby's team name, or the team's place along the strip when the lobby set none+ const GameSlot *slot = playerSlot( seats[ first ].player );+ UnicodeString label;+ if( slot && slot->getTeamNumber() >= 0 )+ label.format( L"%s %s", TheGameText->fetch( "GUI:ScoreboardTeam" ).str(), scoreboardTeamLabel( slot ).str() );+ else+ label.format( L"%s %d", TheGameText->fetch( "GUI:ScoreboardTeam" ).str(), seats[ first ].team + 1 );+ group[ "label" ] = WideCharStringToMultiByte( label.str() );++ size_t end = first;+ for( ; end < seats.size() && ( freeForAll || seats[ end ].team == seats[ first ].team ); end++ ){- HtmlValues between;- between[ "kind" ] = teams == TWO_TEAMS ? "clock" : "gap";- entries.push_back( between );+ Bool owned = FALSE;+ Bool ready = FALSE;+ for( size_t weapon = 0; weapon < weapons.size(); weapon++ )+ {+ if( weapons[ weapon ].playerIndex != seats[ end ].player->getPlayerIndex() )+ continue;+ owned = TRUE;+ ready = ready || weapons[ weapon ].ready;+ }++ const HtmlValues head = spectatorHead( seats[ end ].player );+ const std::string place = "s" + std::to_string( end - first );+ group[ place + ".image" ] = head.at( "image" );+ group[ place + ".color" ] = head.at( "color" );+ group[ place + ".weapon" ] = ready ? "ready" : owned ? "charging" : "none";}+ group[ "kind" ] = freeForAll ? "ffa" : end - first > 1 ? "team" : "solo";+ for( size_t place = end - first; place < MAX_SLOTS; place++ )+ group[ "s" + std::to_string( place ) + ".state" ] = "none";- Bool owned = FALSE;- Bool ready = FALSE;- for( size_t weapon = 0; weapon < weapons.size(); weapon++ )+ if( !entries.empty() ){- if( weapons[ weapon ].playerIndex != seats[ index ].player->getPlayerIndex() )- continue;- owned = TRUE;- ready = ready || weapons[ weapon ].ready;+ HtmlValues between;+ between[ "kind" ] = teams == TWO_TEAMS ? "clock" : "gap";+ entries.push_back( between );}-- HtmlValues entry = spectatorHead( seats[ index ].player );- entry[ "kind" ] = "seat";- entry[ "weapon" ] = ready ? "ready" : owned ? "charging" : "none";- entries.push_back( entry );+ entries.push_back( group );+ first = end;+ }+ if( teams != TWO_TEAMS )+ {+ HtmlValues gap;+ gap[ "kind" ] = "gap";+ if( !entries.empty() )+ entries.push_back( gap );+ HtmlValues clock;+ clock[ "kind" ] = "clock";+ entries.push_back( clock );}}@@ -10179,6 +10229,40 @@ static HtmlValues scoreboardSeat( Player *player, const GameSlot *slot, Bool fulreturn seat;}+//-------------------------------------------------------------------------------------------------+/** One scoreboard seat's superweapons, soonest first, as {{wN.image}} {{wN.time}} and {{wN.state}}+ * for N 0 to SEAT_SUPERWEAPONS - 1: "ready" once it can fire, "none" for an unused place. {{armed}}+ * is "armed" when the player has any. */+//-------------------------------------------------------------------------------------------------+static void putSeatSuperweapons( HtmlValues &row, Int playerIndex, const std::vector< SpectatorSuperweapon > &weapons )+{+ enum { SEAT_SUPERWEAPONS = 6 };++ std::vector< SpectatorSuperweapon > owned;+ for( size_t weapon = 0; weapon < weapons.size(); weapon++ )+ if( weapons[ weapon ].playerIndex == playerIndex )+ owned.push_back( weapons[ weapon ] );+ std::stable_sort( owned.begin(), owned.end(),+ []( const SpectatorSuperweapon &a, const SpectatorSuperweapon &b ) { return a.seconds < b.seconds; } );++ row[ "armed" ] = owned.empty() ? "" : "armed";+ for( Int place = 0; place < SEAT_SUPERWEAPONS; place++ )+ {+ const std::string name = "w" + std::to_string( place );+ if( place >= (Int)owned.size() )+ {+ row[ name + ".state" ] = "none";+ continue;+ }++ UnicodeString time;+ formatStripSeconds( &time, owned[ place ].seconds );+ row[ name + ".image" ] = owned[ place ].cameo ? owned[ place ].cameo->getName().str() : "";+ row[ name + ".time" ] = WideCharStringToMultiByte( time.str() );+ row[ name + ".state" ] = owned[ place ].ready ? "ready" : "";+ }+}+//-------------------------------------------------------------------------------------------------/** The scoreboard on Tab, Window/Html/Scoreboard.html, docked to the left the way Dota docks its* own. A player sees two sections, his side in full and the enemy as names and teams, because@@ -10264,19 +10348,17 @@ void InGameUI::drawScoreboard( void )rows.push_back( band );for( ; first < end; first++ )- rows.push_back( scoreboardSeat( seats[ first ].player, seats[ first ].slot, watching || seats[ first ].section == 0,- seats[ first ].player == local ) );+ {+ HtmlValues row = scoreboardSeat( seats[ first ].player, seats[ first ].slot, watching || seats[ first ].section == 0,+ seats[ first ].player == local );+ putSeatSuperweapons( row, seats[ first ].player->getPlayerIndex(), m_spectatorSuperweapons );+ rows.push_back( row );+ }}- // every superweapon counting down in the match, per player in the order of the seats across the- // top, the one place a player reads the times now the strip is gone- Int teams = 0;- fillSpectatorSuperweapons( gatherSeats( teams ), m_spectatorSuperweapons, lists[ "superweapons" ] );-HtmlValues values;values[ "side" ] = spectatorSide();values[ "clock" ] = spectatorClock( TheGameLogic->getFrame() );- values[ "weapons" ] = lists[ "superweapons" ].empty() ? "hidden" : "";m_scoreboardOverlay->setPage( HtmlTemplate_expand( m_scoreboardPage, values, lists, lookupGameText ) );m_scoreboardOverlay->draw();}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cppindex a43274c5a..913728a5e 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp@@ -60,6 +60,7 @@#include "GameClient/GameText.h"#include "GameClient/ParticleSys.h"#include "GameClient/GUICallbacks.h"+#include "GameClient/KeyDefs.h"#include "GameClient/Shell.h"#include "GameClient/ControlBar.h"#include "GameClient/SelectionInfo.h"@@ -2565,6 +2566,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage{GameMessage::Type t = msg->getType();GameMessageDisposition disp = KEEP_MESSAGE;++ // letting go of Tab puts the scoreboard away, input or no input; the press is the command map's+ // DIPLOMACY+ if (t == GameMessage::MSG_RAW_KEY_UP && msg->getArgument( 0 )->integer == KEY_TAB)+ TheInGameUI->closeScoreboard();+// We want to always be able to get to the options menu even during no input times and a clear game data message should always go throughif (t != GameMessage::MSG_META_OPTIONS && t != GameMessage::MSG_CLEAR_GAME_DATA &&!TheInGameUI->getInputEnabled() && !isSystemMessage(msg))@@ -3343,11 +3350,11 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage//-----------------------------------------------------------------------------------------case GameMessage::MSG_META_DIPLOMACY:- // Tab is the scoreboard in any game that has seats; the diplomacy screen, with its mute- // buttons, stays on the command bar's own button+ // Tab is the scoreboard in any game that has seats, up while the key is held; the diplomacy+ // screen, with its mute buttons, stays on the command bar's own buttonif (TheGameLogic->isInGame() && !TheGameLogic->isInShellGame() && TheGameInfo){- TheInGameUI->toggleScoreboard();+ TheInGameUI->openScoreboard();}else if (TheGameLogic->isInGame() && !TheGameLogic->isInShellGame()){