1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-06-08 09:31:52 +00: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:
Dragorn421 2022-04-24 16:23:49 +02:00 committed by GitHub
parent ef870bdd11
commit fed9ac3e20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 219 additions and 213 deletions

View file

@ -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

View file

@ -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)

View file

@ -957,8 +957,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
} else {
temp_f0_5 = sGlobalCtx->state.input[2].rel.stick_y;
temp_f2_2 = sGlobalCtx->state.input[2].rel.stick_x;
pitch = DEGF_TO_BINANG((SQ(temp_f0_5) / 600.0f) * 0.8f);
yaw = DEGF_TO_BINANG((SQ(temp_f2_2) / 600.0f) * 0.8f);
pitch = CAM_DEG_TO_BINANG((SQ(temp_f0_5) / 600.0f) * 0.8f);
yaw = CAM_DEG_TO_BINANG((SQ(temp_f2_2) / 600.0f) * 0.8f);
if (!D_80161144) {
sp104.pitch += (s16)((temp_f0_5 >= 0.0f) ? pitch : -pitch);
sp104.yaw += (s16)((temp_f2_2 >= 0.0f) ? yaw : -yaw);
@ -974,7 +974,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
OLib_Vec3fDiffToVecSphGeo(&spF4, sp80, sp7C);
DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, spF4.pitch, spF4.yaw, DEGF_TO_BINANG(dbCamera->rollDegrees));
DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, spF4.pitch, spF4.yaw,
CAM_DEG_TO_BINANG(dbCamera->rollDegrees));
if (dbCamera->unk_00 == 1) {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_CRIGHT)) {
cam->inputDir = dbCamera->sub.unk_104A;
@ -1100,9 +1101,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_3C = false;
if (dbCamera->sub.mode != 1) {
func_8006376C(0xD, 0x18, 3, !D_80161144 ? D_8012CF04 : D_8012CF08);
DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.pitch), &D_8012D0E4[11], 4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(sp104.pitch), &D_8012D0E4[11], 4);
func_8006376C(0xF, 0x17, 3, D_8012D0E4);
DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.yaw), &D_8012D0F8[11], 4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(sp104.yaw), &D_8012D0F8[11], 4);
func_8006376C(0xF, 0x18, 3, D_8012D0F8);
DbCamera_SetTextValue(sp104.r, &D_8012D0D4[8], 6);
func_8006376C(0xF, 0x19, 3, D_8012D0D4);
@ -1375,9 +1376,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
: !D_80161144 ? 4
: 3,
D_8012CF30);
DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.pitch), &D_8012D0E4[10], 4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(spFC.pitch), &D_8012D0E4[10], 4);
func_8006376C(3, 0x17, 3, D_8012D0E4);
DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.yaw), &D_8012D0F8[10], 4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(spFC.yaw), &D_8012D0F8[10], 4);
func_8006376C(3, 0x18, 3, D_8012D0F8);
DbCamera_SetTextValue(spFC.r, &D_8012D0D4[7], 6);
func_8006376C(3, 0x19, 3, D_8012D0D4);
@ -1388,9 +1389,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
: D_80161144 ? 4
: 3,
D_8012CF34);
DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.pitch), &D_8012D0E4[10], 4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(spFC.pitch), &D_8012D0E4[10], 4);
func_8006376C(0x1C, 0x17, 3, D_8012D0E4);
DbCamera_SetTextValue(BINANG_TO_DEGF(spFC.yaw), &D_8012D0F8[10], 4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(spFC.yaw), &D_8012D0F8[10], 4);
func_8006376C(0x1C, 0x18, 3, D_8012D0F8);
DbCamera_SetTextValue(spFC.r, &D_8012D0D4[7], 6);
func_8006376C(0x1C, 0x19, 3, D_8012D0D4);
@ -1464,9 +1465,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
DbCamera_SetTextValue(dbCamera->eye.z, &sp111, 6);
func_8006376C(0x1E, 0x19, 2, &sp110);
func_8006376C(0xD, 0x18, 3, !D_80161144 ? D_8012CF04 : D_8012CF08);
DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.pitch), &D_8012D0E4[11], 4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(sp104.pitch), &D_8012D0E4[11], 4);
func_8006376C(0xF, 0x17, 3, D_8012D0E4);
DbCamera_SetTextValue(BINANG_TO_DEGF(sp104.yaw), &D_8012D0F8[11], 4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(sp104.yaw), &D_8012D0F8[11], 4);
func_8006376C(0xF, 0x18, 3, D_8012D0F8);
DbCamera_SetTextValue(sp104.r, &D_8012D0D4[8], 6);
func_8006376C(0xF, 0x19, 3, D_8012D0D4);
@ -2148,7 +2149,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
}
OLib_Vec3fDiffToVecSphGeo(&sp5C, &dbCamera->eye, &dbCamera->at);
DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, sp5C.pitch, sp5C.yaw,
DEGF_TO_BINANG(dbCamera->rollDegrees));
CAM_DEG_TO_BINANG(dbCamera->rollDegrees));
return 2;
}

View file

@ -769,17 +769,17 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
temp = mf->xz;
temp *= temp;
temp += SQ(mf->zz);
rotDest->x = RADF_TO_BINANG(Math_FAtan2F(-mf->yz, sqrtf(temp)));
rotDest->x = RAD_TO_BINANG(Math_FAtan2F(-mf->yz, sqrtf(temp)));
if ((rotDest->x == 0x4000) || (rotDest->x == -0x4000)) {
rotDest->z = 0;
rotDest->y = RADF_TO_BINANG(Math_FAtan2F(-mf->zx, mf->xx));
rotDest->y = RAD_TO_BINANG(Math_FAtan2F(-mf->zx, mf->xx));
} else {
rotDest->y = RADF_TO_BINANG(Math_FAtan2F(mf->xz, mf->zz));
rotDest->y = RAD_TO_BINANG(Math_FAtan2F(mf->xz, mf->zz));
if (!flag) {
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(mf->yx, mf->yy));
rotDest->z = RAD_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 = RADF_TO_BINANG(Math_FAtan2F(temp, temp2));
rotDest->z = RAD_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 = RADF_TO_BINANG(Math_FAtan2F(-mf->zx, sqrtf(temp)));
rotDest->y = RAD_TO_BINANG(Math_FAtan2F(-mf->zx, sqrtf(temp)));
if ((rotDest->y == 0x4000) || (rotDest->y == -0x4000)) {
rotDest->x = 0;
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(-mf->xy, mf->yy));
rotDest->z = RAD_TO_BINANG(Math_FAtan2F(-mf->xy, mf->yy));
} else {
rotDest->z = RADF_TO_BINANG(Math_FAtan2F(mf->yx, mf->xx));
rotDest->z = RAD_TO_BINANG(Math_FAtan2F(mf->yx, mf->xx));
if (!flag) {
rotDest->x = RADF_TO_BINANG(Math_FAtan2F(mf->zy, mf->zz));
rotDest->x = RAD_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 = RADF_TO_BINANG(Math_FAtan2F(temp, temp2));
rotDest->x = RAD_TO_BINANG(Math_FAtan2F(temp, temp2));
}
}
}

View file

@ -4181,12 +4181,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 = -RADF_TO_BINANG(Math_FAtan2F(sp28 * floorPolyNormalY, 1.0f));
arg2->x = -RAD_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 = -RADF_TO_BINANG(Math_FAtan2F(sp24 * floorPolyNormalY, 1.0f));
arg2->z = -RAD_TO_BINANG(Math_FAtan2F(sp24 * floorPolyNormalY, 1.0f));
}
}

View file

@ -565,7 +565,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) {
* Calculates the angle between points `from` and `to`
*/
s16 Camera_XZAngle(Vec3f* to, Vec3f* from) {
return DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(from->x - to->x, from->z - to->z)));
return CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(from->x - to->x, from->z - to->z)));
}
s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) {
@ -630,8 +630,8 @@ s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) {
}
phi_f16 = PCT(OREG(20)) * (D_8015CE50 - camera->playerGroundY);
phi_f18 = (1.0f - PCT(OREG(20))) * (D_8015CE54 - camera->playerGroundY);
temp_s0 = DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(phi_f16, sp30)));
temp_s1 = DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(phi_f18, sp2C)));
temp_s0 = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(phi_f16, sp30)));
temp_s1 = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(phi_f18, sp2C)));
return temp_s0 + temp_s1;
}
@ -1440,7 +1440,7 @@ s32 Camera_Normal1(Camera* camera) {
norm1->yOffset = NEXTSETTING * sp94;
norm1->distMin = NEXTSETTING * sp94;
norm1->distMax = NEXTSETTING * sp94;
norm1->pitchTarget = DEGF_TO_BINANG(NEXTSETTING);
norm1->pitchTarget = CAM_DEG_TO_BINANG(NEXTSETTING);
norm1->unk_0C = NEXTSETTING;
norm1->unk_10 = NEXTSETTING;
norm1->unk_14 = NEXTPCT;
@ -1672,7 +1672,7 @@ s32 Camera_Normal2(Camera* camera) {
norm2->unk_00 = NEXTPCT * playerHeight * yNormal;
norm2->unk_04 = NEXTPCT * playerHeight * yNormal;
norm2->unk_08 = NEXTPCT * playerHeight * yNormal;
norm2->unk_1C = DEGF_TO_BINANG(NEXTSETTING);
norm2->unk_1C = CAM_DEG_TO_BINANG(NEXTSETTING);
norm2->unk_0C = NEXTSETTING;
norm2->unk_10 = NEXTPCT;
norm2->unk_14 = NEXTSETTING;
@ -1830,7 +1830,7 @@ s32 Camera_Normal3(Camera* camera) {
norm3->yOffset = NEXTSETTING * PCT(playerHeight);
norm3->distMin = NEXTSETTING * PCT(playerHeight);
norm3->distMax = NEXTSETTING * PCT(playerHeight);
norm3->pitchTarget = DEGF_TO_BINANG(NEXTSETTING);
norm3->pitchTarget = CAM_DEG_TO_BINANG(NEXTSETTING);
norm3->yawUpdateSpeed = NEXTSETTING;
norm3->unk_10 = NEXTSETTING;
norm3->fovTarget = NEXTSETTING;
@ -1982,8 +1982,8 @@ s32 Camera_Parallel1(Camera* camera) {
para1->yOffset = NEXTPCT * playerHeight * yNormal;
para1->distTarget = NEXTPCT * playerHeight * yNormal;
para1->pitchTarget = DEGF_TO_BINANG(NEXTSETTING);
para1->yawTarget = DEGF_TO_BINANG(NEXTSETTING);
para1->pitchTarget = CAM_DEG_TO_BINANG(NEXTSETTING);
para1->yawTarget = CAM_DEG_TO_BINANG(NEXTSETTING);
para1->unk_08 = NEXTSETTING;
para1->unk_0C = NEXTSETTING;
para1->fovTarget = NEXTSETTING;
@ -2544,7 +2544,7 @@ s32 Camera_Jump3(Camera* camera) {
jump3->yOffset = NEXTSETTING * t2;
jump3->distMin = NEXTSETTING * t2;
jump3->distMax = NEXTSETTING * t2;
jump3->pitchTarget = DEGF_TO_BINANG(NEXTSETTING);
jump3->pitchTarget = CAM_DEG_TO_BINANG(NEXTSETTING);
jump3->swingUpdateRate = NEXTSETTING;
jump3->unk_10 = NEXTSETTING;
jump3->unk_14 = NEXTPCT;
@ -2880,25 +2880,25 @@ s32 Camera_Battle1(Camera* camera) {
skipEyeAtCalc = true;
}
anim->animTimer--;
} else if (ABS(tmpAng1) > DEGF_TO_BINANG(swingAngle)) {
spFC = BINANG_TO_DEGF(tmpAng1);
} else if (ABS(tmpAng1) > CAM_DEG_TO_BINANG(swingAngle)) {
spFC = CAM_BINANG_TO_DEG(tmpAng1);
temp_f2_2 = swingAngle + (spF8 - swingAngle) * (OLib_ClampMaxDist(atToTargetDir.r, spB4.r) / spB4.r);
temp_f12_2 = ((temp_f2_2 * temp_f2_2) - 2.0f) / (temp_f2_2 - 360.0f);
var2 = ((temp_f12_2 * spFC) + (2.0f - (360.0f * temp_f12_2)));
temp_f14 = SQ(spFC) / var2;
tmpAng2 = tmpAng1 >= 0 ? DEGF_TO_BINANG(temp_f14) : (-DEGF_TO_BINANG(temp_f14));
tmpAng2 = tmpAng1 >= 0 ? CAM_DEG_TO_BINANG(temp_f14) : (-CAM_DEG_TO_BINANG(temp_f14));
spB4.yaw = BINANG_ROT180((s16)(BINANG_ROT180(atToEyeNextDir.yaw) + tmpAng2));
} else {
spFC = 0.05f;
spFC = (1 - camera->speedRatio) * spFC;
tmpAng2 = tmpAng1 >= 0 ? DEGF_TO_BINANG(swingAngle) : -DEGF_TO_BINANG(swingAngle);
tmpAng2 = tmpAng1 >= 0 ? CAM_DEG_TO_BINANG(swingAngle) : -CAM_DEG_TO_BINANG(swingAngle);
spB4.yaw = atToEyeNextDir.yaw - (s16)((tmpAng2 - tmpAng1) * spFC);
}
if (!skipEyeAtCalc) {
var3 = atToTargetDir.pitch * batt1->swingPitchAdj;
var2 = F32_LERPIMP(sp7C, sp78, distRatio);
tmpAng1 = DEGF_TO_BINANG(var2) - (s16)(playerToTargetDir.pitch * (0.5f + distRatio * (1.0f - 0.5f)));
tmpAng1 = CAM_DEG_TO_BINANG(var2) - (s16)(playerToTargetDir.pitch * (0.5f + distRatio * (1.0f - 0.5f)));
tmpAng1 += (s16)(var3);
if (tmpAng1 < -0x2AA8) {
@ -2927,7 +2927,7 @@ s32 Camera_Battle1(Camera* camera) {
}
}
anim->roll += (((OREG(36) * camera->speedRatio) * (1.0f - distRatio)) - anim->roll) * PCT(OREG(37));
camera->roll = DEGF_TO_BINANG(anim->roll);
camera->roll = CAM_DEG_TO_BINANG(anim->roll);
camera->fov = Camera_LERPCeilF((player->meleeWeaponState != 0 ? 0.8f
: gSaveContext.health <= 0x10 ? 0.8f
: 1.0f) *
@ -2967,7 +2967,7 @@ s32 Camera_Battle4(Camera* camera) {
batt4->yOffset = NEXTPCT * playerHeight * yNormal;
batt4->rTarget = NEXTPCT * playerHeight * yNormal;
batt4->pitchTarget = DEGF_TO_BINANG(NEXTSETTING);
batt4->pitchTarget = CAM_DEG_TO_BINANG(NEXTSETTING);
batt4->lerpUpdateRate = NEXTPCT;
batt4->fovTarget = NEXTSETTING;
batt4->atLERPTarget = NEXTPCT;
@ -3206,23 +3206,23 @@ s32 Camera_KeepOn1(Camera* camera) {
sp88 = 1;
}
anim->unk_16--;
} else if (ABS(spE2) > DEGF_TO_BINANG(spEC)) {
spF4 = BINANG_TO_DEGF(spE2);
} else if (ABS(spE2) > CAM_DEG_TO_BINANG(spEC)) {
spF4 = CAM_BINANG_TO_DEG(spE2);
t2 = spEC + (spF0 - spEC) * (OLib_ClampMaxDist(spD0.r, spD8.r) / spD8.r);
temp_f12_2 = ((SQ(t2) - 2.0f) / (t2 - 360.0f));
t1 = (temp_f12_2 * spF4) + (2.0f - (360.0f * temp_f12_2));
temp_f14 = SQ(spF4) / t1;
spE0 = spE2 >= 0 ? (DEGF_TO_BINANG(temp_f14)) : (-DEGF_TO_BINANG(temp_f14));
spE0 = spE2 >= 0 ? (CAM_DEG_TO_BINANG(temp_f14)) : (-CAM_DEG_TO_BINANG(temp_f14));
spD8.yaw = BINANG_ROT180((s16)(BINANG_ROT180(spB8.yaw) + spE0));
} else {
spF4 = 0.02f;
spF4 = (1.0f - camera->speedRatio) * spF4;
spE0 = spE2 >= 0 ? DEGF_TO_BINANG(spEC) : -DEGF_TO_BINANG(spEC);
spE0 = spE2 >= 0 ? CAM_DEG_TO_BINANG(spEC) : -CAM_DEG_TO_BINANG(spEC);
spD8.yaw = spB8.yaw - (s16)((spE0 - spE2) * spF4);
}
if (sp88 == 0) {
spE2 = DEGF_TO_BINANG((f32)(keep1->unk_14 + ((keep1->unk_18 - keep1->unk_14) * sp84)));
spE2 = CAM_DEG_TO_BINANG((f32)(keep1->unk_14 + ((keep1->unk_18 - keep1->unk_14) * sp84)));
spE2 -= (s16)(spC8.pitch * (0.5f + (sp84 * 0.5f)));
spE8 = spD0.pitch * keep1->unk_1C;
@ -3351,31 +3351,31 @@ s32 Camera_KeepOn3(Camera* camera) {
anim->animTimer = keep3->initTimer;
spBC = ((1.0f - temp_f0) * targetToPlayerDir.r) / anim->animTimer;
swingAngle = F32_LERPIMP(keep3->swingPitchInitial, keep3->swingPitchFinal, temp_f0);
atToEyeAdj.pitch = DEGF_TO_BINANG(swingAngle) + ((s16)(-(targetToPlayerDir.pitch * keep3->swingPitchAdj)));
atToEyeAdj.pitch = CAM_DEG_TO_BINANG(swingAngle) + ((s16)(-(targetToPlayerDir.pitch * keep3->swingPitchAdj)));
swingAngle = F32_LERPIMP(keep3->swingYawInital, keep3->swingYawFinal, temp_f0);
if (keep3->flags & 0x10) {
if (BINANG_SUB(targetToPlayerDir.yaw, atToEyeNextDir.yaw) < 0) {
atToEyeAdj.yaw = targetToPlayerDir.yaw + DEGF_TO_BINANG(swingAngle);
atToEyeAdj.yaw = targetToPlayerDir.yaw + CAM_DEG_TO_BINANG(swingAngle);
} else {
atToEyeAdj.yaw = targetToPlayerDir.yaw - DEGF_TO_BINANG(swingAngle);
atToEyeAdj.yaw = targetToPlayerDir.yaw - CAM_DEG_TO_BINANG(swingAngle);
}
} else if (keep3->flags & 0x20) {
if (BINANG_SUB(targetToPlayerDir.yaw, atToEyeNextDir.yaw) < 0) {
atToEyeAdj.yaw = BINANG_ROT180(targetToPlayerDir.yaw) - DEGF_TO_BINANG(swingAngle);
atToEyeAdj.yaw = BINANG_ROT180(targetToPlayerDir.yaw) - CAM_DEG_TO_BINANG(swingAngle);
} else {
atToEyeAdj.yaw = BINANG_ROT180(targetToPlayerDir.yaw) + DEGF_TO_BINANG(swingAngle);
atToEyeAdj.yaw = BINANG_ROT180(targetToPlayerDir.yaw) + CAM_DEG_TO_BINANG(swingAngle);
}
} else if (ABS(BINANG_SUB(targetToPlayerDir.yaw, atToEyeNextDir.yaw)) < 0x3FFF) {
if (BINANG_SUB(targetToPlayerDir.yaw, atToEyeNextDir.yaw) < 0) {
atToEyeAdj.yaw = targetToPlayerDir.yaw + DEGF_TO_BINANG(swingAngle);
atToEyeAdj.yaw = targetToPlayerDir.yaw + CAM_DEG_TO_BINANG(swingAngle);
} else {
atToEyeAdj.yaw = targetToPlayerDir.yaw - DEGF_TO_BINANG(swingAngle);
atToEyeAdj.yaw = targetToPlayerDir.yaw - CAM_DEG_TO_BINANG(swingAngle);
}
} else {
if (BINANG_SUB(targetToPlayerDir.yaw, atToEyeNextDir.yaw) < 0) {
atToEyeAdj.yaw = BINANG_ROT180(targetToPlayerDir.yaw) - DEGF_TO_BINANG(swingAngle);
atToEyeAdj.yaw = BINANG_ROT180(targetToPlayerDir.yaw) - CAM_DEG_TO_BINANG(swingAngle);
} else {
atToEyeAdj.yaw = BINANG_ROT180(targetToPlayerDir.yaw) + DEGF_TO_BINANG(swingAngle);
atToEyeAdj.yaw = BINANG_ROT180(targetToPlayerDir.yaw) + CAM_DEG_TO_BINANG(swingAngle);
}
}
prevTargetPlayerDist = targetToPlayerDir.r;
@ -3634,35 +3634,35 @@ s32 Camera_KeepOn4(Camera* camera) {
unk20->unk_10 = keep4->unk_1E;
unk20->unk_08 = playerPosRot->pos.y - camera->playerPosDelta.y;
if (keep4->unk_1C & 2) {
spA2 = DEGF_TO_BINANG(keep4->unk_08);
spA2 = CAM_DEG_TO_BINANG(keep4->unk_08);
spA0 = BINANG_SUB(BINANG_ROT180(playerPosRot->rot.y), spA8.yaw) > 0
? BINANG_ROT180(playerPosRot->rot.y) + DEGF_TO_BINANG(keep4->unk_0C)
: BINANG_ROT180(playerPosRot->rot.y) - DEGF_TO_BINANG(keep4->unk_0C);
? BINANG_ROT180(playerPosRot->rot.y) + CAM_DEG_TO_BINANG(keep4->unk_0C)
: BINANG_ROT180(playerPosRot->rot.y) - CAM_DEG_TO_BINANG(keep4->unk_0C);
} else if (keep4->unk_1C & 4) {
spA2 = DEGF_TO_BINANG(keep4->unk_08);
spA0 = DEGF_TO_BINANG(keep4->unk_0C);
spA2 = CAM_DEG_TO_BINANG(keep4->unk_08);
spA0 = CAM_DEG_TO_BINANG(keep4->unk_0C);
} else if ((keep4->unk_1C & 8) && camera->target != NULL) {
PosRot sp60;
Actor_GetWorldPosShapeRot(&sp60, camera->target);
spA2 = DEGF_TO_BINANG(keep4->unk_08) - sp60.rot.x;
spA2 = CAM_DEG_TO_BINANG(keep4->unk_08) - sp60.rot.x;
spA0 = BINANG_SUB(BINANG_ROT180(sp60.rot.y), spA8.yaw) > 0
? BINANG_ROT180(sp60.rot.y) + DEGF_TO_BINANG(keep4->unk_0C)
: BINANG_ROT180(sp60.rot.y) - DEGF_TO_BINANG(keep4->unk_0C);
? BINANG_ROT180(sp60.rot.y) + CAM_DEG_TO_BINANG(keep4->unk_0C)
: BINANG_ROT180(sp60.rot.y) - CAM_DEG_TO_BINANG(keep4->unk_0C);
spCC[1] = camera->target;
sp9C++;
} else if ((keep4->unk_1C & 0x80) && camera->target != NULL) {
PosRot sp4C;
Actor_GetWorld(&sp4C, camera->target);
spA2 = DEGF_TO_BINANG(keep4->unk_08);
spA2 = CAM_DEG_TO_BINANG(keep4->unk_08);
sp9E = Camera_XZAngle(&sp4C.pos, &playerPosRot->pos);
spA0 = (BINANG_SUB(sp9E, spA8.yaw) > 0) ? sp9E + DEGF_TO_BINANG(keep4->unk_0C)
: sp9E - DEGF_TO_BINANG(keep4->unk_0C);
spA0 = (BINANG_SUB(sp9E, spA8.yaw) > 0) ? sp9E + CAM_DEG_TO_BINANG(keep4->unk_0C)
: sp9E - CAM_DEG_TO_BINANG(keep4->unk_0C);
spCC[1] = camera->target;
sp9C++;
} else if (keep4->unk_1C & 0x40) {
spA2 = DEGF_TO_BINANG(keep4->unk_08);
spA2 = CAM_DEG_TO_BINANG(keep4->unk_08);
spA0 = spA8.yaw;
} else {
spA2 = spA8.pitch;
@ -4458,9 +4458,9 @@ s32 Camera_Data4(Camera* camera) {
atOffset.r = eyeAtOffset.r;
atOffset.yaw =
(initParams->jfifId & 1) ? (DEGF_TO_BINANG(camera->data2) + initParams->eyePosRot.rot.y) : eyeAtOffset.yaw;
(initParams->jfifId & 1) ? (CAM_DEG_TO_BINANG(camera->data2) + initParams->eyePosRot.rot.y) : eyeAtOffset.yaw;
atOffset.pitch =
(initParams->jfifId & 2) ? (DEGF_TO_BINANG(camera->data3) + initParams->eyePosRot.rot.x) : eyeAtOffset.pitch;
(initParams->jfifId & 2) ? (CAM_DEG_TO_BINANG(camera->data3) + initParams->eyePosRot.rot.x) : eyeAtOffset.pitch;
Camera_Vec3fVecSphGeoAdd(at, eye, &atOffset);
@ -4503,7 +4503,7 @@ s32 Camera_Unique1(Camera* camera) {
uniq1->yOffset = NEXTPCT * playerHeight * yNormal;
uniq1->distMin = NEXTPCT * playerHeight * yNormal;
uniq1->distMax = NEXTPCT * playerHeight * yNormal;
uniq1->pitchTarget = DEGF_TO_BINANG(NEXTSETTING);
uniq1->pitchTarget = CAM_DEG_TO_BINANG(NEXTSETTING);
uniq1->fovTarget = NEXTSETTING;
uniq1->atLERPScaleMax = NEXTPCT;
uniq1->interfaceFlags = NEXTSETTING;
@ -5115,8 +5115,8 @@ s32 Camera_Unique9(Camera* camera) {
playerhead.pos.z = playerPosRot.pos.z;
OLib_Vec3fDiffToVecSphGeo(&playerTargetOffset, &targethead.pos, &playerhead.pos);
if (atInitFlags & (s16)0x8080) {
scratchSph.pitch = DEGF_TO_BINANG(anim->curKeyFrame->atTargetInit.x);
scratchSph.yaw = DEGF_TO_BINANG(anim->curKeyFrame->atTargetInit.y);
scratchSph.pitch = CAM_DEG_TO_BINANG(anim->curKeyFrame->atTargetInit.x);
scratchSph.yaw = CAM_DEG_TO_BINANG(anim->curKeyFrame->atTargetInit.y);
scratchSph.r = anim->curKeyFrame->atTargetInit.z;
} else {
OLib_Vec3fToVecSphGeo(&scratchSph, &anim->curKeyFrame->atTargetInit);
@ -5153,8 +5153,8 @@ s32 Camera_Unique9(Camera* camera) {
}
if (atInitFlags & (s16)0x8080) {
scratchSph.pitch = DEGF_TO_BINANG(anim->curKeyFrame->atTargetInit.x);
scratchSph.yaw = DEGF_TO_BINANG(anim->curKeyFrame->atTargetInit.y);
scratchSph.pitch = CAM_DEG_TO_BINANG(anim->curKeyFrame->atTargetInit.x);
scratchSph.yaw = CAM_DEG_TO_BINANG(anim->curKeyFrame->atTargetInit.y);
scratchSph.r = anim->curKeyFrame->atTargetInit.z;
} else {
OLib_Vec3fToVecSphGeo(&scratchSph, &anim->curKeyFrame->atTargetInit);
@ -5204,8 +5204,8 @@ s32 Camera_Unique9(Camera* camera) {
}
if (eyeInitFlags & (s16)0x8080) {
scratchSph.pitch = DEGF_TO_BINANG(anim->curKeyFrame->eyeTargetInit.x);
scratchSph.yaw = DEGF_TO_BINANG(anim->curKeyFrame->eyeTargetInit.y);
scratchSph.pitch = CAM_DEG_TO_BINANG(anim->curKeyFrame->eyeTargetInit.x);
scratchSph.yaw = CAM_DEG_TO_BINANG(anim->curKeyFrame->eyeTargetInit.y);
scratchSph.r = anim->curKeyFrame->eyeTargetInit.z;
} else {
OLib_Vec3fToVecSphGeo(&scratchSph, &anim->curKeyFrame->eyeTargetInit);
@ -5245,8 +5245,8 @@ s32 Camera_Unique9(Camera* camera) {
}
if (eyeInitFlags & (s16)0x8080) {
scratchSph.pitch = DEGF_TO_BINANG(anim->curKeyFrame->eyeTargetInit.x);
scratchSph.yaw = DEGF_TO_BINANG(anim->curKeyFrame->eyeTargetInit.y);
scratchSph.pitch = CAM_DEG_TO_BINANG(anim->curKeyFrame->eyeTargetInit.x);
scratchSph.yaw = CAM_DEG_TO_BINANG(anim->curKeyFrame->eyeTargetInit.y);
scratchSph.r = anim->curKeyFrame->eyeTargetInit.z;
} else {
OLib_Vec3fToVecSphGeo(&scratchSph, &anim->curKeyFrame->eyeTargetInit);
@ -5275,7 +5275,7 @@ s32 Camera_Unique9(Camera* camera) {
anim->rollTarget = camera->roll;
} else {
anim->fovTarget = anim->curKeyFrame->fovTargetInit;
anim->rollTarget = DEGF_TO_BINANG(anim->curKeyFrame->rollTargetInit);
anim->rollTarget = CAM_DEG_TO_BINANG(anim->curKeyFrame->rollTargetInit);
}
action = anim->curKeyFrame->actionFlags & 0x1F;
@ -5391,7 +5391,7 @@ s32 Camera_Unique9(Camera* camera) {
camera->at.y += camera->playerPosDelta.y * anim->curKeyFrame->lerpStepScale;
camera->at.z = Camera_LERPCeilF(anim->atTarget.z, camera->at.z, anim->curKeyFrame->lerpStepScale, 1.0f);
OLib_Vec3fDiffToVecSphGeo(&scratchSph, at, eyeNext);
scratchSph.yaw += DEGF_TO_BINANG(anim->curKeyFrame->eyeTargetInit.y);
scratchSph.yaw += CAM_DEG_TO_BINANG(anim->curKeyFrame->eyeTargetInit.y);
// 3A98 ~ 82.40 degrees
if (scratchSph.pitch >= 0x3A99) {
@ -6402,7 +6402,7 @@ s32 Camera_Special5(Camera* camera) {
spec5->eyeDist = NEXTSETTING;
spec5->minDistForRot = NEXTSETTING;
spec5->timerInit = NEXTSETTING;
spec5->pitch = DEGF_TO_BINANG(NEXTSETTING);
spec5->pitch = CAM_DEG_TO_BINANG(NEXTSETTING);
spec5->fovTarget = NEXTSETTING;
spec5->atMaxLERPScale = NEXTPCT;
spec5->interfaceFlags = NEXTSETTING;
@ -7293,8 +7293,8 @@ void Camera_UpdateDistortion(Camera* camera) {
return;
}
depthPhase += DEGF_TO_BINANG(depthPhaseStep);
screenPlanePhase += DEGF_TO_BINANG(screenPlanePhaseStep);
depthPhase += CAM_DEG_TO_BINANG(depthPhaseStep);
screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep);
View_SetDistortionOrientation(&camera->globalCtx->view, Math_CosS(depthPhase) * 0.0f,
Math_SinS(depthPhase) * 0.0f, Math_SinS(screenPlanePhase) * 0.0f);
@ -7498,7 +7498,7 @@ Vec3s Camera_Update(Camera* camera) {
OLib_Vec3fDiffToVecSphGeo(&eyeAtAngle, &viewEye, &viewAt);
Camera_CalcUpFromPitchYawRoll(&viewUp, eyeAtAngle.pitch + quake.rotZ, eyeAtAngle.yaw + quake.unk_1A,
camera->roll);
viewFov = camera->fov + BINANG_TO_DEGF(quake.zoom);
viewFov = camera->fov + CAM_BINANG_TO_DEG(quake.zoom);
} else {
viewAt = camera->at;
viewEye = camera->eye;
@ -7537,9 +7537,9 @@ Vec3s Camera_Update(Camera* camera) {
if (PREG(81)) {
osSyncPrintf("dir (%d) %d(%f) %d(%f) 0(0) \n", sUpdateCameraDirection, camera->inputDir.x,
BINANG_TO_DEGF(camera->inputDir.x), camera->inputDir.y, BINANG_TO_DEGF(camera->inputDir.y));
CAM_BINANG_TO_DEG(camera->inputDir.x), camera->inputDir.y, CAM_BINANG_TO_DEG(camera->inputDir.y));
osSyncPrintf("real (%d) %d(%f) %d(%f) 0(0) \n", sUpdateCameraDirection, camera->camDir.x,
BINANG_TO_DEGF(camera->camDir.x), camera->camDir.y, BINANG_TO_DEGF(camera->camDir.y));
CAM_BINANG_TO_DEG(camera->camDir.x), camera->camDir.y, CAM_BINANG_TO_DEG(camera->camDir.y));
}
if (camera->timer != -1 && CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_DRIGHT)) {
@ -7550,7 +7550,8 @@ Vec3s Camera_Update(Camera* camera) {
osSyncPrintf("camera: out (%f %f %f) (%f %f %f)\n", camera->at.x, camera->at.y, camera->at.z, camera->eye.x,
camera->eye.y, camera->eye.z);
osSyncPrintf("camera: dir (%f %d(%f) %d(%f)) (%f)\n", eyeAtAngle.r, eyeAtAngle.pitch,
BINANG_TO_DEGF(eyeAtAngle.pitch), eyeAtAngle.yaw, BINANG_TO_DEGF(eyeAtAngle.yaw), camera->fov);
CAM_BINANG_TO_DEG(eyeAtAngle.pitch), eyeAtAngle.yaw, CAM_BINANG_TO_DEG(eyeAtAngle.yaw),
camera->fov);
if (camera->player != NULL) {
osSyncPrintf("camera: foot(%f %f %f) dist (%f)\n", curPlayerPosRot.pos.x, curPlayerPosRot.pos.y,
curPlayerPosRot.pos.z, camera->dist);
@ -7933,7 +7934,7 @@ s32 Camera_SetParam(Camera* camera, s32 param, void* value) {
camera->up = *(Vec3f*)value;
break;
case 0x40:
camera->roll = DEGF_TO_BINANG(*(f32*)value);
camera->roll = CAM_DEG_TO_BINANG(*(f32*)value);
break;
case 0x20:
camera->fov = *(f32*)value;

View file

@ -117,14 +117,14 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) {
if ((dist == 0.0f) && (vec->y == 0.0f)) {
sph.pitch = 0;
} else {
sph.pitch = DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(dist, vec->y)));
sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(dist, vec->y)));
}
sph.r = sqrtf(SQ(vec->y) + distSquared);
if ((vec->x == 0.0f) && (vec->z == 0.0f)) {
sph.yaw = 0;
} else {
sph.yaw = DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(vec->x, vec->z)));
sph.yaw = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(vec->x, vec->z)));
}
*dest = sph;
@ -196,8 +196,8 @@ Vec3f* OLib_Vec3fDiffDegF(Vec3f* dest, Vec3f* a, Vec3f* b) {
OLib_Vec3fDiffRad(&anglesRad, a, b);
anglesDegrees.x = RADF_TO_DEGF(anglesRad.x);
anglesDegrees.y = RADF_TO_DEGF(anglesRad.y);
anglesDegrees.x = RAD_TO_DEG(anglesRad.x);
anglesDegrees.y = RAD_TO_DEG(anglesRad.y);
anglesDegrees.z = 0.0f;
*dest = anglesDegrees;
@ -214,8 +214,8 @@ Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b) {
OLib_Vec3fDiffRad(&anglesRad, a, b);
anglesBinAng.x = DEGF_TO_BINANG(RADF_TO_DEGF(anglesRad.x));
anglesBinAng.y = DEGF_TO_BINANG(RADF_TO_DEGF(anglesRad.y));
anglesBinAng.x = CAM_DEG_TO_BINANG(RAD_TO_DEG(anglesRad.x));
anglesBinAng.y = CAM_DEG_TO_BINANG(RAD_TO_DEG(anglesRad.y));
anglesBinAng.z = 0.0f;
*dest = anglesBinAng;

View file

@ -22,7 +22,7 @@ void OnePointCutscene_AddVecSphToVec3f(Vec3f* dst, Vec3f* src, VecSph* vecSph) {
}
s16 OnePointCutscene_Vec3fYaw(Vec3f* vec1, Vec3f* vec2) {
return DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(vec2->x - vec1->x, vec2->z - vec1->z)));
return CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(vec2->x - vec1->x, vec2->z - vec1->z)));
}
void OnePointCutscene_Vec3sToVec3f(Vec3f* src, Vec3s* dst) {
@ -95,7 +95,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
D_80120964[0].eyeTargetInit = globalCtx->view.eye;
D_80120964[0].fovTargetInit = globalCtx->view.fovy;
OLib_Vec3fDiffToVecSphGeo(&spD0, &mainCam->at, &mainCam->eye);
D_80120964[1].eyeTargetInit.y = BINANG_TO_DEGF(spD0.yaw);
D_80120964[1].eyeTargetInit.y = CAM_BINANG_TO_DEG(spD0.yaw);
D_80120964[1].timerInit = timer - 1;
csInfo->keyFrames = D_80120964;
@ -310,7 +310,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
case 2210:
OLib_Vec3fDiffToVecSphGeo(&spD0, &player->actor.world.pos, &actor->world.pos);
D_801213B4[0].eyeTargetInit.y = D_801213B4[1].eyeTargetInit.y = D_801213B4[2].eyeTargetInit.y =
D_801213B4[2].atTargetInit.y = BINANG_TO_DEGF(spD0.yaw);
D_801213B4[2].atTargetInit.y = CAM_BINANG_TO_DEG(spD0.yaw);
if (Rand_ZeroOne() < 0.0f) {
D_801213B4[3].eyeTargetInit.x = -D_801213B4[3].eyeTargetInit.x;
}

View file

@ -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 = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
*yaw = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
return SQ(dx) + SQ(dz);
}

View file

@ -1014,14 +1014,14 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
sp50 = Math_FAtan2F(sp58, sp60);
temp1 = RADF_TO_BINANG(M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50)));
temp1 = RAD_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 = RADF_TO_BINANG(sp50 - sp54);
temp2 = RAD_TO_BINANG(sp50 - sp54);
rot->z -= temp2;
skelAnime->jointTable[thighLimbIndex].z = skelAnime->jointTable[thighLimbIndex].z - temp2;

View file

@ -290,7 +290,7 @@ void func_808AD450(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot02_objects.c", 736);
if (globalCtx->csCtx.state != 0 && globalCtx->csCtx.npcActions[2] != NULL) {
u16 temp_v1 = BINANG_TO_DEGF(globalCtx->csCtx.npcActions[2]->urot.z);
u16 temp_v1 = CAM_BINANG_TO_DEG(globalCtx->csCtx.npcActions[2]->urot.z);
if (this->unk_170 != temp_v1) {
if (this->unk_170 == 0xFFFF) {

View file

@ -694,7 +694,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) {
sp48 = sp4C->x - this->actor.world.pos.x;
sp44 = sp4C->z - this->actor.world.pos.z;
Math_SmoothStepToF(&this->unk_1E8, 2000.0f, 1.0f, this->unk_1EC * 80.0f, 0.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp48, sp44)), 5,
Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(sp48, sp44)), 5,
(this->unk_1EC * this->unk_1E8), 5);
Math_SmoothStepToS(&this->unk_1C4, 0, 2, 2000, 0);
@ -771,7 +771,7 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) {
sp4C = sp5C->x - this->actor.world.pos.x;
sp48 = sp5C->z - this->actor.world.pos.z;
Math_SmoothStepToF(&this->unk_1E8, 2000.0f, 1.0f, this->unk_1EC * 100.0f, 0.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp4C, sp48)), 5,
Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(sp4C, sp48)), 5,
this->unk_1EC * this->unk_1E8, 0);
if (fabsf(sp4C) <= 15.0f && fabsf(sp48) <= 15.0f) {
@ -1404,7 +1404,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) {
tempSin = cornerPos->x - this->actor.world.pos.x;
tempCos = cornerPos->z - this->actor.world.pos.z;
Math_SmoothStepToF(&this->unk_1E8, 1500.0f, 1.0f, this->unk_1EC * 100.0f, 0.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(tempSin, tempCos)), 5,
Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(tempSin, tempCos)), 5,
(this->unk_1EC * this->unk_1E8), 0);
if ((fabsf(tempSin) <= 15.0f) && (fabsf(tempCos) <= 15.0f)) {

View file

@ -289,8 +289,8 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) {
this->fwork[BFD_FLY_WOBBLE_AMP];
dz += Math_SinS((1796.0f + this->fwork[BFD_FLY_WOBBLE_RATE]) * this->work[BFD_MOVE_TIMER]) *
this->fwork[BFD_FLY_WOBBLE_AMP];
angleToTarget = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
pitchToTarget = RADF_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz))));
angleToTarget = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
pitchToTarget = RAD_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz))));
osSyncPrintf("MODE %d\n", this->work[BFD_ACTION_STATE]);

View file

@ -4221,9 +4221,9 @@ void func_808E1EB4(Actor* thisx, GlobalContext* globalCtx2) {
yDiff = dorf->unk_1FC.y - this->actor.world.pos.y;
zDiff = dorf->unk_1FC.z - this->actor.world.pos.z;
yRotTarget = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
yRotTarget = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
xRotTarget = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
xRotTarget = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
Math_ApproachS(&this->actor.world.rot.x, xRotTarget, 1, 0x1000);
Math_ApproachS(&this->actor.world.rot.y, yRotTarget, 1, 0x1000);
@ -4348,10 +4348,10 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
xDiff = dorf->unk_278.x - this->actor.world.pos.x;
yDiff = dorf->unk_278.y - this->actor.world.pos.y;
zDiff = dorf->unk_278.z - this->actor.world.pos.z;
sp80 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
sp80 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
xRot = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
xRot = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
sp84 = (xzDist * 700.0f) / 10.0f;
if (sp84 > 6144.0f) {
sp84 = 6144.0f;
@ -4389,7 +4389,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
this->fwork[1] = 255.0f;
this->unk_1F0 = player->actor.world.pos;
new_var = this->unk_1F0.x - this->actor.world.pos.x;
this->actor.shape.rot.y = RADF_TO_BINANG(Math_FAtan2F(new_var, this->unk_1F0.z - this->actor.world.pos.z)) +
this->actor.shape.rot.y = RAD_TO_BINANG(Math_FAtan2F(new_var, this->unk_1F0.z - this->actor.world.pos.z)) +
(this->actor.params << 0xD) - 0x20C000;
// fallthrough
case 11:
@ -4399,8 +4399,8 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
yDiff = (this->unk_1F0.y + 30.0f) - this->actor.world.pos.y;
zDiff = this->unk_1F0.z - this->actor.world.pos.z;
sp80 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, sqrtf(SQ(xDiff) + SQ(zDiff))));
sp80 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(yDiff, sqrtf(SQ(xDiff) + SQ(zDiff))));
Math_ApproachS(&this->actor.shape.rot.y, sp80, 1, this->csCamMaxStepScale);
Math_ApproachF(&this->csCamMaxStepScale, 4096.0f, 1.0f, 256.0f);
}
@ -4489,9 +4489,9 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
yDiff = this->unk_1F0.y - this->actor.world.pos.y;
zDiff = this->unk_1F0.z - this->actor.world.pos.z;
sp80 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
sp80 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
xRot = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
xRot = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
sp84 = (xzDist * 700.0f) / 10.0f;
if (sp84 > 6144.0f) {

View file

@ -843,8 +843,7 @@ void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) {
vecToLink.y = playerx->world.pos.y + 40.0f - thisx->world.pos.y;
vecToLink.z = playerx->world.pos.z - thisx->world.pos.z;
thisx->world.rot.y = thisx->shape.rot.y;
thisx->world.rot.x =
RADF_TO_BINANG(Math_FAtan2F(vecToLink.y, sqrtf(SQ(vecToLink.x) + SQ(vecToLink.z))));
thisx->world.rot.x = RAD_TO_BINANG(Math_FAtan2F(vecToLink.y, sqrtf(SQ(vecToLink.x) + SQ(vecToLink.z))));
}
func_8002D908(thisx);

View file

@ -1280,8 +1280,8 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) {
dz = this->targetPos.z - this->cameraEye.z;
tempY = Math_FAtan2F(dx, dz);
tempX = Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz)));
Math_ApproachS(&this->actor.world.rot.y, RADF_TO_BINANG(tempY), 5, this->cameraYawRate);
Math_ApproachS(&this->actor.world.rot.x, RADF_TO_BINANG(tempX), 5, this->cameraYawRate);
Math_ApproachS(&this->actor.world.rot.y, RAD_TO_BINANG(tempY), 5, this->cameraYawRate);
Math_ApproachS(&this->actor.world.rot.x, RAD_TO_BINANG(tempX), 5, this->cameraYawRate);
if (this->work[MO_TENT_MOVE_TIMER] == 150) {
this->cameraAtVel.x = fabsf(this->cameraAt.x - player->actor.world.pos.x);
this->cameraAtVel.y = fabsf(this->cameraAt.y - player->actor.world.pos.y);
@ -2133,8 +2133,8 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) {
spDC = this->targetPos.x - this->actor.world.pos.x;
spD8 = this->targetPos.y - this->actor.world.pos.y;
spD4 = this->targetPos.z - this->actor.world.pos.z;
spCC = RADF_TO_BINANG(Math_FAtan2F(spDC, spD4));
spD0 = RADF_TO_BINANG(Math_FAtan2F(spD8, sqrtf(SQ(spDC) + SQ(spD4))));
spCC = RAD_TO_BINANG(Math_FAtan2F(spDC, spD4));
spD0 = RAD_TO_BINANG(Math_FAtan2F(spD8, sqrtf(SQ(spDC) + SQ(spD4))));
Math_ApproachS(&this->actor.world.rot.y, spCC, this->tentMaxAngle, this->tentSpeed);
Math_ApproachS(&this->actor.world.rot.x, spD0, this->tentMaxAngle, this->tentSpeed);
func_8002D908(&this->actor);

View file

@ -689,9 +689,9 @@ void BossTw_FlyTo(BossTw* this, GlobalContext* globalCtx) {
yDiff = this->targetPos.y - this->actor.world.pos.y;
zDiff = this->targetPos.z - this->actor.world.pos.z;
yawTarget = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
yawTarget = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
pitchTarget = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
pitchTarget = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
Math_ApproachS(&this->actor.world.rot.x, pitchTarget, 0xA, this->rotateSpeed);
Math_ApproachS(&this->actor.world.rot.y, yawTarget, 0xA, this->rotateSpeed);
@ -2370,8 +2370,8 @@ void BossTw_DeathBall(BossTw* this, GlobalContext* globalCtx) {
yDiff = this->targetPos.y - this->actor.world.pos.y;
zDiff = this->targetPos.z - this->actor.world.pos.z;
yaw = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
Math_ApproachS(&this->actor.world.rot.x, RADF_TO_BINANG(Math_FAtan2F(yDiff, sqrtf(SQ(xDiff) + SQ(zDiff)))), 5,
yaw = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
Math_ApproachS(&this->actor.world.rot.x, RAD_TO_BINANG(Math_FAtan2F(yDiff, sqrtf(SQ(xDiff) + SQ(zDiff)))), 5,
this->rotateSpeed);
Math_ApproachS(&this->actor.world.rot.y, yaw, 5, this->rotateSpeed);
func_8002D908(&this->actor);
@ -3934,10 +3934,10 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) {
yDiff = (player->actor.world.pos.y + 30.0f) - this->actor.world.pos.y;
zDiff = player->actor.world.pos.z - this->actor.world.pos.z;
// yaw
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
// pitch
distXZ = sqrtf(SQ(xDiff) + SQ(zDiff));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, distXZ));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(yDiff, distXZ));
this->actor.speedXZ = 20.0f;
for (i = 0; i < 50; i++) {
@ -4124,9 +4124,9 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) {
xDiff = player->actor.world.pos.x - this->actor.world.pos.x;
yDiff = (player->actor.world.pos.y + 30.0f) - this->actor.world.pos.y;
zDiff = player->actor.world.pos.z - this->actor.world.pos.z;
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
this->actor.speedXZ = 20.0f;
for (i = 0; i < 50; i++) {
this->blastTailPos[i] = this->actor.world.pos;
@ -5393,9 +5393,9 @@ void BossTw_TwinrovaSetupFly(BossTw* this, GlobalContext* globalCtx) {
this->actionFunc = BossTw_TwinrovaFly;
this->rotateSpeed = 0.0f;
this->actor.speedXZ = 0.0f;
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -10.0f);
}
@ -5412,9 +5412,9 @@ void BossTw_TwinrovaFly(BossTw* this, GlobalContext* globalCtx) {
xDiff = this->targetPos.x - this->actor.world.pos.x;
yDiff = this->targetPos.y - this->actor.world.pos.y;
zDiff = this->targetPos.z - this->actor.world.pos.z;
yaw = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
yaw = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
Math_ApproachS(&this->actor.world.rot.x, (f32)RADF_TO_BINANG(Math_FAtan2F(yDiff, xzDist)), 0xA, this->rotateSpeed);
Math_ApproachS(&this->actor.world.rot.x, (f32)RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist)), 0xA, this->rotateSpeed);
Math_ApproachS(&this->actor.world.rot.y, yaw, 0xA, this->rotateSpeed);
Math_ApproachS(&this->actor.shape.rot.y, yaw, 0xA, this->rotateSpeed);
Math_ApproachF(&this->rotateSpeed, 2000.0f, 1.0f, 100.0f);

View file

@ -1471,7 +1471,7 @@ void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* glo
}
if (startPos.x != endPos.x || startPos.y != endPos.y || startPos.z != endPos.z) {
this->jewelCsRotation.x = RADF_TO_BINANG(Math_Atan2F(endPos.z - startPos.z, -(endPos.x - startPos.x)));
this->jewelCsRotation.x = RAD_TO_BINANG(Math_Atan2F(endPos.z - startPos.z, -(endPos.x - startPos.x)));
this->jewelCsRotation.y = Math_Vec3f_Yaw(&startPos, &endPos);
}
@ -2093,8 +2093,8 @@ void DemoEffect_FaceToCsEndpoint(DemoEffect* this, Vec3f startPos, Vec3f endPos)
f32 z = endPos.z - startPos.z;
f32 xzDistance = sqrtf(SQ(x) + SQ(z));
this->actor.shape.rot.y = RADF_TO_BINANG(Math_FAtan2F(x, z));
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(-(endPos.y - startPos.y), xzDistance));
this->actor.shape.rot.y = RAD_TO_BINANG(Math_FAtan2F(x, z));
this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(-(endPos.y - startPos.y), xzDistance));
}
/**

View file

@ -550,10 +550,10 @@ void DemoGj_SetupMovement(DemoGj* this, GlobalContext* globalCtx) {
zDistance = player->actor.world.pos.z - pos->z;
if (xDistance != 0.0f || zDistance != 0.0f) {
actor->world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDistance, zDistance));
actor->world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDistance, zDistance));
}
} else {
actor->world.rot.y = RADF_TO_BINANG(Math_FAtan2F(xDistance, zDistance));
actor->world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDistance, zDistance));
}
}
}

View file

@ -120,8 +120,8 @@ void EnAnubice_AimFireball(EnAnubice* this, GlobalContext* globalCtx) {
z = player->actor.world.pos.z - this->headPos.z;
xzDist = sqrtf(SQ(x) + SQ(z));
this->fireballRot.x = -RADF_TO_BINANG(Math_FAtan2F(y, xzDist));
this->fireballRot.y = RADF_TO_BINANG(Math_FAtan2F(x, z));
this->fireballRot.x = -RAD_TO_BINANG(Math_FAtan2F(y, xzDist));
this->fireballRot.y = RAD_TO_BINANG(Math_FAtan2F(x, z));
}
void EnAnubice_Init(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -227,7 +227,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
(this->unk_222 == 0)) {
if (sp74 != NULL) {
sp74 = SEGMENTED_TO_VIRTUAL(sp74);
sp62 = RADF_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z));
sp62 = RAD_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z));
} else {
sp62 = this->actor.world.rot.y + 0x8000;
}
@ -305,7 +305,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
&sp74, 1, 0, 0, 1);
if (sp64 != 0) {
sp74 = SEGMENTED_TO_VIRTUAL(sp74);
sp60 = RADF_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z));
sp60 = RAD_TO_BINANG(Math_FAtan2F(sp74->normal.x, sp74->normal.z));
if (this->unk_236 != sp60) {
if ((s16)(this->actor.yawTowardsPlayer - sp60) >= 0) {
this->unk_238 = 0x4000;

View file

@ -445,9 +445,9 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) {
// Calculate the direction for the Arwing to fly and the rotation for the Arwing
// based on the Arwing's direction, and current rotation.
worldRotationTargetY = RADF_TO_BINANG(Math_FAtan2F(vectorToTargetX, vectorToTargetZ));
worldRotationTargetY = RAD_TO_BINANG(Math_FAtan2F(vectorToTargetX, vectorToTargetZ));
worldRotationTargetX =
RADF_TO_BINANG(Math_FAtan2F(vectorToTargetY, sqrtf(SQ(vectorToTargetX) + SQ(vectorToTargetZ))));
RAD_TO_BINANG(Math_FAtan2F(vectorToTargetY, sqrtf(SQ(vectorToTargetX) + SQ(vectorToTargetZ))));
if ((worldRotationTargetX < 0) && (this->actor.world.pos.y < this->actor.floorHeight + 20.0f)) {
worldRotationTargetX = 0;
}

View file

@ -290,7 +290,7 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) {
EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint);
xDiff = pathPos.x - this->actor.world.pos.x;
zDiff = pathPos.z - this->actor.world.pos.z;
walkAngle1 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
walkAngle1 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->walkAngle = walkAngle1;
this->walkDist = sqrtf((xDiff * xDiff) + (zDiff * zDiff));
@ -305,7 +305,7 @@ s32 EnCs_HandleWalking(EnCs* this, GlobalContext* globalCtx) {
EnCs_GetPathPoint(globalCtx->setupPathList, &pathPos, this->path, this->waypoint);
xDiff = pathPos.x - this->actor.world.pos.x;
zDiff = pathPos.z - this->actor.world.pos.z;
walkAngle2 = RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
walkAngle2 = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
this->walkAngle = walkAngle2;
this->walkDist = sqrtf((xDiff * xDiff) + (zDiff * zDiff));
}

View file

@ -411,7 +411,7 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) {
pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint;
dx = pointPos->x - this->actor.world.pos.x;
dz = pointPos->z - this->actor.world.pos.z;
this->rotYtowardsPath = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
this->rotYtowardsPath = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
dxz = sqrtf(SQ(dx) + SQ(dz));
if (dxz > 10.0f) {
exitLoop = true;
@ -499,7 +499,7 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, GlobalContext* globalCtx) {
Matrix_MultVec3f(&D_809E4148, &vec);
gerudoGuard =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y,
this->initPos.z + vec.z, 0, RADF_TO_BINANG(Math_FAtan2F(-vec.x, -vec.z)), 0, 2);
this->initPos.z + vec.z, 0, RAD_TO_BINANG(Math_FAtan2F(-vec.x, -vec.z)), 0, 2);
if (gerudoGuard == NULL) {
Actor_Kill(&this->actor);
@ -526,7 +526,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) {
pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint;
dx = pointPos->x - this->actor.world.pos.x;
dz = pointPos->z - this->actor.world.pos.z;
ry = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
ry = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
dxz = sqrtf(SQ(dx) + SQ(dz));
if (dxz <= 20.88f) {
this->waypoint++;

View file

@ -364,7 +364,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) {
pathPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->waypoint];
xDist = pathPos->x - this->actor.world.pos.x;
zDist = pathPos->z - this->actor.world.pos.z;
runAngle = RADF_TO_BINANG(Math_FAtan2F(xDist, zDist));
runAngle = RAD_TO_BINANG(Math_FAtan2F(xDist, zDist));
runDist = sqrtf((xDist * xDist) + (zDist * zDist));
run = false;

View file

@ -342,7 +342,7 @@ void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
dx = this->flowerPos.x - this->actor.world.pos.x;
dz = this->flowerPos.z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
this->actor.velocity.y = 9.0f;

View file

@ -303,7 +303,7 @@ void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
dx = 1340.0f + 3.0f - this->actor.world.pos.x;
dz = 0.0f - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 0x32, 0xBB8, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 0x32, 0xBB8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
@ -382,8 +382,8 @@ void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx) {
dx = this->flowerPos.x - this->actor.world.pos.x;
dz = -180.0f - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 3, 0x1388, 0);
if (fabsf(this->actor.shape.rot.y - RADF_TO_BINANG(Math_FAtan2F(dx, dz))) < 20.0f) {
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 3, 0x1388, 0);
if (fabsf(this->actor.shape.rot.y - RAD_TO_BINANG(Math_FAtan2F(dx, dz))) < 20.0f) {
this->actor.speedXZ = 1.0f;
}
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) {
@ -453,7 +453,7 @@ void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx) {
f32 dx = this->targetPos.x - this->actor.world.pos.x;
f32 dz = this->targetPos.z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
turnMod = 90.0f;
}
if ((Rand_ZeroFloat(10.0f + turnMod) < 1.0f) && (this->action != DNT_ACTION_ATTACK)) {
@ -525,7 +525,7 @@ void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) {
this->actor.speedXZ = 0.0f;
return;
}
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 1, 0xBB8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
} else {
if (this->timer1 == 1) {
@ -668,7 +668,7 @@ void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) {
dx = player->actor.world.pos.x - this->mouthPos.x;
dy = player->actor.world.pos.y + 30.0f - this->mouthPos.y;
dz = player->actor.world.pos.z - this->mouthPos.z;
Math_SmoothStepToS(&this->actor.shape.rot.x, -RADF_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz)))), 3, 0x1388,
Math_SmoothStepToS(&this->actor.shape.rot.x, -RAD_TO_BINANG(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz)))), 3, 0x1388,
0);
if ((frame >= this->endFrame) && (this->timer2 == 0)) {
this->timer2 = (s16)Rand_ZeroFloat(10.0f) + 10;
@ -721,7 +721,7 @@ void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
sp2C = this->flowerPos.x - this->actor.world.pos.x;
sp28 = this->flowerPos.z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp2C, sp28)), 1, 0xBB8, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(sp2C, sp28)), 1, 0xBB8, 0);
if (this->timer5 == 0) {
this->timer5 = 10;
} else if (!(this->timer5 & 1)) {

View file

@ -518,7 +518,7 @@ void EnFd_Land(EnFd* this, GlobalContext* globalCtx) {
this->spinTimer = Rand_S16Offset(60, 90);
this->runRadius = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos);
EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir);
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z));
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFD_ANIM_4);
this->actionFunc = EnFd_SpinAndSpawnFire;
}
@ -619,7 +619,7 @@ void EnFd_Run(EnFd* this, GlobalContext* globalCtx) {
}
Math_SmoothStepToF(&this->runRadius, runRadiusTarget, 0.3f, 100.0f, 0.0f);
EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir);
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z)), 4, 0xFA0, 1);
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(adjPos.x, adjPos.z)), 4, 0xFA0, 1);
this->actor.world.rot = this->actor.shape.rot;
func_8002F974(&this->actor, NA_SE_EN_FLAME_RUN - SFX_FLAG);
if (this->skelAnime.curFrame == 6.0f || this->skelAnime.curFrame == 13.0f || this->skelAnime.curFrame == 28.0f) {

View file

@ -150,9 +150,9 @@ void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx) {
dxL = player->actor.world.pos.x - this->actor.world.pos.x;
dyL = player->actor.world.pos.y + 30.0f - this->actor.world.pos.y;
dzL = player->actor.world.pos.z - this->actor.world.pos.z;
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxL, dzL));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxL, dzL));
dxzL = sqrtf(SQ(dxL) + SQ(dzL));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(dyL, dxzL));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(dyL, dxzL));
this->collider.dim.radius = 40;
this->collider.dim.height = 50;
this->collider.dim.yShift = -25;
@ -517,9 +517,9 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
this->actor.speedXZ += 1.0f;
}
}
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxPG, dzPG)) + angleModY;
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxPG, dzPG)) + angleModY;
this->actor.world.rot.x =
RADF_TO_BINANG(Math_FAtan2F(dyPG, sqrtf((dxPG * dxPG) + (dzPG * dzPG)))) + angleModX;
RAD_TO_BINANG(Math_FAtan2F(dyPG, sqrtf((dxPG * dxPG) + (dzPG * dzPG)))) + angleModX;
this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_BLUE;
this->work[FHGFIRE_FX_TIMER] = 2;
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_REFLECT_MG, &player->actor.projectedPos, 4,
@ -538,7 +538,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
break;
case FHGFIRE_LIGHT_BLUE:
if ((bossGnd->flyMode == GND_FLY_RETURN) && (this->work[FHGFIRE_RETURN_COUNT] < 100)) {
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxPG, dzPG));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxPG, dzPG));
if ((sqrtf(SQ(dxPG) + SQ(dzPG)) < (150.0f + (this->actor.speedXZ * 8.0f)))) {
this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_REFLECT;
bossGnd->returnSuccess = true;
@ -549,8 +549,8 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
if ((sqrtf(SQ(dxPG) + SQ(dyPG) + SQ(dzPG)) < 100.0f)) {
bossGnd->returnSuccess = true;
}
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxPG, dzPG));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(dyPG, sqrtf(SQ(dxPG) + SQ(dzPG))));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxPG, dzPG));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(dyPG, sqrtf(SQ(dxPG) + SQ(dzPG))));
}
if ((fabsf(dxPG) < 30.0f) && (fabsf(dzPG) < 30.0f) && (fabsf(dyPG) < 45.0f)) {
killMode = BALL_IMPACT;
@ -577,9 +577,9 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
EffectSsFhgFlash_SpawnLightBall(globalCtx, &this->actor.world.pos, &sp88, &sp7C,
(s16)(Rand_ZeroOne() * 40.0f) + 80, FHGFLASH_LIGHTBALL_GREEN);
}
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dxL, dzL));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dxL, dzL));
dxzL = sqrtf(SQ(dxL) + SQ(dzL));
this->actor.world.rot.x = RADF_TO_BINANG(Math_FAtan2F(dyL, dxzL));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(dyL, dxzL));
this->work[FHGFIRE_FIRE_MODE] = FHGFIRE_LIGHT_GREEN;
Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_REFLECT_MG);
this->actor.speedXZ += 2.0f;

View file

@ -210,7 +210,7 @@ void EnFr_OrientUnderwater(EnFr* this) {
this->actor.world.pos.z = this->posLogSpot.z + vec2.z;
this->actor.world.pos.y = sLogSpotToFromWater[this->actor.params].yDist + this->posLogSpot.y;
this->actor.world.rot.y = this->actor.shape.rot.y =
RADF_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw) + 0x8000;
RAD_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw) + 0x8000;
this->actor.speedXZ = 0.0f;
this->actor.velocity.y = 0.0f;
this->actor.gravity = 0.0f;
@ -445,7 +445,7 @@ void EnFr_OrientOnLogSpot(EnFr* this, GlobalContext* globalCtx) {
void EnFr_ChooseJumpFromLogSpot(EnFr* this, GlobalContext* globalCtx) {
if (sEnFrPointers.flags == 12) {
this->actor.world.rot.y = RADF_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw);
this->actor.world.rot.y = RAD_TO_BINANG(sLogSpotToFromWater[this->actor.params].yaw);
Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f,
Animation_GetLastFrame(&object_fr_Anim_0007BC), ANIMMODE_ONCE, 0.0f);
this->actionFunc = EnFr_JumpingBackIntoWater;

View file

@ -295,7 +295,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
Vec3f sp48;
EnFw_GetPosAdjAroundCircle(&sp48, this, this->runRadius, this->runDirection);
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(sp48.x, sp48.z)), 4, 0xFA0, 1);
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(sp48.x, sp48.z)), 4, 0xFA0, 1);
}
this->actor.world.rot = this->actor.shape.rot;

View file

@ -477,7 +477,7 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) {
pointPos += this->unk_218;
xDist = pointPos->x - this->actor.world.pos.x;
zDist = pointPos->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(xDist, zDist)), 10, 1000, 1);
Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(xDist, zDist)), 10, 1000, 1);
if ((SQ(xDist) + SQ(zDist)) < 600.0f) {
this->unk_218++;

View file

@ -691,8 +691,8 @@ void EnGoma_SetFloorRot(EnGoma* this) {
nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x);
ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y);
nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z);
Math_ApproachS(&this->slopePitch, RADF_TO_BINANG(-Math_FAtan2F(-nz * ny, 1.0f)), 1, 1000);
Math_ApproachS(&this->slopeRoll, RADF_TO_BINANG(Math_FAtan2F(-nx * ny, 1.0f)), 1, 1000);
Math_ApproachS(&this->slopePitch, RAD_TO_BINANG(-Math_FAtan2F(-nz * ny, 1.0f)), 1, 1000);
Math_ApproachS(&this->slopeRoll, RAD_TO_BINANG(Math_FAtan2F(-nx * ny, 1.0f)), 1, 1000);
}
}

View file

@ -165,7 +165,7 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) {
pathDiffX = pointPos->x - this->actor.world.pos.x;
pathDiffZ = pointPos->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 3,
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 3,
this->bodyTurnSpeed, 0);
Math_ApproachF(&this->bodyTurnSpeed, this->bodyTurnSpeedTarget, 1.0f, this->bodyTurnSpeedMax);

View file

@ -2957,7 +2957,7 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) {
return;
}
floorSlope = RADF_TO_BINANG(Math_FAtan2F(this->yBack - this->yFront, 60.0f));
floorSlope = RAD_TO_BINANG(Math_FAtan2F(this->yBack - this->yFront, 60.0f));
if (this->actor.floorPoly != 0) {
nx = this->actor.floorPoly->normal.x * COLPOLY_NORMAL_FRAC;
ny = this->actor.floorPoly->normal.y * COLPOLY_NORMAL_FRAC;
@ -3056,7 +3056,7 @@ void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle) {
*stickMag = *stickMag;
}
*angle = RADF_TO_BINANG(Math_FAtan2F(-curStick->x, curStick->y));
*angle = RAD_TO_BINANG(Math_FAtan2F(-curStick->x, curStick->y));
}
void EnHorse_UpdateStick(EnHorse* this, GlobalContext* globalCtx) {
@ -3075,7 +3075,7 @@ void EnHorse_ResolveCollision(EnHorse* this, GlobalContext* globalCtx, Collision
nx = COLPOLY_GET_NORMAL(colPoly->normal.x);
ny = COLPOLY_GET_NORMAL(colPoly->normal.y);
nz = COLPOLY_GET_NORMAL(colPoly->normal.z);
if (!(Math_CosS(this->actor.world.rot.y - RADF_TO_BINANG(Math_FAtan2F(colPoly->normal.x, colPoly->normal.z)) -
if (!(Math_CosS(this->actor.world.rot.y - RAD_TO_BINANG(Math_FAtan2F(colPoly->normal.x, colPoly->normal.z)) -
0x7FFF) < 0.7071f)) { // cos(45 degrees)
dist = Math3D_DistPlaneToPos(nx, ny, nz, colPoly->dist, &this->actor.world.pos);
offset = (1.0f / sqrtf(SQ(nx) + SQ(nz)));
@ -3195,8 +3195,8 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) {
if (intersectDist < 30.0f) {
EnHorse_ResolveCollision(this, globalCtx, wall);
}
if ((Math_CosS(this->actor.world.rot.y - RADF_TO_BINANG(Math_FAtan2F(wall->normal.x, wall->normal.z)) -
0x7FFF) < 0.5f) ||
if ((Math_CosS(this->actor.world.rot.y - RAD_TO_BINANG(Math_FAtan2F(wall->normal.x, wall->normal.z)) - 0x7FFF) <
0.5f) ||
SurfaceType_IsHorseBlocked(&globalCtx->colCtx, wall, bgId) != 0) {
return;
}

View file

@ -282,7 +282,7 @@ void func_80A68E14(EnHorseGanon* this, GlobalContext* globalCtx) {
temp_ret = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &col, &temp1, &v);
this->unk_1F4 = temp_ret;
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - temp_ret, 30.0f));
this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - temp_ret, 30.0f));
}
void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -295,7 +295,7 @@ void EnHorseNormal_FollowPath(EnHorseNormal* this, GlobalContext* globalCtx) {
pointPos += this->waypoint;
dx = pointPos->x - this->actor.world.pos.x;
dz = pointPos->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 0xA, 0x7D0, 1);
Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 0xA, 0x7D0, 1);
this->actor.shape.rot.y = this->actor.world.rot.y;
if (SQ(dx) + SQ(dz) < 600.0f) {
this->waypoint++;
@ -566,7 +566,7 @@ void func_80A6C8E0(EnHorseNormal* this, GlobalContext* globalCtx) {
sp28.y = this->actor.world.pos.y + 60.0f;
sp28.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z;
this->unk_220 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp38, &sp24, &sp28);
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_220, 30.0f));
this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_220, 30.0f));
}
static EnHorseNormalActionFunc sActionFuncs[] = {

View file

@ -224,7 +224,7 @@ void func_80A6DE38(EnHorseZelda* this, GlobalContext* globalCtx) {
pos.y = this->actor.world.pos.y + 60.0f;
pos.z = (Math_CosS(this->actor.shape.rot.y) * 30.0f) + this->actor.world.pos.z;
this->unk_1F4 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &pos);
this->actor.shape.rot.x = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_1F4, 30.0f));
this->actor.shape.rot.x = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.y - this->unk_1F4, 30.0f));
}
void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -694,7 +694,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->actionState = ENKANBAN_AIR;
this->actor.gravity = -1.0f;
this->actor.world.rot.y = RADF_TO_BINANG(Math_FAtan2F(dx, dz));
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(dx, dz));
if (this->partCount >= 4) {
this->bounceX = (s16)Rand_ZeroFloat(10.0f) + 6;
this->bounceZ = (s16)Rand_ZeroFloat(10.0f) + 6;

View file

@ -285,7 +285,7 @@ s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) {
pathDiffX = pointPos->x - this->actor.world.pos.x;
pathDiffZ = pointPos->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 0xA, 0x3E8, 1);
Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ)), 0xA, 0x3E8, 1);
if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f) {
this->waypoint++;

View file

@ -118,7 +118,7 @@ void EnNb_UpdatePath(EnNb* this, GlobalContext* globalCtx) {
this->finalPos.y = pointPos[1].y;
this->finalPos.z = pointPos[1].z;
this->pathYaw =
RADF_TO_BINANG(Math_FAtan2F(this->finalPos.x - this->initialPos.x, this->finalPos.z - this->initialPos.z));
RAD_TO_BINANG(Math_FAtan2F(this->finalPos.x - this->initialPos.x, this->finalPos.z - this->initialPos.z));
// "En_Nb_Get_path_info Rail Data Get! = %d!!!!!!!!!!!!!!"
osSyncPrintf("En_Nb_Get_path_info レールデータをゲットだぜ = %d!!!!!!!!!!!!!!\n", path);
} else {

View file

@ -577,7 +577,7 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) {
this->unk_29E = 7;
}
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(posY, posZ)), 3, this->unk_300, 0);
Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(posY, posZ)), 3, this->unk_300, 0);
Math_ApproachF(&this->unk_300, 10000.0f, 1.0f, 1000.0f);
}
@ -605,7 +605,7 @@ void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) {
pointPos += this->waypoint;
pathDiffX = pointPos->x - this->actor.world.pos.x;
pathDiffZ = pointPos->z - this->actor.world.pos.z;
this->unk_2E4 = RADF_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ));
this->unk_2E4 = RAD_TO_BINANG(Math_FAtan2F(pathDiffX, pathDiffZ));
func_80AB6100(this, globalCtx, 2);
if (fabsf(pathDiffX) < 30.0f && fabsf(pathDiffZ) < 30.0f) {
@ -839,8 +839,8 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) {
}
this->actionFunc = EnNiw_ResetAction;
} else {
this->unk_2E4 = RADF_TO_BINANG(Math_FAtan2F(this->actor.world.pos.x - player->actor.world.pos.x,
this->actor.world.pos.z - player->actor.world.pos.z));
this->unk_2E4 = RAD_TO_BINANG(Math_FAtan2F(this->actor.world.pos.x - player->actor.world.pos.x,
this->actor.world.pos.z - player->actor.world.pos.z));
func_80AB6100(this, globalCtx, 0);
func_80AB5BF8(this, globalCtx, 2);
}

View file

@ -123,7 +123,7 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) {
}
// Change her angle so that she is always facing the cuckoo
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(xDistBetween, zDistBetween)), 3,
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(xDistBetween, zDistBetween)), 3,
this->unk_27C, 0);
Math_ApproachF(&this->unk_27C, 5000.0f, 30.0f, 150.0f);
this->actor.world.rot.y = this->actor.shape.rot.y;

View file

@ -1058,7 +1058,7 @@ s32 func_80AECF6C(EnRu1* this, GlobalContext* globalCtx) {
shapeRotY = &player->actor.shape.rot.y;
temp1 = this->actor.world.pos.x - player->actor.world.pos.x;
temp2 = this->actor.world.pos.z - player->actor.world.pos.z;
temp_f16 = RADF_TO_BINANG(Math_FAtan2F(temp1, temp2));
temp_f16 = RAD_TO_BINANG(Math_FAtan2F(temp1, temp2));
if (*shapeRotY != temp_f16) {
Math_SmoothStepToS(shapeRotY, temp_f16, 0x14, 0x1838, 0x64);
player->actor.world.rot.y = *shapeRotY;

View file

@ -142,7 +142,7 @@ void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) {
dist2d = sqrtf(SQ(dX) + SQ(dZ));
this->applySpeed = true;
this->splashTimer = 0;
angle = RADF_TO_BINANG(Math_FAtan2F(dX, dZ));
angle = RAD_TO_BINANG(Math_FAtan2F(dX, dZ));
dAngle = (player->actor.world.rot.y ^ 0x8000) - angle;
player->actor.gravity = 0.0f;
player->actor.velocity.y = 0.0f;

View file

@ -91,7 +91,7 @@ void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) {
if (func_80B0B81C(&this->actor.world.pos, &player->actor.world.pos, &posDifference, this->actor.scale.y) != 0) {
xzDist = sqrtf(SQ(posDifference.x) + SQ(posDifference.z));
yDistWithOffset = player->actor.world.pos.y - (this->actor.world.pos.y - 90.0f);
player->pushedYaw = RADF_TO_BINANG(Math_FAtan2F(-posDifference.x, -posDifference.z));
player->pushedYaw = RAD_TO_BINANG(Math_FAtan2F(-posDifference.x, -posDifference.z));
if (xzDist > 3.0f) {
Math_SmoothStepToF(&player->pushedSpeed, 3.0f, 0.5f, xzDist, 0.0f);
} else {

View file

@ -741,7 +741,7 @@ s32 func_80B0DFFC(EnSw* this, GlobalContext* globalCtx) {
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_484, &sp50, &this->unk_430, true,
false, false, true, &sp5C)) {
this->actor.wallYaw = RADF_TO_BINANG(Math_FAtan2F(this->unk_430->normal.x, this->unk_430->normal.z));
this->actor.wallYaw = RAD_TO_BINANG(Math_FAtan2F(this->unk_430->normal.x, this->unk_430->normal.z));
this->actor.world.pos = sp50;
this->actor.world.pos.x += 6.0f * Math_SinS(this->actor.world.rot.y);
this->actor.world.pos.z += 6.0f * Math_CosS(this->actor.world.rot.y);

View file

@ -328,7 +328,7 @@ void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) {
this->unk_294 = 7;
}
Math_SmoothStepToS(&this->actor.world.rot.y, RADF_TO_BINANG(Math_FAtan2F(tmpf1, tmpf2)), 3, this->unk_2C8.z, 0);
Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(tmpf1, tmpf2)), 3, this->unk_2C8.z, 0);
Math_ApproachF(&this->unk_2C8.z, 10000.0f, 1.0f, 1000.0f);
}
@ -474,8 +474,8 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) {
}
Math_SmoothStepToS(&this->actor.world.rot.y,
RADF_TO_BINANG(Math_FAtan2F(player->actor.world.pos.x - this->actor.world.pos.x,
player->actor.world.pos.z - this->actor.world.pos.z)) +
RAD_TO_BINANG(Math_FAtan2F(player->actor.world.pos.x - this->actor.world.pos.x,
player->actor.world.pos.z - this->actor.world.pos.z)) +
phi_f16,
5, this->unk_2C8.y, 0);
Math_ApproachF(&this->unk_2C8.y, 3000.0f, 1.0f, 500.0f);

View file

@ -315,7 +315,7 @@ s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) {
dx = point->x - this->actor.world.pos.x;
dz = point->z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, RADF_TO_BINANG(Math_FAtan2F(dx, dz)), 10, 1000, 1);
Math_SmoothStepToS(&this->actor.shape.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 10, 1000, 1);
this->actor.world.rot = this->actor.shape.rot;
if (SQ(dx) + SQ(dz) < 10.0f) {

View file

@ -229,7 +229,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) {
newActor->yRotVel = 0.0f;
xRotVel = sqrtf(SQ(spawnOffset.x) + SQ(spawnOffset.z));
newActor->xRotVel = 0x1000 / 10.0f * xRotVel;
newActor->actor.shape.rot.y = RADF_TO_BINANG(Math_FAtan2F(spawnOffset.x, spawnOffset.z));
newActor->actor.shape.rot.y = RAD_TO_BINANG(Math_FAtan2F(spawnOffset.x, spawnOffset.z));
newActor->shadowOpacity = 200.0f;
}
}

View file

@ -754,7 +754,7 @@ void func_80B50304(EnZl2* this, GlobalContext* globalCtx) {
this->drawConfig = 1;
this->unk_23C = 0.0f;
shape->shadowAlpha = 255;
this->actor.world.rot.y = shape->rot.y = RADF_TO_BINANG(Math_FAtan2F(actionXDelta, actionZDelta));
this->actor.world.rot.y = shape->rot.y = RAD_TO_BINANG(Math_FAtan2F(actionXDelta, actionZDelta));
}
void func_80B503DC(EnZl2* this, GlobalContext* globalCtx) {

View file

@ -1614,7 +1614,7 @@ s32 func_80B57034(EnZl3* this, s32 arg1, s32 arg2) {
f32 xDiff = vec2->x - vec1->x;
f32 zDiff = vec2->z - vec1->z;
return ((xDiff == 0.0f) && (zDiff == 0.0f)) ? 0 : RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
return ((xDiff == 0.0f) && (zDiff == 0.0f)) ? 0 : RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
}
return 0;
}
@ -1627,7 +1627,7 @@ s16 func_80B57104(EnZl3* this, s32 arg1) {
f32 zDiff = point->z - this->actor.world.pos.z;
if ((xDiff != 0.0f) || (zDiff != 0.0f)) {
return RADF_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
return RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
}
}
return 0;
@ -1741,7 +1741,7 @@ s32 func_80B57458(EnZl3* this, GlobalContext* globalCtx) {
return 1;
}
temp_v0 = (s16)(temp_v1 - RADF_TO_BINANG(Math_FAtan2F(temp_f12, temp_f13)));
temp_v0 = (s16)(temp_v1 - RAD_TO_BINANG(Math_FAtan2F(temp_f12, temp_f13)));
if (temp_v0 < 0x1555) {
return 1;
@ -1828,7 +1828,7 @@ void func_80B577BC(GlobalContext* globalCtx, Vec3f* vec) {
f32 posZ = vec->z;
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TEST, posX, posY, posZ, 0,
RADF_TO_BINANG(Math_FAtan2F(playerPos->x - posX, playerPos->z - posZ)), 0, 5);
RAD_TO_BINANG(Math_FAtan2F(playerPos->x - posX, playerPos->z - posZ)), 0, 5);
}
void func_80B57858(GlobalContext* globalCtx) {