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(gameengine): watchers keep controlbar pro's observer bar

Olcay Seygan5d54b57f46e1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a42901350..d9af58744 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -787,7 +787,7 @@ A third pass went through the generals' powers, promotions and unit abilities.
- Pausing stops both clocks.
- Watching a match, hold Tab and every player's queue is on his row of the scoreboard, on the line under the name, ahead of his superweapons: the three that land soonest with their seconds and a count of the rest. Buildings going up on the ground are in there too, so a player answering an attack with three war factories is visible while the concrete is still wet. It used to be eight rows of pictures piled up the left edge of the screen for the whole match, over the battlefield. Knocked out and staying to watch, Tab gives you this same board, everybody in full; it used to keep your old side's view, with the enemy as names and nothing else.
- Every row and every countdown stands in real metal, cut from the same tray the general's powers sit in down in the corner - the side your command bar is showing. Watching a match there is no bar of your own, so the superweapon countdowns used to fall back to a flat black box for the whole match; now they wear the metal of the player you are watching, and follow it when you switch seats.
-- Watching, the command bar is down to the radar. The list of players it held is the board on the right and the Tab scoreboard now. Pick a player to follow in the camera panel and you are looking at him, his money and his side's steel, the way his button in the list did; pick nobody for everybody. Picking drops whatever you had selected, so the promotions on screen are that player's and not the owner of the tank you last clicked. The portrait panel in the right corner comes up when you select something and goes when you click empty ground, so an empty match leaves the bottom of the screen to the battle.
+- Watching, the command bar is down to the radar. The list of players it held is the board on the right and the Tab scoreboard now. Pick a player to follow in the camera panel and you are looking at him and his money, the way his button in the list did; pick nobody for everybody. The bar stays ControlBar Pro's observer bar the whole match, in a replay as well: following a player or clicking his tank no longer turns it into his side's bar. Picking drops whatever you had selected, so the promotions on screen are that player's and not the owner of the tank you last clicked. The portrait panel in the right corner comes up when you select something and goes when you click empty ground, so an empty match leaves the bottom of the screen to the battle.
- Watching, the bars over the buildings are everyone's too - what each factory is turning out, and how long the superweapons have left. An observer used to see none of it.
- Watching, the camera can drive itself. Two drop-downs in the camera panel on the right, above the board, say who has it and which player you follow, and you can follow nobody. The Director goes to the fight with the most on the line over the last five seconds, where a dead Overlord counts for more than six riflemen being shot at and anything happening to a superweapon counts three times over. It stays with that fight eight seconds, leaves after four for one two and a half times the size, and after twenty seconds on the same fight, or as soon as the fight has burnt down to half of what it was, a third bigger is enough. So a 4v4 is watched like a broadcast rather than hunted for, and it does not hop between spots every few seconds. Any general's power used on the map outranks every fight. For a nuke the camera goes straight to the target and waits there for it to come down and stays through the blast. The particle cannon's beam is followed along its whole sweep, and a Scud Storm or a carpet bomb is watched until the last explosion has died down. Then it goes back to the fighting. The camera glides between places and slows into each one, and only cuts when the next one is across most of the map. When nobody is shooting it no longer parks on empty ground: it goes round what is worth seeing, an army on the march, a superweapon, a base going up, the rest of a base, the dearest first and nine seconds each, and does not come back to one of the last three while there is anything else to show. With a player picked it keeps to his fights and his own armies and buildings. Player camera shows his screen: a human player's camera comes over the network five times a second, smoothed in between, and a computer player, who has no camera, gets the Director narrowed to his own fights. Scroll with the keys or a drag, turn the view or click the radar and the camera is yours again, still following the same player. The edge of the screen does not scroll while it drives: the panel on the right stands on that edge, and reaching for it used to hand the camera back to you, so the Director stopped following the fighting the first time you went to change a setting. In a replay with the recorded camera switched on in the options, the player you follow still drives the camera the way his button in the old list did.
- Watching, the Director climbs over a wide battle until the whole of it is on the screen, and comes back down to your own height when it moves on or you take the camera. The mouse wheel still zooms while it drives, and it keeps what you chose. It stops short of the map's border too, where a fight on the edge used to come with a black corner of nothing beside it. A nuke or a Scud Storm is shown leaving its silo even when the Director has only just arrived at another fight; before, the launch was over by the time it was allowed to move. Rewinding a replay leaves your camera settings as they were, where a rewind used to hand you back a free camera with nobody followed. And following one player while a superweapon wiped out everything he had at the spot could close the game. It no longer does.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
index 322d1a1b2..5ee1c1708 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
@@ -1328,7 +1328,6 @@ protected:
Bool m_isObserverCommandBar; ///< If this is true, the command bar behaves greatly differnt
Player *m_observerLookAtPlayer; ///< The current player we're looking at, Null if we're not looking at anyone.
- AsciiString m_watchedSide; ///< the side the bar is wearing while watching, so a selection change only lays it out again when it really changes side
GameWindow *m_radarAttackGlowWindow; ///< WinUAttack
Int m_remainingRadarAttackGlowFrames; ///< logic frames left on the lamp's flashing
Player *m_watchedSelection; ///< the player the selection last named while watching, NULL for nobody
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
index d08a42060..20949a287 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
@@ -587,12 +587,9 @@ Player *ControlBar::getSelectedPlayer( void )
}
//-------------------------------------------------------------------------------------------------
-/** Watching, the selection drives the whole bar: clicking a unit watches its owner. The
- * portrait's panel comes up and the bar wears his side's metal, and clicking empty ground puts
- * everybody and the watcher's own plain bar back.
- *
- * Before this, picking up somebody's tank told you nothing about him: the bar stayed on whatever
- * side had last been chosen off the list, and the money plate with it. */
+/** Watching, the selection drives the bar's contents: clicking a unit watches its owner and his
+ * panel comes up, clicking empty ground puts everybody back. The bar itself stays ControlBar Pro's
+ * observer bar throughout, as the owner asked; it no longer changes into the watched side's. */
//-------------------------------------------------------------------------------------------------
void ControlBar::updateWatchedPlayer( void )
{
@@ -619,19 +616,6 @@ void ControlBar::watchPlayer( Player *player )
else
showObserverPlayerList();
- const PlayerTemplate *wear = player ? player->getPlayerTemplate()
- : ThePlayerList->getLocalPlayer()->getPlayerTemplate();
- // by template name rather than side: under -modfactions a mod's GLA wears the American bar and
- // ours the GLA one, the same side and not the same bar
- if( m_controlBarSchemeManager && wear && wear->getName().compare( m_watchedSide ) != 0 )
- {
- // a scheme lays the whole bar out again, so it is set when the side really changes and not
- // on every click
- m_watchedSide = wear->getName();
- m_controlBarSchemeManager->setControlBarSchemeByPlayerTemplate( wear );
- restoreStageAfterScheme();
- }
-
// a seat clicked at the top clears the selection before it gets here, so what is selected is
// read again rather than taken from the caller
m_watchedSelection = getSelectedPlayer();
@@ -1391,7 +1375,6 @@ ControlBar::ControlBar( void )
m_controlBarSchemeManager = NULL;
m_isObserverCommandBar = FALSE;
m_observerLookAtPlayer = NULL;
- m_watchedSide.clear();
m_watchedSelection = NULL;
m_currentControlBarStage = CONTROL_BAR_STAGE_DEFAULT;
m_buildToolTipLayout = NULL;
@@ -2781,7 +2764,6 @@ void ControlBar::reset( void )
m_isObserverCommandBar = FALSE; // reset us to use a normal command bar
m_observerLookAtPlayer = NULL;
- m_watchedSide.clear();
m_watchedSelection = NULL;
m_currentControlBarStage = CONTROL_BAR_STAGE_DEFAULT; // a minimised bar is this match's, not the next one's