From 50ace43e3206fbdf60bd44bf42304873cd6c57bb Mon Sep 17 00:00:00 2001 From: Misha Date: Sat, 7 Oct 2023 13:35:32 -0400 Subject: [PATCH] Use enum for mxparam type --- LEGO1/mxomni.cpp | 2 +- LEGO1/mxparam.h | 14 +++++++++++--- LEGO1/mxpresenter.cpp | 7 +++---- LEGO1/mxstreamer.cpp | 2 -- LEGO1/mxstreamer.h | 2 +- LEGO1/mxtransitionmanager.cpp | 2 +- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index fa76d8a5..5ad33922 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -346,7 +346,7 @@ MxLong MxOmni::Notify(MxParam &p) { MxAutoLocker lock(&this->m_criticalsection); MxLong result; - if (p.GetType() == 2) + if (p.GetType() == MXSTREAMER_UNKNOWN) { result = HandleNotificationType2(p); } diff --git a/LEGO1/mxparam.h b/LEGO1/mxparam.h index ffbf1530..d76ecdb0 100644 --- a/LEGO1/mxparam.h +++ b/LEGO1/mxparam.h @@ -7,16 +7,24 @@ class MxCore; +enum MxParamType +{ + MXSTREAMER_UNKNOWN = 2, + MXPRESENTER_NOTIFICATION = 5, + MXSTREAMER_DELETE_NOTIFY = 6, + MXTRANSITIONMANAGER_TRANSITIONENDED = 24 +}; + // VTABLE 0x100d56e0 class MxParam : public MxOmniCreateParamBase { public: - inline MxParam(MxS32 p_type, MxCore *p_sender) : MxOmniCreateParamBase(), m_type(p_type), m_sender(p_sender){} + inline MxParam(MxParamType p_type, MxCore *p_sender) : MxOmniCreateParamBase(), m_type(p_type), m_sender(p_sender){} virtual ~MxParam() override {} // vtable+0x0 (scalar deleting destructor) virtual MxParam *Clone(); // vtable+0x4 - inline MxS32 GetType() const + inline MxParamType GetType() const { return m_type; } @@ -27,7 +35,7 @@ class MxParam : public MxOmniCreateParamBase } protected: - MxS32 m_type; // 0x4 + MxParamType m_type; // 0x4 MxCore *m_sender; // 0x8 }; diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index 5afafc79..f8f60386 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -49,9 +49,9 @@ void MxPresenter::ParseExtra() int val = token ? atoi(token) : 0; int result = MxOmni::GetInstance()->vtable0x30(t_token, val, this); - + m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_Parsed); - + if (result) SendTo_unkPresenter(MxOmni::GetInstance()); @@ -65,8 +65,7 @@ void MxPresenter::SendTo_unkPresenter(MxOmni *p_omni) if (m_unkPresenter) { MxAutoLocker lock(&m_criticalSection); - // TOOD: magic number used for notification type. replace with enum - NotificationManager()->Send(m_unkPresenter, &MxParam(5, this)); + NotificationManager()->Send(m_unkPresenter, &MxParam(MXPRESENTER_NOTIFICATION, this)); m_action->SetOmni(p_omni ? p_omni : MxOmni::GetInstance()); m_unkPresenter = NULL; diff --git a/LEGO1/mxstreamer.cpp b/LEGO1/mxstreamer.cpp index eef989bc..c6ef85bd 100644 --- a/LEGO1/mxstreamer.cpp +++ b/LEGO1/mxstreamer.cpp @@ -9,8 +9,6 @@ DECOMP_SIZE_ASSERT(MxStreamer, 0x2c); -#define MXSTREAMER_DELETE_NOTIFY 6 - // OFFSET: LEGO1 0x100b8f00 MxStreamer::MxStreamer() { diff --git a/LEGO1/mxstreamer.h b/LEGO1/mxstreamer.h index c900feb9..515be51b 100644 --- a/LEGO1/mxstreamer.h +++ b/LEGO1/mxstreamer.h @@ -43,7 +43,7 @@ class MxStreamerSubClass3 : public MxStreamerSubClass1 class MxStreamerNotification : public MxParam { public: - inline MxStreamerNotification(MxS32 p_type, MxCore *p_sender, MxStreamController *p_ctrlr) : MxParam(p_type, p_sender) + inline MxStreamerNotification(MxParamType p_type, MxCore *p_sender, MxStreamController *p_ctrlr) : MxParam(p_type, p_sender) { m_controller = p_ctrlr; } diff --git a/LEGO1/mxtransitionmanager.cpp b/LEGO1/mxtransitionmanager.cpp index d7d16544..66c99532 100644 --- a/LEGO1/mxtransitionmanager.cpp +++ b/LEGO1/mxtransitionmanager.cpp @@ -85,7 +85,7 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld) LegoWorld *world = GetCurrentWorld(); if (world) { - world->Notify(MxParam(0x18, this)); + world->Notify(MxParam(MXTRANSITIONMANAGER_TRANSITIONENDED, this)); } } }