[bot] Implement/match n_GetDistanceFromMeToPoint(...)

* Implement/match `CNetGame::GetDistanceFromMeToPoint(...)`
This commit is contained in:
RD42
2024-07-08 18:03:56 +08:00
parent dc4688d7bb
commit 402d3944e1
3 changed files with 32 additions and 2 deletions

View File

@ -250,6 +250,23 @@ BOOL CNetGame::IsVehicleAdded(VEHICLEID VehicleID)
}
//----------------------------------------------------
float CNetGame::GetDistanceFromMeToPoint(PVECTOR vecPos)
{
VECTOR vecMyPos;
if(GetMyPos(&vecMyPos))
{
float fX = vecMyPos.X - vecPos->X;
float fY = vecMyPos.Y - vecPos->Y;
float fZ = vecMyPos.Z - vecPos->Z;
return (float)sqrt(fX * fX + fY * fY + fZ * fZ);
}
else
{
return 0.0f;
}
}
//----------------------------------------------------
PVECTOR CNetGame::GetMyPos(PVECTOR Vector)

View File

@ -114,6 +114,7 @@ public:
BYTE GetPlayerSpecialAction(PLAYERID playerId);
BOOL IsPlayerAdded(PLAYERID playerId);
BOOL IsVehicleAdded(VEHICLEID VehicleID);
float GetDistanceFromMeToPoint(PVECTOR vecPos);
PVECTOR GetMyPos(PVECTOR Vector);
void SetMyPos(PVECTOR Vector);
float GetMyZAngle();