[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.98,1.99

Max Horn fingolfin at users.sourceforge.net
Tue May 20 10:51:06 CEST 2003


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

Modified Files:
	actor.cpp 
Log Message:
this is 100% equivalent to the old walkActorOld() code - I just made an equivalence transformation (anybody who doesn't believe that, I can show you step by step how to transform the code :-)

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- actor.cpp	20 May 2003 15:13:18 -0000	1.98
+++ actor.cpp	20 May 2003 17:50:43 -0000	1.99
@@ -1329,13 +1329,14 @@
 			break;
 
 		box = _vm->getPathToDestBox(walkbox, walkdata.destbox);
-		if (box < 0 || box > 0xF0) {
+		if (box < 0) {
 			walkdata.destbox = walkbox;
 			moving |= MF_LAST_LEG;
 			return;
 		}
 
 		walkdata.curbox = box;
+		
 		if (_vm->findPathTowards(this, walkbox, box, walkdata.destbox, foundPathX, foundPathY))
 			break;
 
@@ -1356,23 +1357,50 @@
 	if (!moving)
 		return;
 
-	if (moving & MF_NEW_LEG) {
-	restart:
+	if (!(moving & MF_NEW_LEG)) {
+	
+		if (moving & MF_IN_LEG && actorWalkStep())
+			return;
+	
+		if (moving & MF_LAST_LEG) {
+			moving = 0;
+			startWalkAnim(3, walkdata.destdir);
+			return;
+		}
+	
+		if (moving & MF_TURN) {
+			new_dir = updateActorDirection(false);
+			if (facing != new_dir)
+				setDirection(new_dir);
+			else
+				moving = 0;
+			return;
+		}
+	
+		if (walkdata.point3x != 32000) {
+			if (calcMovementFactor(walkdata.point3x, walkdata.point3y)) {
+				walkdata.point3x = 32000;
+				return;
+			}
+			walkdata.point3x = 32000;
+		}
+	
+		walkbox = walkdata.curbox;
+		moving &= MF_IN_LEG;
+		moving |= MF_NEW_LEG;
+	}
+
+	do {
 		moving &= ~MF_NEW_LEG;
 
 		if (walkbox == INVALID_BOX) {
 			walkbox = walkdata.destbox;
 			walkdata.curbox = walkdata.destbox;
-			moving |= MF_LAST_LEG;
-			calcMovementFactor(walkdata.destx, walkdata.desty);
-			return;
+			break;
 		}
 
-		if (walkbox == walkdata.destbox) {
-			moving |= MF_LAST_LEG;
-			calcMovementFactor(walkdata.destx, walkdata.desty);
-			return;
-		}
+		if (walkbox == walkdata.destbox)
+			break;
 
 		next_box = _vm->getPathToDestBox(walkbox, walkdata.destbox);
 
@@ -1385,9 +1413,7 @@
 
 		_vm->findPathTowardsOld(this, walkbox, next_box, walkdata.destbox, gateLoc);
 		if (gateLoc[2].x == 32000 && gateLoc[3].x == 32000) {
-			moving |= MF_LAST_LEG;
-			calcMovementFactor(walkdata.destx, walkdata.desty);
-			return;
+			break;
 		}
 
 		if (gateLoc[2].x != 32000) {
@@ -1402,40 +1428,10 @@
 			return;
 
 		walkbox = walkdata.destbox;
-		goto restart;
-
-	}
-
-	if (moving & MF_IN_LEG && actorWalkStep())
-		return;
-
-	if (moving & MF_LAST_LEG) {
-		moving = 0;
-		startWalkAnim(3, walkdata.destdir);
-		return;
-	}
-
-	if (moving & MF_TURN) {
-		new_dir = updateActorDirection(false);
-		if (facing != new_dir)
-			setDirection(new_dir);
-		else
-			moving = 0;
-		return;
-	}
-
-	if (walkdata.point3x != 32000) {
-		if (calcMovementFactor(walkdata.point3x, walkdata.point3y)) {
-			walkdata.point3x = 32000;
-			return;
-		}
-		walkdata.point3x = 32000;
-	}
+	} while(1);
 
-	walkbox = walkdata.curbox;
-	moving &= MF_IN_LEG;
-	moving |= MF_NEW_LEG;
-	goto restart;
+	moving |= MF_LAST_LEG;
+	calcMovementFactor(walkdata.destx, walkdata.desty);
 }
 
 byte *Actor::getActorName() {





More information about the Scummvm-git-logs mailing list