Skip to content

Commit 7bfca02

Browse files
committed
Replicate in Generals
1 parent 8032ff7 commit 7bfca02

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

Generals/Code/GameEngine/Include/GameClient/View.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,11 @@ class View : public Snapshot
180180
virtual const Coord3D& get3DCameraPosition() const = 0; ///< Returns the actual camera position
181181

182182
virtual Real getZoom() { return m_zoom; }
183-
virtual void setZoom(Real z) { }
183+
virtual void setZoom(Real z) { m_zoom = z; }
184184
virtual Real getHeightAboveGround() { return m_heightAboveGround; }
185185
virtual void setHeightAboveGround(Real z);
186186
virtual void zoom( Real height ); ///< Zoom in/out, closer to the ground, limit to min, or farther away from the ground, limit to max
187187
virtual void setZoomToDefault( void ) { m_zoom = 1.0f; } ///< Set zoom to default value
188-
virtual Real getMaxZoom( void ) { return m_maxZoom; } ///< return max zoom value
189188
virtual void setOkToAdjustHeight( Bool val ) { m_okToAdjustHeight = val; } ///< Set this to adjust camera height
190189

191190
// for debugging
@@ -263,8 +262,6 @@ class View : public Snapshot
263262
Real m_angle; ///< Angle at which view has been rotated about the Z axis
264263
Real m_pitchAngle; ///< Rotation of view direction around horizontal (X) axis
265264

266-
Real m_maxZoom; ///< Largest zoom value (minimum actual zoom)
267-
Real m_minZoom; ///< Smallest zoom value (maximum actual zoom)
268265
Real m_maxHeightAboveGround; ///< Highest camera above ground value
269266
Real m_minHeightAboveGround; ///< Lowest camera above ground value
270267
Real m_zoom; ///< Current zoom value

Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5345,7 +5345,9 @@ void InGameUI::updateAndDrawWorldAnimations( void )
53455345
UnsignedInt height = wad->m_anim->getCurrentFrameHeight();
53465346

53475347
// scale the width and height given the camera zoom level
5348-
Real zoomScale = TheTacticalView->getMaxZoom() / TheTacticalView->getZoom();
5348+
// TheSuperHackers @todo Rework this with sane values. scaler=1.3 originally came from TheTacticalView::getMaxZoom()
5349+
constexpr Real scaler = 1.3f;
5350+
Real zoomScale = scaler / TheTacticalView->getZoom();
53495351
width *= zoomScale;
53505352
height *= zoomScale;
53515353

Generals/Code/GameEngine/Source/GameClient/View.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ View::View( void )
4949
m_heightAboveGround = 0.0f;
5050
m_lockDist = 0.0f;
5151
m_maxHeightAboveGround = 0.0f;
52-
m_maxZoom = 0.0f;
5352
m_minHeightAboveGround = 0.0f;
54-
m_minZoom = 0.0f;
5553
m_next = NULL;
5654
m_okToAdjustHeight = TRUE;
5755
m_originX = 0;
@@ -99,9 +97,7 @@ void View::init( void )
9997
m_cameraLockDrawable = NULL;
10098
m_zoomLimited = TRUE;
10199

102-
m_maxZoom = 1.3f;
103-
m_minZoom = 0.2f;
104-
m_zoom = m_maxZoom;
100+
m_zoom = 1.0f;
105101
m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight;
106102
m_minHeightAboveGround = TheGlobalData->m_minCameraHeight;
107103
m_okToAdjustHeight = FALSE;

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,15 +1777,13 @@ void W3DView::setHeightAboveGround(Real z)
17771777

17781778
//-------------------------------------------------------------------------------------------------
17791779
//-------------------------------------------------------------------------------------------------
1780+
// TheSuperHackers @bugfix xezon 18/09/2025 setZoom is no longer clamped by a min and max zoom.
1781+
// Instead the min and max camera height will be clamped elsewhere. Clamping the zoom would cause
1782+
// issues with camera playback in replay playback where changes in terrain elevation would not raise
1783+
// the camera height.
17801784
void W3DView::setZoom(Real z)
17811785
{
1782-
m_zoom = z;
1783-
1784-
if (m_zoom < m_minZoom)
1785-
m_zoom = m_minZoom;
1786-
1787-
if (m_zoom > m_maxZoom)
1788-
m_zoom = m_maxZoom;
1786+
View::setZoom(z);
17891787

17901788
m_doingMoveCameraOnWaypointPath = false;
17911789
m_doingRotateCamera = false;

0 commit comments

Comments
 (0)