From 6c89cd331562e338e03d9c4dd0fad40a74f720b7 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 1 May 2024 07:49:47 -0400 Subject: [PATCH] Minor refactor SkateBoard setter in Pizza (#874) --- LEGO1/lego/legoomni/include/pizza.h | 20 ++++++++++--------- LEGO1/lego/legoomni/src/actors/pizza.cpp | 14 ++++++------- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 8 ++++---- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 15e34af2..bb8c18f7 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -4,6 +4,8 @@ #include "decomp.h" #include "isleactor.h" +class SkateBoard; + // VTABLE: LEGO1 0x100d7380 // SIZE 0x9c class Pizza : public IsleActor { @@ -34,20 +36,20 @@ class Pizza : public IsleActor { void FUN_100382b0(); void FUN_10038380(); - inline void SetUnknown0x84(undefined* p_unk0x84) { m_unk0x84 = p_unk0x84; } + inline void SetSkateboard(SkateBoard* p_skateboard) { m_skateboard = p_skateboard; } // SYNTHETIC: LEGO1 0x100380e0 // Pizza::`scalar deleting destructor' private: - undefined4 m_unk0x7c; // 0x7c - undefined4 m_unk0x80; // 0x80 - undefined* m_unk0x84; // 0x84 - undefined4 m_unk0x88; // 0x88 - undefined4 m_unk0x8c; // 0x8c - undefined4 m_unk0x90; // 0x90 - undefined4 m_unk0x94; // 0x94 - undefined m_unk0x98; // 0x98 + undefined4 m_unk0x7c; // 0x7c + undefined4 m_unk0x80; // 0x80 + SkateBoard* m_skateboard; // 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/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 106ea918..57ab17df 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -8,13 +8,13 @@ DECOMP_SIZE_ASSERT(Pizza, 0x9c) // FUNCTION: LEGO1 0x10037ef0 Pizza::Pizza() { - this->m_unk0x7c = 0; - this->m_unk0x80 = 0; - this->m_unk0x84 = 0; - this->m_unk0x88 = 0; - this->m_unk0x8c = -1; - this->m_unk0x98 = 0; - this->m_unk0x90 = 0x80000000; + m_unk0x7c = 0; + m_unk0x80 = 0; + m_skateboard = NULL; + m_unk0x88 = 0; + m_unk0x8c = -1; + m_unk0x98 = 0; + m_unk0x90 = 0x80000000; } // FUNCTION: LEGO1 0x10038100 diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 825015c0..30f3f218 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -42,10 +42,10 @@ MxResult SkateBoard::Create(MxDSAction& p_dsAction) if (result == SUCCESS) { 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, IsleScript::c_Pizza_Actor); - if (findResult) { - findResult->SetUnknown0x84((undefined*) this); + + Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); + if (pizza) { + pizza->SetSkateboard(this); } }