diff options
| author | Dragorn421 <Dragorn421@users.noreply.github.com> | 2022-03-13 19:46:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-13 14:46:46 -0400 |
| commit | 61b864a89ce9a98c1280c13ae818fd848432cf6c (patch) | |
| tree | e7fc200721aa76e6575fc027936ee759010182ad /src/code | |
| parent | aab5bc9211baa6c1eeaf8cb88402e1ea76367540 (diff) | |
Angle cleanup - `RADF_TO_BINANG` (#1155)
* Run formatter
* Touch up angle macros (parentheses and hex constants)
* Use `RADF_TO_BINANG` more
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/sys_matrix.c | 20 | ||||
| -rw-r--r-- | src/code/z_actor.c | 4 | ||||
| -rw-r--r-- | src/code/z_camera.c | 2 | ||||
| -rw-r--r-- | src/code/z_path.c | 2 | ||||
| -rw-r--r-- | src/code/z_player_lib.c | 4 |
5 files changed, 16 insertions, 16 deletions
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index 9f44a9931..42ca0b2a0 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -769,17 +769,17 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { temp = mf->xz; temp *= temp; temp += SQ(mf->zz); - rotDest->x = Math_FAtan2F(-mf->yz, sqrtf(temp)) * (0x8000 / M_PI); + rotDest->x = RADF_TO_BINANG(Math_FAtan2F(-mf->yz, sqrtf(temp))); if ((rotDest->x == 0x4000) || (rotDest->x == -0x4000)) { rotDest->z = 0; - rotDest->y = Math_FAtan2F(-mf->zx, mf->xx) * (0x8000 / M_PI); + rotDest->y = RADF_TO_BINANG(Math_FAtan2F(-mf->zx, mf->xx)); } else { - rotDest->y = Math_FAtan2F(mf->xz, mf->zz) * (0x8000 / M_PI); + rotDest->y = RADF_TO_BINANG(Math_FAtan2F(mf->xz, mf->zz)); if (!flag) { - rotDest->z = Math_FAtan2F(mf->yx, mf->yy) * (0x8000 / M_PI); + rotDest->z = RADF_TO_BINANG(Math_FAtan2F(mf->yx, mf->yy)); } else { temp = mf->xx; temp2 = mf->zx; @@ -804,7 +804,7 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { /* for a rotation matrix, temp == yx and temp2 == yy * which is the same as in the !flag branch */ - rotDest->z = Math_FAtan2F(temp, temp2) * (0x8000 / M_PI); + rotDest->z = RADF_TO_BINANG(Math_FAtan2F(temp, temp2)); } } } @@ -822,16 +822,16 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { temp = mf->xx; temp *= temp; temp += SQ(mf->yx); - rotDest->y = Math_FAtan2F(-mf->zx, sqrtf(temp)) * (0x8000 / M_PI); + rotDest->y = RADF_TO_BINANG(Math_FAtan2F(-mf->zx, sqrtf(temp))); if ((rotDest->y == 0x4000) || (rotDest->y == -0x4000)) { rotDest->x = 0; - rotDest->z = Math_FAtan2F(-mf->xy, mf->yy) * (0x8000 / M_PI); + rotDest->z = RADF_TO_BINANG(Math_FAtan2F(-mf->xy, mf->yy)); } else { - rotDest->z = Math_FAtan2F(mf->yx, mf->xx) * (0x8000 / M_PI); + rotDest->z = RADF_TO_BINANG(Math_FAtan2F(mf->yx, mf->xx)); if (!flag) { - rotDest->x = Math_FAtan2F(mf->zy, mf->zz) * (0x8000 / M_PI); + rotDest->x = RADF_TO_BINANG(Math_FAtan2F(mf->zy, mf->zz)); } else { // see Matrix_MtxFToYXZRotS temp = mf->xy; @@ -853,7 +853,7 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { temp2 = sqrtf(temp2); temp2 = temp3 / temp2; - rotDest->x = Math_FAtan2F(temp, temp2) * (0x8000 / M_PI); + rotDest->x = RADF_TO_BINANG(Math_FAtan2F(temp, temp2)); } } } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 2301446ab..816d98d63 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4179,12 +4179,12 @@ void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) { sp38 = Math_SinS(arg1); sp34 = Math_CosS(arg1); sp28 = (-(floorPolyNormalX * sp38) - (floorPolyNormalZ * sp34)); - arg2->x = -(s16)(Math_FAtan2F(sp28 * floorPolyNormalY, 1.0f) * (32768 / M_PI)); + arg2->x = -RADF_TO_BINANG(Math_FAtan2F(sp28 * floorPolyNormalY, 1.0f)); sp2C = Math_SinS(arg1 - 16375); sp30 = Math_CosS(arg1 - 16375); sp24 = (-(floorPolyNormalX * sp2C) - (floorPolyNormalZ * sp30)); - arg2->z = -(s16)(Math_FAtan2F(sp24 * floorPolyNormalY, 1.0f) * (32768 / M_PI)); + arg2->z = -RADF_TO_BINANG(Math_FAtan2F(sp24 * floorPolyNormalY, 1.0f)); } } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 7e731b42e..a3eaefeb0 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -951,7 +951,7 @@ s32 func_800458D4(Camera* camera, VecSph* eyeAtDir, f32 arg2, f32* arg3, s16 arg if (eyeAtAngle > DEGF_TO_RADF(OREG(32))) { if (1) {} - phi_f2 = 1.0f - sinf(DEGF_TO_RADF(eyeAtAngle - OREG(32))); + phi_f2 = 1.0f - sinf(eyeAtAngle - DEGF_TO_RADF(OREG(32))); } else if (eyeAtAngle < DEGF_TO_RADF(OREG(33))) { phi_f2 = 1.0f - sinf(DEGF_TO_RADF(OREG(33)) - eyeAtAngle); } else { diff --git a/src/code/z_path.c b/src/code/z_path.c index 8ff42c07a..bfffb2674 100644 --- a/src/code/z_path.c +++ b/src/code/z_path.c @@ -27,7 +27,7 @@ f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw) { dx = pointPos->x - actor->world.pos.x; dz = pointPos->z - actor->world.pos.z; - *yaw = Math_FAtan2F(dx, dz) * (32768 / M_PI); + *yaw = RADF_TO_BINANG(Math_FAtan2F(dx, dz)); return SQ(dx) + SQ(dz); } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 718183069..e3f95b7e9 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -852,14 +852,14 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, sp50 = Math_FAtan2F(sp58, sp60); - temp1 = (M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50))) * (0x8000 / M_PI); + temp1 = RADF_TO_BINANG(M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50))); temp1 = temp1 - skelAnime->jointTable[shinLimbIndex].z; if ((s16)(ABS(skelAnime->jointTable[shinLimbIndex].x) + ABS(skelAnime->jointTable[shinLimbIndex].y)) < 0) { temp1 += 0x8000; } - temp2 = (sp50 - sp54) * (0x8000 / M_PI); + temp2 = RADF_TO_BINANG(sp50 - sp54); rot->z -= temp2; skelAnime->jointTable[thighLimbIndex].z = skelAnime->jointTable[thighLimbIndex].z - temp2; |
