[Scummvm-devel] That pesky CMI walkbox problem... (fwd)
torbjorn.e.andersson at tietoenator.com
torbjorn.e.andersson at tietoenator.com
Wed Feb 5 08:03:04 CET 2003
Max Horn [mailto:max at quendi.de] wrote:
> COMI walkboxes, like the walkboxes in other Scumm games, are
> tetragons (i.e. polygons with four vertices and four edges).
...
> Our code to check whether a point is inside the walkbox assumes the
> walkbox is konvex, a very reasonable assumption, and I would be
> surprised if they were using non-convex walkboxes, it makes no sense
> to do so.
That's what I thought/hoped.
But obviously something is wrong with it, or the walkbox 7 case
described earlier wouldn't fail. This is what it looks like, as far as
I can tell:
750,473 882,473
LL +----------------------+ LR
| 861,503 |
| X |
| |
UL +----------------------+ UR
750,533 882,533
The first part of the checkXYInBoxBounds() function looks ok to me,
since it just seems to checks if the point is outside the walkbox's
bounding rectangle.
I haven't looked closer at the "is the walkbox a line" case, but I'll
assume that's correct for now.
Which leaves the four calls to compareSlope():
if (!compareSlope(box.ul.x, box.ul.y, box.ur.x, box.ur.y, x, y))
return false;
if (!compareSlope(box.ur.x, box.ur.y, box.lr.x, box.lr.y, x, y))
return false;
if (!compareSlope(box.ll.x, box.ll.y, x, y, box.lr.x, box.lr.y))
return false;
if (!compareSlope(box.ul.x, box.ul.y, x, y, box.ll.x, box.ll.y))
return false;
Where we fail on the very first one. This is the part of the function
that I haven't made sense of yet.
Torbjörn
--
TietoEnator Resource Management AB
Persona
Torbjörn Andersson
http://www.rm.tietoenator.com/
More information about the Scummvm-devel
mailing list