From 7f5087d0b2014dc1ba2bbfc7ce858f0059a8a7cb Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Tue, 6 Jun 2023 12:16:34 +1000 Subject: [PATCH] sys_math.c Rename (#1258) * rename via comments * missed a comment * math header * name boot_80086760.c functions * PR Review * rm cam comment * Elliptic review * alphabetical --- include/functions.h | 101 +----------------- include/variables.h | 1 - include/z64math.h | 71 ++++++++++++ src/boot_O2/boot_80086760.c | 77 +++++-------- src/code/sys_math.c | 33 +++--- src/code/z_actor.c | 18 ++-- src/code/z_bgcheck.c | 3 +- src/code/z_camera.c | 33 +++--- src/code/z_eff_blure.c | 24 ++--- src/code/z_en_item00.c | 12 +-- src/code/z_lib.c | 6 +- src/code/z_olib.c | 8 +- src/code/z_player_lib.c | 12 +-- src/code/z_sub_s.c | 2 +- .../actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c | 7 +- .../ovl_Bg_F40_Swlift/z_bg_f40_swlift.c | 2 +- .../actors/ovl_Bg_Icefloe/z_bg_icefloe.c | 10 +- .../actors/ovl_Bg_Icicle/z_bg_icicle.c | 8 +- .../actors/ovl_Bg_Spdweb/z_bg_spdweb.c | 7 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 38 +++---- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 56 +++++----- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 4 +- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 18 ++-- .../ovl_En_Akindonuts/z_en_akindonuts.c | 2 +- src/overlays/actors/ovl_En_Am/z_en_am.c | 10 +- src/overlays/actors/ovl_En_Arrow/z_en_arrow.c | 2 +- .../ovl_En_Attack_Niw/z_en_attack_niw.c | 8 +- src/overlays/actors/ovl_En_Baguo/z_en_baguo.c | 6 +- src/overlays/actors/ovl_En_Bat/z_en_bat.c | 9 +- .../actors/ovl_En_Bbfall/z_en_bbfall.c | 2 +- src/overlays/actors/ovl_En_Bee/z_en_bee.c | 16 ++- src/overlays/actors/ovl_En_Bh/z_en_bh.c | 8 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 8 +- .../actors/ovl_En_Bigpamet/z_en_bigpamet.c | 4 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 4 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 33 +++--- .../actors/ovl_En_Bigslime/z_en_bigslime.h | 2 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 2 +- .../actors/ovl_En_Bombers/z_en_bombers.c | 4 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 10 +- .../actors/ovl_En_Bomjimb/z_en_bomjimb.c | 4 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 4 +- .../actors/ovl_En_Col_Man/z_en_col_man.c | 6 +- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 4 +- .../actors/ovl_En_Daiku2/z_en_daiku2.c | 12 +-- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 4 +- src/overlays/actors/ovl_En_Dg/z_en_dg.c | 10 +- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 12 +-- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 14 +-- .../actors/ovl_En_Dragon/z_en_dragon.c | 10 +- .../actors/ovl_En_Egblock/z_en_egblock.c | 10 +- src/overlays/actors/ovl_En_Egol/z_en_egol.c | 17 ++- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 12 +-- .../actors/ovl_En_Elfbub/z_en_elfbub.c | 2 +- .../actors/ovl_En_Elfgrp/z_en_elfgrp.c | 4 +- .../actors/ovl_En_Elforg/z_en_elforg.c | 6 +- .../actors/ovl_En_Encount1/z_en_encount1.c | 14 +-- .../actors/ovl_En_Encount4/z_en_encount4.c | 4 +- .../actors/ovl_En_Estone/z_en_estone.c | 10 +- src/overlays/actors/ovl_En_Fall/z_en_fall.c | 8 +- src/overlays/actors/ovl_En_Famos/z_en_famos.c | 6 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 2 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.c | 24 ++--- .../actors/ovl_En_Fishing/z_en_fishing.c | 56 +++++----- src/overlays/actors/ovl_En_Fz/z_en_fz.c | 22 ++-- src/overlays/actors/ovl_En_Gg2/z_en_gg2.c | 2 +- src/overlays/actors/ovl_En_Gk/z_en_gk.c | 2 +- .../ovl_En_Grasshopper/z_en_grasshopper.c | 34 +++--- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 4 +- .../actors/ovl_En_Hakurock/z_en_hakurock.c | 2 +- .../actors/ovl_En_Hanabi/z_en_hanabi.c | 10 +- .../ovl_En_Hidden_Nuts/z_en_hidden_nuts.c | 8 +- .../actors/ovl_En_Hint_Skb/z_en_hint_skb.c | 8 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 14 +-- src/overlays/actors/ovl_En_Jg/z_en_jg.c | 2 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 2 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 6 +- src/overlays/actors/ovl_En_Kame/z_en_kame.c | 4 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 20 ++-- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 6 +- .../actors/ovl_En_Minislime/z_en_minislime.c | 30 +++--- src/overlays/actors/ovl_En_Mkk/z_en_mkk.c | 10 +- .../actors/ovl_En_Nimotsu/z_en_nimotsu.c | 4 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 22 ++-- src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 12 +-- src/overlays/actors/ovl_En_Osk/z_en_osk.c | 6 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 2 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 10 +- src/overlays/actors/ovl_En_Part/z_en_part.c | 6 +- .../actors/ovl_En_Peehat/z_en_peehat.c | 14 +-- src/overlays/actors/ovl_En_Pp/z_en_pp.c | 26 ++--- src/overlays/actors/ovl_En_Pr/z_en_pr.c | 8 +- src/overlays/actors/ovl_En_Pr2/z_en_pr2.c | 18 ++-- src/overlays/actors/ovl_En_Prz/z_en_prz.c | 32 +++--- .../actors/ovl_En_Racedog/z_en_racedog.c | 18 ++-- src/overlays/actors/ovl_En_Raf/z_en_raf.c | 6 +- src/overlays/actors/ovl_En_Rat/z_en_rat.c | 20 ++-- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.c | 4 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 6 +- .../actors/ovl_En_Scopecrow/z_en_scopecrow.c | 2 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.c | 2 +- .../actors/ovl_En_Sellnuts/z_en_sellnuts.c | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 10 +- src/overlays/actors/ovl_En_Slime/z_en_slime.c | 42 ++++---- .../actors/ovl_En_Snowman/z_en_snowman.c | 20 ++-- .../actors/ovl_En_Suttari/z_en_suttari.c | 8 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 2 +- .../ovl_En_Syateki_Crow/z_en_syateki_crow.c | 4 +- .../ovl_En_Syateki_Okuta/z_en_syateki_okuta.c | 4 +- .../ovl_En_Syateki_Wf/z_en_syateki_wf.c | 6 +- .../actors/ovl_En_Tanron1/z_en_tanron1.c | 8 +- .../actors/ovl_En_Tanron2/z_en_tanron2.c | 2 +- .../actors/ovl_En_Tanron3/z_en_tanron3.c | 26 ++--- .../actors/ovl_En_Tanron4/z_en_tanron4.c | 23 ++-- .../actors/ovl_En_Tanron5/z_en_tanron5.c | 16 +-- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 10 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 10 +- src/overlays/actors/ovl_En_Trt2/z_en_trt2.c | 12 +-- .../actors/ovl_En_Tru_Mt/z_en_tru_mt.c | 2 +- .../ovl_En_Water_Effect/z_en_water_effect.c | 12 +-- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 10 +- src/overlays/actors/ovl_En_Wiz/z_en_wiz.c | 8 +- .../actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c | 22 ++-- .../actors/ovl_En_Wood02/z_en_wood02.c | 6 +- src/overlays/actors/ovl_En_Yb/z_en_yb.c | 6 +- src/overlays/actors/ovl_En_Zog/z_en_zog.c | 8 +- .../ovl_Obj_Bigicicle/z_obj_bigicicle.c | 16 +-- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c | 2 +- .../actors/ovl_Obj_Hunsui/z_obj_hunsui.c | 8 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 4 +- src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c | 6 +- .../actors/ovl_player_actor/z_player.c | 30 +++--- .../ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c | 4 +- .../z_eff_ss_fhg_flash.c | 12 +-- .../z_eff_ss_kirakira.c | 4 +- .../effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c | 2 +- tools/disasm/functions.txt | 78 +++++++------- tools/namefixer.py | 8 +- tools/sizes/boot_functions.csv | 66 ++++++------ tools/sizes/code_functions.csv | 12 +-- 140 files changed, 916 insertions(+), 955 deletions(-) diff --git a/include/functions.h b/include/functions.h index 7d64745f69..71aa147299 100644 --- a/include/functions.h +++ b/include/functions.h @@ -129,39 +129,6 @@ void MtxConv_L2F(MtxF* mtx, Mtx* mf); void __assert(const char* file, u32 lineNum); // void func_800862B4(void); s32 func_80086620(OSMesgQueue* param_1, PadMgr* param_2, OSContStatus* param_3); -f32 func_80086760(f32 x); -// void func_80086794(void); -// void func_800867B4(void); -// void func_800867D4(void); -// void func_800867F4(void); -f32 func_80086814(f32 x); -// void func_80086834(void); -// void func_80086880(void); -// void func_800869A4(void); -// void func_80086AF0(void); -f32 func_80086B30(f32 y, f32 x); -// void func_80086C18(void); -f32 func_80086C48(f32 x); -// void func_80086C70(void); -f64 func_80086C7C(f64 param_1); -s32 func_80086C88(f32 param_1); -s32 func_80086C98(f64 param_1); -// void func_80086CA8(void); -f64 func_80086CB4(f64 param_1); -s32 func_80086CC0(f32 param_1); -s32 func_80086CD0(f64 param_1); -// void func_80086CE0(void); -f64 func_80086CEC(f64 param_1); -s32 func_80086CF8(f32 param_1); -s32 func_80086D08(f64 param_1); -// void func_80086D18(void); -f64 func_80086D24(f64); -s32 func_80086D30(f32 param_1); -s32 func_80086D40(f64 param_1); -// void func_80086D50(void); -f64 func_80086D6C(f64 param_1); -s32 func_80086D8C(f32 param_1); -s32 func_80086DAC(f64 param_1); u32 Rand_Next(void); void Rand_Seed(u32 seed); @@ -1161,70 +1128,17 @@ void func_800FEA50(PlayState* play); void func_800FEAB0(void); // void func_800FEAC0(void); void func_800FEAF4(EnvironmentContext* envCtx); + void* Lib_MemCpy(void* dest, void* src, size_t size); void* Lib_MemSet(void* buffer, s32 value, size_t size); -f32 Math_CosS(s16 angle); -f32 Math_SinS(s16 angle); -s32 Math_StepToIImpl(s32 start, s32 target, s32 step); -void Math_StepToIGet(s32* pValue, s32 target, s32 step); -s32 Math_StepToI(s32* pValue, s32 target, s32 step); -s32 Math_ScaledStepToS(s16* pValue, s16 target, s16 step); -s32 Math_StepToS(s16* pValue, s16 target, s16 step); -s32 Math_StepToC(s8* pValue, s8 target, s8 step); -s32 Math_StepToF(f32* pValue, f32 target, f32 step); -s32 Math_StepUntilAngleS(s16* pValue, s16 target, s16 step); -s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step); -s32 Math_AsymStepToS(s16* pValue, s16 target, s16 incrStep, s16 decrStep); -s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step); -s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep); void func_800FF3A0(f32* distOut, s16* angleOut, Input* input); -s16 Rand_S16Offset(s16 base, s16 range); -s16 Rand_S16OffsetStride(s16 base, s16 stride, s16 range); -void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src); -void Math_Vec3s_Copy(Vec3s* dest, Vec3s* src); -void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src); -void Math_Vec3f_ToVec3s(Vec3s* dest, Vec3f* src); -void Math_Vec3f_Sum(Vec3f* l, Vec3f* r, Vec3f* dest); -void Math_Vec3f_Diff(Vec3f* l, Vec3f* r, Vec3f* dest); -void Math_Vec3s_DiffToVec3f(Vec3f* dest, Vec3s* l, Vec3s* r); -void Math_Vec3f_Scale(Vec3f* vec, f32 scale); -void Math_Vec3f_ScaleAndStore(Vec3f* vec, f32 scale, Vec3f* dest); -void Math_Vec3f_Lerp(Vec3f* a, Vec3f* b, f32 t, Vec3f* dest); -void Math_Vec3f_SumScaled(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest); -void Math_Vec3f_AddRand(Vec3f* orig, f32 scale, Vec3f* dest); -void Math_Vec3f_DistXYZAndStoreNormDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest); -f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b); -f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest); -f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b); -f32 Math_Vec3f_DistXZAndStore(Vec3f* a, Vec3f* b, f32* dx, f32* dz); -f32 Math_Vec3f_StepToXZ(Vec3f* start, Vec3f* target, f32 speed); -f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b); -s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b); -s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b); void Actor_ProcessInitChain(Actor* actor, InitChainEntry* ichain); -// void IChain_Apply_u8(u8* actor, InitChainEntry* init); -// void IChain_Apply_s8(u8* actor, InitChainEntry* init); -// void IChain_Apply_u16(u8* actor, InitChainEntry* init); -// void IChain_Apply_s16(u8* actor, InitChainEntry* init); -// void IChain_Apply_u32(u8* actor, InitChainEntry* init); -// void IChain_Apply_s32(u8* actor, InitChainEntry* init); -// void IChain_Apply_f32(u8* actor, InitChainEntry* init); -// void IChain_Apply_f32div1000(u8* actor, InitChainEntry* init); -// void IChain_Apply_Vec3f(u8* actor, InitChainEntry* init); -// void IChain_Apply_Vec3fdiv1000(u8* actor, InitChainEntry* init); -// void IChain_Apply_Vec3s(u8* actor, InitChainEntry* init); -f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep); -void Math_ApproachF(f32* pValue, f32 target, f32 scale, f32 maxStep); -void Math_ApproachZeroF(f32* pValue, f32 scale, f32 maxStep); -s16 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step, s16 minStep); -void Math_ApproachS(s16* pValue, s16 target, s16 scale, s16 maxStep); void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src); void func_801000A4(u16 sfxId); void func_801000CC(u16 sfxId); void Lib_PlaySfxAtPos(Vec3f* pos, u16 sfxId); void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 rotAngle, Vec3f* src, Vec3f* dst); void Lib_LerpRGB(Color_RGB8* a, Color_RGB8* b, f32 t, Color_RGB8* dst); -f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed); void Lib_Nop801004FC(void); void* Lib_SegmentedToVirtual(void* ptr); void* Lib_SegmentedToVirtualNull(void* ptr); @@ -2056,13 +1970,7 @@ void CmpDma_LoadAllFiles(uintptr_t segmentVrom, void* dst, size_t size); // void Check_DrawRegionLockErrorMessage(void); void Check_ExpansionPak(void); void Check_RegionIsSupported(void); -f32 func_80179300(f32 n); -f32 func_80179400(s32 n); -f32 pow_int(f32 base, s32 exp); -f32 sin_rad(f32 rad); -f32 cos_rad(f32 rad); -f32 Rand_ZeroFloat(f32 scale); -f32 randPlusMinusPoint5Scaled(f32 scale); + f32 Math3D_Normalize(Vec3f* vec); s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* linePointA, Vec3f* linePointB, Vec3f* closestPoint); s32 func_80179798(Vec3f* param_1, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, Vec3f* param_5, Vec3f* param_6); @@ -2158,11 +2066,6 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z); // void func_8017FB1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11); // void func_8017FD44(void); -s16 Math_Atan2S(f32 y, f32 x); -f32 Math_Atan2F(f32 y, f32 x); -s16 Math_Atan2S_XY(f32 x, f32 y); -f32 Math_Atan2F_XY(f32 x, f32 y); - u64* SysUcode_GetUCodeBoot(void); size_t SysUcode_GetUCodeBootSize(void); u64* SysUcode_GetUCode(void); diff --git a/include/variables.h b/include/variables.h index e264a7d9b9..fef772123b 100644 --- a/include/variables.h +++ b/include/variables.h @@ -755,7 +755,6 @@ extern s32 gScreenWidth; extern s32 gScreenHeight; extern u32 startHeapSize; extern UNK_PTR D_801D1540; -// extern f32 sFactorialTbl[13]; extern Vec3f gZeroVec3f; extern Vec3s gZeroVec3s; diff --git a/include/z64math.h b/include/z64math.h index cd5c1db200..a86cf9a204 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -168,4 +168,75 @@ typedef enum { #define SQXYZ(vec) ((vec.x) * (vec.x) + (vec.y) * (vec.y) + (vec.z) * (vec.z)) #define DOTXYZ(vec1, vec2) ((vec1.x) * (vec2.x) + (vec1.y) * (vec2.y) + (vec1.z) * (vec2.z)) +f32 Math_CosS(s16 angle); +f32 Math_SinS(s16 angle); +s32 Math_StepToIImpl(s32 start, s32 target, s32 step); +void Math_StepToIGet(s32* pValue, s32 target, s32 step); +s32 Math_StepToI(s32* pValue, s32 target, s32 step); +s32 Math_ScaledStepToS(s16* pValue, s16 target, s16 step); +s32 Math_StepToS(s16* pValue, s16 target, s16 step); +s32 Math_StepToC(s8* pValue, s8 target, s8 step); +s32 Math_StepToF(f32* pValue, f32 target, f32 step); +s32 Math_StepUntilAngleS(s16* pValue, s16 target, s16 step); +s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step); +s32 Math_AsymStepToS(s16* pValue, s16 target, s16 incrStep, s16 decrStep); +s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step); +s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep); +s16 Rand_S16Offset(s16 base, s16 range); +s16 Rand_S16OffsetStride(s16 base, s16 stride, s16 range); +void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src); +void Math_Vec3s_Copy(Vec3s* dest, Vec3s* src); +void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src); +void Math_Vec3f_ToVec3s(Vec3s* dest, Vec3f* src); +void Math_Vec3f_Sum(Vec3f* l, Vec3f* r, Vec3f* dest); +void Math_Vec3f_Diff(Vec3f* l, Vec3f* r, Vec3f* dest); +void Math_Vec3s_DiffToVec3f(Vec3f* dest, Vec3s* l, Vec3s* r); +void Math_Vec3f_Scale(Vec3f* vec, f32 scale); +void Math_Vec3f_ScaleAndStore(Vec3f* vec, f32 scale, Vec3f* dest); +void Math_Vec3f_Lerp(Vec3f* a, Vec3f* b, f32 t, Vec3f* dest); +void Math_Vec3f_SumScaled(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest); +void Math_Vec3f_AddRand(Vec3f* orig, f32 scale, Vec3f* dest); +void Math_Vec3f_DistXYZAndStoreNormDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest); +f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b); +f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest); +f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b); +f32 Math_Vec3f_DistXZAndStore(Vec3f* a, Vec3f* b, f32* dx, f32* dz); +f32 Math_Vec3f_StepToXZ(Vec3f* start, Vec3f* target, f32 speed); +f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b); +s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b); +s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b); +f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep); +void Math_ApproachF(f32* pValue, f32 target, f32 scale, f32 maxStep); +void Math_ApproachZeroF(f32* pValue, f32 scale, f32 maxStep); +s16 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step, s16 minStep); +void Math_ApproachS(s16* pValue, s16 target, s16 scale, s16 maxStep); +f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed); + +f32 Math_FactorialF(f32 n); +f32 Math_Factorial(s32 n); +f32 Math_PowF(f32 base, s32 exp); +f32 Math_SinF(f32 rad); +f32 Math_CosF(f32 rad); +f32 Rand_ZeroFloat(f32 scale); +f32 Rand_CenteredFloat(f32 scale); + +f32 Math_FTanF(f32 x); +f32 Math_FFloorF(f32 x); +f32 Math_FCeilF(f32 x); +f32 Math_FRoundF(f32 x); +f32 Math_FTruncF(f32 x); +f32 Math_FNearbyIntF(f32 x); +f32 Math_FAtanTaylorQF(f32 x); +f32 Math_FAtanTaylorF(f32 x); +f32 Math_FAtanContFracF(f32 x); +f32 Math_FAtanF(f32 x); +f32 Math_FAtan2F(f32 y, f32 x); +f32 Math_FAsinF(f32 x); +f32 Math_FAcosF(f32 x); + +s16 Math_Atan2S(f32 y, f32 x); +f32 Math_Atan2F(f32 y, f32 x); +s16 Math_Atan2S_XY(f32 x, f32 y); +f32 Math_Atan2F_XY(f32 x, f32 y); + #endif diff --git a/src/boot_O2/boot_80086760.c b/src/boot_O2/boot_80086760.c index 398a1e41ab..cb77bed507 100644 --- a/src/boot_O2/boot_80086760.c +++ b/src/boot_O2/boot_80086760.c @@ -5,57 +5,44 @@ #include "global.h" #include "fixed_point.h" -extern f32 func_80086C70(f32 x); -extern f32 func_80086CA8(f32 x); -extern f32 func_80086D50(f32 x); -extern f32 func_80086CE0(f32 x); -extern f32 func_80086D18(f32 x); - s32 gUseAtanContFrac; /** * Tangent function computed using libultra sinf and cosf */ -// Math_FTanF -f32 func_80086760(f32 x) { +f32 Math_FTanF(f32 x) { return sinf(x) / cosf(x); } // Unused -// Math_FFloorF -f32 func_80086794(f32 x) { - return func_80086C70(x); +f32 Math_FFloorF(f32 x) { + return floorf(x); } // Unused -// Math_FCeilF -f32 func_800867B4(f32 x) { - return func_80086CA8(x); +f32 Math_FCeilF(f32 x) { + return ceilf(x); } // Unused -// Math_FRoundF -f32 func_800867D4(f32 x) { - return func_80086D50(x); +f32 Math_FRoundF(f32 x) { + return roundf(x); } // Unused -// Math_FTruncF -f32 func_800867F4(f32 x) { - return func_80086CE0(x); +f32 Math_FTruncF(f32 x) { + return truncf(x); } -// Math_FNearbyIntF -f32 func_80086814(f32 x) { - return func_80086D18(x); +f32 Math_FNearbyIntF(f32 x) { + return nearbyintf(x); } /** * Arctangent approximation using a Maclaurin series [https://mathworld.wolfram.com/MaclaurinSeries.html] * (one quadrant, i.e. |x| < 1) */ -// Math_FAtanTaylorQF -f32 func_80086834(f32 x) { +f32 Math_FAtanTaylorQF(f32 x) { // Coefficients of Maclaurin series of arctangent static const f32 coeffs[] = { -1.0f / 3, +1.0f / 5, -1.0f / 7, +1.0f / 9, -1.0f / 11, +1.0f / 13, -1.0f / 15, +1.0f / 17, 0.0f, @@ -84,10 +71,9 @@ f32 func_80086834(f32 x) { * Extends previous arctangent function to the rest of the real numbers. * Uses the formulae arctan(x) = pi/2 - arctan(1/x) * and arctan(x) = pi/4 - arctan( (1-x)/(1+x) ) - * to extend the range in which the series computed by func_80086834 is a good approximation + * to extend the range in which the series computed by Math_FAtanTaylorQF is a good approximation */ -// Math_FAtanTaylorF -f32 func_80086880(f32 x) { +f32 Math_FAtanTaylorF(f32 x) { f32 t; f32 q; @@ -102,13 +88,13 @@ f32 func_80086880(f32 x) { } if (t <= M_SQRT2 - 1.0f) { - return func_80086834(x); + return Math_FAtanTaylorQF(x); } if (t >= M_SQRT2 + 1.0f) { - q = M_PI / 2 - func_80086834(1.0f / t); + q = M_PI / 2 - Math_FAtanTaylorQF(1.0f / t); } else { // in the interval (\sqrt{2} - 1, \sqrt{2} + 1) - q = M_PI / 4 - func_80086834((1.0f - t) / (1.0f + t)); + q = M_PI / 4 - Math_FAtanTaylorQF((1.0f - t) / (1.0f + t)); } if (x > 0.0f) { @@ -123,8 +109,7 @@ f32 func_80086880(f32 x) { * Cf. https://en.wikipedia.org/wiki/Gauss%27s_continued_fraction#The_series_2F1_2 , * https://dlmf.nist.gov/4.25#E4 */ -// Math_FAtanContFracF -f32 func_800869A4(f32 x) { +f32 Math_FAtanContFracF(f32 x) { s32 sector; f32 z; f32 conv; @@ -162,24 +147,22 @@ f32 func_800869A4(f32 x) { } } -// Math_FAtanF /** * Single-argument arctangent, only used by the two-argument function. * Nothing else sets the bss variable gUseAtanContFrac, so the Maclaurin series is always used */ -f32 func_80086AF0(f32 x) { +f32 Math_FAtanF(f32 x) { if (!gUseAtanContFrac) { - return func_80086880(x); + return Math_FAtanTaylorF(x); } else { - return func_800869A4(x); + return Math_FAtanContFracF(x); } } -// Math_FAtan2F /** * Main two-argument arctangent function */ -f32 func_80086B30(f32 y, f32 x) { +f32 Math_FAtan2F(f32 y, f32 x) { if (x == 0.0f) { if (y == 0.0f) { return 0.0f; @@ -191,20 +174,18 @@ f32 func_80086B30(f32 y, f32 x) { return qNaN0x10000; } } else if (x >= 0.0f) { - return func_80086AF0(y / x); + return Math_FAtanF(y / x); } else if (y < 0.0f) { - return func_80086AF0(y / x) - M_PI; + return Math_FAtanF(y / x) - M_PI; } else { - return M_PI - func_80086AF0(-(y / x)); + return M_PI - Math_FAtanF(-(y / x)); } } -// Math_FAsinF -f32 func_80086C18(f32 x) { - return func_80086B30(x, sqrtf(1.0f - SQ(x))); +f32 Math_FAsinF(f32 x) { + return Math_FAtan2F(x, sqrtf(1.0f - SQ(x))); } -// Math_FAcosF -f32 func_80086C48(f32 x) { - return M_PI / 2 - func_80086C18(x); +f32 Math_FAcosF(f32 x) { + return M_PI / 2 - Math_FAsinF(x); } diff --git a/src/code/sys_math.c b/src/code/sys_math.c index 7fd7e9dea4..99d13c3322 100644 --- a/src/code/sys_math.c +++ b/src/code/sys_math.c @@ -4,15 +4,17 @@ */ #include "global.h" -static f32 sFactorialTbl[] = { 1.0f, 1.0f, 2.0f, 6.0f, 24.0f, 120.0f, 720.0f, - 5040.0f, 40320.0f, 362880.0f, 3628800.0f, 39916800.0f, 479001600.0f }; +static f32 sFactorialTbl[] = { + 1.0f, 1.0f, 2.0f, 6.0f, 24.0f, 120.0f, 720.0f, 5040.0f, 40320.0f, 362880.0f, 3628800.0f, 39916800.0f, 479001600.0f, +}; -// Rename to Math_FactorialF /** * Takes a float, returns the factorial of it(s trunctation), iteratively * Unused + * + * @remark original name: "ffact" */ -f32 func_80179300(f32 n) { +f32 Math_FactorialF(f32 n) { f32 ret = 1.0f; s32 i; @@ -23,12 +25,13 @@ f32 func_80179300(f32 n) { return ret; } -// Rename to Math_Factorial /** * Takes an int and returns its factorial as a float. Uses the lookup table for n <= 12. * Unused + * + * @remark original name: "ifact" */ -f32 func_80179400(s32 n) { +f32 Math_Factorial(s32 n) { f32 ret; s32 i; @@ -45,12 +48,13 @@ f32 func_80179400(s32 n) { return ret; } -// Rename to Math_PowF /** * Returns base^{exp} if exp is nonnegative and 1.0f otherwise. * Unused + * + * @remark original name: "powi" */ -f32 pow_int(f32 base, s32 exp) { +f32 Math_PowF(f32 base, s32 exp) { f32 ret = 1.0f; while (exp > 0) { @@ -61,19 +65,21 @@ f32 pow_int(f32 base, s32 exp) { return ret; } -// Rename to Math_SinF /** * Takes an angle in radians and returns the sine. + * + * @remark original name: "sinf_table" */ -f32 sin_rad(f32 rad) { +f32 Math_SinF(f32 rad) { return sins(RAD_TO_BINANG(rad)) * SHT_MINV; } -// Rename to Math_CosF /** * Takes an angle in radians and returns the cosine. + * + * @remark original name: "cosf_table" */ -f32 cos_rad(f32 rad) { +f32 Math_CosF(f32 rad) { return coss(RAD_TO_BINANG(rad)) * SHT_MINV; } @@ -84,10 +90,9 @@ f32 Rand_ZeroFloat(f32 scale) { return Rand_ZeroOne() * scale; } -// Rename to Rand_CenteredFloat /** * Returns a pseudo-random floating-point number between (- scale / 2) and (scale / 2). Originally in z_actor in OoT. */ -f32 randPlusMinusPoint5Scaled(f32 scale) { +f32 Rand_CenteredFloat(f32 scale) { return Rand_Centered() * scale; } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 82ff8ddd92..e7bc92a261 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3567,8 +3567,8 @@ void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 r accel.y += (Rand_ZeroOne() - 0.5f) * 0.2f; for (i = countMinusOne; i >= 0; i--) { - pos.x = (sin_rad(angle) * radius) + posXZ->x; - pos.z = (cos_rad(angle) * radius) + posXZ->z; + pos.x = (Math_SinF(angle) * radius) + posXZ->x; + pos.z = (Math_CosF(angle) * radius) + posXZ->z; accel.x = (Rand_ZeroOne() - 0.5f) * randAccelWeight; accel.z = (Rand_ZeroOne() - 0.5f) * randAccelWeight; @@ -4816,7 +4816,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 // Apply and draw a light orb over each limb of frozen actor for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) { - Matrix_RotateZF(randPlusMinusPoint5Scaled(2 * M_PI), MTXMODE_APPLY); + Matrix_RotateZF(Rand_CenteredFloat(2 * M_PI), MTXMODE_APPLY); currentMatrix->mf[3][0] = limbPos->x; currentMatrix->mf[3][1] = limbPos->y; currentMatrix->mf[3][2] = limbPos->z; @@ -4857,9 +4857,9 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 // first electric spark Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY); - currentMatrix->mf[3][0] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->x; - currentMatrix->mf[3][1] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->y; - currentMatrix->mf[3][2] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->z; + currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->x; + currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->y; + currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->z; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4869,9 +4869,9 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 // second electric spark Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY); - currentMatrix->mf[3][0] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->x; - currentMatrix->mf[3][1] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->y; - currentMatrix->mf[3][2] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->z; + currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->x; + currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->y; + currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->z; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index e30dec5d55..a263d4393c 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,4 +1,5 @@ #include "global.h" +#include "fixed_point.h" #include "vt.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" @@ -3047,7 +3048,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3 newPoly->normal.z = COLPOLY_SNORMAL(newNormal.z); } - newPoly->dist = func_80086D24(-DOTXYZ(newNormal, vtxA)); + newPoly->dist = nearbyint(-DOTXYZ(newNormal, vtxA)); if (newNormal.y > 0.5f) { s16 polyId = *polyStartIndex + i; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index bd23308c38..ce09f7c4d5 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -875,7 +875,7 @@ void func_800CC938(Camera* camera) { * Calculates the angle between points `from` and `to` */ s16 Camera_CalcXZAngle(Vec3f* to, Vec3f* from) { - return CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(from->x - to->x, from->z - to->z))); + return CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(from->x - to->x, from->z - to->z))); } // BSS @@ -964,8 +964,8 @@ s16 Camera_GetPitchAdjFromFloorHeightDiffs(Camera* camera, s16 viewYaw, s16 shou floorYDiffNear = (sFloorYNear - camera->focalActorFloorHeight) * 0.8f; floorYDiffFar = (sFloorYFar - camera->focalActorFloorHeight) * (20.0f * 0.01f); - pitchNear = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(floorYDiffNear, nearDist))); - pitchFar = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(floorYDiffFar, farDist))); + pitchNear = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(floorYDiffNear, nearDist))); + pitchFar = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(floorYDiffFar, farDist))); return pitchNear + pitchFar; } @@ -1457,9 +1457,8 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecGeo* arg1, f32 yOffset, f32 xzOf deltaY = focalActorPosRot->pos.y - *focalActorPosY; eyeAtDistXZ = OLib_Vec3fDistXZ(at, &camera->eye); - // Math_FTanF // Get the height based on 80% of the fov - fovHeight = func_80086760(DEG_TO_RAD(camera->fov * (0.8f * 0.5f))) * eyeAtDistXZ; + fovHeight = Math_FTanF(DEG_TO_RAD(camera->fov * (0.8f * 0.5f))) * eyeAtDistXZ; if (deltaY > fovHeight) { //! FAKE @@ -1539,8 +1538,8 @@ s32 Camera_CalcAtForFriendlyLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targ deltaY = focalActorPosRot->pos.y - *yPosOffset; sp50 = OLib_Vec3fDistXZ(at, &camera->eye); phi_f16 = sp50; - func_80086B30(deltaY, sp50); - fovHeight = func_80086760(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16; + Math_FAtan2F(deltaY, sp50); + fovHeight = Math_FTanF(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16; if (fovHeight < deltaY) { *yPosOffset += deltaY - fovHeight; @@ -1552,12 +1551,12 @@ s32 Camera_CalcAtForFriendlyLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targ focalActorAtOffsetTarget.y -= deltaY; } else { deltaY = focalActorPosRot->pos.y - *yPosOffset; - temp_f0_6 = func_80086B30(deltaY, OLib_Vec3fDistXZ(at, &camera->eye)); + temp_f0_6 = Math_FAtan2F(deltaY, OLib_Vec3fDistXZ(at, &camera->eye)); if (temp_f0_6 > 0.34906584f) { // (M_PI / 9) - phi_f16 = 1.0f - sin_rad(temp_f0_6 - 0.34906584f); + phi_f16 = 1.0f - Math_SinF(temp_f0_6 - 0.34906584f); } else if (temp_f0_6 < -0.17453292f) { // (M_PI / 18) - phi_f16 = 1.0f - sin_rad(-0.17453292f - temp_f0_6); + phi_f16 = 1.0f - Math_SinF(-0.17453292f - temp_f0_6); } else { phi_f16 = 1.0f; } @@ -1625,10 +1624,10 @@ s32 Camera_CalcAtForEnemyLockOn(Camera* camera, f32* arg1, s32 arg2, f32 yOffset new_var2 = *arg1; sp4C = new_var2; deltaY = focalActorPosRot->pos.y - *arg6; - temp_f0_3 = func_80086B30(deltaY, sp4C); + temp_f0_3 = Math_FAtan2F(deltaY, sp4C); if (!(flags & 0x80)) { - fovHeight = func_80086760(DEG_TO_RAD(camera->fov * 0.4f)) * sp4C; + fovHeight = Math_FTanF(DEG_TO_RAD(camera->fov * 0.4f)) * sp4C; if (fovHeight < deltaY) { *arg6 += deltaY - fovHeight; @@ -1641,9 +1640,9 @@ s32 Camera_CalcAtForEnemyLockOn(Camera* camera, f32* arg1, s32 arg2, f32 yOffset focalActorAtOffsetTarget.y -= deltaY; } else { if (temp_f0_3 > 0.34906584f) { // (M_PI / 9) - phi_f14 = 1.0f - sin_rad(temp_f0_3 - 0.34906584f); + phi_f14 = 1.0f - Math_SinF(temp_f0_3 - 0.34906584f); } else if (temp_f0_3 < -0.17453292f) { // (M_PI / 18) - phi_f14 = 1.0f - sin_rad(-0.17453292f - temp_f0_3); + phi_f14 = 1.0f - Math_SinF(-0.17453292f - temp_f0_3); } else { phi_f14 = 1.0f; } @@ -6343,8 +6342,8 @@ s32 Camera_Demo4(Camera* camera) { // Camera fixed on human player as the mask moves from the pocket to the face // Camera rolls left and right if (rwData->timer >= 12) { - rwData->unk_0C = (rwData->timer - 12) * 10.384615f; - sin = sin_rad(DEG_TO_RAD(rwData->unk_0C)); + rwData->unk_0C = (rwData->timer - 12) * (135.0f / 13.0f); + sin = Math_SinF(DEG_TO_RAD(rwData->unk_0C)); rwData->unk_0C = ((rwData->unk_10 < 0.0f) ? -1.0f : 1.0f) * sin; if (rwData->timer == 12) { Distortion_Request(DISTORTION_TYPE_MASK_TRANSFORM_1); @@ -6516,7 +6515,7 @@ s32 Camera_Demo5(Camera* camera) { // Camera zooms out while rolling back and forth rwData->unk_0C = rwData->timer * (180.0f / 23.0f); sp58 = DEG_TO_RAD(rwData->unk_0C); - sin = sin_rad(sp58); + sin = Math_SinF(sp58); rwData->unk_0C = ((rwData->unk_10 < 0.0f) ? -1.0f : 1.0f) * sin; new_var = (46 - rwData->timer) * (5.0f / 46.0f); focalActorFocus.pos.x = (Math_SinS(rwData->unk_24) * new_var * rwData->unk_0C) + focalActorPosRot->pos.x; diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index 370ca94810..775db80e1e 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -561,16 +561,16 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem vtx[0].v = baseVtx; vtx[1].v = baseVtx; - vtx[0].v.ob[0] = func_80086814(sp158.x); - vtx[0].v.ob[1] = func_80086814(sp158.y); - vtx[0].v.ob[2] = func_80086814(sp158.z); + vtx[0].v.ob[0] = Math_FNearbyIntF(sp158.x); + vtx[0].v.ob[1] = Math_FNearbyIntF(sp158.y); + vtx[0].v.ob[2] = Math_FNearbyIntF(sp158.z); vtx[0].v.cn[0] = sp148.r; vtx[0].v.cn[1] = sp148.g; vtx[0].v.cn[2] = sp148.b; vtx[0].v.cn[3] = sp148.a; - vtx[1].v.ob[0] = func_80086814(sp14C.x); - vtx[1].v.ob[1] = func_80086814(sp14C.y); - vtx[1].v.ob[2] = func_80086814(sp14C.z); + vtx[1].v.ob[0] = Math_FNearbyIntF(sp14C.x); + vtx[1].v.ob[1] = Math_FNearbyIntF(sp14C.y); + vtx[1].v.ob[2] = Math_FNearbyIntF(sp14C.z); vtx[1].v.cn[0] = sp144.r; vtx[1].v.cn[1] = sp144.g; vtx[1].v.cn[2] = sp144.b; @@ -606,17 +606,17 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem vtx[j1].v = baseVtx; vtx[j2].v = baseVtx; - vtx[j1].v.ob[0] = func_80086814(sp158.x); - vtx[j1].v.ob[1] = func_80086814(sp158.y); - vtx[j1].v.ob[2] = func_80086814(sp158.z); + vtx[j1].v.ob[0] = Math_FNearbyIntF(sp158.x); + vtx[j1].v.ob[1] = Math_FNearbyIntF(sp158.y); + vtx[j1].v.ob[2] = Math_FNearbyIntF(sp158.z); vtx[j1].v.cn[0] = func_800B0A24(sp1A4.r, sp19C.r, temp_f28); vtx[j1].v.cn[1] = func_800B0A24(sp1A4.g, sp19C.g, temp_f28); vtx[j1].v.cn[2] = func_800B0A24(sp1A4.b, sp19C.b, temp_f28); vtx[j1].v.cn[3] = func_800B0A24(sp1A4.a, sp19C.a, temp_f28); - vtx[j2].v.ob[0] = func_80086814(sp14C.x); - vtx[j2].v.ob[1] = func_80086814(sp14C.y); - vtx[j2].v.ob[2] = func_80086814(sp14C.z); + vtx[j2].v.ob[0] = Math_FNearbyIntF(sp14C.x); + vtx[j2].v.ob[1] = Math_FNearbyIntF(sp14C.y); + vtx[j2].v.ob[2] = Math_FNearbyIntF(sp14C.z); vtx[j2].v.cn[0] = func_800B0A24(sp1A0.r, sp198.r, temp_f28); vtx[j2].v.cn[1] = func_800B0A24(sp1A0.g, sp198.g, temp_f28); vtx[j2].v.cn[2] = func_800B0A24(sp1A0.b, sp198.b, temp_f28); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 7b9e2ca34d..886c3c9423 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -127,7 +127,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { break; case ITEM00_RECOVERY_HEART: - this->actor.home.rot.z = randPlusMinusPoint5Scaled(0xFFFF); + this->actor.home.rot.z = Rand_CenteredFloat(0xFFFF); shadowOffset = 430.0f; Actor_SetScale(&this->actor, 0.02f); this->unk154 = 0.02f; @@ -381,9 +381,9 @@ void func_800A6650(EnItem00* this, PlayState* play) { } if ((play->gameplayFrames & 1) != 0) { - pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(10.0f); - pos.y = this->actor.world.pos.y + randPlusMinusPoint5Scaled(10.0f); - pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(10.0f); + pos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f); + pos.y = this->actor.world.pos.y + Rand_CenteredFloat(10.0f); + pos.z = this->actor.world.pos.z + Rand_CenteredFloat(10.0f); EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor); } @@ -956,7 +956,7 @@ Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) { } spawnedActor->speed = 2.0f; spawnedActor->gravity = -0.9f; - spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(0x10000); + spawnedActor->world.rot.y = Rand_CenteredFloat(0x10000); Actor_SetScale(spawnedActor, 0.0f); ((EnItem00*)spawnedActor)->actionFunc = func_800A6780; ((EnItem00*)spawnedActor)->unk152 = 0xDC; @@ -1011,7 +1011,7 @@ Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) { } else { spawnedActor->gravity = -0.9f; } - spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(0x10000); + spawnedActor->world.rot.y = Rand_CenteredFloat(0x10000); spawnedActor->flags |= 0x10; } } diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 136918765a..f3e67e5f3b 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -348,9 +348,9 @@ void Math_Vec3f_SumScaled(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest) { } void Math_Vec3f_AddRand(Vec3f* orig, f32 scale, Vec3f* dest) { - dest->x = randPlusMinusPoint5Scaled(scale) + orig->x; - dest->y = randPlusMinusPoint5Scaled(scale) + orig->y; - dest->z = randPlusMinusPoint5Scaled(scale) + orig->z; + dest->x = Rand_CenteredFloat(scale) + orig->x; + dest->y = Rand_CenteredFloat(scale) + orig->y; + dest->z = Rand_CenteredFloat(scale) + orig->z; } void Math_Vec3f_DistXYZAndStoreNormDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest) { diff --git a/src/code/z_olib.c b/src/code/z_olib.c index 754857014b..848a48a72e 100644 --- a/src/code/z_olib.c +++ b/src/code/z_olib.c @@ -123,14 +123,14 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) { if ((distXZ == 0.0f) && (vec->y == 0.0f)) { sph.pitch = 0; } else { - sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(distXZ, vec->y))); + sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(distXZ, vec->y))); } sph.r = sqrtf(SQ(vec->y) + distXZSq); if ((vec->x == 0.0f) && (vec->z == 0.0f)) { sph.yaw = 0; } else { - sph.yaw = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(vec->x, vec->z))); + sph.yaw = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(vec->x, vec->z))); } *dest = sph; @@ -202,8 +202,8 @@ Vec3f* OLib_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) { Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b) { Vec3f anglesRad; - anglesRad.x = func_80086B30(b->z - a->z, b->y - a->y); - anglesRad.y = func_80086B30(b->x - a->x, b->z - a->z); + anglesRad.x = Math_FAtan2F(b->z - a->z, b->y - a->y); + anglesRad.y = Math_FAtan2F(b->x - a->x, b->z - a->z); anglesRad.z = 0; *dest = anglesRad; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 2c0a79d213..2e2d2222d9 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1540,10 +1540,8 @@ void Player_UpdateBunnyEars(Player* player) { sBunnyEarKinematics.angVel.y += -sBunnyEarKinematics.rot.y >> 2; angle = player->actor.world.rot.y - player->actor.shape.rot.y; - force.x = - (s32)(player->actor.speed * -200.0f * Math_CosS(angle) * (randPlusMinusPoint5Scaled(2.0f) + 10.0f)) & 0xFFFF; - force.y = - (s32)(player->actor.speed * 100.0f * Math_SinS(angle) * (randPlusMinusPoint5Scaled(2.0f) + 10.0f)) & 0xFFFF; + force.x = (s32)(player->actor.speed * -200.0f * Math_CosS(angle) * (Rand_CenteredFloat(2.0f) + 10.0f)) & 0xFFFF; + force.y = (s32)(player->actor.speed * 100.0f * Math_SinS(angle) * (Rand_CenteredFloat(2.0f) + 10.0f)) & 0xFFFF; sBunnyEarKinematics.angVel.x += force.x >> 2; sBunnyEarKinematics.angVel.y += force.y >> 2; @@ -1801,7 +1799,7 @@ void Player_AdjustSingleLeg(PlayState* play, Player* player, SkelAnime* skelAnim temp_f20 = sp74 - SQ(sp58); temp_f20 = (temp_f20 < 0.0f) ? 0.0f : sqrtf(temp_f20); - sp4C = func_80086B30(temp_f20, sp58); + sp4C = Math_FAtan2F(temp_f20, sp58); distance = sqrtf(SQ(diffX) + SQ(yIntersect - sp90.y) + SQ(diffZ)); sp58 = (SQ(distance) + sp70) / (2.0f * distance); sp54 = distance - sp58; @@ -1809,8 +1807,8 @@ void Player_AdjustSingleLeg(PlayState* play, Player* player, SkelAnime* skelAnim temp_f20 = sp74 - SQ(sp58); temp_f20 = (temp_f20 < 0.0f) ? 0.0f : sqrtf(temp_f20); - sp48 = func_80086B30(temp_f20, sp58); - phi_t1 = (M_PI - (func_80086B30(sp54, temp_f20) + ((M_PI / 2.0f) - sp48))) * (0x8000 / M_PI); + sp48 = Math_FAtan2F(temp_f20, sp58); + phi_t1 = (M_PI - (Math_FAtan2F(sp54, temp_f20) + ((M_PI / 2.0f) - sp48))) * (0x8000 / M_PI); phi_t1 = -skelAnime->jointTable[shinLimbIndex].z + phi_t1; temp_f8 = (sp48 - sp4C) * (0x8000 / M_PI); diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 35886da186..90d09a4b1e 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -577,7 +577,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) { diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); if (((px * actor->world.pos.x) + (pz * actor->world.pos.z) + d) > 0.0f) { reached = true; } diff --git a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c index 2c99197288..f47bf43947 100644 --- a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c +++ b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c @@ -64,10 +64,11 @@ void func_808D75F0(BgF40Flift* this, PlayState* play) { } this->timer--; if (this->dyna.actor.params == 1) { - this->dyna.actor.world.pos.y = (sin_rad(this->timer * (M_PI / 24.0f)) * 5.0f) + this->dyna.actor.home.pos.y; + this->dyna.actor.world.pos.y = + (Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f) + this->dyna.actor.home.pos.y; } else { this->dyna.actor.world.pos.y = - (sin_rad(this->timer * (M_PI / 24.0f)) * 5.0f) + (926.8f + this->dyna.actor.home.pos.y); + (Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f) + (926.8f + this->dyna.actor.home.pos.y); } } } @@ -76,7 +77,7 @@ void func_808D7714(BgF40Flift* this, PlayState* play) { if (this->timer != 0) { this->timer--; this->dyna.actor.world.pos.y = - (((cos_rad(this->timer * (M_PI / 96.0f)) * this->dyna.actor.params) + 1.0f) * 463.4f) + + (((Math_CosF(this->timer * (M_PI / 96.0f)) * this->dyna.actor.params) + 1.0f) * 463.4f) + this->dyna.actor.home.pos.y; } else { this->dyna.actor.params = -this->dyna.actor.params; diff --git a/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c b/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c index bf6244efe8..039d20f3cb 100644 --- a/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c +++ b/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c @@ -105,7 +105,7 @@ void BgF40Swlift_Update(Actor* thisx, PlayState* play2) { } this->timer--; this->dyna.actor.world.pos.y = - sHeights[this->dyna.actor.params] + (sin_rad(this->timer * (M_PI / 24.0f)) * 5.0f); + sHeights[this->dyna.actor.params] + (Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f); } } diff --git a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c index 15a677c299..50e99c1aa3 100644 --- a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c +++ b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c @@ -96,8 +96,8 @@ void BgIcefloe_Grow(BgIcefloe* this, PlayState* play) { Vec3f velocity; Vec3f position; - velocity.x = randPlusMinusPoint5Scaled(6.0f); - velocity.z = randPlusMinusPoint5Scaled(6.0f); + velocity.x = Rand_CenteredFloat(6.0f); + velocity.z = Rand_CenteredFloat(6.0f); velocity.y = Rand_ZeroFloat(4.0f) + 4.0f; this->dyna.actor.scale.x += (0.65f * 0.01f); this->dyna.actor.scale.z += (0.65f * 0.01f); @@ -127,7 +127,7 @@ void func_80AC4C34(BgIcefloe* this, PlayState* play) { func_80AC4CF0(this); } else { this->dyna.actor.world.pos.y = - (sin_rad(this->timer * (M_PI / 30.0f)) * 3.0f) + (this->dyna.actor.home.pos.y + 10.0f); + (Math_SinF(this->timer * (M_PI / 30.0f)) * 3.0f) + (this->dyna.actor.home.pos.y + 10.0f); } } @@ -144,8 +144,8 @@ void func_80AC4D2C(BgIcefloe* this, PlayState* play) { Vec3f position; velocity.y = (this->timer - 38) * (1 / 12.0f); - velocity.x = randPlusMinusPoint5Scaled(1.5f) * velocity.y; - velocity.z = randPlusMinusPoint5Scaled(1.5f) * velocity.y; + velocity.x = Rand_CenteredFloat(1.5f) * velocity.y; + velocity.z = Rand_CenteredFloat(1.5f) * velocity.y; velocity.y += 0.8f; position.x = this->dyna.actor.world.pos.x + (2.0f * velocity.x); position.z = this->dyna.actor.world.pos.z + (2.0f * velocity.z); diff --git a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c index 740d807d85..a8eea26411 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c @@ -109,12 +109,12 @@ void BgIcicle_Break(BgIcicle* this, PlayState* play, f32 arg2) { for (i = 0; i < 2; i++) { for (j = 0; j < 10; j++) { - pos.x = this->dyna.actor.world.pos.x + randPlusMinusPoint5Scaled(8.0f); + pos.x = this->dyna.actor.world.pos.x + Rand_CenteredFloat(8.0f); pos.y = this->dyna.actor.world.pos.y + (Rand_ZeroOne() * arg2) + (i * arg2); - pos.z = this->dyna.actor.world.pos.z + randPlusMinusPoint5Scaled(8.0f); + pos.z = this->dyna.actor.world.pos.z + Rand_CenteredFloat(8.0f); - velocity.x = randPlusMinusPoint5Scaled(7.0f); - velocity.z = randPlusMinusPoint5Scaled(7.0f); + velocity.x = Rand_CenteredFloat(7.0f); + velocity.z = Rand_CenteredFloat(7.0f); velocity.y = (Rand_ZeroOne() * 4.0f) + 8.0f; EffectSsEnIce_Spawn(play, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &velocity, &accel, &primColor, &envColor, diff --git a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c index fa80cbf900..c11df8af10 100644 --- a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c +++ b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c @@ -240,7 +240,7 @@ void func_809CE234(BgSpdweb* this, PlayState* play) { spA8.y = this->dyna.actor.world.pos.y; for (i = 0; i < 6; i++) { - temp_s0 = (s32)randPlusMinusPoint5Scaled(10240.0f) + phi_s2; + temp_s0 = (s32)Rand_CenteredFloat(0x2800) + phi_s2; temp_f24 = Math_SinS(temp_s0); temp_f22 = Math_CosS(temp_s0); @@ -323,7 +323,8 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { this->unk_162--; } - this->dyna.actor.world.pos.y = (sin_rad(this->unk_162 * (M_PI / 6)) * this->unk_164) + this->dyna.actor.home.pos.y; + this->dyna.actor.world.pos.y = + (Math_SinF(this->unk_162 * (M_PI / 6)) * this->unk_164) + this->dyna.actor.home.pos.y; Math_ApproachZeroF(&this->unk_164, 1.0f, 0.8f); if (this->unk_162 == 4) { @@ -388,7 +389,7 @@ void func_809CE830(BgSpdweb* this, PlayState* play) { spC4.z = this->dyna.actor.world.pos.z + 90.0f * sinQ * cosF1; for (i = 0; i < 6; i++) { - temp_s0 = (s32)randPlusMinusPoint5Scaled(0x2800) + temp_s3; + temp_s0 = (s32)Rand_CenteredFloat(0x2800) + temp_s3; sinF2 = Math_SinS(temp_s0); cosF2 = Math_CosS(temp_s0); diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 7220b5d061..5b19594fb2 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -485,9 +485,9 @@ void Boss02_SpawnEffectSand(TwinmoldEffect* effects, Vec3f* pos, f32 scale) { if (effects->type == TWINMOLD_EFFECT_NONE) { effects->type = TWINMOLD_EFFECT_SAND; effects->pos = *pos; - effects->velocity.x = randPlusMinusPoint5Scaled(30.0f); + effects->velocity.x = Rand_CenteredFloat(30.0f); effects->velocity.y = Rand_ZeroFloat(7.0f) + 7.0f; - effects->velocity.z = randPlusMinusPoint5Scaled(30.0f); + effects->velocity.z = Rand_CenteredFloat(30.0f); effects->accel.y = -0.3f; effects->scale = scale; effects->alpha = 255; @@ -507,9 +507,9 @@ void Boss02_SpawnEffectFragment(TwinmoldEffect* effects, Vec3f* pos) { effects->type = TWINMOLD_EFFECT_FRAGMENT; effects->pos = *pos; effects->timer = Rand_ZeroFloat(20.0f); - effects->velocity.x = randPlusMinusPoint5Scaled(50.0f); - effects->velocity.y = randPlusMinusPoint5Scaled(50.0f); - effects->velocity.z = randPlusMinusPoint5Scaled(50.0f); + effects->velocity.x = Rand_CenteredFloat(50.0f); + effects->velocity.y = Rand_CenteredFloat(50.0f); + effects->velocity.z = Rand_CenteredFloat(50.0f); effects->accel.z = 0.0f; effects->accel.x = 0.0f; effects->accel.y = -1.5f; @@ -774,8 +774,8 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->actor.world.pos.z = player->actor.world.pos.z; this->actor.world.pos.y = player->actor.world.pos.y - (600.0f * D_809DF5B0); } else { - this->actor.world.pos.x = randPlusMinusPoint5Scaled(5000.0f * D_809DF5B0); - this->actor.world.pos.z = randPlusMinusPoint5Scaled(5000.0f * D_809DF5B0); + this->actor.world.pos.x = Rand_CenteredFloat(5000.0f * D_809DF5B0); + this->actor.world.pos.z = Rand_CenteredFloat(5000.0f * D_809DF5B0); this->actor.world.pos.y = -500.0f * D_809DF5B0; if (sIsInGiantMode) { this->actor.world.pos.y += 3150.0f; @@ -802,8 +802,8 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_0146[0] = 150; } else { this->unk_0144 = 2; - this->unk_01B0.x = randPlusMinusPoint5Scaled(3000.0f * D_809DF5B0); - this->unk_01B0.z = randPlusMinusPoint5Scaled(3000.0f * D_809DF5B0); + this->unk_01B0.x = Rand_CenteredFloat(3000.0f * D_809DF5B0); + this->unk_01B0.z = Rand_CenteredFloat(3000.0f * D_809DF5B0); if ((fabsf(this->unk_01B0.x) < (500.0f * D_809DF5B0)) && (fabsf(this->unk_01B0.z) < (500.0f * D_809DF5B0))) { this->unk_01B0.x = 500.0f; @@ -847,12 +847,12 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_01B0.z = player->actor.world.pos.z; if (this->unk_0146[0] == 0) { this->unk_0144 = 3; - this->unk_01B0.x = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + this->actor.world.pos.x; + this->unk_01B0.x = Rand_CenteredFloat(500.0f * D_809DF5B0) + this->actor.world.pos.x; this->unk_01B0.y = -3000.0f * D_809DF5B0; if (sIsInGiantMode) { this->unk_01B0.y += 3150.0f; } - this->unk_01B0.z = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + this->actor.world.pos.z; + this->unk_01B0.z = Rand_CenteredFloat(500.0f * D_809DF5B0) + this->actor.world.pos.z; this->unk_0146[0] = 150; this->unk_0164 = 0.0f; } @@ -917,7 +917,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { Matrix_MultVecZ(1500.0f * D_809DF5B0, &spA4); this->unk_0146[0] = 50; this->unk_01B0.x = player->actor.world.pos.x + spA4.x; - this->unk_01B0.y = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + (600.0f * D_809DF5B0); + this->unk_01B0.y = Rand_CenteredFloat(500.0f * D_809DF5B0) + (600.0f * D_809DF5B0); if (sIsInGiantMode) { this->unk_01B0.y += 3150.0f; } @@ -963,7 +963,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->actor.gravity = -1.0f * D_809DF5B0; this->actor.velocity.y = 0.0f; this->actor.terminalVelocity = -1000.0f * D_809DF5B0; - this->unk_0164 = randPlusMinusPoint5Scaled(0.05f); + this->unk_0164 = Rand_CenteredFloat(0.05f); spCC = player->actor.world.pos.x - this->actor.world.pos.x; spC4 = player->actor.world.pos.z - this->actor.world.pos.z; @@ -1205,16 +1205,16 @@ void Boss02_Twinmold_Update(Actor* thisx, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_INBOSS_SAND_OLD - SFX_FLAG); if (this->unk_0144 > 20) { - sp3C.x = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.x; - sp3C.y = randPlusMinusPoint5Scaled(50.0f * D_809DF5B0) + this->unk_0170.y; - sp3C.z = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.z; + sp3C.x = Rand_CenteredFloat(100.0f * D_809DF5B0) + this->unk_0170.x; + sp3C.y = Rand_CenteredFloat(50.0f * D_809DF5B0) + this->unk_0170.y; + sp3C.z = Rand_CenteredFloat(100.0f * D_809DF5B0) + this->unk_0170.z; Boss02_SpawnEffectSand(play->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f); } if ((this->unk_014C % 2) == 0) { - sp3C.x = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.x; - sp3C.y = randPlusMinusPoint5Scaled(50.0f * D_809DF5B0) + this->unk_0170.y; - sp3C.z = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.z; + sp3C.x = Rand_CenteredFloat(100.0f * D_809DF5B0) + this->unk_0170.x; + sp3C.y = Rand_CenteredFloat(50.0f * D_809DF5B0) + this->unk_0170.y; + sp3C.z = Rand_CenteredFloat(100.0f * D_809DF5B0) + this->unk_0170.z; Boss02_SpawnEffectSand(play->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f); } } 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 ddd9d48301..d44c961e99 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -162,8 +162,8 @@ void Boss03_SpawnEffectDroplet(PlayState* play, Vec3f* pos) { eff->unk_34.y = 0.0f; eff->unk_34.z = Rand_ZeroFloat(2 * M_PI); eff->unk_02 = Rand_ZeroFloat(100.0f); - eff->velocity.x = randPlusMinusPoint5Scaled(25.0f); - eff->velocity.z = randPlusMinusPoint5Scaled(25.0f); + eff->velocity.x = Rand_CenteredFloat(25.0f); + eff->velocity.z = Rand_CenteredFloat(25.0f); return; } @@ -425,17 +425,17 @@ void Boss03_SpawnDust(Boss03* this, PlayState* play) { Vec3f accel; for (i = 0; i < 5; i++) { - velocity.x = randPlusMinusPoint5Scaled(10.0f); + velocity.x = Rand_CenteredFloat(10.0f); velocity.y = Rand_ZeroFloat(2.0f) + 2.0f; - velocity.z = randPlusMinusPoint5Scaled(10.0f); + velocity.z = Rand_CenteredFloat(10.0f); accel.y = -0.075f; accel.z = 0.0f; accel.x = 0.0f; pos.y = Rand_ZeroFloat(20.0f) + 5.0f; - pos.z = randPlusMinusPoint5Scaled(150.0f) + this->insideJawPos.z; - pos.x = randPlusMinusPoint5Scaled(150.0f) + this->insideJawPos.x; + pos.z = Rand_CenteredFloat(150.0f) + this->insideJawPos.z; + pos.x = Rand_CenteredFloat(150.0f) + this->insideJawPos.x; func_800B0EB0(play, &pos, &velocity, &accel, &sGyorgDustPrimColor, &sGyorgDustEnvColor, Rand_ZeroFloat(200.0f) + 400.0f, 10, Rand_ZeroFloat(10.0f) + 25.0f); @@ -597,9 +597,9 @@ void func_809E34B8(Boss03* this, PlayState* play) { if (this->workTimer[WORK_TIMER_UNK2_A] == 0) { if ((sqrtf(SQ(xDiff) + SQ(zDiff)) < 100.0f) || (this->workTimer[WORK_TIMER_UNK0_A] == 0)) { for (i = 0; i < 200; i++) { - this->unk_268.x = randPlusMinusPoint5Scaled(2500.0f); + this->unk_268.x = Rand_CenteredFloat(2500.0f); this->unk_268.y = Rand_ZeroFloat(100.0f) + 150.0f; - this->unk_268.z = randPlusMinusPoint5Scaled(2500.0f); + this->unk_268.z = Rand_CenteredFloat(2500.0f); xDiff = this->unk_268.x - this->actor.world.pos.x; zDiff = this->unk_268.z - this->actor.world.pos.z; @@ -1100,9 +1100,9 @@ void Boss03_JumpOverPlatform(Boss03* this, PlayState* play) { Vec3f sp30; for (i = 0; i < 3; i++) { - sp30.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(150.0f); + sp30.x = this->actor.world.pos.x + Rand_CenteredFloat(150.0f); sp30.y = this->actor.world.pos.y; - sp30.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(150.0f); + sp30.z = this->actor.world.pos.z + Rand_CenteredFloat(150.0f); Boss03_SpawnEffectDroplet(play, &sp30); } } @@ -1337,9 +1337,9 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { if (1) {} for (i = 0; i < 3; i++) { - effectPos.x = randPlusMinusPoint5Scaled(150.0f) + this->actor.world.pos.x; + effectPos.x = Rand_CenteredFloat(150.0f) + this->actor.world.pos.x; effectPos.y = this->actor.world.pos.y; - effectPos.z = randPlusMinusPoint5Scaled(150.0f) + this->actor.world.pos.z; + effectPos.z = Rand_CenteredFloat(150.0f) + this->actor.world.pos.z; Boss03_SpawnEffectDroplet(play, &effectPos); } @@ -1399,9 +1399,9 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { this->subCamEye = this->actor.world.pos; for (i = 0; i < bubblesToSpawnNum; i++) { - effectPos.x = randPlusMinusPoint5Scaled(100.0f) + this->subCamAt.x; - effectPos.y = (randPlusMinusPoint5Scaled(100.0f) + this->subCamAt.y) - 150.0f; - effectPos.z = randPlusMinusPoint5Scaled(100.0f) + this->subCamAt.z; + effectPos.x = Rand_CenteredFloat(100.0f) + this->subCamAt.x; + effectPos.y = (Rand_CenteredFloat(100.0f) + this->subCamAt.y) - 150.0f; + effectPos.z = Rand_CenteredFloat(100.0f) + this->subCamAt.z; Boss03_SpawnEffectBubble(play, &effectPos); } @@ -1573,17 +1573,15 @@ 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)randPlusMinusPoint5Scaled(500.0f) + this->shapeRotTargetX) + 0x8000; + this->shapeRotTargetX = ((s16)(s32)Rand_CenteredFloat(0x1F4) + this->shapeRotTargetX) + 0x8000; } if (Rand_ZeroOne() < 0.5f) { - this->shapeRotTargetZ = - ((s16)randPlusMinusPoint5Scaled(500.0f) + this->shapeRotTargetZ) + 0x8000; + this->shapeRotTargetZ = ((s16)(s32)Rand_CenteredFloat(0x1F4) + this->shapeRotTargetZ) + 0x8000; } if (Rand_ZeroOne() < 0.5f) { - this->shapeRotTargetY = Rand_ZeroFloat(65536.0f); + this->shapeRotTargetY = Rand_ZeroFloat(0x10000); } this->actor.world.rot.y = Math_Atan2S_XY(-this->actor.world.pos.z, -this->actor.world.pos.x); @@ -1600,9 +1598,9 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { sp4C = 150.0f * sp64; for (i = 0; i < 1; i++) { - sp78.x = randPlusMinusPoint5Scaled(sp4C) + this->actor.world.pos.x; + sp78.x = Rand_CenteredFloat(sp4C) + this->actor.world.pos.x; sp78.y = this->actor.world.pos.y; - sp78.z = randPlusMinusPoint5Scaled(sp4C) + this->actor.world.pos.z; + sp78.z = Rand_CenteredFloat(sp4C) + this->actor.world.pos.z; Boss03_SpawnEffectDroplet(play, &sp78); } @@ -2073,9 +2071,9 @@ void Boss03_Update(Actor* thisx, PlayState* play2) { if ((this->unk_240 % 2) == 0) { for (i = 0; i < this->bubbleEffectSpawnCount; i++) { - bubblePos.x = randPlusMinusPoint5Scaled(100.0f) + this->actor.world.pos.x; - bubblePos.y = randPlusMinusPoint5Scaled(100.0f) + this->actor.world.pos.y; - bubblePos.z = randPlusMinusPoint5Scaled(100.0f) + this->actor.world.pos.z; + bubblePos.x = Rand_CenteredFloat(100.0f) + this->actor.world.pos.x; + bubblePos.y = Rand_CenteredFloat(100.0f) + this->actor.world.pos.y; + bubblePos.z = Rand_CenteredFloat(100.0f) + this->actor.world.pos.z; Boss03_SpawnEffectBubble(play, &bubblePos); } @@ -2106,9 +2104,9 @@ void Boss03_Update(Actor* thisx, PlayState* play2) { if (this->wetSpotEffectSpawnCount != 0) { this->wetSpotEffectSpawnCount--; - wetSpotPos.x = randPlusMinusPoint5Scaled(50.0f) + player->actor.world.pos.x; + wetSpotPos.x = Rand_CenteredFloat(50.0f) + player->actor.world.pos.x; wetSpotPos.y = PLATFORM_HEIGHT; - wetSpotPos.z = randPlusMinusPoint5Scaled(50.0f) + player->actor.world.pos.z; + wetSpotPos.z = Rand_CenteredFloat(50.0f) + player->actor.world.pos.z; Boss03_SpawnEffectWetSpot(play, &wetSpotPos); } } @@ -2131,9 +2129,9 @@ void Boss03_Update(Actor* thisx, PlayState* play2) { for (j = 0, i = 0; i < 20; j++) { Matrix_RotateYF(yRot, MTXMODE_NEW); Matrix_MultVecZ(Rand_ZeroFloat(60.000004f) + 312.0f, &dropletPos); - dropletPos.x += this->unk_284 + randPlusMinusPoint5Scaled(40.0f); + dropletPos.x += this->unk_284 + Rand_CenteredFloat(40.0f); dropletPos.y = PLATFORM_HEIGHT; - dropletPos.z += this->unk_28C + randPlusMinusPoint5Scaled(40.0f); + dropletPos.z += this->unk_28C + Rand_CenteredFloat(40.0f); if (sqrtf(SQ(dropletPos.x) + SQ(dropletPos.z)) < 355.0f) { Boss03_SpawnEffectDroplet(play, &dropletPos); 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 bf250ca183..4e22822a48 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -439,8 +439,8 @@ void func_809ECD18(Boss04* this, PlayState* play) { if (Rand_ZeroOne() < 0.1f) { Math_Vec3f_Copy(&this->unk_6C8, &player->actor.world.pos); } else { - this->unk_6C8.x = randPlusMinusPoint5Scaled(600.0f) + this->unk_6E8; - this->unk_6C8.z = randPlusMinusPoint5Scaled(600.0f) + this->unk_6F0; + this->unk_6C8.x = Rand_CenteredFloat(600.0f) + this->unk_6E8; + this->unk_6C8.z = Rand_CenteredFloat(600.0f) + this->unk_6F0; } } diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index ef73ef2dd6..742b3bb705 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -110,7 +110,7 @@ void EffDust_Destroy(Actor* thisx, PlayState* play) { void func_80918D64(EffDust* this, PlayState* play) { s16 theta; - s16 fi; + s16 phi; s32 i; s32 j; f32* distanceTraveled = this->distanceTraveled; @@ -127,10 +127,10 @@ void func_80918D64(EffDust* this, PlayState* play) { i = this->index & 0x3F; if (this->distanceTraveled[i] >= 1.0f) { // Spherical coordinate system. - fi = randPlusMinusPoint5Scaled(0x10000); + phi = Rand_CenteredFloat(0x10000); theta = Rand_ZeroFloat(0x1000); - this->initialPositions[i].x = -(f32)this->actor.home.rot.z * Math_CosS(fi) * Math_CosS(theta); - this->initialPositions[i].y = -(f32)this->actor.home.rot.z * Math_SinS(fi) * Math_CosS(theta); + this->initialPositions[i].x = -(f32)this->actor.home.rot.z * Math_CosS(phi) * Math_CosS(theta); + this->initialPositions[i].y = -(f32)this->actor.home.rot.z * Math_SinS(phi) * Math_CosS(theta); this->initialPositions[i].z = -(f32)this->actor.home.rot.z * Math_SinS(theta); this->distanceTraveled[i] = 0.0f; this->index++; @@ -141,7 +141,7 @@ void func_80918D64(EffDust* this, PlayState* play) { void func_80918FE4(EffDust* this, PlayState* play) { s16 theta; - s16 fi; + s16 phi; f32* distanceTraveled = this->distanceTraveled; s32 i; s32 j; @@ -157,11 +157,11 @@ void func_80918FE4(EffDust* this, PlayState* play) { i = this->index & 0x3F; if (this->distanceTraveled[i] >= 1.0f) { // Spherical coordinate system. - fi = randPlusMinusPoint5Scaled(0x10000); + phi = Rand_CenteredFloat(0x10000); theta = Rand_ZeroFloat(0x2000); - this->initialPositions[i].x = 400.0f * Math_CosS(fi) * Math_CosS(theta); + this->initialPositions[i].x = 400.0f * Math_CosS(phi) * Math_CosS(theta); this->initialPositions[i].y = 400.0f * Math_SinS(theta); - this->initialPositions[i].z = 400.0f * Math_SinS(fi) * Math_CosS(theta); + this->initialPositions[i].z = 400.0f * Math_SinS(phi) * Math_CosS(theta); this->distanceTraveled[i] = 0.0f; this->index++; } @@ -206,7 +206,7 @@ void func_80919230(EffDust* this, PlayState* play) { i = this->index & 0x3F; if (this->distanceTraveled[i] >= 1.0f) { - theta = randPlusMinusPoint5Scaled(0x10000); + theta = Rand_CenteredFloat(0x10000); switch (this->actor.params) { case EFF_DUST_TYPE_SPIN_ATTACK_CHARGE: this->initialPositions[i].x = (Rand_ZeroOne() * 4500.0f) + 700.0f; diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 5fcf75fdf9..6e56cc6098 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -179,7 +179,7 @@ s32 func_80BECD10(EnAkindonuts* this, Path* path, s32 arg2) { phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { sp50 = true; } diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index b6d32f6ec4..7d1f1e140a 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -193,9 +193,9 @@ void EnAm_SpawnEffects(EnAm* this, PlayState* play) { // Dust Clouds that spawn from the hop for (i = 4; i > 0; i--) { - effectPos.x = randPlusMinusPoint5Scaled(65.0f) + this->actor.world.pos.x; - effectPos.y = randPlusMinusPoint5Scaled(10.0f) + (this->actor.world.pos.y + 40.0f); - effectPos.z = randPlusMinusPoint5Scaled(65.0f) + this->actor.world.pos.z; + effectPos.x = Rand_CenteredFloat(65.0f) + this->actor.world.pos.x; + effectPos.y = Rand_CenteredFloat(10.0f) + (this->actor.world.pos.y + 40.0f); + effectPos.z = Rand_CenteredFloat(65.0f) + this->actor.world.pos.z; EffectSsKirakira_SpawnSmall(play, &effectPos, &sVelocity, &sAccel, &D_808B1118, &D_808B111C); } Actor_PlaySfx(&this->actor, NA_SE_EN_AMOS_WALK); @@ -254,7 +254,7 @@ void EnAm_ApplyEnemyTexture(EnAm* this, PlayState* play) { func_808B0358(this); } else { tempTextureBlend = this->textureBlend + 20; - rand = randPlusMinusPoint5Scaled(10.0f); + rand = Rand_CenteredFloat(10.0f); cos = Math_CosS(this->actor.shape.rot.y) * rand; sin = Math_SinS(this->actor.shape.rot.y) * rand; this->actor.world.pos.x = this->actor.home.pos.x + cos; @@ -433,7 +433,7 @@ void func_808B0894(EnAm* this, PlayState* play) { for (i = 0; i < 8; i++) { dustPos.x = (Math_SinS(0) * 7.0f) + this->actor.world.pos.x; - dustPos.y = (randPlusMinusPoint5Scaled(10.0f) * 6.0f) + (this->actor.world.pos.y + 40.0f); + dustPos.y = (Rand_CenteredFloat(10.0f) * 6.0f) + (this->actor.world.pos.y + 40.0f); dustPos.z = (Math_CosS(0) * 7.0f) + this->actor.world.pos.z; func_800B0EB0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &D_808B1120, &D_808B1124, 200, 45, 12); 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 5f0ef2edf3..e47a726a43 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -336,7 +336,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)randPlusMinusPoint5Scaled(8000.0f)); + this->actor.world.rot.y += BINANG_ROT180((s16)(s32)Rand_CenteredFloat(0x1F40)); this->actor.velocity.y = -this->actor.velocity.y; this->bubble.unk_149 = -1; return; 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 8c2b4eb4bb..e8b74f8ece 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 @@ -54,9 +54,9 @@ void EnAttackNiw_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); this->actor.gravity = 0.0f; - this->randomTargetCenterOffset.x = randPlusMinusPoint5Scaled(100.0f); - this->randomTargetCenterOffset.y = randPlusMinusPoint5Scaled(10.0f); - this->randomTargetCenterOffset.z = randPlusMinusPoint5Scaled(100.0f); + this->randomTargetCenterOffset.x = Rand_CenteredFloat(100.0f); + this->randomTargetCenterOffset.y = Rand_CenteredFloat(10.0f); + this->randomTargetCenterOffset.z = Rand_CenteredFloat(100.0f); Actor_SetScale(&this->actor, 0.01f); this->actor.flags &= ~ACTOR_FLAG_1; // Unnecessary: this actor does not start with this flag @@ -311,7 +311,7 @@ void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, PlayState* play) { } if (this->randomAngleChangeTimer == 50) { - this->targetRotY = randPlusMinusPoint5Scaled(200.0f) + this->actor.yawTowardsPlayer; + this->targetRotY = Rand_CenteredFloat(200.0f) + this->actor.yawTowardsPlayer; } Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 2, this->rotStep, 0); 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 4ea6bc4757..406270ff81 100644 --- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c +++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c @@ -449,9 +449,9 @@ void EnBaguo_InitializeEffect(EnBaguo* this, Vec3f* pos, Vec3f* velocity, Vec3f* effect->accel = *accel; effect->scale = scale; effect->timer = timer; - effect->rotation.x = (s16)randPlusMinusPoint5Scaled(30000.0f); - effect->rotation.y = (s16)randPlusMinusPoint5Scaled(30000.0f); - effect->rotation.z = (s16)randPlusMinusPoint5Scaled(30000.0f); + effect->rotation.x = (s16)(s32)Rand_CenteredFloat(0x7530); + effect->rotation.y = (s16)(s32)Rand_CenteredFloat(0x7530); + effect->rotation.z = (s16)(s32)Rand_CenteredFloat(0x7530); return; } } diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index 549a2c4bd3..acb47b7432 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -161,11 +161,10 @@ void EnBat_Init(Actor* thisx, PlayState* play) { EnBat_SetupFlyIdle(this); while (BAD_BAT_GET_NUMBER_TO_SPAWN(thisx) > 1) { Actor_SpawnAsChildAndCutscene( - &play->actorCtx, play, ACTOR_EN_BAT, thisx->world.pos.x + randPlusMinusPoint5Scaled(200.0f), - thisx->world.pos.y + randPlusMinusPoint5Scaled(100.0f), - thisx->world.pos.z + randPlusMinusPoint5Scaled(200.0f), randPlusMinusPoint5Scaled(0x2000), - 0xFFFF * Rand_ZeroOne(), 0, BAD_BAT_PARAMS(this->switchFlag, this->paramFlags, 0), CS_ID_NONE, - thisx->halfDaysBits, NULL); + &play->actorCtx, play, ACTOR_EN_BAT, thisx->world.pos.x + Rand_CenteredFloat(200.0f), + thisx->world.pos.y + Rand_CenteredFloat(100.0f), thisx->world.pos.z + Rand_CenteredFloat(200.0f), + Rand_CenteredFloat(0x2000), 0xFFFF * Rand_ZeroOne(), 0, + BAD_BAT_PARAMS(this->switchFlag, this->paramFlags, 0), CS_ID_NONE, thisx->halfDaysBits, NULL); BAD_BAT_GET_NUMBER_TO_SPAWN(thisx)--; } } 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 9fabcecc0f..d52f12ccff 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -340,7 +340,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)randPlusMinusPoint5Scaled(73728.0f); + this->actor.shape.rot.y += (s16)(s32)Rand_CenteredFloat(0x12000); } this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; diff --git a/src/overlays/actors/ovl_En_Bee/z_en_bee.c b/src/overlays/actors/ovl_En_Bee/z_en_bee.c index c03cc005d6..1c2d1ed0f0 100644 --- a/src/overlays/actors/ovl_En_Bee/z_en_bee.c +++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.c @@ -158,9 +158,9 @@ void EnBee_FlyIdle(EnBee* this, PlayState* play) { nextPos.z += Math_CosS(this->targetYaw) * 30.0f; if ((this->instanceId % 2) == 0) { - this->targetYaw += (s16)((s32)randPlusMinusPoint5Scaled(1000.0f) + 4000); + this->targetYaw += (s16)((s32)Rand_CenteredFloat(1000.0f) + 4000); } else { - this->targetYaw -= (s16)((s32)randPlusMinusPoint5Scaled(1000.0f) + 4000); + this->targetYaw -= (s16)((s32)Rand_CenteredFloat(1000.0f) + 4000); } this->flightHoverOffset += 1000; @@ -197,10 +197,10 @@ void EnBee_Attack(EnBee* this, PlayState* play) { yawOffset = (this->instanceId * 0x700) + 0x2000; for (i = 0; i < 2; i++) { - rand = randPlusMinusPoint5Scaled(20.0f); + rand = Rand_CenteredFloat(20.0f); nextPos.x += Math_SinS((f32)this->actor.yawTowardsPlayer + this->targetYaw + yawOffset) * (rand + 30.0f); nextPos.y = (Math_SinS(this->flightHoverOffset) * 10.0f) + (player->actor.floorHeight + 40.0f); - rand = randPlusMinusPoint5Scaled(20.0f); + rand = Rand_CenteredFloat(20.0f); nextPos.z += Math_CosS((f32)this->actor.yawTowardsPlayer + this->targetYaw + yawOffset) * (rand + 30.0f); Math_Vec3f_Copy(&this->targetPos[i], &nextPos); @@ -210,14 +210,12 @@ void EnBee_Attack(EnBee* this, PlayState* play) { Math_Vec3f_Copy(&nextPos, &this->targetPos[this->posIndex]); if ((this->instanceId % 2) == 0) { - this->targetYaw += - (this->instanceId * 0x700) + (s32)randPlusMinusPoint5Scaled((this->instanceId * 0x700) * 0.5f); + this->targetYaw += (this->instanceId * 0x700) + (s32)Rand_CenteredFloat((this->instanceId * 0x700) * 0.5f); } else { - this->targetYaw -= - (this->instanceId * 0x700) + (s32)randPlusMinusPoint5Scaled((this->instanceId * 0x700) * 0.5f); + this->targetYaw -= (this->instanceId * 0x700) + (s32)Rand_CenteredFloat((this->instanceId * 0x700) * 0.5f); } - this->flightHoverOffset += (s32)randPlusMinusPoint5Scaled(500.0f) + 1000; + this->flightHoverOffset += (s32)Rand_CenteredFloat(500.0f) + 1000; if (this->targetYaw > 0x10000) { this->targetYaw = 0; diff --git a/src/overlays/actors/ovl_En_Bh/z_en_bh.c b/src/overlays/actors/ovl_En_Bh/z_en_bh.c index cdd7abee3b..6d99ada15b 100644 --- a/src/overlays/actors/ovl_En_Bh/z_en_bh.c +++ b/src/overlays/actors/ovl_En_Bh/z_en_bh.c @@ -59,9 +59,9 @@ void func_80C22DEC(EnBh* this, PlayState* play) { xzDist = sqrtf(SQ(xDiff) + SQ(zDiff)); if ((this->timer2 == 0) || (xzDist < 100.0f)) { - this->pos.x = randPlusMinusPoint5Scaled(300.0f) + this->actor.home.pos.x; - this->pos.y = randPlusMinusPoint5Scaled(100.0f) + this->actor.home.pos.y; - this->pos.z = randPlusMinusPoint5Scaled(300.0f) + this->actor.home.pos.z; + this->pos.x = Rand_CenteredFloat(300.0f) + this->actor.home.pos.x; + this->pos.y = Rand_CenteredFloat(100.0f) + this->actor.home.pos.y; + this->pos.z = Rand_CenteredFloat(300.0f) + this->actor.home.pos.z; this->timer2 = Rand_ZeroFloat(50.0f) + 30.0f; this->step = 0; } @@ -85,7 +85,7 @@ void func_80C22DEC(EnBh* this, PlayState* play) { this->skelanime.playSpeed = 1.0f; this->timer = Rand_ZeroFloat(70.0f) + 50.0f; } else if (((this->timer & 7) == 7) && (Rand_ZeroOne() < 0.5f)) { - this->unk1E4 = randPlusMinusPoint5Scaled(3000.0f); + this->unk1E4 = Rand_CenteredFloat(3000.0f); } } else { SkelAnime_Update(&this->skelanime); 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 713410f236..1b849799a2 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -436,9 +436,9 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { bubblePos.y = this->picto.actor.world.pos.y; for (i = 0; i < 20; i++) { - bubbleVel.x = randPlusMinusPoint5Scaled(10.0f); + bubbleVel.x = Rand_CenteredFloat(10.0f); bubbleVel.y = Rand_ZeroFloat(5.5f) + 5.5f; - bubbleVel.z = randPlusMinusPoint5Scaled(10.0f); + bubbleVel.z = Rand_CenteredFloat(10.0f); bubblePos.x = this->picto.actor.world.pos.x + (2.0f * bubbleVel.x); bubblePos.z = this->picto.actor.world.pos.z + (2.0f * bubbleVel.z); @@ -604,7 +604,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec MTXMODE_APPLY); } } else if (this->actionFunc == EnBigokuta_SuckInPlayer) { - f32 sin = sin_rad(this->timer * (M_PI / 3.0f)) * 0.5f; + f32 sin = Math_SinF(this->timer * (M_PI / 3.0f)) * 0.5f; Matrix_Scale(((this->timer * (2 / 90.0f)) * (0.5f + sin)) + 1.0f, ((this->timer * (2 / 90.0f)) * (0.5f - sin)) + 1.0f, 1.0f - ((this->timer * 0.3f) / 9.0f), @@ -613,7 +613,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec if (this->timer == 0) { Matrix_Scale(0.9f, 0.9f, 1.15f, MTXMODE_APPLY); } else if (this->timer > 0) { - f32 sin = sin_rad(this->timer * (M_PI / 3.0f)) * 0.5f; + f32 sin = Math_SinF(this->timer * (M_PI / 3.0f)) * 0.5f; Matrix_Scale(((0.5f + sin) * 0.2f) + 1.0f, ((0.5f - sin) * 0.2f) + 1.0f, 0.7f, MTXMODE_APPLY); } else { diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index a77733d311..3daaf1f853 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -267,7 +267,7 @@ void func_80A27B58(EnBigpamet* this) { this->unk_2A2 = 40; for (ptr = &this->unk_2FC[0], i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) { - temp_s1 = (s32)randPlusMinusPoint5Scaled(20480.0f) + this->actor.wallYaw; + temp_s1 = (s32)Rand_CenteredFloat(0x5000) + this->actor.wallYaw; temp_s2 = Rand_S16Offset(0x1000, 0x3000); temp_fs2 = Math_SinS(temp_s2); @@ -342,7 +342,7 @@ void func_80A27FE8(EnBigpamet* this, PlayState* play) { pos.y += 8.0f; if (this->actionFunc != func_80A28D0C) { - sp32 = (s32)randPlusMinusPoint5Scaled(0x8000) + this->actor.world.rot.y; + sp32 = (s32)Rand_CenteredFloat(0x8000) + this->actor.world.rot.y; pos.x -= 55.0f * Math_SinS(sp32); pos.z -= 55.0f * Math_CosS(sp32); } 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 7c82b50b05..762141ed45 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -554,7 +554,7 @@ void EnBigpo_IdleFlying(EnBigpo* this, PlayState* play) { // flight position calculations this->hoverHeightCycleTimer = (this->hoverHeightCycleTimer == 0) ? 40 : (this->hoverHeightCycleTimer - 1); Math_StepToF(&this->savedHeight, player->actor.world.pos.y + 100.0f, 1.5f); - this->actor.world.pos.y = (sin_rad(this->hoverHeightCycleTimer * (M_PI / 20)) * 10.0f) + this->savedHeight; + this->actor.world.pos.y = (Math_SinF(this->hoverHeightCycleTimer * (M_PI / 20)) * 10.0f) + this->savedHeight; Math_StepToF(&this->actor.speed, 3.0f, 0.2f); func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { @@ -827,7 +827,7 @@ void EnBigpo_ScoopSoulIdle(EnBigpo* this, PlayState* play) { EnBigpo_SetupScoopSoulLeaving(this); } else { Actor_OfferGetItem(&this->actor, play, GI_MAX, 35.0f, 60.0f); - this->actor.world.pos.y = (sin_rad(this->idleTimer * (M_PI / 20)) * 5.0f) + this->savedHeight; + this->actor.world.pos.y = (Math_SinF(this->idleTimer * (M_PI / 20)) * 5.0f) + this->savedHeight; } } 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 1a90fd29b6..695ac91533 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -657,7 +657,7 @@ void EnBigslime_AddWavySurface(EnBigslime* this) { randFloat = (Rand_ZeroOne() * 40.0f) + 50.0f; } - this->vtxSurfacePerturbation[i] = sin_rad((randInt + i) * (M_PI / 3)) * randFloat * 0.001f; + this->vtxSurfacePerturbation[i] = Math_SinF((randInt + i) * (M_PI / 3)) * randFloat * 0.001f; } } @@ -673,7 +673,7 @@ void EnBigslime_UpdateWavySurface(EnBigslime* this) { } this->wavySurfaceTimer--; - vtxSurfaceWave = sin_rad(this->wavySurfaceTimer * (M_PI / 12)); + vtxSurfaceWave = Math_SinF(this->wavySurfaceTimer * (M_PI / 12)); for (i = 0; i < BIGSLIME_NUM_VTX; i++) { staticVtx = &sBigslimeStaticVtx[i]; dynamicVtx = &sBigslimeDynamicVtx[this->dynamicVtxState][i]; @@ -692,9 +692,9 @@ void EnBigslime_InitFallMinislime(EnBigslime* this) { for (i = 0; i < MINISLIME_NUM_SPAWN; i++) { minislime = this->minislime[i]; minislime->actor.params = MINISLIME_INIT_FALL; - minislime->actor.world.pos.x = randPlusMinusPoint5Scaled(80.0f) + (GBT_ROOM_5_MIN_X + ((i % 4) + 1) * 192.0f); + minislime->actor.world.pos.x = Rand_CenteredFloat(80.0f) + (GBT_ROOM_5_MIN_X + ((i % 4) + 1) * 192.0f); minislime->actor.world.pos.y = Rand_ZeroFloat(250.0f) + (GBT_ROOM_5_CENTER_Y + 50.0f); - minislime->actor.world.pos.z = randPlusMinusPoint5Scaled(80.0f) + (GBT_ROOM_5_MIN_Z + ((i / 4) + 1) * 192.0f); + minislime->actor.world.pos.z = Rand_CenteredFloat(80.0f) + (GBT_ROOM_5_MIN_Z + ((i / 4) + 1) * 192.0f); } this->minislimeState = MINISLIME_ACTIVE_INIT_STATE; @@ -1169,7 +1169,7 @@ void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this) { s32 j; for (i = 0; i < BIGSLIME_NUM_RING_FACES / 2; i++) { - vtxY = (((cos_rad(i * (M_PI / 6)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F; + vtxY = (((Math_CosF(i * (M_PI / 6)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F; for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1188,7 +1188,7 @@ void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this) { } for (; i < BIGSLIME_NUM_RING_VTX; i++) { - vtxY = ((cos_rad((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 16)) * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F; + vtxY = ((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 16)) * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F; for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1301,7 +1301,7 @@ void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this) { sBigslimeTargetVtx[0].n.ob[2] = 0; for (i = 1; i < BIGSLIME_NUM_RING_FACES / 2; i++) { - upperSphereCos = (((cos_rad((i - 1) * (M_PI / 5)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F; + upperSphereCos = (((Math_CosF((i - 1) * (M_PI / 5)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F; for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1318,7 +1318,7 @@ void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this) { } for (; i < BIGSLIME_NUM_RING_FACES; i++) { - lowerSphereCos = cos_rad((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / BIGSLIME_NUM_RING_FACES)); + lowerSphereCos = Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / BIGSLIME_NUM_RING_FACES)); for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1361,7 +1361,7 @@ void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this) { sBigslimeTargetVtx[0].n.ob[2] = 0; for (i = 1; i < BIGSLIME_NUM_RING_FACES / 2; i++) { - upperSphereCos = cos_rad((i - 1) * (M_PI / 10)); + upperSphereCos = Math_CosF((i - 1) * (M_PI / 10)); for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1374,7 +1374,7 @@ void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this) { for (; i < BIGSLIME_NUM_RING_FACES; i++) { lowerSphereCos = - (((cos_rad((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 5)) + 1) * 0.925f) + -1.0f) * BIGSLIME_RADIUS_F; + (((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 5)) + 1) * 0.925f) + -1.0f) * BIGSLIME_RADIUS_F; for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1692,7 +1692,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) { EnBigslime_UpdateCameraGrabPlayer(this, play); if (this->windupPunchTimer > 0) { invWindupPunchTimer = 1.0f / this->windupPunchTimer; - scale = cos_rad(this->windupPunchTimer * (M_PI / 27)) + 1.0f; + scale = Math_CosF(this->windupPunchTimer * (M_PI / 27)) + 1.0f; 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 @@ -1705,7 +1705,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) { EnBigslime_GekkoSfxInsideBigslime(this, NA_SE_EN_FROG_PUNCH1); } - scale = 0.5f - cos_rad(-this->windupPunchTimer * (M_PI / 5)) * 0.5f; + scale = 0.5f - Math_CosF(-this->windupPunchTimer * (M_PI / 5)) * 0.5f; if (this->windupPunchTimer == -5) { if (player->stateFlags2 & PLAYER_STATE2_80) { player->actor.parent = NULL; @@ -1879,7 +1879,7 @@ void EnBigslime_Freeze(EnBigslime* this, PlayState* play) { if (vtxIceSeed < BIGSLIME_NUM_VTX) { dynamicVtx = &sBigslimeDynamicVtx[this->dynamicVtxState][vtxIceSeed]; targetVtx = &sBigslimeTargetVtx[vtxIceSeed]; - randFloat = randPlusMinusPoint5Scaled(40.0f); + 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); @@ -2444,9 +2444,9 @@ void EnBigslime_SetupFrogSpawn(EnBigslime* this, PlayState* play) { func_800B0DE0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &dustPrimColor, &dustEnvColor, 500, 50); for (i = 0; i < 25; i++) { - hahenVel.x = randPlusMinusPoint5Scaled(5.0f); + hahenVel.x = Rand_CenteredFloat(5.0f); hahenVel.y = Rand_ZeroFloat(3.0f) + 4.0f; - hahenVel.z = randPlusMinusPoint5Scaled(5.0f); + hahenVel.z = Rand_CenteredFloat(5.0f); EffectSsHahen_Spawn(play, worldPos, &hahenVel, &hahenAccel, 0, Rand_S16Offset(12, 3), HAHEN_OBJECT_DEFAULT, 10, 0); } @@ -2464,7 +2464,8 @@ void EnBigslime_FrogSpawn(EnBigslime* this, PlayState* play) { this->spawnFrogTimer--; // Zoom the camera in and out at the newly spawned red frog - subCamZoom = sin_rad(this->spawnFrogTimer * (M_PI / 5)) * ((0.04f * (this->spawnFrogTimer * 0.1f)) + 0.02f) + 1.0f; + subCamZoom = + Math_SinF(this->spawnFrogTimer * (M_PI / 5)) * ((0.04f * (this->spawnFrogTimer * 0.1f)) + 0.02f) + 1.0f; subCamEye.x = subCam->at.x + (this->subCamDistToFrog.x * subCamZoom); subCamEye.z = subCam->at.z + (this->subCamDistToFrog.z * subCamZoom); subCamEye.y = subCam->at.y + (this->subCamDistToFrog.y * subCamZoom); diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h index f10938b37d..8f2b5bee31 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h @@ -87,7 +87,7 @@ typedef struct EnBigslime { s16 isDespawned; s16 isInitJump; }; - /* 0x02BC */ s16 wavySurfaceTimer; // decrements from 24, used in sin_rad for currData2 + /* 0x02BC */ s16 wavySurfaceTimer; // decrements from 24, used in Math_SinF for currData2 /* 0x02BE */ s16 stunTimer; /* 0x02C0 */ union { s16 freezeTimer; diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index 4355759c76..ee00081db8 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -120,7 +120,7 @@ s32 EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, PlayState return false; } - angle = func_80086C48(normDotUp); + angle = Math_FAcosF(normDotUp); if (angle < 0.001f) { return false; } 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 86cad72197..55f7ff2814 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -236,8 +236,8 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { if (this->unk_2A8 == 0) { Math_Vec3f_Copy(&sp60, &this->actor.home.pos); - sp60.x += randPlusMinusPoint5Scaled(150.0f); - sp60.z += randPlusMinusPoint5Scaled(150.0f); + sp60.x += Rand_CenteredFloat(150.0f); + sp60.z += Rand_CenteredFloat(150.0f); abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp60))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp60, &sp6C, 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 7c2a648411..229a1e6953 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -266,8 +266,8 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) { if (this->unk_2C0 == 0) { Math_Vec3f_Copy(&sp54, &this->actor.home.pos); - sp54.x += randPlusMinusPoint5Scaled(150.0f); - sp54.z += randPlusMinusPoint5Scaled(150.0f); + sp54.x += Rand_CenteredFloat(150.0f); + sp54.z += Rand_CenteredFloat(150.0f); abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp54))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp54, &sp6C, @@ -422,7 +422,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { } sp40.x = (Math_SinS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.x; - sp40.y = this->bombal->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f); + sp40.y = this->bombal->actor.world.pos.y - Rand_CenteredFloat(40.0f); sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.z; SoundSource_PlaySfxAtFixedWorldPos(play, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN); @@ -433,8 +433,8 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { func_80BFE494(this, 5, 1.0f); this->unk_29A = 0; Math_Vec3f_Copy(&this->unk_2A4, &this->actor.home.pos); - this->unk_2A4.x += randPlusMinusPoint5Scaled(150.0f); - this->unk_2A4.z += randPlusMinusPoint5Scaled(150.0f); + this->unk_2A4.x += Rand_CenteredFloat(150.0f); + this->unk_2A4.z += Rand_CenteredFloat(150.0f); this->unk_2A2++; } } 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 3c0f0da54a..fbdcb860f8 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -275,8 +275,8 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) { case 0: if (this->unk_2AE == 0) { Math_Vec3f_Copy(&sp48, &this->actor.home.pos); - sp48.x += randPlusMinusPoint5Scaled(150.0f); - sp48.z += randPlusMinusPoint5Scaled(150.0f); + sp48.x += Rand_CenteredFloat(150.0f); + sp48.z += Rand_CenteredFloat(150.0f); abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp48))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp48, &sp60, diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 4becc2fe6b..8e3e907bb8 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -494,8 +494,8 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { vel.z = cosf(i * (33.0f / 40.0f)) * i * .5f; vel.y = Rand_ZeroFloat(8.0f) + 7.0f; - vel.x += randPlusMinusPoint5Scaled(0.5f); - vel.z += randPlusMinusPoint5Scaled(0.5f); + vel.x += Rand_CenteredFloat(0.5f); + vel.z += Rand_CenteredFloat(0.5f); accel.x = 0.0f; accel.y = -1.0f; diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c index 703585dd47..fa63498717 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c @@ -163,7 +163,7 @@ void func_80AFDFB4(EnColMan* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y < 0.0f)) { if (!this->hasSetRandomValues) { - this->actor.world.rot.y = randPlusMinusPoint5Scaled(30000.0f); + this->actor.world.rot.y = Rand_CenteredFloat(30000.0f); this->actor.speed = 2.0f + BREG(56) + Rand_ZeroFloat(2.0f); this->actor.velocity.y = 12.0f + BREG(57) + Rand_ZeroFloat(5.0f); this->hasSetRandomValues = true; @@ -172,9 +172,9 @@ void func_80AFDFB4(EnColMan* this, PlayState* play) { } for (i = 0; i < 2; i++) { - velocity.x = randPlusMinusPoint5Scaled(2.0f); + velocity.x = Rand_CenteredFloat(2.0f); velocity.y = Rand_ZeroFloat(2.0f) + 1.0f; - velocity.z = randPlusMinusPoint5Scaled(2.0f); + velocity.z = Rand_CenteredFloat(2.0f); accel.y = -0.1f; accel.z = 0.0f; accel.x = 0.0f; 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 ec9a11b4c0..4c88b84cb2 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -552,9 +552,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 * sin_rad(this->skelAnime.curFrame * (M_PI / 4))); + rot->y += (s16)(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4))); } else if (limbIndex == OBJECT_CROW_LIMB_TAIL) { - rot->y += (s16)(0x1400 * sin_rad((this->skelAnime.curFrame + 2.5f) * (M_PI / 4))); + rot->y += (s16)(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4))); } } return false; diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index eaf1839c67..311b6d216d 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -243,9 +243,9 @@ void func_80BE66E4(EnDaiku2* this, PlayState* play) { sp70.y += 40.0f; sp70.z += Math_CosS(this->actor.world.rot.y) * 70.0f; - sp70.x += randPlusMinusPoint5Scaled(5.0f); - sp70.y += randPlusMinusPoint5Scaled(5.0f); - sp70.z += randPlusMinusPoint5Scaled(5.0f); + sp70.x += Rand_CenteredFloat(5.0f); + sp70.y += Rand_CenteredFloat(5.0f); + sp70.z += Rand_CenteredFloat(5.0f); sp88.y = -1.0f; @@ -507,9 +507,9 @@ void func_80BE7504(EnDaiku2* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 ar effect->unk_1C = *arg3; effect->unk_30 = arg4; effect->unk_34 = arg5; - effect->unk_28.x = randPlusMinusPoint5Scaled(30000.0f); - effect->unk_28.y = randPlusMinusPoint5Scaled(30000.0f); - effect->unk_28.z = randPlusMinusPoint5Scaled(30000.0f); + effect->unk_28.x = Rand_CenteredFloat(30000.0f); + effect->unk_28.y = Rand_CenteredFloat(30000.0f); + effect->unk_28.z = Rand_CenteredFloat(30000.0f); break; } } diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 186494268f..422b35e874 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -384,7 +384,7 @@ void EnDekubaba_Grow(EnDekubaba* this, PlayState* play) { this->size * 0.01f * (0.5f + (15 - this->timer) * 0.5f / 15.0f); Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x800); - headDistVertical = sin_rad(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * M_PI) * 32.0f + 14.0f; + headDistVertical = Math_SinF(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * M_PI) * 32.0f + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { headDistHorizontal = 0.0f; @@ -468,7 +468,7 @@ void EnDekubaba_Retract(EnDekubaba* this, PlayState* play) { this->size * 0.01f * (0.5f + this->timer * (1.0f / 30)); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x300); - headDistVertical = (sin_rad(CLAMP_MAX(this->timer * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f; + headDistVertical = (Math_SinF(CLAMP_MAX(this->timer * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { headDistHorizontal = 0.0f; diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index d80013a995..46c6de9791 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -280,7 +280,7 @@ s32 EnDg_HasReachedPoint(EnDg* this, Path* path, s32 pointIndex) { diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; } - func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; @@ -358,9 +358,9 @@ void EnDg_SpawnFloorDustRing(EnDg* this, PlayState* play) { Vec3f pos; if (((this->index + curFrame) % mod) == 0) { - pos.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x; + pos.x = Rand_CenteredFloat(15.0f) + this->actor.world.pos.x; pos.y = this->actor.world.pos.y; - pos.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z; + pos.z = Rand_CenteredFloat(15.0f) + this->actor.world.pos.z; Actor_SpawnFloorDustRing(play, &this->actor, &pos, 10.0f, 0, 2.0f, 300, 0, true); } } @@ -900,14 +900,14 @@ void EnDg_JumpAttack(EnDg* this, PlayState* play) { if (curFrame < 9) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - sAnimationInfo[DOG_ANIM_JUMP_ATTACK].playSpeed = randPlusMinusPoint5Scaled(1.0f) + 3.0f; + sAnimationInfo[DOG_ANIM_JUMP_ATTACK].playSpeed = Rand_CenteredFloat(1.0f) + 3.0f; } EnDg_SpawnFloorDustRing(this, play); } else { this->dogFlags |= DOG_FLAG_JUMP_ATTACKING; if (Animation_OnFrame(&this->skelAnime, 9.0f)) { - f32 rand = randPlusMinusPoint5Scaled(1.5f); + f32 rand = Rand_CenteredFloat(1.5f); sAnimationInfo[DOG_ANIM_JUMP_ATTACK].playSpeed = 1.2f; this->actor.velocity.y = 2.0f * rand + 3.0f; diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 5b268f1f8d..e24e2691b8 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -1062,7 +1062,7 @@ void func_8089CB10(EnDinofos* this, PlayState* play) { } void func_8089CBEC(EnDinofos* this, PlayState* play) { - s16 temp_s3 = ((s32)randPlusMinusPoint5Scaled(0x1000) + this->actor.shape.rot.y) + this->unk_28E; + s16 temp_s3 = ((s32)Rand_CenteredFloat(0x1000) + this->actor.shape.rot.y) + this->unk_28E; Vec3f sp88; Vec3f sp7C; ColliderJntSphElementDim* dim; @@ -1081,10 +1081,10 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { temp_s0 = CLAMP_MIN(temp_s0, 0); sp88.x = 11.0f * temp_f20; - sp88.y = randPlusMinusPoint5Scaled(2.0f) + -5.4f; + sp88.y = Rand_CenteredFloat(2.0f) + -5.4f; sp88.z = 11.0f * temp_f22; sp7C.x = 0.9f * temp_f20; - sp7C.y = randPlusMinusPoint5Scaled(0.6f) + 1.4f; + sp7C.y = Rand_CenteredFloat(0.6f) + 1.4f; sp7C.z = 0.9f * temp_f22; func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); EffectSsDFire_Spawn(play, &this->limbPos[10], &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, 3, 8); @@ -1098,7 +1098,7 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { for (i = 6; i < end; i++) { dim = &this->colliderJntSph.elements[i].dim; - temp_s3 = (s32)(cos_rad((this->unk_290 + ((i - 5) << 1)) * (M_PI / 20)) * 0x2C00) + this->actor.shape.rot.y; + temp_s3 = (s32)(Math_CosF((this->unk_290 + ((i - 5) << 1)) * (M_PI / 20)) * 0x2C00) + this->actor.shape.rot.y; dim->worldSphere.center.x = (s32)this->limbPos[10].x + (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z); dim->worldSphere.center.y = (s32)this->limbPos[10].y + (s32)dim->modelSphere.center.y; @@ -1232,9 +1232,9 @@ void func_8089D42C(EnDinofos* this, PlayState* play) { if ((this->actionFunc == func_8089B834) && (this->unk_290 != 0)) { Math_ScaledStepToS(&this->unk_28E, Math_SinS(this->unk_290 * 1400) * 0x2C00, 0x300); } else if (this->actionFunc == func_8089CA74) { - Math_ScaledStepToS(&this->unk_28E, cos_rad(M_PI) * 0x2C00, 0x233); + Math_ScaledStepToS(&this->unk_28E, Math_CosF(M_PI) * 0x2C00, 0x2C00 / 20); } else if (this->actionFunc == func_8089CBEC) { - this->unk_28E = cos_rad(this->unk_290 * (M_PI / 20)) * 0x2C00; + this->unk_28E = Math_CosF(this->unk_290 * (M_PI / 20)) * 0x2C00; } else if (!Play_InCsMode(play)) { temp_v0_2 = this->unk_28E + this->actor.shape.rot.y; temp_v0_2 = BINANG_SUB(this->actor.yawTowardsPlayer, temp_v0_2); diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 3f149049ac..6149a73607 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -371,11 +371,11 @@ void func_80876930(EnDodongo* this, PlayState* play, Vec3f* arg2) { temp3 = this->unk_334 * 30.0f; for (i = 0; i < 3; i++) { - sp88.x = randPlusMinusPoint5Scaled(temp3) + arg2->x; + sp88.x = Rand_CenteredFloat(temp3) + arg2->x; sp88.y = Rand_ZeroFloat(5.0f) + this->actor.floorHeight; - sp88.z = randPlusMinusPoint5Scaled(temp3) + arg2->z; - D_8087933C.x = randPlusMinusPoint5Scaled(2.0f); - D_8087933C.z = randPlusMinusPoint5Scaled(2.0f); + sp88.z = Rand_CenteredFloat(temp3) + arg2->z; + D_8087933C.x = Rand_CenteredFloat(2.0f); + D_8087933C.z = Rand_CenteredFloat(2.0f); func_800B0DE0(play, &sp88, &gZeroVec3f, &D_8087933C, sp80, sp7C, temp1, temp2); } } @@ -738,9 +738,9 @@ void func_80877E60(EnDodongo* this, PlayState* play) { this->timer--; if (this->timer == 10) { for (i = 10; i >= 0; i--) { - sp84.x = randPlusMinusPoint5Scaled(10.0f); - sp84.y = randPlusMinusPoint5Scaled(10.0f); - sp84.z = randPlusMinusPoint5Scaled(10.0f); + sp84.x = Rand_CenteredFloat(10.0f); + sp84.y = Rand_CenteredFloat(10.0f); + sp84.z = Rand_CenteredFloat(10.0f); sp78.x = sp84.x * -0.1f; sp78.y = sp84.y * -0.1f; sp78.z = sp84.z * -0.1f; diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index d2acb55be5..fae9fc4fcb 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -299,11 +299,11 @@ void EnDragon_SpawnBubbles(EnDragon* this, PlayState* play, Vec3f basePos) { Vec3f bubblePos; s32 i; - bubbleCount = (s32)randPlusMinusPoint5Scaled(5.0f) + 10; + bubbleCount = (s32)Rand_CenteredFloat(5.0f) + 10; colorIndex = 0; if (this->action == DEEP_PYTHON_ACTION_DEAD) { colorIndex = 1; - bubbleCount = (s32)randPlusMinusPoint5Scaled(5.0f) + 10; + bubbleCount = (s32)Rand_CenteredFloat(5.0f) + 10; } for (i = 0; i < bubbleCount; i++) { @@ -311,9 +311,9 @@ void EnDragon_SpawnBubbles(EnDragon* this, PlayState* play, Vec3f basePos) { sBubbleVelocity.x = Rand_ZeroFloat(1.0f) * 23.0f; sBubbleVelocity.y = Rand_ZeroFloat(1.0f) * 10.0f; sBubbleVelocity.z = Rand_ZeroFloat(1.0f) * 23.0f; - bubblePos.x += randPlusMinusPoint5Scaled(i * 30.0f); - bubblePos.y += randPlusMinusPoint5Scaled(5.0f); - bubblePos.z += randPlusMinusPoint5Scaled(i * 30.0f); + bubblePos.x += Rand_CenteredFloat(i * 30.0f); + bubblePos.y += Rand_CenteredFloat(5.0f); + bubblePos.z += Rand_CenteredFloat(i * 30.0f); sBubbleAccel.y = Rand_ZeroFloat(1.0f) * 20.0f * 3.0f; scale = Rand_S16Offset(380, 240); EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &sBubbleVelocity, &sBubbleAccel, diff --git a/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c b/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c index 2a9a0ac677..bd9949c617 100644 --- a/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c +++ b/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c @@ -134,8 +134,8 @@ void EnEgblock_SpawnEffect(EnEgblock* this, Vec3f* pos, s16 lifetime, s16 arg3) if (!effect->isActive) { effect->isActive = true; effect->pos = *pos; - effect->pos.x += randPlusMinusPoint5Scaled(50.0f); - effect->pos.z += randPlusMinusPoint5Scaled(50.0f); + effect->pos.x += Rand_CenteredFloat(50.0f); + effect->pos.z += Rand_CenteredFloat(50.0f); effect->timer = lifetime; effect->alpha = 255; effect->type = arg3; @@ -146,9 +146,9 @@ void EnEgblock_SpawnEffect(EnEgblock* this, Vec3f* pos, s16 lifetime, s16 arg3) effect->velocity.y = 5.0f + (10.0f * Rand_ZeroOne()); effect->velocity.z = 2.0f * (Rand_ZeroOne() - 0.5f); effect->scale = 0.5f + (0.2f * Rand_ZeroFloat(1.0f)); - effect->rot.x = randPlusMinusPoint5Scaled(0x7530); - effect->rot.y = randPlusMinusPoint5Scaled(0x7530); - effect->rot.z = randPlusMinusPoint5Scaled(0x7530); + effect->rot.x = Rand_CenteredFloat(0x7530); + effect->rot.y = Rand_CenteredFloat(0x7530); + effect->rot.z = Rand_CenteredFloat(0x7530); break; } } diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index c9750991ad..1a54c8c33e 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -610,8 +610,7 @@ void EnEgol_Retreat(EnEgol* this, PlayState* play) { if ((ABS_ALT(angleToFacing) < 0x3000) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 50.0f) && (this->actor.xzDistToPlayer < 100.0f) && (player->invincibilityTimer == 0)) { - func_800B8D50(play, &this->actor, 2.0f, (s32)randPlusMinusPoint5Scaled(0x2000) + this->actor.world.rot.y, 5.0f, - 0x10); + func_800B8D50(play, &this->actor, 2.0f, (s32)Rand_CenteredFloat(0x2000) + this->actor.world.rot.y, 5.0f, 0x10); } Math_Vec3f_Copy(&spawnPos, &gZeroVec3f); if ((this->actor.world.pos.y - 50.0f) <= player->actor.world.pos.y) { @@ -764,11 +763,11 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) { /*! @bug The following is supposed to calculate the rotation from vertical to the collision poly normal. * However, the calculation is performed incorrectly. The correct calculation is - * rotToNorm.x = func_80086B30(nz, ny) * 0x8000 / M_PI; - * rotToNorm.z = func_80086B30(-nx, sqrtf(1.0f - SQ(nx))) * 0x8000 / M_PI; + * rotToNorm.x = Math_FAtan2F(nz, ny) * 0x8000 / M_PI; + * rotToNorm.z = Math_FAtan2F(-nx, sqrtf(1.0f - SQ(nx))) * 0x8000 / M_PI; */ - rotToNorm.x = RAD_TO_BINANG_ALT2(-func_80086B30(-nz * ny, 1.0f)); - rotToNorm.z = RAD_TO_BINANG_ALT2(func_80086B30(-nx * ny, 1.0f)); + rotToNorm.x = RAD_TO_BINANG_ALT2(-Math_FAtan2F(-nz * ny, 1.0f)); + rotToNorm.z = RAD_TO_BINANG_ALT2(Math_FAtan2F(-nx * ny, 1.0f)); if ((this->actor.world.pos.y - 50.0f) <= player->actor.world.pos.y) { EnEgol_SpawnEffect(this, &hitPos, &rotToNorm, 100, 0.02f, EYEGORE_EFFECT_IMPACT); @@ -1534,9 +1533,9 @@ void EnEgol_SpawnEffect(EnEgol* this, Vec3f* pos, Vec3s* rot, s16 lifetime, f32 effect->timer = lifetime; effect->alpha = 255; effect->type = type; - effect->rot.x = randPlusMinusPoint5Scaled(0x7530); - effect->rot.y = randPlusMinusPoint5Scaled(0x7530); - effect->rot.z = randPlusMinusPoint5Scaled(0x7530); + effect->rot.x = Rand_CenteredFloat(0x7530); + effect->rot.y = Rand_CenteredFloat(0x7530); + effect->rot.z = Rand_CenteredFloat(0x7530); if ((effect->type == EYEGORE_EFFECT_PIECE_LARGE) || (effect->type == EYEGORE_EFFECT_PIECE_SMALL)) { effect->accel.y = -1.0f; effect->velocity.x = 4.0f * (Rand_ZeroOne() - 0.5f); diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 2bb7b6d0de..3dc6e4a72d 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -201,7 +201,7 @@ void func_8088C858(EnElf* this, PlayState* play) { this->unk_244 = 1; this->unk_248 = 128; this->unk_254 = Rand_ZeroFloat(1.0f) + 0.5f; - this->unk_24C = randPlusMinusPoint5Scaled(0x7FFF); + this->unk_24C = Rand_CenteredFloat(0x7FFF); this->unk_26C = func_8088C9CC; } } @@ -216,7 +216,7 @@ void func_8088C920(EnElf* this, PlayState* play) { this->unk_244 = 1; this->unk_248 = 128; this->unk_254 = Rand_ZeroFloat(1.0f) + 0.5f; - this->unk_24C = randPlusMinusPoint5Scaled(0x7FFF); + this->unk_24C = Rand_CenteredFloat(0x7FFF); this->unk_26C = func_8088C9CC; } } @@ -264,7 +264,7 @@ void func_8088C9CC(EnElf* this, PlayState* play) { this->unk_244 = 1; this->unk_248 = 128; this->unk_254 = Rand_ZeroFloat(0.5f) + 0.5f; - this->unk_24C = randPlusMinusPoint5Scaled(0x7FFF); + this->unk_24C = Rand_CenteredFloat(0x7FFF); } } @@ -293,7 +293,7 @@ void func_8088CC48(EnElf* this, PlayState* play) { this->unk_246 = 0; this->unk_24A = (s32)Rand_ZeroFloat(1048.0f) + 0x200; this->unk_224 = this->actor.world.pos; - this->unk_258 = randPlusMinusPoint5Scaled(0x7FFF); + this->unk_258 = Rand_CenteredFloat(0x7FFF); this->unk_26C = func_8088C9CC; func_8088CBAC(this, play); this->unk_25C = 0; @@ -1247,9 +1247,9 @@ void func_8088F5F4(EnElf* this, PlayState* play, s32 sparkleLife) { Color_RGBA8 envColor; if (!(this->fairyFlags & 8)) { - sparklePos.x = randPlusMinusPoint5Scaled(6.0f) + this->actor.world.pos.x; + sparklePos.x = Rand_CenteredFloat(6.0f) + this->actor.world.pos.x; sparklePos.y = (Rand_ZeroOne() * 6.0f) + this->actor.world.pos.y; - sparklePos.z = randPlusMinusPoint5Scaled(6.0f) + this->actor.world.pos.z; + sparklePos.z = Rand_CenteredFloat(6.0f) + this->actor.world.pos.z; primColor.r = this->innerColor.r; primColor.g = this->innerColor.g; diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c index e2a5f69e3a..2584a1c73f 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c @@ -66,7 +66,7 @@ void EnElfbub_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 1.25f); this->actionFunc = EnElfbub_Idle; - this->zRot = randPlusMinusPoint5Scaled(0x10000); + this->zRot = Rand_CenteredFloat(0x10000); this->zRotDelta = 1000; this->xScale = 0.08f; diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index a3f17f6059..cacef3f4d9 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -262,8 +262,8 @@ void func_80A39DC8(EnElfgrp* this, PlayState* play, s32 arg2, s32 arg3) { } for (i = 0; i < arg2; i++) { - elforg = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, randPlusMinusPoint5Scaled(20.0f) + sp6C.x, sp6C.y, - randPlusMinusPoint5Scaled(20.0f) + sp6C.z, 0, 0, 0, params); + elforg = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, Rand_CenteredFloat(20.0f) + sp6C.x, sp6C.y, + Rand_CenteredFloat(20.0f) + sp6C.z, 0, 0, 0, params); if (elforg == NULL) { continue; } diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 05351cd3fe..9b65ae2a6e 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -58,7 +58,7 @@ void EnElforg_InitializeParams(EnElforg* this) { this->actor.speed = 1.0f; this->targetSpeedXZ = 1.0f; this->actor.velocity.y = 0.0f; - this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x10000); + this->actor.world.rot.y = Rand_CenteredFloat(0x10000); this->timer = 0; this->secondaryTimer = Rand_ZeroFloat(100.0f); this->actor.shape.yOffset = 0.0f; @@ -176,9 +176,9 @@ void EnElforg_SpawnSparkles(EnElforg* this, PlayState* play, s32 life) { s32 pad; s32 index; - pos.x = randPlusMinusPoint5Scaled(6.0f) + this->actor.world.pos.x; + pos.x = Rand_CenteredFloat(6.0f) + this->actor.world.pos.x; pos.y = (Rand_ZeroOne() * 6.0f) + this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y); - pos.z = randPlusMinusPoint5Scaled(6.0f) + this->actor.world.pos.z; + pos.z = Rand_CenteredFloat(6.0f) + this->actor.world.pos.z; index = (this->area < STRAY_FAIRY_AREA_CLOCK_TOWN || this->area >= STRAY_FAIRY_AREA_MAX) ? STRAY_FAIRY_AREA_CLOCK_TOWN : this->area; diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 834a6449f1..3d82240397 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -102,15 +102,15 @@ void EnEncount1_SpawnActor(EnEncount1* this, PlayState* play) { this->timer = 0; switch (this->type) { case EN_ENCOUNT1_GRASSHOPPER: - scale = randPlusMinusPoint5Scaled(40.0f) + 200.0f; + scale = Rand_CenteredFloat(40.0f) + 200.0f; rotY = player->actor.shape.rot.y; if (this->spawnActiveCount & 1) { rotY = -rotY; - scale = randPlusMinusPoint5Scaled(20.0f) + 100.0f; + scale = Rand_CenteredFloat(20.0f) + 100.0f; } - spawnPos.x = player->actor.world.pos.x + (Math_SinS(rotY) * scale) + randPlusMinusPoint5Scaled(40.0f); + spawnPos.x = player->actor.world.pos.x + (Math_SinS(rotY) * scale) + Rand_CenteredFloat(40.0f); spawnPos.y = player->actor.floorHeight + 120.0f; - spawnPos.z = player->actor.world.pos.z + (Math_CosS(rotY) * scale) + randPlusMinusPoint5Scaled(40.0f); + spawnPos.z = player->actor.world.pos.z + (Math_CosS(rotY) * scale) + Rand_CenteredFloat(40.0f); floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); if ((floorHeight <= BGCHECK_Y_MIN) || ((player->actor.depthInWater != BGCHECK_Y_MIN) && @@ -125,11 +125,11 @@ void EnEncount1_SpawnActor(EnEncount1* this, PlayState* play) { break; case EN_ENCOUNT1_SKULLFISH: - scale = randPlusMinusPoint5Scaled(250.0f) + 500.0f; + scale = Rand_CenteredFloat(250.0f) + 500.0f; rotY = player->actor.shape.rot.y; - spawnPos.x = player->actor.world.pos.x + (Math_SinS(rotY) * scale) + randPlusMinusPoint5Scaled(40.0f); + spawnPos.x = player->actor.world.pos.x + (Math_SinS(rotY) * scale) + Rand_CenteredFloat(40.0f); spawnPos.y = player->actor.world.pos.y - Rand_ZeroFloat(20.0f); - spawnPos.z = player->actor.world.pos.z + (Math_CosS(rotY) * scale) + randPlusMinusPoint5Scaled(40.0f); + spawnPos.z = player->actor.world.pos.z + (Math_CosS(rotY) * scale) + Rand_CenteredFloat(40.0f); floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos); if (!(player->stateFlags1 & PLAYER_STATE1_8000000) || (floorHeight <= BGCHECK_Y_MIN) || (player->actor.depthInWater < floorHeight)) { diff --git a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c index 972d038ae0..5e28850c6f 100644 --- a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c +++ b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c @@ -171,8 +171,8 @@ void func_809C42A8(EnEncount4* this, PlayState* play) { if (this->unk_14C != 0) { yRot += 0x8000; } - pos.x += Math_SinS(yRot) * (40.0f + randPlusMinusPoint5Scaled(40.0f)); - pos.z += Math_CosS(yRot) * (40.0f + randPlusMinusPoint5Scaled(40.0f)); + pos.x += Math_SinS(yRot) * (40.0f + Rand_CenteredFloat(40.0f)); + pos.z += Math_CosS(yRot) * (40.0f + Rand_CenteredFloat(40.0f)); if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_SKB, pos.x, pos.y, pos.z, 0, 0, 0, ENSKB_PARAM_0) != NULL) { this->unk_14C++; 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 85d0527fa7..64bfdaecc9 100644 --- a/src/overlays/actors/ovl_En_Estone/z_en_estone.c +++ b/src/overlays/actors/ovl_En_Estone/z_en_estone.c @@ -64,10 +64,10 @@ void EnEstone_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); - this->rotVel.x = this->rotVel.y = this->rotVel.z = randPlusMinusPoint5Scaled(1.0f) * 20.0f; + 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)randPlusMinusPoint5Scaled(0x2710); + this->actor.world.rot.y += (s16)(s32)Rand_CenteredFloat(0x2710); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->actor.params == ENESTONE_TYPE_LARGE) { @@ -224,9 +224,9 @@ void EnEstone_SpawnEffect(EnEstone* this, Vec3f* pos, Vec3f* velocity, Vec3f* ac effect->accel = *accel; effect->scale = scale; effect->timer = lifetime; - effect->rot.x = randPlusMinusPoint5Scaled(0x7530); - effect->rot.y = randPlusMinusPoint5Scaled(0x7530); - effect->rot.z = randPlusMinusPoint5Scaled(0x7530); + effect->rot.x = Rand_CenteredFloat(0x7530); + effect->rot.y = Rand_CenteredFloat(0x7530); + effect->rot.z = Rand_CenteredFloat(0x7530); break; } } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index 2f226e61cb..03989b01fd 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -662,16 +662,16 @@ s32 EnFall_RisingDebris_InitializeEffect(EnFall* this) { debrisEffects[i].pos.x = this->actor.world.pos.x; debrisEffects[i].pos.y = this->actor.world.pos.y; debrisEffects[i].pos.z = this->actor.world.pos.z; - angle = randPlusMinusPoint5Scaled(0x10000); + angle = Rand_CenteredFloat(0x10000); scale = (1.0f - (Rand_ZeroFloat(1.0f) * Rand_ZeroFloat(1.0f))) * 3000.0f; debrisEffects[i].pos.x += Math_SinS(angle) * scale; debrisEffects[i].pos.z += Math_CosS(angle) * scale; debrisEffects[i].velocity.x = 0.0f; debrisEffects[i].velocity.z = 0.0f; debrisEffects[i].velocity.y = 80.0f; - debrisEffects[i].rot.x = randPlusMinusPoint5Scaled(0x10000); - debrisEffects[i].rot.y = randPlusMinusPoint5Scaled(0x10000); - debrisEffects[i].rot.z = randPlusMinusPoint5Scaled(0x10000); + debrisEffects[i].rot.x = Rand_CenteredFloat(0x10000); + debrisEffects[i].rot.y = Rand_CenteredFloat(0x10000); + debrisEffects[i].rot.z = Rand_CenteredFloat(0x10000); this->activeDebrisEffectCount++; return true; } diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index 97d1ec357d..269866ff08 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -265,7 +265,7 @@ void EnFamos_SetupDeathDebris(EnFamos* this) { rock->rotation.y = (s32)Rand_Next() >> 0x10; rock->rotation.z = (s32)Rand_Next() >> 0x10; rock->pos.x = Math_SinS(randVelDirection) * 20.0f + this->actor.world.pos.x; - rock->pos.y = randPlusMinusPoint5Scaled(60.0f) + (this->actor.world.pos.y + 40.0f); + rock->pos.y = Rand_CenteredFloat(60.0f) + (this->actor.world.pos.y + 40.0f); rock->pos.z = Math_CosS(randVelDirection) * 20.0f + this->actor.world.pos.z; rock->scale = Rand_ZeroFloat(0.002f) + (2.5f * 0.001f); } @@ -687,8 +687,8 @@ void EnFamos_DeathExplosion(EnFamos* this, PlayState* play) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 4); } - this->actor.world.pos.x = randPlusMinusPoint5Scaled(5.0f) + this->targetDest.x; - this->actor.world.pos.z = randPlusMinusPoint5Scaled(5.0f) + this->targetDest.z; + this->actor.world.pos.x = Rand_CenteredFloat(5.0f) + this->targetDest.x; + this->actor.world.pos.z = Rand_CenteredFloat(5.0f) + this->targetDest.z; if (this->stateTimer == 1) { EnBom* explosion = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 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 b26592ac0b..fd3b723d83 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)randPlusMinusPoint5Scaled(1536.0f); + this->actor.shape.rot.y += (s16)(s32)Rand_CenteredFloat(0x600); } // Climb if too close to ground diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index ac3a4246b0..923cfeef24 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -352,7 +352,7 @@ void func_80B28C14(EnFish2* this, PlayState* play) { this->unk_2B4 = (s32)Rand_ZeroFloat(20.0f) + 10; } else if (this->unk_2B4 == 1) { if ((this->unk_348 == 0) || (Rand_ZeroOne() < 0.6f)) { - this->unk_348 = randPlusMinusPoint5Scaled(0x2000); + this->unk_348 = Rand_CenteredFloat(0x2000); } else { this->unk_348 = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_324); if (this->unk_348 < -0x1000) { @@ -545,8 +545,8 @@ void func_80B295A4(EnFish2* this, PlayState* play) { Math_ApproachZeroF(&this->actor.speed, 0.3f, 0.3f); if (this->unk_2B4 != 0) { Math_Vec3f_Copy(&sp60, &this->unk_318); - sp60.x += randPlusMinusPoint5Scaled(100.0f); - sp60.z += randPlusMinusPoint5Scaled(100.0f); + sp60.x += Rand_CenteredFloat(100.0f); + sp60.z += Rand_CenteredFloat(100.0f); for (i = 0; i < 2; i++) { EffectSsBubble_Spawn(play, &sp60, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f); @@ -912,10 +912,10 @@ void func_80B2A498(EnFish2* this, PlayState* play) { for (i = 0; i < 10; i++) { Math_Vec3f_Copy(&sp6C, &this->actor.world.pos); - sp6C.x += randPlusMinusPoint5Scaled(70.0f); + sp6C.x += Rand_CenteredFloat(70.0f); sp6C.y = this->unk_334 + 10.0f; - sp6C.z += randPlusMinusPoint5Scaled(70.0f); - EffectSsGSplash_Spawn(play, &sp6C, NULL, NULL, 0, (s32)randPlusMinusPoint5Scaled(50.0f) + 350); + sp6C.z += Rand_CenteredFloat(70.0f); + EffectSsGSplash_Spawn(play, &sp6C, NULL, NULL, 0, (s32)Rand_CenteredFloat(50.0f) + 350); } } } @@ -970,11 +970,11 @@ void EnFish2_Update(Actor* thisx, PlayState* play2) { if ((play->gameplayFrames % 8) == 0) { Math_Vec3f_Copy(&sp5C, &this->unk_324); - sp5C.x += randPlusMinusPoint5Scaled(100.0f); + sp5C.x += Rand_CenteredFloat(100.0f); sp5C.y = this->actor.floorHeight; - sp5C.z += randPlusMinusPoint5Scaled(100.0f); + sp5C.z += Rand_CenteredFloat(100.0f); - for (i = 0; i < (s32)randPlusMinusPoint5Scaled(5.0f) + 10; i++) { + for (i = 0; i < (s32)Rand_CenteredFloat(5.0f) + 10; i++) { EffectSsBubble_Spawn(play, &sp5C, 0, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f); } } @@ -1102,9 +1102,9 @@ void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2) { ptr->unk_20 = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(phi_v0)); ptr->unk_00 = true; ptr->unk_04 = *vec; - ptr->unk_04.x += randPlusMinusPoint5Scaled(ptr->unk_00 + (this->unk_330 * 4000.0f)); - ptr->unk_04.y += randPlusMinusPoint5Scaled(20.0f); - ptr->unk_04.z += randPlusMinusPoint5Scaled(ptr->unk_00 + (this->unk_330 * 4000.0f)); + ptr->unk_04.x += Rand_CenteredFloat(ptr->unk_00 + (this->unk_330 * 4000.0f)); + ptr->unk_04.y += Rand_CenteredFloat(20.0f); + ptr->unk_04.z += Rand_CenteredFloat(ptr->unk_00 + (this->unk_330 * 4000.0f)); ptr->unk_18 = (this->unk_330 * 20.0f) - (Rand_ZeroFloat(5.0f) * 0.01f); ptr->unk_1C = 0x42; ptr->unk_10 = arg2; 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 2ada30cba7..20edbcbc22 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -1838,9 +1838,9 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) dy = sLurePos.y - sRodTipPos.y; dz = sLurePos.z - sRodTipPos.z; - ry = func_80086B30(dx, dz); + ry = Math_FAtan2F(dx, dz); dist = sqrtf(SQ(dx) + SQ(dz)); - rx = -func_80086B30(dy, dist); + rx = -Math_FAtan2F(dy, dist); dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) * 0.001f; @@ -1865,9 +1865,9 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) dy = D_80917218.y - (linePos + i)->y; dz = D_80917218.z - (linePos + i)->z; - ry = func_80086B30(dx, dz); + ry = Math_FAtan2F(dx, dz); dist = sqrtf(SQ(dx) + SQ(dz)); - rx = -func_80086B30(dy, dist); + rx = -Math_FAtan2F(dy, dist); dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) * 0.001f; @@ -3003,9 +3003,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->actor.shape.rot.y = -0x8000; if ((this->actor.projectedPos.z < 200.0f) && (this->actor.projectedPos.z > 0.0f)) { - spC4.x = randPlusMinusPoint5Scaled(5.0f) + 130.0f; + spC4.x = Rand_CenteredFloat(5.0f) + 130.0f; spC4.y = 40.0f; - spC4.z = randPlusMinusPoint5Scaled(5.0f) + 1280.0f; + spC4.z = Rand_CenteredFloat(5.0f) + 1280.0f; EnFishing_SpawnBubble(NULL, play->specialEffects, &spC4, Rand_ZeroFloat(0.02f) + 0.03f, 1); } @@ -3080,9 +3080,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } else { this->unk_150 = 1; this->unk_172[0] = Rand_ZeroFloat(30.0f) + 10.0f; - this->unk_1AC.x = randPlusMinusPoint5Scaled(300.0f); + this->unk_1AC.x = Rand_CenteredFloat(300.0f); this->unk_1AC.y = (WATER_SURFACE_Y(play) - 50.0f) - Rand_ZeroFloat(50.0f); - this->unk_1AC.z = randPlusMinusPoint5Scaled(300.0f); + this->unk_1AC.z = Rand_CenteredFloat(300.0f); this->unk_188 = 1.0f; this->unk_18C = 2000.0f; } @@ -3144,8 +3144,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { Math_ApproachF(&this->unk_1A8, 4096.0f, 1.0f, 256.0f); if ((play->gameplayFrames % 32) == 0) { - this->unk_1AC.x = randPlusMinusPoint5Scaled(600.0f); - this->unk_1AC.z = randPlusMinusPoint5Scaled(600.0f); + this->unk_1AC.x = Rand_CenteredFloat(600.0f); + this->unk_1AC.z = Rand_CenteredFloat(600.0f); this->unk_1AC.y = -120.0f; } } else if (sp124 > 50.0f) { @@ -3600,7 +3600,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { for (spA2 = 0; spA2 < 100; spA2++) { - Matrix_RotateYF(randPlusMinusPoint5Scaled(0.75f * M_PI) + + Matrix_RotateYF(Rand_CenteredFloat(0.75f * M_PI) + BINANG_TO_RAD_ALT(this->actor.yawTowardsPlayer + 0x8000), MTXMODE_NEW); Matrix_MultVec3f(&sp10C, &sp100); @@ -4067,7 +4067,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 = randPlusMinusPoint5Scaled(32768.0f); + this->unk_162 = (s16)(s32)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) { @@ -4128,10 +4128,10 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if (Rand_ZeroOne() < 0.5f) { this->unk_15E = 0; } else { - this->unk_15E = (s16)randPlusMinusPoint5Scaled(32.0f) + 0x8000; + this->unk_15E = (s16)(s32)Rand_CenteredFloat(0x20) + 0x8000; } - this->unk_160 = (s16)randPlusMinusPoint5Scaled(16384.0f); + this->unk_160 = (s16)(s32)Rand_CenteredFloat(0x4000); this->unk_188 = 1.0f; this->unk_18C = 5000.0f; this->unk_194 = 5000.0f; @@ -4141,8 +4141,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((this->unk_150 == 5) && !(this->unk_154 & 1)) { Vec3f pos; - pos.x = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.x; - pos.z = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.z; + pos.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x; + pos.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z; pos.y = this->actor.floorHeight + 5.0f; EnFishing_SpawnWaterDust(&this->actor.projectedPos, play->specialEffects, &pos, (this->unk_1A4 * 0.005f) + 0.15f); @@ -4160,9 +4160,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_1CA--; for (i = 0; i < 2; i++) { - pos.x = randPlusMinusPoint5Scaled(range) + this->actor.world.pos.x; - pos.y = randPlusMinusPoint5Scaled(range) + this->actor.world.pos.y; - pos.z = randPlusMinusPoint5Scaled(range) + this->actor.world.pos.z; + pos.x = Rand_CenteredFloat(range) + this->actor.world.pos.x; + pos.y = Rand_CenteredFloat(range) + this->actor.world.pos.y; + pos.z = Rand_CenteredFloat(range) + this->actor.world.pos.z; EnFishing_SpawnBubble(&this->actor.projectedPos, play->specialEffects, &pos, Rand_ZeroFloat(0.035f) + 0.04f, 0); } @@ -4568,14 +4568,14 @@ void EnFishing_UpdateGroupFishes(PlayState* play) { spD6 = Math_Atan2S_XY(dist, dy); if ((dist < 10.0f) || (((fish->timer % 32) == 0) && (Rand_ZeroOne() > 0.5f))) { - fish->unk_10.y = basePos[groupIndex].y + randPlusMinusPoint5Scaled(10.0f); + fish->unk_10.y = basePos[groupIndex].y + Rand_CenteredFloat(10.0f); if (D_8090CF18 != 0) { - fish->unk_10.x = basePos[groupIndex].x + randPlusMinusPoint5Scaled(200.0f); - fish->unk_10.z = basePos[groupIndex].z + randPlusMinusPoint5Scaled(200.0f); + fish->unk_10.x = basePos[groupIndex].x + Rand_CenteredFloat(200.0f); + fish->unk_10.z = basePos[groupIndex].z + Rand_CenteredFloat(200.0f); } else { - fish->unk_10.x = basePos[groupIndex].x + randPlusMinusPoint5Scaled(100.0f); - fish->unk_10.z = basePos[groupIndex].z + randPlusMinusPoint5Scaled(100.0f); + fish->unk_10.x = basePos[groupIndex].x + Rand_CenteredFloat(100.0f); + fish->unk_10.z = basePos[groupIndex].z + Rand_CenteredFloat(100.0f); } ripplePos = fish->pos; @@ -5460,8 +5460,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { ((play->gameplayFrames % 2) == 0)) { Vec3f pos; - pos.x = randPlusMinusPoint5Scaled(20.0f) + player->actor.world.pos.x; - pos.z = randPlusMinusPoint5Scaled(20.0f) + player->actor.world.pos.z; + pos.x = Rand_CenteredFloat(20.0f) + player->actor.world.pos.x; + pos.z = Rand_CenteredFloat(20.0f) + player->actor.world.pos.z; pos.y = player->actor.floorHeight + 5.0f; EnFishing_SpawnWaterDust(NULL, play->specialEffects, &pos, 0.5f); } @@ -5552,9 +5552,9 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { rot.z = (Camera_GetInputDirYaw(mainCam) * -(M_PI / 0x8000)) + rot.y; for (i = 0; i < (u8)D_8090CCD0; i++) { - pos.x = randPlusMinusPoint5Scaled(700.0f) + play->view.eye.x; + pos.x = Rand_CenteredFloat(700.0f) + play->view.eye.x; pos.y = (Rand_ZeroFloat(100.0f) + 150.0f) - 170.0f; - pos.z = randPlusMinusPoint5Scaled(700.0f) + play->view.eye.z; + pos.z = Rand_CenteredFloat(700.0f) + play->view.eye.z; if (pos.z < 1160.0f) { SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &projectedPos, &sProjectedW); diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 150f3c8c14..71f980d47e 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -306,14 +306,14 @@ void func_809328F4(EnFz* this, PlayState* play, Vec3f* arg2, s32 arg3, f32 arg4) sp88.b = 200; for (i = 0; i < arg3; i++) { - temp_f24 = randPlusMinusPoint5Scaled(0.3f) + 0.6f; - temp_s1 = (s32)randPlusMinusPoint5Scaled(5.0f) + 12; - spA8.x = randPlusMinusPoint5Scaled(arg4) + arg2->x; + temp_f24 = Rand_CenteredFloat(0.3f) + 0.6f; + temp_s1 = (s32)Rand_CenteredFloat(5.0f) + 12; + spA8.x = Rand_CenteredFloat(arg4) + arg2->x; spA8.y = Rand_ZeroFloat(arg4) + arg2->y; - spA8.z = randPlusMinusPoint5Scaled(arg4) + arg2->z; - sp9C.x = randPlusMinusPoint5Scaled(10.0f); + spA8.z = Rand_CenteredFloat(arg4) + arg2->z; + sp9C.x = Rand_CenteredFloat(10.0f); sp9C.y = Rand_ZeroFloat(10.0f) + 2.0f; - sp9C.z = randPlusMinusPoint5Scaled(10.0f); + sp9C.z = Rand_CenteredFloat(10.0f); EffectSsEnIce_Spawn(play, &spA8, temp_f24, &sp9C, &sp90, &sp8C, &sp88, temp_s1); } @@ -329,9 +329,9 @@ void func_80932AF4(EnFz* this) { Vec3f sp2C; if (!(this->unk_BC6 & 0xF)) { - sp44.x = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.x; - sp44.y = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.y + 30.0f; - sp44.z = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.z; + sp44.x = Rand_CenteredFloat(40.0f) + this->actor.world.pos.x; + sp44.y = Rand_CenteredFloat(40.0f) + this->actor.world.pos.y + 30.0f; + sp44.z = Rand_CenteredFloat(40.0f) + this->actor.world.pos.z; sp2C.x = sp2C.z = 0.0f; sp2C.y = 0.1f; sp38.x = sp38.y = sp38.z = 0.0f; @@ -345,9 +345,9 @@ void func_80932BD4(EnFz* this) { Vec3f sp2C; if (!(this->unk_BC6 & 3)) { - sp44.x = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.x; + sp44.x = Rand_CenteredFloat(40.0f) + this->actor.world.pos.x; sp44.y = this->unk_BB4; - sp44.z = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.z; + sp44.z = Rand_CenteredFloat(40.0f) + this->actor.world.pos.z; sp2C.x = sp2C.z = 0.0f; sp2C.y = 0.1f; sp38.x = sp38.y = sp38.z = 0.0f; diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index e059456805..3540b1a246 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -310,7 +310,7 @@ s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_) { phi_f14 = points[arg2 + 1].z - points[arg2 - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 8692f937cf..1db4d7c5b6 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -374,7 +374,7 @@ s32 func_80B50C78(EnGk* this, Path* path, s32 arg2_) { phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c index 7fbed61221..bfd2d19ab8 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c @@ -246,7 +246,7 @@ void EnGrasshopper_Init(Actor* thisx, PlayState* play) { this->type; } - this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y; + this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y; EnGrasshopper_SetupFly(this); } @@ -343,7 +343,7 @@ void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) { void EnGrasshopper_SetupFly(EnGrasshopper* this) { EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FLY); - this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y; + this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y; this->action = EN_GRASSHOPPER_ACTION_FLY; this->actionFunc = EnGrasshopper_Fly; } @@ -384,7 +384,7 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { } if (this->shouldTurn) { - this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y; + this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y; this->targetRot.y = Math_Atan2S(diffX, diffZ); this->timer = Rand_S16Offset(30, 30); } @@ -412,7 +412,7 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { this->targetRot.y = Math_Atan2S(diffX, diffZ); this->timer = Rand_S16Offset(30, 70); - this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y; + this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y; } } } @@ -441,7 +441,7 @@ void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play) { this->baseFlyHeight = Math_SinS(this->bobPhase) * 10.0f; if (this->timer == 0) { - this->baseFlyHeight = randPlusMinusPoint5Scaled(10.0f); + this->baseFlyHeight = Rand_CenteredFloat(10.0f); this->timer = Rand_S16Offset(30, 30); } @@ -583,8 +583,8 @@ void EnGrasshopper_ApproachPlayer(EnGrasshopper* this, PlayState* play) { if ((this->splashCount < 3) || !(play->gameplayFrames % 8)) { this->splashCount++; Math_Vec3f_Copy(&splashPos, &this->tailTipPos); - splashPos.x += randPlusMinusPoint5Scaled(20.0f); - splashPos.z += randPlusMinusPoint5Scaled(20.0f); + splashPos.x += Rand_CenteredFloat(20.0f); + splashPos.z += Rand_CenteredFloat(20.0f); EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (((s32)Rand_ZeroOne() * 100) + 400)); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); } @@ -633,8 +633,8 @@ void EnGrasshopper_Attack(EnGrasshopper* this, PlayState* play) { if ((this->splashCount < 3) || !(play->gameplayFrames % 8)) { this->splashCount++; Math_Vec3f_Copy(&splashPos, &this->tailTipPos); - splashPos.x += randPlusMinusPoint5Scaled(20.0f); - splashPos.z += randPlusMinusPoint5Scaled(20.0f); + splashPos.x += Rand_CenteredFloat(20.0f); + splashPos.z += Rand_CenteredFloat(20.0f); EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, ((s32)Rand_ZeroOne() * 100) + 400); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); } @@ -796,8 +796,8 @@ void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play) { for (i = 0; i < 3; i++) { Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); - splashPos.x += randPlusMinusPoint5Scaled((i * 5.0f) + 20.0f); - splashPos.z += randPlusMinusPoint5Scaled((i * 5.0f) + 20.0f); + splashPos.x += Rand_CenteredFloat((i * 5.0f) + 20.0f); + splashPos.z += Rand_CenteredFloat((i * 5.0f) + 20.0f); EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (((s32)Rand_ZeroOne() * 100) + 400)); } @@ -826,7 +826,7 @@ void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play) { for (i = 0; i < ARRAY_COUNT(sFireVelocityAndAccel); i++) { Math_Vec3f_Copy(&firePos, &this->actor.world.pos); - firePos.x += randPlusMinusPoint5Scaled(30.0f); + firePos.x += Rand_CenteredFloat(30.0f); if (!isUnderWater) { firePos.y = this->actor.floorHeight; } else if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, @@ -834,7 +834,7 @@ void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play) { firePos.y = waterSurface; } - firePos.z += randPlusMinusPoint5Scaled(30.0f); + firePos.z += Rand_CenteredFloat(30.0f); func_800B3030(play, &firePos, &sFireVelocityAndAccel[i], &sFireVelocityAndAccel[i], 100, 0, 2); } @@ -1062,10 +1062,10 @@ void EnGrasshopper_InitializeEffect(EnGrasshopper* this, Vec3f* pos) { effect->isEnabled = true; effect->pos = *pos; effect->timer = 10; - effect->velocity.x = randPlusMinusPoint5Scaled(20.0f); - effect->velocity.y = randPlusMinusPoint5Scaled(20.0f); - effect->velocity.z = randPlusMinusPoint5Scaled(20.0f); - effect->yaw = randPlusMinusPoint5Scaled(30000.0f); + effect->velocity.x = Rand_CenteredFloat(20.0f); + effect->velocity.y = Rand_CenteredFloat(20.0f); + effect->velocity.z = Rand_CenteredFloat(20.0f); + effect->yaw = Rand_CenteredFloat(30000.0f); return; } } 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 d8004bef8e..6f6f2cad9b 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -815,9 +815,9 @@ s32 func_809995A4(EnGs* this, PlayState* play) { Vec3f sp60; for (i = 0; i < 3; i++) { - sp60.x = randPlusMinusPoint5Scaled(15.0f); + sp60.x = Rand_CenteredFloat(15.0f); sp60.y = Rand_ZeroFloat(-1.0f); - sp60.z = randPlusMinusPoint5Scaled(15.0f); + sp60.z = Rand_CenteredFloat(15.0f); sp6C.x = this->actor.world.pos.x + (2.0f * sp60.x); sp6C.y = this->actor.world.pos.y + 7.0f; diff --git a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c index bcc5882a21..f5885b3cfc 100644 --- a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c +++ b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c @@ -265,7 +265,7 @@ void func_80B22500(EnHakurock* this, PlayState* play) { if (this->counter > 0) { this->counter--; if ((this->counter & 1) == 0) { - this->actor.world.pos.y = (sin_rad(this->counter * (M_PI / 20)) * 4.0f) + this->actor.floorHeight; + this->actor.world.pos.y = (Math_SinF(this->counter * (M_PI / 20)) * 4.0f) + this->actor.floorHeight; } else { this->actor.world.pos.y = this->actor.floorHeight; } 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 ce60a01877..4294a83202 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -107,9 +107,9 @@ void func_80B22E0C(EnHanabiStruct* arg0) { arg0->unk_20.y *= arg0->unk_14.x; arg0->unk_20.y -= 1.0f; - arg0->unk_20.x += randPlusMinusPoint5Scaled(0.8f); - arg0->unk_20.y += randPlusMinusPoint5Scaled(0.8f); - arg0->unk_20.z += randPlusMinusPoint5Scaled(0.8f); + arg0->unk_20.x += Rand_CenteredFloat(0.8f); + arg0->unk_20.y += Rand_CenteredFloat(0.8f); + arg0->unk_20.z += Rand_CenteredFloat(0.8f); if (arg0->unk_01 > 0) { arg0->unk_01--; @@ -286,10 +286,10 @@ void func_80B236C8(EnHanabi* this, PlayState* play) { } sp34.x += sp30 * Math_SinS(this->actor.home.rot.y); - sp34.y += randPlusMinusPoint5Scaled(300.0f); + sp34.y += Rand_CenteredFloat(300.0f); sp34.z += sp30 * Math_CosS(this->actor.home.rot.y); - if (this->actor.home.rot.x >= 0x259) { + if (this->actor.home.rot.x > 0x258) { sp28 = func_80B22C80(&sp34, this->unk_148, 2.0f); } else { sp28 = func_80B22C80(&sp34, this->unk_148, 1.0f); diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index e0f9301cea..8ad694a114 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -173,8 +173,8 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) { Math_Vec3f_Copy(&sp74, &this->actor.world.pos); - sp74.x += randPlusMinusPoint5Scaled(15.0f); - sp74.z += randPlusMinusPoint5Scaled(15.0f); + sp74.x += Rand_CenteredFloat(15.0f); + sp74.z += Rand_CenteredFloat(15.0f); EffectSsDtBubble_SpawnCustomColor(play, &sp74, &sp94, &sp88, &sp84, &sp80, Rand_S16Offset(120, 90), 30, true); @@ -216,8 +216,8 @@ void func_80BDB59C(EnHiddenNuts* this, PlayState* play) { Math_Vec3f_Copy(&sp78, &this->actor.world.pos); - sp78.x += randPlusMinusPoint5Scaled(15.0f); - sp78.z += randPlusMinusPoint5Scaled(15.0f); + sp78.x += Rand_CenteredFloat(15.0f); + sp78.z += Rand_CenteredFloat(15.0f); EffectSsDtBubble_SpawnCustomColor(play, &sp78, &sp98, &sp8C, &sp88, &sp84, Rand_S16Offset(120, 90), 30, true); 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 7c01fa7883..1a0105788e 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 @@ -814,11 +814,11 @@ void func_80C215E4(PlayState* play, EnHintSkb* this, Vec3f* arg2) { s32 pad; sp5C.y = this->actor.floorHeight; - sp5C.x = (sin_rad(sp40) * 15.0f) + arg2->x; - sp5C.z = (cos_rad(sp40) * 15.0f) + arg2->z; + sp5C.x = (Math_SinF(sp40) * 15.0f) + arg2->x; + sp5C.z = (Math_CosF(sp40) * 15.0f) + arg2->z; - sp44.x = randPlusMinusPoint5Scaled(1.0f); - sp44.z = randPlusMinusPoint5Scaled(1.0f); + sp44.x = Rand_CenteredFloat(1.0f); + sp44.z = Rand_CenteredFloat(1.0f); sp50.y += (Rand_ZeroOne() - 0.5f) * 4.0f; diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index d4a534ad17..a116c323ad 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -487,7 +487,7 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) { if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 23.0f)) { this->colliderQuad.base.atFlags |= AT_ON; if (this->drawArmorFlags) { - this->actor.speed = sin_rad((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f; + this->actor.speed = Math_SinF((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f; } } else { this->colliderQuad.base.atFlags &= ~AT_ON; @@ -550,7 +550,7 @@ void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) { } else { phi_f2 = this->skelAnime.curFrame - 1.0f; } - this->actor.speed = sin_rad((M_PI / 8) * phi_f2) * 4.5f; + this->actor.speed = Math_SinF((M_PI / 8) * phi_f2) * 4.5f; } this->colliderQuad.base.atFlags |= AT_ON; } else { @@ -685,9 +685,9 @@ void EnIk_Die(EnIk* this, PlayState* play) { if (this->timer != 0) { this->timer--; for (i = 6 - (this->timer >> 2); i >= 0; i--) { - effectPos.x = randPlusMinusPoint5Scaled(80.0f) + this->actor.world.pos.x; - effectPos.z = randPlusMinusPoint5Scaled(80.0f) + this->actor.world.pos.z; - effectPos.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); + effectPos.x = Rand_CenteredFloat(80.0f) + this->actor.world.pos.x; + effectPos.z = Rand_CenteredFloat(80.0f) + this->actor.world.pos.z; + effectPos.y = Rand_CenteredFloat(50.0f) + (this->actor.world.pos.y + 20.0f); func_800B3030(play, &effectPos, &sEffectVelAndAccel, &sEffectVelAndAccel, 100, 0, 2); } if (this->timer == 0) { @@ -845,9 +845,9 @@ void EnIk_UpdateArmor(EnIk* this, PlayState* play) { ikEffect->pos.y = this->actor.floorHeight; for (i = 0; i < 4; i++) { - effectPos.x = randPlusMinusPoint5Scaled(20.0f) + ikEffect->pos.x; + effectPos.x = Rand_CenteredFloat(20.0f) + ikEffect->pos.x; effectPos.y = Rand_ZeroFloat(20.0f) + ikEffect->pos.y; - effectPos.z = randPlusMinusPoint5Scaled(20.0f) + ikEffect->pos.z; + effectPos.z = Rand_CenteredFloat(20.0f) + ikEffect->pos.z; func_800B3030(play, &effectPos, &gZeroVec3f, &gZeroVec3f, 40, 7, 2); } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index df217b86d9..449acf2123 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -242,7 +242,7 @@ s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) { diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; } - func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; 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 a1da5941be..d572c13316 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -1461,7 +1461,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { void func_80B88CD8(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_3); - this->picto.actor.speed = randPlusMinusPoint5Scaled(12.0f); + this->picto.actor.speed = Rand_CenteredFloat(12.0f); this->skelAnime.playSpeed = 1.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; this->unk_2B2 = Rand_ZeroOne() * 30.0f + 30.0f; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 930a0d7a38..fc8d3d201d 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -1006,11 +1006,11 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { if ((play->gameplayFrames % 4) == 0) { Math_Vec3f_Copy(&tempWorldPos, &this->picto.actor.world.pos); tempWorldPos.y = this->picto.actor.floorHeight; - tempWorldPos.x += randPlusMinusPoint5Scaled(2.0f); - tempWorldPos.z += randPlusMinusPoint5Scaled(2.0f); + tempWorldPos.x += Rand_CenteredFloat(2.0f); + tempWorldPos.z += Rand_CenteredFloat(2.0f); if (play->sceneId == SCENE_8ITEMSHOP) { - EffectSsGSplash_Spawn(play, &tempWorldPos, 0, 0, 0, randPlusMinusPoint5Scaled(100.0f) + 200.0f); + EffectSsGSplash_Spawn(play, &tempWorldPos, 0, 0, 0, Rand_CenteredFloat(100.0f) + 200.0f); SoundSource_PlaySfxAtFixedWorldPos(play, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER); } else { 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 d9d5ef7d80..820dd1f4e6 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c @@ -606,9 +606,9 @@ void func_80AD8388(EnKame* this, PlayState* play) { this->actor.scale.y = this->actor.scale.x; this->actor.scale.z = this->actor.scale.x; } - sp34.x = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.x; + sp34.x = Rand_CenteredFloat(40.0f) + this->actor.world.pos.x; sp34.y = this->actor.world.pos.y + 15.0f; - sp34.z = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.z; + sp34.z = Rand_CenteredFloat(40.0f) + this->actor.world.pos.z; func_800B3030(play, &sp34, &gZeroVec3f, &gZeroVec3f, 100, 0, 2); } } 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 e1d9df24c4..ff7e4bb082 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -135,8 +135,8 @@ void func_80954960(EnKanban* this) { ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); - this->floorRot.x = -func_80086B30(-nz * ny, 1.0f); - this->floorRot.z = func_80086B30(-nx * ny, 1.0f); + this->floorRot.x = -Math_FAtan2F(-nz * ny, 1.0f); + this->floorRot.z = Math_FAtan2F(-nx * ny, 1.0f); } } @@ -350,7 +350,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { piece->actionState = ENKANBAN_AIR; piece->actor.gravity = -1.0f; piece->actor.world.rot.y = - BINANG_ROT180((s32)randPlusMinusPoint5Scaled(0x4000) + this->actor.yawTowardsPlayer); + BINANG_ROT180((s32)Rand_CenteredFloat(0x4000) + this->actor.yawTowardsPlayer); if ((hitItem->toucher.dmgFlags & 0x10) || (hitItem->toucher.dmgFlags & 8) || (hitItem->toucher.dmgFlags & 0x80000000)) { @@ -369,7 +369,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { piece->bounceZ = Rand_ZeroFloat(7.0f) + 3.0f; } - piece->spinVel.y = randPlusMinusPoint5Scaled(0x1800); + piece->spinVel.y = Rand_CenteredFloat(0x1800); if (Rand_ZeroOne() < 0.5f) { piece->direction = 1; @@ -526,7 +526,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)randPlusMinusPoint5Scaled(0x4000); + this->actor.world.rot.y += (s16)(s32)Rand_CenteredFloat(0x4000); } bounced = true; } else { @@ -653,8 +653,8 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { dustCount = this->partCount * 0.5f; for (j = 0; j < dustCount + 3; j++) { - pos.x = randPlusMinusPoint5Scaled((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.x; - pos.z = randPlusMinusPoint5Scaled((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.z; + pos.x = Rand_CenteredFloat((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.x; + pos.z = Rand_CenteredFloat((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.z; func_800B0F18(play, &pos, &velocity, &accel, &primColor, &envColor, 100, 5, Rand_ZeroFloat(5.0f) + 14.0f); } @@ -750,7 +750,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { this->actionState = ENKANBAN_AIR; this->actor.gravity = -1.0f; - this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x10000); + this->actor.world.rot.y = Rand_CenteredFloat(0x10000); if (this->partCount >= 4) { this->bounceX = Rand_ZeroFloat(10.0f) + 6.0f; this->bounceZ = Rand_ZeroFloat(10.0f) + 6.0f; @@ -763,7 +763,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { this->actor.speed = Rand_ZeroFloat(1.5f); } - this->spinVel.y = randPlusMinusPoint5Scaled(0x1800); + this->spinVel.y = Rand_CenteredFloat(0x1800); if (Rand_ZeroOne() < 0.5f) { this->direction = 1; @@ -808,7 +808,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { this->actor.speed = 4.0f + bombStrength; } - this->spinVel.y = randPlusMinusPoint5Scaled(0x1800); + this->spinVel.y = Rand_CenteredFloat(0x1800); if (Rand_ZeroOne() < 0.5f) { this->direction = 1; 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 315bc1ffd9..94590f5b6d 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -233,9 +233,9 @@ void EnMinifrog_SpawnDust(EnMinifrog* this, PlayState* play) { vec5.z = this->actor.world.pos.z - (5.0f * Math_CosS(yaw) * Math_CosS(pitch)); for (i = 0; i < 5; i++) { - vel.x = randPlusMinusPoint5Scaled(4.0f); - vel.y = randPlusMinusPoint5Scaled(4.0f); - vel.z = randPlusMinusPoint5Scaled(4.0f); + vel.x = Rand_CenteredFloat(4.0f); + vel.y = Rand_CenteredFloat(4.0f); + vel.z = Rand_CenteredFloat(4.0f); accel.x = -vel.x * 0.1f; accel.y = -vel.y * 0.1f; accel.z = -vel.z * 0.1f; diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 3aac9ae11c..68d08b2235 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -209,11 +209,11 @@ void EnMinislime_AddIceSmokeEffect(EnMinislime* this, PlayState* play) { Vec3f pos; Vec3f vel; - pos.x = (randPlusMinusPoint5Scaled(200.0f) * this->actor.scale.x) + this->actor.world.pos.x; + pos.x = (Rand_CenteredFloat(200.0f) * this->actor.scale.x) + this->actor.world.pos.x; pos.y = CLAMP_MIN(this->actor.world.pos.y, GBT_ROOM_5_MIN_Y + 30.0f); - pos.z = (randPlusMinusPoint5Scaled(200.0f) * this->actor.scale.z) + this->actor.world.pos.z; - vel.x = randPlusMinusPoint5Scaled(1.5f); - vel.z = randPlusMinusPoint5Scaled(1.5f); + pos.z = (Rand_CenteredFloat(200.0f) * this->actor.scale.z) + this->actor.world.pos.z; + vel.x = Rand_CenteredFloat(1.5f); + vel.z = Rand_CenteredFloat(1.5f); vel.y = 2.0f; EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 500); } @@ -401,8 +401,8 @@ void EnMinislime_GrowAndShrink(EnMinislime* this, PlayState* play) { this->growShrinkTimer--; scaleFactor = (this->growShrinkTimer / 6) + 1.0f; this->actor.scale.z = this->actor.scale.x = - ((cos_rad(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * (2.0f / 30.0f))) + 1.5f) * 0.1f; - this->actor.scale.y = ((sin_rad(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * 0.05f)) + 0.75f) * 0.1f; + ((Math_CosF(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * (2.0f / 30.0f))) + 1.5f) * 0.1f; + this->actor.scale.y = ((Math_SinF(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * 0.05f)) + 0.75f) * 0.1f; if (this->actor.params == MINISLIME_SETUP_GEKKO_THROW) { EnMinislime_SetupMoveToGekko(this); } else if ((this->actor.xzDistToPlayer < 150.0f) && (this->growShrinkTimer < 38)) { @@ -424,11 +424,12 @@ void EnMinislime_Idle(EnMinislime* this, PlayState* play) { f32 speedXZ; this->idleTimer--; - speedXZ = sin_rad(this->idleTimer * (M_PI / 10)); + speedXZ = Math_SinF(this->idleTimer * (M_PI / 10)); this->actor.speed = speedXZ * 1.5f; this->actor.speed = CLAMP_MIN(this->actor.speed, 0.0f); Math_StepToF(&this->actor.scale.x, ((0.14f * speedXZ) + 1.5f) * 0.1f, 0.010000001f); - Math_StepToF(&this->actor.scale.y, ((cos_rad(this->idleTimer * (M_PI / 10)) * 0.07f) + 0.75f) * 0.1f, 0.010000001f); + Math_StepToF(&this->actor.scale.y, ((Math_CosF(this->idleTimer * (M_PI / 10)) * 0.07f) + 0.75f) * 0.1f, + 0.010000001f); Math_StepToF(&this->actor.scale.z, 0.3f - this->actor.scale.x, 0.010000001f); if (this->idleTimer == 0) { if (this->actor.xzDistToPlayer < 300.0f) { @@ -537,13 +538,13 @@ void EnMinislime_Knockback(EnMinislime* this, PlayState* play) { this->knockbackTimer--; Math_StepToF(&this->actor.speed, 0.0f, 1.0f); sqrtFrozenTimer = sqrtf(this->knockbackTimer); - this->actor.scale.x = ((cos_rad(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.15f; + this->actor.scale.x = ((Math_CosF(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.15f; this->actor.scale.z = this->actor.scale.x; if (this->knockbackTimer == 15) { this->collider.base.acFlags |= AC_ON; } - this->actor.scale.y = ((sin_rad(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.075f; + this->actor.scale.y = ((Math_SinF(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.075f; if (this->actor.params == MINISLIME_SETUP_GEKKO_THROW) { EnMinislime_SetupMoveToGekko(this); } else if (this->knockbackTimer == 0) { @@ -575,9 +576,10 @@ void EnMinislime_DefeatIdle(EnMinislime* this, PlayState* play) { f32 xzScale; this->idleTimer--; - xzScale = sin_rad(this->idleTimer * (M_PI / 10)); + xzScale = Math_SinF(this->idleTimer * (M_PI / 10)); Math_StepToF(&this->actor.scale.x, ((0.14f * xzScale) + 1.5f) * 0.1f, 0.010000001f); - Math_StepToF(&this->actor.scale.y, ((0.07f * cos_rad(this->idleTimer * (M_PI / 10))) + 0.75f) * 0.1f, 0.010000001f); + Math_StepToF(&this->actor.scale.y, ((0.07f * Math_CosF(this->idleTimer * (M_PI / 10))) + 0.75f) * 0.1f, + 0.010000001f); Math_StepToF(&this->actor.scale.z, 0.3f - this->actor.scale.x, 0.010000001f); if (this->idleTimer == 0) { this->idleTimer = 20; @@ -670,9 +672,9 @@ void EnMinislime_GekkoThrow(EnMinislime* this, PlayState* play) { f32 xzScale; this->throwTimer--; - xzScale = sin_rad(this->throwTimer * (M_PI / 5)); + xzScale = Math_SinF(this->throwTimer * (M_PI / 5)); this->actor.scale.x = ((0.3f * xzScale) + 1.5f) * 0.1f; - this->actor.scale.y = ((cos_rad(this->throwTimer * (M_PI / 5)) * 0.2f) + 0.75f) * 0.1f; + this->actor.scale.y = ((Math_CosF(this->throwTimer * (M_PI / 5)) * 0.2f) + 0.75f) * 0.1f; this->actor.scale.z = 0.3f - this->actor.scale.x; if (this->throwTimer == 0) { this->throwTimer = 10; diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c index 9b4722fba4..4e9af55786 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -274,7 +274,7 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) { Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer, 0x400); } this->actor.shape.rot.y = - (s32)(sin_rad(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speed)) + this->unk_150; + (s32)(Math_SinF(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speed)) + this->unk_150; func_800B9010(&this->actor, NA_SE_EN_KUROSUKE_MOVE - SFX_FLAG); if (sp20) { this->unk_14B &= ~2; @@ -379,16 +379,16 @@ void func_80A4E84C(EnMkk* this) { this->unk_154.y = this->actor.world.pos.y; this->unk_154.x = this->actor.world.pos.x - 10.0f * Math_SinS(this->actor.shape.rot.y + - (s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5)))); + (s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5)))); this->unk_154.z = this->actor.world.pos.z - 10.0f * Math_CosS(this->actor.shape.rot.y + - (s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5)))); + (s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5)))); this->unk_160.x = this->unk_154.x - 12.0f * Math_SinS(this->actor.shape.rot.y - - (s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5)))); + (s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5)))); this->unk_160.z = this->unk_154.z - 12.0f * Math_CosS(this->actor.shape.rot.y - - (s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5)))); + (s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5)))); } } diff --git a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c index 41f8724880..472196ae9a 100644 --- a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c +++ b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c @@ -87,9 +87,9 @@ void EnNimotsu_Update(Actor* thisx, PlayState* play) { } if ((play->state.frames % 3) == 0) { - dustPosition.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(15.0f); + dustPosition.x = this->actor.world.pos.x + Rand_CenteredFloat(15.0f); dustPosition.y = this->actor.world.pos.y; - dustPosition.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(15.0f); + dustPosition.z = this->actor.world.pos.z + Rand_CenteredFloat(15.0f); Actor_SpawnFloorDustRing(play, &this->actor, &dustPosition, 20.0f, 0, 2.0f, 0, 0, 0); } } 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 4982f7e751..0e96590d54 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -280,7 +280,7 @@ void EnNiw_SpawnAttackNiw(EnNiw* this, PlayState* play) { yView = play->view.at.y - play->view.eye.y; zView = play->view.at.z - play->view.eye.z; newNiwPos.x = ((Rand_ZeroOne() - 0.5f) * xView) + play->view.eye.x; - newNiwPos.y = randPlusMinusPoint5Scaled(0.3f) + (play->view.eye.y + 50.0f + (yView * 0.5f)); + newNiwPos.y = Rand_CenteredFloat(0.3f) + (play->view.eye.y + 50.0f + (yView * 0.5f)); newNiwPos.z = ((Rand_ZeroOne() - 0.5f) * zView) + play->view.eye.z; attackNiw = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ATTACK_NIW, newNiwPos.x, newNiwPos.y, newNiwPos.z, 0, 0, 0, ATTACK_NIW_REGULAR); @@ -340,8 +340,8 @@ void EnNiw_SetupIdle(EnNiw* this) { void EnNiw_Idle(EnNiw* this, PlayState* play) { f32 posX2; f32 posZ2; - f32 posX1 = randPlusMinusPoint5Scaled(100.0f); - f32 posZ1 = randPlusMinusPoint5Scaled(100.0f); + f32 posX1 = Rand_CenteredFloat(100.0f); + f32 posZ1 = Rand_CenteredFloat(100.0f); s16 nextAnimIndex; if (this->niwType == NIW_TYPE_REGULAR) { @@ -438,9 +438,9 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { this->heldTimer = (s32)(Rand_ZeroFloat(1.0f) * 10.0f) + 10; } - this->actor.shape.rot.x = (s16)randPlusMinusPoint5Scaled(5000.0f) + this->actor.world.rot.x; - this->actor.shape.rot.y = (s16)randPlusMinusPoint5Scaled(5000.0f) + this->actor.world.rot.y; - this->actor.shape.rot.z = (s16)randPlusMinusPoint5Scaled(5000.0f) + this->actor.world.rot.z; + 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; if (this->niwType == NIW_TYPE_REGULAR) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.shape.rot.z = 0; @@ -773,9 +773,9 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { featherCount = 4; } for (i = 0; i < featherCount; i++) { - pos.x = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.x; - pos.y = randPlusMinusPoint5Scaled(10.0f) + (this->actor.world.pos.y + this->unk308); - pos.z = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.z; + pos.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x; + pos.y = Rand_CenteredFloat(10.0f) + (this->actor.world.pos.y + this->unk308); + pos.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z; featherScale = Rand_ZeroFloat(6.0f) + 6.0f; if ((this->unk29E == 2) && (this->unk308 != 0)) { @@ -785,9 +785,9 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { if (this->unk308 == 0) { featherScale = Rand_ZeroFloat(2.0f) + 2.0f; } - vel.x = randPlusMinusPoint5Scaled(3.0f); + vel.x = Rand_CenteredFloat(3.0f); vel.y = Rand_ZeroFloat(2.0f) * 0.5f + 2.0f; - vel.z = randPlusMinusPoint5Scaled(3.0f); + vel.z = Rand_CenteredFloat(3.0f); accel.z = accel.x = 0.0f; accel.y = -0.15f; 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 fc6ef71dbc..2f8914edcd 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -110,9 +110,9 @@ void EnNwc_SpawnDust(EnNwc* this, PlayState* play) { vec5.z = this->actor.world.pos.z - 5.0f * Math_CosS(yaw) * Math_CosS(pitch); for (i = 0; i < 5; i++) { - vel.x = randPlusMinusPoint5Scaled(4.0f); - vel.y = randPlusMinusPoint5Scaled(4.0f); - vel.z = randPlusMinusPoint5Scaled(4.0f); + vel.x = Rand_CenteredFloat(4.0f); + vel.y = Rand_CenteredFloat(4.0f); + vel.z = Rand_CenteredFloat(4.0f); accel.x = -vel.x * 0.1f; accel.y = -vel.y * 0.1f; accel.z = -vel.z * 0.1f; @@ -182,7 +182,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)randPlusMinusPoint5Scaled(0x10000); + this->fallingRotY = (s16)(s32)Rand_CenteredFloat(0x10000); break; case NWC_STATE_HOPPING_FORWARD: @@ -193,7 +193,7 @@ void EnNwc_ChangeState(EnNwc* this, s16 newState) { case NWC_STATE_FOLLOWING: this->actionFunc = EnNwc_Follow; this->transformTimer = 0; - this->randomRot = (s16)(s32)randPlusMinusPoint5Scaled(10000.0f); + this->randomRot = (s16)(s32)Rand_CenteredFloat(0x2710); break; case NWC_STATE_RUNNING: @@ -331,7 +331,7 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) { } } else { // not too close: keep moving - this->randomRot += (s16)randPlusMinusPoint5Scaled(1500.0f); + this->randomRot += (s16)(s32)Rand_CenteredFloat(0x5DC); if (this->randomRot > 0x1388) { this->randomRot = 0x1388; } else if (this->randomRot < -0x1388) { diff --git a/src/overlays/actors/ovl_En_Osk/z_en_osk.c b/src/overlays/actors/ovl_En_Osk/z_en_osk.c index 7a40b38f5e..c1ce349499 100644 --- a/src/overlays/actors/ovl_En_Osk/z_en_osk.c +++ b/src/overlays/actors/ovl_En_Osk/z_en_osk.c @@ -118,9 +118,9 @@ void func_80BF5E68(EnOsk* this, AnimationHeader** animations, s16 index, f32 pla void func_80BF5EBC(EnOsk* this, PlayState* play) { Vec3f sp2C; - sp2C.x = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.x; - sp2C.z = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.z; - sp2C.y = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.y; + sp2C.x = Rand_CenteredFloat(30.0f) + this->actor.world.pos.x; + sp2C.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; + sp2C.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y; func_800B3030(play, &sp2C, &D_80BF7018, &D_80BF7018, 100, 0, 2); } 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 52f611c0e8..e5b4cabe37 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -271,7 +271,7 @@ void func_8095AB1C(EnOwl* this, PlayState* play) { } void func_8095AB4C(EnOwl* this) { - if (randPlusMinusPoint5Scaled(1.0f) < 0.0f) { + if (Rand_CenteredFloat(1.0f) < 0.0f) { this->actionFlags |= 0x20; } else { this->actionFlags &= ~0x20; diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 079e3027df..4c75fac657 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -306,7 +306,7 @@ s32 func_8086A2CC(EnPametfrog* this, CollisionPoly* floorPoly) { return false; } - rotation = func_80086C48(arg0); + rotation = Math_FAcosF(arg0); if (rotation < 0.0001f) { return false; } @@ -523,7 +523,7 @@ void EnPametfrog_FallOffSnapper(EnPametfrog* this, PlayState* play) { this->timer--; } - sin = sin_rad(this->timer * (M_PI / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f; + sin = Math_SinF(this->timer * (M_PI / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f; EnPametfrog_ShakeCamera(this, play, 300.0f * sin, 100.0f * sin); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnPametfrog_StopCutscene(this, play); @@ -966,9 +966,9 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, PlayState* play) { Flags_SetClearTemp(play, play->roomCtx.curRoom.num); for (i = 0; i < 25; i++) { - vel.x = randPlusMinusPoint5Scaled(5.0f); + vel.x = Rand_CenteredFloat(5.0f); vel.y = Rand_ZeroFloat(3.0f) + 4.0f; - vel.z = randPlusMinusPoint5Scaled(5.0f); + vel.z = Rand_CenteredFloat(5.0f); EffectSsHahen_Spawn(play, &this->actor.world.pos, &vel, &sAccel, 0, Rand_S16Offset(12, 3), HAHEN_OBJECT_DEFAULT, 10, 0); } @@ -981,7 +981,7 @@ void EnPametfrog_SpawnFrog(EnPametfrog* this, PlayState* play) { f32 magShake; this->timer--; - magShake = (sin_rad(this->timer * (M_PI / 5)) * ((0.04f * (this->timer * 0.1f)) + 0.02f)) + 1.0f; + magShake = (Math_SinF(this->timer * (M_PI / 5)) * ((0.04f * (this->timer * 0.1f)) + 0.02f)) + 1.0f; EnPametfrog_ShakeCamera(this, play, 75.0f * magShake, 10.0f * magShake); if (this->timer == 0) { EnPametfrog_StopCutscene(this, play); 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 ac073358f0..e56970e109 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -90,10 +90,10 @@ void func_808654C4(EnPart* this, PlayState* play) { break; case ENPART_TYPE_4: for (i = 7; i >= 0; i--) { - effectPos.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; - effectPos.y = randPlusMinusPoint5Scaled(50.0f) + + effectPos.x = Rand_CenteredFloat(60.0f) + this->actor.world.pos.x; + effectPos.y = Rand_CenteredFloat(50.0f) + (this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y)); - effectPos.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; + effectPos.z = Rand_CenteredFloat(60.0f) + this->actor.world.pos.z; effectVelocity.y = Rand_ZeroOne() + 1.0f; effectScale = Rand_S16Offset(80, 100); EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &gZeroVec3f, effectScale, 25, 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 d4996d74fa..645b7edf5c 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -257,9 +257,9 @@ void func_80897258(PlayState* play, EnPeehat* this, Vec3f* arg2, f32 arg3, f32 a sp44.x = (Math_SinS(sp42) * arg3) + arg2->x; sp44.z = (Math_CosS(sp42) * arg3) + arg2->z; - D_80899564.x = randPlusMinusPoint5Scaled(1.05f); - D_80899564.z = randPlusMinusPoint5Scaled(1.05f); - D_80899558.y = randPlusMinusPoint5Scaled(4.0f) + 8.0f; + D_80899564.x = Rand_CenteredFloat(1.05f); + D_80899564.z = Rand_CenteredFloat(1.05f); + D_80899558.y = Rand_CenteredFloat(4.0f) + 8.0f; EffectSsHahen_Spawn(play, &sp44, &D_80899558, &D_80899564, 0, (Rand_ZeroFloat(5.0f) + 12.0f) * arg4, HAHEN_OBJECT_DEFAULT, 10, NULL); @@ -506,7 +506,7 @@ void func_80897F44(EnPeehat* this, PlayState* play) { this->actor.world.pos.y -= 1.0f; } - cos = cos_rad(this->unk_2B8); + cos = Math_CosF(this->unk_2B8); this->actor.world.pos.y += cos * 1.4f; this->unk_2B8 += fabsf(cos * 0.18f) + 0.07f; this->unk_2B0--; @@ -514,7 +514,7 @@ void func_80897F44(EnPeehat* this, PlayState* play) { if (this->unk_2B0 <= 0) { this->actor.speed = Rand_ZeroFloat(0.5f) + 2.5f; this->unk_2B0 = Rand_ZeroFloat(10.0f) + 10.0f; - this->unk_2B6 = randPlusMinusPoint5Scaled(1000.0f); + this->unk_2B6 = Rand_CenteredFloat(1000.0f); } SkelAnime_Update(&this->skelAnime); @@ -549,10 +549,10 @@ void func_80898144(EnPeehat* this, PlayState* play) { } else { this->actor.world.pos.y += 1.0f; } - cos = cos_rad(this->unk_2B8); + cos = Math_CosF(this->unk_2B8); this->actor.world.pos.y += cos * 1.4f; - cos = cos_rad(this->unk_2B8); + cos = Math_CosF(this->unk_2B8); this->unk_2B8 += fabsf(cos * 0.18f) + 0.07f; step = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); 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 6d16c14188..48c8cd5ab5 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -397,17 +397,17 @@ void EnPp_SpawnDust(EnPp* this, PlayState* play) { Vec3f accel; for (i = 0; i < ARRAY_COUNT(this->backFootPos); i++) { - velocity.x = randPlusMinusPoint5Scaled(2.0f); + velocity.x = Rand_CenteredFloat(2.0f); velocity.y = Rand_ZeroFloat(2.0f) + 1.0f; - velocity.z = randPlusMinusPoint5Scaled(2.0f); + velocity.z = Rand_CenteredFloat(2.0f); accel.y = -0.1f; accel.z = 0.0f; accel.x = 0.0f; - pos.x = this->backFootPos[i].x + randPlusMinusPoint5Scaled(10.0f); + pos.x = this->backFootPos[i].x + Rand_CenteredFloat(10.0f); pos.y = Rand_ZeroFloat(3.0f) + this->actor.floorHeight + 1.0f; - pos.z = this->backFootPos[i].z + randPlusMinusPoint5Scaled(10.0f); + pos.z = this->backFootPos[i].z + Rand_CenteredFloat(10.0f); func_800B0EB0(play, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvColor, (Rand_ZeroFloat(50.0f) + 60.0f), 30, (Rand_ZeroFloat(5.0f) + 20.0f)); @@ -534,8 +534,8 @@ void EnPp_Idle(EnPp* this, PlayState* play) { if ((this->timer == 0) && (this->secondaryTimer == 0)) { this->secondaryTimer = Rand_ZeroFloat(20.0f) + 20.0f; Math_Vec3f_Copy(&posToLookAt, &this->actor.home.pos); - posToLookAt.x += randPlusMinusPoint5Scaled(50.0f); - posToLookAt.z += randPlusMinusPoint5Scaled(50.0f); + posToLookAt.x += Rand_CenteredFloat(50.0f); + posToLookAt.z += Rand_CenteredFloat(50.0f); this->targetRotY = Math_Vec3f_Yaw(&this->actor.world.pos, &posToLookAt); this->actor.speed = 0.0f; if (this->animIndex != EN_PP_ANIM_IDLE) { @@ -1046,8 +1046,8 @@ void EnPp_Dead(EnPp* this, PlayState* play) { if (this->actor.world.pos.y < waterSurface) { for (i = 0; i < 5; i++) { Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); - splashPos.x += randPlusMinusPoint5Scaled(10 + (5 * i)); - splashPos.z += randPlusMinusPoint5Scaled(40 + (5 * i)); + splashPos.x += Rand_CenteredFloat(10 + (5 * i)); + splashPos.z += Rand_CenteredFloat(40 + (5 * i)); EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (Rand_ZeroOne() * 100.0f) + 400.0f); } @@ -1143,9 +1143,9 @@ void EnPp_Mask_Detach(EnPp* this, PlayState* play) { for (i = 0; i < ARRAY_COUNT(sMaskFireVelocityAndAccel); i++) { Math_Vec3f_Copy(&maskFirePos, &this->maskFlamesBasePos); - maskFirePos.x += randPlusMinusPoint5Scaled(20.0f); + maskFirePos.x += Rand_CenteredFloat(20.0f); maskFirePos.y = this->actor.floorHeight; - maskFirePos.z += randPlusMinusPoint5Scaled(20.0f); + maskFirePos.z += Rand_CenteredFloat(20.0f); func_800B3030(play, &maskFirePos, &sMaskFireVelocityAndAccel[i], &sMaskFireVelocityAndAccel[i], 70, 0, 2); } @@ -1173,7 +1173,7 @@ void EnPp_BodyPart_SetupMove(EnPp* this) { this->deadBodyPartRotationalVelocity.z = (this->deadBodyPartIndex * 0x2E) + 0xFF00; if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_BODY_PART_BODY) { this->actor.speed = Rand_ZeroFloat(4.0f) + 4.0f; - this->actor.world.rot.y = ((s32)randPlusMinusPoint5Scaled(223.0f) + 0x1999) * this->deadBodyPartIndex; + this->actor.world.rot.y = ((s32)Rand_CenteredFloat(223.0f) + 0x1999) * this->deadBodyPartIndex; } this->action = EN_PP_ACTION_BODY_PART_MOVE; @@ -1213,8 +1213,8 @@ void EnPp_BodyPart_Move(EnPp* this, PlayState* play) { if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) { for (i = 0; i < 6; i++) { Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); - splashPos.x += randPlusMinusPoint5Scaled(10 + (5 * i)); - splashPos.z += randPlusMinusPoint5Scaled(40 + (5 * i)); + splashPos.x += Rand_CenteredFloat(10 + (5 * i)); + splashPos.z += Rand_CenteredFloat(40 + (5 * i)); EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (Rand_ZeroOne() * 100.0f) + 400.0f); } } else { diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.c b/src/overlays/actors/ovl_En_Pr/z_en_pr.c index 30fd0ee15f..98762c9070 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.c +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.c @@ -319,7 +319,7 @@ void func_80A32A40(EnPr* this, PlayState* play) { WaterBox* sp30; Math_Vec3f_Copy(&sp34, &this->actor.world.pos); - sp34.y = randPlusMinusPoint5Scaled(50.0f) + this->actor.home.pos.y; + sp34.y = Rand_CenteredFloat(50.0f) + this->actor.home.pos.y; if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_2B4, &sp30)) { @@ -551,9 +551,9 @@ void EnPr_Update(Actor* thisx, PlayState* play) { Math_Vec3f_Copy(&sp40, &this->unk_2D4); this->unk_204 = 0; - sp40.x += randPlusMinusPoint5Scaled(20.0f); - sp40.y += randPlusMinusPoint5Scaled(5.0f); - sp40.z += randPlusMinusPoint5Scaled(20.0f); + sp40.x += Rand_CenteredFloat(20.0f); + sp40.y += Rand_CenteredFloat(5.0f); + sp40.z += Rand_CenteredFloat(20.0f); for (i = 0; i < (s32)Rand_ZeroFloat(5.0f) + 5; i++) { EffectSsBubble_Spawn(play, &sp40, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); 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 f4747b4c67..a4dd96d4b4 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c @@ -390,8 +390,8 @@ void func_80A748E8(EnPr2* this, PlayState* play) { if (this->unk_1DA == 1) { this->unk_1D8 = Rand_S16Offset(100, 100); Math_Vec3f_Copy(&sp3C, &this->unk_228); - sp3C.x += randPlusMinusPoint5Scaled(300.0f); - sp3C.z += randPlusMinusPoint5Scaled(300.0f); + sp3C.x += Rand_CenteredFloat(300.0f); + sp3C.z += Rand_CenteredFloat(300.0f); Math_Vec3f_Copy(&this->unk_21C, &sp3C); } } else { @@ -536,7 +536,7 @@ void func_80A751B4(EnPr2* this) { this->actor.shape.rot.z = this->actor.world.rot.z; this->unk_1D8 = 30; this->actor.speed = Rand_ZeroFloat(0.5f); - this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x8000); + this->actor.world.rot.y = Rand_CenteredFloat(0x8000); } Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 10); this->unk_1D4 = 3; @@ -596,9 +596,9 @@ void func_80A75310(EnPr2* this, PlayState* play) { for (i = 0; i < 10; i++) { Math_Vec3f_Copy(&sp64, &this->actor.world.pos); - sp64.x += randPlusMinusPoint5Scaled(20.0f); - sp64.y += randPlusMinusPoint5Scaled(5.0f); - sp64.z += randPlusMinusPoint5Scaled(20.0f); + sp64.x += Rand_CenteredFloat(20.0f); + sp64.y += Rand_CenteredFloat(5.0f); + sp64.z += Rand_CenteredFloat(20.0f); frame = Rand_ZeroFloat(0.03f) + 0.07f; EffectSsBubble_Spawn(play, &sp64, 0.0f, 5.0f, 5.0f, frame); @@ -675,9 +675,9 @@ void EnPr2_Update(Actor* thisx, PlayState* play) { Math_Vec3f_Copy(&sp58, &this->unk_270); this->unk_1D6 = false; - sp58.x += randPlusMinusPoint5Scaled(20.0f); - sp58.y += randPlusMinusPoint5Scaled(5.0f); - sp58.z += randPlusMinusPoint5Scaled(20.0f); + sp58.x += Rand_CenteredFloat(20.0f); + sp58.y += Rand_CenteredFloat(5.0f); + sp58.z += Rand_CenteredFloat(20.0f); for (i = 0; i < 2; i++) { rand = Rand_ZeroFloat(0.03f) + 0.07f; 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 d71de14f78..ef37cf9f0a 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.c +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.c @@ -127,7 +127,7 @@ void EnPrz_Init(Actor* thisx, PlayState* play) { this->unk_220 = &this->actor; this->unk_1EC = 255; - this->unk_202 = randPlusMinusPoint5Scaled((this->unk_1E6 * 100.0f) + 1000.0f); + this->unk_202 = Rand_CenteredFloat((this->unk_1E6 * 100.0f) + 1000.0f); func_80A76388(this); } @@ -176,7 +176,7 @@ void func_80A76070(EnPrz* this, s16 arg1, PlayState* play) { temp_s0 = -100; } - if (fabsf(this->actor.world.rot.y - (f32)arg1) < (randPlusMinusPoint5Scaled(20.0f) + 100.0f)) { + if (fabsf(this->actor.world.rot.y - (f32)arg1) < (Rand_CenteredFloat(20.0f) + 100.0f)) { Math_ApproachZeroF(&this->unk_218, 0.5f, 20.0f); } else { Math_ApproachF(&this->unk_218, temp_s0, 0.5f, 5.0f); @@ -218,7 +218,7 @@ s32 func_80A762C0(EnPrz* this, PlayState* play) { } void func_80A76388(EnPrz* this) { - this->actor.speed = randPlusMinusPoint5Scaled(1.0f) + 4.0f; + this->actor.speed = Rand_CenteredFloat(1.0f) + 4.0f; func_80A75F18(this, 0); this->unk_1EA = 1; this->actionFunc = func_80A763E8; @@ -251,11 +251,11 @@ void func_80A763E8(EnPrz* this, PlayState* play) { if ((this->unk_1EE == 0) && (this->unk_1F2 == 0)) { s16 rot; - this->unk_214 = randPlusMinusPoint5Scaled(40.0f); + this->unk_214 = Rand_CenteredFloat(40.0f); rot = BINANG_ROT180(this->unk_220->world.rot.y); this->unk_1D8.x += Math_SinS(rot) * this->unk_214; - this->unk_1D8.y = randPlusMinusPoint5Scaled(40.0f) + (this->unk_220->world.pos.y + 40.0f); + this->unk_1D8.y = Rand_CenteredFloat(40.0f) + (this->unk_220->world.pos.y + 40.0f); rot = BINANG_ROT180(this->unk_220->world.rot.y); this->unk_1D8.z += Math_CosS(rot) * this->unk_214; @@ -302,7 +302,7 @@ void func_80A76634(EnPrz* this, PlayState* play) { } void func_80A76748(EnPrz* this) { - this->actor.speed = randPlusMinusPoint5Scaled(1.0f) + 3.0f; + this->actor.speed = Rand_CenteredFloat(1.0f) + 3.0f; this->unk_1EE = 0; this->unk_1EA = 3; this->skelAnime.playSpeed = 2.0f; @@ -317,7 +317,7 @@ void func_80A767A8(EnPrz* this, PlayState* play) { if (func_80A762C0(this, play)) { func_80A75F18(this, 0); - this->actor.speed = randPlusMinusPoint5Scaled(1.0f) + 4.0f; + this->actor.speed = Rand_CenteredFloat(1.0f) + 4.0f; func_80A76604(this, play); return; } @@ -353,8 +353,8 @@ void func_80A767A8(EnPrz* this, PlayState* play) { this->unk_1C8 = 1; } - this->unk_1D8.y = (player->actor.world.pos.y + D_80A771E0[GET_PLAYER_FORM]) + - randPlusMinusPoint5Scaled((2.0f * this->unk_1E6) + 1.0f); + this->unk_1D8.y = + (player->actor.world.pos.y + D_80A771E0[GET_PLAYER_FORM]) + Rand_CenteredFloat((2.0f * this->unk_1E6) + 1.0f); func_80A76070(this, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_1D8), play); } @@ -374,7 +374,7 @@ void func_80A76A1C(EnPrz* this) { this->unk_1FE = this->actor.world.rot.y; this->actor.speed = Rand_ZeroFloat(0.5f); - this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x8000); + this->actor.world.rot.y = Rand_CenteredFloat(0x8000); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 30); this->unk_1EE = 50; @@ -409,9 +409,9 @@ void func_80A76B14(EnPrz* this, PlayState* play) { for (i = 0; i < 10; i++) { Math_Vec3f_Copy(&sp6C, &this->actor.world.pos); - sp6C.x += randPlusMinusPoint5Scaled(20.0f); - sp6C.y += randPlusMinusPoint5Scaled(5.0f); - sp6C.z += randPlusMinusPoint5Scaled(20.0f); + sp6C.x += Rand_CenteredFloat(20.0f); + sp6C.y += Rand_CenteredFloat(5.0f); + sp6C.z += Rand_CenteredFloat(20.0f); EffectSsBubble_Spawn(play, &sp6C, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); } @@ -473,9 +473,9 @@ void EnPrz_Update(Actor* thisx, PlayState* play) { Math_Vec3f_Copy(&sp38, &this->unk_1CC); this->unk_1C8 = 0; - sp38.x += randPlusMinusPoint5Scaled(20.0f); - sp38.y += randPlusMinusPoint5Scaled(5.0f); - sp38.z += randPlusMinusPoint5Scaled(20.0f); + sp38.x += Rand_CenteredFloat(20.0f); + sp38.y += Rand_CenteredFloat(5.0f); + sp38.z += Rand_CenteredFloat(20.0f); EffectSsBubble_Spawn(play, &sp38, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); } 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 ba76766551..d4e83a388d 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -275,8 +275,8 @@ s16 EnRacedog_GetYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ) if (path != NULL) { point = Lib_SegmentedToVirtual(path->points); point = &point[pointIndex]; - diffXRand = (randPlusMinusPoint5Scaled(100.0f) + point->x) - pos->x; - diffZRand = (randPlusMinusPoint5Scaled(100.0f) + point->z) - pos->z; + diffXRand = (Rand_CenteredFloat(100.0f) + point->x) - pos->x; + diffZRand = (Rand_CenteredFloat(100.0f) + point->z) - pos->z; diffX = point->x - pos->x; diffZ = point->z - pos->z; } else { @@ -474,9 +474,9 @@ void EnRacedog_UpdateSpeed(EnRacedog* this) { // The dog is past the very start, but is still less than 1/4th of the way through the race track. // This code will give the blue dog a higher base speed than any other dog (6.0 instead of 5.0). if (sDogInfo[this->index].color == DOG_COLOR_BLUE) { - this->targetSpeed = sBaseSpeeds[sDogInfo[this->index].color][0] + randPlusMinusPoint5Scaled(1.0f); + this->targetSpeed = sBaseSpeeds[sDogInfo[this->index].color][0] + Rand_CenteredFloat(1.0f); } else { - this->targetSpeed = 5.0f + randPlusMinusPoint5Scaled(1.0f); + this->targetSpeed = 5.0f + Rand_CenteredFloat(1.0f); } if (DOG_IS_IN_GOOD_CONDITION(this) && (this->index != sFirstPlaceIndex)) { @@ -485,9 +485,9 @@ void EnRacedog_UpdateSpeed(EnRacedog* this) { } else if (this->currentPoint < (quarterPathCount * 3)) { // The dog is between 1/4th and 3/4ths of the way through the race track. if (this->currentPoint < sDogInfo[this->index].pointToUseSecondBaseSpeed) { - this->targetSpeed = 5.0f + randPlusMinusPoint5Scaled(1.0f); + this->targetSpeed = 5.0f + Rand_CenteredFloat(1.0f); } else { - this->targetSpeed = sBaseSpeeds[sDogInfo[this->index].color][1] + randPlusMinusPoint5Scaled(1.0f); + this->targetSpeed = sBaseSpeeds[sDogInfo[this->index].color][1] + Rand_CenteredFloat(1.0f); if (DOG_IS_IN_GOOD_CONDITION(this) && (this->index != sFirstPlaceIndex)) { this->targetSpeed *= sDogInfo[this->index].goodConditionSpeedMultiplier; @@ -497,7 +497,7 @@ void EnRacedog_UpdateSpeed(EnRacedog* this) { // The dog is more than 3/4ths of the way through the race track. EnRacedog_CalculateFinalStretchTargetSpeed(this); } else { - this->targetSpeed = randPlusMinusPoint5Scaled(1.0f) + 5.0f; + this->targetSpeed = Rand_CenteredFloat(1.0f) + 5.0f; } } } @@ -657,9 +657,9 @@ void EnRacedog_SpawnFloorDustRing(EnRacedog* this, PlayState* play) { Vec3f pos; if (((this->index + curFrame) % mod) == 0) { - pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(15.0f); + pos.x = this->actor.world.pos.x + Rand_CenteredFloat(15.0f); pos.y = this->actor.world.pos.y; - pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(15.0f); + pos.z = this->actor.world.pos.z + Rand_CenteredFloat(15.0f); Actor_SpawnFloorDustRing(play, &this->actor, &pos, 10.0f, 0, 2.0f, 300, 0, true); } } 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 055b308f28..1a4024f513 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -895,9 +895,9 @@ void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* acc effect->accel = *accel; effect->scale = scale; effect->timer = timer; - effect->rotation.x = randPlusMinusPoint5Scaled(30000.0f); - effect->rotation.y = randPlusMinusPoint5Scaled(30000.0f); - effect->rotation.z = randPlusMinusPoint5Scaled(30000.0f); + effect->rotation.x = Rand_CenteredFloat(30000.0f); + effect->rotation.y = Rand_CenteredFloat(30000.0f); + effect->rotation.z = Rand_CenteredFloat(30000.0f); return; } } 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 7d585c234d..e08cb5574b 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -230,7 +230,7 @@ s32 EnRat_UpdateFloorPoly(EnRat* this, CollisionPoly* floorPoly, PlayState* play return false; } - angle = func_80086C48(normDotUp); + angle = Math_FAcosF(normDotUp); if (angle < 0.001f) { return false; } @@ -324,9 +324,9 @@ void EnRat_ChooseDirection(EnRat* this) { angle -= 0x8000; } - angle += (s16)randPlusMinusPoint5Scaled(0x800); + angle += (s16)(s32)Rand_CenteredFloat(0x800); } else { - angle = (Rand_ZeroOne() < 0.1f) ? (s16)randPlusMinusPoint5Scaled(0x800) : 0; + angle = (Rand_ZeroOne() < 0.1f) ? (s16)(s32)Rand_CenteredFloat(0x800) : 0; } } @@ -633,9 +633,9 @@ void EnRat_UpdateSparkOffsets(EnRat* this) { for (i = 0; i < ARRAY_COUNT(this->sparkOffsets); i++) { ptr = &this->sparkOffsets[i]; - ptr->x = randPlusMinusPoint5Scaled(6.0f); - ptr->y = randPlusMinusPoint5Scaled(6.0f); - ptr->z = randPlusMinusPoint5Scaled(6.0f); + ptr->x = Rand_CenteredFloat(6.0f); + ptr->y = Rand_CenteredFloat(6.0f); + ptr->z = Rand_CenteredFloat(6.0f); } } @@ -937,14 +937,14 @@ void EnRat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBombCapDL); if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON) { - redModifier = fabsf(cos_rad(this->timer * (M_PI / 30.f))); + redModifier = fabsf(Math_CosF(this->timer * (M_PI / 30.f))); } else { if (this->timer >= 120) { - redModifier = fabsf(cos_rad((this->timer % 30) * (M_PI / 30.0f))); + redModifier = fabsf(Math_CosF((this->timer % 30) * (M_PI / 30.0f))); } else if (this->timer >= 30) { - redModifier = fabsf(cos_rad((this->timer % 6) * (M_PI / 6.0f))); + redModifier = fabsf(Math_CosF((this->timer % 6) * (M_PI / 6.0f))); } else { - redModifier = fabsf(cos_rad((this->timer % 3) * (M_PI / 3.0f))); + redModifier = fabsf(Math_CosF((this->timer % 3) * (M_PI / 3.0f))); } } diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index 351b2f1462..dfff2735c7 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -161,7 +161,7 @@ s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIn diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; } - func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; } @@ -194,7 +194,7 @@ s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32 diffZ = points[currentPoint - 1].z - points[currentPoint + 1].z; } - func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; } diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index b34ee8c641..17ad656a47 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -417,9 +417,9 @@ void EnSb_Draw(Actor* thisx, PlayState* play) { fireDecr = this->fireCount - 1; if (!(fireDecr & 1)) { offset = &sFlamePosOffsets[fireDecr & 3]; - flamePos.x = randPlusMinusPoint5Scaled(5.0f) + (this->actor.world.pos.x + offset->x); - flamePos.y = randPlusMinusPoint5Scaled(5.0f) + (this->actor.world.pos.y + offset->y); - flamePos.z = randPlusMinusPoint5Scaled(5.0f) + (this->actor.world.pos.z + offset->z); + flamePos.x = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.x + offset->x); + flamePos.y = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.y + offset->y); + flamePos.z = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.z + offset->z); EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, 100, 0, 0, -1); } } diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index 9779de80ca..448683376d 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -192,7 +192,7 @@ s32 func_80BCD334(EnScopecrow* this, Path* path, s32 pointIndex) { phi_fa1 = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x); if (((this->actor.world.pos.x * sp3C.z) + (sp3C.y * this->actor.world.pos.z) + sp3C.x) > 0.0f) { ret = true; diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 08b4b2817b..cf634321eb 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -654,7 +654,7 @@ s32 func_80BCC2AC(EnScopenuts* this, Path* path, s32 arg2_) { phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { sp50 = true; diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index e22791c82a..73edc4267d 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -916,7 +916,7 @@ s32 func_80ADCE4C(EnSellnuts* this, Path* path, s32 arg2) { pointY = points[var + 1].z - points[var - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(pointX, pointY)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(pointX, pointY)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index e67808d386..a8167009cf 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -165,10 +165,10 @@ void func_809947B0(PlayState* play, EnSkb* this, Vec3f* inPos) { s32 pad; pos.y = this->actor.floorHeight; - pos.x = (sin_rad(sp40) * 15.0f) + inPos->x; - pos.z = (cos_rad(sp40) * 15.0f) + inPos->z; - accel.x = randPlusMinusPoint5Scaled(1.0f); - accel.z = randPlusMinusPoint5Scaled(1.0f); + pos.x = (Math_SinF(sp40) * 15.0f) + inPos->x; + pos.z = (Math_CosF(sp40) * 15.0f) + inPos->z; + accel.x = Rand_CenteredFloat(1.0f); + accel.z = Rand_CenteredFloat(1.0f); velocity.y += (Rand_ZeroOne() - 0.5f) * 4.0f; EffectSsHahen_Spawn(play, &pos, &velocity, &accel, 0, ((Rand_ZeroOne() * 5.0f) + 12.0f) * 0.8f, HAHEN_OBJECT_DEFAULT, 10, NULL); @@ -579,7 +579,7 @@ void func_80995A8C(EnSkb* this, PlayState* play) { } if ((this->unk_3D8 != 0) && ((play->gameplayFrames % 16) == 0)) { - this->unk_3DA = randPlusMinusPoint5Scaled(50000.0f); + this->unk_3DA = Rand_CenteredFloat(50000.0f); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk_3DA, 1, 0x2EE, 0); diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.c b/src/overlays/actors/ovl_En_Slime/z_en_slime.c index 5c962978e0..5e71d1a540 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.c +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.c @@ -328,15 +328,15 @@ void EnSlime_Idle(EnSlime* this, PlayState* play) { timerFactor = sqrtf(this->timer) * 0.2f; EnSlime_Blink(this); - scale = ((sin_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.13f * timerFactor)) + 1.0f) * 0.01f; + scale = ((Math_SinF(this->timer * (2.0f * M_PI / 5.0f)) * (0.13f * timerFactor)) + 1.0f) * 0.01f; this->actor.scale.x = scale; this->actor.scale.z = scale; if (this->timer < 24) { - this->actor.scale.y = ((cos_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * timerFactor)) + 1.0f) * 0.01f; + this->actor.scale.y = ((Math_CosF(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * timerFactor)) + 1.0f) * 0.01f; } - this->actor.shape.rot.x = randPlusMinusPoint5Scaled(0x200) * timerFactor; - this->actor.shape.rot.z = randPlusMinusPoint5Scaled(0x200) * timerFactor; + this->actor.shape.rot.x = Rand_CenteredFloat(0x200) * timerFactor; + this->actor.shape.rot.z = Rand_CenteredFloat(0x200) * timerFactor; // If player is not wearing the stone mask, is within 280 units of the chuchu, // and the chuchu is facing the player, initialize chase/attack cycle. @@ -361,7 +361,7 @@ void EnSlime_SetupMoveInDirection(EnSlime* this) { if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 120.0f) { this->idleRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } else if (Rand_ZeroOne() < 0.7f) { - this->idleRotY = (s32)randPlusMinusPoint5Scaled(0x4000) + this->actor.shape.rot.y; + this->idleRotY = (s32)Rand_CenteredFloat(0x4000) + this->actor.shape.rot.y; } this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnSlime_MoveInDirection; @@ -390,7 +390,7 @@ void EnSlime_MoveInDirection(EnSlime* this, PlayState* play) { } // Update actor scale, xz speed, and rotation to provide amorphous effect - sinFactor = fabsf(sin_rad(this->timer * (M_PI / 24))); + sinFactor = fabsf(Math_SinF(this->timer * (M_PI / 24))); Math_StepToF(&this->actor.scale.z, ((0.15f * sinFactor) + 1.0f) * 0.01f, 0.0002f); Math_StepToF(&this->actor.scale.x, (1.0f - (0.2f * sinFactor)) * 0.01f, 0.0002f); Math_StepToF(&this->actor.scale.y, (1.0f - (0.1f * sinFactor)) * 0.01f, 0.0002f); @@ -443,7 +443,7 @@ void EnSlime_MoveToHome(EnSlime* this, PlayState* play) { this->idleRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } - timerFactor = fabsf(sin_rad(this->timer * (M_PI / 24))); + timerFactor = fabsf(Math_SinF(this->timer * (M_PI / 24))); Math_StepToF(&this->actor.scale.z, ((0.15f * timerFactor) + 1.0f) * 0.01f, 0.0002f); Math_StepToF(&this->actor.scale.x, (1.0f - (0.2f * timerFactor)) * 0.01f, 0.0002f); Math_StepToF(&this->actor.scale.y, (1.0f - (0.1f * timerFactor)) * 0.01f, 0.0002f); @@ -567,14 +567,14 @@ void EnSlime_Land(EnSlime* this, PlayState* play) { this->timer--; scaleY = ((this->timer / 5) + 1) * 1.6f; rotXZ = sqrtf(this->timer) * 0.2f; - scaleXZ = ((cos_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * scaleY)) + 1.0f) * 0.01f; + scaleXZ = ((Math_CosF(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * scaleY)) + 1.0f) * 0.01f; this->actor.scale.x = scaleXZ; this->actor.scale.z = scaleXZ; if (this->timer < 15) { - this->actor.scale.y = (1.0f - (sin_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.04f * scaleY))) * 0.01f; + this->actor.scale.y = (1.0f - (Math_SinF(this->timer * (2.0f * M_PI / 5.0f)) * (0.04f * scaleY))) * 0.01f; } - this->actor.shape.rot.x = randPlusMinusPoint5Scaled(0x200) * rotXZ; - this->actor.shape.rot.z = randPlusMinusPoint5Scaled(0x200) * rotXZ; + this->actor.shape.rot.x = Rand_CenteredFloat(0x200) * rotXZ; + this->actor.shape.rot.z = Rand_CenteredFloat(0x200) * rotXZ; if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > this->distLimit) { EnSlime_SetupMoveToHome(this); @@ -623,16 +623,16 @@ void EnSlime_ReactToBluntHit(EnSlime* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.0f, 1.0f); timerFactor = sqrtf(this->timer); if (this->timer < 30) { - scale = ((cos_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.08f * timerFactor)) + 1.0f) * 0.01f; + scale = ((Math_CosF(this->timer * (2.0f * M_PI / 5.0f)) * (0.08f * timerFactor)) + 1.0f) * 0.01f; this->actor.scale.x = scale; this->actor.scale.z = scale; } if (this->timer == 15) { this->collider.base.acFlags |= AC_ON; } - this->actor.scale.y = ((sin_rad((f32)this->timer * (2.0f * M_PI / 5.0f)) * (0.07f * timerFactor)) + 1.0f) * 0.01f; - this->actor.shape.rot.x = randPlusMinusPoint5Scaled(0x200) * timerFactor; - this->actor.shape.rot.z = randPlusMinusPoint5Scaled(0x200) * timerFactor; + this->actor.scale.y = ((Math_SinF((f32)this->timer * (2.0f * M_PI / 5.0f)) * (0.07f * timerFactor)) + 1.0f) * 0.01f; + this->actor.shape.rot.x = Rand_CenteredFloat(0x200) * timerFactor; + this->actor.shape.rot.z = Rand_CenteredFloat(0x200) * timerFactor; if (this->timer == 0) { if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > this->distLimit) { @@ -680,9 +680,9 @@ void EnSlime_SetupDamaged(EnSlime* this, PlayState* play, s32 arg2) { EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 550); for (i = 0; i < 10; i++) { - effectPos.x = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.x + ySin; - effectPos.y = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.y + 40.0f; - effectPos.z = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.z + yCos; + effectPos.x = Rand_CenteredFloat(40.0f) + this->actor.world.pos.x + ySin; + effectPos.y = Rand_CenteredFloat(10.0f) + this->actor.world.pos.y + 40.0f; + effectPos.z = Rand_CenteredFloat(40.0f) + this->actor.world.pos.z + yCos; effectVelocity.x = ((Rand_ZeroOne() * 3.5f) + 1.0f) * -Math_SinS(this->actor.world.rot.y); effectVelocity.z = ((Rand_ZeroOne() * 3.5f) + 1.0f) * -Math_CosS(this->actor.world.rot.y); @@ -1184,9 +1184,9 @@ void EnSlime_Draw(Actor* thisx, PlayState* play) { } if (this->actionFunc == EnSlime_Damaged) { - wobbleScale.x = 1.0f - (sin_rad((f32)this->timer * (M_PI / 2.0f)) * 0.3f); - wobbleScale.y = (sin_rad((f32)this->timer * (M_PI / 2.0f)) * 0.3f) + 1.0f; - wobbleScale.z = 1.0f - (cos_rad((f32)this->timer * (M_PI / 2.0f)) * 0.3f); + wobbleScale.x = 1.0f - (Math_SinF((f32)this->timer * (M_PI / 2.0f)) * 0.3f); + wobbleScale.y = (Math_SinF((f32)this->timer * (M_PI / 2.0f)) * 0.3f) + 1.0f; + wobbleScale.z = 1.0f - (Math_CosF((f32)this->timer * (M_PI / 2.0f)) * 0.3f); Matrix_RotateXFApply(this->wobbleRot.x); Matrix_RotateZF(this->wobbleRot.z, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c index ed32353451..e22a5a73b8 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -475,18 +475,18 @@ void EnSnowman_ReadySnowball(EnSnowman* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1000); if ((EN_SNOWMAN_GET_TYPE(&this->actor) != EN_SNOWMAN_TYPE_LARGE) && this->isHoldingSnowball && ((play->gameplayFrames % 2) != 0)) { - pos.x = randPlusMinusPoint5Scaled(10.0f) + this->snowballPos.x; - pos.y = randPlusMinusPoint5Scaled(10.0f) + this->snowballPos.y; - pos.z = randPlusMinusPoint5Scaled(10.0f) + this->snowballPos.z; + pos.x = Rand_CenteredFloat(10.0f) + this->snowballPos.x; + pos.y = Rand_CenteredFloat(10.0f) + this->snowballPos.y; + pos.z = Rand_CenteredFloat(10.0f) + this->snowballPos.z; func_800B0DE0(play, &pos, &sDustVelocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 500, 30); } else if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { if ((this->skelAnime.curFrame > 3.0f) && (this->skelAnime.curFrame < 14.0f) && ((play->gameplayFrames % 2) != 0)) { - pos.x = (this->actor.world.pos.x + (70.0f * Math_SinS(this->actor.shape.rot.y))) + - randPlusMinusPoint5Scaled(40.0f); - pos.y = this->actor.world.pos.y + randPlusMinusPoint5Scaled(20.0f); - pos.z = (this->actor.world.pos.z + (70.0f * Math_CosS(this->actor.shape.rot.y))) + - randPlusMinusPoint5Scaled(40.0f); + pos.x = + (this->actor.world.pos.x + (70.0f * Math_SinS(this->actor.shape.rot.y))) + Rand_CenteredFloat(40.0f); + pos.y = this->actor.world.pos.y + Rand_CenteredFloat(20.0f); + pos.z = + (this->actor.world.pos.z + (70.0f * Math_CosS(this->actor.shape.rot.y))) + Rand_CenteredFloat(40.0f); func_800B0DE0(play, &pos, &sDustVelocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 1000, 150); } } @@ -619,8 +619,8 @@ void EnSnowman_Melt(EnSnowman* this, PlayState* play) { this->work.timer--; if ((this->work.timer >= 38) && (!(this->work.timer & 1))) { smokeVelocity.y = (this->work.timer - 38) * (1.0f / 12.0f); - smokeVelocity.x = randPlusMinusPoint5Scaled(1.5f) * smokeVelocity.y; - smokeVelocity.z = randPlusMinusPoint5Scaled(1.5f) * smokeVelocity.y; + smokeVelocity.x = Rand_CenteredFloat(1.5f) * smokeVelocity.y; + smokeVelocity.z = Rand_CenteredFloat(1.5f) * smokeVelocity.y; smokeVelocity.y += 0.8f; smokePos.x = ((smokeVelocity.x >= 0.0f ? 1.0f : -1.0f) * Rand_ZeroFloat(20.0f) * this->eenoScale) + this->actor.world.pos.x; 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 e86d1e1bd5..12d8d22a8a 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -536,9 +536,9 @@ void func_80BAB374(EnSuttari* this, PlayState* play) { Vec3f sp38; if ((curFrame % 3) == 0) { - sp38.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x; + sp38.x = Rand_CenteredFloat(15.0f) + this->actor.world.pos.x; sp38.y = this->actor.world.pos.y; - sp38.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z; + sp38.z = Rand_CenteredFloat(15.0f) + this->actor.world.pos.z; Actor_SpawnFloorDustRing(play, &this->actor, &sp38, 10.0f, 0, 2.0f, 0, 0, 0); } } @@ -623,7 +623,7 @@ s32 func_80BAB758(EnSuttari* this, Path* path, s32 arg2) { sp54 = sp5C[index + 1].x - sp5C[index - 1].x; sp48 = sp5C[index + 1].z - sp5C[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(sp54, sp48)), &sp44, &sp40, &sp3C); if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; } @@ -653,7 +653,7 @@ s32 func_80BAB8F4(EnSuttari* this, Path* path, s32 arg2) { sp54 = sp5C[index - 1].x - sp5C[index + 1].x; sp48 = sp5C[index - 1].z - sp5C[index + 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(sp54, sp48)), &sp44, &sp40, &sp3C); if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; } 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 a705a85467..4937125dcd 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -304,7 +304,7 @@ s32 func_808D91C4(EnSw* this, CollisionPoly* arg1) { return false; } - sp4C = func_80086C48(temp_f12); + sp4C = Math_FAcosF(temp_f12); if (sp4C < 0.001f) { return false; } 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 5f5194523e..af419ba236 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 * sin_rad(this->skelAnime.curFrame * (M_PI / 4))); + rot->y += (s16)(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4))); } else if (limbIndex == OBJECT_CROW_LIMB_TAIL) { - rot->y += (s16)(0x1400 * sin_rad((this->skelAnime.curFrame + 2.5f) * (M_PI / 4))); + rot->y += (s16)(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4))); } return false; diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c index 324307d8a5..91ed081400 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c @@ -404,7 +404,7 @@ void func_80A36CB0(EnSyatekiOkuta* this) { } } else if (this->actionFunc == func_80A36488) { this->unk_1D8.x = this->unk_1D8.z = 1.0f; - this->unk_1D8.y = (sin_rad((M_PI / 16) * curFrame) * 0.2f) + 1.0f; + this->unk_1D8.y = (Math_SinF((M_PI / 16) * curFrame) * 0.2f) + 1.0f; } else if (this->actionFunc == func_80A36504) { if (curFrame < 3.0f) { this->unk_1D8.y = 1.0f; @@ -440,7 +440,7 @@ s32 func_80A370EC(EnSyatekiOkuta* this, f32 arg1, Vec3f* arg2) { if (this->actionFunc == func_80A363B4) { arg2->y = 1.0f; arg2->z = 1.0f; - arg2->x = (sin_rad((M_PI / 16) * arg1) * 0.4f) + 1.0f; + arg2->x = (Math_SinF((M_PI / 16) * arg1) * 0.4f) + 1.0f; } else if (this->actionFunc == func_80A365EC) { if ((arg1 >= 35.0f) || (arg1 < 25.0f)) { return false; diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index 52aa71cad5..347d78088e 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -408,9 +408,9 @@ void EnSyatekiWf_Dead(EnSyatekiWf* this, PlayState* play) { s32 i; for (i = (s32)this->skelAnime.animLength - (s32)this->skelAnime.curFrame; i >= 0; i--) { - firePos.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; - firePos.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; - firePos.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); + firePos.x = Rand_CenteredFloat(60.0f) + this->actor.world.pos.x; + firePos.z = Rand_CenteredFloat(60.0f) + this->actor.world.pos.z; + firePos.y = Rand_CenteredFloat(50.0f) + (this->actor.world.pos.y + 20.0f); func_800B3030(play, &firePos, &sFireVelocityAndAccel, &sFireVelocityAndAccel, 100, 0, 2); } } diff --git a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c index 495c16c137..c716760619 100644 --- a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c +++ b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c @@ -248,9 +248,9 @@ void func_80BB5318(EnTanron1* this, PlayState* play) { ptr->unk_20 = Math_Atan2S(temp.x, temp.z); ptr->unk_1E = Math_Atan2S(temp.y, sqrtf(SQXZ(temp))); if ((ptr->unk_26 & 0xF) == 0) { - ptr->unk_30 = randPlusMinusPoint5Scaled(temp_f30); - ptr->unk_34 = randPlusMinusPoint5Scaled(temp_f30 * 0.5f); - ptr->unk_38 = randPlusMinusPoint5Scaled(temp_f30); + ptr->unk_30 = Rand_CenteredFloat(temp_f30); + ptr->unk_34 = Rand_CenteredFloat(temp_f30 * 0.5f); + ptr->unk_38 = Rand_CenteredFloat(temp_f30); } temp.x = player->actor.world.pos.x - ptr->unk_00.x; @@ -336,7 +336,7 @@ void func_80BB5318(EnTanron1* this, PlayState* play) { Math_ApproachF(&ptr->unk_30, ptr->unk_34, 1.0f, 0.5f); if ((ptr->unk_26 & 0xF) == 0) { if (Rand_ZeroOne() < 0.5f) { - ptr->unk_34 = randPlusMinusPoint5Scaled(12.0f); + ptr->unk_34 = Rand_CenteredFloat(12.0f); } ptr->unk_3C = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp98, &ptr->unk_00); sp9C = ptr->unk_00.y; 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 dd4f389a36..785308dad5 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -236,7 +236,7 @@ void func_80BB6BD8(EnTanron2* this, PlayState* play) { switch (this->unk_158) { case 0: if (Rand_ZeroOne() > 0.2f) { - sp32 = Rand_ZeroFloat(65536.0f); + sp32 = Rand_ZeroFloat(0x10000); } else { sp32 = Math_Atan2S(sp2C, sp28); } 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 b86b9c714a..81a4ac2af3 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -100,8 +100,8 @@ void EnTanron3_CreateEffect(PlayState* play, Vec3f* effectPos) { effectPtr->unk_34.y = 0.0f; effectPtr->unk_34.z = Rand_ZeroFloat(2 * M_PI); effectPtr->unk_02 = Rand_ZeroFloat(100.0f); - effectPtr->velocity.x = randPlusMinusPoint5Scaled(25.0f); - effectPtr->velocity.z = randPlusMinusPoint5Scaled(25.0f); + effectPtr->velocity.x = Rand_CenteredFloat(25.0f); + effectPtr->velocity.z = Rand_CenteredFloat(25.0f); break; } } @@ -155,9 +155,9 @@ void EnTanron3_SetupLive(EnTanron3* this, PlayState* play) { this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] = 50; this->actor.speed = 5.0f; this->speedMaxStep = 0.5f; - this->deviation.x = randPlusMinusPoint5Scaled(500.0f); - this->deviation.y = randPlusMinusPoint5Scaled(100.0f); - this->deviation.z = randPlusMinusPoint5Scaled(500.0f); + this->deviation.x = Rand_CenteredFloat(500.0f); + this->deviation.y = Rand_CenteredFloat(100.0f); + this->deviation.z = Rand_CenteredFloat(500.0f); Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); this->timer = Rand_ZeroFloat(100.0f); } @@ -245,9 +245,9 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { if (this->workTimer[WORK_TIMER_OUT_OF_WATER] == 0) { if ((this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] == 0) && (this->actor.speed > 1.0f)) { this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] = Rand_ZeroFloat(20.0f); - this->deviation.x = randPlusMinusPoint5Scaled(100.0f); - this->deviation.y = randPlusMinusPoint5Scaled(50.0f + extraScaleY); - this->deviation.z = randPlusMinusPoint5Scaled(100.0f); + this->deviation.x = Rand_CenteredFloat(100.0f); + this->deviation.y = Rand_CenteredFloat(50.0f + extraScaleY); + this->deviation.z = Rand_CenteredFloat(100.0f); } this->targetPosWithDeviation.y = this->targetPos.y + this->deviation.y + 50.0f; } @@ -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)randPlusMinusPoint5Scaled(500.0f) + this->targetShapeRotation.x + 0x8000; + (s16)(s32)Rand_CenteredFloat(0x1F4) + this->targetShapeRotation.x + 0x8000; } if (Rand_ZeroOne() < 0.5f) { this->targetShapeRotation.z = - (s16)randPlusMinusPoint5Scaled(500.0f) + this->targetShapeRotation.z + 0x8000; + (s16)(s32)Rand_CenteredFloat(0x1F4) + this->targetShapeRotation.z + 0x8000; } if (Rand_ZeroOne() < 0.5f) { this->targetShapeRotation.y = (s16)Rand_ZeroFloat(0x10000); } this->actor.world.rot.y = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x) + - (s16)randPlusMinusPoint5Scaled(0xCE20); + (s16)(s32)Rand_CenteredFloat(0xCE20); } Math_ApproachS(&this->actor.shape.rot.y, this->targetShapeRotation.y, 3, 0x500); @@ -316,9 +316,9 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { if ((Rand_ZeroOne() < 0.5f) & !(this->timer & 0x3)) { Vec3f effectPos; - effectPos.x = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.x; + effectPos.x = Rand_CenteredFloat(30.0f) + this->actor.world.pos.x; effectPos.y = this->actor.world.pos.y; - effectPos.z = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.z; + effectPos.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z; EnTanron3_CreateEffect(play, &effectPos); } break; diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c index 5c62c50eea..074eaec797 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c @@ -65,10 +65,9 @@ void EnTanron4_Init(Actor* thisx, PlayState* play2) { s32 i; for (i = 0; i < thisx->params; i++) { - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON4, - thisx->world.pos.x + randPlusMinusPoint5Scaled(500.0f), - thisx->world.pos.y + randPlusMinusPoint5Scaled(100.0f), - thisx->world.pos.z + randPlusMinusPoint5Scaled(500.0f), 0, Rand_ZeroFloat(65536.0f), 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON4, thisx->world.pos.x + Rand_CenteredFloat(500.0f), + thisx->world.pos.y + Rand_CenteredFloat(100.0f), + thisx->world.pos.z + Rand_CenteredFloat(500.0f), 0, Rand_ZeroFloat(0x10000), 0, SEAGULL_CLONE); } } @@ -112,9 +111,9 @@ void EnTanron4_FlyNearHome(EnTanron4* this, PlayState* play) { distToTarget = sqrtf(SQ(xDiff) + SQ(zDiff)); if ((this->timers[SEAGULL_TIMER_CHOOSE_TARGET] == 0) || (distToTarget < 100.0f)) { - this->targetPos.x = this->actor.home.pos.x + randPlusMinusPoint5Scaled(500.0f); - this->targetPos.y = this->actor.home.pos.y + randPlusMinusPoint5Scaled(100.0f); - this->targetPos.z = this->actor.home.pos.z + randPlusMinusPoint5Scaled(500.0f); + this->targetPos.x = this->actor.home.pos.x + Rand_CenteredFloat(500.0f); + this->targetPos.y = this->actor.home.pos.y + Rand_CenteredFloat(100.0f); + this->targetPos.z = this->actor.home.pos.z + Rand_CenteredFloat(500.0f); this->timers[SEAGULL_TIMER_CHOOSE_TARGET] = Rand_ZeroFloat(100.0f) + 60.0f; this->step = 0; @@ -151,7 +150,7 @@ void EnTanron4_FlyNearHome(EnTanron4* this, PlayState* play) { case SEAGULL_FLY_GLIDE: if (((this->randRollTimer % 8) == 0) && (Rand_ZeroOne() < 0.5f)) { - this->rollTarget = randPlusMinusPoint5Scaled(3000.0f + KREG(44)); + this->rollTarget = Rand_CenteredFloat(3000.0f + KREG(44)); } if (this->timers[SEAGULL_TIMER_FLY_STATE] == 0) { @@ -192,9 +191,9 @@ void EnTanron4_FlyNearActor(EnTanron4* this, PlayState* play) { distToTarget = sqrtf(SQ(xDiff) + SQ(zDiff)); if ((this->timers[SEAGULL_TIMER_CHOOSE_TARGET] == 0) || (distToTarget < 100.0f)) { - this->targetPos.x = targetActor->world.pos.x + randPlusMinusPoint5Scaled(200.0f + KREG(82)); - this->targetPos.y = targetActor->world.pos.y + KREG(80) + 100.0f + randPlusMinusPoint5Scaled(100.0f + KREG(81)); - this->targetPos.z = targetActor->world.pos.z + randPlusMinusPoint5Scaled(200.0f + KREG(82)); + this->targetPos.x = targetActor->world.pos.x + Rand_CenteredFloat(200.0f + KREG(82)); + this->targetPos.y = targetActor->world.pos.y + KREG(80) + 100.0f + Rand_CenteredFloat(100.0f + KREG(81)); + this->targetPos.z = targetActor->world.pos.z + Rand_CenteredFloat(200.0f + KREG(82)); this->timers[SEAGULL_TIMER_CHOOSE_TARGET] = Rand_ZeroFloat(100.0f) + 60.0f; this->step = 0; @@ -230,7 +229,7 @@ void EnTanron4_FlyNearActor(EnTanron4* this, PlayState* play) { case SEAGULL_FLY_GLIDE: if (((this->randRollTimer % 8) == 0) && (Rand_ZeroOne() < 0.5f)) { - this->rollTarget = randPlusMinusPoint5Scaled(3000.0f + KREG(44)); + this->rollTarget = Rand_CenteredFloat(3000.0f + KREG(44)); } if (this->timers[SEAGULL_TIMER_FLY_STATE] == 0) { diff --git a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c index 18e24c5e7c..a56b01c3b1 100644 --- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c +++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c @@ -101,9 +101,9 @@ void func_80BE4930(EnTanron5Effect* effect, Vec3f* arg1, f32 arg2) { effect->unk_00 = *arg1; - effect->unk_0C = randPlusMinusPoint5Scaled(10.0f); + effect->unk_0C = Rand_CenteredFloat(10.0f); effect->unk_10 = Rand_ZeroFloat(2.0f) + 3.0f; - effect->unk_14 = randPlusMinusPoint5Scaled(10.0f); + effect->unk_14 = Rand_CenteredFloat(10.0f); effect->unk_18.y = -0.15f; effect->unk_18.x = 0.0f; @@ -127,9 +127,9 @@ void func_80BE4A2C(EnTanron5Effect* effect, Vec3f* arg1, f32 arg2) { effect->unk_00 = *arg1; - effect->unk_0C = randPlusMinusPoint5Scaled(30.0f); + effect->unk_0C = Rand_CenteredFloat(30.0f); effect->unk_10 = Rand_ZeroFloat(7.0f); - effect->unk_14 = randPlusMinusPoint5Scaled(30.0f); + effect->unk_14 = Rand_CenteredFloat(30.0f); effect->unk_18.y = -0.3f; effect->unk_18.x = 0.0f; @@ -154,8 +154,8 @@ void EnTanron5_Init(Actor* thisx, PlayState* play) { return; } - this->unk_198 = randPlusMinusPoint5Scaled(0x2000); - this->unk_19A = randPlusMinusPoint5Scaled(0x2000); + this->unk_198 = Rand_CenteredFloat(0x2000); + this->unk_19A = Rand_CenteredFloat(0x2000); if (ENTANRON5_GET(&this->actor) < ENTANRON5_107) { Actor_SetScale(&this->actor, (Rand_ZeroFloat(0.025f) + 0.085f) * D_80BE5DD0); @@ -327,8 +327,8 @@ void EnTanron5_Update(Actor* thisx, PlayState* play2) { spAC = 50.0f; } - sp9C.x = (randPlusMinusPoint5Scaled(spA8) * D_80BE5DD0) + spB8.x; - sp9C.z = (randPlusMinusPoint5Scaled(spA8) * D_80BE5DD0) + spB8.z; + sp9C.x = (Rand_CenteredFloat(spA8) * D_80BE5DD0) + spB8.x; + sp9C.z = (Rand_CenteredFloat(spA8) * D_80BE5DD0) + spB8.z; sp9C.y = this->actor.floorHeight + (spAC * D_80BE5DD0); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, sp9C.x, sp9C.y, sp9C.z, 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 2bef1cda2c..87589ae8c0 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -193,12 +193,12 @@ void func_80C10984(EnThiefbird* this, s32 arg1) { for (i = 0; i < ARRAY_COUNT(this->unk_3F0); i++, ptr++) { if (ptr->unk_22 == 0) { ptr->unk_22 = (s32)Rand_ZeroFloat(20.0f) + 40; - ptr->unk_00.x = randPlusMinusPoint5Scaled(30.0f) + this->actor.focus.pos.x; - ptr->unk_00.y = randPlusMinusPoint5Scaled(30.0f) + this->actor.focus.pos.y; - ptr->unk_00.z = randPlusMinusPoint5Scaled(30.0f) + this->actor.focus.pos.z; - ptr->unk_0C.x = randPlusMinusPoint5Scaled(5.0f); + ptr->unk_00.x = Rand_CenteredFloat(30.0f) + this->actor.focus.pos.x; + ptr->unk_00.y = Rand_CenteredFloat(30.0f) + this->actor.focus.pos.y; + ptr->unk_00.z = Rand_CenteredFloat(30.0f) + this->actor.focus.pos.z; + ptr->unk_0C.x = Rand_CenteredFloat(5.0f); ptr->unk_0C.y = Rand_ZeroOne() + 2.0f; - ptr->unk_0C.z = randPlusMinusPoint5Scaled(5.0f); + ptr->unk_0C.z = Rand_CenteredFloat(5.0f); ptr->unk_1C = Rand_ZeroFloat(1000.0f); ptr->unk_18 = (Rand_ZeroFloat(20.0f) + 40.0f) * 0.0001f; ptr->unk_1E = (s32)Rand_Next() >> 0x10; 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 cfae131912..1ae0e073b4 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -253,9 +253,9 @@ void func_80893BCC(EnTite* this, PlayState* play) { for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { for (j = 0; j < 2; j++) { ptr = &this->limbPos[i]; - sp7C.x = ptr->x + randPlusMinusPoint5Scaled(1.0f); - sp7C.y = ptr->y + randPlusMinusPoint5Scaled(1.0f); - sp7C.z = ptr->z + randPlusMinusPoint5Scaled(1.0f); + sp7C.x = ptr->x + Rand_CenteredFloat(1.0f); + sp7C.y = ptr->y + Rand_CenteredFloat(1.0f); + sp7C.z = ptr->z + Rand_CenteredFloat(1.0f); func_800B0DE0(play, &sp7C, &gZeroVec3f, &D_80896B64, &D_80896B3C, &D_80896B40, (s32)Rand_ZeroFloat(16.0f) + 80, 15); } @@ -808,9 +808,9 @@ void func_80895738(EnTite* this, PlayState* play) { void func_8089595C(EnTite* this, PlayState* play) { Vec3f sp2C; - sp2C.x = randPlusMinusPoint5Scaled(20.0f) + this->actor.world.pos.x; + sp2C.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; sp2C.y = this->actor.world.pos.y + 15.0f; - sp2C.z = randPlusMinusPoint5Scaled(20.0f) + this->actor.world.pos.z; + sp2C.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; func_800B0DE0(play, &sp2C, &gZeroVec3f, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); } 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 bf0f9cc31d..29560fdced 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -499,9 +499,9 @@ void func_80AD434C(EnTrt2* this, PlayState* play) { Vec3f sp5C = { 0.0f, 0.5f, 0.0f }; for (i = (s32)this->skelAnime.animLength - (s32)this->skelAnime.curFrame; i >= 0; i -= 2) { - sp68.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; - sp68.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; - sp68.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); + sp68.x = Rand_CenteredFloat(60.0f) + this->actor.world.pos.x; + sp68.z = Rand_CenteredFloat(60.0f) + this->actor.world.pos.z; + sp68.y = Rand_CenteredFloat(50.0f) + (this->actor.world.pos.y + 20.0f); func_800B3030(play, &sp68, &sp5C, &sp5C, 100, 0, 3); } @@ -592,7 +592,7 @@ s32 func_80AD475C(EnTrt2* this, Path* path, s32 arg2) { phi_f14 = points[arg + 1].z - points[arg - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; @@ -639,9 +639,9 @@ f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { void func_80AD4A78(EnTrt2* this, PlayState* play) { Vec3f sp34; - sp34.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x; + sp34.x = Rand_CenteredFloat(15.0f) + this->actor.world.pos.x; sp34.y = this->actor.world.pos.y; - sp34.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z; + sp34.z = Rand_CenteredFloat(15.0f) + this->actor.world.pos.z; Actor_SpawnFloorDustRing(play, &this->actor, &sp34, 50.0f, 0, 2.0f, 0, 0, 0); } diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index 6cd2641a18..f877a26a8d 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -301,7 +301,7 @@ s32 func_80B76600(EnTruMt* this, Path* path, s32 arg2) { phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { sp50 = true; } diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index b14f824241..c8ec8f8c4f 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -159,9 +159,9 @@ void EnWaterEffect_Update(Actor* thisx, PlayState* play2) { if ((this->unk_DC4 % 32) == 0) { if (Rand_ZeroOne() < 0.5f) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 40.0f, UPDBGCHECKINFO_FLAG_4); - sp88.x = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.x; + sp88.x = Rand_CenteredFloat(50.0f) + this->actor.world.pos.x; sp88.y = this->actor.world.pos.y; - sp88.z = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.z; + sp88.z = Rand_CenteredFloat(50.0f) + this->actor.world.pos.z; if ((this->actor.world.pos.y + this->actor.depthInWater) <= this->actor.floorHeight) { phi_v1 = 0; } else { @@ -367,9 +367,9 @@ void func_80A599E8(EnWaterEffect* this, Vec3f* arg1, u8 arg2) { if (arg2 >= 2) { if (arg2 == 2) { - ptr->unk_10.x = randPlusMinusPoint5Scaled(10.0f); + ptr->unk_10.x = Rand_CenteredFloat(10.0f); ptr->unk_10.y = Rand_ZeroFloat(3.0f) + 5.0f; - ptr->unk_10.z = randPlusMinusPoint5Scaled(10.0f); + ptr->unk_10.z = Rand_CenteredFloat(10.0f); } ptr->unk_2C.z = 0.0017f; ptr->unk_2C.x = 0.003f; @@ -421,9 +421,9 @@ void func_80A59C04(Actor* thisx, PlayState* play2) { if (this->unk_DC6 == 0) { this->unk_DC6 = Rand_ZeroFloat(150.0f) + 100.0f; Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 40.0f, UPDBGCHECKINFO_FLAG_4); - sp74.x = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.x; + sp74.x = Rand_CenteredFloat(50.0f) + this->actor.world.pos.x; sp74.y = this->actor.world.pos.y; - sp74.z = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.z; + sp74.z = Rand_CenteredFloat(50.0f) + this->actor.world.pos.z; func_80A599E8(this, &sp74, 0); } } 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 b05bc48698..26301730f2 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -489,9 +489,9 @@ void func_80990C6C(EnWf* this, PlayState* play, s32 arg2) { } for (i = 0; i < arg2; i++) { - sp88.x = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.x; + sp88.x = Rand_CenteredFloat(50.0f) + this->actor.world.pos.x; sp88.y = Rand_ZeroFloat(5.0f) + this->actor.world.pos.y; - sp88.z = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.z; + sp88.z = Rand_CenteredFloat(50.0f) + this->actor.world.pos.z; func_800B0F18(play, &sp88, &gZeroVec3f, &D_809942DC, phi_s1, phi_s1, phi_s6, 5, Rand_ZeroFloat(5.0f) + 14.0f); } @@ -1199,9 +1199,9 @@ void func_80992E0C(EnWf* this, PlayState* play) { this->unk_2A0--; for (i = (25 - this->unk_2A0) >> 1; i >= 0; i--) { - sp60.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; - sp60.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; - sp60.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); + sp60.x = Rand_CenteredFloat(60.0f) + this->actor.world.pos.x; + sp60.z = Rand_CenteredFloat(60.0f) + this->actor.world.pos.z; + sp60.y = Rand_CenteredFloat(50.0f) + (this->actor.world.pos.y + 20.0f); func_800B3030(play, &sp60, &D_809942F0, &D_809942F0, 100, 0, 2); } 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 7fd55f4eeb..6ce68a0e38 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c @@ -1297,7 +1297,7 @@ void EnWiz_UpdateDamage(EnWiz* this, PlayState* play) { scaleStep = Rand_S16Offset(20, 10); Math_Vec3f_Copy(&pos, &this->ghostPos[i]); pos.x += (f32)Rand_S16Offset(20, 20) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1); - pos.y += 70.0f + randPlusMinusPoint5Scaled(30.0f); + pos.y += 70.0f + Rand_CenteredFloat(30.0f); pos.z += (f32)Rand_S16Offset(20, 20) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1); func_800B0DE0(play, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvTimer, Rand_S16Offset(350, 100), scaleStep); @@ -1419,9 +1419,9 @@ void EnWiz_PostLimbDrawXlu(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_MultVec3f(&staffFlamePos, &flamePos); - flamePos.x += randPlusMinusPoint5Scaled(4.0f); - flamePos.y += randPlusMinusPoint5Scaled(7.0f); - flamePos.z += randPlusMinusPoint5Scaled(5.0f); + flamePos.x += Rand_CenteredFloat(4.0f); + flamePos.y += Rand_CenteredFloat(7.0f); + flamePos.z += Rand_CenteredFloat(5.0f); func_800B3030(play, &flamePos, &gZeroVec3f, &gZeroVec3f, ((Rand_ZeroFloat(1.0f) * 50.0f) + 70.0f), 10, 1); SoundSource_PlaySfxAtFixedWorldPos(play, &flamePos, 10, NA_SE_EN_EXTINCT); } 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 8251a896b6..e6fc7e7761 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 @@ -152,7 +152,7 @@ void EnWiz_SetupMoveMagicProjectile(EnWizFire* this, PlayState* play) { Matrix_RotateXS(this->actor.world.rot.x, MTXMODE_APPLY); if (this->type != EN_WIZ_FIRE_TYPE_MAGIC_PROJECTILE) { - velocity.z = randPlusMinusPoint5Scaled(2.0f) + 8.0f; + velocity.z = Rand_CenteredFloat(2.0f) + 8.0f; } else { velocity.z = 12.0f; } @@ -223,8 +223,8 @@ void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play) { this->increaseLowestUsedIndexTimer = 10; Matrix_Push(); - Matrix_RotateYS((s16)randPlusMinusPoint5Scaled(0x100) + this->actor.world.rot.y, MTXMODE_NEW); - velocity.z = randPlusMinusPoint5Scaled(2.0f) + 8.0f; + Matrix_RotateYS((s16)(s32)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(); @@ -257,7 +257,7 @@ void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WIZ_FIRE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, arcingProjectileRotY, 0, EN_WIZ_FIRE_TYPE_ARCING_MAGIC_PROJECTILE); - arcingProjectileRotY += BINANG_ADD((s32)randPlusMinusPoint5Scaled(0x1000), 0x3333); + arcingProjectileRotY += BINANG_ADD((s32)Rand_CenteredFloat(0x1000), 0x10000 / 5); } Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); @@ -313,9 +313,9 @@ void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play) { void EnWiz_SetupSmallFlame(EnWizFire* this, PlayState* play) { this->targetScale = 0.02f; this->timer = Rand_S16Offset(50, 50); - this->scaleMod.x = randPlusMinusPoint5Scaled(1.0f) * 0.007f; - this->scaleMod.y = randPlusMinusPoint5Scaled(1.0f) * 0.005f; - this->scaleMod.z = randPlusMinusPoint5Scaled(1.0f) * 0.007f; + this->scaleMod.x = Rand_CenteredFloat(1.0f) * 0.007f; + this->scaleMod.y = Rand_CenteredFloat(1.0f) * 0.005f; + this->scaleMod.z = Rand_CenteredFloat(1.0f) * 0.007f; this->actionFunc = EnWiz_SmallFlame; } @@ -379,13 +379,13 @@ void EnWiz_Pool(EnWizFire* this, PlayState* play) { Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f pos; - accel.x = randPlusMinusPoint5Scaled(3.0f) / 10.0f; + accel.x = Rand_CenteredFloat(3.0f) / 10.0f; accel.y = 0.23f; - accel.z = randPlusMinusPoint5Scaled(3.0f) / 10.0f; + accel.z = Rand_CenteredFloat(3.0f) / 10.0f; Math_Vec3f_Copy(&pos, &this->actor.world.pos); - pos.x += randPlusMinusPoint5Scaled(150.0f); - pos.z += randPlusMinusPoint5Scaled(150.0f); + pos.x += Rand_CenteredFloat(150.0f); + pos.z += Rand_CenteredFloat(150.0f); Math_ApproachF(&this->poolScale, 0.022f, 0.3f, 0.01f); this->collider.dim.radius = this->poolScale * 4300.0f; diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 874e0a63ea..cf4331ffa0 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -264,8 +264,8 @@ void EnWood02_Init(Actor* thisx, PlayState* play) { case WOOD_LEAF_YELLOW: this->unk_14A[0] = 75; actorScale = 0.02f; - this->actor.velocity.x = randPlusMinusPoint5Scaled(6.0f); - this->actor.velocity.z = randPlusMinusPoint5Scaled(6.0f); + this->actor.velocity.x = Rand_CenteredFloat(6.0f); + this->actor.velocity.z = Rand_CenteredFloat(6.0f); this->actor.velocity.y = (Rand_ZeroOne() * 1.25f) + -3.1f; break; } @@ -409,7 +409,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { for (i = 3; i >= 0; i--) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WOOD02, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, - 0, randPlusMinusPoint5Scaled(0xFFFF), 0, leavesParams); + 0, Rand_CenteredFloat(0xFFFF), 0, leavesParams); } } diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index 1dbe5d2e86..9df560150c 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -242,9 +242,9 @@ void EnYb_Disappear(EnYb* this, PlayState* play) { EnYb_UpdateAnimation(this, play); for (i = 3; i >= 0; i--) { - sp60.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; - sp60.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; - sp60.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); + sp60.x = Rand_CenteredFloat(60.0f) + this->actor.world.pos.x; + sp60.z = Rand_CenteredFloat(60.0f) + this->actor.world.pos.z; + sp60.y = Rand_CenteredFloat(50.0f) + (this->actor.world.pos.y + 20.0f); func_800B3030(play, &sp60, &D_80BFB2E8, &D_80BFB2E8, 100, 0, 2); } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 979187532b..96de52b88b 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -394,9 +394,9 @@ void func_80B93D2C(EnZog* this, PlayState* play) { void func_80B93DE8(Vec3f* arg0, PlayState* play, s32 arg2) { Vec3f sp2C; - sp2C.x = randPlusMinusPoint5Scaled(30.0f) + arg0->x; + sp2C.x = Rand_CenteredFloat(30.0f) + arg0->x; sp2C.y = arg0->y + 3.0f; - sp2C.z = randPlusMinusPoint5Scaled(30.0f) + arg0->z; + sp2C.z = Rand_CenteredFloat(30.0f) + arg0->z; EffectSsKirakira_SpawnDispersed(play, &sp2C, &D_80B9598C, &D_80B95998, &D_80B959A4, &D_80B959A8, 1000, arg2); } @@ -865,9 +865,9 @@ void func_80B94E34(EnZog* this, PlayState* play) { Vec3f sp38; Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &D_80B959AC, &sp38); - sp38.x += randPlusMinusPoint5Scaled(30.0f); + sp38.x += Rand_CenteredFloat(30.0f); sp38.y += 20.0f; - sp38.z += randPlusMinusPoint5Scaled(30.0f); + sp38.z += Rand_CenteredFloat(30.0f); if (WaterBox_GetSurface1(play, &play->colCtx, sp38.x, sp38.z, &sp38.y, &sp44) && (this->actor.world.pos.y < sp38.y)) { EffectSsGSplash_Spawn(play, &sp38, NULL, NULL, 1, 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 85468c59ce..61805fd49b 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c @@ -159,13 +159,13 @@ void func_80AE8DE4(ObjBigicicle* this, PlayState* play) { f32 temp_f20 = this->actor.scale.x * (50.0f / 3.0f); for (i = 0; i < 10; i++) { - sp98.x = (randPlusMinusPoint5Scaled(4.0f) * temp_f20) + this->actor.world.pos.x; + sp98.x = (Rand_CenteredFloat(4.0f) * temp_f20) + this->actor.world.pos.x; sp98.y = ((Rand_ZeroFloat(20.0f) - 35.0f) * temp_f20) + this->actor.world.pos.y; - sp98.z = (randPlusMinusPoint5Scaled(4.0f) * temp_f20) + this->actor.world.pos.z; + sp98.z = (Rand_CenteredFloat(4.0f) * temp_f20) + this->actor.world.pos.z; - sp8C.x = randPlusMinusPoint5Scaled(13.0f); + sp8C.x = Rand_CenteredFloat(13.0f); sp8C.y = Rand_ZeroFloat(2.0f); - sp8C.z = randPlusMinusPoint5Scaled(13.0f); + sp8C.z = Rand_CenteredFloat(13.0f); EffectSsHahen_Spawn(play, &sp98, &sp8C, &D_80AE987C, HAHEN_XLU, (Rand_ZeroFloat(20.0f) + 30.0f) * temp_f20, OBJECT_BIGICICLE, 40, object_bigicicle_DL_0009B0); @@ -222,8 +222,8 @@ void func_80AE9180(ObjBigicicle* this, PlayState* play) { if (this->unk_14A > 0) { this->unk_14A--; - this->actor.shape.rot.x = BINANG_ADD((s32)(randPlusMinusPoint5Scaled(1408.0f) * 0.02f * this->unk_14A), 0x4000); - this->actor.shape.rot.z = randPlusMinusPoint5Scaled(1408.0f) * 0.02f * this->unk_14A; + this->actor.shape.rot.x = BINANG_ADD((s32)(Rand_CenteredFloat(0x580) * 0.02f * this->unk_14A), 0x4000); + this->actor.shape.rot.z = Rand_CenteredFloat(0x580) * 0.02f * this->unk_14A; } else { this->actor.shape.rot.x = 0x4000; this->actor.shape.rot.z = 0; @@ -271,9 +271,9 @@ void func_80AE939C(ObjBigicicle* this, PlayState* play) { f32 temp_f20 = this->actor.scale.x * (50.0f / 3.0f); for (i = 0; i < 20; i++) { - sp8C.x = randPlusMinusPoint5Scaled(15.0f); + sp8C.x = Rand_CenteredFloat(15.0f); sp8C.y = Rand_ZeroFloat(7.0f) + 3.0f; - sp8C.z = randPlusMinusPoint5Scaled(15.0f); + sp8C.z = Rand_CenteredFloat(15.0f); sp98.x = this->actor.world.pos.x + (sp8C.x * 5.0f * temp_f20); sp98.y = this->actor.world.pos.y + (sp8C.y * 7.0f * temp_f20); diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index c2270f15b8..4971b39bc1 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -119,7 +119,7 @@ u32 func_80BB9A1C(ObjChan* this, f32 arg1) { sp20 = Math_SinS(this->unk1D4) * this->unk1D0; temp_f6 = (Math_CosS(this->unk1D4) * (400 * M_PI / 0x8000) * this->unk1D0) + arg1; if (temp_f6 != 0.0f) { - this->unk1D4 = RAD_TO_BINANG(func_80086B30(sp20 * (400 * M_PI / 0x8000), temp_f6)); + this->unk1D4 = RAD_TO_BINANG(Math_FAtan2F(sp20 * (400 * M_PI / 0x8000), temp_f6)); } else if (sp20 >= 0.0f) { this->unk1D4 = 0x4000; } else { diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index 4cc81013e9..7559c4db76 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -130,8 +130,8 @@ void func_80B9C5E8(ObjHunsui* this, PlayState* play) { this->unk_18C = 0; Math_Vec3f_Copy(&sp40, &player->actor.world.pos); - sp40.x += randPlusMinusPoint5Scaled(10.0f); - sp40.z += randPlusMinusPoint5Scaled(10.0f); + sp40.x += Rand_CenteredFloat(10.0f); + sp40.z += Rand_CenteredFloat(10.0f); sp40.y += Rand_ZeroFloat(2.0f); EffectSsGSplash_Spawn(play, &sp40, NULL, NULL, 2.0f * Rand_ZeroOne(), 1); @@ -144,8 +144,8 @@ void func_80B9C5E8(ObjHunsui* this, PlayState* play) { Math_Vec3f_Copy(&sp40, &player->actor.world.pos); this->unk_18C = 0; - sp40.x += randPlusMinusPoint5Scaled(10.0f); - sp40.z += randPlusMinusPoint5Scaled(10.0f); + sp40.x += Rand_CenteredFloat(10.0f); + sp40.z += Rand_CenteredFloat(10.0f); sp40.y += Rand_ZeroFloat(45.0f); EffectSsGSplash_Spawn(play, &sp40, NULL, NULL, 1, 1); diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 10937f985c..d1601e69d8 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -156,9 +156,9 @@ void func_80931828(ObjIcePoly* this, PlayState* play) { temp = spA0.y - sp90; for (i = 0; i < 30; i++) { - sp94.x = randPlusMinusPoint5Scaled(12.0f); + sp94.x = Rand_CenteredFloat(12.0f); sp94.y = Rand_ZeroFloat(15.0f); - sp94.z = randPlusMinusPoint5Scaled(12.0f); + sp94.z = Rand_CenteredFloat(12.0f); spA0.x = (this->colliders1[0].dim.radius * (sp94.x * (1.0f / 12))) + this->actor.world.pos.x; spA0.z = (this->colliders1[0].dim.radius * (sp94.z * (1.0f / 12))) + this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c index aeaddd2eec..6eac0ddbc0 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c @@ -141,10 +141,10 @@ void func_80B9B9C8(ObjTaru* this, PlayState* play) { for (i = 0; i < 4; i++) { for (j = phi_fp; j < phi_s5; j++) { - temp_fs0 = randPlusMinusPoint5Scaled(10.0f) + -105.0f + (j * 30.0f); - temp_fs1 = randPlusMinusPoint5Scaled(4.0f); + temp_fs0 = Rand_CenteredFloat(10.0f) + -105.0f + (j * 30.0f); + temp_fs1 = Rand_CenteredFloat(4.0f); spD8.x = temp_fs0 * cos; - spD8.y = randPlusMinusPoint5Scaled(10.0f) + 15.0f + (i * 30.0f); + spD8.y = Rand_CenteredFloat(10.0f) + 15.0f + (i * 30.0f); spD8.z = temp_fs0 * sin; spCC.x = (spD8.x * 0.05f) + (temp_fs1 * sin); spCC.y = Rand_ZeroFloat(5.0f) + 2.0f; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 9bf7808595..bbde013ef7 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -6280,9 +6280,9 @@ void func_80836C70(PlayState* play, Player* this, PlayerBodyPart bodyPartIndex) for (i = 0; i < 4; i++) { Vec3f velocity; - velocity.x = randPlusMinusPoint5Scaled(4.0f); + velocity.x = Rand_CenteredFloat(4.0f); velocity.y = Rand_ZeroFloat(2.0f); - velocity.z = randPlusMinusPoint5Scaled(4.0f); + velocity.z = Rand_CenteredFloat(4.0f); D_8085D130.y = -0.2f; EffectSsHahen_Spawn(play, &this->bodyPartsPos[bodyPartIndex], &velocity, &D_8085D130, 0, 10, OBJECT_LINK_NUTS, 16, object_link_nuts_DL_008860); @@ -9507,9 +9507,9 @@ void func_8083F57C(Player* this, PlayState* play) { } void func_8083F828(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4) { - arg1->x = randPlusMinusPoint5Scaled(arg3) + arg0->x; - arg1->y = randPlusMinusPoint5Scaled(arg4) + (arg0->y + arg2); - arg1->z = randPlusMinusPoint5Scaled(arg3) + arg0->z; + arg1->x = Rand_CenteredFloat(arg3) + arg0->x; + arg1->y = Rand_CenteredFloat(arg4) + (arg0->y + arg2); + arg1->z = Rand_CenteredFloat(arg3) + arg0->z; } Color_RGBA8 D_8085D26C = { 255, 255, 255, 255 }; @@ -9528,8 +9528,8 @@ s32 func_8083F8A8(PlayState* play, Player* this, f32 radius, s32 countMax, f32 r count = (count >= ABS_ALT(countMax)) ? ABS_ALT(countMax) : count; for (i = 0; i < count; i++) { func_8083F828(&this->actor.world.pos, &pos, 0.0f, 40.0f, 10.0f); - D_8085D27C.x = randPlusMinusPoint5Scaled(3.0f); - D_8085D27C.z = randPlusMinusPoint5Scaled(3.0f); + D_8085D27C.x = Rand_CenteredFloat(3.0f); + D_8085D27C.z = Rand_CenteredFloat(3.0f); EffectSsDust_Spawn(play, 0, &pos, &D_8085D27C, &D_8085D270, &D_8085D26C, &D_8085D26C, scale, scaleStep, 42, 0); } @@ -9555,9 +9555,9 @@ s32 func_8083F8A8(PlayState* play, Player* this, f32 radius, s32 countMax, f32 r count = (count >= countMax) ? countMax : count; for (i = 0; i < count; i++) { func_8083F828(&this->actor.world.pos, &pos, 0.0f, 20.0f, 20.0f); - velocity.x = randPlusMinusPoint5Scaled(3.0f); + velocity.x = Rand_CenteredFloat(3.0f); velocity.y = Rand_ZeroFloat(2.0f); - velocity.z = randPlusMinusPoint5Scaled(3.0f); + velocity.z = Rand_CenteredFloat(3.0f); D_8085D288.y = -0.1f; EffectSsHahen_Spawn(play, &pos, &velocity, &D_8085D288, 0, 0x96, 1, 0x10, gKakeraLeafTip); } @@ -11237,9 +11237,9 @@ void func_808445C4(PlayState* play, Player* this) { randIndex = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); bodyPartsPos = randIndex + this->bodyPartsPos; - pos.x = (randPlusMinusPoint5Scaled(5.0f) + bodyPartsPos->x) - this->actor.world.pos.x; - pos.y = (randPlusMinusPoint5Scaled(5.0f) + bodyPartsPos->y) - this->actor.world.pos.y; - pos.z = (randPlusMinusPoint5Scaled(5.0f) + bodyPartsPos->z) - this->actor.world.pos.z; + pos.x = (Rand_CenteredFloat(5.0f) + bodyPartsPos->x) - this->actor.world.pos.x; + pos.y = (Rand_CenteredFloat(5.0f) + bodyPartsPos->y) - this->actor.world.pos.y; + pos.z = (Rand_CenteredFloat(5.0f) + bodyPartsPos->z) - this->actor.world.pos.z; EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, scale, 1); func_800B8F98(&this->actor, NA_SE_PL_SPARK - SFX_FLAG); } @@ -19575,9 +19575,9 @@ void func_80859D70(PlayState* play, Player* this, UNK_TYPE arg2) { this->rightHandType = 0xFF; } else { posInfo = &D_8085E368[this->transformation]; - randPos.x = randPlusMinusPoint5Scaled(posInfo->range.x) + posInfo->base.x; - randPos.y = randPlusMinusPoint5Scaled(posInfo->range.y) + posInfo->base.y; - randPos.z = randPlusMinusPoint5Scaled(posInfo->range.z) + posInfo->base.z; + randPos.x = Rand_CenteredFloat(posInfo->range.x) + posInfo->base.x; + randPos.y = Rand_CenteredFloat(posInfo->range.y) + posInfo->base.y; + randPos.z = Rand_CenteredFloat(posInfo->range.z) + posInfo->base.z; SkinMatrix_Vec3fMtxFMultXYZ(&this->shieldMf, &randPos, &effectPos); EffectSsKirakira_SpawnDispersed(play, &effectPos, &gZeroVec3f, &gZeroVec3f, &D_8085E3A4, &D_8085E3A8, 600, -10); } diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index 14d5d5c6e1..cf019c6cf1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -60,7 +60,7 @@ u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initPar this->rEnvColorG = initParams->envColor.g; this->rEnvColorB = initParams->envColor.b; this->rAlphaMode = 1; - this->rPitch = randPlusMinusPoint5Scaled(0x10000); + this->rPitch = Rand_CenteredFloat(0x10000); } else if (initParams->type == ENICE_TYPE_NORMAL) { Math_Vec3f_Copy(&this->pos, &initParams->pos); Math_Vec3f_Copy(&this->vec, &initParams->pos); @@ -142,7 +142,7 @@ void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { } else { this->actor = NULL; if (this->life >= 9) { - rand = randPlusMinusPoint5Scaled(0xFFFF); + rand = Rand_CenteredFloat(0xFFFF); this->accel.x = Math_SinS(rand) * (Rand_ZeroOne() + 1.0f); this->accel.z = Math_CosS(rand) * (Rand_ZeroOne() + 1.0f); this->life = 8; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index f2038c768b..4edc1e3b12 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -90,9 +90,9 @@ void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this) { Player* player = GET_PLAYER(play); randBodyPart = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); - this->pos.x = player->bodyPartsPos[randBodyPart].x + randPlusMinusPoint5Scaled(10.0f); - this->pos.y = player->bodyPartsPos[randBodyPart].y + randPlusMinusPoint5Scaled(15.0f); - this->pos.z = player->bodyPartsPos[randBodyPart].z + randPlusMinusPoint5Scaled(10.0f); + this->pos.x = player->bodyPartsPos[randBodyPart].x + Rand_CenteredFloat(10.0f); + this->pos.y = player->bodyPartsPos[randBodyPart].y + Rand_CenteredFloat(15.0f); + this->pos.z = player->bodyPartsPos[randBodyPart].z + Rand_CenteredFloat(10.0f); } else if ((this->rParams >= FHGFLASH_SHOCK_GOHT_2) && (this->rParams <= FHGFLASH_SHOCK_GOHT_6)) { s32 pad; Vec3f* bodyPartPos; @@ -105,9 +105,9 @@ void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this) { bodyPartPos = &goht->unk_2F00[this->rParams][index].unk_00; } - this->pos.x = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->x; - this->pos.y = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->y; - this->pos.z = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->z; + this->pos.x = Rand_CenteredFloat(70.0f) + bodyPartPos->x; + this->pos.y = Rand_CenteredFloat(70.0f) + bodyPartPos->y; + this->pos.z = Rand_CenteredFloat(70.0f) + bodyPartPos->z; } if (this->life < 100) { this->rAlpha -= 50; diff --git a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c index 4e395141b7..4e8f11f5c2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c @@ -139,8 +139,8 @@ void func_80977DB4(PlayState* play, u32 index, EffectSs* this) { void func_80977E6C(PlayState* play, u32 index, EffectSs* this) { this->velocity.x *= 0.95f; this->velocity.z *= 0.95f; - this->accel.x = randPlusMinusPoint5Scaled(0.2f); - this->accel.z = randPlusMinusPoint5Scaled(0.2f); + this->accel.x = Rand_CenteredFloat(0.2f); + this->accel.z = Rand_CenteredFloat(0.2f); this->rEnvColorA += this->rAlphaStep; if (this->rEnvColorA < 0) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c index f79e59340c..69b24c0291 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c @@ -68,7 +68,7 @@ u32 EffectSsSbn_Init(PlayState* play, u32 index, EffectSs* this, void* initParam this->rReg4 = 250; this->rReg4Step = 30; - this->rScale = randPlusMinusPoint5Scaled(100.0f) + (initParams->scale * 120.0f); + this->rScale = Rand_CenteredFloat(100.0f) + (initParams->scale * 120.0f); if (this->rScale < 600) { this->rScale = 600; } else if (this->rScale > 1500) { diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index e4f96e594b..1d38ccc2ee 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -166,39 +166,39 @@ 0x80086588:("SystemHeap_RunInits",), 0x800865F8:("SystemHeap_Init",), 0x80086620:("PadSetup_Init",), - 0x80086760:("func_80086760",), - 0x80086794:("func_80086794",), - 0x800867B4:("func_800867B4",), - 0x800867D4:("func_800867D4",), - 0x800867F4:("func_800867F4",), - 0x80086814:("func_80086814",), - 0x80086834:("func_80086834",), - 0x80086880:("func_80086880",), - 0x800869A4:("func_800869A4",), - 0x80086AF0:("func_80086AF0",), - 0x80086B30:("func_80086B30",), - 0x80086C18:("func_80086C18",), - 0x80086C48:("func_80086C48",), - 0x80086C70:("func_80086C70",), - 0x80086C7C:("func_80086C7C",), - 0x80086C88:("func_80086C88",), - 0x80086C98:("func_80086C98",), - 0x80086CA8:("func_80086CA8",), - 0x80086CB4:("func_80086CB4",), - 0x80086CC0:("func_80086CC0",), - 0x80086CD0:("func_80086CD0",), - 0x80086CE0:("func_80086CE0",), - 0x80086CEC:("func_80086CEC",), - 0x80086CF8:("func_80086CF8",), - 0x80086D08:("func_80086D08",), - 0x80086D18:("func_80086D18",), - 0x80086D24:("func_80086D24",), - 0x80086D30:("func_80086D30",), - 0x80086D40:("func_80086D40",), - 0x80086D50:("func_80086D50",), - 0x80086D6C:("func_80086D6C",), - 0x80086D8C:("func_80086D8C",), - 0x80086DAC:("func_80086DAC",), + 0x80086760:("Math_FTanF",), + 0x80086794:("Math_FFloorF",), + 0x800867B4:("Math_FCeilF",), + 0x800867D4:("Math_FRoundF",), + 0x800867F4:("Math_FTruncF",), + 0x80086814:("Math_FNearbyIntF",), + 0x80086834:("Math_FAtanTaylorQF",), + 0x80086880:("Math_FAtanTaylorF",), + 0x800869A4:("Math_FAtanContFracF",), + 0x80086AF0:("Math_FAtanF",), + 0x80086B30:("Math_FAtan2F",), + 0x80086C18:("Math_FAsinF",), + 0x80086C48:("Math_FAcosF",), + 0x80086C70:("floorf",), + 0x80086C7C:("floor",), + 0x80086C88:("lfloorf",), + 0x80086C98:("lfloor",), + 0x80086CA8:("ceilf",), + 0x80086CB4:("ceil",), + 0x80086CC0:("lceilf",), + 0x80086CD0:("lceil",), + 0x80086CE0:("truncf",), + 0x80086CEC:("trunc",), + 0x80086CF8:("ltruncf",), + 0x80086D08:("ltrunc",), + 0x80086D18:("nearbyintf",), + 0x80086D24:("nearbyint",), + 0x80086D30:("lnearbyintf",), + 0x80086D40:("lnearbyint",), + 0x80086D50:("roundf",), + 0x80086D6C:("round",), + 0x80086D8C:("lroundf",), + 0x80086DAC:("lround",), 0x80086DD0:("SystemArena_Malloc",), 0x80086DF8:("SystemArena_MallocR",), 0x80086E20:("SystemArena_Realloc",), @@ -3248,13 +3248,13 @@ 0x801791CC:("Check_DrawRegionLockErrorMessage",), 0x80179260:("Check_ExpansionPak",), 0x801792A4:("Check_RegionIsSupported",), - 0x80179300:("func_80179300",), - 0x80179400:("func_80179400",), - 0x801794C4:("pow_int",), - 0x801794EC:("sin_rad",), - 0x80179540:("cos_rad",), + 0x80179300:("Math_FactorialF",), + 0x80179400:("Math_Factorial",), + 0x801794C4:("Math_PowF",), + 0x801794EC:("Math_SinF",), + 0x80179540:("Math_CosF",), 0x80179594:("Rand_ZeroFloat",), - 0x801795C0:("randPlusMinusPoint5Scaled",), + 0x801795C0:("Rand_CenteredFloat",), 0x801795F0:("Math3D_Normalize",), 0x80179678:("Math3D_PlaneVsLineSegClosestPoint",), 0x80179798:("func_80179798",), diff --git a/tools/namefixer.py b/tools/namefixer.py index 286653e13e..a755cc88c0 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -18,10 +18,16 @@ simpleReplace = { wordReplace = { # Functions "Actor_GetSwitchFlag": "Flags_GetSwitch", - # "Math_FAtan2F": "Math_Atan2S_XY", // All old Math_FAtan2F should be renamed, so func_80086B30 can be renamed to Math_FAtan2F "Math_Acot2F": "Math_Atan2F_XY", "atan_flip": "Math_Atan2F_XY", "atans": "Math_Atan2S", + "sin_rad": "Math_SinF", + "cos_rad": "Math_CosF", + "randPlusMinusPoint5Scaled": "Rand_CenteredFloat", + # "Math_FAtan2F": "Math_Atan2S_XY", // Old Math_FAtan2F was renamed + "func_80086B30": "Math_FAtan2F", + "func_80086760": "Math_FTanF", + "func_80086C48": "Math_FAcosF", # "SysMatrix_StateAlloc": "Matrix_StateAlloc", # "SysMatrix_StatePush": "Matrix_StatePush", diff --git a/tools/sizes/boot_functions.csv b/tools/sizes/boot_functions.csv index 744376bcc9..ecc9eed278 100644 --- a/tools/sizes/boot_functions.csv +++ b/tools/sizes/boot_functions.csv @@ -163,39 +163,39 @@ asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc1Reverse.s,SystemHea asm/non_matchings/boot/boot_800862E0/SystemHeap_RunInits.s,SystemHeap_RunInits,0x80086588,0x1C asm/non_matchings/boot/boot_800862E0/SystemHeap_Init.s,SystemHeap_Init,0x800865F8,0xA asm/non_matchings/boot/padsetup/PadSetup_Init.s,PadSetup_Init,0x80086620,0x50 -asm/non_matchings/boot/boot_80086760/func_80086760.s,func_80086760,0x80086760,0xD -asm/non_matchings/boot/boot_80086760/func_80086794.s,func_80086794,0x80086794,0x8 -asm/non_matchings/boot/boot_80086760/func_800867B4.s,func_800867B4,0x800867B4,0x8 -asm/non_matchings/boot/boot_80086760/func_800867D4.s,func_800867D4,0x800867D4,0x8 -asm/non_matchings/boot/boot_80086760/func_800867F4.s,func_800867F4,0x800867F4,0x8 -asm/non_matchings/boot/boot_80086760/func_80086814.s,func_80086814,0x80086814,0x8 -asm/non_matchings/boot/boot_80086760/func_80086834.s,func_80086834,0x80086834,0x13 -asm/non_matchings/boot/boot_80086760/func_80086880.s,func_80086880,0x80086880,0x49 -asm/non_matchings/boot/boot_80086760/func_800869A4.s,func_800869A4,0x800869A4,0x53 -asm/non_matchings/boot/boot_80086760/func_80086AF0.s,func_80086AF0,0x80086AF0,0x10 -asm/non_matchings/boot/boot_80086760/func_80086B30.s,func_80086B30,0x80086B30,0x3A -asm/non_matchings/boot/boot_80086760/func_80086C18.s,func_80086C18,0x80086C18,0xC -asm/non_matchings/boot/boot_80086760/func_80086C48.s,func_80086C48,0x80086C48,0xA -asm/non_matchings/boot/fp/func_80086C70.s,func_80086C70,0x80086C70,0x3 -asm/non_matchings/boot/fp/func_80086C7C.s,func_80086C7C,0x80086C7C,0x3 -asm/non_matchings/boot/fp/func_80086C88.s,func_80086C88,0x80086C88,0x4 -asm/non_matchings/boot/fp/func_80086C98.s,func_80086C98,0x80086C98,0x4 -asm/non_matchings/boot/fp/func_80086CA8.s,func_80086CA8,0x80086CA8,0x3 -asm/non_matchings/boot/fp/func_80086CB4.s,func_80086CB4,0x80086CB4,0x3 -asm/non_matchings/boot/fp/func_80086CC0.s,func_80086CC0,0x80086CC0,0x4 -asm/non_matchings/boot/fp/func_80086CD0.s,func_80086CD0,0x80086CD0,0x4 -asm/non_matchings/boot/fp/func_80086CE0.s,func_80086CE0,0x80086CE0,0x3 -asm/non_matchings/boot/fp/func_80086CEC.s,func_80086CEC,0x80086CEC,0x3 -asm/non_matchings/boot/fp/func_80086CF8.s,func_80086CF8,0x80086CF8,0x4 -asm/non_matchings/boot/fp/func_80086D08.s,func_80086D08,0x80086D08,0x4 -asm/non_matchings/boot/fp/func_80086D18.s,func_80086D18,0x80086D18,0x3 -asm/non_matchings/boot/fp/func_80086D24.s,func_80086D24,0x80086D24,0x3 -asm/non_matchings/boot/fp/func_80086D30.s,func_80086D30,0x80086D30,0x4 -asm/non_matchings/boot/fp/func_80086D40.s,func_80086D40,0x80086D40,0x4 -asm/non_matchings/boot/fp/func_80086D50.s,func_80086D50,0x80086D50,0x7 -asm/non_matchings/boot/fp/func_80086D6C.s,func_80086D6C,0x80086D6C,0x8 -asm/non_matchings/boot/fp/func_80086D8C.s,func_80086D8C,0x80086D8C,0x8 -asm/non_matchings/boot/fp/func_80086DAC.s,func_80086DAC,0x80086DAC,0x9 +asm/non_matchings/boot/boot_80086760/Math_FTanF.s,Math_FTanF,0x80086760,0xD +asm/non_matchings/boot/boot_80086760/Math_FFloorF.s,Math_FFloorF,0x80086794,0x8 +asm/non_matchings/boot/boot_80086760/Math_FCeilF.s,Math_FCeilF,0x800867B4,0x8 +asm/non_matchings/boot/boot_80086760/Math_FRoundF.s,Math_FRoundF,0x800867D4,0x8 +asm/non_matchings/boot/boot_80086760/Math_FTruncF.s,Math_FTruncF,0x800867F4,0x8 +asm/non_matchings/boot/boot_80086760/Math_FNearbyIntF.s,Math_FNearbyIntF,0x80086814,0x8 +asm/non_matchings/boot/boot_80086760/Math_FAtanTaylorQF.s,Math_FAtanTaylorQF,0x80086834,0x13 +asm/non_matchings/boot/boot_80086760/Math_FAtanTaylorF.s,Math_FAtanTaylorF,0x80086880,0x49 +asm/non_matchings/boot/boot_80086760/Math_FAtanContFracF.s,Math_FAtanContFracF,0x800869A4,0x53 +asm/non_matchings/boot/boot_80086760/Math_FAtanF.s,Math_FAtanF,0x80086AF0,0x10 +asm/non_matchings/boot/boot_80086760/Math_FAtan2F.s,Math_FAtan2F,0x80086B30,0x3A +asm/non_matchings/boot/boot_80086760/Math_FAsinF.s,Math_FAsinF,0x80086C18,0xC +asm/non_matchings/boot/boot_80086760/Math_FAcosF.s,Math_FAcosF,0x80086C48,0xA +asm/non_matchings/boot/fp/floorf.s,floorf,0x80086C70,0x3 +asm/non_matchings/boot/fp/floor.s,floor,0x80086C7C,0x3 +asm/non_matchings/boot/fp/lfloorf.s,lfloorf,0x80086C88,0x4 +asm/non_matchings/boot/fp/lfloor.s,lfloor,0x80086C98,0x4 +asm/non_matchings/boot/fp/ceilf.s,ceilf,0x80086CA8,0x3 +asm/non_matchings/boot/fp/ceil.s,ceil,0x80086CB4,0x3 +asm/non_matchings/boot/fp/lceilf.s,lceilf,0x80086CC0,0x4 +asm/non_matchings/boot/fp/lceil.s,lceil,0x80086CD0,0x4 +asm/non_matchings/boot/fp/truncf.s,truncf,0x80086CE0,0x3 +asm/non_matchings/boot/fp/trunc.s,trunc,0x80086CEC,0x3 +asm/non_matchings/boot/fp/ltruncf.s,ltruncf,0x80086CF8,0x4 +asm/non_matchings/boot/fp/ltrunc.s,ltrunc,0x80086D08,0x4 +asm/non_matchings/boot/fp/nearbyintf.s,nearbyintf,0x80086D18,0x3 +asm/non_matchings/boot/fp/nearbyint.s,nearbyint,0x80086D24,0x3 +asm/non_matchings/boot/fp/lnearbyintf.s,lnearbyintf,0x80086D30,0x4 +asm/non_matchings/boot/fp/lnearbyint.s,lnearbyint,0x80086D40,0x4 +asm/non_matchings/boot/fp/roundf.s,roundf,0x80086D50,0x7 +asm/non_matchings/boot/fp/round.s,round,0x80086D6C,0x8 +asm/non_matchings/boot/fp/lroundf.s,lroundf,0x80086D8C,0x8 +asm/non_matchings/boot/fp/lround.s,lround,0x80086DAC,0x9 asm/non_matchings/boot/system_malloc/SystemArena_Malloc.s,SystemArena_Malloc,0x80086DD0,0xA asm/non_matchings/boot/system_malloc/SystemArena_MallocR.s,SystemArena_MallocR,0x80086DF8,0xA asm/non_matchings/boot/system_malloc/SystemArena_Realloc.s,SystemArena_Realloc,0x80086E20,0xC diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 3d5839a69f..834b933ef9 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2762,13 +2762,13 @@ asm/non_matchings/code/sys_initial_check/Check_DrawExpansionPakErrorMessage.s,Ch asm/non_matchings/code/sys_initial_check/Check_DrawRegionLockErrorMessage.s,Check_DrawRegionLockErrorMessage,0x801791CC,0x25 asm/non_matchings/code/sys_initial_check/Check_ExpansionPak.s,Check_ExpansionPak,0x80179260,0x11 asm/non_matchings/code/sys_initial_check/Check_RegionIsSupported.s,Check_RegionIsSupported,0x801792A4,0x17 -asm/non_matchings/code/sys_math/func_80179300.s,func_80179300,0x80179300,0x40 -asm/non_matchings/code/sys_math/func_80179400.s,func_80179400,0x80179400,0x31 -asm/non_matchings/code/sys_math/pow_int.s,pow_int,0x801794C4,0xA -asm/non_matchings/code/sys_math/sin_rad.s,sin_rad,0x801794EC,0x15 -asm/non_matchings/code/sys_math/cos_rad.s,cos_rad,0x80179540,0x15 +asm/non_matchings/code/sys_math/Math_FactorialF.s,Math_FactorialF,0x80179300,0x40 +asm/non_matchings/code/sys_math/Math_Factorial.s,Math_Factorial,0x80179400,0x31 +asm/non_matchings/code/sys_math/Math_PowF.s,Math_PowF,0x801794C4,0xA +asm/non_matchings/code/sys_math/Math_SinF.s,Math_SinF,0x801794EC,0x15 +asm/non_matchings/code/sys_math/Math_CosF.s,Math_CosF,0x80179540,0x15 asm/non_matchings/code/sys_math/Rand_ZeroFloat.s,Rand_ZeroFloat,0x80179594,0xB -asm/non_matchings/code/sys_math/randPlusMinusPoint5Scaled.s,randPlusMinusPoint5Scaled,0x801795C0,0xC +asm/non_matchings/code/sys_math/Rand_CenteredFloat.s,Rand_CenteredFloat,0x801795C0,0xC asm/non_matchings/code/sys_math3d/Math3D_Normalize.s,Math3D_Normalize,0x801795F0,0x22 asm/non_matchings/code/sys_math3d/Math3D_PlaneVsLineSegClosestPoint.s,Math3D_PlaneVsLineSegClosestPoint,0x80179678,0x48 asm/non_matchings/code/sys_math3d/func_80179798.s,func_80179798,0x80179798,0xAB