diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 9086b286..e2a7ce16 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -61,7 +61,7 @@ void LegoROI::configureLegoROI(int p_roiConfig) } // FUNCTION: LEGO1 0x100a81d0 -LegoROI::LegoROI(Tgl::Renderer* p_renderer) : ViewROI(p_renderer, NULL), m_unk0xe0(-1) +LegoROI::LegoROI(Tgl::Renderer* p_renderer) : ViewROI(p_renderer, NULL) { m_unk0xd4 = NULL; m_name = NULL; @@ -69,7 +69,7 @@ LegoROI::LegoROI(Tgl::Renderer* p_renderer) : ViewROI(p_renderer, NULL), m_unk0x } // FUNCTION: LEGO1 0x100a82d0 -LegoROI::LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList) : ViewROI(p_renderer, p_lodList), m_unk0xe0(-1) +LegoROI::LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList) : ViewROI(p_renderer, p_lodList) { m_unk0xd4 = NULL; m_name = NULL; diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index c84f3eba..aa4f3b37 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -57,7 +57,6 @@ class LegoROI : public ViewROI { // LegoROI::`scalar deleting destructor' private: - int m_unk0xe0; // 0xe0 LegoChar* m_name; // 0xe4 BoundingSphere m_sphere; // 0xe8 undefined4 m_unk0x100; // 0x100 diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index b0cf26cf..feec88f4 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -19,6 +19,9 @@ class Mx3DPointFloat : public Vector3 { inline float GetY() { return m_data[1]; } inline float GetZ() { return m_data[2]; } + inline float& operator[](size_t idx) { return m_data[idx]; } + inline const float& operator[](size_t idx) const { return m_data[idx]; } + // FUNCTION: LEGO1 0x100343a0 inline Mx3DPointFloat(const Mx3DPointFloat& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); } diff --git a/LEGO1/mxgeometry/mxmatrix.h b/LEGO1/mxgeometry/mxmatrix.h index 81cdaa2c..13c07c54 100644 --- a/LEGO1/mxgeometry/mxmatrix.h +++ b/LEGO1/mxgeometry/mxmatrix.h @@ -10,6 +10,9 @@ class MxMatrix : public Matrix4 { inline MxMatrix() : Matrix4(m_elements) {} inline MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } + float* operator[](size_t idx) { return m_data[idx]; } + const float* operator[](size_t idx) const { return m_data[idx]; } + // FUNCTION: LEGO1 0x10002850 void operator=(const Matrix4& p_matrix) override { Equals(p_matrix); } // vtable+0x28 diff --git a/LEGO1/omni/include/mxticklemanager.h b/LEGO1/omni/include/mxticklemanager.h index f07d0dc3..8d1327a5 100644 --- a/LEGO1/omni/include/mxticklemanager.h +++ b/LEGO1/omni/include/mxticklemanager.h @@ -5,6 +5,7 @@ #include "mxstl/stlcompat.h" #include "mxtypes.h" +// SIZE 0x10 class MxTickleClient { public: MxTickleClient(MxCore* p_client, MxTime p_interval); @@ -33,10 +34,11 @@ class MxTickleClient { typedef list MxTickleClientPtrList; // VTABLE: LEGO1 0x100d86d8 +// SIZE 0x14 class MxTickleManager : public MxCore { public: inline MxTickleManager() {} - ~MxTickleManager() override; // vtable+0x00 (scalar deleting destructor) + ~MxTickleManager() override; MxResult Tickle() override; // vtable+0x08 virtual void RegisterClient(MxCore* p_client, MxTime p_interval); // vtable+0x14 diff --git a/LEGO1/realtime/orientableroi.cpp b/LEGO1/realtime/orientableroi.cpp index 8a2e8a12..988b3f77 100644 --- a/LEGO1/realtime/orientableroi.cpp +++ b/LEGO1/realtime/orientableroi.cpp @@ -16,8 +16,8 @@ OrientableROI::OrientableROI() ZEROVEC3(m_world_velocity); IDENTMAT4(m_local2world); - m_unk0xd4 = 0; - m_unk0xd8 |= c_bit1 | c_bit2; + m_unk0xd4 = NULL; + ToggleUnknown0xd8(TRUE); } // FUNCTION: LEGO1 0x100a5910 diff --git a/LEGO1/realtime/orientableroi.h b/LEGO1/realtime/orientableroi.h index 005ec4dc..9f059826 100644 --- a/LEGO1/realtime/orientableroi.h +++ b/LEGO1/realtime/orientableroi.h @@ -5,6 +5,8 @@ #include "mxgeometry/mxmatrix.h" #include "roi.h" +#include + // VTABLE: LEGO1 0x100dbc08 // SIZE 0xdc class OrientableROI : public ROI { @@ -19,8 +21,10 @@ class OrientableROI : public ROI { const float* GetWorldVelocity() const override; // vtable+0x08 const BoundingBox& GetWorldBoundingBox() const override; // vtable+0x0c const BoundingSphere& GetWorldBoundingSphere() const override; // vtable+0x10 + // FUNCTION: LEGO1 0x100a5db0 - virtual void VTable0x14() { VTable0x1c(); } // vtable+0x14 + virtual void VTable0x14() { VTable0x1c(); } // vtable+0x14 + virtual void UpdateWorldBoundingVolumes() = 0; // vtable+0x18 virtual void VTable0x1c(); // vtable+0x1c virtual void SetLocalTransform(const Matrix4& p_transform); // vtable+0x20 @@ -34,17 +38,20 @@ class OrientableROI : public ROI { const float* GetWorldUp() const { return m_local2world[1]; } OrientableROI* GetUnknown0xd4() const { return m_unk0xd4; } + void ToggleUnknown0xd8(BOOL p_enable) + { + if (p_enable) { + m_unk0xd8 |= c_bit1 | c_bit2; + } + else { + m_unk0xd8 &= ~c_bit1; + } + } + protected: - MxMatrix m_local2world; // 0x10 - BoundingBox m_world_bounding_box; // 0x58 - - // Unclear whether the following vectors are: - // 1) Part of m_world_bounding_box; - // 2) A second BoundingBox; - // 3) Standalone vectors - - Mx3DPointFloat m_unk0x80; // 0x80 - Mx3DPointFloat m_unk0x94; // 0x94 + MxMatrix m_local2world; // 0x10 + BoundingBox m_world_bounding_box; // 0x58 + BoundingBox m_unk0x80; // 0x80 BoundingSphere m_world_bounding_sphere; // 0xa8 Mx3DPointFloat m_world_velocity; // 0xc0 OrientableROI* m_unk0xd4; // 0xd4 diff --git a/LEGO1/realtime/roi.h b/LEGO1/realtime/roi.h index 33a9ce33..850a533f 100644 --- a/LEGO1/realtime/roi.h +++ b/LEGO1/realtime/roi.h @@ -15,10 +15,10 @@ // SIZE 0x28 class BoundingBox { public: - const Mx3DPointFloat& Min() const { return min; } - Mx3DPointFloat& Min() { return min; } - const Mx3DPointFloat& Max() const { return max; } - Mx3DPointFloat& Max() { return max; } + const Vector3& Min() const { return min; } + Vector3& Min() { return min; } + const Vector3& Max() const { return max; } + Vector3& Max() { return max; } private: Mx3DPointFloat min; // 0x00 @@ -31,8 +31,8 @@ class BoundingBox { // SIZE 0x18 class BoundingSphere { public: - const Mx3DPointFloat& Center() const { return center; } - Mx3DPointFloat& Center() { return center; } + const Vector3& Center() const { return center; } + Vector3& Center() { return center; } const float& Radius() const { return radius; } float& Radius() { return radius; } diff --git a/LEGO1/viewmanager/viewroi.cpp b/LEGO1/viewmanager/viewroi.cpp index 37b299b5..bee14c41 100644 --- a/LEGO1/viewmanager/viewroi.cpp +++ b/LEGO1/viewmanager/viewroi.cpp @@ -4,7 +4,7 @@ #include -DECOMP_SIZE_ASSERT(ViewROI, 0xe0) +DECOMP_SIZE_ASSERT(ViewROI, 0xe4) // GLOBAL: LEGO1 0x101013d8 undefined g_unk101013d8 = 0; diff --git a/LEGO1/viewmanager/viewroi.h b/LEGO1/viewmanager/viewroi.h index 544d3762..5524088f 100644 --- a/LEGO1/viewmanager/viewroi.h +++ b/LEGO1/viewmanager/viewroi.h @@ -13,13 +13,14 @@ */ // VTABLE: LEGO1 0x100dbe70 -// SIZE 0xe0 +// SIZE 0xe4 class ViewROI : public OrientableROI { public: inline ViewROI(Tgl::Renderer* pRenderer, ViewLODList* lodList) { SetLODList(lodList); geometry = pRenderer->CreateGroup(); + m_unk0xe0 = -1; } // FUNCTION: LEGO1 0x100a9e20 @@ -61,6 +62,7 @@ class ViewROI : public OrientableROI { void UpdateWorldData(const MxMatrix& parent2world) override; Tgl::Group* geometry; // 0xdc + int m_unk0xe0; // 0xe0 }; // SYNTHETIC: LEGO1 0x100aa250