From 8dd34921945ea0ce7f77e6c71ec5fbafaeb77622 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 11 Jul 2009 15:00:40 +0000 Subject: [PATCH] SCI: don't let TimerSongIterator loop forever, and don't immediately signal completion when starting it. This fixes a sync issue with the departing spaceship at the start of SQ4CD (after the intro). svn-id: r42385 --- engines/sci/engine/ksound.cpp | 1 - engines/sci/sfx/iterator.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 4ba89713977..95c2eaab1df 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -823,7 +823,6 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { sampleLen = s->_sound.startAudio(65535, number); // Also create iterator, that will fire SI_FINISHED event, when the sound is done playing s->_sound.sfx_add_song(build_timeriterator(s, sampleLen), 0, handle, number); - PUT_SEL32V(obj, signal, sampleLen); } else { if (!s->resmgr->testResource(ResourceId(kResourceTypeSound, number))) { warning("Could not open song number %d", number); diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index 6c5706a8c1e..dc2979abda2 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -1173,7 +1173,9 @@ TimerSongIterator::TimerSongIterator(int delta) int TimerSongIterator::nextCommand(byte *buf, int *result) { if (_delta) { - return _delta; + int d = _delta; + _delta = 0; + return d; } return SI_FINISHED; }