From 5d18c50168b24607ee24777692d3c7a7fb4156ea Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 3 Jan 2014 23:25:37 +0200 Subject: [PATCH] FULLPIPE: Implement Floaters::init() --- engines/fullpipe/floaters.cpp | 57 ++++++++++++++++++++++++++++++++++- engines/fullpipe/floaters.h | 5 ++- engines/fullpipe/motion.h | 1 + 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/floaters.cpp b/engines/fullpipe/floaters.cpp index 384bfa21508..7e807ad1a5a 100644 --- a/engines/fullpipe/floaters.cpp +++ b/engines/fullpipe/floaters.cpp @@ -22,11 +22,66 @@ #include "fullpipe/fullpipe.h" #include "fullpipe/floaters.h" +#include "fullpipe/utils.h" +#include "fullpipe/objects.h" +#include "fullpipe/motion.h" +#include "fullpipe/objectnames.h" namespace Fullpipe { +Floaters::~Floaters() { + delete _hRgn; +} + void Floaters::init(GameVar *var) { - warning("STUB: Floaters::init()"); + _array1.clear(); + _array2.clear(); + + GameVar *varFliers = var->getSubVarByName(sO_Fliers); + + if (!varFliers) + return; + + GameVar *sub = varFliers->getSubVarByName("flyIdleRegion"); + + if (sub) { + _hRgn = new ReactPolygonal(); + + _hRgn->_pointCount = sub->getSubVarsCount(); + _hRgn->_points = (Common::Point **)malloc(sizeof(Common::Point *) * _hRgn->_pointCount); + + sub = sub->_subVars; + + int idx = 0; + + while (sub) { + _hRgn->_points[idx] = new Common::Point; + _hRgn->_points[idx]->x = sub->_subVars->_value.intValue; + _hRgn->_points[idx]->y = sub->_subVars->_nextVarObj->_value.intValue; + + idx++; + sub = sub->_nextVarObj; + } + } + + sub = varFliers->getSubVarByName("flyIdlePath"); + + if (sub) { + _array1.reserve(sub->getSubVarsCount()); + + sub = sub->_subVars; + + int idx = 0; + + while (sub) { + _array1[idx]->val1 = sub->_subVars->_value.intValue; + _array1[idx]->val2 = sub->_subVars->_nextVarObj->_value.intValue; + + idx++; + sub = sub->_nextVarObj; + } + + } } void Floaters::genFlies(Scene *sc, int x, int y, int a5, int a6) { diff --git a/engines/fullpipe/floaters.h b/engines/fullpipe/floaters.h index a4d64dd79d6..6611f4005c1 100644 --- a/engines/fullpipe/floaters.h +++ b/engines/fullpipe/floaters.h @@ -27,6 +27,7 @@ namespace Fullpipe { class StaticANIObject; class Scene; +class ReactPolygonal; struct FloaterArray1 { int val1; @@ -52,10 +53,12 @@ struct FloaterArray2 { class Floaters { public: - //HRGN hRgn; + ReactPolygonal *_hRgn; Common::Array _array1; Common::Array _array2; + Floaters() { _hRgn = 0; } + ~Floaters(); void init(GameVar *var); void genFlies(Scene *sc, int x, int y, int a5, int a6); void update(); diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 1c8f17e13ce..6ca24a303fe 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -29,6 +29,7 @@ class Statics; class Movement; class MctlConnectionPoint; class MovGraphLink; +class MessageQueue; int startWalkTo(int objId, int objKey, int x, int y, int a5); int doSomeAnimation(int objId, int objKey, int a3);