diff options
-rw-r--r-- | engines/fullpipe/motion.cpp | 33 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 32 |
2 files changed, 61 insertions, 4 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 66664b1de5..d2ece50aa2 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -27,6 +27,7 @@ #include "common/list.h" #include "fullpipe/objects.h" +#include "fullpipe/statics.h" #include "fullpipe/motion.h" #include "fullpipe/messages.h" #include "fullpipe/gameloader.h" @@ -234,8 +235,37 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int flag return 0; } +int MovGraph2::getItemIndexByGameObjectId(int objectId) { + for (uint i = 0; i < _items.size(); i++) + if (_items[i]->_objectId == objectId) + return i; + + return -1; +} + +bool MovGraph2::initDirections(StaticANIObject *obj, MovGraph2Item *item) { + warning("STUB: MovGraph2::initDirections()"); + + return false; +} + void MovGraph2::addObject(StaticANIObject *obj) { - warning("STUB: MovGraph2::addObject()"); + MovGraph::addObject(obj); + + int id = getItemIndexByGameObjectId(obj->_id); + + if (id >= 0) { + _items[id]->_obj = obj; + } else { + + MovGraph2Item *item = new MovGraph2Item; + + if (initDirections(obj, item)) { + _items.push_back(item); + } else { + delete item; + } + } } int MovGraph2::removeObject(StaticANIObject *obj) { @@ -266,7 +296,6 @@ MovGraphNode *MovGraph::calcOffset(int ox, int oy) { return 0; } - MovGraphLink::MovGraphLink() { _distance = 0; _angle = 0; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 0f91a99600..7cc20e392c 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -101,10 +101,11 @@ class MctlCompound : public MotionController { }; class Unk2 : public CObject { +public: int _items; int _count; - public: +public: Unk2() : _items(0), _count(0) {} }; @@ -199,9 +200,32 @@ class MovGraph : public MotionController { MovGraphNode *calcOffset(int ox, int oy); }; +class Movement; + +struct MG2I { + int _movementId; + Movement *_movement; + int _mx; + int _my; +}; + +struct MovGraph2ItemSub { + int _staticsId2; + int _staticsId1; + MG2I _field_8[3]; + MG2I _field_38[4]; + MG2I _field_78[4]; +}; + +struct MovGraph2Item { + int _objectId; + StaticANIObject *_obj; + MovGraph2ItemSub _subItems[4]; +}; + class MovGraph2 : public MovGraph { public: - ObArray _items; + Common::Array<MovGraph2Item *> _items; public: virtual void addObject(StaticANIObject *obj); @@ -209,9 +233,13 @@ public: virtual void freeItems(); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId); virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId); + + int getItemIndexByGameObjectId(int objectId); + bool initDirections(StaticANIObject *obj, MovGraph2Item *item); }; class MctlConnectionPoint : public CObject { +public: int _connectionX; int _connectionY; int _field_C; |