From 583b5b122e814d314fb673a718ae5330ea7f72ad Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 18 Sep 2025 10:58:53 +0200 Subject: [PATCH 1/3] bugfix(view): Fix camera terrain height adjustment in Replay playback --- .../GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 7231705257..42a5a0f6b7 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1327,14 +1327,17 @@ void W3DView::update(void) * scrolling), the zoom will move toward matching the desired height. */ // TheSuperHackers @tweak Can now also zoom when the game is paused. + // TheSuperHackers @bugfix The camera terrain height adjustment now also works in replay playback. + m_terrainHeightUnderCamera = getHeightAroundPos(m_pos.x, m_pos.y); m_currentHeightAboveGround = m_cameraOffset.z * m_zoom - m_terrainHeightUnderCamera; + if (TheTerrainLogic && TheGlobalData && TheInGameUI && m_okToAdjustHeight) { Real desiredHeight = (m_terrainHeightUnderCamera + m_heightAboveGround); Real desiredZoom = desiredHeight / m_cameraOffset.z; - if (didScriptedMovement || (TheGameLogic->isInReplayGame() && TheGlobalData->m_useCameraInReplay)) + if (didScriptedMovement) { // if we are in a scripted camera movement, take its height above ground as our desired height. m_heightAboveGround = m_currentHeightAboveGround; From 7cbfb03937599554bd2d53cce847172f50cce157 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 12:16:55 +0200 Subject: [PATCH 2/3] Replicate in Generals --- .../GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 0d887707f6..257b1ffa37 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1178,14 +1178,17 @@ void W3DView::update(void) * scrolling), the zoom will move toward matching the desired height. */ // TheSuperHackers @tweak Can now also zoom when the game is paused. + // TheSuperHackers @bugfix The camera terrain height adjustment now also works in replay playback. + m_terrainHeightUnderCamera = getHeightAroundPos(m_pos.x, m_pos.y); m_currentHeightAboveGround = m_cameraOffset.z * m_zoom - m_terrainHeightUnderCamera; + if (TheTerrainLogic && TheGlobalData && TheInGameUI && m_okToAdjustHeight) { Real desiredHeight = (m_terrainHeightUnderCamera + m_heightAboveGround); Real desiredZoom = desiredHeight / m_cameraOffset.z; - if (didScriptedMovement || (TheGameLogic->isInReplayGame() && TheGlobalData->m_useCameraInReplay)) + if (didScriptedMovement) { // if we are in a scripted camera movement, take its height above ground as our desired height. m_heightAboveGround = m_currentHeightAboveGround; From eec7334b706a6e5cdb59e401a6c9550a0276ba8c Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 20 Sep 2025 12:22:59 +0200 Subject: [PATCH 3/3] Also add comments for the prior camera zoom speed decoupling --- .../GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp | 1 + .../GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 257b1ffa37..31406a903e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1178,6 +1178,7 @@ void W3DView::update(void) * scrolling), the zoom will move toward matching the desired height. */ // TheSuperHackers @tweak Can now also zoom when the game is paused. + // TheSuperHackers @tweak The camera zoom speed is now decoupled from the render update. // TheSuperHackers @bugfix The camera terrain height adjustment now also works in replay playback. m_terrainHeightUnderCamera = getHeightAroundPos(m_pos.x, m_pos.y); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 42a5a0f6b7..2e142f6a54 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1327,6 +1327,7 @@ void W3DView::update(void) * scrolling), the zoom will move toward matching the desired height. */ // TheSuperHackers @tweak Can now also zoom when the game is paused. + // TheSuperHackers @tweak The camera zoom speed is now decoupled from the render update. // TheSuperHackers @bugfix The camera terrain height adjustment now also works in replay playback. m_terrainHeightUnderCamera = getHeightAroundPos(m_pos.x, m_pos.y);