From e3ccf166289620a4331b371c2afd577ed8fb8062 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 4 Feb 2024 12:21:50 -0500 Subject: [PATCH] Implement/match remaining LegoWorld functions --- LEGO1/lego/legoomni/include/legoomni.h | 2 +- .../legoomni/include/legopathcontroller.h | 6 +++++ LEGO1/lego/legoomni/include/legoworld.h | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 26 +++++++++++++++---- LEGO1/lego/legoomni/src/main/legoomni.cpp | 2 +- .../legoomni/src/paths/legopathcontroller.cpp | 12 +++++++++ 6 files changed, 42 insertions(+), 8 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index ff973f95..8e787b28 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -71,7 +71,7 @@ class LegoOmni : public MxOmni { void CreateBackgroundAudio(); void RemoveWorld(const MxAtomId&, MxLong); - static int GetCurrPathInfo(LegoPathBoundary**, MxS32&); + static MxS32 GetCurrPathInfo(LegoPathBoundary**, MxS32&); static void CreateInstance(); static LegoOmni* GetInstance(); diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 4ad0b03f..d812733e 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -1,8 +1,12 @@ #ifndef LEGOPATHCONTROLLER_H #define LEGOPATHCONTROLLER_H +#include "decomp.h" #include "mxcore.h" +class IslePathActor; +class LegoPathBoundary; + // VTABLE: LEGO1 0x100d7d60 // SIZE 0x40 class LegoPathController : public MxCore { @@ -32,6 +36,8 @@ class LegoPathController : public MxCore { virtual void Destroy(); // vtable+0x18 void Enable(MxBool p_enable); + undefined4 FUN_10046770(IslePathActor* p_actor); + MxS32 FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value); }; #endif // LEGOPATHCONTROLLER_H diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 98dbbd5c..bd07ddc5 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -70,7 +70,7 @@ class LegoWorld : public LegoEntity { MxBool PresentersPending(); void Remove(MxCore* p_object); void FUN_1001fc80(IslePathActor* p_actor); - MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); + MxResult GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); MxCore* Find(const char* p_class, const char* p_name); MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId); diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index f9c0b63c..ee9d8231 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -265,16 +265,32 @@ LegoCameraController* LegoWorld::VTable0x54() return m_cameraController; } -// STUB: LEGO1 0x1001fc80 +// FUNCTION: LEGO1 0x1001fc80 void LegoWorld::FUN_1001fc80(IslePathActor* p_actor) { + LegoPathControllerListCursor cursor(&m_list0x68); + LegoPathController* controller; + + while (cursor.Next(controller)) { + if (!controller->FUN_10046770(p_actor)) { + break; + } + } } -// STUB: LEGO1 0x10020120 -MxS32 LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) +// FUNCTION: LEGO1 0x10020120 +MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) { - // TODO - return 0; + LegoPathControllerListCursor cursor(&m_list0x68); + LegoPathController* controller; + + cursor.Next(controller); + + if (!controller) { + return FAILURE; + } + + return controller->FUN_10046b30(p_path, p_value); } // FUNCTION: LEGO1 0x10020220 diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index 7384da72..17106e9d 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -748,7 +748,7 @@ MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction) MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) { if (::CurrentWorld() == NULL) { - return -1; + return FAILURE; } return ::CurrentWorld()->GetCurrPathInfo(p_path, p_value); diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index f2b4d0bb..84a1f888 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -30,3 +30,15 @@ void LegoPathController::Enable(MxBool p_enable) { // TODO } + +// STUB: LEGO1 0x10046770 +undefined4 LegoPathController::FUN_10046770(IslePathActor* p_actor) +{ + return 0; +} + +// STUB: LEGO1 0x10046b30 +MxS32 LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value) +{ + return 0; +}