From ac0e6749ba0f87e95f5b510998b62caac7857d45 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 3 Jan 2014 23:58:31 +0200 Subject: FULLPIPE: Implement Floaters::genFlies() --- engines/fullpipe/constants.h | 5 +++++ engines/fullpipe/floaters.cpp | 38 ++++++++++++++++++++++++++++++++++++-- engines/fullpipe/floaters.h | 7 ++++++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index af09d1d4d2..b88e5e8546 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -25,6 +25,11 @@ namespace Fullpipe { +// Common +#define ANI_FLY 4916 +#define MV_FLY_FLY 4917 +#define ST_FLY_FLY 4918 + #define ANI_BALLDROP 2685 #define ANI_BATUTA 737 #define ANI_BIGBALL 4923 diff --git a/engines/fullpipe/floaters.cpp b/engines/fullpipe/floaters.cpp index 7e807ad1a5..9c4db80f01 100644 --- a/engines/fullpipe/floaters.cpp +++ b/engines/fullpipe/floaters.cpp @@ -25,6 +25,9 @@ #include "fullpipe/utils.h" #include "fullpipe/objects.h" #include "fullpipe/motion.h" +#include "fullpipe/statics.h" +#include "fullpipe/scene.h" +#include "fullpipe/constants.h" #include "fullpipe/objectnames.h" namespace Fullpipe { @@ -84,8 +87,39 @@ void Floaters::init(GameVar *var) { } } -void Floaters::genFlies(Scene *sc, int x, int y, int a5, int a6) { - warning("STUB: Floaters::genFlies()"); +void Floaters::genFlies(Scene *sc, int x, int y, int priority, int flags) { + StaticANIObject *ani = new StaticANIObject(g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_FLY, -1)); + + ani->_statics = ani->getStaticsById(ST_FLY_FLY); + ani->_movement = 0; + ani->setOXY(x, y); + ani->_flags |= 4; + ani->_priority = priority; + + sc->addStaticANIObject(ani, 1); + + ani->startAnim(MV_FLY_FLY, 0, -1); + + int nummoves; + + if (ani->_movement->_currMovement) + nummoves = ani->_movement->_currMovement->_dynamicPhases.size(); + else + nummoves = ani->_movement->_dynamicPhases.size(); + + ani->_movement->setDynamicPhaseIndex(g_fp->_rnd->getRandomNumber(nummoves)); + + FloaterArray2 *arr2 = new FloaterArray2; + + arr2->ani = ani; + arr2->val11 = 15.0; + arr2->val3 = y; + arr2->val5 = y; + arr2->val2 = x; + arr2->val4 = x; + arr2->fflags = flags; + + _array2.push_back(arr2); } void Floaters::update() { diff --git a/engines/fullpipe/floaters.h b/engines/fullpipe/floaters.h index 6611f4005c..3ecbbeea9c 100644 --- a/engines/fullpipe/floaters.h +++ b/engines/fullpipe/floaters.h @@ -32,6 +32,8 @@ class ReactPolygonal; struct FloaterArray1 { int val1; int val2; + + FloaterArray1() { val1 = 0; val2 = 0; } }; struct FloaterArray2 { @@ -49,6 +51,9 @@ struct FloaterArray2 { int countdown; int val15; int fflags; + + FloaterArray2() : ani(0), val2(0), val3(0), val4(0), val5(0), val6(0), val7(0), val8(0), + val9(0.0), val11(0.0), val13(0), countdown(0), val15(0), fflags(0) {} }; class Floaters { @@ -60,7 +65,7 @@ public: Floaters() { _hRgn = 0; } ~Floaters(); void init(GameVar *var); - void genFlies(Scene *sc, int x, int y, int a5, int a6); + void genFlies(Scene *sc, int x, int y, int priority, int flags); void update(); void stopAll(); }; -- cgit v1.2.3