Skip to content

Commit 8078a22

Browse files
authored
bugfix(view): Fix camera terrain height adjustment in Replay playback (#1597)
1 parent b1eac2a commit 8078a22

File tree

2 files changed

+10
-2
lines changed
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient

2 files changed

+10
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,14 +1178,18 @@ void W3DView::update(void)
11781178
* scrolling), the zoom will move toward matching the desired height.
11791179
*/
11801180
// TheSuperHackers @tweak Can now also zoom when the game is paused.
1181+
// TheSuperHackers @tweak The camera zoom speed is now decoupled from the render update.
1182+
// TheSuperHackers @bugfix The camera terrain height adjustment now also works in replay playback.
1183+
11811184
m_terrainHeightUnderCamera = getHeightAroundPos(m_pos.x, m_pos.y);
11821185
m_currentHeightAboveGround = m_cameraOffset.z * m_zoom - m_terrainHeightUnderCamera;
1186+
11831187
if (TheTerrainLogic && TheGlobalData && TheInGameUI && m_okToAdjustHeight)
11841188
{
11851189
Real desiredHeight = (m_terrainHeightUnderCamera + m_heightAboveGround);
11861190
Real desiredZoom = desiredHeight / m_cameraOffset.z;
11871191

1188-
if (didScriptedMovement || (TheGameLogic->isInReplayGame() && TheGlobalData->m_useCameraInReplay))
1192+
if (didScriptedMovement)
11891193
{
11901194
// if we are in a scripted camera movement, take its height above ground as our desired height.
11911195
m_heightAboveGround = m_currentHeightAboveGround;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,14 +1327,18 @@ void W3DView::update(void)
13271327
* scrolling), the zoom will move toward matching the desired height.
13281328
*/
13291329
// TheSuperHackers @tweak Can now also zoom when the game is paused.
1330+
// TheSuperHackers @tweak The camera zoom speed is now decoupled from the render update.
1331+
// TheSuperHackers @bugfix The camera terrain height adjustment now also works in replay playback.
1332+
13301333
m_terrainHeightUnderCamera = getHeightAroundPos(m_pos.x, m_pos.y);
13311334
m_currentHeightAboveGround = m_cameraOffset.z * m_zoom - m_terrainHeightUnderCamera;
1335+
13321336
if (TheTerrainLogic && TheGlobalData && TheInGameUI && m_okToAdjustHeight)
13331337
{
13341338
Real desiredHeight = (m_terrainHeightUnderCamera + m_heightAboveGround);
13351339
Real desiredZoom = desiredHeight / m_cameraOffset.z;
13361340

1337-
if (didScriptedMovement || (TheGameLogic->isInReplayGame() && TheGlobalData->m_useCameraInReplay))
1341+
if (didScriptedMovement)
13381342
{
13391343
// if we are in a scripted camera movement, take its height above ground as our desired height.
13401344
m_heightAboveGround = m_currentHeightAboveGround;

0 commit comments

Comments
 (0)