diff --git a/CMakeLists.txt b/CMakeLists.txt index 03353834..eeee76d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,7 +170,6 @@ add_library(omni STATIC LEGO1/omni/src/notify/mxactionnotificationparam.cpp LEGO1/omni/src/notify/mxnotificationmanager.cpp LEGO1/omni/src/notify/mxnotificationparam.cpp - LEGO1/omni/src/notify/mxtype17notificationparam.cpp LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp LEGO1/omni/src/stream/mxdiskstreamprovider.cpp LEGO1/omni/src/stream/mxdsbuffer.cpp diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 88fd57d8..5429cc66 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -25,13 +25,13 @@ class Ambulance : public IslePathActor { return !strcmp(p_name, Ambulance::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4 - virtual MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - virtual void VTable0xe4() override; // vtable+0xe4 + virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + virtual void VTable0x70(float p_float) override; // vtable+0x70 + virtual MxU32 VTable0xcc() override; // vtable+0xcc + virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + virtual MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc + virtual void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10036130 // Ambulance::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index 02265604..3e3f1359 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -23,10 +23,10 @@ class Bike : public IslePathActor { return !strcmp(p_name, Bike::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4 - virtual void VTable0xe4() override; // vtable+0xe4 + virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + virtual MxU32 VTable0xcc() override; // vtable+0xcc + virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + virtual void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10076880 // Bike::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index ca671955..3aaf7a87 100644 --- a/LEGO1/lego/legoomni/include/dunebuggy.h +++ b/LEGO1/lego/legoomni/include/dunebuggy.h @@ -26,7 +26,7 @@ class DuneBuggy : public IslePathActor { virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual void VTable0x70(float p_float) override; // vtable+0x70 virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4 + virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 virtual MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc virtual void VTable0xe4() override; // vtable+0xe4 diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index e730fee4..10bcd7da 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -41,7 +41,7 @@ class Helicopter : public IslePathActor { virtual void VTable0x70(float p_float) override; // vtable+0x70 virtual void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4 + virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 virtual MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8 virtual void VTable0xe4() override; // vtable+0xe4 diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index e2944876..2e92c251 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -1,9 +1,9 @@ #ifndef ISLEPATHACTOR_H #define ISLEPATHACTOR_H +#include "legocontrolmanager.h" #include "legopathactor.h" #include "legoworld.h" -#include "mxtype17notificationparam.h" #include "mxtype18notificationparam.h" #include "mxtype19notificationparam.h" #include "mxtypes.h" @@ -39,7 +39,7 @@ class IslePathActor : public LegoPathActor { // FUNCTION: LEGO1 0x10002df0 virtual MxU32 VTable0xd0() { return 0; } // vtable+0xd0 // FUNCTION: LEGO1 0x10002e80 - virtual MxU32 VTable0xd4(MxType17NotificationParam&) { return 0; } // vtable+0xd4 + virtual MxU32 VTable0xd4(LegoControlManagerEvent&) { return 0; } // vtable+0xd4 // FUNCTION: LEGO1 0x10002e90 virtual MxU32 VTable0xd8(MxType18NotificationParam&) { return 0; } // vtable+0xd8 // FUNCTION: LEGO1 0x10002e00 diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index c3136d80..91de4b91 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -3,7 +3,7 @@ #include "decomp.h" #include "islepathactor.h" -#include "mxtype17notificationparam.h" +#include "legocontrolmanager.h" // VTABLE: LEGO1 0x100d9ec8 // SIZE 0x164 @@ -24,11 +24,11 @@ class Jetski : public IslePathActor { return !strcmp(p_name, Jetski::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(MxType17NotificationParam&) override; // vtable+0xd4 - virtual void VTable0xe4() override; // vtable+0xe4 + virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + virtual void VTable0x70(float p_float) override; // vtable+0x70 + virtual MxU32 VTable0xcc() override; // vtable+0xcc + virtual MxU32 VTable0xd4(LegoControlManagerEvent&) override; // vtable+0xd4 + virtual void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x1007e5c0 // Jetski::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index 5b83a715..f2f04026 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -2,9 +2,40 @@ #define LEGOCONTROLMANAGER_H #include "legoeventnotificationparam.h" +#include "legoinputmanager.h" #include "mxcore.h" #include "mxpresenterlist.h" +// VTABLE: LEGO1 0x100d6a98 +// SIZE 0x2c +class LegoControlManagerEvent : public LegoEventNotificationParam { +public: + inline LegoControlManagerEvent() : LegoEventNotificationParam() + { + m_clickedObjectId = -1; + m_clickedAtom = NULL; + } + + inline MxS32 GetClickedObjectId() const { return m_clickedObjectId; } + inline const char* GetClickedAtom() const { return m_clickedAtom; } + inline MxS16 GetUnknown0x28() const { return m_unk0x28; } + + inline void SetClickedObjectId(MxS32 p_clickedObjectId) { m_clickedObjectId = p_clickedObjectId; } + inline void SetClickedAtom(const char* p_clickedAtom) { m_clickedAtom = p_clickedAtom; } + inline void SetUnknown0x28(MxS16 p_unk0x28) { m_unk0x28 = p_unk0x28; } + +private: + MxS32 m_clickedObjectId; // 0x20 + const char* m_clickedAtom; // 0x24 + MxS16 m_unk0x28; // 0x28 +}; + +// SYNTHETIC: LEGO1 0x10028bf0 +// LegoControlManagerEvent::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x10028c60 +// LegoControlManagerEvent::~LegoControlManagerEvent + // VTABLE: LEGO1 0x100d6a80 class LegoControlManager : public MxCore { public: @@ -31,6 +62,10 @@ class LegoControlManager : public MxCore { void Unregister(MxCore* p_listener); MxBool FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter); void FUN_100293c0(undefined4, const char*, undefined2); + void FUN_100294e0(MxS32 p_x, MxS32 p_y); + MxBool FUN_10029630(); + MxBool FUN_10029750(); + void FUN_100292e0(); inline undefined4 GetUnknown0x0c() { return m_unk0x0c; } inline undefined GetUnknown0x10() { return m_unk0x10; } @@ -39,10 +74,13 @@ class LegoControlManager : public MxCore { // LegoControlManager::`scalar deleting destructor' private: - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - undefined m_unk0x10; // 0x10 - undefined m_padding0x14[0x4c]; // 0x14 + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + MxBool m_unk0x10; // 0x10 + MxPresenter* m_unk0x14; // 0x14 + LegoControlManagerEvent m_event; // 0x18 + MxPresenterList* m_presenterList; // 0x44 + LegoNotifyList m_notifyList; // 0x48 }; #endif // LEGOCONTROLMANAGER_H diff --git a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h index 9eb6c7b5..731b53bb 100644 --- a/LEGO1/lego/legoomni/include/legoeventnotificationparam.h +++ b/LEGO1/lego/legoomni/include/legoeventnotificationparam.h @@ -39,6 +39,10 @@ class LegoEventNotificationParam : public MxNotificationParam { inline MxS32 GetY() const { return m_y; } inline void SetROI(LegoROI* p_roi) { m_roi = p_roi; } + inline void SetModifier(MxU8 p_modifier) { m_modifier = p_modifier; } + inline void SetKey(MxU8 p_key) { m_key = p_key; } + inline void SetX(MxS32 p_x) { m_x = p_x; } + inline void SetY(MxS32 p_y) { m_y = p_y; } protected: MxU8 m_modifier; // 0x0c diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index eada8f70..913df81c 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -12,6 +12,9 @@ class LegoControlManager; +extern MxS32 g_unk0x100f31b0; +extern const char* g_unk0x100f31b4; + // VTABLE: LEGO1 0x100d87b8 // class MxCollection @@ -171,6 +174,9 @@ class LegoInputManager : public MxPresenter { // SYNTHETIC: LEGO1 0x10028b30 // MxPtrList::`scalar deleting destructor' +// FUNCTION: LEGO1 0x10028ba0 +// LegoNotifyList::~LegoNotifyList + // SYNTHETIC: LEGO1 0x10028fd0 // LegoNotifyListCursor::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/motocycle.h b/LEGO1/lego/legoomni/include/motocycle.h index e7716a33..6505f35b 100644 --- a/LEGO1/lego/legoomni/include/motocycle.h +++ b/LEGO1/lego/legoomni/include/motocycle.h @@ -23,12 +23,12 @@ class Motocycle : public IslePathActor { return !strcmp(p_name, Motocycle::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual void VTable0x70(float p_float) override; // vtable+0x70 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4 - virtual MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - virtual void VTable0xe4() override; // vtable+0xe4 + virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + virtual void VTable0x70(float p_float) override; // vtable+0x70 + virtual MxU32 VTable0xcc() override; // vtable+0xcc + virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + virtual MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc + virtual void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x100359d0 // Motocycle::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h index b4c8950e..34b3082d 100644 --- a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h @@ -4,6 +4,8 @@ #include "decomp.h" #include "mxcompositepresenter.h" +class LegoControlManagerEvent; + // VTABLE: LEGO1 0x100d7b88 // SIZE 0x5c class MxControlPresenter : public MxCompositePresenter { @@ -34,11 +36,12 @@ class MxControlPresenter : public MxCompositePresenter { virtual void Enable(MxBool p_enable) override; // vtable+0x54 virtual MxBool VTable0x64(undefined4 p_undefined) override; // vtable+0x64 virtual void VTable0x68(MxBool p_unk0x50); // vtable+0x68 - virtual void VTable0x6c(undefined4); // vtable+0x6c + virtual void VTable0x6c(undefined2); // vtable+0x6c + + MxBool FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter); private: - MxBool FUN_10044270(undefined4, undefined4, undefined4*); - MxBool FUN_10044480(undefined4, undefined4*); + MxBool FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter); void FUN_10044540(undefined2); undefined2 m_unk0x4c; // 0x4c @@ -46,6 +49,7 @@ class MxControlPresenter : public MxCompositePresenter { MxBool m_unk0x50; // 0x50 undefined2 m_unk0x52; // 0x52 undefined2 m_unk0x54; // 0x54 + undefined2 m_unk0x56; // 0x56 MxS16* m_unk0x58; // 0x58 }; diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 08d4b595..2df0e37c 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -1,10 +1,10 @@ #ifndef SCORE_H #define SCORE_H +#include "legocontrolmanager.h" #include "legoeventnotificationparam.h" #include "legoworld.h" #include "mxactionnotificationparam.h" -#include "mxtype17notificationparam.h" #include "scorestate.h" // VTABLE: LEGO1 0x100d4018 @@ -39,7 +39,7 @@ class Score : public LegoWorld { void Paint(); MxLong FUN_10001510(MxEndActionNotificationParam& p_param); - MxLong FUN_100016d0(MxType17NotificationParam& p_param); + MxLong FUN_100016d0(LegoControlManagerEvent& p_param); void FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color); protected: diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index f4154b8d..4f97d87c 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -23,11 +23,11 @@ class SkateBoard : public IslePathActor { return !strcmp(p_name, SkateBoard::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd0() override; // vtable+0xd0 - virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4 - virtual void VTable0xe4() override; // vtable+0xe4 + virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + virtual MxU32 VTable0xcc() override; // vtable+0xcc + virtual MxU32 VTable0xd0() override; // vtable+0xd0 + virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + virtual void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x1000ff60 // SkateBoard::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 8fb6b818..a79f75fb 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -27,7 +27,7 @@ class TowTrack : public IslePathActor { virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual void VTable0x70(float p_float) override; // vtable+0x70 virtual MxU32 VTable0xcc() override; // vtable+0xcc - virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4 + virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4 virtual MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8 virtual MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc virtual void VTable0xe4() override; // vtable+0xe4 diff --git a/LEGO1/lego/legoomni/src/build/dunebuggy.cpp b/LEGO1/lego/legoomni/src/build/dunebuggy.cpp index 857a316c..66fa23d2 100644 --- a/LEGO1/lego/legoomni/src/build/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/build/dunebuggy.cpp @@ -38,7 +38,7 @@ MxU32 DuneBuggy::VTable0xcc() } // STUB: LEGO1 0x100681b0 -MxU32 DuneBuggy::VTable0xd4(MxType17NotificationParam& p_param) +MxU32 DuneBuggy::VTable0xd4(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/build/helicopter.cpp b/LEGO1/lego/legoomni/src/build/helicopter.cpp index 2a1d1e06..f5add3e0 100644 --- a/LEGO1/lego/legoomni/src/build/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/build/helicopter.cpp @@ -123,7 +123,7 @@ MxU32 Helicopter::VTable0xcc() } // FUNCTION: LEGO1 0x100035e0 -MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param) +MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) { MxU32 ret = 0; MxAtomId script; @@ -138,8 +138,8 @@ MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param) script = *g_act3Script; break; } - if (p_param.GetUnknown28() == 1) { - switch (p_param.GetUnknown20()) { + if (p_param.GetUnknown0x28() == 1) { + switch (p_param.GetClickedObjectId()) { case 0x17: if (*g_act3Script == script) { ((Act3*) GetCurrentWorld())->SetUnkown4270(2); diff --git a/LEGO1/lego/legoomni/src/build/jetski.cpp b/LEGO1/lego/legoomni/src/build/jetski.cpp index 4676ea91..7a5a3dcd 100644 --- a/LEGO1/lego/legoomni/src/build/jetski.cpp +++ b/LEGO1/lego/legoomni/src/build/jetski.cpp @@ -37,7 +37,7 @@ MxU32 Jetski::VTable0xcc() } // STUB: LEGO1 0x1007e8e0 -MxU32 Jetski::VTable0xd4(MxType17NotificationParam& p_param) +MxU32 Jetski::VTable0xd4(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index 465ccf9f..e296ad91 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -1,44 +1,118 @@ #include "legocontrolmanager.h" #include "legoeventnotificationparam.h" +#include "mxcontrolpresenter.h" #include "mxpresenter.h" +#include "mxticklemanager.h" -DECOMP_SIZE_ASSERT(LegoControlManager, 0x60); +DECOMP_SIZE_ASSERT(LegoControlManager, 0x60) +DECOMP_SIZE_ASSERT(LegoControlManagerEvent, 0x2c) -// STUB: LEGO1 0x10028520 +// FUNCTION: LEGO1 0x10028520 LegoControlManager::LegoControlManager() { - // TODO + m_presenterList = NULL; + m_unk0x08 = 0; + m_unk0x0c = 0; + m_unk0x10 = FALSE; + m_unk0x14 = NULL; + TickleManager()->RegisterClient(this, 10); } -// STUB: LEGO1 0x10028d60 +// FUNCTION: LEGO1 0x10028d60 LegoControlManager::~LegoControlManager() { - // TODO + TickleManager()->UnregisterClient(this); } -// STUB: LEGO1 0x10028df0 +// FUNCTION: LEGO1 0x10028df0 void LegoControlManager::FUN_10028df0(MxPresenterList* p_presenterList) { - // TODO + m_presenterList = p_presenterList; + g_unk0x100f31b0 = -1; + g_unk0x100f31b4 = NULL; } -// STUB: LEGO1 0x10028e10 +// FUNCTION: LEGO1 0x10028e10 void LegoControlManager::Register(MxCore* p_listener) { - // TODO + m_notifyList.Append(p_listener); } -// STUB: LEGO1 0x10028ea0 +// FUNCTION: LEGO1 0x10028ea0 void LegoControlManager::Unregister(MxCore* p_listener) { - // TODO + LegoNotifyListCursor cursor(&m_notifyList); + if (cursor.Find(p_listener)) + cursor.Detach(); } -// STUB: LEGO1 0x10029210 +// FUNCTION: LEGO1 0x10029210 MxBool LegoControlManager::FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter) { - return TRUE; + if (m_presenterList != NULL && m_presenterList->GetCount() != 0) { + m_unk0x14 = p_presenter; + + if (p_param.GetType() == c_notificationButtonUp || p_param.GetType() == c_notificationButtonDown) { + m_event.SetType(p_param.GetType()); + m_event.SetSender(p_param.GetSender()); + m_event.SetModifier(p_param.GetModifier()); + m_event.SetX(p_param.GetX()); + m_event.SetY(p_param.GetY()); + m_event.SetKey(p_param.GetKey()); + + if (p_param.GetType() == c_notificationButtonUp) { + if (m_unk0x10 == TRUE) { + m_unk0x10 = FALSE; + return TRUE; + } + + if (g_unk0x100f31b0 != -1 && g_unk0x100f31b4 != NULL) { + if (m_unk0x08 == 2) { + return FUN_10029750(); + } + else { + m_unk0x0c = 1; + return TRUE; + } + } + } + else if (p_param.GetType() == c_notificationButtonDown) { + if (m_unk0x0c == 1) { + m_unk0x10 = TRUE; + return TRUE; + } + else { + return FUN_10029630(); + } + } + } + + return FALSE; + } + else { + g_unk0x100f31b0 = -1; + g_unk0x100f31b4 = NULL; + + return FALSE; + } +} + +// FUNCTION: LEGO1 0x100292e0 +void LegoControlManager::FUN_100292e0() +{ + LegoNotifyListCursor cursor(&m_notifyList); + MxCore* target; + + // The usual cursor.Next() loop doesn't match here, even though + // the logic is the same. It does match when "deconstructed" into + // the following Head(), Current() and NextFragment() calls, + // but this seems unlikely to be the original code. + cursor.Head(); + while (cursor.Current(target)) { + cursor.NextFragment(); + target->Notify(m_event); + } } // STUB: LEGO1 0x100293c0 @@ -46,10 +120,68 @@ void LegoControlManager::FUN_100293c0(undefined4, const char*, undefined2) { } -// STUB: LEGO1 0x10029600 +// STUB: LEGO1 0x100294e0 +void LegoControlManager::FUN_100294e0(MxS32 p_x, MxS32 p_y) +{ +} + +// FUNCTION: LEGO1 0x10029600 MxResult LegoControlManager::Tickle() { - // TODO - + if (m_unk0x08 == 2 && m_unk0x0c == 1) { + m_event.SetType(c_notificationButtonUp); + FUN_10029750(); + return 0; + } + else if (m_unk0x08 == 1) { + m_unk0x08 = 2; + } return 0; } + +// FUNCTION: LEGO1 0x10029630 +MxBool LegoControlManager::FUN_10029630() +{ + MxPresenterListCursor cursor(m_presenterList); + MxPresenter* presenter; + + while (cursor.Next(presenter)) { + if (((MxControlPresenter*) presenter)->FUN_10044480(&m_event, m_unk0x14)) { + g_unk0x100f31b0 = m_event.GetClickedObjectId(); + g_unk0x100f31b4 = m_event.GetClickedAtom(); + FUN_100292e0(); + m_unk0x08 = 1; + return TRUE; + } + } + + return FALSE; +} + +// FUNCTION: LEGO1 0x10029750 +MxBool LegoControlManager::FUN_10029750() +{ + MxPresenterListCursor cursor(m_presenterList); + MxPresenter* presenter; + + while (cursor.Next(presenter)) { + if (presenter->GetAction() && presenter->GetAction()->GetObjectId() == g_unk0x100f31b0 && + presenter->GetAction()->GetAtomId().GetInternal() == g_unk0x100f31b4) { + if (((MxControlPresenter*) presenter)->FUN_10044480(&m_event, m_unk0x14)) { + FUN_100292e0(); + } + + g_unk0x100f31b0 = -1; + g_unk0x100f31b4 = NULL; + + m_unk0x08 = 0; + m_unk0x0c = 0; + + return TRUE; + } + } + + g_unk0x100f31b0 = -1; + g_unk0x100f31b4 = NULL; + return FALSE; +} diff --git a/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp index b578f107..ad19bb94 100644 --- a/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/mxcontrolpresenter.cpp @@ -1,6 +1,7 @@ #include "mxcontrolpresenter.h" #include "define.h" +#include "legocontrolmanager.h" #include "mxticklemanager.h" #include "mxutil.h" @@ -99,21 +100,45 @@ void MxControlPresenter::EndAction() } // STUB: LEGO1 0x10044270 -MxBool MxControlPresenter::FUN_10044270(undefined4, undefined4, undefined4*) +MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter) { // TODO return TRUE; } -// STUB: LEGO1 0x10044480 -MxBool MxControlPresenter::FUN_10044480(undefined4, undefined4*) +// FUNCTION: LEGO1 0x10044480 +MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter) { - // TODO - return TRUE; + if (IsEnabled()) { + switch (p_event->GetType()) { + case c_notificationButtonUp: + if (m_unk0x4c == 0 || m_unk0x4c == 2 || m_unk0x4c == 3) { + p_event->SetClickedObjectId(m_action->GetObjectId()); + p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); + VTable0x6c(0); + p_event->SetType(c_notificationType17); + p_event->SetUnknown0x28(m_unk0x4e); + return TRUE; + } + break; + case c_notificationButtonDown: + if (FUN_10044270(p_event->GetX(), p_event->GetY(), p_presenter)) { + p_event->SetClickedObjectId(m_action->GetObjectId()); + p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); + VTable0x6c(m_unk0x56); + p_event->SetType(c_notificationType17); + p_event->SetUnknown0x28(m_unk0x4e); + return TRUE; + } + break; + } + } + + return FALSE; } // STUB: LEGO1 0x10044540 -void MxControlPresenter::VTable0x6c(undefined4) +void MxControlPresenter::VTable0x6c(undefined2) { // TODO } diff --git a/LEGO1/lego/legoomni/src/hospital/ambulance.cpp b/LEGO1/lego/legoomni/src/hospital/ambulance.cpp index a7bd2689..aad42ca4 100644 --- a/LEGO1/lego/legoomni/src/hospital/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/hospital/ambulance.cpp @@ -67,7 +67,7 @@ void Ambulance::VTable0xe4() } // STUB: LEGO1 0x10036f90 -MxU32 Ambulance::VTable0xd4(MxType17NotificationParam& p_param) +MxU32 Ambulance::VTable0xd4(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/infocenter/score.cpp b/LEGO1/lego/legoomni/src/infocenter/score.cpp index a7c1ee14..f1db49f2 100644 --- a/LEGO1/lego/legoomni/src/infocenter/score.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/score.cpp @@ -92,7 +92,7 @@ MxLong Score::Notify(MxParam& p_param) ret = 1; break; case c_notificationType17: - ret = FUN_100016d0((MxType17NotificationParam&) p_param); + ret = FUN_100016d0((LegoControlManagerEvent&) p_param); break; case c_notificationTransitioned: DeleteObjects(g_infoscorScript, 7, 9); @@ -152,12 +152,12 @@ void Score::ReadyWorld() } // FUNCTION: LEGO1 0x100016d0 -MxLong Score::FUN_100016d0(MxType17NotificationParam& p_param) +MxLong Score::FUN_100016d0(LegoControlManagerEvent& p_param) { - MxS16 l = p_param.GetUnknown28(); + MxS16 l = p_param.GetUnknown0x28(); - if (l == 1 || p_param.GetUnknown20() == 4) { - switch (p_param.GetUnknown20()) { + if (l == 1 || p_param.GetClickedObjectId() == 4) { + switch (p_param.GetClickedObjectId()) { case 1: m_unk0xf8 = 2; DeleteScript(); diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 05f09061..783bbfe3 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -15,7 +15,7 @@ DECOMP_SIZE_ASSERT(LegoEventQueue, 0x18) MxS32 g_unk0x100f31b0 = -1; // GLOBAL: LEGO1 0x100f31b4 -MxS32 g_unk0x100f31b4 = 0; +const char* g_unk0x100f31b4 = NULL; // FUNCTION: LEGO1 0x1005b790 LegoInputManager::LegoInputManager() @@ -424,5 +424,5 @@ void LegoInputManager::EnableInputProcessing() { m_unk0x88 = FALSE; g_unk0x100f31b0 = -1; - g_unk0x100f31b4 = 0; + g_unk0x100f31b4 = NULL; } diff --git a/LEGO1/lego/legoomni/src/isle/bike.cpp b/LEGO1/lego/legoomni/src/isle/bike.cpp index 1c71b299..219208ea 100644 --- a/LEGO1/lego/legoomni/src/isle/bike.cpp +++ b/LEGO1/lego/legoomni/src/isle/bike.cpp @@ -31,7 +31,7 @@ MxU32 Bike::VTable0xcc() } // STUB: LEGO1 0x10076aa0 -MxU32 Bike::VTable0xd4(MxType17NotificationParam& p_param) +MxU32 Bike::VTable0xd4(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/isle/motocycle.cpp b/LEGO1/lego/legoomni/src/isle/motocycle.cpp index c54bd841..0f4424f9 100644 --- a/LEGO1/lego/legoomni/src/isle/motocycle.cpp +++ b/LEGO1/lego/legoomni/src/isle/motocycle.cpp @@ -38,7 +38,7 @@ MxU32 Motocycle::VTable0xcc() } // STUB: LEGO1 0x10035d70 -MxU32 Motocycle::VTable0xd4(MxType17NotificationParam& p_param) +MxU32 Motocycle::VTable0xd4(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/isle/skateboard.cpp b/LEGO1/lego/legoomni/src/isle/skateboard.cpp index 037dff9a..22998f85 100644 --- a/LEGO1/lego/legoomni/src/isle/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/isle/skateboard.cpp @@ -38,7 +38,7 @@ MxU32 SkateBoard::VTable0xcc() } // STUB: LEGO1 0x10010230 -MxU32 SkateBoard::VTable0xd4(MxType17NotificationParam& p_param) +MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/towtrack/towtrack.cpp b/LEGO1/lego/legoomni/src/towtrack/towtrack.cpp index eb05e57b..ebfd3ee7 100644 --- a/LEGO1/lego/legoomni/src/towtrack/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/towtrack/towtrack.cpp @@ -64,7 +64,7 @@ void TowTrack::VTable0xe4() } // STUB: LEGO1 0x1004d9e0 -MxU32 TowTrack::VTable0xd4(MxType17NotificationParam& p_param) +MxU32 TowTrack::VTable0xd4(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/omni/include/mxnotificationparam.h b/LEGO1/omni/include/mxnotificationparam.h index a6055fa2..2ec5cf19 100644 --- a/LEGO1/omni/include/mxnotificationparam.h +++ b/LEGO1/omni/include/mxnotificationparam.h @@ -49,6 +49,7 @@ class MxNotificationParam : public MxParam { inline NotificationId GetType() const { return m_type; } inline void SetType(NotificationId p_type) { m_type = p_type; } + inline void SetSender(MxCore* p_sender) { m_sender = p_sender; } protected: NotificationId m_type; // 0x04 diff --git a/LEGO1/omni/include/mxtype17notificationparam.h b/LEGO1/omni/include/mxtype17notificationparam.h deleted file mode 100644 index cf4e78fa..00000000 --- a/LEGO1/omni/include/mxtype17notificationparam.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MXTYPE17NOTIFICATIONPARAM_H -#define MXTYPE17NOTIFICATIONPARAM_H - -#include "decomp.h" -#include "mxnotificationparam.h" - -// ??? This type is handled, but seemingly never created and no VTABLE fits -class MxType17NotificationParam : public MxNotificationParam { -public: - inline MxU32 GetUnknown20() { return m_unk0x20; } - inline MxU16 GetUnknown28() { return m_unk0x28; } - -protected: - undefined m_unk0xc[0x14]; - MxU32 m_unk0x20; - undefined4 m_unk0x24; - MxU16 m_unk0x28; -}; - -#endif // MXTYPE17NOTIFICATIONPARAM_H diff --git a/LEGO1/omni/src/notify/mxtype17notificationparam.cpp b/LEGO1/omni/src/notify/mxtype17notificationparam.cpp deleted file mode 100644 index dbb047f6..00000000 --- a/LEGO1/omni/src/notify/mxtype17notificationparam.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "mxtype17notificationparam.h" - -DECOMP_SIZE_ASSERT(MxType17NotificationParam, 0x2c)