From e6507b874a477e64e5796bbfb6d147be5a08da5e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 7 Oct 2023 14:00:20 -0400 Subject: [PATCH] Refactor vector EqualsScalar (#171) * Refactor vector EqualsScalar * Fix param name --- LEGO1/legoentity.cpp | 8 ++------ LEGO1/mxdsaction.cpp | 19 +++---------------- LEGO1/mxvector.h | 2 ++ 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/LEGO1/legoentity.cpp b/LEGO1/legoentity.cpp index 105b4b5f..e7601cc2 100644 --- a/LEGO1/legoentity.cpp +++ b/LEGO1/legoentity.cpp @@ -23,12 +23,8 @@ MxLong LegoEntity::Notify(MxParam &p) // OFFSET: LEGO1 0x100105f0 void LegoEntity::Reset() { - float value = 0.0f; - m_vec1.EqualsScalar(&value); - - value = 0.0f; - m_vec2.EqualsScalar(&value); - + m_vec1.Fill(0); + m_vec2.Fill(0); m_unk50 = 0; m_unk54 = 0; m_unk58 = 0; diff --git a/LEGO1/mxdsaction.cpp b/LEGO1/mxdsaction.cpp index 0ac01543..1f26c7c9 100644 --- a/LEGO1/mxdsaction.cpp +++ b/LEGO1/mxdsaction.cpp @@ -22,22 +22,9 @@ MxDSAction::MxDSAction() this->m_loopCount = -1; this->SetType(MxDSType_Action); - - { - float value = FLT_MAX; - this->m_location.EqualsScalar(&value); - } - - { - float value = FLT_MAX; - this->m_direction.EqualsScalar(&value); - } - - { - float value = FLT_MAX; - this->m_up.EqualsScalar(&value); - } - + this->m_location.Fill(FLT_MAX); + this->m_direction.Fill(FLT_MAX); + this->m_up.Fill(FLT_MAX); this->m_unk84 = 0; this->m_unk88 = 0; this->m_omni = NULL; diff --git a/LEGO1/mxvector.h b/LEGO1/mxvector.h index ae58abd9..eef1d927 100644 --- a/LEGO1/mxvector.h +++ b/LEGO1/mxvector.h @@ -95,6 +95,8 @@ class MxVector3 : public MxVector2 virtual void EqualsCross(MxVector3 *p_a, float *p_b); virtual void EqualsCross(MxVector3 *p_a, MxVector3 *p_b); virtual void EqualsScalar(float *p_value); + + inline void Fill(float p_value) { EqualsScalar(&p_value); } }; // VTABLE 0x100d45a0