mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-10 19:20:13 +00:00
Introduce Sfx Flags (#1278)
* Sfx Flags * Discord Discussion * Move macro to sound_params * Oops * PR Suggestions * Clarify comment * Missed switch * More suggestions * Update src/code/audio_sound_params.c Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * sfxs * PR Suggestions * revert back to flag Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
56e52a89c1
commit
b602276fef
6 changed files with 1322 additions and 241 deletions
|
@ -229,6 +229,7 @@
|
|||
#define NA_SE_PL_DUMMY_221 0x8DD
|
||||
#define NA_SE_PL_SLIP_HEAVYBOOTS_LEVEL 0x8DE
|
||||
#define NA_SE_PL_SLIP_ICE_LEVEL 0x8DF
|
||||
// TODO: The sfx below in this bank are not in gSoundParams and read OoB. May be fake Ids from OoT3D
|
||||
#define NA_SE_PL_JUMP_METAL 0x8E0
|
||||
#define NA_SE_PL_LAND_METAL 0x8E1
|
||||
#define NA_SE_PL_WALK_RUNNINGMAN 0x8E2
|
||||
|
@ -329,6 +330,7 @@
|
|||
#define NA_SE_IT_HAND_CLAP 0x184D
|
||||
#define NA_SE_IT_MASTER_SWORD_SWING 0x184E
|
||||
#define NA_SE_IT_DUMMY5 0x184F
|
||||
// TODO: The sfx below in this bank are not in gSoundParams and read OoB. May be fake Ids from OoT3D
|
||||
#define NA_SE_IT_YOBI19 0x1850
|
||||
#define NA_SE_FISHING_REEL_SLOW2 0x1851 // not IT?
|
||||
#define NA_SE_IT_SPIDERNET_HIT1 0x1852
|
||||
|
@ -601,6 +603,7 @@
|
|||
#define NA_SE_EV_OCARINA_BMELO_0 0x28F5
|
||||
#define NA_SE_EV_OCARINA_BMELO_1 0x28F6
|
||||
#define NA_SE_EV_EXPLOSION_FOR_RENZOKU 0x28F7
|
||||
// TODO: The sfx below in this bank are not in gSoundParams and read OoB. May be fake Ids from OoT3D
|
||||
#define NA_SE_EV_ELEVATOR_MOVE_KABE1 0x28F8
|
||||
#define NA_SE_EV_RIVER_STREAM_F_IDO 0x28F9
|
||||
#define NA_SE_EV_GUILLOTINE_BOUND_copyOrigin 0x28FA
|
||||
|
@ -637,8 +640,6 @@
|
|||
|
||||
// ------------ ENEMY ------------
|
||||
|
||||
#define NA_SE_EN_FLOORMASTER_SLIDING 0x3034
|
||||
#define NA_SE_EN_FLOORMASTER_SM_STICK 0x3136
|
||||
#define NA_SE_EN_DODO_J_WALK 0x3800
|
||||
#define NA_SE_EN_DODO_J_CRY 0x3801
|
||||
#define NA_SE_EN_DODO_J_FIRE 0x3802
|
||||
|
@ -691,6 +692,7 @@
|
|||
#define NA_SE_EN_STALKID_ATTACK 0x3831
|
||||
#define NA_SE_EN_STALKID_DAMAGE 0x3832
|
||||
#define NA_SE_EN_STALKID_DEAD 0x3833
|
||||
#define NA_SE_EN_FLOORMASTER_SLIDING 0x3834
|
||||
#define NA_SE_EN_TEKU_WALK_WATER 0x3835
|
||||
#define NA_SE_EN_LIGHT_ARROW_HIT 0x3836
|
||||
#define NA_SE_EN_TUBOOCK_FLY 0x3837
|
||||
|
@ -948,6 +950,7 @@
|
|||
#define NA_SE_EN_FLOORMASTER_RESTORE 0x3933
|
||||
#define NA_SE_EN_FLOORMASTER_EXPAND 0x3934
|
||||
#define NA_SE_EN_FLOORMASTER_SPLIT 0x3935
|
||||
#define NA_SE_EN_FLOORMASTER_SM_STICK 0x3936
|
||||
#define NA_SE_EN_FLOORMASTER_SM_LAND 0x3937
|
||||
#define NA_SE_EN_IRONNACK_WAVE_DEMO 0x3938
|
||||
#define NA_SE_EN_IRONNACK_FINGER_DEMO 0x3939
|
||||
|
@ -1136,6 +1139,7 @@
|
|||
#define NA_SE_EN_MUSI_WALK 0x39F0
|
||||
#define NA_SE_EN_MIMICK_BREATH 0x39F1
|
||||
#define NA_SE_EN_STALWALL_LAUGH 0x39F2
|
||||
// TODO: The sfx below in this bank are not in gSoundParams and read OoB. May be fake Ids from OoT3D
|
||||
#define NA_SE_EN_TWINROBA_TRANSFORM2 0x39F3
|
||||
#define NA_SE_EN_KAICHO_PIYORI 0x39F4
|
||||
#define NA_SE_EN_DODO_K_WALK_APPEAR 0x39F5
|
||||
|
@ -1245,6 +1249,7 @@
|
|||
#define NA_SE_SY_CARROT_RECOVER 0x4845
|
||||
#define NA_SE_EV_FAIVE_LUPY_COUNT 0x4846 // EV sound inside SY?
|
||||
#define NA_SE_SY_DUMMY_71 0x4847
|
||||
// TODO: The sfx below in this bank are not in gSoundParams and read OoB. May be fake Ids from OoT3D
|
||||
#define NA_SE_SY_KANADE_ISHI 0x4848
|
||||
#define NA_SE_SY_NA_HELLO_2 0x4849
|
||||
#define NA_SE_SY_MAGIC_SOUL_NORMAL 0x484A
|
||||
|
@ -1275,6 +1280,7 @@
|
|||
#define NA_SE_OC_SECRET_HOLE_OUT 0x5805
|
||||
#define NA_SE_OC_REVENGE 0x5806
|
||||
#define NA_SE_OC_HINT_MOVIE 0x5807
|
||||
// TODO: The sfx below in this bank are not in gSoundParams and read OoB. May be fake Ids from OoT3D
|
||||
#define NA_SE_OC_HINT_MOVIE2_WHITE 0x5808
|
||||
#define NA_SE_OC_HINT_MOVIE_ZOOMIN 0x5809
|
||||
#define NA_SE_OC_HIBIKI_ISHI 0x580A
|
||||
|
@ -1409,6 +1415,7 @@
|
|||
#define NA_SE_VO_DUMMY_0x7d 0x687D
|
||||
#define NA_SE_VO_DUMMY_0x7e 0x687E
|
||||
#define NA_SE_VO_DUMMY_0x7f 0x687F
|
||||
// TODO: The sfx below in this bank are not in gSoundParams and read OoB. May be fake Ids from OoT3D
|
||||
#define NA_SE_VO_DUMMY_0x80 0x6880
|
||||
#define NA_SE_VO_LI_AUTO_JUMP_DARKLINK 0x6881
|
||||
#define NA_SE_VO_DUMMY_0x82_YOBI 0x6882
|
||||
|
|
|
@ -1046,6 +1046,28 @@ typedef struct {
|
|||
u8 entryIndex;
|
||||
} ActiveSound;
|
||||
|
||||
// SoundParams bit-packing
|
||||
|
||||
#define SFX_PARAM_01_SHIFT 0
|
||||
#define SFX_PARAM_01_MASK (3 << SFX_PARAM_01_SHIFT)
|
||||
|
||||
#define SFX_FLAG_2 (1 << 2)
|
||||
#define SFX_FLAG_3 (1 << 3)
|
||||
#define SFX_FLAG_4 (1 << 4)
|
||||
#define SFX_FLAG_5 (1 << 5)
|
||||
|
||||
#define SFX_PARAM_67_SHIFT 6
|
||||
#define SFX_PARAM_67_MASK (3 << SFX_PARAM_67_SHIFT)
|
||||
|
||||
#define SFX_FLAG_9 (1 << 9)
|
||||
#define SFX_FLAG_10_SHIFT 10
|
||||
#define SFX_FLAG_10 (1 << SFX_FLAG_10_SHIFT)
|
||||
#define SFX_FLAG_11 (1 << 11)
|
||||
#define SFX_FLAG_12 (1 << 12)
|
||||
#define SFX_FLAG_13 (1 << 13)
|
||||
#define SFX_FLAG_14 (1 << 14)
|
||||
#define SFX_FLAG_15 (1 << 15)
|
||||
|
||||
typedef struct {
|
||||
u8 importance;
|
||||
u16 params;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3740,14 +3740,14 @@ f32 Audio_ComputeSoundVolume(u8 bankId, u8 entryIdx) {
|
|||
f32 baseDist;
|
||||
f32 ret;
|
||||
|
||||
if (bankEntry->sfxParams & 0x2000) {
|
||||
if (bankEntry->sfxParams & SFX_FLAG_13) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
if (bankEntry->dist > 10000.0f) {
|
||||
ret = 0.0f;
|
||||
} else {
|
||||
switch (bankEntry->sfxParams & 3) {
|
||||
switch ((bankEntry->sfxParams & SFX_PARAM_01_MASK) >> SFX_PARAM_01_SHIFT) {
|
||||
case 1:
|
||||
baseDist = 10000.0f / 15.0f;
|
||||
break;
|
||||
|
@ -3785,7 +3785,7 @@ s8 Audio_ComputeSoundReverb(u8 bankId, u8 entryIdx, u8 channelIdx) {
|
|||
SoundBankEntry* entry = &gSoundBanks[bankId][entryIdx];
|
||||
s32 reverb;
|
||||
|
||||
if (!(entry->sfxParams & 0x1000)) {
|
||||
if (!(entry->sfxParams & SFX_FLAG_12)) {
|
||||
if (entry->dist < 2500.0f) {
|
||||
distAdd = *entry->posZ > 0.0f ? (entry->dist / 2500.0f) * 70.0f : (entry->dist / 2500.0f) * 91.0f;
|
||||
} else {
|
||||
|
@ -3861,7 +3861,7 @@ f32 Audio_ComputeSoundFreqScale(u8 bankId, u8 entryIdx) {
|
|||
f32 unk1C;
|
||||
f32 freq = 1.0f;
|
||||
|
||||
if (entry->sfxParams & 0x4000) {
|
||||
if (entry->sfxParams & SFX_FLAG_14) {
|
||||
freq = 1.0f - ((gAudioContext.audioRandom & 0xF) / 192.0f);
|
||||
}
|
||||
|
||||
|
@ -3885,14 +3885,14 @@ f32 Audio_ComputeSoundFreqScale(u8 bankId, u8 entryIdx) {
|
|||
}
|
||||
|
||||
if (phi_v0 == 1) {
|
||||
if (!(entry->sfxParams & 0x800)) {
|
||||
if (!(entry->sfxParams & SFX_FLAG_11)) {
|
||||
freq *= (1.0293 - ((gAudioContext.audioRandom & 0xF) / 144.0f));
|
||||
}
|
||||
}
|
||||
|
||||
unk1C = entry->dist;
|
||||
if (!(entry->sfxParams & 0x2000)) {
|
||||
if (!(entry->sfxParams & 0x8000)) {
|
||||
if (!(entry->sfxParams & SFX_FLAG_13)) {
|
||||
if (!(entry->sfxParams & SFX_FLAG_15)) {
|
||||
if (unk1C >= 10000.0f) {
|
||||
freq += 0.2f;
|
||||
} else {
|
||||
|
@ -3901,7 +3901,7 @@ f32 Audio_ComputeSoundFreqScale(u8 bankId, u8 entryIdx) {
|
|||
}
|
||||
}
|
||||
|
||||
if (entry->sfxParams & 0xC0) {
|
||||
if ((entry->sfxParams & SFX_PARAM_67_MASK) != (0 << SFX_PARAM_67_SHIFT)) {
|
||||
freq += (entry->unk_2F / 192.0f);
|
||||
}
|
||||
|
||||
|
@ -3930,12 +3930,12 @@ u8 func_800F37B8(f32 behindScreenZ, SoundBankEntry* arg1, s8 arg2) {
|
|||
}
|
||||
|
||||
if (phi_v1 == 0) {
|
||||
if (arg1->sfxParams & 0x200) {
|
||||
if (arg1->sfxParams & SFX_FLAG_9) {
|
||||
phi_v1 = 0xF;
|
||||
}
|
||||
}
|
||||
|
||||
switch (arg1->sfxParams & 3) {
|
||||
switch ((arg1->sfxParams & SFX_PARAM_01_MASK) >> SFX_PARAM_01_SHIFT) {
|
||||
case 1:
|
||||
phi_f0 = 12.0f;
|
||||
break;
|
||||
|
@ -3998,8 +3998,8 @@ void Audio_SetSoundProperties(u8 bankId, u8 entryIdx, u8 channelIdx) {
|
|||
panSigned = Audio_ComputeSoundPanSigned(*entry->posX, *entry->posZ, entry->token);
|
||||
freqScale = Audio_ComputeSoundFreqScale(bankId, entryIdx) * *entry->freqScale;
|
||||
if (D_80130604 == 2) {
|
||||
behindScreenZ = sBehindScreenZ[(entry->sfxParams & 0x400) >> 10];
|
||||
if (!(entry->sfxParams & 0x800)) {
|
||||
behindScreenZ = sBehindScreenZ[(entry->sfxParams & SFX_FLAG_10) >> SFX_FLAG_10_SHIFT];
|
||||
if (!(entry->sfxParams & SFX_FLAG_11)) {
|
||||
if (*entry->posZ < behindScreenZ) {
|
||||
stereoBits = 0x10;
|
||||
}
|
||||
|
@ -4023,7 +4023,7 @@ void Audio_SetSoundProperties(u8 bankId, u8 entryIdx, u8 channelIdx) {
|
|||
|
||||
if ((baseFilter | sAudioExtraFilter) != 0) {
|
||||
filter = (baseFilter | sAudioExtraFilter);
|
||||
} else if (D_80130604 == 2 && (entry->sfxParams & 0x2000) == 0) {
|
||||
} else if (D_80130604 == 2 && !(entry->sfxParams & SFX_FLAG_13)) {
|
||||
filter = func_800F37B8(behindScreenZ, entry, panSigned);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -233,7 +233,7 @@ void Audio_ProcessSoundRequest(void) {
|
|||
index = gSoundBanks[bankId][0].next;
|
||||
while (index != 0xFF && index != 0) {
|
||||
if (gSoundBanks[bankId][index].posX == &req->pos->x) {
|
||||
if ((gSoundParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)].params & 0x20) &&
|
||||
if ((gSoundParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)].params & SFX_FLAG_5) &&
|
||||
gSoundParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)].importance ==
|
||||
gSoundBanks[bankId][index].sfxImportance) {
|
||||
return;
|
||||
|
@ -261,8 +261,8 @@ void Audio_ProcessSoundRequest(void) {
|
|||
}
|
||||
if (count == gUsedChannelsPerBank[gSfxChannelLayout][bankId]) {
|
||||
soundParams = &gSoundParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)];
|
||||
if ((req->sfxId & 0xC00) || (soundParams->params & 4) || (index == evictIndex)) {
|
||||
if ((gSoundBanks[bankId][index].sfxParams & 8) &&
|
||||
if ((req->sfxId & 0xC00) || (soundParams->params & SFX_FLAG_2) || (index == evictIndex)) {
|
||||
if ((gSoundBanks[bankId][index].sfxParams & SFX_FLAG_3) &&
|
||||
gSoundBanks[bankId][index].state != SFX_STATE_QUEUED) {
|
||||
Audio_ClearBGMMute(gSoundBanks[bankId][index].channelIdx);
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ void Audio_RemoveSoundBankEntry(u8 bankId, u8 entryIndex) {
|
|||
SoundBankEntry* entry = &gSoundBanks[bankId][entryIndex];
|
||||
u8 i;
|
||||
|
||||
if (entry->sfxParams & 8) {
|
||||
if (entry->sfxParams & SFX_FLAG_3) {
|
||||
Audio_ClearBGMMute(entry->channelIdx);
|
||||
}
|
||||
if (entryIndex == sSoundBankListEnd[bankId]) {
|
||||
|
@ -382,7 +382,7 @@ void Audio_ChooseActiveSounds(u8 bankId) {
|
|||
entry->dist = (SQ(*entry->posX) + SQ(tempf1) + SQ(*entry->posZ)) * 1;
|
||||
}
|
||||
sfxImportance = entry->sfxImportance;
|
||||
if (entry->sfxParams & 0x10) {
|
||||
if (entry->sfxParams & SFX_FLAG_4) {
|
||||
entry->priority = SQ(0xFF - sfxImportance) * SQ(76);
|
||||
} else {
|
||||
if (entry->dist > 0x7FFFFFD0) {
|
||||
|
@ -506,18 +506,18 @@ void Audio_PlayActiveSounds(u8 bankId) {
|
|||
channel = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[sCurSfxPlayerChannelIdx];
|
||||
if (entry->state == SFX_STATE_READY) {
|
||||
entry->channelIdx = sCurSfxPlayerChannelIdx;
|
||||
if (entry->sfxParams & 8) {
|
||||
if (entry->sfxParams & SFX_FLAG_3) {
|
||||
Audio_QueueSeqCmdMute(sCurSfxPlayerChannelIdx);
|
||||
}
|
||||
if (entry->sfxParams & 0xC0) {
|
||||
switch (entry->sfxParams & 0xC0) {
|
||||
case 0x40:
|
||||
if ((entry->sfxParams & SFX_PARAM_67_MASK) != (0 << SFX_PARAM_67_SHIFT)) {
|
||||
switch (entry->sfxParams & SFX_PARAM_67_MASK) {
|
||||
case (1 << SFX_PARAM_67_SHIFT):
|
||||
entry->unk_2F = Audio_NextRandom() & 0xF;
|
||||
break;
|
||||
case 0x80:
|
||||
case (2 << SFX_PARAM_67_SHIFT):
|
||||
entry->unk_2F = Audio_NextRandom() & 0x1F;
|
||||
break;
|
||||
case 0xC0:
|
||||
case (3 << SFX_PARAM_67_SHIFT):
|
||||
entry->unk_2F = Audio_NextRandom() & 0x3F;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -581,7 +581,7 @@ void EnFloormas_Slide(EnFloormas* this, PlayState* play) {
|
|||
|
||||
func_800286CC(play, &pos, &velocity, &accel, 450, 100);
|
||||
|
||||
func_8002F974(&this->actor, NA_SE_EN_FLOORMASTER_SLIDING);
|
||||
func_8002F974(&this->actor, NA_SE_EN_FLOORMASTER_SLIDING - SFX_FLAG);
|
||||
}
|
||||
|
||||
void EnFloormas_Charge(EnFloormas* this, PlayState* play) {
|
||||
|
@ -820,7 +820,7 @@ void EnFloormas_GrabLink(EnFloormas* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_STICK);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_STICK - SFX_FLAG);
|
||||
}
|
||||
|
||||
void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, PlayState* play) {
|
||||
|
|
Loading…
Reference in a new issue