aboutsummaryrefslogtreecommitdiff
path: root/engines/director/score.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-13 18:04:45 +0100
committerEugene Sandulenko2019-12-13 18:04:45 +0100
commit513a7d878c55be83677ef76c363e64bdda64f694 (patch)
treed30172af2ea6375d0b7d1665ce5ee0a1e758fc4d /engines/director/score.cpp
parentfa8f76ee5bf4672578112af30e264355d5548a16 (diff)
downloadscummvm-rg350-513a7d878c55be83677ef76c363e64bdda64f694.tar.gz
scummvm-rg350-513a7d878c55be83677ef76c363e64bdda64f694.tar.bz2
scummvm-rg350-513a7d878c55be83677ef76c363e64bdda64f694.zip
DIRECTOR: Correct sequence of events around frame drawing
Diffstat (limited to 'engines/director/score.cpp')
-rw-r--r--engines/director/score.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 3cd59b70d2..36e75eae06 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -418,6 +418,8 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
uint16 channelOffset;
Frame *initial = new Frame(_vm);
+ // Push a frame at frame#0 position.
+ // This makes all indexing simpler
_frames.push_back(initial);
// This is a representation of the channelData. It gets overridden
@@ -1305,18 +1307,25 @@ void Score::update() {
return;
}
- debugC(1, kDebugImages, "****************************** Current frame: %d", _currentFrame + 1);
+ // For previous frame
+ if (_currentFrame > 0)
+ _lingo->processEvent(kEventExitFrame);
+
+ if (!_vm->_playbackPaused && !_vm->_skipFrameAdvance)
+ _currentFrame++;
+
+ _vm->_skipFrameAdvance = false;
+
+ if (_currentFrame >= _frames.size())
+ return;
+
+ debugC(1, kDebugImages, "****************************** Current frame: %d", _currentFrame);
_surface->clear();
_surface->copyFrom(*_trailSurface);
_lingo->executeImmediateScripts(_frames[_currentFrame]);
- // Enter and exit from previous frame (Director 4)
- _lingo->processEvent(kEventEnterFrame);
- _lingo->processEvent(kEventNone);
- // TODO Director 6 - another order
-
if (_vm->getVersion() >= 6) {
_lingo->processEvent(kEventBeginSprite);
// TODO Director 6 step: send beginSprite event to any sprites whose span begin in the upcoming frame
@@ -1324,6 +1333,14 @@ void Score::update() {
// TODO: Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame
}
+ _frames[_currentFrame]->prepareFrame(this);
+ // Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell, p.100)
+
+ // Enter and exit from previous frame (Director 4)
+ _lingo->processEvent(kEventEnterFrame);
+ _lingo->processEvent(kEventNone);
+ // TODO Director 6 - another order
+
Common::SortedArray<Label *>::iterator i;
if (_labels != NULL) {
for (i = _labels->begin(); i != _labels->end(); ++i) {
@@ -1333,17 +1350,6 @@ void Score::update() {
}
}
- if (!_vm->_playbackPaused && !_vm->_skipFrameAdvance)
- _currentFrame++;
-
- _vm->_skipFrameAdvance = false;
-
- if (_currentFrame >= _frames.size())
- return;
-
- _frames[_currentFrame]->prepareFrame(this);
- // Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell)
-
byte tempo = _frames[_currentFrame]->_tempo;
if (tempo) {
@@ -1375,8 +1381,6 @@ void Score::update() {
}
}
- _lingo->processEvent(kEventExitFrame);
-
_nextFrameTime = g_system->getMillis() + 1000.0 / (float)_currentFrameRate;
}