[Scummvm-git-logs] scummvm master -> 31820bfdc225ade609f33e27770085a947fcd2e7
mduggan
noreply at scummvm.org
Sat Nov 18 07:01:43 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
31820bfdc2 ULTIMA8: Do not include item box in search radius
Commit: 31820bfdc225ade609f33e27770085a947fcd2e7
https://github.com/scummvm/scummvm/commit/31820bfdc225ade609f33e27770085a947fcd2e7
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-11-18T17:32:47+11:00
Commit Message:
ULTIMA8: Do not include item box in search radius
The original game only searches for objects whose bottom-right is in the search
range. If we include the whole item footprint, it causes a door to get triggered
twice in Mission 12 of No Remorse (bug #14680).
Changed paths:
engines/ultima/ultima8/misc/box.h
engines/ultima/ultima8/world/current_map.cpp
diff --git a/engines/ultima/ultima8/misc/box.h b/engines/ultima/ultima8/misc/box.h
index d73ad0d44f1..6a33ec5f75c 100644
--- a/engines/ultima/ultima8/misc/box.h
+++ b/engines/ultima/ultima8/misc/box.h
@@ -58,6 +58,12 @@ struct Box {
pz >= _z && pz < _z + _zd;
}
+ // Check to see if a 2d point is within the XY of the Box
+ bool containsXY(int32 px, int32 py) const {
+ return px > _x - _xd && px <= _x &&
+ py > _y - _yd && py <= _y;
+ }
+
// Check to see if the box is below a point
bool isBelow(int32 px, int32 py, int32 pz) const {
return px > _x - _xd && px <= _x &&
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index 2412c9e23e1..3d1e443890e 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -576,6 +576,8 @@ void CurrentMap::areaSearch(UCList *itemlist, const uint8 *loopscript,
// Mission 12 (map 19) at (17118,34878) uses range 6400 and a VALBOX
// exactly 6400 from the KEYPAD.
//
+ // box size is negative in x and y, so range is from x+range to x-range.
+ //
const Box searchrange(x + range, y + range, 0, xd + range * 2 + 1, yd + range * 2 + 1, INT_MAX_VALUE);
int minx = ((x - xd - range) / _mapChunkSize) - 1;
@@ -605,8 +607,9 @@ void CurrentMap::areaSearch(UCList *itemlist, const uint8 *loopscript,
continue;
// check if item is in range
- const Box ib = item->getWorldBox();
- if (searchrange.overlapsXY(ib)) {
+ int32 ix, iy, iz;
+ item->getLocation(ix, iy, iz);
+ if (searchrange.containsXY(ix, iy)) {
// check item against loopscript
if (item->checkLoopScript(loopscript, scriptsize)) {
assert(itemlist->getElementSize() == 2);
More information about the Scummvm-git-logs
mailing list