diff options
author | johndoe123 | 2014-03-19 23:18:25 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2018-07-20 06:43:33 +0000 |
commit | c99f40c13d945060f489693d3f533b6ce0b54adb (patch) | |
tree | fa4f8c4e973350d5e37d62d3aad5ba0f2b409c01 /engines/illusions/time.cpp | |
parent | 48ef46c02dfeb34706f1060f9443bb31c1a56093 (diff) | |
download | scummvm-rg350-c99f40c13d945060f489693d3f533b6ce0b54adb.tar.gz scummvm-rg350-c99f40c13d945060f489693d3f533b6ce0b54adb.tar.bz2 scummvm-rg350-c99f40c13d945060f489693d3f533b6ce0b54adb.zip |
ILLUSIONS: Implement TimerThread and script opcode
Diffstat (limited to 'engines/illusions/time.cpp')
-rw-r--r-- | engines/illusions/time.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/engines/illusions/time.cpp b/engines/illusions/time.cpp index f190035b10..34ceaf4b37 100644 --- a/engines/illusions/time.cpp +++ b/engines/illusions/time.cpp @@ -26,7 +26,7 @@ namespace Illusions { uint32 getCurrentTime() { - return g_system->getMillis() / 60; + return g_system->getMillis() / 16; } bool isTimerExpired(uint32 startTime, uint32 endTime) { @@ -36,4 +36,15 @@ bool isTimerExpired(uint32 startTime, uint32 endTime) { (startTime < endTime && currTime <= endTime && currTime >= startTime)); } +uint32 getDurationElapsed(uint32 startTime, uint32 endTime) { + uint32 currTime = getCurrentTime(); + uint32 elapsed = endTime - startTime; + if (isTimerExpired(startTime, endTime)) + return elapsed; + else if (startTime < endTime || currTime > startTime) + return currTime - startTime; + else + return currTime + elapsed - endTime; +} + } // End of namespace Illusions |