From 9d802d0c087f11cb2749f3dd5c5d3b4915d2d390 Mon Sep 17 00:00:00 2001 From: Bl00D4NGEL Date: Tue, 3 Sep 2024 20:25:19 +0200 Subject: [PATCH 1/5] refac: rename func_8030E510 to sfxsource_play --- include/functions.h | 2 +- src/BGS/ch/pinkegg.c | 2 +- src/CCW/code_3050.c | 2 +- src/GV/ch/histup.c | 2 +- src/core2/ch/gameSelect.c | 24 ++++++++++++------------ src/core2/code_4C020.c | 4 ++-- src/core2/code_85800.c | 6 +++--- src/lair/ch/cauldron.c | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/functions.h b/include/functions.h index 145deaec..11ac0cf0 100644 --- a/include/functions.h +++ b/include/functions.h @@ -397,7 +397,7 @@ void func_8030E2C4(u8); void func_8030E394(u8 indx); void func_8030E484(enum sfx_e uid); void func_8030E4E4(enum sfx_e uid); -void func_8030E510(enum sfx_e uid, s32 arg1); +void sfxsource_play(enum sfx_e uid, s32 sample_rate); void func_8030E540(enum sfx_e uid); void func_8030E560(enum sfx_e uid, s32 arg1); void func_8030E58C(enum sfx_e uid, f32 arg1); diff --git a/src/BGS/ch/pinkegg.c b/src/BGS/ch/pinkegg.c index a455aabb..8f1193d9 100644 --- a/src/BGS/ch/pinkegg.c +++ b/src/BGS/ch/pinkegg.c @@ -84,7 +84,7 @@ void chpinkegg_collision(ActorMarker *this, ActorMarker *other_marker){ thisActor = marker_getActor(this); this->propPtr->unk8_3 = 0; - func_8030E510(SFX_AA_BGS_EGG_BREAKING_1, 28000); + sfxsource_play(SFX_AA_BGS_EGG_BREAKING_1, 28000); subaddie_set_state(thisActor, 3); actor_playAnimationOnce(thisActor); this->collidable = 0; diff --git a/src/CCW/code_3050.c b/src/CCW/code_3050.c index 12698181..ea928bba 100644 --- a/src/CCW/code_3050.c +++ b/src/CCW/code_3050.c @@ -13,7 +13,7 @@ void func_80389440(Actor *this, s32 next_state) { void *temp_v0; if (next_state == 2) { - func_8030E510(SFX_AA_BGS_EGG_BREAKING_1, 28000); + sfxsource_play(SFX_AA_BGS_EGG_BREAKING_1, 28000); this->marker->propPtr->unk8_3 = FALSE; fileProgressFlag_set(FILEPROG_E6_SPRING_EYRIE_HATCHED, TRUE); skeletalAnim_set(this->unk148, 0x187, 0.0f, 2.0f); diff --git a/src/GV/ch/histup.c b/src/GV/ch/histup.c index 9b1efd8b..d5c81e1c 100644 --- a/src/GV/ch/histup.c +++ b/src/GV/ch/histup.c @@ -216,7 +216,7 @@ void func_8038DBDC(Actor *this){ } else{ if(actor_animationIsAt(this, 0.42f)) - func_8030E510(SFX_7C_CHEBOOF, 32000); + sfxsource_play(SFX_7C_CHEBOOF, 32000); tmp = this->unk44_31; if(tmp && func_8030E3FC(tmp)){ if(1.0 < this->unk1C[1]){ diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index aacf2606..b306dfbd 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -341,10 +341,10 @@ void func_802C4C14(Actor *this){ switch(sp84){ case 0://L802C4D8C if(actor_animationIsAt(this, 0.1f)) - func_8030E510(SFX_5D_BANJO_RAAOWW, 8000); + sfxsource_play(SFX_5D_BANJO_RAAOWW, 8000); if(actor_animationIsAt(this, 0.7f)) - func_8030E510(SFX_5E_BANJO_PHEWWW, 8000); + sfxsource_play(SFX_5E_BANJO_PHEWWW, 8000); break; case 1://L802C4DD0 if(randf() < 0.1){ @@ -364,7 +364,7 @@ void func_802C4C14(Actor *this){ switch(this->state){ case 1://L802C4F10 if(sp84 == 1){ - func_8030E510(SFX_136_GAMEBOY_STARTUP, 15000); + sfxsource_play(SFX_136_GAMEBOY_STARTUP, 15000); timedFunc_set_3(0.25f, (GenFunction_3)comusic_8025AB44, COMUSIC_73_GAMEBOY, -1, 2000); func_8025A58C(0, 2000); } @@ -441,20 +441,20 @@ void func_802C4C14(Actor *this){ if(randf() < 0.1){ switch(sp84){ case 0://L802C52B8 - func_8030E510(SFX_31_BANJO_OHHWAAOOO, 28000); + sfxsource_play(SFX_31_BANJO_OHHWAAOOO, 28000); func_8030E540(SFX_135_CARTOONY_SPRING); - timedFunc_set_2(0.4f, (GenFunction_2)func_8030E510, SFX_13A_GLASS_BREAKING_7, 0x7fff); - timedFunc_set_2(0.9f, (GenFunction_2)func_8030E510, SFX_150_PORCELAIN_CRASH, 0x7fff); - timedFunc_set_2(1.0f, (GenFunction_2)func_8030E510, SFX_151_CAT_MEOW, 0x7fff); + timedFunc_set_2(0.4f, (GenFunction_2)sfxsource_play, SFX_13A_GLASS_BREAKING_7, 0x7fff); + timedFunc_set_2(0.9f, (GenFunction_2)sfxsource_play, SFX_150_PORCELAIN_CRASH, 0x7fff); + timedFunc_set_2(1.0f, (GenFunction_2)sfxsource_play, SFX_151_CAT_MEOW, 0x7fff); break; case 1://L802C5320 - timedFunc_set_2(0.4f, (GenFunction_2)func_8030E510, SFX_31_BANJO_OHHWAAOOO, 28000); - timedFunc_set_2(0.2f, (GenFunction_2)func_8030E510, SFX_E_SHOCKSPRING_BOING, 28000); + timedFunc_set_2(0.4f, (GenFunction_2)sfxsource_play, SFX_31_BANJO_OHHWAAOOO, 28000); + timedFunc_set_2(0.2f, (GenFunction_2)sfxsource_play, SFX_E_SHOCKSPRING_BOING, 28000); func_8030E540(SFX_2D_KABOING); break; case 2://L802C5364 - timedFunc_set_2(0.15f, (GenFunction_2)func_8030E510, SFX_32_BANJO_EGHEE, 28000); - func_8030E510(SFX_3F6_UNKNOWN, 28000); + timedFunc_set_2(0.15f, (GenFunction_2)sfxsource_play, SFX_32_BANJO_EGHEE, 28000); + sfxsource_play(SFX_3F6_UNKNOWN, 28000); func_8030E540(SFX_8F_SNOWBALL_FLYING); break; }//L802C5394 @@ -466,7 +466,7 @@ void func_802C4C14(Actor *this){ subaddie_set_state(this, 3); } }else{//L802C53D0 - func_8030E510(SFX_4F_BANJO_WAHOO, 28000); + sfxsource_play(SFX_4F_BANJO_WAHOO, 28000); subaddie_set_state(this, 3); }//L802C53E8 if(sp84 == 0) diff --git a/src/core2/code_4C020.c b/src/core2/code_4C020.c index 84580db7..0f9b7a7a 100644 --- a/src/core2/code_4C020.c +++ b/src/core2/code_4C020.c @@ -171,7 +171,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case MARKER_109_BREAKABLE_BRICK_WALL: func_8030E6D4(SFX_114_BRICKWALL_BREAKING); - func_8030E510(SFX_11_WOOD_BREAKING_1, 28000); + sfxsource_play(SFX_11_WOOD_BREAKING_1, 28000); subaddie_set_state_looped(sp2C, 9); fileProgressFlag_set((sp2C->unkF4_8 == 1) ? FILEPROG_C8_LAIR_BRICKWALL_TO_WADINGBOOTS_BROKEN : FILEPROG_C9_LAIR_BRICKWALL_TO_SHOCKJUMP_PAD_BROKEN, TRUE); break; @@ -329,7 +329,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case 0x164: case 0x165: if (sp2C->unk1C[1] == sp2C->position[1]) { - func_8030E510(SFX_9B_BOULDER_BREAKING_1, 25000); + sfxsource_play(SFX_9B_BOULDER_BREAKING_1, 25000); sp2C->unk1C[0] = 1.0f; } break; diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index f88a66fb..4a67266b 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -849,12 +849,12 @@ void func_8030E4E4(enum sfx_e uid){ func_8030D6C4(uid, 1.0f, 22000, 0, 0); } -void func_8030E510(enum sfx_e uid, s32 arg1){ - func_8030D6C4(uid, 1.0f, arg1, 0, 2); +void sfxsource_play(enum sfx_e uid, s32 sample_rate){ + func_8030D6C4(uid, 1.0f, sample_rate, 0, 2); } void func_8030E540(enum sfx_e uid){ - func_8030E510(uid, 0x7ff8); + sfxsource_play(uid, 0x7ff8); } void func_8030E560(enum sfx_e uid, s32 arg1){ diff --git a/src/lair/ch/cauldron.c b/src/lair/ch/cauldron.c index 14806538..2c30609e 100644 --- a/src/lair/ch/cauldron.c +++ b/src/lair/ch/cauldron.c @@ -276,7 +276,7 @@ void chWarpCauldron_update(Actor *this) { func_802BAFE4(D_80393620[this->unkF4_8 - 1].unk3); func_802D09B8(this, 2); phi_a0 = (fileProgressFlag_get(chWarpCauldron_getPairedFileProgressFlagIndex(this)) != 0) ? SFX_107_CAULDRON_ACTIVATION_1 : SFX_108_CAULDRON_ACTIVATION_2; - func_8030E510(phi_a0, 32000); + sfxsource_play(phi_a0, 32000); if (!fileProgressFlag_get(FILEPROG_F5_COMPLETED_A_WARP_CAULDRON_SET) && !fileProgressFlag_get(chWarpCauldron_getPairedFileProgressFlagIndex(this))) { func_80311480(0xF79, 4, NULL, NULL, NULL, NULL); } From 3b2c5f4a99c0f5624d6a4f7ea0c3ec35753f52f2 Mon Sep 17 00:00:00 2001 From: Bl00D4NGEL Date: Tue, 3 Sep 2024 20:26:49 +0200 Subject: [PATCH 2/5] refac: rename struct45s to Sfxsource --- src/core2/code_85800.c | 90 +++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index 4a67266b..5319ac4a 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -41,7 +41,7 @@ typedef struct { u8 unk43_7:3; u8 unk43_4:3; u8 unk43_1:2; -}struct45s; +}Sfxsource; u8 func_8030D90C(void); void sfxsource_setSfxId(u8 indx, enum sfx_e uid); @@ -56,7 +56,7 @@ void func_8030EDAC(f32, f32); /* .bss */ struct46s D_80382470[10]; -struct45s D_803824C0[35]; +Sfxsource D_803824C0[35]; f32 D_80382E0C; f32 D_80382E10; @@ -68,35 +68,35 @@ void __sfx_getPlayerPositionIfPresent(f32 arg0[3]){ ml_vec3f_clear(arg0); } -void func_8030C7D0(struct45s *arg0, s32 arg1){ +void func_8030C7D0(Sfxsource *arg0, s32 arg1){ arg0->unk43_7 = arg1; } -s32 func_8030C7E8(struct45s *arg0){ +s32 func_8030C7E8(Sfxsource *arg0){ return arg0->unk43_7; } -void func_8030C7F8(struct45s *arg0, s32 arg1){ +void func_8030C7F8(Sfxsource *arg0, s32 arg1){ arg0->unk43_4 = arg1; } -int func_8030C814(struct45s *arg0, s32 arg1){ +int func_8030C814(Sfxsource *arg0, s32 arg1){ return arg0->unk43_4 == arg1; } -void sfxsource_setFlag(struct45s *arg0, s32 arg1){ +void sfxsource_setFlag(Sfxsource *arg0, s32 arg1){ arg0->unk41 |= arg1; } -void sfxsource_clearFlag(struct45s *arg0, s32 arg1){ +void sfxsource_clearFlag(Sfxsource *arg0, s32 arg1){ arg0->unk41 &= ~arg1; } -s32 sfxsource_isFlagSet(struct45s *arg0, s32 arg1){ +s32 sfxsource_isFlagSet(Sfxsource *arg0, s32 arg1){ return arg0->unk41 & arg1; } -int sfxsource_isFlagCleared(struct45s *arg0, s32 arg1){ +int sfxsource_isFlagCleared(Sfxsource *arg0, s32 arg1){ return (arg0->unk41 & arg1) == 0; } @@ -106,7 +106,7 @@ void sfxsource_initAll(void){ D_803824C0[i].busy = FALSE; } -struct45s *sfxsource_at(u8 indx){ +Sfxsource *sfxsource_at(u8 indx){ return D_803824C0 + indx; } @@ -154,7 +154,7 @@ s32 func_8030CA60(void){ } void sfxsource_free(u8 indx){ - struct45s *ptr = sfxsource_at(indx); + Sfxsource *ptr = sfxsource_at(indx); if(ptr->unk40){ func_8030C9F4(ptr->unk40); ptr->unk40 = 0; @@ -162,7 +162,7 @@ void sfxsource_free(u8 indx){ D_803824C0[indx].busy = FALSE; } -void func_8030CBD0(struct45s *arg0){ +void func_8030CBD0(Sfxsource *arg0){ s32 sp24 = func_8030CA60(); struct46s *temp_a1; if(sp24){ @@ -182,7 +182,7 @@ void func_8030CBD0(struct45s *arg0){ }//L8030CC7C } -void func_8030CC90(struct45s *arg0){ +void func_8030CC90(Sfxsource *arg0){ if(func_8030C814(arg0, 1)){ sfxsource_clearFlag(arg0, SFX_SRC_FLAG_5_UNKOWN); func_8030C7F8(arg0, 2); @@ -192,7 +192,7 @@ void func_8030CC90(struct45s *arg0){ } } -s32 func_8030CCF0(struct45s *arg0, s32 arg1){ +s32 func_8030CCF0(Sfxsource *arg0, s32 arg1){ f32 plyr_pos[3]; f32 diff[3]; f32 dist_sqr; @@ -211,7 +211,7 @@ s32 func_8030CCF0(struct45s *arg0, s32 arg1){ return retVal; } -s32 func_8030CDE4(struct45s *arg0){ +s32 func_8030CDE4(Sfxsource *arg0){ f32 sp44[3]; f32 sp38[3]; f32 sp2C[3]; @@ -264,7 +264,7 @@ void func_8030D004(s32 arg0, s32 arg1){ } } -s32 func_8030D038(struct45s *arg0, s32 arg1){ +s32 func_8030D038(Sfxsource *arg0, s32 arg1){ if(sfxsource_isFlagSet(arg0,SFX_SRC_FLAG_6_UNKOWN)){ if(sfxsource_isFlagSet(arg0, SFX_SRC_FLAG_7_UNKOWN)){ if(player_is_present() && func_8028EE84() == BSWATERGROUP_2_UNDERWATER) @@ -280,7 +280,7 @@ s32 func_8030D038(struct45s *arg0, s32 arg1){ s32 func_8030D10C(u8 indx){ s32 sp24; - struct45s * ptr; + Sfxsource * ptr; s32 tmp_v0; f32 tmp_f2; @@ -326,7 +326,7 @@ void func_8030D310(u8 indx){ f32 pad0; s32 sp30; f32 pad1; - struct45s * ptr; + Sfxsource * ptr; f32 sp24; ptr = sfxsource_at(indx); @@ -396,7 +396,7 @@ void func_8030D310(u8 indx){ } bool func_8030D5CC(u8 indx){ - struct45s * sp1C = sfxsource_at(indx); + Sfxsource * sp1C = sfxsource_at(indx); if(!func_8030C814(sp1C, 3)) return 0; @@ -478,7 +478,7 @@ void func_8030D8DC(void){ u8 func_8030D90C(void){ u8 s1 = sfxsource_getNewIndex(); - struct45s *s0; + Sfxsource *s0; if(s1 == 0) return 0; @@ -511,7 +511,7 @@ u8 func_8030D90C(void){ } void func_8030DA44(u8 indx){ - struct45s * sp1C = sfxsource_at(indx); + Sfxsource * sp1C = sfxsource_at(indx); func_8030E394(indx); func_8030C7F8(sp1C, 3); } @@ -522,7 +522,7 @@ void sfxsource_setSfxId(u8 indx, enum sfx_e uid){ } void sfxsource_setSampleRate(u8 indx, s32 sample_rate){ - struct45s *temp_v0; + Sfxsource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); temp_v0->unk2A = sample_rate; @@ -550,7 +550,7 @@ void func_8030DB04(u8 indx, s32 arg1, f32 arg2[3], f32 min_dist, f32 max_dist){ } void func_8030DBB4(u8 indx, f32 arg1){ - struct45s *temp_v0; + Sfxsource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); temp_v0->unk34 = arg1; @@ -581,7 +581,7 @@ void func_8030DBFC(u8 indx, f32 arg1, f32 arg2, f32 arg3){ } void func_8030DCCC(u8 indx, s32 arg1){ - struct45s *temp_v0; + Sfxsource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); temp_v0->unk2C = arg1; @@ -590,7 +590,7 @@ void func_8030DCCC(u8 indx, s32 arg1){ } void func_8030DD14(u8 indx, int arg1){ - struct45s *temp_v0; + Sfxsource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); func_8030C7D0(temp_v0, arg1); @@ -598,7 +598,7 @@ void func_8030DD14(u8 indx, int arg1){ } void func_8030DD54(u8 indx, void (*arg1)(u8)){ - struct45s *temp_v0; + Sfxsource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); temp_v0->unk30 = arg1; @@ -606,7 +606,7 @@ void func_8030DD54(u8 indx, void (*arg1)(u8)){ } void func_8030DD90(u8 indx, s32 arg1){ - struct45s *temp_v0; + Sfxsource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); switch(arg1){ @@ -627,7 +627,7 @@ void func_8030DD90(u8 indx, s32 arg1){ } void func_8030DE44(u8 indx, s32 arg1, f32 arg2){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); switch(arg1){ @@ -644,7 +644,7 @@ void func_8030DE44(u8 indx, s32 arg1, f32 arg2){ } void sfxsource_set_fade_distances(u8 indx, f32 min, f32 max){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->fade_inner_radius_sqr = min*min; @@ -654,7 +654,7 @@ void sfxsource_set_fade_distances(u8 indx, f32 min, f32 max){ } void func_8030DF18(u8 indx, f32 arg1){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->unk14 = (s16)arg1; @@ -663,7 +663,7 @@ void func_8030DF18(u8 indx, f32 arg1){ } void sfxsource_set_position(u8 indx, f32 position[3]){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); ml_vec3f_copy(ptr->position, position); @@ -672,7 +672,7 @@ void sfxsource_set_position(u8 indx, f32 position[3]){ } void func_8030DFB4(u8 indx, s32 arg1){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->unk16 = arg1; @@ -680,7 +680,7 @@ void func_8030DFB4(u8 indx, s32 arg1){ } void func_8030DFF0(u8 indx, s32 arg1){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); if(arg1){ @@ -693,7 +693,7 @@ void func_8030DFF0(u8 indx, s32 arg1){ } void func_8030E04C(u8 indx, f32 arg1, f32 arg2, f32 arg3){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->unk43_1 = 1; @@ -704,7 +704,7 @@ void func_8030E04C(u8 indx, f32 arg1, f32 arg2, f32 arg3){ } void func_8030E0B4(u8 indx, f32 arg1, f32 arg2){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->unk38 = arg1; @@ -713,7 +713,7 @@ void func_8030E0B4(u8 indx, f32 arg1, f32 arg2){ } void func_8030E0FC(u8 indx, f32 arg1, f32 arg2, f32 arg3){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); @@ -726,7 +726,7 @@ void func_8030E0FC(u8 indx, f32 arg1, f32 arg2, f32 arg3){ } enum sfx_e sfxsource_getSfxId(u8 indx){ - struct45s *ptr; + Sfxsource *ptr; if(!indx) return 0; @@ -737,7 +737,7 @@ enum sfx_e sfxsource_getSfxId(u8 indx){ } s32 func_8030E1C4(u8 indx){ - struct45s *ptr; + Sfxsource *ptr; if(indx == 0) return 0; @@ -748,7 +748,7 @@ s32 func_8030E1C4(u8 indx){ } f32 func_8030E200(u8 indx){ - struct45s *ptr; + Sfxsource *ptr; if(!indx) return 1.0f; @@ -759,7 +759,7 @@ f32 func_8030E200(u8 indx){ } s32 func_8030E244(u8 indx){ - struct45s *ptr; + Sfxsource *ptr; if(!indx) return 0; @@ -769,7 +769,7 @@ s32 func_8030E244(u8 indx){ } } -bool func_8030E280(struct45s *arg0){ +bool func_8030E280(Sfxsource *arg0){ int temp_v1; if(sfxsource_isFlagSet(arg0, SFX_SRC_FLAG_1_UNKOWN)){ temp_v1 = func_8030CCF0(arg0, arg0->unk2A); @@ -781,7 +781,7 @@ bool func_8030E280(struct45s *arg0){ } void func_8030E2C4(u8 indx){ - struct45s *ptr; + Sfxsource *ptr; if(!indx) return; @@ -810,7 +810,7 @@ void func_8030E2C4(u8 indx){ } void func_8030E394(u8 indx){ - struct45s *ptr; + Sfxsource *ptr; if(indx){ ptr = sfxsource_at(indx); @@ -824,7 +824,7 @@ void func_8030E394(u8 indx){ int func_8030E3FC(u8 indx){ - struct45s *ptr; + Sfxsource *ptr; if(!indx) return 0; From 1908fb86b25504131dd1922f0052b04427aaaef3 Mon Sep 17 00:00:00 2001 From: Bl00D4NGEL Date: Tue, 3 Sep 2024 20:27:17 +0200 Subject: [PATCH 3/5] refac: rename D_803824C0 to sfxsources --- src/core2/code_85800.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index 5319ac4a..b6ce8de9 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -56,7 +56,7 @@ void func_8030EDAC(f32, f32); /* .bss */ struct46s D_80382470[10]; -Sfxsource D_803824C0[35]; +Sfxsource sfxsources[35]; f32 D_80382E0C; f32 D_80382E10; @@ -103,11 +103,11 @@ int sfxsource_isFlagCleared(Sfxsource *arg0, s32 arg1){ void sfxsource_initAll(void){ int i; for(i = 0; i < 35; i++) - D_803824C0[i].busy = FALSE; + sfxsources[i].busy = FALSE; } Sfxsource *sfxsource_at(u8 indx){ - return D_803824C0 + indx; + return sfxsources + indx; } struct46s *func_8030C8DC(s32 indx){ @@ -121,8 +121,8 @@ Struct81s *func_8030C8F4(s32 indx){ u8 sfxsource_getNewIndex(void){ int i; for(i = 1; i < 35; i++){ - if(!D_803824C0[i].busy){ - D_803824C0[i].busy = TRUE; + if(!sfxsources[i].busy){ + sfxsources[i].busy = TRUE; return i; } } @@ -159,7 +159,7 @@ void sfxsource_free(u8 indx){ func_8030C9F4(ptr->unk40); ptr->unk40 = 0; } - D_803824C0[indx].busy = FALSE; + sfxsources[indx].busy = FALSE; } void func_8030CBD0(Sfxsource *arg0){ @@ -411,7 +411,7 @@ bool func_8030D5CC(u8 indx){ void func_8030D644(void){ int i; for(i = 1; i < 35; i++){ - if(D_803824C0[i].busy){ + if(sfxsources[i].busy){ func_8030D310(i); if(func_8030D5CC(i)) sfxsource_free(i); @@ -442,14 +442,14 @@ void func_8030D778(void){ int i; int temp_s1; for(i = 1; i < 35; i++){ - if(D_803824C0[i].busy) + if(sfxsources[i].busy) func_8030DA44(i); } do{ temp_s1 = 0; func_8030D644(); for(i = 1; i < 35; i++){ - if(D_803824C0[i].busy) + if(sfxsources[i].busy) temp_s1++; } }while(temp_s1); From 90bee2133797db4dd3903168c19a749e48c40e20 Mon Sep 17 00:00:00 2001 From: Bl00D4NGEL Date: Tue, 3 Sep 2024 20:30:13 +0200 Subject: [PATCH 4/5] refac: rename unk2A of Sfxsource struct to sample_rate --- src/core2/code_85800.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index b6ce8de9..380d02c8 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -28,7 +28,7 @@ typedef struct { f32 unk20; f32 unk24; s16 sfx_uid; - s16 unk2A;//sample_rate + s16 sample_rate;//sample_rate u8 unk2C; u8 pad2D[3]; void (*unk30)(u8 indx); @@ -299,14 +299,14 @@ s32 func_8030D10C(u8 indx){ //L8030D228 if(sfxsource_isFlagSet(ptr, SFX_SRC_FLAG_1_UNKOWN)){ - tmp_v0 = func_8030CCF0(ptr, ptr->unk2A); + tmp_v0 = func_8030CCF0(ptr, ptr->sample_rate); if(tmp_v0 < 100) sp24 = 1; func_8030D004(ptr->unk40, func_8030D038(ptr, tmp_v0)); func_8030CF9C(ptr->unk40, func_8030CDE4(ptr)); }else{//L8030D288 if(sfxsource_isFlagSet(ptr, SFX_SRC_FLAG_3_UNKOWN)){ - tmp_v0 = func_8030D038(ptr, ptr->unk2A); + tmp_v0 = func_8030D038(ptr, ptr->sample_rate); if(tmp_v0 < 100) sp24 = 1; func_8030D004(ptr->unk40, tmp_v0); @@ -486,7 +486,7 @@ u8 func_8030D90C(void){ s0 = sfxsource_at(s1); s0->unk30 = NULL; s0->sfx_uid = -1; - s0->unk2A = 22000; + s0->sample_rate = 22000; s0->unk2C = 0; s0->unk40 = 0; s0->unk43_1 = 0; @@ -525,7 +525,7 @@ void sfxsource_setSampleRate(u8 indx, s32 sample_rate){ Sfxsource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); - temp_v0->unk2A = sample_rate; + temp_v0->sample_rate = sample_rate; sfxsource_setFlag(temp_v0, SFX_SRC_FLAG_3_UNKOWN); } } @@ -743,7 +743,7 @@ s32 func_8030E1C4(u8 indx){ return 0; else{ ptr = sfxsource_at(indx); - return ptr->unk2A; + return ptr->sample_rate; } } @@ -772,10 +772,10 @@ s32 func_8030E244(u8 indx){ bool func_8030E280(Sfxsource *arg0){ int temp_v1; if(sfxsource_isFlagSet(arg0, SFX_SRC_FLAG_1_UNKOWN)){ - temp_v1 = func_8030CCF0(arg0, arg0->unk2A); + temp_v1 = func_8030CCF0(arg0, arg0->sample_rate); } else{ - temp_v1 = arg0->unk2A; + temp_v1 = arg0->sample_rate; } return (temp_v1 > 100); } From 1fe12db32d14c5530982fffa13c8bf2096bb692b Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Thu, 5 Sep 2024 20:03:21 -0500 Subject: [PATCH 5/5] `Sfxsource` -> `SfxSource` to better fit style guide --- src/core2/code_85800.c | 90 +++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index 380d02c8..2ba08b39 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -41,7 +41,7 @@ typedef struct { u8 unk43_7:3; u8 unk43_4:3; u8 unk43_1:2; -}Sfxsource; +}SfxSource; u8 func_8030D90C(void); void sfxsource_setSfxId(u8 indx, enum sfx_e uid); @@ -56,7 +56,7 @@ void func_8030EDAC(f32, f32); /* .bss */ struct46s D_80382470[10]; -Sfxsource sfxsources[35]; +SfxSource sfxsources[35]; f32 D_80382E0C; f32 D_80382E10; @@ -68,35 +68,35 @@ void __sfx_getPlayerPositionIfPresent(f32 arg0[3]){ ml_vec3f_clear(arg0); } -void func_8030C7D0(Sfxsource *arg0, s32 arg1){ +void func_8030C7D0(SfxSource *arg0, s32 arg1){ arg0->unk43_7 = arg1; } -s32 func_8030C7E8(Sfxsource *arg0){ +s32 func_8030C7E8(SfxSource *arg0){ return arg0->unk43_7; } -void func_8030C7F8(Sfxsource *arg0, s32 arg1){ +void func_8030C7F8(SfxSource *arg0, s32 arg1){ arg0->unk43_4 = arg1; } -int func_8030C814(Sfxsource *arg0, s32 arg1){ +int func_8030C814(SfxSource *arg0, s32 arg1){ return arg0->unk43_4 == arg1; } -void sfxsource_setFlag(Sfxsource *arg0, s32 arg1){ +void sfxsource_setFlag(SfxSource *arg0, s32 arg1){ arg0->unk41 |= arg1; } -void sfxsource_clearFlag(Sfxsource *arg0, s32 arg1){ +void sfxsource_clearFlag(SfxSource *arg0, s32 arg1){ arg0->unk41 &= ~arg1; } -s32 sfxsource_isFlagSet(Sfxsource *arg0, s32 arg1){ +s32 sfxsource_isFlagSet(SfxSource *arg0, s32 arg1){ return arg0->unk41 & arg1; } -int sfxsource_isFlagCleared(Sfxsource *arg0, s32 arg1){ +int sfxsource_isFlagCleared(SfxSource *arg0, s32 arg1){ return (arg0->unk41 & arg1) == 0; } @@ -106,7 +106,7 @@ void sfxsource_initAll(void){ sfxsources[i].busy = FALSE; } -Sfxsource *sfxsource_at(u8 indx){ +SfxSource *sfxsource_at(u8 indx){ return sfxsources + indx; } @@ -154,7 +154,7 @@ s32 func_8030CA60(void){ } void sfxsource_free(u8 indx){ - Sfxsource *ptr = sfxsource_at(indx); + SfxSource *ptr = sfxsource_at(indx); if(ptr->unk40){ func_8030C9F4(ptr->unk40); ptr->unk40 = 0; @@ -162,7 +162,7 @@ void sfxsource_free(u8 indx){ sfxsources[indx].busy = FALSE; } -void func_8030CBD0(Sfxsource *arg0){ +void func_8030CBD0(SfxSource *arg0){ s32 sp24 = func_8030CA60(); struct46s *temp_a1; if(sp24){ @@ -182,7 +182,7 @@ void func_8030CBD0(Sfxsource *arg0){ }//L8030CC7C } -void func_8030CC90(Sfxsource *arg0){ +void func_8030CC90(SfxSource *arg0){ if(func_8030C814(arg0, 1)){ sfxsource_clearFlag(arg0, SFX_SRC_FLAG_5_UNKOWN); func_8030C7F8(arg0, 2); @@ -192,7 +192,7 @@ void func_8030CC90(Sfxsource *arg0){ } } -s32 func_8030CCF0(Sfxsource *arg0, s32 arg1){ +s32 func_8030CCF0(SfxSource *arg0, s32 arg1){ f32 plyr_pos[3]; f32 diff[3]; f32 dist_sqr; @@ -211,7 +211,7 @@ s32 func_8030CCF0(Sfxsource *arg0, s32 arg1){ return retVal; } -s32 func_8030CDE4(Sfxsource *arg0){ +s32 func_8030CDE4(SfxSource *arg0){ f32 sp44[3]; f32 sp38[3]; f32 sp2C[3]; @@ -264,7 +264,7 @@ void func_8030D004(s32 arg0, s32 arg1){ } } -s32 func_8030D038(Sfxsource *arg0, s32 arg1){ +s32 func_8030D038(SfxSource *arg0, s32 arg1){ if(sfxsource_isFlagSet(arg0,SFX_SRC_FLAG_6_UNKOWN)){ if(sfxsource_isFlagSet(arg0, SFX_SRC_FLAG_7_UNKOWN)){ if(player_is_present() && func_8028EE84() == BSWATERGROUP_2_UNDERWATER) @@ -280,7 +280,7 @@ s32 func_8030D038(Sfxsource *arg0, s32 arg1){ s32 func_8030D10C(u8 indx){ s32 sp24; - Sfxsource * ptr; + SfxSource * ptr; s32 tmp_v0; f32 tmp_f2; @@ -326,7 +326,7 @@ void func_8030D310(u8 indx){ f32 pad0; s32 sp30; f32 pad1; - Sfxsource * ptr; + SfxSource * ptr; f32 sp24; ptr = sfxsource_at(indx); @@ -396,7 +396,7 @@ void func_8030D310(u8 indx){ } bool func_8030D5CC(u8 indx){ - Sfxsource * sp1C = sfxsource_at(indx); + SfxSource * sp1C = sfxsource_at(indx); if(!func_8030C814(sp1C, 3)) return 0; @@ -478,7 +478,7 @@ void func_8030D8DC(void){ u8 func_8030D90C(void){ u8 s1 = sfxsource_getNewIndex(); - Sfxsource *s0; + SfxSource *s0; if(s1 == 0) return 0; @@ -511,7 +511,7 @@ u8 func_8030D90C(void){ } void func_8030DA44(u8 indx){ - Sfxsource * sp1C = sfxsource_at(indx); + SfxSource * sp1C = sfxsource_at(indx); func_8030E394(indx); func_8030C7F8(sp1C, 3); } @@ -522,7 +522,7 @@ void sfxsource_setSfxId(u8 indx, enum sfx_e uid){ } void sfxsource_setSampleRate(u8 indx, s32 sample_rate){ - Sfxsource *temp_v0; + SfxSource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); temp_v0->sample_rate = sample_rate; @@ -550,7 +550,7 @@ void func_8030DB04(u8 indx, s32 arg1, f32 arg2[3], f32 min_dist, f32 max_dist){ } void func_8030DBB4(u8 indx, f32 arg1){ - Sfxsource *temp_v0; + SfxSource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); temp_v0->unk34 = arg1; @@ -581,7 +581,7 @@ void func_8030DBFC(u8 indx, f32 arg1, f32 arg2, f32 arg3){ } void func_8030DCCC(u8 indx, s32 arg1){ - Sfxsource *temp_v0; + SfxSource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); temp_v0->unk2C = arg1; @@ -590,7 +590,7 @@ void func_8030DCCC(u8 indx, s32 arg1){ } void func_8030DD14(u8 indx, int arg1){ - Sfxsource *temp_v0; + SfxSource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); func_8030C7D0(temp_v0, arg1); @@ -598,7 +598,7 @@ void func_8030DD14(u8 indx, int arg1){ } void func_8030DD54(u8 indx, void (*arg1)(u8)){ - Sfxsource *temp_v0; + SfxSource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); temp_v0->unk30 = arg1; @@ -606,7 +606,7 @@ void func_8030DD54(u8 indx, void (*arg1)(u8)){ } void func_8030DD90(u8 indx, s32 arg1){ - Sfxsource *temp_v0; + SfxSource *temp_v0; if(indx){ temp_v0 = sfxsource_at(indx); switch(arg1){ @@ -627,7 +627,7 @@ void func_8030DD90(u8 indx, s32 arg1){ } void func_8030DE44(u8 indx, s32 arg1, f32 arg2){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); switch(arg1){ @@ -644,7 +644,7 @@ void func_8030DE44(u8 indx, s32 arg1, f32 arg2){ } void sfxsource_set_fade_distances(u8 indx, f32 min, f32 max){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->fade_inner_radius_sqr = min*min; @@ -654,7 +654,7 @@ void sfxsource_set_fade_distances(u8 indx, f32 min, f32 max){ } void func_8030DF18(u8 indx, f32 arg1){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->unk14 = (s16)arg1; @@ -663,7 +663,7 @@ void func_8030DF18(u8 indx, f32 arg1){ } void sfxsource_set_position(u8 indx, f32 position[3]){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); ml_vec3f_copy(ptr->position, position); @@ -672,7 +672,7 @@ void sfxsource_set_position(u8 indx, f32 position[3]){ } void func_8030DFB4(u8 indx, s32 arg1){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->unk16 = arg1; @@ -680,7 +680,7 @@ void func_8030DFB4(u8 indx, s32 arg1){ } void func_8030DFF0(u8 indx, s32 arg1){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); if(arg1){ @@ -693,7 +693,7 @@ void func_8030DFF0(u8 indx, s32 arg1){ } void func_8030E04C(u8 indx, f32 arg1, f32 arg2, f32 arg3){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->unk43_1 = 1; @@ -704,7 +704,7 @@ void func_8030E04C(u8 indx, f32 arg1, f32 arg2, f32 arg3){ } void func_8030E0B4(u8 indx, f32 arg1, f32 arg2){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); ptr->unk38 = arg1; @@ -713,7 +713,7 @@ void func_8030E0B4(u8 indx, f32 arg1, f32 arg2){ } void func_8030E0FC(u8 indx, f32 arg1, f32 arg2, f32 arg3){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); @@ -726,7 +726,7 @@ void func_8030E0FC(u8 indx, f32 arg1, f32 arg2, f32 arg3){ } enum sfx_e sfxsource_getSfxId(u8 indx){ - Sfxsource *ptr; + SfxSource *ptr; if(!indx) return 0; @@ -737,7 +737,7 @@ enum sfx_e sfxsource_getSfxId(u8 indx){ } s32 func_8030E1C4(u8 indx){ - Sfxsource *ptr; + SfxSource *ptr; if(indx == 0) return 0; @@ -748,7 +748,7 @@ s32 func_8030E1C4(u8 indx){ } f32 func_8030E200(u8 indx){ - Sfxsource *ptr; + SfxSource *ptr; if(!indx) return 1.0f; @@ -759,7 +759,7 @@ f32 func_8030E200(u8 indx){ } s32 func_8030E244(u8 indx){ - Sfxsource *ptr; + SfxSource *ptr; if(!indx) return 0; @@ -769,7 +769,7 @@ s32 func_8030E244(u8 indx){ } } -bool func_8030E280(Sfxsource *arg0){ +bool func_8030E280(SfxSource *arg0){ int temp_v1; if(sfxsource_isFlagSet(arg0, SFX_SRC_FLAG_1_UNKOWN)){ temp_v1 = func_8030CCF0(arg0, arg0->sample_rate); @@ -781,7 +781,7 @@ bool func_8030E280(Sfxsource *arg0){ } void func_8030E2C4(u8 indx){ - Sfxsource *ptr; + SfxSource *ptr; if(!indx) return; @@ -810,7 +810,7 @@ void func_8030E2C4(u8 indx){ } void func_8030E394(u8 indx){ - Sfxsource *ptr; + SfxSource *ptr; if(indx){ ptr = sfxsource_at(indx); @@ -824,7 +824,7 @@ void func_8030E394(u8 indx){ int func_8030E3FC(u8 indx){ - Sfxsource *ptr; + SfxSource *ptr; if(!indx) return 0;