Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Mathematical Constants #3586

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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