diff options
author | Kamil Zbróg | 2013-11-09 23:07:48 +0000 |
---|---|---|
committer | Kamil Zbróg | 2013-11-09 23:07:48 +0000 |
commit | 416110d3e087cb18b84c8ca26b63700160d9ac0f (patch) | |
tree | dd3a989b152a23480a079bd6b2689b6bf104b7dc /engines/fullpipe/scenes.cpp | |
parent | cdc1409dc77c57b083a60e6118c29dd9aad0be9b (diff) | |
parent | 4095ae1ba8e113a06924ec4c87383631c1fa5691 (diff) | |
download | scummvm-rg350-416110d3e087cb18b84c8ca26b63700160d9ac0f.tar.gz scummvm-rg350-416110d3e087cb18b84c8ca26b63700160d9ac0f.tar.bz2 scummvm-rg350-416110d3e087cb18b84c8ca26b63700160d9ac0f.zip |
Merge remote-tracking branch 'sync/master' into prince-malik
Diffstat (limited to 'engines/fullpipe/scenes.cpp')
-rw-r--r-- | engines/fullpipe/scenes.cpp | 207 |
1 files changed, 206 insertions, 1 deletions
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index fdc28e8092..c266a819ed 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -1600,8 +1600,213 @@ int scene03_updateCursor() { 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) { - warning("STUB: sceneHandler03()"); + 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; } |