diff options
author | Scott Percival | 2019-12-22 17:42:24 +0800 |
---|---|---|
committer | Scott Percival | 2019-12-23 08:58:14 +0800 |
commit | 48499ac10a1f2b72959d763ac23462085276de79 (patch) | |
tree | 0174e258e2296c039367dcb73059d202e046375a /engines | |
parent | 9bbacd05398cb824c5b2c88991151968a17bdb62 (diff) | |
download | scummvm-rg350-48499ac10a1f2b72959d763ac23462085276de79.tar.gz scummvm-rg350-48499ac10a1f2b72959d763ac23462085276de79.tar.bz2 scummvm-rg350-48499ac10a1f2b72959d763ac23462085276de79.zip |
DIRECTOR: Fix _nextFrame from getting clobbered by exitFrame events
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/score.cpp | 18 |
1 files 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) |