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): observer queues move to the tab scoreboard, seats watch
Olcay Seyganb7f146cae0a7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 50dfb99e3..500053374 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -461,7 +461,7 @@ found and fixed — EA's own, not port damage.**- A superweapon's wait is written in plain seconds - 200, not 3:20 - so it compares with every other countdown on the screen at a glance. Once it is charged the number goes away entirely and the picture itself breathes in your colour, which is the one thing you want to catch out of the corner of your eye.- The countdown inside a strip picture moved down into its bottom left corner and carries the unit with it - 45s, 200s - on a translucent plate. In the middle of the picture it sat on the one thing the picture is there to show, and the plate it lost when it was in the middle earns its place down in the corner, where a pale cameo was swallowing the digits and their shadow together. This applies to the superweapon countdowns in the top right as well.- Every picture in the row stands in a tray - the same tray your general's powers stand in down in the corner, your own side's copy of it, so the American, Chinese and GLA strips each carry their own metal. The tray is turned back to front, because that bar grows out of the right hand corner and the strip grows out of the left, so its heavy rail leads the row instead of standing between every pair of pictures. It is never stretched to fit, and side by side the trays close up behind each other by exactly what that bar closes its own up by, so a row of them reads as one run of metal rather than a line of loose boxes. Stacked they stand clear of each other instead: a picture in a column carries its whole tray, with none of the one above it cutting across its top edge. The strip is flush against the left edge, and a black rectangle laid over the battlefield is gone.-- The queue stands up out of the corner instead of lying across the bottom of the screen. It is a column now, five pictures high, growing upward from just above the command bar with the next thing to arrive at the bottom of it - so the one picture you actually read is always in the same place, a thumb's width above the buttons, and it does not move when six more tanks are ordered. What is left over closes the column as a sixth cell wearing a "+N". A busy base used to lay its whole queue across the battlefield; now it costs one picture's width of screen, whatever it has coming. Watching a match it goes back to rows, because there the up and down belongs to the players: one row each, piled off the bottom left corner, each row reading left to right. Playing under the new steel command bar it lies down again, as a row: a steel tray on the radar's side standing just over the under-attack light, the twin of the general's powers on the other side, the next thing to arrive against the screen's left edge and the rest running right. Each picture sits in a framed cell the size of a power's, so the two trays read as a pair.+- The queue stands up out of the corner instead of lying across the bottom of the screen. It is a column now, five pictures high, growing upward from just above the command bar with the next thing to arrive at the bottom of it - so the one picture you actually read is always in the same place, a thumb's width above the buttons, and it does not move when six more tanks are ordered. What is left over closes the column as a sixth cell wearing a "+N". A busy base used to lay its whole queue across the battlefield; now it costs one picture's width of screen, whatever it has coming. Playing under the new steel command bar it lies down again, as a row: a steel tray on the radar's side standing just over the under-attack light, the twin of the general's powers on the other side, the next thing to arrive against the screen's left edge and the rest running right. Each picture sits in a framed cell the size of a power's, so the two trays read as a pair.- A slot in it is a slot of that bar to the pixel, at every resolution - the size is measured off the bar itself rather than guessed - so the queue is read at a glance instead of squinted at: these were postage stamps a third of that size. Ten tanks ordered back to back are one picture with an x10 in its corner rather than ten copies of the same tank eating the row, so what is left of the row still says what else is coming.- The buildings your workers are raising stand in that same column, not in one of their own: a war factory going up is a picture in the queue at the point its time puts it, between the tank that lands before it and the one that lands after. One column is the whole answer to what your base has coming, read bottom to top in the order it arrives, and it no longer takes a second strip of screen to say the slower half of it. Each site carries its own sweep and the seconds it still needs. Click one and the camera goes there - a half-finished building under fire on the far side of the map is one click away instead of a hunt across the minimap - and none of them can be cancelled by mistake: a building already standing is sold or lost, never cancelled, so Ctrl over it does nothing.- The superweapon strip in the top right stands in the same metal, the right way round this time: it is anchored to the right hand edge and grows leftwards, which is the way that bar in the corner grows, so its rail closes the row against the edge of the screen. The black rectangle behind those pictures is gone with it, and the countdowns are the size of the ones down in the corner rather than half of it.@@ -480,18 +480,19 @@ found and fixed — EA's own, not port damage.**- The corner readout separates game time from real time, and sim rate from fps. It also says DX11 or DX9 after the frame rate, which is what your machine is actually drawing with: a graphics card that cannot start Direct3D 11 falls back to 9 without a word, and a frame rate means nothing until you know which of the two it belongs to. The 64-bit game writes x64 after it, so a screenshot says which build took it.- Your computer's own clock leads that readout, so you can see the time without leaving the match.- Pausing stops both clocks.-- Watching a match, the strip becomes every player's queue at once: one row each, bordered in that player's colour, showing the three that land soonest and a count of the rest. Buildings going up on the ground are in those rows too, so a player answering an attack with three war factories is visible while the concrete is still wet, and eight players fit on one screen because a row is three pictures wide.-- Every row and every countdown stands in real metal, cut from the same tray the general's powers sit in down in the corner - the side your command bar is showing. Watching a match there is no bar of your own, so both strips used to fall back to a flat black box for the whole match; now they wear the metal of the player you are watching, and follow it when you switch seats.+- Watching a match, hold Tab and every player's queue is on his row of the scoreboard, on the line under the name, ahead of his superweapons: the three that land soonest with their seconds and a count of the rest. Buildings going up on the ground are in there too, so a player answering an attack with three war factories is visible while the concrete is still wet. It used to be eight rows of pictures piled up the left edge of the screen for the whole match, over the battlefield. Knocked out and staying to watch, Tab gives you this same board, everybody in full; it used to keep your old side's view, with the enemy as names and nothing else.+- Every row and every countdown stands in real metal, cut from the same tray the general's powers sit in down in the corner - the side your command bar is showing. Watching a match there is no bar of your own, so the superweapon countdowns used to fall back to a flat black box for the whole match; now they wear the metal of the player you are watching, and follow it when you switch seats.+- Watching, the command bar is down to the radar. The list of players it held is the row of seats across the top of the screen now: click a seat and you are looking at that player, his money and his side's steel, the way his button in the list did, and the seat is lit gold. Click it again for everybody. A seat click drops whatever you had selected, so the promotions on screen are that player's and not the owner of the tank you last clicked, and the seat stays yours when you click empty ground. The portrait panel in the right corner comes up when you select something and goes when you click empty ground, so an empty match leaves the bottom of the screen to the battle.- Watching, the bars over the buildings are everyone's too - what each factory is turning out, and how long the superweapons have left. An observer used to see none of it.- Watching, you see the fog the player you are watching sees. The game only ever remembered one player's fog, so switching seats handed you the first player's idea of the map.- An ally, and anyone watching, now sees a stealthed unit's muzzle flash, its promotion and the cash it earns - if they can see the unit at all. Those three asked 'is it mine' instead of 'can I see it', so allies and observers got nothing.- Watching, the match opens on the middle of the map. An observer has no start position, so the game looked for the camera waypoint of "player zero", did not find it, and fell back to the corner of the map: every match watched from the stands began pointed at empty ground in the south west.- Watching, you can click a stealth building. The rule that stops you selecting an enemy you cannot see never asked who was asking, so an observer, and a player already knocked out, could see a stealthed structure on the map and not pick it up to read it. A spectator commands nothing and sees everything already, so there is nothing there to give away.-- Watching, the promotions every general has bought are on screen the whole match: a strip of them in the bottom right corner, standing on the command bar the way the production rows do on the left, one row per player in his own colour. There was nowhere else to find this out - the promotion screen filled itself in with the watcher's own player, who has no general and no command sets at all, so a spectator got a blank screen.-- Watching, clicking one player's unit is clicking his name in the player list, and clicking empty ground puts the whole match back. The command bar brings up his readouts and his money and wears his side's metal; the production rows on the left close down to his, and get longer since he has the strip to himself; the promotions on the right are his alone. The tilde key, or the general's stars on the right of the bar, then opens his promotion screen, on his side's artwork, with his skill points and his rank - greyed out, because they are not yours to spend. With nothing selected the key does nothing and the stars are dark; there is no one general to show.+- Watching, the promotions every general has bought are on screen the whole match: a strip of them in the bottom right corner, one row per player in his own colour. There was nowhere else to find this out - the promotion screen filled itself in with the watcher's own player, who has no general and no command sets at all, so a spectator got a blank screen.+- Watching, clicking one player's unit is clicking his seat at the top, and clicking empty ground puts the whole match back. The screen wears his side's metal and the promotions on the right are his alone. The tilde key, or the general's stars on the right of the bar, then opens his promotion screen, on his side's artwork, with his skill points and his rank - greyed out, because they are not yours to spend. With nothing selected the key does nothing and the stars are dark; there is no one general to show.- A general who has taken Artillery Barrage to level 3 shows one Artillery Barrage on the promotions strip, not three copies of the same picture in a row.- The strips close up again: across a row the trays slide an eighth of a tray under each other, so a row reads as one run of metal. The cameos never overlap each other, because every tray goes down before any picture does.-- Watching, the strips can be switched off. A small "Strips" drop-down in the top left corner opens into three boxes - the production queue, the generals' promotions and the superweapon timers - and each box switches its strip the moment it is clicked and is remembered for the next match you watch. The message list moves down to start under it. Playing, there is no drop-down and every strip is up, whatever you chose in the stands.+- Watching, the strips can be switched off. A small "Strips" drop-down in the top left corner opens into two boxes, the generals' promotions and the superweapon timers, and each box switches its strip the moment it is clicked and is remembered for the next match you watch. The message list moves down to start under it. Playing, there is no drop-down and every strip is up, whatever you chose in the stands.- Watching, an observer's board sits on the right of the screen, built from the command bar's own steel, and the steel is the watched side's: grey for America, red for China, sand for GLA, changing when you select a unit of another side: every player's general in the same metal tray the production strip uses, his name in his colour, the number in gold, and under it a bar filled the way the power bar is, green for one side and red for the other in a two-sided match and each player's own colour in a free for all. It opens on net worth, the cash in hand plus what everything the player has standing would cost to build again, counted twice a second, richest first.- The number the board ranks by is yours to pick from the drop-down at its top: net worth, cash, income per minute, army value, kills and losses, the general's rank and power. The list re-sorts the moment you choose. The command bar's top row of keys picks them too while you watch, Q W E R T Y U, or Q E R T Y U I with the WASD camera, and the drop-down writes each stat's key beside it.- Two buttons under the list. One opens the net worth lead since the first minute on a green radar screen, the first team's lead rising above the line and the second's falling below it in red, with how far ahead the leader is right now; it needs a match with two sides. The other opens the armies: every player's six most expensive kinds of unit in cameo trays, with how many of each he has on the field.@@ -701,7 +702,6 @@ found and fixed — EA's own, not port damage.**- Your screen only. Nobody else in the match sees your choice, nothing about the game itself changes, and two people in the same game can run different settings. Original is the default and nothing changes until you pick something else.- Switch it mid-match and the map repaints itself. So does the picture when an alliance is made or broken by a map script.- A building being captured flashes in the capturer's colour from the setting too. It used to blink in the capturer's original colour while that player's units, radar dots and capture clock showed the new one. The flash on a selected unit and the flashes a mission script asks for follow the setting the same way.-- The player names on an observer's command bar follow the setting as well. They used to keep whatever colour they were given when the bar first filled, which was sometimes black.## You can see where your ally is pointing- Your ally's mouse is on your map: a soft pool of their own player colour on the ground where it rests, with their name across the middle of it. No second arrow on your screen - one is confusing enough, and the name is the part that says whose it is.diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex c475fb3e0..12af71095 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -1110,10 +1110,6 @@ GUI:HudToggles"Strips"END-GUI:HudProductionStrip-"Production queue"-END-GUI:HudSkillStrip"Generals' promotions"ENDdiff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex 61d815446..ee5f131eb 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -15637,10 +15637,6 @@ GUI:HudToggles"Şeritler"END-GUI:HudProductionStrip-"Üretim sırası"-END-GUI:HudSkillStrip"General yetenekleri"ENDdiff --git a/GeneralsMD/Code/Data/Window/Html/Scoreboard.html b/GeneralsMD/Code/Data/Window/Html/Scoreboard.htmlindex 5df44f93b..ccadc8a05 100644--- a/GeneralsMD/Code/Data/Window/Html/Scoreboard.html+++ b/GeneralsMD/Code/Data/Window/Html/Scoreboard.html@@ -20,6 +20,10 @@{{w4...}}, the state "ready" once it can fire and "none" for an unused place; {{more}} countsthe rest and {{moreready}} those of them ready, each with a mark "off" at zero; {{armed}} is"armed" when it has any.+ Watching, every seat also has its three soonest things coming, queued or going up, as+ {{j0.image}} {{j0.time}} {{j0.count}} ("x5" for a run of one thing) {{j0.state}} to {{j2...}},+ "none" for an unused place; {{jobsmore}} counts the rest, {{jobsmoremark}} "off" at zero, and+ {{watching}} is "watching" on every seat, coming or not.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.@@ -43,7 +47,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: 26px; top: 4px; width: 530px; padding-bottom: 3px; }+ #board { position: absolute; left: 26px; top: 4px; width: 620px; 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 */@@ -110,6 +114,17 @@.arm .time { position: absolute; left: 26px; top: 0; line-height: 20px; font-weight: bold; color: #c9d2d9; }.arm.ready .cameo { border-color: #e8c24a; }.arm.ready .time { color: #f2cf4a; }++ /* watching, what a player has coming leads the line under the row, the same cameos and seconds as+ his superweapons, which follow it on the same line: eight rows of two lines each still fit the+ screen's height, where a third line did not. The line is there on every seat, empty or not, so+ the superweapons hold their column while queues come and go */+ .jobs { display: none; position: absolute; left: 30px; top: 22px; height: 20px; }+ .watching .jobs { display: block; }+ .seatrow.full.watching { height: 44px; }+ .watching .arms { left: 244px; }+ .jobs .more { left: 180px; }+ .arm .count { position: absolute; left: 1px; top: 10px; line-height: 8px; font-size: 7px; font-weight: bold; color: #f1f4f6; }</style></head><body>@@ -129,7 +144,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}} {{armed}}">+ <div class="seatrow {{state}} {{armed}} {{watching}}"><div class="stripe" style="background-color: {{color}}"></div><div class="tray"><img class="emblem" src="{{portrait}}"></div><span class="who c-name">{{name}}</span>@@ -149,6 +164,12 @@<img class="skill" src="{{skill5}}" style="left: 440px"><img class="skill" src="{{skill6}}" style="left: 454px"><img class="favourite c-favourite" src="{{favourite}}">+ <div class="jobs">+ <div class="arm w0 {{j0.state}}"><img class="cameo" src="{{j0.image}}"><span class="count">{{j0.count}}</span><span class="time">{{j0.time}}</span></div>+ <div class="arm w1 {{j1.state}}"><img class="cameo" src="{{j1.image}}"><span class="count">{{j1.count}}</span><span class="time">{{j1.time}}</span></div>+ <div class="arm w2 {{j2.state}}"><img class="cameo" src="{{j2.image}}"><span class="count">{{j2.count}}</span><span class="time">{{j2.time}}</span></div>+ <div class="more {{jobsmoremark}}">(+{{jobsmore}})</div>+ </div><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>diff --git a/GeneralsMD/Code/Data/Window/Html/Spectator.html b/GeneralsMD/Code/Data/Window/Html/Spectator.htmlindex 0695ab099..0b1752908 100644--- a/GeneralsMD/Code/Data/Window/Html/Spectator.html+++ b/GeneralsMD/Code/Data/Window/Html/Spectator.html@@ -36,8 +36,11 @@data-each="lead", the first team's net worth less the second's since the start, up to 48columns, with {{up}} or {{down}} as a percent of the biggest lead either waydata-each="top", every player grouped by team: {{kind}} "player" with {{image}} {{color}} {{name}}- {{team}} {{cash}} and {{power}} "brownout" while his power is short; between two teams one- entry of kind "clock", between any others one of kind "gap"+ {{team}} {{cash}}, {{power}} "brownout" while his power is short, {{click}} "watch:N" and+ {{watched}} "watched" while he is the one looked at; between two teams one entry of kind+ "clock", between any others one of kind "gap". A data-click of watch:N looks at player N, what+ his button in the old player list did, and watch:N on the one already looked at goes back to+ everybodyThree flat lists open each player's run with a {{kind}} "head" entry carrying {{image}} (hisgeneral), {{color}} and {{name}}:data-each="army", then up to six "unit" entries, the most money first, with {{image}} {{count}}@@ -97,6 +100,9 @@.tplayer .who { position: absolute; left: 0; right: 0; top: 20px; font-size: 8px; line-height: 8px; }.tplayer .cash { position: absolute; left: 0; right: 0; top: 27px; font-size: 7px; line-height: 7px; color: #e8d27a; }.tplayer.brownout .cash { color: #ff7a5c; }+ /* the seat is the player list's button: the pointer lights it, and the one being watched is lit gold */+ .tplayer:hover { background-color: rgba(60, 72, 80, 0.85); }+ .tplayer.watched { background-color: rgba(232, 210, 122, 0.3); border-bottom: 2px solid #e8d27a; }.team0 .tint { background-color: #b8f08a; }.team1 .tint { background-color: #ff7a5c; }@@ -201,7 +207,7 @@<div class="{{side}}"><div id="top">- <div class="t{{kind}} team{{team}} {{power}}" data-each="top">+ <div class="t{{kind}} team{{team}} {{power}} {{watched}}" data-each="top" data-click="{{click}}"><div class="tray"><img class="emblem" src="{{image}}"></div><div class="tint"></div><div class="who" style="color: {{color}}">{{name}}</div>@@ -215,7 +221,6 @@<div class="strips {{flip:strips}}"><div class="plate" data-click="flip:strips"><span class="box"></span>{{text:GUI:HudToggles}}</div><div class="items well">- <div class="row {{option:ShowProductionStrip}}" data-click="option:ShowProductionStrip"><span class="box"></span>{{text:GUI:HudProductionStrip}}</div><div class="row {{option:ShowSkillStrip}}" data-click="option:ShowSkillStrip"><span class="box"></span>{{text:GUI:HudSkillStrip}}</div><div class="row {{option:ShowSuperweaponStrip}}" data-click="option:ShowSuperweaponStrip"><span class="box"></span>{{text:GUI:HudSuperweaponStrip}}</div></div>diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.hindex 9a6468242..52948714f 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h@@ -412,7 +412,6 @@ public:Int m_anisotropyLevel; ///< samples anisotropic filtering may take; 0 = whatever the card offersBool m_showHudOverlay; ///< draw the fps / elapsed time / income line in the cornerBool m_showPlacementRangeRing; ///< while placing a structure, ring its weapon range- Bool m_showProductionStrip; ///< the production queue rows above the command bar, bottom leftBool m_showSkillStrip; ///< watching, every general's bought promotions, bottom rightBool m_showSuperweaponStrip; ///< the superweapon countdown cameos, top rightBool m_workersReturnToSupply; ///< a worker that finishes a build job goes back to the dock it leftdiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.hindex c86ed99d7..8603b197d 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h@@ -862,6 +862,9 @@ public:/// watching, follow the selection: the player's readouts, his money and his side's metalvoid updateWatchedPlayer( void );+ /// watching, look at this player - what pressing his button in the player list did - or at+ /// everybody for NULL, the list's cancel; the portrait's panel follows whatever is selected+ void watchPlayer( Player *player );void showObserverPlayerInfo( void ); ///< his readouts up, the player list downvoid showObserverPlayerList( void ); ///< and back againdiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex ecbebaf3e..1e00f47ef 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -760,22 +760,6 @@ public: // ********************************************************************//enum { PRODUCTION_STRIP_ROW_MAX = 5 }; ///< cameos one column will draw, stacked upward; whatever/// is left over closes it as a sixth cell wearing a "+N"- enum { PRODUCTION_STRIP_WATCH_MAX = 3 }; ///< and while watching, where eight columns share the- /// screen and a column is a whole player: three cameos and- /// a "+N", since a run of the same unit is one of them now- enum { PRODUCTION_STRIP_ROWS = 8 }; ///< playing: one column, the whole base's.- /// watching: one column per player, so eight of them-- //- // Playing, everything the base has coming is one column: what a factory is turning out and what- // a dozer is raising stand in the same run of cells, soonest first, because the question is when- // the next thing lands and not which of the two kinds it is. The building you have selected does- // not get a column of its own either - its items lead this one.- //- enum- {- PRODUCTION_ROW_QUEUE = 0 ///< queues and building sites together- };//// A queue slot is one slot of the general's power bar down in the corner, measurement for@@ -1210,10 +1194,9 @@ protected:void drawPeaceCountdown( UnsignedInt framesLeft ); ///< the last seconds of it, one big digit in the middle of the screenvoid drawHudOverlay( void ); ///< the small elapsed-time / fps plate (ShowHudOverlay)void drawProductionStrip( void ); ///< the production queue rows above the control bar- ///< one run of cells - a column while playing, a player's row while watching - with its left- ///< edge at 'left' and its first cell's top edge at 'bottomY'- void drawProductionStripColumn( Int row, Int left, Int bottomY );- void drawQueueTray( Int row ); ///< the playing strip as a row in Window/Html/Queue.html's tray+ ///< the run of cells, a column, with its left edge at 'left' and its first cell's top edge at 'bottomY'+ void drawProductionStripColumn( Int left, Int bottomY );+ void drawQueueTray( void ); ///< the playing strip as a row in Window/Html/Queue.html's trayconst Image *productionStripTray( void ); ///< the bar's tray, mirrored, kept until the bar changes sidevoid stripTrayMetrics( ICoord2D *tray, ICoord2D *cameo, ICoord2D *hole, Int *step ); ///< that tray's size, its cameo hole, and the column stepvoid drawStripSeconds( Int which, Int x, Int y, Int w, Int h, Int seconds ); ///< countdown written inside a cameo@@ -1282,6 +1265,7 @@ protected:HtmlLists m_spectatorLists;HtmlValues m_spectatorTotals; ///< the page's values that are not per player, gathered with the listsUnsignedInt m_spectatorListsFrame; ///< the logic frame the lists were last gathered on+ const Player *m_spectatorListsWatched; ///< the player being watched when they were, whose seat they markstd::vector< Int > m_spectatorLead; ///< the first team's net worth less the second's, one per sampleUnsignedInt m_spectatorLeadFrame; ///< the logic frame the last of those was taken onInt m_hudTogglesBottom; ///< the bottom of the page's #hud-top, so the message list starts under it@@ -1327,13 +1311,14 @@ protected:// The global production strip: everything the local player has coming - queued in any factory,// or going up on the ground - one cameo each, soonest to finish first, in a column standing on// the corner above the control bar. drawProductionStrip() lays it out and records where each- // cameo landed; handleProductionStripClick() reads those back.+ // cameo landed; handleProductionStripClick() reads those back. What a factory is turning out+ // and what a dozer is raising stand in the same run, because the question is when the next thing+ // lands and not which of the two kinds it is, and the building you have selected leads it.+ // Watching, the queues are on the Tab scoreboard instead.//- ProductionStripSlot m_productionStrip[ PRODUCTION_STRIP_ROWS ][ PRODUCTION_STRIP_ROW_MAX ];- Int m_productionStripCount[ PRODUCTION_STRIP_ROWS ]; ///< cameos drawn per row- Int m_productionStripTotal[ PRODUCTION_STRIP_ROWS ]; ///< items queued per row, drawn or not- Color m_productionStripRowColor[ PRODUCTION_STRIP_ROWS ]; ///< whose row it is, 0 for the local player's own- Bool m_productionStripWatching; ///< the rows are every player's, not ours+ ProductionStripSlot m_productionStrip[ PRODUCTION_STRIP_ROW_MAX ];+ Int m_productionStripCount; ///< cameos drawn+ Int m_productionStripTotal; ///< items queued, drawn or notInt m_productionStripCameoW; ///< cameo size this frame, in the control bar's aspectInt m_productionStripCameoH;Bool m_productionStripThemed; ///< playing under the bar's page: a row in Queue.html's steel tray@@ -1358,11 +1343,15 @@ protected:// cameo per frame, and watching a match the strips cost more to draw than the terrain under// them. Kept per cameo, a countdown rebuilds when its own second changes: once a second.//- enum { STRIP_SECONDS_STRINGS = PRODUCTION_STRIP_ROWS * PRODUCTION_STRIP_ROW_MAX- + SUPERWEAPON_STRIP_MAX };- enum { STRIP_OVERFLOW_STRINGS = PRODUCTION_STRIP_ROWS + 1 }; ///< one per production row, plus the superweapon strip's+ enum { STRIP_SECONDS_STRINGS = PRODUCTION_STRIP_ROW_MAX + SUPERWEAPON_STRIP_MAX };+ enum+ {+ STRIP_OVERFLOW_PRODUCTION = 0, ///< the "+N" closing the production column+ STRIP_OVERFLOW_SUPERWEAPON, ///< and the superweapon strip's+ STRIP_OVERFLOW_STRINGS+ };- enum { STRIP_QUANTITY_STRINGS = PRODUCTION_STRIP_ROWS * PRODUCTION_STRIP_ROW_MAX };+ enum { STRIP_QUANTITY_STRINGS = PRODUCTION_STRIP_ROW_MAX };DisplayString * m_productionStripOverflow[ STRIP_OVERFLOW_STRINGS ]; ///< the "+N" that stands for the rest of a rowDisplayString * m_stripSecondsString[ STRIP_SECONDS_STRINGS ]; ///< the countdown written inside a cameo, either strip'sdiff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex d31dddd35..761a81fa7 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -1146,7 +1146,6 @@ GlobalData::GlobalData()m_buildPlacementShadows = TRUE;m_showHudOverlay = TRUE;m_showPlacementRangeRing = TRUE;- m_showProductionStrip = TRUE;m_showSkillStrip = TRUE;m_showSuperweaponStrip = TRUE;m_workersReturnToSupply = TRUE;diff --git a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cppindex 2d79b7cc3..6f6473846 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp@@ -80,7 +80,6 @@ OPTION_BOOL_ACCESSORS( m_shadowsForProjectiles )OPTION_BOOL_ACCESSORS( m_shadowsForProps )OPTION_BOOL_ACCESSORS( m_shadowsForParticles )OPTION_BOOL_ACCESSORS( m_particleGroundBounce )-OPTION_BOOL_ACCESSORS( m_showProductionStrip )OPTION_BOOL_ACCESSORS( m_showSkillStrip )OPTION_BOOL_ACCESSORS( m_showSuperweaponStrip )@@ -397,11 +396,8 @@ const OptionDef TheOptionCatalog[] =// The strips over the battlefield while watching a match. They have no control in the options// menu: a spectator switches them from the drop-down in the top left corner, which writes them- // back itself. Playing, every strip is drawn whatever these say.- { "ShowProductionStrip", NULL, "GUI:HudProductionStrip",- OPTION_BOOL, APPLY_LIVE, 0, 1,- get_m_showProductionStrip, set_m_showProductionStrip },-+ // back itself. Playing, every strip is drawn whatever these say. The production queues have no+ // switch: watching, they are on the Tab scoreboard, and playing, they are always drawn.{ "ShowSkillStrip", NULL, "GUI:HudSkillStrip",OPTION_BOOL, APPLY_LIVE, 0, 1,get_m_showSkillStrip, set_m_showSkillStrip },diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex ab45df596..85c6ef6b6 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -444,13 +444,13 @@ void ControlBar::markUIDirty( void )* Watching - an observer, or a player knocked out who stayed to watch - the screen used to be* populated with the watcher's own player, who owns no command sets at all, so the whole screen* came up blank. It follows the field instead: whatever is selected names its owner, and with- * nothing selected it is the player the observer list is pointed at, or the first side still in+ * nothing selected it is the player the seats at the top are pointed at, or the first side still in* the match. *///-------------------------------------------------------------------------------------------------/** The player a watcher has picked out by clicking one of his things, NULL when nothing is* selected or the selection belongs to nobody who is still playing. It is what narrows the- * whole screen to one player: the production rows on the left, the skills on the right, the- * side the bar wears and whose promotion screen the key opens. */+ * whole screen to one player: his seat lit at the top, the skills on the right, the side the bar+ * wears and whose promotion screen the key opens. */Player *ControlBar::getSelectedPlayer( void ){if( ThePlayerList->getLocalPlayer()->isPlayerActive() )@@ -469,9 +469,9 @@ Player *ControlBar::getSelectedPlayer( void )}//--------------------------------------------------------------------------------------------------/** Watching, the selection drives the whole bar: clicking a unit is clicking its owner in the- * player list. His readouts come up, the money plate becomes his, and the bar wears his side's- * metal - and clicking empty ground puts the list and the watcher's own plain bar back.+/** Watching, the selection drives the whole bar: clicking a unit is clicking its owner's seat at+ * the top. His seat lights, the portrait's panel comes up, and the bar wears his side's metal -+ * and clicking empty ground puts everybody and the watcher's own plain bar back.** Before this, picking up somebody's tank told you nothing about him: the bar stayed on whatever* side had last been chosen off the list, and the money plate with it. */@@ -482,16 +482,27 @@ void ControlBar::updateWatchedPlayer( void )if( selected == m_watchedSelection )return;- m_watchedSelection = selected;- setObserverLookAtPlayer( selected );+ watchPlayer( selected );- if( selected )+ // the general's stars open the promotion screen of the player who is selected, and there is+ // nobody's to open with nothing selected+ static NameKeyType buttonGeneralID = NAMEKEY( "ControlBar.wnd:ButtonGeneral" );+ GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( NULL, buttonGeneralID );+ if( buttonGeneral )+ buttonGeneral->winEnable( selected != NULL );+}++void ControlBar::watchPlayer( Player *player )+{+ setObserverLookAtPlayer( player );++ if( player )showObserverPlayerInfo();elseshowObserverPlayerList();- const PlayerTemplate *wear = selected ? selected->getPlayerTemplate()- : ThePlayerList->getLocalPlayer()->getPlayerTemplate();+ const PlayerTemplate *wear = player ? player->getPlayerTemplate()+ : ThePlayerList->getLocalPlayer()->getPlayerTemplate();if( m_controlBarSchemeManager && wear && wear->getSide().compare( m_watchedSide ) != 0 ){// a scheme lays the whole bar out again, so it is set when the side really changes and not@@ -501,12 +512,11 @@ void ControlBar::updateWatchedPlayer( void )restoreStageAfterScheme();}- // the general's stars open the promotion screen of the player who is selected, and there is- // nobody's to open with nothing selected- static NameKeyType buttonGeneralID = NAMEKEY( "ControlBar.wnd:ButtonGeneral" );- GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( NULL, buttonGeneralID );- if( buttonGeneral )- buttonGeneral->winEnable( selected != NULL );+ // a seat clicked at the top clears the selection before it gets here, so what is selected is+ // read again rather than taken from the caller; the portrait's panel is the selection's+ m_watchedSelection = getSelectedPlayer();+ if( m_currentControlBarStage == CONTROL_BAR_STAGE_DEFAULT )+ showPanel( CB_PANEL_RIGHT, m_watchedSelection != NULL );}Player *ControlBar::getWatchedPlayer( void )@@ -3172,7 +3182,7 @@ void ControlBar::update( void )// if we're an observer, don't do the complete updateif( m_isObserverCommandBar){- // clicking a unit is clicking its owner in the player list: his readouts, his money, his side+ // clicking a unit is clicking its owner's seat at the top: his seat, his side, the portraitupdateWatchedPlayer();// twice a second is plenty for the observer readouts, and only on a real logic tick -@@ -5860,10 +5870,11 @@ void ControlBar::setDefaultControlBarConfig( void )m_contextParent[ CP_MASTER ]->winSetPosition(m_defaultControlBarPosition.x, m_defaultControlBarPosition.y);m_contextParent[ CP_MASTER ]->winHide(FALSE);- // the three panels the minimised bar stands down+ // the three panels the minimised bar stands down. Watching, the middle is the player list, which+ // the seats across the top of the screen have taken over, and the right is the selection's portraitshowPanel( CB_PANEL_LEFT, TRUE );- showPanel( CB_PANEL_CENTER, TRUE );- showPanel( CB_PANEL_RIGHT, TRUE );+ showPanel( CB_PANEL_CENTER, !m_isObserverCommandBar );+ showPanel( CB_PANEL_RIGHT, !m_isObserverCommandBar || getSelectedPlayer() != NULL );repopulateBuildTooltipLayout();setUpDownImages();diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex c1a452941..5abc51348 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -1177,13 +1177,8 @@ InGameUI::InGameUI()m_hudRealClockBaseMs = 0;m_hudLastDrawMs = 0;m_hudOverlayBottom = 0;- for( Int stripRow = 0; stripRow < PRODUCTION_STRIP_ROWS; stripRow++ )- {- m_productionStripCount[ stripRow ] = 0;- m_productionStripTotal[ stripRow ] = 0;- m_productionStripRowColor[ stripRow ] = 0;- }- m_productionStripWatching = FALSE;+ m_productionStripCount = 0;+ m_productionStripTotal = 0;m_productionStripCameoW = PRODUCTION_STRIP_CAMEO;m_productionStripCameoH = PRODUCTION_STRIP_CAMEO;m_productionStripThemed = FALSE;@@ -1199,6 +1194,7 @@ InGameUI::InGameUI()m_spectatorPageLoaded = FALSE;m_spectatorPageShown = FALSE;m_spectatorListsFrame = 0;+ m_spectatorListsWatched = NULL;m_spectatorLeadFrame = 0;m_hudTogglesBottom = 0;m_scoreboardOpen = FALSE;@@ -1794,6 +1790,7 @@ static const char *const SPECTATOR_PAGE = "Window\\Html\\Spectator.html";static const std::string OPTION_ACTION = "option:";static const std::string FLIP_ACTION = "flip:";static const std::string PICK_ACTION = "pick:";+static const std::string WATCH_ACTION = "watch:";static const std::string TEXT_LOOKUP = "text:";static const std::string STAT_GROUP = "stat";@@ -2201,6 +2198,8 @@ static void fillSpectatorTop( std::vector< SpectatorStats > players, std::vectorentry[ "team" ] = std::to_string( stats.team );entry[ "cash" ] = std::to_string( stats.cash );entry[ "power" ] = stats.power < 0 ? "brownout" : "";+ entry[ "click" ] = WATCH_ACTION + std::to_string( stats.player->getPlayerIndex() );+ entry[ "watched" ] = stats.player == TheControlBar->getObserverLookAtPlayer() ? "watched" : "";entries.push_back( entry );}}@@ -2452,11 +2451,11 @@ Bool InGameUI::pickSpectatorStat( Int commandSlot )* the number picked in the stat drop-down, the net worth lead over the match and each army's most* expensive units - the panels Dota's spectator keeps down the left of the screen.*- * Watching a match three strips fight over the same picture - the production rows, the- * promotions, the superweapon countdowns - and which of them a spectator wants depends on what he- * is watching for. Each box flips its option the moment it is clicked and saves the choice with- * the rest of the options. Only while watching: playing, the top left corner belongs to the- * messages, and the other side's worth is not a player's to know. */+ * Watching a match two strips fight over the same picture - the promotions and the superweapon+ * countdowns - and which of them a spectator wants depends on what he is watching for; the+ * production is on the Tab scoreboard. Each box flips its option the moment it is clicked and+ * saves the choice with the rest of the options. Only while watching: playing, the top left+ * corner belongs to the messages, and the other side's worth is not a player's to know. *///-------------------------------------------------------------------------------------------------void InGameUI::drawSpectatorPage( void ){@@ -2478,8 +2477,11 @@ void InGameUI::drawSpectatorPage( void )if( m_spectatorOverlay == NULL )m_spectatorOverlay = new HtmlOverlay( m_superweaponNormalFont );+ // a seat clicked or a unit selected moves the gold mark the same frame, not half a second onconst UnsignedInt frame = TheGameLogic->getFrame();- if( m_spectatorLists.empty() || frame < m_spectatorListsFrame || frame >= m_spectatorListsFrame + NET_WORTH_REFRESH_FRAMES )+ const Player *watched = TheControlBar->getObserverLookAtPlayer();+ if( m_spectatorLists.empty() || watched != m_spectatorListsWatched+ || frame < m_spectatorListsFrame || frame >= m_spectatorListsFrame + NET_WORTH_REFRESH_FRAMES ){const SpectatorStat &stat = spectatorStat( m_spectatorPicked );Int teams = 0;@@ -2508,6 +2510,7 @@ void InGameUI::drawSpectatorPage( void )for( Int each = 0; each < (Int)ARRAY_SIZE( SPECTATOR_STATS ); each++ )m_spectatorTotals[ std::string( "statkey:" ) + SPECTATOR_STATS[ each ].key ] = commandSlotKey( each * COMMAND_SLOTS_PER_COLUMN );m_spectatorListsFrame = frame;+ m_spectatorListsWatched = watched;}// the messages come and go on their own clock, not the lists' half second@@ -2577,6 +2580,16 @@ Bool InGameUI::handleSpectatorPageClick( const ICoord2D *mouse, Bool act )m_spectatorFlipped.erase( group );m_spectatorLists.clear();}+ else if( action.compare( 0, WATCH_ACTION.size(), WATCH_ACTION ) == 0 )+ {+ // a seat across the top is that player's button in the old player list, and the seat already+ // being watched is the list's cancel. A selection would keep the promotions and the skills on+ // its own owner whatever the seat says, so the seat takes the whole screen and clears it+ Player *player = ThePlayerList->getNthPlayer( atoi( action.c_str() + WATCH_ACTION.size() ) );+ Player *watched = player == TheControlBar->getObserverLookAtPlayer() ? NULL : player;+ deselectAllDrawables();+ TheControlBar->watchPlayer( watched );+ }else if( action.compare( 0, OPTION_ACTION.size(), OPTION_ACTION ) == 0 ){const OptionDef *option = findOptionDef( action.substr( OPTION_ACTION.size() ).c_str() );@@ -9573,6 +9586,23 @@ static const ProductionEntry *findStripEntry( ProductionUpdateInterface *pu,return NULL;}+//-------------------------------------------------------------------------------------------------+/** The picture a slot is drawn with, given its producer and the queue entry found for it: the+ * building going up, or what the entry makes. NULL once the producer or the entry is gone, or+ * for a template that carries no picture. */+//-------------------------------------------------------------------------------------------------+static const Image *stripSlotCameo( const Object *producer, const ProductionEntry *entry,+ const InGameUI::ProductionStripSlot *slot )+{+ if( slot->isStructure )+ return producer ? producer->getTemplate()->getButtonImage() : NULL;+ if( entry == NULL )+ return NULL;+ if( slot->isUpgrade )+ return entry->getProductionUpgrade() ? entry->getProductionUpgrade()->getButtonImage() : NULL;+ return entry->getProductionObject() ? entry->getProductionObject()->getButtonImage() : NULL;+}+//-------------------------------------------------------------------------------------------------/** The tray a queue cameo stands in: the general's power bar's own, this side's copy of it, turned* back to front. That bar grows leftward out of the corner and its tray's heavy rail is on the@@ -9903,7 +9933,7 @@ void InGameUI::drawSuperweaponStrip( void )const Int x = right - trayW + trayHole.x - secondsSlot * trayStep;if( !slot->ready )- drawStripSeconds( PRODUCTION_STRIP_ROWS * PRODUCTION_STRIP_ROW_MAX + first + secondsSlot,+ drawStripSeconds( PRODUCTION_STRIP_ROW_MAX + first + secondsSlot,x, y, cameoW, cameoH, slot->seconds );}@@ -9925,7 +9955,7 @@ void InGameUI::drawSuperweaponStrip( void )if( hidden > 0 && lastRow ){// this strip's own "+N", kept apart from the production rows' - see m_stripSecondsString- DisplayString *&overflow = m_productionStripOverflow[ PRODUCTION_STRIP_ROWS ];+ DisplayString *&overflow = m_productionStripOverflow[ STRIP_OVERFLOW_SUPERWEAPON ];if( overflow == NULL ){@@ -10315,13 +10345,65 @@ static void putSeatSuperweapons( HtmlValues &row, Int playerIndex, const std::verow[ "morereadymark" ] = moreReady > 0 ? "" : "off";}+//-------------------------------------------------------------------------------------------------+/** One scoreboard seat's production while watching, what the left edge of the screen used to carry:+ * the SEAT_JOBS soonest things coming, queued in a factory or going up on the ground, as+ * {{jN.image}} {{jN.time}} {{jN.count}} ("x5" for a run of the same thing) and {{jN.state}}, "none"+ * for an unused place. {{jobsmore}} counts the rest, with {{jobsmoremark}} "off" when there are+ * none. {{watching}} is "watching" on every seat, so the line keeps its place with nothing coming+ * and the superweapons after it stay put as a queue empties and fills. */+//-------------------------------------------------------------------------------------------------+static void putSeatQueue( HtmlValues &row, Player *player )+{+ enum { SEAT_JOBS = 3 }; ///< the line's head; its superweapons follow on the same line++ InGameUI::ProductionStripSlot slots[ SEAT_JOBS ];+ Int count = 0;+ Int total = 0;+ ProductionStripGather gather;+ gather.slot = slots;+ gather.count = &count;+ gather.total = &total;+ gather.max = SEAT_JOBS;+ gather.skip = INVALID_ID;+ player->iterateObjects( gatherStripEverything, &gather );++ Int shown = 0;+ for( Int place = 0; place < SEAT_JOBS; place++ )+ {+ const std::string name = "j" + std::to_string( place );+ if( place >= count )+ {+ row[ name + ".state" ] = "none";+ continue;+ }++ const InGameUI::ProductionStripSlot *slot = &slots[ place ];+ Object *producer = TheGameLogic->findObjectByID( slot->producer );+ const ProductionEntry *entry = producer && !slot->isStructure+ ? findStripEntry( producer->getProductionUpdateInterface(), slot ) : NULL;+ const Image *cameo = stripSlotCameo( producer, entry, slot );+ UnicodeString time;+ formatStripSeconds( &time, ControlBar_secondsFromFrames( (Real)slot->remaining ) );+ row[ name + ".image" ] = cameo ? cameo->getName().str() : "";+ row[ name + ".time" ] = WideCharStringToMultiByte( time.str() );+ row[ name + ".count" ] = slot->quantity > 1 ? "x" + std::to_string( slot->quantity ) : "";+ row[ name + ".state" ] = "";+ shown += slot->quantity;+ }+ row[ "jobsmore" ] = std::to_string( total - shown );+ row[ "jobsmoremark" ] = total > shown ? "" : "off";+ row[ "watching" ] = "watching";+}+//-------------------------------------------------------------------------------------------------/** 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- * the enemy's general, money and promotions are for its own side to know. A watcher sees one- * section a team, every seat in full. Every section opens with a band of kind "band" carrying- * its {{label}}, how many seats are {{standing}} of {{seats}}, and {{side}} "allies", "enemies"- * or "team". */+ * the enemy's general, money and promotions are for its own side to know. A watcher, an observer+ * or a player knocked out who stayed, sees one section a team, every seat in full and with its+ * production, which is the left edge's queue column he no longer has. Every section opens with a+ * band of kind "band" carrying its {{label}}, how many seats are {{standing}} of {{seats}}, and+ * {{side}} "allies", "enemies" or "team". *///-------------------------------------------------------------------------------------------------void InGameUI::drawScoreboard( void ){@@ -10341,7 +10423,7 @@ void InGameUI::drawScoreboard( void )m_scoreboardOverlay = new HtmlOverlay( m_superweaponNormalFont );Player *local = ThePlayerList->getLocalPlayer();- const Bool watching = local->isPlayerObserver();+ const Bool watching = localPlayerWatching();struct Seat{@@ -10404,6 +10486,8 @@ void InGameUI::drawScoreboard( void )HtmlValues row = scoreboardSeat( seats[ first ].player, seats[ first ].slot, watching || seats[ first ].section == 0,seats[ first ].player == local, earnedPerSecond( seats[ first ].player->getPlayerIndex() ) );putSeatSuperweapons( row, seats[ first ].player->getPlayerIndex(), m_spectatorSuperweapons );+ if( watching )+ putSeatQueue( row, seats[ first ].player );rows.push_back( row );}}@@ -11829,15 +11913,11 @@ void InGameUI::drawQuitMenuPage( GameWindow *parent )* the screen. The soonest thing to arrive is the bottom cell - the one nearest the command bar* and nearest the eye - and everything behind it is stacked above. Five cells, and whatever is* left over closes the column as a sixth wearing a "+N", so the strip's whole footprint is one- * tray wide however much the base has queued.- *- * Watching, the run is a row instead, because there the vertical belongs to the players: one row- * each, stacked, and a row that grew upward too would have nowhere to put the next player. The- * soonest is then the left hand cell and the run reads left to right. */+ * tray wide however much the base has queued. *///--------------------------------------------------------------------------------------------------void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )+void InGameUI::drawProductionStripColumn( Int left, Int bottomY ){- const Int count = m_productionStripCount[ row ];+ const Int count = m_productionStripCount;if( count < 1 )return;@@ -11872,8 +11952,8 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )// Which way the cells run. Either way they step a whole tray, so no cameo has a neighbouring// tray lying over its edge.//- const Int cellStepX = m_productionStripThemed ? m_productionStripStep : m_productionStripWatching ? trayStep : 0;- const Int cellStepY = m_productionStripThemed || m_productionStripWatching ? 0 : trayH;+ const Int cellStepX = m_productionStripThemed ? m_productionStripStep : 0;+ const Int cellStepY = m_productionStripThemed ? 0 : trayH;const Image *tray = productionStripTray();@@ -11883,9 +11963,9 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )//Int shown = 0;for( Int shownSlot = 0; shownSlot < count; shownSlot++ )- shown += m_productionStrip[ row ][ shownSlot ].quantity;+ shown += m_productionStrip[ shownSlot ].quantity;- const Int hidden = m_productionStripTotal[ row ] - shown;+ const Int hidden = m_productionStripTotal - shown;const Int cells = count + ( hidden > 0 ? 1 : 0 );//@@ -11927,7 +12007,7 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )for( Int i = 0; i < count; i++ ){- ProductionStripSlot *slot = &m_productionStrip[ row ][ i ];+ ProductionStripSlot *slot = &m_productionStrip[ i ];StripSlotDraw *draw = &slots[ i ];// the soonest is the near cell: the bottom of a column, the left hand end of a row@@ -11938,7 +12018,6 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )draw->x = slotX;draw->y = y;- draw->cameo = NULL;draw->percent = -1;draw->seconds = -1;draw->quantity = slot->quantity;@@ -11947,6 +12026,7 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )Object *producer = TheGameLogic->findObjectByID( slot->producer );ProductionUpdateInterface *pu = producer ? producer->getProductionUpdateInterface() : NULL;const ProductionEntry *entry = slot->isStructure ? NULL : findStripEntry( pu, slot );+ draw->cameo = stripSlotCameo( producer, entry, slot );if( slot->isStructure && producer ){@@ -11954,8 +12034,6 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )// A building going up carries its own progress rather than a queue entry's: the same// sweep and the same countdown, read off the construction percentage on the object.//- draw->cameo = producer->getTemplate()->getButtonImage();-const Real done = producer->getConstructionPercent();draw->percent = REAL_TO_INT( done );@@ -11969,14 +12047,6 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )}else if( entry ){- if( slot->isUpgrade )- {- if( entry->getProductionUpgrade() )- draw->cameo = entry->getProductionUpgrade()->getButtonImage();- }- else if( entry->getProductionObject() )- draw->cameo = entry->getProductionObject()->getButtonImage();-//// The scrim starts covering the cameo and is swept off as the item is built, the same// way round as the command bar's own clock. Going the other way - filling up with black@@ -12019,26 +12089,17 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )// the cursor is really on, and an accidental cancel costs the whole item.//// a building already standing on the map is not cancelled from here - it is sold or blown up- if( !m_productionStripWatching && !slot->isStructure- && TheKeyboard && TheKeyboard->isCtrl() && TheMouse )+ if( !slot->isStructure && TheKeyboard && TheKeyboard->isCtrl() && TheMouse ){const MouseIO *io = TheMouse->getMouseStatus();draw->cancelHover = io && io->pos.x >= draw->x && io->pos.x < draw->x + cameoW &&io->pos.y >= draw->y && io->pos.y < draw->y + cameoH;}- // same border colours the command bar puts on its build and upgrade buttons - except while- // watching, where the border is whose row it is, since that is what the row is there to say+ // same border colours the command bar puts on its build and upgrade buttonsdraw->border = GameMakeColor( 160, 160, 160, 160 );if( draw->cancelHover )draw->border = GameMakeColor( 255, 80, 80, 255 );- else if( m_productionStripRowColor[ row ] != 0 )- {- // the stored player colour's alpha is not ours to trust, the health bars found that out- UnsignedByte r, g, b, a;- GameGetColorComponents( m_productionStripRowColor[ row ], &r, &g, &b, &a );- draw->border = GameMakeColor( r, g, b, 255 );- }else if( TheControlBar )draw->border = slot->isUpgrade ? TheControlBar->getUpgradeBorderColor(): TheControlBar->getBuildBorderColor();@@ -12067,7 +12128,7 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY ){const StripSlotDraw *draw = &slots[ secondsSlot ];if( draw->seconds >= 0 )- drawStripSeconds( row * PRODUCTION_STRIP_ROW_MAX + secondsSlot,+ drawStripSeconds( secondsSlot,draw->x, draw->y, cameoW, cameoH, draw->seconds );}@@ -12076,18 +12137,15 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY ){const StripSlotDraw *draw = &slots[ quantitySlot ];if( draw->quantity > 1 )- drawStripQuantity( row * PRODUCTION_STRIP_ROW_MAX + quantitySlot,+ drawStripQuantity( quantitySlot,draw->x, draw->y, cameoW, draw->quantity );}- // and the borders round them, a team border heavy enough to read as the row's whole label; the- // themed row's frames are Queue.html's+ // and the borders round them; the themed row's frames are Queue.html'sfor( Int borderSlot = 0; borderSlot < count && !m_productionStripThemed; borderSlot++ ){const StripSlotDraw *draw = &slots[ borderSlot ];- TheDisplay->drawOpenRect( draw->x, draw->y, cameoW, cameoH,- m_productionStripRowColor[ row ] != 0 ? 2.0f : 1.0f,- draw->border );+ TheDisplay->drawOpenRect( draw->x, draw->y, cameoW, cameoH, 1.0f, draw->border );}for( Int hoverSlot = 0; hoverSlot < count; hoverSlot++ )@@ -12114,8 +12172,8 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )//if( hidden > 0 ){- // this row's own "+N" - see m_stripSecondsString- DisplayString *&overflow = m_productionStripOverflow[ row ];+ // the column's own "+N" - see m_stripSecondsString+ DisplayString *&overflow = m_productionStripOverflow[ STRIP_OVERFLOW_PRODUCTION ];if( overflow == NULL ){@@ -12149,7 +12207,7 @@ void InGameUI::drawProductionStripColumn( Int row, Int left, Int bottomY )* right. Each cell is a power's size, the soonest first, the "+N" in a cell of its own at the end,* and the page's frames are drawn again over the cameos' edges the way the command grid's are. *///--------------------------------------------------------------------------------------------------void InGameUI::drawQueueTray( Int row )+void InGameUI::drawQueueTray( void ){const Real scale = ControlBarUniformScale();const IRegion2D button = commandButtonRect( 1 );@@ -12166,9 +12224,9 @@ void InGameUI::drawQueueTray( Int row )// a cameo wearing an "x5" stands for five, and the "+N" is what none of them showsInt shown = 0;- for( Int slot = 0; slot < m_productionStripCount[ row ]; slot++ )- shown += m_productionStrip[ row ][ slot ].quantity;- const Int cells = m_productionStripCount[ row ] + ( m_productionStripTotal[ row ] > shown ? 1 : 0 );+ for( Int slot = 0; slot < m_productionStripCount; slot++ )+ shown += m_productionStrip[ slot ].quantity;+ const Int cells = m_productionStripCount + ( m_productionStripTotal > shown ? 1 : 0 );IRegion2D cellsBox;cellsBox.lo.x = trayBorder;@@ -12212,7 +12270,7 @@ void InGameUI::drawQueueTray( Int row )m_queueOverlay->draw();TheDisplay->beginBatch2D();- drawProductionStripColumn( row, cellsBox.lo.x, cellsBox.lo.y );+ drawProductionStripColumn( cellsBox.lo.x, cellsBox.lo.y );TheDisplay->endBatch2D();values[ "layer" ] = "front";@@ -12246,16 +12304,9 @@ void InGameUI::drawProductionStrip( void )TheStripDrawMS = 0.0f;#endif- for( Int row = 0; row < PRODUCTION_STRIP_ROWS; row++ )- {- m_productionStripCount[ row ] = 0;- m_productionStripTotal[ row ] = 0;- m_productionStripRowColor[ row ] = 0;- }+ m_productionStripCount = 0;+ m_productionStripTotal = 0;- // switched off from the drop-down: nothing drawn, and with the counts at nought nothing to click- if( stripSwitchedOff( &GlobalData::m_showProductionStrip ) )- return;if( TheGameLogic == NULL || !TheGameLogic->isInGame() || TheGameLogic->isInShellGame() )return;@@ -12263,103 +12314,48 @@ void InGameUI::drawProductionStrip( void )if( player == NULL )return;+ // watching, everybody's queue is on his row of the Tab scoreboard, not down the left edge+ if( !player->isPlayerActive() )+ return;+//- // Watching rather than playing (an observer, or a player who has been knocked out and stayed- // to watch): the strip becomes every player's queue at once, one row each, wearing that- // player's colour. "Who is building what" is the question a spectator is actually asking, and- // it was the one thing the game never showed - the observer's own queue is empty, so the strip- // used to be blank for the whole match.+ // A single selected producer leads the column rather than getting one of its own: what the+ // building you are looking at is making is the front of the strip, and the rest of the base+ // follows it. It goes in before the sweep over everything else, and the sweep skips it, so+ // nothing is drawn or counted twice.//- m_productionStripWatching = !player->isPlayerActive();- if( m_productionStripWatching )+ ObjectID selected = INVALID_ID;+ if( getSelectCount() == 1 && !m_selectedDrawables.empty() ){- //- // Selecting somebody's unit narrows the whole screen to him - his rows here, his skills on- // the right, his side on the bar - and clicking empty ground puts the whole match back.- //- Player *only = TheControlBar ? TheControlBar->getSelectedPlayer() : NULL;-- Int row = 0;- for( Int i = 0; i < ThePlayerList->getPlayerCount() && row < PRODUCTION_STRIP_ROWS; i++ )+ Object *sel = m_selectedDrawables.front()->getObject();+ if( sel && sel->getControllingPlayer() == player ){- Player *p = ThePlayerList->getNthPlayer( i );- if( p == NULL || p == player || !p->isPlayerActive() || !p->isPlayableSide() )- continue;- if( only && p != only )- continue;-- ProductionStripGather watch;- watch.slot = m_productionStrip[ row ];- watch.count = &m_productionStripCount[ row ];- watch.total = &m_productionStripTotal[ row ];- // eight rows are on screen at once here, so each one is the few soonest and a "+N" -- // unless one player has the screen to himself, and then his row is as long as the- // playing strip's own column- watch.max = only ? PRODUCTION_STRIP_ROW_MAX : PRODUCTION_STRIP_WATCH_MAX;- watch.skip = INVALID_ID; // nothing is selected in somebody else's base- p->iterateObjects( gatherStripEverything, &watch );-- if( m_productionStripCount[ row ] > 0 )- {- m_productionStripRowColor[ row ] = clientPlayerColor( p );- row++; // a player with nothing queued gets no row rather than an empty one- }+ selected = sel->getID();+ appendProducerQueue( sel, m_productionStrip, &m_productionStripCount, PRODUCTION_STRIP_ROW_MAX,+ &m_productionStripTotal, TRUE );}}- else- {- //- // A single selected producer leads the column rather than getting one of its own: what the- // building you are looking at is making is the front of the strip, and the rest of the base- // follows it. It goes in before the sweep over everything else, and the sweep skips it, so- // nothing is drawn or counted twice.- //- ObjectID selected = INVALID_ID;- if( getSelectCount() == 1 && !m_selectedDrawables.empty() )- {- Object *sel = m_selectedDrawables.front()->getObject();- if( sel && sel->getControllingPlayer() == player )- {- selected = sel->getID();- appendProducerQueue( sel, m_productionStrip[ PRODUCTION_ROW_QUEUE ],- &m_productionStripCount[ PRODUCTION_ROW_QUEUE ],- PRODUCTION_STRIP_ROW_MAX,- &m_productionStripTotal[ PRODUCTION_ROW_QUEUE ],- TRUE );- }- }- //- // One sweep, one column: the queues and the buildings going up are gathered into the same- // cells and sorted against each other, so the strip is a single run of what the base has- // coming. A dozer raising a war factory now sits in the queue where its finishing time puts- // it instead of standing in a column of its own beside it.- //- ProductionStripGather gather;- gather.slot = m_productionStrip[ PRODUCTION_ROW_QUEUE ];- gather.count = &m_productionStripCount[ PRODUCTION_ROW_QUEUE ];- gather.total = &m_productionStripTotal[ PRODUCTION_ROW_QUEUE ];- gather.max = PRODUCTION_STRIP_ROW_MAX;- gather.skip = selected;- player->iterateObjects( gatherStripEverything, &gather );- }+ //+ // One sweep, one column: the queues and the buildings going up are gathered into the same+ // cells and sorted against each other, so the strip is a single run of what the base has+ // coming. A dozer raising a war factory now sits in the queue where its finishing time puts+ // it instead of standing in a column of its own beside it.+ //+ ProductionStripGather gather;+ gather.slot = m_productionStrip;+ gather.count = &m_productionStripCount;+ gather.total = &m_productionStripTotal;+ gather.max = PRODUCTION_STRIP_ROW_MAX;+ gather.skip = selected;+ player->iterateObjects( gatherStripEverything, &gather );#ifdef DEBUG_LOGGINGQueryPerformanceCounter( (LARGE_INTEGER *)&tGatherEnd );TheStripGatherMS = stripElapsedMS( tGatherStart, tGatherEnd );#endif- //- // The rows in use are closed up before they are placed: playing there is one of them, and- // watching, a player with nothing coming would otherwise leave a gap where his column stood.- //- Int used[ PRODUCTION_STRIP_ROWS ];- Int rowsUsed = 0;- for( Int row = 0; row < PRODUCTION_STRIP_ROWS; row++ )- if( m_productionStripCount[ row ] > 0 )- used[ rowsUsed++ ] = row;-- if( rowsUsed == 0 )+ if( m_productionStripCount == 0 )return;//@@ -12395,11 +12391,6 @@ void InGameUI::drawProductionStrip( void )// however deep the base's queue goes - across the bottom of the screen it used to run over the// battlefield instead. Cells step a whole tray, so none of them is clipped by the one above.//- // Watching, the vertical belongs to the players: one row per player, piled up from the bar, each- // row a few cameos running rightward from the left edge. Those close up by the six that bar- // closes its own slots by - its 35 pixel step between 41 pixel slots - so a row reads as one run- // of metal, and the rows themselves are a whole tray apart.- //const Int trayBelow = traySize.y - trayHole.y;const Int lowerY = barTop - trayBelow - stripPixels( PRODUCTION_STRIP_LIFT );@@ -12409,32 +12400,18 @@ void InGameUI::drawProductionStrip( void )m_queuePageLoaded = TRUE;readHtmlPage( QUEUE_PAGE, m_queuePage );}- m_productionStripThemed = !m_productionStripWatching && m_controlBarPageShown && !m_queuePage.empty();+ m_productionStripThemed = m_controlBarPageShown && !m_queuePage.empty();if( m_productionStripThemed )- drawQueueTray( used[ 0 ] );+ drawQueueTray();else{//// The strip is the busiest thing on the screen that is drawn a quad at a time, so it is drawn- // as a batch: the columns hand the display their pieces in an order that lets it gather the+ // as a batch: the column hands the display its pieces in an order that lets it gather the// ones asking for the same state into single draw calls. See Display::beginBatch2D.//TheDisplay->beginBatch2D();-- //- // Playing there is the one run and it stands on the edge. Watching, each player is a row of- // his own and the rows are piled up from the bar, the first of them lowest, so the vertical- // says who and the horizontal says what - a queue that grew upward as well would have nowhere- // to put the next player.- //- for( Int at = 0; at < rowsUsed; at++ )- {- const Int y = lowerY - at * traySize.y;- if( y - traySize.y < 0 )- continue;- drawProductionStripColumn( used[ at ], 0, y );- }-+ drawProductionStripColumn( 0, lowerY );TheDisplay->endBatch2D();}@@ -12457,42 +12434,36 @@ Bool InGameUI::handleProductionStripClick( const ICoord2D *mouse, Bool cancel )if( handleSpectatorPageClick( mouse, !cancel ) )return TRUE;- for( Int row = 0; row < PRODUCTION_STRIP_ROWS; row++ )+ for( Int i = 0; i < m_productionStripCount; i++ ){- for( Int i = 0; i < m_productionStripCount[ row ]; i++ )- {- const ProductionStripSlot *slot = &m_productionStrip[ row ][ i ];+ const ProductionStripSlot *slot = &m_productionStrip[ i ];- if( mouse->x < slot->pos.x || mouse->x >= slot->pos.x + m_productionStripCameoW ||- mouse->y < slot->pos.y || mouse->y >= slot->pos.y + m_productionStripCameoH )- continue;-- Object *producer = TheGameLogic->findObjectByID( slot->producer );- if( producer == NULL )- return TRUE; // the building died under the cursor - the click is still ours+ if( mouse->x < slot->pos.x || mouse->x >= slot->pos.x + m_productionStripCameoW ||+ mouse->y < slot->pos.y || mouse->y >= slot->pos.y + m_productionStripCameoH )+ continue;- if( cancel && !slot->isStructure && producer->isLocallyControlled() )- {- //- // the producer travels with the message: the strip cancels on buildings that are not- // selected, so the logic cannot work out whose queue this is otherwise- //- // Only ever our own: while watching, the rows are other people's queues, and a- // spectator's ctrl-click is a camera jump, not a cancel.- //- GameMessage *msg = TheMessageStream->appendMessage( slot->isUpgrade- ? GameMessage::MSG_CANCEL_UPGRADE- : GameMessage::MSG_CANCEL_UNIT_CREATE );- msg->appendIntegerArgument( slot->id );- msg->appendObjectIDArgument( slot->producer );- }- else- {- TheTacticalView->lookAt( producer->getPosition() );- }+ Object *producer = TheGameLogic->findObjectByID( slot->producer );+ if( producer == NULL )+ return TRUE; // the building died under the cursor - the click is still ours- return TRUE;+ if( cancel && !slot->isStructure && producer->isLocallyControlled() )+ {+ //+ // the producer travels with the message: the strip cancels on buildings that are not+ // selected, so the logic cannot work out whose queue this is otherwise+ //+ GameMessage *msg = TheMessageStream->appendMessage( slot->isUpgrade+ ? GameMessage::MSG_CANCEL_UPGRADE+ : GameMessage::MSG_CANCEL_UNIT_CREATE );+ msg->appendIntegerArgument( slot->id );+ msg->appendObjectIDArgument( slot->producer );+ }+ else+ {+ TheTacticalView->lookAt( producer->getPosition() );}++ return TRUE;}return FALSE;diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 29e67707c..147c6ad4c 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -9914,10 +9914,6 @@ TEST(the_production_strip_folds_a_long_queue_into_its_overflow){CHECK_EQ( 5, (Int)InGameUI::PRODUCTION_STRIP_ROW_MAX );- // while watching, eight columns share the screen at once, so a column there is never the taller- // one - and neither cap may outrun the slots the strip has room to remember- CHECK( (Int)InGameUI::PRODUCTION_STRIP_WATCH_MAX <= (Int)InGameUI::PRODUCTION_STRIP_ROW_MAX );-//// The column, its overflow cell included, has to stand inside the 600 the layout is written in// with room to spare for the control bar it stands on: it grows upward out of the corner, and a@@ -10033,19 +10029,6 @@ TEST(a_stacked_tray_does_not_lie_over_the_one_below_it)const Int pileHeight = rows * (Int)InGameUI::PRODUCTION_STRIP_TRAY_H;CHECK( pileHeight < 600 / 2 );- //- // Watching, the vertical is the players: a row each, a whole tray apart, piled up off the bottom- // of the screen. Eight of them have to leave the top of a 600 tall screen alone, and a row -- // the few soonest plus the tray the "+N" closes it with - has to stay well inside 800 across,- // since it is drawn over the battlefield rather than over a bar.- //- const Int watchPile = (Int)InGameUI::PRODUCTION_STRIP_ROWS * (Int)InGameUI::PRODUCTION_STRIP_TRAY_H;- CHECK( watchPile < 2 * 600 / 3 );-- const Int watchWidth = ( (Int)InGameUI::PRODUCTION_STRIP_WATCH_MAX + 1 )- * (Int)InGameUI::PRODUCTION_STRIP_TRAY_W;- CHECK( watchWidth < 800 / 2 );-const Int rowWidth = (Int)InGameUI::SUPERWEAPON_STRIP_COLS * (Int)InGameUI::PRODUCTION_STRIP_TRAY_W;CHECK( rowWidth < 800 );}@@ -10053,13 +10036,9 @@ TEST(a_stacked_tray_does_not_lie_over_the_one_below_it)/* Buildings going up on the map are not in anybody's queue - they are objects standing on theground with a percentage on them - but they land in the same column as the queued items, sortedagainst them on the one thing the two kinds share: how long each still has. The comparison the- column is built with is therefore blind to which kind a slot is, and there is one row while- playing, at the front of the array. */+ column is built with is therefore blind to which kind a slot is. */TEST(the_buildings_going_up_stand_in_the_queue_column){- CHECK_EQ( 0, (Int)InGameUI::PRODUCTION_ROW_QUEUE );- CHECK( (Int)InGameUI::PRODUCTION_ROW_QUEUE < (Int)InGameUI::PRODUCTION_STRIP_ROWS );-// a site three seconds out goes in front of a tank ten seconds out, and not the other way roundCHECK( InGameUI::stripSlotGoesBefore( FALSE, 90, FALSE, 300 ) );CHECK( !InGameUI::stripSlotGoesBefore( FALSE, 300, FALSE, 90 ) );@@ -13746,7 +13725,8 @@ TEST(the_spectator_page_names_only_on_off_options)CHECK( option != NULL && option->kind == OPTION_BOOL );options++;}- CHECK_EQ( options, 3 );+ // the promotions and the superweapon countdowns; the production queues are on the Tab scoreboard+ CHECK_EQ( options, 2 );CHECK( page.find( "id=\"hud-top\"" ) != std::string::npos );CHECK( page.find( "data-each=\"players\"" ) != std::string::npos );}diff --git a/GeneralsMD/Code/Tests/test_production_input.inc b/GeneralsMD/Code/Tests/test_production_input.incindex ccaecd6e8..3de3cecd9 100644--- a/GeneralsMD/Code/Tests/test_production_input.inc+++ b/GeneralsMD/Code/Tests/test_production_input.inc@@ -87,10 +87,9 @@ class ProductionStripTestUI : public CameraTestUIpublic:void staleCameo(){- for(Int row = 0; row < PRODUCTION_STRIP_ROWS; ++row) m_productionStripCount[row] = 0;m_productionStripCameoW = m_productionStripCameoH = 40;- m_productionStripCount[0] = 1;- ProductionStripSlot &slot = m_productionStrip[0][0];+ m_productionStripCount = 1;+ ProductionStripSlot &slot = m_productionStrip[0];slot.producer = INVALID_ID; // producer died after the last draw; the strip still owns the clickslot.pos.x = slot.pos.y = 20;}