From c17efa585ee0ddef3e243bc4da08e5dfc80f579b Mon Sep 17 00:00:00 2001 From: YYxsCnnPP Date: Mon, 20 Jun 2022 22:05:57 -0300 Subject: [PATCH] SCUMM: Fix lip sync when speech is overriden --- engines/scumm/he/sound_he.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index ca851c85537..6790bfe23f5 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -270,6 +270,11 @@ int SoundHE::getSoundVar(int sound, int var) { return isSoundCodeUsed(sound); } + // Disable lip sync if the speech was overriden + if (_heTalkOffset != 0) { + return 0; + } + assertRange(0, var, 25, "sound variable"); int chan = -1; @@ -754,6 +759,10 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags, _mixer->stopHandle(_heSoundChannels[heChannel]); if (!stream) { + if (soundID == 1) { + // Reset variable to signal getSoundVar that lip sync is allowed + _heTalkOffset = 0; + } stream = Audio::makeRawStream(ptr + heOffset + 8, size, rate, flags, DisposeAfterUse::NO); } _mixer->playStream(type, &_heSoundChannels[heChannel],