diff options
author | Eugene Sandulenko | 2013-09-28 14:15:46 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-28 14:15:46 +0300 |
commit | dd7995958dd5d1efd59f86c27384fd1b58dfa098 (patch) | |
tree | 08a7b572694f576a8023c8c3d3d0204131cfef22 /engines/fullpipe/motion.cpp | |
parent | b22c7d28f7d757c56d998a2c5d286e3679ae9249 (diff) | |
download | scummvm-rg350-dd7995958dd5d1efd59f86c27384fd1b58dfa098.tar.gz scummvm-rg350-dd7995958dd5d1efd59f86c27384fd1b58dfa098.tar.bz2 scummvm-rg350-dd7995958dd5d1efd59f86c27384fd1b58dfa098.zip |
FULLPIPE: Implement MovGraph2::addObject()
Diffstat (limited to 'engines/fullpipe/motion.cpp')
-rw-r--r-- | engines/fullpipe/motion.cpp | 33 |
1 files changed, 31 insertions, 2 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; |