Sound queue order is different in HE72+ games.

Fixes wrong music been played in some locations.

svn-id: r20075
This commit is contained in:
Travis Howell 2006-01-18 06:06:14 +00:00
parent a4151c9982
commit b88a79750b
2 changed files with 29 additions and 13 deletions

View file

@ -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);
}
}
}

View file

@ -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);
}