From b88a79750b95e75e8ae15ca2839205bb35545c68 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 18 Jan 2006 06:06:14 +0000 Subject: Sound queue order is different in HE72+ games. Fixes wrong music been played in some locations. svn-id: r20075 --- scumm/sound.cpp | 38 +++++++++++++++++++++++++++----------- scumm/sound_he.cpp | 4 ++-- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 534374858c..fb04087eb2 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -142,17 +142,33 @@ void Sound::processSoundQueues() { int snd, heOffset, heChannel, heFlags; int data[16]; - while (_soundQue2Pos) { - _soundQue2Pos--; - snd = _soundQue2[_soundQue2Pos].sound; - heOffset = _soundQue2[_soundQue2Pos].offset; - heChannel = _soundQue2[_soundQue2Pos].channel; - heFlags = _soundQue2[_soundQue2Pos].flags; - if (snd) { - if (_vm->_heversion>= 60) - playHESound(snd, heOffset, heChannel, heFlags); - else - playSound(snd); + if (_vm->_heversion >= 72) { + for (i = 0; i <_soundQue2Pos; i++) { + snd = _soundQue2[i].sound; + heOffset = _soundQue2[i].offset; + heChannel = _soundQue2[i].channel; + heFlags = _soundQue2[i].flags; + if (snd) { + if (_vm->_heversion>= 60) + playHESound(snd, heOffset, heChannel, heFlags); + else + playSound(snd); + } + } + _soundQue2Pos = 0; + } else { + while (_soundQue2Pos) { + _soundQue2Pos--; + snd = _soundQue2[_soundQue2Pos].sound; + heOffset = _soundQue2[_soundQue2Pos].offset; + heChannel = _soundQue2[_soundQue2Pos].channel; + heFlags = _soundQue2[_soundQue2Pos].flags; + if (snd) { + if (_vm->_heversion>= 60) + playHESound(snd, heOffset, heChannel, heFlags); + else + playSound(snd); + } } } diff --git a/scumm/sound_he.cpp b/scumm/sound_he.cpp index 18e4a3439f..560a4d5704 100644 --- a/scumm/sound_he.cpp +++ b/scumm/sound_he.cpp @@ -416,7 +416,7 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) { else if (READ_UINT32(ptr) == MKID('DIGI') || READ_UINT32(ptr) == MKID('TALK')) { byte *sndPtr = ptr; - priority = *(ptr + 18); + priority = (soundID > _vm->_numSounds) ? 255 : *(ptr + 18); rate = READ_LE_UINT16(ptr + 22); ptr += 8 + READ_BE_UINT32(ptr + 12); @@ -480,7 +480,7 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) { _currentMusic = soundID; _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); } - else { + else if (READ_UINT32(ptr) == MKID('MIDI')) { if (_vm->_musicEngine) { _vm->_musicEngine->startSound(soundID); } -- cgit v1.2.3