2020-04-30 21:52:16 +02:00
|
|
|
#pragma once
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Specific/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;
|
|
|
|
};
|
|
|
|
|
2020-05-30 15:55:23 +02:00
|
|
|
constexpr auto PI = 3.14159265358979323846f;
|
|
|
|
constexpr auto RADIAN = 0.01745329252f;
|
|
|
|
constexpr auto ONE_DEGREE = 182;
|
|
|
|
constexpr auto PREDICTIVE_SCALE_FACTOR = 14;
|
|
|
|
constexpr auto WALL_SIZE = 1024;
|
2021-08-26 13:06:24 +03:00
|
|
|
constexpr auto STEP_SIZE = WALL_SIZE / 4;
|
|
|
|
constexpr auto STOP_SIZE = WALL_SIZE / 2;
|
2021-10-02 15:44:34 +03:00
|
|
|
constexpr auto GRID_SNAP_SIZE = STEP_SIZE / 2;
|
2020-05-30 15:55:23 +02:00
|
|
|
constexpr auto STEPUP_HEIGHT = ((STEP_SIZE * 3) / 2);
|
2021-09-14 15:30:28 +03:00
|
|
|
constexpr auto SWIM_DEPTH = 730;
|
|
|
|
constexpr auto WADE_DEPTH = STEPUP_HEIGHT;
|
2020-05-30 15:55:23 +02:00
|
|
|
constexpr auto BAD_JUMP_CEILING = ((STEP_SIZE * 3) / 4);
|
2021-09-13 03:11:13 +03:00
|
|
|
constexpr auto SLOPE_DIFFERENCE = 60;
|
2021-08-26 13:06:24 +03:00
|
|
|
constexpr auto NO_HEIGHT = (-0x7F00);
|
|
|
|
constexpr auto MAX_HEIGHT = (-0x7FFF);
|
2021-09-18 01:32:48 +03:00
|
|
|
constexpr auto DEEP_WATER = 0x7FFF;
|
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);
|
2021-06-29 05:00:15 +02:00
|
|
|
short FROM_DEGREES(float angle);
|
2020-10-22 00:15:59 -03:00
|
|
|
short FROM_RAD(float angle);
|
2020-05-01 06:33:43 +02:00
|
|
|
float TO_DEGREES(short angle);
|
2021-08-30 15:35:00 +03:00
|
|
|
float TO_RAD(short angle);
|
|
|
|
|
2021-09-14 14:38:59 +03:00
|
|
|
BoundingOrientedBox TO_DX_BBOX(PHD_3DPOS pos, BOUNDING_BOX* box);
|
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);
|
2021-09-15 17:40:00 +03:00
|
|
|
void phd_RotBoundingBoxNoPersp(PHD_3DPOS* pos, BOUNDING_BOX* bounds, BOUNDING_BOX* tbounds);
|
2021-11-09 03:16:34 +03:00
|
|
|
int phd_Distance(PHD_3DPOS* first, PHD_3DPOS* second);
|
2021-09-15 17:40:00 +03:00
|
|
|
|
2021-09-16 05:06:03 +03:00
|
|
|
void InterpolateAngle(short angle, short* rotation, short* outAngle, int shift);
|
2021-09-28 13:01:28 +02:00
|
|
|
void GetMatrixFromTrAngle(Matrix* matrix, short* frameptr, int index);
|
|
|
|
|
|
|
|
constexpr auto FP_SHIFT = 16;
|
|
|
|
constexpr auto FP_ONE = (1 << FP_SHIFT);
|
|
|
|
constexpr auto W2V_SHIFT = 14;
|
|
|
|
|
|
|
|
void FP_VectorMul(PHD_VECTOR* v, int scale, PHD_VECTOR* result);
|
|
|
|
__int64 FP_Mul(__int64 a, __int64 b);
|
|
|
|
__int64 FP_Div(__int64 a, __int64 b);
|
|
|
|
int FP_DotProduct(PHD_VECTOR* a, PHD_VECTOR* b);
|
|
|
|
void FP_CrossProduct(PHD_VECTOR* a, PHD_VECTOR* b, PHD_VECTOR* n);
|
|
|
|
void FP_GetMatrixAngles(MATRIX3D* m, short* angles);
|
|
|
|
__int64 FP_ToFixed(__int64 value);
|
|
|
|
__int64 FP_FromFixed(__int64 value);
|
|
|
|
PHD_VECTOR* FP_Normalise(PHD_VECTOR* v);
|
|
|
|
|
|
|
|
|
|
|
|
#define MULFP(a,b) (int)((((__int64)a*(__int64)b))>>16)
|
|
|
|
#define DIVFP(a,b) (int)(((a)/(b>>8))<<8)
|