From ac19539d0f198fa87c764cce4f2a03053a7ca46b Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 11 Dec 2024 13:13:34 -0700 Subject: [PATCH] Implement/match `Act3Shark` functions (#1208) * Implement/match `Act3Shark` functions * Naming --- LEGO1/lego/legoomni/include/act3.h | 1 + LEGO1/lego/legoomni/include/act3ammo.h | 13 ++++- LEGO1/lego/legoomni/include/act3shark.h | 29 +++++++---- LEGO1/lego/legoomni/src/actors/act3shark.cpp | 53 +++++++++++++++++--- 4 files changed, 77 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index a8bfb77e..3172ea9d 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -110,6 +110,7 @@ class Act3 : public LegoWorld { void Enable(MxBool p_enable) override; // vtable+0x68 void SetHelicopter(Helicopter* p_copter) { m_copter = p_copter; } + void SetShark(Act3Shark* p_shark) { m_shark = p_shark; } void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } // SYNTHETIC: LEGO1 0x10072630 diff --git a/LEGO1/lego/legoomni/include/act3ammo.h b/LEGO1/lego/legoomni/include/act3ammo.h index 122618cd..4cd45d7a 100644 --- a/LEGO1/lego/legoomni/include/act3ammo.h +++ b/LEGO1/lego/legoomni/include/act3ammo.h @@ -14,7 +14,8 @@ class Act3Ammo : public LegoPathActor { c_pizza = 0x01, c_donut = 0x02, c_valid = 0x04, - c_bit4 = 0x08 + c_bit4 = 0x08, + c_bit5 = 0x10 }; Act3Ammo(); @@ -57,6 +58,16 @@ class Act3Ammo : public LegoPathActor { } } + void SetBit5(MxBool p_bit5) + { + if (p_bit5) { + m_ammoFlag |= c_bit5; + } + else { + m_ammoFlag &= ~c_bit5; + } + } + MxFloat GetUnknown0x158() { return m_unk0x158; } void SetUnknown0x158(MxFloat p_unk0x158) { m_unk0x158 = p_unk0x158; } diff --git a/LEGO1/lego/legoomni/include/act3shark.h b/LEGO1/lego/legoomni/include/act3shark.h index f43f76bd..8ced3595 100644 --- a/LEGO1/lego/legoomni/include/act3shark.h +++ b/LEGO1/lego/legoomni/include/act3shark.h @@ -3,6 +3,9 @@ #include "legoanimactor.h" +class Act3; +class Act3Ammo; + // VTABLE: LEGO1 0x100d7920 LegoPathActor // VTABLE: LEGO1 0x100d79f0 LegoAnimActor // SIZE 0x1a8 @@ -21,7 +24,7 @@ class Act3Shark : public LegoAnimActor { void VTable0x70(float p_time) override; // vtable+0x70 // LegoAnimActor vtable - virtual MxResult FUN_10042ce0(void*); // vtable+0x10 + virtual MxResult FUN_10042ce0(Act3Ammo* p_ammo); // vtable+0x10 MxFloat GetUnknown0x2c() { return m_unk0x2c; } @@ -31,16 +34,22 @@ class Act3Shark : public LegoAnimActor { // Act3Shark::`scalar deleting destructor' private: - list m_unk0x1c; // 0x1c - undefined4 m_unk0x28; // 0x28 - MxFloat m_unk0x2c; // 0x2c - undefined m_unk0x30[0x0c]; // 0x30 - Mx3DPointFloat m_unk0x3c; // 0x3c + list m_unk0x1c; // 0x1c + undefined4 m_unk0x28; // 0x28 + MxFloat m_unk0x2c; // 0x2c + Act3* m_a3; // 0x30 + LegoAnimActorStruct* m_unk0x34; // 0x34 + LegoROI* m_unk0x38; // 0x38 + Mx3DPointFloat m_unk0x3c; // 0x3c }; -// STUB: LEGO1 0x10042c90 -// List::~List -// TODO: Update once type is known. -// STUB to resolve diff in scalar dtor and not create a new one. +// TEMPLATE: LEGO1 0x10042c20 +// list >::~list > + +// TEMPLATE: LEGO1 0x10042c90 +// List::~List + +// GLOBAL: LEGO1 0x100d7918 +// Act3Shark::`vbtable' #endif // ACT3SHARK_H diff --git a/LEGO1/lego/legoomni/src/actors/act3shark.cpp b/LEGO1/lego/legoomni/src/actors/act3shark.cpp index 67fffcdf..4c8a5bab 100644 --- a/LEGO1/lego/legoomni/src/actors/act3shark.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3shark.cpp @@ -1,17 +1,26 @@ #include "act3shark.h" +#include "act3.h" +#include "act3ammo.h" +#include "define.h" +#include "legolocomotionanimpresenter.h" +#include "misc.h" +#include "mxutilities.h" + DECOMP_SIZE_ASSERT(Act3Shark, 0x1a8) -// STUB: LEGO1 0x10042ab0 +// FUNCTION: LEGO1 0x10042ab0 Act3Shark::Act3Shark() { - // TODO + m_unk0x2c = 0.0f; + m_unk0x28 = 0; } -// STUB: LEGO1 0x10042ce0 -MxResult Act3Shark::FUN_10042ce0(void*) +// FUNCTION: LEGO1 0x10042ce0 +MxResult Act3Shark::FUN_10042ce0(Act3Ammo* p_ammo) { - // TODO + p_ammo->SetBit5(TRUE); + m_unk0x1c.push_back(p_ammo); return SUCCESS; } @@ -21,8 +30,36 @@ void Act3Shark::VTable0x70(float p_time) // TODO } -// STUB: LEGO1 0x10042f30 -void Act3Shark::ParseAction(char*) +// FUNCTION: LEGO1 0x10042f30 +void Act3Shark::ParseAction(char* p_extra) { - // TODO + LegoPathActor::ParseAction(p_extra); + + m_a3 = (Act3*) CurrentWorld(); + + char value[256]; + if (KeyValueStringParse(value, g_strANIMATION, p_extra)) { + char* token = strtok(value, g_parseExtraTokens); + + while (token != NULL) { + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) m_a3->Find("LegoAnimPresenter", token); + + if (presenter != NULL) { + token = strtok(NULL, g_parseExtraTokens); + + if (token != NULL) { + presenter->FUN_1006d680(this, atof(token)); + } + } + + token = strtok(NULL, g_parseExtraTokens); + } + } + + m_a3->SetShark(this); + m_unk0x34 = m_animMaps[0]; + m_unk0x38 = m_unk0x34->m_roiMap[1]; + m_unk0x38->SetVisibility(FALSE); + m_a3->PlaceActor(this); }