From 3bc43ed1213279cd15e6ba8c568cc030bea5743e Mon Sep 17 00:00:00 2001 From: jonschz Date: Sun, 28 Apr 2024 06:35:07 +0200 Subject: [PATCH] Address review comments --- .../legoomni/include/legocontrolmanager.h | 7 ++-- LEGO1/lego/legoomni/include/pizza.h | 6 ++-- LEGO1/lego/legoomni/include/skateboard.h | 8 ++--- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 33 +++++++++++-------- 4 files changed, 25 insertions(+), 29 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index e0c1dbf5..46719167 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -26,13 +26,10 @@ class LegoControlManagerEvent : public LegoEventNotificationParam { inline void SetClickedAtom(const char* p_clickedAtom) { m_clickedAtom = p_clickedAtom; } inline void SetUnknown0x28(MxS16 p_unk0x28) { m_unk0x28 = p_unk0x28; } - MxS32 m_clickedObjectId; // 0x20 - private: + MxS32 m_clickedObjectId; // 0x20 const char* m_clickedAtom; // 0x24 - -public: - MxS16 m_unk0x28; // 0x28 + MxS16 m_unk0x28; // 0x28 }; // SYNTHETIC: LEGO1 0x10028bf0 diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 54fa8ccc..15e34af2 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -34,17 +34,15 @@ class Pizza : public IsleActor { void FUN_100382b0(); void FUN_10038380(); + inline void SetUnknown0x84(undefined* p_unk0x84) { m_unk0x84 = p_unk0x84; } + // SYNTHETIC: LEGO1 0x100380e0 // Pizza::`scalar deleting destructor' private: undefined4 m_unk0x7c; // 0x7c undefined4 m_unk0x80; // 0x80 - -public: undefined* m_unk0x84; // 0x84 - -private: undefined4 m_unk0x88; // 0x88 undefined4 m_unk0x8c; // 0x8c undefined4 m_unk0x90; // 0x90 diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 3696a3d8..dc567b9f 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -36,12 +36,8 @@ class SkateBoard : public IslePathActor { // SkateBoard::`scalar deleting destructor' private: - // TODO: SkateBoard types - undefined m_unk0x160; - undefined m_unk0x161; - undefined m_unk0x162; - undefined m_unk0x163; - undefined* m_unk0x164; + undefined m_unk0x160; // 0x160 + undefined* m_unk0x164; // 0x164 }; #endif // SKATEBOARD_H diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 2902a951..93d29c00 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -1,6 +1,7 @@ #include "skateboard.h" #include "decomp.h" +#include "isle_actions.h" #include "legoutils.h" #include "misc.h" #include "mxmisc.h" @@ -12,10 +13,10 @@ DECOMP_SIZE_ASSERT(SkateBoard, 0x168) // FUNCTION: LEGO1 0x1000fd40 SkateBoard::SkateBoard() { - this->m_unk0x160 = 0; - this->m_unk0x13c = 15.0; - this->m_unk0x150 = 3.5; - this->m_unk0x148 = 1; + m_unk0x160 = 0; + m_unk0x13c = 15.0; + m_unk0x150 = 3.5; + m_unk0x148 = 1; NotificationManager()->Register(this); } @@ -31,15 +32,17 @@ SkateBoard::~SkateBoard() MxResult SkateBoard::Create(MxDSAction& p_dsAction) { MxResult result = IslePathActor::Create(p_dsAction); + if (result == SUCCESS) { - this->m_world = CurrentWorld(); - this->m_world->Add(this); + m_world = CurrentWorld(); + m_world->Add(this); // The type `Pizza` is an educated guesss, inferred from VTable0xe4() below - Pizza* findResult = (Pizza*) CurrentWorld()->Find(*g_isleScript, 0x49d); + Pizza* findResult = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); if (findResult) { - findResult->m_unk0x84 = (undefined*) this; + findResult->SetUnknown0x84((undefined*) this); } } + return result; } @@ -47,16 +50,16 @@ MxResult SkateBoard::Create(MxDSAction& p_dsAction) void SkateBoard::VTable0xe4() { // TODO: Work out what kind of structure this points to - if (*(int*) (this->m_unk0x164 + 0x18) == 3) { - Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, 0x49d); + if (*(int*) (m_unk0x164 + 0x18) == 3) { + Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); pizza->FUN_10038380(); pizza->FUN_100382b0(); - this->m_unk0x160 = 0; + m_unk0x160 = 0; } IslePathActor::VTable0xe4(); GameState()->m_currentArea = LegoGameState::Area::e_skateboard; - RemoveFromCurrentWorld(*g_isleScript, 0xc3); - RemoveFromCurrentWorld(*g_isleScript, 0xc2); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkateArms_Ctl); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkatePizza_Bitmap); ControlManager()->Unregister(this); } @@ -71,11 +74,13 @@ MxU32 SkateBoard::VTable0xcc() MxU32 SkateBoard::VTable0xd4(LegoControlManagerEvent& p_param) { MxU32 result = 0; - if (p_param.m_unk0x28 == 1 && p_param.m_clickedObjectId == 0xc3) { + + if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == 0xc3) { VTable0xe4(); GameState()->m_currentArea = LegoGameState::Area::e_unk66; result = 1; } + return result; }