[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.68,1.69
Max Horn
fingolfin at users.sourceforge.net
Fri Mar 7 20:12:01 CET 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv9777
Modified Files:
actor.cpp
Log Message:
cleanup (should cause no behavior change)
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- actor.cpp 7 Mar 2003 02:43:21 -0000 1.68
+++ actor.cpp 8 Mar 2003 04:11:02 -0000 1.69
@@ -233,34 +233,35 @@
return 180;
}
}
- /* Or 1024 in to signal direction interpolation should be done */
+ // OR 1024 in to signal direction interpolation should be done
return normalizeAngle(dir) | 1024;
}
int Actor::updateActorDirection(bool is_walking) {
- int from, to;
- int diff;
+ int from;
int dirType;
int dir;
- int num;
bool shouldInterpolate;
dirType = (_vm->_features & GF_NEW_COSTUMES) ? _vm->akos_hasManyDirections(this) : false;
from = toSimpleDir(dirType, facing);
dir = remapDirection(newDirection, is_walking);
+
if (_vm->_features & GF_NEW_COSTUMES)
// Direction interpolation interfers with walk scripts in Dig; they perform
// (much better) interpolation themselves.
shouldInterpolate = false;
else
shouldInterpolate = (dir & 1024) ? true : false;
- to = toSimpleDir(dirType, dir & 1023);
- num = dirType ? 8 : 4;
+ dir &= 1023;
if (shouldInterpolate) {
+ int to = toSimpleDir(dirType, dir);
+ int num = dirType ? 8 : 4;
+
// Turn left or right, depending on which is shorter.
- diff = to - from;
+ int diff = to - from;
if (abs(diff) > (num >> 1))
diff = -diff;
@@ -269,9 +270,9 @@
} else if (diff < 0){
to = from - 1;
}
- }
- dir = fromSimpleDir(dirType, (to + num) % num);
+ dir = fromSimpleDir(dirType, (to + num) % num);
+ }
return dir;
}
@@ -1275,7 +1276,7 @@
}
void Actor::walkActor() {
- int j;
+ int new_dir, box;
int16 foundPathX, foundPathY;
if (!moving)
@@ -1293,9 +1294,9 @@
}
if (moving & MF_TURN) {
- j = updateActorDirection(false);
- if (facing != j)
- setDirection(j);
+ new_dir = updateActorDirection(false);
+ if (facing != new_dir)
+ setDirection(new_dir);
else
moving = 0;
return;
@@ -1314,15 +1315,15 @@
}
if (walkbox == walkdata.destbox)
break;
- j = _vm->getPathToDestBox(walkbox, walkdata.destbox);
- if (j == -1 || j > 0xF0) {
+ box = _vm->getPathToDestBox(walkbox, walkdata.destbox);
+ if (box == -1 || box > 0xF0) {
walkdata.destbox = walkbox;
moving |= MF_LAST_LEG;
return;
}
- walkdata.curbox = j;
+ walkdata.curbox = box;
- if (_vm->findPathTowards(this, walkbox, j, walkdata.destbox, foundPathX, foundPathY))
+ if (_vm->findPathTowards(this, walkbox, box, walkdata.destbox, foundPathX, foundPathY))
break;
if (calcMovementFactor(foundPathX, foundPathY))
return;
@@ -1391,10 +1392,8 @@
}
- if (moving & MF_IN_LEG) {
- if (actorWalkStep())
- return;
- }
+ if (moving & MF_IN_LEG && actorWalkStep())
+ return;
if (moving & MF_LAST_LEG) {
moving = 0;
@@ -1404,11 +1403,10 @@
if (moving & MF_TURN) {
new_dir = updateActorDirection(false);
- if (facing != new_dir) {
+ if (facing != new_dir)
setDirection(new_dir);
- return;
- }
- moving = 0;
+ else
+ moving = 0;
return;
}
More information about the Scummvm-git-logs
mailing list