aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe/modal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/fullpipe/modal.cpp')
-rw-r--r--engines/fullpipe/modal.cpp181
1 files changed, 156 insertions, 25 deletions
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index 26048ced13..44e7b46184 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -25,36 +25,15 @@
#include "fullpipe/messages.h"
#include "fullpipe/constants.h"
#include "fullpipe/scenes.h"
+#include "fullpipe/gameloader.h"
namespace Fullpipe {
-bool BaseModalObject::handleMessage(ExCommand *message) {
- warning("STUB: BaseModalObject::handleMessage()");
-
- return true;
-}
-
-bool BaseModalObject::init(int counterdiff) {
- warning("STUB: BaseModalObject::init(%d)", counterdiff);
-
- return true;
-}
-
-bool BaseModalObject::update() {
- warning("STUB: BaseModalObject::update()");
-
- return true;
-}
-
-void BaseModalObject::saveload() {
- warning("STUB: BaseModalObject::saveload()");
-}
-
-
ModalIntro::ModalIntro() {
_field_8 = 0;
_countDown = 0;
- _needRedraw = 0;
+ _stillRunning = 0;
+
if (g_vars->sceneIntro_skipIntro) {
_introFlags = 4;
} else {
@@ -64,6 +43,7 @@ ModalIntro::ModalIntro() {
PictureObject *pict = g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0);
pict->setFlags(pict->_flags & 0xFFFB);
}
+
g_vars->sceneIntro_skipIntro = false;
_sfxVolume = g_fullpipe->_sfxVolume;
}
@@ -78,7 +58,7 @@ bool ModalIntro::handleMessage(ExCommand *message) {
if (message->_keyCode != 13 && message->_keyCode != 27 && message->_keyCode != 32)
return false;
- if (_needRedraw) {
+ if (_stillRunning) {
if (!(_introFlags & 0x10)) {
_countDown = 0;
g_vars->sceneIntro_needBlackout = true;
@@ -91,6 +71,157 @@ bool ModalIntro::handleMessage(ExCommand *message) {
return true;
}
+bool ModalIntro::init(int counterdiff) {
+ if (!g_vars->sceneIntro_playing) {
+ if (!_stillRunning) {
+ finish();
+ return false;
+ }
+
+ 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 (_stillRunning <= 0) {
+ _countDown = 0;
+ _stillRunning = 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 (_stillRunning <= 0) {
+ _countDown = 50;
+ _stillRunning = 0;
+ _introFlags = (_introFlags & 0xbf) | 9;
+
+ return true;
+ }
+
+ _introFlags |= 2;
+ return true;
+ }
+
+ if (_introFlags & 8) {
+ _countDown--;
+
+ if (_countDown > 0 )
+ return true;
+
+ if (_stillRunning > 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 (!_stillRunning) {
+ _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 (_stillRunning > 0) {
+ _introFlags |= 2;
+
+ return true;
+ }
+
+ _introFlags = (_introFlags & 0xdf) | 0x10;
+
+ g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_GAMETITLE, 0)->_flags &= 0xfffb;
+
+ _stillRunning = 0;
+ }
+
+ return true;
+}
+
+void ModalIntro::update() {
+ if (g_fullpipe->_currentScene) {
+ if (_introFlags & 1) {
+ //sceneFade(virt, g_currentScene, 1);
+ _stillRunning = 255;
+ _introFlags &= 0xfe;
+
+ if (_introFlags & 0x20)
+ g_fullpipe->playSound(SND_INTR_019, 0);
+ } else if (_introFlags & 2) {
+ if (g_vars->sceneIntro_needBlackout) {
+ //vrtRectangle(*(_DWORD *)virt, 0, 0, 0, 800, 600);
+ g_vars->sceneIntro_needBlackout = 0;
+ _stillRunning = 0;
+ _introFlags &= 0xfd;
+ } else {
+ //sceneFade(virt, g_currentScene, 0);
+ _stillRunning = 0;
+ _introFlags &= 0xfd;
+ }
+ } else if (_stillRunning) {
+ g_fullpipe->_currentScene->draw();
+ }
+ }
+}
+
+void ModalIntro::finish() {
+ g_fullpipe->_gameLoader->unloadScene(SC_INTRO2);
+ g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO1);
+ g_fullpipe->_gameLoader->preloadScene(SC_INTRO1, TrubaDown);
+
+ if (g_fullpipe->_currentScene)
+ g_fullpipe->_gameLoader->updateSystems(42);
+}
+
+void ModalVideoPlayer::play(const char *fname) {
+ warning("STUB: ModalVideoPlayer::play(%s)", fname);
+}
+
void FullpipeEngine::openMap() {
warning("STUB: FullpipeEngine::openMap()");
}