Use enum for mxparam type

This commit is contained in:
Misha 2023-10-07 13:35:32 -04:00
parent 61da302195
commit 50ace43e32
6 changed files with 17 additions and 12 deletions

View File

@ -346,7 +346,7 @@ MxLong MxOmni::Notify(MxParam &p)
{ {
MxAutoLocker lock(&this->m_criticalsection); MxAutoLocker lock(&this->m_criticalsection);
MxLong result; MxLong result;
if (p.GetType() == 2) if (p.GetType() == MXSTREAMER_UNKNOWN)
{ {
result = HandleNotificationType2(p); result = HandleNotificationType2(p);
} }

View File

@ -7,16 +7,24 @@
class MxCore; class MxCore;
enum MxParamType
{
MXSTREAMER_UNKNOWN = 2,
MXPRESENTER_NOTIFICATION = 5,
MXSTREAMER_DELETE_NOTIFY = 6,
MXTRANSITIONMANAGER_TRANSITIONENDED = 24
};
// VTABLE 0x100d56e0 // VTABLE 0x100d56e0
class MxParam : public MxOmniCreateParamBase class MxParam : public MxOmniCreateParamBase
{ {
public: 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() override {} // vtable+0x0 (scalar deleting destructor)
virtual MxParam *Clone(); // vtable+0x4 virtual MxParam *Clone(); // vtable+0x4
inline MxS32 GetType() const inline MxParamType GetType() const
{ {
return m_type; return m_type;
} }
@ -27,7 +35,7 @@ class MxParam : public MxOmniCreateParamBase
} }
protected: protected:
MxS32 m_type; // 0x4 MxParamType m_type; // 0x4
MxCore *m_sender; // 0x8 MxCore *m_sender; // 0x8
}; };

View File

@ -49,9 +49,9 @@ void MxPresenter::ParseExtra()
int val = token ? atoi(token) : 0; int val = token ? atoi(token) : 0;
int result = MxOmni::GetInstance()->vtable0x30(t_token, val, this); int result = MxOmni::GetInstance()->vtable0x30(t_token, val, this);
m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_Parsed); m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_Parsed);
if (result) if (result)
SendTo_unkPresenter(MxOmni::GetInstance()); SendTo_unkPresenter(MxOmni::GetInstance());
@ -65,8 +65,7 @@ void MxPresenter::SendTo_unkPresenter(MxOmni *p_omni)
if (m_unkPresenter) { if (m_unkPresenter) {
MxAutoLocker lock(&m_criticalSection); MxAutoLocker lock(&m_criticalSection);
// TOOD: magic number used for notification type. replace with enum NotificationManager()->Send(m_unkPresenter, &MxParam(MXPRESENTER_NOTIFICATION, this));
NotificationManager()->Send(m_unkPresenter, &MxParam(5, this));
m_action->SetOmni(p_omni ? p_omni : MxOmni::GetInstance()); m_action->SetOmni(p_omni ? p_omni : MxOmni::GetInstance());
m_unkPresenter = NULL; m_unkPresenter = NULL;

View File

@ -9,8 +9,6 @@
DECOMP_SIZE_ASSERT(MxStreamer, 0x2c); DECOMP_SIZE_ASSERT(MxStreamer, 0x2c);
#define MXSTREAMER_DELETE_NOTIFY 6
// OFFSET: LEGO1 0x100b8f00 // OFFSET: LEGO1 0x100b8f00
MxStreamer::MxStreamer() MxStreamer::MxStreamer()
{ {

View File

@ -43,7 +43,7 @@ class MxStreamerSubClass3 : public MxStreamerSubClass1
class MxStreamerNotification : public MxParam class MxStreamerNotification : public MxParam
{ {
public: 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; m_controller = p_ctrlr;
} }

View File

@ -85,7 +85,7 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
LegoWorld *world = GetCurrentWorld(); LegoWorld *world = GetCurrentWorld();
if (world) { if (world) {
world->Notify(MxParam(0x18, this)); world->Notify(MxParam(MXTRANSITIONMANAGER_TRANSITIONENDED, this));
} }
} }
} }