From 7b42598f9acfc1f339126aa77bc76281885e8791 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 7 May 2024 22:25:37 +0800 Subject: [PATCH] [saco] Implement and match `DistanceBetweenHorizontalPoints(...)` --- saco/game/util.cpp | 12 ++++++++++++ saco/game/util.h | 1 + 2 files changed, 13 insertions(+) diff --git a/saco/game/util.cpp b/saco/game/util.cpp index 6a41159..016e10f 100644 --- a/saco/game/util.cpp +++ b/saco/game/util.cpp @@ -1527,6 +1527,18 @@ float __stdcall SquaredDistanceBetweenHorizontalPoints(float x1, float y1, float //----------------------------------------------------------- +float __stdcall DistanceBetweenHorizontalPoints(float x1, float y1, float x2, float y2) +{ + float fSX,fSY; + + fSX = (x1 - x2) * (x1 - x2); + fSY = (y1 - y2) * (y1 - y2); + + return (float)sqrt(fSX + fSY); +} + +//----------------------------------------------------------- + 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 284cfb0..c0bbc77 100644 --- a/saco/game/util.h +++ b/saco/game/util.h @@ -32,6 +32,7 @@ void __stdcall SetPlayerPedPtrRecord(BYTE bytePlayer, DWORD dwPedPtr); 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); void GameResetRadarColors();