mirror of
https://github.com/HarbourMasters/2ship2harkinian.git
synced 2024-11-24 06:29:59 +00:00
Audio Sequences Decompiled & Documented (z_obj_sound OK, more code_8019AF00.c) (#1407)
* import audio docs * cleanup * SEQ_SCREEN_WEIGHTED_DIST * PR * PR
This commit is contained in:
parent
576cf6964c
commit
93713a1da0
@ -1292,21 +1292,13 @@ void Audio_SetBgmVolumeOn(void);
|
||||
void func_801A0204(s8 seqId);
|
||||
void Audio_SetMainBgmVolume(u8 targetVolume, u8 volumeFadeTimer);
|
||||
void AudioSfx_SetChannelIO(Vec3f* pos, u16 sfxId, u8 ioData);
|
||||
// void func_801A1290(void);
|
||||
// void func_801A1348(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
// void func_801A13BC(void);
|
||||
// void func_801A153C(void);
|
||||
// void func_801A17F4(void);
|
||||
// void func_801A1904(void);
|
||||
// void func_801A1A10(void);
|
||||
// void func_801A1A8C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
void func_801A1D44(Vec3f* vec, u8 seqId, f32 arg2);
|
||||
void func_801A1DB8(Vec3f* vec, u8 seqId, f32 arg2);
|
||||
// void func_801A1E0C(void);
|
||||
void func_801A1F00(u8 arg0, u16 seqId);
|
||||
void func_801A1F88(void);
|
||||
void func_801A1FB4(u8 playerIndex, Vec3f* pos, u16 seqId, f32 maxDist);
|
||||
// void func_801A2090(void);
|
||||
void Audio_PlayObjSoundBgm(Vec3f* pos, s8 seqId);
|
||||
void Audio_PlayObjSoundFanfare(Vec3f* pos, s8 seqId);
|
||||
void Audio_PlaySubBgmAtPos(Vec3f* pos, u8 seqId, f32 maxDist);
|
||||
void Audio_PlaySubBgmAtPosWithFilter(Vec3f* pos, u8 seqId, f32 arg2);
|
||||
void Audio_PlaySequenceAtDefaultPos(u8 seqPlayerIndex, u16 seqId);
|
||||
void Audio_StopSequenceAtDefaultPos(void);
|
||||
void Audio_PlaySequenceAtPos(u8 seqPlayerIndex, Vec3f* pos, u16 seqId, f32 maxDist);
|
||||
void func_801A246C(u8 param_1, u8 param_2);
|
||||
void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne);
|
||||
void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne);
|
||||
|
3
spec
3
spec
@ -2000,8 +2000,7 @@ beginseg
|
||||
name "ovl_Obj_Sound"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.o"
|
||||
include "build/data/ovl_Obj_Sound/ovl_Obj_Sound.data.o"
|
||||
include "build/data/ovl_Obj_Sound/ovl_Obj_Sound.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Obj_Sound/ovl_Obj_Sound_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
@ -77,10 +77,10 @@ void Audio_PlayAmbience(u8 ambienceId);
|
||||
void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 volume);
|
||||
|
||||
void Audio_UpdateRiverSoundVolumes(void);
|
||||
void func_801A1290(void);
|
||||
void func_801A1904(void);
|
||||
void func_801A1E0C(void);
|
||||
void func_801A2090(void);
|
||||
void Audio_UpdateObjSoundProperties(void);
|
||||
void Audio_UpdateObjSoundFanfare(void);
|
||||
void Audio_UpdateSubBgmAtPos(void);
|
||||
void Audio_UpdateSequenceAtPos(void);
|
||||
void Audio_UpdateSceneSequenceResumePoint(void);
|
||||
void func_801A312C(void);
|
||||
void func_801A3AC0(void);
|
||||
@ -116,7 +116,14 @@ u8 sRiverSoundBgmTimer;
|
||||
u8 sFanfareState;
|
||||
u16 sFanfareSeqId;
|
||||
u8 sMuteOnlySfxAndAmbienceSeq;
|
||||
u8 sAllPlayersMutedExceptOcaAndSys;
|
||||
u8 sAllPlayersMutedExceptSystemAndOcarina;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ AUDIO_PAUSE_STATE_CLOSED,
|
||||
/* 1 */ AUDIO_PAUSE_STATE_CLOSING,
|
||||
/* 2 */ AUDIO_PAUSE_STATE_OPEN
|
||||
} AudioPauseState;
|
||||
|
||||
u8 sAudioPauseState;
|
||||
u8 sSpatialSeqIsActive[4];
|
||||
u8 sSequenceFilter[8 * 4];
|
||||
@ -237,6 +244,10 @@ Vec3f* sRiverSoundBgmPos = NULL;
|
||||
f32 sRiverSoundXZDistToPlayer = 2000.0f;
|
||||
u8 sObjSoundMainBgmSeqId = NA_BGM_GENERAL_SFX;
|
||||
|
||||
// Weights distance strongest by depth (z), weaker by left/right screen (x), and weakest by top/bottom screen (y)
|
||||
#define SEQ_SCREEN_WEIGHTED_DIST(projectedPos) \
|
||||
(sqrtf(SQ((projectedPos)->z) + ((SQ((projectedPos)->x) / 4.0f) + (SQ((projectedPos)->y) / 6.0f))))
|
||||
|
||||
// Allows enemy bgm
|
||||
#define SEQ_FLAG_ENEMY (1 << 0)
|
||||
|
||||
@ -3639,11 +3650,11 @@ void Audio_Update(void) {
|
||||
Audio_UpdateSceneSequenceResumePoint();
|
||||
func_801A312C();
|
||||
Audio_UpdateSfxVolumeTransition();
|
||||
func_801A1E0C();
|
||||
func_801A1904();
|
||||
func_801A2090();
|
||||
Audio_UpdateSubBgmAtPos();
|
||||
Audio_UpdateObjSoundFanfare();
|
||||
Audio_UpdateSequenceAtPos();
|
||||
func_801A3AC0();
|
||||
func_801A1290();
|
||||
Audio_UpdateObjSoundProperties();
|
||||
Audio_ResetRequestedSceneSeqId();
|
||||
AudioSfx_ProcessRequests();
|
||||
AudioSeq_ProcessSeqCmds();
|
||||
@ -4870,37 +4881,455 @@ void Audio_SplitBgmChannels(s8 volumeSplit) {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0E44.s")
|
||||
void Audio_SetSequenceProperties(u8 seqPlayerIndex, Vec3f* projectedPos, s16 flags, f32 minDist, f32 maxDist,
|
||||
f32 maxVolume, f32 minVolume) {
|
||||
f32 dist;
|
||||
f32 volume;
|
||||
s8 surroundEffectIndex;
|
||||
s8 pan;
|
||||
s32 pad;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1290.s")
|
||||
// calculating surround sound effect from screen depth
|
||||
if (projectedPos->z > 0.0f) {
|
||||
if (projectedPos->z > 100.0f) {
|
||||
surroundEffectIndex = 0;
|
||||
} else {
|
||||
surroundEffectIndex = ((100.0f - projectedPos->z) / 100.0f) * 64.0f;
|
||||
}
|
||||
} else {
|
||||
if (projectedPos->z < -100.0f) {
|
||||
surroundEffectIndex = 0x7F;
|
||||
} else {
|
||||
surroundEffectIndex = (s8)((-projectedPos->z / 100.0f) * 64.0f) + 0x3F;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1348.s")
|
||||
// calculating pan from left-right screen position
|
||||
if (projectedPos->x > 0.0f) {
|
||||
if (projectedPos->x > 200.0f) {
|
||||
pan = 0x6C;
|
||||
} else {
|
||||
pan = (s8)((projectedPos->x / 200.0f) * 45.0f) + 0x3F;
|
||||
}
|
||||
} else {
|
||||
if (projectedPos->x < -200.0f) {
|
||||
pan = 0x14;
|
||||
} else {
|
||||
pan = (s8)(((projectedPos->x + 200.0f) / 200.0f) * 44.0f) + 0x14;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A13BC.s")
|
||||
// Calculate weighted volume
|
||||
dist = SEQ_SCREEN_WEIGHTED_DIST(projectedPos);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A153C.s")
|
||||
if (dist > maxDist) {
|
||||
volume = minVolume;
|
||||
} else if (dist < minDist) {
|
||||
volume = 1.0f;
|
||||
} else {
|
||||
volume = (((maxDist - dist) / (maxDist - minDist)) * (1.0f - minVolume)) + minVolume;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A17F4.s")
|
||||
AUDIOCMD_GLOBAL_SET_CHANNEL_MASK(seqPlayerIndex, 0xFFFF);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1904.s")
|
||||
if (flags & 1) {
|
||||
AUDIOCMD_CHANNEL_SET_SURROUND_EFFECT_INDEX(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, surroundEffectIndex);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1A10.s")
|
||||
if (flags & 2) {
|
||||
AUDIOCMD_CHANNEL_SET_PAN(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, pan);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1A8C.s")
|
||||
if (flags & 4) {
|
||||
AUDIOCMD_CHANNEL_SET_PAN_WEIGHT(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, 0x7F);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1D44.s")
|
||||
// applies filter, stores result in sSequenceFilter
|
||||
if (flags & 8) {
|
||||
// Uses new filter gBandPassFilterData
|
||||
AUDIOCMD_CHANNEL_SET_FILTER(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, 0x54,
|
||||
((u32)&sSequenceFilter[0] & ~0xF) + 0x10);
|
||||
} else {
|
||||
// Identity Filter
|
||||
AUDIOCMD_CHANNEL_SET_FILTER(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, 0, ((u32)&sSequenceFilter[0] & ~0xF) + 0x10);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1DB8.s")
|
||||
if (flags & 0x10) {
|
||||
AUDIOCMD_CHANNEL_SET_GAIN(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, 0x7F);
|
||||
} else {
|
||||
AUDIOCMD_CHANNEL_SET_GAIN(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, 0);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1E0C.s")
|
||||
if (flags & 0x20) {
|
||||
AUDIOCMD_CHANNEL_SET_VOL_SCALE(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, maxVolume * volume);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1F00.s")
|
||||
if (flags & 0x40) {
|
||||
AUDIOCMD_CHANNEL_SET_PAN_WEIGHT(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, 0x40);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1F88.s")
|
||||
if (flags & 0x80) {
|
||||
AUDIOCMD_CHANNEL_SET_REVERB_INDEX(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, 1);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A1FB4.s")
|
||||
if (flags & 0x100) {
|
||||
AUDIOCMD_CHANNEL_SET_REVERB_VOLUME(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, 55);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2090.s")
|
||||
// ======== BEGIN Z_OBJ_SOUND FUNCTIONS ========
|
||||
|
||||
/**
|
||||
* Used for Main Bgm and Fanfares
|
||||
*/
|
||||
void Audio_UpdateObjSoundProperties(void) {
|
||||
if (sObjSoundPlayerIndex != SEQ_PLAYER_INVALID) {
|
||||
if ((AudioSeq_GetActiveSeqId(sObjSoundPlayerIndex) != NA_BGM_FINAL_HOURS) &&
|
||||
AudioSeq_IsSeqCmdNotQueued((sObjSoundPlayerIndex << 24) + NA_BGM_FINAL_HOURS,
|
||||
SEQCMD_OP_MASK | SEQCMD_ASYNC_ACTIVE | SEQCMD_SEQPLAYER_MASK |
|
||||
SEQCMD_SEQID_MASK) &&
|
||||
!sIsFinalHoursOrSoaring) {
|
||||
Audio_SetSequenceProperties(sObjSoundPlayerIndex, &sObjSoundPos, sObjSoundFlags, sObjSoundMinDist,
|
||||
sObjSoundMaxDist, sObjSoundMaxVol, sObjSoundMinVol);
|
||||
}
|
||||
sObjSoundPlayerIndex = SEQ_PLAYER_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for Main Bgm and Fanfares
|
||||
*/
|
||||
void Audio_SetObjSoundProperties(u8 seqPlayerIndex, Vec3f* pos, s16 flags, f32 minDist, f32 maxDist, f32 maxVolume,
|
||||
f32 minVolume) {
|
||||
sObjSoundPlayerIndex = seqPlayerIndex;
|
||||
sObjSoundPos.x = pos->x;
|
||||
sObjSoundPos.y = pos->y;
|
||||
sObjSoundPos.z = pos->z;
|
||||
sObjSoundFlags = flags;
|
||||
sObjSoundMinDist = minDist;
|
||||
sObjSoundMaxDist = maxDist;
|
||||
sObjSoundMaxVol = maxVolume;
|
||||
sObjSoundMinVol = minVolume;
|
||||
}
|
||||
|
||||
void Audio_StartObjSoundFanfare(u8 seqPlayerIndex, Vec3f* pos, s8 seqId, u16 seqIdOffset) {
|
||||
s32 pad[3];
|
||||
u32 mask;
|
||||
|
||||
if ((AudioSeq_GetActiveSeqId(seqPlayerIndex) == NA_BGM_FINAL_HOURS) ||
|
||||
!AudioSeq_IsSeqCmdNotQueued((seqPlayerIndex << 0x18) + NA_BGM_FINAL_HOURS,
|
||||
SEQCMD_OP_MASK | SEQCMD_ASYNC_ACTIVE | SEQCMD_SEQPLAYER_MASK | SEQCMD_SEQID_MASK) ||
|
||||
sIsFinalHoursOrSoaring) {
|
||||
sIsFinalHoursOrSoaring = true;
|
||||
} else if (pos != NULL) {
|
||||
if ((seqId != (s8)(AudioSeq_GetActiveSeqId(seqPlayerIndex) & 0xFFFF)) &&
|
||||
!gAudioCtx.seqPlayers[seqPlayerIndex].enabled && (sObjSoundMainBgmSeqId == NA_BGM_GENERAL_SFX)) {
|
||||
|
||||
mask = 0xFFFF;
|
||||
|
||||
SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, ((((AudioThread_NextRandom() % 30) & 0xFF) + 1)),
|
||||
((seqId & mask) + seqIdOffset));
|
||||
sObjSoundMainBgmSeqId = seqId;
|
||||
}
|
||||
|
||||
Audio_SetObjSoundProperties(seqPlayerIndex, pos, 0x7F, 320.0f, 1280.0f, 1.0f, 0.0f);
|
||||
} else {
|
||||
SEQCMD_STOP_SEQUENCE(seqPlayerIndex, 5);
|
||||
}
|
||||
}
|
||||
|
||||
void Audio_PlayObjSoundBgm(Vec3f* pos, s8 seqId) {
|
||||
s32 pad[2];
|
||||
u16 sp36;
|
||||
s32 sp2C;
|
||||
u16 seqId0 = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
|
||||
u32 temp_a0;
|
||||
|
||||
if ((seqId0 == NA_BGM_FINAL_HOURS) ||
|
||||
!AudioSeq_IsSeqCmdNotQueued(NA_BGM_FINAL_HOURS,
|
||||
SEQCMD_OP_MASK | SEQCMD_ASYNC_ACTIVE | SEQCMD_SEQPLAYER_MASK | SEQCMD_SEQID_MASK) ||
|
||||
sIsFinalHoursOrSoaring) {
|
||||
sIsFinalHoursOrSoaring = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (seqId0 == NA_BGM_SONG_OF_SOARING) {
|
||||
sIsFinalHoursOrSoaring = true;
|
||||
}
|
||||
|
||||
if (pos != NULL) {
|
||||
if (seqId == NA_BGM_ASTRAL_OBSERVATORY) {
|
||||
|
||||
if ((seqId != (u8)(seqId0 & 0xFF)) && !sAllPlayersMutedExceptSystemAndOcarina) {
|
||||
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, (u16)seqId);
|
||||
sObjSoundMainBgmSeqId = seqId;
|
||||
} else if ((seqId == (u8)(seqId0 & 0xFF)) && (sObjSoundMainBgmSeqId == NA_BGM_GENERAL_SFX)) {
|
||||
sObjSoundMainBgmSeqId = seqId;
|
||||
}
|
||||
|
||||
Audio_SetObjSoundProperties(SEQ_PLAYER_BGM_MAIN, pos, 0x20, 100.0f, 1500.0f, 0.9f, 0.0f);
|
||||
} else {
|
||||
if (sObjSoundMainBgmSeqId == NA_BGM_GENERAL_SFX) {
|
||||
temp_a0 = ((((AudioThread_NextRandom() % 30) & 0xFF) + 1) << 0x10) | ((u16)seqId + 0x7F00);
|
||||
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, temp_a0);
|
||||
sObjSoundMainBgmSeqId = seqId;
|
||||
}
|
||||
|
||||
if (seqId == NA_BGM_MILK_BAR_DUPLICATE) {
|
||||
Audio_SetObjSoundProperties(SEQ_PLAYER_BGM_MAIN, pos, 0x1E3, 0.0f, 600.0f, 0.9f, 0.55f);
|
||||
} else if (seqId == NA_BGM_MILK_BAR) {
|
||||
Audio_SetObjSoundProperties(SEQ_PLAYER_BGM_MAIN, pos, 0x1FF, 0.0f, 600.0f, 0.9f, 0.55f);
|
||||
} else {
|
||||
Audio_SetObjSoundProperties(SEQ_PLAYER_BGM_MAIN, pos, 0x3F, 0.0f, 600.0f, 0.9f, 0.55f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sObjSoundMainBgmSeqId == NA_BGM_ASTRAL_OBSERVATORY) {
|
||||
AUDIOCMD_GLOBAL_SET_CHANNEL_MASK(SEQ_PLAYER_BGM_MAIN, 0xFFFF);
|
||||
AUDIOCMD_CHANNEL_SET_VOL_SCALE(SEQ_PLAYER_BGM_MAIN, AUDIOCMD_ALL_CHANNELS, 1.0f);
|
||||
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 10, NA_BGM_CAVERN);
|
||||
} else {
|
||||
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 5);
|
||||
}
|
||||
|
||||
sObjSoundMainBgmSeqId = NA_BGM_GENERAL_SFX;
|
||||
}
|
||||
}
|
||||
|
||||
void Audio_PlayObjSoundFanfare(Vec3f* pos, s8 seqId) {
|
||||
s32 requestFanfare = false;
|
||||
s32 pad;
|
||||
|
||||
if (sObjSoundFanfareSeqId == NA_BGM_GENERAL_SFX) {
|
||||
// No spatial fanfare is currently playing
|
||||
requestFanfare = true;
|
||||
} else if (SEQ_SCREEN_WEIGHTED_DIST(pos) < SEQ_SCREEN_WEIGHTED_DIST(&sObjSoundFanfarePos)) {
|
||||
// The spatial fanfare requested is closer than the spatial fanfare currently playing
|
||||
requestFanfare = true;
|
||||
}
|
||||
|
||||
if (requestFanfare) {
|
||||
sObjSoundFanfarePos.x = pos->x;
|
||||
sObjSoundFanfarePos.y = pos->y;
|
||||
sObjSoundFanfarePos.z = pos->z;
|
||||
sObjSoundFanfareSeqId = seqId;
|
||||
sObjSoundFanfareRequested = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Audio_UpdateObjSoundFanfare(void) {
|
||||
if (sObjSoundFanfareRequested && (sAudioPauseState == AUDIO_PAUSE_STATE_CLOSED)) {
|
||||
if (sObjSoundFanfareSeqId != NA_BGM_GENERAL_SFX) {
|
||||
Audio_StartObjSoundFanfare(SEQ_PLAYER_FANFARE, &sObjSoundFanfarePos, sObjSoundFanfareSeqId, 0);
|
||||
|
||||
if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) {
|
||||
func_801A3038();
|
||||
}
|
||||
|
||||
if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) &&
|
||||
(AudioSeq_GetActiveSeqId(SEQ_PLAYER_AMBIENCE) == NA_BGM_DISABLED)) {
|
||||
Audio_PlayAmbience(AMBIENCE_ID_09);
|
||||
}
|
||||
|
||||
sAudioCutsceneFlag = true;
|
||||
} else {
|
||||
Audio_StartObjSoundFanfare(SEQ_PLAYER_FANFARE, NULL, sObjSoundFanfareSeqId, 0);
|
||||
if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) {
|
||||
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, 0);
|
||||
}
|
||||
sObjSoundFanfareRequested = false;
|
||||
sObjSoundMainBgmSeqId = NA_BGM_GENERAL_SFX;
|
||||
sAudioCutsceneFlag = false;
|
||||
}
|
||||
sObjSoundFanfareSeqId = NA_BGM_GENERAL_SFX;
|
||||
}
|
||||
}
|
||||
|
||||
// ======== END Z_OBJ_SOUND FUNCTIONS ========
|
||||
|
||||
void Audio_StopSequenceAtPos(u8 seqPlayerIndex, u8 volumeFadeTimer) {
|
||||
SEQCMD_STOP_SEQUENCE((u32)seqPlayerIndex, 20);
|
||||
if ((seqPlayerIndex == SEQ_PLAYER_BGM_SUB) && (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED)) {
|
||||
AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F, volumeFadeTimer);
|
||||
Audio_SplitBgmChannels(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Audio_StartSubBgmAtPos(u8 seqPlayerIndex, Vec3f* projectedPos, u8 seqId, u8 flags, f32 minDist, f32 maxDist,
|
||||
f32 arg6) {
|
||||
f32 dist = SEQ_SCREEN_WEIGHTED_DIST(projectedPos);
|
||||
u8 targetVolume;
|
||||
u16 seqId0 = AudioSeq_GetActiveSeqId(seqPlayerIndex);
|
||||
f32 relVolume;
|
||||
s32 pad;
|
||||
|
||||
if (dist > maxDist) {
|
||||
if ((u8)seqId0 == seqId) {
|
||||
Audio_StopSequenceAtPos(seqPlayerIndex, 10);
|
||||
sSpatialSeqIsActive[seqPlayerIndex] = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!gAudioCtx.seqPlayers[seqPlayerIndex].enabled && !sAllPlayersMutedExceptSystemAndOcarina) ||
|
||||
(seqId0 == (NA_BGM_ENEMY | 0x800))) {
|
||||
if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) {
|
||||
AudioSeq_SetVolumeScale(seqPlayerIndex, VOL_SCALE_INDEX_BGM_SUB, 0x7F, 1);
|
||||
}
|
||||
|
||||
SEQCMD_PLAY_SEQUENCE((u32)seqPlayerIndex, 1, seqId);
|
||||
|
||||
sSpatialSeqIsActive[seqPlayerIndex] = true;
|
||||
}
|
||||
|
||||
Audio_SetSequenceProperties(seqPlayerIndex, projectedPos, flags, minDist, maxDist, 1.0, 0.05f);
|
||||
|
||||
if ((seqPlayerIndex == SEQ_PLAYER_BGM_SUB) && (gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].enabled == true)) {
|
||||
|
||||
if (dist > maxDist) {
|
||||
relVolume = 1.0f;
|
||||
} else if (dist < minDist) {
|
||||
relVolume = 0.0f;
|
||||
} else {
|
||||
relVolume = 1.0f - ((maxDist - dist) / (maxDist - minDist));
|
||||
}
|
||||
|
||||
targetVolume = (u8)(relVolume * 127.0f);
|
||||
|
||||
AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, targetVolume, 10);
|
||||
Audio_SplitBgmChannels(0x7F - targetVolume);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sSpatialSeqNoFilterPos takes priority over sSpatialSeqFilterPos
|
||||
* Used only by guru guru for song of storms
|
||||
*/
|
||||
void Audio_PlaySubBgmAtPos(Vec3f* pos, u8 seqId, f32 maxDist) {
|
||||
if (gAudioSpecId != 0xC) {
|
||||
sSpatialSeqNoFilterPos.x = pos->x;
|
||||
sSpatialSeqNoFilterPos.y = pos->y;
|
||||
sSpatialSeqNoFilterPos.z = pos->z;
|
||||
sSpatialSeqSeqId = seqId;
|
||||
sSpatialSeqMaxDist = maxDist;
|
||||
sSpatialSeqFlags |= 2; // Only update volume
|
||||
sSpatialSubBgmFadeTimer = 4;
|
||||
}
|
||||
}
|
||||
|
||||
// Used only by guru guru for song of storms in stock pot from hallway or neighboring room
|
||||
void Audio_PlaySubBgmAtPosWithFilter(Vec3f* pos, u8 seqId, f32 maxDist) {
|
||||
sSpatialSeqFilterPos.x = pos->x;
|
||||
sSpatialSeqFilterPos.y = pos->y;
|
||||
sSpatialSeqFilterPos.z = pos->z;
|
||||
sSpatialSeqSeqId = seqId;
|
||||
//! @bug Did not set sSpatialSeqMaxDist = maxDist; This will use the previously set value of sSpatialSeqMaxDist
|
||||
sSpatialSeqFlags |= 1; // Update with volume and filter
|
||||
sSpatialSubBgmFadeTimer = 4;
|
||||
}
|
||||
|
||||
// Another bgm by pos, less customization
|
||||
void Audio_UpdateSubBgmAtPos(void) {
|
||||
if (sSpatialSubBgmFadeTimer != 0) {
|
||||
if (sSpatialSeqFlags & 2) {
|
||||
// Affects only volume
|
||||
Audio_StartSubBgmAtPos(SEQ_PLAYER_BGM_SUB, &sSpatialSeqNoFilterPos, sSpatialSeqSeqId, 0x20, 100.0f,
|
||||
sSpatialSeqMaxDist, 1.0f);
|
||||
} else {
|
||||
// Set volume with band-pass filter
|
||||
Audio_StartSubBgmAtPos(SEQ_PLAYER_BGM_SUB, &sSpatialSeqFilterPos, sSpatialSeqSeqId, 0x28, 100.0f,
|
||||
sSpatialSeqMaxDist, 1.0f);
|
||||
}
|
||||
|
||||
sSpatialSubBgmFadeTimer--;
|
||||
if (sSpatialSubBgmFadeTimer == 0) {
|
||||
Audio_StopSequenceAtPos(SEQ_PLAYER_BGM_SUB, 10);
|
||||
}
|
||||
|
||||
sSpatialSeqFlags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Play sequence at the default center of the screen. Does not check for final hours or soaring bgms playing
|
||||
* Used only by minifrog for the frog song
|
||||
*/
|
||||
void Audio_PlaySequenceAtDefaultPos(u8 seqPlayerIndex, u16 seqId) {
|
||||
if (!sAudioCutsceneFlag && (gAudioSpecId != 0xC)) {
|
||||
sSpatialSeqFilterPos.x = gSfxDefaultPos.x;
|
||||
sSpatialSeqFilterPos.y = gSfxDefaultPos.y;
|
||||
sSpatialSeqFilterPos.z = gSfxDefaultPos.z;
|
||||
sSpatialSeqMaxDist = 10000.0f;
|
||||
sSpatialSeqFadeTimer = 128;
|
||||
sSpatialSeqSeqId = seqId;
|
||||
sSpatialSeqPlayerIndex = seqPlayerIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Used only by minifrog
|
||||
void Audio_StopSequenceAtDefaultPos(void) {
|
||||
if (gAudioSpecId != 0xC) {
|
||||
sSpatialSeqFadeTimer = 1;
|
||||
sSpatialSeqSeqId = NA_BGM_GENERAL_SFX;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Play the requested sequence at a position. Valid for sequences on players 0 - 3
|
||||
*/
|
||||
void Audio_PlaySequenceAtPos(u8 seqPlayerIndex, Vec3f* pos, u16 seqId, f32 maxDist) {
|
||||
if ((!sAudioCutsceneFlag) && ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF) != NA_BGM_SONG_OF_SOARING) &&
|
||||
(gAudioSpecId != 0xC) && (pos != NULL) &&
|
||||
((sSpatialSeqPlayerIndex != SEQ_PLAYER_BGM_MAIN) ||
|
||||
(AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS))) {
|
||||
sSpatialSeqFilterPos.x = pos->x;
|
||||
sSpatialSeqFilterPos.y = pos->y;
|
||||
sSpatialSeqFilterPos.z = pos->z;
|
||||
sSpatialSeqMaxDist = maxDist;
|
||||
sSpatialSeqFadeTimer = 2;
|
||||
sSpatialSeqSeqId = seqId & 0xFF;
|
||||
sSpatialSeqPlayerIndex = seqPlayerIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void Audio_UpdateSequenceAtPos(void) {
|
||||
u16 mainBgmSeqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
|
||||
u8 volumeFadeTimer;
|
||||
|
||||
if ((sSpatialSeqFadeTimer != 0) && (sAudioPauseState == AUDIO_PAUSE_STATE_CLOSED)) {
|
||||
if ((sSpatialSeqSeqId == NA_BGM_GENERAL_SFX) || (mainBgmSeqId == NA_BGM_SONG_OF_SOARING)) {
|
||||
volumeFadeTimer = 10;
|
||||
|
||||
if (mainBgmSeqId == NA_BGM_SONG_OF_SOARING) {
|
||||
sSpatialSeqFadeTimer = 0;
|
||||
volumeFadeTimer = 1;
|
||||
} else if (sSpatialSeqFadeTimer < 128) {
|
||||
sSpatialSeqFadeTimer--;
|
||||
}
|
||||
|
||||
if (sSpatialSeqFadeTimer == 0) {
|
||||
Audio_StopSequenceAtPos(sSpatialSeqPlayerIndex, volumeFadeTimer);
|
||||
sSpatialSeqIsActive[sSpatialSeqPlayerIndex] = false;
|
||||
}
|
||||
} else {
|
||||
if ((sSpatialSeqPlayerIndex == SEQ_PLAYER_BGM_MAIN) && (mainBgmSeqId == NA_BGM_FINAL_HOURS)) {
|
||||
Audio_StopSequenceAtPos(sSpatialSeqPlayerIndex, 10);
|
||||
sSpatialSeqIsActive[sSpatialSeqPlayerIndex] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Audio_StartSubBgmAtPos(sSpatialSeqPlayerIndex, &sSpatialSeqFilterPos, sSpatialSeqSeqId, 0x20, 200.0f,
|
||||
sSpatialSeqMaxDist, 1.0f);
|
||||
if (!sSpatialSeqIsActive[sSpatialSeqPlayerIndex]) {
|
||||
sSpatialSeqFadeTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (sSpatialSeqFadeTimer < 128) {
|
||||
sSpatialSeqSeqId = NA_BGM_GENERAL_SFX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unused remnant of OoT's EnRiverSound
|
||||
@ -5408,7 +5837,7 @@ void Audio_StartSfxPlayer(void) {
|
||||
void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 volume) {
|
||||
u8 channelIndex;
|
||||
|
||||
if (!sAllPlayersMutedExceptOcaAndSys) {
|
||||
if (!sAllPlayersMutedExceptSystemAndOcarina) {
|
||||
for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) {
|
||||
switch (channelIndex) {
|
||||
case SFX_CHANNEL_SYSTEM0:
|
||||
|
@ -2767,11 +2767,11 @@ void Actor_UpdateFlaggedAudio(Actor* actor) {
|
||||
if (sfxId != NA_SE_NONE) {}
|
||||
|
||||
if (actor->audioFlags & ACTOR_AUDIO_FLAG_SEQ_MUSIC_BOX_HOUSE) {
|
||||
func_801A1FB4(SEQ_PLAYER_BGM_SUB, &actor->projectedPos, NA_BGM_MUSIC_BOX_HOUSE, 1500.0f);
|
||||
Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &actor->projectedPos, NA_BGM_MUSIC_BOX_HOUSE, 1500.0f);
|
||||
}
|
||||
|
||||
if (actor->audioFlags & ACTOR_AUDIO_FLAG_SEQ_KAMARO_DANCE) {
|
||||
func_801A1FB4(SEQ_PLAYER_BGM_MAIN, &actor->projectedPos, NA_BGM_KAMARO_DANCE, 900.0f);
|
||||
Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_MAIN, &actor->projectedPos, NA_BGM_KAMARO_DANCE, 900.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,12 +350,12 @@ void EnGuruguru_Update(Actor* thisx, PlayState* play) {
|
||||
|
||||
if (this->actor.params == 2) {
|
||||
if (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f) {
|
||||
func_801A1DB8(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f);
|
||||
Audio_PlaySubBgmAtPosWithFilter(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 200.0f) {
|
||||
func_801A1D44(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f);
|
||||
Audio_PlaySubBgmAtPos(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f);
|
||||
}
|
||||
if (this->unusedTimer != 0) {
|
||||
this->unusedTimer--;
|
||||
|
@ -150,7 +150,7 @@ void EnMinifrog_Destroy(Actor* thisx, PlayState* play) {
|
||||
|
||||
Collider_DestroyCylinder(play, &this->collider);
|
||||
if (this->flags & 0x100) {
|
||||
func_801A1F88();
|
||||
Audio_StopSequenceAtDefaultPos();
|
||||
}
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, PlayState* play) {
|
||||
this->actionFunc = EnMinifrog_NextFrogMissing;
|
||||
this->timer = 60;
|
||||
this->actor.home.rot.y = Actor_WorldYawTowardActor(&this->actor, &this->frog->actor);
|
||||
func_801A1F88();
|
||||
Audio_StopSequenceAtDefaultPos();
|
||||
this->flags &= ~0x100;
|
||||
this->flags &=
|
||||
~(0x2 << FROG_YELLOW | 0x2 << FROG_CYAN | 0x2 << FROG_PINK | 0x2 << FROG_BLUE | 0x2 << FROG_WHITE);
|
||||
@ -460,7 +460,7 @@ void EnMinifrog_BeginChoirCutscene(EnMinifrog* this, PlayState* play) {
|
||||
CutsceneManager_Start(this->actor.csId, &this->actor);
|
||||
this->actionFunc = EnMinifrog_SetupNextFrogChoir;
|
||||
this->timer = 5;
|
||||
func_801A1F00(3, NA_BGM_FROG_SONG);
|
||||
Audio_PlaySequenceAtDefaultPos(SEQ_PLAYER_BGM_SUB, NA_BGM_FROG_SONG);
|
||||
this->flags |= 0x100;
|
||||
play->setPlayerTalkAnim(play, &gPlayerAnim_pn_gakkiplay, ANIMMODE_LOOP);
|
||||
} else {
|
||||
|
@ -417,7 +417,7 @@ void func_80BFC058(EnRz* this, PlayState* play) {
|
||||
|
||||
void func_80BFC078(EnRz* this, PlayState* play) {
|
||||
s32 pad;
|
||||
Vec3f sp28;
|
||||
Vec3f seqPos;
|
||||
|
||||
EnRz_UpdateSkelAnime(this, play);
|
||||
|
||||
@ -443,10 +443,10 @@ void func_80BFC078(EnRz* this, PlayState* play) {
|
||||
}
|
||||
|
||||
if (EN_RZ_GET_SISTER(&this->actor) == EN_RZ_JUDO) {
|
||||
sp28.x = this->actor.projectedPos.x;
|
||||
sp28.y = this->actor.projectedPos.y;
|
||||
sp28.z = this->actor.projectedPos.z;
|
||||
func_801A1FB4(SEQ_PLAYER_BGM_SUB, &sp28, NA_BGM_ROSA_SISTERS, 900.0f);
|
||||
seqPos.x = this->actor.projectedPos.x;
|
||||
seqPos.y = this->actor.projectedPos.y;
|
||||
seqPos.z = this->actor.projectedPos.z;
|
||||
Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_ROSA_SISTERS, 900.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,7 +504,7 @@ void func_80BFC36C(EnRz* this, PlayState* play) {
|
||||
|
||||
void func_80BFC3F8(EnRz* this, PlayState* play) {
|
||||
s32 pad;
|
||||
Vec3f bgmPos;
|
||||
Vec3f seqPos;
|
||||
|
||||
EnRz_UpdateSkelAnime(this, play);
|
||||
|
||||
@ -544,10 +544,10 @@ void func_80BFC3F8(EnRz* this, PlayState* play) {
|
||||
}
|
||||
|
||||
if (EN_RZ_GET_SISTER(&this->actor) == EN_RZ_JUDO) {
|
||||
bgmPos.x = this->actor.projectedPos.x;
|
||||
bgmPos.y = this->actor.projectedPos.y;
|
||||
bgmPos.z = this->actor.projectedPos.z;
|
||||
func_801A1FB4(SEQ_PLAYER_BGM_SUB, &bgmPos, NA_BGM_ROSA_SISTERS, 900.0f);
|
||||
seqPos.x = this->actor.projectedPos.x;
|
||||
seqPos.y = this->actor.projectedPos.y;
|
||||
seqPos.z = this->actor.projectedPos.z;
|
||||
Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_ROSA_SISTERS, 900.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ void func_80BA06BC(EnZob* this, PlayState* play) {
|
||||
|
||||
void func_80BA0728(EnZob* this, PlayState* play) {
|
||||
s32 pad;
|
||||
Vec3f sp28;
|
||||
Vec3f seqPos;
|
||||
|
||||
func_80B9F86C(this);
|
||||
|
||||
@ -585,10 +585,10 @@ void func_80BA0728(EnZob* this, PlayState* play) {
|
||||
func_800B874C(&this->actor, play, 200.0f, 150.0f);
|
||||
}
|
||||
|
||||
sp28.x = this->actor.projectedPos.x;
|
||||
sp28.y = this->actor.projectedPos.y;
|
||||
sp28.z = this->actor.projectedPos.z;
|
||||
func_801A1FB4(SEQ_PLAYER_BGM_SUB, &sp28, NA_BGM_BASS_PLAY, 1000.0f);
|
||||
seqPos.x = this->actor.projectedPos.x;
|
||||
seqPos.y = this->actor.projectedPos.y;
|
||||
seqPos.z = this->actor.projectedPos.z;
|
||||
Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_BASS_PLAY, 1000.0f);
|
||||
}
|
||||
|
||||
void func_80BA08E8(EnZob* this, PlayState* play) {
|
||||
|
@ -387,7 +387,7 @@ void EnZod_PlayDrumsSequence(EnZod* this, PlayState* play) {
|
||||
seqPos.y = this->actor.projectedPos.y;
|
||||
seqPos.z = this->actor.projectedPos.z;
|
||||
|
||||
func_801A1FB4(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_DRUMS_PLAY, 700.0f);
|
||||
Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_DRUMS_PLAY, 700.0f);
|
||||
}
|
||||
|
||||
void func_80BAFA44(EnZod* this, PlayState* play) {
|
||||
|
@ -542,7 +542,7 @@ void func_80BBBD5C(EnZos* this, PlayState* play) {
|
||||
|
||||
void func_80BBBDE0(EnZos* this, PlayState* play) {
|
||||
Actor* thisx = &this->actor;
|
||||
Vec3f sp28;
|
||||
Vec3f seqPos;
|
||||
|
||||
if (this->unk_2B6 & 1) {
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x1000, 0x200);
|
||||
@ -578,10 +578,10 @@ void func_80BBBDE0(EnZos* this, PlayState* play) {
|
||||
CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_10);
|
||||
}
|
||||
|
||||
sp28.x = this->actor.projectedPos.x;
|
||||
sp28.y = this->actor.projectedPos.y;
|
||||
sp28.z = this->actor.projectedPos.z;
|
||||
func_801A1FB4(SEQ_PLAYER_BGM_SUB, &sp28, NA_BGM_PIANO_PLAY, 1000.0f);
|
||||
seqPos.x = this->actor.projectedPos.x;
|
||||
seqPos.y = this->actor.projectedPos.y;
|
||||
seqPos.z = this->actor.projectedPos.z;
|
||||
Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_PIANO_PLAY, 1000.0f);
|
||||
}
|
||||
|
||||
void func_80BBBFBC(EnZos* this, PlayState* play) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File: z_obj_sound.c
|
||||
* Overlay: ovl_Obj_Sound
|
||||
* Description: Plays certain sounds (e.g., swamp waterfall noise)
|
||||
* Description: An invisible point-source to play sounds, including sfx and sequences.
|
||||
*/
|
||||
|
||||
#include "z_obj_sound.h"
|
||||
@ -13,8 +13,8 @@
|
||||
void ObjSound_Init(Actor* thisx, PlayState* play);
|
||||
void ObjSound_Destroy(Actor* thisx, PlayState* play);
|
||||
void ObjSound_Update(Actor* thisx, PlayState* play);
|
||||
void ObjSound_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
#if 0
|
||||
ActorInit Obj_Sound_InitVars = {
|
||||
ACTOR_OBJ_SOUND,
|
||||
ACTORCAT_ITEMACTION,
|
||||
@ -27,12 +27,50 @@ ActorInit Obj_Sound_InitVars = {
|
||||
(ActorFunc)NULL,
|
||||
};
|
||||
|
||||
#endif
|
||||
void ObjSound_Init(Actor* thisx, PlayState* play) {
|
||||
ObjSound* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Sound/ObjSound_Init.s")
|
||||
this->unk_144 = false;
|
||||
this->soundType = OBJ_SOUND_GET_TYPE(&this->actor);
|
||||
this->sfxType = OBJ_SOUND_GET_SFX_TYPE(&this->actor);
|
||||
this->actor.params &= OBJ_SOUND_ID_MASK;
|
||||
if (this->soundType == OBJ_SOUND_TYPE_FANFARE) {
|
||||
this->actor.draw = ObjSound_Draw;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Sound/ObjSound_Destroy.s")
|
||||
void ObjSound_Destroy(Actor* thisx, PlayState* play) {
|
||||
ObjSound* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Sound/ObjSound_Update.s")
|
||||
if (this->soundType == OBJ_SOUND_TYPE_BGM) {
|
||||
Audio_PlayObjSoundBgm(NULL, NA_BGM_GENERAL_SFX);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Sound/func_8099AA84.s")
|
||||
void ObjSound_Update(Actor* thisx, PlayState* play) {
|
||||
ObjSound* this = THIS;
|
||||
|
||||
if (this->soundType == OBJ_SOUND_TYPE_SFX) {
|
||||
if (this->sfxType != 0) {
|
||||
Actor_PlaySfx_Flagged(&this->actor, gAudioEnvironmentalSfx[this->actor.params]);
|
||||
} else {
|
||||
Actor_PlaySfx_FlaggedCentered3(&this->actor, gAudioEnvironmentalSfx[this->actor.params]);
|
||||
}
|
||||
} else if (this->unk_144) {
|
||||
if (this->soundType == OBJ_SOUND_TYPE_BGM) {
|
||||
Audio_PlayObjSoundBgm(&this->actor.projectedPos, this->actor.params);
|
||||
} else if (this->soundType == OBJ_SOUND_TYPE_FIXED_SFX) {
|
||||
Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, gAudioEnvironmentalSfx[this->actor.params]);
|
||||
}
|
||||
} else {
|
||||
this->unk_144 = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjSound_Draw(Actor* thisx, PlayState* play) {
|
||||
ObjSound* this = THIS;
|
||||
|
||||
if (CHECK_EVENTINF(EVENTINF_41) || CHECK_EVENTINF(EVENTINF_35)) {
|
||||
Audio_PlayObjSoundFanfare(&this->actor.projectedPos, this->actor.params);
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,22 @@
|
||||
|
||||
struct ObjSound;
|
||||
|
||||
#define OBJ_SOUND_GET_TYPE(thisx) (((thisx)->params >> 8) & 0xFF)
|
||||
#define OBJ_SOUND_GET_SFX_TYPE(thisx) (((thisx)->params >> 7) & 1)
|
||||
#define OBJ_SOUND_ID_MASK 0x7F
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ OBJ_SOUND_TYPE_SFX,
|
||||
/* 1 */ OBJ_SOUND_TYPE_BGM,
|
||||
/* 2 */ OBJ_SOUND_TYPE_FIXED_SFX,
|
||||
/* 3 */ OBJ_SOUND_TYPE_FANFARE
|
||||
} ObjSoundType;
|
||||
|
||||
typedef struct ObjSound {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x4];
|
||||
/* 0x144 */ u8 unk_144;
|
||||
/* 0x145 */ u8 sfxType;
|
||||
/* 0x146 */ s16 soundType;
|
||||
} ObjSound; // size = 0x148
|
||||
|
||||
#endif // Z_OBJ_SOUND_H
|
||||
|
@ -3919,22 +3919,22 @@
|
||||
0x801A0C70:("Audio_ClearSariaBgm",),
|
||||
0x801A0C90:("Audio_ClearSariaBgmAtPos",),
|
||||
0x801A0CB0:("Audio_SplitBgmChannels",),
|
||||
0x801A0E44:("func_801A0E44",),
|
||||
0x801A1290:("func_801A1290",),
|
||||
0x801A1348:("func_801A1348",),
|
||||
0x801A13BC:("func_801A13BC",),
|
||||
0x801A153C:("func_801A153C",),
|
||||
0x801A17F4:("func_801A17F4",),
|
||||
0x801A1904:("func_801A1904",),
|
||||
0x801A1A10:("func_801A1A10",),
|
||||
0x801A1A8C:("func_801A1A8C",),
|
||||
0x801A1D44:("func_801A1D44",),
|
||||
0x801A1DB8:("func_801A1DB8",),
|
||||
0x801A1E0C:("func_801A1E0C",),
|
||||
0x801A1F00:("func_801A1F00",),
|
||||
0x801A1F88:("func_801A1F88",),
|
||||
0x801A1FB4:("func_801A1FB4",),
|
||||
0x801A2090:("func_801A2090",),
|
||||
0x801A0E44:("Audio_SetSequenceProperties",),
|
||||
0x801A1290:("Audio_UpdateObjSoundProperties",),
|
||||
0x801A1348:("Audio_SetObjSoundProperties",),
|
||||
0x801A13BC:("Audio_StartObjSoundFanfare",),
|
||||
0x801A153C:("Audio_PlayObjSoundBgm",),
|
||||
0x801A17F4:("Audio_PlayObjSoundFanfare",),
|
||||
0x801A1904:("Audio_UpdateObjSoundFanfare",),
|
||||
0x801A1A10:("Audio_StopSequenceAtPos",),
|
||||
0x801A1A8C:("Audio_StartSubBgmAtPos",),
|
||||
0x801A1D44:("Audio_PlaySubBgmAtPos",),
|
||||
0x801A1DB8:("Audio_PlaySubBgmAtPosWithFilter",),
|
||||
0x801A1E0C:("Audio_UpdateSubBgmAtPos",),
|
||||
0x801A1F00:("Audio_PlaySequenceAtDefaultPos",),
|
||||
0x801A1F88:("Audio_StopSequenceAtDefaultPos",),
|
||||
0x801A1FB4:("Audio_PlaySequenceAtPos",),
|
||||
0x801A2090:("Audio_UpdateSequenceAtPos",),
|
||||
0x801A21FC:("Audio_PlaySariaBgm",),
|
||||
0x801A2460:("Audio_ClearSariaBgm2",),
|
||||
0x801A246C:("func_801A246C",),
|
||||
|
@ -4181,7 +4181,7 @@
|
||||
0x801FD3AB:("sFanfareState","UNK_TYPE1","",0x1),
|
||||
0x801FD3AC:("sFanfareSeqId","UNK_TYPE1","",0x1),
|
||||
0x801FD3AE:("sMuteOnlySfxAndAmbienceSeq","UNK_TYPE1","",0x1),
|
||||
0x801FD3AF:("sAllPlayersMutedExceptOcaAndSys","UNK_TYPE1","",0x1),
|
||||
0x801FD3AF:("sAllPlayersMutedExceptSystemAndOcarina","UNK_TYPE1","",0x1),
|
||||
0x801FD3B0:("sAudioPauseState","UNK_TYPE1","",0x1),
|
||||
0x801FD3B4:("sSpatialSeqIsActive","u8","[4]",0x4),
|
||||
0x801FD3B8:("sSequenceFilter","UNK_TYPE1","",0x1),
|
||||
|
@ -3436,22 +3436,22 @@ asm/non_matchings/code/code_8019AF00/func_801A09D4.s,func_801A09D4,0x801A09D4,0x
|
||||
asm/non_matchings/code/code_8019AF00/Audio_ClearSariaBgm.s,Audio_ClearSariaBgm,0x801A0C70,0x8
|
||||
asm/non_matchings/code/code_8019AF00/Audio_ClearSariaBgmAtPos.s,Audio_ClearSariaBgmAtPos,0x801A0C90,0x8
|
||||
asm/non_matchings/code/code_8019AF00/Audio_SplitBgmChannels.s,Audio_SplitBgmChannels,0x801A0CB0,0x65
|
||||
asm/non_matchings/code/code_8019AF00/func_801A0E44.s,func_801A0E44,0x801A0E44,0x113
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1290.s,func_801A1290,0x801A1290,0x2E
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1348.s,func_801A1348,0x801A1348,0x1D
|
||||
asm/non_matchings/code/code_8019AF00/func_801A13BC.s,func_801A13BC,0x801A13BC,0x60
|
||||
asm/non_matchings/code/code_8019AF00/func_801A153C.s,func_801A153C,0x801A153C,0xAE
|
||||
asm/non_matchings/code/code_8019AF00/func_801A17F4.s,func_801A17F4,0x801A17F4,0x44
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1904.s,func_801A1904,0x801A1904,0x43
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1A10.s,func_801A1A10,0x801A1A10,0x1F
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1A8C.s,func_801A1A8C,0x801A1A8C,0xAE
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1D44.s,func_801A1D44,0x801A1D44,0x1D
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1DB8.s,func_801A1DB8,0x801A1DB8,0x15
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1E0C.s,func_801A1E0C,0x801A1E0C,0x3D
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1F00.s,func_801A1F00,0x801A1F00,0x22
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1F88.s,func_801A1F88,0x801A1F88,0xB
|
||||
asm/non_matchings/code/code_8019AF00/func_801A1FB4.s,func_801A1FB4,0x801A1FB4,0x37
|
||||
asm/non_matchings/code/code_8019AF00/func_801A2090.s,func_801A2090,0x801A2090,0x5B
|
||||
asm/non_matchings/code/code_8019AF00/Audio_SetSequenceProperties.s,Audio_SetSequenceProperties,0x801A0E44,0x113
|
||||
asm/non_matchings/code/code_8019AF00/Audio_UpdateObjSoundProperties.s,Audio_UpdateObjSoundProperties,0x801A1290,0x2E
|
||||
asm/non_matchings/code/code_8019AF00/Audio_SetObjSoundProperties.s,Audio_SetObjSoundProperties,0x801A1348,0x1D
|
||||
asm/non_matchings/code/code_8019AF00/Audio_StartObjSoundFanfare.s,Audio_StartObjSoundFanfare,0x801A13BC,0x60
|
||||
asm/non_matchings/code/code_8019AF00/Audio_PlayObjSoundBgm.s,Audio_PlayObjSoundBgm,0x801A153C,0xAE
|
||||
asm/non_matchings/code/code_8019AF00/Audio_PlayObjSoundFanfare.s,Audio_PlayObjSoundFanfare,0x801A17F4,0x44
|
||||
asm/non_matchings/code/code_8019AF00/Audio_UpdateObjSoundFanfare.s,Audio_UpdateObjSoundFanfare,0x801A1904,0x43
|
||||
asm/non_matchings/code/code_8019AF00/Audio_StopSequenceAtPos.s,Audio_StopSequenceAtPos,0x801A1A10,0x1F
|
||||
asm/non_matchings/code/code_8019AF00/Audio_StartSubBgmAtPos.s,Audio_StartSubBgmAtPos,0x801A1A8C,0xAE
|
||||
asm/non_matchings/code/code_8019AF00/Audio_PlaySubBgmAtPos.s,Audio_PlaySubBgmAtPos,0x801A1D44,0x1D
|
||||
asm/non_matchings/code/code_8019AF00/Audio_PlaySubBgmAtPosWithFilter.s,Audio_PlaySubBgmAtPosWithFilter,0x801A1DB8,0x15
|
||||
asm/non_matchings/code/code_8019AF00/Audio_UpdateSubBgmAtPos.s,Audio_UpdateSubBgmAtPos,0x801A1E0C,0x3D
|
||||
asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceAtDefaultPos.s,Audio_PlaySequenceAtDefaultPos,0x801A1F00,0x22
|
||||
asm/non_matchings/code/code_8019AF00/Audio_StopSequenceAtDefaultPos.s,Audio_StopSequenceAtDefaultPos,0x801A1F88,0xB
|
||||
asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceAtPos.s,Audio_PlaySequenceAtPos,0x801A1FB4,0x37
|
||||
asm/non_matchings/code/code_8019AF00/Audio_UpdateSequenceAtPos.s,Audio_UpdateSequenceAtPos,0x801A2090,0x5B
|
||||
asm/non_matchings/code/code_8019AF00/Audio_PlaySariaBgm.s,Audio_PlaySariaBgm,0x801A21FC,0x99
|
||||
asm/non_matchings/code/code_8019AF00/Audio_ClearSariaBgm2.s,Audio_ClearSariaBgm2,0x801A2460,0x3
|
||||
asm/non_matchings/code/code_8019AF00/func_801A246C.s,func_801A246C,0x801A246C,0x36
|
||||
|
|
Loading…
Reference in New Issue
Block a user