Fix last two functions in sys_math_atan (#1066)

* Fix extra Atan2 funcs

* format

* make Math_GetAtan2Tbl private

* rename Depr to XY

* ./format.sh i loathe thee

* namefixer.py changes
This commit is contained in:
mzxrules 2022-11-07 19:21:51 -05:00 committed by GitHub
parent 65cf949bc0
commit 577a4a772b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 133 additions and 131 deletions

View File

@ -2702,11 +2702,10 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z);
// void func_8017FB1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11);
// void func_8017FD44(void);
u16 Math_GetAtan2Tbl(f32 y, f32 x);
s16 Math_Atan2S(f32 y, f32 x);
f32 Math_Atan2F(f32 y, f32 x);
s16 Math_FAtan2F(f32 adjacent, f32 opposite);
f32 Math_Acot2F(f32 adjacent, f32 opposite);
s16 Math_Atan2S_XY(f32 x, f32 y);
f32 Math_Atan2F_XY(f32 x, f32 y);
u64* SysUcode_GetUCodeBoot(void);
size_t SysUcode_GetUCodeBootSize(void);

View File

@ -130,10 +130,12 @@ f32 Math_Atan2F(f32 y, f32 x) {
return Math_Atan2S(y, x) * (M_PI / 0x8000);
}
s16 Math_FAtan2F(f32 adjacent, f32 opposite) {
return Math_Atan2S(opposite, adjacent);
// Match the OoT implementation of Math_Atan2S
s16 Math_Atan2S_XY(f32 x, f32 y) {
return Math_Atan2S(y, x);
}
f32 Math_Acot2F(f32 adjacent, f32 opposite) {
return Math_Atan2F(opposite, adjacent);
// Match the OoT implementation of Math_Atan2F
f32 Math_Atan2F_XY(f32 x, f32 y) {
return Math_Atan2F(y, x);
}

View File

@ -151,7 +151,7 @@ void ActorShadow_DrawFoot(PlayState* play, Light* light, MtxF* arg2, s32 lightNu
dir0 = light->l.dir[0];
dir2 = light->l.dir[2];
sp58 = Math_FAtan2F(dir2, dir0);
sp58 = Math_Atan2S_XY(dir2, dir0);
shadowScaleZ *= (4.5f - (light->l.dir[1] * 0.035f));
shadowScaleZ = CLAMP_MIN(shadowScaleZ, 1.0f);
Matrix_Put(arg2);
@ -1493,8 +1493,7 @@ void Actor_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16*
slopeNormal->x = COLPOLY_GET_NORMAL(floorPoly->normal.x);
slopeNormal->y = COLPOLY_GET_NORMAL(floorPoly->normal.y);
slopeNormal->z = COLPOLY_GET_NORMAL(floorPoly->normal.z);
*downwardSlopeYaw = Math_FAtan2F(slopeNormal->z, slopeNormal->x);
*downwardSlopeYaw = Math_Atan2S_XY(slopeNormal->z, slopeNormal->x);
}
s32 func_800B761C(Actor* actor, f32 arg1, s32 arg2) {
@ -1591,7 +1590,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
Math_Vec3f_Copy(&actor->world.pos, &pos);
}
actor->wallYaw = Math_FAtan2F(sp7C->normal.z, sp7C->normal.x);
actor->wallYaw = Math_Atan2S_XY(sp7C->normal.z, sp7C->normal.x);
actor->wallBgId = bgId;
} else {
actor->bgCheckFlags &= ~8;
@ -4380,8 +4379,8 @@ void func_800BE33C(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, s32 arg3) {
f32 zDiff = arg1->z - arg0->z;
f32 yDiff = arg3 ? (arg1->y - arg0->y) : (arg0->y - arg1->y);
arg2->y = Math_FAtan2F(zDiff, xDiff);
arg2->x = Math_FAtan2F(sqrtf(SQ(xDiff) + SQ(zDiff)), yDiff);
arg2->y = Math_Atan2S_XY(zDiff, xDiff);
arg2->x = Math_Atan2S_XY(sqrtf(SQ(xDiff) + SQ(zDiff)), yDiff);
}
void func_800BE3D0(Actor* actor, s16 angle, Vec3s* arg2) {

View File

@ -251,7 +251,7 @@ void func_800FF3A0(f32* distOut, s16* angleOut, Input* input) {
if (dist > 0.0f) {
x = input->cur.stick_x;
y = input->cur.stick_y;
*angleOut = Math_FAtan2F(y, -x);
*angleOut = Math_Atan2S_XY(y, -x);
} else {
*angleOut = 0;
}
@ -420,11 +420,11 @@ f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b) {
s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b) {
f32 f14 = b->x - a->x;
f32 f12 = b->z - a->z;
return Math_FAtan2F(f12, f14);
return Math_Atan2S_XY(f12, f14);
}
s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b) {
return Math_FAtan2F(Math_Vec3f_DistXZ(a, b), a->y - b->y);
return Math_Atan2S_XY(Math_Vec3f_DistXZ(a, b), a->y - b->y);
}
void IChain_Apply_u8(u8* ptr, InitChainEntry* ichain);

View File

@ -1725,7 +1725,7 @@ void func_80124FF0(f32 arg0, s16 arg1, Vec3f* arg2, s16 arg3, Vec3f* arg4, Vec3f
Math_Vec3f_Diff(arg5, arg4, &sp44);
sp40 = sqrtf(SQXZ(sp44));
sp3C = (sp40 <= 1.0f) ? arg3 : Math_FAtan2F(sp44.z, sp44.x);
sp3C = (sp40 <= 1.0f) ? arg3 : Math_Atan2S_XY(sp44.z, sp44.x);
sp40 = (Math_CosS(sp3C - arg3) * sp40) + arg8;
if (ABS_ALT(BINANG_SUB(sp3C, arg3)) > 0x4000) {
@ -1733,7 +1733,7 @@ void func_80124FF0(f32 arg0, s16 arg1, Vec3f* arg2, s16 arg3, Vec3f* arg4, Vec3f
}
sp3C -= arg3;
temp_v0 = Math_FAtan2F(sp44.y, sp40);
temp_v0 = Math_Atan2S_XY(sp44.y, sp40);
temp_v0 = CLAMP(temp_v0, (s16)-arg9, arg9);
//! FAKE:
if (sp3C) {}

View File

@ -1072,8 +1072,8 @@ s32 SubS_TrackPoint(Vec3f* target, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* trac
s16 targetX;
f32 diffZ = target->z - focusPos->z;
yaw = Math_FAtan2F(diffZ, diffX);
pitch = Math_FAtan2F(sqrtf(SQ(diffX) + SQ(diffZ)), target->y - focusPos->y);
yaw = Math_Atan2S_XY(diffZ, diffX);
pitch = Math_Atan2S_XY(sqrtf(SQ(diffX) + SQ(diffZ)), target->y - focusPos->y);
Math_SmoothStepToS(&trackTarget->x, pitch, 4, 0x2710, 0);
Math_SmoothStepToS(&trackTarget->y, yaw, 4, 0x2710, 0);
@ -1306,8 +1306,8 @@ void SubS_ActorPathing_ComputePointInfo(PlayState* play, ActorPathing* actorPath
diff.z = actorPath->curPoint.z - actorPath->worldPos->z;
actorPath->distSqToCurPointXZ = Math3D_XZLengthSquared(diff.x, diff.z);
actorPath->distSqToCurPoint = Math3D_LengthSquared(&diff);
actorPath->rotToCurPoint.y = Math_FAtan2F(diff.z, diff.x);
actorPath->rotToCurPoint.x = Math_FAtan2F(sqrtf(actorPath->distSqToCurPointXZ), -diff.y);
actorPath->rotToCurPoint.y = Math_Atan2S_XY(diff.z, diff.x);
actorPath->rotToCurPoint.x = Math_Atan2S_XY(sqrtf(actorPath->distSqToCurPointXZ), -diff.y);
actorPath->rotToCurPoint.z = 0;
}

View File

@ -216,7 +216,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
}
} else {
Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->actor.velocity);
player->actor.world.rot.x = Math_FAtan2F(sqrtf(SQXZ(bodyDistDiffVec)), -bodyDistDiffVec.y);
player->actor.world.rot.x = Math_Atan2S_XY(sqrtf(SQXZ(bodyDistDiffVec)), -bodyDistDiffVec.y);
}
if (phi_f16 < 50.0f) {
ArmsHook_DetachHookFromActor(this);
@ -238,7 +238,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
Actor_MoveWithGravity(&this->actor);
Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff);
Math_Vec3f_Sum(&this->unk1E0, &prevFrameDiff, &this->unk1E0);
this->actor.shape.rot.x = Math_FAtan2F(this->actor.speedXZ, -this->actor.velocity.y);
this->actor.shape.rot.x = Math_Atan2S_XY(this->actor.speedXZ, -this->actor.velocity.y);
sp60.x = this->unk1EC.x - (this->unk1E0.x - this->unk1EC.x);
sp60.y = this->unk1EC.y - (this->unk1E0.y - this->unk1EC.y);
sp60.z = this->unk1EC.z - (this->unk1E0.z - this->unk1EC.z);

View File

@ -575,10 +575,10 @@ void func_809E34B8(Boss03* this, PlayState* play) {
yDiff = this->unk_268.y - this->actor.world.pos.y;
zDiff = this->unk_268.z - this->actor.world.pos.z;
Math_ApproachS(&this->actor.world.rot.x, Math_FAtan2F(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff), 0xA, this->unk_274);
Math_ApproachS(&this->actor.world.rot.x, Math_Atan2S_XY(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff), 0xA, this->unk_274);
bodyYRotTarget =
Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(zDiff, xDiff), 0xA, this->unk_274, 0) * -0.5f;
Math_SmoothStepToS(&this->actor.world.rot.y, Math_Atan2S_XY(zDiff, xDiff), 0xA, this->unk_274, 0) * -0.5f;
Math_ApproachS(&this->bodyYRot, bodyYRotTarget, 5, 0x100);
Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100);
@ -664,9 +664,9 @@ void Boss03_ChasePlayer(Boss03* this, PlayState* play) {
yDiff = (player->actor.world.pos.y - this->actor.world.pos.y) + 50.0f;
zDiff = player->actor.world.pos.z - this->actor.world.pos.z;
Math_ApproachS(&this->actor.world.rot.x, Math_FAtan2F(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff), 0xA, this->unk_274);
Math_ApproachS(&this->actor.world.rot.x, Math_Atan2S_XY(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff), 0xA, this->unk_274);
bodyYRotTarget =
Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(zDiff, xDiff), 0xA, this->unk_274, 0) * -0.5f;
Math_SmoothStepToS(&this->actor.world.rot.y, Math_Atan2S_XY(zDiff, xDiff), 0xA, this->unk_274, 0) * -0.5f;
Math_ApproachS(&this->bodyYRot, bodyYRotTarget, 5, 0x100);
Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100);
@ -760,9 +760,9 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) {
yDiff = player->actor.world.pos.y - this->actor.world.pos.y;
zDiff = player->actor.world.pos.z - this->actor.world.pos.z;
Math_ApproachS(&this->actor.world.rot.x, Math_FAtan2F(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff), 0xA, this->unk_274);
Math_ApproachS(&this->actor.world.rot.x, Math_Atan2S_XY(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff), 0xA, this->unk_274);
Math_ApproachS(&this->bodyYRot,
Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(zDiff, xDiff), 0xA, this->unk_274, 0) *
Math_SmoothStepToS(&this->actor.world.rot.y, Math_Atan2S_XY(zDiff, xDiff), 0xA, this->unk_274, 0) *
-0.5f,
5, 0x100);
Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100);
@ -826,7 +826,7 @@ void Boss03_SetupChewPlayer(Boss03* this, PlayState* play) {
this->actionFunc = Boss03_ChewPlayer;
pitchAngle = Math_FAtan2F(this->actor.world.pos.z, this->actor.world.pos.x);
pitchAngle = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x);
Matrix_RotateYS(pitchAngle, MTXMODE_NEW);
out.x = 0.0f;
@ -864,9 +864,9 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) {
yDiff = this->unk_268.y - this->actor.world.pos.y;
zDiff = this->unk_268.z - this->actor.world.pos.z;
Math_ApproachS(&this->actor.world.rot.x, Math_FAtan2F(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff), 0xA, this->unk_274);
Math_ApproachS(&this->actor.world.rot.x, Math_Atan2S_XY(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff), 0xA, this->unk_274);
Math_ApproachS(&this->bodyYRot,
Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(zDiff, xDiff), 0xA, this->unk_274, 0) *
Math_SmoothStepToS(&this->actor.world.rot.y, Math_Atan2S_XY(zDiff, xDiff), 0xA, this->unk_274, 0) *
-0.5f,
5, 0x100);
Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100);
@ -1026,9 +1026,9 @@ void Boss03_Charge(Boss03* this, PlayState* play) {
yDiff = (this->unk_268.y - this->actor.world.pos.y) - 50.0f;
zDiff = this->unk_268.z - this->actor.world.pos.z;
Math_ApproachS(&this->actor.world.rot.y, Math_FAtan2F(zDiff, xDiff), 0xA, 0x1000);
Math_ApproachS(&this->actor.world.rot.y, Math_Atan2S_XY(zDiff, xDiff), 0xA, 0x1000);
rotXTarget = Math_FAtan2F(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff);
rotXTarget = Math_Atan2S_XY(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff);
Math_ApproachS(&this->actor.world.rot.x, rotXTarget, 0xA, 0x1000);
this->actor.shape.rot = this->actor.world.rot;
@ -1055,7 +1055,7 @@ void Boss03_Charge(Boss03* this, PlayState* play) {
// Player is above water && Player is standing on ground
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) {
func_800B8D50(play, NULL, 7.0f, Math_FAtan2F(player->actor.world.pos.z, player->actor.world.pos.x),
func_800B8D50(play, NULL, 7.0f, Math_Atan2S_XY(player->actor.world.pos.z, player->actor.world.pos.x),
7.0f, 0);
}
@ -1197,9 +1197,9 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) {
yDiff = D_809E9104[this->unk_242].y - this->actor.world.pos.y;
zDiff = D_809E9104[this->unk_242].z - this->actor.world.pos.z;
Math_ApproachS(&this->actor.world.rot.x, Math_FAtan2F(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff),
0xA, this->unk_274);
Math_ApproachS(&this->actor.world.rot.y, Math_FAtan2F(zDiff, xDiff), 0xA, this->unk_274);
Math_ApproachS(&this->actor.world.rot.x,
Math_Atan2S_XY(sqrtf(SQ(xDiff) + SQ(zDiff)), -yDiff), 0xA, this->unk_274);
Math_ApproachS(&this->actor.world.rot.y, Math_Atan2S_XY(zDiff, xDiff), 0xA, this->unk_274);
Math_ApproachS(&this->unk_274, 0x200, 1, 0x10);
if ((this->csTimer > 30) && (this->csTimer < 50)) {
@ -1449,7 +1449,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
this->subCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT);
Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE);
this->unk_2BE = Math_FAtan2F(this->actor.world.pos.z, this->actor.world.pos.x);
this->unk_2BE = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x);
// Player is above water && Player is standing on ground
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) {
@ -1468,7 +1468,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
this->subCamAt.z = mainCam->at.z;
aux = this->subCamEye.x - this->actor.world.pos.x;
this->unk_568 = Math_Acot2F(this->subCamEye.z - this->actor.world.pos.z, aux);
this->unk_568 = Math_Atan2F_XY(this->subCamEye.z - this->actor.world.pos.z, aux);
this->unk_570 = 0.0f;
this->unk_56C = 0.0f;
@ -1582,7 +1582,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
this->shapeRotTargetY = Rand_ZeroFloat(65536.0f);
}
this->actor.world.rot.y = Math_FAtan2F(-this->actor.world.pos.z, -this->actor.world.pos.x);
this->actor.world.rot.y = Math_Atan2S_XY(-this->actor.world.pos.z, -this->actor.world.pos.x);
Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_BOUND_OLD);
Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_BOUND2_OLD);
@ -1679,7 +1679,7 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) {
this->actor.shape.rot.x = this->actor.shape.rot.z;
this->actor.shape.rot.y = this->actor.world.rot.y =
Math_FAtan2F(-this->actor.world.pos.x, -this->actor.world.pos.x);
Math_Atan2S_XY(-this->actor.world.pos.x, -this->actor.world.pos.x);
this->unk_260 = 0.0f;
player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.world.rot.y + 0x8000;
@ -2536,7 +2536,7 @@ void Boss03_SeaweedUpdate(Actor* thisx, PlayState* play) {
}
if (flag & SEAWEED_FLAG_INTERACT_PLAYER) {
Math_ApproachS(&this->actor.shape.rot.y, Math_FAtan2F(zDiff, xDiff), 0x14, 0x800);
Math_ApproachS(&this->actor.shape.rot.y, Math_Atan2S_XY(zDiff, xDiff), 0x14, 0x800);
}
if (sGyorgBossInstance->actor.world.pos.y - 40.0f < sGyorgBossInstance->waterHeight) {
@ -2569,7 +2569,7 @@ void Boss03_SeaweedUpdate(Actor* thisx, PlayState* play) {
}
if (flag & SEAWEED_FLAG_INTERACT_GYORG) {
Math_ApproachS(&this->actor.shape.rot.y, Math_FAtan2F(zDiff, xDiff), 0x14, 0x800);
Math_ApproachS(&this->actor.shape.rot.y, Math_Atan2S_XY(zDiff, xDiff), 0x14, 0x800);
}
}

View File

@ -474,7 +474,7 @@ void func_8088ACE0(EnArrow* this, PlayState* play) {
}
if (this->actor.params < ENARROW_6) {
this->actor.shape.rot.x = Math_FAtan2F(this->actor.speedXZ, -this->actor.velocity.y);
this->actor.shape.rot.x = Math_Atan2S_XY(this->actor.speedXZ, -this->actor.velocity.y);
}
}

View File

@ -1600,8 +1600,8 @@ void func_80A982E0(PlayState* play, ActorPathing* actorPathing) {
sp28.z = actorPathing->curPoint.z - actorPathing->worldPos->z;
actorPathing->distSqToCurPointXZ = Math3D_XZLengthSquared(sp28.x, sp28.z);
actorPathing->distSqToCurPoint = Math3D_LengthSquared(&sp28);
actorPathing->rotToCurPoint.y = Math_FAtan2F(sp28.z, sp28.x);
actorPathing->rotToCurPoint.x = Math_FAtan2F(sqrtf(actorPathing->distSqToCurPointXZ), -sp28.y);
actorPathing->rotToCurPoint.y = Math_Atan2S_XY(sp28.z, sp28.x);
actorPathing->rotToCurPoint.x = Math_Atan2S_XY(sqrtf(actorPathing->distSqToCurPointXZ), -sp28.y);
actorPathing->rotToCurPoint.z = 0;
}

View File

@ -266,7 +266,7 @@ void func_80871058(EnBom* this, PlayState* play) {
} else {
this->actor.speedXZ = sp38;
}
this->actor.world.rot.y = Math_FAtan2F(sp3C, sp40);
this->actor.world.rot.y = Math_Atan2S_XY(sp3C, sp40);
}
if (!Math_StepToF(&this->actor.speedXZ, 0.0f, sp58->x)) {
@ -678,9 +678,9 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a
Math_Vec3f_Copy(&fuseSegmentPtr->pos, arg1);
Math_Vec3f_Diff(arg2, arg1, &spCC);
fuseSegmentPtr->rotY = Math_FAtan2F(spCC.z, spCC.x);
fuseSegmentPtr->rotY = Math_Atan2S_XY(spCC.z, spCC.x);
distXZ = sqrtf(SQXZ(spCC));
fuseSegmentPtr->rotX = Math_FAtan2F(distXZ, spCC.y);
fuseSegmentPtr->rotX = Math_Atan2S_XY(distXZ, spCC.y);
spB0 = (arg4 / 240) + 1;
@ -718,9 +718,9 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a
spCC.z = 0.0f;
}
fuseSegmentPtr2->rotY = Math_FAtan2F(spCC.z, spCC.x);
fuseSegmentPtr2->rotY = Math_Atan2S_XY(spCC.z, spCC.x);
distXZ = sqrtf(SQXZ(spCC));
fuseSegmentPtr2->rotX = Math_FAtan2F(distXZ, spCC.y);
fuseSegmentPtr2->rotX = Math_Atan2S_XY(distXZ, spCC.y);
fuseSegmentPtr2->rotY =
(s16)CLAMP(BINANG_SUB(fuseSegmentPtr2->rotY, fuseSegmentPtr->rotY), -8000, 8000) + fuseSegmentPtr->rotY;

View File

@ -284,8 +284,8 @@ void EnClearTag_CreateLightRayEffect(EnClearTag* this, Vec3f* pos, Vec3f* veloci
effect->actionTimer = Rand_ZeroFloat(10.0f);
effect->rotationY = Math_Acot2F(effect->velocity.z, effect->velocity.x);
effect->rotationX = -Math_Acot2F(sqrtf(SQXZ(effect->velocity)), effect->velocity.y);
effect->rotationY = Math_Atan2F_XY(effect->velocity.z, effect->velocity.x);
effect->rotationX = -Math_Atan2F_XY(sqrtf(SQXZ(effect->velocity)), effect->velocity.y);
effect->envColor.r = 255.0f;
effect->envColor.g = 255.0f;
@ -326,8 +326,8 @@ void EnClearTag_CreateIsolatedLightRayEffect(EnClearTag* this, Vec3f* pos, Vec3f
effect->actionTimer = Rand_ZeroFloat(10.0f);
effect->rotationY = Math_Acot2F(effect->velocity.z, effect->velocity.x);
effect->rotationX = -Math_Acot2F(sqrtf(SQXZ(effect->velocity)), effect->velocity.y);
effect->rotationY = Math_Atan2F_XY(effect->velocity.z, effect->velocity.x);
effect->rotationX = -Math_Atan2F_XY(sqrtf(SQXZ(effect->velocity)), effect->velocity.y);
effect->envColor.r = sLightRayEnvColor[colorIndex].x;
effect->envColor.g = sLightRayEnvColor[colorIndex].y;

View File

@ -252,8 +252,8 @@ void EnDg_GetFloorRot(EnDg* this, Vec3f* floorRot) {
sinf(0.0f);
cosf(0.0f);
floorRot->x = -Math_Acot2F(1.0f, -nz * ny);
floorRot->z = Math_Acot2F(1.0f, -nx * ny);
floorRot->x = -Math_Atan2F_XY(1.0f, -nz * ny);
floorRot->z = Math_Atan2F_XY(1.0f, -nx * ny);
}
}
@ -310,7 +310,7 @@ s16 EnDg_GetYRotation(Path* path, s32 index, Vec3f* pos, f32* distSq) {
*distSq = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Acot2F(diffZ, diffX));
return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
/**

View File

@ -565,17 +565,17 @@ void func_8088D9BC(EnElf* this, PlayState* play) {
switch (this->unk_244) {
case 0:
targetYaw = Math_FAtan2F(-(this->actor.world.pos.z - vec->z), -(this->actor.world.pos.x - vec->x));
targetYaw = Math_Atan2S_XY(-(this->actor.world.pos.z - vec->z), -(this->actor.world.pos.x - vec->x));
break;
case 3:
targetYaw = Math_FAtan2F(-(this->actor.world.pos.z - player->actor.world.pos.z),
-(this->actor.world.pos.x - player->actor.world.pos.x));
targetYaw = Math_Atan2S_XY(-(this->actor.world.pos.z - player->actor.world.pos.z),
-(this->actor.world.pos.x - player->actor.world.pos.x));
break;
case 2:
targetYaw = Math_FAtan2F(this->actor.world.pos.z - player->actor.world.pos.z,
this->actor.world.pos.x - player->actor.world.pos.x);
targetYaw = Math_Atan2S_XY(this->actor.world.pos.z - player->actor.world.pos.z,
this->actor.world.pos.x - player->actor.world.pos.x);
break;
default:
@ -719,7 +719,7 @@ void func_8088E018(EnElf* this, PlayState* play) {
} else {
Actor_Kill(&this->actor);
}
this->unk_258 = Math_FAtan2F(this->actor.velocity.z, this->actor.velocity.x);
this->unk_258 = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x);
}
void func_8088E0E0(EnElf* this, PlayState* play) {
@ -766,7 +766,7 @@ void func_8088E0F0(EnElf* this, PlayState* play) {
return;
}
this->unk_258 = Math_FAtan2F(this->actor.velocity.z, this->actor.velocity.x);
this->unk_258 = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x);
func_8088F5F4(this, play, 32);
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG);
}
@ -800,7 +800,7 @@ void func_8088E304(EnElf* this, PlayState* play) {
this->unk_248 += this->unk_24C;
func_8088D7F8(this, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]);
this->unk_258 = Math_FAtan2F(this->actor.velocity.z, this->actor.velocity.x);
this->unk_258 = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x);
func_8088F5F4(this, play, 0x20);
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG);
}
@ -825,7 +825,7 @@ void func_8088E484(EnElf* this, PlayState* play) {
func_8088D7F8(this, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]);
Actor_SetScale(&this->actor, (1.0f - (SQ(this->unk_250) * SQ(1.0f / 9.0f))) * 0.008f);
this->unk_258 = Math_FAtan2F(this->actor.velocity.z, this->actor.velocity.x);
this->unk_258 = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x);
func_8088F5F4(this, play, 32);
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG);
}
@ -872,7 +872,7 @@ void func_8088E60C(EnElf* this, PlayState* play) {
Lights_PointGlowSetInfo(&this->lightInfoGlow, this->actor.world.pos.x, this->actor.world.pos.y,
this->actor.world.pos.z, 255, 255, 255, glowLightRadius);
this->unk_258 = Math_FAtan2F(this->actor.velocity.z, this->actor.velocity.x);
this->unk_258 = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x);
Actor_SetScale(&this->actor, this->actor.scale.x);
}

View File

@ -220,7 +220,7 @@ void EnElforg_MoveToTargetFairyFountain(EnElforg* this, Vec3f* homePos) {
EnElforg_ApproachTargetYPosition(this, homePos);
xDifference = this->actor.world.pos.x - homePos->x;
zDifference = this->actor.world.pos.z - homePos->z;
targetAngle = Math_FAtan2F(-zDifference, -xDifference);
targetAngle = Math_Atan2S_XY(-zDifference, -xDifference);
xzDistance = sqrtf(SQ(xDifference) + SQ(zDifference));
if ((this->targetDistanceFromHome + 10.0f) < xzDistance) {
@ -247,7 +247,7 @@ void EnElforg_MoveToTarget(EnElforg* this, Vec3f* targetPos) {
this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer << 9);
EnElforg_ApproachTargetYPosition(this, targetPos);
targetAngle = Math_FAtan2F(-(this->actor.world.pos.z - targetPos->z), -(this->actor.world.pos.x - targetPos->x));
targetAngle = Math_Atan2S_XY(-(this->actor.world.pos.z - targetPos->z), -(this->actor.world.pos.x - targetPos->x));
if (this->targetSpeedXZ > 2.0f) {
Math_SmoothStepToS(&this->actor.world.rot.y, targetAngle, 2, 0x400, 0x100);

View File

@ -1481,9 +1481,9 @@ void EnFishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* ro
dy = spD8 - (pos + i - 1)->y;
dz = (pos + i)->z - (pos + i - 1)->z;
ry = Math_Acot2F(dz, dx);
ry = Math_Atan2F_XY(dz, dx);
dist = sqrtf(SQ(dx) + SQ(dz));
rx = -Math_Acot2F(dist, dy);
rx = -Math_Atan2F_XY(dist, dy);
(rot + i - 1)->y = ry;
(rot + i - 1)->x = rx;
@ -1517,9 +1517,9 @@ void EnFishing_UpdateLinePos(Vec3f* pos) {
dy = (pos + i)->y - (pos + i + 1)->y;
dz = (pos + i)->z - (pos + i + 1)->z;
ry = Math_Acot2F(dz, dx);
ry = Math_Atan2F_XY(dz, dx);
dist = sqrtf(SQ(dx) + SQ(dz));
rx = -Math_Acot2F(dist, dy);
rx = -Math_Atan2F_XY(dist, dy);
Matrix_RotateYF(ry, MTXMODE_NEW);
Matrix_RotateXFApply(rx);
@ -1559,9 +1559,9 @@ void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookI
dy = refPos->y - pos->y + offsetY;
dz = refPos->z - pos->z;
ry = Math_Acot2F(dz, dx);
ry = Math_Atan2F_XY(dz, dx);
dist = sqrtf(SQ(dx) + SQ(dz));
rx = -Math_Acot2F(dist, dy);
rx = -Math_Atan2F_XY(dist, dy);
Matrix_RotateYF(ry, MTXMODE_NEW);
Matrix_RotateXFApply(rx);
@ -1680,9 +1680,9 @@ void EnFishing_UpdateSinkingLure(PlayState* play) {
dy = (pos + i)->y - (pos + i - 1)->y + offsetY;
dz = (pos + i)->z - (pos + i - 1)->z + offsetZ;
ry = Math_Acot2F(dz, dx);
ry = Math_Atan2F_XY(dz, dx);
dist = sqrtf(SQ(dx) + SQ(dz));
rx = -Math_Acot2F(dist, dy);
rx = -Math_Atan2F_XY(dist, dy);
Matrix_RotateYF(ry, MTXMODE_NEW);
Matrix_RotateXFApply(rx);
@ -2214,7 +2214,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
sLureRot.y = sReelLineRot[LINE_SEG_COUNT - 2].y;
} else {
sLureRot.x = 0.0f;
sLureRot.y = Math_Acot2F(spD0, spD8) + M_PI;
sLureRot.y = Math_Atan2F_XY(spD0, spD8) + M_PI;
}
phi_f16 = sqrtf(SQ(spD8) + SQ(spD4) + SQ(spD0));
@ -2399,7 +2399,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
sp90.x = player->actor.world.pos.x - sLurePos.x;
sp90.z = player->actor.world.pos.z - sLurePos.z;
sp90.y = Math_Acot2F(sp90.z, sp90.x);
sp90.y = Math_Atan2F_XY(sp90.z, sp90.x);
D_809101B0 = (sp70 * D_809101BC) + sp90.y;
D_809101BC *= -1.0f;
@ -2963,10 +2963,10 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
sp12C = this->unk_1AC.y - this->actor.world.pos.y;
sp128 = this->unk_1AC.z - this->actor.world.pos.z;
spFC = Math_FAtan2F(sp128, sp130);
spFC = Math_Atan2S_XY(sp128, sp130);
sp124 = sqrtf(SQ(sp130) + SQ(sp128));
spFE = Math_FAtan2F(sp124, sp12C);
spFE = Math_Atan2S_XY(sp124, sp12C);
sp124 = sqrtf(SQ(sp130) + SQ(sp128) + SQ(sp12C));
if ((this->unk_198 != 0) && (this->unk_150 != 2) && (this->unk_150 != 3) && (this->unk_150 != 4)) {
@ -4253,7 +4253,7 @@ void EnFishing_HandleReedContact(FishingProp* prop, Vec3f* entityPos) {
f32 distXZ = sqrtf(SQ(dx) + SQ(dz));
if (distXZ <= 20.0f) {
prop->rotY = Math_Acot2F(dz, dx);
prop->rotY = Math_Atan2F_XY(dz, dx);
Math_ApproachF(&prop->rotX, (20.0f - distXZ) * 0.03f, 0.2f, 0.2f);
}
@ -4265,7 +4265,7 @@ void EnFishing_HandleLilyPadContact(FishingProp* prop, Vec3f* entityPos, u8 fish
f32 distXZ = sqrtf(SQ(dx) + SQ(dz));
if (distXZ <= 40.0f) {
Math_ApproachS(&prop->lilyPadAngle, Math_FAtan2F(dz, dx), 10, 0x300);
Math_ApproachS(&prop->lilyPadAngle, Math_Atan2S_XY(dz, dx), 10, 0x300);
}
if (fishTimer && (distXZ <= 60.0f)) {
@ -4560,9 +4560,9 @@ void EnFishing_UpdateGroupFishes(PlayState* play) {
dx = fish->unk_10.x - fish->pos.x;
dy = fish->unk_10.y - fish->pos.y;
dz = fish->unk_10.z - fish->pos.z;
spD4 = Math_FAtan2F(dz, dx);
spD4 = Math_Atan2S_XY(dz, dx);
dist = sqrtf(SQ(dx) + SQ(dz));
spD6 = Math_FAtan2F(dist, dy);
spD6 = Math_Atan2S_XY(dist, dy);
if ((dist < 10.0f) || (((fish->timer % 32) == 0) && (Rand_ZeroOne() > 0.5f))) {
fish->unk_10.y = basePos[groupIndex].y + randPlusMinusPoint5Scaled(10.0f);
@ -5179,7 +5179,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) {
spFC.x = sLurePos.x - player->actor.world.pos.x;
spFC.z = sLurePos.z - player->actor.world.pos.z;
lureDistXZ = sqrtf(SQXZ(spFC));
Matrix_RotateYF(Math_Acot2F(spFC.z, spFC.x), MTXMODE_NEW);
Matrix_RotateYF(Math_Atan2F_XY(spFC.z, spFC.x), MTXMODE_NEW);
sp114.x = 0.0f;
sp114.y = 0.0f;

View File

@ -119,7 +119,7 @@ void func_809616E0(EnFu* this, PlayState* play) {
for (i = 0; i < this->unk_520; i++) {
temp_f20 = this->actor.world.pos.x - this->unk_538[i].x;
temp_f22 = this->actor.world.pos.z - this->unk_538[i].z;
atan = Math_FAtan2F(temp_f22, temp_f20);
atan = Math_Atan2S_XY(temp_f22, temp_f20);
if (!spA0 || ((i % 2) != 0)) {
Actor_Spawn(&play->actorCtx, play, this->unk_544, this->unk_538[i].x, this->unk_538[i].y,

View File

@ -830,7 +830,7 @@ s32 func_80B440B8(EnInvadepoh* this, f32 arg1, f32 arg2) {
sp40 = temp_a3->x - sp48->x;
sp3C = temp_a3->z - sp48->z;
sp1E = Math_FAtan2F(sp3C, sp40);
sp1E = Math_Atan2S_XY(sp3C, sp40);
sp38 = Math_CosS(sp1E);
sp34 = Math_SinS(sp1E);
sp30 = this->actor.world.pos.x - sp48->x;
@ -1160,8 +1160,8 @@ s32 func_80B44C80(EnInvadepoh* this, PlayState* play) {
}
Math_SmoothStepToS(&this->actor.world.rot.y,
Math_FAtan2F(((sp60.z + temp_f0_2) * 0.9f) + sp6C.z, ((sp60.x + temp_f0_3) * 0.9f) + sp6C.x), 4,
0xFA0, 0x64);
Math_Atan2S_XY(((sp60.z + temp_f0_2) * 0.9f) + sp6C.z, ((sp60.x + temp_f0_3) * 0.9f) + sp6C.x),
4, 0xFA0, 0x64);
Actor_MoveWithGravity(&this->actor);
if (func_80B440B8(this, 50.0f, 15.0f)) {
phi_v0 = 4;

View File

@ -318,7 +318,7 @@ void func_8095DFF0(EnIshi* this, PlayState* play) {
Matrix_MultVecY(1.0f, &sp30);
sp2C = Math3D_Parallel(&sp30, &D_8095F778);
if (sp2C < 0.707f) {
temp_v1_2 = Math_FAtan2F(sp30.z, sp30.x) - sp3C->world.rot.y;
temp_v1_2 = Math_Atan2S_XY(sp30.z, sp30.x) - sp3C->world.rot.y;
if (ABS_ALT(temp_v1_2) > 0x4000) {
sp3C->world.rot.y = BINANG_ROT180(sp3C->world.rot.y);
}

View File

@ -214,7 +214,7 @@ s16 EnJg_GetWalkingYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ
*distSQ = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Acot2F(diffZ, diffX));
return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) {

View File

@ -151,7 +151,7 @@ void func_80965DB4(EnMm* this, PlayState* play) {
if ((temp_f2 < this->actor.speedXZ) ||
(SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) {
this->actor.speedXZ = CLAMP_MAX(temp_f2, 16.0f);
this->actor.world.rot.y = Math_FAtan2F(temp_f12, temp_f14);
this->actor.world.rot.y = Math_Atan2S_XY(temp_f12, temp_f14);
}
if (!Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f)) {

View File

@ -658,7 +658,7 @@ void func_80A69D3C(EnMushi2* this) {
sp38 = Math3D_XZLengthSquared(sp40, sp3C);
if (fabsf(sp38) > 0.010000001f) {
s16 temp_v0 = Math_FAtan2F(sp3C, sp40);
s16 temp_v0 = Math_Atan2S_XY(sp3C, sp40);
temp_v0 = CLAMP(temp_v0, -3000, 3000);
func_80A68F9C(this, temp_v0);
}

View File

@ -104,7 +104,7 @@ void EnNutsball_Update(Actor* thisx, PlayState* play2) {
this->actor.velocity.y += this->actor.gravity;
spdXZ = sqrtf((this->actor.velocity.x * this->actor.velocity.x) +
(this->actor.velocity.z * this->actor.velocity.z));
this->actor.world.rot.x = Math_FAtan2F(spdXZ, this->actor.velocity.y);
this->actor.world.rot.x = Math_Atan2S_XY(spdXZ, this->actor.velocity.y);
}
this->actor.home.rot.z += 0x2AA8;
if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || (this->actor.bgCheckFlags & 16) ||

View File

@ -411,7 +411,7 @@ void func_8095B0C8(EnOwl* this) {
Vec3s* points = Lib_SegmentedToVirtual(this->path->points);
points += this->unk_3F8;
this->unk_3EC = Math_FAtan2F(points->z - this->actor.world.pos.z, points->x - this->actor.world.pos.x);
this->unk_3EC = Math_Atan2S_XY(points->z - this->actor.world.pos.z, points->x - this->actor.world.pos.x);
this->unk_3F0 = points->y;
}

View File

@ -288,7 +288,7 @@ s16 EnRacedog_GetYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ)
}
*distSQ = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Acot2F(diffZRand, diffXRand));
return RADF_TO_BINANG(Math_Atan2F_XY(diffZRand, diffXRand));
}
void EnRacedog_GetFloorRot(EnRacedog* this, Vec3f* floorRot) {
@ -299,7 +299,7 @@ void EnRacedog_GetFloorRot(EnRacedog* this, Vec3f* floorRot) {
ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y);
nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z);
floorRot->x = -Math_Acot2F(1.0f, -nz * ny);
floorRot->x = -Math_Atan2F_XY(1.0f, -nz * ny);
}
}

View File

@ -1040,8 +1040,8 @@ void EnSnowman_Update(Actor* thisx, PlayState* play) {
if ((this->actor.floorPoly != NULL) && ((this->actor.floorPoly->normal.y * SHT_MINV) < 0.7f)) {
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos);
if (!this->turningOnSteepSlope) {
this->snowPileTargetRotY = Math_FAtan2F(this->actor.floorPoly->normal.z * SHT_MINV,
this->actor.floorPoly->normal.x * SHT_MINV);
this->snowPileTargetRotY = Math_Atan2S_XY(this->actor.floorPoly->normal.z * SHT_MINV,
this->actor.floorPoly->normal.x * SHT_MINV);
this->turningOnSteepSlope = true;
}
} else {

View File

@ -1286,7 +1286,7 @@ s16 EnSob1_GetDistSqAndOrient(Path* path, s32 pointIndex, Vec3f* pos, f32* distS
diffZ = 0.0f;
}
*distSq = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Acot2F(diffZ, diffX));
return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
void EnSob1_GetCutscenes(EnSob1* this) {

View File

@ -563,7 +563,7 @@ s16 EnSuttari_GetDistSqAndOrient(Path* path, s32 index, Vec3f* pos, f32* distSq)
}
*distSq = SQ(diffX) + SQ(diffZ);
return RADF_TO_BINANG(Math_Acot2F(diffZ, diffX));
return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
s32 func_80BAB758(EnSuttari* this, Path* path, s32 arg2) {

View File

@ -761,7 +761,7 @@ void func_808DA3F4(EnSw* this, PlayState* play) {
Math_Vec3f_Copy(&sp38, &this->unk_374);
func_808D9894(this, &sp38);
temp_v0 = Math_FAtan2F(sp38.z, sp38.x);
temp_v0 = Math_Atan2S_XY(sp38.z, sp38.x);
if (ABS_ALT(temp_v0) < temp_s1) {
this->skelAnime.curFrame = 0.0f;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH);
@ -794,7 +794,7 @@ void func_808DA578(EnSw* this, PlayState* play) {
if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) {
Math_Vec3f_Copy(&sp30, &this->unk_374);
func_808D9894(this, &sp30);
temp2 = Math_FAtan2F(sp30.z, sp30.x);
temp2 = Math_Atan2S_XY(sp30.z, sp30.x);
func_808D94D0(this, play, 0, 0, temp2);
}
} else if (this->unk_410 & 0x20) {
@ -825,7 +825,7 @@ void func_808DA6FC(EnSw* this, PlayState* play) {
if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) {
Math_Vec3f_Copy(&sp38, &this->unk_374);
func_808D9894(this, &sp38);
temp2 = Math_FAtan2F(sp38.z, sp38.x);
temp2 = Math_Atan2S_XY(sp38.z, sp38.x);
func_808D94D0(this, play, 0, 0, temp2);
}
} else {
@ -916,7 +916,7 @@ void func_808DAA60(EnSw* this, PlayState* play) {
if (this->unk_45E == 0) {
Math_Vec3s_ToVec3f(&sp34, &sp44[this->unk_4A0]);
func_808D9894(this, &sp34);
temp_v0 = Math_FAtan2F(sp34.z, sp34.x);
temp_v0 = Math_Atan2S_XY(sp34.z, sp34.x);
if (ABS_ALT(temp_v0) < sp40) {
this->skelAnime.curFrame = 0.0f;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH);
@ -967,7 +967,7 @@ void func_808DACF4(EnSw* this, PlayState* play) {
Math_Vec3f_Copy(&sp38, &this->unk_374);
func_808D9894(this, &sp38);
temp_f6 = Math_FAtan2F(sp38.z, sp38.x);
temp_f6 = Math_Atan2S_XY(sp38.z, sp38.x);
func_808D94D0(this, play, 0, 0, temp_f6);
}
} else {

View File

@ -232,7 +232,7 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) {
// on attacking the player; in that case, this code will make it turn in the
// opposite direction and swim away. In both cases, the fish's target y-position
// will be slightly above the halfway point of the water.
atanTemp = Math_FAtan2F(this->targetPos.z, this->targetPos.x);
atanTemp = Math_Atan2S_XY(this->targetPos.z, this->targetPos.x);
Matrix_RotateYS(atanTemp, MTXMODE_NEW);
Matrix_MultVecZ(700.0f, &this->targetPos);
this->targetPos.y = 250.0f;
@ -259,9 +259,9 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) {
// Rotate the fish to look towards its target
xzDistance = sqrtf(SQ(xDistance) + SQ(zDistance));
atanTemp = Math_FAtan2F(xzDistance, -yDistance);
atanTemp = Math_Atan2S_XY(xzDistance, -yDistance);
Math_ApproachS(&this->actor.world.rot.x, atanTemp, this->rotationScale, this->rotationStep);
atanTemp = Math_FAtan2F(zDistance, xDistance);
atanTemp = Math_Atan2S_XY(zDistance, xDistance);
Math_SmoothStepToS(&this->actor.world.rot.y, atanTemp, this->rotationScale, this->rotationStep, 0);
Math_ApproachS(&this->rotationStep, this->targetRotationStep, 1, 0x100);
@ -304,7 +304,7 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) {
if (Rand_ZeroOne() < 0.5f) {
this->targetShapeRotation.y = (s16)Rand_ZeroFloat(0x10000);
}
this->actor.world.rot.y = Math_FAtan2F(this->actor.world.pos.z, this->actor.world.pos.x) +
this->actor.world.rot.y = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x) +
(s16)randPlusMinusPoint5Scaled(0xCE20);
}
@ -343,8 +343,8 @@ void EnTanron3_SetupDie(EnTanron3* this, PlayState* play) {
xDistance = this->actor.world.pos.x - player->actor.world.pos.x;
yDistance = this->actor.world.pos.y - player->actor.world.pos.y + 30.0f;
zDistance = this->actor.world.pos.z - player->actor.world.pos.z;
this->actor.world.rot.x = Math_FAtan2F(sqrtf(SQ(xDistance) + SQ(zDistance)), -yDistance);
this->actor.world.rot.y = Math_FAtan2F(zDistance, xDistance);
this->actor.world.rot.x = Math_Atan2S_XY(sqrtf(SQ(xDistance) + SQ(zDistance)), -yDistance);
this->actor.world.rot.y = Math_Atan2S_XY(zDistance, xDistance);
this->workTimer[WORK_TIMER_DIE] = 6;
this->actor.speedXZ = 10.0f;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_MINI_DEAD);
@ -367,8 +367,8 @@ void EnTanron3_CheckCollisions(EnTanron3* this, PlayState* play) {
if (player->actor.world.pos.y > 350.0f) {
if (this->atCollider.base.atFlags & AT_HIT) {
this->atCollider.base.atFlags &= ~AT_HIT;
func_800B8D50(play, NULL, 3.0f, Math_FAtan2F(-player->actor.world.pos.z, -player->actor.world.pos.x), 5.0f,
0);
func_800B8D50(play, NULL, 3.0f, Math_Atan2S_XY(-player->actor.world.pos.z, -player->actor.world.pos.x),
5.0f, 0);
}
}
if (this->acCollider.base.acFlags & AC_HIT) {

View File

@ -615,7 +615,7 @@ s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3) {
phi_f12 = 0.0f;
}
*arg3 = SQ(phi_f14) + SQ(phi_f12);
return RADF_TO_BINANG(Math_Acot2F(phi_f12, phi_f14));
return RADF_TO_BINANG(Math_Atan2F_XY(phi_f12, phi_f14));
}
f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {

View File

@ -87,7 +87,7 @@ void func_8099FB64(Actor* thisx, PlayState* play) {
Matrix_RotateXS(thisx->shape.rot.x, MTXMODE_APPLY);
Matrix_RotateZS(thisx->shape.rot.z, MTXMODE_APPLY);
Matrix_MultVec3f(&D_8099FE3C, &destVec);
rotY = Math_FAtan2F(destVec.z, destVec.x);
rotY = Math_Atan2S_XY(destVec.z, destVec.x);
}
actor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z,
0, rotY, 0, (OBJMAKEKINSUTA_GET_1F(thisx) << 2) | 0xFF01);

View File

@ -65,7 +65,7 @@ void func_80C253D0(ObjSwprize* this, PlayState* play) {
if (sp78.y < 0.98f) {
collectible->velocity.y = (sp78.y + 1.0f) * 4.0f;
collectible->speedXZ = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f;
collectible->world.rot.y = Math_FAtan2F(sp78.z, sp78.x) + D_80C257F8[i];
collectible->world.rot.y = Math_Atan2S_XY(sp78.z, sp78.x) + D_80C257F8[i];
} else {
collectible->world.rot.y = i * (0x10000 / 3);
}
@ -76,7 +76,7 @@ void func_80C253D0(ObjSwprize* this, PlayState* play) {
if ((collectible != NULL) && (sp78.y < 0.98f)) {
collectible->velocity.y = (sp78.y + 1.0f) * 4.0f;
collectible->speedXZ = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f;
collectible->world.rot.y = Math_FAtan2F(sp78.z, sp78.x);
collectible->world.rot.y = Math_Atan2S_XY(sp78.z, sp78.x);
}
}
}

View File

@ -71,7 +71,7 @@ u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initPar
this->update = EffectSsEnIce_Update;
this->rLifespan = initParams->life;
this->rScale = initParams->scale * 100.0f;
this->rYaw = Math_FAtan2F(initParams->velocity.z, initParams->velocity.x);
this->rYaw = Math_Atan2S_XY(initParams->velocity.z, initParams->velocity.x);
this->rPitch = 0;
this->rPrimColorR = initParams->primColor.r;
this->rPrimColorG = initParams->primColor.g;

View File

@ -36,7 +36,7 @@ u32 EffectSsIcePiece_Init(PlayState* play, u32 index, EffectSs* this, void* init
this->update = EffectSsIcePiece_Update;
this->rLifespan = initParams->life;
this->rScale = initParams->scale * 100.0f;
this->rYaw = Math_FAtan2F(initParams->velocity.z, initParams->velocity.x);
this->rYaw = Math_Atan2S_XY(initParams->velocity.z, initParams->velocity.x);
this->rPitch = 0;
this->rRotSpeed =
((fabsf(initParams->velocity.x) + fabsf(initParams->velocity.y)) * 100.0f) * (Rand_ZeroFloat(1.0f) + 0.5f);

View File

@ -111,9 +111,9 @@ u32 EffectSsSbn_Init(PlayState* play, u32 index, EffectSs* this, void* initParam
opposite = (SQ(angle) >= 1.0f) ? 0.0f : sqrtf(1.0f - SQ(angle));
if (((mtx.mf[0][0] * colPolyVec.x) + (mtx.mf[0][1] * colPolyVec.y) + (mtx.mf[0][2] * colPolyVec.z)) < 0.0f) {
this->rRotAngle = Math_FAtan2F(angle, opposite);
this->rRotAngle = Math_Atan2S_XY(angle, opposite);
} else {
this->rRotAngle = -Math_FAtan2F(angle, opposite);
this->rRotAngle = -Math_Atan2S_XY(angle, opposite);
}
}

View File

@ -3352,8 +3352,8 @@
0x8017FEB0:("Math_GetAtan2Tbl",),
0x8017FEE4:("Math_Atan2S",),
0x801800CC:("Math_Atan2F",),
0x80180100:("Math_FAtan2F",),
0x8018012C:("Math_Acot2F",),
0x80180100:("Math_Atan2S_XY",),
0x8018012C:("Math_Atan2F_XY",),
0x80180160:("Matrix_Init",),
0x8018019C:("Matrix_Push",),
0x801801CC:("Matrix_Pop",),

View File

@ -18,7 +18,9 @@ simpleReplace = {
wordReplace = {
# Functions
"Actor_GetSwitchFlag": "Flags_GetSwitch",
"atan_flip": "Math_Acot2F",
"Math_FAtan2F(": "Math_Atan2S_XY(",
"Math_Acot2F": "Math_Atan2F_XY",
"atan_flip": "Math_Atan2F_XY",
"atans": "Math_Atan2S",
# "SysMatrix_StateAlloc": "Matrix_StateAlloc",

View File

@ -2866,8 +2866,8 @@ asm/non_matchings/code/sys_math3d/func_8017FD44.s,func_8017FD44,0x8017FD44,0x5B
asm/non_matchings/code/sys_math_atan/Math_GetAtan2Tbl.s,Math_GetAtan2Tbl,0x8017FEB0,0xD
asm/non_matchings/code/sys_math_atan/Math_Atan2S.s,Math_Atan2S,0x8017FEE4,0x7A
asm/non_matchings/code/sys_math_atan/Math_Atan2F.s,Math_Atan2F,0x801800CC,0xD
asm/non_matchings/code/sys_math_atan/Math_FAtan2F.s,Math_FAtan2F,0x80180100,0xB
asm/non_matchings/code/sys_math_atan/Math_Acot2F.s,Math_Acot2F,0x8018012C,0xD
asm/non_matchings/code/sys_math_atan/Math_Atan2S_XY.s,Math_Atan2S_XY,0x80180100,0xB
asm/non_matchings/code/sys_math_atan/Math_Atan2F_XY.s,Math_Atan2F_XY,0x8018012C,0xD
asm/non_matchings/code/sys_matrix/Matrix_Init.s,Matrix_Init,0x80180160,0xF
asm/non_matchings/code/sys_matrix/Matrix_Push.s,Matrix_Push,0x8018019C,0xC
asm/non_matchings/code/sys_matrix/Matrix_Pop.s,Matrix_Pop,0x801801CC,0x7

1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
2866 asm/non_matchings/code/sys_math_atan/Math_GetAtan2Tbl.s Math_GetAtan2Tbl 0x8017FEB0 0xD
2867 asm/non_matchings/code/sys_math_atan/Math_Atan2S.s Math_Atan2S 0x8017FEE4 0x7A
2868 asm/non_matchings/code/sys_math_atan/Math_Atan2F.s Math_Atan2F 0x801800CC 0xD
2869 asm/non_matchings/code/sys_math_atan/Math_FAtan2F.s asm/non_matchings/code/sys_math_atan/Math_Atan2S_XY.s Math_FAtan2F Math_Atan2S_XY 0x80180100 0xB
2870 asm/non_matchings/code/sys_math_atan/Math_Acot2F.s asm/non_matchings/code/sys_math_atan/Math_Atan2F_XY.s Math_Acot2F Math_Atan2F_XY 0x8018012C 0xD
2871 asm/non_matchings/code/sys_matrix/Matrix_Init.s Matrix_Init 0x80180160 0xF
2872 asm/non_matchings/code/sys_matrix/Matrix_Push.s Matrix_Push 0x8018019C 0xC
2873 asm/non_matchings/code/sys_matrix/Matrix_Pop.s Matrix_Pop 0x801801CC 0x7