From 51520aaae6827cba51a316fd4ec94b6eed26938c Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Fri, 23 Feb 2024 12:51:49 -0500 Subject: [PATCH] LegoActor: destructor, SetROI (#588) * LegoActor: destructor, SetROI * Fixes --------- Co-authored-by: Christian Semmler --- LEGO1/lego/legoomni/include/legoactor.h | 14 +++++++--- LEGO1/lego/legoomni/src/entity/legoactor.cpp | 27 ++++++++++++++++---- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 0f048619..114bf4bb 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -2,6 +2,7 @@ #define LEGOACTOR_H #include "decomp.h" +#include "legocachesound.h" #include "legoentity.h" // VTABLE: LEGO1 0x100d6d68 @@ -29,22 +30,27 @@ class LegoActor : public LegoEntity { // FUNCTION: LEGO1 0x10002cc0 virtual MxFloat VTable0x50() { return m_unk0x68; } // vtable+0x50 + // FUNCTION: LEGO1 0x10002cd0 virtual void VTable0x54(MxFloat p_unk0x68) { m_unk0x68 = p_unk0x68; } // vtable+0x54 + // FUNCTION: LEGO1 0x10002ce0 virtual void VTable0x58(MxFloat p_unk0x70) { m_unk0x70 = p_unk0x70; } // vtable+0x58 + // FUNCTION: LEGO1 0x10002cf0 virtual MxFloat VTable0x5c() { return m_unk0x70; } // vtable+0x5c + // FUNCTION: LEGO1 0x10002d00 virtual MxU8 VTable0x60() { return m_unk0x74; } // vtable+0x60 + // FUNCTION: LEGO1 0x10002d10 virtual void VTable0x64(MxU8 p_unk0x74) { m_unk0x74 = p_unk0x74; } // vtable+0x64 private: - MxFloat m_unk0x68; // 0x68 - undefined4 m_unk0x6c; // 0x6c - MxFloat m_unk0x70; // 0x70 - MxU8 m_unk0x74; // 0x74 + MxFloat m_unk0x68; // 0x68 + LegoCacheSound* m_sound; // 0x6c + MxFloat m_unk0x70; // 0x70 + MxU8 m_unk0x74; // 0x74 }; // SYNTHETIC: LEGO1 0x1002d300 diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 5c18b9d3..4fc0daa2 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -2,20 +2,25 @@ DECOMP_SIZE_ASSERT(LegoActor, 0x78) +// GLOBAL: LEGO1 0x100f32d0 +const char* g_unk0x100f32d0[] = {"none", "pepper", "mama", "papa", "nick", "laura", "The_Brickster!"}; + // FUNCTION: LEGO1 0x1002d110 LegoActor::LegoActor() { m_unk0x68 = 0.0f; - m_unk0x6c = 0; + m_sound = NULL; m_unk0x70 = 0.0f; m_unk0x10 = 0; m_unk0x74 = 0; } -// STUB: LEGO1 0x1002d320 +// FUNCTION: LEGO1 0x1002d320 LegoActor::~LegoActor() { - // TODO + if (m_sound) { + m_sound->FUN_10006b80(); + } } // STUB: LEGO1 0x1002d390 @@ -24,8 +29,20 @@ void LegoActor::ParseAction(char*) // TODO } -// STUB: LEGO1 0x1002d670 +// FUNCTION: LEGO1 0x1002d670 void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) { - // TODO + if (p_roi) { + const char* name = p_roi->GetName(); + + for (MxU32 i = 1; i <= _countof(g_unk0x100f32d0) - 1; i++) { + if (!strcmpi(name, g_unk0x100f32d0[i])) { + m_unk0x59 = 0; + m_unk0x74 = i; + break; + } + } + } + + LegoEntity::SetROI(p_roi, p_bool1, p_bool2); }