Skip to content

Commit

Permalink
SCI: Fix looping of sounds that are not initialized yet
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
csnover committed Jun 19, 2017
1 parent d556dcc commit 87895b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions engines/sci/sound/soundcmd.cpp
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 87895b9

Please sign in to comment.