diff options
Diffstat (limited to 'src/core/Timer.cpp')
-rw-r--r-- | src/core/Timer.cpp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp index e4f5b01e..77f26a8b 100644 --- a/src/core/Timer.cpp +++ b/src/core/Timer.cpp @@ -5,9 +5,11 @@ #include "DMAudio.h" #include "Record.h" #include "Timer.h" +#include "SpecialFX.h" uint32 CTimer::m_snTimeInMilliseconds; uint32 CTimer::m_snTimeInMillisecondsPauseMode = 1; + uint32 CTimer::m_snTimeInMillisecondsNonClipped; uint32 CTimer::m_snPreviousTimeInMilliseconds; uint32 CTimer::m_FrameCounter; @@ -15,7 +17,7 @@ float CTimer::ms_fTimeScale; float CTimer::ms_fTimeStep; float CTimer::ms_fTimeStepNonClipped; bool CTimer::m_UserPause; -bool CTimer::m_CodePause; +bool CTimer::m_CodePause; #ifdef FIX_BUGS uint32 CTimer::m_LogicalFrameCounter; uint32 CTimer::m_LogicalFramesPassed; @@ -83,9 +85,10 @@ void CTimer::Shutdown(void) { ; } + #ifdef FIX_BUGS void CTimer::Update(void) -{ +{ static double frameTimeLogical = 0.0; static double frameTimeFraction = 0.0; static double frameTimeFractionScaled = 0.0; @@ -103,10 +106,9 @@ void CTimer::Update(void) int32 updInCycles = (pc.LowPart - _oldPerfCounter.LowPart); // & 0x7FFFFFFF; pointless _oldPerfCounter = pc; - - // bugfix from VC - double updInCyclesScaled = GetIsPaused() ? updInCycles : updInCycles * ms_fTimeScale; - + + float updInCyclesScaled = GetIsPaused() ? updInCycles : updInCycles * ms_fTimeScale; + frameTime = updInCyclesScaled / (double)_nCyclesPerMS; dblUpdInMs = (double)updInCycles / (double)_nCyclesPerMS; @@ -117,10 +119,9 @@ void CTimer::Update(void) RsTimerType timer = RsTimer(); RsTimerType updInMs = timer - oldPcTimer; - - // bugfix from VC - frameTime = GetIsPaused() ? (double)updInMs : (double)updInMs * ms_fTimeScale; - + + frameTime = (double)updInMs * ms_fTimeScale; + oldPcTimer = timer; dblUpdInMs = (double)updInMs; @@ -129,7 +130,7 @@ void CTimer::Update(void) // count frames as if we're running at 30 fps m_LogicalFramesPassed = 0; frameTimeLogical += dblUpdInMs; - while(frameTimeLogical >= 1000.0 / 30.0) { + while (frameTimeLogical >= 1000.0 / 30.0) { frameTimeLogical -= 1000.0 / 30.0; m_LogicalFramesPassed++; } @@ -139,7 +140,7 @@ void CTimer::Update(void) frameTimeFractionScaled += frameTime; m_snTimeInMillisecondsPauseMode += uint32(frameTimeFraction); - + if ( GetIsPaused() ) ms_fTimeStep = 0.0f; else @@ -151,7 +152,7 @@ void CTimer::Update(void) frameTimeFraction -= uint32(frameTimeFraction); frameTimeFractionScaled -= uint32(frameTimeFractionScaled); - if ( ms_fTimeStep < 0.01f && !GetIsPaused() ) + if ( ms_fTimeStep < 0.01f && !GetIsPaused() && !CSpecialFX::bSnapShotActive) ms_fTimeStep = 0.01f; ms_fTimeStepNonClipped = ms_fTimeStep; @@ -186,10 +187,11 @@ void CTimer::Update(void) int32 updInCycles = (pc.LowPart - _oldPerfCounter.LowPart); // & 0x7FFFFFFF; pointless _oldPerfCounter = pc; - - float updInCyclesScaled = updInCycles * ms_fTimeScale; - + + float updInCyclesScaled = GetIsPaused() ? updInCycles : updInCycles * ms_fTimeScale; + double frameTime = updInCyclesScaled / (double)_nCyclesPerMS; + m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime; if ( GetIsPaused() ) @@ -209,11 +211,11 @@ void CTimer::Update(void) RsTimerType updInMs = timer - oldPcTimer; double frameTime = (double)updInMs * ms_fTimeScale; - - oldPcTimer = timer; + oldPcTimer = timer; + m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime; - + if ( GetIsPaused() ) ms_fTimeStep = 0.0f; else @@ -224,7 +226,7 @@ void CTimer::Update(void) } } - if ( ms_fTimeStep < 0.01f && !GetIsPaused() ) + if ( ms_fTimeStep < 0.01f && !GetIsPaused() && !CSpecialFX::bSnapShotActive) ms_fTimeStep = 0.01f; ms_fTimeStepNonClipped = ms_fTimeStep; |