mirror of
https://github.com/zeldaret/oot
synced 2026-08-14 12:34:06 -04:00
Angle cleanup - macros names (#1193)
* Move binang utility macros out of angle conversion macros block
* `BINANG_TO_DEGF` -> `BINANG_TO_DEG_ALT` (it may even be warranted to name it _approx instead of _alt, unsure)
* Add `BINANG_TO_DEG` (unused by oot) (for completeness)
* `DEGF_TO_BINANG` -> `DEG_TO_BINANG_ALT` (again may even be _approx, or maybe _cam)
* Add `DEG_TO_BINANG` (unused by oot) (for completeness)
* `RADF_TO_BINANG` -> `RAD_TO_BINANG`
* `RADF_TO_DEGF` -> `RAD_TO_DEG`
* Cleanup argument names in angle conversion macros
* Format for angle macros changes
* Run formatter
* Move `DEG_TO_BINANG_ALT`, `BINANG_TO_DEG_ALT` to z64camera.h
* Remove `DEG_TO_BINANG`, `BINANG_TO_DEG`
* Remove `_ALT` from `DEG_TO_BINANG`, `BINANG_TO_DEG`
* Add comment about inaccuracy near `DEG_TO_BINANG`, `BINANG_TO_DEG`
* run formatter
* `CAM_` prefix on `DEG_TO_BINANG`, `BINANG_TO_DEG` macros
* Revert "Remove `DEG_TO_BINANG`, `BINANG_TO_DEG`"
This reverts commit 5321647e5b.
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
#include "ultra64.h"
|
||||
#include "z64cutscene.h"
|
||||
|
||||
// these two angle conversion macros are slightly inaccurate
|
||||
#define CAM_DEG_TO_BINANG(degrees) (s16)((degrees) * 182.04167f + .5f)
|
||||
#define CAM_BINANG_TO_DEG(binang) ((f32)(binang) * (360.0001525f / 65535.0f))
|
||||
|
||||
#define CAM_STAT_CUT 0
|
||||
#define CAM_STAT_WAIT 1
|
||||
#define CAM_STAT_UNK3 3
|
||||
|
||||
+8
-7
@@ -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,14 +96,12 @@ typedef struct {
|
||||
|
||||
#define IS_ZERO(f) (fabsf(f) < 0.008f)
|
||||
|
||||
// Trig 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)))
|
||||
// Angle conversion macros
|
||||
#define DEG_TO_BINANG(degrees) (s16)((degrees) * (0x8000 / 180.0f))
|
||||
#define RAD_TO_BINANG(radians) (s16)((radians) * (0x8000 / M_PI))
|
||||
#define RAD_TO_DEG(radians) ((radians) * (180.0f / M_PI))
|
||||
#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f))
|
||||
#define BINANG_TO_DEGF(binang) ((f32)(binang) * (360.0001525f / 65535.0f))
|
||||
#define BINANG_TO_DEG(binang) ((f32)(binang) * (180.0f / 0x8000))
|
||||
#define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PI / 0x8000))
|
||||
#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / (f32)0x8000) * M_PI)
|
||||
#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PI) / 0x8000)
|
||||
|
||||
Reference in New Issue
Block a user