Skip to content

Commit f2257df

Browse files
committed
tweak(camera): Decouple camera zoom update from logic time
1 parent 2bbf902 commit f2257df

File tree

1 file changed

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

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,8 @@ void W3DView::update(void)
13551355
// if scrolling, only adjust if we're too close or too far
13561356
if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround))
13571357
{
1358-
Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio();
1358+
const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps();
1359+
const Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio;
13591360
if (fabs(zoomAdj) >= 0.0001f) // only do positive
13601361
{
13611362
m_zoom += zoomAdj;
@@ -1366,7 +1367,8 @@ void W3DView::update(void)
13661367
else if (!didScriptedMovement)
13671368
{
13681369
// we're not scrolling; settle toward desired height above ground
1369-
Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio();
1370+
const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps();
1371+
const Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio;
13701372
if (fabs(zoomAdj) >= 0.0001f)
13711373
{
13721374
m_zoom -= zoomAdj;

0 commit comments

Comments
 (0)