From 28d497966b8f5c9b7a8c051f5ef4b2a3d0350ef1 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 19 Oct 2023 07:41:17 -0400 Subject: [PATCH] Fix missing instructions --- LEGO1/mxregion.cpp | 58 +++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/LEGO1/mxregion.cpp b/LEGO1/mxregion.cpp index 97b694cf..34a93d27 100644 --- a/LEGO1/mxregion.cpp +++ b/LEGO1/mxregion.cpp @@ -53,35 +53,39 @@ void MxRegion::vtable18(MxRect32 &p_rect) cursor.Prepend(newTopBottom); rectCopy.m_top = rectCopy.m_bottom; } - else if (rectCopy.m_top < topBottom->m_bottom) { - if (rectCopy.m_top < topBottom->m_top) { - MxRect32 topBottomRect( - MxPoint32(rectCopy.m_left, rectCopy.m_top), - MxSize32(rectCopy.m_right, topBottom->m_top) - ); + else { + MxS32 *bottom = &topBottom->m_bottom; - MxRegionTopBottom *newTopBottom = new MxRegionTopBottom(topBottomRect); - cursor.Prepend(newTopBottom); - rectCopy.m_top = topBottom->m_top; - } - else if (topBottom->m_top < rectCopy.m_top) { - MxRegionTopBottom *newTopBottom = topBottom->Clone(); - newTopBottom->m_bottom = rectCopy.m_top; - topBottom->m_top = rectCopy.m_top; - cursor.Prepend(newTopBottom); - } + if (rectCopy.m_top < *bottom) { + if (rectCopy.m_top < topBottom->m_top) { + MxRect32 topBottomRect( + MxPoint32(rectCopy.m_left, rectCopy.m_top), + MxSize32(rectCopy.m_right, topBottom->m_top) + ); - if (rectCopy.m_bottom < topBottom->m_top) { - MxRegionTopBottom *newTopBottom = topBottom->Clone(); - newTopBottom->m_bottom = rectCopy.m_bottom; - topBottom->m_top = rectCopy.m_bottom; - newTopBottom->FUN_100c5280(rectCopy.m_left, rectCopy.m_right); - cursor.Prepend(newTopBottom); - rectCopy.m_top = rectCopy.m_bottom; - } - else { - topBottom->FUN_100c5280(rectCopy.m_left, rectCopy.m_right); - rectCopy.m_top = topBottom->m_top; + MxRegionTopBottom *newTopBottom = new MxRegionTopBottom(topBottomRect); + cursor.Prepend(newTopBottom); + rectCopy.m_top = topBottom->m_top; + } + else if (topBottom->m_top < rectCopy.m_top) { + MxRegionTopBottom *newTopBottom = topBottom->Clone(); + newTopBottom->m_bottom = rectCopy.m_top; + topBottom->m_top = rectCopy.m_top; + cursor.Prepend(newTopBottom); + } + + if (rectCopy.m_bottom < *bottom) { + MxRegionTopBottom *newTopBottom = topBottom->Clone(); + newTopBottom->m_bottom = rectCopy.m_bottom; + topBottom->m_top = rectCopy.m_bottom; + newTopBottom->FUN_100c5280(rectCopy.m_left, rectCopy.m_right); + cursor.Prepend(newTopBottom); + rectCopy.m_top = rectCopy.m_bottom; + } + else { + topBottom->FUN_100c5280(rectCopy.m_left, rectCopy.m_right); + rectCopy.m_top = topBottom->m_top; + } } }