diff options
author | Matthew Hoops | 2010-09-01 23:39:25 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-09-01 23:39:25 +0000 |
commit | 1475f756539e81182cb9aaa8188ddb354ea7769f (patch) | |
tree | 1c378a273e740bf73de6da223a8a17d955133546 | |
parent | a053ef7cd18400058af9ec39e53481ba88455b96 (diff) | |
download | scummvm-rg350-1475f756539e81182cb9aaa8188ddb354ea7769f.tar.gz scummvm-rg350-1475f756539e81182cb9aaa8188ddb354ea7769f.tar.bz2 scummvm-rg350-1475f756539e81182cb9aaa8188ddb354ea7769f.zip |
MOHAWK: Update videos when the delay opcode is called
The fixes a couple scripts which decide to delay through a background video turning into a virtual blocking video.
svn-id: r52488
-rw-r--r-- | engines/mohawk/riven.cpp | 18 | ||||
-rw-r--r-- | engines/mohawk/riven.h | 12 | ||||
-rw-r--r-- | engines/mohawk/riven_scripts.cpp | 2 |
3 files changed, 27 insertions, 5 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 18ebea20db..4c53f867d3 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -593,6 +593,24 @@ void MohawkEngine_Riven::runHotspotScript(uint16 hotspot, uint16 scriptType) { } } +void MohawkEngine_Riven::delayAndUpdate(uint32 ms) { + uint32 startTime = _system->getMillis(); + + while (_system->getMillis() < startTime + ms && !shouldQuit()) { + bool needsUpdate = _gfx->runScheduledWaterEffects(); + needsUpdate |= _video->updateBackgroundMovies(); + + Common::Event event; + while (_system->getEventManager()->pollEvent(event)) + ; + + if (needsUpdate) + _system->updateScreen(); + + _system->delayMillis(10); // Ease off the CPU + } +} + void MohawkEngine_Riven::runLoadDialog() { GUI::SaveLoadChooser slc("Load Game:", "Load"); slc.setSaveMode(false); diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index aa97250627..d65dd7db05 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -153,10 +153,7 @@ private: bool _ignoreNextMouseUp; public: - Common::SeekableReadStream *getExtrasResource(uint32 tag, uint16 id); - bool _activatedSLST; - void runLoadDialog(); - + // Stack/card/script funtions void changeToCard(uint16 dest); void changeToStack(uint16); void refreshCard(); @@ -169,6 +166,7 @@ public: uint16 matchRMAPToCard(uint32); uint32 getCurCardRMAP(); + // Hotspot functions/variables RivenHotspot *_hotspots; int32 _curHotspot; Common::Array<ZipMode> _zipModeData; @@ -177,6 +175,7 @@ public: int32 getCurHotspot() { return _curHotspot; } Common::String getHotspotName(uint16 hotspot); + // Variable functions void initVars(); uint32 getVarCount() { return _varCount; } uint32 getGlobalVar(uint32 index); @@ -185,8 +184,13 @@ public: uint32 *matchVarToString(Common::String varName); uint32 *matchVarToString(const char *varName); + // Miscellaneous void setGameOver() { _gameOver = true; } void ignoreNextMouseUp() { _ignoreNextMouseUp = true; } + Common::SeekableReadStream *getExtrasResource(uint32 tag, uint16 id); + bool _activatedSLST; + void runLoadDialog(); + void delayAndUpdate(uint32 ms); }; } // End of namespace Mohawk diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index 17ff0716c5..2b91dce35a 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -398,7 +398,7 @@ void RivenScript::changeCursor(uint16 op, uint16 argc, uint16 *argv) { void RivenScript::delay(uint16 op, uint16 argc, uint16 *argv) { debug(2, "Delay %dms", argv[0]); if (argv[0] > 0) - _vm->_system->delayMillis(argv[0]); + _vm->delayAndUpdate(argv[0]); } // Command 17: call external command |