internal BoxCoords GetBoxCoordinates(int boxnum)
{
var bp = GetBoxBase(boxnum);
var box = new BoxCoords();
box.UpperLeft.X = bp.Ulx;
box.UpperLeft.Y = bp.Uly;
box.UpperRight.X = bp.Urx;
box.UpperRight.Y = bp.Ury;
box.LowerLeft.X = bp.Llx;
box.LowerLeft.Y = bp.Lly;
box.LowerRight.X = bp.Lrx;
box.LowerRight.Y = bp.Lry;
if (Game.Version == 8)
{
// WORKAROUND (see patch #684732): Some walkboxes in CMI appear
// to have been flipped, in the sense that for instance the
// lower boundary is above the upper one. We work around this
// by simply flipping them back.
if (box.UpperLeft.Y > box.LowerLeft.Y && box.UpperRight.Y > box.LowerRight.Y)
{
ScummHelper.Swap(ref box.UpperLeft, ref box.LowerLeft);
ScummHelper.Swap(ref box.UpperRight, ref box.LowerRight);
}
if (box.UpperLeft.X > box.UpperRight.X && box.LowerLeft.X > box.LowerRight.X)
{
ScummHelper.Swap(ref box.UpperLeft, ref box.UpperRight);
ScummHelper.Swap(ref box.LowerLeft, ref box.LowerRight);
}
}
return box;
}