Implement FUN_100b6e10 and MxRect32 adjustments (#390)

* Some WIP rect

* Adjustments to MxRect32

* Spacing

* Changes

* Spacing

* Spacing
This commit is contained in:
Christian Semmler
2023-12-29 23:55:36 -05:00
committed by GitHub
parent b4b73465d0
commit bb22b21260
7 changed files with 129 additions and 41 deletions

View File

@@ -8,16 +8,8 @@
class MxRect32 {
public:
MxRect32() {}
MxRect32(MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 p_bottom)
{
this->m_left = p_left;
this->m_top = p_top;
this->m_right = p_right;
this->m_bottom = p_bottom;
}
MxRect32(MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 p_bottom) { CopyFrom(p_left, p_top, p_right, p_bottom); }
MxRect32(const MxPoint32& p_point, const MxSize32& p_size) { CopyFrom(p_point, p_size); }
MxRect32(const MxRect32& p_a, const MxRect32& p_b)
{
m_left = Max(p_a.m_left, p_b.m_left);
@@ -56,10 +48,12 @@ public:
this->m_bottom += p_point.GetY();
}
inline void SetSize(const MxSize32& p_size)
inline void SubtractPoint(const MxPoint32& p_point)
{
this->m_right = p_size.GetWidth();
this->m_bottom = p_size.GetHeight();
this->m_left -= p_point.GetX();
this->m_top -= p_point.GetY();
this->m_right -= p_point.GetX();
this->m_bottom -= p_point.GetY();
}
inline void UpdateBounds(const MxRect32& p_rect)
@@ -92,6 +86,15 @@ public:
inline void SetRight(MxS32 p_right) { m_right = p_right; }
inline void SetBottom(MxS32 p_bottom) { m_bottom = p_bottom; }
private:
inline void CopyFrom(MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 p_bottom)
{
this->m_left = p_left;
this->m_top = p_top;
this->m_right = p_right;
this->m_bottom = p_bottom;
}
inline void CopyFrom(const MxRect32& p_rect)
{
this->m_left = p_rect.m_left;
@@ -100,15 +103,17 @@ public:
this->m_bottom = p_rect.m_bottom;
}
inline void CopyFrom(const MxPoint32& p_point, const MxSize32& p_size)
// The address might also be the constructor that calls CopyFrom
// FUNCTION: LEGO1 0x100b6fc0
inline MxRect32* CopyFrom(const MxPoint32& p_point, const MxSize32& p_size)
{
this->m_left = p_point.GetX();
this->m_top = p_point.GetY();
this->m_right = p_size.GetWidth() + p_point.GetX();
this->m_bottom = p_size.GetHeight() + p_point.GetY();
this->m_right = p_size.GetWidth() + p_point.GetX() - 1;
this->m_bottom = p_size.GetHeight() + p_point.GetY() - 1;
return this;
}
private:
inline static MxS32 Min(MxS32 p_a, MxS32 p_b) { return p_a <= p_b ? p_a : p_b; };
inline static MxS32 Max(MxS32 p_a, MxS32 p_b) { return p_a <= p_b ? p_b : p_a; };