diff options
author | Johannes Schickel | 2009-08-19 08:46:59 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-08-19 08:46:59 +0000 |
commit | a37c9164ee09cb7b29b312bd7810790b08dc2355 (patch) | |
tree | 359f90083b21c7612c71a66bb29ba999231f00fb | |
parent | 2597814af37711dce00594e71c6f2e5aaecdb96a (diff) | |
download | scummvm-rg350-a37c9164ee09cb7b29b312bd7810790b08dc2355.tar.gz scummvm-rg350-a37c9164ee09cb7b29b312bd7810790b08dc2355.tar.bz2 scummvm-rg350-a37c9164ee09cb7b29b312bd7810790b08dc2355.zip |
Cleanup.
svn-id: r43533
-rw-r--r-- | engines/kyra/script_lok.cpp | 92 |
1 files changed, 16 insertions, 76 deletions
diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp index a778a2066b..5d323b7c17 100644 --- a/engines/kyra/script_lok.cpp +++ b/engines/kyra/script_lok.cpp @@ -429,22 +429,14 @@ int KyraEngine_LoK::o1_runWSAFromBeginningToEnd(EMCState *script) { int wsaFrame = 0; while (running) { + const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); + _movieObjects[wsaIndex]->displayFrame(wsaFrame++, 0, xpos, ypos, 0, 0, 0); _animator->_updateScreen = true; if (wsaFrame >= _movieObjects[wsaIndex]->frames()) running = false; - uint32 continueTime = waitTime * _tickLength + _system->getMillis(); - while (_system->getMillis() < continueTime) { - if (worldUpdate) { - _sprites->updateSceneAnims(); - _animator->updateAllObjectShapes(); - } else { - _screen->updateScreen(); - } - if (continueTime - _system->getMillis() >= 10) - delay(10); - } + delayUntil(continueTime, false, worldUpdate != 0); } _screen->showMouse(); @@ -460,18 +452,10 @@ int KyraEngine_LoK::o1_displayWSAFrame(EMCState *script) { int waitTime = stackPos(3); int wsaIndex = stackPos(4); _screen->hideMouse(); + const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); _movieObjects[wsaIndex]->displayFrame(frame, 0, xpos, ypos, 0, 0, 0); _animator->_updateScreen = true; - uint32 continueTime = waitTime * _tickLength + _system->getMillis(); - while (_system->getMillis() < continueTime) { - _sprites->updateSceneAnims(); - _animator->updateAllObjectShapes(); - if (skipFlag()) - break; - - if (continueTime - _system->getMillis() >= 10) - delay(10); - } + delayUntil(continueTime, false, true); _screen->showMouse(); return 0; } @@ -501,15 +485,10 @@ int KyraEngine_LoK::o1_runWSAFrames(EMCState *script) { int wsaIndex = stackPos(5); _screen->hideMouse(); for (; startFrame <= endFrame; ++startFrame) { - uint32 nextRun = _system->getMillis() + delayTime * _tickLength; + const uint32 nextRun = _system->getMillis() + delayTime * _tickLength; _movieObjects[wsaIndex]->displayFrame(startFrame, 0, xpos, ypos, 0, 0, 0); _animator->_updateScreen = true; - while (_system->getMillis() < nextRun) { - _sprites->updateSceneAnims(); - _animator->updateAllObjectShapes(); - if (nextRun - _system->getMillis() >= 10) - delay(10); - } + delayUntil(nextRun, false, true); } _screen->showMouse(); return 0; @@ -693,18 +672,10 @@ int KyraEngine_LoK::o1_displayWSAFrameOnHidPage(EMCState *script) { int wsaIndex = stackPos(4); _screen->hideMouse(); - uint32 continueTime = waitTime * _tickLength + _system->getMillis(); + const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); _movieObjects[wsaIndex]->displayFrame(frame, 2, xpos, ypos, 0, 0, 0); _animator->_updateScreen = true; - while (_system->getMillis() < continueTime) { - _sprites->updateSceneAnims(); - _animator->updateAllObjectShapes(); - if (skipFlag()) - break; - - if (continueTime - _system->getMillis() >= 10) - delay(10); - } + delayUntil(continueTime, false, true); _screen->showMouse(); return 0; @@ -776,37 +747,21 @@ int KyraEngine_LoK::o1_displayWSASequentialFrames(EMCState *script) { if (endFrame >= startFrame) { int frame = startFrame; while (endFrame >= frame) { - uint32 continueTime = waitTime * _tickLength + _system->getMillis(); + const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); _movieObjects[wsaIndex]->displayFrame(frame, 0, xpos, ypos, 0, 0, 0); if (waitTime) _animator->_updateScreen = true; - while (_system->getMillis() < continueTime) { - _sprites->updateSceneAnims(); - _animator->updateAllObjectShapes(); - if (skipFlag()) - break; - - if (continueTime - _system->getMillis() >= 10) - delay(10); - } + delayUntil(continueTime, false, true); ++frame; } } else { int frame = startFrame; while (endFrame <= frame) { - uint32 continueTime = waitTime * _tickLength + _system->getMillis(); + const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); _movieObjects[wsaIndex]->displayFrame(frame, 0, xpos, ypos, 0, 0, 0); if (waitTime) _animator->_updateScreen = true; - while (_system->getMillis() < continueTime) { - _sprites->updateSceneAnims(); - _animator->updateAllObjectShapes(); - if (skipFlag()) - break; - - if (continueTime - _system->getMillis() >= 10) - delay(10); - } + delayUntil(continueTime, false, true); --frame; } } @@ -1060,16 +1015,7 @@ int KyraEngine_LoK::o1_walkCharacterToPoint(EMCState *script) { setCharacterPosition(character, 0); ++curPos; - nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis(); - while (_system->getMillis() < nextFrame) { - _sprites->updateSceneAnims(); - updateMousePointer(); - _timer->update(); - _animator->updateAllObjectShapes(); - updateTextFade(); - if ((nextFrame - _system->getMillis()) >= 10) - delay(10); - } + delayUntil(nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis(), true, true); } return 0; } @@ -1318,9 +1264,8 @@ int KyraEngine_LoK::o1_makeAmuletAppear(EMCState *script) { assert(_amuleteAnim); _screen->hideMouse(); snd_playSoundEffect(0x70); - uint32 nextTime = 0; for (int i = 0; _amuleteAnim[i] != 0xFF; ++i) { - nextTime = _system->getMillis() + 5 * _tickLength; + const uint32 nextTime = _system->getMillis() + 5 * _tickLength; uint8 code = _amuleteAnim[i]; if (code == 3 || code == 7) @@ -1335,12 +1280,7 @@ int KyraEngine_LoK::o1_makeAmuletAppear(EMCState *script) { amulet->displayFrame(code, 0, 224, 152, 0, 0, 0); _animator->_updateScreen = true; - while (_system->getMillis() < nextTime) { - _sprites->updateSceneAnims(); - _animator->updateAllObjectShapes(); - if (nextTime - _system->getMillis() >= 10) - delay(10); - } + delayUntil(nextTime, false, true); } _screen->showMouse(); } |