diff options
author | Kamil Zbróg | 2013-11-26 18:53:03 +0000 |
---|---|---|
committer | Kamil Zbróg | 2013-11-26 18:53:03 +0000 |
commit | 15bb1c61eda48f09253ccb8d2a42ccad59f3b00a (patch) | |
tree | c2f5ac2907225730c6f1cdaa000f549ef7951183 /engines/fullpipe/scenes | |
parent | 446c57d281e592653c9935c896d33334d23f0519 (diff) | |
parent | e1afc7d0d777dad4b7ca0a58f0bb0324b24f9584 (diff) | |
download | scummvm-rg350-15bb1c61eda48f09253ccb8d2a42ccad59f3b00a.tar.gz scummvm-rg350-15bb1c61eda48f09253ccb8d2a42ccad59f3b00a.tar.bz2 scummvm-rg350-15bb1c61eda48f09253ccb8d2a42ccad59f3b00a.zip |
Merge remote-tracking branch 'sync/master' into prince-malik
Conflicts:
engines/configure.engines
engines/engines.mk
engines/plugins_table.h
Diffstat (limited to 'engines/fullpipe/scenes')
-rw-r--r-- | engines/fullpipe/scenes/scene01.cpp | 117 | ||||
-rw-r--r-- | engines/fullpipe/scenes/scene02.cpp | 137 | ||||
-rw-r--r-- | engines/fullpipe/scenes/scene03.cpp | 294 | ||||
-rw-r--r-- | engines/fullpipe/scenes/scene04.cpp | 681 | ||||
-rw-r--r-- | engines/fullpipe/scenes/sceneDbg.cpp | 107 | ||||
-rw-r--r-- | engines/fullpipe/scenes/sceneIntro.cpp | 109 |
6 files changed, 1445 insertions, 0 deletions
diff --git a/engines/fullpipe/scenes/scene01.cpp b/engines/fullpipe/scenes/scene01.cpp new file mode 100644 index 0000000000..4181bbffe3 --- /dev/null +++ b/engines/fullpipe/scenes/scene01.cpp @@ -0,0 +1,117 @@ +/* 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/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene01_fixEntrance() { + GameVar *var = g_fullpipe->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName("SAVEGAME"); + if (var->getSubVarAsInt("Entrance") == TrubaLeft) + var->setSubVarAsInt("Entrance", TrubaRight); +} + +void scene01_initScene(Scene *sc, int entrance) { + g_vars->scene01_picSc01Osk = sc->getPictureObjectById(PIC_SC1_OSK, 0); + g_vars->scene01_picSc01Osk->_flags &= 0xFFFB; + + g_vars->scene01_picSc01Osk2 = sc->getPictureObjectById(PIC_SC1_OSK2, 0); + g_vars->scene01_picSc01Osk2->_flags &= 0xFFFB; + + if (g_fullpipe->getObjectState(sO_EggCracker) == g_fullpipe->getObjectEnumState(sO_EggCracker, sO_DidNotCrackEgg)) { + PictureObject *pic = sc->getPictureObjectById(PIC_SC1_KUCHKA, 0); + if (pic) + pic->_flags &= 0xFFFB; + } + + if (entrance != TrubaLeft) { + StaticANIObject *bootAnim = sc->getStaticANIObject1ById(ANI_BOOT_1, -1); + if (bootAnim) + bootAnim->_flags &= ~0x04; + } + + g_fullpipe->lift_setButton(sO_Level2, ST_LBN_2N); +} + +int sceneHandler01(ExCommand *cmd) { + int res = 0; + + if (cmd->_messageKind != 17) + return 0; + + if (cmd->_messageNum > MSG_SC1_SHOWOSK) { + if (cmd->_messageNum == MSG_SC1_UTRUBACLICK) + handleObjectInteraction(g_fullpipe->_aniMan, g_fullpipe->_currentScene->getPictureObjectById(PIC_SC1_LADDER, 0), 0); + + return 0; + } + + if (cmd->_messageNum == MSG_SC1_SHOWOSK) { + g_vars->scene01_picSc01Osk->_flags |= 4; + + g_vars->scene01_picSc01Osk->_priority = 20; + g_vars->scene01_picSc01Osk2->_priority = 21; + + return 0; + } + + if (cmd->_messageNum != 0x21) { + if (cmd->_messageNum == MSG_SC1_SHOWOSK2) { + g_vars->scene01_picSc01Osk2->_flags |= 4; + g_vars->scene01_picSc01Osk2->_priority = 20; + g_vars->scene01_picSc01Osk->_priority = 21; + + return 0; + } + + return 0; + } + + if (g_fullpipe->_aniMan2) { + if (g_fullpipe->_aniMan2->_ox < g_fullpipe->_sceneRect.left + 200) { + g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.left - 300; + } + + if (g_fullpipe->_aniMan2->_ox > g_fullpipe->_sceneRect.right - 200) + g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.right + 300; + + res = 1; + } + g_fullpipe->_behaviorManager->updateBehaviors(); + + g_fullpipe->startSceneTrack(); + + return res; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene02.cpp b/engines/fullpipe/scenes/scene02.cpp new file mode 100644 index 0000000000..dd01af4c4b --- /dev/null +++ b/engines/fullpipe/scenes/scene02.cpp @@ -0,0 +1,137 @@ +/* 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/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + + +namespace Fullpipe { + +void scene02_initScene(Scene *sc) { + g_vars->scene02_guvTheDrawer = sc->getStaticANIObject1ById(ANI_DADAYASHIK, -1); + + if (g_fullpipe->getObjectState(sO_GuvTheDrawer) == g_fullpipe->getObjectEnumState(sO_GuvTheDrawer, sO_Sleeping)) { + Scene *s = g_fullpipe->_currentScene; + + g_fullpipe->_currentScene = sc; + g_vars->scene02_guvTheDrawer->changeStatics2(ST_DYAS_LIES); + g_fullpipe->_currentScene = s; + } + + g_vars->scene02_boxDelay = 0; + + StaticANIObject *box = sc->getStaticANIObject1ById(ANI_SC2_BOX, -1); + + if (box && box->_flags & 4) { + g_vars->scene02_boxOpen = false; + } else { + g_vars->scene02_boxOpen = true; + g_vars->scene02_boxDelay = 100 * g_fullpipe->_rnd->getRandomNumber(32767) + 150; + } + + g_fullpipe->_floaters->init(g_fullpipe->_gameLoader->_gameVar->getSubVarByName("SC_2")); +} + +void sceneHandler02_ladderClick() { + handleObjectInteraction(g_fullpipe->_aniMan2, g_fullpipe->_currentScene->getPictureObjectById(PIC_SC2_DTRUBA, 0), 0); +} + +void sceneHandler02_showLadder() { + g_fullpipe->_currentScene->getPictureObjectById(PIC_SC2_LADDER, 0)->_flags |= 4; +} + +void sceneHandler02_hideLadder() { + g_fullpipe->_currentScene->getPictureObjectById(PIC_SC2_LADDER, 0)->_flags &= 0xfffb; + g_fullpipe->_aniMan2->_priority = 25; +} + +int sceneHandler02(ExCommand *ex) { + int res = 0; + + if (ex->_messageKind != 17) + return 0; + + switch(ex->_messageNum) { + case MSG_SC2_LADDERCLICK: + sceneHandler02_ladderClick(); + return 0; + + case MSG_SC2_SHOWLADDER: + sceneHandler02_showLadder(); + return 0; + + case MSG_SC2_PUTMANUP: + g_fullpipe->_aniMan2->_priority = 0; + return 0; + + case MSG_SC2_HIDELADDER: + sceneHandler02_hideLadder(); + return 0; + + case 33: + if (g_fullpipe->_aniMan2) { + if (g_fullpipe->_aniMan2->_ox < g_fullpipe->_sceneRect.left + 200) + g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.left - 300; + + if (g_fullpipe->_aniMan2->_ox > g_fullpipe->_sceneRect.right - 200) + g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.right + 300; + + res = 1; + } + + if (g_vars->scene02_boxOpen) { + if (g_vars->scene02_boxDelay >= 1) { + --g_vars->scene02_boxDelay; + } else if (g_fullpipe->_floaters->_array2.size() >= 1) { + if (g_fullpipe->_floaters->_array2[0]->val5 == -50) { + g_fullpipe->_floaters->stopAll(); + g_vars->scene02_boxOpen = false; + g_vars->scene02_boxDelay = 100 * g_fullpipe->_rnd->getRandomNumber(32767) + 150; + } else { + g_fullpipe->_floaters->_array2[0]->val3 = -50; + } + } else { + g_fullpipe->_floaters->genFlies(g_fullpipe->_currentScene, g_fullpipe->_rnd->getRandomNumber(700) + 100, -50, 0, 0); + g_vars->scene02_boxDelay = 500 * g_fullpipe->_rnd->getRandomNumber(32767) + 1000; + } + } + + g_fullpipe->_floaters->update(); + g_fullpipe->_behaviorManager->updateBehaviors(); + + g_fullpipe->startSceneTrack(); + } + + return res; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene03.cpp b/engines/fullpipe/scenes/scene03.cpp new file mode 100644 index 0000000000..e9f8a240e8 --- /dev/null +++ b/engines/fullpipe/scenes/scene03.cpp @@ -0,0 +1,294 @@ +/* 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/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + +namespace Fullpipe { + +void FullpipeEngine::setSwallowedEggsState() { + GameVar *v = _gameLoader->_gameVar->getSubVarByName("OBJSTATES")->getSubVarByName(sO_GulpedEggs); + + g_vars->swallowedEgg1 = v->getSubVarByName(sO_Egg1); + g_vars->swallowedEgg2 = v->getSubVarByName(sO_Egg2); + g_vars->swallowedEgg3 = v->getSubVarByName(sO_Egg3); + + g_vars->swallowedEgg1->_value.intValue = 0; + g_vars->swallowedEgg2->_value.intValue = 0; + g_vars->swallowedEgg3->_value.intValue = 0; +} + +void scene03_initScene(Scene *sc) { + g_vars->scene03_eggeater = sc->getStaticANIObject1ById(ANI_EGGEATER, -1); + g_vars->scene03_domino = sc->getStaticANIObject1ById(ANI_DOMINO_3, -1); + + GameVar *v = g_fullpipe->_gameLoader->_gameVar->getSubVarByName("OBJSTATES")->getSubVarByName(sO_GulpedEggs); + + g_vars->swallowedEgg1 = v->getSubVarByName(sO_Egg1); + g_vars->swallowedEgg2 = v->getSubVarByName(sO_Egg2); + g_vars->swallowedEgg3 = v->getSubVarByName(sO_Egg3); + + g_fullpipe->lift_setButton(sO_Level2, ST_LBN_2N); + + g_fullpipe->lift_sub5(sc, QU_SC3_ENTERLIFT, QU_SC3_EXITLIFT); +} + +void scene03_setEaterState() { + if (g_fullpipe->getObjectState(sO_EggGulperGaveCoin) == g_fullpipe->getObjectEnumState(sO_EggGulperGaveCoin, sO_Yes)) { + g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_SLIM, QU_EGTR_SLIMSHOW, 0); + g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID1, QU_EGTR_MD1_SHOW, 0); + g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID2, QU_EGTR_MD2_SHOW, 0); + } +} + +int scene03_updateCursor() { + g_fullpipe->updateCursorCommon(); + + if (g_fullpipe->_cursorId == PIC_CSR_DEFAULT && g_fullpipe->_objectIdAtCursor == PIC_SC3_DOMIN && g_vars->scene03_domino) { + if (g_vars->scene03_domino->_flags & 4) + g_fullpipe->_cursorId = PIC_CSR_ITN; + } + + return g_fullpipe->_cursorId; +} + +void sceneHandler03_eaterFat() { + g_vars->scene03_eggeater->_flags &= 0xFF7F; + + g_vars->scene03_eggeater->startAnim(MV_EGTR_FATASK, 0, -1); +} + +void sceneHandler03_swallowEgg(int item) { + if (!g_vars->swallowedEgg1->_value.intValue) { + g_vars->swallowedEgg1->_value.intValue = item; + } else if (!g_vars->swallowedEgg2->_value.intValue) { + g_vars->swallowedEgg2->_value.intValue = item; + } else if (!g_vars->swallowedEgg3->_value.intValue) { + g_vars->swallowedEgg3->_value.intValue = item; + + g_fullpipe->setObjectState(sO_EggGulperGaveCoin, g_fullpipe->getObjectEnumState(sO_EggGulperGaveCoin, sO_Yes)); + + scene03_setEaterState(); + } +} + +void sceneHandler03_giveItem(ExCommand *ex) { + if (ex->_parentId == ANI_INV_EGGAPL || ex->_parentId == ANI_INV_EGGDOM || + ex->_parentId == ANI_INV_EGGCOIN || ex->_parentId == ANI_INV_EGGBOOT || + ex->_parentId == ANI_INV_EGGGLS) + sceneHandler03_swallowEgg(ex->_parentId); +} + +int sceneHandler03_swallowedEgg1State() { + return g_vars->swallowedEgg1->_value.intValue; +} + +void sceneHandler03_giveCoin(ExCommand *ex) { + MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex->_parId); + + if (mq && mq->getCount() > 0) { + ExCommand *ex0 = mq->getExCommandByIndex(0); + ExCommand *ex1 = mq->getExCommandByIndex(1); + + if (sceneHandler03_swallowedEgg1State()) { + ex0->_messageKind = 1; + ex1->_messageKind = 1; + + getGameLoaderInventory()->removeItem(ANI_INV_COIN, 1); + } else { + ex0->_messageKind = 0; + ex0->_excFlags |= 1; + + ex1->_messageKind = 0; + ex1->_excFlags |= 1; + + g_vars->scene03_eggeater->_flags &= 0xFF7Fu; + } + } +} + +void sceneHandler03_goLadder() { + handleObjectInteraction(g_fullpipe->_aniMan, g_fullpipe->_currentScene->getPictureObjectById(PIC_SC3_LADDER, 0), 0); +} + +void sceneHandler03_pushEggStack() { + g_vars->swallowedEgg1->_value.intValue = g_vars->swallowedEgg2->_value.intValue; + g_vars->swallowedEgg2->_value.intValue = g_vars->swallowedEgg3->_value.intValue; + g_vars->swallowedEgg3->_value.intValue = 0; + + if (g_vars->swallowedEgg2->_value.intValue == ANI_INV_EGGBOOT + && g_vars->swallowedEgg1->_value.intValue == ANI_INV_EGGAPL) { + g_vars->swallowedEgg1->_value.intValue = ANI_INV_EGGBOOT; + g_vars->swallowedEgg2->_value.intValue = ANI_INV_EGGAPL; + } +} + +void sceneHandler03_releaseEgg() { + g_vars->scene03_eggeater->_flags &= 0xFF7F; + + g_vars->scene03_eggeater->show1(-1, -1, -1, 0); +} + +void sceneHandler03_takeEgg(ExCommand *ex) { + MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex->_parId); + + if (mq && mq->getCount() > 0) { + ExCommand *ex0 = mq->getExCommandByIndex(0); + ExCommand *ex1 = mq->getExCommandByIndex(1); + + int egg1 = sceneHandler03_swallowedEgg1State(); + + if (egg1 && ex0) { + ex0->_parentId = egg1; + sceneHandler03_pushEggStack(); + } + + if ( g_vars->swallowedEgg1->_value.intValue == ANI_INV_EGGAPL + && !g_vars->swallowedEgg2->_value.intValue + && !g_vars->swallowedEgg3->_value.intValue + && ex1) { + + if (ex1->_objtype == kObjTypeObjstateCommand) { + ObjstateCommand *com = (ObjstateCommand *)ex1; + + com->_value = g_fullpipe->getObjectEnumState(sO_EggGulper, sO_WantsNothing); + } + } + } +} + +int sceneHandler03(ExCommand *ex) { + if (ex->_messageKind != 17) { + if (ex->_messageKind == 57) + sceneHandler03_giveItem(ex); + return 0; + } + + switch (ex->_messageNum) { + case MSG_LIFT_EXITLIFT: + g_fullpipe->lift_exitSeq(ex); + break; + + case MSG_LIFT_CLOSEDOOR: + g_fullpipe->lift_closedoorSeq(); + break; + + case MSG_SC3_ONTAKECOIN: + sceneHandler03_eaterFat(); + break; + + case MSG_LIFT_STARTEXITQUEUE: + g_fullpipe->lift_startExitQueue(); + break; + + case MSG_SC3_RELEASEEGG: + sceneHandler03_releaseEgg(); + break; + + case MSG_LIFT_CLICKBUTTON: + g_fullpipe->lift_animation3(); + break; + + case MSG_SC3_HIDEDOMINO: + g_vars->scene03_domino->_flags &= 0xFFFB; + break; + + case MSG_SC3_TAKEEGG: + sceneHandler03_takeEgg(ex); + break; + + case MSG_LIFT_GO: + g_fullpipe->lift_goAnimation(); + break; + + case MSG_SC3_UTRUBACLICK: + sceneHandler03_goLadder(); + break; + + case MSG_SC3_TESTFAT: + sceneHandler03_giveCoin(ex); + break; + + case 64: + g_fullpipe->lift_sub05(ex); + break; + + case 93: + { + StaticANIObject *ani = g_fullpipe->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY); + if (ani && ani->_id == ANI_LIFTBUTTON) { + g_fullpipe->lift_sub1(ani); + ex->_messageKind = 0; + + return 0; + } + + if (g_fullpipe->_currentScene->getPictureObjectIdAtPos(ex->_sceneClickX, ex->_sceneClickY) == PIC_SC3_DOMIN) { + if (g_vars->scene03_domino) + if (g_vars->scene03_domino->_flags & 4) + if (g_fullpipe->_aniMan->isIdle()) + if (!(g_fullpipe->_aniMan->_flags & 0x100) && g_fullpipe->_msgObjectId2 != g_vars->scene03_domino->_id) { + handleObjectInteraction(g_fullpipe->_aniMan, g_vars->scene03_domino, ex->_keyCode); + ex->_messageKind = 0; + + return 0; + } + } + + break; + } + + case 97: + { + int res = 0; + + if (g_fullpipe->_aniMan2) { + if (g_fullpipe->_aniMan2->_ox < g_fullpipe->_sceneRect.left + 200) + g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.left - 300; + + if (g_fullpipe->_aniMan2->_ox > g_fullpipe->_sceneRect.right - 200) + g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan2->_ox - g_fullpipe->_sceneRect.right + 300; + + res = 1; + } + + g_fullpipe->_behaviorManager->updateBehaviors(); + + g_fullpipe->startSceneTrack(); + + return res; + } + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp new file mode 100644 index 0000000000..dab2131e04 --- /dev/null +++ b/engines/fullpipe/scenes/scene04.cpp @@ -0,0 +1,681 @@ +/* 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/objectnames.h" +#include "fullpipe/constants.h" +#include "fullpipe/utils.h" +#include "fullpipe/gfx.h" +#include "fullpipe/scenes.h" +#include "fullpipe/messages.h" +#include "fullpipe/statics.h" +#include "fullpipe/scene.h" +#include "fullpipe/interaction.h" +#include "fullpipe/gameloader.h" +#include "fullpipe/behavior.h" + +namespace Fullpipe { + +void scene04_callback(int *param) { + warning("STUB: scene04_callback"); +} + +void scene04_initScene(Scene *sc) { + g_vars->scene04_var01 = 0; + g_vars->scene04_bottle = sc->getPictureObjectById(PIC_SC4_BOTTLE, 0); + g_vars->scene04_hand = sc->getStaticANIObject1ById(ANI_HAND, -1); + g_vars->scene04_plank = sc->getStaticANIObject1ById(ANI_PLANK, -1); + g_vars->scene04_clock = sc->getStaticANIObject1ById(ANI_CLOCK, -1); + g_vars->scene04_spring = sc->getStaticANIObject1ById(ANI_SPRING, -1); + g_vars->scene04_mamasha = sc->getStaticANIObject1ById(ANI_MAMASHA_4, -1); + g_vars->scene04_boot = sc->getStaticANIObject1ById(ANI_SC4_BOOT, -1); + g_vars->scene04_ladder = 0; + + StaticANIObject *koz = sc->getStaticANIObject1ById(ANI_KOZAWKA, -1); + + if (koz) { + Movement *kozmov = koz->getMovementById(MV_KZW_JUMP); + if (kozmov) { + uint kozsize = kozmov->_currMovement ? kozmov->_currMovement->_dynamicPhases.size() : kozmov->_dynamicPhases.size(); + + for (uint i = 0; i < kozsize; i++) { + kozmov->setDynamicPhaseIndex(i); + + if (kozmov->_framePosOffsets) { + g_vars->scene04_jumpingKozyawki[i] = *kozmov->_framePosOffsets[kozmov->_currDynamicPhaseIndex]; + } else { + kozmov->_somePoint.x = 0; + kozmov->_somePoint.y = 0; + g_vars->scene04_jumpingKozyawki[i] = kozmov->_somePoint; + } + } + } + + kozmov = koz->getMovementById(MV_KZW_JUMPROTATE); + if (kozmov) { + uint kozsize = kozmov->_currMovement ? kozmov->_currMovement->_dynamicPhases.size() : kozmov->_dynamicPhases.size(); + + for (uint i = 0; i < kozsize; i++) { + kozmov->setDynamicPhaseIndex(i); + + if (kozmov->_framePosOffsets) { + g_vars->scene04_jumpRotateKozyawki[i] = *kozmov->_framePosOffsets[kozmov->_currDynamicPhaseIndex]; + } else { + kozmov->_somePoint.x = 0; + kozmov->_somePoint.y = 0; + g_vars->scene04_jumpRotateKozyawki[i] = kozmov->_somePoint; + } + } + } + } + + Interaction *plank = getGameLoaderInteractionController()->getInteractionByObjectIds(ANI_PLANK, 0, 0); + if (plank) + plank->_flags |= 8; + + if (g_fullpipe->getObjectState(sO_Jar_4) == g_fullpipe->getObjectEnumState(sO_Jar_4, sO_UpsideDown)) { + g_vars->scene04_bottleObjList.clear(); + g_vars->scene04_kozyawkiObjList.clear(); + + sc->getPictureObjectById(PIC_SC4_BOTTLE, 0)->_flags &= 0xfffb; + sc->getPictureObjectById(PIC_SC4_MASK, 0)->_flags &= 0xfffb; + sc->getStaticANIObject1ById(ANI_SPRING, 0)->_flags &= 0xfffb; + + g_vars->scene04_var18 = 0; + g_vars->scene04_var19 = 0; + } else { + StaticANIObject *spring = sc->getStaticANIObject1ById(ANI_SPRING, -1); + + if (spring) + spring->_callback2 = 0; + + g_vars->scene04_bottleObjList.clear(); + g_vars->scene04_bottleObjList.push_back(sc->getPictureObjectById(PIC_SC4_BOTTLE, 0)); + g_vars->scene04_bottleObjList.push_back(sc->getPictureObjectById(PIC_SC4_MASK, 0)); + + g_vars->scene04_kozyawkiObjList.clear(); + + if (koz) { + koz->loadMovementsPixelData(); + + koz->_statics = koz->getStaticsById(ST_KZW_EMPTY); + koz->setOXY(0, 0); + koz->hide(); + + g_vars->scene04_kozyawkiObjList.push_back(koz); + + for (int i = 0; i < 6; i++) { + StaticANIObject *koz1 = new StaticANIObject(koz); + + sc->addStaticANIObject(koz1, 1); + koz1->_statics = koz->getStaticsById(ST_KZW_EMPTY); + koz1->setOXY(0, 0); + koz1->hide(); + g_vars->scene04_kozyawkiObjList.push_back(koz1); + } + } + sc->getPictureObjectById(PIC_SC4_BOTTLE2, 0)->_flags &= 0xfffb; + + g_vars->scene04_var18 = 1; + g_vars->scene04_var19 = 1; + } + + g_vars->scene04_var02 = 0; + g_vars->scene04_soundPlaying = 0; + g_vars->scene04_var04 = 0; + g_vars->scene04_var05 = 0; + g_vars->scene04_var06 = 2; + g_vars->scene04_dynamicPhaseIndex = 0; + + g_vars->scene04_kozyawkiAni.clear(); + + g_fullpipe->setObjectState(sO_LowerPipe, g_fullpipe->getObjectEnumState(sO_LowerPipe, sO_IsClosed)); + + g_vars->scene04_var07 = 0; + g_vars->scene04_var08 = 0; + g_vars->scene04_coinPut = 0; + g_vars->scene04_var09 = 0; + g_vars->scene04_var10 = 0; + g_vars->scene04_var11 = 0; + g_vars->scene04_var12 = 0; + g_vars->scene04_var13 = 1; + g_vars->scene04_var14 = 0; + g_vars->scene04_var15 = 1; + + if (g_fullpipe->getObjectState(sO_BigMumsy) != g_fullpipe->getObjectEnumState(sO_BigMumsy, sO_Gone)) + g_vars->scene04_mamasha->hide(); + + g_vars->scene04_speaker = sc->getStaticANIObject1ById(ANI_SPEAKER_4, -1); + g_vars->scene04_speaker->_callback2 = scene04_callback; + g_vars->scene04_speaker->startAnim(MV_SPK4_PLAY, 0, -1); + + g_vars->scene04_var16 = 0; + g_vars->scene04_var17 = 0; + + g_fullpipe->initArcadeKeys("SC_4"); +} + +bool sceneHandler04_friesAreWalking() { + warning("STUB: sceneHandler04_friesAreWalking()"); + + return false; +} + +int scene04_updateCursor() { + g_fullpipe->updateCursorCommon(); + + if (g_fullpipe->_objectIdAtCursor == PIC_SC4_LRTRUBA) { + if (!g_vars->scene04_var19) { + g_fullpipe->_cursorId = PIC_CSR_DEFAULT; + + return g_fullpipe->_cursorId; + } + } else if (g_fullpipe->_objectIdAtCursor == ANI_PLANK || g_fullpipe->_objectIdAtCursor == PIC_SC4_PLANK) { + if (g_fullpipe->_objectIdAtCursor == ANI_PLANK && g_fullpipe->_cursorId != PIC_CSR_ITN) + return g_fullpipe->_cursorId; + + if (g_fullpipe->_objectIdAtCursor == ANI_PLANK || (g_fullpipe->_objectIdAtCursor == PIC_SC4_PLANK && g_fullpipe->_cursorId == PIC_CSR_DEFAULT)) { + if (sceneHandler04_friesAreWalking()) { + g_fullpipe->_cursorId = PIC_CSR_ARCADE1; + return g_fullpipe->_cursorId; + } + if (g_vars->scene04_soundPlaying) { + g_fullpipe->_cursorId = PIC_CSR_DEFAULT; + return g_fullpipe->_cursorId; + } + } + } + + if (g_fullpipe->_objectIdAtCursor == PIC_CSR_ITN && g_fullpipe->_objectIdAtCursor == PIC_SC4_DOWNTRUBA) + g_fullpipe->_cursorId = PIC_CSR_GOD; + + return g_fullpipe->_cursorId; +} + +void sceneHandlers_sub01(ExCommand *ex) { + warning("sceneHandlers_sub01()"); +} + +void sceneHandler04_checkBigBallClick() { + StaticANIObject *ball = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_BIGBALL, -1); + + if (ball) + for (uint i = 0; i < ball->_movements.size(); i++) + ((Movement *)ball->_movements[i])->_counterMax = 73; + + g_vars->scene04_var13 = 1; +} + +void sceneHandler04_clickBottle() { + if (!g_vars->scene04_var02) + g_vars->scene04_var20 += 5; +} + +void sceneHandler04_clickButton() { + StaticANIObject *but = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_BUTTON, -1); + + if (but) { + if (!g_vars->scene04_clock->_movement || + (g_vars->scene04_clock->_movement->_id == MV_CLK_GO && g_vars->scene04_clock->_movement->_currDynamicPhaseIndex > 3 && + g_vars->scene04_clock->_movement->_currDynamicPhaseIndex < 105)) { + if (!g_vars->scene04_hand->_movement && !g_vars->scene04_var02) { + but->startAnim(MV_BTN_CLICK, 0, -1); + g_vars->scene04_hand->startAnim(MV_HND_POINT, 0, -1); + } + } + } +} + +void sceneHandler04_clickLadder() { + warning("sceneHandler04_clickLadder()"); +} + +void sceneHandler04_sub13() { + warning("sceneHandler04_sub13()"); +} + +void sceneHandler04_clickPlank() { + if (sceneHandler04_friesAreWalking()) + sceneHandler04_sub13(); + else if (g_vars->scene04_var01) + g_fullpipe->playSound(SND_4_033, 0); + else if (!g_vars->scene04_soundPlaying) + chainQueue(QU_PNK_CLICK, 0); +} + +void sceneHandler04_dropBottle() { + warning("sceneHandler04_dropBottle()"); +} + +void sceneHandler04_gotoLadder(int par) { + warning("sceneHandler04_gotoLadder()"); +} + +void sceneHandler04_lowerPlank() { + g_vars->scene04_plank->startAnim(MV_PNK_WEIGHTRIGHT, 0, -1); +} + +void sceneHandler04_manFromBottle() { + warning("sceneHandler04_manFromBottle()"); +} + +void sceneHandler04_manToBottle() { + g_vars->scene04_bottleObjList.push_back(g_fullpipe->_aniMan); + g_vars->scene04_var20 = 5; + g_vars->scene04_var06 += 9; + g_fullpipe->_aniMan2 = g_fullpipe->_aniMan; + g_vars->scene04_var10 = 1; +} + +void sceneHandler04_raisePlank() { + g_vars->scene04_plank->startAnim(MV_PNK_WEIGHTLEFT, 0, -1); +} + +void sceneHandler04_shootKozyawka() { + warning("sceneHandler04_shootKozyawka()"); +} + +void sceneHandler04_showCoin() { + StaticANIObject *ani = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_SC4_COIN, -1); + + if (ani) { + ani->show1(MV_BDG_OPEN, MV_MAN_GOU, MV_SC4_COIN_default, 0); + + ani->_priority = 40; + } +} + +void sceneHandler04_stopSound() { + warning("sceneHandler04_stopSound()"); +} + +void sceneHandler04_sub1(ExCommand *ex) { + g_fullpipe->_aniMan->changeStatics2(ST_MAN_SIT); + + MessageQueue *mq = new MessageQueue(g_fullpipe->_currentScene->getMessageQueueById(QU_SC4_MANFROMBOTTLE), 0, 0); + + if (ex) { + ExCommand *newex = new ExCommand(ex); + + mq->_exCommands.push_back(newex); + } + + mq->_flags |= 1; + mq->chain(0); + + g_vars->scene04_var10 = 0; + g_fullpipe->_behaviorManager->setFlagByStaticAniObject(g_fullpipe->_aniMan, 1); +} + +void sceneHandler04_sub3() { + warning("sceneHandler04_sub3()"); +} + +void sceneHandler04_sub4() { + warning("sceneHandler04_sub4()"); +} + +void sceneHandler04_sub5() { + warning("sceneHandler04_sub5()"); +} + +void sceneHandler04_sub6() { + warning("sceneHandler04_sub6()"); +} + +void sceneHandler04_sub7() { + warning("sceneHandler04_sub7()"); +} + +void sceneHandler04_sub8(ExCommand *ex) { + warning("sceneHandler04_sub8()"); +} + +void sceneHandler04_sub9(StaticANIObject *ani) { + warning("sceneHandler04_sub9()"); +} + +void sceneHandler04_sub15() { + warning("sceneHandler04_sub15()"); +} + +void sceneHandler04_sub17() { + warning("sceneHandler04_sub17()"); +} + +void sceneHandler04_takeBottle() { + warning("sceneHandler04_takeBottle()"); +} + +void sceneHandler04_takeKozyawka() { + warning("sceneHandler04_takeKozyawka()"); +} + +void sceneHandler04_testPlank(ExCommand *ex) { + warning("sceneHandler04_testPlank()"); +} + +void sceneHandler04_bottleUpdateObjects(int off) { + warning("sceneHandler04_bottleUpdateObjects()"); +} + +void sceneHandler04_updateBottle() { + Common::Point point; + + int yoff; + + if (g_vars->scene04_hand->_movement) + yoff = g_vars->scene04_hand->_movement->_oy; + else + yoff = g_vars->scene04_hand->_oy; + + int newy = g_vars->scene04_hand->getSomeXY(point)->y + yoff + 140; + + sceneHandler04_bottleUpdateObjects(newy - g_vars->scene04_spring->_oy); + + g_vars->scene04_spring->setOXY(g_vars->scene04_spring->_ox, newy); +} + +void sceneHandler04_winArcade() { + warning("sceneHandler04_winArcade()"); +} + +int sceneHandler04(ExCommand *ex) { + if (ex->_messageKind != 17) + return 0; + + switch (ex->_messageNum) { + case MSG_UPDATEBOTTLE: + sceneHandler04_updateBottle(); + break; + + case MSG_CLICKBOTTLE: + sceneHandler04_clickBottle(); + break; + + case MSG_SHOOTKOZAW: + sceneHandler04_shootKozyawka(); + break; + + case MSG_SHAKEBOTTLE: + if (!g_vars->scene04_var02) + ++g_vars->scene04_var20; + break; + + case MSG_STARTHAND: + g_vars->scene04_var09 = 1; + g_vars->scene04_coinPut = 0; + + if (g_vars->scene04_var10) + sceneHandler04_sub1(0); + + sceneHandler04_sub15(); + sceneHandler04_stopSound(); + break; + + case MSG_TAKEKOZAW: + sceneHandler04_takeKozyawka(); + break; + + case MSG_CLICKBUTTON: + sceneHandler04_clickButton(); + break; + + case MSG_CLICKPLANK: + sceneHandler04_clickPlank(); + break; + + case MSG_RAISEPLANK: + sceneHandler04_raisePlank(); + break; + + case MSG_KOZAWRESTART: + if (g_vars->scene04_var05) { + g_vars->scene04_kozyawkiObjList.push_back(g_vars->scene04_var05); + g_vars->scene04_var05->hide(); + g_vars->scene04_var05 = 0; + } + if (g_vars->scene04_soundPlaying) + sceneHandler04_sub3(); + + break; + + case MSG_LOWERPLANK: + sceneHandler04_lowerPlank(); + break; + + case MSG_TESTPLANK: + sceneHandler04_testPlank(ex); + break; + + case 33: + { + g_vars->scene04_dudePosX = g_fullpipe->_aniMan->_ox; + g_vars->scene04_dudePosY = g_fullpipe->_aniMan->_oy; + + int res = 0; + + if (g_fullpipe->_aniMan2) { + if (g_fullpipe->_aniMan->_ox < g_fullpipe->_sceneRect.left + 200) { + g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan->_ox - g_fullpipe->_sceneRect.left - 300; + g_fullpipe->_aniMan->_ox = g_vars->scene04_dudePosX; + } + if (g_fullpipe->_aniMan->_ox > g_fullpipe->_sceneRect.right - 200) { + g_fullpipe->_currentScene->_x = g_fullpipe->_aniMan->_ox - g_fullpipe->_sceneRect.right + 300; + } + + res = 1; + + if (g_vars->scene04_soundPlaying) { + if (g_fullpipe->_aniMan->_movement) { + if (g_fullpipe->_aniMan->_movement->_id == MV_MAN_TOLADDER) { + g_fullpipe->_aniMan2 = 0; + + if (g_fullpipe->_sceneRect.left > 380) + g_fullpipe->_currentScene->_x = 380 - g_fullpipe->_sceneRect.left; + } + } + } + } else { + if (g_fullpipe->_aniMan->_movement && g_fullpipe->_aniMan->_movement->_id == MV_MAN_GOD) + g_fullpipe->_aniMan2 = g_fullpipe->_aniMan; + } + + sceneHandler04_sub4(); + + if (g_vars->scene04_var07 && !g_vars->scene04_var09) + sceneHandler04_sub5(); + + if (g_vars->scene04_var12) + sceneHandler04_sub6(); + + if (g_vars->scene04_var08) + sceneHandler04_clickLadder(); + + if (g_vars->scene04_var10 && g_vars->scene04_hand->_movement) + sceneHandler04_sub1(0); + + if (g_vars->scene04_coinPut && g_vars->scene04_var18 && !g_vars->scene04_var09 && !g_vars->scene04_soundPlaying) + sceneHandler04_sub7(); + + if (g_vars->scene04_var01) { + if (!g_vars->scene04_soundPlaying) { + g_fullpipe->startSceneTrack(); + + g_fullpipe->_behaviorManager->updateBehaviors(); + return res; + } + + g_vars->scene04_var14++; + + if (g_vars->scene04_var14 > 600) + sceneHandler04_sub17(); + } + + if (g_vars->scene04_soundPlaying) { + g_fullpipe->_behaviorManager->updateBehaviors(); + + return res; + } + + g_fullpipe->startSceneTrack(); + + g_fullpipe->_behaviorManager->updateBehaviors(); + + return res; + } + + case 29: + { + int picid = g_fullpipe->_currentScene->getPictureObjectIdAtPos(ex->_sceneClickX, ex->_sceneClickY); + + if (g_vars->scene04_var10) { + sceneHandler04_sub1(ex); + + break; + } + + if (picid == PIC_SC4_LADDER) { + if (!g_vars->scene04_var04) { + g_vars->scene04_sceneClickX = ex->_sceneClickX; + g_vars->scene04_sceneClickY = ex->_sceneClickY; + + sceneHandler04_clickLadder(); + + ex->_messageKind = 0; + + break; + } + + sceneHandler04_gotoLadder(0); + + break; + } + + StaticANIObject *ani = g_fullpipe->_currentScene->getStaticANIObjectAtPos(ex->_sceneClickX, ex->_sceneClickY); + + if ((ani && ani->_id == ANI_PLANK) || picid == PIC_SC4_PLANK) { + sceneHandler04_clickPlank(); + + ex->_messageKind = 0; + } else if (g_vars->scene04_var01) { + sceneHandler04_sub8(ex); + } else if (!ani || !canInteractAny(g_fullpipe->_aniMan, ani, ex->_keyCode)) { + PictureObject *pic = g_fullpipe->_currentScene->getPictureObjectById(picid, 0); + + if (!pic || !canInteractAny(g_fullpipe->_aniMan, pic,ex->_keyCode)) { + if ((g_fullpipe->_sceneRect.right - ex->_sceneClickX < 47 && g_fullpipe->_sceneRect.right < g_fullpipe->_sceneWidth - 1) + || (ex->_sceneClickX - g_fullpipe->_sceneRect.left < 47 && g_fullpipe->_sceneRect.left > 0)) + sceneHandlers_sub01(ex); + } + } + } + + break; + + case MSG_SC4_HIDEBOOT: + g_vars->scene04_boot->_flags &= 0xfffb; + break; + + case MSG_CMN_WINARCADE: + sceneHandler04_winArcade(); + break; + + case MSG_SC4_HANDOVER: + g_vars->scene04_var09 = 0; + g_vars->scene04_var19 = 1; + break; + + case MSG_SC4_DROPBOTTLE: + sceneHandler04_dropBottle(); + break; + + case MSG_SC4_COINOUT: + g_vars->scene04_clock->changeStatics2(ST_CLK_CLOSED); + g_vars->scene04_coinPut = 0; + sceneHandler04_stopSound(); + + if (g_vars->scene04_kozyawkiAni.size() && !g_vars->scene04_var02) { + g_vars->scene04_var09 = 1; + + if (g_vars->scene04_var10) + sceneHandler04_sub1(0); + + sceneHandler04_sub15(); + } + + break; + + case MSG_SC4_KOZAWFALL: + { + ExCommand *exnew; + + if (g_vars->scene04_var11) { + sceneHandler04_sub9(g_vars->scene04_var24); + + g_vars->scene04_var11 = 0; + + exnew = new ExCommand(0, 35, SND_4_010, 0, 0, 0, 1, 0, 0, 0); + } else { + exnew = new ExCommand(0, 35, SND_4_012, 0, 0, 0, 1, 0, 0, 0); + } + + exnew->_field_14 = 5; + exnew->_excFlags |= 2; + exnew->postMessage(); + break; + } + + case MSG_SC4_MANFROMBOTTLE: + sceneHandler04_manFromBottle(); + break; + + case MSG_SC4_CLICKLADDER: + sceneHandler04_clickLadder(); + break; + + case MSG_SC4_MANTOBOTTLE: + sceneHandler04_manToBottle(); + break; + + case MSG_SHOWCOIN: + sceneHandler04_showCoin(); + break; + + case MSG_TAKEBOTTLE: + sceneHandler04_takeBottle(); + break; + + case MSG_GOTOLADDER: + sceneHandler04_gotoLadder(0); + break; + + case MSG_SC4_COINPUT: + g_vars->scene04_coinPut = 1; + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/sceneDbg.cpp b/engines/fullpipe/scenes/sceneDbg.cpp new file mode 100644 index 0000000000..83f3b64ee5 --- /dev/null +++ b/engines/fullpipe/scenes/sceneDbg.cpp @@ -0,0 +1,107 @@ +/* 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/scenes.h" +#include "fullpipe/statics.h" +#include "fullpipe/input.h" + +#include "fullpipe/interaction.h" + +namespace Fullpipe { + +void sceneDbgMenu_initScene(Scene *sc) { + g_vars->selector = sc->getPictureObjectById(PIC_SCD_SEL, 0); + getGameLoaderInteractionController()->disableFlag24(); + setInputDisabled(0); +} + +GameObject *sceneHandlerDbgMenu_getObjectAtXY(int x, int y) { + if (g_fullpipe->_currentScene) + for (uint i = 0; i < g_fullpipe->_currentScene->_picObjList.size(); i++) { + PictureObject *pic = (PictureObject *)g_fullpipe->_currentScene->_picObjList[i]; + + if (x >= pic->_ox && y >= pic->_oy) { + Common::Point point; + + pic->getDimensions(&point); + + if (x <= pic->_ox + point.x && y <= pic->_oy + point.y && pic != g_vars->selector) + return pic; + } + } + + return 0; +} + +int sceneHandlerDbgMenu(ExCommand *ex) { + if (ex->_messageKind != 17) + return 0; + + int mx = g_fullpipe->_mouseScreenPos.x + g_fullpipe->_sceneRect.left; + int my = g_fullpipe->_mouseScreenPos.y + g_fullpipe->_sceneRect.top; + + if (ex->_messageNum == 29) { + GameObject *obj = sceneHandlerDbgMenu_getObjectAtXY(mx, my); + if (obj && canInteractAny(0, obj, -3) ) { + getGameLoaderInteractionController()->enableFlag24(); + handleObjectInteraction(0, obj, 0); + } + return 0; + } + if (ex->_messageNum != 33) { + if (ex->_messageNum == MSG_RESTARTGAME) { + g_fullpipe->_needRestart = true; + return 0; + } + return 0; + } + + g_fullpipe->_cursorId = PIC_CSR_DEFAULT; + GameObject *obj = g_fullpipe->_currentScene->getStaticANIObjectAtPos(mx, my); + if (obj) { + if (canInteractAny(0, obj, -3)) { + g_fullpipe->_cursorId = PIC_CSR_DEFAULT; + g_fullpipe->setCursor(PIC_CSR_DEFAULT); + return 0; + } + } else { + obj = sceneHandlerDbgMenu_getObjectAtXY(mx, my); + if (obj && canInteractAny(0, obj, -3) ) { + g_vars->selector->_flags |= 4; + g_vars->selector->setOXY(obj->_ox, obj->_oy); + g_fullpipe->_cursorId = PIC_CSR_DEFAULT; + g_fullpipe->setCursor(PIC_CSR_DEFAULT); + return 0; + } + g_vars->selector->_flags &= 0xFFFB; + } + g_fullpipe->setCursor(g_fullpipe->_cursorId); + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/sceneIntro.cpp b/engines/fullpipe/scenes/sceneIntro.cpp new file mode 100644 index 0000000000..d60f90faf7 --- /dev/null +++ b/engines/fullpipe/scenes/sceneIntro.cpp @@ -0,0 +1,109 @@ +/* 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/scenes.h" +#include "fullpipe/modal.h" +#include "fullpipe/statics.h" + +namespace Fullpipe { + +int sceneIntro_updateCursor() { + g_fullpipe->_cursorId = 0; + + return 0; +} + +void sceneIntro_initScene(Scene *sc) { + g_fullpipe->_gameLoader->loadScene(SC_INTRO2); + + g_vars->sceneIntro_aniin1man = sc->getStaticANIObject1ById(ANI_IN1MAN, -1); + g_vars->sceneIntro_needSleep = true; + g_vars->sceneIntro_needGetup = false; + g_vars->sceneIntro_playing = true; + g_vars->sceneIntro_needBlackout = false; + + if (g_fullpipe->_recordEvents || g_fullpipe->_inputArFlag) + g_vars->sceneIntro_skipIntro = false; + + g_fullpipe->_modalObject = new ModalIntro; +} + +void sceneHandlerIntro_part1() { + g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO1); + chainQueue(QU_INTR_FINISH, 0); +} + +void sceneHandlerIntro_part2() { + g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO2); + chainQueue(QU_IN2_DO, 0); +} + +int sceneHandlerIntro(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: + sceneHandlerIntro_part1(); + return 0; + + case MSG_INTR_GETUPMAN: + g_vars->sceneIntro_needSleep = 0; + g_vars->sceneIntro_needGetup = 1; + return 0; + + case MSG_INTR_SWITCHTO2: + sceneHandlerIntro_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_fullpipe->startSceneTrack(); + + return 0; +} + +} // End of namespace Fullpipe |