1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-10 01:44:36 +00:00

Match func_800EEA50 + some surrounding doc (#916)

* Match func_800EEA50

* Document some audio debug stuff

* more doc

* more doc

* formatting

* Fix enums, and some more bits of doc

* review

* LIM -> MAX

* missed review suggestion...

* more review

* ganon comments

* more review

* 🐍☠️

* more review

* Update functions.h

* quotes

* review

Co-authored-by: zelda2774 <zelda2774@invalid>
This commit is contained in:
zelda2774 2021-08-30 02:08:41 +02:00 committed by GitHub
parent 28e72bb486
commit a75c70358c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 1562 additions and 5496 deletions

View file

@ -6,10 +6,10 @@ typedef struct {
/* 0x00 */ u16 sfxId;
/* 0x04 */ Vec3f* pos;
/* 0x08 */ u8 unk_8;
/* 0x0C */ f32* unk_C;
/* 0x0C */ f32* freqScale;
/* 0x10 */ f32* unk_10;
/* 0x14 */ s8* unk_14;
} Struct_800F738C; // size = 0x18
/* 0x14 */ s8* reverbAdd;
} SoundRequest; // size = 0x18
typedef struct {
/* 0x00 */ f32 unk_0;
@ -18,7 +18,8 @@ typedef struct {
/* 0x0C */ u16 unk_C;
} Struct_800F8EA0; // size = 0x10
// rodata for func_800F7680 (this file)
// rodata for Audio_ProcessSoundRequest (this file)
// (probably moved to .data due to -use_readwrite_const)
char D_80133340[] = "SE";
// rodata for func_800F7CEC (this file)
@ -32,9 +33,10 @@ char D_80133390[] = "SEQ H";
char D_80133398[] = " L";
// data
u8 D_801333A0 = 0;
u8 D_801333A4 = 0;
// sSoundRequests ring buffer endpoints. read index <= write index, wrapping around mod 256.
u8 sSoundRequestWriteIndex = 0;
u8 sSoundRequestReadIndex = 0;
/**
* Array of pointers to arrays of SoundBankEntry of sizes: 9, 12, 22, 20, 8, 3, 5
@ -60,36 +62,36 @@ u8 D_801333CC = 0;
u16 D_801333D0 = 0;
Vec3f D_801333D4 = { 0.0f, 0.0f, 0.0f };
Vec3f D_801333D4 = { 0.0f, 0.0f, 0.0f }; // default pos
f32 D_801333E0 = 1.0f;
f32 D_801333E0 = 1.0f; // default freqScale
UNK_TYPE D_801333E4 = 0;
s32 D_801333E4 = 0; // unused
s8 D_801333E8 = 0;
s8 D_801333E8 = 0; // default reverbAdd
UNK_TYPE D_801333EC = 0;
s32 D_801333EC = 0; // unused
u8 D_801333F0 = 0;
u8 D_801333F4 = 0;
u8 gAudioSEFlagSwapOff = 0;
u8 D_801333F8 = 0;
extern Struct_800F738C D_8016C9A0[];
extern Struct_800F8EA0 D_8016E270[];
extern SoundRequest sSoundRequests[0x100];
extern Struct_800F8EA0 D_8016E270[7];
extern Struct_8013331C* D_8013331C[9];
void func_800F7260(u16 arg0) {
void Audio_SetSoundBanksMute(u16 muteMask) {
u8 bankId;
for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) {
if (arg0 & 1) {
D_8016E264[bankId] = 1;
if (muteMask & 1) {
gSoundBankMuted[bankId] = true;
} else {
D_8016E264[bankId] = 0;
gSoundBankMuted[bankId] = false;
}
arg0 = (arg0 >> 1) & 0xFFFF;
muteMask = muteMask >> 1;
}
}
@ -107,98 +109,96 @@ void Audio_ClearBGMMute(u8 arg0) {
}
}
// a3 = freq scale factor for ocarina
// a5 = reverb add
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* a1, u8 a2, f32* a3, f32* a4, s8* a5) {
// a4 is often the same as freqScale. (u8)(*a4 * 127.0f) is sent to script on IO port 2
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* pos, u8 a2, f32* freqScale, f32* a4, s8* reverbAdd) {
u8 i;
Struct_800F738C* phi_v0;
SoundRequest* req;
if (D_8016E264[SFX_BANK_SHIFT(sfxId)] == 0) {
phi_v0 = &D_8016C9A0[D_801333A0];
if (D_801333F4 == 0) {
if (!gSoundBankMuted[SFX_BANK_SHIFT(sfxId)]) {
req = &sSoundRequests[sSoundRequestWriteIndex];
if (!gAudioSEFlagSwapOff) {
for (i = 0; i < 10; i++) {
if (sfxId == D_8016E2E0[i]) {
if (D_8016E310[i] == 0) {
sfxId = D_8016E2F8[i];
} else {
phi_v0->sfxId = D_8016E2F8[i];
phi_v0->pos = a1;
phi_v0->unk_8 = a2;
phi_v0->unk_C = a3;
phi_v0->unk_10 = a4;
phi_v0->unk_14 = a5;
D_801333A0++;
phi_v0 = &D_8016C9A0[D_801333A0];
if (sfxId == gAudioSEFlagSwapSource[i]) {
if (gAudioSEFlagSwapMode[i] == 0) { // "SWAP"
sfxId = gAudioSEFlagSwapTarget[i];
} else { // "ADD"
req->sfxId = gAudioSEFlagSwapTarget[i];
req->pos = pos;
req->unk_8 = a2;
req->freqScale = freqScale;
req->unk_10 = a4;
req->reverbAdd = reverbAdd;
sSoundRequestWriteIndex++;
req = &sSoundRequests[sSoundRequestWriteIndex];
}
i = 10;
i = 10; // "break;"
}
}
}
phi_v0->sfxId = sfxId;
phi_v0->pos = a1;
phi_v0->unk_8 = a2;
phi_v0->unk_C = a3;
phi_v0->unk_10 = a4;
phi_v0->unk_14 = a5;
D_801333A0++;
req->sfxId = sfxId;
req->pos = pos;
req->unk_8 = a2;
req->freqScale = freqScale;
req->unk_10 = a4;
req->reverbAdd = reverbAdd;
sSoundRequestWriteIndex++;
}
}
void func_800F74E0(u8 arg0, SoundBankEntry* arg1) {
Struct_800F738C* entry;
s32 phi_a0;
u8 i = D_801333A4;
void Audio_RemoveMatchingSoundRequests(u8 aspect, SoundBankEntry* cmp) {
SoundRequest* req;
s32 remove;
u8 i = sSoundRequestReadIndex;
for (i; i != D_801333A0; i++) {
phi_a0 = false;
entry = &D_8016C9A0[i];
switch (arg0) {
for (; i != sSoundRequestWriteIndex; i++) {
remove = false;
req = &sSoundRequests[i];
switch (aspect) {
case 0:
if (SFX_BANK_MASK(entry->sfxId) == SFX_BANK_MASK(arg1->unk_28)) {
phi_a0 = true;
if (SFX_BANK_MASK(req->sfxId) == SFX_BANK_MASK(cmp->unk_28)) {
remove = true;
}
break;
case 1:
if (SFX_BANK_MASK(entry->sfxId) == SFX_BANK_MASK(arg1->unk_28) && (&entry->pos->x == arg1->posX)) {
phi_a0 = true;
if (SFX_BANK_MASK(req->sfxId) == SFX_BANK_MASK(cmp->unk_28) && (&req->pos->x == cmp->posX)) {
remove = true;
}
break;
case 2:
if (&entry->pos->x == arg1->posX) {
phi_a0 = true;
if (&req->pos->x == cmp->posX) {
remove = true;
}
break;
case 3:
if (&entry->pos->x == arg1->posX && entry->sfxId == arg1->unk_28) {
phi_a0 = true;
if (&req->pos->x == cmp->posX && req->sfxId == cmp->unk_28) {
remove = true;
}
break;
case 4:
if (entry->unk_8 == arg1->unk_C && entry->sfxId == arg1->unk_28) {
phi_a0 = true;
if (req->unk_8 == cmp->unk_C && req->sfxId == cmp->unk_28) {
remove = true;
}
break;
case 5:
if (entry->sfxId == arg1->unk_28) {
phi_a0 = true;
if (req->sfxId == cmp->unk_28) {
remove = true;
}
break;
}
if (phi_a0) {
entry->sfxId = 0;
if (remove) {
req->sfxId = 0;
}
// i++;
}
}
#ifdef NON_MATCHING
// Down to a/v regalloc and some stuff where the compiler gets confused about reusing values. There's some fake matching
// stuff to improve regalloc enough to verify equivalence.
void func_800F7680(void) {
void Audio_ProcessSoundRequest(void) {
u16 flag1;
u8 sp55;
u8 phi_a1;
Struct_800F738C* sp50;
SoundRequest* req; // sp50
SoundBankEntry* temp_v0;
Struct_8013331C* sp48;
s32 phi_s5;
@ -206,25 +206,25 @@ void func_800F7680(void) {
u8 phi_s1;
u16 flag2;
sp50 = &D_8016C9A0[D_801333A4];
req = &sSoundRequests[sSoundRequestReadIndex];
phi_s1 = 0x80;
if (sp50->sfxId == 0) {
if (req->sfxId == 0) {
return;
}
phi_s5 = SFX_BANK(sp50->sfxId);
phi_s5 = SFX_BANK(req->sfxId);
if ((1 << phi_s5) & D_801333F0) {
func_800F2D6C(D_80133340, sp50->sfxId);
phi_s5 = SFX_BANK(sp50->sfxId);
AudioDebug_ScrPrt((const s8*)D_80133340, req->sfxId);
phi_s5 = SFX_BANK(req->sfxId);
}
sp55 = 0;
phi_a1 = gSoundBanks[phi_s5][0].next;
while (phi_a1 != 0xFF && phi_a1 != 0) {
if (gSoundBanks[phi_s5][phi_a1].posX == &sp50->pos->x) {
sp48 = &D_8013331C[SFX_BANK_SHIFT(sp50->sfxId)][SFX_INDEX(sp50->sfxId)];
if (gSoundBanks[phi_s5][phi_a1].posX == &req->pos->x) {
sp48 = &D_8013331C[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)];
if (!(!(sp48->unk_2 & 0x20) || sp48->unk_0 != gSoundBanks[phi_s5][phi_a1].unk_24)) {
return;
}
if (gSoundBanks[phi_s5][phi_a1].unk_28 == sp50->sfxId) {
if (gSoundBanks[phi_s5][phi_a1].unk_28 == req->sfxId) {
sp55 = D_80130594[D_801333CC][phi_s5];
} else {
//! @bug possibly uninitialized sp43 ? confirm when matching
@ -243,20 +243,20 @@ void func_800F7680(void) {
}
}
if (D_80130594[D_801333CC][phi_s5] == sp55) {
flag2 = sp50->sfxId & 0xC00; // Problem is around here
sp48 = &D_8013331C[SFX_BANK_SHIFT(sp50->sfxId)][SFX_INDEX(sp50->sfxId)];
if ((flag2) || (D_8013331C[SFX_BANK_SHIFT(sp50->sfxId)][SFX_INDEX(sp50->sfxId)].unk_2 & 4) ||
flag2 = req->sfxId & 0xC00; // Problem is around here
sp48 = &D_8013331C[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)];
if ((flag2) || (D_8013331C[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)].unk_2 & 4) ||
(phi_a1 == phi_s1)) {
if ((gSoundBanks[phi_s5][phi_a1].unk_26 & 8) && gSoundBanks[phi_s5][phi_a1].unk_2A != 1) {
Audio_ClearBGMMute(gSoundBanks[phi_s5][phi_a1].unk_2E);
}
gSoundBanks[phi_s5][phi_a1].unk_C = sp50->unk_8;
gSoundBanks[phi_s5][phi_a1].unk_28 = sp50->sfxId;
gSoundBanks[phi_s5][phi_a1].unk_C = req->unk_8;
gSoundBanks[phi_s5][phi_a1].unk_28 = req->sfxId;
gSoundBanks[phi_s5][phi_a1].unk_2A = 1;
gSoundBanks[phi_s5][phi_a1].unk_2B = 2;
gSoundBanks[phi_s5][phi_a1].unk_10 = sp50->unk_C;
gSoundBanks[phi_s5][phi_a1].unk_14 = sp50->unk_10;
gSoundBanks[phi_s5][phi_a1].unk_18 = sp50->unk_14;
gSoundBanks[phi_s5][phi_a1].freqScale = req->freqScale;
gSoundBanks[phi_s5][phi_a1].unk_14 = req->unk_10;
gSoundBanks[phi_s5][phi_a1].reverbAdd = req->reverbAdd;
gSoundBanks[phi_s5][phi_a1].unk_26 = sp48->unk_2;
gSoundBanks[phi_s5][phi_a1].unk_24 = sp48->unk_0;
if (!sp48->unk_2) {}
@ -273,17 +273,17 @@ void func_800F7680(void) {
if (gSoundBanks[phi_s5][D_8016E1A8[phi_s5]].next != 0xFF && phi_a1 != 0) {
phi_a1 = D_8016E1A8[phi_s5];
temp_v0 = &gSoundBanks[phi_s5][phi_a1];
temp_v0->posX = &sp50->pos->x;
temp_v0->posY = &sp50->pos->y;
temp_v0->posZ = &sp50->pos->z;
temp_v0->unk_C = sp50->unk_8;
temp_v0->unk_10 = sp50->unk_C;
temp_v0->unk_14 = sp50->unk_10;
temp_v0->unk_18 = sp50->unk_14;
sp48 = &D_8013331C[SFX_BANK_SHIFT(sp50->sfxId)][SFX_INDEX(sp50->sfxId)];
temp_v0->posX = &req->pos->x;
temp_v0->posY = &req->pos->y;
temp_v0->posZ = &req->pos->z;
temp_v0->unk_C = req->unk_8;
temp_v0->freqScale = req->freqScale;
temp_v0->unk_14 = req->unk_10;
temp_v0->reverbAdd = req->reverbAdd;
sp48 = &D_8013331C[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)];
temp_v0->unk_26 = sp48->unk_2;
temp_v0->unk_24 = sp48->unk_0;
temp_v0->unk_28 = sp50->sfxId;
temp_v0->unk_28 = req->sfxId;
temp_v0->unk_2A = 1;
temp_v0->unk_2B = 2;
temp_v0->prev = D_8016E1A0[phi_s5];
@ -295,8 +295,8 @@ void func_800F7680(void) {
}
}
#else
void func_800F7680(void);
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F7260/func_800F7680.s")
void Audio_ProcessSoundRequest(void);
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F7260/Audio_ProcessSoundRequest.s")
#endif
void func_800F7B54(u8 bankId, u8 bankIndex) {
@ -327,27 +327,26 @@ void func_800F7B54(u8 bankId, u8 bankIndex) {
}
void func_800F7CEC(u8 arg0) {
u8 phi_a1;
u8 phi_s3;
u8 spAE;
u8 phi_s4;
u8 spAC;
u8 phi_s3;
u8 i;
u8 j;
u8 phi_s0;
u8 spA9;
u8 phi_v1_5;
u8 temp1;
u8 temp2;
u16 temp3;
f32 tempf1;
SoundBankEntry* temp_s2;
SoundBankEntry* entry;
Struct_800F7CEC sp84[3];
Struct_800F7CEC* temp_s4_3;
s32 pad;
phi_s3 = 0;
for (spAC = 0; spAC < 3; spAC++) {
sp84[spAC].unk_0 = 0x7FFFFFFF;
sp84[spAC].unk_4 = 0xFF;
for (i = 0; i < 3; i++) {
sp84[i].unk_0 = 0x7FFFFFFF;
sp84[i].unk_4 = 0xFF;
}
phi_s4 = gSoundBanks[arg0][0].next;
phi_s0 = 0;
@ -361,51 +360,51 @@ void func_800F7CEC(u8 arg0) {
if (gSoundBanks[arg0][phi_s4].unk_2B == 0) {
func_800F7B54(arg0, phi_s4);
} else if (gSoundBanks[arg0][phi_s4].unk_2A != 0) {
temp_s2 = &gSoundBanks[arg0][phi_s4];
entry = &gSoundBanks[arg0][phi_s4];
if (&D_801333D4.x == temp_s2[0].posX) {
temp_s2->unk_1C = 0.0f;
if (&D_801333D4.x == entry[0].posX) {
entry->dist = 0.0f;
} else {
tempf1 = *temp_s2->posY * 1;
temp_s2->unk_1C = (SQ(*temp_s2->posX) + SQ(tempf1) + SQ(*temp_s2->posZ)) * 1;
tempf1 = *entry->posY * 1;
entry->dist = (SQ(*entry->posX) + SQ(tempf1) + SQ(*entry->posZ)) * 1;
}
spA9 = temp_s2->unk_24;
if (temp_s2->unk_26 & 0x10) {
temp_s2->unk_20 = SQ(0xFF - spA9) * 0x1690;
spA9 = entry->unk_24;
if (entry->unk_26 & 0x10) {
entry->unk_20 = SQ(0xFF - spA9) * 0x1690;
} else {
if (temp_s2->unk_1C > 0x7FFFFFD0) {
temp_s2->unk_1C = 0x70000008;
osSyncPrintf(D_80133344, temp_s2->unk_28, temp_s2->posX, temp_s2->posZ, *temp_s2->posX,
*temp_s2->posY, *temp_s2->posZ);
if (entry->dist > 0x7FFFFFD0) {
entry->dist = 0x70000008;
osSyncPrintf(D_80133344, entry->unk_28, entry->posX, entry->posZ, *entry->posX,
*entry->posY, *entry->posZ);
}
temp3 = temp_s2->unk_28;
temp_s2->unk_20 = (u32)temp_s2->unk_1C + (SQ(0xFF - spA9) * 0x1690) + temp3 - temp3;
if (*temp_s2->posZ < 0.0f) {
temp_s2->unk_20 += (s32)(-*temp_s2->posZ * 6.0f);
temp3 = entry->unk_28;
entry->unk_20 = (u32)entry->dist + (SQ(0xFF - spA9) * 0x1690) + temp3 - temp3;
if (*entry->posZ < 0.0f) {
entry->unk_20 += (s32)(-*entry->posZ * 6.0f);
}
}
if (temp_s2->unk_1C > 1.0e10f) {
if (temp_s2->unk_2A == 4) {
Audio_QueueCmdS8((temp_s2->unk_2E << 8) | 0x6020000, 0);
if (temp_s2->unk_28 & 0xC00) {
if (entry->dist > SQ(1e5f)) {
if (entry->unk_2A == 4) {
Audio_QueueCmdS8((entry->unk_2E << 8) | 0x6020000, 0);
if (entry->unk_28 & 0xC00) {
func_800F7B54(arg0, phi_s4);
phi_s4 = phi_s0;
}
}
} else {
spAE = D_80130578[D_801333CC][arg0];
for (spAC = 0; spAC < spAE; spAC++) {
if (sp84[spAC].unk_0 >= temp_s2->unk_20) {
for (i = 0; i < spAE; i++) {
if (sp84[i].unk_0 >= entry->unk_20) {
if (phi_s3 < D_80130578[D_801333CC][arg0]) {
phi_s3++;
}
for (phi_a1 = spAE - 1; phi_a1 > spAC; phi_a1--) {
sp84[phi_a1].unk_0 = sp84[phi_a1 - 1].unk_0;
sp84[phi_a1].unk_4 = sp84[phi_a1 - 1].unk_4;
for (j = spAE - 1; j > i; j--) {
sp84[j].unk_0 = sp84[j - 1].unk_0;
sp84[j].unk_4 = sp84[j - 1].unk_4;
}
sp84[spAC].unk_0 = temp_s2->unk_20;
sp84[spAC].unk_4 = phi_s4;
spAC = spAE;
sp84[i].unk_0 = entry->unk_20;
sp84[i].unk_4 = phi_s4;
i = spAE;
}
}
}
@ -413,40 +412,39 @@ void func_800F7CEC(u8 arg0) {
}
phi_s4 = gSoundBanks[arg0][phi_s0].next;
}
for (spAC = 0; spAC < phi_s3; spAC++) {
temp_s2 = &gSoundBanks[arg0][sp84[spAC].unk_4];
if (temp_s2->unk_2A == 1) {
temp_s2->unk_2A = 2;
} else if (temp_s2->unk_2A == 4) {
temp_s2->unk_2A = 3;
for (i = 0; i < phi_s3; i++) {
entry = &gSoundBanks[arg0][sp84[i].unk_4];
if (entry->unk_2A == 1) {
entry->unk_2A = 2;
} else if (entry->unk_2A == 4) {
entry->unk_2A = 3;
}
}
spAE = D_80130578[D_801333CC][arg0];
for (spAC = 0; spAC < spAE; spAC++) {
for (i = 0; i < spAE; i++) {
phi_v1_5 = 0;
temp_s4_3 = &D_8016E1B8[arg0][spAC];
temp1 = temp_s4_3->unk_4;
temp_s4_3 = &D_8016E1B8[arg0][i];
if (temp_s4_3->unk_4 == 0xFF) {
phi_v1_5 = 1;
} else {
temp_s2 = &gSoundBanks[arg0][temp_s4_3[0].unk_4];
if (temp_s2->unk_2A == 4) {
if (temp_s2->unk_28 & 0xC00) {
entry = &gSoundBanks[arg0][temp_s4_3[0].unk_4];
if (entry->unk_2A == 4) {
if (entry->unk_28 & 0xC00) {
func_800F7B54(arg0, temp_s4_3->unk_4);
} else {
temp_s2->unk_2A = 1;
entry->unk_2A = 1;
}
phi_v1_5 = 1;
} else if (temp_s2->unk_2A == 0) {
} else if (entry->unk_2A == 0) {
temp_s4_3->unk_4 = 0xFF;
phi_v1_5 = 1;
} else {
for (phi_a1 = 0; phi_a1 < spAE; phi_a1++) {
if (temp_s4_3->unk_4 == sp84[phi_a1].unk_4) {
sp84[phi_a1].unk_4 = 0xFF;
phi_a1 = spAE;
for (j = 0; j < spAE; j++) {
if (temp_s4_3->unk_4 == sp84[j].unk_4) {
sp84[j].unk_4 = 0xFF;
j = spAE;
}
}
phi_s3--;
@ -454,8 +452,8 @@ void func_800F7CEC(u8 arg0) {
}
if (phi_v1_5 == 1) {
for (phi_a1 = 0; phi_a1 < spAE; phi_a1++) {
temp2 = sp84[phi_a1].unk_4;
for (j = 0; j < spAE; j++) {
temp2 = sp84[j].unk_4;
if ((temp2 != 0xFF) && (gSoundBanks[arg0][temp2].unk_2A != 3)) {
for (phi_s0 = 0; phi_s0 < spAE; phi_s0++) {
if (temp2 == D_8016E1B8[arg0][phi_s0].unk_4) {
@ -466,14 +464,14 @@ void func_800F7CEC(u8 arg0) {
if (phi_v1_5 == 1) {
temp_s4_3->unk_4 = temp2;
sp84[phi_a1].unk_4 = 0xFF;
sp84[j].unk_4 = 0xFF;
phi_a1 = spAE + 1;
j = spAE + 1;
phi_s3--;
}
}
}
if (phi_a1 == spAE) {
if (j == spAE) {
temp_s4_3->unk_4 = 0xFF;
}
}
@ -512,7 +510,7 @@ void func_800F8480(u8 bankId) {
break;
}
}
func_800F3A08(bankId, bankIndex, D_8016E260);
Audio_SetSoundProperties(bankId, bankIndex, D_8016E260);
Audio_QueueCmdS8(0x06020000 | ((D_8016E260 & 0xFF) << 8), 1);
Audio_QueueCmdS8(0x06020000 | ((D_8016E260 & 0xFF) << 8) | 4, entry->unk_28 & 0xFF);
if (D_80130570[bankId] != 0) {
@ -526,7 +524,7 @@ void func_800F8480(u8 bankId) {
} else if ((u8)seqChannel->soundScriptIO[1] == 0xFF) {
func_800F7B54(bankId, bankIndex);
} else if (entry->unk_2A == 3) {
func_800F3A08(bankId, bankIndex, D_8016E260);
Audio_SetSoundProperties(bankId, bankIndex, D_8016E260);
if (entry->unk_28 & 0xC00) {
entry->unk_2A = 4;
} else {
@ -541,7 +539,7 @@ void func_800F8480(u8 bankId) {
void func_800F87A0(u8 bankId) {
SoundBankEntry* entry;
s32 pad;
SoundBankEntry sp48;
SoundBankEntry cmp;
u8 bankIndex = gSoundBanks[bankId][0].next;
while (bankIndex != 0xFF) {
@ -554,8 +552,8 @@ void func_800F87A0(u8 bankId) {
}
bankIndex = gSoundBanks[bankId][0].next;
}
sp48.unk_28 = bankId << 12;
func_800F74E0(0, &sp48);
cmp.unk_28 = bankId << 12;
Audio_RemoveMatchingSoundRequests(0, &cmp);
}
void func_800F8884(u8 bankId, Vec3f* pos) {
@ -580,30 +578,30 @@ void func_800F8884(u8 bankId, Vec3f* pos) {
}
void func_800F89A0(u8 bankId, Vec3f* pos) {
SoundBankEntry sp18;
SoundBankEntry cmp;
func_800F8884(bankId, pos);
sp18.unk_28 = bankId << 12;
sp18.posX = &pos->x;
func_800F74E0(1, &sp18);
cmp.unk_28 = bankId << 12;
cmp.posX = &pos->x;
Audio_RemoveMatchingSoundRequests(1, &cmp);
}
void func_800F89E8(Vec3f* pos) {
u8 i;
SoundBankEntry sp24;
SoundBankEntry cmp;
for (i = 0; i < ARRAY_COUNT(gSoundBanks); i++) {
func_800F8884(i, pos);
}
sp24.posX = &pos->x;
func_800F74E0(2, &sp24);
cmp.posX = &pos->x;
Audio_RemoveMatchingSoundRequests(2, &cmp);
}
void func_800F8A44(Vec3f* pos, u16 sfxId) {
SoundBankEntry* entry;
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
u8 bankIndex2 = 0;
SoundBankEntry sp50;
SoundBankEntry cmp;
while (bankIndex != 0xFF) {
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
@ -622,16 +620,16 @@ void func_800F8A44(Vec3f* pos, u16 sfxId) {
bankIndex = gSoundBanks[SFX_BANK(sfxId)][bankIndex2].next;
}
}
sp50.posX = &pos->x;
sp50.unk_28 = sfxId;
func_800F74E0(3, &sp50);
cmp.posX = &pos->x;
cmp.unk_28 = sfxId;
Audio_RemoveMatchingSoundRequests(3, &cmp);
}
void func_800F8BA0(u8 arg0, u16 sfxId) {
SoundBankEntry* entry;
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
u8 bankIndex2 = 0;
SoundBankEntry sp58;
SoundBankEntry cmp;
while (bankIndex != 0xFF) {
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
@ -649,16 +647,16 @@ void func_800F8BA0(u8 arg0, u16 sfxId) {
bankIndex = gSoundBanks[SFX_BANK(sfxId)][bankIndex2].next;
}
}
sp58.unk_C = arg0;
sp58.unk_28 = sfxId;
func_800F74E0(4, &sp58);
cmp.unk_C = arg0;
cmp.unk_28 = sfxId;
Audio_RemoveMatchingSoundRequests(4, &cmp);
}
void Audio_StopSfx(u32 sfxId) {
SoundBankEntry* entry;
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
u8 bankIndex2 = 0;
SoundBankEntry sp50;
SoundBankEntry cmp;
while (bankIndex != 0xFF) {
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
@ -674,14 +672,14 @@ void Audio_StopSfx(u32 sfxId) {
}
bankIndex = gSoundBanks[SFX_BANK(sfxId)][bankIndex2].next;
}
sp50.unk_28 = sfxId;
func_800F74E0(5, &sp50);
cmp.unk_28 = sfxId;
Audio_RemoveMatchingSoundRequests(5, &cmp);
}
void func_800F8E3C(void) {
while (D_801333A0 != D_801333A4) {
func_800F7680();
D_801333A4++;
void Audio_ProcessSoundRequests(void) {
while (sSoundRequestWriteIndex != sSoundRequestReadIndex) {
Audio_ProcessSoundRequest();
sSoundRequestReadIndex++;
}
}
@ -718,7 +716,7 @@ void func_800F8F88(void) {
}
}
u8 func_800F8FF4(u32 sfxId) {
u8 Audio_IsSfxPlaying(u32 sfxId) {
SoundBankEntry* entry;
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
@ -737,14 +735,14 @@ void func_800F905C(void) {
u8 i;
u8 bankIndex;
D_801333A0 = 0;
D_801333A4 = 0;
sSoundRequestWriteIndex = 0;
sSoundRequestReadIndex = 0;
D_801333D0 = 0;
for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) {
D_8016E1A0[bankId] = 0;
D_8016E1A8[bankId] = 1;
D_8016E1B0[bankId] = 0;
D_8016E264[bankId] = 0;
gSoundBankMuted[bankId] = false;
D_8016E270[bankId].unk_0 = 1.0f;
D_8016E270[bankId].unk_C = 0;
}
@ -765,9 +763,9 @@ void func_800F905C(void) {
}
if (D_801333F8 == 0) {
for (bankId = 0; bankId < 10; bankId++) {
D_8016E2E0[bankId] = 0;
D_8016E2F8[bankId] = 0;
D_8016E310[bankId] = 0;
gAudioSEFlagSwapSource[bankId] = 0;
gAudioSEFlagSwapTarget[bankId] = 0;
gAudioSEFlagSwapMode[bankId] = 0;
}
D_801333F8++;
}