From 120cecdfe4aa5106e9096828e2a34e0bd6a58c9f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 20 Nov 2013 12:25:03 -0800 Subject: FULLPIPE: Move scene02 to separate file --- engines/fullpipe/module.mk | 3 +- engines/fullpipe/scenes.cpp | 98 -------------------------- engines/fullpipe/scenes/scene01.cpp | 1 - engines/fullpipe/scenes/scene02.cpp | 137 ++++++++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 100 deletions(-) create mode 100644 engines/fullpipe/scenes/scene02.cpp (limited to 'engines/fullpipe') diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk index 3d53320649..8563f092c0 100644 --- a/engines/fullpipe/module.mk +++ b/engines/fullpipe/module.mk @@ -24,7 +24,8 @@ MODULE_OBJS = \ statics.o \ utils.o \ scenes/sceneIntro.o \ - scenes/scene01.o + scenes/scene01.o \ + scenes/scene02.o # This module can be built as a plugin ifeq ($(ENABLE_FULLPIPE), DYNAMIC_PLUGIN) diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 27b8c29074..877bdfe36d 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -681,104 +681,6 @@ void FullpipeEngine::setSwallowedEggsState() { g_vars->swallowedEgg3->_value.intValue = 0; } -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; -} - void scene03_initScene(Scene *sc) { g_vars->scene03_eggeater = sc->getStaticANIObject1ById(ANI_EGGEATER, -1); g_vars->scene03_domino = sc->getStaticANIObject1ById(ANI_DOMINO_3, -1); diff --git a/engines/fullpipe/scenes/scene01.cpp b/engines/fullpipe/scenes/scene01.cpp index f446dbb007..4181bbffe3 100644 --- a/engines/fullpipe/scenes/scene01.cpp +++ b/engines/fullpipe/scenes/scene01.cpp @@ -22,7 +22,6 @@ #include "fullpipe/fullpipe.h" -//#include "fullpipe/objects.h" #include "fullpipe/objectnames.h" #include "fullpipe/constants.h" 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 -- cgit v1.2.3