From 78afb3f836ad2e9283b6435758f6f31f7e335c13 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 28 Oct 2013 23:03:43 +0200 Subject: FULLPIPE: Implement ModalIntro::init() --- engines/fullpipe/constants.h | 2 + engines/fullpipe/modal.cpp | 116 +++++++++++++++++++++++++++++++++++++++++-- engines/fullpipe/modal.h | 20 +++++++- 3 files changed, 134 insertions(+), 4 deletions(-) diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index fe72238a02..6c1686db4c 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -89,6 +89,7 @@ namespace Fullpipe { #define PIC_CSR_ITN_RED 5329 #define PIC_CSR_LIFT 5176 #define PIC_CSR_MAP 5339 +#define PIC_IN1_GAMETITLE 5169 #define PIC_IN1_PIPETITLE 5167 #define PIC_INV_MENU 991 #define PIC_MAP_A13 5275 @@ -101,6 +102,7 @@ namespace Fullpipe { #define QU_IN2_DO 5144 #define QU_INTR_FINISH 5138 #define QU_INTR_GETUPMAN 5136 +#define QU_INTR_STARTINTRO 5133 #define SC_1 301 #define SC_10 653 #define SC_11 654 diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 85999bcadb..14090ad813 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -25,6 +25,7 @@ #include "fullpipe/messages.h" #include "fullpipe/constants.h" #include "fullpipe/scenes.h" +#include "fullpipe/gameloader.h" namespace Fullpipe { @@ -69,7 +70,112 @@ bool ModalIntro::handleMessage(ExCommand *message) { } bool ModalIntro::init(int counterdiff) { - warning("STUB: ModalIntro::init(%d)", counterdiff); + if (!g_vars->sceneIntro_playing) { + if (!_needRedraw) { + idle(); + return 0; + } + + if (_introFlags & 0x10) + g_fullpipe->_gameLoader->updateSystems(42); + + _introFlags |= 2; + + return true; + } + + if (_introFlags & 4) { + ModalVideoPlayer *player = new ModalVideoPlayer(); + + g_fullpipe->_modalObject = player; + player->_parentObj = this; + player->play("intro.avi"); + + _countDown--; + + if (_countDown > 0 ) + return true; + + if (_needRedraw <= 0) { + _countDown = 0; + _needRedraw = 0; + _introFlags = (_introFlags & 0xfb) | 0x40; + + return true; + } + + _introFlags |= 2; + return true; + } + + if (_introFlags & 0x40) { + ModalVideoPlayer *player = new ModalVideoPlayer(); + + g_fullpipe->_modalObject = player; + player->_parentObj = this; + player->play("intro2.avi"); + + _countDown--; + if (_countDown > 0) + return true; + + if (_needRedraw <= 0) { + _countDown = 50; + _needRedraw = 0; + _introFlags = (_introFlags & 0xbf) | 9; + + return true; + } + _introFlags |= 2; + return true; + } + + if (_introFlags & 8) { + _countDown--; + + if (_countDown > 0 ) + return true; + + if (_needRedraw > 0) { + _introFlags |= 2; + return true; + } + + _countDown = 150; + _introFlags = (_introFlags & 0xf7) | 0x21; + g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0)->_flags &= 0xfffb; + } + + if (!(_introFlags & 0x20)) { + if (_introFlags & 0x10) { + if (!_needRedraw) { + _introFlags |= 1; + + g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0)->_flags &= 0xfffb; + g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_GAMETITLE, 0)->_flags &= 0xfffb; + + chainQueue(QU_INTR_STARTINTRO, 1); + } + g_fullpipe->_gameLoader->updateSystems(42); + } + return true; + } + + _countDown--; + + if (_countDown <= 0) { + if (_needRedraw > 0) { + _introFlags |= 2; + + return true; + } + + _introFlags = (_introFlags & 0xdf) | 0x10; + + g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_GAMETITLE, 0)->_flags &= 0xfffb; + + _needRedraw = 0; + } return true; } @@ -80,8 +186,12 @@ bool ModalIntro::update() { return true; } -void ModalIntro::saveload() { - // No saveload +void ModalIntro::idle() { + warning("STUB: ModalIntro::idle()"); +} + +void ModalVideoPlayer::play(const char *fname) { + warning("STUB: ModalVideoPlayer::play(%s)", fname); } void FullpipeEngine::openMap() { diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 3562622bde..7273b5fd8a 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -34,9 +34,12 @@ class BaseModalObject { BaseModalObject() : _parentObj(0) {} virtual ~BaseModalObject() {} + + virtual bool pollEvent() = 0; virtual bool handleMessage(ExCommand *message) = 0; virtual bool init(int counterdiff) = 0; virtual bool update() = 0; + virtual void saveload() = 0; }; @@ -50,10 +53,25 @@ class ModalIntro : public BaseModalObject { public: ModalIntro(); + virtual bool pollEvent() { return true; } virtual bool handleMessage(ExCommand *message); virtual bool init(int counterdiff); virtual bool update(); - virtual void saveload(); + virtual void saveload() {} + + void idle(); +}; + +class ModalVideoPlayer : public BaseModalObject { +public: + + virtual bool pollEvent() { return true; } + virtual bool handleMessage(ExCommand *message) { return true; } + virtual bool init(int counterdiff) { return true; } + virtual bool update() { return true; } + virtual void saveload() {} + + void play(const char *fname); }; } // End of namespace Fullpipe -- cgit v1.2.3