Skip to content

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

fix(gameclient): keep the portrait figures apart in the game's font

Olcay Seygan88a1ea43fe8c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 42ec55b0f..a4bb696dd 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, rockets and blasts: 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. 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/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 12e84bab7..6bf62364b 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -1234,8 +1234,8 @@ TOOLTIP:StatNewWeaponFigures
"%d damage, %d range"
END
-// Beside a lone unit's portrait, short enough for a column of a quarter of it: damage a second,
-// and the armour's change to four kinds of damage.
+// Beside a lone unit's portrait, short enough for a column of a third of it: damage a second,
+// and the armour's change to three kinds of damage.
TOOLTIP:StatShortDamagePerSecond
"DPS"
@@ -1253,10 +1253,6 @@ TOOLTIP:StatVsRockets
"Rocket"
END
-TOOLTIP:StatVsBlast
-"Blast"
-END
-
// Under the figures: a unit's upgrades, or on an upgrade's card the units it changes.
TOOLTIP:Upgrades
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 36ef35f4a..712c47361 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -15810,7 +15810,7 @@ TOOLTIP:StatNewWeaponFigures
END
TOOLTIP:StatShortDamagePerSecond
-"Hasar/sn"
+"DPS"
END
TOOLTIP:StatVsGuns
@@ -15825,10 +15825,6 @@ TOOLTIP:StatVsRockets
"Roket"
END
-TOOLTIP:StatVsBlast
-"Bomba"
-END
-
TOOLTIP:Upgrades
"GELİŞTİRMELER"
END
diff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
index 14a86e9eb..7b9c15481 100644
--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html
+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
@@ -59,7 +59,7 @@
at {{x}} from the right for each veterancy level, the health bar's dark
groove, {{sel.healthshown}} "hidden" for an enemy in disguise, and
data-each="selweapon" the main weapon's damage, damage a second and
- range and data-each="selarmor" the armour's change to four kinds of
+ range and data-each="selarmor" the armour's change to three kinds of
damage, each at {{x}} with {{label}} over {{value}} and {{state}}
"strong", "weak" or nothing; both empty for a disguise, the weapon's
for an unarmed unit. The health's figure and its lit length are
@@ -194,18 +194,20 @@
its veterancy as gold stars at the right hand end of that figure's line, and then two rows of
figures, a small grey label over each: its main weapon's, and what its armour does to the damage
most of the fighting deals, green where it takes less and red where it takes more. The column
- beside the portrait is 108 by 70 page pixels, so the name takes two lines and every row is cut to
- the pixel to fit */
- .selinfo .name { position: absolute; left: 0; top: 0; height: 20px; line-height: 10px; font-size: 9px; font-weight: bold;
+ beside the portrait is 108 by 78 page pixels from just under the well's top, so the name takes
+ two lines and every row is cut to the pixel to fit. The game's 9 pixel bold font sets a name's
+ letters 10 high and its 7 pixel font a label's 8, so a name's line is 11, a label's 8, and its
+ figure starts a pixel under that */
+ .selinfo .name { position: absolute; left: 0; top: 0; height: 22px; line-height: 11px; font-size: 9px; font-weight: bold;
color: #f1f4f6; }
- .selinfo .vet { position: absolute; top: 27px; width: 9px; height: 9px; background-size: 100% 100%;
+ .selinfo .vet { position: absolute; top: 29px; width: 9px; height: 9px; background-size: 100% 100%;
background-repeat: no-repeat; background-image: url(Icons/RankStar.svg); }
- .selinfo .health { position: absolute; left: 0; top: 21px; height: 4px; background-color: #0d1512; border-bottom: 1px solid #3f4650; }
- .selinfo .figure { position: absolute; height: 16px; white-space: nowrap; }
- .selinfo .weapon { top: 37px; }
- .selinfo .armor { top: 54px; }
- .selinfo .figure .label { position: absolute; left: 0; top: 0; height: 7px; line-height: 7px; font-size: 7px; color: #8a949f; }
- .selinfo .figure .value { position: absolute; left: 0; top: 7px; height: 9px; line-height: 9px; font-size: 8px; font-weight: bold; color: #f1f4f6; }
+ .selinfo .health { position: absolute; left: 0; top: 23px; height: 4px; background-color: #0d1512; border-bottom: 1px solid #3f4650; }
+ .selinfo .figure { position: absolute; height: 18px; white-space: nowrap; }
+ .selinfo .weapon { top: 40px; }
+ .selinfo .armor { top: 60px; }
+ .selinfo .figure .label { position: absolute; left: 0; top: 0; height: 8px; line-height: 8px; font-size: 7px; color: #8a949f; }
+ .selinfo .figure .value { position: absolute; left: 0; top: 9px; height: 9px; line-height: 9px; font-size: 8px; font-weight: bold; color: #f1f4f6; }
.selinfo .figure.strong .value { color: #7fd36a; }
.selinfo .figure.weak .value { color: #ef6a4c; }
diff --git a/GeneralsMD/Code/Data/Window/Html/Readout.html b/GeneralsMD/Code/Data/Window/Html/Readout.html
index 59b7d7816..0f37ab4c2 100644
--- a/GeneralsMD/Code/Data/Window/Html/Readout.html
+++ b/GeneralsMD/Code/Data/Window/Html/Readout.html
@@ -41,10 +41,10 @@
/* the health over ControlBar.html's groove, which stands at the same place, and its figure on the
line under it, whose right hand end holds that page's veterancy stars */
- .fill { position: absolute; left: 0; top: 21px; height: 4px; background-color: #3fbf3f; }
+ .fill { position: absolute; left: 0; top: 23px; height: 4px; background-color: #3fbf3f; }
.fill.yellow { background-color: #e8c83a; }
.fill.red { background-color: #d8402a; }
- .figure { position: absolute; left: 0; top: 27px; height: 9px; line-height: 9px; color: #c9d2d9; }
+ .figure { position: absolute; left: 0; top: 29px; height: 9px; line-height: 9px; color: #c9d2d9; }
</style>
</head>
<body>
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
index c67563534..fffad475e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
@@ -187,12 +187,16 @@ static void findUpgradeEffects( const ThingTemplate *thing, UpgradeEffects &effe
//-------------------------------------------------------------------------------------------------
/** A clip fires its shots a delay apart and then reloads in place of the last delay. A weapon that
- * does no damage, the dummies that hold a slot until an upgrade fills it, is none. */
+ * does no damage, the dummies that hold a slot until an upgrade fills it, is none, and so is one
+ * that heals, clears or unloads: a dozer's mine disarming "weapon" does 1 damage at a range of 5
+ * so that it can be aimed, and an Ambulance's cleanup is the same. */
//-------------------------------------------------------------------------------------------------
WeaponFigures ControlBarWeaponFigures( const WeaponTemplate *weapon, const WeaponBonus &bonus )
{
WeaponFigures figure = {};
- if( weapon->getDamageType() == DAMAGE_HEALING || !IsHealthDamagingDamage( weapon->getDamageType() ) )
+ const DamageType type = weapon->getDamageType();
+ if( type == DAMAGE_HEALING || type == DAMAGE_DISARM || type == DAMAGE_HAZARD_CLEANUP || type == DAMAGE_DEPLOY
+ || !IsHealthDamagingDamage( type ) )
return figure;
const Real damage = weapon->getPrimaryDamage( bonus );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 1ded395fa..ed889a954 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -11907,23 +11907,27 @@ static void putWell( std::vector< HtmlValues > &wells, size_t &filled, const IRe
putPageRect( entry, "header", wellHeader( well, scale ), headed, scale );
}
-/** The damage a lone unit's armour is shown against, what most of the fighting deals, each under its
- * label in the string table. */
+/** The damage a lone unit's armour is shown against, the three most of the fighting deals, each under
+ * its label in the string table. */
static const struct { DamageType type; const char *label; } SHOWN_ARMOR[] =
{
{ DAMAGE_SMALL_ARMS, "TOOLTIP:StatVsGuns" },
{ DAMAGE_ARMOR_PIERCING, "TOOLTIP:StatVsShells" },
{ DAMAGE_INFANTRY_MISSILE, "TOOLTIP:StatVsRockets" },
- { DAMAGE_EXPLOSION, "TOOLTIP:StatVsBlast" },
};
+/** Where each column of figures stands in the 108 page pixels beside the portrait. Not thirds: the
+ * game's 7 pixel font writes "Damage" 37 pixels wide and "Rocket" 31, so the first column takes
+ * what "Damage" needs and a gap of seven, and the last one keeps 32 for "Range", "Rocket" and "+100%". */
+static const Int FIGURE_COLUMN_X[] = { 0, 44, 76 };
+
/** One column of the figures under a lone unit's health, {{x}} its left in page pixels, {{label}}
* over {{value}}, and {{state}} "strong", "weak" or nothing. */
-static void putFigureColumn( std::vector< HtmlValues > &columns, Int column, Int count, Int width, const char *label,
- const std::string &value, const char *state )
+static void putFigureColumn( std::vector< HtmlValues > &columns, Int column, const char *label, const std::string &value,
+ const char *state )
{
HtmlValues &entry = listEntry( columns, column );
- entry[ "x" ] = std::to_string( column * width / count );
+ entry[ "x" ] = std::to_string( FIGURE_COLUMN_X[ column ] );
entry[ "label" ] = WideCharStringToMultiByte( TheGameText->fetch( label ).str() );
entry[ "value" ] = value;
entry[ "state" ] = state;
@@ -11939,11 +11943,14 @@ static void putFigureColumn( std::vector< HtmlValues > &columns, Int column, Int
* its upgrades put on - read through the same const calls the logic makes. */
static void putSelectedUnit( HtmlValues &values, HtmlLists &lists, const IRegion2D &portrait, const IRegion2D &well, Bool shown )
{
- enum { INFO_GAP = 6, HEALTH_YELLOW_PERCENT = 50, HEALTH_RED_PERCENT = 25, STAR_PITCH = 11, WEAPON_FIGURES = 3 };
+ enum { INFO_GAP = 6, INFO_TOP = 4, HEALTH_YELLOW_PERCENT = 50, HEALTH_RED_PERCENT = 25, STAR_PITCH = 11, WEAPON_FIGURES = 3 };
const Real scale = ControlBarHudScale();
+ // from just under the well's top rather than the portrait's, which stands a dozen page pixels
+ // lower: a two line name and the two rows of figures need that room to keep clear of each other
IRegion2D info = portrait;
info.lo.x = portrait.hi.x + REAL_TO_INT( INFO_GAP * scale );
info.hi.x = well.hi.x - REAL_TO_INT( INFO_GAP * scale );
+ info.lo.y = well.lo.y + REAL_TO_INT( INFO_TOP * scale );
// the drawable the bar's portrait is of, which is the one selected
const Drawable *drawable = TheControlBar->getContextDrawable();
const Object *object = drawable ? drawable->getObject() : NULL;
@@ -11994,7 +12001,6 @@ static void putSelectedUnit( HtmlValues &values, HtmlLists &lists, const IRegion
const Player *local = ThePlayerList->getLocalPlayer();
const Bool ours = localPlayerWatching() || object->getControllingPlayer() == local
|| local->getRelationship( object->getTeam() ) == ALLIES;
- const Int width = atoi( values[ "selinfo.w" ].c_str() );
UnitFigures figures = {};
if( ours )
{
@@ -12021,10 +12027,10 @@ static void putSelectedUnit( HtmlValues &values, HtmlLists &lists, const IRegion
else
{
const WeaponFigures &weapon = figures.slots[ main ];
- putFigureColumn( weaponColumns, 0, WEAPON_FIGURES, width, "TOOLTIP:StatDamage", std::to_string( REAL_TO_INT( weapon.damage ) ), "" );
- putFigureColumn( weaponColumns, 1, WEAPON_FIGURES, width, "TOOLTIP:StatShortDamagePerSecond",
+ putFigureColumn( weaponColumns, 0, "TOOLTIP:StatDamage", std::to_string( REAL_TO_INT( weapon.damage ) ), "" );
+ putFigureColumn( weaponColumns, 1, "TOOLTIP:StatShortDamagePerSecond",
std::to_string( REAL_TO_INT( weapon.damage * weapon.attacksPerSecond ) ), "" );
- putFigureColumn( weaponColumns, 2, WEAPON_FIGURES, width, "TOOLTIP:StatRange", std::to_string( REAL_TO_INT( weapon.range ) ), "" );
+ putFigureColumn( weaponColumns, 2, "TOOLTIP:StatRange", std::to_string( REAL_TO_INT( weapon.range ) ), "" );
weaponColumns.resize( WEAPON_FIGURES );
}
@@ -12040,7 +12046,7 @@ static void putSelectedUnit( HtmlValues &values, HtmlLists &lists, const IRegion
for( Int each = 0; each < shownArmor; each++ )
{
const Int change = REAL_TO_INT_FLOOR( armor.adjustDamage( SHOWN_ARMOR[ each ].type, PERCENT ) * scalar + 0.5f ) - PERCENT;
- putFigureColumn( armorColumns, each, shownArmor, width, SHOWN_ARMOR[ each ].label,
+ putFigureColumn( armorColumns, each, SHOWN_ARMOR[ each ].label,
( change > 0 ? "+" : "" ) + std::to_string( change ) + "%", change < 0 ? "strong" : change > 0 ? "weak" : "" );
}
armorColumns.resize( shownArmor );