Skip to content

Commit f3564fd

Browse files
committed
tweak(scrolling): Use smoothened frame rate to scale movement for scrolling and camera
1 parent f9504a6 commit f3564fd

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
////////////////////////////////////////////////////////////////////////////////
2424

2525
// InGameUI.cpp ///////////////////////////////////////////////////////////////////////////////////
26-
// Implementation of in-game user interface singleton inteface
26+
// Implementation of in-game user interface singleton
2727
// Author: Michael S. Booth, March 2001
2828
///////////////////////////////////////////////////////////////////////////////////////////////////
2929

@@ -1995,7 +1995,7 @@ void InGameUI::update( void )
19951995
if (m_cameraRotatingLeft || m_cameraRotatingRight || m_cameraZoomingIn || m_cameraZoomingOut)
19961996
{
19971997
// TheSuperHackers @tweak The camera rotation and zoom are now decoupled from the render update.
1998-
const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps();
1998+
const Real fpsRatio = (Real)BaseFps / TheDisplay->getAverageFPS();
19991999
const Real rotateAngle = TheGlobalData->m_keyboardCameraRotateSpeed * fpsRatio;
20002000
const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio;
20012001

GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine
3030

31-
#include "Common/FramePacer.h"
3231
#include "Common/GameType.h"
3332
#include "Common/MessageStream.h"
3433
#include "Common/Player.h"
@@ -439,7 +438,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
439438
{
440439

441440
// TheSuperHackers @bugfix Mauller 07/06/2025 The camera scrolling is now decoupled from the render update.
442-
const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps();
441+
const Real fpsRatio = (Real)BaseFps / TheDisplay->getAverageFPS();
443442

444443
switch (m_scrollType)
445444
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ void W3DView::update(void)
13561356
// if scrolling, only adjust if we're too close or too far
13571357
if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround))
13581358
{
1359-
const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps();
1359+
const Real fpsRatio = (Real)BaseFps / TheDisplay->getAverageFPS();
13601360
const Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio;
13611361
if (fabs(zoomAdj) >= 0.0001f) // only do positive
13621362
{
@@ -1368,7 +1368,7 @@ void W3DView::update(void)
13681368
else if (!didScriptedMovement)
13691369
{
13701370
// we're not scrolling; settle toward desired height above ground
1371-
const Real fpsRatio = (Real)BaseFps / TheFramePacer->getUpdateFps();
1371+
const Real fpsRatio = (Real)BaseFps / TheDisplay->getAverageFPS();
13721372
const Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio;
13731373
if (fabs(zoomAdj) >= 0.0001f)
13741374
{

0 commit comments

Comments
 (0)