Fix for bug #853874 (ZAK: Can't Give Club in 5.5 build); this may cause regressions, and/or fix other bugs. However, I believe this is the right thing (TM) to do anyway :-)
svn-id: r11523
This commit is contained in:
parent
a189699f31
commit
c9559ef0d5
1 changed files with 13 additions and 12 deletions
|
@ -274,7 +274,7 @@ static int getDist(int x, int y, int x2, int y2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScummEngine::getObjActToObjActDist(int a, int b) {
|
int ScummEngine::getObjActToObjActDist(int a, int b) {
|
||||||
int x, y, x2, y2, dist;
|
int x, y, x2, y2;
|
||||||
Actor *acta = NULL;
|
Actor *acta = NULL;
|
||||||
Actor *actb = NULL;
|
Actor *actb = NULL;
|
||||||
|
|
||||||
|
@ -293,25 +293,26 @@ int ScummEngine::getObjActToObjActDist(int a, int b) {
|
||||||
if (getObjectOrActorXY(b, x2, y2) == -1)
|
if (getObjectOrActorXY(b, x2, y2) == -1)
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
|
|
||||||
if (acta) {
|
// Only call FOO in V5 games. Older versions don't seem to make this
|
||||||
|
// call at all, and using it caused at least one bug (#853874).
|
||||||
|
if (acta && _version == 5) {
|
||||||
AdjustBoxResult r = acta->adjustXYToBeInBox(x2, y2);
|
AdjustBoxResult r = acta->adjustXYToBeInBox(x2, y2);
|
||||||
x2 = r.x;
|
x2 = r.x;
|
||||||
y2 = r.y;
|
y2 = r.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now compute the distance between the two points
|
// Now compute the distance between the two points
|
||||||
x = ABS(x - x2);
|
if (_version <= 2) {
|
||||||
y = ABS(y - y2);
|
|
||||||
|
|
||||||
// For V1/V2 games, distances are measured in the original "character"
|
// For V1/V2 games, distances are measured in the original "character"
|
||||||
// based coordinate system, instead of pixels. Otherwise various scripts
|
// based coordinate system, instead of pixels. Otherwise various scripts
|
||||||
// will break.
|
// will break. See bugs #853874, #774529
|
||||||
if (_version <= 2) {
|
x /= 8;
|
||||||
dist = MAX(x/8, y/2);
|
y /= 2;
|
||||||
} else
|
x2 /= 8;
|
||||||
dist = MAX(x, y);
|
y2 /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
return dist;
|
return getDist(x, y, x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScummEngine::findObject(int x, int y) {
|
int ScummEngine::findObject(int x, int y) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue