From b8b983dd7fcc0870544c586bddda02bc85050f4c Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Tue, 28 Dec 2021 04:35:05 +1100 Subject: [PATCH] Nature Ambience Documentation (#1063) * Document nature ambience io data * Document nature ambience functions * Function headers * Doc storing main bgm for nature/miniboss bgm * Give temporary names to functions * small cleanup * add docs to clarify * Break up nature ambience channel io data for easier reading * Add info to where each nature ambience Id is used * Name environmental sequence functions * Use channel macros globally * Add nature enum, revert env name * Revert tough-to-name functions, use nature channel enum instead * Fill in remaining enums from sequence 1 * PR Suggestions * Improve macros * remove clang-format off * MINI_GAME_2 -> TIMED_MINI_GAME * Revert to generic name * Fix Spacing --- include/functions.h | 17 +- include/sequence.h | 128 ++- src/code/code_800EC960.c | 759 +++++++++++++++--- src/code/z_common_data.c | 2 +- src/code/z_demo.c | 8 +- src/code/z_game_over.c | 2 +- src/code/z_kankyo.c | 52 +- src/code/z_parameter.c | 2 +- src/code/z_play.c | 4 +- .../ovl_En_Diving_Game/z_en_diving_game.c | 2 +- .../z_en_okarina_effect.c | 10 +- .../ovl_En_River_Sound/z_en_river_sound.c | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 4 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 2 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 12 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 2 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 2 +- .../actors/ovl_player_actor/z_player.c | 6 +- 18 files changed, 850 insertions(+), 166 deletions(-) diff --git a/include/functions.h b/include/functions.h index 9fb1b0b923..620dd856c2 100644 --- a/include/functions.h +++ b/include/functions.h @@ -889,7 +889,7 @@ void Environment_DrawSkyboxFilters(GlobalContext* globalCtx); void Environment_UpdateLightningStrike(GlobalContext* globalCtx); void Environment_AddLightningBolts(GlobalContext* globalCtx, u8 num); void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused); -void func_800758AC(GlobalContext* globalCtx); +void Environment_PlaySceneSequence(GlobalContext* globalCtx); void Environment_DrawCustomLensFlare(GlobalContext* globalCtx); void Environment_InitGameOverLights(GlobalContext* globalCtx); void Environment_FadeInGameOverLights(GlobalContext* globalCtx); @@ -900,10 +900,10 @@ void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 s32 Environment_GetBgsDayCount(void); void Environment_ClearBgsDayCount(void); s32 Environment_GetTotalDays(void); -void Environment_ForcePlaySequence(u16); +void Environment_ForcePlaySequence(u16 seqId); s32 Environment_IsForcedSequenceDisabled(void); -void func_80077624(GlobalContext* globalCtx); -void func_80077684(GlobalContext* globalCtx); +void Environment_PlayStormNatureAmbience(GlobalContext* globalCtx); +void Environment_StopStormNatureAmbience(GlobalContext* globalCtx); void Environment_WarpSongLeave(GlobalContext* globalCtx); void Lib_MemSet(u8* dest, size_t size, u8 val); f32 Math_CosS(s16 angle); @@ -2055,9 +2055,9 @@ void func_800F5918(void); void func_800F595C(u16); void func_800F59E8(u16); s32 func_800F5A58(u8); -void func_800F5ACC(u16 bgmID); +void func_800F5ACC(u16 seqId); void func_800F5B58(void); -void func_800F5BF0(u8 arg0); +void func_800F5BF0(u8 natureAmbienceId); void Audio_PlayFanfare(u16); void func_800F5C2C(void); void func_800F5E18(u8 playerIdx, u16 seqId, u8 fadeTimer, s8 arg3, s8 arg4); @@ -2079,9 +2079,8 @@ void func_800F6AB0(u16); // ? func_800F6BB8(?); void Audio_PreNMI(); // ? func_800F6C34(?); -void func_800F6D58(u8, u8, u8); -// ? func_800F6E7C(?); -void func_800F6FB4(u8); +void Audio_SetNatureAmbienceChannelIO(u8 channelIdxRange, u8 port, u8 val); +void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId); void Audio_Init(); void Audio_InitSound(); void func_800F7170(void); diff --git a/include/sequence.h b/include/sequence.h index c29fb200ee..4112f74688 100644 --- a/include/sequence.h +++ b/include/sequence.h @@ -111,7 +111,7 @@ #define NA_BGM_STAFF_3 0x69 // End Credits III #define NA_BGM_STAFF_4 0x6A // End Credits IV #define NA_BGM_FIRE_BOSS 0x6B // King Dodongo & Volvagia Boss Battle "NA_BGM_BOSS01" -#define NA_BGM_MINI_GAME_2 0x6C // Mini-Game +#define NA_BGM_TIMED_MINI_GAME 0x6C // Mini-Game #define NA_BGM_VARIOUS_SFX 0x6D // A small collection of various sound effects #define NA_BGM_NO_MUSIC 0x7F // No bgm music is played #define NA_BGM_NATURE_SFX_RAIN 0x80 // Related to rain @@ -131,4 +131,130 @@ typedef enum { /* 3 */ SEQ_MODE_IGNORE } SequenceMode; +typedef enum { + /* 0x0 */ CHANNEL_IO_PORT_0, + /* 0x1 */ CHANNEL_IO_PORT_1, + /* 0x2 */ CHANNEL_IO_PORT_2, + /* 0x3 */ CHANNEL_IO_PORT_3, + /* 0x4 */ CHANNEL_IO_PORT_4, + /* 0x5 */ CHANNEL_IO_PORT_5, + /* 0x6 */ CHANNEL_IO_PORT_6, + /* 0x7 */ CHANNEL_IO_PORT_7 +} ChannelIOPort; + +typedef enum { + /* 0x0 */ NATURE_CHANNEL_STREAM_0, + /* 0x1 */ NATURE_CHANNEL_CRITTER_0, + /* 0x2 */ NATURE_CHANNEL_CRITTER_1, + /* 0x3 */ NATURE_CHANNEL_CRITTER_2, + /* 0x4 */ NATURE_CHANNEL_CRITTER_3, + /* 0x5 */ NATURE_CHANNEL_CRITTER_4, + /* 0x6 */ NATURE_CHANNEL_CRITTER_5, + /* 0x7 */ NATURE_CHANNEL_CRITTER_6, + /* 0x8 */ NATURE_CHANNEL_CRITTER_7, + /* 0xC */ NATURE_CHANNEL_STREAM_1 = 12, + /* 0xD */ NATURE_CHANNEL_UNK, + /* 0xE */ NATURE_CHANNEL_RAIN, + /* 0xF */ NATURE_CHANNEL_LIGHTNING +} NatureChannelIdx; // playerIdx = 0 (Overlaps with main bgm) + +typedef enum { + /* 0x00 */ NATURE_ID_GENERAL_NIGHT, + /* 0x01 */ NATURE_ID_MARKET_ENTRANCE, + /* 0x02 */ NATURE_ID_KAKARIKO_REGION, + /* 0x03 */ NATURE_ID_MARKET_RUINS, + /* 0x04 */ NATURE_ID_KOKIRI_REGION, + /* 0x05 */ NATURE_ID_MARKET_NIGHT, + /* 0x06 */ NATURE_ID_06, + /* 0x07 */ NATURE_ID_GANONS_LAIR, + /* 0x08 */ NATURE_ID_08, + /* 0x09 */ NATURE_ID_09, + /* 0x0A */ NATURE_ID_WASTELAND, + /* 0x0B */ NATURE_ID_COLOSSUS, + /* 0x0C */ NATURE_ID_DEATH_MOUNTAIN_TRAIL, + /* 0x0D */ NATURE_ID_0D, + /* 0x0E */ NATURE_ID_0E, + /* 0x0F */ NATURE_ID_0F, + /* 0x10 */ NATURE_ID_10, + /* 0x11 */ NATURE_ID_11, + /* 0x12 */ NATURE_ID_12, + /* 0x13 */ NATURE_ID_NONE, + /* 0xFF */ NATURE_ID_DISABLED = 0xFF +} NatureAmbienceId; + +typedef enum { + /* 0x00 */ NATURE_STREAM_RUSHING_WATER, + /* 0x01 */ NATURE_STREAM_HOWLING_WIND, + /* 0x02 */ NATURE_STREAM_SCREECHING_WIND, + /* 0x03 */ NATURE_STREAM_SCREECHING_WIND_ALT1 +} NatureStreamId; + +typedef enum { + /* 0x00 */ NATURE_CRITTER_BIRD_CHIRP_1, + /* 0x01 */ NATURE_CRITTER_TAP, + /* 0x02 */ NATURE_CRITTER_BIRD_CHIRP_2, + /* 0x03 */ NATURE_CRITTER_BIRD_CHIRP_1_ALT1, + /* 0x04 */ NATURE_CRITTER_CRICKETS, + /* 0x05 */ NATURE_CRITTER_BIRD_CHIRP_1_ALT2, + /* 0x06 */ NATURE_CRITTER_LOUD_CHIRPING, + /* 0x07 */ NATURE_CRITTER_BIRD_CHIRP_1_ALT3, + /* 0x08 */ NATURE_CRITTER_BIRD_CHIRP_1_ALT4, + /* 0x09 */ NATURE_CRITTER_CROWS_CAWS, + /* 0x0A */ NATURE_CRITTER_SMALL_BIRD_CHIRPS, + /* 0x0B */ NATURE_CRITTER_BIRD_SCREECH, + /* 0x0C */ NATURE_CRITTER_BIRD_SONG, + /* 0x0D */ NATURE_CRITTER_OWL_HOOT, + /* 0x0E */ NATURE_CRITTER_HAWK_SCREECH, + /* 0x0F */ NATURE_CRITTER_BIRD_CALL, + /* 0x10 */ NATURE_CRITTER_CAWING_BIRD, + /* 0x11 */ NATURE_CRITTER_CUCCO_CROWS, + /* 0x12 */ NATURE_CRITTER_BIRD_CHIRP_2_ALT1, + /* 0x13 */ NATURE_CRITTER_BIRD_CHIRP_1_ALT5 +} NatureAmimalId; + +#define NATURE_IO_CRITTER_0_TYPE(type) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_2, type +#define NATURE_IO_CRITTER_0_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_3, bend +#define NATURE_IO_CRITTER_0_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_4, num +#define NATURE_IO_CRITTER_0_PORT5(reverb) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_5, reverb + +#define NATURE_IO_CRITTER_1_TYPE(type) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_2, type +#define NATURE_IO_CRITTER_1_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_3, bend +#define NATURE_IO_CRITTER_1_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_4, num +#define NATURE_IO_CRITTER_1_PORT5(reverb) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_5, reverb + +#define NATURE_IO_CRITTER_2_TYPE(type) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_2, type +#define NATURE_IO_CRITTER_2_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_3, bend +#define NATURE_IO_CRITTER_2_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_4, num +#define NATURE_IO_CRITTER_2_PORT5(reverb) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_5, reverb + +#define NATURE_IO_CRITTER_3_TYPE(type) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_2, type +#define NATURE_IO_CRITTER_3_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_3, bend +#define NATURE_IO_CRITTER_3_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_4, num +#define NATURE_IO_CRITTER_3_PORT5(reverb) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_5, reverb + +#define NATURE_IO_CRITTER_4_TYPE(type) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_2, type +#define NATURE_IO_CRITTER_4_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_3, bend +#define NATURE_IO_CRITTER_4_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_4, num +#define NATURE_IO_CRITTER_4_PORT5(reverb) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_5, reverb + +#define NATURE_IO_CRITTER_5_TYPE(type) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_2, type +#define NATURE_IO_CRITTER_5_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_3, bend +#define NATURE_IO_CRITTER_5_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_4, num +#define NATURE_IO_CRITTER_5_PORT5(reverb) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_5, reverb + +#define NATURE_IO_CRITTER_6_TYPE(type) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_2, type +#define NATURE_IO_CRITTER_6_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_3, bend +#define NATURE_IO_CRITTER_6_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_4, num +#define NATURE_IO_CRITTER_6_PORT5(reverb) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_5, reverb + +#define NATURE_IO_STREAM_0_TYPE(type) NATURE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_2, type +#define NATURE_IO_STREAM_0_PORT3(data) NATURE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_3, data +#define NATURE_IO_STREAM_0_PORT4(data) NATURE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_4, data + +#define NATURE_IO_STREAM_1_TYPE(type) NATURE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_2, type +#define NATURE_IO_STREAM_1_PORT3(data) NATURE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_3, data +#define NATURE_IO_STREAM_1_PORT4(data) NATURE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_4, data + +#define NATURE_IO_ENTRIES_END 0xFF + #endif diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c index 4c0c7b5d82..f10ebe3499 100644 --- a/src/code/code_800EC960.c +++ b/src/code/code_800EC960.c @@ -41,10 +41,10 @@ typedef struct { } FreqLerp; typedef struct { - /* 0x0 */ u16 unk_00; - /* 0x2 */ u16 unk_02; - /* 0x4 */ u8 unk_04[100]; -} D_801306DC_s; // size = 0x68 + /* 0x0 */ u16 playerIO; + /* 0x2 */ u16 channelMask; + /* 0x4 */ u8 channelIO[3 * 33 + 1]; +} NatureAmbienceDataIO; // size = 0x68 typedef enum { /* 0x0 */ PAGE_NON, @@ -124,7 +124,7 @@ s8 sAudioCodeReverb = 0; u8 sPrevSeqMode = 0; f32 sAudioEnemyDist = 0.0f; s8 sAudioEnemyVol = 127; -u16 D_80130628 = NA_BGM_DISABLED; +u16 sPrevMainBgmSeqId = NA_BGM_DISABLED; u8 D_8013062C = 0; u8 D_80130630 = NA_BGM_GENERAL_SFX; u32 sNumFramesStill = 0; @@ -245,49 +245,585 @@ u8 sSeqFlags[0x6E] = { 0, // NA_BGM_STAFF_3 0, // NA_BGM_STAFF_4 0, // NA_BGM_FIRE_BOSS - 0x8, // NA_BGM_MINI_GAME_2 + 0x8, // NA_BGM_TIMED_MINI_GAME 0, // NA_BGM_VARIOUS_SFX }; s8 sSpecReverbs[20] = { 0, 0, 0, 0, 0, 0, 0, 40, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -D_801306DC_s D_801306DC[20] = { - { 0xC0FF, 0xC0FE, { 0, 2, 0, 0, 3, 0, 1, 2, 9, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 4, 2, 3, - 0, 2, 4, 1, 2, 5, 16, 3, 2, 10, 3, 3, 112, 3, 4, 1, 3, 5, 48, 4, 2, 14, 4, - 3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16, 6, 2, 1, - 6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } }, - { 0xC0FB, 0xC0FA, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 3, 2, 11, 3, 3, 112, 3, 4, 1, - 3, 5, 48, 4, 2, 14, 4, 3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16, - 6, 2, 1, 6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } }, - { 0xC001, 0x4000, { 0, 2, 0, 0, 3, 0, 2, 2, 11, 2, 3, 48, 2, 4, 1, 2, 5, 32, 0xFF } }, - { 0xC005, 0x4000, { 0, 2, 1, 0, 3, 32, 2, 2, 11, 2, 3, 48, 2, 4, 1, 2, 5, 32, 0xFF } }, - { 0xC01F, - 0xC000, - { 0, 2, 0, 0, 3, 47, 1, 2, 13, 1, 3, 0, 1, 4, 1, 1, 5, 16, 2, 2, 16, 2, 3, 0, 2, 4, 1, 2, - 5, 32, 3, 2, 14, 3, 3, 0, 3, 4, 0, 3, 5, 44, 4, 2, 11, 4, 3, 63, 4, 4, 1, 4, 5, 44, 0xFF } }, - { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xC0FB, 0xC0FA, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 3, 2, 11, 3, 3, 112, 3, 4, 1, - 3, 5, 48, 4, 2, 14, 4, 3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16, - 6, 2, 1, 6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } }, - { 0x8001, 0x0, { 0, 2, 1, 0, 3, 32, 0xFF } }, - { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xC001, 0xC000, { 0, 2, 2, 0, 3, 0, 0, 4, 0, 0xFF } }, - { 0xC02F, 0xC02E, { 0, 2, 2, 0, 3, 0, 0, 4, 0, 1, 2, 10, 1, 3, 64, 1, 4, 0, 1, 5, - 32, 2, 2, 15, 2, 3, 112, 2, 4, 1, 2, 5, 48, 3, 2, 14, 3, 3, 127, 3, - 4, 0, 3, 5, 16, 5, 2, 4, 5, 3, 127, 5, 4, 0, 5, 5, 16, 0xFF } }, - { 0xC07F, 0xC07E, { 0, 2, 0, 0, 3, 0, 0, 4, 0, 1, 2, 10, 1, 3, 64, 1, 4, 0, 1, 5, 32, - 2, 2, 11, 2, 3, 112, 2, 4, 1, 2, 5, 48, 3, 2, 12, 3, 3, 127, 3, 4, 0, - 3, 5, 16, 4, 2, 6, 4, 3, 0, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 0, - 5, 4, 0, 5, 5, 16, 6, 2, 1, 6, 3, 0, 6, 4, 0, 6, 5, 16, 0xFF } }, - { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xC01F, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 0, 1, 3, 80, 1, 4, 1, 1, 5, 8, 2, 2, 10, 2, 3, 80, 2, 4, 1, 2, - 5, 48, 3, 2, 6, 3, 3, 0, 3, 4, 0, 3, 5, 0, 4, 2, 11, 4, 3, 96, 4, 4, 0, 4, 5, 32, 0xFF } }, - { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, +NatureAmbienceDataIO sNatureAmbienceDataIO[20] = { + // NATURE_ID_GENERAL_NIGHT + { + 0xC0FF, // PlayerIO Data + 0xC0FE, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CROWS_CAWS), + NATURE_IO_CRITTER_0_BEND_PITCH(64), + NATURE_IO_CRITTER_0_NUM_LAYERS(0), + NATURE_IO_CRITTER_0_PORT5(32), + + // Channel 2 + NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_1_BEND_PITCH(0), + NATURE_IO_CRITTER_1_NUM_LAYERS(1), + NATURE_IO_CRITTER_1_PORT5(16), + + // Channel 3 + NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_SMALL_BIRD_CHIRPS), + NATURE_IO_CRITTER_2_BEND_PITCH(112), + NATURE_IO_CRITTER_2_NUM_LAYERS(1), + NATURE_IO_CRITTER_2_PORT5(48), + + // Channel 4 + NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_HAWK_SCREECH), + NATURE_IO_CRITTER_3_BEND_PITCH(127), + NATURE_IO_CRITTER_3_NUM_LAYERS(0), + NATURE_IO_CRITTER_3_PORT5(16), + + // Channel 5 + NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_BIRD_CHIRP_1), + NATURE_IO_CRITTER_4_BEND_PITCH(127), + NATURE_IO_CRITTER_4_NUM_LAYERS(1), + NATURE_IO_CRITTER_4_PORT5(16), + + // Channel 6 + NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_TAP), + NATURE_IO_CRITTER_5_BEND_PITCH(127), + NATURE_IO_CRITTER_5_NUM_LAYERS(3), + NATURE_IO_CRITTER_5_PORT5(16), + + // Channel 7 + NATURE_IO_CRITTER_6_TYPE(NATURE_CRITTER_CUCCO_CROWS), + NATURE_IO_CRITTER_6_BEND_PITCH(127), + NATURE_IO_CRITTER_6_NUM_LAYERS(1), + NATURE_IO_CRITTER_6_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_MARKET_ENTRANCE + { + 0xC0FB, // PlayerIO Data + 0xC0FA, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // Channel 3 + NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_BIRD_SCREECH), + NATURE_IO_CRITTER_2_BEND_PITCH(112), + NATURE_IO_CRITTER_2_NUM_LAYERS(1), + NATURE_IO_CRITTER_2_PORT5(48), + + // Channel 4 + NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_HAWK_SCREECH), + NATURE_IO_CRITTER_3_BEND_PITCH(127), + NATURE_IO_CRITTER_3_NUM_LAYERS(0), + NATURE_IO_CRITTER_3_PORT5(16), + + // Channel 5 + NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_BIRD_CHIRP_1), + NATURE_IO_CRITTER_4_BEND_PITCH(127), + NATURE_IO_CRITTER_4_NUM_LAYERS(1), + NATURE_IO_CRITTER_4_PORT5(16), + + // Channel 6 + NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_TAP), + NATURE_IO_CRITTER_5_BEND_PITCH(127), + NATURE_IO_CRITTER_5_NUM_LAYERS(3), + NATURE_IO_CRITTER_5_PORT5(16), + + // Channel 7 + NATURE_IO_CRITTER_6_TYPE(NATURE_CRITTER_CUCCO_CROWS), + NATURE_IO_CRITTER_6_BEND_PITCH(127), + NATURE_IO_CRITTER_6_NUM_LAYERS(1), + NATURE_IO_CRITTER_6_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_KAKARIKO_REGION + { + 0xC001, // PlayerIO Data + 0x4000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 2 + NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_BIRD_SCREECH), + NATURE_IO_CRITTER_1_BEND_PITCH(48), + NATURE_IO_CRITTER_1_NUM_LAYERS(1), + NATURE_IO_CRITTER_1_PORT5(32), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_MARKET_RUINS + { + 0xC005, // PlayerIO Data + 0x4000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_HOWLING_WIND), + NATURE_IO_STREAM_0_PORT3(32), + + // Channel 2 + NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_BIRD_SCREECH), + NATURE_IO_CRITTER_1_BEND_PITCH(48), + NATURE_IO_CRITTER_1_NUM_LAYERS(1), + NATURE_IO_CRITTER_1_PORT5(32), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_KOKIRI_REGION + { + 0xC01F, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(47), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_OWL_HOOT), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // Channel 2 + NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_CAWING_BIRD), + NATURE_IO_CRITTER_1_BEND_PITCH(0), + NATURE_IO_CRITTER_1_NUM_LAYERS(1), + NATURE_IO_CRITTER_1_PORT5(32), + + // Channel 3 + NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_HAWK_SCREECH), + NATURE_IO_CRITTER_2_BEND_PITCH(0), + NATURE_IO_CRITTER_2_NUM_LAYERS(0), + NATURE_IO_CRITTER_2_PORT5(44), + + // Channel 4 + NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_BIRD_SCREECH), + NATURE_IO_CRITTER_3_BEND_PITCH(63), + NATURE_IO_CRITTER_3_NUM_LAYERS(1), + NATURE_IO_CRITTER_3_PORT5(44), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_MARKET_NIGHT + { + 0xC003, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_06 + { + 0xC0FB, // PlayerIO Data + 0xC0FA, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // Channel 3 + NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_BIRD_SCREECH), + NATURE_IO_CRITTER_2_BEND_PITCH(112), + NATURE_IO_CRITTER_2_NUM_LAYERS(1), + NATURE_IO_CRITTER_2_PORT5(48), + + // Channel 4 + NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_HAWK_SCREECH), + NATURE_IO_CRITTER_3_BEND_PITCH(127), + NATURE_IO_CRITTER_3_NUM_LAYERS(0), + NATURE_IO_CRITTER_3_PORT5(16), + + // Channel 5 + NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_BIRD_CHIRP_1), + NATURE_IO_CRITTER_4_BEND_PITCH(127), + NATURE_IO_CRITTER_4_NUM_LAYERS(1), + NATURE_IO_CRITTER_4_PORT5(16), + + // Channel 6 + NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_TAP), + NATURE_IO_CRITTER_5_BEND_PITCH(127), + NATURE_IO_CRITTER_5_NUM_LAYERS(3), + NATURE_IO_CRITTER_5_PORT5(16), + + // Channel 7 + NATURE_IO_CRITTER_6_TYPE(NATURE_CRITTER_CUCCO_CROWS), + NATURE_IO_CRITTER_6_BEND_PITCH(127), + NATURE_IO_CRITTER_6_NUM_LAYERS(1), + NATURE_IO_CRITTER_6_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_GANONS_LAIR + { + 0x8001, // PlayerIO Data + 0x0, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_HOWLING_WIND), + NATURE_IO_STREAM_0_PORT3(32), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_08 + { + 0xC003, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_09 + { + 0xC003, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_WASTELAND + { + 0xC001, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_SCREECHING_WIND), + NATURE_IO_STREAM_0_PORT3(0), + NATURE_IO_STREAM_0_PORT4(0), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_COLOSSUS + { + 0xC02F, // PlayerIO Data + 0xC02E, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_SCREECHING_WIND), + NATURE_IO_STREAM_0_PORT3(0), + NATURE_IO_STREAM_0_PORT4(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_SMALL_BIRD_CHIRPS), + NATURE_IO_CRITTER_0_BEND_PITCH(64), + NATURE_IO_CRITTER_0_NUM_LAYERS(0), + NATURE_IO_CRITTER_0_PORT5(32), + + // Channel 2 + NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_BIRD_CALL), + NATURE_IO_CRITTER_1_BEND_PITCH(112), + NATURE_IO_CRITTER_1_NUM_LAYERS(1), + NATURE_IO_CRITTER_1_PORT5(48), + + // Channel 3 + NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_HAWK_SCREECH), + NATURE_IO_CRITTER_2_BEND_PITCH(127), + NATURE_IO_CRITTER_2_NUM_LAYERS(0), + NATURE_IO_CRITTER_2_PORT5(16), + + // Channel 5 + NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_4_BEND_PITCH(127), + NATURE_IO_CRITTER_4_NUM_LAYERS(0), + NATURE_IO_CRITTER_4_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_DEATH_MOUNTAIN_TRAIL + { + 0xC07F, // PlayerIO Data + 0xC07E, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + NATURE_IO_STREAM_0_PORT4(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_SMALL_BIRD_CHIRPS), + NATURE_IO_CRITTER_0_BEND_PITCH(64), + NATURE_IO_CRITTER_0_NUM_LAYERS(0), + NATURE_IO_CRITTER_0_PORT5(32), + + // Channel 2 + NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_BIRD_SCREECH), + NATURE_IO_CRITTER_1_BEND_PITCH(112), + NATURE_IO_CRITTER_1_NUM_LAYERS(1), + NATURE_IO_CRITTER_1_PORT5(48), + + // Channel 3 + NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_BIRD_SONG), + NATURE_IO_CRITTER_2_BEND_PITCH(127), + NATURE_IO_CRITTER_2_NUM_LAYERS(0), + NATURE_IO_CRITTER_2_PORT5(16), + + // Channel 4 + NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_LOUD_CHIRPING), + NATURE_IO_CRITTER_3_BEND_PITCH(0), + NATURE_IO_CRITTER_3_NUM_LAYERS(0), + NATURE_IO_CRITTER_3_PORT5(16), + + // Channel 5 + NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_BIRD_CHIRP_1), + NATURE_IO_CRITTER_4_BEND_PITCH(0), + NATURE_IO_CRITTER_4_NUM_LAYERS(0), + NATURE_IO_CRITTER_4_PORT5(16), + + // Channel 6 + NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_TAP), + NATURE_IO_CRITTER_5_BEND_PITCH(0), + NATURE_IO_CRITTER_5_NUM_LAYERS(0), + NATURE_IO_CRITTER_5_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_0D + { + 0xC003, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_0E + { + 0xC003, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_0F + { + 0xC01F, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_BIRD_CHIRP_1), + NATURE_IO_CRITTER_0_BEND_PITCH(80), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(8), + + // Channel 2 + NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_SMALL_BIRD_CHIRPS), + NATURE_IO_CRITTER_1_BEND_PITCH(80), + NATURE_IO_CRITTER_1_NUM_LAYERS(1), + NATURE_IO_CRITTER_1_PORT5(48), + + // Channel 3 + NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_LOUD_CHIRPING), + NATURE_IO_CRITTER_2_BEND_PITCH(0), + NATURE_IO_CRITTER_2_NUM_LAYERS(0), + NATURE_IO_CRITTER_2_PORT5(0), + + // Channel 4 + NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_BIRD_SCREECH), + NATURE_IO_CRITTER_3_BEND_PITCH(96), + NATURE_IO_CRITTER_3_NUM_LAYERS(0), + NATURE_IO_CRITTER_3_PORT5(32), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_10 + { + 0xC003, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_11 + { + 0xC003, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_12 + { + 0xC003, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, + + // NATURE_ID_NONE + // While there is data for this natureAmbienceId, it is identical to previous entries + // and the game treats it as no nature ambience + { + 0xC003, // PlayerIO Data + 0xC000, // Channel Mask + { + // Channel 0 + NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_RUSHING_WATER), + NATURE_IO_STREAM_0_PORT3(0), + + // Channel 1 + NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_CRICKETS), + NATURE_IO_CRITTER_0_BEND_PITCH(0), + NATURE_IO_CRITTER_0_NUM_LAYERS(1), + NATURE_IO_CRITTER_0_PORT5(16), + + // End + NATURE_IO_ENTRIES_END, + }, + }, }; u32 sOcarinaAllowedBtnMask = 0x800F; @@ -711,7 +1247,7 @@ void PadMgr_RequestPadData(PadMgr* padmgr, Input* inputs, s32 mode); void Audio_StepFreqLerp(FreqLerp* lerp); void func_800F56A8(void); -void func_800F6FB4(u8); +void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId); s32 Audio_SetGanonDistVol(u8 targetVol); void func_800EC960(u8 custom) { @@ -1637,7 +2173,7 @@ char sAudioSceneNames[3][2] = { "A", "S", "X" }; u8 sAudioBlkChgBgmWork[2] = { 0 }; u8 sAudioBlkChgBgmSel = 0; char sBoolStrs[3][5] = { "OFF", "ON", "STBY" }; -u8 sAudioNatureFailed = 0; +u8 sAudioNatureFailed = false; u8 sPeakNumNotes = 0; void AudioDebug_SetInput(void) { @@ -2333,7 +2869,7 @@ void AudioDebug_Draw(GfxPrint* printer) { } GfxPrint_SetPos(printer, 3, 23); - if (sAudioNatureFailed != 0) { + if (sAudioNatureFailed != false) { GfxPrint_Printf(printer, "NATURE FAILED %01x", sAudioNatureFailed); } @@ -2446,7 +2982,7 @@ void AudioDebug_ProcessInput_SndCont(void) { } break; case 7: - func_800F6FB4(sAudioSndContWork[sAudioSndContSel]); + Audio_PlayNatureAmbienceSequence(sAudioSndContWork[sAudioSndContSel]); break; case 8: case 9: @@ -3872,7 +4408,7 @@ void func_800F574C(f32 arg0, u8 arg2) { } void func_800F5918(void) { - if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_MINI_GAME_2 && func_800FA11C(0, 0xF0000000)) { + if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_TIMED_MINI_GAME && func_800FA11C(0, 0xF0000000)) { Audio_SeqCmdB(SEQ_PLAYER_BGM_MAIN, 5, 0, 0xD2); } } @@ -3919,48 +4455,62 @@ s32 func_800F5A58(u8 arg0) { } } +/** + * Plays a sequence on the main bgm player, but stores the previous sequence to return to later + * Designed for the mini-boss sequence, but also used by mini-game 2 sequence + */ void func_800F5ACC(u16 seqId) { - u16 temp_v0; + u16 curSeqId = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); - temp_v0 = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); - if ((temp_v0 & 0xFF) != NA_BGM_GANON_TOWER && (temp_v0 & 0xFF) != NA_BGM_ESCAPE && temp_v0 != seqId) { + if ((curSeqId & 0xFF) != NA_BGM_GANON_TOWER && (curSeqId & 0xFF) != NA_BGM_ESCAPE && curSeqId != seqId) { Audio_SetSequenceMode(SEQ_MODE_IGNORE); - if (temp_v0 != NA_BGM_DISABLED) { - D_80130628 = temp_v0; + if (curSeqId != NA_BGM_DISABLED) { + sPrevMainBgmSeqId = curSeqId; } else { osSyncPrintf("Middle Boss BGM Start not stack \n"); } + Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, seqId); } } +/** + * Restores the previous sequence to the main bgm player before func_800F5ACC was called + */ void func_800F5B58(void) { - if ((func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && (D_80130628 != NA_BGM_DISABLED) && + if ((func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && (sPrevMainBgmSeqId != NA_BGM_DISABLED) && (sSeqFlags[func_800FA0B4(SEQ_PLAYER_BGM_MAIN) & 0xFF] & 8)) { - if (D_80130628 == NA_BGM_DISABLED) { + if (sPrevMainBgmSeqId == NA_BGM_DISABLED) { Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0); } else { - Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, D_80130628); + Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, sPrevMainBgmSeqId); } - D_80130628 = NA_BGM_DISABLED; + + sPrevMainBgmSeqId = NA_BGM_DISABLED; } } -void func_800F5BF0(u8 arg0) { - u16 temp_v0; +/** + * Plays the nature ambience sequence on the main bgm player, but stores the previous sequence to return to later + */ +void func_800F5BF0(u8 natureAmbienceId) { + u16 curSeqId = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); - temp_v0 = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); - if (temp_v0 != NA_BGM_NATURE_AMBIENCE) { - D_80130628 = temp_v0; + if (curSeqId != NA_BGM_NATURE_AMBIENCE) { + sPrevMainBgmSeqId = curSeqId; } - func_800F6FB4(arg0); + + Audio_PlayNatureAmbienceSequence(natureAmbienceId); } +/** + * Restores the previous sequence to the main bgm player before func_800F5BF0 was called + */ void func_800F5C2C(void) { - if (D_80130628 != NA_BGM_DISABLED) { - Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, D_80130628); + if (sPrevMainBgmSeqId != NA_BGM_DISABLED) { + Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, sPrevMainBgmSeqId); } - D_80130628 = NA_BGM_DISABLED; + sPrevMainBgmSeqId = NA_BGM_DISABLED; } void Audio_PlayFanfare(u16 seqId) { @@ -4024,7 +4574,7 @@ void Audio_SetSequenceMode(u8 seqMode) { u8 volumeFadeOutTimer; sSeqModeInput = seqMode; - if (D_80130628 == NA_BGM_DISABLED) { + if (sPrevMainBgmSeqId == NA_BGM_DISABLED) { if (sAudioCutsceneFlag) { seqMode = SEQ_MODE_IGNORE; } @@ -4378,7 +4928,7 @@ void func_800F6C34(void) { D_8016B9D8 = 0; sSpecReverb = sSpecReverbs[gAudioSpecId]; D_80130608 = 0; - D_80130628 = NA_BGM_DISABLED; + sPrevMainBgmSeqId = NA_BGM_DISABLED; Audio_QueueCmdS8(0x46 << 24 | SEQ_PLAYER_BGM_MAIN << 16, -1); sSariaBgmPtr = NULL; D_8016B9F4 = 0; @@ -4386,83 +4936,88 @@ void func_800F6C34(void) { D_8016B9F2 = 0; } -void func_800F6D58(u8 arg0, u8 arg1, u8 arg2) { - u8 t; - u8 temp_a0; - u8 i; +void Audio_SetNatureAmbienceChannelIO(u8 channelIdxRange, u8 port, u8 val) { + u8 firstChannelIdx; + u8 lastChannelIdx; + u8 channelIdx; if ((D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_AMBIENCE) && func_800FA11C(1, 0xF00000FF)) { - sAudioNatureFailed = 1; + sAudioNatureFailed = true; return; } - if (((arg0 << 8) + arg1) == 0x101) { + // channelIdxRange = 01 on port 1 + if (((channelIdxRange << 8) + port) == ((NATURE_CHANNEL_CRITTER_0 << 8) + CHANNEL_IO_PORT_1)) { if (func_800FA0B4(SEQ_PLAYER_BGM_SUB) != NA_BGM_LONLON) { D_8016B9D8 = 0; } } - t = arg0 >> 4; - temp_a0 = arg0 & 0xF; - if (t == 0) { - t = arg0 & 0xF; + firstChannelIdx = channelIdxRange >> 4; + lastChannelIdx = channelIdxRange & 0xF; + + if (firstChannelIdx == 0) { + firstChannelIdx = channelIdxRange & 0xF; } - for (i = t; i <= temp_a0; i++) { - Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, arg1, i, arg2); + for (channelIdx = firstChannelIdx; channelIdx <= lastChannelIdx; channelIdx++) { + Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, port, channelIdx, val); } } -void func_800F6E7C(u16 arg0, u16 arg1) { - u8 i; - u32 t; +void Audio_StartNatureAmbienceSequence(u16 playerIO, u16 channelMask) { + u8 channelIdx; if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_WINDMILL) { func_800F3F3C(0xF); return; } + Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 0, 1); - Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 4, arg0 >> 8); - Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 5, arg0 & 0xFF); + Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 4, playerIO >> 8); + Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 5, playerIO & 0xFF); Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 1); - i = 0; + channelIdx = false; if (D_80133408 != 0) { - i = 1; + channelIdx = true; Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, 0); } Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_NATURE_AMBIENCE); - if (i != 0) { + if (channelIdx) { Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, 1); } - for (i = 0; i < 0x10; i++) { - if (!(arg1 & (1 << i)) && (arg0 & (1 << i))) { - Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, 1, i, 1); + for (channelIdx = 0; channelIdx < 16; channelIdx++) { + if (!(channelMask & (1 << channelIdx)) && (playerIO & (1 << channelIdx))) { + Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, CHANNEL_IO_PORT_1, channelIdx, 1); } } } -void func_800F6FB4(u8 arg0) { +void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId) { u8 i = 0; - u8 b0; - u8 b1; - u8 b2; + u8 channelIdx; + u8 port; + u8 val; if ((D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 == NA_BGM_DISABLED) || !(sSeqFlags[((u8)D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254) & 0xFF] & 0x80)) { - func_800F6E7C(D_801306DC[arg0].unk_00, D_801306DC[arg0].unk_02); - while ((D_801306DC[arg0].unk_04[i] != 0xFF) && (i < 100)) { + + Audio_StartNatureAmbienceSequence(sNatureAmbienceDataIO[natureAmbienceId].playerIO, + sNatureAmbienceDataIO[natureAmbienceId].channelMask); + + while ((sNatureAmbienceDataIO[natureAmbienceId].channelIO[i] != 0xFF) && (i < 100)) { // Probably a fake match, using Audio_SeqCmd8 doesn't work. - b0 = D_801306DC[arg0].unk_04[i++]; - b1 = D_801306DC[arg0].unk_04[i++]; - b2 = D_801306DC[arg0].unk_04[i++]; - Audio_QueueSeqCmd(0x80000000 | (SEQ_PLAYER_BGM_MAIN << 24) | (b1 << 0x10) | (b0 << 8) | b2); + channelIdx = sNatureAmbienceDataIO[natureAmbienceId].channelIO[i++]; + port = sNatureAmbienceDataIO[natureAmbienceId].channelIO[i++]; + val = sNatureAmbienceDataIO[natureAmbienceId].channelIO[i++]; + Audio_QueueSeqCmd(0x80000000 | (SEQ_PLAYER_BGM_MAIN << 24) | (port << 0x10) | (channelIdx << 8) | val); } - Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, 0x07, 13, D_80130604); + Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, CHANNEL_IO_PORT_7, NATURE_CHANNEL_UNK, D_80130604); } } diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index fbe01f7c7f..216a5ac9a4 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -9,7 +9,7 @@ void SaveContext_Init(void) { D_8015FA88 = 0; D_8015FA8C = 0; gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; gSaveContext.nextCutsceneIndex = 0xFFEF; gSaveContext.cutsceneTrigger = 0; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index be8b68c6ed..1efc88b626 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -227,14 +227,14 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* switch (cmd->base) { case 1: if (sp3F != 0) { - func_800F6D58(0xE, 4, 0x3F); - func_800F6D58(0xE, 1, 1); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_4, 0x3F); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 1); globalCtx->envCtx.unk_EE[0] = 20; } break; case 2: if (sp3F != 0) { - func_800F6D58(0xF, 0, 0); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); Environment_AddLightningBolts(globalCtx, 3); gLightningStrike.state = LIGHTNING_STRIKE_START; } @@ -332,7 +332,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } if (globalCtx->envCtx.unk_EE[1] == 0) { gWeatherMode = 0; - func_800F6D58(14, 1, 0); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); } break; case 19: diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index e9a0eef644..3605c5bd6f 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -63,7 +63,7 @@ void GameOver_Update(GlobalContext* globalCtx) { gSaveContext.nayrusLoveTimer = 2000; gSaveContext.naviTimer = 0; gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; gSaveContext.eventInf[0] = 0; gSaveContext.eventInf[1] = 0; gSaveContext.eventInf[2] = 0; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 99d5dffa8f..e71139e343 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1778,7 +1778,7 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) { sLightningFlashAlpha += 100; if (sLightningFlashAlpha >= gLightningStrike.flashAlphaTarget) { - func_800F6D58(15, 0, 0); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); gLightningStrike.state++; gLightningStrike.flashAlphaTarget = 0; } @@ -1916,25 +1916,25 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3353); } -void func_800758AC(GlobalContext* globalCtx) { +void Environment_PlaySceneSequence(GlobalContext* globalCtx) { globalCtx->envCtx.unk_E0 = 0xFF; // both lost woods exits on the bridge from kokiri to hyrule field if (((void)0, gSaveContext.entranceIndex) == 0x4DE || ((void)0, gSaveContext.entranceIndex) == 0x5E0) { - func_800F6FB4(4); + Audio_PlayNatureAmbienceSequence(NATURE_ID_KOKIRI_REGION); } else if (((void)0, gSaveContext.forcedSeqId) != NA_BGM_GENERAL_SFX) { if (!Environment_IsForcedSequenceDisabled()) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | (s32)((void)0, gSaveContext.forcedSeqId)); } gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; } else if (globalCtx->sequenceCtx.seqId == NA_BGM_NO_MUSIC) { - if (globalCtx->sequenceCtx.natureAmbienceId == 0x13) { + if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { return; } if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) { - func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId); + Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); } - } else if (globalCtx->sequenceCtx.natureAmbienceId == 0x13) { + } else if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { // "BGM Configuration" osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", globalCtx->sequenceCtx.seqId, ((void)0, gSaveContext.seqId)); @@ -1949,7 +1949,7 @@ void func_800758AC(GlobalContext* globalCtx) { globalCtx->envCtx.unk_E0 = 1; } else { if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) { - func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId); + Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); } if (((void)0, gSaveContext.dayTime) > 0xB71C && ((void)0, gSaveContext.dayTime) < 0xCAAC) { @@ -1974,7 +1974,8 @@ void func_800758AC(GlobalContext* globalCtx) { void func_80075B44(GlobalContext* globalCtx) { switch (globalCtx->envCtx.unk_E0) { case 0: - func_800F6D58(86, 1, 0); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5, + CHANNEL_IO_PORT_1, 0); if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n"); func_800F5510(globalCtx->sequenceCtx.seqId); @@ -1997,8 +1998,8 @@ void func_80075B44(GlobalContext* globalCtx) { break; case 3: if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { - func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId); - func_800F6D58(1, 1, 1); + Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_1, 1); } globalCtx->envCtx.unk_E0++; break; @@ -2008,9 +2009,10 @@ void func_80075B44(GlobalContext* globalCtx) { } break; case 5: - func_800F6D58(1, 1, 0); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_1, 0); if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { - func_800F6D58(36, 1, 1); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3, + CHANNEL_IO_PORT_1, 1); } globalCtx->envCtx.unk_E0++; break; @@ -2029,9 +2031,11 @@ void func_80075B44(GlobalContext* globalCtx) { } break; case 7: - func_800F6D58(36, 1, 0); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3, + CHANNEL_IO_PORT_1, 0); if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { - func_800F6D58(86, 1, 1); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5, + CHANNEL_IO_PORT_1, 1); } globalCtx->envCtx.unk_E0++; break; @@ -2404,24 +2408,24 @@ s32 Environment_IsForcedSequenceDisabled(void) { return isDisabled; } -void func_80077624(GlobalContext* globalCtx) { - if (globalCtx->sequenceCtx.natureAmbienceId == 19) { - func_800F6FB4(5); +void Environment_PlayStormNatureAmbience(GlobalContext* globalCtx) { + if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) { + Audio_PlayNatureAmbienceSequence(NATURE_ID_MARKET_NIGHT); } else { - func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId); + Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId); } - func_800F6D58(14, 1, 1); - func_800F6D58(15, 1, 1); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 1); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 1); } -void func_80077684(GlobalContext* globalCtx) { - func_800F6D58(14, 1, 0); - func_800F6D58(15, 1, 0); +void Environment_StopStormNatureAmbience(GlobalContext* globalCtx) { + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0); if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) { gSaveContext.seqId = NA_BGM_NATURE_SFX_RAIN; - func_800758AC(globalCtx); + Environment_PlaySceneSequence(globalCtx); } } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 03fa51887d..45983cc03f 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -4161,7 +4161,7 @@ void Interface_Update(GlobalContext* globalCtx) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; func_800F6964(30); gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } else { gSaveContext.sunsSongState = SUNSSONG_SPECIAL; } diff --git a/src/code/z_play.c b/src/code/z_play.c index de86b1b2e6..787bbb1865 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -392,7 +392,7 @@ void Gameplay_Init(GameState* thisx) { } Interface_SetSceneRestrictions(globalCtx); - func_800758AC(globalCtx); + Environment_PlaySceneSequence(globalCtx); gSaveContext.seqId = globalCtx->sequenceCtx.seqId; gSaveContext.natureAmbienceId = globalCtx->sequenceCtx.natureAmbienceId; func_8002DF18(globalCtx, GET_PLAYER(globalCtx)); @@ -484,7 +484,7 @@ void Gameplay_Update(GlobalContext* globalCtx) { osSyncPrintf("\n\n\nサウンドイニシャル来ました。222"); func_800F6964(0x14); gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } } } diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index aab1368fa1..7659321937 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -414,7 +414,7 @@ void func_809EE800(EnDivingGame* this, GlobalContext* globalCtx) { } else { func_80088B34(BREG(2) + 50); } - func_800F5ACC(NA_BGM_MINI_GAME_2); + func_800F5ACC(NA_BGM_TIMED_MINI_GAME); func_8002DF54(globalCtx, NULL, 7); this->actor.textId = 0x405B; this->unk_292 = TEXT_STATE_EVENT; diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 13ed7161ba..dfad2c1957 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -38,7 +38,7 @@ void EnOkarinaEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { globalCtx->envCtx.unk_F2[0] = 0; if ((gWeatherMode != 4) && (gWeatherMode != 5) && (globalCtx->envCtx.gloomySkyMode == 1)) { globalCtx->envCtx.gloomySkyMode = 2; // end gloomy sky - func_80077684(globalCtx); + Environment_StopStormNatureAmbience(globalCtx); } globalCtx->envCtx.lightningMode = LIGHTNING_MODE_LAST; } @@ -64,7 +64,7 @@ void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCt globalCtx->envCtx.unk_DE = 1; } globalCtx->envCtx.lightningMode = LIGHTNING_MODE_ON; - func_80077624(globalCtx); + Environment_PlayStormNatureAmbience(globalCtx); EnOkarinaEffect_SetupAction(this, EnOkarinaEffect_ManageStorm); } @@ -91,10 +91,10 @@ void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx if (this->timer == 0) { globalCtx->envCtx.unk_F2[0] = 0; if (globalCtx->csCtx.state == CS_STATE_IDLE) { - func_80077684(globalCtx); + Environment_StopStormNatureAmbience(globalCtx); } else if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) { - func_800F6D58(0xF, 1, 0); - func_800F6D58(0xE, 1, 0); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0); + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0); } osSyncPrintf("\n\n\nE_wether_flg=[%d]", gWeatherMode); osSyncPrintf("\nrain_evt_trg=[%d]\n\n", globalCtx->envCtx.gloomySkyMode); diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index 4d8dce0848..9aea2df41a 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -36,7 +36,7 @@ void EnRiverSound_Init(Actor* thisx, GlobalContext* globalCtx) { func_800F4870(this->actor.params - RS_MAX); Actor_Kill(&this->actor); } else if (this->actor.params == RS_UNK_F7) { - func_800F6FB4(4); + Audio_PlayNatureAmbienceSequence(NATURE_ID_KOKIRI_REGION); Actor_Kill(&this->actor); } else if (this->actor.params == RS_SARIAS_SONG) { if (!CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || CHECK_QUEST_ITEM(QUEST_SONG_SARIA)) { diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index d234efb441..b718a023c1 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1372,7 +1372,7 @@ void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { if (player->stateFlags2 & 0x1000000) { player->stateFlags2 |= 0x2000000; - func_800F5BF0(4); + func_800F5BF0(NATURE_ID_KOKIRI_REGION); EnSkj_TurnPlayer(this, player); player->unk_6A8 = &this->actor; Message_StartTextbox(globalCtx, 0x10BE, &this->actor); @@ -1388,7 +1388,7 @@ void EnSkj_WaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { if (player->stateFlags2 & 0x1000000) { player->stateFlags2 |= 0x2000000; - func_800F5BF0(4); + func_800F5BF0(NATURE_ID_KOKIRI_REGION); EnSkj_TurnPlayer(this, player); player->unk_6A8 = &this->actor; Message_StartTextbox(globalCtx, 0x10BE, &this->actor); diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index f2f6bb717f..e4be14197c 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -807,7 +807,7 @@ void func_80B15AD4(EnTa* this, GlobalContext* globalCtx) { Animation_GetLastFrame(&gTalonSitHandsUpAnim), ANIMMODE_ONCE, 0.0f); this->unk_2CC = 50; func_80088B34(0x1E); - func_800F5ACC(NA_BGM_MINI_GAME_2); + func_800F5ACC(NA_BGM_TIMED_MINI_GAME); this->unk_2E0 |= 0x200; Message_CloseTextbox(globalCtx); func_8002DF54(globalCtx, &this->actor, 1); diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 5325bd5b60..a8fa0a059b 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -253,7 +253,7 @@ void EnWeatherTag_EnabledCloudySnow(EnWeatherTag* this, GlobalContext* globalCtx void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx) { if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 2, 100, 4)) { - func_80077624(globalCtx); + Environment_PlayStormNatureAmbience(globalCtx); globalCtx->envCtx.unk_EE[0] = 25; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledRainLakeHylia); } @@ -261,7 +261,7 @@ void EnWeatherTag_DisabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globa void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, GlobalContext* globalCtx) { if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 2, 0, 100)) { - func_80077684(globalCtx); + Environment_StopStormNatureAmbience(globalCtx); globalCtx->envCtx.unk_EE[0] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledRainLakeHylia); } @@ -269,7 +269,7 @@ void EnWeatherTag_EnabledRainLakeHylia(EnWeatherTag* this, GlobalContext* global void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx) { if (WeatherTag_CheckEnableWeatherEffect(this, globalCtx, 0, 1, 0, 4, 100, 5)) { - func_80077624(globalCtx); + Environment_PlayStormNatureAmbience(globalCtx); globalCtx->envCtx.lightningMode = LIGHTNING_MODE_ON; globalCtx->envCtx.unk_EE[0] = 30; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledCloudyRainThunderKakariko); @@ -278,7 +278,7 @@ void EnWeatherTag_DisabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalCo void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalContext* globalCtx) { if (WeatherTag_CheckRestoreWeather(this, globalCtx, 1, 0, 4, 0, 100)) { - func_80077684(globalCtx); + Environment_StopStormNatureAmbience(globalCtx); globalCtx->envCtx.lightningMode = LIGHTNING_MODE_LAST; globalCtx->envCtx.unk_EE[0] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyRainThunderKakariko); @@ -301,7 +301,7 @@ void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, GlobalContext* globalC Player* player = GET_PLAYER(globalCtx); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { - func_80077624(globalCtx); + Environment_PlayStormNatureAmbience(globalCtx); globalCtx->envCtx.lightningMode = LIGHTNING_MODE_ON; globalCtx->envCtx.unk_EE[0] = 25; EnWeatherTag_SetupAction(this, EnWeatherTag_EnabledRainThunder); @@ -312,7 +312,7 @@ void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, GlobalContext* globalCt Player* player = GET_PLAYER(globalCtx); if ((WEATHER_TAG_RANGE100(this->actor.params) + 10.0f) < Actor_WorldDistXZToActor(&player->actor, &this->actor)) { - func_80077684(globalCtx); + Environment_StopStormNatureAmbience(globalCtx); globalCtx->envCtx.lightningMode = LIGHTNING_MODE_LAST; globalCtx->envCtx.unk_EE[0] = 0; globalCtx->envCtx.unk_EE[1] = 10; diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index f59355852f..12f51c03e7 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -385,7 +385,7 @@ void EnWf_WaitToAppear(EnWf* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; if ((this->actor.params != WOLFOS_NORMAL) && (this->switchFlag != 0xFF)) { - func_800F5ACC(0x38); // Mini-Boss Battle Theme + func_800F5ACC(NA_BGM_MINI_BOSS); } } } else if (this->actionTimer != 0) { diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 68bc879c8d..e013a11f73 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -641,7 +641,7 @@ void EnZf_DropIn(EnZf* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_0; if (this->actor.params == ENZF_TYPE_LIZALFOS_MINIBOSS_A) { - func_800F5ACC(0x38); // Miniboss theme + func_800F5ACC(NA_BGM_MINI_BOSS); } } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 1c831e8aab..11a13e55e5 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2823,7 +2823,7 @@ void func_80836448(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* func_800F6AB0(0); Audio_PlayFanfare(NA_BGM_GAME_OVER); gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } OnePointCutscene_Init(globalCtx, 9806, cond ? 120 : 60, &this->actor, MAIN_CAM); @@ -3985,7 +3985,7 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u func_800788CC(NA_SE_OC_SECRET_HOLE_OUT); func_800F6964(5); gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } else { linearVel = this->linearVelocity; @@ -11923,7 +11923,7 @@ void func_8084E3C4(Player* this, GlobalContext* globalCtx) { } gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } }