diff options
-rw-r--r-- | engines/fullpipe/modal.cpp | 130 | ||||
-rw-r--r-- | engines/fullpipe/modal.h | 20 | ||||
-rw-r--r-- | engines/fullpipe/module.mk | 1 | ||||
-rw-r--r-- | engines/fullpipe/scenes.cpp | 19 | ||||
-rw-r--r-- | engines/fullpipe/scenes.h | 4 | ||||
-rw-r--r-- | engines/fullpipe/scenes/sceneIntroDemo.cpp | 106 |
6 files changed, 275 insertions, 5 deletions
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index c4c30cb1fb..1c216477ca 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -226,8 +226,7 @@ void ModalIntro::update() { } void ModalIntro::finish() { - if (!(g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS)) - g_fp->_gameLoader->unloadScene(SC_INTRO2); + g_fp->_gameLoader->unloadScene(SC_INTRO2); g_fp->_currentScene = g_fp->accessScene(SC_INTRO1); g_fp->_gameLoader->preloadScene(SC_INTRO1, TrubaDown); @@ -236,6 +235,133 @@ void ModalIntro::finish() { g_fp->_gameLoader->updateSystems(42); } +ModalIntroDemo::ModalIntroDemo() { + _field_8 = 0; + _countDown = 50; + _stillRunning = 0; + _introFlags = 9; + g_vars->sceneIntro_skipIntro = false; + _sfxVolume = g_fp->_sfxVolume; +} + +ModalIntroDemo::~ModalIntroDemo() { + g_fp->stopAllSounds(); + g_fp->_sfxVolume = _sfxVolume; +} + +bool ModalIntroDemo::handleMessage(ExCommand *message) { + if (message->_messageKind != 17) + return false; + + if (message->_messageNum != 36) + return false; + + if (message->_param != 13 && message->_param != 27 && message->_param != 32) + return false; + + if (_introFlags & 0x8) { + _countDown = 0; + g_vars->sceneIntro_needBlackout = true; + return true; + } else if (_stillRunning) { + g_vars->sceneIntro_playing = false; + g_vars->sceneIntro_needBlackout = true; + } + + return true; +} + +bool ModalIntroDemo::init(int counterdiff) { + if (!g_vars->sceneIntro_playing) { + if (!_stillRunning) { + finish(); + return false; + } + + if (_introFlags & 0x10) + g_fp->_gameLoader->updateSystems(42); + + _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_fp->accessScene(SC_INTRO1)->getPictureObjectById(522, 0)->_flags &= 0xfffb; + } else { + if (!(_introFlags & 0x20)) + return true; + + _countDown--; + + if (_countDown > 0) + return true; + + if (_stillRunning > 0) { + _introFlags |= 2; + return true; + } + + _introFlags &= 0xDF; + + g_vars->sceneIntro_playing = false; + _stillRunning = 0; + } + + return true; +} + +void ModalIntroDemo::update() { + if (g_fp->_currentScene) { + if (_introFlags & 1) { + if (g_vars->sceneIntro_needBlackout) { + g_fp->drawAlphaRectangle(0, 0, 800, 600, 0); + g_vars->sceneIntro_needBlackout = 0; + } else { + g_fp->sceneFade(g_fp->_currentScene, true); + } + _stillRunning = 255; + _introFlags &= 0xfe; + + if (_introFlags & 0x20) + g_fp->playSound(SND_INTR_019, 0); + } else if (_introFlags & 2) { + if (g_vars->sceneIntro_needBlackout) { + g_fp->drawAlphaRectangle(0, 0, 800, 600, 0); + g_vars->sceneIntro_needBlackout = 0; + _stillRunning = 0; + _introFlags &= 0xfd; + } else { + g_fp->sceneFade(g_fp->_currentScene, false); + _stillRunning = 0; + _introFlags &= 0xfd; + } + } else if (_stillRunning) { + g_fp->_currentScene->draw(); + } + } +} + +void ModalIntroDemo::finish() { + g_fp->_currentScene = g_fp->accessScene(SC_INTRO1); + g_fp->_gameLoader->preloadScene(SC_INTRO1, TrubaDown); + + if (g_fp->_currentScene) + g_fp->_gameLoader->updateSystems(42); +} + void ModalVideoPlayer::play(const char *filename) { Video::AVIDecoder *aviDecoder = new Video::AVIDecoder(); diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index dd5faa8940..68ebef258c 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -78,6 +78,26 @@ class ModalIntro : public BaseModalObject { void finish(); }; +class ModalIntroDemo : public BaseModalObject { + int _field_8; + int _introFlags; + int _countDown; + int _stillRunning; + int _sfxVolume; + + public: + ModalIntroDemo(); + virtual ~ModalIntroDemo(); + + virtual bool pollEvent() { return true; } + virtual bool handleMessage(ExCommand *message); + virtual bool init(int counterdiff); + virtual void update(); + virtual void saveload() {} + + void finish(); +}; + class ModalVideoPlayer : public BaseModalObject { public: diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk index 62f9c5f77a..5dc6bb82c9 100644 --- a/engines/fullpipe/module.mk +++ b/engines/fullpipe/module.mk @@ -27,6 +27,7 @@ MODULE_OBJS = \ statics.o \ utils.o \ scenes/sceneIntro.o \ + scenes/sceneIntroDemo.o \ scenes/scene01.o \ scenes/scene02.o \ scenes/scene03.o \ diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 967eb0aa40..c88705b98e 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -35,6 +35,8 @@ #include "fullpipe/scenes.h" #include "fullpipe/interaction.h" +#include "engines/advancedDetector.h" + namespace Fullpipe { Vars::Vars() { @@ -616,12 +618,23 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { case SC_INTRO1: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_INTRO1"); scene->preloadMovements(sceneVar); - sceneIntro_initScene(scene); + + if (!(g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS)) + sceneIntro_initScene(scene); + else + sceneIntroDemo_initScene(scene); + _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_INTRO1"); setSceneMusicParameters(sceneVar); - addMessageHandler(sceneHandlerIntro, 2); - _updateCursorCallback = sceneIntro_updateCursor; + + if (!(g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS)) { + addMessageHandler(sceneHandlerIntro, 2); + _updateCursorCallback = sceneIntro_updateCursor; + } else { + addMessageHandler(sceneHandlerIntroDemo, 2); + _updateCursorCallback = sceneIntroDemo_updateCursor; + } break; case SC_1: diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h index 2d30f54d52..1d54aef441 100644 --- a/engines/fullpipe/scenes.h +++ b/engines/fullpipe/scenes.h @@ -41,6 +41,10 @@ int sceneIntro_updateCursor(); void sceneIntro_initScene(Scene *sc); int sceneHandlerIntro(ExCommand *cmd); +int sceneIntroDemo_updateCursor(); +void sceneIntroDemo_initScene(Scene *sc); +int sceneHandlerIntroDemo(ExCommand *cmd); + void scene01_fixEntrance(); void scene01_initScene(Scene *sc, int entrance); int sceneHandler01(ExCommand *cmd); diff --git a/engines/fullpipe/scenes/sceneIntroDemo.cpp b/engines/fullpipe/scenes/sceneIntroDemo.cpp new file mode 100644 index 0000000000..a4e18ce27d --- /dev/null +++ b/engines/fullpipe/scenes/sceneIntroDemo.cpp @@ -0,0 +1,106 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/constants.h" +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/modal.h" +#include "fullpipe/statics.h" + +namespace Fullpipe { + +int sceneIntroDemo_updateCursor() { + g_fp->_cursorId = 0; + + return 0; +} + +void sceneIntroDemo_initScene(Scene *sc) { + g_vars->sceneIntro_needSleep = true; + g_vars->sceneIntro_needGetup = false; + g_vars->sceneIntro_playing = true; + g_vars->sceneIntro_needBlackout = false; + + if (g_fp->_recordEvents || g_fp->_inputArFlag) + g_vars->sceneIntro_skipIntro = false; + + g_fp->_modalObject = new ModalIntroDemo; +} + +void sceneHandlerIntroDemo_part1() { + g_fp->_currentScene = g_fp->accessScene(SC_INTRO1); + chainQueue(QU_INTR_FINISH, 0); +} + +void sceneHandlerIntroDemo_part2() { + chainQueue(QU_IN2_DO, 0); +} + +int sceneHandlerIntroDemo(ExCommand *ex) { + if (ex->_messageKind != 17) + return 0; + + switch (ex->_messageNum) { + case MSG_INTR_ENDINTRO: + g_vars->sceneIntro_playing = 0; + return 0; + + case MSG_INTR_SWITCHTO1: + sceneHandlerIntroDemo_part1(); + return 0; + + case MSG_INTR_GETUPMAN: + g_vars->sceneIntro_needSleep = 0; + g_vars->sceneIntro_needGetup = 1; + return 0; + + case MSG_INTR_SWITCHTO2: + sceneHandlerIntroDemo_part2(); + return 0; + + case 33: + // fall through + break; + + default: + return 0; + } + + if (g_vars->sceneIntro_needSleep) { + if (!g_vars->sceneIntro_aniin1man->_movement && g_vars->sceneIntro_aniin1man->_statics->_staticsId == ST_IN1MAN_SLEEP) + g_vars->sceneIntro_aniin1man->startAnim(MV_IN1MAN_SLEEP, 0, -1); + } else if (g_vars->sceneIntro_needGetup && !g_vars->sceneIntro_aniin1man->_movement && + g_vars->sceneIntro_aniin1man->_statics->_staticsId == ST_IN1MAN_SLEEP) { + g_vars->sceneIntro_needGetup = 0; + + chainQueue(QU_INTR_GETUPMAN, 0); + } + + g_fp->startSceneTrack(); + + return 0; +} + +} // End of namespace Fullpipe |