diff options
author | Filippos Karapetis | 2007-06-07 12:11:33 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-06-07 12:11:33 +0000 |
commit | 7bd240ea8f63401d0cbb9a459e34e01619f6957d (patch) | |
tree | bc1cf416eb9a742129f10902153a86c3ec4f6e11 | |
parent | 3f819b90852bc7f64faeff0f3d7585d55285a0f5 (diff) | |
download | scummvm-rg350-7bd240ea8f63401d0cbb9a459e34e01619f6957d.tar.gz scummvm-rg350-7bd240ea8f63401d0cbb9a459e34e01619f6957d.tar.bz2 scummvm-rg350-7bd240ea8f63401d0cbb9a459e34e01619f6957d.zip |
Implemented video playing for IHNM (still needs work). Also, updated a comment regarding the intro
svn-id: r27166
-rw-r--r-- | engines/saga/animation.cpp | 53 | ||||
-rw-r--r-- | engines/saga/animation.h | 9 | ||||
-rw-r--r-- | engines/saga/ihnm_introproc.cpp | 6 | ||||
-rw-r--r-- | engines/saga/sfuncs.cpp | 7 |
4 files changed, 40 insertions, 35 deletions
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index e038213d5c..88caec96c9 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -80,6 +80,8 @@ void Anim::freeCutawayList(void) { void Anim::playCutaway(int cut, bool fade) { debug(0, "playCutaway(%d, %d)", cut, fade); + _cutAwayFade = fade; + if (fade) { Event event; static PalEntry cur_pal[PAL_ENTRIES]; @@ -101,7 +103,10 @@ void Anim::playCutaway(int cut, bool fade) { _vm->_interface->setStatusText(""); _vm->_interface->setSaveReminderState(0); _vm->_interface->rememberMode(); - _vm->_interface->setMode(kPanelCutaway); + if (_cutAwayMode == kPanelVideo) + _vm->_interface->setMode(kPanelVideo); + else + _vm->_interface->setMode(kPanelCutaway); _cutawayActive = true; } @@ -183,17 +188,23 @@ void Anim::returnFromCutaway(void) { // Note that clearCutaway() sets _cutawayActive to false. clearCutaway(); - warning("TODO: Implement the rest of returnFromCutaway()"); - // Handle fade up, if we previously faded down - // TODO + if (_cutAwayFade) { + Event event; + event.type = kEvTImmediate; + event.code = kPalEvent; + event.op = kEventBlackToPal; + event.time = 0; + event.duration = kNormalFadeDuration; + event.data = saved_pal; + + _vm->_events->queue(&event); + } // Restore the scene _vm->_scene->restoreScene(); // Restore the animations - // TODO - for (int i = 0; i < MAX_ANIMATIONS; i++) { if (_animations[i] && _animations[i]->state == ANIM_PLAYING) { resume(i, 0); @@ -221,32 +232,24 @@ void Anim::clearCutaway(void) { void Anim::startVideo(int vid, bool fade) { debug(0, "startVideo(%d, %d)", vid, fade); - // TODO - warning(0, "TODO: Anim::startVideo(%d, %d)", vid, fade); + Event event; + _vm->_gfx->getCurrentPal(saved_pal); + + _vm->_interface->setStatusText(""); - _videoActive = true; + playCutaway(vid, fade); } void Anim::endVideo(void) { debug(0, "endVideo()"); - // TODO - warning("TODO: Anim::endVideo()"); - - _videoActive = false; + clearCutaway(); } void Anim::returnFromVideo(void) { debug(0, "returnFromVideo()"); - // TODO - warning("TODO: Anim::returnFromVideo"); - - _videoActive = false; -} - -void Anim::nextVideoFrame(void) { - // TODO + returnFromCutaway(); } void Anim::load(uint16 animId, const byte *animResourceData, size_t animResourceLength) { @@ -360,11 +363,17 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) { return; } + // HACK: the animation starts playing before sfwaitframes is called in IHNM, which + // causes the game to wait forever. Raise the framecount by 10 to avoid lockup + // TODO: remove this hack + _vm->_frameCount += 10; + if (anim->completed < anim->cycles) { frame = anim->currentFrame; // FIXME: if start > 0, then this works incorrectly decodeFrame(anim, anim->frameOffsets[frame], displayBuffer, _vm->getDisplayWidth() * _vm->getDisplayHeight()); + _vm->_frameCount++; anim->currentFrame++; if (anim->completed != 65535) { anim->completed++; @@ -535,7 +544,7 @@ void Anim::decodeFrame(AnimationData *anim, size_t frameOffset, byte *buf, size_ // Begin RLE decompression to output buffer - do { + do { markByte = readS.readByte(); switch (markByte) { case SAGA_FRAME_START: diff --git a/engines/saga/animation.h b/engines/saga/animation.h index 4aa813c765..687ef55bcb 100644 --- a/engines/saga/animation.h +++ b/engines/saga/animation.h @@ -123,7 +123,6 @@ public: void startVideo(int vid, bool fade); void endVideo(void); void returnFromVideo(void); - void nextVideoFrame(void); void load(uint16 animId, const byte *animResourceData, size_t animResourceLength); void freeId(uint16 animId); @@ -142,8 +141,8 @@ public: bool hasCutaway(void) { return _cutawayActive; } - bool hasVideo(void) { - return _videoActive; + void setCutAwayMode(int mode) { + _cutAwayMode = mode; } bool hasAnimation(uint16 animId) { if (animId >= MAX_ANIMATIONS) { @@ -198,9 +197,11 @@ private: AnimationData *_animations[MAX_ANIMATIONS]; AnimationData *_cutawayAnimations[2]; Cutaway *_cutawayList; + PalEntry saved_pal[PAL_ENTRIES]; int _cutawayListLength; bool _cutawayActive; - bool _videoActive; + int _cutAwayMode; + bool _cutAwayFade; }; } // End of namespace Saga diff --git a/engines/saga/ihnm_introproc.cpp b/engines/saga/ihnm_introproc.cpp index 69ffa2620e..4a24004a7e 100644 --- a/engines/saga/ihnm_introproc.cpp +++ b/engines/saga/ihnm_introproc.cpp @@ -97,7 +97,7 @@ int Scene::IHNMStartProc() { // The original used the "play video" mechanism for the first part of // the intro. We just use that panel mode. - _vm->_interface->setMode(kPanelVideo); + _vm->_anim->setCutAwayMode(kPanelVideo); n_introscenes = ARRAYSIZE(IHNM_IntroList); @@ -312,9 +312,7 @@ int Scene::IHNMIntroMovieProc3(int param) { q_event = _vm->_events->chain(q_event, &event); // Queue end of scene after a while - // TODO: I've increased the delay so the speech won't start - // until the music has ended. Could someone verify if that's - // the correct behaviour? + // The delay has been increased so the speech won't start until the music has ended event.type = kEvTOneshot; event.code = kSceneEvent; event.op = kEventEnd; diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index 1dddba5fcc..b087783a4c 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -1875,6 +1875,7 @@ void Script::sfScriptStartCutAway(SCRIPTFUNC_PARAMS) { thread->pop(); // Not used fade = thread->pop(); + _vm->_anim->setCutAwayMode(kPanelCutaway); _vm->_anim->playCutaway(cut, fade != 0); } @@ -1932,20 +1933,16 @@ void Script::sfScriptStartVideo(SCRIPTFUNC_PARAMS) { vid = thread->pop(); fade = thread->pop(); - _vm->_interface->setStatusText(""); + _vm->_anim->setCutAwayMode(kPanelVideo); _vm->_anim->startVideo(vid, fade != 0); - _vm->_interface->rememberMode(); - _vm->_interface->setMode(kPanelVideo); } void Script::sfScriptReturnFromVideo(SCRIPTFUNC_PARAMS) { _vm->_anim->returnFromVideo(); - _vm->_interface->restoreMode(); } void Script::sfScriptEndVideo(SCRIPTFUNC_PARAMS) { _vm->_anim->endVideo(); - _vm->_interface->restoreMode(); } void Script::sf87(SCRIPTFUNC_PARAMS) { |