From b8ef3c5e16dae3dcaa2cf416eed403af2678fab4 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 7 May 2024 22:26:45 +0800 Subject: [PATCH] [saco] Implement and match `DistanceBetweenPoints(...)` --- saco/game/util.cpp | 13 +++++++++++++ saco/game/util.h | 1 + 2 files changed, 14 insertions(+) diff --git a/saco/game/util.cpp b/saco/game/util.cpp index 016e10f..a0691c3 100644 --- a/saco/game/util.cpp +++ b/saco/game/util.cpp @@ -1539,6 +1539,19 @@ float __stdcall DistanceBetweenHorizontalPoints(float x1, float y1, float x2, fl //----------------------------------------------------------- +float __stdcall DistanceBetweenPoints(float x1, float y1, float z1, float x2, float y2, float z2) +{ + float fSX,fSY,fSZ; + + fSX = (x1 - x2) * (x1 - x2); + fSY = (y1 - y2) * (y1 - y2); + fSZ = (z1 - z2) * (z1 - z2); + + return (float)sqrt(fSX + fSY + fSZ); +} + +//---------------------------------------------------- + float DegToRad(float fDegrees) { if (fDegrees > 360.0f || fDegrees < 0.0f) return 0.0f; diff --git a/saco/game/util.h b/saco/game/util.h index c0bbc77..f09263e 100644 --- a/saco/game/util.h +++ b/saco/game/util.h @@ -33,6 +33,7 @@ DWORD __stdcall GetPlayerPedPtrRecord(BYTE bytePlayer); BYTE __stdcall FindPlayerNumFromPedPtr(DWORD dwPedPtr); float __stdcall SquaredDistanceBetweenHorizontalPoints(float x1, float y1, float x2, float y2); float DistanceBetweenHorizontalPoints(float x1, float y1, float x2, float y2); +float DistanceBetweenPoints(float x1, float y1, float z1, float x2, float y2, float z2); void GameResetRadarColors();