summaryrefslogtreecommitdiffstats
path: root/src/control/OnscreenTimer.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-02-23 11:12:44 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-02-23 11:12:44 +0100
commit1ba696f5fca9dfc7c6f6d4f5f2537392b96cfc63 (patch)
tree03f1c90f1578c84d2c41beaf077108bd915a8217 /src/control/OnscreenTimer.cpp
parentsome cosmetic stuff (diff)
downloadre3-1ba696f5fca9dfc7c6f6d4f5f2537392b96cfc63.tar
re3-1ba696f5fca9dfc7c6f6d4f5f2537392b96cfc63.tar.gz
re3-1ba696f5fca9dfc7c6f6d4f5f2537392b96cfc63.tar.bz2
re3-1ba696f5fca9dfc7c6f6d4f5f2537392b96cfc63.tar.lz
re3-1ba696f5fca9dfc7c6f6d4f5f2537392b96cfc63.tar.xz
re3-1ba696f5fca9dfc7c6f6d4f5f2537392b96cfc63.tar.zst
re3-1ba696f5fca9dfc7c6f6d4f5f2537392b96cfc63.zip
Diffstat (limited to '')
-rw-r--r--src/control/OnscreenTimer.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/control/OnscreenTimer.cpp b/src/control/OnscreenTimer.cpp
index 1677df06..5406522c 100644
--- a/src/control/OnscreenTimer.cpp
+++ b/src/control/OnscreenTimer.cpp
@@ -106,18 +106,18 @@ void COnscreenTimerEntry::Process() {
return;
}
- uint32* timerPtr = (uint32*)&CTheScripts::ScriptSpace[m_nTimerOffset];
- uint32 oldTime = *timerPtr;
- int32 newTime = int32(oldTime - uint32(20.0f * CTimer::GetTimeStep()));
+ int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nTimerOffset);
+ int32 oldTime = *timerPtr;
+ int32 newTime = oldTime - int32(CTimer::GetTimeStepInSeconds() * 1000);
if(newTime < 0) {
*timerPtr = 0;
m_bTimerProcessed = 0;
m_nTimerOffset = 0;
m_aTimerText[0] = 0;
} else {
- *timerPtr = (uint32)newTime;
- uint32 oldTimeSeconds = oldTime / 1000;
- if(oldTimeSeconds <= 11 && newTime / 1000 != oldTimeSeconds) {
+ *timerPtr = newTime;
+ int32 oldTimeSeconds = oldTime / 1000;
+ if(oldTimeSeconds < 12 && newTime / 1000 != oldTimeSeconds) {
DMAudio.PlayFrontEndSound(SOUND_CLOCK_TICK, newTime / 1000);
}
}
@@ -144,13 +144,13 @@ bool COnscreenTimerEntry::ProcessForDisplay() {
}
void COnscreenTimerEntry::ProcessForDisplayClock() {
- uint32 time = *(uint32*)&CTheScripts::ScriptSpace[m_nTimerOffset];
+ uint32 time = *CTheScripts::GetPointerToScriptVariable(m_nTimerOffset);
sprintf(m_bTimerBuffer, "%02d:%02d", time / 1000 / 60,
time / 1000 % 60);
}
void COnscreenTimerEntry::ProcessForDisplayCounter() {
- uint32 counter = *(uint32*)&CTheScripts::ScriptSpace[m_nCounterOffset];
+ uint32 counter = *CTheScripts::GetPointerToScriptVariable(m_nCounterOffset);
sprintf(m_bCounterBuffer, "%d", counter);
}