aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-13 19:21:25 +0100
committerEugene Sandulenko2019-12-13 19:21:25 +0100
commit237c776b8e2176fad599e665fd75694e4bbf4f48 (patch)
treed0f7068bbafe386f9930dafb897c90af46742641
parentd09cb00df11701282c809467b45d6d41df14bf0f (diff)
downloadscummvm-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.
-rw-r--r--engines/director/score.cpp25
-rw-r--r--engines/director/score.h1
2 files changed, 15 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;
diff --git a/engines/director/score.h b/engines/director/score.h
index d217a47227..1b8c8109f2 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -164,6 +164,7 @@ private:
byte _currentFrameRate;
uint16 _castArrayStart;
uint16 _currentFrame;
+ uint16 _nextFrame;
int _currentLabel;
uint32 _flags;
uint16 _castArrayEnd;