diff --git a/saco/game/entity.cpp b/saco/game/entity.cpp index 2e67935..ac3ba33 100644 --- a/saco/game/entity.cpp +++ b/saco/game/entity.cpp @@ -232,3 +232,19 @@ void CEntity::TeleportTo(float x, float y, float z) } //----------------------------------------------------------- + +float CEntity::GetDistanceFromPoint(float X, float Y, float Z) +{ + MATRIX4X4 matThis; + float fSX,fSY,fSZ; + + GetMatrix(&matThis); + fSX = (matThis.pos.X - X) * (matThis.pos.X - X); + fSY = (matThis.pos.Y - Y) * (matThis.pos.Y - Y); + fSZ = (matThis.pos.Z - Z) * (matThis.pos.Z - Z); + + return (float)sqrt(fSX + fSY + fSZ); +} + +//----------------------------------------------------------- + diff --git a/saco/game/entity.h b/saco/game/entity.h index 8332660..bb1af6a 100644 --- a/saco/game/entity.h +++ b/saco/game/entity.h @@ -26,6 +26,9 @@ public: UINT GetModelIndex(); void TeleportTo(float x, float y, float z); + float GetDistanceFromPoint(float X, float Y, float Z); + + BOOL FUNC_1009FDE0(); VECTOR field_4[5];