diff options
author | Nipun Garg | 2019-08-18 01:12:59 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:34 +0200 |
commit | 6fbadccf0874dffbe09be5908b523bd480805b83 (patch) | |
tree | 8bc12fb202f6e017dbb5d2ccf1756fed876405d2 /engines/hdb | |
parent | 7e0af9a2cbcc4b48cf30b507575014e87555eb1d (diff) | |
download | scummvm-rg350-6fbadccf0874dffbe09be5908b523bd480805b83.tar.gz scummvm-rg350-6fbadccf0874dffbe09be5908b523bd480805b83.tar.bz2 scummvm-rg350-6fbadccf0874dffbe09be5908b523bd480805b83.zip |
HDB: Fix voice playing when no message on screen
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/hdb.cpp | 6 | ||||
-rw-r--r-- | engines/hdb/menu.cpp | 1 | ||||
-rw-r--r-- | engines/hdb/sound.cpp | 8 | ||||
-rw-r--r-- | engines/hdb/sound.h | 10 |
4 files changed, 21 insertions, 4 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 1eaa102927..43b419abdc 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -214,6 +214,7 @@ void HDBGame::changeGameState() { break; case GAME_PLAY: _menu->startMenu(); + _sound->stopVoices(); _gameState = GAME_MENU; break; case GAME_LOADING: @@ -1022,6 +1023,11 @@ Common::Error HDBGame::run() { _map->drawForegrounds(); _ai->animateTargets(); + // Check for voice to interrupt + if (!_window->dialogActive() && !_window->dialogChoiceActive() && !_window->msgBarActive()) { + _sound->stopVoices(); + } + _window->drawDialog(); _window->drawDialogChoice(); _window->drawInventory(); diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp index 3dc7d2fe36..c1427c6ab4 100644 --- a/engines/hdb/menu.cpp +++ b/engines/hdb/menu.cpp @@ -33,6 +33,7 @@ #include "hdb/menu.h" #include "hdb/map.h" #include "hdb/mpc.h" +#include "hdb/window.h" namespace HDB { diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp index b41622b39e..28cee431ae 100644 --- a/engines/hdb/sound.cpp +++ b/engines/hdb/sound.cpp @@ -1626,14 +1626,14 @@ void Sound::playVoice(int index, int actor) { if (!_voicesOn || g_hdb->isPPC()) return; - // make sure we aren't playing a line more than once this time (only on CHANNEL 0) - if (!actor && _voicePlayed[index - FIRST_VOICE]) - return; - // is voice channel already active? if so, shut 'er down (automagically called StopVoice via callback) if (_voices[actor].active) g_hdb->_mixer->stopHandle(*_voices[actor].handle); + // make sure we aren't playing a line more than once this time (only on CHANNEL 0) + if (!actor && _voicePlayed[index - FIRST_VOICE]) + return; + Common::SeekableReadStream *stream = nullptr; if (g_hdb->getPlatform() == Common::kPlatformLinux) { Common::String updatedName(soundList[index].name); diff --git a/engines/hdb/sound.h b/engines/hdb/sound.h index d810cae28c..bbc4174f63 100644 --- a/engines/hdb/sound.h +++ b/engines/hdb/sound.h @@ -1513,6 +1513,16 @@ public: void playSound(int index); void playSoundEx(int index, int channel, bool loop); void playVoice(int index, int actor); + void stopVoices() { + if (_voices[0].active) { + g_hdb->_mixer->stopHandle(*_voices[0].handle); + _voices[0].active = false; + } + if (_voices[1].active) { + g_hdb->_mixer->stopHandle(*_voices[1].handle); + _voices[1].active = false; + } + } void startMusic(SoundType song); void fadeInMusic(SoundType song, int ramp); void fadeOutMusic(int ramp); |