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): stealth on a watcher's screen goes by the followed player

Olcay Seygan31704f36a690
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a77c3661..501fa295b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -485,7 +485,7 @@ found and fixed — EA's own, not port damage.**
- Watching, the command bar is down to the radar. The list of players it held is the row of seats across the top of the screen now: click a seat and you are looking at that player, his money and his side's steel, the way his button in the list did, and the seat is lit gold. Click it again for everybody. A seat click drops whatever you had selected, so the promotions on screen are that player's and not the owner of the tank you last clicked, and the seat stays yours when you click empty ground. 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. The drop-down at the top of the board on the right says who has it. The Director goes wherever the most things were hit in the last five seconds, stays with that fight at least six seconds, and cuts away only for one clearly bigger, so a 4v4 is watched like a broadcast rather than hunted for. Pick a player instead and you see 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, turn the view or click the radar and the camera is yours again. In a replay with the recorded camera switched on in the options, a seat click still follows that player the way it always did.
-- Watching, tick Fog of war under the camera and you see what the player you follow sees and nothing more: black where he has never been, grey where he has been, none of the enemy he cannot see, and an enemy base as he last saw it. One gap: a stealthed enemy he has not detected still shows, because stealth is still judged from your seat. It stays on when you take the camera back, until you switch it off or hand the camera to the Director. An observer used to have no fog at all: the whole map, all match, with no way to see the game the way one of its players was seeing it.
+- Watching, tick Fog of war under the camera and you see what the player you follow sees and nothing more: black where he has never been, grey where he has been, none of the enemy he cannot see, and an enemy base as he last saw it. Stealth goes by his eyes too: a Jarmen Kell he has not found is gone from the screen and the radar, and his own stealthed units show the way they show him. It stays on when you take the camera back, until you switch it off or hand the camera to the Director. An observer used to have no fog at all: the whole map, all match, with no way to see the game the way one of its players was seeing it.
- An ally, and anyone watching, now sees a stealthed unit's muzzle flash, its promotion and the cash it earns - if they can see the unit at all. Those three asked 'is it mine' instead of 'can I see it', so allies and observers got nothing.
- Watching, the match opens on the middle of the map. An observer has no start position, so the game looked for the camera waypoint of "player zero", did not find it, and fell back to the corner of the map: every match watched from the stands began pointed at empty ground in the south west.
- Watching, you can click a stealth building. The rule that stops you selecting an enemy you cannot see never asked who was asking, so an observer, and a player already knocked out, could see a stealthed structure on the map and not pick it up to read it. A spectator commands nothing and sees everything already, so there is nothing there to give away.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
index fa26368d8..41d506ba1 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
@@ -29,7 +29,7 @@
// The followed player is picked from the camera's list, not the seats: clicking a unit makes its
// owner the watched player, and the camera jumping to an enemy's screen on a click would be no use.
// Fog on draws the followed player's fog, what he has seen and what he has not, and hides what he
-// cannot see; following nobody it changes nothing. Nothing here is logic: the camera and the fog
+// cannot see, stealthed units he has not detected included; following nobody it changes nothing. Nothing here is logic: the camera and the fog
// are this machine's picture only.
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp
index 6debf3d4a..106b4c9f0 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp
@@ -47,6 +47,7 @@
#include "GameClient/FXList.h"
#include "GameClient/GameClient.h"
#include "GameClient/Eva.h"
+#include "GameClient/ObserverCamera.h"
#include "GameLogic/Damage.h"
#include "GameLogic/Object.h"
@@ -834,9 +835,12 @@ UpdateSleepTime StealthUpdate::update( void )
+ // the look is for whoever the screen is drawn for: this machine's player, or the one a watcher
+ // follows with his fog on, so a stealthed enemy he has not found is not on the screen either
if (draw)
{
- StealthLookType stealthLook = calcStealthedStatusForPlayer( self, ThePlayerList->getLocalPlayer() );
+ const Player *viewer = ThePlayerList->getNthPlayer( TheObserverCamera.getShroudPlayerIndex() );
+ StealthLookType stealthLook = calcStealthedStatusForPlayer( self, viewer );
draw->setStealthLook( stealthLook );
}
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp
index 2c938844a..6b82ad7b4 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp
@@ -843,7 +843,8 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
// Now it twinkles for any stealthed object, whether locally controlled or neutral-observier-viewed
if( obj->testStatus( OBJECT_STATUS_STEALTHED ) )
{
- if ( ThePlayerList->getLocalPlayer()->getRelationship(obj->getTeam()) == ENEMIES )
+ // an enemy of whoever the screen is drawn for: the local player, or the followed one with fog on
+ if ( ThePlayerList->getNthPlayer( playerIndex )->getRelationship(obj->getTeam()) == ENEMIES )
if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !obj->testStatus( OBJECT_STATUS_DISGUISED ) )
skip = TRUE;