diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/saga/animation.cpp | 42 | ||||
-rw-r--r-- | engines/saga/animation.h | 1 | ||||
-rw-r--r-- | engines/saga/events.cpp | 10 | ||||
-rw-r--r-- | engines/saga/events.h | 2 |
4 files changed, 41 insertions, 14 deletions
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index 0f9a1ddef4..0f948f38c4 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -243,9 +243,9 @@ void Anim::returnFromCutaway(void) { } // Note that clearCutaway() sets _cutawayActive to false. - clearCutaway(); + // clearCutaway(); // TODO: Clearing the cutaway via an event is better, but it breaks things up - /* + event.type = kEvTImmediate; event.code = kCutawayEvent; event.op = kEventClearCutaway; @@ -256,10 +256,24 @@ void Anim::returnFromCutaway(void) { q_event = _vm->_events->chain(q_event, &event); // chain with the other events else q_event = _vm->_events->queue(&event); - */ // Restore the scene - _vm->_scene->restoreScene(); + event.type = kEvTImmediate; + event.code = kSceneEvent; + event.op = kEventRestore; + event.time = 0; + event.duration = 0; + + q_event = _vm->_events->chain(q_event, &event); // chain with the other events + + // Restore the animations + event.type = kEvTImmediate; + event.code = kAnimEvent; + event.op = kEventResumeAll; + event.time = 0; + event.duration = 0; + + q_event = _vm->_events->chain(q_event, &event); // chain with the other events // Handle fade up, if we previously faded down if (_cutAwayFade) { @@ -267,24 +281,15 @@ void Anim::returnFromCutaway(void) { event.code = kPalEvent; event.op = kEventBlackToPal; event.time = 0; - event.duration = kNormalFadeDuration; + event.duration = 3000; //kNormalFadeDuration; event.data = saved_pal; q_event = _vm->_events->chain(q_event, &event); } - - // Restore the animations - for (int i = 0; i < MAX_ANIMATIONS; i++) { - if (_animations[i] && _animations[i]->state == ANIM_PLAYING) { - resume(i, 0); - } - } } } void Anim::clearCutaway(void) { - debug(0, "clearCutaway()"); - if (_cutawayActive) { _cutawayActive = false; @@ -851,4 +856,13 @@ void Anim::cutawayInfo() { } } +void Anim::resumeAll() { + // Restore the animations + for (int i = 0; i < MAX_ANIMATIONS; i++) { + if (_animations[i] && _animations[i]->state == ANIM_PLAYING) { + resume(i, 0); + } + } +} + } // End of namespace Saga diff --git a/engines/saga/animation.h b/engines/saga/animation.h index 8f23ae28a5..89a1e77807 100644 --- a/engines/saga/animation.h +++ b/engines/saga/animation.h @@ -138,6 +138,7 @@ public: void stop(uint16 animId); void finish(uint16 animId); void resume(uint16 animId, int cycles); + void resumeAll(); int16 getCurrentFrame(uint16 animId); bool hasCutaway(void) { return _cutawayActive; diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index 6672cd2477..2f786dd7b8 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -247,10 +247,14 @@ int Events::handleImmediate(Event *event) { case kScriptEvent: case kBgEvent: case kInterfaceEvent: + case kSceneEvent: + case kAnimEvent: + case kCutawayEvent: handleOneShot(event); event_done = true; break; default: + warning("Unhandled Immediate event type (%d)", event->code & EVENT_MASK); break; } @@ -356,6 +360,9 @@ int Events::handleOneShot(Event *event) { case kEventClearFlag: _vm->_anim->clearFlag(event->param, event->param2); break; + case kEventResumeAll: + _vm->_anim->resumeAll(); + break; default: break; } @@ -365,6 +372,9 @@ int Events::handleOneShot(Event *event) { case kEventEnd: _vm->_scene->nextScene(); return kEvStBreak; + case kEventRestore: + _vm->_scene->restoreScene(); + return kEvStBreak; default: break; } diff --git a/engines/saga/events.h b/engines/saga/events.h index d18f009de3..4b0d6fcc52 100644 --- a/engines/saga/events.h +++ b/engines/saga/events.h @@ -73,11 +73,13 @@ enum EventOps { kEventFrame = 3, kEventSetFlag = 4, kEventClearFlag = 5, + kEventResumeAll = 6, // MUISC & SOUND events kEventPlay = 1, kEventStop = 2, // SCENE events kEventEnd = 2, + kEventRestore = 3, // TEXT events kEventHide = 2, kEventRemove = 3, |