[Scummvm-git-logs] scummvm master -> 324ecfa880b087bf52dc457ca987ccafa696ba32
djsrv
dservilla at gmail.com
Thu Jul 9 16:23:17 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
04f457c46b DIRECTOR: Add _playState to Score
324ecfa880 DIRECTOR: Play MIAWs
Commit: 04f457c46b4ae9cbba0032933928be3019712b5f
https://github.com/scummvm/scummvm/commit/04f457c46b4ae9cbba0032933928be3019712b5f
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-09T12:20:39-04:00
Commit Message:
DIRECTOR: Add _playState to Score
Changed paths:
engines/director/events.cpp
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo-events.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo.cpp
engines/director/score.cpp
engines/director/score.h
engines/director/types.h
diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 0444f17a28..15423aadb3 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -40,7 +40,7 @@ bool processQuitEvent(bool click) {
while (g_system->getEventManager()->pollEvent(event)) {
if (event.type == Common::EVENT_QUIT) {
- g_director->getCurrentMovie()->getScore()->_stopPlay = true;
+ g_director->getCurrentMovie()->getScore()->_playState = kPlayStopped;
return true;
}
@@ -77,7 +77,7 @@ void DirectorEngine::processEvents(bool bufferLingoEvents) {
switch (event.type) {
case Common::EVENT_QUIT:
- sc->_stopPlay = true;
+ sc->_playState = kPlayStopped;
break;
case Common::EVENT_MOUSEMOVE:
@@ -170,7 +170,7 @@ void DirectorEngine::processEvents(bool bufferLingoEvents) {
g_system->updateScreen();
g_system->delayMillis(10);
- if (getVersion() >= 3 && sc->getCurrentFrame() > 0 && !sc->_stopPlay && _lingo->getEventCount() == 0)
+ if (getVersion() >= 3 && sc->getCurrentFrame() > 0 && sc->_playState != kPlayStopped && _lingo->getEventCount() == 0)
_lingo->registerEvent(kEventIdle);
if (!bufferLingoEvents)
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 15ca7f5343..ea148adf5e 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1280,7 +1280,7 @@ void LB::b_printFrom(int nargs) {
void LB::b_quit(int nargs) {
if (g_director->getCurrentMovie())
- g_director->getCurrentMovie()->getScore()->_stopPlay = true;
+ g_director->getCurrentMovie()->getScore()->_playState = kPlayStopped;
g_lingo->pushVoid();
}
@@ -1914,7 +1914,7 @@ void LB::b_updateStage(int nargs) {
if (score->_framesRan > 9) {
warning("b_updateStage(): exiting due to debug few frames only");
- score->_stopPlay = true;
+ score->_playState = kPlayStopped;
}
}
}
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index 5b0d8d4650..288751d41b 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -318,7 +318,7 @@ void Lingo::processEvents() {
while (!_eventQueue.empty()) {
LingoEvent el = _eventQueue.pop();
- if (_vm->getCurrentMovie()->getScore()->_stopPlay && el.event != kEventStopMovie)
+ if (_vm->getCurrentMovie()->getScore()->_playState == kPlayStopped && el.event != kEventStopMovie)
continue;
if (lastEventId == el.eventId && !_passEvent)
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index dade4bbf75..a77455094a 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -194,7 +194,7 @@ void Lingo::func_goto(Datum &frame, Datum &movie) {
if (!stage->setNextMovie(movieFilenameRaw))
return;
- stage->getCurrentMovie()->getScore()->_stopPlay = true;
+ stage->getCurrentMovie()->getScore()->_playState = kPlayStopped;
stage->_nextMovie.frameS.clear();
stage->_nextMovie.frameI = -1;
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 97c6cc4ccd..421943d5e1 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -589,7 +589,7 @@ void Lingo::execute(uint pc) {
if (++counter > 1000 && debugChannelSet(-1, kDebugFewFramesOnly)) {
warning("Lingo::execute(): Stopping due to debug few frames only");
- _vm->getCurrentMovie()->getScore()->_stopPlay = true;
+ _vm->getCurrentMovie()->getScore()->_playState = kPlayStopped;
break;
}
}
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 1374ed6737..3af4fd690c 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -63,7 +63,7 @@ Score::Score(Movie *movie) {
_nextFrame = 0;
_currentLabel = 0;
_nextFrameTime = 0;
- _stopPlay = false;
+ _playState = kPlayNotStarted;
_numChannelsDisplayed = 0;
@@ -202,23 +202,23 @@ void Score::startLoop() {
initGraphics(_vm->_surface->w, _vm->_surface->h);
_currentFrame = 0;
- _stopPlay = false;
+ _playState = kPlayStarted;
_nextFrameTime = 0;
if (_frames.size() <= 1) { // We added one empty sprite
warning("Score::startLoop(): Movie has no frames");
- _stopPlay = true;
+ _playState = kPlayStopped;
}
// All frames in the same movie have the same number of channels
- if (!_stopPlay)
+ if (_playState != kPlayStopped)
for (uint i = 0; i < _frames[1]->_sprites.size(); i++)
_channels.push_back(new Channel(_frames[1]->_sprites[i]));
if (_vm->getVersion() >= 3)
_lingo->processEvent(kEventStartMovie);
- while (!_stopPlay) {
+ while (_playState != kPlayStopped) {
if (_currentFrame >= _frames.size()) {
if (debugChannelSet(-1, kDebugNoLoop))
break;
diff --git a/engines/director/score.h b/engines/director/score.h
index f77075ea4c..99cc2952d3 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -112,7 +112,7 @@ public:
byte _currentFrameRate;
byte _puppetTempo;
- bool _stopPlay;
+ PlayState _playState;
uint32 _nextFrameTime;
int _numChannelsDisplayed;
diff --git a/engines/director/types.h b/engines/director/types.h
index e07863d04b..8b31a93005 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -283,6 +283,12 @@ enum {
kCursorMouseUp
};
+enum PlayState {
+ kPlayNotStarted,
+ kPlayStarted,
+ kPlayStopped
+};
+
struct Datum;
struct PCell;
typedef Common::Array<Datum> DatumArray;
Commit: 324ecfa880b087bf52dc457ca987ccafa696ba32
https://github.com/scummvm/scummvm/commit/324ecfa880b087bf52dc457ca987ccafa696ba32
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-09T12:20:39-04:00
Commit Message:
DIRECTOR: Play MIAWs
Changed paths:
engines/director/director.cpp
engines/director/score.cpp
engines/director/score.h
engines/director/stage.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index fc5cf43061..d39467896f 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -184,7 +184,19 @@ Common::Error DirectorEngine::run() {
bool loop = true;
while (loop) {
+ _currentStage = _mainStage;
loop = _currentStage->step();
+
+ if (loop) {
+ DatumArray *windowList = g_lingo->_windowList.u.farr;
+ for (uint i = 0; i < windowList->size(); i++) {
+ if ((*windowList)[i].type != OBJECT || (*windowList)[i].u.obj->getObjType() != kWindowObj)
+ continue;
+
+ _currentStage = static_cast<Stage *>((*windowList)[i].u.obj);
+ _currentStage->step();
+ }
+ }
}
return Common::kNoError;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 3af4fd690c..9302c1632a 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -196,7 +196,7 @@ int Score::getPreviousLabelNumber(int referenceFrame) {
return 0;
}
-void Score::startLoop() {
+void Score::startPlay() {
// TODO: Should the dims be set by the movie?
debugC(1, kDebugImages, "Score dims: %dx%d", _movie->_movieRect.width(), _movie->_movieRect.height());
initGraphics(_vm->_surface->w, _vm->_surface->h);
@@ -217,34 +217,39 @@ void Score::startLoop() {
if (_vm->getVersion() >= 3)
_lingo->processEvent(kEventStartMovie);
+}
- while (_playState != kPlayStopped) {
- if (_currentFrame >= _frames.size()) {
- if (debugChannelSet(-1, kDebugNoLoop))
- break;
-
- _currentFrame = 0;
+void Score::step() {
+ if (_currentFrame >= _frames.size()) {
+ if (debugChannelSet(-1, kDebugNoLoop)) {
+ _playState = kPlayStopped;
+ return;
}
- update();
+ _currentFrame = 0;
+ }
- if (_currentFrame < _frames.size())
- _vm->processEvents();
+ update();
- if (debugChannelSet(-1, kDebugFewFramesOnly) || debugChannelSet(-1, kDebugScreenshot)) {
- warning("Score::startLoop(): ran frame %0d", _framesRan);
- _framesRan++;
- }
+ if (_currentFrame < _frames.size())
+ _vm->processEvents();
- if (debugChannelSet(-1, kDebugFewFramesOnly) && _framesRan > 9) {
- warning("Score::startLoop(): exiting due to debug few frames only");
- break;
- }
+ if (debugChannelSet(-1, kDebugFewFramesOnly) || debugChannelSet(-1, kDebugScreenshot)) {
+ warning("Score::startLoop(): ran frame %0d", _framesRan);
+ _framesRan++;
+ }
- if (debugChannelSet(-1, kDebugScreenshot))
- screenShot();
+ if (debugChannelSet(-1, kDebugFewFramesOnly) && _framesRan > 9) {
+ warning("Score::startLoop(): exiting due to debug few frames only");
+ _playState = kPlayStopped;
+ return;
}
+ if (debugChannelSet(-1, kDebugScreenshot))
+ screenShot();
+}
+
+void Score::stopPlay() {
if (_vm->getVersion() >= 3)
_lingo->processEvent(kEventStopMovie);
_lingo->executePerFrameHook(-1, 0);
diff --git a/engines/director/score.h b/engines/director/score.h
index 99cc2952d3..72120c25ee 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -73,7 +73,9 @@ public:
void gotoLoop();
void gotoNext();
void gotoPrevious();
- void startLoop();
+ void startPlay();
+ void step();
+ void stopPlay();
void setCurrentFrame(uint16 frameId) { _nextFrame = frameId; }
uint16 getCurrentFrame() { return _currentFrame; }
Channel *getChannelById(uint16 id);
diff --git a/engines/director/stage.cpp b/engines/director/stage.cpp
index 09b56d2e8a..64fa476a73 100644
--- a/engines/director/stage.cpp
+++ b/engines/director/stage.cpp
@@ -341,31 +341,38 @@ bool Stage::setNextMovie(Common::String &movieFilenameRaw) {
}
bool Stage::step() {
- bool loop = false;
-
if (_currentMovie) {
debug(0, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
debug(0, "@@@@ Movie name '%s' in '%s'", _currentMovie->getMacName().c_str(), _currentPath.c_str());
debug(0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
- bool goodMovie = _currentMovie->loadArchive();
-
- // If we came in a loop, then skip as requested
- if (!_nextMovie.frameS.empty()) {
- _currentMovie->getScore()->setStartToLabel(_nextMovie.frameS);
- _nextMovie.frameS.clear();
- }
-
- if (_nextMovie.frameI != -1) {
- _currentMovie->getScore()->setCurrentFrame(_nextMovie.frameI);
- _nextMovie.frameI = -1;
- }
-
- if (!debugChannelSet(-1, kDebugCompileOnly) && goodMovie) {
- debugC(1, kDebugEvents, "Starting playback of movie '%s'", _currentMovie->getMacName().c_str());
-
- _currentMovie->getScore()->startLoop();
-
+ switch (_currentMovie->getScore()->_playState) {
+ case kPlayNotStarted:
+ {
+ bool goodMovie = _currentMovie->loadArchive();
+
+ // If we came in a loop, then skip as requested
+ if (!_nextMovie.frameS.empty()) {
+ _currentMovie->getScore()->setStartToLabel(_nextMovie.frameS);
+ _nextMovie.frameS.clear();
+ }
+
+ if (_nextMovie.frameI != -1) {
+ _currentMovie->getScore()->setCurrentFrame(_nextMovie.frameI);
+ _nextMovie.frameI = -1;
+ }
+
+ if (!debugChannelSet(-1, kDebugCompileOnly) && goodMovie) {
+ debugC(1, kDebugEvents, "Starting playback of movie '%s'", _currentMovie->getMacName().c_str());
+ _currentMovie->getScore()->startPlay();
+ }
+ }
+ return true;
+ case kPlayStarted:
+ _currentMovie->getScore()->step();
+ return true;
+ case kPlayStopped:
+ _currentMovie->getScore()->stopPlay();
debugC(1, kDebugEvents, "Finished playback of movie '%s'", _currentMovie->getMacName().c_str());
}
}
@@ -415,10 +422,10 @@ bool Stage::step() {
}
_nextMovie.movie.clear();
- loop = true;
+ return true;
}
- return loop;
+ return false;
}
} // end of namespace Director
More information about the Scummvm-git-logs
mailing list