mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 17:04:17 +00:00
Use MxGeometry header (#1399)
* Use MxGeometry header * Fix comment --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
#include "mxdsfile.h"
|
||||
#include "mxdsmultiaction.h"
|
||||
#include "mxdsobject.h"
|
||||
#include "mxgeometry.h"
|
||||
#include "mxpresenterlist.h"
|
||||
#include "mxrect32.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
void (*g_omniUserMessage)(const char*, MxS32) = NULL;
|
||||
|
||||
// FUNCTION: LEGO1 0x100b6e10
|
||||
// FUNCTION: BETA10 0x10136970
|
||||
MxBool GetRectIntersection(
|
||||
MxS32 p_rect1Width,
|
||||
MxS32 p_rect1Height,
|
||||
@@ -35,22 +36,22 @@ MxBool GetRectIntersection(
|
||||
MxRect32 rect2(MxPoint32(0, 0), MxSize32(p_rect2Width, p_rect2Height));
|
||||
|
||||
MxRect32 rect(0, 0, *p_width, *p_height);
|
||||
rect.AddPoint(rect1Origin);
|
||||
rect += rect1Origin;
|
||||
|
||||
if (!rect.IntersectsWith(rect1)) {
|
||||
if (!rect.Intersects(rect1)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rect.Intersect(rect1);
|
||||
rect.SubtractPoint(rect1Origin);
|
||||
rect.AddPoint(rect2Origin);
|
||||
rect &= rect1;
|
||||
rect -= rect1Origin;
|
||||
rect += rect2Origin;
|
||||
|
||||
if (!rect.IntersectsWith(rect2)) {
|
||||
if (!rect.Intersects(rect2)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rect.Intersect(rect2);
|
||||
rect.SubtractPoint(rect2Origin);
|
||||
rect &= rect2;
|
||||
rect -= rect2Origin;
|
||||
|
||||
*p_rect1Left += rect.GetLeft();
|
||||
*p_rect1Top += rect.GetTop();
|
||||
|
||||
@@ -70,7 +70,7 @@ void MxFlcPresenter::LoadFrame(MxStreamChunk* p_chunk)
|
||||
|
||||
for (MxS32 i = 0; i < rectCount; i++) {
|
||||
MxRect32 rect(rects[i]);
|
||||
rect.AddPoint(m_location);
|
||||
rect += m_location;
|
||||
MVideoManager()->InvalidateRect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ void MxRegion::AddRect(MxRect32& p_rect)
|
||||
MxSpanListCursor cursor(m_spanList);
|
||||
MxSpan* span;
|
||||
|
||||
while (rect.IsValid() && cursor.Next(span)) {
|
||||
while (!rect.Empty() && cursor.Next(span)) {
|
||||
if (span->GetMin() >= rect.GetBottom()) {
|
||||
MxSpan* newSpan = new MxSpan(rect);
|
||||
cursor.Prepend(newSpan);
|
||||
@@ -75,19 +75,19 @@ void MxRegion::AddRect(MxRect32& p_rect)
|
||||
}
|
||||
}
|
||||
|
||||
if (rect.IsValid()) {
|
||||
if (!rect.Empty()) {
|
||||
MxSpan* newSpan = new MxSpan(rect);
|
||||
m_spanList->Append(newSpan);
|
||||
}
|
||||
|
||||
m_boundingRect.UpdateBounds(p_rect);
|
||||
m_boundingRect |= p_rect;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100c3e20
|
||||
// FUNCTION: BETA10 0x10149535
|
||||
MxBool MxRegion::Intersects(MxRect32& p_rect)
|
||||
{
|
||||
if (!m_boundingRect.IntersectsWith(p_rect)) {
|
||||
if (!m_boundingRect.Intersects(p_rect)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ MxRect32* MxRegionCursor::Next(MxRect32& p_rect)
|
||||
|
||||
if (span->IntersectsV(p_rect) && segment->IntersectsH(p_rect)) {
|
||||
SetRect(segment->GetMin(), span->GetMin(), segment->GetMax(), span->GetMax());
|
||||
m_rect->Intersect(p_rect);
|
||||
*m_rect &= p_rect;
|
||||
}
|
||||
else {
|
||||
NextSpan(p_rect);
|
||||
@@ -278,7 +278,7 @@ MxRect32* MxRegionCursor::Prev(MxRect32& p_rect)
|
||||
|
||||
if (span->IntersectsV(p_rect) && segment->IntersectsH(p_rect)) {
|
||||
SetRect(segment->GetMin(), span->GetMin(), segment->GetMax(), span->GetMax());
|
||||
m_rect->Intersect(p_rect);
|
||||
*m_rect &= p_rect;
|
||||
}
|
||||
else {
|
||||
PrevSpan(p_rect);
|
||||
@@ -351,7 +351,7 @@ void MxRegionCursor::NextSpan(MxRect32& p_rect)
|
||||
|
||||
if (p_rect.GetLeft() < segment->GetMax()) {
|
||||
SetRect(segment->GetMin(), span->GetMin(), segment->GetMax(), span->GetMax());
|
||||
m_rect->Intersect(p_rect);
|
||||
*m_rect &= p_rect;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -382,7 +382,7 @@ void MxRegionCursor::PrevSpan(MxRect32& p_rect)
|
||||
|
||||
if (segment->GetMin() < p_rect.GetRight()) {
|
||||
SetRect(segment->GetMin(), span->GetMin(), segment->GetMax(), span->GetMax());
|
||||
m_rect->Intersect(p_rect);
|
||||
*m_rect &= p_rect;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ MxResult MxSmk::LoadFrame(
|
||||
MxSmk* p_mxSmk,
|
||||
MxU8* p_chunkData,
|
||||
MxBool p_paletteChanged,
|
||||
MxRectList* p_list
|
||||
MxRect32List* p_list
|
||||
)
|
||||
{
|
||||
p_bitmapInfo->m_bmiHeader.biHeight = -MxBitmap::HeightAbs(p_bitmapInfo->m_bmiHeader.biHeight);
|
||||
|
||||
@@ -72,7 +72,7 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk)
|
||||
m_currentFrame++;
|
||||
VTable0x88();
|
||||
|
||||
MxRectList rects(TRUE);
|
||||
MxRect32List rects(TRUE);
|
||||
MxSmk::LoadFrame(bitmapInfo, bitmapData, &m_mxSmk, chunkData, paletteChanged, &rects);
|
||||
|
||||
if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && paletteChanged) {
|
||||
@@ -80,12 +80,12 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk)
|
||||
}
|
||||
|
||||
MxRect32 invalidateRect;
|
||||
MxRectListCursor cursor(&rects);
|
||||
MxRect32ListCursor cursor(&rects);
|
||||
MxRect32* rect;
|
||||
|
||||
while (cursor.Next(rect)) {
|
||||
invalidateRect = *rect;
|
||||
invalidateRect.AddPoint(GetLocation());
|
||||
invalidateRect += GetLocation();
|
||||
MVideoManager()->InvalidateRect(invalidateRect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,20 +148,21 @@ void MxStillPresenter::RepeatingTickle()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100ba040
|
||||
// FUNCTION: BETA10 0x10142724
|
||||
void MxStillPresenter::SetPosition(MxS32 p_x, MxS32 p_y)
|
||||
{
|
||||
MxS32 x = m_location.GetX();
|
||||
MxS32 y = m_location.GetY();
|
||||
MxPoint32 oldLocation(m_location);
|
||||
m_location.SetX(p_x);
|
||||
m_location.SetY(p_y);
|
||||
|
||||
if (IsEnabled()) {
|
||||
// Most likely needs to work with MxSize32 and MxPoint32
|
||||
MxS32 height = GetHeight() - 1;
|
||||
MxS32 width = GetWidth() - 1;
|
||||
MxRect32 area(0, 0, GetWidth() - 1, GetHeight() - 1);
|
||||
|
||||
MxRect32 rectA(x, y, width + x, height + y);
|
||||
MxRect32 rectB(m_location.GetX(), m_location.GetY(), width + m_location.GetX(), height + m_location.GetY());
|
||||
MxRect32 rectA(area);
|
||||
rectA += oldLocation;
|
||||
|
||||
MxRect32 rectB(area);
|
||||
rectB += m_location;
|
||||
|
||||
MVideoManager()->InvalidateRect(rectA);
|
||||
MVideoManager()->UpdateView(rectA.GetLeft(), rectA.GetTop(), rectA.GetWidth(), rectA.GetHeight());
|
||||
|
||||
@@ -84,11 +84,12 @@ void MxVideoManager::Destroy(MxBool p_fromDestructor)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100be3e0
|
||||
// FUNCTION: BETA10 0x1012cdaa
|
||||
void MxVideoManager::UpdateRegion()
|
||||
{
|
||||
if (m_region->IsEmpty() == FALSE) {
|
||||
MxRect32 rect(m_region->GetBoundingRect());
|
||||
rect.Intersect(m_videoParam.GetRect());
|
||||
rect &= m_videoParam.GetRect();
|
||||
|
||||
m_displaySurface
|
||||
->Display(rect.GetLeft(), rect.GetTop(), rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
|
||||
|
||||
@@ -301,7 +301,7 @@ void MxVideoPresenter::PutFrame()
|
||||
MxDisplaySurface* displaySurface = MVideoManager()->GetDisplaySurface();
|
||||
MxRegion* region = MVideoManager()->GetRegion();
|
||||
MxRect32 rect(MxPoint32(0, 0), MxSize32(GetWidth(), GetHeight()));
|
||||
rect.AddPoint(GetLocation());
|
||||
rect += GetLocation();
|
||||
LPDIRECTDRAWSURFACE ddSurface = displaySurface->GetDirectDrawSurface2();
|
||||
|
||||
if (m_action->GetFlags() & MxDSAction::c_bit5) {
|
||||
|
||||
Reference in New Issue
Block a user