[Scummvm-cvs-logs] SF.net SVN: scummvm:[45893] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Sat Nov 14 12:45:18 CET 2009
Revision: 45893
http://scummvm.svn.sourceforge.net/scummvm/?rev=45893&view=rev
Author: megath
Date: 2009-11-14 11:45:15 +0000 (Sat, 14 Nov 2009)
Log Message:
-----------
stick to the closest points to the destination instead of walkboxes' centers
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/objects.h
scummvm/trunk/engines/teenagent/scene.cpp
Modified: scummvm/trunk/engines/teenagent/objects.h
===================================================================
--- scummvm/trunk/engines/teenagent/objects.h 2009-11-14 11:32:58 UTC (rev 45892)
+++ scummvm/trunk/engines/teenagent/objects.h 2009-11-14 11:45:15 UTC (rev 45893)
@@ -78,7 +78,21 @@
inline bool contains(const Rect & rect) const {
return rect.left >= left && rect.right <= right && rect.top >= top && rect.bottom <= bottom;
}
+
+ inline Common::Point closest_to(const Common::Point & src) const {
+ Common::Point p(src);
+ if (p.x < left)
+ p.x = left;
+ if (p.x > right)
+ p.x = right;
+ if (p.y < top)
+ p.y = top;
+ if (p.y > bottom)
+ p.y = bottom;
+ return p;
+ }
+
protected:
byte * _base;
};
Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp 2009-11-14 11:32:58 UTC (rev 45892)
+++ scummvm/trunk/engines/teenagent/scene.cpp 2009-11-14 11:45:15 UTC (rev 45893)
@@ -165,15 +165,11 @@
search(nodes, n, m, start / m, start % m, -1, end, 1);
int v = end;
+ Common::Point prev(dst);
do {
debug(1, "backtrace %d", v);
- Common::Point c = nodes[v].rect.center();
- if (end / m == v / m) { //same y
- c.y = dst.y;
- }
- if (end % m == v % m) {
- c.x = dst.x;
- }
+ Common::Point c = nodes[v].rect.closest_to(prev);
+ prev = c;
p.push_front(c);
if (v == start)
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list