aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-10-17 00:55:34 +0300
committerEugene Sandulenko2013-10-17 00:55:34 +0300
commit8880077ec3899fc7bf752c5ede2434505b948157 (patch)
tree8899c73bf3dffe996c21abb0a4cd1a34d1d18e59 /engines
parent1cfafc6cfd8b7de11c1bb28df082199092e5774c (diff)
downloadscummvm-rg350-8880077ec3899fc7bf752c5ede2434505b948157.tar.gz
scummvm-rg350-8880077ec3899fc7bf752c5ede2434505b948157.tar.bz2
scummvm-rg350-8880077ec3899fc7bf752c5ede2434505b948157.zip
FULLPIPE: Implement MovGraph2::findNode()
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/motion.cpp14
-rw-r--r--engines/fullpipe/motion.h6
-rw-r--r--engines/fullpipe/utils.h9
3 files changed, 21 insertions, 8 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 53b2906599..aced36fa79 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -796,7 +796,19 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
}
MovGraphNode *MovGraph2::findNode(int x, int y, int fuzzyMatch) {
- warning("STUB: MovGraphLink *MovGraph2::findNode()");
+ for (ObList::iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
+ assert(((CObject *)*i)->_objtype == kObjTypeMovGraphNode);
+
+ MovGraphNode *node = (MovGraphNode *)*i;
+
+ if (fuzzyMatch) {
+ if (abs(node->_x - x) < 15 && abs(node->_y - y) < 15)
+ return node;
+ } else {
+ if (node->_x == x && node->_y == y)
+ return node;
+ }
+ }
return 0;
}
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index eedc292561..6901a7263a 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -147,15 +147,15 @@ public:
};
class MovGraphNode : public CObject {
- public:
+public:
int _x;
int _y;
int _distance;
int16 _field_10;
int _field_14;
- public:
- MovGraphNode() : _x(0), _y(0), _distance(0), _field_10(0), _field_14(0) {}
+public:
+ MovGraphNode() : _x(0), _y(0), _distance(0), _field_10(0), _field_14(0) { _objtype = kObjTypeMovGraphNode; }
virtual bool load(MfcArchive &file);
};
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index e593bd9f18..d976e09d60 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -66,15 +66,16 @@ class MfcArchive : public Common::SeekableReadStream {
enum ObjType {
kObjTypeDefault,
+ kObjTypeMovGraph,
+ kObjTypeMovGraphNode,
+ kObjTypeMctlCompound,
kObjTypeObjstateCommand,
- kObjTypeStaticANIObject,
kObjTypePictureObject,
- kObjTypeMovGraph,
- kObjTypeMctlCompound
+ kObjTypeStaticANIObject
};
class CObject {
- public:
+public:
ObjType _objtype;
CObject() : _objtype(kObjTypeDefault) {}