diff --git a/include/z64math.h b/include/z64math.h index 9affe49a67..17f5b2ff36 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -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))