diff --git a/CMakeLists.txt b/CMakeLists.txt index 3856f024..259ec560 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -376,6 +376,7 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/paths/legopathboundary.cpp LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp + LEGO1/lego/legoomni/src/paths/legopathstruct.cpp LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp LEGO1/lego/legoomni/src/police/policeentity.cpp diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 393ab9ed..6eae5ae6 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -26,6 +26,7 @@ typedef set LegoAnimPresenterSe class LegoPathBoundary : public LegoWEGEdge { public: LegoPathBoundary(); + ~LegoPathBoundary() override; MxResult AddActor(LegoPathActor* p_actor); void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor); @@ -35,7 +36,7 @@ class LegoPathBoundary : public LegoWEGEdge { inline LegoAnimPresenterSet* GetPresenters() { return &m_presenters; } // SYNTHETIC: LEGO1 0x10047a80 - // LegoPathBoundary::`scalar deleting destructor' + // LegoPathBoundary::`vector deleting destructor' private: LegoPathActorSet m_actors; // 0x54 diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 069912d2..7149300b 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -2,20 +2,31 @@ #define LEGOPATHCONTROLLER_H #include "decomp.h" +#include "geom/legounkown100db7f4.h" #include "legopathactor.h" #include "legopathboundary.h" #include "mxcore.h" #include "mxstl/stlcompat.h" class LegoAnimPresenter; +class LegoPathStruct; class LegoWorld; class MxAtomId; class Vector3; -struct LegoPathControllerComparator { - MxBool operator()(const undefined*, const undefined*) const { return 0; } +// VTABLE: LEGO1 0x100d7da8 +// SIZE 0x40 +class LegoPathCtrlEdge : public LegoUnknown100db7f4 {}; + +struct LegoPathCtrlEdgeCompare { + MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const + { + return (MxS32) p_lhs < (MxS32) p_rhs; + } }; +typedef set LegoPathCtrlEdgeSet; + // VTABLE: LEGO1 0x100d7d60 // SIZE 0x40 class LegoPathController : public MxCore { @@ -41,8 +52,8 @@ class LegoPathController : public MxCore { // SYNTHETIC: LEGO1 0x10045740 // LegoPathController::`scalar deleting destructor' - virtual void VTable0x14(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger); // vtable+0x14 - virtual void Destroy(); // vtable+0x18 + virtual void Create(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger); // vtable+0x14 + virtual void Destroy(); // vtable+0x18 MxResult FUN_10045c20( LegoPathActor* p_actor, @@ -61,30 +72,66 @@ class LegoPathController : public MxCore { void FUN_10046bb0(LegoWorld* p_world); private: - LegoPathBoundary* m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - undefined4 m_unk0x10; // 0x10 - undefined4 m_unk0x14; // 0x14 - MxU16 m_numL; // 0x18 - MxU16 m_numE; // 0x1a - MxU16 m_numN; // 0x1c - MxU16 m_numT; // 0x1e - set m_pfsE; // 0x20 - LegoPathActorSet m_actors; // 0x30 + MxResult Read(LegoStorage* p_storage); + MxResult FUN_10047b30(LegoStorage* p_storage); + MxResult FUN_10047c10(LegoStorage* p_storage); + MxResult FUN_10047e90(LegoStorage* p_storage); + static MxResult FUN_100482b0(LegoStorage* p_storage, Mx3DPointFloat&); + + LegoPathBoundary* m_unk0x08; // 0x08 + LegoPathCtrlEdge* m_unk0x0c; // 0x0c + Mx3DPointFloat* m_unk0x10; // 0x10 + LegoPathStruct* m_unk0x14; // 0x14 + MxU16 m_numL; // 0x18 + MxU16 m_numE; // 0x1a + MxU16 m_numN; // 0x1c + MxU16 m_numT; // 0x1e + LegoPathCtrlEdgeSet m_pfsE; // 0x20 + LegoPathActorSet m_actors; // 0x30 }; // clang-format off // TEMPLATE: LEGO1 0x100451a0 -// _Tree >::_Kfn,LegoPathControllerComparator,allocator >::~_Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::~_Tree::~Set +// Set::~Set // TEMPLATE: LEGO1 0x10045830 -// set >::~set > +// set >::~set > + +// TEMPLATE: LEGO1 0x10047550 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Insert + +// TEMPLATE: LEGO1 0x100474e0 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::iterator::_Dec + +// TEMPLATE: LEGO1 0x10047530 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Buynode + +// TEMPLATE: LEGO1 0x100477d0 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Lrotate + +// TEMPLATE: LEGO1 0x10047830 +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Rrotate + +// SYNTHETIC: LEGO1 0x10047940 +// LegoPathCtrlEdge::`vector deleting destructor' + +// SYNTHETIC: LEGO1 0x100479d0 +// LegoPathCtrlEdge::LegoPathCtrlEdge + +// SYNTHETIC: LEGO1 0x10047a30 +// LegoPathCtrlEdge::~LegoPathCtrlEdge + +// SYNTHETIC: LEGO1 0x10047ae0 +// LegoUnknown100db7f4::~LegoUnknown100db7f4 + +// TEMPLATE: LEGO1 0x1004a780 +// _Construct // GLOBAL: LEGO1 0x100f4360 -// _Tree >::_Kfn,LegoPathControllerComparator,allocator >::_Nil +// _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Nil // clang-format on #endif // LEGOPATHCONTROLLER_H diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h new file mode 100644 index 00000000..b85d7d52 --- /dev/null +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -0,0 +1,50 @@ +#ifndef LEGOPATHSTRUCT_H +#define LEGOPATHSTRUCT_H + +#include "decomp.h" +#include "mxatom.h" +#include "mxtypes.h" + +// VTABLE: LEGO1 0x100d7d9c +// SIZE 0x0c +class LegoPathStructBase { +public: + LegoPathStructBase() : m_unk0x04(NULL), m_unk0x08(0) {} + + // FUNCTION: LEGO1 0x10047420 + virtual ~LegoPathStructBase() + { + if (m_unk0x04 != NULL) { + delete m_unk0x04; + } + } + +private: + undefined* m_unk0x04; // 0x04 + undefined4 m_unk0x08; // 0x08 +}; + +// VTABLE: LEGO1 0x100d7da0 +// SIZE 0x14 +class LegoPathStruct : public LegoPathStructBase { +public: + // FUNCTION: LEGO1 0x100473a0 + LegoPathStruct() : m_unk0x0c(0) {} + + // FUNCTION: LEGO1 0x10047470 + ~LegoPathStruct() override {} + + void VTable0x04(undefined4, undefined4, undefined4); // vtable+0x04 + +private: + undefined4 m_unk0x0c; // 0x0c + MxAtomId m_atomId; // 0x10 +}; + +// SYNTHETIC: LEGO1 0x10047440 +// LegoPathStructBase::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x10047890 +// LegoPathStruct::`vector deleting destructor' + +#endif // LEGOPATHSTRUCT_H diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 0da8541d..dc1dc21d 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -8,6 +8,13 @@ DECOMP_SIZE_ASSERT(LegoPathBoundary, 0x74) // STUB: LEGO1 0x10056a70 LegoPathBoundary::LegoPathBoundary() { + // TODO +} + +// STUB: LEGO1 0x10057260 +LegoPathBoundary::~LegoPathBoundary() +{ + // TODO } // FUNCTION: LEGO1 0x100573f0 diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index c3d89b98..3a2cf6ae 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -1,18 +1,21 @@ #include "legopathcontroller.h" +#include "legopathstruct.h" +#include "misc/legostorage.h" #include "mxmisc.h" #include "mxtimer.h" DECOMP_SIZE_ASSERT(LegoPathController, 0x40) +DECOMP_SIZE_ASSERT(LegoPathCtrlEdge, 0x40) // FUNCTION: LEGO1 0x10044f40 // FUNCTION: BETA10 0x100b6860 LegoPathController::LegoPathController() { m_unk0x08 = NULL; - m_unk0x0c = 0; - m_unk0x10 = 0; - m_unk0x14 = 0; + m_unk0x0c = NULL; + m_unk0x10 = NULL; + m_unk0x14 = NULL; m_numL = 0; m_numE = 0; m_numN = 0; @@ -20,7 +23,7 @@ LegoPathController::LegoPathController() } // STUB: LEGO1 0x10045880 -void LegoPathController::VTable0x14(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger) +void LegoPathController::Create(MxU8* p_data, Vector3& p_location, MxAtomId& p_trigger) { // TODO } @@ -118,3 +121,94 @@ void LegoPathController::Enable(MxBool p_enable) { // TODO } + +// FUNCTION: LEGO1 0x10046e50 +// FUNCTION: BETA10 0x100b781f +MxResult LegoPathController::Read(LegoStorage* p_storage) +{ + if (p_storage->Read(&m_numT, sizeof(m_numT)) != SUCCESS) { + return FAILURE; + } + if (m_numT > 0) { + m_unk0x14 = new LegoPathStruct[m_numT]; + } + + if (p_storage->Read(&m_numN, sizeof(m_numN)) != SUCCESS) { + return FAILURE; + } + if (m_numN > 0) { + m_unk0x10 = new Mx3DPointFloat[m_numN]; + } + + if (p_storage->Read(&m_numE, sizeof(m_numE)) != SUCCESS) { + return FAILURE; + } + if (m_numE > 0) { + m_unk0x0c = new LegoPathCtrlEdge[m_numE]; + } + + if (p_storage->Read(&m_numL, sizeof(m_numL)) != SUCCESS) { + return FAILURE; + } + if (m_numL > 0) { + m_unk0x08 = new LegoPathBoundary[m_numL]; + } + + if (m_numT > 0 && FUN_10047b30(p_storage) != SUCCESS) { + return FAILURE; + } + + if (m_numN > 0) { + for (MxS32 i = 0; i < m_numN; i++) { + if (FUN_100482b0(p_storage, m_unk0x10[i]) != SUCCESS) { + return FAILURE; + } + } + } + + if (m_numE > 0 && FUN_10047c10(p_storage) != SUCCESS) { + return FAILURE; + } + + if (m_numL > 0 && FUN_10047e90(p_storage) != SUCCESS) { + return FAILURE; + } + + for (MxS32 j = 0; j < m_numE; j++) { + m_pfsE.insert(&m_unk0x0c[j]); + } + + return SUCCESS; +} + +// STUB: LEGO1 0x10047b30 +// FUNCTION: BETA10 0x100b7cd6 +MxResult LegoPathController::FUN_10047b30(LegoStorage* p_storage) +{ + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x10047c10 +// FUNCTION: BETA10 0x1100b7df3 +MxResult LegoPathController::FUN_10047c10(LegoStorage* p_storage) +{ + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x10047e90 +// FUNCTION: BETA10 0x100b8293 +MxResult LegoPathController::FUN_10047e90(LegoStorage* p_storage) +{ + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x100482b0 +// FUNCTION: BETA10 0x100b8864 +MxResult LegoPathController::FUN_100482b0(LegoStorage* p_storage, Mx3DPointFloat&) +{ + // TODO + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp index 7542192b..4b935c7f 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp @@ -70,9 +70,9 @@ void LegoPathPresenter::Destroy() // FUNCTION: LEGO1 0x10044c20 void LegoPathPresenter::ReadyTickle() { - LegoWorld* currentWorld = CurrentWorld(); + LegoWorld* world = CurrentWorld(); - if (currentWorld) { + if (world) { MxStreamChunk* chunk = m_subscriber->PopData(); if (chunk) { @@ -84,8 +84,8 @@ void LegoPathPresenter::ReadyTickle() else { ParseExtra(); - controller->VTable0x14(chunk->GetData(), m_action->GetLocation(), m_trigger); - currentWorld->AddPath(controller); + controller->Create(chunk->GetData(), m_action->GetLocation(), m_trigger); + world->AddPath(controller); m_subscriber->FreeDataChunk(chunk); ProgressTickleState(MxPresenter::e_starting); diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp new file mode 100644 index 00000000..2cbf51c4 --- /dev/null +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -0,0 +1,11 @@ +#include "legopathstruct.h" + +DECOMP_SIZE_ASSERT(LegoPathStructBase, 0x0c) +DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14) + +// STUB: LEGO1 0x1001b700 +// FUNCTION: BETA10 0x100c26c5 +void LegoPathStruct::VTable0x04(undefined4, undefined4, undefined4) +{ + // TODO +} diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp index 79ba66cb..4262da76 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp @@ -1,3 +1,12 @@ #include "legounkown100db7f4.h" DECOMP_SIZE_ASSERT(LegoUnknown100db7f4, 0x40) + +// FUNCTION: LEGO1 0x1009a630 +// FUNCTION: BETA10 0x10183050 +LegoUnknown100db7f4::LegoUnknown100db7f4() +{ + m_unk0x24 = 0; + m_unk0x28.Clear(); + m_unk0x3c = 0; +} diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index 8cf8934f..fa0dd995 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -9,6 +9,8 @@ // SIZE 0x40 class LegoUnknown100db7f4 : public LegoEdge { public: + LegoUnknown100db7f4(); + // FUNCTION: LEGO1 0x1002ddc0 // FUNCTION: BETA10 0x100372a0 LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point) @@ -25,6 +27,9 @@ class LegoUnknown100db7f4 : public LegoEdge { return SUCCESS; } + // SYNTHETIC: LEGO1 0x1009a6c0 + // LegoUnknown100db7f4::`scalar deleting destructor' + private: LegoU16 m_unk0x24; // 0x24 Mx3DPointFloat m_unk0x28; // 0x28 diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 4ef49f94..7a4153b6 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -18,6 +18,15 @@ // LIBRARY: LEGO1 0x1008b020 // ___CxxFrameHandler +// LIBRARY: LEGO1 0x1008b24c +// __global_unwind2 + +// LIBRARY: LEGO1 0x1008b28e +// __local_unwind2 + +// LIBRARY: LEGO1 0x1008b322 +// __NLG_Notify + // LIBRARY: LEGO1 0x1008b3dc // __CIacos @@ -81,6 +90,15 @@ // LIBRARY: LEGO1 0x1008c200 // _sscanf +// LIBRARY: LEGO1 0x1008c250 +// ??_L@YGXPAXIHP6EX0@Z1@Z + +// LIBRARY: LEGO1 0x1008c2e0 +// ??_M@YGXPAXIHP6EX0@Z@Z + +// LIBRARY: LEGO1 0x1008c370 +// ?__ArrayUnwind@@YGXPAXIHP6EX0@Z@Z + // LIBRARY: LEGO1 0x1008c410 // _strlwr @@ -93,6 +111,9 @@ // LIBRARY: LEGO1 0x1008c6a0 // _isdigit +// LIBRARY: LEGO1 0x1008c980 +// __except_handler3 + // LIBRARY: LEGO1 0x1008ca60 // _abort @@ -120,4 +141,7 @@ // LIBRARY: LEGO1 0x100d2270 // __beginthreadex +// LIBRARY: LEGO1 0x100fc8bc +// __NLG_Destination + #endif