diff options
author | Torbjörn Andersson | 2003-06-01 16:40:15 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2003-06-01 16:40:15 +0000 |
commit | 7cfe07fdd301aa10a1e2f8009c2fb34067d88d04 (patch) | |
tree | 02514dcf59a88c2aa4fbf3c2cfa3b0ff0859d2da | |
parent | ed0080e55b14b7f890449e5744633da46d41428a (diff) | |
download | scummvm-rg350-7cfe07fdd301aa10a1e2f8009c2fb34067d88d04.tar.gz scummvm-rg350-7cfe07fdd301aa10a1e2f8009c2fb34067d88d04.tar.bz2 scummvm-rg350-7cfe07fdd301aa10a1e2f8009c2fb34067d88d04.zip |
Reverted the recent o5_getClosestObjActor() change and fixed it by
measuring the distance in characters for V2 games instead. Now Edna won't
bring the same strange kid into the cell over and over again.
If necessary, we can still fix o5_getClosestActor() to handle larger
distances. It just takes a few more changes than I first thought.
svn-id: r8243
-rw-r--r-- | scumm/object.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 14 |
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); } |