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(gameengine): repaint observer bar names when player colours change

Olcay Seygan402ec7d75104
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e56d079d3..524e96b11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -541,6 +541,7 @@ found and fixed — EA's own, not port damage.**
- The colour reaches everything: the tint on the models, the radar, health bars, selection rings, the score screen, the money that floats up from a supply drop.
- 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.
+- 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/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
index 4a74751a4..95f7f643f 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
@@ -724,6 +724,13 @@ void GameClient::update( void )
{
for( Drawable *draw = m_drawableList; draw; draw = draw->getNextDrawable() )
draw->refreshIndicatorColor();
+
+ // the observer bar writes its names' colours once, when it is filled, so it is filled again
+ if( TheControlBar->isObserverControlBarOn() )
+ {
+ TheControlBar->populateObserverList();
+ TheControlBar->populateObserverInfoWindow();
+ }
}
Bool freezeTime = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished();
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/PlayerColorScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/PlayerColorScheme.cpp
index 59d1aa3dd..6dd0d92f4 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/PlayerColorScheme.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/PlayerColorScheme.cpp
@@ -87,6 +87,7 @@ static Bool theTableChanged = FALSE;
static UnsignedInt theTableStamp = 0;
static UnsignedInt theTableFrame = 0;
static Bool theTableHasFrame = FALSE;
+static Int theTableScheme = PLAYER_COLORS_ORIGINAL;
// ------------------------------------------------------------------------------------------------
static Color opaque( Color rgb )
@@ -360,16 +361,24 @@ static void ensureTable( void )
if( TheGlobalData == NULL )
return;
- // at most one rebuild a frame; the shell has no frame counter running, and does not need one
+ // at most one rebuild a frame; the shell has no frame counter running, and does not need one.
+ // The frame is the logic frame, which stands still through a whole load and a whole pause, so a
+ // new setting or a longer roster gets past the gate on its own. Without that, a setting changed
+ // in a paused match waited for the pause to end, and a table built early in the load, before
+ // the players existed, handed out black until the first logic frame.
+ const Int scheme = TheGlobalData->m_playerColorScheme;
+ const Int rosterSize = (ThePlayerList != NULL) ? ThePlayerList->getPlayerCount() : 0;
if( TheGameClient != NULL )
{
const UnsignedInt frame = TheGameClient->getFrame();
- if( theTableValid && theTableHasFrame && theTableFrame == frame )
+ if( theTableValid && theTableHasFrame && theTableFrame == frame
+ && theTableScheme == scheme && theEntryCount == rosterSize )
return;
theTableFrame = frame;
theTableHasFrame = TRUE;
}
+ theTableScheme = scheme;
const UnsignedInt stamp = computeStamp();
if( theTableValid && stamp == theTableStamp )