mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
Match MxRegion::VTable0x18
This commit is contained in:
parent
79da5b2ac6
commit
adc6b75135
@ -32,15 +32,22 @@ class MxRect32 {
|
|||||||
m_bottom = Min(p_a.m_bottom, p_b.m_bottom);
|
m_bottom = Min(p_a.m_bottom, p_b.m_bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MxRect32(const MxRect32& p_rect) { CopyFrom(p_rect); }
|
||||||
|
|
||||||
MxRect32& MxRect32::operator=(const MxRect32& p_rect)
|
MxRect32& MxRect32::operator=(const MxRect32& p_rect)
|
||||||
{
|
{
|
||||||
this->m_left = p_rect.m_left;
|
CopyFrom(p_rect);
|
||||||
this->m_top = p_rect.m_top;
|
|
||||||
this->m_right = p_rect.m_right;
|
|
||||||
this->m_bottom = p_rect.m_bottom;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void Intersect(const MxRect32& p_rect)
|
||||||
|
{
|
||||||
|
m_left = Max(p_rect.m_left, m_left);
|
||||||
|
m_top = Max(p_rect.m_top, m_top);
|
||||||
|
m_right = Min(p_rect.m_right, m_right);
|
||||||
|
m_bottom = Min(p_rect.m_bottom, m_bottom);
|
||||||
|
}
|
||||||
|
|
||||||
inline void SetPoint(const MxPoint32& p_point)
|
inline void SetPoint(const MxPoint32& p_point)
|
||||||
{
|
{
|
||||||
this->m_left = p_point.GetX();
|
this->m_left = p_point.GetX();
|
||||||
@ -61,12 +68,6 @@ class MxRect32 {
|
|||||||
this->m_bottom = p_size.GetHeight();
|
this->m_bottom = p_size.GetHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline MxBool IsValid() { return m_left < m_right && m_top < m_bottom; }
|
|
||||||
inline MxBool IntersectsWith(const MxRect32& p_rect)
|
|
||||||
{
|
|
||||||
return m_left < p_rect.m_right && p_rect.m_left < m_right && m_top < p_rect.m_bottom && p_rect.m_top < m_bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void UpdateBounds(const MxRect32& p_rect)
|
inline void UpdateBounds(const MxRect32& p_rect)
|
||||||
{
|
{
|
||||||
m_left = Min(m_left, p_rect.m_left);
|
m_left = Min(m_left, p_rect.m_left);
|
||||||
@ -75,16 +76,22 @@ class MxRect32 {
|
|||||||
m_bottom = Max(m_bottom, p_rect.m_bottom);
|
m_bottom = Max(m_bottom, p_rect.m_bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline MxS32 GetWidth() { return (m_right - m_left) + 1; }
|
inline MxBool IsValid() const { return m_left < m_right && m_top < m_bottom; }
|
||||||
inline MxS32 GetHeight() { return (m_bottom - m_top) + 1; }
|
inline MxBool IntersectsWith(const MxRect32& p_rect) const
|
||||||
|
{
|
||||||
|
return m_left < p_rect.m_right && p_rect.m_left < m_right && m_top < p_rect.m_bottom && p_rect.m_top < m_bottom;
|
||||||
|
}
|
||||||
|
|
||||||
inline MxPoint32 GetPoint() { return MxPoint32(this->m_left, this->m_top); }
|
inline MxS32 GetWidth() const { return (m_right - m_left) + 1; }
|
||||||
inline MxSize32 GetSize() { return MxSize32(this->m_right, this->m_bottom); }
|
inline MxS32 GetHeight() const { return (m_bottom - m_top) + 1; }
|
||||||
|
|
||||||
inline MxS32 GetLeft() { return m_left; }
|
inline MxPoint32 GetPoint() const { return MxPoint32(this->m_left, this->m_top); }
|
||||||
inline MxS32 GetTop() { return m_top; }
|
inline MxSize32 GetSize() const { return MxSize32(this->m_right, this->m_bottom); }
|
||||||
inline MxS32 GetRight() { return m_right; }
|
|
||||||
inline MxS32 GetBottom() { return m_bottom; }
|
inline MxS32 GetLeft() const { return m_left; }
|
||||||
|
inline MxS32 GetTop() const { return m_top; }
|
||||||
|
inline MxS32 GetRight() const { return m_right; }
|
||||||
|
inline MxS32 GetBottom() const { return m_bottom; }
|
||||||
|
|
||||||
inline void SetLeft(MxS32 p_left) { m_left = p_left; }
|
inline void SetLeft(MxS32 p_left) { m_left = p_left; }
|
||||||
inline void SetTop(MxS32 p_top) { m_top = p_top; }
|
inline void SetTop(MxS32 p_top) { m_top = p_top; }
|
||||||
@ -92,6 +99,14 @@ class MxRect32 {
|
|||||||
inline void SetBottom(MxS32 p_bottom) { m_bottom = p_bottom; }
|
inline void SetBottom(MxS32 p_bottom) { m_bottom = p_bottom; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
inline void CopyFrom(const MxRect32& p_rect)
|
||||||
|
{
|
||||||
|
this->m_left = p_rect.m_left;
|
||||||
|
this->m_top = p_rect.m_top;
|
||||||
|
this->m_right = p_rect.m_right;
|
||||||
|
this->m_bottom = p_rect.m_bottom;
|
||||||
|
}
|
||||||
|
|
||||||
inline static MxS32 Min(MxS32 p_a, MxS32 p_b) { return p_a <= p_b ? p_a : p_b; };
|
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; };
|
inline static MxS32 Max(MxS32 p_a, MxS32 p_b) { return p_a <= p_b ? p_b : p_a; };
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,8 @@ void MxRegion::Reset()
|
|||||||
// FUNCTION: LEGO1 0x100c3750
|
// FUNCTION: LEGO1 0x100c3750
|
||||||
void MxRegion::VTable0x18(MxRect32& p_rect)
|
void MxRegion::VTable0x18(MxRect32& p_rect)
|
||||||
{
|
{
|
||||||
MxRect32 rect(p_rect.GetPoint(), MxSize32(p_rect.GetRight(), p_rect.GetBottom()));
|
MxRect32 rect(p_rect);
|
||||||
|
MxRect32 newRect;
|
||||||
MxRegionListCursor cursor(m_list);
|
MxRegionListCursor cursor(m_list);
|
||||||
MxRegionTopBottom* topBottom;
|
MxRegionTopBottom* topBottom;
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ void MxRegion::VTable0x18(MxRect32& p_rect)
|
|||||||
}
|
}
|
||||||
else if (rect.GetTop() < topBottom->GetBottom()) {
|
else if (rect.GetTop() < topBottom->GetBottom()) {
|
||||||
if (rect.GetTop() < topBottom->GetTop()) {
|
if (rect.GetTop() < topBottom->GetTop()) {
|
||||||
MxRect32 newRect(rect);
|
newRect = rect;
|
||||||
newRect.SetBottom(topBottom->GetTop());
|
newRect.SetBottom(topBottom->GetTop());
|
||||||
MxRegionTopBottom* newTopBottom = new MxRegionTopBottom(newRect);
|
MxRegionTopBottom* newTopBottom = new MxRegionTopBottom(newRect);
|
||||||
cursor.Prepend(newTopBottom);
|
cursor.Prepend(newTopBottom);
|
||||||
|
|||||||
@ -75,7 +75,9 @@ void MxVideoManager::Destroy(MxBool p_fromDestructor)
|
|||||||
void MxVideoManager::UpdateRegion()
|
void MxVideoManager::UpdateRegion()
|
||||||
{
|
{
|
||||||
if (m_region->VTable0x20() == FALSE) {
|
if (m_region->VTable0x20() == FALSE) {
|
||||||
MxRect32 rect(m_region->GetRect(), m_videoParam.GetRect());
|
MxRect32 rect(m_region->GetRect());
|
||||||
|
rect.Intersect(m_videoParam.GetRect());
|
||||||
|
|
||||||
m_displaySurface
|
m_displaySurface
|
||||||
->Display(rect.GetLeft(), rect.GetTop(), rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
|
->Display(rect.GetLeft(), rect.GetTop(), rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user