diff options
author | Willem Jan Palenstijn | 2009-02-21 23:16:03 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2009-02-21 23:16:03 +0000 |
commit | b18ccb755a1fd7b39618d3f64f997d7123f81c26 (patch) | |
tree | 472abfc4dc927594e74ad16ca18bf733a1d48625 /engines/sci/engine | |
parent | ebc3de4a82eef3c226ffa79ac2b72e67dc5499eb (diff) | |
download | scummvm-rg350-b18ccb755a1fd7b39618d3f64f997d7123f81c26.tar.gz scummvm-rg350-b18ccb755a1fd7b39618d3f64f997d7123f81c26.tar.bz2 scummvm-rg350-b18ccb755a1fd7b39618d3f64f997d7123f81c26.zip |
multiply before dividing to improve timer resolution
svn-id: r38765
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index c932a1fe93..d01451f2e3 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -510,14 +510,14 @@ reg_t kGetTime(EngineState *s, int funct_nr, int argc, reg_t *argv) { #endif g_system->getTimeAndDate(loc_time); - start_time = g_system->getMillis() / 1000; + start_time = g_system->getMillis(); if (s->version < SCI_VERSION_FTU_NEW_GETTIME) { // Use old semantics if (argc) { // Get seconds since last am/pm switch retval = loc_time.tm_sec + loc_time.tm_min * 60 + (loc_time.tm_hour % 12) * 3600; debugC(2, kDebugLevelTime, "GetTime(timeofday) returns %d", retval); } else { // Get time since game started - retval = start_time * 60; + retval = start_time * 60 / 1000; debugC(2, kDebugLevelTime, "GetTime(elapsed) returns %d", retval); } } else { @@ -527,7 +527,7 @@ reg_t kGetTime(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (mode) { case _K_NEW_GETTIME_TICKS : { - retval = start_time * 60; + retval = start_time * 60 / 1000; debugC(2, kDebugLevelTime, "GetTime(elapsed) returns %d", retval); break; } diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 1974ff9084..c4cf477e42 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -651,7 +651,7 @@ reg_t kWait(EngineState *s, int funct_nr, int argc, reg_t *argv) { int sleep_time = UKPV(0); time = g_system->getMillis(); - s->r_acc = make_reg(0, ((time - s->last_wait_time) / 1000) * 60); + s->r_acc = make_reg(0, ((long)time - (long)s->last_wait_time) * 60 / 1000); s->last_wait_time = time; // Reset optimization flags: Game is playing along nicely anyway |