summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2022-03-20 01:16:33 +0100
committerGitHub <noreply@github.com>2022-03-19 20:16:33 -0400
commit0e5ecdcd73ab94eba28b49cbda111ed7caf88b38 (patch)
tree405f054d2f71ea9addf1b6fefc3973b5f426a4e6 /src/code
parent4f6967b02778e61ed0e9fa471f9ba7d67524c908 (diff)
Angle cleanup - `BINANG_TO_RAD`, `BINANG_TO_RAD_ALT` (#1158)
* Run formatter * Touch up angle macros (parentheses and hex constants) * Add `BINANG_TO_RAD_ALT` * Swap `BINANG_TO_RAD` and `BINANG_TO_RAD_ALT` * Run formatter
Diffstat (limited to 'src/code')
-rw-r--r--src/code/sys_math_atan.c2
-rw-r--r--src/code/z_actor.c4
-rw-r--r--src/code/z_player_lib.c12
3 files changed, 9 insertions, 9 deletions
diff --git a/src/code/sys_math_atan.c b/src/code/sys_math_atan.c
index 21152c9f2..4e346da4e 100644
--- a/src/code/sys_math_atan.c
+++ b/src/code/sys_math_atan.c
@@ -131,5 +131,5 @@ s16 Math_Atan2S(f32 x, f32 y) {
}
f32 Math_Atan2F(f32 x, f32 y) {
- return Math_Atan2S(x, y) * (M_PI / 32768.0f);
+ return BINANG_TO_RAD(Math_Atan2S(x, y));
}
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 5b9309ace..1fd01f454 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -47,7 +47,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf
Matrix_Put(&sp60);
if (dlist != gCircleShadowDL) {
- Matrix_RotateY(actor->shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
+ Matrix_RotateY(BINANG_TO_RAD(actor->shape.rot.y), MTXMODE_APPLY);
}
temp2 = (1.0f - (temp1 * (1.0f / 350))) * actor->shape.shadowScale;
@@ -398,7 +398,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) {
Matrix_Translate(actor->focus.pos.x, actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y) + 17.0f,
actor->focus.pos.z, MTXMODE_NEW);
- Matrix_RotateY((f32)((u16)(globalCtx->gameplayFrames * 3000)) * (M_PI / 0x8000), MTXMODE_APPLY);
+ Matrix_RotateY(BINANG_TO_RAD((u16)(globalCtx->gameplayFrames * 3000)), MTXMODE_APPLY);
Matrix_Scale((iREG(27) + 35) / 1000.0f, (iREG(28) + 60) / 1000.0f, (iREG(29) + 50) / 1000.0f, MTXMODE_APPLY);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, naviColor->inner.r, naviColor->inner.g, naviColor->inner.b, 255);
diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c
index e3f95b7e9..74ce5ba99 100644
--- a/src/code/z_player_lib.c
+++ b/src/code/z_player_lib.c
@@ -906,7 +906,7 @@ s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbInde
if (this->unk_6C2 != 0) {
Matrix_Translate(pos->x, ((Math_CosS(this->unk_6C2) - 1.0f) * 200.0f) + pos->y, pos->z, MTXMODE_APPLY);
- Matrix_RotateX(this->unk_6C2 * (M_PI / 0x8000), MTXMODE_APPLY);
+ Matrix_RotateX(BINANG_TO_RAD(this->unk_6C2), MTXMODE_APPLY);
Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY);
pos->x = pos->y = pos->z = 0.0f;
rot->x = rot->y = rot->z = 0;
@@ -922,17 +922,17 @@ s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbInde
rot->z += this->unk_6B6;
} else if (limbIndex == PLAYER_LIMB_UPPER) {
if (this->unk_6B0 != 0) {
- Matrix_RotateZ(0x44C * (M_PI / 0x8000), MTXMODE_APPLY);
- Matrix_RotateY(this->unk_6B0 * (M_PI / 0x8000), MTXMODE_APPLY);
+ Matrix_RotateZ(BINANG_TO_RAD(0x44C), MTXMODE_APPLY);
+ Matrix_RotateY(BINANG_TO_RAD(this->unk_6B0), MTXMODE_APPLY);
}
if (this->unk_6BE != 0) {
- Matrix_RotateY(this->unk_6BE * (M_PI / 0x8000), MTXMODE_APPLY);
+ Matrix_RotateY(BINANG_TO_RAD(this->unk_6BE), MTXMODE_APPLY);
}
if (this->unk_6BC != 0) {
- Matrix_RotateX(this->unk_6BC * (M_PI / 0x8000), MTXMODE_APPLY);
+ Matrix_RotateX(BINANG_TO_RAD(this->unk_6BC), MTXMODE_APPLY);
}
if (this->unk_6C0 != 0) {
- Matrix_RotateZ(this->unk_6C0 * (M_PI / 0x8000), MTXMODE_APPLY);
+ Matrix_RotateZ(BINANG_TO_RAD(this->unk_6C0), MTXMODE_APPLY);
}
} else if (limbIndex == PLAYER_LIMB_L_THIGH) {
func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN,