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): draw the spectator stats the way dota draws them
Olcay Seyganb20d75e8b564
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e4e748b56..c0adce11a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -478,10 +478,10 @@ found and fixed — EA's own, not port damage.**- 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, every player's net worth is on screen under the strips drop-down, the way Dota shows it: richest first, the general's portrait, the number, and a bar measured against the richest player, 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. Net worth is the cash in hand plus what everything the player has standing would cost to build again, counted twice a second. Click the minus to fold it away.-- The number that list ranks by is yours to pick, as in Dota's game stats. Click its title and it opens into 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.-- Under it, a graph of the net worth lead since the first minute: green above the line while the first team is ahead, red below while the second is, with how far ahead the leader is right now. It appears in any match with two sides.-- An armies chart, closed until you open it: every player's six most expensive kinds of unit, with how many of each he has on the field.+- Watching, every player's net worth is on screen under the strips drop-down, the way Dota shows it: richest first, the general's portrait, the number in gold, and a thin line measured against the richest player that ends in a bright dot, 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. Net worth is the cash in hand plus what everything the player has standing would cost to build again, counted twice a second.+- The number that list ranks by is yours to pick, as in Dota's game stats. Click the dark bar above the list and it opens into 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 first of the two square buttons beside that bar opens a graph of the net worth lead since the first minute: green above the line while the first team is ahead, red below while the second is, with how far ahead the leader is right now. It needs a match with two sides.+- The second opens the armies chart: every player's six most expensive kinds of unit, with how many of each he has on the field.- Both are an ordinary web page with a stylesheet, in the game's Window folder. Change the colours, the sizes or the order there and the next match you watch draws it that way, and the page opens in a browser too.- A minimised command bar stays minimised. Changing seats, or clicking another player's unit while watching, put the whole bar back up over the battlefield you had just cleared. A new match still opens with the bar up.diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex 912ce0778..baa71cd21 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -1059,7 +1059,11 @@ GUI:HudNetWorth"Net worth"END-// the other numbers the spectator's drop-down can rank every player by+// the heading of the spectator's stat drop-down, and the other numbers it can rank every player by+GUI:HudGameStats+"Game stats"+END+GUI:HudStatCash"Cash"ENDdiff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex 5fce93c06..269afae80 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -15589,6 +15589,10 @@ GUI:HudNetWorth"Net değer"END+GUI:HudGameStats+"Oyun istatistikleri"+END+GUI:HudStatCash"Nakit"ENDdiff --git a/GeneralsMD/Code/Data/Window/Html/Spectator.html b/GeneralsMD/Code/Data/Window/Html/Spectator.htmlindex c5d6262bc..9c948b08d 100644--- a/GeneralsMD/Code/Data/Window/Html/Spectator.html+++ b/GeneralsMD/Code/Data/Window/Html/Spectator.html@@ -1,14 +1,16 @@<!DOCTYPE html><!--What a spectator sees over the battlefield, down the left edge the way Dota's spectator has it:- the drop-down that switches the strips, every player ranked by a number picked from a second- drop-down, the net worth lead over the match, and what each army is made of. Laid out by- litehtml and drawn by the game (GameClient/HtmlOverlay.h).+ the drop-down that switches the strips, and Dota's stats drop-down - a dark bar naming the stat,+ two square buttons beside it for the lead graph and the armies chart, and under it one row per+ player with no box behind it: portrait, the number in gold, and a thin line in the team's colour+ ending in a bright dot. Laid out by litehtml and drawn by the game (GameClient/HtmlOverlay.h).A CSS pixel is a pixel of an 800x600 screen and font-size is the game font's point size there;- the page is scaled with the rest of the interface. A background on html or body is for a- browser only. Not drawn: rounded corners, overflow clipping, list bullets, gradients other- than linear ones.+ the page is scaled with the rest of the interface. Text is always drawn with a black shadow.+ A background on html or body is for a browser only. Not drawn: rounded corners, overflow+ clipping, list bullets, gradients other than linear ones, and text-transform on anything but+ plain ASCII letters.The game fills in, before layout (GameClient/HtmlTemplate.h):{{option:Key}} "on" while that Options.ini on/off option is on@@ -40,67 +42,68 @@<title>Spectator</title><style>html, body { margin: 0; padding: 0; }- body { background-color: #3b4a36; color: #e8e8e8; font-size: 9px; }-- #hud-top { position: absolute; left: 6px; top: 6px; width: 150px; }-- .panel { background-color: rgba(8, 12, 16, 0.78); border-top: 1px solid #45525c; margin-bottom: 4px; padding-bottom: 2px; }- .head { padding: 2px 4px; color: #aab6bf; }- .head:hover { color: #ffffff; }- .fold { display: inline-block; width: 8px; margin-right: 2px; }- .fold::before { content: "-"; }- .flipped > .head .fold::before { content: "+"; }- .flipped > .body { display: none; }- .opens > .head .fold::before { content: "+"; }- .opens.flipped > .head .fold::before { content: "-"; }- .opens > .body { display: none; }- .opens.flipped > .body { display: block; }-- .menu { background-color: rgba(0, 0, 0, 0.6); margin-bottom: 4px; }- .row { padding: 2px 3px; }- .row:hover { background-color: rgba(255, 255, 255, 0.12); }- .items { display: none; }- .menu.flipped .items { display: block; }- .box { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border: 1px solid #c8c8c8;- text-align: center; line-height: 8px; vertical-align: middle; }- .on .box { background-color: #5ac85a; }- .menu .sign::before { content: "+"; }- .menu.flipped .sign::before { content: "-"; }-- .picker { color: #e8c865; }- .picker:hover { color: #ffffff; }- .picker::after { content: " v"; }- .choices { display: none; background-color: rgba(0, 0, 0, 0.85); border: 1px solid #45525c; margin: 0 2px 2px 2px; }- .body.flipped .choices { display: block; }- .choice { padding: 2px 6px; color: #aab6bf; }- .choice:hover { background-color: rgba(255, 255, 255, 0.12); color: #ffffff; }- .choice.on { color: #e8c865; }-- .player { height: 14px; margin: 1px 2px; }- .portrait { float: left; width: 22px; height: 14px; border-left: 2px solid #888888; }- .track { position: relative; height: 14px; margin-left: 27px; background-color: rgba(255, 255, 255, 0.05); }- .bar { position: absolute; left: 0; top: 0; height: 14px; }- .teams2.team0 .bar { background: linear-gradient(to right, #2f6b21, #72cf4b); }- .teams2.team1 .bar { background: linear-gradient(to right, #7a1d17, #e2553f); }- .name { position: absolute; left: 3px; top: 0; line-height: 14px; color: #ffffff; }- .value { position: absolute; right: 3px; top: 0; line-height: 14px; font-weight: bold; color: #ffffff; }-- .graph { display: none; }- .graph.shown { display: block; }- .lead { float: right; font-weight: bold; }- .team0 .lead { color: #72cf4b; }- .team1 .lead { color: #e2553f; }- .chart { height: 36px; margin: 1px 3px 0 3px; background-color: rgba(255, 255, 255, 0.05); }+ body { background-color: #3b4a36; color: #d6dde2; font-size: 9px; }++ #hud-top { position: absolute; left: 4px; top: 4px; width: 160px; }++ /* Dota's bars: dark, a hair of border, the words in a cool grey */+ .bar { background-color: rgba(18, 22, 26, 0.88); border: 1px solid #3b444c; color: #c3ccd3; }+ .bar:hover { border-color: #6b7780; color: #ffffff; }++ .strips { margin-bottom: 3px; }+ .strips .bar { padding: 2px 5px; }+ .strips .items { display: none; background-color: rgba(18, 22, 26, 0.88); border: 1px solid #3b444c; border-top: 0; }+ .strips.flipped .items { display: block; }+ .row { padding: 2px 5px; }+ .row:hover { background-color: rgba(255, 255, 255, 0.08); color: #ffffff; }+ .box { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border: 1px solid #8a959d; vertical-align: middle; }+ .on .box { background-color: #6dbf3b; border-color: #a6f05a; }++ .tools { height: 15px; margin-bottom: 2px; }+ .picker { float: left; width: 112px; height: 13px; line-height: 13px; padding-left: 5px; position: relative; }+ .arrow { position: absolute; right: 5px; top: 0; font-size: 7px; }+ .button { float: left; position: relative; width: 15px; height: 13px; margin-left: 2px; }+ .button.flipped { background-color: rgba(70, 82, 92, 0.95); border-color: #8a959d; }+ .glyph { position: absolute; background-color: #aeb8bf; }+ .button:hover .glyph, .button.flipped .glyph { background-color: #ffffff; }++ .choices { display: none; background-color: rgba(12, 15, 18, 0.94); border: 1px solid #3b444c; margin-bottom: 3px; width: 152px; }+ .flipped > .choices { display: block; }+ .caption { padding: 3px 6px 2px 6px; color: #7d8a93; font-size: 8px; }+ .choice { padding: 2px 6px; color: #c3ccd3; }+ .choice:hover { background-color: rgba(255, 255, 255, 0.08); color: #ffffff; }+ .choice.on { background-color: rgba(120, 132, 142, 0.35); color: #ffffff; }++ .player { position: relative; height: 13px; margin-bottom: 1px; }+ .portrait { position: absolute; left: 0; top: 0; width: 20px; height: 13px; border-left: 2px solid #888888; }+ .value { position: absolute; left: 25px; top: 0; line-height: 13px; font-weight: bold; color: #f0b43c; }+ .track { position: absolute; left: 62px; top: 6px; width: 90px; height: 2px; }+ .line { position: relative; height: 2px; background-color: #9aa4ab; }+ .dot { position: absolute; right: -2px; top: -1px; width: 4px; height: 4px; background-color: #ffffff; }+ .teams2.team0 .line { background: linear-gradient(to right, #3f7a1e, #6dbf3b); }+ .teams2.team0 .dot { background-color: #a6f05a; }+ .teams2.team1 .line { background: linear-gradient(to right, #7a1d17, #c8402f); }+ .teams2.team1 .dot { background-color: #ff6a50; }++ .panel { display: none; background-color: rgba(12, 15, 18, 0.88); border: 1px solid #3b444c; margin-top: 4px; width: 152px; }+ .panel.flipped { display: block; }+ .graph.flipped { display: none; }+ .graph.flipped.shown { display: block; }+ .title { padding: 2px 5px; color: #7d8a93; font-size: 8px; }+ .lead { float: right; font-size: 9px; font-weight: bold; }+ .team0 .lead { color: #a6f05a; }+ .team1 .lead { color: #ff6a50; }+ .chart { height: 36px; margin: 0 4px 4px 4px; }.col { float: left; width: 3px; height: 36px; }.half { position: relative; height: 18px; }- .over { border-bottom: 1px solid #45525c; height: 17px; }- .up { position: absolute; left: 0; right: 0; bottom: 0; background-color: #72cf4b; }- .down { position: absolute; left: 0; right: 0; top: 0; background-color: #e2553f; }+ .over { border-bottom: 1px solid #4b555d; height: 17px; }+ .up { position: absolute; left: 0; right: 0; bottom: 0; background-color: #6dbf3b; }+ .down { position: absolute; left: 0; right: 0; top: 0; background-color: #c8402f; }- .army { overflow: hidden; padding: 0 2px; }+ .army { overflow: hidden; padding: 0 3px 3px 3px; }.cell { float: left; position: relative; width: 18px; height: 15px; margin: 1px 1px 0 0; }.cell img { width: 18px; height: 15px; }- .cell.head { clear: left; width: 20px; padding: 0; border-left: 2px solid #888888; }+ .cell.head { clear: left; width: 20px; border-left: 2px solid #888888; margin-right: 3px; }.cell.head img { width: 20px; }.count { position: absolute; right: 1px; bottom: 0; font-size: 8px; font-weight: bold; color: #ffffff; }</style>@@ -108,8 +111,8 @@<body><div id="hud-top">- <div class="menu {{flip:strips}}">- <div class="row" data-click="flip:strips"><span class="box sign"></span>{{text:GUI:HudToggles}}</div>+ <div class="strips {{flip:strips}}">+ <div class="bar" data-click="flip:strips"><span class="box"></span>{{text:GUI:HudToggles}}</div><div class="items"><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>@@ -117,37 +120,43 @@</div></div>- <div class="panel {{flip:statsfold}}">- <div class="head">- <span class="fold" data-click="flip:statsfold"></span><span class="picker" data-click="flip:stat">{{stat}}</span>+ <div class="tools">+ <div class="bar picker" data-click="flip:stat">{{stat}}<span class="arrow">▼</span></div>+ <div class="bar button {{flip:graph}}" data-click="flip:graph">+ <div class="glyph" style="left: 3px; top: 7px; width: 2px; height: 4px"></div>+ <div class="glyph" style="left: 6px; top: 3px; width: 2px; height: 8px"></div>+ <div class="glyph" style="left: 9px; top: 5px; width: 2px; height: 6px"></div></div>- <div class="body {{flip:stat}}">- <div class="choices">- <div class="choice {{pick:stat:networth}}" data-click="pick:stat:networth">{{text:GUI:HudNetWorth}}</div>- <div class="choice {{pick:stat:cash}}" data-click="pick:stat:cash">{{text:GUI:HudStatCash}}</div>- <div class="choice {{pick:stat:income}}" data-click="pick:stat:income">{{text:GUI:HudStatIncome}}</div>- <div class="choice {{pick:stat:army}}" data-click="pick:stat:army">{{text:GUI:HudStatArmy}}</div>- <div class="choice {{pick:stat:kills}}" data-click="pick:stat:kills">{{text:GUI:HudStatKills}}</div>- <div class="choice {{pick:stat:rank}}" data-click="pick:stat:rank">{{text:GUI:HudStatRank}}</div>- <div class="choice {{pick:stat:power}}" data-click="pick:stat:power">{{text:GUI:HudStatPower}}</div>- </div>- <div class="player teams{{teams}} team{{team}}" data-each="players">- <img class="portrait" src="{{portrait}}" style="border-color: {{color}}">- <div class="track">- <div class="bar" style="width: {{share}}%; background-color: {{color}}"></div>- <span class="name">{{name}}</span>- <span class="value">{{value}}</span>- </div>- </div>+ <div class="bar button {{flip:army}}" data-click="flip:army">+ <div class="glyph" style="left: 3px; top: 2px; width: 4px; height: 4px"></div>+ <div class="glyph" style="left: 8px; top: 2px; width: 4px; height: 4px"></div>+ <div class="glyph" style="left: 3px; top: 7px; width: 4px; height: 4px"></div>+ <div class="glyph" style="left: 8px; top: 7px; width: 4px; height: 4px"></div></div></div>- <div class="panel graph {{graph}} {{flip:graphfold}}">- <div class="head {{leader}}">- <span class="fold" data-click="flip:graphfold"></span>{{text:GUI:HudNetWorthLead}}- <span class="lead">{{lead}}</span>+ <div class="{{flip:stat}}">+ <div class="choices">+ <div class="caption">{{text:GUI:HudGameStats}}</div>+ <div class="choice {{pick:stat:networth}}" data-click="pick:stat:networth">{{text:GUI:HudNetWorth}}</div>+ <div class="choice {{pick:stat:cash}}" data-click="pick:stat:cash">{{text:GUI:HudStatCash}}</div>+ <div class="choice {{pick:stat:income}}" data-click="pick:stat:income">{{text:GUI:HudStatIncome}}</div>+ <div class="choice {{pick:stat:army}}" data-click="pick:stat:army">{{text:GUI:HudStatArmy}}</div>+ <div class="choice {{pick:stat:kills}}" data-click="pick:stat:kills">{{text:GUI:HudStatKills}}</div>+ <div class="choice {{pick:stat:rank}}" data-click="pick:stat:rank">{{text:GUI:HudStatRank}}</div>+ <div class="choice {{pick:stat:power}}" data-click="pick:stat:power">{{text:GUI:HudStatPower}}</div></div>- <div class="body chart">+ </div>++ <div class="player teams{{teams}} team{{team}}" data-each="players">+ <img class="portrait" src="{{portrait}}" style="border-color: {{color}}">+ <span class="value">{{value}}</span>+ <div class="track"><div class="line" style="width: {{share}}%; background-color: {{color}}"><div class="dot"></div></div></div>+ </div>++ <div class="panel graph {{graph}} {{flip:graph}}">+ <div class="title {{leader}}">{{text:GUI:HudNetWorthLead}}<span class="lead">{{lead}}</span></div>+ <div class="chart"><div class="col" data-each="lead"><div class="half over"><div class="up" style="height: {{up}}%"></div></div><div class="half"><div class="down" style="height: {{down}}%"></div></div>@@ -155,9 +164,9 @@</div></div>- <div class="panel opens {{flip:armyfold}}">- <div class="head" data-click="flip:armyfold"><span class="fold"></span>{{text:GUI:HudArmies}}</div>- <div class="body army">+ <div class="panel {{flip:army}}">+ <div class="title">{{text:GUI:HudArmies}}</div>+ <div class="army"><div class="cell {{kind}}" data-each="army" style="border-color: {{color}}"><img src="{{image}}"><span class="count">{{count}}</span>