[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.148,1.149

Max Horn fingolfin at users.sourceforge.net
Sat Dec 6 06:20:03 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv11184

Modified Files:
	object.cpp 
Log Message:
Fix for bug #853874 (ZAK: Can't Give Club in 5.5 build); this may cause regressions, and/or fix other bugs. However, I believe this is the right thing (TM) to do anyway :-)

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -d -r1.148 -r1.149
--- object.cpp	16 Nov 2003 20:52:56 -0000	1.148
+++ object.cpp	6 Dec 2003 14:19:34 -0000	1.149
@@ -274,7 +274,7 @@
 }
 
 int ScummEngine::getObjActToObjActDist(int a, int b) {
-	int x, y, x2, y2, dist;
+	int x, y, x2, y2;
 	Actor *acta = NULL;
 	Actor *actb = NULL;
 
@@ -293,25 +293,26 @@
 	if (getObjectOrActorXY(b, x2, y2) == -1)
 		return 0xFF;
 
-	if (acta) {
+	// Only call FOO in V5 games. Older versions don't seem to make this
+	// call at all, and using it caused at least one bug (#853874).
+	if (acta && _version == 5) {
 		AdjustBoxResult r = acta->adjustXYToBeInBox(x2, y2);
 		x2 = r.x;
 		y2 = r.y;
 	}
 
 	// Now compute the distance between the two points
-	x = ABS(x - x2);
-	y = ABS(y - y2);
-
-	// For V1/V2 games, distances are measured in the original "character"
-	// based coordinate system, instead of pixels. Otherwise various scripts
-	// will break.
 	if (_version <= 2) {
-		dist = MAX(x/8, y/2);
-	} else 
-		dist = MAX(x, y);
+		// For V1/V2 games, distances are measured in the original "character"
+		// based coordinate system, instead of pixels. Otherwise various scripts
+		// will break. See bugs #853874, #774529
+		x /= 8;
+		y /= 2;
+		x2 /= 8;
+		y2 /= 2;
+	}
 
-	return dist;
+	return getDist(x, y, x2, y2);
 }
 
 int ScummEngine::findObject(int x, int y) {





More information about the Scummvm-git-logs mailing list