aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/illusions/duckman/illusions_duckman.cpp1
-rw-r--r--engines/illusions/sound.cpp13
-rw-r--r--engines/illusions/sound.h2
3 files changed, 16 insertions, 0 deletions
diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp
index 1ffb9f68c4..326d8abb36 100644
--- a/engines/illusions/duckman/illusions_duckman.cpp
+++ b/engines/illusions/duckman/illusions_duckman.cpp
@@ -931,6 +931,7 @@ bool IllusionsEngine_Duckman::changeScene(uint32 sceneId, uint32 threadId, uint3
uint32 currSceneId = getCurrentScene();
if (currSceneId != 0x10003)
dumpCurrSceneFiles(currSceneId, callerThreadId);
+ _soundMan->stopLoopingSounds(); //Fix for global looping sound not stopping in falling scene.
_threads->terminateThreads(callerThreadId);
_controls->destroyControls();
_resSys->unloadSceneResources(0x10003, 0x10001);
diff --git a/engines/illusions/sound.cpp b/engines/illusions/sound.cpp
index bd39469d76..9a351a29bc 100644
--- a/engines/illusions/sound.cpp
+++ b/engines/illusions/sound.cpp
@@ -342,6 +342,10 @@ bool Sound::isPlaying() {
return g_system->getMixer()->isSoundHandleActive(_soundHandle);
}
+bool Sound::isLooping() {
+ return _looping;
+}
+
// SoundMan
SoundMan::SoundMan(IllusionsEngine *vm)
@@ -450,6 +454,15 @@ void SoundMan::stopSound(uint32 soundEffectId) {
sound->stop();
}
+void SoundMan::stopLoopingSounds() {
+ for (SoundListIterator it = _sounds.begin(); it != _sounds.end(); ++it) {
+ Sound *sound = *it;
+ if (sound->isPlaying() && sound->isLooping()) {
+ sound->stop();
+ }
+ }
+}
+
void SoundMan::unloadSounds(uint32 soundGroupId) {
SoundListIterator it = _sounds.begin();
while (it != _sounds.end()) {
diff --git a/engines/illusions/sound.h b/engines/illusions/sound.h
index 027228ef0b..db1d47c3df 100644
--- a/engines/illusions/sound.h
+++ b/engines/illusions/sound.h
@@ -103,6 +103,7 @@ public:
void play(int16 volume, int16 pan);
void stop();
bool isPlaying();
+ bool isLooping();
public:
uint32 _soundEffectId;
uint32 _soundGroupId;
@@ -159,6 +160,7 @@ public:
void loadSound(uint32 soundEffectId, uint32 soundGroupId, bool looping);
void playSound(uint32 soundEffectId, int16 volume, int16 pan);
void stopSound(uint32 soundEffectId);
+ void stopLoopingSounds();
void unloadSounds(uint32 soundGroupId);
protected: