From 3de75901c3826ad64c7d80f0d1c870bd6055e54f Mon Sep 17 00:00:00 2001 From: Adrian Frühwirth Date: Wed, 14 Mar 2018 19:20:57 +0100 Subject: TUCKER: Fix wrong sound effects being played Fixes Trac#6376, Trac#6377 and probably many more unreported instances of wrong audio samples being played. --- engines/tucker/resource.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index cab26a0636..0ea24adf2d 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -900,6 +900,21 @@ void TuckerEngine::loadFx() { break; } if (s->_type == 8) { + // type 8 is basically a pointer to another type 6 sample + + // WORKAROUND + // There is at least one instance (namely in location 40) where the reference + // is to another sample which has not yet been read in. + // It seems that the original doesn't properly handle this case which + // results in the sample not being played at all. + // We just ignore and hop over these. + if (s->_num >= i) { + --i; + continue; + } + + assert(s->_num >= 0 && s ->_num < i); + s->_num = _locationSoundsTable[s->_num]._num; s->_type = 6; } } @@ -924,6 +939,7 @@ void TuckerEngine::loadFx() { } else { error("loadFx() - Index not found for location %d", _locationNum); } + } void TuckerEngine::loadSound(Audio::Mixer::SoundType type, int num, int volume, bool loop, Audio::SoundHandle *handle) { -- cgit v1.2.3