From 4374891ac88293c7621df62b0e5d2b380006aee7 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Fri, 12 Apr 2024 07:02:32 -0400 Subject: [PATCH] Implement IslePathActor::VTable0xe0 & VTable0xec (#788) * Implement IslePathActor::VTable0xe0 & VTable0xec * Revert random change --- LEGO1/lego/legoomni/include/islepathactor.h | 16 ++--- .../lego/legoomni/include/legonavcontroller.h | 6 ++ LEGO1/lego/legoomni/include/legoutils.h | 1 + .../legoomni/src/actors/islepathactor.cpp | 59 +++++++++++++++++-- LEGO1/lego/legoomni/src/common/legoutils.cpp | 6 ++ 5 files changed, 77 insertions(+), 11 deletions(-) diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index d4f572fa..67b1b320 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -51,10 +51,10 @@ class IslePathActor : public LegoPathActor { // FUNCTION: LEGO1 0x10002e00 virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc - virtual void VTable0xe0(); // vtable+0xe0 - virtual void VTable0xe4(); // vtable+0xe4 - virtual void VTable0xe8(LegoGameState::Area, MxBool, MxU8); // vtable+0xe8 - virtual void VTable0xec(MxMatrix, LegoPathBoundary*, MxBool); // vtable+0xec + virtual void VTable0xe0(); // vtable+0xe0 + virtual void VTable0xe4(); // vtable+0xe4 + virtual void VTable0xe8(LegoGameState::Area, MxBool, MxU8); // vtable+0xe8 + virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); // SYNTHETIC: LEGO1 0x10002ff0 // IslePathActor::`scalar deleting destructor' @@ -62,10 +62,12 @@ class IslePathActor : public LegoPathActor { inline void SetWorld(LegoWorld* p_world) { m_world = p_world; } inline LegoWorld* GetWorld() { return m_world; } + void FUN_1001b660(); + protected: - LegoWorld* m_world; // 0x154 - MxFloat m_unk0x158; // 0x158 - MxFloat m_unk0x15c; // 0x15c + LegoWorld* m_world; // 0x154 + IslePathActor* m_unk0x158; // 0x158 + MxFloat m_unk0x15c; // 0x15c }; #endif // ISLEPATHACTOR_H diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index 9dfc8ccf..ffc98186 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -72,6 +72,12 @@ class LegoNavController : public MxCore { ); static MxResult UpdateCameraLocation(MxU32 p_location); static MxResult UpdateCameraLocation(const char* p_location); + inline MxFloat GetMaxLinearVel() { return m_maxLinearVel; } + inline void ResetLinearVel(MxFloat p_maxLinearVel) + { + m_maxLinearVel = p_maxLinearVel; + m_trackDefault = 0; + } // SYNTHETIC: LEGO1 0x10054c10 // LegoNavController::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index 55b65bea..2272b0f7 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -20,6 +20,7 @@ Extra::ActionType MatchActionString(const char*); void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, MxS32 p_targetEntityId, LegoEntity* p_sender); void SetCameraControllerFromIsle(); void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut); +void FUN_1003eda0(); MxBool RemoveFromCurrentWorld(MxAtomId& p_atomId, MxS32 p_id); void FUN_1003ef00(MxBool); void SetAppCursor(WPARAM p_wparam); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 6b6d540d..faf9709c 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -1,5 +1,9 @@ #include "islepathactor.h" +#include "legoanimationmanager.h" +#include "legonavcontroller.h" +#include "legoutils.h" +#include "misc.h" #include "mxnotificationparam.h" DECOMP_SIZE_ASSERT(IslePathActor, 0x160) @@ -53,10 +57,30 @@ MxLong IslePathActor::Notify(MxParam& p_param) return ret; } -// STUB: LEGO1 0x1001a350 +// FUNCTION: LEGO1 0x1001a350 void IslePathActor::VTable0xe0() { - // TODO + m_roi->SetVisibility(FALSE); + if (CurrentActor() != this) { + m_unk0x15c = NavController()->GetMaxLinearVel(); + m_unk0x158 = CurrentActor(); + if (m_unk0x158) { + m_unk0x158->ResetWorldTransform(FALSE); + m_unk0x158->SetUserNavFlag(FALSE); + } + } + + AnimationManager()->FUN_10061010(0); + if (!m_cameraFlag) { + ResetWorldTransform(TRUE); + SetUserNavFlag(TRUE); + + NavController()->ResetLinearVel(m_unk0x13c); + + SetCurrentActor(this); + FUN_1001b660(); + FUN_10010c30(); + } } // STUB: LEGO1 0x1001a3f0 @@ -71,8 +95,35 @@ void IslePathActor::VTable0xe8(LegoGameState::Area, MxBool, MxU8) // TODO } -// STUB: LEGO1 0x1001b5b0 -void IslePathActor::VTable0xec(MxMatrix, LegoPathBoundary*, MxBool) +// FUNCTION: LEGO1 0x1001b5b0 +void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset) +{ + if (m_world) { + m_world->FUN_1001fc80(this); + m_world->Remove(this); + VideoManager()->Get3DManager()->GetLego3DView()->Remove(*m_roi); + } + + m_world = CurrentWorld(); + if (p_reset) { + VTable0xe0(); + } + + m_world->FUN_1001fa70(this); + p_boundary->AddActor(this); + if (m_actorId != GameState()->GetActorId()) { + m_world->Add(this); + } + + m_roi->FUN_100a58f0(p_transform); + if (m_cameraFlag) { + FUN_1003eda0(); + FUN_10010c30(); + } +} + +// STUB: LEGO1 0x1001b660 +void IslePathActor::FUN_1001b660() { // TODO } diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 86242395..82d3f3d2 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -243,6 +243,12 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO } } +// STUB: LEGO1 0x1003eda0 +void FUN_1003eda0() +{ + // TODO +} + // FUNCTION: LEGO1 0x1003ee00 MxBool RemoveFromCurrentWorld(MxAtomId& p_atomId, MxS32 p_id) {