Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Generals/Code/GameEngine/Include/GameClient/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,11 @@ class View : public Snapshot
virtual const Coord3D& get3DCameraPosition() const = 0; ///< Returns the actual camera position

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

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

Real m_maxZoom; ///< Largest zoom value (minimum actual zoom)
Real m_minZoom; ///< Smallest zoom value (maximum actual zoom)
Real m_maxHeightAboveGround; ///< Highest camera above ground value
Real m_minHeightAboveGround; ///< Lowest camera above ground value
Real m_zoom; ///< Current zoom value
Expand Down
4 changes: 3 additions & 1 deletion Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5345,7 +5345,9 @@ void InGameUI::updateAndDrawWorldAnimations( void )
UnsignedInt height = wad->m_anim->getCurrentFrameHeight();

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

Expand Down
6 changes: 1 addition & 5 deletions Generals/Code/GameEngine/Source/GameClient/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ View::View( void )
m_heightAboveGround = 0.0f;
m_lockDist = 0.0f;
m_maxHeightAboveGround = 0.0f;
m_maxZoom = 0.0f;
m_minHeightAboveGround = 0.0f;
m_minZoom = 0.0f;
m_next = NULL;
m_okToAdjustHeight = TRUE;
m_originX = 0;
Expand Down Expand Up @@ -99,9 +97,7 @@ void View::init( void )
m_cameraLockDrawable = NULL;
m_zoomLimited = TRUE;

m_maxZoom = 1.3f;
m_minZoom = 0.2f;
m_zoom = m_maxZoom;
m_zoom = 1.0f;
m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight;
m_minHeightAboveGround = TheGlobalData->m_minCameraHeight;
m_okToAdjustHeight = FALSE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1777,15 +1777,13 @@ void W3DView::setHeightAboveGround(Real z)

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// TheSuperHackers @bugfix xezon 18/09/2025 setZoom is no longer clamped by a min and max zoom.
// Instead the min and max camera height will be clamped elsewhere. Clamping the zoom would cause
// issues with camera playback in replay playback where changes in terrain elevation would not raise
// the camera height.
void W3DView::setZoom(Real z)
{
m_zoom = z;

if (m_zoom < m_minZoom)
m_zoom = m_minZoom;

if (m_zoom > m_maxZoom)
m_zoom = m_maxZoom;
View::setZoom(z);

m_doingMoveCameraOnWaypointPath = false;
m_doingRotateCamera = false;
Expand Down
5 changes: 1 addition & 4 deletions GeneralsMD/Code/GameEngine/Include/GameClient/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,11 @@ class View : public Snapshot
virtual const Coord3D& get3DCameraPosition() const = 0; ///< Returns the actual camera position

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

// for debugging
Expand Down Expand Up @@ -267,8 +266,6 @@ class View : public Snapshot
Real m_angle; ///< Angle at which view has been rotated about the Z axis
Real m_pitchAngle; ///< Rotation of view direction around horizontal (X) axis

Real m_maxZoom; ///< Largest zoom value (minimum actual zoom)
Real m_minZoom; ///< Smallest zoom value (maximum actual zoom)
Real m_maxHeightAboveGround; ///< Highest camera above ground value
Real m_minHeightAboveGround; ///< Lowest camera above ground value
Real m_zoom; ///< Current zoom value
Expand Down
4 changes: 3 additions & 1 deletion GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5517,7 +5517,9 @@ void InGameUI::updateAndDrawWorldAnimations( void )
UnsignedInt height = wad->m_anim->getCurrentFrameHeight();

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

Expand Down
6 changes: 1 addition & 5 deletions GeneralsMD/Code/GameEngine/Source/GameClient/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ View::View( void )
m_heightAboveGround = 0.0f;
m_lockDist = 0.0f;
m_maxHeightAboveGround = 0.0f;
m_maxZoom = 0.0f;
m_minHeightAboveGround = 0.0f;
m_minZoom = 0.0f;
m_next = NULL;
m_okToAdjustHeight = TRUE;
m_originX = 0;
Expand Down Expand Up @@ -99,9 +97,7 @@ void View::init( void )
m_cameraLockDrawable = NULL;
m_zoomLimited = TRUE;

m_maxZoom = 1.3f;
m_minZoom = 0.2f;
m_zoom = m_maxZoom;
m_zoom = 1.0f;
m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight;
m_minHeightAboveGround = TheGlobalData->m_minCameraHeight;
m_okToAdjustHeight = FALSE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1940,15 +1940,13 @@ void W3DView::setHeightAboveGround(Real z)

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// TheSuperHackers @bugfix xezon 18/09/2025 setZoom is no longer clamped by a min and max zoom.
// Instead the min and max camera height will be clamped elsewhere. Clamping the zoom would cause
// issues with camera playback in replay playback where changes in terrain elevation would not raise
// the camera height.
void W3DView::setZoom(Real z)
{
m_zoom = z;

if (m_zoom < m_minZoom)
m_zoom = m_minZoom;

if (m_zoom > m_maxZoom)
m_zoom = m_maxZoom;
View::setZoom(z);

m_doingMoveCameraOnWaypointPath = false;
m_CameraArrivedAtWaypointOnPathFlag = false;
Expand Down
Loading