summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2023-12-13 15:16:24 +1100
committerGitHub <noreply@github.com>2023-12-13 15:16:24 +1100
commit5607eec18bae68e4cd38ef6d1fa69d7f1d84bfc8 (patch)
treebb13ad49718f8883bc65d7bd0a9db4d791800cf2 /src
parented4da0ecef698ad0112c7cdf575368ac3c61903b (diff)
Use more `TRUNCF_BINANG` for f32 -> s16 casts (#1503)
* TRUNCF_BINANG * brackets * extra cast
Diffstat (limited to 'src')
-rw-r--r--src/code/cutscene_camera.c12
-rw-r--r--src/code/z_bgcheck.c6
-rw-r--r--src/code/z_camera.c49
-rw-r--r--src/code/z_en_item00.c2
-rw-r--r--src/code/z_lib.c2
-rw-r--r--src/code/z_message.c22
-rw-r--r--src/code/z_message_nes.c18
-rw-r--r--src/code/z_parameter.c2
-rw-r--r--src/code/z_player_lib.c6
-rw-r--r--src/code/z_quake.c2
-rw-r--r--src/code/z_skelanime.c6
-rw-r--r--src/code/z_snap.c4
-rw-r--r--src/code/z_sub_s.c4
-rw-r--r--src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c2
-rw-r--r--src/overlays/actors/ovl_Boss_03/z_boss_03.c10
-rw-r--r--src/overlays/actors/ovl_Boss_04/z_boss_04.c8
-rw-r--r--src/overlays/actors/ovl_Boss_06/z_boss_06.c12
-rw-r--r--src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c6
-rw-r--r--src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c4
-rw-r--r--src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c9
-rw-r--r--src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c4
-rw-r--r--src/overlays/actors/ovl_En_Arrow/z_en_arrow.c10
-rw-r--r--src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c16
-rw-r--r--src/overlays/actors/ovl_En_Baba/z_en_baba.c4
-rw-r--r--src/overlays/actors/ovl_En_Baguo/z_en_baguo.c12
-rw-r--r--src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c4
-rw-r--r--src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c2
-rw-r--r--src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c2
-rw-r--r--src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c2
-rw-r--r--src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c33
-rw-r--r--src/overlays/actors/ovl_En_Bom/z_en_bom.c2
-rw-r--r--src/overlays/actors/ovl_En_Bombers/z_en_bombers.c2
-rw-r--r--src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c2
-rw-r--r--src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c4
-rw-r--r--src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c2
-rw-r--r--src/overlays/actors/ovl_En_Boom/z_en_boom.c2
-rw-r--r--src/overlays/actors/ovl_En_Bubble/z_en_bubble.c4
-rw-r--r--src/overlays/actors/ovl_En_Butte/z_en_butte.c6
-rw-r--r--src/overlays/actors/ovl_En_Cha/z_en_cha.c2
-rw-r--r--src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c4
-rw-r--r--src/overlays/actors/ovl_En_Crow/z_en_crow.c4
-rw-r--r--src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c4
-rw-r--r--src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c2
-rw-r--r--src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c2
-rw-r--r--src/overlays/actors/ovl_En_Estone/z_en_estone.c2
-rw-r--r--src/overlays/actors/ovl_En_Firefly/z_en_firefly.c2
-rw-r--r--src/overlays/actors/ovl_En_Fish/z_en_fish.c2
-rw-r--r--src/overlays/actors/ovl_En_Fishing/z_en_fishing.c18
-rw-r--r--src/overlays/actors/ovl_En_Fsn/z_en_fsn.c4
-rw-r--r--src/overlays/actors/ovl_En_Ge1/z_en_ge1.c4
-rw-r--r--src/overlays/actors/ovl_En_Geg/z_en_geg.c2
-rw-r--r--src/overlays/actors/ovl_En_Gm/z_en_gm.c4
-rw-r--r--src/overlays/actors/ovl_En_Go/z_en_go.c12
-rw-r--r--src/overlays/actors/ovl_En_Gs/z_en_gs.c4
-rw-r--r--src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c2
-rw-r--r--src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c2
-rw-r--r--src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c2
-rw-r--r--src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c14
-rw-r--r--src/overlays/actors/ovl_En_Horse/z_en_horse.c18
-rw-r--r--src/overlays/actors/ovl_En_In/z_en_in.c4
-rw-r--r--src/overlays/actors/ovl_En_Ja/z_en_ja.c2
-rw-r--r--src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c4
-rw-r--r--src/overlays/actors/ovl_En_Kame/z_en_kame.c2
-rw-r--r--src/overlays/actors/ovl_En_Kanban/z_en_kanban.c2
-rw-r--r--src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c6
-rw-r--r--src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c4
-rw-r--r--src/overlays/actors/ovl_En_Mm/z_en_mm.c2
-rw-r--r--src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c4
-rw-r--r--src/overlays/actors/ovl_En_Nb/z_en_nb.c2
-rw-r--r--src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c4
-rw-r--r--src/overlays/actors/ovl_En_Niw/z_en_niw.c22
-rw-r--r--src/overlays/actors/ovl_En_Nwc/z_en_nwc.c8
-rw-r--r--src/overlays/actors/ovl_En_Ossan/z_en_ossan.c4
-rw-r--r--src/overlays/actors/ovl_En_Owl/z_en_owl.c4
-rw-r--r--src/overlays/actors/ovl_En_Part/z_en_part.c2
-rw-r--r--src/overlays/actors/ovl_En_Peehat/z_en_peehat.c2
-rw-r--r--src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c6
-rw-r--r--src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c4
-rw-r--r--src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c6
-rw-r--r--src/overlays/actors/ovl_En_Pp/z_en_pp.c6
-rw-r--r--src/overlays/actors/ovl_En_Pr2/z_en_pr2.c4
-rw-r--r--src/overlays/actors/ovl_En_Prz/z_en_prz.c4
-rw-r--r--src/overlays/actors/ovl_En_Racedog/z_en_racedog.c2
-rw-r--r--src/overlays/actors/ovl_En_Raf/z_en_raf.c8
-rw-r--r--src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c4
-rw-r--r--src/overlays/actors/ovl_En_Rat/z_en_rat.c4
-rw-r--r--src/overlays/actors/ovl_En_Rg/z_en_rg.c6
-rw-r--r--src/overlays/actors/ovl_En_Ru/z_en_ru.c4
-rw-r--r--src/overlays/actors/ovl_En_Sob1/z_en_sob1.c2
-rw-r--r--src/overlays/actors/ovl_En_Ssh/z_en_ssh.c2
-rw-r--r--src/overlays/actors/ovl_En_St/z_en_st.c2
-rw-r--r--src/overlays/actors/ovl_En_Sth/z_en_sth.c4
-rw-r--r--src/overlays/actors/ovl_En_Sth2/z_en_sth2.c4
-rw-r--r--src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c2
-rw-r--r--src/overlays/actors/ovl_En_Suttari/z_en_suttari.c4
-rw-r--r--src/overlays/actors/ovl_En_Sw/z_en_sw.c2
-rw-r--r--src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c4
-rw-r--r--src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c2
-rw-r--r--src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c8
-rw-r--r--src/overlays/actors/ovl_En_Test6/z_en_test6.c6
-rw-r--r--src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c2
-rw-r--r--src/overlays/actors/ovl_En_Tite/z_en_tite.c2
-rw-r--r--src/overlays/actors/ovl_En_Trt/z_en_trt.c2
-rw-r--r--src/overlays/actors/ovl_En_Trt2/z_en_trt2.c4
-rw-r--r--src/overlays/actors/ovl_En_Twig/z_en_twig.c2
-rw-r--r--src/overlays/actors/ovl_En_Wf/z_en_wf.c2
-rw-r--r--src/overlays/actors/ovl_En_Wiz/z_en_wiz.c1
-rw-r--r--src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c6
-rw-r--r--src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c46
-rw-r--r--src/overlays/actors/ovl_En_Zo/z_en_zo.c4
-rw-r--r--src/overlays/actors/ovl_En_Zod/z_en_zod.c2
-rw-r--r--src/overlays/actors/ovl_En_Zos/z_en_zos.c2
-rw-r--r--src/overlays/actors/ovl_En_Zot/z_en_zot.c4
-rw-r--r--src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c2
-rw-r--r--src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c4
-rw-r--r--src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c2
-rw-r--r--src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c4
-rw-r--r--src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c4
-rw-r--r--src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c2
-rw-r--r--src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c4
-rw-r--r--src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c2
-rw-r--r--src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c4
-rw-r--r--src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c4
-rw-r--r--src/overlays/actors/ovl_player_actor/z_player.c18
-rw-r--r--src/overlays/gamestates/ovl_daytelop/z_daytelop.c2
-rw-r--r--src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c2
-rw-r--r--src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c40
127 files changed, 387 insertions, 373 deletions
diff --git a/src/code/cutscene_camera.c b/src/code/cutscene_camera.c
index 53474bf88..e2d4bdd0a 100644
--- a/src/code/cutscene_camera.c
+++ b/src/code/cutscene_camera.c
@@ -401,9 +401,9 @@ s16 CutsceneCamera_Interp_Linear(Vec3f* camPos, f32* camFov, s16* camRoll, CsCmd
targetRoll = CAM_DEG_TO_BINANG(miscCmd->roll);
- rollDiffToTarget = (s16)(targetRoll - (s16)interpState->initRoll);
+ rollDiffToTarget = (s16)(targetRoll - TRUNCF_BINANG(interpState->initRoll));
- *camRoll = (s16)interpState->initRoll + (s16)(rollDiffToTarget * lerp);
+ *camRoll = TRUNCF_BINANG(interpState->initRoll) + TRUNCF_BINANG(rollDiffToTarget * lerp);
}
if (interpState->curFrame >= pointCmd->duration) {
@@ -467,9 +467,9 @@ s16 CutsceneCamera_Interp_Scale(Vec3f* camPos, f32* camFov, s16* camRoll, CsCmdC
targetRoll = CAM_DEG_TO_BINANG(miscCmd->roll);
- rollDiffToTarget = (s16)(targetRoll - (s16)interpState->initRoll);
+ rollDiffToTarget = (s16)(targetRoll - TRUNCF_BINANG(interpState->initRoll));
- *camRoll += (s16)(rollDiffToTarget * lerp);
+ *camRoll += TRUNCF_BINANG(rollDiffToTarget * lerp);
}
if (interpState->curFrame >= pointCmd->duration) {
@@ -532,9 +532,9 @@ s16 CutsceneCamera_Interp_Geo(Vec3f* camPos, f32* camFov, s16* camRoll, CsCmdCam
targetRoll = CAM_DEG_TO_BINANG(miscCmd->roll);
- rollDiffToTarget = (s16)(targetRoll - (s16)interpState->initRoll);
+ rollDiffToTarget = (s16)(targetRoll - TRUNCF_BINANG(interpState->initRoll));
- *camRoll += (s16)(rollDiffToTarget * lerp);
+ *camRoll += TRUNCF_BINANG(rollDiffToTarget * lerp);
}
if (interpState->curFrame >= pointCmd->duration) {
diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c
index a43c37070..5742321bd 100644
--- a/src/code/z_bgcheck.c
+++ b/src/code/z_bgcheck.c
@@ -3570,17 +3570,17 @@ s32 BgCheck_SphVsDynaWall(CollisionContext* colCtx, u16 xpFlags, f32* outX, f32*
continue;
}
- bgActor->boundingSphere.radius += (s16)radius;
+ bgActor->boundingSphere.radius += TRUNCF_BINANG(radius);
r = bgActor->boundingSphere.radius;
dx = bgActor->boundingSphere.center.x - resultPos.x;
dz = bgActor->boundingSphere.center.z - resultPos.z;
if ((SQ(r) < SQ(dx) + SQ(dz)) || (!Math3D_XYInSphere(&bgActor->boundingSphere, resultPos.x, resultPos.y) &&
!Math3D_YZInSphere(&bgActor->boundingSphere, resultPos.y, resultPos.z))) {
- bgActor->boundingSphere.radius -= (s16)radius;
+ bgActor->boundingSphere.radius -= TRUNCF_BINANG(radius);
continue;
}
- bgActor->boundingSphere.radius -= (s16)radius;
+ bgActor->boundingSphere.radius -= TRUNCF_BINANG(radius);
if (BgCheck_SphVsDynaWallInBgActor(colCtx, xpFlags, &colCtx->dyna,
&(colCtx->dyna.bgActors + i)->dynaLookup.wall, outX, outZ, outPoly, outBgId,
&resultPos, radius, i, actor)) {
diff --git a/src/code/z_camera.c b/src/code/z_camera.c
index 252dc3d91..5e04f1613 100644
--- a/src/code/z_camera.c
+++ b/src/code/z_camera.c
@@ -695,7 +695,7 @@ s16 func_800CC260(Camera* camera, Vec3f* arg1, Vec3f* arg2, VecGeo* arg3, Actor*
sp90.yaw = D_801B9E18[i] + arg3->yaw;
rand = Rand_ZeroOne();
- sp90.pitch = D_801B9E34[i] + (s16)(arg3->pitch * rand);
+ sp90.pitch = D_801B9E34[i] + TRUNCF_BINANG(arg3->pitch * rand);
if (sp90.pitch > 0x36B0) { // 76.9 degrees
sp90.pitch -= 0x3E80; // -87.9 degrees
@@ -1752,7 +1752,8 @@ s16 Camera_CalcDefaultPitch(Camera* camera, s16 pitch, s16 flatSurfacePitchTarge
s16 pitchTarget;
// if slopePitchAdj is positive, then it is attenuated by a factor of Math_CosS(slopePitchAdj)
- slopePitchAdjAttenuated = (slopePitchAdj > 0) ? (s16)(Math_CosS(slopePitchAdj) * slopePitchAdj) : slopePitchAdj;
+ slopePitchAdjAttenuated =
+ (slopePitchAdj > 0) ? TRUNCF_BINANG(Math_CosS(slopePitchAdj) * slopePitchAdj) : slopePitchAdj;
pitchTarget = flatSurfacePitchTarget - slopePitchAdjAttenuated;
if (ABS(pitchTarget) < pitchMag) {
@@ -1801,7 +1802,7 @@ s16 Camera_CalcDefaultYaw(Camera* camera, s16 yaw, s16 target, f32 attenuationYa
attenuationSpeedRatio = Camera_QuadraticAttenuation(0.5f, camera->speedRatio);
yawUpdRate = 1.0f / camera->yawUpdateRateInv;
- return yaw + (s16)(yawDiffToTarget * attenuationYawDiffAdj * attenuationSpeedRatio * yawUpdRate);
+ return yaw + TRUNCF_BINANG(yawDiffToTarget * attenuationYawDiffAdj * attenuationSpeedRatio * yawUpdRate);
}
void Camera_CalcDefaultSwing(Camera* camera, VecGeo* arg1, VecGeo* arg2, f32 arg3, f32 arg4, SwingAnimation* swing2,
@@ -2218,14 +2219,14 @@ s32 Camera_Normal1(Camera* camera) {
}
if (!(roData->interfaceFlags & NORMAL1_FLAG_3) || !func_800CB924(camera)) {
- spB4.yaw = Camera_CalcDefaultYaw(camera, sp9C.yaw, (s16)(focalActorPosRot->rot.y - (s16)(sp72 * sp6C)),
- roData->unk_14, spC0);
+ spB4.yaw = Camera_CalcDefaultYaw(
+ camera, sp9C.yaw, (s16)(focalActorPosRot->rot.y - TRUNCF_BINANG(sp72 * sp6C)), roData->unk_14, spC0);
}
if (!(roData->interfaceFlags & NORMAL1_FLAG_3) || (camera->speedRatio < 0.01f)) {
- spB4.pitch = Camera_CalcDefaultPitch(camera, sp9C.pitch,
- roData->unk_20 + (s16)((roData->unk_20 - sp74.pitch) * sp6C * 0.75f),
- rwData->unk_08);
+ spB4.pitch = Camera_CalcDefaultPitch(
+ camera, sp9C.pitch, roData->unk_20 + TRUNCF_BINANG((roData->unk_20 - sp74.pitch) * sp6C * 0.75f),
+ rwData->unk_08);
}
} else if (roData->interfaceFlags & NORMAL1_FLAG_1) {
VecGeo sp64;
@@ -3747,14 +3748,14 @@ s32 Camera_Battle1(Camera* camera) {
} else {
sp104 = (1.0f - camera->speedRatio) * 0.05f;
sp88 = (sp8A >= 0) ? CAM_DEG_TO_BINANG(spFC) : -CAM_DEG_TO_BINANG(spFC);
- spBC.yaw = atToEyeNextDir.yaw - (s16)((sp88 - sp8A) * sp104);
+ spBC.yaw = atToEyeNextDir.yaw - TRUNCF_BINANG((sp88 - sp8A) * sp104);
}
if (!skipEyeAtCalc) {
spF8 = atToTargetDir.pitch * roData->swingPitchAdj;
var2 = swingPitchInitial + ((swingPitchFinal - swingPitchInitial) * distRatio);
- sp8A = CAM_DEG_TO_BINANG(var2) - (s16)((spA4.pitch * (0.5f + (distRatio * (1.0f - 0.5f)))) + 0.5f);
- sp8A += (s16)spF8;
+ sp8A = CAM_DEG_TO_BINANG(var2) - TRUNCF_BINANG((spA4.pitch * (0.5f + (distRatio * (1.0f - 0.5f)))) + 0.5f);
+ sp8A += TRUNCF_BINANG(spF8);
if (sp8A < -0x2AA8) {
sp8A = -0x2AA8;
@@ -4101,15 +4102,15 @@ s32 Camera_KeepOn1(Camera* camera) {
sp104 = (1.0f - camera->speedRatio) * 0.05f;
spF0 = (spF2 >= 0) ? CAM_DEG_TO_BINANG(spFC) : -CAM_DEG_TO_BINANG(spFC);
- spE8.yaw = atToEyeNext.yaw - (s16)((spF0 - spF2) * sp104);
+ spE8.yaw = atToEyeNext.yaw - TRUNCF_BINANG((spF0 - spF2) * sp104);
}
if (!skipEyeAtCalc) {
spF2 = CAM_DEG_TO_BINANG(F32_LERPIMP(roData->unk_14, roData->unk_18, sp74));
- spF2 -= (s16)((spD0.pitch * (0.5f + (sp74 * 0.5f))) + 0.5f);
+ spF2 -= TRUNCF_BINANG((spD0.pitch * (0.5f + (sp74 * 0.5f))) + 0.5f);
spF8 = spD8.pitch * roData->unk_1C;
- spF2 += (s16)spF8;
+ spF2 += TRUNCF_BINANG(spF8);
if (spF2 < -0x3200) {
spF2 = -0x3200;
@@ -4316,7 +4317,7 @@ s32 Camera_KeepOn3(Camera* camera) {
}
swingAngle = LERPIMP(roData->unk_14, roData->unk_18, phi_f14);
- sp98.pitch = CAM_DEG_TO_BINANG(swingAngle) + ((s16) - (spA0.pitch * roData->unk_1C));
+ sp98.pitch = CAM_DEG_TO_BINANG(swingAngle) + TRUNCF_BINANG(-(spA0.pitch * roData->unk_1C));
swingAngle = LERPIMP(roData->unk_0C, roData->unk_10, phi_f14);
phi_a3 = CAM_DEG_TO_BINANG(swingAngle);
@@ -4424,8 +4425,8 @@ s32 Camera_KeepOn3(Camera* camera) {
at->z += (rwData->unk_10.z - at->z) / timer;
sp98.r = (rwData->unk_00 * timer) + sp80.r + 1.0f;
- sp98.yaw = sp80.yaw + (s16)(rwData->unk_04 * timer);
- sp98.pitch = sp80.pitch + (s16)(rwData->unk_08 * timer);
+ sp98.yaw = sp80.yaw + TRUNCF_BINANG(rwData->unk_04 * timer);
+ sp98.pitch = sp80.pitch + TRUNCF_BINANG(rwData->unk_08 * timer);
*eyeNext = OLib_AddVecGeoToVec3f(at, &sp98);
*eye = *eyeNext;
camera->fov = Camera_ScaledStepToCeilF(roData->unk_20, camera->fov, 0.5f, 0.1f);
@@ -4704,8 +4705,8 @@ s32 Camera_KeepOn4(Camera* camera) {
if (rwData->timer != 0) {
Camera_SetStateFlag(camera, CAM_STATE_DISABLE_MODE_CHANGE);
- rwData->unk_10 += (s16)rwData->unk_00;
- rwData->unk_12 += (s16)rwData->unk_04;
+ rwData->unk_10 += TRUNCF_BINANG(rwData->unk_00);
+ rwData->unk_12 += TRUNCF_BINANG(rwData->unk_04);
rwData->timer--;
} else {
Camera_SetStateFlag(camera, CAM_STATE_10 | CAM_STATE_4);
@@ -6635,9 +6636,9 @@ s32 Camera_Special5(Camera* camera) {
spA4 = BINANG_SUB(focalActorPosRot->rot.y, sp6C.yaw);
sp74.r = roData->eyeDist;
rand = Rand_ZeroOne();
- sp74.yaw =
- BINANG_ROT180(focalActorPosRot->rot.y) +
- (s16)((spA4 < 0) ? -(s16)(0x1553 + (s16)(rand * 2730.0f)) : (s16)(0x1553 + (s16)(rand * 2730.0f)));
+ sp74.yaw = BINANG_ROT180(focalActorPosRot->rot.y) +
+ (s16)((spA4 < 0) ? -(s16)(0x1553 + TRUNCF_BINANG(rand * 2730.0f))
+ : (s16)(0x1553 + TRUNCF_BINANG(rand * 2730.0f)));
sp74.pitch = roData->pitch;
*eyeNext = OLib_AddVecGeoToVec3f(&spA8.pos, &sp74);
*eye = *eyeNext;
@@ -6839,8 +6840,8 @@ s32 Camera_Special9(Camera* camera) {
s16 camEyeSide;
s16 randFloat;
- spB0.pitch = ((s16)(Rand_ZeroOne() * 0x280) + 0xBB8);
- randFloat = ((s16)(Rand_ZeroOne() * 0x4CE) + 0x5DC);
+ spB0.pitch = TRUNCF_BINANG(Rand_ZeroOne() * 0x280) + 0xBB8;
+ randFloat = TRUNCF_BINANG(Rand_ZeroOne() * 0x4CE) + 0x5DC;
// The camera will either position itself either to the left or to the right
// of the door when it jumps behind it. It's effectively 50/50 percent chance
diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c
index 84638af47..421db8070 100644
--- a/src/code/z_en_item00.c
+++ b/src/code/z_en_item00.c
@@ -415,7 +415,7 @@ void func_800A6780(EnItem00* this, PlayState* play) {
if (this->actor.velocity.y < -1.5f) {
this->actor.velocity.y = -1.5f;
}
- this->actor.home.rot.z += (s16)((this->actor.velocity.y + 3.0f) * 1000.0f);
+ this->actor.home.rot.z += TRUNCF_BINANG((this->actor.velocity.y + 3.0f) * 1000.0f);
this->actor.world.pos.x +=
(Math_CosS(this->actor.yawTowardsPlayer) * (-3.0f * Math_CosS(this->actor.home.rot.z)));
this->actor.world.pos.z +=
diff --git a/src/code/z_lib.c b/src/code/z_lib.c
index 0d4d00626..00bb37bc8 100644
--- a/src/code/z_lib.c
+++ b/src/code/z_lib.c
@@ -76,7 +76,7 @@ s32 Math_ScaledStepToS(s16* pValue, s16 target, s16 step) {
step = -step;
}
- *pValue += (s16)(step * f0);
+ *pValue += TRUNCF_BINANG(step * f0);
if (((s16)(*pValue - target) * step) >= 0) {
*pValue = target;
diff --git a/src/code/z_message.c b/src/code/z_message.c
index eb2d0d8cb..7e6c9356a 100644
--- a/src/code/z_message.c
+++ b/src/code/z_message.c
@@ -1457,16 +1457,16 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) {
switch (character) {
case 0x8169:
case 0x8175:
- msgCtx->textPosX -= (s16)(6.0f * msgCtx->textCharScale);
+ msgCtx->textPosX -= TRUNCF_BINANG(6.0f * msgCtx->textCharScale);
break;
case 0x8145:
- msgCtx->textPosX -= (s16)(3.0f * msgCtx->textCharScale);
+ msgCtx->textPosX -= TRUNCF_BINANG(3.0f * msgCtx->textCharScale);
break;
case 0x8148:
case 0x8149:
- msgCtx->textPosX -= (s16)(2.0f * msgCtx->textCharScale);
+ msgCtx->textPosX -= TRUNCF_BINANG(2.0f * msgCtx->textCharScale);
break;
default:
@@ -1494,34 +1494,34 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) {
charTexIndex += FONT_CHAR_TEX_SIZE;
switch (character) {
case 0x8144:
- msgCtx->textPosX += (s16)(8.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(8.0f * msgCtx->textCharScale);
break;
case 0x816A:
case 0x8176:
- msgCtx->textPosX += (s16)(10.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(10.0f * msgCtx->textCharScale);
break;
case 0x8141:
case 0x8142:
case 0x8168:
- msgCtx->textPosX += (s16)(12.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(12.0f * msgCtx->textCharScale);
break;
case 0x8194:
- msgCtx->textPosX += (s16)(14.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(14.0f * msgCtx->textCharScale);
break;
case 0x8145:
- msgCtx->textPosX += (s16)(15.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(15.0f * msgCtx->textCharScale);
break;
default:
if ((msgCtx->msgMode >= MSGMODE_SCENE_TITLE_CARD_FADE_IN_BACKGROUND) &&
(msgCtx->msgMode <= MSGMODE_SCENE_TITLE_CARD_FADE_OUT_BACKGROUND)) {
- msgCtx->textPosX += (s16)((16.0f * msgCtx->textCharScale) - 1.0f);
+ msgCtx->textPosX += TRUNCF_BINANG((16.0f * msgCtx->textCharScale) - 1.0f);
} else {
- msgCtx->textPosX += (s16)(16.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(16.0f * msgCtx->textCharScale);
}
break;
}
@@ -2200,7 +2200,7 @@ void Message_Decode(PlayState* play) {
msgCtx->unk11FFA = msgCtx->textboxY + 6;
msgCtx->unk11F1A[spD2] = 0;
if (msgCtx->unk11F18 == 0) {
- msgCtx->unk11F1A[spD2] = (s16)((msgCtx->textCharScale * 16.0f * 16.0f) - spC0) / 2;
+ msgCtx->unk11F1A[spD2] = TRUNCF_BINANG((msgCtx->textCharScale * 16.0f * 16.0f) - spC0) / 2;
}
spC0 = 0.0f;
if (curChar == 0xB) {
diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c
index 0bd3c99a3..db74d56c1 100644
--- a/src/code/z_message_nes.c
+++ b/src/code/z_message_nes.c
@@ -825,16 +825,16 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) {
switch (character) {
case 0x8169:
case 0x8175:
- msgCtx->textPosX -= (s16)(6.0f * msgCtx->textCharScale);
+ msgCtx->textPosX -= TRUNCF_BINANG(6.0f * msgCtx->textCharScale);
break;
case 0x8145:
- msgCtx->textPosX -= (s16)(3.0f * msgCtx->textCharScale);
+ msgCtx->textPosX -= TRUNCF_BINANG(3.0f * msgCtx->textCharScale);
break;
case 0x8148:
case 0x8149:
- msgCtx->textPosX -= (s16)(2.0f * msgCtx->textCharScale);
+ msgCtx->textPosX -= TRUNCF_BINANG(2.0f * msgCtx->textCharScale);
break;
default:
@@ -866,26 +866,26 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) {
//! @TODO: u8 character but > 0x255 cases
switch (character) {
case 0x8144:
- msgCtx->textPosX += (s16)(8.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(8.0f * msgCtx->textCharScale);
break;
case 0x816A:
case 0x8176:
- msgCtx->textPosX += (s16)(10.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(10.0f * msgCtx->textCharScale);
break;
case 0x8141:
case 0x8142:
case 0x8168:
- msgCtx->textPosX += (s16)(12.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(12.0f * msgCtx->textCharScale);
break;
case 0x8194:
- msgCtx->textPosX += (s16)(14.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(14.0f * msgCtx->textCharScale);
break;
case 0x8145:
- msgCtx->textPosX += (s16)(15.0f * msgCtx->textCharScale);
+ msgCtx->textPosX += TRUNCF_BINANG(15.0f * msgCtx->textCharScale);
break;
default:
@@ -998,7 +998,7 @@ void Message_DecodeNES(PlayState* play) {
}
msgCtx->unk11F1A[spC6] = 0;
if (msgCtx->unk11F18 != 0) {
- msgCtx->unk11F1A[spC6] = (s16)((msgCtx->textCharScale * 16.0f * 16.0f) - spA4) / 2;
+ msgCtx->unk11F1A[spC6] = TRUNCF_BINANG((msgCtx->textCharScale * 16.0f * 16.0f) - spA4) / 2;
}
spA4 = 0.0f;
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index c1098f23a..f2b4330fc 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -4601,7 +4601,7 @@ void Interface_DrawClock(PlayState* play) {
}
timeInSeconds = TIME_TO_SECONDS_F(CURRENT_TIME);
- timeInSeconds -= ((s16)(timeInSeconds / 3600.0f)) * 3600.0f;
+ timeInSeconds -= TRUNCF_BINANG(timeInSeconds / 3600.0f) * 3600.0f;
Gfx_SetupDL42_Overlay(play->state.gfxCtx);
diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c
index ec051f1fb..8901069e3 100644
--- a/src/code/z_player_lib.c
+++ b/src/code/z_player_lib.c
@@ -1895,8 +1895,8 @@ void func_80124F18(s16* arg0, f32* arg1, s16 arg2, f32 arg3, f32 arg4) {
}
*arg1 = CLAMP(*arg1, -arg4, arg4);
- *arg0 += (s16)*arg1;
- if (((arg2 - *arg0) * (s16)*arg1) < 0) {
+ *arg0 += TRUNCF_BINANG(*arg1);
+ if (((arg2 - *arg0) * TRUNCF_BINANG(*arg1)) < 0) {
*arg0 = arg2;
}
}
@@ -2168,7 +2168,7 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
rotX = player->upperLimbRot.x;
if ((player->transformation == PLAYER_FORM_DEKU) && (player->stateFlags3 & PLAYER_STATE3_40)) {
if (player->heldActor != NULL) {
- rotX += (s16)(((EnArrow*)(player->heldActor))->bubble.unk_144 * -470.0f);
+ rotX += TRUNCF_BINANG(((EnArrow*)(player->heldActor))->bubble.unk_144 * -470.0f);
}
}
diff --git a/src/code/z_quake.c b/src/code/z_quake.c
index 9423983e1..c4b6e6782 100644
--- a/src/code/z_quake.c
+++ b/src/code/z_quake.c
@@ -184,7 +184,7 @@ QuakeRequest* Quake_RequestImpl(Camera* camera, u32 type) {
// Add a unique random identifier to the upper bits of the index
// The `~3` assumes there are only 4 requests
- req->index = index + ((s16)(Rand_ZeroOne() * 0x10000) & ~3);
+ req->index = index + (TRUNCF_BINANG(Rand_ZeroOne() * 0x10000) & ~3);
sQuakeRequestCount++;
diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c
index 58542b786..c7062332c 100644
--- a/src/code/z_skelanime.c
+++ b/src/code/z_skelanime.c
@@ -944,13 +944,13 @@ void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* start, Vec3s*
for (i = 0; i < limbCount; i++, dst++, start++, target++) {
base = start->x;
diff = target->x - base;
- dst->x = (s16)(diff * weight) + base;
+ dst->x = TRUNCF_BINANG(diff * weight) + base;
base = start->y;
diff = target->y - base;
- dst->y = (s16)(diff * weight) + base;
+ dst->y = TRUNCF_BINANG(diff * weight) + base;
base = start->z;
diff = target->z - base;
- dst->z = (s16)(diff * weight) + base;
+ dst->z = TRUNCF_BINANG(diff * weight) + base;
}
} else {
for (i = 0; i < limbCount; i++, dst++, target++) {
diff --git a/src/code/z_snap.c b/src/code/z_snap.c
index 3524fe3ab..cd5a03704 100644
--- a/src/code/z_snap.c
+++ b/src/code/z_snap.c
@@ -171,8 +171,8 @@ s32 Snap_ValidatePictograph(PlayState* play, Actor* actor, s32 flag, Vec3f* pos,
// Check in capture region
Actor_GetProjectedPos(play, pos, &projectedPos, &distance);
// Convert to projected position to device coordinates, shift to be relative to the capture region's top-left corner
- x = (s16)PROJECTED_TO_SCREEN_X(projectedPos, distance) - PICTO_VALID_TOPLEFT_X;
- y = (s16)PROJECTED_TO_SCREEN_Y(projectedPos, distance) - PICTO_VALID_TOPLEFT_Y;
+ x = TRUNCF_BINANG(PROJECTED_TO_SCREEN_X(projectedPos, distance)) - PICTO_VALID_TOPLEFT_X;
+ y = TRUNCF_BINANG(PROJECTED_TO_SCREEN_Y(projectedPos, distance)) - PICTO_VALID_TOPLEFT_Y;
// checks if the coordinates are within the capture region
if ((x < 0) || (x > PICTO_VALID_WIDTH) || (y < 0) || (y > PICTO_VALID_HEIGHT)) {
diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c
index d36f65b34..767018e58 100644
--- a/src/code/z_sub_s.c
+++ b/src/code/z_sub_s.c
@@ -589,8 +589,8 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) {
Path* SubS_GetDayDependentPath(PlayState* play, u8 pathIndex, u8 pathIndexNone, s32* startPointIndex) {
Path* path = NULL;
s32 found = false;
- s16 time1 = TIME_TO_MINUTES_F(CURRENT_TIME);
- s16 time2 = TIME_TO_MINUTES_F(CURRENT_TIME);
+ s16 time1 = TRUNCF_BINANG(TIME_TO_MINUTES_F(CURRENT_TIME));
+ s16 time2 = TRUNCF_BINANG(TIME_TO_MINUTES_F(CURRENT_TIME));
s32 time = ((time1 % 60) + (time2 / 60) * 60) / 30;
s32 day = CURRENT_DAY;
diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c
index ec5c63fc1..fd39e2fc9 100644
--- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c
+++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c
@@ -133,7 +133,7 @@ void BgNumaHana_UpdatePetalPosRots(BgNumaHana* this) {
void BgNumaHana_UpdateSettleRotation(s16* settleRotZ, s16* settleAngle, f32* settleScale, f32 scaleStep) {
*settleAngle += 0x32C8;
Math_StepToF(settleScale, 0.0f, scaleStep);
- *settleRotZ += (s16)(Math_SinS(*settleAngle) * *settleScale);
+ *settleRotZ += TRUNCF_BINANG(Math_SinS(*settleAngle) * *settleScale);
}
void BgNumaHana_Init(Actor* thisx, PlayState* play) {
diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c
index 7eebfac5d..a14d001e3 100644
--- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c
+++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c
@@ -1574,11 +1574,13 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
this->actor.speed = ((Rand_ZeroFloat(5.0f) + 2.5f) * sp64) + 2.5f;
if (Rand_ZeroOne() < 0.5f) {
- this->shapeRotTargetX = ((s16)(s32)Rand_CenteredFloat(0x1F4) + this->shapeRotTargetX) + 0x8000;
+ this->shapeRotTargetX =
+ (TRUNCF_BINANG(Rand_CenteredFloat(0x1F4)) + this->shapeRotTargetX) + 0x8000;
}
if (Rand_ZeroOne() < 0.5f) {
- this->shapeRotTargetZ = ((s16)(s32)Rand_CenteredFloat(0x1F4) + this->shapeRotTargetZ) + 0x8000;
+ this->shapeRotTargetZ =
+ (TRUNCF_BINANG(Rand_CenteredFloat(0x1F4)) + this->shapeRotTargetZ) + 0x8000;
}
if (Rand_ZeroOne() < 0.5f) {
@@ -2488,8 +2490,8 @@ void Boss03_DrawEffects(PlayState* play) {
flag++;
}
- gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s16)eff->unk_40, ((void)0, ((s16)eff->unk_40) + 55), 225,
- eff->alpha);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, TRUNCF_BINANG(eff->unk_40),
+ ((void)0, TRUNCF_BINANG(eff->unk_40) + 55), 225, eff->alpha);
Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW);
diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c
index 5e6618e4c..ecffb2e68 100644
--- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c
+++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c
@@ -475,7 +475,7 @@ void func_809ECF58(Boss04* this, PlayState* play) {
this->unk_2D0 = 10000.0f;
this->unk_2C8 = 100;
} else {
- this->actor.world.rot.y = BINANG_ROT180((s16)Rand_ZeroFloat(8000.0f) + this->actor.world.rot.y);
+ this->actor.world.rot.y = BINANG_ROT180(TRUNCF_BINANG(Rand_ZeroFloat(8000.0f)) + this->actor.world.rot.y);
}
this->actor.speed = 0.0f;
@@ -784,15 +784,15 @@ s32 Boss04_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
}
if ((limbIndex == WART_LIMB_TOP_EYELID_ROOT) || (limbIndex == WART_LIMB_BOTTOM_EYELID_ROOT)) {
- rot->y = (rot->y + (s16)this->unk_2CC) - 0x500;
+ rot->y = (rot->y + TRUNCF_BINANG(this->unk_2CC)) - 0x500;
}
if (limbIndex == WART_LIMB_EYE) {
rot->y += this->unk_2D8;
rot->z += this->unk_2D4;
if (this->unk_2DA != 0) {
- rot->y = (s16)(Math_SinS(this->unk_1F4 * 0x3000) * (this->unk_2DA * 500)) + rot->y;
- rot->z = (s16)(Math_SinS(this->unk_1F4 * 0x3500) * (this->unk_2DA * 300)) + rot->z;
+ rot->y = TRUNCF_BINANG(Math_SinS(this->unk_1F4 * 0x3000) * (this->unk_2DA * 500)) + rot->y;
+ rot->z = TRUNCF_BINANG(Math_SinS(this->unk_1F4 * 0x3500) * (this->unk_2DA * 300)) + rot->z;
}
}
diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c
index 4defc3741..76be8c461 100644
--- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c
+++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c
@@ -527,16 +527,16 @@ void Boss06_Draw(Actor* thisx, PlayState* play2) {
temp_f10 = (Math_CosS(D_809F4970->unk_144) * -2000.0f) - 2000.0f;
temp_v0_2 = SEGMENTED_TO_K0(&object_knight_Vtx_018BD0);
- temp_v0_2[0].v.ob[1] = (s16)this->unk_1A0 + 0xE92;
- temp_v0_2[3].v.ob[1] = (s16)this->unk_1A0 + 0xE92;
- temp_v0_2[4].v.ob[1] = (s16)this->unk_1A0 + 0xE92;
- temp_v0_2[7].v.ob[1] = (s16)this->unk_1A0 + 0xE92;
+ temp_v0_2[0].v.ob[1] = TRUNCF_BINANG(this->unk_1A0) + 0xE92;
+ temp_v0_2[3].v.ob[1] = TRUNCF_BINANG(this->unk_1A0) + 0xE92;
+ temp_v0_2[4].v.ob[1] = TRUNCF_BINANG(this->unk_1A0) + 0xE92;
+ temp_v0_2[7].v.ob[1] = TRUNCF_BINANG(this->unk_1A0) + 0xE92;
temp_v0_2[5].v.ob[0] = temp_s0 + 0x2A3;
- temp_v0_2[5].v.ob[2] = (temp_f10 + (s16)this->unk_1A4) - 0x708;
+ temp_v0_2[5].v.ob[2] = (temp_f10 + TRUNCF_BINANG(this->unk_1A4)) - 0x708;
temp_v0_2[6].v.ob[0] = temp_s0 - 0x2A3;
- temp_v0_2[6].v.ob[2] = (temp_f10 + (s16)this->unk_1A4) - 0x708;
+ temp_v0_2[6].v.ob[2] = (temp_f10 + TRUNCF_BINANG(this->unk_1A4)) - 0x708;
temp_v0_2[9].v.ob[0] = temp_s0 + 0x2A3;
temp_v0_2[9].v.ob[2] = temp_f10 - 0x1C2;
diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c
index 9899926c8..173a3349f 100644
--- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c
+++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c
@@ -122,11 +122,11 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, PlayState* play) {
// This block is also init code and only runs once
if (i < 32) {
if (Rand_ZeroOne() < 0.5f) {
- this->effects[i].LostWoodsSkyFishSpeedXZ = (s16)(Rand_ZeroOne() * 200.0f) + 200;
+ this->effects[i].LostWoodsSkyFishSpeedXZ = TRUNCF_BINANG(Rand_ZeroOne() * 200.0f) + 200;
} else {
- this->effects[i].LostWoodsSkyFishSpeedXZ = -200 - (s16)(Rand_ZeroOne() * 200.0f);
+ this->effects[i].LostWoodsSkyFishSpeedXZ = -200 - TRUNCF_BINANG(Rand_ZeroOne() * 200.0f);
}
- this->effects[i].LostWoodsSkyFishPosOffsetMax = (s16)(Rand_ZeroOne() * 50.0f) + 15;
+ this->effects[i].LostWoodsSkyFishPosOffsetMax = TRUNCF_BINANG(Rand_ZeroOne() * 50.0f) + 15;
this->effects[i].LostWoodsSkyFishSpeedY = ((Rand_ZeroOne() * 10.0f) + 10.0f) * 0.01f;
// Only the 31st particle matters as sLostWoodsSkyFishParticleNum will be overwritten
diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c
index 710a1863c..8aca46311 100644
--- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c
+++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c
@@ -529,13 +529,13 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
sp44.x = (Rand_ZeroOne() - 0.5f) * (2.0f * phi_f2);
sp44.y = D_80AAAAB8;
sp44.z = (Rand_ZeroOne() * D_80AAAAC4) + phi_f2;
- temp = (s16)spBC + D_80AAAACC;
+ temp = TRUNCF_BINANG(spBC) + D_80AAAACC;
EffectSsGSplash_Spawn(play, &sp44, NULL, NULL, 0, temp);
} else {
sp44.x = -phi_f2 - (Rand_ZeroOne() * D_80AAAAC4);
sp44.y = D_80AAAAB8;
sp44.z = (Rand_ZeroOne() - 0.5f) * (2.0f * phi_f2);
- temp = (s16)spBC + D_80AAAACC;
+ temp = TRUNCF_BINANG(spBC) + D_80AAAACC;
EffectSsGSplash_Spawn(play, &sp44, NULL, NULL, 0, temp);
}
}
diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c
index 938f41edb..794648cde 100644
--- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c
+++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c
@@ -986,8 +986,9 @@ void func_808BAE9C(DoorWarp1* this, PlayState* play) {
gSPSegment(POLY_XLU_DISP++, 0x0A, Matrix_NewMtx(play->state.gfxCtx));
Matrix_Push();
gSPSegment(POLY_XLU_DISP++, 0x08,
- Gfx_TwoTexScroll(play->state.gfxCtx, 0, sp94 & 0xFF, -((s16)(2.0f * this->unk_1AC) & 0x1FF), 0x100,
- 0x100, 1, sp94 & 0xFF, -((s16)(2.0f * this->unk_1AC) & 0x1FF), 0x100, 0x100));
+ Gfx_TwoTexScroll(play->state.gfxCtx, 0, sp94 & 0xFF, -(TRUNCF_BINANG(2.0f * this->unk_1AC) & 0x1FF),
+ 0x100, 0x100, 1, sp94 & 0xFF, -(TRUNCF_BINANG(2.0f * this->unk_1AC) & 0x1FF), 0x100,
+ 0x100));
Matrix_Translate(0.0f, this->unk_1A4 * 230.0f, 0.0f, MTXMODE_APPLY);
Matrix_Scale(((this->unk_1C6 * sp90) / 100.0f) + 1.0f, 1.0f, ((this->unk_1C6 * sp90) / 100.0f) + 1.0f,
@@ -1004,8 +1005,8 @@ void func_808BAE9C(DoorWarp1* this, PlayState* play) {
sp94 *= 2;
gSPSegment(POLY_XLU_DISP++, 0x08,
- Gfx_TwoTexScroll(play->state.gfxCtx, 0, sp94 & 0xFF, -((s16)this->unk_1AC & 0x1FF), 0x100, 0x100, 1,
- sp94 & 0xFF, -((s16)this->unk_1AC & 0x1FF), 0x100, 0x100));
+ Gfx_TwoTexScroll(play->state.gfxCtx, 0, sp94 & 0xFF, -(TRUNCF_BINANG(this->unk_1AC) & 0x1FF), 0x100,
+ 0x100, 1, sp94 & 0xFF, -(TRUNCF_BINANG(this->unk_1AC) & 0x1FF), 0x100, 0x100));
Matrix_Translate(0.0f, this->unk_1A8 * 60.0f, 0.0f, MTXMODE_APPLY);
Matrix_Scale(((this->unk_1C8 * sp8C) / 100.0f) + 1.0f, 1.0f, ((this->unk_1C8 * sp8C) / 100.0f) + 1.0f,
diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c
index 9a7078c78..b507c7354 100644
--- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c
+++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c
@@ -1189,8 +1189,8 @@ s32 EnAob01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if ((limbIndex == MAMAMU_YAN_LIMB_TORSO) || (limbIndex == MAMAMU_YAN_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == MAMAMU_YAN_LIMB_RIGHT_UPPER_ARM)) {
- rot->y += (s16)Math_SinS(this->fidgetTableY[limbIndex]) * 200;
- rot->z += (s16)Math_CosS(this->fidgetTableZ[limbIndex]) * 200;
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[limbIndex])) * 200;
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[limbIndex])) * 200;
}
return false;
diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c
index 1fb9def4e..aade607af 100644
--- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c
+++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c
@@ -383,7 +383,7 @@ void func_8088ACE0(EnArrow* this, PlayState* play) {
(this->collider.base.atFlags & AT_BOUNCED)) {
if ((this->collider.base.at != NULL) && (this->collider.base.at->id != ACTOR_OBJ_SYOKUDAI)) {
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos);
- this->actor.world.rot.y += BINANG_ROT180((s16)(s32)Rand_CenteredFloat(0x1F40));
+ this->actor.world.rot.y += BINANG_ROT180(TRUNCF_BINANG(Rand_CenteredFloat(0x1F40)));
this->actor.velocity.y = -this->actor.velocity.y;
this->bubble.unk_149 = -1;
return;
@@ -485,12 +485,12 @@ void func_8088ACE0(EnArrow* this, PlayState* play) {
if (Math_StepToF(&this->bubble.unk_144, 1.0f, 0.4f)) {
this->unk_260 = 0;
} else {
- this->bubble.unk_14A += (s16)(this->bubble.unk_144 * (500.0f + Rand_ZeroFloat(1400.0f)));
- this->actor.world.rot.x += (s16)(500.0f * Math_SinS(this->bubble.unk_14A));
+ this->bubble.unk_14A += TRUNCF_BINANG(this->bubble.unk_144 * (500.0f + Rand_ZeroFloat(1400.0f)));
+ this->actor.world.rot.x += TRUNCF_BINANG(500.0f * Math_SinS(this->bubble.unk_14A));
this->actor.shape.rot.x = this->actor.world.rot.x;
- this->bubble.unk_14C += (s16)(this->bubble.unk_144 * (500.0f + Rand_ZeroFloat(1400.0f)));
- this->actor.world.rot.y += (s16)(500.0f * Math_SinS(this->bubble.unk_14C));
+ this->bubble.unk_14C += TRUNCF_BINANG(this->bubble.unk_144 * (500.0f + Rand_ZeroFloat(1400.0f)));
+ this->actor.world.rot.y += TRUNCF_BINANG(500.0f * Math_SinS(this->bubble.unk_14C));
this->actor.shape.rot.y = this->actor.world.rot.y;
diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c
index 69aa87602..558d0a3b4 100644
--- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c
+++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c
@@ -425,23 +425,23 @@ s32 EnAttackNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve
EnAttackNiw* this = THIS;
if (limbIndex == NIW_LIMB_UPPER_BODY) {
- rot->y += (s16)this->upperBodyRotY;
+ rot->y += TRUNCF_BINANG(this->upperBodyRotY);
}
if (limbIndex == NIW_LIMB_HEAD) {
- rot->z += (s16)this->headRotZ;
+ rot->z += TRUNCF_BINANG(this->headRotZ);
}
if (limbIndex == NIW_LIMB_RIGHT_WING_ROOT) {
- rot->x += (s16)this->rightWingRotX;
- rot->y += (s16)this->rightWingRotY;
- rot->z += (s16)this->rightWingRotZ;
+ rot->x += TRUNCF_BINANG(this->rightWingRotX);
+ rot->y += TRUNCF_BINANG(this->rightWingRotY);
+ rot->z += TRUNCF_BINANG(this->rightWingRotZ);
}
if (limbIndex == NIW_LIMB_LEFT_WING_ROOT) {
- rot->x += (s16)this->leftWingRotX;
- rot->y += (s16)this->leftWingRotY;
- rot->z += (s16)this->leftWingRotZ;
+ rot->x += TRUNCF_BINANG(this->leftWingRotX);
+ rot->y += TRUNCF_BINANG(this->leftWingRotY);
+ rot->z += TRUNCF_BINANG(this->leftWingRotZ);
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c
index 1b28887d2..0f510158d 100644
--- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c
+++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c
@@ -785,8 +785,8 @@ s32 EnBaba_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if ((limbIndex == BBA_LIMB_UPPER_ROOT) || (limbIndex == BBA_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == BBA_LIMB_RIGHT_UPPER_ARM)) {
- rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
}
if (((this->animIndex == BOMB_SHOP_LADY_ANIM_IDLE) || (this->animIndex == BOMB_SHOP_LADY_ANIM_KNOCKED_OVER) ||
diff --git a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c
index f3e9deb78..d60290b02 100644
--- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c
+++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c
@@ -256,13 +256,13 @@ void EnBaguo_Roll(EnBaguo* this, PlayState* play) {
Math_ApproachF(&this->currentRotation.x, this->targetRotation.x, 0.2f, 1000.0f);
Math_ApproachF(&this->currentRotation.z, this->targetRotation.z, 0.2f, 1000.0f);
Math_ApproachF(&this->actor.speed, 5.0f, 0.3f, 0.5f);
- this->actor.world.rot.x += (s16)this->currentRotation.x;
+ this->actor.world.rot.x += TRUNCF_BINANG(this->currentRotation.x);
if (this->currentRotation.z != 0.0f) {
if (this->zRollDirection == NEJIRON_DIRECTION_RIGHT) {
- this->actor.world.rot.z += (s16)this->currentRotation.z;
+ this->actor.world.rot.z += TRUNCF_BINANG(this->currentRotation.z);
} else {
- this->actor.world.rot.z -= (s16)this->currentRotation.z;
+ this->actor.world.rot.z -= TRUNCF_BINANG(this->currentRotation.z);
}
}
@@ -450,9 +450,9 @@ void EnBaguo_InitializeEffect(EnBaguo* this, Vec3f* pos, Vec3f* velocity, Vec3f*
effect->accel = *accel;
effect->scale = scale;
effect->timer = timer;
- effect->rot.x = (s16)(s32)Rand_CenteredFloat(0x7530);
- effect->rot.y = (s16)(s32)Rand_CenteredFloat(0x7530);
- effect->rot.z = (s16)(s32)Rand_CenteredFloat(0x7530);
+ effect->rot.x = TRUNCF_BINANG(Rand_CenteredFloat(0x7530));
+ effect->rot.y = TRUNCF_BINANG(Rand_CenteredFloat(0x7530));
+ effect->rot.z = TRUNCF_BINANG(Rand_CenteredFloat(0x7530));
return;
}
}
diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c
index caf43c0eb..502022649 100644
--- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c
+++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c
@@ -289,8 +289,8 @@ s32 EnBba01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
}
if ((limbIndex == BBA_LIMB_BAG) || (limbIndex == BBA_LIMB_TORSO) || (limbIndex == BBA_LIMB_LEFT_FOREARM)) {
- rot->y += (s16)(Math_SinS(this->enHy.fidgetTableY[limbIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->enHy.fidgetTableZ[limbIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->enHy.fidgetTableY[limbIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->enHy.fidgetTableZ[limbIndex]) * 200.0f);
}
return false;
diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c
index abf9ddd86..a224b3744 100644
--- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c
+++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c
@@ -325,7 +325,7 @@ void EnBbfall_Fly(EnBbfall* this, PlayState* play) {
// Bounce upwards off the ground
this->actor.velocity.y *= -1.2f;
this->actor.velocity.y = CLAMP(this->actor.velocity.y, 8.0f, 12.0f);
- this->actor.shape.rot.y += (s16)(s32)Rand_CenteredFloat(0x12000);
+ this->actor.shape.rot.y += TRUNCF_BINANG(Rand_CenteredFloat(0x12000));
}
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
index 0979fd3a8..c3c0abf4a 100644
--- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
+++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
@@ -575,7 +575,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec
gDPSetEnvColor((*gfx)++, envColor, envColor, envColor, envColor);
if (this->actionFunc == EnBigokuta_SuckInPlayer) {
- rotX = (s16)(this->timer * 6144.0f * (1 / 9.0f));
+ rotX = TRUNCF_BINANG(this->timer * 6144.0f * (1 / 9.0f));
rot->x -= rotX;
} else if (this->actionFunc == EnBigokuta_HoldPlayer) {
if (this->timer == 1) {
diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c
index 551a10e24..cd521d02e 100644
--- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c
+++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c
@@ -1435,7 +1435,7 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, PlayState* play) {
fireRadius = 500;
} else {
Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY);
- fireRadius = (s16)(thisx->scale.x * 500.0f * 100.0f);
+ fireRadius = TRUNCF_BINANG(thisx->scale.x * 500.0f * 100.0f);
}
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (play->gameplayFrames * -20) % 512, 0x20,
diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c
index b24441829..81e11f192 100644
--- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c
+++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c
@@ -1325,7 +1325,7 @@ void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this) {
targetVtx = &sBigslimeTargetVtx[j];
targetVtx->n.ob[0] = staticVtx->n.ob[0];
targetVtx->n.ob[2] = staticVtx->n.ob[2];
- targetVtxY = (s16)(((lowerSphereCos * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F);
+ targetVtxY = TRUNCF_BINANG(((lowerSphereCos * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F);
targetVtx->n.ob[1] = targetVtxY;
}
}
@@ -1368,7 +1368,7 @@ void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this) {
targetVtx = &sBigslimeTargetVtx[j];
targetVtx->n.ob[0] = staticVtx->n.ob[0];
targetVtx->n.ob[2] = staticVtx->n.ob[2];
- vtxY = (s16)(((upperSphereCos * 0.1f) + 0.9f) * BIGSLIME_RADIUS_F);
+ vtxY = TRUNCF_BINANG(((upperSphereCos * 0.1f) + 0.9f) * BIGSLIME_RADIUS_F);
targetVtx->n.ob[1] = vtxY;
}
}
@@ -1550,7 +1550,7 @@ void EnBigslime_CutsceneGrabPlayer(EnBigslime* this, PlayState* play) {
for (j = 0; j < 3; j++) {
// Linearly interpolate dynamicVtx --> staticVtx
dynamicVtx->n.ob[j] +=
- (s16)((sBigslimeStaticVtx[i].n.ob[j] - dynamicVtx->n.ob[j]) * invgrabPlayerTimer);
+ TRUNCF_BINANG((sBigslimeStaticVtx[i].n.ob[j] - dynamicVtx->n.ob[j]) * invgrabPlayerTimer);
}
}
@@ -1697,7 +1697,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) {
player->actor.world.pos.y = this->actor.world.pos.y + (this->actor.scale.y * -500.0f);
// Linearly interpolate gekkoRot.y --> this->actor.world.rot.y
- this->gekkoRot.y += (s16)((s16)(this->actor.world.rot.y - this->gekkoRot.y) * invWindupPunchTimer);
+ this->gekkoRot.y += TRUNCF_BINANG((s16)(this->actor.world.rot.y - this->gekkoRot.y) * invWindupPunchTimer);
this->gekkoPosOffset.x = Math_SinS(this->gekkoRot.y) * -50.0f;
this->gekkoPosOffset.z = Math_CosS(this->gekkoRot.y) * -50.0f;
} else {
@@ -1741,10 +1741,10 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) {
// loop over x, y, z
for (j = 0; j < 3; j++) {
// Linearly interpolate dynamicVtx --> staticVtx * (1 - scale * vtxSurfacePerturbation)
- dynamicVtx->n.ob[j] += (s16)(((staticVtx->n.ob[j] - (s32)(scale * staticVtx->n.ob[j] *
- this->vtxSurfacePerturbation[i])) -
- dynamicVtx->n.ob[j]) *
- invWindupPunchTimer);
+ dynamicVtx->n.ob[j] += TRUNCF_BINANG(
+ ((staticVtx->n.ob[j] - (s32)(scale * staticVtx->n.ob[j] * this->vtxSurfacePerturbation[i])) -
+ dynamicVtx->n.ob[j]) *
+ invWindupPunchTimer);
}
} else {
// loop over x, y, z
@@ -1759,7 +1759,8 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) {
// loop over x, y, z
for (j = 0; j < 3; j++) {
// Linearly interpolate dynamicVtx --> staticVtx
- dynamicVtx->n.ob[j] += (s16)((staticVtx->n.ob[j] - dynamicVtx->n.ob[j]) * invWindupPunchTimer);
+ dynamicVtx->n.ob[j] +=
+ TRUNCF_BINANG((staticVtx->n.ob[j] - dynamicVtx->n.ob[j]) * invWindupPunchTimer);
}
}
}
@@ -1794,7 +1795,7 @@ void EnBigslime_SetDynamicVtxThrowPlayer(EnBigslime* this, PlayState* play) {
// loop over x, y, z
for (j = 0; j < 3; j++) {
// Linearly interpolate dynamicVtx --> targetVtx
- dynamicVtx->n.ob[j] += (s16)((targetVtx->n.ob[j] - dynamicVtx->n.ob[j]) * invThrowPlayerTimer);
+ dynamicVtx->n.ob[j] += TRUNCF_BINANG((targetVtx->n.ob[j] - dynamicVtx->n.ob[j]) * invThrowPlayerTimer);
}
}
@@ -1881,9 +1882,9 @@ void EnBigslime_Freeze(EnBigslime* this, PlayState* play) {
dynamicVtx = &sBigslimeDynamicVtx[this->dynamicVtxState][vtxIceSeed];
targetVtx = &sBigslimeTargetVtx[vtxIceSeed];
randFloat = Rand_CenteredFloat(40.0f);
- dynamicVtx->n.ob[0] += (s16)(randFloat / this->actor.scale.x);
- dynamicVtx->n.ob[1] += (s16)(randFloat / this->actor.scale.y);
- dynamicVtx->n.ob[2] += (s16)(randFloat / this->actor.scale.z);
+ dynamicVtx->n.ob[0] += TRUNCF_BINANG(randFloat / this->actor.scale.x);
+ dynamicVtx->n.ob[1] += TRUNCF_BINANG(randFloat / this->actor.scale.y);
+ dynamicVtx->n.ob[2] += TRUNCF_BINANG(randFloat / this->actor.scale.z);
if (((dynamicVtx->n.ob[1] * this->actor.scale.y) + this->actor.world.pos.y) < GBT_ROOM_5_MIN_Y) {
dynamicVtx->n.ob[1] = ((GBT_ROOM_5_MIN_Y - this->actor.world.pos.y) / this->actor.scale.y) - 1.0f;
}
@@ -2843,8 +2844,8 @@ void EnBigslime_UpdateGekko(Actor* thisx, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 40.0f, 80.0f,
UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 |
UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10);
- this->gekkoCollider.dim.pos.x = (s16)this->actor.world.pos.x;
- this->gekkoCollider.dim.pos.z = (s16)this->actor.world.pos.z;
+ this->gekkoCollider.dim.pos.x = TRUNCF_BINANG(this->actor.world.pos.x);
+ this->gekkoCollider.dim.pos.z = TRUNCF_BINANG(this->actor.world.pos.z);
if (this->gekkoCollider.base.acFlags & AC_ON) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->gekkoCollider.base);
}
@@ -2856,7 +2857,7 @@ void EnBigslime_UpdateGekko(Actor* thisx, PlayState* play) {
EnBigslime_UpdateEffects(this);
if ((this->actionFunc != EnBigslime_StunGekko) &&
- (this->gekkoCollider.dim.pos.y < (s16)(3.0f + GBT_ROOM_5_MIN_Y))) {
+ (this->gekkoCollider.dim.pos.y < TRUNCF_BINANG(3.0f + GBT_ROOM_5_MIN_Y))) {
Vec3f vtxNorm;
if (((play->gameplayFrames % 4) == 0) || !isGekkoOnGround) {
diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c
index 96759b331..7efbb4118 100644
--- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c
+++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c
@@ -281,7 +281,7 @@ void EnBom_Move(EnBom* this, PlayState* play) {
temp = BINANG_ROT180(temp);
}
Math_ScaledStepToS(&this->actor.shape.rot.y, temp, this->actor.speed * 100.0f);
- this->unk_1FA += (s16)(this->actor.speed * 800.0f);
+ this->unk_1FA += TRUNCF_BINANG(this->actor.speed * 800.0f);
}
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c
index 4434f5b4d..3198a22d0 100644
--- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c
+++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c
@@ -545,7 +545,7 @@ void EnBombers_Update(Actor* thisx, PlayState* play) {
this->unk_2B8++;
if (this->unk_2B8 >= 3) {
this->unk_2B8 = 0;
- this->unk_2BA = (s16)Rand_ZeroFloat(60.0f) + 20;
+ this->unk_2BA = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 20;
}
}
diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c
index d3710e521..d39a39eba 100644
--- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c
+++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c
@@ -418,7 +418,7 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) {
this->eyeIndex += 1;
if (this->eyeIndex >= 3) {
this->eyeIndex = 0;
- this->unk_2BE = (s16)Rand_ZeroFloat(60.0f) + 0x14;
+ this->unk_2BE = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 0x14;
}
}
Math_Vec3f_Copy(&sp34, &this->actor.world.pos);
diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c
index 3a8dc9cfb..c0b651968 100644
--- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c
+++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c
@@ -488,7 +488,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) {
EffectSsHitmark_SpawnFixedScale(play, 0, &sp40);
this->unk_2BC++;
- if (((s16)Rand_ZeroFloat(2.0f) + 3) < this->unk_2BC) {
+ if ((TRUNCF_BINANG(Rand_ZeroFloat(2.0f)) + 3) < this->unk_2BC) {
EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_5, 1.0f);
this->unk_29A = 0;
Math_Vec3f_Copy(&this->unk_2A4, &this->actor.home.pos);
@@ -1105,7 +1105,7 @@ void EnBomjima_Update(Actor* thisx, PlayState* play) {
this->unk_2E0++;
if (this->unk_2E0 >= 3) {
this->unk_2E0 = 0;
- this->unk_2E2 = (s16)Rand_ZeroFloat(60.0f) + 20;
+ this->unk_2E2 = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 20;
}
}
diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c
index 916094ac6..95deb67c8 100644
--- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c
+++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c
@@ -924,7 +924,7 @@ void EnBomjimb_Update(Actor* thisx, PlayState* play2) {
this->unk_2C2++;
if (this->unk_2C2 > 2) {
this->unk_2C2 = 0;
- this->unk_2C4 = (s16)Rand_ZeroFloat(60.0f) + 20;
+ this->unk_2C4 = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 20;
}
}
diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c
index cea78dc9e..2f542739a 100644
--- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c
+++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c
@@ -203,7 +203,7 @@ void func_808A2918(EnBoom* this, PlayState* play) {
}
Math_ScaledStepToS(&this->actor.world.rot.y, sp72,
- (this->unk_1CF > 0) ? 0x3E8 : (s16)(ABS_ALT(sp70) * sp64));
+ (this->unk_1CF > 0) ? 0x3E8 : TRUNCF_BINANG(ABS_ALT(sp70) * sp64));
}
Math_ScaledStepToS(&this->actor.world.rot.x, sp6E, ABS_ALT(sp6C) * sp64);
diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c
index 219665701..88f011553 100644
--- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c
+++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c
@@ -238,7 +238,7 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) {
this->bounceDirection = bounceDirection;
bounceCount = this->bounceCount;
this->bounceCount = ++bounceCount;
- if (bounceCount > (s16)(Rand_ZeroOne() * 10.0f)) {
+ if (bounceCount > TRUNCF_BINANG(Rand_ZeroOne() * 10.0f)) {
this->bounceCount = 0;
}
bounceSpeed = (this->bounceCount == 0) ? 3.6000001f : 3.0f;
@@ -257,7 +257,7 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) {
this->bounceDirection = bounceDirection;
bounceCount = this->bounceCount;
this->bounceCount = ++bounceCount;
- if (bounceCount > (s16)(Rand_ZeroOne() * 10.0f)) {
+ if (bounceCount > TRUNCF_BINANG(Rand_ZeroOne() * 10.0f)) {
this->bounceCount = 0;
}
bounceSpeed = (this->bounceCount == 0) ? 3.6000001f : 3.0f;
diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c
index 77414e0e4..b4c80d02e 100644
--- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c
+++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c
@@ -221,7 +221,7 @@ void func_8091C6B4(EnButte* this) {
s16 temp_v0 = temp_a1 - this->actor.shape.rot.y;
Math_ScaledStepToS(&this->actor.shape.rot.y, temp_a1, ABS_ALT(temp_v0) >> 3);
- this->actor.shape.rot.x = (s16)(Math_SinS(this->unk_258) * 600.0f) - 0x2320;
+ this->actor.shape.rot.x = TRUNCF_BINANG(Math_SinS(this->unk_258) * 600.0f) - 0x2320;
}
void func_8091C748(EnButte* this) {
@@ -272,7 +272,7 @@ void func_8091C794(EnButte* this, PlayState* play) {
sp38 = 0.4f;
}
} else {
- this->actor.world.rot.y += (s16)(Math_SinS(this->unk_254) * 100.0f);
+ this->actor.world.rot.y += TRUNCF_BINANG(Math_SinS(this->unk_254) * 100.0f);
}
func_8091C6B4(this);
@@ -329,7 +329,7 @@ void func_8091CBB4(EnButte* this, PlayState* play) {
yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &sp48);
if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw + (s32)(Rand_ZeroOne() * D_8091D3F0), 0x7D0)) {
if ((play->gameplayFrames & 0x30) == 0x30) {
- this->actor.world.rot.y += (s16)(Math_SinS(this->unk_254) * 60.0f);
+ this->actor.world.rot.y += TRUNCF_BINANG(Math_SinS(this->unk_254) * 60.0f);
}
} else {
sp40 = 0.3f;
diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c
index 07058af7a..d5652fa2e 100644
--- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c
+++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c
@@ -97,7 +97,7 @@ void EnCha_Idle(EnCha* this, PlayState* play) {
}
}
this->actor.home.rot.x += this->actor.home.rot.z;
- this->actor.home.rot.z -= (s16)(this->actor.home.rot.x * 0.1f);
+ this->actor.home.rot.z -= TRUNCF_BINANG(this->actor.home.rot.x * 0.1f);
this->actor.home.rot.z *= 0.96f;
}
diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c
index 9e97549fc..f8eb0b9ae 100644
--- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c
+++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c
@@ -280,8 +280,8 @@ s32 EnCne01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if ((limbIndex == CNE_LIMB_TORSO) || (limbIndex == CNE_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == CNE_LIMB_RIGHT_UPPER_ARM)) {
- rot->y += (s16)(Math_SinS(this->enHy.fidgetTableY[limbIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->enHy.fidgetTableZ[limbIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->enHy.fidgetTableY[limbIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->enHy.fidgetTableZ[limbIndex]) * 200.0f);
}
return false;
diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c
index 72f9236e5..bdd60af09 100644
--- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c
+++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c
@@ -549,9 +549,9 @@ s32 EnCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if (this->actor.colChkInfo.health != 0) {
if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) {
- rot->y += (s16)(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4)));
+ rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4)));
} else if (limbIndex == OBJECT_CROW_LIMB_TAIL) {
- rot->y += (s16)(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4)));
+ rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4)));
}
}
return false;
diff --git a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c
index a2e29fb74..f2dcace68 100644
--- a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c
+++ b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c
@@ -108,8 +108,8 @@ void EnDs2n_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
if ((limbIndex == DS2N_LIMB_HIPS) || (limbIndex == DS2N_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == DS2N_LIMB_RIGHT_UPPER_ARM)) {
- rot->y += (s16)Math_SinS(this->fidgetTableY[limbIndex]) * 200;
- rot->z += (s16)Math_CosS(this->fidgetTableZ[limbIndex]) * 200;
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[limbIndex])) * 200;
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[limbIndex])) * 200;
}
if (limbIndex == DS2N_LIMB_HEAD) {
diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c
index fae51e685..6b47c734a 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c
+++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c
@@ -62,7 +62,7 @@ void EnEndingHero_Update(Actor* thisx, PlayState* play) {
this->unk242++;
if (this->unk242 > 2) {
this->unk242 = 0;
- this->unk240 = (s16)Rand_ZeroFloat(60.0f) + 0x14;
+ this->unk240 = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 0x14;
}
}
this->actionFunc(this, play);
diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c
index 4d9b932db..6344370c5 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c
+++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c
@@ -125,7 +125,7 @@ void EnEndingHero6_Update(Actor* thisx, PlayState* play) {
this->eyeState++;
if (this->eyeState >= 3) {
this->eyeState = 0;
- this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
+ this->blinkTimer = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 20;
}
}
diff --git a/src/overlays/actors/ovl_En_Estone/z_en_estone.c b/src/overlays/actors/ovl_En_Estone/z_en_estone.c
index 7a4f4ec28..44658a09c 100644
--- a/src/overlays/actors/ovl_En_Estone/z_en_estone.c
+++ b/src/overlays/actors/ovl_En_Estone/z_en_estone.c
@@ -67,7 +67,7 @@ void EnEstone_Init(Actor* thisx, PlayState* play) {
this->rotVel.x = this->rotVel.y = this->rotVel.z = Rand_CenteredFloat(1.0f) * 20.0f;
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
- this->actor.world.rot.y += (s16)(s32)Rand_CenteredFloat(0x2710);
+ this->actor.world.rot.y += TRUNCF_BINANG(Rand_CenteredFloat(0x2710));
this->actor.shape.rot.y = this->actor.world.rot.y;
if (this->actor.params == ENESTONE_TYPE_LARGE) {
diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c
index af75f27f6..c3d77576c 100644
--- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c
+++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c
@@ -301,7 +301,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) {
Math_ScaledStepToS(&this->actor.shape.rot.y,
Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300);
} else if (rand < 0.8f) {
- this->actor.shape.rot.y += (s16)(s32)Rand_CenteredFloat(0x600);
+ this->actor.shape.rot.y += TRUNCF_BINANG(Rand_CenteredFloat(0x600));
}
// Climb if too close to ground
diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c
index 7df5498e7..f4b223813 100644
--- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c
+++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c
@@ -563,7 +563,7 @@ void func_8091EAF0(Actor* thisx, PlayState* play) {
s16 phi_v1;
Math_SmoothStepToF(&this->actor.speed, Rand_ZeroOne() * 0.2f, 0.1f, 0.1f, 0.0f);
- phi_v1 = (s16)((((sp40 >> 5) & 2) | ((sp40 >> 2) & 1)) << 0xB) * 0.3f;
+ phi_v1 = TRUNCF_BINANG((s16)((((sp40 >> 5) & 2) | ((sp40 >> 2) & 1)) << 0xB) * 0.3f);
if (sp40 & 4) {
phi_v1 *= -1;
}
diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
index cc26b6ecf..02084c57f 100644
--- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
+++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
@@ -3365,7 +3365,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->unk_149 = 6;
sp134 = 2;
- if (((s16)player->actor.world.pos.x + D_80917268) & 1) {
+ if ((TRUNCF_BINANG(player->actor.world.pos.x) + D_80917268) & 1) {
sp10C.x = 30.0f;
} else {
sp10C.x = -30.0f;
@@ -3874,7 +3874,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
D_809171D2 = D_80917206;
Actor_Kill(&this->actor);
} else if ((this->unk_148 == 0) && (D_809171D0 == 0) &&
- ((s16)this->unk_1A4 < (s16)D_8090CCF0)) {
+ (TRUNCF_BINANG(this->unk_1A4) < TRUNCF_BINANG(D_8090CCF0))) {
this->unk_1CD = 1;
this->unk_172[0] = 0x3C;
Message_StartTextbox(play, 0x4098, NULL);
@@ -4074,7 +4074,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
func_80903C60(this, 1);
this->unk_17C = this->actor.velocity.y;
this->actor.velocity.y = 0.0f;
- this->unk_162 = (s16)(s32)Rand_CenteredFloat(0x8000);
+ this->unk_162 = TRUNCF_BINANG(Rand_CenteredFloat(0x8000));
} else if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) &&
(this->actor.prevPos.y >= WATER_SURFACE_Y(play))) {
if (this->unk_17C < -5.0f) {
@@ -4135,10 +4135,10 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
if (Rand_ZeroOne() < 0.5f) {
this->unk_15E = 0;
} else {
- this->unk_15E = (s16)(s32)Rand_CenteredFloat(0x20) + 0x8000;
+ this->unk_15E = TRUNCF_BINANG(Rand_CenteredFloat(0x20)) + 0x8000;
}
- this->unk_160 = (s16)(s32)Rand_CenteredFloat(0x4000);
+ this->unk_160 = TRUNCF_BINANG(Rand_CenteredFloat(0x4000));
this->unk_188 = 1.0f;
this->unk_18C = 5000.0f;
this->unk_194 = 5000.0f;
@@ -4842,7 +4842,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) {
this->unk_154 = 20;
} else if (D_809171D0 == 0) {
D_8090CCF8 = D_8090CCF0;
- if ((s16)D_809171CC < (s16)D_8090CCF0) {
+ if (TRUNCF_BINANG(D_809171CC) < TRUNCF_BINANG(D_8090CCF0)) {
if (D_809171D2 == 2) {
this->actor.textId = 0x40B0;
} else {
@@ -4924,11 +4924,11 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) {
f32 temp;
HIGH_SCORE(HS_FISHING) &= 0xFFFFFF00;
- HIGH_SCORE(HS_FISHING) |= ((s16)D_809171CC & 0x7F);
+ HIGH_SCORE(HS_FISHING) |= (TRUNCF_BINANG(D_809171CC) & 0x7F);
temp = (HIGH_SCORE(HS_FISHING) & 0x7F000000) >> 0x18;
if (temp < D_809171CC) {
HIGH_SCORE(HS_FISHING) &= 0xFFFFFF;
- HIGH_SCORE(HS_FISHING) |= ((s16)D_809171CC & 0x7F) << 0x18;
+ HIGH_SCORE(HS_FISHING) |= (TRUNCF_BINANG(D_809171CC) & 0x7F) << 0x18;
if (D_809171D2 == 2) {
HIGH_SCORE(HS_FISHING) |= 0x80000000;
@@ -4942,7 +4942,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) {
}
} else {
HIGH_SCORE(HS_FISHING) &= 0xFFFFFF;
- HIGH_SCORE(HS_FISHING) |= ((s16)D_809171CC & 0x7F) << 0x18;
+ HIGH_SCORE(HS_FISHING) |= (TRUNCF_BINANG(D_809171CC) & 0x7F) << 0x18;
if (D_809171D2 == 2) {
HIGH_SCORE(HS_FISHING) |= 0x80000000;
diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
index e4ef83109..04bf00e9d 100644
--- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
+++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
@@ -1657,8 +1657,8 @@ s32 EnFsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
break;
}
if (fidgetIndex < 9) {
- rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
}
}
if (limbIndex == FSN_LIMB_TOUPEE) {
diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c
index b653e3953..50282c066 100644
--- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c
+++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c
@@ -414,8 +414,8 @@ s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
// Make small fidgeting movements if in standing animation.
if ((limbIndex == GERUDO_WHITE_LIMB_TORSO) || (limbIndex == GERUDO_WHITE_LIMB_LEFT_FOREARM) ||
(limbIndex == GERUDO_WHITE_LIMB_RIGHT_FOREARM)) {
- rot->y += (s16)(Math_SinS(play->state.frames * (limbIndex * 50 + 0x814)) * 200.0f);
- rot->z += (s16)(Math_CosS(play->state.frames * (limbIndex * 50 + 0x940)) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(play->state.frames * (limbIndex * 50 + 0x814)) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(play->state.frames * (limbIndex * 50 + 0x940)) * 200.0f);
}
}
return false;
diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c
index 5154482d6..0a72b2303 100644
--- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c
+++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c
@@ -240,7 +240,7 @@ void func_80BB178C(EnGeg* this, PlayState* play) {
if (this->unk_230 & 1) {
this->colliderSphere.dim.worldSphere.center.x = sp34.x;
this->colliderSphere.dim.worldSphere.center.y = sp34.y;
- this->colliderSphere.dim.worldSphere.center.y += (s16)this->actor.shape.yOffset;
+ this->colliderSphere.dim.worldSphere.center.y += TRUNCF_BINANG(this->actor.shape.yOffset);
this->colliderSphere.dim.worldSphere.center.z = sp34.z;
this->colliderSphere.dim.modelSphere.radius = 20;
this->colliderSphere.dim.worldSphere.radius =
diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c
index 153ac8d0d..c1131804f 100644
--- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c
+++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c
@@ -1782,8 +1782,8 @@ s32 EnGm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
}
if ((this->unk_3A4 & 0x2000) && (fidgetIndex < 9)) {
- rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
}
return false;
diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c
index 6a9d58724..6bee89d63 100644
--- a/src/overlays/actors/ovl_En_Go/z_en_go.c
+++ b/src/overlays/actors/ovl_En_Go/z_en_go.c
@@ -793,7 +793,7 @@ void EnGo_UpdateSnowballCollider(EnGo* this, PlayState* play) {
this->colliderSphere.dim.worldSphere.center.x = worldPos.x;
this->colliderSphere.dim.worldSphere.center.y = worldPos.y;
- this->colliderSphere.dim.worldSphere.center.y += (s16)this->actor.shape.yOffset;
+ this->colliderSphere.dim.worldSphere.center.y += TRUNCF_BINANG(this->actor.shape.yOffset);
this->colliderSphere.dim.worldSphere.center.z = worldPos.z;
this->colliderSphere.dim.modelSphere.radius = 48;
@@ -826,7 +826,7 @@ void EnGo_UpdateRolledUpCollider(EnGo* this, PlayState* play) {
Math_Vec3f_Copy(&worldPos, &this->actor.world.pos);
this->colliderSphere.dim.worldSphere.center.x = worldPos.x;
this->colliderSphere.dim.worldSphere.center.y = worldPos.y;
- this->colliderSphere.dim.worldSphere.center.y += (s16)this->actor.shape.yOffset;
+ this->colliderSphere.dim.worldSphere.center.y += TRUNCF_BINANG(this->actor.shape.yOffset);
this->colliderSphere.dim.worldSphere.center.z = worldPos.z;
this->colliderSphere.dim.modelSphere.radius = 20;
this->colliderSphere.dim.worldSphere.radius =
@@ -1339,7 +1339,7 @@ s32 EnGo_HandleGatekeeperPoundCutscene(EnGo* this, f32 initialVelocity, f32 maxD
if (velocity > 0.0f) {
// PHASE 1: Goron is rising
rotAndDistortFactor = velocity / initialVelocity;
- this->actor.shape.rot.x += (s16)(0x238C * rotAndDistortFactor);
+ this->actor.shape.rot.x += TRUNCF_BINANG(0x238C * rotAndDistortFactor);
this->elapsedHangtime = 0;
} else if ((s32)this->actor.velocity.y == 0) {
if (maxHangtime >= this->elapsedHangtime) {
@@ -2309,7 +2309,7 @@ void EnGo_Snowball(EnGo* this, PlayState* play) {
}
this->actor.speed = 4.0f;
- this->actor.shape.rot.x += (s16)(this->actor.speed * 546.0f);
+ this->actor.shape.rot.x += TRUNCF_BINANG(this->actor.speed * 546.0f);
Actor_MoveWithGravity(&this->actor);
}
}
@@ -2528,8 +2528,8 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
}
if ((this->actionFlags & ENGO_FLAG_STANDING) && (fidgetIndex < 9)) {
- rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c
index 5b15e66a3..4422b8916 100644
--- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c
+++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c
@@ -707,7 +707,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) {
if (this->unk_19D == 4) {
sp48 = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 0.8f, 16384.0f, 3640.0f);
- this->unk_19E[0].y += (s16)this->unk_1DC;
+ this->unk_19E[0].y += TRUNCF_BINANG(this->unk_1DC);
if (sp48 == 0.0f) {
phi_v0_2 = this->unk_19E[0].y;
if (phi_v0_2 > 0) {
@@ -888,7 +888,7 @@ s32 func_809995A4(EnGs* this, PlayState* play) {
Actor_MoveWithGravity(&this->actor);
Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 0.5f, 364.0f, 0.0f);
- this->unk_19E[1].y += (s16)this->unk_1DC;
+ this->unk_19E[1].y += TRUNCF_BINANG(this->unk_1DC);
if ((this->actor.world.pos.y - this->actor.home.pos.y) >= 4000.0f) {
this->unk_216 = 0;
diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c
index 795ef3852..de9f74739 100644
--- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c
+++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c
@@ -332,7 +332,7 @@ void EnGuardNuts_Update(Actor* thisx, PlayState* play) {
this->eyeState++;
if (this->eyeState >= 3) {
this->eyeState = 0;
- this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
+ this->blinkTimer = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 20;
}
}
if ((this->animIndex == GUARD_NUTS_ANIM_WALK) &&
diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c
index efa7f2e97..6e8d5c6e2 100644
--- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c
+++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c
@@ -297,7 +297,7 @@ void func_80B236C8(EnHanabi* this, PlayState* play) {
sp28 = func_80B22C80(&sp34, this->unk_148, 1.0f);
}
- this->actor.home.rot.y += (s16)((Rand_ZeroFloat(40.0f) + 80.0f) * 256.0f);
+ this->actor.home.rot.y += TRUNCF_BINANG((Rand_ZeroFloat(40.0f) + 80.0f) * 256.0f);
this->unk_144 = (s32)Rand_ZeroFloat(5.0f) + 20;
Actor_PlaySfx(&this->actor, NA_SE_OC_FIREWORKS);
func_80B235CC(this, &sp34, sp28);
diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c
index c67d448e1..b6c348935 100644
--- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c
+++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c
@@ -880,7 +880,7 @@ s32 EnHintSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3
temp_f10 = fabsf(Math_SinS(play->state.frames * 6000) * 95.0f) + 160.0f;
gDPPipeSync(POLY_OPA_DISP++);
- gDPSetEnvColor(POLY_OPA_DISP++, (s16)temp_f10, (s16)temp_f10, (s16)temp_f10, 255);
+ gDPSetEnvColor(POLY_OPA_DISP++, TRUNCF_BINANG(temp_f10), TRUNCF_BINANG(temp_f10), TRUNCF_BINANG(temp_f10), 255);
CLOSE_DISPS(play->state.gfxCtx);
} else if (limbIndex == STALCHILD_LIMB_RIBCAGE) {
diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c
index d5e0e98d0..12285e15a 100644
--- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c
+++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c
@@ -639,7 +639,7 @@ void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) {
flameElem->pos.y = this->actor.world.pos.y;
flameElem->pos.z = (sp84 * var_fs0) + this->actor.world.pos.z;
- flameElem->unkC = Math_SinS((s16)(s32)(var_fs0 * 25486.223f)) * 1.6f;
+ flameElem->unkC = Math_SinS(TRUNCF_BINANG(var_fs0 * 25486.223f)) * 1.6f;
if (flameElem->unkC > 1.0f) {
flameElem->unkC = 1.0f;
} else if (flameElem->unkC < 0.0f) {
@@ -666,19 +666,19 @@ void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) {
sp68.z = temp_fs0;
}
- var_fs0_2 = Math_SinS((s16)(s32)(sp68.z * 212.3852f)) * 1.6f;
+ var_fs0_2 = Math_SinS(TRUNCF_BINANG(sp68.z * 212.3852f)) * 1.6f;
if (var_fs0_2 > 1.0f) {
var_fs0_2 = 1.0f;
}
sp80 *= ((1.0f - flameGroup->unk4) * 0.8f) + 0.2f;
if (sp80 > 0.2f) {
this->collider.cyl.dim.pos.x =
- (s16)(s32)((Math_SinS(this->actor.shape.rot.y) * sp68.z) + this->actor.world.pos.x);
- this->collider.cyl.dim.pos.y = (s16)(s32)(this->actor.world.pos.y - (24.0f * var_fs0_2));
+ TRUNCF_BINANG((Math_SinS(this->actor.shape.rot.y) * sp68.z) + this->actor.world.pos.x);
+ this->collider.cyl.dim.pos.y = TRUNCF_BINANG(this->actor.world.pos.y - (24.0f * var_fs0_2));
this->collider.cyl.dim.pos.z =
- (s16)(s32)((Math_CosS(this->actor.shape.rot.y) * sp68.z) + this->actor.world.pos.z);
- this->collider.cyl.dim.radius = (s16)(s32)(15.0f * var_fs0_2);
- this->collider.cyl.dim.height = (s16)(s32)(37.5f * var_fs0_2);
+ TRUNCF_BINANG((Math_CosS(this->actor.shape.rot.y) * sp68.z) + this->actor.world.pos.z);
+ this->collider.cyl.dim.radius = TRUNCF_BINANG(15.0f * var_fs0_2);
+ this->collider.cyl.dim.height = TRUNCF_BINANG(37.5f * var_fs0_2);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.tris.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.tris.base);
diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c
index d9d746b68..ec8ffcffc 100644
--- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c
+++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c
@@ -4121,7 +4121,7 @@ void EnHorse_TiltBody(EnHorse* this, PlayState* play) {
speed = this->actor.speed / this->boostSpeed;
turnVel = this->actor.shape.rot.y - this->lastYaw;
- targetRoll = -((s16)((2730.0f * speed) * (turnVel / 960.00006f)));
+ targetRoll = -TRUNCF_BINANG((2730.0f * speed) * (turnVel / 960.00006f));
rollDiff = targetRoll - this->actor.world.rot.z;
if (fabsf(targetRoll) < 100.0f) {
@@ -4316,22 +4316,22 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) {
if (this->type == HORSE_TYPE_2) {
this->colliderCylinder1.dim.pos.x =
- (s16)(Math_SinS(thisx->shape.rot.y) * 11.0f) + this->colliderCylinder1.dim.pos.x;
+ TRUNCF_BINANG(Math_SinS(thisx->shape.rot.y) * 11.0f) + this->colliderCylinder1.dim.pos.x;
this->colliderCylinder1.dim.pos.z =
- (s16)(Math_CosS(thisx->shape.rot.y) * 11.0f) + this->colliderCylinder1.dim.pos.z;
+ TRUNCF_BINANG(Math_CosS(thisx->shape.rot.y) * 11.0f) + this->colliderCylinder1.dim.pos.z;
this->colliderCylinder2.dim.pos.x =
- (s16)(Math_SinS(thisx->shape.rot.y) * -18.0f) + this->colliderCylinder2.dim.pos.x;
+ TRUNCF_BINANG(Math_SinS(thisx->shape.rot.y) * -18.0f) + this->colliderCylinder2.dim.pos.x;
this->colliderCylinder2.dim.pos.z =
- (s16)(Math_CosS(thisx->shape.rot.y) * -18.0f) + this->colliderCylinder2.dim.pos.z;
+ TRUNCF_BINANG(Math_CosS(thisx->shape.rot.y) * -18.0f) + this->colliderCylinder2.dim.pos.z;
} else {
this->colliderCylinder1.dim.pos.x =
- (s16)(Math_SinS(thisx->shape.rot.y) * 6.6000004f) + this->colliderCylinder1.dim.pos.x;
+ TRUNCF_BINANG(Math_SinS(thisx->shape.rot.y) * 6.6000004f) + this->colliderCylinder1.dim.pos.x;
this->colliderCylinder1.dim.pos.z =
- (s16)(Math_CosS(thisx->shape.rot.y) * 6.6000004f) + this->colliderCylinder1.dim.pos.z;
+ TRUNCF_BINANG(Math_CosS(thisx->shape.rot.y) * 6.6000004f) + this->colliderCylinder1.dim.pos.z;
this->colliderCylinder2.dim.pos.x =
- (s16)(Math_SinS(thisx->shape.rot.y) * -10.8f) + this->colliderCylinder2.dim.pos.x;
+ TRUNCF_BINANG(Math_SinS(thisx->shape.rot.y) * -10.8f) + this->colliderCylinder2.dim.pos.x;
this->colliderCylinder2.dim.pos.z =
- (s16)(Math_CosS(thisx->shape.rot.y) * -10.8f) + this->colliderCylinder2.dim.pos.z;
+ TRUNCF_BINANG(Math_CosS(thisx->shape.rot.y) * -10.8f) + this->colliderCylinder2.dim.pos.z;
}
CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder1.base);
diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c
index 3d31dc945..fac7fb840 100644
--- a/src/overlays/actors/ovl_En_In/z_en_in.c
+++ b/src/overlays/actors/ovl_En_In/z_en_in.c
@@ -1693,8 +1693,8 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
}
if ((limbIndex == OBJECT_IN_LIMB_09) || (limbIndex == OBJECT_IN_LIMB_0A) || (limbIndex == OBJECT_IN_LIMB_0D)) {
- rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
}
if (this->unk4AC & 0x40) {
diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.c b/src/overlays/actors/ovl_En_Ja/z_en_ja.c
index 92c46383d..c69d14403 100644
--- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c
+++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c
@@ -129,7 +129,7 @@ void func_80BC1984(EnJa* this, PlayState* play) {
s32 pad[2];
Collider_UpdateCylinder(&this->actor, &this->collider);
- this->collider.dim.height = (s16)fabsf(this->actor.focus.pos.y - this->actor.world.pos.y) + 5;
+ this->collider.dim.height = TRUNCF_BINANG(fabsf(this->actor.focus.pos.y - this->actor.world.pos.y)) + 5;
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
}
diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c
index f556bb8db..9b8bb3778 100644
--- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c
+++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c
@@ -1357,9 +1357,9 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) {
if (!func_80B85858(this, play) && !func_80B85A00(this, play, false)) {
temp_v0 = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y;
if (temp_v0 > 0) {
- var_a2 = (s16)(temp_v0 * 0.25f) + 0x7D0;
+ var_a2 = TRUNCF_BINANG(temp_v0 * 0.25f) + 0x7D0;
} else {
- var_a2 = (s16)(temp_v0 * 0.25f) - 0x7D0;
+ var_a2 = TRUNCF_BINANG(temp_v0 * 0.25f) - 0x7D0;
}
this->picto.actor.shape.rot.y += var_a2;
this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y;
diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.c b/src/overlays/actors/ovl_En_Kame/z_en_kame.c
index 1167cb88b..1fd1db928 100644
--- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c
+++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c
@@ -714,7 +714,7 @@ void EnKame_Dead(EnKame* this, PlayState* play) {
}
this->actor.shape.rot.x += Rand_S16Offset(0x700, 0x1400);
- this->actor.shape.rot.y += (s16)Rand_ZeroFloat(5120.0f);
+ this->actor.shape.rot.y += TRUNCF_BINANG(Rand_ZeroFloat(0x1400));
this->actor.shape.rot.z += Rand_S16Offset(0x700, 0x1400);
}
}
diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c
index d73c3727b..e4f43bad4 100644
--- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c
+++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c
@@ -535,7 +535,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
this->actor.velocity.y = 0.0f;
} else {
this->actor.velocity.y *= -0.3f;
- this->actor.world.rot.y += (s16)(s32)Rand_CenteredFloat(0x4000);
+ this->actor.world.rot.y += TRUNCF_BINANG(Rand_CenteredFloat(0x4000));
}
bounced = true;
} else {
diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c
index 75ff9c0ec..1de2f9f4b 100644
--- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c
+++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c
@@ -321,7 +321,7 @@ void EnLookNuts_Update(Actor* thisx, PlayState* play) {
this->eyeState++;
if (this->eyeState >= 3) {
this->eyeState = 0;
- this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
+ this->blinkTimer = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 20;
}
}
this->actionFunc(this, play);
@@ -339,9 +339,9 @@ void EnLookNuts_Update(Actor* thisx, PlayState* play) {
Vec3f effectVelocity;
Math_Vec3f_Copy(&effectPos, &this->actor.world.pos);
- effectPos.x += Math_SinS(this->actor.world.rot.y + (s16)this->headRot.y) * 10.0f;
+ effectPos.x += Math_SinS(this->actor.world.rot.y + TRUNCF_BINANG(this->headRot.y)) * 10.0f;
effectPos.y += 30.0f;
- effectPos.z += Math_CosS(this->actor.world.rot.y + (s16)this->headRot.y) * 10.0f;
+ effectPos.z += Math_CosS(this->actor.world.rot.y + TRUNCF_BINANG(this->headRot.y)) * 10.0f;
Matrix_Push();
Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW);
effectVelocityOffset.z = 20.0f;
diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c
index 92ed94364..033ca9192 100644
--- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c
+++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c
@@ -344,8 +344,8 @@ void EnMinifrog_SetupNextFrogInit(EnMinifrog* this, PlayState* play) {
if (nextFrog != NULL) {
missingFrog = nextFrog->frog;
if (nextFrog->frog != NULL) {
- this->actor.home.rot.y =
- (s16)Actor_WorldYawTowardActor(&this->actor, &missingFrog->actor); // Set home to missing frog
+ // Set home to missing frog
+ this->actor.home.rot.y = Actor_WorldYawTowardActor(&this->actor, &missingFrog->actor);
EnMinifrog_TurnToMissingFrog(this);
} else {
EnMinifrog_TurnToPlayer(this);
diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c
index 20afd77cc..1a6822745 100644
--- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c
+++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c
@@ -161,7 +161,7 @@ void func_80965DB4(EnMm* this, PlayState* play) {
direction = BINANG_ROT180(direction);
}
Math_ScaledStepToS(&this->actor.shape.rot.y, direction, this->actor.speed * 100.0f);
- this->unk_190 += (s16)(this->actor.speed * 800.0f);
+ this->unk_190 += TRUNCF_BINANG(this->actor.speed * 800.0f);
}
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c
index 6ffa29179..6f40ddb4d 100644
--- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c
+++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c
@@ -624,7 +624,7 @@ void func_80A69ADC(Actor* thisx) {
} else {
this->unk_366 = ((s32)Rand_Next() > 0) ? 2000 : -2000;
}
- this->unk_366 += (s16)(((Rand_ZeroOne() * (1.0f - this->unk_358)) - 0.5f) * 0x400);
+ this->unk_366 += TRUNCF_BINANG(((Rand_ZeroOne() * (1.0f - this->unk_358)) - 0.5f) * 0x400);
} else {
this->unk_360 = 0.0f;
this->unk_364 = -0x8000;
@@ -1033,7 +1033,7 @@ void func_80A6AE7C(EnMushi2* this, PlayState* play) {
this->actor.shape.rot.y += 0xC8;
this->actor.speed += (Rand_ZeroOne() - 0.5f) * 0.16f;
this->actor.speed *= 0.9f;
- this->actor.world.rot.y += (s16)((Rand_ZeroOne() - 0.5f) * 2000.0f);
+ this->actor.world.rot.y += TRUNCF_BINANG((Rand_ZeroOne() - 0.5f) * 2000.0f);
this->actor.gravity = -0.04f - (Rand_ZeroOne() * 0.02f);
this->actor.velocity.y *= 0.95f;
Actor_MoveWithGravity(&this->actor);
diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c
index 04a76a05d..469f3b4ff 100644
--- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c
+++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c
@@ -325,7 +325,7 @@ s32 func_80BC01DC(Actor* thisx, PlayState* play) {
case ENNB_BEHAVIOUR_2:
// Slowly increase alpha to fill the screen with a black rectangle
- R_PLAY_FILL_SCREEN_ALPHA = (s16)(s32)(255.0f - (((f32)ABS_ALT(20 - this->storyTimer) / 20.0f) * 255.0f));
+ R_PLAY_FILL_SCREEN_ALPHA = TRUNCF_BINANG(255.0f - (((f32)ABS_ALT(20 - this->storyTimer) / 20.0f) * 255.0f));
if (this->storyTimer == 20) {
if (CHECK_EVENTINF(EVENTINF_42)) {
diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c
index a88945a1d..356a92c29 100644
--- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c
+++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c
@@ -721,8 +721,8 @@ s32 EnNeoReeba_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec
EnNeoReeba* this = THIS;
if ((limbIndex == OBJECT_RB_LIMB_03) && (this->rotationSpeed != 0.0f)) {
- rot->y += (s16)(this->rotationSpeed * Math_SinS(this->rotationAngle));
- rot->z += (s16)(this->rotationSpeed * Math_CosS(this->rotationAngle));
+ rot->y += TRUNCF_BINANG(this->rotationSpeed * Math_SinS(this->rotationAngle));
+ rot->z += TRUNCF_BINANG(this->rotationSpeed * Math_CosS(this->rotationAngle));
}
return false;
diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c
index 2d2b4e4b9..970840eaa 100644
--- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c
+++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c
@@ -434,9 +434,9 @@ void EnNiw_Held(EnNiw* this, PlayState* play) {
this->heldTimer = (s32)(Rand_ZeroFloat(1.0f) * 10.0f) + 10;
}
- this->actor.shape.rot.x = (s16)(s32)Rand_CenteredFloat(0x1388) + this->actor.world.rot.x;
- this->actor.shape.rot.y = (s16)(s32)Rand_CenteredFloat(0x1388) + this->actor.world.rot.y;
- this->actor.shape.rot.z = (s16)(s32)Rand_CenteredFloat(0x1388) + this->actor.world.rot.z;
+ this->actor.shape.rot.x = TRUNCF_BINANG(Rand_CenteredFloat(0x1388)) + this->actor.world.rot.x;
+ this->actor.shape.rot.y = TRUNCF_BINANG(Rand_CenteredFloat(0x1388)) + this->actor.world.rot.y;
+ this->actor.shape.rot.z = TRUNCF_BINANG(Rand_CenteredFloat(0x1388)) + this->actor.world.rot.z;
if (this->niwType == NIW_TYPE_REGULAR) {
if (Actor_HasNoParent(&this->actor, play)) {
this->actor.shape.rot.z = 0;
@@ -908,20 +908,20 @@ s32 EnNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
EnNiw* this = THIS;
if (limbIndex == NIW_LIMB_UPPER_BODY) {
- rot->y += (s16)this->upperBodyRotY;
+ rot->y += TRUNCF_BINANG(this->upperBodyRotY);
}
if (limbIndex == NIW_LIMB_HEAD) {
- rot->y += (s16)this->headRotY;
+ rot->y += TRUNCF_BINANG(this->headRotY);
}
if (limbIndex == NIW_LIMB_RIGHT_WING_ROOT) {
- rot->x += (s16)this->rightWingRotX;
- rot->y += (s16)this->rightWingRotY;
- rot->z += (s16)this->rightWingRotZ;
+ rot->x += TRUNCF_BINANG(this->rightWingRotX);
+ rot->y += TRUNCF_BINANG(this->rightWingRotY);
+ rot->z += TRUNCF_BINANG(this->rightWingRotZ);
}
if (limbIndex == NIW_LIMB_LEFT_WING_ROOT) {
- rot->x += (s16)this->leftWingRotX;
- rot->y += (s16)this->leftWingRotY;
- rot->z += (s16)this->leftWingRotZ;
+ rot->x += TRUNCF_BINANG(this->leftWingRotX);
+ rot->y += TRUNCF_BINANG(this->leftWingRotY);
+ rot->z += TRUNCF_BINANG(this->leftWingRotZ);
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c
index 159c51061..dfb83f4ca 100644
--- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c
+++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c
@@ -179,7 +179,7 @@ void EnNwc_ChangeState(EnNwc* this, s16 newState) {
case NWC_STATE_TURNING:
this->stateTimer = Rand_ZeroFloat(20.0f) + 15.0f;
this->actionFunc = EnNwc_Turn;
- this->fallingRotY = (s16)(s32)Rand_CenteredFloat(0x10000);
+ this->fallingRotY = TRUNCF_BINANG(Rand_CenteredFloat(0x10000));
break;
case NWC_STATE_HOPPING_FORWARD:
@@ -190,7 +190,7 @@ void EnNwc_ChangeState(EnNwc* this, s16 newState) {
case NWC_STATE_FOLLOWING:
this->actionFunc = EnNwc_Follow;
this->transformTimer = 0;
- this->randomRot = (s16)(s32)Rand_CenteredFloat(0x2710);
+ this->randomRot = TRUNCF_BINANG(Rand_CenteredFloat(0x2710));
break;
case NWC_STATE_RUNNING:
@@ -305,7 +305,7 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) {
if ((this->grog->actor.home.rot.z >= 20) && // all 10 chicks have been found
!(this->hasGrownUp & 1)) {
this->transformTimer += 2;
- if (this->transformTimer >= (s32)(s16)((this->actor.home.rot.z * 0x1E) + 0x1E)) {
+ if (this->transformTimer >= (s16)((this->actor.home.rot.z * 0x1E) + 0x1E)) {
// it is our turn to transform
this->hasGrownUp |= 1;
this->grog->actor.home.rot.x += 2; // increment grog's adult tranformation counter
@@ -328,7 +328,7 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) {
}
} else { // not too close: keep moving
- this->randomRot += (s16)(s32)Rand_CenteredFloat(0x5DC);
+ this->randomRot += TRUNCF_BINANG(Rand_CenteredFloat(0x5DC));
if (this->randomRot > 0x1388) {
this->randomRot = 0x1388;
} else if (this->randomRot < -0x1388) {
diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
index 6694cef89..b4c5401ac 100644
--- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
+++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
@@ -1745,8 +1745,8 @@ void EnOssan_CuriosityShopMan_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx**
if ((limbIndex == FSN_LIMB_PELVIS) || (limbIndex == FSN_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == FSN_LIMB_RIGHT_UPPER_ARM)) {
- rot->y += (s16)Math_SinS(this->fidgetTableY[limbIndex]) * 200;
- rot->z += (s16)Math_CosS(this->fidgetTableZ[limbIndex]) * 200;
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[limbIndex])) * 200;
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[limbIndex])) * 200;
}
}
diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c
index a786f9179..964633344 100644
--- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c
+++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c
@@ -1145,13 +1145,13 @@ s32 EnOwl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
case OWL_FLYING_LIMB_RIGHT_EYEBROW: // OWL_PERCHING_LIMB_RIGHT_EYEBROW
if (!(this->actionFlags & 8)) {
- rot->y -= (s16)(this->unk_3D8 * 1.5f);
+ rot->y -= TRUNCF_BINANG(this->unk_3D8 * 1.5f);
}
break;
case OWL_FLYING_LIMB_LEFT_EYEBROW: // OWL_PERCHING_LIMB_LEFT_EYEBROW
if (!(this->actionFlags & 8)) {
- rot->y += (s16)(this->unk_3D8 * 1.5f);
+ rot->y += TRUNCF_BINANG(this->unk_3D8 * 1.5f);
}
break;
diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c
index 44736ce56..851a46369 100644
--- a/src/overlays/actors/ovl_En_Part/z_en_part.c
+++ b/src/overlays/actors/ovl_En_Part/z_en_part.c
@@ -43,7 +43,7 @@ void func_80865390(EnPart* this, PlayState* play) {
switch (this->actor.params) {
case ENPART_TYPE_1:
case ENPART_TYPE_4:
- this->unk146 += (s16)(Rand_ZeroOne() * 17.0f) + 5;
+ this->unk146 += TRUNCF_BINANG(Rand_ZeroOne() * 17.0f) + 5;
this->actor.velocity.y = Rand_ZeroOne() * 5.0f + 4.0f;
this->actor.gravity = -0.6f - (Rand_ZeroOne() * 0.5f);
this->unk14C = 0.15f;
diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c
index eee28d163..c56a752e0 100644
--- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c
+++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c
@@ -774,7 +774,7 @@ void EnPeehat_Update(Actor* thisx, PlayState* play2) {
}
Collider_UpdateCylinder(thisx, &this->colliderCylinder);
- this->colliderCylinder.dim.pos.y += (s16)(thisx->shape.yOffset * thisx->scale.y);
+ this->colliderCylinder.dim.pos.y += TRUNCF_BINANG(thisx->shape.yOffset * thisx->scale.y);
if (this->colliderCylinder.base.ocFlags1 & OC1_ON) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base);
}
diff --git a/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c b/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c
index c668b054c..7d392aed8 100644
--- a/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c
+++ b/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c
@@ -735,9 +735,9 @@ void EnPoComposer_Draw(Actor* thisx, PlayState* play) {
Matrix_Put(&play->billboardMtxF);
Matrix_MultVecZ(15.0f, &lightOffset);
lightPos = this->lanternCollider.elements[0].dim.worldSphere.center;
- lightPos.x += (s16)lightOffset.x;
- lightPos.y += (s16)lightOffset.y;
- lightPos.z += (s16)lightOffset.z;
+ lightPos.x += TRUNCF_BINANG(lightOffset.x);
+ lightPos.y += TRUNCF_BINANG(lightOffset.y);
+ lightPos.z += TRUNCF_BINANG(lightOffset.z);
Lights_PointGlowSetInfo(&this->lightInfo, lightPos.x, lightPos.y, lightPos.z, this->envColor.r, this->envColor.g,
this->envColor.b, this->envColor.a * (200.0f / 255.0f));
diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c
index 134cd9066..dc1880db5 100644
--- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c
+++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c
@@ -301,8 +301,8 @@ s32 EnPoFusen_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3
} else if (limbIndex == POE_BALLOON_LEFT_HAND) {
rot->z += this->limbRotLeftHand;
} else if (limbIndex == POE_BALLOON_LIMB_CHAIN_AND_LANTERN) {
- rot->y += (s16)(this->limbRotChainAndLantern * Math_SinS(this->randBaseRotChange));
- rot->z += (s16)(this->limbRotChainAndLantern * Math_CosS(this->randBaseRotChange));
+ rot->y += TRUNCF_BINANG(this->limbRotChainAndLantern * Math_SinS(this->randBaseRotChange));
+ rot->z += TRUNCF_BINANG(this->limbRotChainAndLantern * Math_CosS(this->randBaseRotChange));
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c
index ca8cc4dee..686e90c92 100644
--- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c
+++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c
@@ -498,7 +498,7 @@ void EnPoSisters_SetupAttackConnect(EnPoSisters* this) {
void EnPoSisters_AttackConnectDrift(EnPoSisters* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
- this->actor.shape.rot.y -= (s16)(this->actor.speed * 10.0f * 128.0f);
+ this->actor.shape.rot.y -= TRUNCF_BINANG(this->actor.speed * 10.0f * 128.0f);
if (Math_StepToF(&this->actor.speed, 0.0f, 0.1f)) { // wait to stop moving
this->actor.world.rot.y = this->actor.shape.rot.y;
@@ -823,8 +823,8 @@ void EnPoSisters_MegSurroundPlayer(EnPoSisters* this, PlayState* play) {
if (this->megCloneId == POE_SISTERS_MEG_REAL) {
if (ABS_ALT(16 - this->floatingBobbingTimer) < 14) {
// Every N frames rotate around player. The fewer Meg clones remaining the faster they spin.
- this->actor.shape.rot.y += (s16)((0x580 - (this->megClonesRemaining * 0x180)) *
- fabsf(Math_SinS(this->floatingBobbingTimer * 0x800)));
+ this->actor.shape.rot.y += TRUNCF_BINANG((0x580 - (this->megClonesRemaining * 0x180)) *
+ fabsf(Math_SinS(this->floatingBobbingTimer * 0x800)));
}
// Twirl the real Meg backwards for a bit for a visual tell to player.
diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.c b/src/overlays/actors/ovl_En_Pp/z_en_pp.c
index fee468c42..d51ca9f42 100644
--- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c
+++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c
@@ -1481,9 +1481,9 @@ s32 EnPp_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
}
if (limbIndex == HIPLOOP_LIMB_MASK) {
- rot->x += (s16)this->maskRot.x;
- rot->y += (s16)this->maskRot.y;
- rot->z += (s16)this->maskRot.z;
+ rot->x += TRUNCF_BINANG(this->maskRot.x);
+ rot->y += TRUNCF_BINANG(this->maskRot.y);
+ rot->z += TRUNCF_BINANG(this->maskRot.z);
pos->x += this->maskPos.x;
pos->y += this->maskPos.y;
pos->z += this->maskPos.z;
diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c
index 8eb362aaa..07f597773 100644
--- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c
+++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c
@@ -716,7 +716,7 @@ s32 EnPr2_OverrideLimbDrawOpa(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f
if (this->unk_1E0 < 10) {
if (limbIndex == OBJECT_PR_2_LIMB_02) {
- rot->y += (s16)this->unk_1FC * -1;
+ rot->y += TRUNCF_BINANG(this->unk_1FC) * -1;
}
} else if ((limbIndex + 10) != this->unk_1E0) {
*dList = NULL;
@@ -742,7 +742,7 @@ s32 EnPr2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
if (this->unk_1E0 < 10) {
if (limbIndex == OBJECT_PR_2_LIMB_02) {
- rot->y += (s16)this->unk_1FC * -1;
+ rot->y += TRUNCF_BINANG(this->unk_1FC) * -1;
}
} else if ((limbIndex + 10) != this->unk_1E0) {
*dList = NULL;
diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.c b/src/overlays/actors/ovl_En_Prz/z_en_prz.c
index 38cf4bd3f..5f5182360 100644
--- a/src/overlays/actors/ovl_En_Prz/z_en_prz.c
+++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.c
@@ -306,7 +306,7 @@ void func_80A76634(EnPrz* this, PlayState* play) {
if (ABS_ALT(BINANG_SUB(this->actor.world.rot.y, this->unk_1E4)) < 0x100) {
if (func_80A762C0(this, play) != 0) {
this->unk_1E4 += 0x1500;
- this->unk_1E4 += (s16)Rand_ZeroFloat(5000.0f);
+ this->unk_1E4 += TRUNCF_BINANG(Rand_ZeroFloat(5000.0f));
} else if ((player->stateFlags1 & PLAYER_STATE1_8000000) && (player->actor.floorHeight < 30.0f)) {
this->actionFunc = func_80A763E8;
} else {
@@ -502,7 +502,7 @@ s32 EnPrz_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
EnPrz* this = THIS;
if (limbIndex == OBJECT_PR_2_LIMB_02) {
- rot->y += (s16)this->unk_218 * -100;
+ rot->y += TRUNCF_BINANG(this->unk_218) * -100;
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c
index 1301215db..c2a3622b1 100644
--- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c
+++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c
@@ -344,7 +344,7 @@ void EnRacedog_Init(Actor* thisx, PlayState* play) {
// meaning that the IDs are just whatever their default values in sDogInfo are. As a result,
// the blue dog, one beige dog, one white dog, one brown dog, and two gray dogs never bother
// to do the random 1/20 check here, regardless of anything else.
- if ((sDogInfo[this->index].textId > 0x353E) && (this->index == (s16)Rand_ZeroFloat(20.0f))) {
+ if ((sDogInfo[this->index].textId > 0x353E) && (this->index == TRUNCF_BINANG(Rand_ZeroFloat(20.0f)))) {
this->extraTimeBeforeRaceStart = 5;
} else {
this->extraTimeBeforeRaceStart = 0;
diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c
index 90b23d53e..c72abdcf9 100644
--- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c
+++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c
@@ -820,7 +820,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) {
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_MIDDLE_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_MIDDLE_SEGMENT)) {
for (i = 0; i < ARRAY_COUNT(sGrabAnimationCheckFrames); i++) {
- if ((s16)this->skelAnime.curFrame == sGrabAnimationCheckFrames[i]) {
+ if (TRUNCF_BINANG(this->skelAnime.curFrame) == sGrabAnimationCheckFrames[i]) {
Math_Vec3f_Copy(&this->targetLimbScale[limbIndex], &sMiddleSegmentTargetScaleDuringGrab[i]);
}
}
@@ -830,7 +830,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) {
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_UPPER_SEGMENT)) {
for (i = 0; i < ARRAY_COUNT(sGrabAnimationCheckFrames); i++) {
- if ((s16)this->skelAnime.curFrame == sGrabAnimationCheckFrames[i]) {
+ if (TRUNCF_BINANG(this->skelAnime.curFrame) == sGrabAnimationCheckFrames[i]) {
Math_Vec3f_Copy(&this->targetLimbScale[limbIndex], &sUpperSegmentTargetScaleDuringGrab[i]);
}
}
@@ -866,7 +866,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) {
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_MIDDLE_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_MIDDLE_SEGMENT)) {
for (i = 0; i < ARRAY_COUNT(sSpitAnimationCheckFrames); i++) {
- if ((s16)this->skelAnime.curFrame == sSpitAnimationCheckFrames[i]) {
+ if (TRUNCF_BINANG(this->skelAnime.curFrame) == sSpitAnimationCheckFrames[i]) {
Math_Vec3f_Copy(&this->targetLimbScale[limbIndex], &sMiddleSegmentTargetScaleDuringSpit[i]);
}
}
@@ -876,7 +876,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) {
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_UPPER_SEGMENT)) {
for (i = 0; i < 4; i++) {
- if ((s16)this->skelAnime.curFrame == sSpitAnimationCheckFrames[i]) {
+ if (TRUNCF_BINANG(this->skelAnime.curFrame) == sSpitAnimationCheckFrames[i]) {
Math_Vec3f_Copy(&this->targetLimbScale[limbIndex], &sUpperSegmentTargetScaleDuringSpit[i]);
}
}
diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c
index 87136e51b..e56ff4561 100644
--- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c
+++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c
@@ -700,8 +700,8 @@ void EnRailgibud_SpawnDust(PlayState* play, Vec3f* basePos, f32 randomnessScale,
dustVelocity.x *= 0.5f;
dustVelocity.z *= 0.5f;
- func_800B1210(play, &dustPos, &dustVelocity, &dustAccel, (s16)(Rand_ZeroOne() * dustScale * 0.2f) + dustScale,
- scaleStep);
+ func_800B1210(play, &dustPos, &dustVelocity, &dustAccel,
+ TRUNCF_BINANG(Rand_ZeroOne() * dustScale * 0.2f) + dustScale, scaleStep);
}
}
diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c
index 25750399c..8b7f3230a 100644
--- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c
+++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c
@@ -335,9 +335,9 @@ void EnRat_ChooseDirection(EnRat* this) {
angle -= 0x8000;
}
- angle += (s16)(s32)Rand_CenteredFloat(0x800);
+ angle += TRUNCF_BINANG(Rand_CenteredFloat(0x800));
} else {
- angle = (Rand_ZeroOne() < 0.1f) ? (s16)(s32)Rand_CenteredFloat(0x800) : 0;
+ angle = (Rand_ZeroOne() < 0.1f) ? TRUNCF_BINANG(Rand_CenteredFloat(0x800)) : 0;
}
}
diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c
index 8bf9663e4..9a1b4c851 100644
--- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c
+++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c
@@ -347,7 +347,7 @@ s32 func_80BF42BC(EnRg* this, f32 arg1) {
this->actor.shape.yOffset = this->actor.scale.y * 100.0f * 14.0f;
if (!(this->unk_310 & 0x1000)) {
- this->actor.shape.rot.x += (s16)(13650.0f * sp2C);
+ this->actor.shape.rot.x += TRUNCF_BINANG(0x3552 * sp2C);
}
this->actor.world.rot.x = this->actor.shape.rot.x;
@@ -851,8 +851,8 @@ s32 EnRg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
}
if ((this->unk_310 & 8) && (fidgetIndex < 9)) {
- rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
}
return false;
diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c
index 16fc48e69..187be59ee 100644
--- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c
+++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c
@@ -335,8 +335,8 @@ s32 EnRu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if ((limbIndex == RU2_LIMB_TORSO) || (limbIndex == RU2_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == RU2_LIMB_RIGHT_UPPER_ARM)) {
- rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
}
return false;
diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
index a34d57308..5f827a7de 100644
--- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
+++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
@@ -739,7 +739,7 @@ void EnSob1_EndWalk(EnSob1* this, PlayState* play) {
s32 pad;
f32 distSq;
s16 curFrame = this->skelAnime.curFrame / this->skelAnime.playSpeed;
- s16 animLastFrame = Animation_GetLastFrame(&gBombShopkeeperWalkAnim) / (s16)this->skelAnime.playSpeed;
+ s16 animLastFrame = Animation_GetLastFrame(&gBombShopkeeperWalkAnim) / TRUNCF_BINANG(this->skelAnime.playSpeed);
Math_SmoothStepToS(&this->actor.world.rot.y,
EnSob1_GetDistSqAndOrient(this->path, this->waypoint - 1, &this->actor.world.pos, &distSq), 4,
diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
index af407d897..22a4c6cb9 100644
--- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
+++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
@@ -310,7 +310,7 @@ void EnSsh_Turn(EnSsh* this, PlayState* play) {
}
if (DECR(this->spinTimer) != 0) {
- this->actor.world.rot.y += (s16)(0x2710 * (this->spinTimer / 30.0f));
+ this->actor.world.rot.y += TRUNCF_BINANG(0x2710 * (this->spinTimer / 30.0f));
} else if ((this->swayTimer == 0) && (this->stunTimer == 0)) {
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 4, 0x2710, 1);
}
diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c
index 3c8bfd054..5096f07d5 100644
--- a/src/overlays/actors/ovl_En_St/z_en_st.c
+++ b/src/overlays/actors/ovl_En_St/z_en_st.c
@@ -272,7 +272,7 @@ void func_808A54B0(EnSt* this, PlayState* play) {
s32 func_808A576C(EnSt* this) {
s32 i;
- s16 phi_s2 = (s16)((s16)(Rand_ZeroOne() * 1000.0f) % 12) * 0x1555;
+ s16 phi_s2 = (s16)(TRUNCF_BINANG(Rand_ZeroOne() * 1000.0f) % 12) * 0x1555;
for (i = 0; i < ENST_BODYPART_MAX; i++, phi_s2 += 0x1555) {
if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) {
diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c
index 1ac8d5b42..593be5b87 100644
--- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c
+++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c
@@ -708,8 +708,8 @@ s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
if ((limbIndex == STH_LIMB_CHEST) || (limbIndex == STH_LIMB_LEFT_FOREARM) ||
(limbIndex == STH_LIMB_RIGHT_FOREARM)) {
- rot->y += (s16)(Math_SinS(play->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f);
- rot->z += (s16)(Math_CosS(play->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(play->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(play->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f);
}
return false;
diff --git a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c
index 232dffc5c..3fc031889 100644
--- a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c
+++ b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c
@@ -85,8 +85,8 @@ s32 EnSth2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
}
if ((limbIndex == STH_LIMB_CHEST) || (limbIndex == STH_LIMB_LEFT_FOREARM) ||
(limbIndex == STH_LIMB_RIGHT_FOREARM)) {
- rot->y += (s16)(Math_SinS(play->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f);
- rot->z += (s16)(Math_CosS(play->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(play->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(play->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f);
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c
index bce4fd941..5dee82775 100644
--- a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c
+++ b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c
@@ -364,7 +364,7 @@ void func_80AE7F34(EnStopheishi* this, PlayState* play) {
f32 zDiff;
SkelAnime_Update(&this->skelAnime);
- if ((this->currentAnim == SOLDIER_ANIM_5) && (((s16)this->skelAnime.curFrame % 2) != 0)) {
+ if ((this->currentAnim == SOLDIER_ANIM_5) && ((TRUNCF_BINANG(this->skelAnime.curFrame) % 2) != 0)) {
Actor_PlaySfx(&this->actor, NA_SE_EV_SOLDIER_WALK);
}
if (gSaveContext.save.day != 3) {
diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c
index 6ddcf13a0..f01f8b045 100644
--- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c
+++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c
@@ -1577,8 +1577,8 @@ s32 EnSuttari_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3
Matrix_RotateZS(-this->torsoRot.x, MTXMODE_APPLY);
}
if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 0xC)) {
- rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c
index ca4d53a9f..49e6fe3e8 100644
--- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c
+++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c
@@ -756,7 +756,7 @@ void func_808DA3F4(EnSw* this, PlayState* play) {
if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
temp_f16 = this->skelAnime.endFrame - this->skelAnime.curFrame;
- temp_s1 = (s16)(80.0f * temp_f16);
+ temp_s1 = TRUNCF_BINANG(80.0f * temp_f16);
Math_Vec3f_Copy(&sp38, &this->unk_374);
func_808D9894(this, &sp38);
diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c
index fa68d1072..80008f37c 100644
--- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c
+++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c
@@ -292,9 +292,9 @@ s32 EnSyatekiCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList,
EnSyatekiCrow* this = THIS;
if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) {
- rot->y += (s16)(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4)));
+ rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4)));
} else if (limbIndex == OBJECT_CROW_LIMB_TAIL) {
- rot->y += (s16)(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4)));
+ rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4)));
}
return false;
diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c
index c401c4b4c..6c0728123 100644
--- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c
+++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c
@@ -254,7 +254,7 @@ void func_80BB6BD8(EnTanron2* this, PlayState* play) {
case 2:
sp32 = Math_Atan2S(player->actor.world.pos.x - this->actor.world.pos.x,
player->actor.world.pos.z - this->actor.world.pos.z) +
- (s16)Rand_ZeroFloat(20000.0f);
+ TRUNCF_BINANG(Rand_ZeroFloat(20000.0f));
this->actor.speed = Rand_ZeroFloat(7.0f) + 7.0f;
if ((this->unk_152 == 0) && (D_80BB8450->unk_1F6 == 0)) {
this->unk_158 = 1;
diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c
index f207a6352..9219d16a1 100644
--- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c
+++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c
@@ -297,17 +297,17 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) {
this->actor.speed = Rand_ZeroFloat(2.0f) + 2.0f;
if (Rand_ZeroOne() < 0.5f) {
this->targetShapeRotation.x =
- (s16)(s32)Rand_CenteredFloat(0x1F4) + this->targetShapeRotation.x + 0x8000;
+ TRUNCF_BINANG(Rand_CenteredFloat(0x1F4)) + this->targetShapeRotation.x + 0x8000;
}
if (Rand_ZeroOne() < 0.5f) {
this->targetShapeRotation.z =
- (s16)(s32)Rand_CenteredFloat(0x1F4) + this->targetShapeRotation.z + 0x8000;
+ TRUNCF_BINANG(Rand_CenteredFloat(0x1F4)) + this->targetShapeRotation.z + 0x8000;
}
if (Rand_ZeroOne() < 0.5f) {
- this->targetShapeRotation.y = (s16)Rand_ZeroFloat(0x10000);
+ this->targetShapeRotation.y = TRUNCF_BINANG(Rand_ZeroFloat(0x10000));
}
this->actor.world.rot.y = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x) +
- (s16)(s32)Rand_CenteredFloat(0xCE20);
+ TRUNCF_BINANG(Rand_CenteredFloat(0xCE20));
}
Math_ApproachS(&this->actor.shape.rot.y, this->targetShapeRotation.y, 3, 0x500);
diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c
index 239af56c6..5c3b8ca90 100644
--- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c
+++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c
@@ -1219,8 +1219,8 @@ void EnTest6_DrawThreeDayResetSoTCutscene(EnTest6* this, PlayState* play) {
// The `& 0x3C` ensures the angle only updates once every 4 frames
angle = (play->state.frames & 0x3C) * 1024;
angle *= this->clockSpeed / 200.0f;
- this->clockAngle += (s16)this->clockSpeed;
- this->clockRingRotZ = (s16)((this->clockSpeed / 200.0f) * 256.0f);
+ this->clockAngle += TRUNCF_BINANG(this->clockSpeed);
+ this->clockRingRotZ = TRUNCF_BINANG((this->clockSpeed / 200.0f) * 256.0f);
// Draw 2 clocks per loop
for (i = 0; i < (SOTCS_RESET_NUM_CLOCKS / 2); i++) {
@@ -1284,7 +1284,7 @@ void EnTest6_DrawDoubleSoTCutscene(EnTest6* this, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
this->gfx = POLY_OPA_DISP;
- this->clockAngle += (s16)this->clockSpeed;
+ this->clockAngle += TRUNCF_BINANG(this->clockSpeed);
this->clockRingRotZ = this->clockAngle * 2;
// The `& 0x3C` ensures the clock only turns once every 4 frames.
diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c
index efcd9e08e..81b7090c7 100644
--- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c
+++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c
@@ -1005,7 +1005,7 @@ void func_80C12D00(EnThiefbird* this) {
}
ptr->unk_20 = Math_SinS(ptr->unk_1C * 0x7D0) * 0x2000;
- ptr->unk_1E += (s16)(0x666 * fabsf(Math_SinS(ptr->unk_1C * 0xBB8)) * phi_f20);
+ ptr->unk_1E += TRUNCF_BINANG(0x666 * fabsf(Math_SinS(ptr->unk_1C * 0xBB8)) * phi_f20);
}
}
}
diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c
index ad6f8ed06..711e5a039 100644
--- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c
+++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c
@@ -803,7 +803,7 @@ void func_80895738(EnTite* this, PlayState* play) {
func_80893A9C(this, play);
}
}
- this->actor.shape.rot.y += (s16)(this->actor.speed * 768.0f);
+ this->actor.shape.rot.y += TRUNCF_BINANG(this->actor.speed * 768.0f);
}
void func_8089595C(EnTite* this, PlayState* play) {
diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c
index 3092bc046..eda9fd196 100644
--- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c
+++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c
@@ -878,7 +878,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) {
void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
s16 curFrame = this->skelAnime.curFrame / this->skelAnime.playSpeed;
- s16 animLastFrame = Animation_GetLastFrame(&gKotakeWakeUpAnim) / (s16)this->skelAnime.playSpeed;
+ s16 animLastFrame = Animation_GetLastFrame(&gKotakeWakeUpAnim) / TRUNCF_BINANG(this->skelAnime.playSpeed);
if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) {
if (CutsceneManager_IsNext(this->csId)) {
diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c
index 8d1435f8d..ab75e06d2 100644
--- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c
+++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c
@@ -891,8 +891,8 @@ s32 EnTrt2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if ((limbIndex == KOTAKE_LIMB_TORSO_LIMB) || (limbIndex == KOTAKE_LIMB_LEFT_HAND) ||
(limbIndex == KOTAKE_LIMB_RIGHT_HAND)) {
- rot->y += (s16)Math_SinS(this->unk_33C[limbIndex]) * 200;
- rot->z += (s16)Math_CosS(this->unk_372[limbIndex]) * 200;
+ rot->y += TRUNCF_BINANG(Math_SinS(this->unk_33C[limbIndex])) * 200;
+ rot->z += TRUNCF_BINANG(Math_CosS(this->unk_372[limbIndex])) * 200;
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c
index d6dd30c07..54d717ba9 100644
--- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c
+++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c
@@ -186,7 +186,7 @@ void func_80AC0D2C(EnTwig* this, PlayState* play) {
0.01f);
Math_SmoothStepToF(&this->dyna.actor.world.pos.z, player->bodyPartsPos[PLAYER_BODYPART_WAIST].z, 0.5f, 100.0f,
0.01f);
- this->dyna.actor.shape.rot.z += (s16)this->unk_170;
+ this->dyna.actor.shape.rot.z += TRUNCF_BINANG(this->unk_170);
this->dyna.actor.scale.x -= this->unk_174;
if (this->dyna.actor.scale.x < 0.0f) {
Actor_SetScale(&this->dyna.actor, 0.0f);
diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c
index 098f9c54c..929f57145 100644
--- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c
+++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c
@@ -847,7 +847,7 @@ void func_80991C80(EnWf* this, PlayState* play) {
(!Actor_IsFacingPlayer(&this->actor, 0x2000) || (this->actor.xzDistToPlayer >= 100.0f))) ||
SkelAnime_Update(&this->skelAnime)) {
if ((sp2C == 0) && (this->unk_2A0 != 0)) {
- this->actor.shape.rot.y += (s16)(0xCCC * (1.5f + ((this->unk_2A0 - 4) * 0.4f)));
+ this->actor.shape.rot.y += TRUNCF_BINANG(0xCCC * (1.5f + ((this->unk_2A0 - 4) * 0.4f)));
func_80990C6C(this, play, 1);
this->unk_2A0--;
} else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (sp2C == 0)) {
diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c
index 94d8e7924..adc043d39 100644
--- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c
+++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c
@@ -592,6 +592,7 @@ void EnWiz_SelectPlatform(EnWiz* this, PlayState* play) {
curPlatformIndex = Rand_ZeroFloat(i);
while ((this->curPlatformIndex == curPlatformIndex) || ((s16)i == curPlatformIndex)) {
curPlatformIndex = Rand_ZeroFloat(i);
+ // FAKE:
if (1) {}
}
diff --git a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c
index a7056aac5..134dbeb51 100644
--- a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c
+++ b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c
@@ -113,7 +113,7 @@ void EnWizBrock_Draw(Actor* thisx, PlayState* play) {
} else {
Scene_SetRenderModeXlu(play, 1, 2);
gDPPipeSync(POLY_XLU_DISP++);
- gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, (s16)this->alpha);
+ gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, TRUNCF_BINANG(this->alpha));
Gfx_DrawDListXlu(play, gWizrobePlatformDL);
}
@@ -126,9 +126,9 @@ void EnWizBrock_Draw(Actor* thisx, PlayState* play) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255);
if (this->platformType == EN_WIZ_BROCK_PLATFORM_TYPE_FIRE) {
- gDPSetEnvColor(POLY_XLU_DISP++, 255, 00, 100, (s16)this->alpha);
+ gDPSetEnvColor(POLY_XLU_DISP++, 255, 00, 100, TRUNCF_BINANG(this->alpha));
} else {
- gDPSetEnvColor(POLY_XLU_DISP++, 50, 00, 255, (s16)this->alpha);
+ gDPSetEnvColor(POLY_XLU_DISP++, 50, 00, 255, TRUNCF_BINANG(this->alpha));
}
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
diff --git a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c
index 345c1e0ee..29d2a4a3e 100644
--- a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c
+++ b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c
@@ -223,7 +223,7 @@ void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play) {
this->increaseLowestUsedIndexTimer = 10;
Matrix_Push();
- Matrix_RotateYS((s16)(s32)Rand_CenteredFloat(0x100) + this->actor.world.rot.y, MTXMODE_NEW);
+ Matrix_RotateYS(TRUNCF_BINANG(Rand_CenteredFloat(0x100)) + this->actor.world.rot.y, MTXMODE_NEW);
velocity.z = Rand_CenteredFloat(2.0f) + 8.0f;
Matrix_MultVec3f(&velocity, &this->actor.velocity);
Matrix_Pop();
@@ -519,41 +519,47 @@ void EnWizFire_Update(Actor* thisx, PlayState* play2) {
}
play->envCtx.adjLightSettings.fogNear =
- (fogNear - (s16)play->envCtx.lightSettings.fogNear) * this->blendScaleFrac;
+ TRUNCF_BINANG((fogNear - play->envCtx.lightSettings.fogNear) * this->blendScaleFrac);
play->envCtx.adjLightSettings.ambientColor[0] =
- ((f32)sLightSettingsColors[index].r - play->envCtx.lightSettings.ambientColor[0]) *
- this->blendScaleFrac;
+ TRUNCF_BINANG(((f32)sLightSettingsColors[index].r - play->envCtx.lightSettings.ambientColor[0]) *
+ this->blendScaleFrac);
play->envCtx.adjLightSettings.ambientColor[1] =
- ((f32)sLightSettingsColors[index].g - play->envCtx.lightSettings.ambientColor[1]) *
- this->blendScaleFrac;
+ TRUNCF_BINANG(((f32)sLightSettingsColors[index].g - play->envCtx.lightSettings.ambientColor[1]) *
+ this->blendScaleFrac);
play->envCtx.adjLightSettings.ambientColor[2] =
- ((f32)sLightSettingsColors[index].b - play->envCtx.lightSettings.ambientColor[2]) *
- this->blendScaleFrac;
+ TRUNCF_BINANG(((f32)sLightSettingsColors[index].b - play->envCtx.lightSettings.ambientColor[2]) *
+ this->blendScaleFrac);
index++;
play->envCtx.adjLightSettings.light1Color[0] =
- ((f32)sLightSettingsColors[index].r - play->envCtx.lightSettings.light1Color[0]) * this->blendScaleFrac;
+ TRUNCF_BINANG(((f32)sLightSettingsColors[index].r - play->envCtx.lightSettings.light1Color[0]) *
+ this->blendScaleFrac);
play->envCtx.adjLightSettings.light1Color[1] =
- ((f32)sLightSettingsColors[index].g - play->envCtx.lightSettings.light1Color[1]) * this->blendScaleFrac;
+ TRUNCF_BINANG(((f32)sLightSettingsColors[index].g - play->envCtx.lightSettings.light1Color[1]) *
+ this->blendScaleFrac);
play->envCtx.adjLightSettings.light1Color[2] =
- ((f32)sLightSettingsColors[index].b - play->envCtx.lightSettings.light1Color[2]) * this->blendScaleFrac;
+ TRUNCF_BINANG(((f32)sLightSettingsColors[index].b - play->envCtx.lightSettings.light1Color[2]) *
+ this->blendScaleFrac);
index++;
play->envCtx.adjLightSettings.light2Color[0] =
- ((f32)sLightSettingsColors[index].r - play->envCtx.lightSettings.light2Color[0]) * this->blendScaleFrac;
+ TRUNCF_BINANG(((f32)sLightSettingsColors[index].r - play->envCtx.lightSettings.light2Color[0]) *
+ this->blendScaleFrac);
play->envCtx.adjLightSettings.light2Color[1] =
- ((f32)sLightSettingsColors[index].g - play->envCtx.lightSettings.light2Color[1]) * this->blendScaleFrac;
+ TRUNCF_BINANG(((f32)sLightSettingsColors[index].g - play->envCtx.lightSettings.light2Color[1]) *
+ this->blendScaleFrac);
play->envCtx.adjLightSettings.light2Color[2] =
- ((f32)sLightSettingsColors[index].b - play->envCtx.lightSettings.light2Color[2]) * this->blendScaleFrac;
+ TRUNCF_BINANG(((f32)sLightSettingsColors[index].b - play->envCtx.lightSettings.light2Color[2]) *
+ this->blendScaleFrac);
index++;
- play->envCtx.adjLightSettings.fogColor[0] =
- ((f32)sLightSettingsColors[index].r - play->envCtx.lightSettings.fogColor[0]) * this->blendScaleFrac;
- play->envCtx.adjLightSettings.fogColor[1] =
- ((f32)sLightSettingsColors[index].g - play->envCtx.lightSettings.fogColor[1]) * this->blendScaleFrac;
- play->envCtx.adjLightSettings.fogColor[2] =
- ((f32)sLightSettingsColors[index].b - play->envCtx.lightSettings.fogColor[2]) * this->blendScaleFrac;
+ play->envCtx.adjLightSettings.fogColor[0] = TRUNCF_BINANG(
+ ((f32)sLightSettingsColors[index].r - play->envCtx.lightSettings.fogColor[0]) * this->blendScaleFrac);
+ play->envCtx.adjLightSettings.fogColor[1] = TRUNCF_BINANG(
+ ((f32)sLightSettingsColors[index].g - play->envCtx.lightSettings.fogColor[1]) * this->blendScaleFrac);
+ play->envCtx.adjLightSettings.fogColor[2] = TRUNCF_BINANG(
+ ((f32)sLightSettingsColors[index].b - play->envCtx.lightSettings.fogColor[2]) * this->blendScaleFrac);
}
}
diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
index 953eded8e..7e5dd65b4 100644
--- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c
+++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
@@ -361,8 +361,8 @@ s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if ((limbIndex == ZORA_LIMB_TORSO) || (limbIndex == ZORA_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == ZORA_LIMB_RIGHT_UPPER_ARM)) {
- rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
}
return false;
}
diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c
index d87aeff40..9d42a3189 100644
--- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c
+++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c
@@ -226,7 +226,7 @@ void EnZod_UpdateInstruments(EnZod* this) {
for (i = 0; i < ARRAY_COUNT(this->cymbalRots); i++) {
this->cymbalRots[i] += this->cymbalRotVels[i];
- this->cymbalRotVels[i] -= (s16)(this->cymbalRots[i] * 0.1f);
+ this->cymbalRotVels[i] -= TRUNCF_BINANG(this->cymbalRots[i] * 0.1f);
if (ABS_ALT(this->cymbalRotVels[i]) > 100) {
this->cymbalRotVels[i] *= 0.9f;
diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c
index efc6ce176..154b17f82 100644
--- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c
+++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c
@@ -178,7 +178,7 @@ s32 func_80BBAF5C(EnZos* this, PlayState* play) {
s32 func_80BBAFFC(EnZos* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime)) {
- switch ((s16)Rand_ZeroFloat(4.0f)) {
+ switch (TRUNCF_BINANG(Rand_ZeroFloat(4.0f))) {
case 0:
EnZos_ChangeAnim(this, EN_ZOS_ANIM_PLAY_RIGHT, ANIMMODE_ONCE);
break;
diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c
index 87b45aa50..07a4d1f77 100644
--- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c
+++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c
@@ -1376,8 +1376,8 @@ s32 EnZot_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
if (((this->unk_2F0 == 8) || (this->unk_2F0 == 9)) &&
((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13))) {
- rot->y += (s16)(Math_SinS(play->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f);
- rot->z += (s16)(Math_CosS(play->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f);
+ rot->y += TRUNCF_BINANG(Math_SinS(play->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f);
+ rot->z += TRUNCF_BINANG(Math_CosS(play->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f);
}
return false;
}
diff --git a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c
index 8b0275f47..2a3e7d3fa 100644
--- a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c
+++ b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c
@@ -157,7 +157,7 @@ s32 func_80A356D8(ObjBell* this) {
scaleProjection = Math_SinS(this->unk_20C) * this->unk_21C;
this->dyna.actor.world.rot.x = this->dyna.actor.home.rot.x;
this->unk_220 = scaleProjection;
- this->dyna.actor.world.rot.x += (s16)scaleProjection;
+ this->dyna.actor.world.rot.x += TRUNCF_BINANG(scaleProjection);
Math_ApproachF(&this->unk_21C, 0.0f, 0.03f, 70.0f);
if (this->unk_21C > 0.0f) {
this->unk_20C -= 0x800;
diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c
index 1584634e6..f9fedda43 100644
--- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c
+++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c
@@ -205,8 +205,8 @@ void func_80AE9090(ObjBigicicle* this, PlayState* play) {
this->actor.flags |= ACTOR_FLAG_10;
this->actor.shape.yOffset = 2100.0f;
this->actor.world.pos.y -= temp_f0;
- this->collider1.dim.yShift += (s16)temp_f0;
- this->collider2.dim.yShift += (s16)temp_f0;
+ this->collider1.dim.yShift += TRUNCF_BINANG(temp_f0);
+ this->collider2.dim.yShift += TRUNCF_BINANG(temp_f0);
this->actionFunc = func_80AE9258;
} else {
this->unk_14A = 50;
diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c
index 67c42f57e..2c1f843fb 100644
--- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c
+++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c
@@ -633,7 +633,7 @@ void func_80A1CEF4(ObjFlowerpot* this, PlayState* play) {
Actor_MoveWithGravity(thisx);
if (!(this->unk_1EA & 2)) {
- D_80A1D3F8 += (s16)(thisx->shape.rot.x * -0.06f);
+ D_80A1D3F8 += TRUNCF_BINANG(thisx->shape.rot.x * -0.06f);
} else {
Math_StepToS(&D_80A1D3F8, 0, 80);
Math_StepToS(&D_80A1D3FC, 0, 20);
diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c
index c696a3c6b..5d0c7ede6 100644
--- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c
+++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c
@@ -258,13 +258,13 @@ void func_80A23938(ObjIceblock* this) {
}
Math_StepToF(&ptr->unk_1C, phi_f0, 0.04f);
- ptr->unk_22 += (s16)(ptr->unk_20 * -0.02f);
+ ptr->unk_22 += TRUNCF_BINANG(ptr->unk_20 * -0.02f);
ptr->unk_22 = func_80A23090(ptr->unk_22, 50, 800);
ptr->unk_20 += ptr->unk_22;
temp = ptr->unk_16 - ptr->unk_14;
- ptr->unk_18 += (s16)(temp * -0.04f * thisx->xzDistToPlayer * thisx->scale.x * (1.0f / 600.0f));
+ ptr->unk_18 += TRUNCF_BINANG(temp * -0.04f * thisx->xzDistToPlayer * thisx->scale.x * (1.0f / 600.0f));
ptr->unk_18 = func_80A23090(ptr->unk_18, 50, 800);
ptr->unk_16 += ptr->unk_18;
diff --git a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c
index b490af0b8..7f57c73c8 100644
--- a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c
+++ b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c
@@ -476,8 +476,8 @@ void ObjKendoKanban_UpdateCollision(ObjKendoKanban* this, PlayState* play) {
}
Collider_UpdateCylinder(&this->actor, &this->colliderCylinder);
- this->colliderCylinder.dim.pos.z -= (s16)(20.0f * Math_CosS(this->actor.shape.rot.y));
- this->colliderCylinder.dim.pos.x -= (s16)(20.0f * Math_SinS(this->actor.shape.rot.y));
+ this->colliderCylinder.dim.pos.z -= TRUNCF_BINANG(20.0f * Math_CosS(this->actor.shape.rot.y));
+ this->colliderCylinder.dim.pos.x -= TRUNCF_BINANG(20.0f * Math_SinS(this->actor.shape.rot.y));
if (this->actionFunc == ObjKendoKanban_DoNothing) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base);
diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c
index dc76b7fe1..84b341b6c 100644
--- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c
+++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c
@@ -350,7 +350,7 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) {
Actor_Kill(&this->dyna.actor);
}
- this->dyna.actor.shape.rot.x = -0x1F40 - (s16)(sp38 * 400.0f);
+ this->dyna.actor.shape.rot.x = -0x1F40 - TRUNCF_BINANG(sp38 * 400.0f);
}
}
}
diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c
index b1ac272b8..2abb3ead8 100644
--- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c
+++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c
@@ -38,9 +38,9 @@
#define GET_CURRENT_CLOCK_HOUR(this) ((s32)TIME_TO_HOURS_F((this)->clockTime))
#define GET_CURRENT_CLOCK_MINUTE(this) ((s32)((this)->clockTime * (360 * 2.0f / 0x10000)) % 30)
-#define GET_CLOCK_FACE_ROTATION(currentClockHour) ((s16)(currentClockHour * (0x10000 / 24.0f)))
+#define GET_CLOCK_FACE_ROTATION(currentClockHour) (TRUNCF_BINANG(currentClockHour * (0x10000 / 24.0f)))
#define GET_MINUTE_RING_OR_EXTERIOR_GEAR_ROTATION(currentClockMinute) \
- ((s16)(currentClockMinute * (0x10000 * 12.0f / 360)))
+ (TRUNCF_BINANG(currentClockMinute * (0x10000 * 12.0f / 360)))
void ObjTokeidai_Init(Actor* thisx, PlayState* play);
void ObjTokeidai_Destroy(Actor* thisx, PlayState* play);
diff --git a/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c b/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c
index fe9c60bdc..8e3685dfc 100644
--- a/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c
+++ b/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c
@@ -118,7 +118,7 @@ void ObjToudai_Update(Actor* thisx, PlayState* play) {
Math_ApproachF(&this->unk_228, (this->unk_236 == 0) ? 0.0f : 1.0f, 0.01f, 1000.0f);
this->unk_234 += 100;
- thisx->shape.rot.y = (s16)(Math_SinS(this->unk_234) * 16000.0f) + thisx->world.rot.y;
+ thisx->shape.rot.y = TRUNCF_BINANG(Math_SinS(this->unk_234) * 16000.0f) + thisx->world.rot.y;
}
void ObjToudai_Draw(Actor* thisx, PlayState* play) {
diff --git a/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c b/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c
index 30ea80a23..a40d7d514 100644
--- a/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c
+++ b/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c
@@ -76,10 +76,10 @@ void ObjYasi_Update(Actor* thisx, PlayState* play) {
this->dyna.actor.home.rot.x = 400;
this->dyna.actor.home.rot.z = 0;
}
- temp = (s16)(this->dyna.actor.shape.rot.x * 0.1f);
+ temp = TRUNCF_BINANG(this->dyna.actor.shape.rot.x * 0.1f);
this->dyna.actor.home.rot.x -= temp;
this->dyna.actor.shape.rot.x +=
- BINANG_SUB(this->dyna.actor.home.rot.x, (s16)(this->dyna.actor.shape.rot.x * 0.08f));
+ BINANG_SUB(this->dyna.actor.home.rot.x, TRUNCF_BINANG(this->dyna.actor.shape.rot.x * 0.08f));
}
void ObjYasi_Draw(Actor* thisx, PlayState* play) {
diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c
index ab4df1a6a..b5c60f60b 100644
--- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c
+++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c
@@ -678,8 +678,8 @@ void func_808DDE9C(Actor* thisx, PlayState* play2) {
gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
- Matrix_RotateYS((s16)this->unk_14C[2].unk_04 + (s16)(i << 5), MTXMODE_APPLY);
- Matrix_RotateXS((s16)this->unk_14C[2].unk_00 + (s16)(i << 5), MTXMODE_APPLY);
+ Matrix_RotateYS(TRUNCF_BINANG(this->unk_14C[2].unk_04) + (s16)(i << 5), MTXMODE_APPLY);
+ Matrix_RotateXS(TRUNCF_BINANG(this->unk_14C[2].unk_00) + (s16)(i << 5), MTXMODE_APPLY);
if (this->unk_114C == 0) {
Matrix_Scale(0.5f, 1.0f, 0.5f, MTXMODE_APPLY);
diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c
index 6f7e02c74..866a6f395 100644
--- a/src/overlays/actors/ovl_player_actor/z_player.c
+++ b/src/overlays/actors/ovl_player_actor/z_player.c
@@ -8851,7 +8851,7 @@ void func_8083C8E8(Player* this, PlayState* play) {
temp1 = CLAMP(temp1, -0xFA0, 0xFA0);
- temp1 += (s16)(s32)(D_80862B3C * -500.0f);
+ temp1 += TRUNCF_BINANG(D_80862B3C * -500.0f);
temp1 = CLAMP(temp1, -0x2EE0, 0x2EE0);
@@ -14684,7 +14684,8 @@ void Player_Action_25(Player* this, PlayState* play) {
this->stateFlags2 |= (PLAYER_STATE2_20 | PLAYER_STATE2_40);
this->unk_B10[0] += -800.0f;
- this->actor.shape.rot.y += BINANG_ADD((s16)this->unk_B10[0], BINANG_SUB(this->currentYaw, prevYaw));
+ this->actor.shape.rot.y +=
+ BINANG_ADD(TRUNCF_BINANG(this->unk_B10[0]), BINANG_SUB(this->currentYaw, prevYaw));
Math_StepToF(&this->unk_B10[1], 0.0f, this->unk_B10[0]);
}
} else {
@@ -16838,8 +16839,8 @@ void func_80852290(PlayState* play, Player* this) {
}
if (DECR(this->unk_B8A) != 0) {
- this->unk_B86[0] += (s16)(this->upperLimbRot.x * 2.5f);
- this->unk_B86[1] += (s16)(this->upperLimbRot.y * 3.0f);
+ this->unk_B86[0] += TRUNCF_BINANG(this->upperLimbRot.x * 2.5f);
+ this->unk_B86[1] += TRUNCF_BINANG(this->upperLimbRot.y * 3.0f);
} else {
this->unk_B86[0] = 0;
this->unk_B86[1] = 0;
@@ -17915,7 +17916,8 @@ void func_80854EFC(PlayState* play, f32 arg1, struct_8085D848_unk_00* arg2) {
}
play->envCtx.adjLightSettings.fogNear =
- ((s16)((var_v1->fogNear - var_t0->fogNear) * arg1) + var_t0->fogNear) - play->envCtx.lightSettings.fogNear;
+ (TRUNCF_BINANG((var_v1->fogNear - var_t0->fogNear) * arg1) + var_t0->fogNear) -
+ play->envCtx.lightSettings.fogNear;
func_80854CD0(arg1, play->envCtx.adjLightSettings.fogColor, var_v1->fogColor, var_t0->fogColor,
play->envCtx.lightSettings.fogColor, play->envCtx.adjLightSettings.ambientColor, var_v1->ambientColor,
@@ -18359,7 +18361,7 @@ void Player_Action_93(Player* this, PlayState* play) {
this->actor.scale.y = 0.01f + temp_fv0_2;
this->actor.scale.z = this->actor.scale.x = 0.01f - (this->unk_B48 * -0.000015f);
- this->actor.shape.rot.y += (s16)(this->unk_B48 * 130.0f);
+ this->actor.shape.rot.y += TRUNCF_BINANG(this->unk_B48 * 130.0f);
if (this->actor.floorBgId != BGCHECK_SCENE) {
dyna = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId);
@@ -18720,7 +18722,7 @@ void Player_Action_95(Player* this, PlayState* play) {
}
this->unk_B10[0] += -800.0f;
- this->actor.shape.rot.y += BINANG_ADD((s16)this->unk_B10[0], BINANG_SUB(this->currentYaw, prevYaw));
+ this->actor.shape.rot.y += BINANG_ADD(TRUNCF_BINANG(this->unk_B10[0]), BINANG_SUB(this->currentYaw, prevYaw));
if (Math_StepToF(&this->unk_B10[1], 0.0f, this->unk_B10[0])) {
this->actor.shape.rot.y = this->currentYaw;
@@ -19055,7 +19057,7 @@ void Player_Action_96(Player* this, PlayState* play) {
sp80 = CLAMP_MIN(sp80, 0.0f);
Math_AsymStepToF(&this->linearVelocity, speedTarget, sp84, sp80);
- spC8 = (s16)(fabsf(this->actor.speed) * 20.0f) + 300;
+ spC8 = TRUNCF_BINANG(fabsf(this->actor.speed) * 20.0f) + 300;
spC8 = CLAMP_MIN(spC8, 100);
sp7C = (s32)(BINANG_SUB(yawTarget, this->currentYaw) * -0.5f);
diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
index 2c2e9a6b1..034f14412 100644
--- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
+++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
@@ -92,7 +92,7 @@ void DayTelop_Update(DayTelopState* this, GameState* thisx) {
}
if (this->fadeInState == DAYTELOP_HOURSTEXT_FADEIN) {
- this->alpha += (s16)(ABS_ALT(this->alpha - 0xFF) / D_80815FF0);
+ this->alpha += (s16)(ABS_ALT(this->alpha - 255) / D_80815FF0);
D_80815FF0--;
if (D_80815FF0 == 0) {
diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
index 4f736a317..83d1de86a 100644
--- a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
+++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
@@ -1466,7 +1466,7 @@ void FileSelect_DrawFileInfo(GameState* thisx, s16 fileIndex) {
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[D_80814654[fileIndex] + 0xCC], 4, 0);
POLY_OPA_DISP = FileSelect_DrawTexQuadIA8(
- POLY_OPA_DISP, sFileSelHeartPieceTextures[this->heartPieceCount[sp20C]], 0x18, 0x10, (s16)0);
+ POLY_OPA_DISP, sFileSelHeartPieceTextures[this->heartPieceCount[sp20C]], 0x18, 0x10, 0);
if (this->defenseHearts[sp20C] == 0) {
heartType = 0;
diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c
index 4ab7fbdfd..d6fb4f42d 100644
--- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c
+++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c
@@ -1446,11 +1446,11 @@ void KaleidoScope_UpdateSwitchPage(PlayState* play, Input* input) {
pauseCtx->eye.z += sPageSwitchEyeDz[pauseCtx->nextPageMode] * 2.0f;
if (pauseCtx->switchPageTimer < 32) {
- sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX -= TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX -= TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
} else {
- sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX += TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX += TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
}
pauseCtx->switchPageTimer += 8;
@@ -2917,8 +2917,8 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = pauseCtx->maskPageRoll -= 40.0f;
interfaceCtx->startAlpha += 63;
- sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX += TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX += TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
pauseCtx->alpha += 31;
if (pauseCtx->itemPageRoll == 0) {
interfaceCtx->startAlpha = 255;
@@ -3044,8 +3044,8 @@ void KaleidoScope_Update(PlayState* play) {
switch (pauseCtx->savePromptState) {
case PAUSE_SAVEPROMPT_STATE_APPEARING:
pauseCtx->roll -= 78.5f;
- sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX -= TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX -= TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
if (pauseCtx->roll <= -628.0f) {
pauseCtx->roll = -628.0f;
pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_1;
@@ -3109,8 +3109,8 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->maskPageRoll += 40.0f;
pauseCtx->roll += 40.0f;
pauseCtx->infoPanelOffsetY -= 10;
- sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX -= TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX -= TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
pauseCtx->alpha -= 63;
if (pauseCtx->roll == (D_8082B90C + 160.0f)) {
pauseCtx->alpha = 0;
@@ -3128,8 +3128,8 @@ void KaleidoScope_Update(PlayState* play) {
case PAUSE_SAVEPROMPT_STATE_RETURN_TO_MENU:
pauseCtx->roll += 78.5f;
- sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX += TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX += TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
if (pauseCtx->roll >= -314.0f) {
pauseCtx->state = PAUSE_STATE_MAIN;
@@ -3295,8 +3295,8 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->roll;
interfaceCtx->startAlpha += 63;
sGameOverRectPosY -= 3;
- sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX += TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX += TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
pauseCtx->alpha += 31;
if (pauseCtx->roll < -628.0f) {
pauseCtx->roll = -628.0f;
@@ -3466,8 +3466,8 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->mapPageRoll -= 40.0f;
interfaceCtx->startAlpha += 63;
sGameOverRectPosY -= 3;
- sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX += TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX += TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
pauseCtx->alpha += 31;
if (pauseCtx->mapPageRoll == 0) {
@@ -3540,8 +3540,8 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->infoPanelOffsetY -= 10;
pauseCtx->mapPageRoll += 40.0f;
interfaceCtx->startAlpha -= 63;
- sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX -= TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX -= TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
pauseCtx->alpha -= 63;
if (pauseCtx->mapPageRoll == 160.0f) {
pauseCtx->alpha = 0;
@@ -3564,8 +3564,8 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = pauseCtx->maskPageRoll +=
40.0f;
interfaceCtx->startAlpha -= 63;
- sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4);
- sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4);
+ sPauseCursorLeftX -= TRUNCF_BINANG(sPauseCursorLeftMoveOffsetX / 4);
+ sPauseCursorRightX -= TRUNCF_BINANG(sPauseCursorRightMoveOffsetX / 4);
pauseCtx->alpha -= 63;
if (pauseCtx->itemPageRoll == 160.0f) {
pauseCtx->alpha = 0;