From 09f3d7ca34faa5e792b00e568d2b1fd1559a6487 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 25 Jun 2017 14:17:05 +0200 Subject: [PATCH] Minor improvements to CMatrix --- SilentPatchSA/GeneralSA.h | 4 ++-- SilentPatchSA/Maths.h | 14 +++++--------- SilentPatchSA/versionmeta.props | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/SilentPatchSA/GeneralSA.h b/SilentPatchSA/GeneralSA.h index 19ff329..cc9699e 100644 --- a/SilentPatchSA/GeneralSA.h +++ b/SilentPatchSA/GeneralSA.h @@ -80,7 +80,7 @@ public: } inline CVector* GetCoords() - { return m_pCoords ? reinterpret_cast(&m_pCoords->matrix.pos) : &m_transform.m_translate; } + { return m_pCoords ? &m_pCoords->GetPos() : &m_transform.m_translate; } inline CMatrix* GetMatrix() { return m_pCoords; } inline CSimpleTransform& GetTransform() @@ -89,7 +89,7 @@ public: { return m_pCoords ? atan2(-m_pCoords->GetUp().x, m_pCoords->GetUp().y) : m_transform.m_heading; } inline void SetCoords(const CVector& pos) - { if ( m_pCoords ) { m_pCoords->matrix.pos.x = pos.x; m_pCoords->matrix.pos.y = pos.y; m_pCoords->matrix.pos.z = pos.z; } + { if ( m_pCoords ) { m_pCoords->GetPos() = pos; } else m_transform.m_translate = pos; } inline void SetHeading(float fHeading) { if ( m_pCoords ) m_pCoords->SetRotateZOnly(fHeading); else m_transform.m_heading = fHeading; } diff --git a/SilentPatchSA/Maths.h b/SilentPatchSA/Maths.h index a27908d..afa0a2e 100644 --- a/SilentPatchSA/Maths.h +++ b/SilentPatchSA/Maths.h @@ -102,26 +102,22 @@ public: class CMatrix { -public: +private: RwMatrix matrix; - RwMatrix* pMatrix; - BOOL haveRwMatrix; + RwMatrix* pMatrix = nullptr; + BOOL haveRwMatrix = FALSE; public: - inline CMatrix() - : pMatrix(nullptr), haveRwMatrix(FALSE) - {} + inline CMatrix() = default; inline CMatrix(RwMatrix* pMatrix, bool bHasMatrix=false) - : CMatrix() { Attach(pMatrix, bHasMatrix); } inline CMatrix(const CMatrix& theMatrix) - : pMatrix(nullptr), haveRwMatrix(FALSE), matrix(theMatrix.matrix) + : matrix(theMatrix.matrix) {} inline CMatrix(const CVector& vecRight, const CVector& vecUp, const CVector& vecAt, const CVector& vecPos) - : CMatrix() { matrix.right.x = vecRight.x; matrix.right.y = vecRight.y; diff --git a/SilentPatchSA/versionmeta.props b/SilentPatchSA/versionmeta.props index f0de8db..1bade2a 100644 --- a/SilentPatchSA/versionmeta.props +++ b/SilentPatchSA/versionmeta.props @@ -6,7 +6,7 @@ .asi SilentPatch for San Andreas 29 - 3 + 4 2014-2017