From 3d5a7b277dff9ca6e722b26fadfb3f7d9ddc07b8 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sat, 27 Jan 2024 19:45:53 -0500 Subject: [PATCH] push changes --- .../legoomni/include/legocontrolmanager.h | 10 +- .../include/legoeventnotificationparam.h | 7 +- .../lego/legoomni/include/legoinputmanager.h | 2 + .../lego/legoomni/include/legovideomanager.h | 2 +- .../src/control/legocontrolmanager.cpp | 9 ++ .../legoomni/src/input/legoinputmanager.cpp | 108 +++++++++++++++++- .../legoomni/src/video/legovideomanager.cpp | 14 ++- LEGO1/omni/include/mxnotificationparam.h | 2 + LEGO1/realtime/roi.h | 2 + 9 files changed, 148 insertions(+), 8 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index e2861885..fc16dfcf 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -1,6 +1,7 @@ #ifndef LEGOCONTROLMANAGER_H #define LEGOCONTROLMANAGER_H +#include "legoeventnotificationparam.h" #include "mxcore.h" #include "mxpresenterlist.h" @@ -28,13 +29,20 @@ class LegoControlManager : public MxCore { void FUN_10028df0(MxPresenterList* p_presenterList); void Register(MxCore* p_listener); void Unregister(MxCore* p_listener); + MxBool FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter); void FUN_100293c0(undefined4, const char*, undefined2); + inline undefined4 GetUnknown0x0c() { return m_unk0x0c; } + inline undefined GetUnknown0x10() { return m_unk0x10; } + // SYNTHETIC: LEGO1 0x10028d40 // LegoControlManager::`scalar deleting destructor' private: - undefined m_padding0x08[0x58]; // 0x08 + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + undefined m_unk0x10; // 0x10 + undefined m_padding0x08[0x4c]; // 0x14 }; #endif // LEGOCONTROLMANAGER_H diff --git a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h index f5ec9205..441a7535 100644 --- a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h +++ b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h @@ -3,6 +3,7 @@ #include "mxnotificationparam.h" #include "mxtypes.h" +#include "roi/legoroi.h" #include @@ -21,7 +22,7 @@ class LegoEventNotificationParam : public MxNotificationParam { MxS32 p_y, MxU8 p_key ) - : MxNotificationParam(p_type, p_sender), m_modifier(p_modifier), m_x(p_x), m_y(p_y), m_key(p_key), m_unk0x1c(0) + : MxNotificationParam(p_type, p_sender), m_modifier(p_modifier), m_x(p_x), m_y(p_y), m_key(p_key), m_roi(0) { } @@ -29,12 +30,14 @@ class LegoEventNotificationParam : public MxNotificationParam { inline MxS32 GetX() const { return m_x; } inline MxS32 GetY() const { return m_y; } + inline void SetROI(LegoROI* p_roi) { m_roi = p_roi; } + protected: MxU8 m_modifier; // 0x0c MxS32 m_x; // 0x10 MxS32 m_y; // 0x14 MxU8 m_key; // 0x18 - MxU32 m_unk0x1c; // 0x1c + LegoROI* m_roi; // 0x1c }; // SYNTHETIC: LEGO1 0x10028770 diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index 89e30dc7..027577df 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -110,6 +110,8 @@ class LegoInputManager : public MxPresenter { void ProcessEvents(); MxBool ProcessOneEvent(LegoEventNotificationParam& p_param); + MxBool FUN_1005cdf0(LegoEventNotificationParam& p_param); + // SYNTHETIC: LEGO1 0x1005b8d0 // LegoInputManager::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legovideomanager.h b/LEGO1/lego/legoomni/include/legovideomanager.h index 72cb2148..f1ad14c5 100644 --- a/LEGO1/lego/legoomni/include/legovideomanager.h +++ b/LEGO1/lego/legoomni/include/legovideomanager.h @@ -31,7 +31,7 @@ class LegoVideoManager : public MxVideoManager { override; // vtable+0x2c virtual MxResult RealizePalette(MxPalette*) override; // vtable+0x30 virtual void UpdateView(MxU32 p_x, MxU32 p_y, MxU32 p_width, MxU32 p_height) override; // vtable+0x34 - virtual void VTable0x38(undefined4, undefined4); // vtable+0x38 + virtual MxPresenter* VTable0x38(MxS32 p_x, MxS32 p_y); // vtable+0x38 // FUNCTION: LEGO1 0x1007ab10 virtual LegoUnknown100d9d00* VTable0x3c() { return m_unk0x100d9d00; } // vtable+0x3c diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index 5b51b8ec..465ccf9f 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -1,5 +1,8 @@ #include "legocontrolmanager.h" +#include "legoeventnotificationparam.h" +#include "mxpresenter.h" + DECOMP_SIZE_ASSERT(LegoControlManager, 0x60); // STUB: LEGO1 0x10028520 @@ -32,6 +35,12 @@ void LegoControlManager::Unregister(MxCore* p_listener) // TODO } +// STUB: LEGO1 0x10029210 +MxBool LegoControlManager::FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter) +{ + return TRUE; +} + // STUB: LEGO1 0x100293c0 void LegoControlManager::FUN_100293c0(undefined4, const char*, undefined2) { diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 2a551c71..92bd4061 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -2,7 +2,9 @@ #include "legocontrolmanager.h" #include "legoomni.h" +#include "legovideomanager.h" #include "mxautolocker.h" +#include "roi/legoroi.h" DECOMP_SIZE_ASSERT(LegoInputManager, 0x338) DECOMP_SIZE_ASSERT(LegoNotifyList, 0x18) @@ -279,8 +281,112 @@ void LegoInputManager::ProcessEvents() } } -// STUB: LEGO1 0x1005c9c0 +// FUNCTION: LEGO1 0x1005c9c0 MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) +{ + MxBool processRoi; + if (p_param.GetType() == c_notificationKeyPress) { + if (!Lego()->IsTimerRunning() || p_param.GetKey() == 0x13) { + if (p_param.GetKey() == 16) { + if (m_unk0x195) { + m_unk0x80 = 0; + p_param.SetType(c_notificationDrag); + if (m_camera) { + m_camera->Notify(p_param); + } + } + + m_unk0x195 = !m_unk0x195; + return TRUE; + } + + LegoNotifyListCursor cursor(m_keyboardNotifyList); + MxCore* obj; + while (cursor.Next(obj)) { + if (obj->Notify(p_param) != 0) { + return TRUE; + } + } + } + } + else { + if (!Lego()->IsTimerRunning()) { + processRoi = TRUE; + if (m_unk0x335 != 0) { + if (p_param.GetType() == c_notificationButtonDown) { + LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, ' '); + + LegoNotifyListCursor cursor(m_keyboardNotifyList); + MxCore* obj; + while (cursor.Next(obj)) { + if (obj->Notify(p_param) != 0) { + return TRUE; + } + } + } + + return TRUE; + } + + if (m_unk0x195 && p_param.GetType() == c_notificationButtonDown) { + m_unk0x195 = 0; + return TRUE; + } + + if (m_world != NULL && m_world->Notify(p_param) != 0) { + return TRUE; + } + + if (p_param.GetType() == c_notificationButtonDown) { + MxPresenter* presenter = VideoManager()->VTable0x38(p_param.GetX(), p_param.GetY()); + if (presenter) { + if (presenter->GetDisplayZ() < 0) { + processRoi = FALSE; + if (m_controlManager->FUN_10029210(p_param, presenter)) { + return TRUE; + } + } + else { + LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); + if (roi == NULL && m_controlManager->FUN_10029210(p_param, presenter)) { + return TRUE; + } + } + } + } + + if (p_param.GetType() == c_notificationButtonUp) { + if (g_unk0x100f31b0 != -1 || !m_controlManager->GetUnknown0x10() || + m_controlManager->GetUnknown0x0c() == 1) { + MxBool result2 = m_controlManager->FUN_10029210(p_param, NULL); + KillTimer(); + m_unk0x80 = 0; + m_unk0x81 = 0; + return result2; + } + else { + if (FUN_1005cdf0(p_param)) { + if (processRoi && p_param.GetType() == c_notificationType11) { + LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); + p_param.SetROI(roi); + if (roi && roi->GetUnk0x0c() == 1) { + // TODO: enumerate through some list in ROI + } + } + + if (m_camera && m_camera->Notify(p_param) != 0) { + return TRUE; + } + } + } + } + } + } + return FALSE; +} + +// STUB: LEGO1 0x1005cdf0 +MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param) { // TODO return FALSE; diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index f31879b3..ef5b4393 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -330,10 +330,18 @@ void LegoVideoManager::DrawFPS() // TODO } -// STUB: LEGO1 0x1007c080 -void LegoVideoManager::VTable0x38(undefined4, undefined4) +// FUNCTION: LEGO1 0x1007c080 +MxPresenter* LegoVideoManager::VTable0x38(MxS32 p_x, MxS32 p_y) { - // TODO + MxPresenterListCursor cursor(m_presenters); + MxPresenter* presenter; + + while (cursor.Next(presenter)) { + if (presenter->IsHit(p_x, p_y)) { + return presenter; + } + } + return NULL; } // FUNCTION: LEGO1 0x1007c290 diff --git a/LEGO1/omni/include/mxnotificationparam.h b/LEGO1/omni/include/mxnotificationparam.h index e990abe6..a6055fa2 100644 --- a/LEGO1/omni/include/mxnotificationparam.h +++ b/LEGO1/omni/include/mxnotificationparam.h @@ -48,6 +48,8 @@ class MxNotificationParam : public MxParam { inline MxCore* GetSender() const { return m_sender; } inline NotificationId GetType() const { return m_type; } + inline void SetType(NotificationId p_type) { m_type = p_type; } + protected: NotificationId m_type; // 0x04 MxCore* m_sender; // 0x08 diff --git a/LEGO1/realtime/roi.h b/LEGO1/realtime/roi.h index 08db5080..b5cbefa5 100644 --- a/LEGO1/realtime/roi.h +++ b/LEGO1/realtime/roi.h @@ -103,6 +103,8 @@ class ROI { int GetLODCount() const { return m_lods ? m_lods->Size() : 0; } const CompoundObject* GetComp() const { return m_comp; } + inline undefined GetUnk0x0c() { return m_unk0xc; } + // SYNTHETIC: LEGO1 0x100a5d60 // ROI::`scalar deleting destructor'