1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-19 05:15:18 +00:00

Move binang utility macros out of angle conversion macros block

This commit is contained in:
Dragorn421 2022-04-03 21:03:16 +02:00
parent a9084ad65e
commit 385fbf6dfa
No known key found for this signature in database
GPG key ID: C182A3A3996E8201

View file

@ -76,6 +76,9 @@ typedef struct {
/* 0x06 */ s16 yaw; // azimuthal angle
} VecSph; // size = 0x08
#define BINANG_ROT180(angle) ((s16)((angle) - 0x7FFF))
#define BINANG_SUB(a, b) ((s16)((a) - (b)))
#define LERP(x, y, scale) (((y) - (x)) * (scale) + (x))
#define LERP32(x, y, scale) ((s32)(((y) - (x)) * (scale)) + (x))
#define LERP16(x, y, scale) ((s16)(((y) - (x)) * (scale)) + (x))
@ -93,12 +96,10 @@ typedef struct {
#define IS_ZERO(f) (fabsf(f) < 0.008f)
// Trig macros
// Angle conversion macros
#define DEGF_TO_BINANG(degreesf) (s16)((degreesf) * 182.04167f + .5f)
#define RADF_TO_BINANG(radf) (s16)((radf) * (0x8000 / M_PI))
#define RADF_TO_DEGF(radf) ((radf) * (180.0f / M_PI))
#define BINANG_ROT180(angle) ((s16)((angle) - 0x7FFF))
#define BINANG_SUB(a, b) ((s16)((a) - (b)))
#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f))
#define BINANG_TO_DEGF(binang) ((f32)(binang) * (360.0001525f / 65535.0f))
#define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PI / 0x8000))