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.

feat(gameclient): side emblems on picker, lobby, popup and score screen

Olcay Seygan3c1d2d43807b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 791fa9581..2f443ffc3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ found and fixed, EA's own, not port damage.**
- Watching a match gets a bar of its own in dark graphite with rounded corners. Its radar takes the map's shape as a player's does, and the column of players stands against the radar's edge on a tall map instead of leaving a gap. A lamp in each player's colour sits beside his button, with a ring round the one you point at and a brighter one round the player you are watching.
- While you watch, a rack of drawers hangs from the right edge under the superweapon countdowns. The top drawer holds a lever for the camera with three stops (yours, the director that goes to the biggest fight by itself, or the followed player's own screen), a switch for that player's fog of war and a switch that slides the armies drawer out. Under it every player is ranked on a dial of seven numbers: net worth, cash, income a minute, army value, kills and losses, general's rank and power. Turn it with a click, the wheel or Q, W, E, R, T, Y and A, and each row's bar shows his share of the leader's number. A tab out of each row follows that player, a second click lets him go, and the armies drawer lists the six kinds of unit he has most of, with how many. A click on the rack never reaches the battlefield.
- The superweapon countdowns stand where they do in a player's game while you watch, in their tray. The observer's bar named no tray for them, so they used to sit bare and higher up.
+- The army screen, the lobby and the score screen wear our own emblems. Every army has a card of its own on the army screen, the generals included, where EA's faces and logos used to be, and the player card shows the same one. Turkiye stops borrowing America's logo there and in the lobby's game list, and a mod's army carries the card of the country it is built on. On the score screen each player's row starts with his army's emblem, and your own army's card stands faint behind the table.
## Your queue in pictures again
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedFactionEmblems.dds b/GeneralsMD/Code/Data/Art/Textures/ReforgedFactionEmblems.dds
new file mode 100644
index 000000000..12eaba35a
Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedFactionEmblems.dds differ
diff --git a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedFactionEmblems.ini b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedFactionEmblems.ini
new file mode 100644
index 000000000..a8057960d
--- /dev/null
+++ b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedFactionEmblems.ini
@@ -0,0 +1,400 @@
+; The front end's side emblems (Tools/hud_command_bar.py paint_faction_emblems, round 14, approved by the
+; owner on 2026-11-03), all on ReforgedFactionEmblems, 1024x1024. The generator reads this file as the
+; sheet's layout. Mapped images are not in the multiplayer INI checksum.
+;
+; FactionPicker<template name>: the army screen's card for each army, 240x240 (the tile, the pool icon and
+; the focused portrait), and FactionPickerObserver. The retail GeneralImage names (USA_Logo ... GLA_Stealth)
+; are the same cards under EA's names, for PopupPlayerInfo and every other GeneralImage reader; HandCreated
+; loads after TextureSize_512, so these take the names back. GameinfoXXX: the SideIconImage side icons,
+; 48x44, GameinfoTURKIYE new. SSScore<suffix>: the score screen's row emblems, the observer's SSObserver
+; badges drawn at 60x40. The score screen's watermark is the local player's card, drawn faint by the code.
+
+MappedImage FactionPickerFactionAmerica
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:4 Top:4 Right:244 Bottom:244
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionAmericaSuperWeaponGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:252 Top:4 Right:492 Bottom:244
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionAmericaLaserGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:500 Top:4 Right:740 Bottom:244
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionAmericaAirForceGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:748 Top:4 Right:988 Bottom:244
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionChina
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:4 Top:252 Right:244 Bottom:492
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionChinaTankGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:252 Top:252 Right:492 Bottom:492
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionChinaInfantryGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:500 Top:252 Right:740 Bottom:492
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionChinaNukeGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:748 Top:252 Right:988 Bottom:492
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionBossGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:4 Top:500 Right:244 Bottom:740
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionGLA
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:252 Top:500 Right:492 Bottom:740
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionGLAToxinGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:500 Top:500 Right:740 Bottom:740
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionGLADemolitionGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:748 Top:500 Right:988 Bottom:740
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionGLAStealthGeneral
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:4 Top:748 Right:244 Bottom:988
+ Status = NONE
+End
+
+MappedImage FactionPickerFactionTurkiye
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:252 Top:748 Right:492 Bottom:988
+ Status = NONE
+End
+
+MappedImage FactionPickerObserver
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:500 Top:748 Right:740 Bottom:988
+ Status = NONE
+End
+
+; the retail GeneralImage names, on the same cards
+
+MappedImage USA_Logo
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:4 Top:4 Right:244 Bottom:244
+ Status = NONE
+End
+
+MappedImage USA_Superweapon
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:252 Top:4 Right:492 Bottom:244
+ Status = NONE
+End
+
+MappedImage USA_Laser
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:500 Top:4 Right:740 Bottom:244
+ Status = NONE
+End
+
+MappedImage USA_Air
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:748 Top:4 Right:988 Bottom:244
+ Status = NONE
+End
+
+MappedImage China_Logo
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:4 Top:252 Right:244 Bottom:492
+ Status = NONE
+End
+
+MappedImage China_Tank
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:252 Top:252 Right:492 Bottom:492
+ Status = NONE
+End
+
+MappedImage China_Infantry
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:500 Top:252 Right:740 Bottom:492
+ Status = NONE
+End
+
+MappedImage China_Nuke
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:748 Top:252 Right:988 Bottom:492
+ Status = NONE
+End
+
+MappedImage GLA_Logo
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:252 Top:500 Right:492 Bottom:740
+ Status = NONE
+End
+
+MappedImage GLA_Toxin
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:500 Top:500 Right:740 Bottom:740
+ Status = NONE
+End
+
+MappedImage GLA_Demo
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:748 Top:500 Right:988 Bottom:740
+ Status = NONE
+End
+
+MappedImage GLA_Stealth
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:4 Top:748 Right:244 Bottom:988
+ Status = NONE
+End
+
+; the side icons (SideIconImage)
+
+MappedImage GameinfoAMRCA
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:752 Top:752 Right:800 Bottom:796
+ Status = NONE
+End
+
+MappedImage GameinfoCHINA
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:808 Top:752 Right:856 Bottom:796
+ Status = NONE
+End
+
+MappedImage GameinfoGLA
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:864 Top:752 Right:912 Bottom:796
+ Status = NONE
+End
+
+MappedImage GameinfoTURKIYE
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:920 Top:752 Right:968 Bottom:796
+ Status = NONE
+End
+
+MappedImage GameinfoBOSS
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:752 Top:802 Right:800 Bottom:846
+ Status = NONE
+End
+
+MappedImage GameinfoOBSRVR
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:808 Top:802 Right:856 Bottom:846
+ Status = NONE
+End
+
+MappedImage GameinfoRANDOM
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:864 Top:802 Right:912 Bottom:846
+ Status = NONE
+End
+
+; the score screen's row emblems, 60x40
+
+MappedImage SSScoreUSA
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:752 Top:852 Right:812 Bottom:892
+ Status = NONE
+End
+
+MappedImage SSScoreAmericaSuperWeapon
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:816 Top:852 Right:876 Bottom:892
+ Status = NONE
+End
+
+MappedImage SSScoreAmericaLaser
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:880 Top:852 Right:940 Bottom:892
+ Status = NONE
+End
+
+MappedImage SSScoreAmericaAirForce
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:944 Top:852 Right:1004 Bottom:892
+ Status = NONE
+End
+
+MappedImage SSScoreChina
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:752 Top:895 Right:812 Bottom:935
+ Status = NONE
+End
+
+MappedImage SSScoreChinaTank
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:816 Top:895 Right:876 Bottom:935
+ Status = NONE
+End
+
+MappedImage SSScoreChinaInfantry
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:880 Top:895 Right:940 Bottom:935
+ Status = NONE
+End
+
+MappedImage SSScoreChinaNuke
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:944 Top:895 Right:1004 Bottom:935
+ Status = NONE
+End
+
+MappedImage SSScoreBoss
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:752 Top:938 Right:812 Bottom:978
+ Status = NONE
+End
+
+MappedImage SSScoreGLA
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:816 Top:938 Right:876 Bottom:978
+ Status = NONE
+End
+
+MappedImage SSScoreGLAToxin
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:880 Top:938 Right:940 Bottom:978
+ Status = NONE
+End
+
+MappedImage SSScoreGLADemolition
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:944 Top:938 Right:1004 Bottom:978
+ Status = NONE
+End
+
+MappedImage SSScoreGLAStealth
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:752 Top:981 Right:812 Bottom:1021
+ Status = NONE
+End
+
+MappedImage SSScoreTurkiye
+ Texture = ReforgedFactionEmblems.tga
+ TextureWidth = 1024
+ TextureHeight = 1024
+ Coords = Left:816 Top:981 Right:876 Bottom:1021
+ Status = NONE
+End
diff --git a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedFactionPicker.ini b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedFactionPicker.ini
index 08b6467ef..56adee557 100644
--- a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedFactionPicker.ini
+++ b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedFactionPicker.ini
@@ -1,11 +1,4 @@
-; The lobby's army screen shows FactionPicker<template name> for an army when it is mapped, in place of
-; the template's GeneralImage. Turkiye's is a Maresal's insignia, since everywhere else it wears
-; America's eagle. Mapped images are not in the multiplayer INI checksum.
-
-MappedImage FactionPickerFactionTurkiye
- Texture = ReforgedFactionTurkiye.tga
- TextureWidth = 512
- TextureHeight = 192
- Coords = Left:327 Top:136 Right:377 Bottom:182
- Status = NONE
-End
+; The army screen's FactionPicker<template name> cards, Turkiye's among them, are in
+; ReforgedFactionEmblems.ini since 2026-11-03. This file stays empty so an install that still has the
+; old one, which mapped Turkiye's card to ReforgedFactionTurkiye.tga and loads after
+; ReforgedFactionEmblems.ini, is overwritten and cannot take the name back.
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index c63d3e4bc..d12f3c846 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -15722,7 +15722,7 @@ GUI:HudCameraFree
END
GUI:HudCameraDirector
-"Yönetmen"
+"Direktör"
END
GUI:HudCameraPlayer
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h
index 2fe0182d6..27a7dda6c 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h
@@ -59,7 +59,7 @@
// FORWARD REFERENCES /////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
class AsciiString;
-class playerTemplate;
+class PlayerTemplate;
class Image;
enum TimeOfDay : Int;
@@ -357,9 +357,13 @@ private:
//-----------------------------------------------------------------------------
/// a mod's faction, which gets our American power tray (owner's call)
Bool ControlBarIsModFaction( const PlayerTemplate *pt );
-/// the side's emblem the observer's column, the rack and the lobbies show: SSObserver and the template's
-/// name less a leading "Faction" and a trailing "General" (SSObserverAmericaLaser), else
-/// SSObserver<USA|China|GLA|Turkiye> for the country its base side or side names, else its EnabledImage
+/// a side's picture of one family, prefix SSObserver, SSScore, FactionPicker or Gameinfo: the prefix and
+/// the template's name (less "Faction" and "General" but for FactionPicker: SSScoreAmericaLaser,
+/// FactionPickerFactionAmericaLaserGeneral), else the prefix and the base name of the country its base
+/// side or side names (SSScoreUSA, FactionPickerFactionAmerica, GameinfoAMRCA), else NULL
+const Image *ControlBarSideImage( const PlayerTemplate *pt, const char *prefix );
+/// the side's emblem the observer's column and the rack show: ControlBarSideImage's SSObserver, else
+/// its EnabledImage
const Image *ControlBarSideEmblem( const PlayerTemplate *pt );
#endif // __CONTROL_BAR_SCHEME_H_
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
index a3d25b57b..26761e43c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
@@ -1266,45 +1266,78 @@ Bool ControlBarIsModFaction( const PlayerTemplate *pt )
}
//-----------------------------------------------------------------------------
-/** The emblem is looked up by name, so a sheet that adds one for a general needs no INI edit and the
- * player templates (in the INI checksum) stay as they are. A mod's sub-faction or a faction built
- * on another country's base side gets that country's. */
+/** How each family of side pictures is named. SSObserver and SSScore take the template's name less a
+ * leading "Faction" and a trailing "General" (SSScoreAmericaLaser), FactionPicker the whole name
+ * (FactionPickerFactionAmericaLaserGeneral); the country's own picture is the retail name where
+ * retail has one (GameinfoAMRCA). */
//-----------------------------------------------------------------------------
-const Image *ControlBarSideEmblem( const PlayerTemplate *pt )
+struct SideImageNames
+{
+ const char *prefix;
+ Bool wholeName;
+ const char *country[ 4 ]; ///< USA, China, GLA, Turkiye
+};
+static const SideImageNames theSideImageNames[] =
{
- static const char *const PREFIX = "SSObserver";
+ { "SSObserver", FALSE, { "USA", "China", "GLA", "Turkiye" } },
+ { "SSScore", FALSE, { "USA", "China", "GLA", "Turkiye" } },
+ { "FactionPicker", TRUE, { "FactionAmerica", "FactionChina", "FactionGLA", "FactionTurkiye" } },
+ { "Gameinfo", FALSE, { "AMRCA", "CHINA", "GLA", "TURKIYE" } },
+};
+
+//-----------------------------------------------------------------------------
+/** Looked up by name, so a sheet that adds a picture for a general needs no INI edit and the player
+ * templates (in the INI checksum) stay as they are. Names are case blind, so GameinfoTurkiye finds
+ * GameinfoTURKIYE and GameinfoBoss retail's GameinfoBOSS. A mod's faction is named M<n>~ and never
+ * matches, so it gets the country its base side names, as does any general without a picture. */
+//-----------------------------------------------------------------------------
+const Image *ControlBarSideImage( const PlayerTemplate *pt, const char *prefix )
+{
+ const SideImageNames *names = NULL;
+ for( Int each = 0; each < ARRAY_SIZE( theSideImageNames ); each++ )
+ {
+ if( strcmp( theSideImageNames[ each ].prefix, prefix ) == 0 )
+ names = &theSideImageNames[ each ];
+ }
+ DEBUG_ASSERTCRASH( names != NULL, ( "ControlBarSideImage: no names for prefix %s", prefix ) );
+
static const std::string LEADING = "Faction";
static const std::string TRAILING = "General";
- // FactionAmericaLaserGeneral wears SSObserverAmericaLaser, FactionTurkiye SSObserverTurkiye
std::string general = pt->getName().str();
- if( general.compare( 0, LEADING.size(), LEADING ) == 0 )
- general.erase( 0, LEADING.size() );
- if( general.size() >= TRAILING.size() && general.compare( general.size() - TRAILING.size(), TRAILING.size(), TRAILING ) == 0 )
- general.erase( general.size() - TRAILING.size() );
+ if( !names->wholeName )
+ {
+ if( general.compare( 0, LEADING.size(), LEADING ) == 0 )
+ general.erase( 0, LEADING.size() );
+ if( general.size() >= TRAILING.size() && general.compare( general.size() - TRAILING.size(), TRAILING.size(), TRAILING ) == 0 )
+ general.erase( general.size() - TRAILING.size() );
+ }
AsciiString name;
- name.format( "%s%s", PREFIX, general.c_str() );
- const Image *emblem = TheMappedImageCollection->findImageByName( name );
- if( emblem != NULL )
- return emblem;
+ name.format( "%s%s", prefix, general.c_str() );
+ const Image *image = TheMappedImageCollection->findImageByName( name );
+ if( image != NULL )
+ return image;
const AsciiString side = pt->getBaseSide().isEmpty() ? pt->getSide() : pt->getBaseSide();
- const char *country = NULL;
+ Int country = -1;
if( side.startsWithNoCase( "America" ) || side.startsWithNoCase( "USA" ) )
- country = "USA";
+ country = 0;
else if( side.startsWithNoCase( "China" ) )
- country = "China";
+ country = 1;
else if( side.startsWithNoCase( "GLA" ) )
- country = "GLA";
+ country = 2;
else if( side.startsWithNoCase( "Turkiye" ) )
- country = "Turkiye";
- if( country != NULL )
- {
- name.format( "%s%s", PREFIX, country );
- emblem = TheMappedImageCollection->findImageByName( name );
- if( emblem != NULL )
- return emblem;
- }
- return pt->getEnabledImage();
+ country = 3;
+ if( country < 0 )
+ return NULL;
+ name.format( "%s%s", prefix, names->country[ country ] );
+ return TheMappedImageCollection->findImageByName( name );
+}
+
+//-----------------------------------------------------------------------------
+const Image *ControlBarSideEmblem( const PlayerTemplate *pt )
+{
+ const Image *emblem = ControlBarSideImage( pt, "SSObserver" );
+ return emblem != NULL ? emblem : pt->getEnabledImage();
}
//-----------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp
index 85e562587..9b0195d3c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp
@@ -41,6 +41,7 @@
#include "Common/NameKeyGenerator.h"
#include "Common/PlayerTemplate.h"
#include "GameClient/ChallengeGenerals.h"
+#include "GameClient/ControlBarScheme.h"
#include "GameClient/Display.h"
#include "GameClient/DisplayString.h"
#include "GameClient/DisplayStringManager.h"
@@ -85,7 +86,6 @@ static const Real SIDE_TICK = 26.0f;
static const Real SIDE_TICK_GAP = 14.0f;
static const Real MAX_PORTRAIT_SCALE = 4.0f; // a 64 px side logo blown up past this is only blur
static const Int POOL_DIM_ALPHA = 190;
-static const char *const PICKER_IMAGE_PREFIX = "FactionPicker"; // a template's own picture here, FactionPickerFactionTurkiye
struct PickerCell
{
@@ -365,7 +365,10 @@ static void buildCells( void )
Int mod = -1;
if( pick == PLAYERTEMPLATE_OBSERVER )
{
- cell.icon = cell.portrait = TheMappedImageCollection->findImageByName( "GameinfoOBSRVR" );
+ cell.icon = TheMappedImageCollection->findImageByName( "FactionPickerObserver" );
+ if( cell.icon == NULL )
+ cell.icon = TheMappedImageCollection->findImageByName( "GameinfoOBSRVR" );
+ cell.portrait = cell.icon;
}
else
{
@@ -377,15 +380,14 @@ static void buildCells( void )
if( candidates[ n ] == pick )
cell.poolBit = (Int)n;
}
- // a retail general has the challenge screen's pictures of him; a side has its logo, unless a
- // picture is mapped for this screen alone (Turkiye borrows America's logo everywhere else)
+ // our card for the army (FactionPickerFactionChinaNukeGeneral), a mod's or a general's without
+ // one its country's; where no card is mapped, the challenge screen's pictures of a retail
+ // general, else the side's logo
+ const Image *card = ControlBarSideImage( pt, "FactionPicker" );
const GeneralPersona *persona = TheChallengeGenerals->getGeneralByTemplateName( pt->getName() );
- AsciiString ownImage( PICKER_IMAGE_PREFIX );
- ownImage.concat( pt->getName() );
- const Image *own = TheMappedImageCollection->findImageByName( ownImage );
- const Image *logo = own ? own : ( pt->getGeneralImage() ? pt->getGeneralImage() : pt->getSideIconImage() );
- cell.icon = persona && persona->getBioPortraitSmall() ? persona->getBioPortraitSmall() : logo;
- cell.portrait = persona && persona->getBioPortraitLarge() ? persona->getBioPortraitLarge() : logo;
+ const Image *logo = pt->getGeneralImage() ? pt->getGeneralImage() : pt->getSideIconImage();
+ cell.icon = card ? card : ( persona && persona->getBioPortraitSmall() ? persona->getBioPortraitSmall() : logo );
+ cell.portrait = card ? card : ( persona && persona->getBioPortraitLarge() ? persona->getBioPortraitLarge() : logo );
if( !pt->getTooltip().isEmpty() )
cell.strategy = TheGameText->fetch( pt->getTooltip() );
if( !pt->getGeneralFeatures().isEmpty() )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp
index 88fb5340b..a653bb5ba 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp
@@ -32,6 +32,7 @@
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "GameClient/WindowLayout.h"
+#include "GameClient/ControlBarScheme.h"
#include "GameClient/MapUtil.h"
#include "GameClient/Shell.h"
#include "GameClient/GameWindowManager.h"
@@ -179,8 +180,10 @@ void RefreshGameInfoWindow(GameInfo *gameInfo, UnicodeString gameName)
}
else
{
+ // our icon by name (GameinfoTURKIYE, a mod's its base side's), else the template's own
const PlayerTemplate *fact = ThePlayerTemplateStore->getNthPlayerTemplate(playerTemplate);
- GadgetListBoxAddEntryImage(listBoxPlayers, fact->getSideIconImage(),addedRow, 0, 22,25);
+ const Image *icon = ControlBarSideImage(fact, "Gameinfo");
+ GadgetListBoxAddEntryImage(listBoxPlayers, icon ? icon : fact->getSideIconImage(),addedRow, 0, 22,25);
//GadgetListBoxAddEntryText(listBoxPlayers,fact->getDisplayName(),playerColor,addedRow, 0);
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp
index 00d57a11a..7a7138b3f 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp
@@ -40,6 +40,7 @@
#include "Common/GameSpyMiscPreferences.h"
#include "Common/FileSystem.h"
#include "GameClient/Mouse.h"
+#include "GameClient/ControlBarScheme.h"
#include "GameClient/GameText.h"
#include "GameClient/WindowLayout.h"
#include "GameClient/Gadget.h"
@@ -1075,7 +1076,9 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName )
win = findWindow(NULL, parentWindowName, "FactionImage");
if(win && pPlayerTemplate && TheRankPointValues && rankPoints)
{
- win->winSetEnabledImage(0, pPlayerTemplate->getGeneralImage());
+ // our card, as the army screen shows it: Turkiye's GeneralImage is America's logo
+ const Image *card = ControlBarSideImage(pPlayerTemplate, "FactionPicker");
+ win->winSetEnabledImage(0, card ? card : pPlayerTemplate->getGeneralImage());
//x win->setTooltipText( sideStr ); //ex: Toxin General
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp
index 629221255..2b76865ac 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreenGraphs.cpp
@@ -41,6 +41,7 @@
#include "Common/ThingTemplate.h"
#include "GameClient/CampaignManager.h"
#include "GameClient/ControlBar.h"
+#include "GameClient/ControlBarScheme.h"
#include "GameClient/Display.h"
#include "GameClient/DisplayString.h"
#include "GameClient/DisplayStringManager.h"
@@ -51,6 +52,7 @@
#include "GameClient/Image.h"
#include "GameClient/MapUtil.h"
#include "GameClient/Mouse.h"
+#include "GameClient/ObserverCamera.h"
#include "GameClient/UIStyle.h"
#include "Common/GameState.h"
#include "Common/GlobalData.h"
@@ -130,6 +132,7 @@ struct GraphPlayer
UnicodeString side;
Color color;
Color nameColor; ///< the colour lifted where it is too dark to read as words
+ const Image *emblem; ///< the army's SSScore emblem before the name, NULL for a campaign's side
Bool winner;
Int stats[ SUMMARY_COLUMN_COUNT ];
};
@@ -184,6 +187,7 @@ static GameFont *s_tinyFont = NULL;
static Int s_tab = GRAPH_TAB_SUMMARY;
static Bool s_everyBuild = FALSE;
static std::vector< GraphPlayer > s_players;
+static const Image *s_watermark = NULL; ///< the local player's army card, faint behind the Summary's table
static std::vector< GraphText > s_texts;
static std::vector< GraphMark > s_marks;
static std::vector< GraphLine > s_lines;
@@ -234,6 +238,30 @@ static Int textWidth( DisplayString *string )
return width;
}
+/// U+2026 by number: a u"" literal is read in the machine's code page by MSVC
+static const WideChar SCORE_ELLIPSIS[] = { 0x2026, 0 };
+
+/** text as it fits widest pixels in font: whole, or as many of its first characters as fit with an
+ * ellipsis after them (ObserverCamera_fitCount), spaces before the ellipsis dropped. A skirmish
+ * name read from the preferences, or the machine's own name standing in for one, has no length cap. */
+static UnicodeString fittedText( const UnicodeString &text, GameFont *font, Int widest )
+{
+ DisplayString *string = newText( text, font );
+ std::vector< Int > prefixWidths( text.getLength() + 1, 0 );
+ for( Int count = 1; count <= text.getLength(); count++ )
+ prefixWidths[ count ] = string->getWidth( count );
+ string->setText( UnicodeString( SCORE_ELLIPSIS ) );
+ const Int kept = ObserverCamera_fitCount( prefixWidths, textWidth( string ), widest );
+ TheDisplayStringManager->freeDisplayString( string );
+ if( kept == text.getLength() )
+ return text;
+ UnicodeString cut = text;
+ while( cut.getLength() > kept || ( cut.getLength() > 0 && cut.getCharAt( cut.getLength() - 1 ) == u' ' ) )
+ cut.removeLastChar();
+ cut.concat( SCORE_ELLIPSIS );
+ return cut;
+}
+
/** align: 0 puts x at the text's left, 1 at its middle, 2 at its right. Returns the text's width. */
static Int addText( const UnicodeString &text, GameFont *font, Int x, Int y, Color color, Int align = 0 )
{
@@ -441,7 +469,15 @@ static void layoutSummary( Int top, Int width, Int bottom, Int pad )
const Int line = s_bigFont->height;
const Int left = pad * 2;
const Int right = width - pad * 2;
- const Int namesRight = left + ( right - left ) / 3;
+ const Int subTop = top + s_font->height + pad / 2;
+ const Int tableTop = subTop + smallLine + pad / 2;
+ const Int rows = max( (Int)s_players.size(), 1 );
+ const Int rowHeight = max( min( ( bottom - tableTop ) / rows, line * 2 + pad * 2 ), line + pad / 3 );
+ // the army's emblem, 60x40 at 1080, stands before the name; the names' column grows by its width
+ const Int emblemHeight = min( UIStyle::px( 40 ), rowHeight - pad );
+ const Int emblemWidth = emblemHeight * 3 / 2;
+ const Int emblemRoom = emblemWidth + pad;
+ const Int namesRight = left + emblemRoom + ( right - left - emblemRoom ) / 3;
const Int groupGap = pad * 2;
const Int column = ( right - namesRight - ( SUMMARY_GROUP_COUNT - 1 ) * groupGap ) / SUMMARY_COLUMN_COUNT;
@@ -450,7 +486,6 @@ static void layoutSummary( Int top, Int width, Int bottom, Int pad )
for( Int each = 0; each < SUMMARY_COLUMN_COUNT; each++ )
columnRight[ each ] = namesRight + ( each + 1 ) * column + theColumnGroup[ each ] * groupGap;
- const Int subTop = top + s_font->height + pad / 2;
for( Int group = 0; group < SUMMARY_GROUP_COUNT; group++ )
{
Int first = SUMMARY_COLUMN_COUNT, last = 0;
@@ -468,7 +503,7 @@ static void layoutSummary( Int top, Int width, Int bottom, Int pad )
}
for( Int each = 0; each < SUMMARY_COLUMN_COUNT; each++ )
addText( TheGameText->fetch( theColumnLabels[ each ] ), s_smallFont, columnRight[ each ], subTop, UIStyle::MUTED, 2 );
- Int y = subTop + smallLine + pad / 2;
+ Int y = tableTop;
addRule( left, y, right, y, UIStyle::FRAME );
// the row a column's best stands in, or -1 where two rows share it
@@ -491,25 +526,35 @@ static void layoutSummary( Int top, Int width, Int bottom, Int pad )
}
}
- const Int rows = max( (Int)s_players.size(), 1 );
const Int sideLine = s_font->height;
- const Int rowHeight = max( min( ( bottom - y ) / rows, line * 2 + pad * 2 ), line + pad / 3 );
// the side goes under the name where the row has room for both, beside it where not
const Bool sideUnder = rowHeight >= line + sideLine + pad / 2;
+ // a name and its side stop a pad short of the winner's box, or of the numbers
+ DisplayString *winnerText = newText( TheGameText->fetch( "GUI:SummaryWinner" ), s_font );
+ const Int winnerRoom = textWidth( winnerText ) + pad * 3;
+ TheDisplayStringManager->freeDisplayString( winnerText );
for( size_t each = 0; each < s_players.size(); each++ )
{
const GraphPlayer &player = s_players[ each ];
const Int nameY = y + ( rowHeight - ( sideUnder && !player.side.isEmpty() ? line + sideLine : line ) ) / 2;
const Int stripe = UIStyle::stripeWidth();
s_marks.push_back( newMark( left, y + pad / 2, stripe, rowHeight - pad, player.color, player.color ) );
- const Int x = left + stripe + pad;
- const Int nameWidth = addText( player.name, s_bigFont, x, nameY, player.nameColor );
+ if( player.emblem )
+ {
+ // the mark draws its picture 2 in from its box, so the box is the emblem grown by 2
+ GraphMark emblem = newMark( left + stripe + pad - 2, y + ( rowHeight - emblemHeight ) / 2 - 2, emblemWidth + 4, emblemHeight + 4, 0, 0 );
+ emblem.image = player.emblem;
+ s_marks.push_back( emblem );
+ }
+ const Int x = left + stripe + pad + emblemRoom;
+ const Int room = namesRight - ( player.winner ? winnerRoom : pad ) - x;
+ const Int nameWidth = addText( fittedText( player.name, s_bigFont, room ), s_bigFont, x, nameY, player.nameColor );
if( !player.side.isEmpty() )
{
if( sideUnder )
- addText( player.side, s_font, x, nameY + line, UIStyle::MUTED );
- else
- addText( player.side, s_smallFont, x + nameWidth + pad, nameY + line - smallLine - 1, UIStyle::MUTED );
+ addText( fittedText( player.side, s_font, room ), s_font, x, nameY + line, UIStyle::MUTED );
+ else if( room - nameWidth - pad > 0 )
+ addText( fittedText( player.side, s_smallFont, room - nameWidth - pad ), s_smallFont, x + nameWidth + pad, nameY + line - smallLine - 1, UIStyle::MUTED );
}
if( player.winner )
{
@@ -903,6 +948,17 @@ static void drawPanel( GameWindow *window, WinInstanceData *instData )
UIStyle::wordmark( s_wordmark, ox + width - UIStyle::px( UIStyle::ROOM_INSET - UIStyle::ROOM_PANEL_LEFT ), titleMiddle - markHeight / 2 );
UIStyle::rule( ox, oy + s_ruleY, width );
+ // the local player's army card behind the Summary's table, 560 at 1080 and a tenth opaque; the
+ // colour stays, since an image drawn in grey ignores its alpha
+ if( s_watermark && s_tab == GRAPH_TAB_SUMMARY )
+ {
+ const Int top = s_tabBox[ 0 ].hi.y;
+ const Int size = min( UIStyle::px( 560 ), s_contentBottom - top );
+ const Int x = ox + ( width - size ) / 2;
+ const Int y = oy + ( top + s_contentBottom - size ) / 2;
+ TheDisplay->drawImage( s_watermark, x, y, x + size, y + size, GameMakeColor( 255, 255, 255, 26 ) );
+ }
+
for( Int tab = 0; tab < GRAPH_TAB_COUNT; tab++ )
{
const IRegion2D &box = s_tabBox[ tab ];
@@ -1027,6 +1083,7 @@ static WindowMsgHandledType panelInput( GameWindow *window, UnsignedInt msg, Win
void ScoreScreenGraphsInit( GameWindow *backdrop )
{
s_players.clear();
+ s_watermark = NULL;
s_tab = GRAPH_TAB_SUMMARY;
s_everyBuild = FALSE;
s_font = UIStyle::font( UIStyle::TEXT_STRONG );
@@ -1082,6 +1139,16 @@ void ScoreScreenGraphsAddPlayer( Player *player, const UnicodeString &name, Colo
entry.side = side ? side->getDisplayName() : UnicodeString::TheEmptyString;
entry.color = color;
entry.nameColor = UIStyle::readable( color );
+ entry.emblem = NULL;
+ if( side )
+ {
+ // SSScoreChinaNuke, else the country's SSScoreChina, else the observer's emblem of the same name
+ entry.emblem = ControlBarSideImage( side, "SSScore" );
+ if( entry.emblem == NULL )
+ entry.emblem = ControlBarSideEmblem( side );
+ if( player->isLocalPlayer() )
+ s_watermark = ControlBarSideImage( side, "FactionPicker" );
+ }
entry.winner = TheVictoryConditions->hasAchievedVictory( player );
entry.stats[ SUMMARY_UNITS_BUILT ] = score->getTotalUnitsBuilt();
entry.stats[ SUMMARY_UNITS_LOST ] = score->getTotalUnitsLost();
@@ -1102,6 +1169,7 @@ void ScoreScreenGraphsAddSide( const UnicodeString &name, Color color, Int units
entry.name = name;
entry.color = color;
entry.nameColor = UIStyle::readable( color );
+ entry.emblem = NULL;
entry.winner = FALSE;
entry.stats[ SUMMARY_UNITS_BUILT ] = unitsBuilt;
entry.stats[ SUMMARY_UNITS_LOST ] = unitsLost;