mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 06:54:33 +00:00
Angle cleanup - RADF_TO_BINANG
(#1155)
* Run formatter * Touch up angle macros (parentheses and hex constants) * Use `RADF_TO_BINANG` more
This commit is contained in:
parent
aab5bc9211
commit
61b864a89c
45 changed files with 120 additions and 128 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue