From 9a0fff429f51832aafd1ad17fad94c206b68ffb5 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 1 Jun 2009 23:38:56 +0000 Subject: - Remove LoLEngine::delayUntil it was identical to KyraEngine_v1 in its functionallity anyway - Change KyraEngine_v1::delayUntil to a somewhat more LoLEngine::delayUntil like implementation svn-id: r41117 --- engines/kyra/kyra_v1.cpp | 12 +++++++++--- engines/kyra/lol.cpp | 15 --------------- engines/kyra/lol.h | 1 - 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index a5e6503d7c..f3ba67a265 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -476,9 +476,15 @@ int KyraEngine_v1::resetGameFlag(int flag) { } void KyraEngine_v1::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) { - while (_system->getMillis() < timestamp && !shouldQuit()) { - if (timestamp - _system->getMillis() >= 10) - delay(10, update, isMainLoop); + const uint32 curTime = _system->getMillis(); + if (curTime > timestamp) + return; + + uint32 del = timestamp - curTime; + while (del && !shouldQuit()) { + uint32 step = MIN(del, _tickLength); + delay(step, update, isMainLoop); + del -= step; } } diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 147cebdf9b..600252c164 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1792,21 +1792,6 @@ void LoLEngine::delay(uint32 millis, bool doUpdate, bool) { } } -void LoLEngine::delayUntil(uint32 timeStamp) { - const uint32 curTime = _system->getMillis(); - if (curTime < timeStamp) - return; - - uint32 del = timeStamp - curTime; - while (del && !shouldQuit()) { - updateInput(); - - uint32 step = MIN(del, _tickLength); - _system->delayMillis(step); - del -= step; - } -} - uint8 LoLEngine::getRandomNumberSpecial() { uint8 a = _rndSpecial & 0xff; uint8 b = (_rndSpecial >> 8) & 0xff; diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index ac0f9516d8..ca5510c1f8 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -1292,7 +1292,6 @@ private: // misc void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false); - void delayUntil(uint32 timeStamp); uint8 getRandomNumberSpecial(); uint8 _compassBroken; -- cgit v1.2.3