ULTIMA8: Fix gump / screen space tranforms

This commit is contained in:
Matthew Jimenez 2020-08-24 18:22:45 -05:00
parent 9f344b99e6
commit a76218651f

View File

@ -472,15 +472,13 @@ void Gump::GumpRectToScreenSpace(Rect &gr, RectRoundDir r) {
PointRoundDir br = (r == ROUND_OUTSIDE ? ROUND_BOTTOMRIGHT : ROUND_TOPLEFT);
int32 x1 = gr.left, y1 = gr.top;
int32 x2 = gr.left + gr.width(), y2 = gr.top + gr.height();
int32 x2 = gr.right, y2 = gr.bottom;
GumpToScreenSpace(x1, y1, tl);
GumpToScreenSpace(x2, y2, br);
gr.left = x1;
gr.top = y1;
if (gr.width() != 0)
gr.setWidth(x2 - x1);
if (gr.height() != 0)
gr.setHeight(y2 - y1);
gr.right = x2;
gr.bottom = y2;
}
// Transform a rectangle to gumpspace from screenspace
@ -489,15 +487,13 @@ void Gump::ScreenSpaceToGumpRect(Rect &sr, RectRoundDir r) {
PointRoundDir br = (r == ROUND_OUTSIDE ? ROUND_BOTTOMRIGHT : ROUND_TOPLEFT);
int32 x1 = sr.left, y1 = sr.top;
int32 x2 = sr.left + sr.width(), y2 = sr.top + sr.height();
int32 x2 = sr.right, y2 = sr.bottom;
ScreenSpaceToGump(x1, y1, tl);
ScreenSpaceToGump(x2, y2, br);
sr.left = x1;
sr.top = y1;
if (sr.width() != 0)
sr.setWidth(x2 - x1);
if (sr.height() != 0)
sr.setHeight(y2 - y1);
sr.right = x2;
sr.bottom = y2;
}
uint16 Gump::TraceObjId(int32 mx, int32 my) {