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 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'engines/kyra/kyra_v1.cpp') 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; } } -- cgit v1.2.3