mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Merge branch 'master' into parameter
This commit is contained in:
+10
-11
@@ -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);
|
||||
|
||||
+5
-3
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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")
|
||||
+7
-7
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -859,7 +859,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 =
|
||||
@@ -867,7 +867,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -925,7 +925,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);
|
||||
@@ -1081,7 +1081,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
|
||||
if (gSaveContext.save.playerData.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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user