diff --git a/saco/game/common.h b/saco/game/common.h index 450893a..e912968 100644 --- a/saco/game/common.h +++ b/saco/game/common.h @@ -26,3 +26,18 @@ typedef struct _MATRIX4X4 { VECTOR pos; float pad_p; } MATRIX4X4, *PMATRIX4X4; + +//----------------------------------------------------------- +#pragma pack(1) +typedef struct _ENTITY_TYPE +{ + // ENTITY STUFF + DWORD vtable; // 0-4 + + char _pad4[16]; + + MATRIX4X4 *mat; // 20-24 + +} ENTITY_TYPE; + +//----------------------------------------------------------- diff --git a/saco/game/entity.cpp b/saco/game/entity.cpp index f49be0a..427ea42 100644 --- a/saco/game/entity.cpp +++ b/saco/game/entity.cpp @@ -1,3 +1,53 @@ #include "../main.h" +#include "entity.h" + + +//----------------------------------------------------------- + +void CEntity::GetMatrix(PMATRIX4X4 Matrix) +{ + if (!m_pEntity || !m_pEntity->mat) return; + + Matrix->right.X = m_pEntity->mat->right.X; + Matrix->right.Y = m_pEntity->mat->right.Y; + Matrix->right.Z = m_pEntity->mat->right.Z; + + Matrix->up.X = m_pEntity->mat->up.X; + Matrix->up.Y = m_pEntity->mat->up.Y; + Matrix->up.Z = m_pEntity->mat->up.Z; + + Matrix->at.X = m_pEntity->mat->at.X; + Matrix->at.Y = m_pEntity->mat->at.Y; + Matrix->at.Z = m_pEntity->mat->at.Z; + + Matrix->pos.X = m_pEntity->mat->pos.X; + Matrix->pos.Y = m_pEntity->mat->pos.Y; + Matrix->pos.Z = m_pEntity->mat->pos.Z; +} + +//----------------------------------------------------------- + +void CEntity::SetMatrix(MATRIX4X4 Matrix) +{ + if (!m_pEntity || !m_pEntity->mat) return; + + m_pEntity->mat->right.X = Matrix.right.X; + m_pEntity->mat->right.Y = Matrix.right.Y; + m_pEntity->mat->right.Z = Matrix.right.Z; + + m_pEntity->mat->up.X = Matrix.up.X; + m_pEntity->mat->up.Y = Matrix.up.Y; + m_pEntity->mat->up.Z = Matrix.up.Z; + + m_pEntity->mat->at.X = Matrix.at.X; + m_pEntity->mat->at.Y = Matrix.at.Y; + m_pEntity->mat->at.Z = Matrix.at.Z; + + m_pEntity->mat->pos.X = Matrix.pos.X; + m_pEntity->mat->pos.Y = Matrix.pos.Y; + m_pEntity->mat->pos.Z = Matrix.pos.Z; +} + +//----------------------------------------------------------- diff --git a/saco/game/entity.h b/saco/game/entity.h index 9892208..b5f25bc 100644 --- a/saco/game/entity.h +++ b/saco/game/entity.h @@ -11,8 +11,10 @@ public: }; virtual ~CEntity() {}; + void GetMatrix(PMATRIX4X4 Matrix); + void SetMatrix(MATRIX4X4 Matrix); char field_4[60]; - int field_40; + ENTITY_TYPE *m_pEntity; int field_44; };