[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.99,1.100 actor.cpp,1.99,1.100 actor.h,1.21,1.22
Max Horn
fingolfin at users.sourceforge.net
Tue May 20 12:36:10 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv1865
Modified Files:
object.cpp actor.cpp actor.h
Log Message:
got rid of the evil locked-box hack in adjustXYToBeInBox; instead check for locked boxes in walkActorOld, which seems to work just as well (and hopefully better)
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- object.cpp 20 May 2003 16:13:34 -0000 1.99
+++ object.cpp 20 May 2003 19:35:39 -0000 1.100
@@ -237,7 +237,7 @@
return 0xFF;
if (acta) {
- AdjustBoxResult r = acta->adjustXYToBeInBox(x2, y2, -1);
+ AdjustBoxResult r = acta->adjustXYToBeInBox(x2, y2);
x2 = r.x;
y2 = r.y;
}
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- actor.cpp 20 May 2003 17:50:43 -0000 1.99
+++ actor.cpp 20 May 2003 19:35:40 -0000 1.100
@@ -593,7 +593,7 @@
return 0;
}
-AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY, int pathfrom) {
+AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY) {
const uint thresholdTable[] = { 30, 80, 0 };
AdjustBoxResult abr, tmp;
uint threshold;
@@ -628,32 +628,6 @@
if (flags & kBoxInvisible && (!(flags & kBoxPlayerOnly) || isInClass(31)))
continue;
- // FIXME: the following is essentially a hack to fix issues in Zak256
- // and possibly elsewhere; but it seems the original did nothing like this
- // so hopefully one day we'll find a 'proper' solution and can remove
- // this hack.
- if (pathfrom >= firstValidBox) {
-
- if (flags & kBoxLocked && (!(flags & kBoxPlayerOnly)))
- continue;
-
- int i = _vm->getPathToDestBox(pathfrom, box);
- if (i == -1)
- continue;
-
- if (_vm->_features & GF_OLD256) {
- // FIXME - we check here if the box suggested by getPathToDestBox
- // is locked or not. This prevents us from walking thru
- // closed doors in some cases in Zak256. However a better fix
- // would be to recompute the box matrix whenever flags change.
- flags = _vm->getBoxFlags(i);
- if (flags & kBoxLocked && (!(flags & kBoxPlayerOnly)))
- continue;
- if (flags & kBoxInvisible && (!(flags & kBoxPlayerOnly) || isInClass(31)))
- continue;
- }
- }
-
// For increased performance, we perform a quick test if
// the coordinates can even be within a distance of 'threshold'
// pixels of the box.
@@ -700,7 +674,7 @@
void Actor::adjustActorPos() {
AdjustBoxResult abr;
- abr = adjustXYToBeInBox(x, y, -1);
+ abr = adjustXYToBeInBox(x, y);
x = abr.x;
y = abr.y;
@@ -1196,7 +1170,7 @@
abr.x = destX;
abr.y = destY;
} else {
- abr = adjustXYToBeInBox(destX, destY, walkbox);
+ abr = adjustXYToBeInBox(destX, destY);
}
if (!isInCurrentRoom()) {
@@ -1214,7 +1188,7 @@
if (_vm->checkXYInBoxBounds(walkdata.destbox, abr.x, abr.y)) {
abr.dist = walkdata.destbox;
} else {
- abr = adjustXYToBeInBox(abr.x, abr.y, walkbox);
+ abr = adjustXYToBeInBox(abr.x, abr.y);
}
if (moving && walkdata.destdir == dir && walkdata.destx == abr.x && walkdata.desty == abr.y)
return;
@@ -1290,7 +1264,7 @@
}
}
- if (moving == 0)
+ if (!moving)
return;
if (!(moving & MF_NEW_LEG)) {
@@ -1319,6 +1293,7 @@
do {
moving &= ~MF_NEW_LEG;
+
if (walkbox == INVALID_BOX) {
setBox(walkdata.destbox);
walkdata.curbox = walkdata.destbox;
@@ -1358,7 +1333,6 @@
return;
if (!(moving & MF_NEW_LEG)) {
-
if (moving & MF_IN_LEG && actorWalkStep())
return;
@@ -1387,7 +1361,6 @@
walkbox = walkdata.curbox;
moving &= MF_IN_LEG;
- moving |= MF_NEW_LEG;
}
do {
@@ -1408,6 +1381,15 @@
moving |= MF_LAST_LEG;
return;
}
+
+ // FIXME: not sure if this is needed in non-Zak games, but I think it shouldn't
+ // hurt there either.
+ int flags = _vm->getBoxFlags(next_box);
+ if (flags & kBoxLocked && (!(flags & kBoxPlayerOnly) || isInClass(31))) {
+ moving |= MF_LAST_LEG;
+ return;
+ }
+
walkdata.curbox = next_box;
Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- actor.h 18 May 2003 19:44:22 -0000 1.21
+++ actor.h 20 May 2003 19:35:40 -0000 1.22
@@ -151,7 +151,7 @@
public:
void adjustActorPos();
- AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY, int pathfrom);
+ AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY);
void setDirection(int direction);
void faceToObject(int obj);
More information about the Scummvm-git-logs
mailing list