From 133e02a8a744ec7252b71ca5a0e310367dae037d Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Tue, 11 Jan 2022 11:27:36 +1100 Subject: [PATCH] z_sound_source OK (#353) * z_sound_source OK * Fix Pos * Lib_PlaySfxByPos * Change function names * format * Update names to match OoT * cleanup from the merge * Fix name --- include/functions.h | 21 +++--- include/z64.h | 8 +- spec | 2 +- src/code/audio/code_8019AF00.c | 2 +- src/code/audio/code_801A5BD0.c | 2 +- src/code/code_800F0390.c | 11 --- src/code/z_actor.c | 14 ++-- src/code/z_collision_check.c | 20 ++--- src/code/z_effect_soft_sprite.c | 4 +- src/code/z_en_item00.c | 8 +- src/code/z_fireobj.c | 2 +- src/code/z_lib.c | 4 +- src/code/z_sound_source.c | 75 +++++++++++++++++++ .../actors/ovl_Arms_Hook/z_arms_hook.c | 6 +- .../actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c | 2 +- .../actors/ovl_Bg_Icicle/z_bg_icicle.c | 2 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 2 +- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 2 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 8 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 6 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 2 +- .../actors/ovl_En_Dekunuts/z_en_dekunuts.c | 2 +- .../actors/ovl_En_Elfbub/z_en_elfbub.c | 2 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.c | 2 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 16 ++-- .../actors/ovl_En_Floormas/z_en_floormas.c | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 4 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 2 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 10 +-- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 2 +- src/overlays/actors/ovl_En_Kame/z_en_kame.c | 3 +- src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c | 8 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 2 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 4 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 2 +- .../actors/ovl_En_Peehat/z_en_peehat.c | 8 +- .../actors/ovl_En_Rail_Skb/z_en_rail_skb.c | 8 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 2 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.c | 2 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 4 +- src/overlays/actors/ovl_En_St/z_en_st.c | 2 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 2 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 2 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 2 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 4 +- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c | 16 ++-- .../ovl_En_Water_Effect/z_en_water_effect.c | 8 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 3 +- .../actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c | 6 +- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c | 2 +- .../ovl_Obj_Flowerpot/z_obj_flowerpot.c | 6 +- .../actors/ovl_Obj_Ghaka/z_obj_ghaka.c | 4 +- .../ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c | 4 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 12 +-- .../actors/ovl_Obj_Kibako2/z_obj_kibako2.c | 2 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 2 +- tools/actorfixer.py | 5 +- tools/disasm/files.txt | 2 +- tools/disasm/functions.txt | 16 ++-- tools/sizes/code_functions.csv | 16 ++-- 62 files changed, 239 insertions(+), 169 deletions(-) delete mode 100644 src/code/code_800F0390.c create mode 100644 src/code/z_sound_source.c diff --git a/include/functions.h b/include/functions.h index 30f577b50b..cfa7f4fad6 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1495,11 +1495,10 @@ void EffFootmark_Init(GlobalContext* globalCtx); void EffFootmark_Add(GlobalContext* globalCtx, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay); void EffFootmark_Update(GlobalContext* globalCtx); void EffFootmark_Draw(GlobalContext* globalCtx); -void func_800F0390(GlobalContext* globalCtx); -void func_800F03C0(GlobalContext* globalCtx); -void func_800F048C(GlobalContext* globalCtx, Vec3f* param_2, u8 param_3, u16 param_4, u8 param_5); -void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* position, s32 param_3, u16 sfxId); -void func_800F0590(GlobalContext* globalCtx, Vec3f* arg1, s32 arg2, s32 arg3); +void SoundSource_InitAll(GlobalContext* globalCtx); +void SoundSource_UpdateAll(GlobalContext* globalCtx); +void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId); +void SoundSource_PlaySfxEachFrameAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId); u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx); s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex); Actor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx); @@ -1720,7 +1719,7 @@ 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 func_801000F4(s32 a0, u16 a1); +void Lib_PlaySfxAtPos(Vec3f* pos, u16 sfxId); void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 a, 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); @@ -3689,12 +3688,12 @@ void func_8019E014(void); // void func_8019EB2C(void); // void func_8019F024(void); // void func_8019F05C(void); -void func_8019F170(Vec3f* pos, u16 sfxId); -void func_8019F1C0(Vec3f* pos, u16 sfxId); void play_sound(u16 sfxId); void func_8019F128(u16 sfxId); -void func_8019F208(void); // Decide sound -void func_8019F230(void); // Cancel sound +void func_8019F170(Vec3f* pos, u16 sfxId); +void Audio_PlaySfxAtPos(Vec3f* pos, u16 sfxId); +void func_8019F208(void); // decide sfx +void func_8019F230(void); // cancel sfx // void func_8019F258(void); // void func_8019F300(void); void func_8019F420(Vec3f* pos, u16 sfxId); @@ -3852,7 +3851,7 @@ void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* param_2, u8 param_3, f32* param_4, f // void func_801A7084(void); // void func_801A7168(void); // void func_801A7284(void); -void func_801A72CC(Vec3f* uParm1); +void Audio_StopSfxByPos(Vec3f* pos); void func_801A7328(Vec3f* pos, u16 sfxId); // void func_801A7484(void); void func_801A75E8(u16 sfxId); diff --git a/include/z64.h b/include/z64.h index 248c0f7baf..31eec335b7 100644 --- a/include/z64.h +++ b/include/z64.h @@ -467,9 +467,11 @@ typedef enum { } GfxPrintFlag; typedef struct { - /* 0x00 */ u16 countdown; - /* 0x04 */ Vec3f originPos; - /* 0x10 */ Vec3f relativePos; + /* 0x00 */ u8 countdown; + /* 0x01 */ u8 playSfxEachFrame; + /* 0x02 */ u16 sfxId; + /* 0x04 */ Vec3f worldPos; + /* 0x10 */ Vec3f projectedPos; } SoundSource; // size = 0x1C typedef struct { diff --git a/spec b/spec index 20c127ac26..aa2eacaea1 100644 --- a/spec +++ b/spec @@ -465,7 +465,7 @@ beginseg include "build/data/code/z_draw.data.o" include "build/src/code/z_eff_footmark.o" include "build/data/code/z_eff_footmark.data.o" - include "build/src/code/code_800F0390.o" + include "build/src/code/z_sound_source.o" include "build/src/code/z_elf_message.o" include "build/src/code/z_en_hy.o" include "build/src/code/z_face_reaction.o" diff --git a/src/code/audio/code_8019AF00.c b/src/code/audio/code_8019AF00.c index 9354af1887..5d0a166a28 100644 --- a/src/code/audio/code_8019AF00.c +++ b/src/code/audio/code_8019AF00.c @@ -134,7 +134,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F170.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F1C0.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_PlaySfxAtPos.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F208.s") diff --git a/src/code/audio/code_801A5BD0.c b/src/code/audio/code_801A5BD0.c index 0a13b00ecf..7d796aa9fc 100644 --- a/src/code/audio/code_801A5BD0.c +++ b/src/code/audio/code_801A5BD0.c @@ -24,7 +24,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7284.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A72CC.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/Audio_StopSfxByPos.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7328.s") diff --git a/src/code/code_800F0390.c b/src/code/code_800F0390.c deleted file mode 100644 index f495cfe5ea..0000000000 --- a/src/code/code_800F0390.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F0390/func_800F0390.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F0390/func_800F03C0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F0390/func_800F048C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F0390/Audio_PlaySoundAtPosition.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F0390/func_800F0590.s") diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 49eee72358..0b38d135f5 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2139,7 +2139,7 @@ void func_800B8E58(Player* player, u16 sfxId) { * Plays the sound effect at the actor's position */ void Actor_PlaySfxAtPos(Actor* actor, u16 sfxId) { - func_8019F1C0(&actor->projectedPos, sfxId); + Audio_PlaySfxAtPos(&actor->projectedPos, sfxId); } void func_800B8EF4(GlobalContext* globalCtx, Actor* actor) { @@ -2155,8 +2155,8 @@ void func_800B8EF4(GlobalContext* globalCtx, Actor* actor) { sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, actor->floorPoly, actor->floorBgId); } - func_8019F1C0(&actor->projectedPos, NA_SE_EV_BOMB_BOUND); - func_8019F1C0(&actor->projectedPos, sfxId + SFX_FLAG); + Audio_PlaySfxAtPos(&actor->projectedPos, NA_SE_EV_BOMB_BOUND); + Audio_PlaySfxAtPos(&actor->projectedPos, sfxId + SFX_FLAG); } void func_800B8F98(Actor* actor, u16 sfxId) { @@ -2580,7 +2580,7 @@ void func_800B9D1C(Actor* actor) { } else if (actor->audioFlags & 0x10) { func_801A0810(&D_801DB4A4, NA_SE_SY_TIMER - SFX_FLAG, (sfxId - 1)); } else if (actor->audioFlags & 1) { - func_8019F1C0(&actor->projectedPos, sfxId); + Audio_PlaySfxAtPos(&actor->projectedPos, sfxId); } } @@ -3345,7 +3345,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC actorCtx->targetContext.bgmEnemy = NULL; } - func_801A72CC(&actor->projectedPos); + Audio_StopSfxByPos(&actor->projectedPos); Actor_Destroy(actor, globalCtx); newHead = Actor_RemoveFromCategory(globalCtx, actorCtx, actor); @@ -3487,7 +3487,7 @@ void func_800BB8EC(GameState* gameState, ActorContext* actorCtx, Actor** arg2, A */ void Enemy_StartFinishingBlow(GlobalContext* globalCtx, Actor* actor) { globalCtx->actorCtx.freezeFlashTimer = 5; - Audio_PlaySoundAtPosition(globalCtx, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE); } // blinking routine @@ -4717,7 +4717,7 @@ void Actor_SpawnIceEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos s16 yaw; s32 j; - Audio_PlaySoundAtPosition(globalCtx, &actor->world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &actor->world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < limbPosCount; i++) { yaw = Actor_YawToPoint(actor, limbPos); diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 44885d6c77..ddf21fe172 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1525,7 +1525,7 @@ void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Colli if (collider->actor == NULL) { play_sound(NA_SE_IT_SHIELD_BOUND); } else { - func_8019F1C0(&collider->actor->projectedPos, NA_SE_IT_SHIELD_BOUND); + Audio_PlaySfxAtPos(&collider->actor->projectedPos, NA_SE_IT_SHIELD_BOUND); } } else if (flags == TOUCH_SFX_NORMAL) { EffectSsHitMark_SpawnFixedScale(globalCtx, 3, hitPos); @@ -1539,14 +1539,14 @@ void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Colli if (collider->actor == NULL) { play_sound(NA_SE_IT_SHIELD_BOUND); } else { - func_8019F1C0(&collider->actor->projectedPos, NA_SE_IT_SHIELD_BOUND); + Audio_PlaySfxAtPos(&collider->actor->projectedPos, NA_SE_IT_SHIELD_BOUND); } } else if (flags == TOUCH_SFX_WOOD) { EffectSsHitMark_SpawnFixedScale(globalCtx, 1, hitPos); if (collider->actor == NULL) { play_sound(NA_SE_IT_REFLECTION_WOOD); } else { - func_8019F1C0(&collider->actor->projectedPos, NA_SE_IT_REFLECTION_WOOD); + Audio_PlaySfxAtPos(&collider->actor->projectedPos, NA_SE_IT_REFLECTION_WOOD); } } } @@ -1557,13 +1557,13 @@ void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Colli s32 CollisionCheck_SwordHitAudio(Collider* at, ColliderInfo* acInfo) { if (at->actor != NULL && at->actor->category == ACTORCAT_PLAYER) { if (acInfo->elemType == ELEMTYPE_UNK0) { - func_8019F1C0(&at->actor->projectedPos, NA_SE_IT_SWORD_STRIKE); + Audio_PlaySfxAtPos(&at->actor->projectedPos, NA_SE_IT_SWORD_STRIKE); } else if (acInfo->elemType == ELEMTYPE_UNK1) { - func_8019F1C0(&at->actor->projectedPos, NA_SE_IT_SWORD_STRIKE_HARD); + Audio_PlaySfxAtPos(&at->actor->projectedPos, NA_SE_IT_SWORD_STRIKE_HARD); } else if (acInfo->elemType == ELEMTYPE_UNK2) { - func_8019F1C0(&at->actor->projectedPos, 0); + Audio_PlaySfxAtPos(&at->actor->projectedPos, 0); } else if (acInfo->elemType == ELEMTYPE_UNK3) { - func_8019F1C0(&at->actor->projectedPos, 0); + Audio_PlaySfxAtPos(&at->actor->projectedPos, 0); } } return 1; @@ -1618,7 +1618,7 @@ void CollisionCheck_HitEffects(GlobalContext* globalCtx, Collider* at, ColliderI if (ac->actor == NULL) { play_sound(NA_SE_IT_SHIELD_BOUND); } else { - func_8019F1C0(&ac->actor->projectedPos, NA_SE_IT_SHIELD_BOUND); + Audio_PlaySfxAtPos(&ac->actor->projectedPos, NA_SE_IT_SHIELD_BOUND); } } } @@ -3905,7 +3905,7 @@ void CollisionCheck_SpawnShieldParticlesMetal(GlobalContext* globalCtx, Vec3f* v */ void CollisionCheck_SpawnShieldParticlesMetalSound(GlobalContext* globalCtx, Vec3f* v, Vec3f* pos) { CollisionCheck_SpawnShieldParticles(globalCtx, v); - func_8019F1C0(pos, NA_SE_IT_SHIELD_REFLECT_SW); + Audio_PlaySfxAtPos(pos, NA_SE_IT_SHIELD_REFLECT_SW); } /** @@ -3945,7 +3945,7 @@ void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, shieldParticleInitWood.lightPoint.z = shieldParticleInitWood.position.z; Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &shieldParticleInitWood); - func_8019F1C0(pos, NA_SE_IT_REFLECTION_WOOD); + Audio_PlaySfxAtPos(pos, NA_SE_IT_REFLECTION_WOOD); } /** diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index fddcf7f954..11545da016 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -58,11 +58,11 @@ EffectSs* EffectSS_GetTable() { void EffectSS_Delete(EffectSs* effectSs) { if (effectSs->flags & 2) { - func_801A72CC(&effectSs->pos); + Audio_StopSfxByPos(&effectSs->pos); } if (effectSs->flags & 4) { - func_801A72CC(&effectSs->vec); + Audio_StopSfxByPos(&effectSs->vec); } EffectSS_ResetEntry(effectSs); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index ec32550f87..2f0668c668 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -858,7 +858,7 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 param spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102); if (!Flags_GetCollectible(globalCtx, (param7F00 >> 8) & 0x7F)) { - Audio_PlaySoundAtPosition(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); } } else { spawnedActor = @@ -866,7 +866,7 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 param spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7); if (param20000 == 0) { if (!Flags_GetCollectible(globalCtx, (param7F00 >> 8) & 0x7F)) { - Audio_PlaySoundAtPosition(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); } } } @@ -924,7 +924,7 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s32 para spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7); } if (Flags_GetCollectible(globalCtx, (param7F00 >> 8) & 0x7F) == 0) { - Audio_PlaySoundAtPosition(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); } } else { params = func_800A7650(params & 0xFF); @@ -1080,7 +1080,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 if (gSaveContext.health <= 0x10) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 2); - Audio_PlaySoundAtPosition(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); return; } diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index 7c5de646a8..2cf05e02a0 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -131,7 +131,7 @@ void FireObj_UpdateStateTransitions(GlobalContext* globalCtx, FireObj* fire) { } } else if (player->unk_B28 == 0) { player->unk_B28 = 0xD2; - Audio_PlaySoundAtPosition(globalCtx, &fire->position, 20, NA_SE_EV_FLAME_IGNITION); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &fire->position, 20, NA_SE_EV_FLAME_IGNITION); } else if (player->unk_B28 < 0xC8) { player->unk_B28 = 0xC8; } diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 5bc49c8aca..84eb8c051c 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -647,8 +647,8 @@ void func_801000CC(u16 sfxId) { func_8019F128(sfxId); } -void func_801000F4(s32 a0, u16 sfxId) { - func_8019F1C0(a0, sfxId); +void Lib_PlaySfxAtPos(Vec3f* pos, u16 sfxId) { + Audio_PlaySfxAtPos(pos, sfxId); } void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 a, Vec3f* src, Vec3f* dst) { diff --git a/src/code/z_sound_source.c b/src/code/z_sound_source.c new file mode 100644 index 0000000000..ba7036a4ce --- /dev/null +++ b/src/code/z_sound_source.c @@ -0,0 +1,75 @@ +#include "global.h" + +void SoundSource_InitAll(GlobalContext* globalCtx) { + SoundSource* sources = &globalCtx->soundSources[0]; + s32 i; + + // clang-format off + for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { sources[i].countdown = 0; } + // clang-format on +} + +void SoundSource_UpdateAll(GlobalContext* globalCtx) { + SoundSource* source = &globalCtx->soundSources[0]; + s32 i; + + for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { + if (source->countdown != 0) { + if (DECR(source->countdown) == 0) { + Audio_StopSfxByPos(&source->projectedPos); + } else { + SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos); + if (source->playSfxEachFrame) { + Audio_PlaySfxAtPos(&source->projectedPos, source->sfxId); + } + } + } + + source++; + } +} + +void SoundSource_Add(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId, u32 playSfxEachFrame) { + s32 countdown; + SoundSource* source; + s32 smallestCountdown = 0xFFFF; + SoundSource* backupSource = NULL; + s32 i; + + source = &globalCtx->soundSources[0]; + for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { + if (source->countdown == 0) { + break; + } + + // Store the sound source with the smallest remaining countdown + countdown = source->countdown; + if (countdown < smallestCountdown) { + smallestCountdown = countdown; + backupSource = source; + } + source++; + } + + // If no sound source is available, replace the sound source with the smallest remaining countdown + if (i >= ARRAY_COUNT(globalCtx->soundSources)) { + source = backupSource; + Audio_StopSfxByPos(&source->projectedPos); + } + + source->worldPos = *worldPos; + source->countdown = duration; + source->playSfxEachFrame = playSfxEachFrame; + source->sfxId = sfxId; + + SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos); + Audio_PlaySfxAtPos(&source->projectedPos, sfxId); +} + +void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId) { + SoundSource_Add(globalCtx, worldPos, duration, sfxId, false); +} + +void SoundSource_PlaySfxEachFrameAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId) { + SoundSource_Add(globalCtx, worldPos, duration, sfxId, true); +} diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 6e4841bcef..1045976983 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -149,7 +149,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { } } this->timer = 0; - func_8019F1C0(&this->actor.projectedPos, NA_SE_IT_HOOKSHOT_STICK_CRE); + Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_HOOKSHOT_STICK_CRE); return; } @@ -265,10 +265,10 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { } } func_808C1154(this); - func_8019F1C0(&this->actor.projectedPos, NA_SE_IT_HOOKSHOT_STICK_OBJ); + Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_HOOKSHOT_STICK_OBJ); } else { CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &this->actor.world.pos); - func_8019F1C0(&this->actor.projectedPos, NA_SE_IT_HOOKSHOT_REFLECT); + Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_HOOKSHOT_REFLECT); } } else { if (CHECK_BTN_ANY(CONTROLLER1(globalCtx)->press.button, diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c index 389f80809a..e75367f602 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c @@ -78,7 +78,7 @@ void func_80B40160(BgGoronOyu* this, GlobalContext* globalCtx) { func_80B40080(this); } - func_8019F1C0(&D_80B40780, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); + Audio_PlaySfxAtPos(&D_80B40780, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); } void func_80B401F8(BgGoronOyu* this, GlobalContext* globalCtx) { 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 44f67c5bda..d497492f33 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c @@ -107,7 +107,7 @@ void BgIcicle_Break(BgIcicle* this, GlobalContext* globalCtx, f32 arg2) { s32 j; s32 i; - Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < 2; i++) { for (j = 0; j < 10; j++) { 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 2d404126de..f60141c5d8 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -1103,7 +1103,7 @@ void func_809DBFB4(Boss02* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_INBOSS_DAMAGE_OLD); this->unk_015C = 1; } else { - func_8019F1C0(&this->unk_167C, NA_SE_EN_INBOSS_DAMAGE_OLD); + Audio_PlaySfxAtPos(&this->unk_167C, NA_SE_EN_INBOSS_DAMAGE_OLD); this->unk_015C = 10; } 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 6e3fa14e3c..67ea1702e6 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -551,7 +551,7 @@ void func_809ED2A0(Boss04* this, GlobalContext* globalCtx) { if ((this->unk_1F8 == 2) || (this->unk_1F8 == 5)) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_EXPLOSION); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_BIG_BOMB_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_BIG_BOMB_EXPLOSION); } if (this->unk_1FA == 3) { diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index ef6f258a71..99a46c1e25 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -668,7 +668,7 @@ void func_80AA0B08(DmStk* this, GlobalContext* globalCtx) { switch (globalCtx->csCtx.frames) { case 64: - func_8019F1C0(&this->unk_310, NA_SE_EN_STAL06_SURPRISED); + Audio_PlaySfxAtPos(&this->unk_310, NA_SE_EN_STAL06_SURPRISED); break; case 327: @@ -688,11 +688,11 @@ void func_80AA0B08(DmStk* this, GlobalContext* globalCtx) { case 486: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); - func_8019F1C0(&this->unk_310, NA_SE_EN_STAL08_CRY_BIG); + Audio_PlaySfxAtPos(&this->unk_310, NA_SE_EN_STAL08_CRY_BIG); break; case 496: - func_8019F1C0(&this->unk_310, NA_SE_EN_STAL09_SCREAM); + Audio_PlaySfxAtPos(&this->unk_310, NA_SE_EN_STAL09_SCREAM); break; case 590: @@ -704,7 +704,7 @@ void func_80AA0B08(DmStk* this, GlobalContext* globalCtx) { break; case 594: - func_8019F1C0(&this->unk_310, NA_SE_EN_STAL24_SCREAM2); + Audio_PlaySfxAtPos(&this->unk_310, NA_SE_EN_STAL24_SCREAM2); break; } 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 9f55e3e0b0..d32947951c 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -388,7 +388,7 @@ void EnBigslime_Destroy(Actor* thisx, GlobalContext* globalCtx) { } Collider_DestroyCylinder(globalCtx, &this->gekkoCollider); - func_801A72CC(&this->gekkoProjectedPos); + Audio_StopSfxByPos(&this->gekkoProjectedPos); } void EnBigslime_DynamicVtxCopyState(EnBigslime* this) { @@ -894,7 +894,7 @@ void EnBigslime_SetTargetVtxFromPreFrozen(EnBigslime* this) { * Plays the standard Gekko sound effects without reverb */ void EnBigslime_GekkoSfxOutsideBigslime(EnBigslime* this, u16 sfxId) { - func_8019F1C0(&this->gekkoProjectedPos, sfxId); + Audio_PlaySfxAtPos(&this->gekkoProjectedPos, sfxId); } /** @@ -2436,7 +2436,7 @@ void EnBigslime_SetupFrogSpawn(EnBigslime* this, GlobalContext* globalCtx) { worldPos = &this->actor.world.pos; dustPos.z = (Math_CosS(yawReverse) * 20.0f) + this->actor.world.pos.z; - Audio_PlaySoundAtPosition(globalCtx, worldPos, 40, NA_SE_EN_NPC_APPEAR); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, worldPos, 40, NA_SE_EN_NPC_APPEAR); // dust cloud where the red frog appears func_800B0DE0(globalCtx, &dustPos, &gZeroVec3f, &gZeroVec3f, &dustPrimColor, &dustEnvColor, 500, 50); 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 084439a4b5..4664f2b9f8 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -421,7 +421,7 @@ void func_80BFEB64(EnBomjima* this, GlobalContext* globalCtx) { sp40.y = this->unk_2F0->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f); sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->unk_2F0->actor.world.pos.z; - Audio_PlaySoundAtPosition(globalCtx, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN); EffectSsHitMark_SpawnFixedScale(globalCtx, 0, &sp40); this->unk_2BC++; diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 30b749c0dc..e75bbade9a 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -548,7 +548,7 @@ void func_808BE4D4(EnDekunuts* this, GlobalContext* globalCtx) { sp40.y = this->actor.world.pos.y + 18.0f; sp40.z = this->actor.world.pos.z; EffectSsDeadDb_Spawn(globalCtx, &sp40, &gZeroVec3f, &gZeroVec3f, &D_808BEF90, &D_808BEF94, 200, 0, 13); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); sp40.y = this->actor.world.pos.y + 10.0f; EffectSsHahen_SpawnBurst(globalCtx, &sp40, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); 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 0bf4b18ede..e0eed3f3c0 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c @@ -117,7 +117,7 @@ void EnElfbub_Pop(EnElfbub* this, GlobalContext* globalCtx) { Rand_S16Offset(100, 50), 25, 0); } - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK); Actor_MarkForDeath(&this->actor); } } 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 dcb634f42f..ee36b9107a 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -912,7 +912,7 @@ void func_80B2A498(EnFish2* this, GlobalContext* globalCtx) { Vec3f sp6C; s32 i; - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); for (i = 0; i < 10; i++) { Math_Vec3f_Copy(&sp6C, &this->actor.world.pos); 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 a1fedd7a97..4de4d0955e 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -2196,7 +2196,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { D_8091726C = 0.5f; D_80917268 = Rand_ZeroFloat(1.9f); sFishMouthOffset.y = 500.0f; - func_8019F1C0(&D_8090D614, NA_SE_IT_SWORD_SWING_HARD); + Audio_PlaySfxAtPos(&D_8090D614, NA_SE_IT_SWORD_SWING_HARD); } } break; @@ -2275,8 +2275,8 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { D_809101D0 = 0.0; } else { Math_ApproachF(&D_809101C4, 0.0f, 1.0f, 0.05f); - func_8019F1C0(&D_8090D614, - NA_SE_EN_WIZ_UNARI - SFX_FLAG); // changed from NA_SE_EN_FANTOM_FLOAT in OoT + Audio_PlaySfxAtPos(&D_8090D614, + NA_SE_EN_WIZ_UNARI - SFX_FLAG); // changed from NA_SE_EN_FANTOM_FLOAT in OoT } } else { f32 sp7C = WATER_SURFACE_Y(globalCtx); @@ -2296,7 +2296,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { if ((sLurePos.y <= sp7C) && (sp7C < spE0) && (sp7C == WATER_SURFACE_Y(globalCtx))) { D_80917264 = 10; - func_8019F1C0(&D_8090D614, NA_SE_EV_BOMB_DROP_WATER); + Audio_PlaySfxAtPos(&D_8090D614, NA_SE_EV_BOMB_DROP_WATER); D_80917248.y = 0.0f; D_80917238.y *= 0.2f; @@ -2322,8 +2322,8 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { } } else { Math_ApproachZeroF(&D_809101C4, 1.0f, 0.05f); - func_8019F1C0(&D_8090D614, - NA_SE_EN_WIZ_UNARI - SFX_FLAG); // changed from NA_SE_EN_FANTOM_FLOAT in OoT + Audio_PlaySfxAtPos(&D_8090D614, + NA_SE_EN_WIZ_UNARI - SFX_FLAG); // changed from NA_SE_EN_FANTOM_FLOAT in OoT } } @@ -2460,7 +2460,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { sLureRot.x = 0.0f; if (CHECK_BTN_ALL(input->press.button, BTN_B)) { D_809101C0 += 6.0f; - func_8019F1C0(&D_8090D614, NA_SE_PL_WALK_SAND); + Audio_PlaySfxAtPos(&D_8090D614, NA_SE_PL_WALK_SAND); } } else { if (D_809101C0 > 150.0f) { @@ -5593,7 +5593,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sStreamSoundPos, &sStreamSoundProjectedPos, &sProjectedW); - func_8019F1C0(&sStreamSoundProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG); + Audio_PlaySfxAtPos(&sStreamSoundProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG); if (gSaveContext.language == 0) { // Added in MM gSaveContext.minigameScore = D_8090CCF8; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index d7ccc8b158..fe74226102 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -683,7 +683,7 @@ void func_808D1ED4(EnFloormas* this, GlobalContext* globalCtx) { sp34.y = this->actor.world.pos.y + 15.0f; sp34.z = this->actor.world.pos.z; func_800B3030(globalCtx, &sp34, &gZeroVec3f, &gZeroVec3f, 150, -10, 2); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); this->actionFunc = func_808D1F7C; } diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index dc8e0bfa5f..7fbf4213f6 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -965,7 +965,7 @@ void func_80941060(EnGoroiwa* this, GlobalContext* globalCtx) { } void func_80941274(EnGoroiwa* this, GlobalContext* globalCtx) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_SNOWBALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_SNOWBALL_BROKEN); } void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 627aec919c..66300dda5f 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -351,9 +351,9 @@ void func_808F374C(EnIn* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 8.0f)) { func_8019F88C(&this->actor.projectedPos, NA_SE_VO_IN_LASH_0, 2); if (Rand_ZeroOne() < 0.3f) { - func_8019F1C0(&this->actor.projectedPos, NA_SE_IT_INGO_HORSE_NEIGH); + Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_INGO_HORSE_NEIGH); } - func_8019F1C0(&this->actor.projectedPos, NA_SE_IT_LASH); + Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_LASH); } } if (this->skelAnime.animation == &D_060198A8 && Animation_OnFrame(&this->skelAnime, 20.0f)) { diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 37b6aace56..f6b2438d48 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -2371,7 +2371,7 @@ void func_80B47D30(Actor* thisx, GlobalContext* globalCtx) { thisx->gravity = 0.0f; thisx->velocity.y = acAttached->velocity.y * 0.5f; thisx->velocity.y = CLAMP(thisx->velocity.y, -30.0f, 30.0f); - Audio_PlaySoundAtPosition(globalCtx, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); func_80B47830(this); } diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index abc5474d84..f4bef28664 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -467,7 +467,7 @@ void func_8095E660(EnIshi* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { func_8095E934(this); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, D_8095F7AC[sp38]); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, D_8095F7AC[sp38]); if (ENISHI_GET_2(&this->actor)) { func_8095E204(this, globalCtx); } @@ -482,7 +482,7 @@ void func_8095E660(EnIshi* this, GlobalContext* globalCtx) { return; } func_8095DF90(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, D_8095F6D4[sp38], D_8095F6D0[sp38]); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, D_8095F6D4[sp38], D_8095F6D0[sp38]); D_8095F6D8[sp38](&this->actor, globalCtx); D_8095F6E0[sp38](this, globalCtx); Actor_MarkForDeath(&this->actor); @@ -585,7 +585,7 @@ void func_8095EBDC(EnIshi* this, GlobalContext* globalCtx) { D_8095F6D8[sp70](&this->actor, globalCtx); if (!(this->actor.bgCheckFlags & 0x20)) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, D_8095F6D4[sp70], D_8095F6D0[sp70]); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, D_8095F6D4[sp70], D_8095F6D0[sp70]); D_8095F6E0[sp70](this, globalCtx); } @@ -632,7 +632,7 @@ void func_8095EBDC(EnIshi* this, GlobalContext* globalCtx) { D_8095F690 >>= 2; D_8095F694 >>= 2; - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); this->actor.bgCheckFlags &= ~0x40; } @@ -660,7 +660,7 @@ void func_8095F0A4(EnIshi* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, D_8095F6D4[sp28], D_8095F6D0[sp28]); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, D_8095F6D4[sp28], D_8095F6D0[sp28]); D_8095F6D8[sp28](&this->actor, globalCtx); D_8095F6E0[sp28](this, globalCtx); this->actor.draw = NULL; 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 60857e8602..0ccec50154 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -1011,7 +1011,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, GlobalContext* globalCtx) { if (globalCtx->sceneNum == SCENE_8ITEMSHOP) { EffectSsGSplash_Spawn(globalCtx, &tempWorldPos, 0, 0, 0, randPlusMinusPoint5Scaled(100.0f) + 200.0f); - Audio_PlaySoundAtPosition(globalCtx, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER); } else { Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 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 7aae7b7dd7..86c9242989 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c @@ -593,7 +593,8 @@ void func_80AD8388(EnKame* this, GlobalContext* globalCtx) { if (this->unk_29E > 0) { this->unk_29E--; if (this->unk_29E == 0) { - func_800F0590(globalCtx, &this->actor.world.pos, 21, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + SoundSource_PlaySfxEachFrameAtFixedWorldPos(globalCtx, &this->actor.world.pos, 21, + NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } } else { this->actor.scale.x -= 0.001f; diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 8fd3a4075e..d32735035d 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -342,7 +342,7 @@ void func_80A5BDB0(EnKusa2* this, GlobalContext* globalCtx) { sp50.z = this->actor.world.pos.z; EffectSsGSplash_Spawn(globalCtx, &sp50, NULL, NULL, 0, 280); EffectSsGRipple_Spawn(globalCtx, &sp50, 300, 700, 0); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); } void func_80A5BF38(EnKusa2* this, s32 arg1) { @@ -375,7 +375,7 @@ s32 func_80A5BFD8(EnKusa2* this, GlobalContext* globalCtx) { func_80A5CF44(this); func_80A5BD14(this, globalCtx, (this->collider.info.acHitInfo->toucher.dmgFlags & 0x1000000) ? 1 : 0); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); func_80A5BD94(this); Actor_MarkForDeath(&this->actor); return true; @@ -959,7 +959,7 @@ void func_80A5D7C4(EnKusa2* this, GlobalContext* globalCtx) { s16 sp2A; if (Actor_HasParent(&this->actor, globalCtx)) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.shape.shadowAlpha = 60; this->actor.room = -1; @@ -1200,7 +1200,7 @@ void func_80A5E210(EnKusa2* this, GlobalContext* globalCtx) { this->actor.speedXZ *= 0.4f; if (this->actor.bgCheckFlags & 2) { func_80A5D178(this); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_KUSAMUSHI_HIDE); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_KUSAMUSHI_HIDE); } } 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 9892af79b7..eecc287908 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -288,7 +288,7 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, GlobalContext* globalCtx) { default: func_801477B4(globalCtx); EnMinifrog_SetCamera(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_NPC_FADEAWAY); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_NPC_FADEAWAY); if (this->actor.cutscene != -1) { if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { ActorCutscene_Stop(this->actor.cutscene); diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 1af1ec8b8a..c99daf298b 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -121,9 +121,9 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) { spawnBurstPos.z = this->actor.world.pos.z; EffectSsHahen_SpawnBurst(globalCtx, &spawnBurstPos, 6.0f, 0, 7, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); if (this->actor.params == 1) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_NUTS_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_NUTS_BROKEN); } else { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); } Actor_MarkForDeath(&this->actor); } 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 c85f1ac495..22f9693796 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -964,7 +964,7 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, GlobalContext* globalCtx) { vec1.z = (Math_CosS(yaw) * 20.0f) + this->actor.world.pos.z; this->collider.base.ocFlags1 &= ~OC1_ON; func_800B0DE0(globalCtx, &vec1, &gZeroVec3f, &gZeroVec3f, &primColor, &envColor, 800, 50); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_NPC_APPEAR); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_NPC_APPEAR); Flags_SetClearTemp(globalCtx, globalCtx->roomCtx.currRoom.num); for (i = 0; i < 25; i++) { 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 11a15bdc2b..c47f67c278 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -434,9 +434,9 @@ void func_80897A94(EnPeehat* this, GlobalContext* globalCtx) { func_808982E0(this); } else if ((this->colliderCylinder.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & 1)) { func_800B3030(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 40, 7, 0); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); if (!(this->actor.bgCheckFlags & 1)) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_PIHAT_SM_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_PIHAT_SM_DEAD); } Actor_MarkForDeath(&this->actor); } else if (this->colliderTris.base.atFlags & AT_HIT) { @@ -586,8 +586,8 @@ void func_80898338(EnPeehat* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f)) { if (this->actor.params != 0) { func_800B3030(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 40, 7, 0); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_EXTINCT); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_PIHAT_SM_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_PIHAT_SM_DEAD); Actor_MarkForDeath(&this->actor); } else { func_80897864(this); diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index d287414b38..8f15008106 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -355,7 +355,7 @@ void func_80B7114C(EnRailSkb* this, GlobalContext* globalCtx) { this->unk_402 |= 1; func_80B712FC(this); } else { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80B71488(this); } } else if (this->unk_3F0 == 1) { @@ -379,7 +379,7 @@ void func_80B7123C(EnRailSkb* this, GlobalContext* globalCtx) { this->unk_402 |= 1; func_80B712FC(this); } else { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80B71488(this); } } @@ -881,7 +881,7 @@ void func_80B726B4(EnRailSkb* this, GlobalContext* globalCtx) { end = ARRAY_COUNT(this->unk_234); } - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < end; i++) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_234[i]); @@ -967,7 +967,7 @@ void func_80B72970(EnRailSkb* this, GlobalContext* globalCtx) { if ((Actor_ApplyDamage(&this->actor) == 0) && (this->actor.colChkInfo.damageEffect != 3) && (this->actor.colChkInfo.damageEffect != 4)) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80B71488(this); return; } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index c52c7c1786..f1c6e9a168 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -721,7 +721,7 @@ void func_808FB42C(EnRr* this, GlobalContext* globalCtx) { sp74.y = this->actor.world.pos.y + 20.0f; sp74.z = this->actor.world.pos.z; func_800B3030(globalCtx, &sp74, &gZeroVec3f, &gZeroVec3f, 100, 0, 0); - Audio_PlaySoundAtPosition(globalCtx, &sp74, 11, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &sp74, 11, NA_SE_EN_EXTINCT); } else { temp_f20 = this->actor.scale.y * 66.66667f; 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 cebb90123d..414e1123b4 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -613,7 +613,7 @@ void EnRuppecrow_FallToDespawn(EnRuppecrow* this, GlobalContext* globalCtx) { func_800B3030(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, (this->actor.scale.x * 10000.0f), 0x0, 0x0); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 0xB, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 0xB, NA_SE_EN_EXTINCT); Actor_MarkForDeath(&this->actor); return; } 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 78f36abfd6..59417e2b23 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -343,7 +343,7 @@ void EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { } this->isDead = true; Enemy_StartFinishingBlow(globalCtx, &this->actor); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 0x28, NA_SE_EN_BEE_FLY); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 0x28, NA_SE_EN_BEE_FLY); return; } hitPoint.x = this->collider.info.bumper.hitPos.x; 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 333717941c..32802fb01e 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -734,7 +734,7 @@ void func_809961E4(EnSkb* this, GlobalContext* globalCtx) { } this->unk_3E4 = 0; this->actor.flags &= ~1; - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); this->unk_3DE = 7; this->actionFunc = func_80996284; } @@ -1011,7 +1011,7 @@ void func_80996BEC(EnSkb* this, GlobalContext* globalCtx) { end = 14; } - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < end; i++) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_234[i]); diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 4d6520bb3a..e3116fb3c2 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -611,7 +611,7 @@ s32 func_808A6580(EnSt* this, GlobalContext* globalCtx) { if (ENST_GET_3F(&this->actor) != ENST_3F_63) { Flags_SetSwitch(globalCtx, ENST_GET_3F(&this->actor)); } - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); Enemy_StartFinishingBlow(globalCtx, &this->actor); this->actor.flags &= ~1; 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 55fae4cadd..dc10640406 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -1191,7 +1191,7 @@ void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 30, NA_SE_IT_BOMB_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_IT_BOMB_EXPLOSION); Actor_MarkForDeath(&this->actor); return; } 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 d7d547afd4..a851f2ee9b 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -686,7 +686,7 @@ s32 func_808DA08C(EnSw* this, GlobalContext* globalCtx) { this->unk_45C = 0; } else if (!func_808D90C4(this)) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); Enemy_StartFinishingBlow(globalCtx, &this->actor); this->actor.flags &= ~1; if (!ENSW_GET_3(&this->actor)) { 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 b28c8b1cca..cee811bdf9 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -661,7 +661,7 @@ void func_80C11DF0(EnThiefbird* this, GlobalContext* globalCtx) { func_800B3030(globalCtx, &this->unk_350[i], &gZeroVec3f, &gZeroVec3f, 0x8C, 0, 0); } - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_HUGE); for (i = 0; i < ARRAY_COUNT(D_80C13664); i++) { 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 041a688184..5afdd500f6 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -644,7 +644,7 @@ void func_80895020(EnTite* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->collider.base.acFlags &= ~AC_ON; this->actor.colorFilterTimer = 0; - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_TEKU_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_TEKU_DEAD); this->actor.flags &= ~1; this->actor.flags |= 0x10; this->unk_2BA = 1; @@ -678,7 +678,7 @@ void func_808951B8(EnTite* this, GlobalContext* globalCtx) { if (this->unk_2BC == 0) { for (i = 0; i < ARRAY_COUNT(this->unk_2D0); i++) { func_800B3030(globalCtx, &this->unk_2D0[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 1); - Audio_PlaySoundAtPosition(globalCtx, &this->unk_2D0[i], 11, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->unk_2D0[i], 11, NA_SE_EN_EXTINCT); } Actor_MarkForDeath(&this->actor); } else { diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index b09eb87ae7..05f4e76d73 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -175,7 +175,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 15.0f)) { EnTuboTrap_SpawnEffectsInWater(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); EnTuboTrap_DropCollectible(this, globalCtx); Actor_MarkForDeath(&this->actor); return; @@ -184,8 +184,8 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~AT_BOUNCED; EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); EnTuboTrap_DropCollectible(this, globalCtx); Actor_MarkForDeath(&this->actor); return; @@ -194,8 +194,8 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); EnTuboTrap_DropCollectible(this, globalCtx); Actor_MarkForDeath(&this->actor); return; @@ -206,8 +206,8 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { if (&player->actor == this->collider.base.at) { EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); - Audio_PlaySoundAtPosition(globalCtx, &player2->actor.world.pos, 40, NA_SE_PL_BODY_HIT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &player2->actor.world.pos, 40, NA_SE_PL_BODY_HIT); EnTuboTrap_DropCollectible(this, globalCtx); Actor_MarkForDeath(&this->actor); return; @@ -216,7 +216,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1)) { EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); EnTuboTrap_DropCollectible(this, globalCtx); Actor_MarkForDeath(&this->actor); } 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 843294728c..5e45f8c033 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 @@ -198,11 +198,11 @@ void EnWaterEffect_Update(Actor* thisx, GlobalContext* globalCtx2) { if (phi_v0) { ptr->unk_00 = 0; - Audio_PlaySoundAtPosition(globalCtx, &ptr->unk_04, 30, NA_SE_EV_BOMB_DROP_WATER); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &ptr->unk_04, 30, NA_SE_EV_BOMB_DROP_WATER); } else { ptr->unk_04.y = this->actor.floorHeight; if (ptr->unk_2A == 0) { - Audio_PlaySoundAtPosition(globalCtx, &ptr->unk_04, 30, NA_SE_EV_WATERDROP_GRD); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &ptr->unk_04, 30, NA_SE_EV_WATERDROP_GRD); ptr->unk_00 = 3; ptr->unk_2C.x = 0.1f; ptr->unk_2C.y = 0.6f; @@ -215,7 +215,7 @@ void EnWaterEffect_Update(Actor* thisx, GlobalContext* globalCtx2) { EffectSsGSplash_Spawn(globalCtx, &sp98, NULL, NULL, 1, 100); } else { ptr->unk_00 = 0; - Audio_PlaySoundAtPosition(globalCtx, &ptr->unk_04, 30, NA_SE_EV_WATERDROP); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &ptr->unk_04, 30, NA_SE_EV_WATERDROP); EffectSsGRipple_Spawn(globalCtx, &ptr->unk_04, 70, 500, 0); EffectSsGRipple_Spawn(globalCtx, &ptr->unk_04, 70, 500, 10); Math_Vec3f_Copy(&sp98, &ptr->unk_04); @@ -493,7 +493,7 @@ void func_80A59C04(Actor* thisx, GlobalContext* globalCtx2) { for (j = 0; j < 5; j++) { func_80A599E8(this, &ptr->unk_04, 2); } - Audio_PlaySoundAtPosition(globalCtx, &ptr->unk_04, 30, NA_SE_EV_PLANT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &ptr->unk_04, 30, NA_SE_EV_PLANT_BROKEN); } ptr->unk_2A++; } 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 e1786b78cf..a453e23e77 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -1201,7 +1201,8 @@ void func_80992E0C(EnWf* this, GlobalContext* globalCtx) { Vec3f sp60; if (this->unk_2A0 == 25) { - func_800F0590(globalCtx, &this->actor.world.pos, 36, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + SoundSource_PlaySfxEachFrameAtFixedWorldPos(globalCtx, &this->actor.world.pos, 36, + NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } this->unk_2A0--; 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 4dd2db5a57..0bdbf86794 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 @@ -262,7 +262,7 @@ void func_80A49A44(EnWizFire* this, GlobalContext* globalCtx) { if (this->collider.info.acHitInfo->toucher.dmgFlags == 0x1000) { this->unk_168 = 0; this->unk_148 = 1; - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); } } @@ -317,7 +317,7 @@ void func_80A49FD8(EnWizFire* this, GlobalContext* globalCtx) { if (this->collider.info.acHitInfo->toucher.dmgFlags == 0x1000) { this->unk_168 = 0; this->unk_148 = 1; - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); } } } @@ -382,7 +382,7 @@ void func_80A4A11C(EnWizFire* this, GlobalContext* globalCtx) { D_80A4C1C0 = 1; this->unk_148 = 1; this->unk_16A = 0; - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); } } this->actor.world.pos.y = this->actor.floorHeight + 10.0f; diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 385ca2cc2a..8e168cba89 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -184,7 +184,7 @@ void func_80ACBC8C(ObjAqua* this, GlobalContext* globalCtx) { func_80ACBD34(this); } else { func_80ACB6A0(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 0x28, NA_SE_EV_BOMB_DROP_WATER); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 0x28, NA_SE_EV_BOMB_DROP_WATER); Actor_MarkForDeath(&this->actor); } } else if (this->counter <= 0) { diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index bd91aaaf08..e72dfb836e 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -200,11 +200,11 @@ void func_80A1B914(ObjFlowerpot* this, GlobalContext* globalCtx) { } void func_80A1B994(ObjFlowerpot* this, GlobalContext* globalCtx) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); } void func_80A1B9CC(ObjFlowerpot* this, GlobalContext* globalCtx) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); } void func_80A1BA04(ObjFlowerpot* this, Vec3f* arg1) { @@ -620,7 +620,7 @@ void func_80A1CEF4(ObjFlowerpot* this2, GlobalContext* globalCtx) { } func_80A1BD80(this, globalCtx); func_80A1B994(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index 49a5a7dbe8..060a4e0c03 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -140,9 +140,9 @@ void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx) { func_80B3C2C4(this, globalCtx); gSaveContext.weekEventReg[20] |= 0x20; func_80B3C260(this); - func_8019F1C0(&D_80B3C960, NA_SE_EV_BLOCK_BOUND); + Audio_PlaySfxAtPos(&D_80B3C960, NA_SE_EV_BLOCK_BOUND); } else { - func_8019F1C0(&D_80B3C960, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); + Audio_PlaySfxAtPos(&D_80B3C960, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index 2c204e7baa..b4004c1809 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -410,9 +410,9 @@ void func_80A54CEC(ObjHugebombiwa* this, GlobalContext* globalCtx) { } if (!(ENHUGEBOMBIWA_GET_100(&this->actor))) { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); } else { - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 80, NA_SE_EV_SNOWBALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EV_SNOWBALL_BROKEN); } if (!(ENHUGEBOMBIWA_GET_100(&this->actor))) { diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 8558127c8a..34d45038ae 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -282,13 +282,13 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 19.0f)) { ObjKibako_WaterBreak(this, globalCtx); ObjKibako_SpawnCollectible(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); Actor_MarkForDeath(&this->actor); } else if (this->collider.base.acFlags & AC_HIT) { ObjKibako_AirBreak(this, globalCtx); ObjKibako_SpawnCollectible(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); Actor_MarkForDeath(&this->actor); } else { Actor_MoveWithGravity(&this->actor); @@ -387,14 +387,14 @@ void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 0xB) || (atHit) || (this->timer <= 0)) { ObjKibako_AirBreak(this, globalCtx); ObjKibako_SpawnCollectible(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); Actor_MarkForDeath(&this->actor); } else { if (this->actor.bgCheckFlags & 0x40) { ObjKibako_WaterBreak(this, globalCtx); ObjKibako_SpawnCollectible(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); Actor_MarkForDeath(&this->actor); } else { if (this->actor.velocity.y < -0.05f) { diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 478dd0cf70..dd8029eca3 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -209,7 +209,7 @@ s32 ObjKibako2_ShouldBreak(ObjKibako2* this) { void ObjKibako2_Idle(ObjKibako2* this, GlobalContext* globalCtx) { if (ObjKibako2_ShouldBreak(this)) { ObjKibako2_Break(this, globalCtx); - Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); this->dyna.actor.flags |= 0x10; func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 5454c9be32..d1fb1b23ec 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -209,7 +209,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { if (interaction <= OBJ_SYOKUDAI_INTERACTION_STICK) { if (player->unk_B28 == 0) { player->unk_B28 = 0xD2; - func_8019F1C0(&thisx->projectedPos, NA_SE_EV_FLAME_IGNITION); + Audio_PlaySfxAtPos(&thisx->projectedPos, NA_SE_EV_FLAME_IGNITION); } else if (player->unk_B28 < 0xC8) { player->unk_B28 = 0xC8; } diff --git a/tools/actorfixer.py b/tools/actorfixer.py index 28b982bc5e..fc26e60e00 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -79,12 +79,15 @@ animdict = { "func_800B8214": "Actor_GetWorld", "func_800B8248": "Actor_GetWorldPosShapeRot", "func_800BE22C": "Actor_ApplyDamage", - "func_800F0568": "Audio_PlaySoundAtPosition", + "Audio_PlaySoundAtPosition": "SoundSource_PlaySfxAtFixedWorldPos", + "func_800F0590": "SoundSource_PlaySfxEachFrameAtFixedWorldPos", "func_8016970C": "Play_CameraSetAtEye", "func_800BBA88": "Enemy_StartFinishingBlow", "ShrinkWindow_Step": "ShrinkWindow_Update", "ShrinkWindow_Fini": "ShrinkWindow_Destroy", "func_801A89A8": "Audio_QueueSeqCmd", + "func_8019F1C0": "Audio_PlaySfxAtPos", + "func_801A72CC": "Audio_StopSfxByPos", "SkelAnime_LodDrawLimb(": "SkelAnime_DrawLimbLod(", "SkelAnime_LodDraw(": "SkelAnime_DrawLod(", "SkelAnime_LodDrawLimbSV(": "SkelAnime_DrawFlexLimbLod(", diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 04e4a5f39a..175365f8e8 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -378,7 +378,7 @@ 0x800EA060 : "z_demo", 0x800EE320 : "z_draw", 0x800EFE60 : "z_eff_footmark", - 0x800F0390 : "code_800F0390", + 0x800F0390 : "z_sound_source", 0x800F05C0 : "z_elf_message", 0x800F07C0 : "z_en_hy", 0x800F1250 : "z_face_reaction", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index ee8d115bb6..7466934fb9 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1610,11 +1610,11 @@ 0x800EFF04:("EffFootmark_Add",), 0x800F00BC:("EffFootmark_Update",), 0x800F01C8:("EffFootmark_Draw",), - 0x800F0390:("func_800F0390",), - 0x800F03C0:("func_800F03C0",), - 0x800F048C:("func_800F048C",), - 0x800F0568:("Audio_PlaySoundAtPosition",), - 0x800F0590:("func_800F0590",), + 0x800F0390:("SoundSource_InitAll",), + 0x800F03C0:("SoundSource_UpdateAll",), + 0x800F048C:("SoundSource_Add",), + 0x800F0568:("SoundSource_PlaySfxAtFixedWorldPos",), + 0x800F0590:("SoundSource_PlaySfxEachFrameAtFixedWorldPos",), 0x800F05C0:("ElfMessage_GetFirstCycleHint",), 0x800F07C0:("EnHy_ChangeAnim",), 0x800F0888:("EnHy_FindNearestDoor",), @@ -1847,7 +1847,7 @@ 0x8010007C:("Color_RGBA8_Copy",), 0x801000A4:("func_801000A4",), 0x801000CC:("func_801000CC",), - 0x801000F4:("func_801000F4",), + 0x801000F4:("Lib_PlaySfxAtPos",), 0x8010011C:("Lib_Vec3f_TranslateAndRotateY",), 0x801001B8:("Lib_LerpRGB",), 0x80100448:("Math_Vec3f_StepTo",), @@ -3870,7 +3870,7 @@ 0x8019F0C8:("play_sound",), 0x8019F128:("func_8019F128",), 0x8019F170:("func_8019F170",), - 0x8019F1C0:("func_8019F1C0",), + 0x8019F1C0:("Audio_PlaySfxAtPos",), 0x8019F208:("func_8019F208",), 0x8019F230:("func_8019F230",), 0x8019F258:("func_8019F258",), @@ -4042,7 +4042,7 @@ 0x801A7084:("func_801A7084",), 0x801A7168:("func_801A7168",), 0x801A7284:("func_801A7284",), - 0x801A72CC:("func_801A72CC",), + 0x801A72CC:("Audio_StopSfxByPos",), 0x801A7328:("func_801A7328",), 0x801A7484:("func_801A7484",), 0x801A75E8:("func_801A75E8",), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index bfc0f86b8d..ea6a1c6b87 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1124,11 +1124,11 @@ asm/non_matchings/code/z_eff_footmark/EffFootmark_Init.s,EffFootmark_Init,0x800E asm/non_matchings/code/z_eff_footmark/EffFootmark_Add.s,EffFootmark_Add,0x800EFF04,0x6E asm/non_matchings/code/z_eff_footmark/EffFootmark_Update.s,EffFootmark_Update,0x800F00BC,0x43 asm/non_matchings/code/z_eff_footmark/EffFootmark_Draw.s,EffFootmark_Draw,0x800F01C8,0x72 -asm/non_matchings/code/code_800F0390/func_800F0390.s,func_800F0390,0x800F0390,0xC -asm/non_matchings/code/code_800F0390/func_800F03C0.s,func_800F03C0,0x800F03C0,0x33 -asm/non_matchings/code/code_800F0390/func_800F048C.s,func_800F048C,0x800F048C,0x37 -asm/non_matchings/code/code_800F0390/Audio_PlaySoundAtPosition.s,Audio_PlaySoundAtPosition,0x800F0568,0xA -asm/non_matchings/code/code_800F0390/func_800F0590.s,func_800F0590,0x800F0590,0xC +asm/non_matchings/code/z_sound_source/SoundSource_InitAll.s,SoundSource_InitAll,0x800F0390,0xC +asm/non_matchings/code/z_sound_source/SoundSource_UpdateAll.s,SoundSource_UpdateAll,0x800F03C0,0x33 +asm/non_matchings/code/z_sound_source/SoundSource_Add.s,SoundSource_Add,0x800F048C,0x37 +asm/non_matchings/code/z_sound_source/SoundSource_PlaySfxAtFixedWorldPos.s,SoundSource_PlaySfxAtFixedWorldPos,0x800F0568,0xA +asm/non_matchings/code/z_sound_source/SoundSource_PlaySfxEachFrameAtFixedWorldPos.s,SoundSource_PlaySfxEachFrameAtFixedWorldPos,0x800F0590,0xC asm/non_matchings/code/z_elf_message/func_800F05C0.s,func_800F05C0,0x800F05C0,0x80 asm/non_matchings/code/code_800F07C0/func_800F07C0.s,func_800F07C0,0x800F07C0,0x32 asm/non_matchings/code/code_800F07C0/func_800F0888.s,func_800F0888,0x800F0888,0x2F @@ -1361,7 +1361,7 @@ asm/non_matchings/code/z_lib/Math_ApproachS.s,Math_ApproachS,0x800FFFD8,0x29 asm/non_matchings/code/z_lib/Color_RGBA8_Copy.s,Color_RGBA8_Copy,0x8010007C,0xA asm/non_matchings/code/z_lib/func_801000A4.s,func_801000A4,0x801000A4,0xA asm/non_matchings/code/z_lib/func_801000CC.s,func_801000CC,0x801000CC,0xA -asm/non_matchings/code/z_lib/func_801000F4.s,func_801000F4,0x801000F4,0xA +asm/non_matchings/code/z_lib/Lib_PlaySfxAtPos.s,Lib_PlaySfxAtPos,0x801000F4,0xA asm/non_matchings/code/z_lib/Lib_Vec3f_TranslateAndRotateY.s,Lib_Vec3f_TranslateAndRotateY,0x8010011C,0x27 asm/non_matchings/code/z_lib/Lib_LerpRGB.s,Lib_LerpRGB,0x801001B8,0xA4 asm/non_matchings/code/z_lib/Math_Vec3f_StepTo.s,Math_Vec3f_StepTo,0x80100448,0x2D @@ -3388,7 +3388,7 @@ asm/non_matchings/code/code_8019AF00/func_8019F05C.s,func_8019F05C,0x8019F05C,0x asm/non_matchings/code/code_8019AF00/play_sound.s,play_sound,0x8019F0C8,0x18 asm/non_matchings/code/code_8019AF00/func_8019F128.s,func_8019F128,0x8019F128,0x12 asm/non_matchings/code/code_8019AF00/func_8019F170.s,func_8019F170,0x8019F170,0x14 -asm/non_matchings/code/code_8019AF00/func_8019F1C0.s,func_8019F1C0,0x8019F1C0,0x12 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfxAtPos.s,Audio_PlaySfxAtPos,0x8019F1C0,0x12 asm/non_matchings/code/code_8019AF00/func_8019F208.s,func_8019F208,0x8019F208,0xA asm/non_matchings/code/code_8019AF00/func_8019F230.s,func_8019F230,0x8019F230,0xA asm/non_matchings/code/code_8019AF00/func_8019F258.s,func_8019F258,0x8019F258,0x2A @@ -3560,7 +3560,7 @@ asm/non_matchings/code/code_801A5BD0/func_801A6D0C.s,func_801A6D0C,0x801A6D0C,0x asm/non_matchings/code/code_801A5BD0/func_801A7084.s,func_801A7084,0x801A7084,0x39 asm/non_matchings/code/code_801A5BD0/func_801A7168.s,func_801A7168,0x801A7168,0x47 asm/non_matchings/code/code_801A5BD0/func_801A7284.s,func_801A7284,0x801A7284,0x12 -asm/non_matchings/code/code_801A5BD0/func_801A72CC.s,func_801A72CC,0x801A72CC,0x17 +asm/non_matchings/code/code_801A5BD0/Audio_StopSfxByPos.s,Audio_StopSfxByPos,0x801A72CC,0x17 asm/non_matchings/code/code_801A5BD0/func_801A7328.s,func_801A7328,0x801A7328,0x57 asm/non_matchings/code/code_801A5BD0/func_801A7484.s,func_801A7484,0x801A7484,0x59 asm/non_matchings/code/code_801A5BD0/func_801A75E8.s,func_801A75E8,0x801A75E8,0x4E