From 05101c9e579f8dfdaa6fc6757df6624c5068c93c Mon Sep 17 00:00:00 2001 From: disinvite Date: Mon, 6 Nov 2023 22:02:42 -0500 Subject: [PATCH] MxParamType -> NotificationId --- ISLE/isleapp.cpp | 14 +++++++------- LEGO1/legoeventnotificationparam.h | 4 ++-- LEGO1/legoinputmanager.cpp | 7 +++---- LEGO1/legoinputmanager.h | 15 +++------------ LEGO1/mxactionnotificationparam.h | 9 +++++++-- LEGO1/mxnotificationparam.h | 14 ++++++++------ LEGO1/mxstreamer.h | 2 +- 7 files changed, 31 insertions(+), 34 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 8c38315e..775f038c 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -95,7 +95,7 @@ void IsleApp::Close() if (Lego()) { GameState()->Save(0); if (InputManager()) { - InputManager()->QueueEvent(KEYDOWN, 0, 0, 0, 0x20); + InputManager()->QueueEvent(c_notificationKeyPress, 0, 0, 0, 0x20); } VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL); @@ -431,22 +431,22 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DefWindowProcA(hWnd, uMsg, wParam, lParam); } keyCode = wParam; - type = KEYDOWN; + type = c_notificationKeyPress; break; case WM_MOUSEMOVE: g_mousemoved = 1; - type = MOUSEMOVE; + type = c_notificationMouseMove; break; case WM_TIMER: - type = TIMER; + type = c_notificationTimer; break; case WM_LBUTTONDOWN: g_mousedown = 1; - type = MOUSEDOWN; + type = c_notificationButtonDown; break; case WM_LBUTTONUP: g_mousedown = 0; - type = MOUSEUP; + type = c_notificationButtonUp; break; case 0x5400: if (g_isle) { @@ -462,7 +462,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (InputManager()) { InputManager()->QueueEvent(type, wParam, LOWORD(lParam), HIWORD(lParam), keyCode); } - if (g_isle && g_isle->m_drawCursor && type == MOUSEMOVE) { + if (g_isle && g_isle->m_drawCursor && type == c_notificationMouseMove) { int x = LOWORD(lParam); int y = HIWORD(lParam); if (x >= 640) { diff --git a/LEGO1/legoeventnotificationparam.h b/LEGO1/legoeventnotificationparam.h index 1d5ec7a1..3916771d 100644 --- a/LEGO1/legoeventnotificationparam.h +++ b/LEGO1/legoeventnotificationparam.h @@ -7,9 +7,9 @@ // VTABLE 0x100d6aa0 class LegoEventNotificationParam : public MxNotificationParam { public: - inline LegoEventNotificationParam() : MxNotificationParam((MxParamType) 0, NULL) {} + inline LegoEventNotificationParam() : MxNotificationParam(PARAM_NONE, NULL) {} inline LegoEventNotificationParam( - MxParamType p_type, + NotificationId p_type, MxCore* p_sender, MxU8 p_modifier, MxS32 p_x, diff --git a/LEGO1/legoinputmanager.cpp b/LEGO1/legoinputmanager.cpp index f11e8577..e9a82cc6 100644 --- a/LEGO1/legoinputmanager.cpp +++ b/LEGO1/legoinputmanager.cpp @@ -227,11 +227,10 @@ void LegoInputManager::ClearWorld() // OFFSET: LEGO1 0x1005c740 void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key) { - // TODO: param type wrong? - LegoEventNotificationParam param = - LegoEventNotificationParam((MxParamType) p_id, NULL, p_modifier, p_x, p_y, p_key); + LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key); - if (((!m_unk0x88) || ((m_unk0x335 && (param.GetType() == MOUSEDOWN)))) || ((m_unk0x336 && (p_key == ' ')))) { + if (((!m_unk0x88) || ((m_unk0x335 && (param.GetType() == c_notificationButtonDown)))) || + ((m_unk0x336 && (p_key == ' ')))) { ProcessOneEvent(param); } } diff --git a/LEGO1/legoinputmanager.h b/LEGO1/legoinputmanager.h index 3c481cd9..c583a64a 100644 --- a/LEGO1/legoinputmanager.h +++ b/LEGO1/legoinputmanager.h @@ -10,15 +10,6 @@ #include -enum NotificationId { - NONE = 0, - KEYDOWN = 7, - MOUSEUP = 8, - MOUSEDOWN = 9, - MOUSEMOVE = 10, - TIMER = 15 -}; - class LegoControlManager; // VTABLE 0x100d8800 @@ -113,13 +104,13 @@ class LegoInputManager : public MxPresenter { // OFFSET: LEGO1 0x1005d010 TEMPLATE // MxListEntry::GetValue -// VTABLE 0x100d87e8 +// VTABLE 0x100d87e8 TEMPLATE // class MxQueue -// VTABLE 0x100d87d0 +// VTABLE 0x100d87d0 TEMPLATE // class MxList -// VTABLE 0x100d87b8 +// VTABLE 0x100d87b8 TEMPLATE // class MxListParent #endif // LEGOINPUTMANAGER_H diff --git a/LEGO1/mxactionnotificationparam.h b/LEGO1/mxactionnotificationparam.h index 3255f91d..7f825a21 100644 --- a/LEGO1/mxactionnotificationparam.h +++ b/LEGO1/mxactionnotificationparam.h @@ -8,7 +8,12 @@ // SIZE 0x14 class MxActionNotificationParam : public MxNotificationParam { public: - inline MxActionNotificationParam(MxParamType p_type, MxCore* p_sender, MxDSAction* p_action, MxBool p_reallocAction) + inline MxActionNotificationParam( + NotificationId p_type, + MxCore* p_sender, + MxDSAction* p_action, + MxBool p_reallocAction + ) : MxNotificationParam(p_type, p_sender) { MxDSAction* oldAction = p_action; @@ -50,7 +55,7 @@ class MxActionNotificationParam : public MxNotificationParam { class MxEndActionNotificationParam : public MxActionNotificationParam { public: inline MxEndActionNotificationParam( - MxParamType p_type, + NotificationId p_type, MxCore* p_sender, MxDSAction* p_action, MxBool p_reallocAction diff --git a/LEGO1/mxnotificationparam.h b/LEGO1/mxnotificationparam.h index 98d27a1c..ec58fde6 100644 --- a/LEGO1/mxnotificationparam.h +++ b/LEGO1/mxnotificationparam.h @@ -7,7 +7,7 @@ class MxCore; -enum MxParamType { +enum NotificationId { PARAM_NONE = 0, c_notificationStartAction = 1, // 100dc210:100d8350 c_notificationEndAction = 2, // 100d8358:100d8350 @@ -36,18 +36,20 @@ enum MxParamType { // VTABLE 0x100d56e0 class MxNotificationParam : public MxParam { public: - inline MxNotificationParam(MxParamType p_type, MxCore* p_sender) : MxParam(), m_type(p_type), m_sender(p_sender) {} + inline MxNotificationParam(NotificationId p_type, MxCore* p_sender) : MxParam(), m_type(p_type), m_sender(p_sender) + { + } virtual ~MxNotificationParam() override {} // vtable+0x0 (scalar deleting destructor) virtual MxNotificationParam* Clone(); // vtable+0x4 - inline MxParamType GetNotification() const { return m_type; } + inline NotificationId GetNotification() const { return m_type; } inline MxCore* GetSender() const { return m_sender; } - inline MxParamType GetType() const { return m_type; } + inline NotificationId GetType() const { return m_type; } protected: - MxParamType m_type; // 0x4 - MxCore* m_sender; // 0x8 + NotificationId m_type; // 0x4 + MxCore* m_sender; // 0x8 }; #endif // MXNOTIFICATIONPARAM_H diff --git a/LEGO1/mxstreamer.h b/LEGO1/mxstreamer.h index f7d1d448..6e0500cb 100644 --- a/LEGO1/mxstreamer.h +++ b/LEGO1/mxstreamer.h @@ -42,7 +42,7 @@ class MxStreamerSubClass3 : public MxStreamerSubClass1 { class MxStreamerNotification : public MxNotificationParam { public: - inline MxStreamerNotification(MxParamType p_type, MxCore* p_sender, MxStreamController* p_ctrlr) + inline MxStreamerNotification(NotificationId p_type, MxCore* p_sender, MxStreamController* p_ctrlr) : MxNotificationParam(p_type, p_sender) { m_controller = p_ctrlr;