FULLPIPE: Implement MovGraph2::addObject()

This commit is contained in:
Eugene Sandulenko 2013-09-28 14:15:46 +03:00
parent b22c7d28f7
commit dd7995958d
2 changed files with 61 additions and 4 deletions

View file

@ -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;

View file

@ -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;