Implement LegoControlManager (#500)

* Push changes

* Update score.cpp

* fix

* Update score.h

* Fixes/matches

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2024-01-28 16:09:33 -05:00 committed by GitHub
parent c0acf11f9b
commit 4314d3e297
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 291 additions and 105 deletions

View file

@ -170,7 +170,6 @@ add_library(omni STATIC
LEGO1/omni/src/notify/mxactionnotificationparam.cpp LEGO1/omni/src/notify/mxactionnotificationparam.cpp
LEGO1/omni/src/notify/mxnotificationmanager.cpp LEGO1/omni/src/notify/mxnotificationmanager.cpp
LEGO1/omni/src/notify/mxnotificationparam.cpp LEGO1/omni/src/notify/mxnotificationparam.cpp
LEGO1/omni/src/notify/mxtype17notificationparam.cpp
LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp
LEGO1/omni/src/stream/mxdiskstreamprovider.cpp LEGO1/omni/src/stream/mxdiskstreamprovider.cpp
LEGO1/omni/src/stream/mxdsbuffer.cpp LEGO1/omni/src/stream/mxdsbuffer.cpp

View file

@ -29,7 +29,7 @@ class Ambulance : public IslePathActor {
virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c
virtual void VTable0x70(float p_float) override; // vtable+0x70 virtual void VTable0x70(float p_float) override; // vtable+0x70
virtual MxU32 VTable0xcc() override; // vtable+0xcc 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&) override; // vtable+0xdc virtual MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc
virtual void VTable0xe4() override; // vtable+0xe4 virtual void VTable0xe4() override; // vtable+0xe4

View file

@ -25,7 +25,7 @@ class Bike : public IslePathActor {
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual MxU32 VTable0xcc() override; // vtable+0xcc 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 void VTable0xe4() override; // vtable+0xe4 virtual void VTable0xe4() override; // vtable+0xe4
// SYNTHETIC: LEGO1 0x10076880 // SYNTHETIC: LEGO1 0x10076880

View file

@ -26,7 +26,7 @@ class DuneBuggy : public IslePathActor {
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual void VTable0x70(float p_float) override; // vtable+0x70 virtual void VTable0x70(float p_float) override; // vtable+0x70
virtual MxU32 VTable0xcc() override; // vtable+0xcc 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 MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc
virtual void VTable0xe4() override; // vtable+0xe4 virtual void VTable0xe4() override; // vtable+0xe4

View file

@ -41,7 +41,7 @@ class Helicopter : public IslePathActor {
virtual void VTable0x70(float p_float) override; // vtable+0x70 virtual void VTable0x70(float p_float) override; // vtable+0x70
virtual void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 virtual void VTable0x74(Matrix4& p_transform) override; // vtable+0x74
virtual MxU32 VTable0xcc() override; // vtable+0xcc 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 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8
virtual void VTable0xe4() override; // vtable+0xe4 virtual void VTable0xe4() override; // vtable+0xe4

View file

@ -1,9 +1,9 @@
#ifndef ISLEPATHACTOR_H #ifndef ISLEPATHACTOR_H
#define ISLEPATHACTOR_H #define ISLEPATHACTOR_H
#include "legocontrolmanager.h"
#include "legopathactor.h" #include "legopathactor.h"
#include "legoworld.h" #include "legoworld.h"
#include "mxtype17notificationparam.h"
#include "mxtype18notificationparam.h" #include "mxtype18notificationparam.h"
#include "mxtype19notificationparam.h" #include "mxtype19notificationparam.h"
#include "mxtypes.h" #include "mxtypes.h"
@ -39,7 +39,7 @@ class IslePathActor : public LegoPathActor {
// FUNCTION: LEGO1 0x10002df0 // FUNCTION: LEGO1 0x10002df0
virtual MxU32 VTable0xd0() { return 0; } // vtable+0xd0 virtual MxU32 VTable0xd0() { return 0; } // vtable+0xd0
// FUNCTION: LEGO1 0x10002e80 // FUNCTION: LEGO1 0x10002e80
virtual MxU32 VTable0xd4(MxType17NotificationParam&) { return 0; } // vtable+0xd4 virtual MxU32 VTable0xd4(LegoControlManagerEvent&) { return 0; } // vtable+0xd4
// FUNCTION: LEGO1 0x10002e90 // FUNCTION: LEGO1 0x10002e90
virtual MxU32 VTable0xd8(MxType18NotificationParam&) { return 0; } // vtable+0xd8 virtual MxU32 VTable0xd8(MxType18NotificationParam&) { return 0; } // vtable+0xd8
// FUNCTION: LEGO1 0x10002e00 // FUNCTION: LEGO1 0x10002e00

View file

@ -3,7 +3,7 @@
#include "decomp.h" #include "decomp.h"
#include "islepathactor.h" #include "islepathactor.h"
#include "mxtype17notificationparam.h" #include "legocontrolmanager.h"
// VTABLE: LEGO1 0x100d9ec8 // VTABLE: LEGO1 0x100d9ec8
// SIZE 0x164 // SIZE 0x164
@ -27,7 +27,7 @@ class Jetski : public IslePathActor {
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual void VTable0x70(float p_float) override; // vtable+0x70 virtual void VTable0x70(float p_float) override; // vtable+0x70
virtual MxU32 VTable0xcc() override; // vtable+0xcc virtual MxU32 VTable0xcc() override; // vtable+0xcc
virtual MxU32 VTable0xd4(MxType17NotificationParam&) override; // vtable+0xd4 virtual MxU32 VTable0xd4(LegoControlManagerEvent&) override; // vtable+0xd4
virtual void VTable0xe4() override; // vtable+0xe4 virtual void VTable0xe4() override; // vtable+0xe4
// SYNTHETIC: LEGO1 0x1007e5c0 // SYNTHETIC: LEGO1 0x1007e5c0

View file

@ -2,9 +2,40 @@
#define LEGOCONTROLMANAGER_H #define LEGOCONTROLMANAGER_H
#include "legoeventnotificationparam.h" #include "legoeventnotificationparam.h"
#include "legoinputmanager.h"
#include "mxcore.h" #include "mxcore.h"
#include "mxpresenterlist.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 // VTABLE: LEGO1 0x100d6a80
class LegoControlManager : public MxCore { class LegoControlManager : public MxCore {
public: public:
@ -31,6 +62,10 @@ class LegoControlManager : public MxCore {
void Unregister(MxCore* p_listener); void Unregister(MxCore* p_listener);
MxBool FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter); MxBool FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter);
void FUN_100293c0(undefined4, const char*, undefined2); 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 undefined4 GetUnknown0x0c() { return m_unk0x0c; }
inline undefined GetUnknown0x10() { return m_unk0x10; } inline undefined GetUnknown0x10() { return m_unk0x10; }
@ -41,8 +76,11 @@ class LegoControlManager : public MxCore {
private: private:
undefined4 m_unk0x08; // 0x08 undefined4 m_unk0x08; // 0x08
undefined4 m_unk0x0c; // 0x0c undefined4 m_unk0x0c; // 0x0c
undefined m_unk0x10; // 0x10 MxBool m_unk0x10; // 0x10
undefined m_padding0x14[0x4c]; // 0x14 MxPresenter* m_unk0x14; // 0x14
LegoControlManagerEvent m_event; // 0x18
MxPresenterList* m_presenterList; // 0x44
LegoNotifyList m_notifyList; // 0x48
}; };
#endif // LEGOCONTROLMANAGER_H #endif // LEGOCONTROLMANAGER_H

View file

@ -39,6 +39,10 @@ class LegoEventNotificationParam : public MxNotificationParam {
inline MxS32 GetY() const { return m_y; } inline MxS32 GetY() const { return m_y; }
inline void SetROI(LegoROI* p_roi) { m_roi = p_roi; } 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: protected:
MxU8 m_modifier; // 0x0c MxU8 m_modifier; // 0x0c

View file

@ -12,6 +12,9 @@
class LegoControlManager; class LegoControlManager;
extern MxS32 g_unk0x100f31b0;
extern const char* g_unk0x100f31b4;
// VTABLE: LEGO1 0x100d87b8 // VTABLE: LEGO1 0x100d87b8
// class MxCollection<LegoEventNotificationParam> // class MxCollection<LegoEventNotificationParam>
@ -171,6 +174,9 @@ class LegoInputManager : public MxPresenter {
// SYNTHETIC: LEGO1 0x10028b30 // SYNTHETIC: LEGO1 0x10028b30
// MxPtrList<MxCore>::`scalar deleting destructor' // MxPtrList<MxCore>::`scalar deleting destructor'
// FUNCTION: LEGO1 0x10028ba0
// LegoNotifyList::~LegoNotifyList
// SYNTHETIC: LEGO1 0x10028fd0 // SYNTHETIC: LEGO1 0x10028fd0
// LegoNotifyListCursor::`scalar deleting destructor' // LegoNotifyListCursor::`scalar deleting destructor'

View file

@ -26,7 +26,7 @@ class Motocycle : public IslePathActor {
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual void VTable0x70(float p_float) override; // vtable+0x70 virtual void VTable0x70(float p_float) override; // vtable+0x70
virtual MxU32 VTable0xcc() override; // vtable+0xcc 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&) override; // vtable+0xdc virtual MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc
virtual void VTable0xe4() override; // vtable+0xe4 virtual void VTable0xe4() override; // vtable+0xe4

View file

@ -4,6 +4,8 @@
#include "decomp.h" #include "decomp.h"
#include "mxcompositepresenter.h" #include "mxcompositepresenter.h"
class LegoControlManagerEvent;
// VTABLE: LEGO1 0x100d7b88 // VTABLE: LEGO1 0x100d7b88
// SIZE 0x5c // SIZE 0x5c
class MxControlPresenter : public MxCompositePresenter { class MxControlPresenter : public MxCompositePresenter {
@ -34,11 +36,12 @@ class MxControlPresenter : public MxCompositePresenter {
virtual void Enable(MxBool p_enable) override; // vtable+0x54 virtual void Enable(MxBool p_enable) override; // vtable+0x54
virtual MxBool VTable0x64(undefined4 p_undefined) override; // vtable+0x64 virtual MxBool VTable0x64(undefined4 p_undefined) override; // vtable+0x64
virtual void VTable0x68(MxBool p_unk0x50); // vtable+0x68 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: private:
MxBool FUN_10044270(undefined4, undefined4, undefined4*); MxBool FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter);
MxBool FUN_10044480(undefined4, undefined4*);
void FUN_10044540(undefined2); void FUN_10044540(undefined2);
undefined2 m_unk0x4c; // 0x4c undefined2 m_unk0x4c; // 0x4c
@ -46,6 +49,7 @@ class MxControlPresenter : public MxCompositePresenter {
MxBool m_unk0x50; // 0x50 MxBool m_unk0x50; // 0x50
undefined2 m_unk0x52; // 0x52 undefined2 m_unk0x52; // 0x52
undefined2 m_unk0x54; // 0x54 undefined2 m_unk0x54; // 0x54
undefined2 m_unk0x56; // 0x56
MxS16* m_unk0x58; // 0x58 MxS16* m_unk0x58; // 0x58
}; };

View file

@ -1,10 +1,10 @@
#ifndef SCORE_H #ifndef SCORE_H
#define SCORE_H #define SCORE_H
#include "legocontrolmanager.h"
#include "legoeventnotificationparam.h" #include "legoeventnotificationparam.h"
#include "legoworld.h" #include "legoworld.h"
#include "mxactionnotificationparam.h" #include "mxactionnotificationparam.h"
#include "mxtype17notificationparam.h"
#include "scorestate.h" #include "scorestate.h"
// VTABLE: LEGO1 0x100d4018 // VTABLE: LEGO1 0x100d4018
@ -39,7 +39,7 @@ class Score : public LegoWorld {
void Paint(); void Paint();
MxLong FUN_10001510(MxEndActionNotificationParam& p_param); 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); void FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color);
protected: protected:

View file

@ -26,7 +26,7 @@ class SkateBoard : public IslePathActor {
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual MxU32 VTable0xcc() override; // vtable+0xcc virtual MxU32 VTable0xcc() override; // vtable+0xcc
virtual MxU32 VTable0xd0() override; // vtable+0xd0 virtual MxU32 VTable0xd0() override; // vtable+0xd0
virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4 virtual MxU32 VTable0xd4(LegoControlManagerEvent& p_param) override; // vtable+0xd4
virtual void VTable0xe4() override; // vtable+0xe4 virtual void VTable0xe4() override; // vtable+0xe4
// SYNTHETIC: LEGO1 0x1000ff60 // SYNTHETIC: LEGO1 0x1000ff60

View file

@ -27,7 +27,7 @@ class TowTrack : public IslePathActor {
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual void VTable0x70(float p_float) override; // vtable+0x70 virtual void VTable0x70(float p_float) override; // vtable+0x70
virtual MxU32 VTable0xcc() override; // vtable+0xcc 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 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8
virtual MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc virtual MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc
virtual void VTable0xe4() override; // vtable+0xe4 virtual void VTable0xe4() override; // vtable+0xe4

View file

@ -38,7 +38,7 @@ MxU32 DuneBuggy::VTable0xcc()
} }
// STUB: LEGO1 0x100681b0 // STUB: LEGO1 0x100681b0
MxU32 DuneBuggy::VTable0xd4(MxType17NotificationParam& p_param) MxU32 DuneBuggy::VTable0xd4(LegoControlManagerEvent& p_param)
{ {
// TODO // TODO
return 0; return 0;

View file

@ -123,7 +123,7 @@ MxU32 Helicopter::VTable0xcc()
} }
// FUNCTION: LEGO1 0x100035e0 // FUNCTION: LEGO1 0x100035e0
MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param) MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
{ {
MxU32 ret = 0; MxU32 ret = 0;
MxAtomId script; MxAtomId script;
@ -138,8 +138,8 @@ MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param)
script = *g_act3Script; script = *g_act3Script;
break; break;
} }
if (p_param.GetUnknown28() == 1) { if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetUnknown20()) { switch (p_param.GetClickedObjectId()) {
case 0x17: case 0x17:
if (*g_act3Script == script) { if (*g_act3Script == script) {
((Act3*) GetCurrentWorld())->SetUnkown4270(2); ((Act3*) GetCurrentWorld())->SetUnkown4270(2);

View file

@ -37,7 +37,7 @@ MxU32 Jetski::VTable0xcc()
} }
// STUB: LEGO1 0x1007e8e0 // STUB: LEGO1 0x1007e8e0
MxU32 Jetski::VTable0xd4(MxType17NotificationParam& p_param) MxU32 Jetski::VTable0xd4(LegoControlManagerEvent& p_param)
{ {
// TODO // TODO
return 0; return 0;

View file

@ -1,44 +1,118 @@
#include "legocontrolmanager.h" #include "legocontrolmanager.h"
#include "legoeventnotificationparam.h" #include "legoeventnotificationparam.h"
#include "mxcontrolpresenter.h"
#include "mxpresenter.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() 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() LegoControlManager::~LegoControlManager()
{ {
// TODO TickleManager()->UnregisterClient(this);
} }
// STUB: LEGO1 0x10028df0 // FUNCTION: LEGO1 0x10028df0
void LegoControlManager::FUN_10028df0(MxPresenterList* p_presenterList) 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) void LegoControlManager::Register(MxCore* p_listener)
{ {
// TODO m_notifyList.Append(p_listener);
} }
// STUB: LEGO1 0x10028ea0 // FUNCTION: LEGO1 0x10028ea0
void LegoControlManager::Unregister(MxCore* p_listener) 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) MxBool LegoControlManager::FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter)
{ {
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; 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 // 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() 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; 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;
}

View file

@ -1,6 +1,7 @@
#include "mxcontrolpresenter.h" #include "mxcontrolpresenter.h"
#include "define.h" #include "define.h"
#include "legocontrolmanager.h"
#include "mxticklemanager.h" #include "mxticklemanager.h"
#include "mxutil.h" #include "mxutil.h"
@ -99,21 +100,45 @@ void MxControlPresenter::EndAction()
} }
// STUB: LEGO1 0x10044270 // STUB: LEGO1 0x10044270
MxBool MxControlPresenter::FUN_10044270(undefined4, undefined4, undefined4*) MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter)
{ {
// TODO // TODO
return TRUE; return TRUE;
} }
// STUB: LEGO1 0x10044480 // FUNCTION: LEGO1 0x10044480
MxBool MxControlPresenter::FUN_10044480(undefined4, undefined4*) MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter)
{ {
// TODO 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; 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 // STUB: LEGO1 0x10044540
void MxControlPresenter::VTable0x6c(undefined4) void MxControlPresenter::VTable0x6c(undefined2)
{ {
// TODO // TODO
} }

View file

@ -67,7 +67,7 @@ void Ambulance::VTable0xe4()
} }
// STUB: LEGO1 0x10036f90 // STUB: LEGO1 0x10036f90
MxU32 Ambulance::VTable0xd4(MxType17NotificationParam& p_param) MxU32 Ambulance::VTable0xd4(LegoControlManagerEvent& p_param)
{ {
// TODO // TODO
return 0; return 0;

View file

@ -92,7 +92,7 @@ MxLong Score::Notify(MxParam& p_param)
ret = 1; ret = 1;
break; break;
case c_notificationType17: case c_notificationType17:
ret = FUN_100016d0((MxType17NotificationParam&) p_param); ret = FUN_100016d0((LegoControlManagerEvent&) p_param);
break; break;
case c_notificationTransitioned: case c_notificationTransitioned:
DeleteObjects(g_infoscorScript, 7, 9); DeleteObjects(g_infoscorScript, 7, 9);
@ -152,12 +152,12 @@ void Score::ReadyWorld()
} }
// FUNCTION: LEGO1 0x100016d0 // 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) { if (l == 1 || p_param.GetClickedObjectId() == 4) {
switch (p_param.GetUnknown20()) { switch (p_param.GetClickedObjectId()) {
case 1: case 1:
m_unk0xf8 = 2; m_unk0xf8 = 2;
DeleteScript(); DeleteScript();

View file

@ -15,7 +15,7 @@ DECOMP_SIZE_ASSERT(LegoEventQueue, 0x18)
MxS32 g_unk0x100f31b0 = -1; MxS32 g_unk0x100f31b0 = -1;
// GLOBAL: LEGO1 0x100f31b4 // GLOBAL: LEGO1 0x100f31b4
MxS32 g_unk0x100f31b4 = 0; const char* g_unk0x100f31b4 = NULL;
// FUNCTION: LEGO1 0x1005b790 // FUNCTION: LEGO1 0x1005b790
LegoInputManager::LegoInputManager() LegoInputManager::LegoInputManager()
@ -424,5 +424,5 @@ void LegoInputManager::EnableInputProcessing()
{ {
m_unk0x88 = FALSE; m_unk0x88 = FALSE;
g_unk0x100f31b0 = -1; g_unk0x100f31b0 = -1;
g_unk0x100f31b4 = 0; g_unk0x100f31b4 = NULL;
} }

View file

@ -31,7 +31,7 @@ MxU32 Bike::VTable0xcc()
} }
// STUB: LEGO1 0x10076aa0 // STUB: LEGO1 0x10076aa0
MxU32 Bike::VTable0xd4(MxType17NotificationParam& p_param) MxU32 Bike::VTable0xd4(LegoControlManagerEvent& p_param)
{ {
// TODO // TODO
return 0; return 0;

View file

@ -38,7 +38,7 @@ MxU32 Motocycle::VTable0xcc()
} }
// STUB: LEGO1 0x10035d70 // STUB: LEGO1 0x10035d70
MxU32 Motocycle::VTable0xd4(MxType17NotificationParam& p_param) MxU32 Motocycle::VTable0xd4(LegoControlManagerEvent& p_param)
{ {
// TODO // TODO
return 0; return 0;

View file

@ -38,7 +38,7 @@ MxU32 SkateBoard::VTable0xcc()
} }
// STUB: LEGO1 0x10010230 // STUB: LEGO1 0x10010230
MxU32 SkateBoard::VTable0xd4(MxType17NotificationParam& p_param) MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param)
{ {
// TODO // TODO
return 0; return 0;

View file

@ -64,7 +64,7 @@ void TowTrack::VTable0xe4()
} }
// STUB: LEGO1 0x1004d9e0 // STUB: LEGO1 0x1004d9e0
MxU32 TowTrack::VTable0xd4(MxType17NotificationParam& p_param) MxU32 TowTrack::VTable0xd4(LegoControlManagerEvent& p_param)
{ {
// TODO // TODO
return 0; return 0;

View file

@ -49,6 +49,7 @@ class MxNotificationParam : public MxParam {
inline NotificationId GetType() const { return m_type; } inline NotificationId GetType() const { return m_type; }
inline void SetType(NotificationId p_type) { m_type = p_type; } inline void SetType(NotificationId p_type) { m_type = p_type; }
inline void SetSender(MxCore* p_sender) { m_sender = p_sender; }
protected: protected:
NotificationId m_type; // 0x04 NotificationId m_type; // 0x04

View file

@ -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

View file

@ -1,3 +0,0 @@
#include "mxtype17notificationparam.h"
DECOMP_SIZE_ASSERT(MxType17NotificationParam, 0x2c)