summaryrefslogtreecommitdiffstats
path: root/src/control/OnscreenTimer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/OnscreenTimer.cpp')
-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);
}