diff options
author | Norbert Lange | 2009-08-24 17:51:47 +0000 |
---|---|---|
committer | Norbert Lange | 2009-08-24 17:51:47 +0000 |
commit | 917d4b78b36d6c5a5c25a03e7ee6a1c1b6a85fd5 (patch) | |
tree | e652563203a00f8acecfaafbf93c64dbfbd13f25 /engines/kyra/script_lok.cpp | |
parent | 5f87d5090cfcb34cda3c1f5d430e0865344d7366 (diff) | |
parent | dd7868acc2512c9761d892e67a4837f4dc38bdc0 (diff) | |
download | scummvm-rg350-917d4b78b36d6c5a5c25a03e7ee6a1c1b6a85fd5.tar.gz scummvm-rg350-917d4b78b36d6c5a5c25a03e7ee6a1c1b6a85fd5.tar.bz2 scummvm-rg350-917d4b78b36d6c5a5c25a03e7ee6a1c1b6a85fd5.zip |
Merge with trunk
svn-id: r43701
Diffstat (limited to 'engines/kyra/script_lok.cpp')
-rw-r--r-- | engines/kyra/script_lok.cpp | 104 |
1 files changed, 16 insertions, 88 deletions
diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp index a778a2066b..0a96db8277 100644 --- a/engines/kyra/script_lok.cpp +++ b/engines/kyra/script_lok.cpp @@ -429,22 +429,13 @@ 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 +451,9 @@ 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 +483,9 @@ 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; @@ -597,7 +573,6 @@ int KyraEngine_LoK::o1_setCustomPaletteRange(EMCState *script) { int KyraEngine_LoK::o1_loadPageFromDisk(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_loadPageFromDisk(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); _screen->loadPageFromDisk(stackPosString(0), stackPos(1)); - _animator->_updateScreen = true; return 0; } @@ -665,7 +640,6 @@ int KyraEngine_LoK::o1_copyWSARegion(EMCState *script) { int srcPage = stackPos(4); int dstPage = stackPos(5); _screen->copyRegion(xpos, ypos, xpos, ypos, width, height, srcPage, dstPage); - _animator->_updateScreen = true; return 0; } @@ -693,18 +667,9 @@ 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 +741,17 @@ 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 +1005,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 +1254,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) @@ -1333,14 +1268,7 @@ int KyraEngine_LoK::o1_makeAmuletAppear(EMCState *script) { snd_playSoundEffect(0x73); 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(); } |