From 0fefe4602c29b71449d568a7478f8572ae7eb69c Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Mon, 7 Jul 2003 05:45:55 +0000 Subject: Fix for bug [761637] FOA: Music problems in endgame/credits. Revision to the handle_maker() fix for bug #733401, since that didn't seem to take care of the problem. This fix chomps marker queue entries if it finds a matching marker not at the head of the queue. This might cause inappropriate behavior elsewhere; regression testing is advised. svn-id: r8831 --- scumm/imuse.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index ebb5983931..cacf2048bc 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -285,8 +285,8 @@ void IMuseInternal::init_players() { int i; for (i = ARRAYSIZE(_players); i != 0; i--, player++) { - player->clear(); // Used to just set _active to false player->_se = this; + player->clear(); // Used to just set _active to false } } @@ -348,25 +348,28 @@ void IMuseInternal::handle_marker(uint id, byte data) { if (_queue_adding && _queue_sound == id && data == _queue_marker) return; - // Fix for bug #733401: It would seem that sometimes the - // queue read position gets out of sync (possibly just - // reset to zero). Therefore, the read position should - // skip over any empty (i.e. all zeros) queue entries - // until it finds a legit entry to review. + // Fix for bug #733401, revised for bug #761637: + // It would seem that sometimes a marker is in the queue + // but not at the head position. In the case of our bug, + // this seems to be the result of commands in the queue + // for songs that are no longer playing. So we skip + // ahead to the appropriate marker, effectively chomping + // anything in the queue before it. This fixes the FOA + // end credits music, but needs to be tested for inappopriate + // behavior elsewhere. pos = _queue_end; while (pos != _queue_pos) { p = _cmd_queue[pos].array; - if ((p[0] | p[1] | p[2] | p[3] | p[4] | p[5] | p[6] | p[7]) != 0) + if (p[0] == TRIGGER_ID && p[1] == id && p[2] == data) break; - warning ("Skipping empty command queue entry at position %d", pos); pos = (pos + 1) & (ARRAYSIZE(_cmd_queue) - 1); } if (pos == _queue_pos) return; - if (p[0] != TRIGGER_ID || p[1] != id || p[2] != data) - return; + if (pos != _queue_end) + warning ("Skipping entries in iMuse command queue to reach marker"); _trigger_count--; _queue_cleared = false; -- cgit v1.2.3