diff options
author | Torbjörn Andersson | 2006-05-08 15:40:30 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2006-05-08 15:40:30 +0000 |
commit | 575eb8b775f3d5a0a55a5e7ce41e0f0dd0988807 (patch) | |
tree | 0cc77e1a8e48cb90bff26a314fb5fb9ff21ea4cb /engines/kyra/kyra.cpp | |
parent | 73f0a23beecd52888b3c692acd0ff68a83ad3828 (diff) | |
download | scummvm-rg350-575eb8b775f3d5a0a55a5e7ce41e0f0dd0988807.tar.gz scummvm-rg350-575eb8b775f3d5a0a55a5e7ce41e0f0dd0988807.tar.bz2 scummvm-rg350-575eb8b775f3d5a0a55a5e7ce41e0f0dd0988807.zip |
Replaced a bunch of delay loops with a new delayUntil() function. Now all of
them will at least sleep if the remaining delay is at least 10 ms. (Personally,
I don't like the idea of busy-waiting even 9 ms, but now that it's in its own
function, it becomes much easier if we want to change that behaviour. There are
still plenty of custom delay loops left, though.)
svn-id: r22393
Diffstat (limited to 'engines/kyra/kyra.cpp')
-rw-r--r-- | engines/kyra/kyra.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index 904f8475cd..a6bf71459d 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -561,6 +561,15 @@ void KyraEngine::quitGame() { _system->quit(); } +void KyraEngine::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) { + while (_system->getMillis() < timestamp) { + if (updateTimers) + updateGameTimers(); + if (timestamp - _system->getMillis() >= 10) + delay(10, update, isMainLoop); + } +} + void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) { OSystem::Event event; char saveLoadSlot[20]; |