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): open far clip by eye height only for director panes

Olcay Seyganf123b103f80d
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
index 238ff79af..d5b04cc82 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
@@ -132,7 +132,7 @@ static const Int PANE_CIRCLE_ROWS = 72;
/// a subject fitted into its pane's circle leaves this much of the radius round it
static const Real PANE_FIT_MARGIN = 0.15f;
/// a pane never comes closer than the director's own zoom, and never goes further out than this times it
-static const Real PANE_FIT_FARTHEST = 2.0f;
+static const Real PANE_FIT_FARTHEST = 3.0f;
/// a fight is never fitted as smaller than this across, so two tanks are not filled into a pane
static const Real PANE_FIT_LEAST_EXTENT = 150.0f;
/// the opening fits what a player has within this of the middle of it, his base and the army beside it
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
index 17971626d..b122a272d 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
@@ -944,13 +944,16 @@ void W3DView::aimCamera( void )
// 1200 was a number, not a distance: at the stock ceiling and pitch the far plane already cuts
// the terrain the game means to draw, and this fork zooms further out than the stock game did.
// Take the distance the terrain is actually drawn over instead, and open it with the height -
- // at twice the height you see twice as far. The height is the eye's own as well as the one the
- // view settles towards: the observer camera sets the zoom outright with the settling held off,
- // and a pane twice as high as the height said cut the far ground off in a black band.
+ // at twice the height you see twice as far. -directorrecord's panes set the zoom outright with
+ // the height's settling held off, so there the eye's own height opens it as well: a pane twice
+ // as high as the held height cut the far ground off in a black band. Only there, so every
+ // other camera keeps the far plane it had.
static const Real VIEW_DEFAULT_MAX_HEIGHT_ABOVE_TERRAIN = 310.0f;
farZ = (WorldHeightMap::NORMAL_DRAW_WIDTH * 1.08f) * MAP_XY_FACTOR;
- const Real eyeHeight = m_cameraOffset.z * getZoom() - m_groundLevel;
- const Real heightMultiplier = max(m_heightAboveGround, eyeHeight) / VIEW_DEFAULT_MAX_HEIGHT_ABOVE_TERRAIN;
+ Real height = m_heightAboveGround;
+ if (TheGlobalData->m_directorRecord && !m_okToAdjustHeight)
+ height = max(height, m_cameraOffset.z * getZoom() - m_groundLevel);
+ const Real heightMultiplier = height / VIEW_DEFAULT_MAX_HEIGHT_ABOVE_TERRAIN;
if (heightMultiplier > 1.0f)
farZ *= heightMultiplier;