From 9e204334a6c2e27494952a48c24f4ba42ab9c5f5 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 16 Jan 2025 15:32:35 -0700 Subject: [PATCH] Proper const use for vector / BETA match --- LEGO1/lego/legoomni/include/act3ammo.h | 2 +- LEGO1/lego/legoomni/src/actors/act3ammo.cpp | 2 +- LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp | 6 +++--- LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp | 1 + LEGO1/lego/sources/geom/legounkown100db7f4.h | 8 ++++---- LEGO1/lego/sources/misc/legounknown.cpp | 8 +++++++- LEGO1/lego/sources/misc/legounknown.h | 7 ++++++- LEGO1/mxgeometry/mxgeometry3d.h | 6 +----- LEGO1/omni/include/mxdsaction.h | 6 +++--- LEGO1/viewmanager/viewmanager.cpp | 1 + 10 files changed, 28 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act3ammo.h b/LEGO1/lego/legoomni/include/act3ammo.h index 28de0263..ee4e3dc1 100644 --- a/LEGO1/lego/legoomni/include/act3ammo.h +++ b/LEGO1/lego/legoomni/include/act3ammo.h @@ -82,7 +82,7 @@ class Act3Ammo : public LegoPathActor { MxResult Remove(); MxResult Create(Act3* p_world, MxU32 p_isPizza, MxS32 p_index); - MxResult FUN_10053b40(Vector3& p_srcLoc, Vector3& p_srcDir, Vector3& p_srcUp); + MxResult FUN_10053b40(const Vector3& p_srcLoc, const Vector3& p_srcDir, const Vector3& p_srcUp); MxResult FUN_10053cb0(LegoPathController* p_p, LegoPathBoundary* p_boundary, MxFloat p_unk0x19c); MxResult FUN_10053d30(LegoPathController* p_p, MxFloat p_unk0x19c); diff --git a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp index 2eaae385..6eb4c70a 100644 --- a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp @@ -109,7 +109,7 @@ MxResult Act3Ammo::Create(Act3* p_world, MxU32 p_isPizza, MxS32 p_index) // FUNCTION: LEGO1 0x10053b40 // FUNCTION: BETA10 0x1001db2a -MxResult Act3Ammo::FUN_10053b40(Vector3& p_srcLoc, Vector3& p_srcDir, Vector3& p_srcUp) +MxResult Act3Ammo::FUN_10053b40(const Vector3& p_srcLoc, const Vector3& p_srcDir, const Vector3& p_srcUp) { assert(p_srcDir[1] != 0); diff --git a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp index 2489b1ec..91d3650c 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp @@ -260,9 +260,9 @@ void LegoCarBuildAnimPresenter::StreamingTickle() Mx3DPointFloat dirVec; - Vector3 cameraPosition(camera->GetWorldPosition()); - Vector3 upVec(camera->GetWorldUp()); - Vector3 targetPosition(targetROI->GetWorldPosition()); + const Vector3 cameraPosition(camera->GetWorldPosition()); + const Vector3 upVec(camera->GetWorldUp()); + const Vector3 targetPosition(targetROI->GetWorldPosition()); MxMatrix localTransform; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 58b27935..24ea5af5 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -316,6 +316,7 @@ float LegoNavController::CalculateNewVel(float p_targetVel, float p_currentVel, } // FUNCTION: LEGO1 0x10055080 +// FUNCTION: BETA10 0x1009b26b MxBool LegoNavController::CalculateNewPosDir( const Vector3& p_curPos, const Vector3& p_curDir, diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index 1c9c266d..d54e3730 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -22,12 +22,12 @@ struct LegoUnknown100db7f4 : public LegoEdge { // FUNCTION: LEGO1 0x1002ddc0 // FUNCTION: BETA10 0x100372a0 - LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point) + LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point) const { if (p_f.IsEqual(m_faceA)) { - p_point[0] = -m_unk0x28.index_operator(0); - p_point[1] = -m_unk0x28.index_operator(1); - p_point[2] = -m_unk0x28.index_operator(2); + p_point[0] = -m_unk0x28[0]; + p_point[1] = -m_unk0x28[1]; + p_point[2] = -m_unk0x28[2]; } else { // clang-format off diff --git a/LEGO1/lego/sources/misc/legounknown.cpp b/LEGO1/lego/sources/misc/legounknown.cpp index d1af890d..db3f056c 100644 --- a/LEGO1/lego/sources/misc/legounknown.cpp +++ b/LEGO1/lego/sources/misc/legounknown.cpp @@ -18,7 +18,13 @@ LegoUnknown::~LegoUnknown() } // FUNCTION: LEGO1 0x1009a140 -void LegoUnknown::FUN_1009a140(const Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4) +// FUNCTION: BETA10 0x10182c2f +void LegoUnknown::FUN_1009a140( + const Vector3& p_point1, + const Vector3& p_point2, + const Vector3& p_point3, + const Vector3& p_point4 +) { m_unk0x00[0] = p_point1; m_unk0x00[1] = p_point2; diff --git a/LEGO1/lego/sources/misc/legounknown.h b/LEGO1/lego/sources/misc/legounknown.h index 5659feb7..e129952c 100644 --- a/LEGO1/lego/sources/misc/legounknown.h +++ b/LEGO1/lego/sources/misc/legounknown.h @@ -12,7 +12,12 @@ class LegoUnknown { LegoUnknown(); ~LegoUnknown(); - void FUN_1009a140(const Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4); + void FUN_1009a140( + const Vector3& p_point1, + const Vector3& p_point2, + const Vector3& p_point3, + const Vector3& p_point4 + ); LegoResult FUN_1009a1e0(float p_f1, MxMatrix& p_mat, Vector3& p_v, LegoU32 p_und); private: diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index 578d31b2..0a6ec12e 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -38,12 +38,8 @@ class Mx3DPointFloat : public Vector3 { // FUNCTION: BETA10 0x10013460 float& operator[](int idx) { return m_data[idx]; } - // According to the PDB, BETA10 will not link this one if it is never used - // const float& operator[](int idx) const { return m_data[idx]; } - - // only used by LegoUnknown100db7f4::FUN_1002ddc0() for some unknown reason // FUNCTION: BETA10 0x100373c0 - float& index_operator(int idx) { return m_data[idx]; } + const float& operator[](int idx) const { return m_data[idx]; } // SYNTHETIC: LEGO1 0x10010c00 // ??4Mx3DPointFloat@@QAEAAV0@ABV0@@Z diff --git a/LEGO1/omni/include/mxdsaction.h b/LEGO1/omni/include/mxdsaction.h index 807700c5..c003496e 100644 --- a/LEGO1/omni/include/mxdsaction.h +++ b/LEGO1/omni/include/mxdsaction.h @@ -87,13 +87,13 @@ class MxDSAction : public MxDSObject { void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; } // FUNCTION: BETA10 0x1003db50 - Vector3& GetLocation() { return m_location; } + const Vector3& GetLocation() { return m_location; } // FUNCTION: BETA10 0x1003db80 - Vector3& GetDirection() { return m_direction; } + const Vector3& GetDirection() { return m_direction; } // FUNCTION: BETA10 0x1003dbb0 - Vector3& GetUp() { return m_up; } + const Vector3& GetUp() { return m_up; } // FUNCTION: BETA10 0x100153b0 void SetLocation(const Vector3& p_location) { m_location = p_location; } diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index 8f92f6f2..9c6b8434 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -471,6 +471,7 @@ void ViewManager::SetPOVSource(const OrientableROI* point_of_view) } // FUNCTION: LEGO1 0x100a6dc0 +// FUNCTION: BETA10 0x101739b8 float ViewManager::ProjectedSize(const BoundingSphere& p_bounding_sphere) { // The algorithm projects the radius of bounding sphere onto the perpendicular