diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-05-28 18:03:16 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-06-24 20:32:44 +0200 |
commit | cacec36dd1dd6141986631ae22d6d40a64358a41 (patch) | |
tree | 4d9da021ceb5e0ce8ec78bc6bfe040b1bd809979 /src/core | |
parent | Make sampman stream functions default to stream 0 (diff) | |
download | re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.gz re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.bz2 re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.lz re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.xz re3-cacec36dd1dd6141986631ae22d6d40a64358a41.tar.zst re3-cacec36dd1dd6141986631ae22d6d40a64358a41.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Timer.cpp | 24 | ||||
-rw-r--r-- | src/core/Timer.h | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp index ed5580fd..5c7d012e 100644 --- a/src/core/Timer.cpp +++ b/src/core/Timer.cpp @@ -16,6 +16,9 @@ float CTimer::ms_fTimeStep; float CTimer::ms_fTimeStepNonClipped; bool CTimer::m_UserPause; bool CTimer::m_CodePause; +#ifdef FIX_BUGS +uint32 CTimer::m_LogicalFrameCounter; +#endif uint32 _nCyclesPerMS = 1; @@ -49,6 +52,9 @@ void CTimer::Initialise(void) m_snTimeInMillisecondsNonClipped = 0; m_snPreviousTimeInMilliseconds = 0; m_snTimeInMilliseconds = 1; +#ifdef FIX_BUGS + m_LogicalFrameCounter = 0; +#endif #ifdef _WIN32 LARGE_INTEGER perfFreq; @@ -102,6 +108,15 @@ void CTimer::Update(void) #endif frameTime = updInCyclesScaled / (double)_nCyclesPerMS; +#ifdef FIX_BUGS + static double frameTimeLogical = 0.0; + frameTimeLogical += ((double)updInCycles / (double)_nCyclesPerMS); + while (frameTimeLogical >= 1000.0 / 30.0) { + frameTimeLogical -= 1000.0 / 30.0; + m_LogicalFrameCounter++; + } +#endif + m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime; if ( GetIsPaused() ) @@ -126,6 +141,15 @@ void CTimer::Update(void) #endif frameTime = (double)updInMs * ms_fTimeScale; +#ifdef FIX_BUGS + static double frameTimeLogical = 0.0; + frameTimeLogical += (double)updInMs; + while(frameTimeLogical >= 1000.0 / 30.0) { + frameTimeLogical -= 1000.0 / 30.0; + m_LogicalFrameCounter++; + } +#endif + oldPcTimer = timer; m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime; diff --git a/src/core/Timer.h b/src/core/Timer.h index 393242dd..ebde1747 100644 --- a/src/core/Timer.h +++ b/src/core/Timer.h @@ -11,6 +11,9 @@ class CTimer static float ms_fTimeScale; static float ms_fTimeStep; static float ms_fTimeStepNonClipped; +#ifdef FIX_BUGS + static uint32 m_LogicalFrameCounter; +#endif public: static bool m_UserPause; static bool m_CodePause; @@ -61,6 +64,7 @@ public: #ifdef FIX_BUGS static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; } static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); } + static uint32 GetLogicalFrameCounter(void) { return m_LogicalFrameCounter; } #endif }; |