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
fix(gameclient): stop an enemy's portrait telling his research
Olcay Seygan0944d90236a1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e4555ec9b..ac22e7b10 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -23,7 +23,7 @@ found and fixed — EA's own, not port damage.**- The command bar is one console standing in the middle of the bottom edge: a taller radar, your selection and the build grid side by side, with the power bar over the grid. The idle worker and rank keys sit in a row over your selection, and in multiplayer the smoke signals join them. The red under-attack lamp is gone: the ping on the radar, the voice and the line in the event feed already tell you where you are hit, and the lamp only blinked about it a second time.- Your general's powers grow out of the console's right end, a column for each F key with its powers stacked up it, and only the powers you have take any room.-- A single unit's name and health stand beside its portrait, and a veteran gets his gold stars there too. Under them sit its main weapon's damage, damage a second and range, and what its armour does to gunfire, tank shells and rockets: green for less damage taken, red for more. Your own units and your allies' show as they stand, so a veteran's bonus, a Composite Armor upgrade or Hold the Line shows the moment it lands. An enemy's show only what his veterancy stars already tell you, never his upgrades or battle plans. A group shows every type it holds in the same box, five to a row. Watching a match with nothing selected, the empty portrait box is gone and the console is the radar alone; click a unit and the box comes back. Following nobody, the experience bar beside the radar is gone too, since there is no general's rank to fill it.+- A single unit's name and health stand beside its portrait, and a veteran gets his gold stars there too. Under them sit its main weapon's damage, damage a second and range, and what its armour does to gunfire, tank shells and rockets: green for less damage taken, red for more. Your own units and your allies' show as they stand, so a veteran's bonus, a Composite Armor upgrade or Hold the Line shows the moment it lands. An enemy's show only what his veterancy stars already tell you, never his upgrades or battle plans. Click an enemy and his health reads as a share, 64%, because 512/800 would tell you he bought Composite Armor; the upgrade icons under his portrait stay grey for everything his side researched, where retail lit Composite Armor or Supply Lines for anyone who clicked, and light only for what the unit visibly carries, a drone or an Overlord's turret. A group shows every type it holds in the same box, five to a row. Watching a match with nothing selected, the empty portrait box is gone and the console is the radar alone; click a unit and the box comes back. Following nobody, the experience bar beside the radar is gone too, since there is no general's rank to fill it.- The match clock hangs from the middle of the top edge with your money in its own box under it. Superweapon countdowns in the top right corner are as big as your general's power buttons. Hold Tab and the scoreboard drops down from it.- Peace time has its own plate under your money, so the truce clock never pushes the match clock aside. When the last ten seconds start, the countdown hangs straight off that plate.- A superweapon built, charged or fired anywhere on the map flashes its name in big letters under the clock: "Nuclear Missile launched". Yours are white, an ally's blue, an enemy's red. Each line stays four seconds and fades out. When several land at once they queue and hurry through, two seconds each with one more waiting and one second with a pile behind it, so the last news never sits stale.diff --git a/GeneralsMD/Code/Data/Window/Html/Readout.html b/GeneralsMD/Code/Data/Window/Html/Readout.htmlindex 0f37ab4c2..015e84d2d 100644--- a/GeneralsMD/Code/Data/Window/Html/Readout.html+++ b/GeneralsMD/Code/Data/Window/Html/Readout.html@@ -15,7 +15,7 @@{{peace.time}} m:ss, empty for the last ten seconds, which the gamecounts out under the plate{{selinfo.x}} .y .w .h the column beside a lone unit's portrait, {{selinfo.shown}} the same;- {{sel.health}} "820/1000", {{sel.healthw}} the bar's lit length out of+ {{sel.health}} "820/1000", "82%" for an enemy's, {{sel.healthw}} the bar's lit length out ofselinfo.w, {{sel.healthstate}} "green", "yellow" or "red", and{{sel.healthshown}} "hidden" for an enemy in disguiseIn the page's pixels, laid out at ControlBarHudScale() as the bar's page is.diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex 7d64b55f8..66f11b4f1 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -5438,6 +5438,13 @@ void ControlBar::setPortraitByObject( Object *obj )m_rightHUDWindow->winClearStatus( WIN_STATUS_IMAGE );m_rightHUDCameoWindow->winSetStatus( WIN_STATUS_IMAGE );+ // a player's upgrades are his research, which nobody else can see on the battlefield, so they+ // light only for the local player, his allies and a watcher; an enemy's or a neutral's portrait+ // lights only what the unit carries itself, its drones and add-ons. Retail lit them all+ Player *local = ThePlayerList->getLocalPlayer();+ const Bool researchShown = player && ( !local->isPlayerActive() || player == local+ || local->getRelationship( player->getDefaultTeam() ) == ALLIES );+for(Int i = 0; i < MAX_UPGRADE_CAMEO_UPGRADES; ++i){AsciiString upgradeName = thing->getUpgradeCameoName(i);@@ -5461,7 +5468,7 @@ void ControlBar::setPortraitByObject( Object *obj )//Object level upgradesm_rightHUDUpgradeCameos[i]->winEnable( TRUE );}- else if( player && player->hasUpgradeComplete( ut ) )+ else if( researchShown && player->hasUpgradeComplete( ut ) ){//Player level upgradesm_rightHUDUpgradeCameos[i]->winEnable( TRUE );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex ed889a954..b94fadafd 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -11935,7 +11935,7 @@ static void putFigureColumn( std::vector< HtmlValues > &columns, Int column, con/** A lone unit's name, rank, health, main weapon and armour for the page, beside its portrait* `portrait` in the selection's well `well`: {{selinfo.x}} .y .w .h, {{sel.name}},- * data-each="selstars" a star for each veterancy level it has, {{sel.health}} "820/1000",+ * data-each="selstars" a star for each veterancy level it has, {{sel.health}} "820/1000" or "82%",* {{sel.healthw}} the bar's lit width in page pixels out of selinfo.w, {{sel.healthstate}} "green",* "yellow" or "red", data-each="selweapon" the main weapon's damage, damage a second and range and* data-each="selarmor" what its armour does to each of SHOWN_ARMOR, "-75%". Both are the object's@@ -11987,20 +11987,23 @@ static void putSelectedUnit( HtmlValues &values, HtmlLists &lists, const IRegionstars.push_back( star );}+ // a unit of the local player's or an ally's shows its figures as they stand; anybody else's only+ // with the veterancy his stars show already, since his upgrades, battle plans and horde are what+ // he has researched and planned. A watcher is in nobody's match and sees everything+ const Player *local = ThePlayerList->getLocalPlayer();+ const Bool ours = localPlayerWatching() || object->getControllingPlayer() == local+ || local->getRelationship( object->getTeam() ) == ALLIES;++ // an enemy's health as a share of his whole: the whole is research too, Composite Armor and the+ // armour upgrades raise it, and the bar over the unit only ever showed the shareconst BodyModuleInterface *body = object->getBodyModule();const Int health = (Int)REAL_TO_INT_CEIL( body->getHealth() );const Int maxHealth = max( 1, (Int)REAL_TO_INT_CEIL( body->getMaxHealth() ) );const Int percent = health * PERCENT / maxHealth;- values[ "sel.health" ] = std::to_string( health ) + "/" + std::to_string( maxHealth );+ values[ "sel.health" ] = ours ? std::to_string( health ) + "/" + std::to_string( maxHealth ) : std::to_string( percent ) + "%";values[ "sel.healthw" ] = std::to_string( atoi( values[ "selinfo.w" ].c_str() ) * health / maxHealth );values[ "sel.healthstate" ] = percent <= HEALTH_RED_PERCENT ? "red" : percent <= HEALTH_YELLOW_PERCENT ? "yellow" : "green";- // a unit of the local player's or an ally's shows its figures as they stand; anybody else's only- // with the veterancy his stars show already, since his upgrades, battle plans and horde are what- // he has researched and planned. A watcher is in nobody's match and sees everything- const Player *local = ThePlayerList->getLocalPlayer();- const Bool ours = localPlayerWatching() || object->getControllingPlayer() == local- || local->getRelationship( object->getTeam() ) == ALLIES;UnitFigures figures = {};if( ours ){