diff --git a/ChaosMod/Effects/db/Peds/PedsJamesBond.cpp b/ChaosMod/Effects/db/Peds/PedsJamesBond.cpp index b979bf1a5..bd878150a 100644 --- a/ChaosMod/Effects/db/Peds/PedsJamesBond.cpp +++ b/ChaosMod/Effects/db/Peds/PedsJamesBond.cpp @@ -6,6 +6,7 @@ #include #include "Effects/Register/RegisterEffect.h" + #define PI 3.14159265 static void OnStart() @@ -24,8 +25,8 @@ static void OnStart() float heading = GET_ENTITY_HEADING(IS_PED_IN_ANY_VEHICLE(playerPed, false) ? GET_VEHICLE_PED_IS_IN(playerPed, false) : playerPed); - float xPos = sin((360 - heading) * PI / 180) * 10; - float yPos = cos((360 - heading) * PI / 180) * 10; + float xPos = sin((360 - heading) * DEGREE) * 10; + float yPos = cos((360 - heading) * DEGREE) * 10; auto veh = CreatePoolVehicle("JB700"_hash, playerPos.x - xPos, playerPos.y - yPos, playerPos.z, heading); SET_VEHICLE_ENGINE_ON(veh, true, true, false); diff --git a/ChaosMod/Effects/db/Peds/PedsSpawnBiker.cpp b/ChaosMod/Effects/db/Peds/PedsSpawnBiker.cpp index 8b27bb3ce..8ca995c46 100644 --- a/ChaosMod/Effects/db/Peds/PedsSpawnBiker.cpp +++ b/ChaosMod/Effects/db/Peds/PedsSpawnBiker.cpp @@ -7,8 +7,6 @@ #include "Effects/Register/RegisterEffect.h" #include "Util/Peds.h" -#define PI 3.14159265 - static void OnStart() { static const Hash bikerHash = "G_M_Y_Lost_03"_hash; @@ -22,8 +20,8 @@ static void OnStart() float heading = GET_ENTITY_HEADING(IS_PED_IN_ANY_VEHICLE(playerPed, false) ? GET_VEHICLE_PED_IS_IN(playerPed, false) : playerPed); - float x_pos = sin((360 - heading) * PI / 180) * 10; - float y_pos = cos((360 - heading) * PI / 180) * 10; + float x_pos = sin((360 - heading) * DEGREE) * 10; + float y_pos = cos((360 - heading) * DEGREE) * 10; Vehicle veh = CreatePoolVehicle(vehHash, playerPos.x - x_pos, playerPos.y - y_pos, playerPos.z, heading); SET_VEHICLE_ENGINE_ON(veh, true, true, false); diff --git a/ChaosMod/Util/Constants.h b/ChaosMod/Util/Constants.h new file mode 100644 index 000000000..f24e4ebad --- /dev/null +++ b/ChaosMod/Util/Constants.h @@ -0,0 +1,6 @@ +#pragma once + +#define PI 3.14159265f +#define TAU 6.2831855f +#define DEGREE 0.0174532925f // PI / 180 + diff --git a/ChaosMod/stdafx.h b/ChaosMod/stdafx.h index 9987d576d..5566c8be5 100644 --- a/ChaosMod/stdafx.h +++ b/ChaosMod/stdafx.h @@ -1,5 +1,6 @@ #pragma once +#include "Util/Constants.h" #include "Util/EntityIterator.h" #include "Util/Hash.h" #include "Util/Logging.h"