From 1bfe47357b93c28084fc55c500706f6ed237f93f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 7 Apr 2024 08:36:58 -0400 Subject: [PATCH] Refactor LegoActorStruct into unknown class in misc lib (#782) --- CMakeLists.txt | 1 + LEGO1/lego/legoomni/include/legopathactor.h | 11 ++------ .../lego/legoomni/src/paths/legopathactor.cpp | 25 ----------------- LEGO1/lego/sources/misc/legounknown.cpp | 28 +++++++++++++++++++ LEGO1/lego/sources/misc/legounknown.h | 19 +++++++++++++ 5 files changed, 50 insertions(+), 34 deletions(-) create mode 100644 LEGO1/lego/sources/misc/legounknown.cpp create mode 100644 LEGO1/lego/sources/misc/legounknown.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 04d67816..c7abac57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,6 +173,7 @@ add_library(misc STATIC LEGO1/lego/sources/misc/legostorage.cpp LEGO1/lego/sources/misc/legotexture.cpp LEGO1/lego/sources/misc/legotree.cpp + LEGO1/lego/sources/misc/legounknown.cpp ) register_lego1_target(misc) set_property(TARGET misc PROPERTY ARCHIVE_OUTPUT_NAME "misc$<$:d>") diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 60f2a5ef..7b0498b5 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -3,19 +3,12 @@ #include "legoactor.h" #include "legopathboundary.h" +#include "misc/legounknown.h" #include "mxtypes.h" #include "realtime/matrix.h" class LegoPathController; -struct LegoActorStruct { - LegoActorStruct(); - ~LegoActorStruct(); - void FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4); - - Mx3DPointFloat m_unk0x00[4]; // 0x00 -}; - // VTABLE: LEGO1 0x100d6e28 // SIZE 0x154 class LegoPathActor : public LegoActor { @@ -114,7 +107,7 @@ class LegoPathActor : public LegoActor { MxFloat m_actorTime; // 0x80 MxFloat m_lastTime; // 0x84 LegoPathBoundary* m_boundary; // 0x88 - LegoActorStruct m_unk0x8c; // 0x8c + LegoUnknown m_unk0x8c; // 0x8c MxU32 m_state; // 0xdc Edge* m_destEdge; // 0xe0 undefined4 m_unk0xe4; // 0xe4 diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index a66c8f18..e8f37cba 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -124,28 +124,3 @@ void LegoPathActor::VTable0xa8() { // TODO } - -// FUNCTION: LEGO1 0x1009a0f0 -LegoActorStruct::LegoActorStruct() -{ - for (MxS32 i = 0; i < _countof(m_unk0x00); i++) { - m_unk0x00[i].Clear(); - } -} - -// FUNCTION: LEGO1 0x1009a130 -LegoActorStruct::~LegoActorStruct() -{ -} - -// FUNCTION: LEGO1 0x1009a140 -void LegoActorStruct::FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4) -{ - m_unk0x00[0] = p_point1; - m_unk0x00[1] = p_point2; - - for (MxS32 i = 0; i < 3; i++) { - m_unk0x00[2][i] = (p_point3[i] - p_point1[i]) * 3.0f - p_point2[i] * 2.0f - p_point4[i]; - m_unk0x00[3][i] = (p_point1[i] - p_point3[i]) * 2.0f + p_point4[i] + p_point2[i]; - } -} diff --git a/LEGO1/lego/sources/misc/legounknown.cpp b/LEGO1/lego/sources/misc/legounknown.cpp new file mode 100644 index 00000000..f3e47974 --- /dev/null +++ b/LEGO1/lego/sources/misc/legounknown.cpp @@ -0,0 +1,28 @@ +#include "legounknown.h" + +DECOMP_SIZE_ASSERT(LegoUnknown, 0x50) + +// FUNCTION: LEGO1 0x1009a0f0 +LegoUnknown::LegoUnknown() +{ + for (LegoS32 i = 0; i < _countof(m_unk0x00); i++) { + m_unk0x00[i].Clear(); + } +} + +// FUNCTION: LEGO1 0x1009a130 +LegoUnknown::~LegoUnknown() +{ +} + +// FUNCTION: LEGO1 0x1009a140 +void LegoUnknown::FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4) +{ + m_unk0x00[0] = p_point1; + m_unk0x00[1] = p_point2; + + for (LegoS32 i = 0; i < 3; i++) { + m_unk0x00[2][i] = (p_point3[i] - p_point1[i]) * 3.0f - p_point2[i] * 2.0f - p_point4[i]; + m_unk0x00[3][i] = (p_point1[i] - p_point3[i]) * 2.0f + p_point4[i] + p_point2[i]; + } +} diff --git a/LEGO1/lego/sources/misc/legounknown.h b/LEGO1/lego/sources/misc/legounknown.h new file mode 100644 index 00000000..271b3276 --- /dev/null +++ b/LEGO1/lego/sources/misc/legounknown.h @@ -0,0 +1,19 @@ +#ifndef __LEGOUNKNOWN_H +#define __LEGOUNKNOWN_H + +#include "legotypes.h" +#include "mxgeometry/mxgeometry3d.h" + +// SIZE 0x50 +class LegoUnknown { +public: + LegoUnknown(); + ~LegoUnknown(); + + void FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4); + +private: + Mx3DPointFloat m_unk0x00[4]; // 0x00 +}; + +#endif // __LEGOUNKNOWN_H