From 21d9e69510c1e80e3b9eed47023e1b4b8a3c682b Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Mon, 6 May 2024 22:30:31 +0800 Subject: [PATCH] [saco] Implement and match `InvDegToRad(...)` --- saco/game/util.cpp | 12 ++++++++++++ saco/game/util.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/saco/game/util.cpp b/saco/game/util.cpp index bdf4ac2..103eb74 100644 --- a/saco/game/util.cpp +++ b/saco/game/util.cpp @@ -1467,6 +1467,18 @@ float DegToRad(float fDegrees) //---------------------------------------------------- +float InvDegToRad(float fDegrees) +{ + if (fDegrees > 360.0f || fDegrees < 0.0f) return 0.0f; + if (fDegrees > 180.0f) { + return (float)((-(PI - (((fDegrees - 180.0f) * PI) / 180.0f))) * -1.0f); + } else { + return (float)(((fDegrees * PI) / 180.0f) * -1.0f); + } +} + +//---------------------------------------------------- + bool IsNumeric(char * szString) { while(*szString) { diff --git a/saco/game/util.h b/saco/game/util.h index 00b3fd1..ba577bf 100644 --- a/saco/game/util.h +++ b/saco/game/util.h @@ -31,6 +31,8 @@ BYTE __stdcall FindPlayerNumFromPedPtr(DWORD dwPedPtr); void GameResetRadarColors(); float DegToRad(float fDegrees); +float InvDegToRad(float fDegrees); + void SaveCameraRaster(char *filename); BOOL IsFileOrDirectoryExists(char * szPath);