From a05b085a21d2bdeedd73100d53bc5c2382bcea50 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 6 Apr 2008 14:58:02 +0000 Subject: Fixed potentional crash. svn-id: r31432 --- engines/kyra/scene_v2.cpp | 2 +- engines/kyra/sound.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp index ef9fde2eea..498ddc1c6b 100644 --- a/engines/kyra/scene_v2.cpp +++ b/engines/kyra/scene_v2.cpp @@ -115,7 +115,7 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk if (newSoundFile) { if (_sound->getMusicType() == Sound::kAdlib) { - while (((SoundAdlibPC*)_sound)->isPlaying()) + while (_sound->isPlaying()) _system->delayMillis(10); } else { while (waitTime > _system->getMillis()) diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 0c40dec323..0ffb1c73b5 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -137,6 +137,13 @@ public: */ virtual void playSoundEffect(uint8 track) = 0; + /** + * Checks if the sound driver plays any sound + * + * @return true if playing, false otherwise + */ + virtual bool isPlaying() const { return false; } + /** * Starts fading out the volume. * @@ -465,6 +472,7 @@ public: void playTrack(uint8 track) { _music->playTrack(track); } void haltTrack() { _music->haltTrack(); } + bool isPlaying() const { return _music->isPlaying() | _sfx->isPlaying(); } void playSoundEffect(uint8 track) { _sfx->playSoundEffect(track); } -- cgit v1.2.3