aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEric Fry2019-09-23 23:50:24 +1000
committerEugene Sandulenko2019-09-23 20:39:13 +0200
commit64cf3b6e9b9f54ae643e9b3aa6d1db249f53d3bc (patch)
treeb62b0f2be8f8a2df1b586a1db53e6faf91cd7f34 /engines
parentb4b9ad1743dcf97999b7fda4860aa964d119118c (diff)
downloadscummvm-rg350-64cf3b6e9b9f54ae643e9b3aa6d1db249f53d3bc.tar.gz
scummvm-rg350-64cf3b6e9b9f54ae643e9b3aa6d1db249f53d3bc.tar.bz2
scummvm-rg350-64cf3b6e9b9f54ae643e9b3aa6d1db249f53d3bc.zip
ILLUSIONS: DUCKMAN: Fix endless SFX bug #11161
Diffstat (limited to 'engines')
-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: