[Scummvm-cvs-logs] CVS: scummvm actor.cpp,1.62,1.63

Max Horn fingolfin at users.sourceforge.net
Fri May 10 14:36:03 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv29447

Modified Files:
	actor.cpp 
Log Message:
one more direction 'fix', getting rid of one FIXME hack for Indy 4

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- actor.cpp	10 May 2002 18:47:37 -0000	1.62
+++ actor.cpp	10 May 2002 21:35:53 -0000	1.63
@@ -176,7 +176,7 @@
 	int specdir;
 	byte flags;
 	byte dirflag;
-
+	
 	if (!a->ignoreBoxes) {
 		specdir = _extraBoxFlags[a->walkbox];
 		if (specdir) {
@@ -192,7 +192,6 @@
 		dirflag = ((a->walkdata.XYFactor > 0) ? 1 : 0) |
 			((a->walkdata.YXFactor > 0) ? 2 : 0);
 
-
 		if ((flags & 8) || getClass(a->number, 0x1E)) {
 			dir = 360 - dir;
 			dirflag ^= 1;
@@ -218,7 +217,8 @@
 			return 180;
 		}
 	}
-	return normalizeAngle(dir);
+	/* Or 1024 in to signal direction interpolation should be done */
+	return normalizeAngle(dir) | 1024;
 }
 
 int Scumm::updateActorDirection(Actor * a)
@@ -226,25 +226,33 @@
 	int from, to;
 	int diff;
 	int dirType;
+	int dir;
 	int num;
+	bool shouldInterpolate;
 	
 	dirType = akos_hasManyDirections(a);
 
 	from = toSimpleDir(dirType, a->facing);
-	to = toSimpleDir(dirType, remapDirection(a, a->newDirection));
+	dir = remapDirection(a, a->newDirection);
+	shouldInterpolate = (dir & 1024);
+	to = toSimpleDir(dirType, dir & 1023);
 	diff = to - from;	
 	num = numSimpleDirDirections(dirType);
 
-	if (abs(diff) > (num >> 1))
-		diff = -diff;
-
-	if (diff == 0) {
-	} else if (diff > 0) {
-		from++;
-	} else {
-		from--;
-	}
-
+	if (shouldInterpolate) {
+		// Turn left or right, depending on which is shorter.
+		if (abs(diff) > (num >> 1))
+			diff = -diff;
+	
+		if (diff == 0) {
+		} else if (diff > 0) {
+			from++;
+		} else {
+			from--;
+		}
+	} else
+		from = to;
+	
 	return fromSimpleDir(dirType, from & (num - 1));
 }
 
@@ -414,11 +422,6 @@
 			a->animProgress = 0;
 			a->cost.animCounter1 = 0;
 			a->needRedraw = true;
-
-			// FIXME: FOA hack, room 17, climbing off machine
-			if (_gameId == GID_INDY4 && a->costume == 27) {
- 				a->facing = 0;
-			}
 
 			if (a->initFrame == frame)
 				initActorCostumeData(a);





More information about the Scummvm-git-logs mailing list