From 62023d203b6b2bc0203595705887d3198b367dca Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 29 Jan 2024 17:40:36 -0500 Subject: [PATCH] Fixes/changes --- .../legoomni/include/mxcontrolpresenter.h | 3 +- .../src/control/mxcontrolpresenter.cpp | 77 ++++++++++--------- LEGO1/omni/include/mxcompositepresenter.h | 2 +- LEGO1/omni/include/mxutil.h | 2 +- LEGO1/omni/include/mxvideopresenter.h | 2 +- LEGO1/omni/src/common/mxutil.cpp | 6 +- 6 files changed, 50 insertions(+), 42 deletions(-) diff --git a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h index ac43faac..0903f557 100644 --- a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h @@ -5,6 +5,7 @@ #include "mxcompositepresenter.h" class LegoControlManagerEvent; +class MxVideoPresenter; // VTABLE: LEGO1 0x100d7b88 // SIZE 0x5c @@ -41,7 +42,7 @@ class MxControlPresenter : public MxCompositePresenter { MxBool FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter); private: - MxBool FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter); + MxBool FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* p_presenter); void FUN_10044540(undefined2); undefined2 m_unk0x4c; // 0x4c diff --git a/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp index 4146742d..ae0288f7 100644 --- a/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp @@ -2,7 +2,7 @@ #include "define.h" #include "legocontrolmanager.h" -#include "mxdsparallelaction.h" +#include "mxdsmultiaction.h" #include "mxticklemanager.h" #include "mxtimer.h" #include "mxutil.h" @@ -103,53 +103,59 @@ void MxControlPresenter::EndAction() } // FUNCTION: LEGO1 0x10044270 -MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter) +MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* p_presenter) { if (m_unk0x4c == 3) { - MxPresenter* first = *m_list.begin(); - if (p_presenter == first || first->GetDisplayZ() < first->GetDisplayZ()) { - MxS32 height = ((MxVideoPresenter*) first)->GetHeight(); - MxS32 width = ((MxVideoPresenter*) first)->GetWidth(); + MxVideoPresenter* frontPresenter = (MxVideoPresenter*) m_list.front(); - if (first->GetLocation().GetX() <= p_x && p_x < width - 1 + first->GetLocation().GetY() && - first->GetLocation().GetY() <= p_y && p_y < height - 1 + first->GetLocation().GetY()) { + if (p_presenter == frontPresenter || frontPresenter->GetDisplayZ() < frontPresenter->GetDisplayZ()) { + if (p_presenter->VTable0x7c()) { + MxS32 height = frontPresenter->GetHeight(); + MxS32 width = frontPresenter->GetWidth(); - MxU8* start; - MxBitmap* bitmap = ((MxVideoPresenter*) first)->GetBitmap(); + if (frontPresenter->GetLocation().GetX() <= p_x && + p_x < width - 1 + frontPresenter->GetLocation().GetY() && + frontPresenter->GetLocation().GetY() <= p_y && + p_y < height - 1 + frontPresenter->GetLocation().GetY()) { + MxU8* start; - if (((MxVideoPresenter*) first)->GetAlphaMask() == NULL) { - start = bitmap->GetStart(p_x - first->GetLocation().GetX(), p_y - first->GetLocation().GetY()); - } - else { - start = NULL; - } - m_unk0x56 = 0; - - if (m_unk0x58 == NULL) { - if (*start != 0) { - m_unk0x56 = 1; + if (frontPresenter->GetAlphaMask() == NULL) { + start = frontPresenter->GetBitmap()->GetStart( + p_x - frontPresenter->GetLocation().GetX(), + p_y - frontPresenter->GetLocation().GetY() + ); } - } - else { - for (MxS16 i = 1; i <= *m_unk0x58; i++) { - if (m_unk0x58[i] == *start) { - m_unk0x56 = i; - break; + else { + start = NULL; + } + + m_unk0x56 = 0; + if (m_unk0x58 == NULL) { + if (*start != 0) { + m_unk0x56 = 1; + } + } + else { + for (MxS16 i = 1; i <= *m_unk0x58; i++) { + if (m_unk0x58[i] == *start) { + m_unk0x56 = i; + break; + } } } - } - if (m_unk0x56) { - return TRUE; + if (m_unk0x56) { + return TRUE; + } } } } } else { - if (HasCompositePresenter(&m_list, p_presenter)) { + if (ContainsPresenter(m_list, p_presenter)) { if (m_unk0x4c == 2) { - MxS32 width = ((MxVideoPresenter*) p_presenter)->GetWidth(); - MxS32 height = ((MxVideoPresenter*) p_presenter)->GetHeight(); + MxS32 width = p_presenter->GetWidth(); + MxS32 height = p_presenter->GetHeight(); if (m_unk0x52 == 2 && m_unk0x54 == 2) { MxS16 val; @@ -178,6 +184,7 @@ MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_pre return TRUE; } } + return FALSE; } @@ -197,7 +204,7 @@ MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPres } break; case c_notificationButtonDown: - if (FUN_10044270(p_event->GetX(), p_event->GetY(), p_presenter)) { + if (FUN_10044270(p_event->GetX(), p_event->GetY(), (MxVideoPresenter*) p_presenter)) { p_event->SetClickedObjectId(m_action->GetObjectId()); p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); VTable0x6c(m_unk0x56); @@ -216,7 +223,7 @@ MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPres void MxControlPresenter::VTable0x6c(MxS16 p_val) { if (p_val == -1) { - if ((MxS16) ((MxDSParallelAction*) m_action)->GetActionList()->GetCount() - m_unk0x4e == 1) { + if ((MxS16) ((MxDSMultiAction*) m_action)->GetActionList()->GetCount() - m_unk0x4e == 1) { m_unk0x4e = 0; } else { diff --git a/LEGO1/omni/include/mxcompositepresenter.h b/LEGO1/omni/include/mxcompositepresenter.h index 2f00af28..044d085a 100644 --- a/LEGO1/omni/include/mxcompositepresenter.h +++ b/LEGO1/omni/include/mxcompositepresenter.h @@ -46,7 +46,7 @@ class MxCompositePresenter : public MxPresenter { return TRUE; }; // vtable+0x64 - inline MxCompositePresenterList* GetList() { return &m_list; } + inline MxCompositePresenterList& GetList() { return m_list; } protected: MxCompositePresenterList m_list; // 0x40 diff --git a/LEGO1/omni/include/mxutil.h b/LEGO1/omni/include/mxutil.h index 66f7be33..c85259bb 100644 --- a/LEGO1/omni/include/mxutil.h +++ b/LEGO1/omni/include/mxutil.h @@ -73,7 +73,7 @@ MxBool GetRectIntersection( void MakeSourceName(char*, const char*); void SetOmniUserMessage(void (*)(const char*, int)); -MxBool HasCompositePresenter(MxCompositePresenterList* p_presenterList, MxPresenter* p_presenter); +MxBool ContainsPresenter(MxCompositePresenterList& p_presenterList, MxPresenter* p_presenter); void FUN_100b7220(MxDSAction* p_action, MxU32 p_newFlags, MxBool p_setFlags); MxDSObject* CreateStreamObject(MxDSFile*, MxS16); diff --git a/LEGO1/omni/include/mxvideopresenter.h b/LEGO1/omni/include/mxvideopresenter.h index 8a461e5e..480607b0 100644 --- a/LEGO1/omni/include/mxvideopresenter.h +++ b/LEGO1/omni/include/mxvideopresenter.h @@ -72,7 +72,7 @@ class MxVideoPresenter : public MxMediaPresenter { virtual LPDIRECTDRAWSURFACE VTable0x78() { return m_unk0x58; }; // vtable+0x78 // FUNCTION: LEGO1 0x1000c7c0 - virtual MxBool VTable0x7c() { return (m_bitmap != NULL) || (m_alpha != NULL); }; // vtable+0x7c + virtual MxBool VTable0x7c() { return m_bitmap != NULL || m_alpha != NULL; }; // vtable+0x7c // FUNCTION: LEGO1 0x1000c7e0 virtual MxS32 GetWidth() { return m_alpha ? m_alpha->m_width : m_bitmap->GetBmiWidth(); }; // vtable+0x80 diff --git a/LEGO1/omni/src/common/mxutil.cpp b/LEGO1/omni/src/common/mxutil.cpp index 95f89d9d..d06b2653 100644 --- a/LEGO1/omni/src/common/mxutil.cpp +++ b/LEGO1/omni/src/common/mxutil.cpp @@ -112,11 +112,11 @@ MxBool KeyValueStringParse(char* p_outputValue, const char* p_key, const char* p } // FUNCTION: LEGO1 0x100b7170 -MxBool HasCompositePresenter(MxCompositePresenterList* p_presenterList, MxPresenter* p_presenter) +MxBool ContainsPresenter(MxCompositePresenterList& p_presenterList, MxPresenter* p_presenter) { - for (MxCompositePresenterList::iterator it = p_presenterList->begin(); it != p_presenterList->end(); it++) { + for (MxCompositePresenterList::iterator it = p_presenterList.begin(); it != p_presenterList.end(); it++) { if (p_presenter == *it || (*it)->IsA("MxCompositePresenter") && - HasCompositePresenter(((MxCompositePresenter*) *it)->GetList(), p_presenter)) { + ContainsPresenter(((MxCompositePresenter*) *it)->GetList(), p_presenter)) { return TRUE; } }