From 3b2555c428fc65ac7b7cdad1dcd58d1626f20c86 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 9 Aug 2023 06:09:48 -0400 Subject: [PATCH] Match MxDSAction::CopyFrom --- LEGO1/mxdsaction.cpp | 7 +++---- LEGO1/mxvector.h | 33 +++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/LEGO1/mxdsaction.cpp b/LEGO1/mxdsaction.cpp index 7b977d1f..02de454f 100644 --- a/LEGO1/mxdsaction.cpp +++ b/LEGO1/mxdsaction.cpp @@ -51,10 +51,9 @@ void MxDSAction::CopyFrom(MxDSAction &p_dsAction) this->m_duration = p_dsAction.m_duration; this->m_loopCount = p_dsAction.m_loopCount; - // TODO - // this->m_location.SetVector(p_dsAction.m_location.GetData()); - // this->m_direction.SetVector(p_dsAction.m_direction.GetData()); - // this->m_up.SetVector(p_dsAction.m_up.GetData()); + this->m_location.CopyFrom(&p_dsAction.m_location); + this->m_direction.CopyFrom(&p_dsAction.m_direction); + this->m_up.CopyFrom(&p_dsAction.m_up); FUN_100ADE60(p_dsAction.m_unk80, p_dsAction.m_unk7c); this->m_unk84 = p_dsAction.m_unk84; diff --git a/LEGO1/mxvector.h b/LEGO1/mxvector.h index e55e8d56..7922f143 100644 --- a/LEGO1/mxvector.h +++ b/LEGO1/mxvector.h @@ -57,8 +57,8 @@ class MxVector2 virtual void DivScalar(float *p_value); // vtable + 0x6C - virtual void SetVector(MxVector2 *other); - virtual void SetVector(float *other); + virtual void SetVector(MxVector2 *p_other); + virtual void SetVector(float *p_other); inline float& operator[](size_t idx) { return m_data[idx]; } inline const float operator[](size_t idx) const { return m_data[idx]; } @@ -139,7 +139,24 @@ class MxVector3Data : public MxVector3 : MxVector3(&x) , x(p_x), y(p_y), z(p_z) {} - float x, y, z; + + union { + float storage[3]; + struct { + float x; + float y; + float z; + }; + }; + + void CopyFrom(MxVector3Data *p_other) { + EqualsImpl(p_other->m_data); + + float *src = this->storage; + float *dest = p_other->storage; + for (size_t i = sizeof(storage) / sizeof(float); i > 0; --i) + *dest++ = *src++; + } }; // VTABLE 0x100d41e8 @@ -148,7 +165,15 @@ class MxVector4Data : public MxVector4 { public: inline MxVector4Data() : MxVector4(&x) {} - float x, y, z, w; + union { + float storage[4]; + struct { + float x; + float y; + float z; + float w; + }; + }; }; #endif // MXVECTOR_H \ No newline at end of file