[Scummvm-cvs-logs] scummvm master -> c6d36044c5343b6cbc476d3e06be06963c35a9ba

sev- sev at scummvm.org
Mon May 5 07:04:05 CEST 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c6d36044c5 FULLPIPE: Started MovGraph::findClosestLink() implementation


Commit: c6d36044c5343b6cbc476d3e06be06963c35a9ba
    https://github.com/scummvm/scummvm/commit/c6d36044c5343b6cbc476d3e06be06963c35a9ba
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-05-05T08:02:44+03:00

Commit Message:
FULLPIPE: Started MovGraph::findClosestLink() implementation

Changed paths:
    engines/fullpipe/motion.cpp
    engines/fullpipe/motion.h



diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index df0e8d8..00e4d85 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -687,6 +687,64 @@ void MovGraph::calcNodeDistancesAndAngles() {
 	}
 }
 
+bool MovGraph::findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr) {
+#if 0
+	v4 = (double)p->x;
+	v5 = (double)(signed int)p->y;
+	link = 0;
+	v28 = 1.0e20;
+
+	for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) {
+		MovGraphLink *lnk = (MovGraphLink *)*i;
+
+		v8 = v6->data;
+
+		if ((lnk->_flags & 0x10000000) && !(lnk->_flags & 0x20000000) ) {
+			v12 = lnk->_movGraphNode1->_x;
+			v13 = lnk->_movGraphNode1->_y;
+			v23 = v12;
+			v14 = lnk->_movGraphNode2->_x;
+			v15 = (double)v12;
+			v27 = v14;
+			v16 = v14 - v12;
+			v17 = lnk->_movGraphNode2->_y;
+			v29 = v15;
+			v18 = v4 - v15;
+			v32 = (double)v13 - v5;
+			v33 = (double)v16;
+			v19 = sqrt(v32 * v32 + v18 * v18);
+			v20 = ((double)(v13 - v17) * v32 + v33 * v18) / lnk->_distance / v19;
+			v21 = v20 * v19;
+			v26 = sqrt(1.0 - v20 * v20) * v19;
+			if ( v20 * v19 < 0.0 ) {
+				v21 = 0.0;
+				v26 = sqrt((v29 - v4) * (v29 - v4) + v32 * v32);
+			}
+			if (v21 > lnk->_distance) {
+				v21 = lnk->_distance;
+				v26 = sqrt(((double)v27 - v4) * ((double)v27 - v4) + ((double)lnk->_movGraphNode2->_y - v5) * ((double)lnk->_movGraphNode2->_y - v5));
+			}
+			if ( v21 >= 0.0 && v21 <= lnk->_distance && v26 < v28 ) {
+				v30 = v23 + (unsigned __int64)(signed __int64)(v33 * v21 / lnk->_distance);
+				v7 = v13 + (unsigned __int64)(signed __int64)((double)(v17 - v13) * v21 / lnk->_distance);
+				v28 = v26;
+				link = lnk;
+			}
+		}
+	}
+
+	if (v28 < 1.0e20) {
+		if (movarr)
+			movarr->_link = link;
+		p->x = v30;
+		p->y = v7;
+
+		return true;
+	}
+#endif
+	return false;
+}
+
 int MovGraph::getItemIndexByStaticAni(StaticANIObject *ani) {
 	for (uint i = 0; i < _items.size(); i++)
 		if (_items[i]->ani == ani)
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 396fc65..13d96ae 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -359,6 +359,7 @@ public:
 
 	double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch);
 	void calcNodeDistancesAndAngles();
+	bool findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr);
 	MovGraphNode *calcOffset(int ox, int oy);
 	int getItemIndexByStaticAni(StaticANIObject *ani);
 	Common::Array<MovArr *> *genMovArr(int x, int y, int *arrSize, int flag1, int flag2);






More information about the Scummvm-git-logs mailing list