From 82b596a31e42bf21cec2a31a3a68c07c1936355d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 21 Jul 2013 23:22:04 +0300 Subject: FULLPIPE: Several methods for motion controller --- engines/fullpipe/gameloader.cpp | 8 ++++++++ engines/fullpipe/gameloader.h | 4 +++- engines/fullpipe/motion.h | 17 ++++++++++++++--- engines/fullpipe/scenes.cpp | 10 ++++++---- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 7f38515afd..abb709825d 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -31,6 +31,14 @@ CInventory2 *getGameLoaderInventory() { return &g_fullpipe->_gameLoader->_inventory; } +CMctlCompound *getSc2MctlCompoundBySceneId(int16 sceneId) { + for (uint i = 0; i < g_fullpipe->_gameLoader->_sc2array.size(); i++) + if (g_fullpipe->_gameLoader->_sc2array[i]._sceneId == sceneId) + return (CMctlCompound *)g_fullpipe->_gameLoader->_sc2array[i]._motionController; + + return 0; +} + CInteractionController *getGameLoaderInteractionController() { return g_fullpipe->_gameLoader->_interactionController; } diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index a37181d5fd..13b100c230 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -29,6 +29,7 @@ namespace Fullpipe { class SceneTag; +class CMctlCompound; class CGameLoader : public CObject { public: @@ -44,6 +45,7 @@ class CGameLoader : public CObject { CGameVar *_gameVar; CInventory2 _inventory; CInteractionController *_interactionController; + Sc2Array _sc2array; private: GameProject *_gameProject; @@ -57,7 +59,6 @@ class CGameLoader : public CObject { int _field_28; int _field_2C; CInputController _inputController; - Sc2Array _sc2array; void *_sceneSwitcher; void *_preloadCallback; void *_readSavegameCallback; @@ -73,6 +74,7 @@ class CGameLoader : public CObject { CInventory2 *getGameLoaderInventory(); CInteractionController *getGameLoaderInteractionController(); +CMctlCompound *getSc2MctlCompoundBySceneId(int16 sceneId); } // End of namespace Fullpipe diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 39fadbe6e2..28e4297337 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -27,11 +27,16 @@ namespace Fullpipe { class CMotionController : public CObject { int _field_4; - int _isEnabled; + bool _isEnabled; public: - CMotionController() : _isEnabled(1) {} + CMotionController() : _isEnabled(true) {} virtual bool load(MfcArchive &file); + + void setEnabled() { _isEnabled = true; } + void clearEnabled() { _isEnabled = false; } + + virtual void addObject(StaticANIObject *obj) {} }; class CMctlCompoundArray : public Common::Array, public CObject { @@ -49,6 +54,9 @@ class CMctlCompound : public CMotionController { public: virtual bool load(MfcArchive &file); + + virtual void addObject(StaticANIObject *obj); + void initMovGraph2(); }; class Unk2 : public CObject { @@ -76,10 +84,11 @@ class CMovGraphReact : public CObject { // Empty }; -class CMctlCompoundArrayItem : public CMotionController { +class CMctlCompoundArrayItem : public CObject { friend class CMctlCompound; protected: + CMotionController *_motionControllerObj; CMovGraphReact *_movGraphReactObj; CMctlConnectionPointsArray _connectionPoints; int _field_20; @@ -149,6 +158,8 @@ class CMovGraph : public CMotionController { public: CMovGraph(); virtual bool load(MfcArchive &file); + + virtual void addObject(StaticANIObject *obj); }; class CMctlConnectionPoint : public CObject { diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index b79f32f6e3..d0d0fabeab 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -29,6 +29,7 @@ #include "fullpipe/scene.h" #include "fullpipe/gameloader.h" #include "fullpipe/sound.h" +#include "fullpipe/motion.h" #include "fullpipe/gameobj.h" @@ -97,18 +98,19 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _aniMan->_staticsObj = _aniMan->getStaticsById(ST_MAN_EMPTY); _aniMan->setOXY(0, 0); -#if 0 if (_aniMan) { _aniMan2 = _aniMan; - getSc2MotionControllerBySceneId(entrance->_sceneId)->initMovGraph2(); - getSc2MotionControllerBySceneId(entrance->_sceneId)->addObject(_aniMan); - getSc2MotionControllerBySceneId(entrance->_sceneId)->setEnabled(); + CMctlCompound *cmp = getSc2MctlCompoundBySceneId(entrance->_sceneId); + cmp->initMovGraph2(); + cmp->addObject(_aniMan); + cmp->setEnabled(); getGameLoaderInteractionController()->enableFlag24(); input_setInputDisabled(0); } else { _aniMan2 = 0; } +#if 0 scene->setPictureObjectsFlag4(); for (CPtrList::iterator s = scene->_staticANIObjectList1.begin(); s != scene->_staticANIObjectList1.end(); ++s) { -- cgit v1.2.3