From 981c471d427e409de516f85a51c7e909b0bd1d0d Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 17 Nov 2023 09:30:17 -0500 Subject: [PATCH] Consistent naming for Matrix --- LEGO1/helicopter.h | 4 +-- LEGO1/realtime/matrix.cpp | 42 ++++++++++++++++---------------- LEGO1/realtime/matrix.h | 20 +++++++-------- LEGO1/realtime/orientableroi.cpp | 12 ++++----- LEGO1/realtime/orientableroi.h | 8 +++--- LEGO1/realtime/realtime.cpp | 2 +- LEGO1/realtime/realtime.h | 2 +- LEGO1/viewmanager/viewroi.cpp | 2 +- LEGO1/viewmanager/viewroi.h | 2 +- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/LEGO1/helicopter.h b/LEGO1/helicopter.h index 07bb7336..7ed0a30f 100644 --- a/LEGO1/helicopter.h +++ b/LEGO1/helicopter.h @@ -32,8 +32,8 @@ class Helicopter : public IslePathActor { virtual ~Helicopter() override; // vtable+0x0 protected: - MatrixData m_unk160; - MatrixData m_unk1a8; + Matrix4Data m_unk160; + Matrix4Data m_unk1a8; undefined4 m_unk1f0; Vector4Data m_unk1f4; Vector4Data m_unk20c; diff --git a/LEGO1/realtime/matrix.cpp b/LEGO1/realtime/matrix.cpp index ea3048cd..0b6b90b1 100644 --- a/LEGO1/realtime/matrix.cpp +++ b/LEGO1/realtime/matrix.cpp @@ -7,65 +7,65 @@ #include DECOMP_SIZE_ASSERT(Matrix4, 0x40); -DECOMP_SIZE_ASSERT(MatrixImpl, 0x8); -DECOMP_SIZE_ASSERT(MatrixData, 0x48); +DECOMP_SIZE_ASSERT(Matrix4Impl, 0x8); +DECOMP_SIZE_ASSERT(Matrix4Data, 0x48); // OFFSET: LEGO1 0x10002320 -void MatrixImpl::EqualsMatrixData(const Matrix4& p_matrix) +void Matrix4Impl::EqualsMatrixData(const Matrix4& p_matrix) { *m_data = p_matrix; } // OFFSET: LEGO1 0x10002340 -void MatrixImpl::EqualsMatrixImpl(const MatrixImpl* p_other) +void Matrix4Impl::EqualsMatrixImpl(const Matrix4Impl* p_other) { *m_data = *p_other->m_data; } // OFFSET: LEGO1 0x10002360 -void MatrixImpl::AnotherSetData(Matrix4& p_data) +void Matrix4Impl::AnotherSetData(Matrix4& p_data) { m_data = &p_data; } // OFFSET: LEGO1 0x10002370 -void MatrixImpl::SetData(Matrix4& p_data) +void Matrix4Impl::SetData(Matrix4& p_data) { m_data = &p_data; } // OFFSET: LEGO1 0x10002380 -const Matrix4* MatrixImpl::GetData() const +const Matrix4* Matrix4Impl::GetData() const { return m_data; } // OFFSET: LEGO1 0x10002390 -Matrix4* MatrixImpl::GetData() +Matrix4* Matrix4Impl::GetData() { return m_data; } // OFFSET: LEGO1 0x100023a0 -const float* MatrixImpl::Element(int p_row, int p_col) const +const float* Matrix4Impl::Element(int p_row, int p_col) const { return &(*m_data)[p_row][p_col]; } // OFFSET: LEGO1 0x100023c0 -float* MatrixImpl::Element(int p_row, int p_col) +float* Matrix4Impl::Element(int p_row, int p_col) { return &(*m_data)[p_row][p_col]; } // OFFSET: LEGO1 0x100023e0 -void MatrixImpl::Clear() +void Matrix4Impl::Clear() { memset(m_data, 0, 16 * sizeof(float)); } // OFFSET: LEGO1 0x100023f0 -void MatrixImpl::SetIdentity() +void Matrix4Impl::SetIdentity() { Clear(); (*m_data)[0][0] = 1.0f; @@ -75,7 +75,7 @@ void MatrixImpl::SetIdentity() } // OFFSET: LEGO1 0x10002430 -MatrixImpl* MatrixImpl::operator+=(const Matrix4& p_matrix) +Matrix4Impl* Matrix4Impl::operator+=(const Matrix4& p_matrix) { for (int i = 0; i < 16; ++i) ((float*) m_data)[i] += ((float*) &p_matrix)[i]; @@ -85,7 +85,7 @@ MatrixImpl* MatrixImpl::operator+=(const Matrix4& p_matrix) // Matches but instructions are significantly out of order. Probably not wrong // code given that the very similar SetTranslation does match. // OFFSET: LEGO1 0x10002460 -void MatrixImpl::TranslateBy(const float* p_x, const float* p_y, const float* p_z) +void Matrix4Impl::TranslateBy(const float* p_x, const float* p_y, const float* p_z) { ((float*) m_data)[12] += *p_x; ((float*) m_data)[13] += *p_y; @@ -93,7 +93,7 @@ void MatrixImpl::TranslateBy(const float* p_x, const float* p_y, const float* p_ } // OFFSET: LEGO1 0x100024a0 -void MatrixImpl::SetTranslation(const float* p_x, const float* p_y, const float* p_z) +void Matrix4Impl::SetTranslation(const float* p_x, const float* p_y, const float* p_z) { (*m_data)[3][0] = *p_x; (*m_data)[3][1] = *p_y; @@ -101,7 +101,7 @@ void MatrixImpl::SetTranslation(const float* p_x, const float* p_y, const float* } // OFFSET: LEGO1 0x100024d0 -void MatrixImpl::EqualsDataProduct(const Matrix4& p_a, const Matrix4& p_b) +void Matrix4Impl::EqualsDataProduct(const Matrix4& p_a, const Matrix4& p_b) { float* cur = (float*) m_data; for (int row = 0; row < 4; ++row) { @@ -116,7 +116,7 @@ void MatrixImpl::EqualsDataProduct(const Matrix4& p_a, const Matrix4& p_b) } // OFFSET: LEGO1 0x10002530 -void MatrixImpl::EqualsMxProduct(const MatrixImpl* p_a, const MatrixImpl* p_b) +void Matrix4Impl::EqualsMxProduct(const Matrix4Impl* p_a, const Matrix4Impl* p_b) { EqualsDataProduct(*p_a->m_data, *p_b->m_data); } @@ -125,7 +125,7 @@ void MatrixImpl::EqualsMxProduct(const MatrixImpl* p_a, const MatrixImpl* p_b) // be manually worked out. Included since I at least figured out what it was // doing with rotateIndex and what overall operation it's trying to do. // OFFSET: LEGO1 0x10002550 STUB -void MatrixImpl::ToQuaternion(Vector4Impl* p_outQuat) +void Matrix4Impl::ToQuaternion(Vector4Impl* p_outQuat) { /* float trace = m_data[0] + m_data[5] + m_data[10]; @@ -168,19 +168,19 @@ void MatrixImpl::ToQuaternion(Vector4Impl* p_outQuat) // No idea what this function is doing and it will be hard to tell until // we have a confirmed usage site. // OFFSET: LEGO1 0x10002710 STUB -int MatrixImpl::FUN_10002710(const Vector3Impl* p_vec) +int Matrix4Impl::FUN_10002710(const Vector3Impl* p_vec) { return -1; } // OFFSET: LEGO1 0x10002850 -void MatrixImpl::operator=(const MatrixImpl& p_other) +void Matrix4Impl::operator=(const Matrix4Impl& p_other) { EqualsMatrixImpl(&p_other); } // OFFSET: LEGO1 0x10002860 -void MatrixData::operator=(const MatrixData& p_other) +void Matrix4Data::operator=(const Matrix4Data& p_other) { EqualsMatrixImpl(&p_other); } diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index fbdd3441..602e50ef 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -33,12 +33,12 @@ class Matrix4 { // VTABLE 0x100d4350 // SIZE 0x8 -class MatrixImpl { +class Matrix4Impl { public: - inline MatrixImpl(Matrix4& p_data) : m_data(&p_data) {} + inline Matrix4Impl(Matrix4& p_data) : m_data(&p_data) {} // vtable + 0x00 - virtual void EqualsMatrixImpl(const MatrixImpl* p_other); + virtual void EqualsMatrixImpl(const Matrix4Impl* p_other); virtual void EqualsMatrixData(const Matrix4& p_matrix); virtual void SetData(Matrix4& p_data); virtual void AnotherSetData(Matrix4& p_data); @@ -52,13 +52,13 @@ class MatrixImpl { // vtable + 0x20 virtual void Clear(); virtual void SetIdentity(); - virtual void operator=(const MatrixImpl& p_other); - virtual MatrixImpl* operator+=(const Matrix4& p_matrix); + virtual void operator=(const Matrix4Impl& p_other); + virtual Matrix4Impl* operator+=(const Matrix4& p_matrix); // vtable + 0x30 virtual void TranslateBy(const float* p_x, const float* p_y, const float* p_z); virtual void SetTranslation(const float* p_x, const float* p_y, const float* p_z); - virtual void EqualsMxProduct(const MatrixImpl* p_a, const MatrixImpl* p_b); + virtual void EqualsMxProduct(const Matrix4Impl* p_a, const Matrix4Impl* p_b); virtual void EqualsDataProduct(const Matrix4& p_a, const Matrix4& p_b); // vtable + 0x40 @@ -73,16 +73,16 @@ class MatrixImpl { // VTABLE 0x100d4300 // SIZE 0x48 -class MatrixData : public MatrixImpl { +class Matrix4Data : public Matrix4Impl { public: - inline MatrixData() : MatrixImpl(m) {} - inline MatrixData(MatrixData& p_other) : MatrixImpl(m) { m = *p_other.m_data; } + inline Matrix4Data() : Matrix4Impl(m) {} + inline Matrix4Data(Matrix4Data& p_other) : Matrix4Impl(m) { m = *p_other.m_data; } inline Matrix4& GetMatrix() { return *m_data; } // No idea why there's another equals. Maybe to some other type like the // DirectX Retained Mode Matrix type which is also a float* alias? // vtable + 0x44 - virtual void operator=(const MatrixData& p_other); + virtual void operator=(const Matrix4Data& p_other); Matrix4 m; }; diff --git a/LEGO1/realtime/orientableroi.cpp b/LEGO1/realtime/orientableroi.cpp index 8d07cae5..a1fd6832 100644 --- a/LEGO1/realtime/orientableroi.cpp +++ b/LEGO1/realtime/orientableroi.cpp @@ -12,26 +12,26 @@ void OrientableROI::VTable0x1c() } // OFFSET: LEGO1 0x100a5930 -void OrientableROI::SetLocalTransform(const MatrixImpl& p_transform) +void OrientableROI::SetLocalTransform(const Matrix4Impl& p_transform) { - reinterpret_cast(m_local2world) = p_transform; + reinterpret_cast(m_local2world) = p_transform; UpdateWorldBoundingVolumes(); UpdateWorldVelocity(); } // OFFSET: LEGO1 0x100a5960 -void OrientableROI::VTable0x24(const MatrixData& p_transform) +void OrientableROI::VTable0x24(const Matrix4Data& p_transform) { - MatrixData l_matrix(m_local2world); + Matrix4Data l_matrix(m_local2world); m_local2world.EqualsMxProduct(&p_transform, &l_matrix); UpdateWorldBoundingVolumes(); UpdateWorldVelocity(); } // OFFSET: LEGO1 0x100a59b0 -void OrientableROI::UpdateWorldData(const MatrixData& p_transform) +void OrientableROI::UpdateWorldData(const Matrix4Data& p_transform) { - MatrixData l_matrix(m_local2world); + Matrix4Data l_matrix(m_local2world); m_local2world.EqualsMxProduct(&l_matrix, &p_transform); UpdateWorldBoundingVolumes(); UpdateWorldVelocity(); diff --git a/LEGO1/realtime/orientableroi.h b/LEGO1/realtime/orientableroi.h index 6fb69990..958ca322 100644 --- a/LEGO1/realtime/orientableroi.h +++ b/LEGO1/realtime/orientableroi.h @@ -31,14 +31,14 @@ class OrientableROI : public ROI { public: virtual void VTable0x1c(); // vtable + 0x20 - virtual void SetLocalTransform(const MatrixImpl& p_transform); - virtual void VTable0x24(const MatrixData& p_transform); - virtual void UpdateWorldData(const MatrixData& p_transform); + virtual void SetLocalTransform(const Matrix4Impl& p_transform); + virtual void VTable0x24(const Matrix4Data& p_transform); + virtual void UpdateWorldData(const Matrix4Data& p_transform); virtual void UpdateWorldVelocity(); protected: char m_unkc; - MatrixData m_local2world; // 0x10 + Matrix4Data m_local2world; // 0x10 BoundingBox m_world_bounding_box; // 0x58 BoundingSphere m_world_bounding_sphere; // 0xa8 Vector3Data m_world_velocity; // 0xc0 diff --git a/LEGO1/realtime/realtime.cpp b/LEGO1/realtime/realtime.cpp index 48a859a9..d2eea110 100644 --- a/LEGO1/realtime/realtime.cpp +++ b/LEGO1/realtime/realtime.cpp @@ -5,7 +5,7 @@ void CalcLocalTransform( const Vector3Impl& p_posVec, const Vector3Impl& p_dirVec, const Vector3Impl& p_upVec, - MatrixImpl& p_outMatrix + Matrix4Impl& p_outMatrix ) { float x_axis[3], y_axis[3], z_axis[3]; diff --git a/LEGO1/realtime/realtime.h b/LEGO1/realtime/realtime.h index 5592032d..ae166dfa 100644 --- a/LEGO1/realtime/realtime.h +++ b/LEGO1/realtime/realtime.h @@ -13,7 +13,7 @@ void CalcLocalTransform( const Vector3Impl& p_posVec, const Vector3Impl& p_dirVec, const Vector3Impl& p_upVec, - MatrixImpl& p_outMatrix + Matrix4Impl& p_outMatrix ); #endif // REALTIME_H diff --git a/LEGO1/viewmanager/viewroi.cpp b/LEGO1/viewmanager/viewroi.cpp index 35683e41..50100444 100644 --- a/LEGO1/viewmanager/viewroi.cpp +++ b/LEGO1/viewmanager/viewroi.cpp @@ -23,7 +23,7 @@ Tgl::Group* ViewROI::GetGeometry() } // OFFSET: LEGO1 0x100a9ee0 -void ViewROI::UpdateWorldData(const MatrixData& parent2world) +void ViewROI::UpdateWorldData(const Matrix4Data& parent2world) { OrientableROI::UpdateWorldData(parent2world); if (geometry) { diff --git a/LEGO1/viewmanager/viewroi.h b/LEGO1/viewmanager/viewroi.h index cc007a3a..99e73d34 100644 --- a/LEGO1/viewmanager/viewroi.h +++ b/LEGO1/viewmanager/viewroi.h @@ -41,7 +41,7 @@ class ViewROI : public OrientableROI { protected: Tgl::Group* geometry; - void UpdateWorldData(const MatrixData& parent2world); + void UpdateWorldData(const Matrix4Data& parent2world); }; #endif // VIEWROI_H