From d0082982d52a98674cafca08a0822375c37a3d83 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 29 Aug 2017 09:25:37 +0200 Subject: WAGE: Make sound blocking --- engines/wage/sound.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'engines/wage') diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp index fd6adaea19..36490695e1 100644 --- a/engines/wage/sound.cpp +++ b/engines/wage/sound.cpp @@ -49,6 +49,7 @@ #include "audio/mixer.h" #include "audio/decoders/raw.h" #include "common/stream.h" +#include "common/system.h" #include "wage/wage.h" #include "wage/entities.h" @@ -93,6 +94,24 @@ void WageEngine::playSound(Common::String soundName) { _mixer->playStream(Audio::Mixer::kPlainSoundType, &s->_handle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); + + while (_mixer->isSoundHandleActive(s->_handle) && !_shouldQuit) { + Common::Event event; + + _eventMan->pollEvent(event); + + switch (event.type) { + case Common::EVENT_QUIT: + if (saveDialog()) + _shouldQuit = true; + break; + default: + break; + } + + _system->updateScreen(); + _system->delayMillis(10); + } } void WageEngine::updateSoundTimerForScene(Scene *scene, bool firstTime) { -- cgit v1.2.3