aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authormd52011-02-28 00:18:23 +0200
committermd52011-02-28 00:18:23 +0200
commitc7bfbc31e2f23f899dcf884ef9a9ba3a7bd0ebe8 (patch)
tree75656eabba5ad06da150b88e8772ff2b51ffd0c4 /engines/sci
parent4d3392343675faec3b2427a7cd2d19ddce69884b (diff)
downloadscummvm-rg350-c7bfbc31e2f23f899dcf884ef9a9ba3a7bd0ebe8.tar.gz
scummvm-rg350-c7bfbc31e2f23f899dcf884ef9a9ba3a7bd0ebe8.tar.bz2
scummvm-rg350-c7bfbc31e2f23f899dcf884ef9a9ba3a7bd0ebe8.zip
SCI: Fixed bug #3106107 - "QFG3: Crash when saving outside palace"
Ignore requests to alter a song's hold value while it's being faded, and reset a song's hold value when fading starts. This ensures that the song will actually stop when fading is done and won't keep looping forever.
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/sound/soundcmd.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 1e6d0aef87..33be8f4bca 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -318,6 +318,9 @@ reg_t SoundCommandParser::kDoSoundFade(int argc, reg_t *argv, reg_t acc) {
int volume = musicSlot->volume;
+ // Reset hold so that the song can actually stop
+ musicSlot->hold = -1;
+
// If sound is not playing currently, set signal directly
if (musicSlot->status != kSoundPlaying) {
debugC(kDebugLevelSound, "kDoSound(fade): %04x:%04x fading requested, but sound is currently not playing", PRINT_REG(obj));
@@ -531,6 +534,12 @@ reg_t SoundCommandParser::kDoSoundSetHold(int argc, reg_t *argv, reg_t acc) {
return acc;
}
+ // Is the song being faded? If yes, don't set a hold value, otherwise the
+ // song will never actually stop. Fixes bug #3106107.
+ if (musicSlot->fadeStep && argv[1].toSint16() != -1) {
+ warning("kDoSound(setHold): Attempt to set a hold value (%d) to a song being faded, ignoring", argv[1].toSint16());
+ return acc;
+ }
// Set the special hold marker ID where the song should be looped at.
musicSlot->hold = argv[1].toSint16();
return acc;