Skip to content

Commit

Permalink
Add Mathematical Constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Veloscocity committed Sep 22, 2023
1 parent 99a45d7 commit 93e035d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 2 additions & 4 deletions ChaosMod/Effects/db/Peds/PedsJamesBond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <math.h>
#include <stdafx.h>

#define PI 3.14159265

static void OnStart()
{
Ped playerPed = PLAYER_PED_ID();
Expand All @@ -23,8 +21,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);
Expand Down
6 changes: 2 additions & 4 deletions ChaosMod/Effects/db/Peds/PedsSpawnBiker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include "Util/Peds.h"

#define PI 3.14159265

static void OnStart()
{
static const Hash bikerHash = "G_M_Y_Lost_03"_hash;
Expand All @@ -21,8 +19,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);
Expand Down
6 changes: 6 additions & 0 deletions ChaosMod/Util/Constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

#define PI 3.14159265f
#define TAU 6.2831855f
#define DEGREE 0.0174532925f // PI / 180

1 change: 1 addition & 0 deletions ChaosMod/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Effects/Effect.h"

#include "Util/Constants.h"
#include "Util/EntityIterator.h"
#include "Util/Hash.h"
#include "Util/Logging.h"
Expand Down

0 comments on commit 93e035d

Please sign in to comment.