aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-05-20 17:50:43 +0000
committerMax Horn2003-05-20 17:50:43 +0000
commit1f859e592f278f3fd4746ce4b65b5a12ea0453d5 (patch)
treebb43672f4d2dd48f2f41206cf4336e8636a136d2 /scumm
parent14273bad5e82f4af70e1352f3d0f7681ccd2f8d1 (diff)
downloadscummvm-rg350-1f859e592f278f3fd4746ce4b65b5a12ea0453d5.tar.gz
scummvm-rg350-1f859e592f278f3fd4746ce4b65b5a12ea0453d5.tar.bz2
scummvm-rg350-1f859e592f278f3fd4746ce4b65b5a12ea0453d5.zip
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 :-)
svn-id: r7749
Diffstat (limited to 'scumm')
-rw-r--r--scumm/actor.cpp90
1 files changed, 43 insertions, 47 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index 73e1e0d28c..41ad08ea9f 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -1329,13 +1329,14 @@ void Actor::walkActor() {
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 @@ void Actor::walkActorOld() {
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 @@ void Actor::walkActorOld() {
_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 @@ void Actor::walkActorOld() {
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;
- }
+ } while(1);
- 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;
- goto restart;
+ moving |= MF_LAST_LEG;
+ calcMovementFactor(walkdata.destx, walkdata.desty);
}
byte *Actor::getActorName() {