aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2018-04-15 06:17:45 +0200
committerBastien Bouclet2018-04-15 06:17:45 +0200
commitb1f927f10577c4547b0667776d5df124d3a8dd15 (patch)
tree3d719cd8d44f3b4552c06cf34f15cfa36d9a04cf /engines/mohawk
parent85c802c9b74d2cbafd68dcc8c2e88423e66ccb36 (diff)
downloadscummvm-rg350-b1f927f10577c4547b0667776d5df124d3a8dd15.tar.gz
scummvm-rg350-b1f927f10577c4547b0667776d5df124d3a8dd15.tar.bz2
scummvm-rg350-b1f927f10577c4547b0667776d5df124d3a8dd15.zip
MOHAWK: MYST: Make changeBackgroundSound wait for the effect to complete
Fixes #10489.
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/myst_scripts.cpp10
-rw-r--r--engines/mohawk/myst_scripts.h1
2 files changed, 9 insertions, 2 deletions
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index 70923e93d5..4b22a94d0c 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -625,6 +625,8 @@ void MystScriptParser::o_copyImageToBackBuffer(uint16 var, const ArgumentsArray
}
void MystScriptParser::o_changeBackgroundSound(uint16 var, const ArgumentsArray &args) {
+ soundWaitStop();
+
// Used on Stoneship Card 2080
// Used on Channelwood Card 3225 with argc = 8 i.e. Conditional Sound List
Common::MemoryWriteStreamDynamic writeStream = Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
@@ -787,12 +789,16 @@ void MystScriptParser::o_soundWaitStop(uint16 var, const ArgumentsArray &args) {
// Used on Selenitic Card 1191 (Maze Runner)
// Used on Mechanical Card 6267 (Code Lock)
// Used when Button is pushed...
- while (_vm->_sound->isEffectPlaying())
+ soundWaitStop();
+}
+
+void MystScriptParser::soundWaitStop() const {
+ while (_vm->_sound->isEffectPlaying() && !Engine::shouldQuit())
_vm->doFrame();
}
void MystScriptParser::o_quit(uint16 var, const ArgumentsArray &args) {
- _vm->quitGame();
+ Engine::quitGame();
}
void MystScriptParser::showMap() {
diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h
index 3ef8663324..a7a840b9d3 100644
--- a/engines/mohawk/myst_scripts.h
+++ b/engines/mohawk/myst_scripts.h
@@ -87,6 +87,7 @@ public:
void showMap();
void animatedUpdate(const ArgumentsArray &args, uint16 delay);
+ void soundWaitStop() const;
// Common opcodes
DECLARE_OPCODE(o_toggleVar);