diff options
author | Eugene Sandulenko | 2019-12-13 19:21:25 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-12-13 19:21:25 +0100 |
commit | 237c776b8e2176fad599e665fd75694e4bbf4f48 (patch) | |
tree | d0f7068bbafe386f9930dafb897c90af46742641 /engines/director/score.cpp | |
parent | d09cb00df11701282c809467b45d6d41df14bf0f (diff) | |
download | scummvm-rg350-237c776b8e2176fad599e665fd75694e4bbf4f48.tar.gz scummvm-rg350-237c776b8e2176fad599e665fd75694e4bbf4f48.tar.bz2 scummvm-rg350-237c776b8e2176fad599e665fd75694e4bbf4f48.zip |
DIRECTOR: Changed notion of 'go to' commands to postponed
Previously, we had immediate effect on _currentFrame, which could
affect the scripts, and we were losing event for 'exitFrame'. Now,
instead we're scheduling next frame in those cases.
Diffstat (limited to 'engines/director/score.cpp')
-rw-r--r-- | engines/director/score.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 1c7fed1ade..a3deb95433 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -83,6 +83,7 @@ Score::Score(DirectorEngine *vm) { _currentFrameRate = 20; _castArrayStart = _castArrayEnd = 0; _currentFrame = 0; + _nextFrame = 0; _currentLabel = 0; _nextFrameTime = 0; _flags = 0; @@ -984,7 +985,7 @@ void Score::setStartToLabel(Common::String label) { for (i = _labels->begin(); i != _labels->end(); ++i) { if ((*i)->name.equalsIgnoreCase(label)) { - _currentFrame = (*i)->number; + _nextFrame = (*i)->number; return; } } @@ -1061,10 +1062,10 @@ void Score::gotoLoop() { // This command has the playback head contonuously return to the first marker to to the left and then loop back. // If no marker are to the left of the playback head, the playback head continues to the right. if (_labels == NULL) { - _currentFrame = 0; + _nextFrame = 1; return; } else { - _currentFrame = _currentLabel; + _nextFrame = _currentLabel; } _vm->_skipFrameAdvance = true; @@ -1085,16 +1086,12 @@ int Score::getCurrentLabelNumber() { void Score::gotoNext() { // we can just try to use the current frame and get the next label - _currentFrame = getNextLabelNumber(_currentFrame); - - _vm->_skipFrameAdvance = true; + _nextFrame = getNextLabelNumber(_currentFrame); } void Score::gotoPrevious() { // we actually need the frame of the label prior to the most recent label. - _currentFrame = getPreviousLabelNumber(getCurrentLabelNumber()); - - _vm->_skipFrameAdvance = true; + _nextFrame = getPreviousLabelNumber(getCurrentLabelNumber()); } int Score::getNextLabelNumber(int referenceFrame) { @@ -1310,8 +1307,14 @@ void Score::update() { if (_currentFrame > 0) _lingo->processEvent(kEventExitFrame); - if (!_vm->_playbackPaused && !_vm->_skipFrameAdvance) - _currentFrame++; + if (!_vm->_playbackPaused) { + if (_nextFrame) + _currentFrame = _nextFrame; + else + _currentFrame++; + } + + _nextFrame = 0; _vm->_skipFrameAdvance = false; |