[Scummvm-cvs-logs] scummvm master -> 18d2bbc2289feff265c12026aae7093b24aee959
sev-
sev at scummvm.org
Tue Oct 22 23:50:41 CEST 2013
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1dd90e4ea9 FULLPIPE: Implement MovGraph::calcOffset()
18d2bbc228 FULLPIPE: Implement MovGraph::calcNodeDistancesAndAngles()
Commit: 1dd90e4ea9a01df9f2ccca8779c4fb3bec86cb34
https://github.com/scummvm/scummvm/commit/1dd90e4ea9a01df9f2ccca8779c4fb3bec86cb34
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-10-22T14:37:04-07:00
Commit Message:
FULLPIPE: Implement MovGraph::calcOffset()
Changed paths:
engines/fullpipe/motion.cpp
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 94635a3..ebf896c 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -1132,9 +1132,22 @@ double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest,
}
MovGraphNode *MovGraph::calcOffset(int ox, int oy) {
- warning("STUB: MovGraph::calcOffset()");
+ MovGraphNode *res = 0;
+ double mindist = 1.0e10;
- return 0;
+ for (ObList::iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
+ assert(((CObject *)*i)->_objtype == kObjTypeMovGraphNode);
+
+ MovGraphNode *node = (MovGraphNode *)*i;
+
+ double dist = sqrt((double)((node->_x - oy) * (node->_x - oy) + (node->_x - ox) * (node->_x - ox)));
+ if (dist < mindist) {
+ mindist = dist;
+ res = node;
+ }
+ }
+
+ return res;
}
void MGM::clear() {
Commit: 18d2bbc2289feff265c12026aae7093b24aee959
https://github.com/scummvm/scummvm/commit/18d2bbc2289feff265c12026aae7093b24aee959
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-10-22T14:49:55-07:00
Commit Message:
FULLPIPE: Implement MovGraph::calcNodeDistancesAndAngles()
Changed paths:
engines/fullpipe/motion.cpp
engines/fullpipe/motion.h
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index ebf896c..750c2de 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -357,6 +357,18 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzz
return res;
}
+void MovGraph::calcNodeDistancesAndAngles() {
+ for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) {
+ assert(((CObject *)*i)->_objtype == kObjTypeMovGraphLink);
+
+ MovGraphLink *lnk = (MovGraphLink *)*i;
+
+ lnk->_flags &= 0x7FFFFFFF;
+
+ lnk->calcNodeDistanceAndAngle();
+ }
+}
+
int MovGraph2::getItemIndexByGameObjectId(int objectId) {
for (uint i = 0; i < _items.size(); i++)
if (_items[i]->_objectId == objectId)
@@ -1248,6 +1260,16 @@ bool MovGraphLink::load(MfcArchive &file) {
return true;
}
+void MovGraphLink::calcNodeDistanceAndAngle() {
+ if (_movGraphNode1) {
+ double dx = _movGraphNode2->_x - _movGraphNode1->_x;
+ double dy = _movGraphNode2->_y - _movGraphNode1->_y;
+
+ _distance = sqrt(dy * dy + dx * dx);
+ _angle = atan2(dx, dy);
+ }
+}
+
bool MovGraphNode::load(MfcArchive &file) {
debug(5, "MovGraphNode::load()");
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 85ad084..7da0c47 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -206,6 +206,8 @@ class MovGraphLink : public CObject {
public:
MovGraphLink();
virtual bool load(MfcArchive &file);
+
+ void calcNodeDistanceAndAngle();
};
struct MovGraphItem {
@@ -255,6 +257,7 @@ class MovGraph : public MotionController {
virtual int method50();
double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch);
+ void calcNodeDistancesAndAngles();
MovGraphNode *calcOffset(int ox, int oy);
};
More information about the Scummvm-git-logs
mailing list