DIRECTOR: Update current frame before running startMovie

The startMovie handler needs "the frame" to return the starting frame,
which isn't necessarily 1. Easiest way to fix this is to set up the
frame data in the Score::startPlay() handler.

Fixes the broken navigation in the Empire State Building in Hell Cab.
This commit is contained in:
Scott Percival 2024-05-02 01:34:10 +08:00 committed by Eugene Sandulenko
parent ed4d4e355b
commit a08934a95e
2 changed files with 9 additions and 3 deletions

View File

@ -85,7 +85,7 @@ Score::Score(Movie *movie) {
_numChannelsDisplayed = 0;
_skipTransition = false;
_curFrameNumber = 0;
_curFrameNumber = 1;
_framesStream = nullptr;
_currentFrame = nullptr;
}
@ -271,7 +271,6 @@ int Score::getPreviousLabelNumber(int referenceFrame) {
}
void Score::startPlay() {
_curFrameNumber = 1;
_playState = kPlayStarted;
_nextFrameTime = 0;
_nextFrameDelay = 0;
@ -283,6 +282,9 @@ void Score::startPlay() {
return;
}
// load first frame (either 1 or _nextFrame)
updateCurrentFrame();
// All frames in the same movie have the same number of channels
if (_playState != kPlayStopped)
for (uint i = 0; i < _currentFrame->_sprites.size(); i++)
@ -338,6 +340,10 @@ void Score::setDelay(uint32 ticks) {
}
}
void Score::setCurrentFrame(uint16 frameId) {
_nextFrame = frameId;
}
bool Score::isWaitingForNextFrame() {
bool keepWaiting = false;
debugC(8, kDebugLoading, "Score::isWaitingForNextFrame(): nextFrameTime: %d, time: %d, sound: %d, click: %d, video: %d", _nextFrameTime, g_system->getMillis(false), _waitForChannel, _waitForClick, _waitForVideoChannel);

View File

@ -90,7 +90,7 @@ public:
void stopPlay();
void setDelay(uint32 ticks);
void setCurrentFrame(uint16 frameId) { _nextFrame = frameId; }
void setCurrentFrame(uint16 frameId);
uint16 getCurrentFrameNum() { return _curFrameNumber; }
int getNextFrame() { return _nextFrame; }
uint16 getFramesNum() { return _numFrames; }