From 346dd3ec637dd21d5c52dac56d65f229f3087454 Mon Sep 17 00:00:00 2001 From: athrxx Date: Fri, 3 Jan 2020 00:04:39 +0100 Subject: KYRA: (HOF) - fix speech/sfx priority (bug #11301) It doesn't come as a big surprise that the original handles this more or less in the same manner as LOL. The Kyra games usually don't play many sfx at once. That's probably the reason why this never came up before. --- engines/kyra/engine/kyra_hof.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/engine/kyra_hof.cpp b/engines/kyra/engine/kyra_hof.cpp index 1d60c04035..bc09be038c 100644 --- a/engines/kyra/engine/kyra_hof.cpp +++ b/engines/kyra/engine/kyra_hof.cpp @@ -1457,9 +1457,15 @@ void KyraEngine_HoF::snd_playSoundEffect(int track, int volume) { _lastSfxTrack = track; } - int16 vocIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2]); - if (vocIndex != -1) { - _sound->voicePlay(_ingameSoundList[vocIndex], 0, 255, 255, true); + if (track == -1) + return; + + int16 prio = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2 + 1]); + int16 file = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2]); + prio = prio <= 0 ? -prio : (prio * volume) >> 8; + + if (file != -1 && _sound->useDigitalSfx()) { + _sound->voicePlay(_ingameSoundList[file], 0, volume, prio, true); } else if (_flags.platform == Common::kPlatformDOS) { if (_sound->getSfxType() == Sound::kMidiMT32) track = track < _mt32SfxMapSize ? _mt32SfxMap[track] - 1 : -1; @@ -1470,12 +1476,8 @@ void KyraEngine_HoF::snd_playSoundEffect(int track, int volume) { if (track != -1) KyraEngine_v1::snd_playSoundEffect(track); - - // TODO ?? Maybe there is a way to let users select whether they want - // voc, midi or adl sfx (even though it makes no sense to choose anything but voc). - // The PC-98 version has support for non-pcm sound effects, but only for tracks - // which also have voc files. The syntax would be: - // KyraEngine_v1::snd_playSoundEffect(vocIndex); + } else if (file != -1) { + KyraEngine_v1::snd_playSoundEffect(file); } } -- cgit v1.2.3