aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/object.cpp2
-rw-r--r--scumm/script_v5.cpp14
2 files changed, 11 insertions, 5 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 47836fbb50..a47026188c 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -288,7 +288,7 @@ int Scumm::getObjActToObjActDist(int a, int b) {
if (y > x)
x = y;
- return x;
+ return (_features & GF_AFTER_V2) ? x / 8 : x;
}
int Scumm::findObject(int x, int y) {
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 9ce58b2309..207c4920ce 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -1031,9 +1031,18 @@ void Scumm_v5::o5_getAnimCounter() {
void Scumm_v5::o5_getClosestObjActor() {
int obj;
int act;
- int closest_obj = 0xFF, closest_dist = 0xFFFF;
int dist;
+ // This is a bit odd: We can't detect any actors farther away than
+ // 255 units (pixels in newer games, characters in older ones.) To
+ // fix this, we also need to change getObjActToObjActDist(), since
+ // it returns 255 to indicate that it can't find the actor, and make
+ // sure we don't break o5_getDist() in the process.
+ //
+ // But we probably won't have to.
+
+ int closest_obj = 0xFF, closest_dist = 0xFF;
+
getResultPos();
act = getVarOrDirectWord(0x80);
@@ -1062,9 +1071,6 @@ void Scumm_v5::o5_getDist() {
if (_gameId == GID_MONKEY2 && vm.slot[_currentScript].number == 40 && r < 60)
r = 60;
- if (_features & GF_AFTER_V2)
- r /= 8;
-
setResult(r);
}