Skip to content

Commit c2aaeb9

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

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

@@ -1945,7 +1945,7 @@ void InGameUI::update( void )
19451945
if (m_cameraRotatingLeft || m_cameraRotatingRight || m_cameraZoomingIn || m_cameraZoomingOut)
19461946
{
19471947
// TheSuperHackers @tweak The camera rotation and zoom are now decoupled from the render update.
1948-
const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps();
1948+
const Real fpsRatio = (Real)BaseFps / TheDisplay->getAverageFPS();
19491949
const Real rotateAngle = TheGlobalData->m_keyboardCameraRotateSpeed * fpsRatio;
19501950
const Real zoomHeight = (Real)View::ZoomHeightPerSecond * fpsRatio;
19511951

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
3030

3131
#include "Common/GameType.h"
32-
#include "Common/GameEngine.h"
3332
#include "Common/MessageStream.h"
3433
#include "Common/Player.h"
3534
#include "Common/PlayerList.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 / TheGameEngine->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
@@ -1355,7 +1355,7 @@ 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-
const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps();
1358+
const Real fpsRatio = (Real)BaseFps / TheDisplay->getAverageFPS();
13591359
const Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio;
13601360
if (fabs(zoomAdj) >= 0.0001f) // only do positive
13611361
{
@@ -1367,7 +1367,7 @@ void W3DView::update(void)
13671367
else if (!didScriptedMovement)
13681368
{
13691369
// we're not scrolling; settle toward desired height above ground
1370-
const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps();
1370+
const Real fpsRatio = (Real)BaseFps / TheDisplay->getAverageFPS();
13711371
const Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio;
13721372
if (fabs(zoomAdj) >= 0.0001f)
13731373
{

0 commit comments

Comments
 (0)