summaryrefslogtreecommitdiffstats
path: root/src/core/Timer.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-04-10 17:06:49 +0200
committereray orçunus <erayorcunus@gmail.com>2020-04-11 23:56:27 +0200
commitf2995640bd29157d28c17b4dacab93cad05eadc2 (patch)
treebff16d69ea69ab0e65bb5f797017a7a152cf10fe /src/core/Timer.cpp
parentdisabling the code that freezes gang members (diff)
downloadre3-f2995640bd29157d28c17b4dacab93cad05eadc2.tar
re3-f2995640bd29157d28c17b4dacab93cad05eadc2.tar.gz
re3-f2995640bd29157d28c17b4dacab93cad05eadc2.tar.bz2
re3-f2995640bd29157d28c17b4dacab93cad05eadc2.tar.lz
re3-f2995640bd29157d28c17b4dacab93cad05eadc2.tar.xz
re3-f2995640bd29157d28c17b4dacab93cad05eadc2.tar.zst
re3-f2995640bd29157d28c17b4dacab93cad05eadc2.zip
Diffstat (limited to '')
-rw-r--r--src/core/Timer.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp
index 18d6b6a3..b5e031ed 100644
--- a/src/core/Timer.cpp
+++ b/src/core/Timer.cpp
@@ -34,6 +34,10 @@ LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318;
//UInt32 suspendDepth;
uint32 &suspendDepth = *(uint32*)0x62A320;
+#ifdef FIX_BUGS
+double frameTime;
+#endif
+
void CTimer::Initialise(void)
{
debug("Initialising CTimer...\n");
@@ -90,17 +94,21 @@ void CTimer::Update(void)
float updInCyclesScaled = updInCycles * ms_fTimeScale;
- double upd = updInCyclesScaled / (double)_nCyclesPerMS;
+ // We need that real frame time to fix transparent menu bug.
+#ifndef FIX_BUGS
+ double
+#endif
+ frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
- m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd;
+ m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
if ( GetIsPaused() )
ms_fTimeStep = 0.0f;
else
{
- m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd;
- m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd;
- ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0f;
+ m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
+ m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
+ ms_fTimeStep = frameTime / 1000.0f * 50.0f;
}
}
else
@@ -109,19 +117,23 @@ void CTimer::Update(void)
uint32 updInMs = timer - oldPcTimer;
- double upd = (double)updInMs * ms_fTimeScale;
+ // We need that real frame time to fix transparent menu bug.
+#ifndef FIX_BUGS
+ double
+#endif
+ frameTime = (double)updInMs * ms_fTimeScale;
oldPcTimer = timer;
- m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd;
+ m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
if ( GetIsPaused() )
ms_fTimeStep = 0.0f;
else
{
- m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd;
- m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd;
- ms_fTimeStep = upd / 1000.0f * 50.0f;
+ m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
+ m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
+ ms_fTimeStep = frameTime / 1000.0f * 50.0f;
}
}