SA-MP/saco/game/entity.cpp

98 lines
2.3 KiB
C++

#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;
}
//-----------------------------------------------------------
void CEntity::sub_1009EC80()
{
if(!m_pEntity || m_pEntity->vtable == 0x863C40) return;
DWORD dwRenderWare = (DWORD)m_pEntity->pdwRenderWare;
DWORD dwMatrix = (DWORD)m_pEntity->mat;
DWORD dwEntity = (DWORD)m_pEntity;
if(dwEntity && dwRenderWare && dwMatrix)
{
_asm mov edx, dwRenderWare
_asm mov eax, [edx+4]
_asm add eax, 16
_asm push eax
_asm mov ecx, dwMatrix
_asm mov edx, 0x59AD70
_asm call edx
_asm mov ecx, dwEntity
_asm mov edx, 0x532B00
_asm call edx
}
}
//-----------------------------------------------------------
void CEntity::GetMoveSpeedVector(PVECTOR Vector)
{
Vector->X = m_pEntity->vecMoveSpeed.X;
Vector->Y = m_pEntity->vecMoveSpeed.Y;
Vector->Z = m_pEntity->vecMoveSpeed.Z;
}
//-----------------------------------------------------------
void CEntity::SetMoveSpeedVector(VECTOR Vector)
{
m_pEntity->vecMoveSpeed.X = Vector.X;
m_pEntity->vecMoveSpeed.Y = Vector.Y;
m_pEntity->vecMoveSpeed.Z = Vector.Z;
}
//-----------------------------------------------------------