diff options
author | Tobia Tesan | 2017-06-21 10:53:37 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-05 08:35:33 +0200 |
commit | 1d5c92783e2803d4db4c504ec87c327007c0f8a7 (patch) | |
tree | e87e4a89dee755fc5372e45545a1772e746be39a | |
parent | fd310f1fd3b8336b7c9a2b771153e22a006a4e52 (diff) | |
download | scummvm-rg350-1d5c92783e2803d4db4c504ec87c327007c0f8a7.tar.gz scummvm-rg350-1d5c92783e2803d4db4c504ec87c327007c0f8a7.tar.bz2 scummvm-rg350-1d5c92783e2803d4db4c504ec87c327007c0f8a7.zip |
DIRECTOR: Add processSpriteEvent
-rw-r--r-- | engines/director/lingo/lingo-events.cpp | 23 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 1 | ||||
-rw-r--r-- | engines/director/score.cpp | 15 |
3 files changed, 23 insertions, 16 deletions
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp index ff3f2b03e0..65c02490f5 100644 --- a/engines/director/lingo/lingo-events.cpp +++ b/engines/director/lingo/lingo-events.cpp @@ -203,10 +203,7 @@ void Lingo::processFrameEvent(LEvent event) { * are sent to a frame script and then a movie script. If the * current frame has no frame script when the event occurs, the * message goes to movie scripts. - * [...] - * If more than one movie script handles the same message, Lingo - * searches the movie scripts according to their order in the cast - * window [p.81 of D4 docs] + * [p.81 of D4 docs] */ // TODO: Same for D2-3 or not? Score *score = _vm->getCurrentScore(); @@ -243,6 +240,21 @@ void Lingo::processGenericEvent(LEvent event) { g_lingo->processEvent(event, kMovieScript, id); } +void Lingo::processSpriteEvent(LEvent event) { + Score *score = _vm->getCurrentScore(); + Frame *currentFrame = score->_frames[score->getCurrentFrame()]; + if (event == kEventBeginSprite) { + // TODO: Check if this is also possibly a kSpriteScript? + for (uint16 i = 0; i < CHANNEL_COUNT; i++) + if (currentFrame->_sprites[i]->_enabled) + g_lingo->processEvent(event, kCastScript, currentFrame->_sprites[i]->_scriptId); + + } else { + warning("STUB: processSpriteEvent called for something else than kEventBeginSprite, additional logic probably needed"); + } + +} + void Lingo::processEvent(LEvent event) { switch (event) { case kEventKeyUp: @@ -264,7 +276,8 @@ void Lingo::processEvent(LEvent event) { case kEventTimeout: processGenericEvent(event); break; - + case kEventBeginSprite: + processSpriteEvent(event); default: warning("processEvent: Unhandled event %s", _eventHandlerTypes[event]); } diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 0d0c56cd92..9a425f697c 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -198,6 +198,7 @@ private: void processFrameEvent(LEvent event); void processGenericEvent(LEvent event); void runMovieScript(LEvent event); + void processSpriteEvent(LEvent event); public: ScriptType event2script(LEvent ev); Symbol *getHandler(Common::String &name); diff --git a/engines/director/score.cpp b/engines/director/score.cpp index e5430542d3..29be599573 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -1183,19 +1183,12 @@ void Score::update() { _lingo->processEvent(kEventNone, kFrameScript, _frames[_currentFrame]->_actionId); // TODO Director 6 - another order - // TODO Director 6 step: send beginSprite event to any sprites whose span begin in the upcoming frame if (_vm->getVersion() >= 6) { - for (uint16 i = 0; i < CHANNEL_COUNT; i++) { - if (_frames[_currentFrame]->_sprites[i]->_enabled) { - // TODO: Check if this is also possibly a kSpriteScript? - _lingo->processEvent(kEventBeginSprite, kCastScript, _frames[_currentFrame]->_sprites[i]->_scriptId); - } - } - } - - // TODO: Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame - if (_vm->getVersion() >= 6) + _lingo->processEvent(kEventBeginSprite); + // TODO Director 6 step: send beginSprite event to any sprites whose span begin in the upcoming frame _lingo->processEvent(kEventPrepareFrame); + // TODO: Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame + } Common::SortedArray<Label *>::iterator i; if (_labels != NULL) { |