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
This commit is contained in:
Matthew Hoops 2010-09-01 23:39:25 +00:00
parent a053ef7cd1
commit 1475f75653
3 changed files with 27 additions and 5 deletions

View File

@ -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);

View File

@ -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

View File

@ -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