From 87895b97f76488d531c50c05a25aaabc4d73aaf3 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sun, 18 Jun 2017 00:36:46 -0500 Subject: SCI: Fix looping of sounds that are not initialized yet This fixes at least the character selection screen in QFG4CD, where the sound for the torches is supposed to loop, but wasn't because kDoSoundSetLoop would bail out before setting the loop property on the soundObj. --- engines/sci/sound/soundcmd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/sci/sound/soundcmd.cpp') diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index f7cb6cda5c..280015f222 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -767,6 +767,9 @@ reg_t SoundCommandParser::kDoSoundSetLoop(EngineState *s, int argc, reg_t *argv) debugC(kDebugLevelSound, "kDoSound(setLoop): %04x:%04x, %d", PRINT_REG(obj), value); + const uint16 loopCount = value == -1 ? 0xFFFF : 1; + writeSelectorValue(_segMan, obj, SELECTOR(loop), loopCount); + MusicEntry *musicSlot = _music->getSlot(obj); if (!musicSlot) { // Apparently, it's perfectly normal for a game to call cmdSetSoundLoop @@ -782,9 +785,6 @@ reg_t SoundCommandParser::kDoSoundSetLoop(EngineState *s, int argc, reg_t *argv) return s->r_acc; } - const uint16 loopCount = value == -1 ? 0xFFFF : 1; - writeSelectorValue(_segMan, obj, SELECTOR(loop), loopCount); - #ifdef ENABLE_SCI32 if (_soundVersion >= SCI_VERSION_2_1_MIDDLE && musicSlot->isSample) { g_sci->_audio32->setLoop(ResourceId(kResourceTypeAudio, musicSlot->resourceId), musicSlot->soundObj, value == -1); -- cgit v1.2.3