From 48499ac10a1f2b72959d763ac23462085276de79 Mon Sep 17 00:00:00 2001 From: Scott Percival Date: Sun, 22 Dec 2019 17:42:24 +0800 Subject: DIRECTOR: Fix _nextFrame from getting clobbered by exitFrame events --- engines/director/score.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/engines/director/score.cpp b/engines/director/score.cpp index acbccf145f..062cff06bd 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -1351,8 +1351,22 @@ void Score::update() { } // For previous frame - if (_currentFrame > 0) - _lingo->processEvent(kEventExitFrame); + if (_currentFrame > 0) { + // When Lingo::func_goto* is called, _nextFrame is set + // and _skipFrameAdvance is set to true. + // However, the exitFrame event can overwrite the value + // for _nextFrame before it can be used. + // Because we still want to call exitFrame, we check if + // a goto call has been made and if so, cache the value + // of _nextFrame so it doesn't get wiped. + if (_vm->_skipFrameAdvance) { + uint16 nextFrameCache = _nextFrame; + _lingo->processEvent(kEventExitFrame); + _nextFrame = nextFrameCache; + } else { + _lingo->processEvent(kEventExitFrame); + } + } if (!_vm->_playbackPaused) { if (_nextFrame) -- cgit v1.2.3