aboutsummaryrefslogtreecommitdiff
path: root/engines/toltecs/script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/toltecs/script.cpp')
-rw-r--r--engines/toltecs/script.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp
index d95ac0ec06..d0bf39bb0f 100644
--- a/engines/toltecs/script.cpp
+++ b/engines/toltecs/script.cpp
@@ -896,7 +896,17 @@ void ScriptInterpreter::sfLoadAddPalette() {
void ScriptInterpreter::sfLoadScene() {
if (arg8(3) == 0) {
- _vm->_sound->stopSpeech();
+ // FIXME: Originally, this was stopSpeech(). However, we need to stop
+ // ALL sounds here (including sound effects and background sounds)
+ // before purgeCache() is called, otherwise the sound buffers will be
+ // invalidated. This is apparent when moving from a scene that has
+ // background sounds (such as the canyon at the beginning), to another
+ // one that doesn't (such as the map), and does not stop the sounds
+ // already playing. In this case, the engine will either crash or
+ // garbage will be heard through the speakers.
+ // TODO: We should either move purgeCache() elsewhere, or monitor
+ // which resources are still used before purging the cache.
+ _vm->_sound->stopAll();
_vm->_res->purgeCache();
_vm->loadScene(arg16(4));
} else {
@@ -1053,8 +1063,8 @@ void ScriptInterpreter::sfStartSequence() {
// TODO: It seems that music is always looping?
_vm->_musicPlayer->playMIDI(data, resourceSize, true);
} else {
- // TODO: Where does this occur? Are these SMF MIDI files?
- warning("sfStartSequence: resource %d isn't XMIDI", sequenceResIndex);
+ // Sanity check: this should never occur
+ error("sfStartSequence: resource %d isn't XMIDI", sequenceResIndex);
}
delete[] data;
@@ -1080,8 +1090,8 @@ void ScriptInterpreter::sfPlaySound2() {
}
void ScriptInterpreter::sfClearScreen() {
- // TODO
- debug("ScriptInterpreter::sfClearScreen");
+ // TODO: Occurs on every scene change, but seems unneeded
+ //debug("ScriptInterpreter::sfClearScreen");
}
void ScriptInterpreter::sfHandleInput() {