diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-05-29 10:57:51 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-06-24 20:32:44 +0200 |
commit | f741101e4458d2515c57ae11f3f6c0088206524f (patch) | |
tree | 4e7d72af74ebd8194020ac70ee8e82509e8709db /src/core | |
parent | Fix cut off sfx on high framerates (diff) | |
download | re3-f741101e4458d2515c57ae11f3f6c0088206524f.tar re3-f741101e4458d2515c57ae11f3f6c0088206524f.tar.gz re3-f741101e4458d2515c57ae11f3f6c0088206524f.tar.bz2 re3-f741101e4458d2515c57ae11f3f6c0088206524f.tar.lz re3-f741101e4458d2515c57ae11f3f6c0088206524f.tar.xz re3-f741101e4458d2515c57ae11f3f6c0088206524f.tar.zst re3-f741101e4458d2515c57ae11f3f6c0088206524f.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Timer.cpp | 10 | ||||
-rw-r--r-- | src/core/Timer.h | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp index 5c7d012e..5771274a 100644 --- a/src/core/Timer.cpp +++ b/src/core/Timer.cpp @@ -18,6 +18,7 @@ bool CTimer::m_UserPause; bool CTimer::m_CodePause; #ifdef FIX_BUGS uint32 CTimer::m_LogicalFrameCounter; +uint32 CTimer::m_LogicalFramesPassed; #endif uint32 _nCyclesPerMS = 1; @@ -54,6 +55,7 @@ void CTimer::Initialise(void) m_snTimeInMilliseconds = 1; #ifdef FIX_BUGS m_LogicalFrameCounter = 0; + m_LogicalFramesPassed = 0; #endif #ifdef _WIN32 @@ -109,12 +111,14 @@ void CTimer::Update(void) frameTime = updInCyclesScaled / (double)_nCyclesPerMS; #ifdef FIX_BUGS + m_LogicalFramesPassed = 0; static double frameTimeLogical = 0.0; frameTimeLogical += ((double)updInCycles / (double)_nCyclesPerMS); while (frameTimeLogical >= 1000.0 / 30.0) { frameTimeLogical -= 1000.0 / 30.0; - m_LogicalFrameCounter++; + m_LogicalFramesPassed++; } + m_LogicalFrameCounter += m_LogicalFramesPassed; #endif m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime; @@ -142,12 +146,14 @@ void CTimer::Update(void) frameTime = (double)updInMs * ms_fTimeScale; #ifdef FIX_BUGS + m_LogicalFramesPassed = 0; static double frameTimeLogical = 0.0; frameTimeLogical += (double)updInMs; while(frameTimeLogical >= 1000.0 / 30.0) { frameTimeLogical -= 1000.0 / 30.0; - m_LogicalFrameCounter++; + m_LogicalFramesPassed++; } + m_LogicalFrameCounter += m_LogicalFramesPassed; #endif oldPcTimer = timer; diff --git a/src/core/Timer.h b/src/core/Timer.h index ebde1747..7b68303a 100644 --- a/src/core/Timer.h +++ b/src/core/Timer.h @@ -13,6 +13,7 @@ class CTimer static float ms_fTimeStepNonClipped; #ifdef FIX_BUGS static uint32 m_LogicalFrameCounter; + static uint32 m_LogicalFramesPassed; #endif public: static bool m_UserPause; @@ -65,6 +66,7 @@ public: static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; } static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); } static uint32 GetLogicalFrameCounter(void) { return m_LogicalFrameCounter; } + static uint32 GetLogicalFramesPassed(void) { return m_LogicalFramesPassed; } #endif }; |