aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-03-08 00:56:43 +0000
committerMax Horn2003-03-08 00:56:43 +0000
commitc7399601760e8658ed0ae52acdda980c29550db3 (patch)
tree4afe097877f4a87e94204cb95c2e4a68e1c7b2ab /scumm
parent20c6cfdd2dbd06c4a7f2249405c02604c99e3fc1 (diff)
downloadscummvm-rg350-c7399601760e8658ed0ae52acdda980c29550db3.tar.gz
scummvm-rg350-c7399601760e8658ed0ae52acdda980c29550db3.tar.bz2
scummvm-rg350-c7399601760e8658ed0ae52acdda980c29550db3.zip
added yet another sanity check (assert); fixed long standing evil bug in getObjNewDir / getObjOldDir
svn-id: r6763
Diffstat (limited to 'scumm')
-rw-r--r--scumm/object.cpp17
-rw-r--r--scumm/scummvm.cpp1
2 files changed, 2 insertions, 16 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 81ab29d1de..e61a309785 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -1068,31 +1068,16 @@ int Scumm::getObjY(int obj) {
}
int Scumm::getObjOldDir(int obj) {
- if (obj < NUM_ACTORS) {
- return newDirToOldDir(derefActorSafe(obj, "getObjOldDir")->facing);
- } else {
- int x, y, dir;
- getObjectXYPos(obj, x, y, dir);
- return dir;
- }
+ return newDirToOldDir(getObjNewDir(obj));
}
-int another_dummy_valgrind_var = 0;
-
int Scumm::getObjNewDir(int obj) {
int dir;
if (obj < NUM_ACTORS) {
dir = derefActorSafe(obj, "getObjNewDir")->facing;
- if (dir > 0)
- another_dummy_valgrind_var++;
} else {
int x, y;
getObjectXYPos(obj, x, y, dir);
- if (dir > 0)
- another_dummy_valgrind_var *= 2;
- dir = oldDirToNewDir(dir);
- if (dir > 0)
- another_dummy_valgrind_var--;
}
return dir;
}
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index c3bfa3c57b..045c3fdedd 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -1439,6 +1439,7 @@ int newDirToOldDir(int dir) {
// Convert an new style (angle) direction to an old style one.
//
int oldDirToNewDir(int dir) {
+ assert(0 <= dir && dir <= 3);
const int new_dir_table[4] = { 270, 90, 180, 0 };
return new_dir_table[dir];
}