diff options
-rw-r--r-- | engines/director/lingo/lingo.cpp | 1 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 1 | ||||
-rw-r--r-- | engines/director/score.cpp | 30 | ||||
-rw-r--r-- | engines/director/score.h | 3 |
4 files changed, 22 insertions, 13 deletions
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index fe192cce2f..2bbf5f8271 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -38,6 +38,7 @@ struct EventHandlerType { { kEventEnterFrame, "enterFrame" }, { kEventPrepareFrame, "prepareFrame" }, + { kEventIdle, "idle" }, { kEventStepFrame, "stepFrame"}, { kEventExitFrame, "exitFrame" }, diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 65ead5fa55..a4f980597d 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -40,6 +40,7 @@ enum LEvent { kEventNone, kEventEnterFrame, kEventPrepareFrame, + kEventIdle, kEventStepFrame, kEventExitFrame, diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 25631d569d..55b37405ee 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -29,7 +29,7 @@ #include "common/system.h" #include "director/dib.h" #include "director/resource.h" -#include "lingo/lingo.h" +#include "director/lingo/lingo.h" #include "graphics/palette.h" #include "common/events.h" @@ -428,21 +428,23 @@ void Score::update() { _surface->clear(_stageColor); - //Exit from previous frame, and step to next - _lingo->processEvent(kEventExitFrame, _currentFrame - 1); - _lingo->processEvent(kEventStepFrame, _currentFrame); - - //Director step: send beginSprite event to any sprites whose span begin in the upcoming frame - for (uint16 i = 0; i < CHANNEL_COUNT; i++) { - if (_frames[_currentFrame]->_sprites[i]->_enabled) - _lingo->processEvent(kEventBeginSprite, i); + if (_currentFrame > 0) { + //Enter and exit from previous frame (Director 4) + _lingo->processEvent(kEventEnterFrame, _currentFrame - 1); + _lingo->processEvent(kEventExitFrame, _currentFrame - 1); + //TODO Director 6 - another order } - //Director step: send prepareFrame event to all sprites and the script channel in upcoming frame - _lingo->processEvent(kEventPrepareFrame, _currentFrame); + //TODO Director 6 step: send beginSprite event to any sprites whose span begin in the upcoming frame + //for (uint16 i = 0; i < CHANNEL_COUNT; i++) { + // if (_frames[_currentFrame]->_sprites[i]->_enabled) + // _lingo->processEvent(kEventBeginSprite, i); + //} + + //TODO Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame + //_lingo->processEvent(kEventPrepareFrame, _currentFrame); _frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, _movieRect); //Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell) - _lingo->processEvent(kEventEnterFrame, _currentFrame); _currentFrame++; byte tempo = _frames[_currentFrame]->_tempo; @@ -451,6 +453,7 @@ void Score::update() { if (tempo > 161) { //Delay _nextFrameTime = g_system->getMillis() + (256 - tempo) * 1000; + return; } else if (tempo <= 60) { //FPS _nextFrameTime = g_system->getMillis() + (float)tempo / 60 * 1000; @@ -469,6 +472,9 @@ void Score::update() { } void Score::processEvents() { + if (_currentFrame > 0) + _lingo->processEvent(kEventIdle, _currentFrame - 1); + Common::Event event; while (g_system->getEventManager()->pollEvent(event)) { if (event.type == Common::EVENT_QUIT) diff --git a/engines/director/score.h b/engines/director/score.h index 9f0be8a442..4a5075e642 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -29,10 +29,11 @@ #include "director/resource.h" #include "graphics/managed_surface.h" #include "common/str.h" -#include "lingo/lingo.h" namespace Director { +class Lingo; + #define CHANNEL_COUNT 24 enum castType { |