From 8cbb094b754eba504bee615267864fe0df391333 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Thu, 11 Apr 2024 07:55:22 -0400 Subject: [PATCH] IsleActor::Create, IsleActor::Notify (#779) * IsleActor::Create, IsleActor::Notify * fix pizzeria vtable * clang-format * fix pizza vtable * fix annotation * refactor, add annotations --------- Co-authored-by: Christian Semmler --- LEGO1/lego/legoomni/include/isleactor.h | 28 +++++++++- LEGO1/lego/legoomni/include/pizza.h | 22 ++++---- LEGO1/lego/legoomni/include/pizzeria.h | 3 +- LEGO1/lego/legoomni/src/actors/isleactor.cpp | 55 +++++++++++++++++--- LEGO1/lego/legoomni/src/actors/pizza.cpp | 21 ++++++++ LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 7 +++ 6 files changed, 116 insertions(+), 20 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isleactor.h b/LEGO1/lego/legoomni/include/isleactor.h index 5ddf79ac..6e337454 100644 --- a/LEGO1/lego/legoomni/include/isleactor.h +++ b/LEGO1/lego/legoomni/include/isleactor.h @@ -2,9 +2,11 @@ #define ISLEACTOR_H #include "legoactor.h" +#include "legoworld.h" +#include "mxactionnotificationparam.h" // VTABLE: LEGO1 0x100d5178 -// SIZE 0x78 +// SIZE 0x7c class IsleActor : public LegoActor { public: MxLong Notify(MxParam& p_param) override; // vtable+0x04 @@ -23,6 +25,30 @@ class IsleActor : public LegoActor { } MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + + // FUNCTION: LEGO1 0x1000e5f0 + virtual undefined4 VTable0x68() { return 0; } // vtable+0x68 + + // FUNCTION: LEGO1 0x1000e600 + virtual undefined4 VTable0x6c() { return 0; } // vtable+0x6c + + // FUNCTION: LEGO1 0x1000e610 + virtual undefined4 VTable0x70() { return 0; } // vtable+0x70 + + // FUNCTION: LEGO1 0x1000e620 + virtual undefined4 HandleEndAction(MxEndActionNotificationParam&) { return 0; } // vtable+0x74 + + // FUNCTION: LEGO1 0x1000e630 + virtual undefined4 HandleButtonDown(MxNotificationParam&) { return 0; } // vtable+0x78 + + // FUNCTION: LEGO1 0x1000e640 + virtual undefined4 HandleButtonUp(MxNotificationParam&) { return 0; } // vtable+0x7c + + // FUNCTION: LEGO1 0x1000e650 + virtual undefined4 VTable0x80(MxParam&) { return 0; } // vtable+0x80 + +private: + LegoWorld* m_world; // 0x78 }; // SYNTHETIC: LEGO1 0x1000e940 diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 1b67bc6d..7884334d 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -26,21 +26,23 @@ class Pizza : public IsleActor { return !strcmp(p_name, Pizza::ClassName()) || IsleActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + undefined4 VTable0x68() override; // vtable+0x68 + undefined4 HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 + undefined4 VTable0x80(MxParam&) override; // vtable+0x80 // SYNTHETIC: LEGO1 0x100380e0 // Pizza::`scalar deleting destructor' private: - undefined4 m_unk0x78; - undefined4 m_unk0x7c; - undefined4 m_unk0x80; - undefined4 m_unk0x84; - undefined4 m_unk0x88; - undefined4 m_unk0x8c; - undefined4 m_unk0x90; - undefined4 m_unk0x94; - undefined m_unk0x98; + undefined4 m_unk0x7c; // 0x7c + undefined4 m_unk0x80; // 0x80 + undefined4 m_unk0x84; // 0x84 + undefined4 m_unk0x88; // 0x88 + undefined4 m_unk0x8c; // 0x8c + undefined4 m_unk0x90; // 0x90 + undefined4 m_unk0x94; // 0x94 + undefined m_unk0x98; // 0x98 }; #endif // PIZZA_H diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index ca09d7dc..e4de7b6c 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -1,6 +1,7 @@ #ifndef PIZZERIA_H #define PIZZERIA_H +#include "decomp.h" #include "isleactor.h" // VTABLE: LEGO1 0x100d5520 @@ -23,12 +24,12 @@ class Pizzeria : public IsleActor { } MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + undefined4 VTable0x68() override; // vtable+0x68 // SYNTHETIC: LEGO1 0x1000e8d0 // Pizzeria::`scalar deleting destructor' private: - undefined4 m_unk0x78; // 0x78 undefined4 m_unk0x7c; // 0x7c undefined4 m_unk0x80; // 0x80 }; diff --git a/LEGO1/lego/legoomni/src/actors/isleactor.cpp b/LEGO1/lego/legoomni/src/actors/isleactor.cpp index b6ac3556..7d8dae64 100644 --- a/LEGO1/lego/legoomni/src/actors/isleactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/isleactor.cpp @@ -1,18 +1,57 @@ #include "isleactor.h" -// NOTE: This is copied from base class LegoActor. IsleActor may in fact be larger but we don't know yet. -DECOMP_SIZE_ASSERT(IsleActor, 0x78) +#include "legoentity.h" +#include "legoomni.h" +#include "legoworld.h" +#include "misc.h" +#include "mxnotificationparam.h" -// STUB: LEGO1 0x1002c780 +DECOMP_SIZE_ASSERT(IsleActor, 0x7c) + +// FUNCTION: LEGO1 0x1002c780 MxResult IsleActor::Create(MxDSAction& p_dsAction) { - // TODO - return SUCCESS; + MxResult ret = LegoEntity::Create(p_dsAction); + + if (ret == SUCCESS) { + m_world = CurrentWorld(); + + if (!m_world) { + ret = FAILURE; + } + } + + return ret; } -// STUB: LEGO1 0x1002c7b0 +// FUNCTION: LEGO1 0x1002c7b0 MxLong IsleActor::Notify(MxParam& p_param) { - // TODO - return 0; + MxLong result = 0; + + switch (((MxNotificationParam&) p_param).GetNotification()) { + case c_notificationType0: + result = VTable0x6c(); + break; + case c_notificationEndAction: + result = HandleEndAction((MxEndActionNotificationParam&) p_param); + break; + case c_notificationButtonUp: + result = HandleButtonUp((MxNotificationParam&) p_param); + break; + case c_notificationButtonDown: + result = HandleButtonDown((MxNotificationParam&) p_param); + break; + case c_notificationType11: + result = VTable0x68(); + break; + case c_notificationType18: + result = VTable0x70(); + break; + case c_notificationType19: + result = VTable0x80(p_param); + break; + } + + return result; } diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index e21effe1..6a16c580 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -30,9 +30,30 @@ MxResult Pizza::Create(MxDSAction& p_dsAction) return SUCCESS; } +// STUB: LEGO1 0x100383f0 +undefined4 Pizza::VTable0x68() +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x100384f0 +undefined4 Pizza::VTable0x80(MxParam&) +{ + // TODO + return 0; +} + // STUB: LEGO1 0x100388a0 MxResult Pizza::Tickle() { // TODO return SUCCESS; } + +// STUB: LEGO1 0x10038b10 +undefined4 Pizza::HandleEndAction(MxEndActionNotificationParam&) +{ + // TODO + return 0; +} diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index b8c47e36..ce35f634 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -8,3 +8,10 @@ MxResult Pizzeria::Create(MxDSAction& p_dsAction) // TODO return SUCCESS; } + +// STUB: LEGO1 0x10017a50 +undefined4 Pizzeria::VTable0x68() +{ + // TODO + return 0; +}