[saco] Implement/match CEntity::Add()

This commit is contained in:
RD42
2024-08-06 19:06:50 +08:00
parent 9a5a830cee
commit e3320fd439
2 changed files with 37 additions and 0 deletions

View File

@ -248,6 +248,42 @@ float CEntity::GetDistanceFromPoint(float X, float Y, float Z)
//----------------------------------------------------------- //-----------------------------------------------------------
void CEntity::Add()
{
// Check for CPlaceable messup
if(!m_pEntity || m_pEntity->vtable == 0x863C40)
{
#ifdef _DEBUG
OutputDebugString("CEntity::Add - m_pEntity == NULL or CPlaceable");
#endif
return;
}
if(!m_pEntity->dwUnkModelRel) {
// Make sure the move/turn speed is reset
VECTOR vec = {0.0f,0.0f,0.0f};
SetMoveSpeedVector(vec);
SetTurnSpeedVector(vec);
WorldAddEntity((PDWORD)m_pEntity);
MATRIX4X4 mat;
GetMatrix(&mat);
TeleportTo(mat.pos.X,mat.pos.Y,mat.pos.Z);
#ifdef _DEBUG
if (!IsAdded())
{
OutputDebugString("CEntity::Add failed...");
}
#endif
}
}
//-----------------------------------------------------------
BOOL CEntity::IsAdded() BOOL CEntity::IsAdded()
{ {
// Check for CPlaceable messup // Check for CPlaceable messup

View File

@ -31,6 +31,7 @@ public:
BOOL FUNC_1009FDE0(); BOOL FUNC_1009FDE0();
virtual void Add();
BOOL IsAdded(); BOOL IsAdded();
VECTOR field_4[5]; VECTOR field_4[5];