[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.115,1.116 script_v5.cpp,1.107,1.108

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sun Jun 1 10:05:05 CEST 2003


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

Modified Files:
	object.cpp script_v5.cpp 
Log Message:
Reverted the recent o5_getClosestObjActor() change and fixed it by
measuring the distance in characters for V2 games instead. Now Edna won't
bring the same strange kid into the cell over and over again.

If necessary, we can still fix o5_getClosestActor() to handle larger
distances. It just takes a few more changes than I first thought.


Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- object.cpp	1 Jun 2003 13:09:30 -0000	1.115
+++ object.cpp	1 Jun 2003 16:40:15 -0000	1.116
@@ -288,7 +288,7 @@
 
 	if (y > x)
 		x = y;
-	return x;
+	return (_features & GF_AFTER_V2) ? x / 8 : x;
 }
 
 int Scumm::findObject(int x, int y) {

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- script_v5.cpp	31 May 2003 12:17:57 -0000	1.107
+++ script_v5.cpp	1 Jun 2003 16:40:15 -0000	1.108
@@ -1031,9 +1031,18 @@
 void Scumm_v5::o5_getClosestObjActor() {
 	int obj;
 	int act;
-	int closest_obj = 0xFF, closest_dist = 0xFFFF;
 	int dist;
 
+	// This is a bit odd: We can't detect any actors farther away than
+	// 255 units (pixels in newer games, characters in older ones.) To
+	// fix this, we also need to change getObjActToObjActDist(), since
+	// it returns 255 to indicate that it can't find the actor, and make
+	// sure we don't break o5_getDist() in the process.
+	//
+	// But we probably won't have to.
+
+	int closest_obj = 0xFF, closest_dist = 0xFF;
+
 	getResultPos();
 
 	act = getVarOrDirectWord(0x80);
@@ -1061,9 +1070,6 @@
 	// FIXME: MI2 race workaround, see bug #597022
 	if (_gameId == GID_MONKEY2 && vm.slot[_currentScript].number == 40 && r < 60) 
 		r = 60; 
-
-	if (_features & GF_AFTER_V2)
-		r /= 8;
 
 	setResult(r);
 }





More information about the Scummvm-git-logs mailing list