TombEngine/TR5Main/Game/trmath.h

46 lines
1.3 KiB
C
Raw Normal View History

2020-04-30 21:52:16 +02:00
#pragma once
#include "phd_global.h"
2020-04-30 21:52:16 +02:00
2020-09-15 11:01:24 -03:00
struct VectorInt2
{
int x;
int y;
};
struct VectorInt3
{
int x;
int y;
int z;
};
constexpr auto PI = 3.14159265358979323846f;
constexpr auto RADIAN = 0.01745329252f;
constexpr auto ONE_DEGREE = 182;
constexpr auto PREDICTIVE_SCALE_FACTOR = 14;
constexpr auto STEP_SIZE = 256;
constexpr auto WALL_SIZE = 1024;
constexpr auto STEPUP_HEIGHT = ((STEP_SIZE * 3) / 2);
constexpr auto BAD_JUMP_CEILING = ((STEP_SIZE * 3) / 4);
2020-04-30 21:52:16 +02:00
2020-09-29 11:27:09 -03:00
constexpr auto SQUARE = [](auto x) { return x * x; };
constexpr auto CLICK = [](auto x) { return STEP_SIZE * x; };
constexpr auto SECTOR = [](auto x) { return WALL_SIZE * x; };
constexpr auto MESH_BITS = [](auto x) { return 1 << x; };
2020-04-30 21:52:16 +02:00
short ANGLE(float angle);
short FROM_DEGREES(float angle);
short FROM_RAD(float angle);
float TO_DEGREES(short angle);
float TO_RAD(short angle);
2020-04-30 21:52:16 +02:00
2020-10-05 22:24:57 -03:00
float phd_sin(short a);
float phd_cos(short a);
2020-04-30 21:52:16 +02:00
const float lerp(float v0, float v1, float t);
2020-08-16 16:01:24 +02:00
const Vector3 getRandomVector();
const Vector3 getRandomVectorInCone(const Vector3& direction,const float angleDegrees);
2020-04-30 21:52:16 +02:00
int mGetAngle(int x1, int y1, int x2, int y2);
int phd_atan(int dz, int dx);
void phd_GetVectorAngles(int x, int y, int z, short* angles);
2020-07-25 18:02:35 +02:00
void phd_RotBoundingBoxNoPersp(PHD_3DPOS* pos, BOUNDING_BOX* bounds, BOUNDING_BOX* tbounds);