From 99194a75f1f77a101669aff860eb98255644393f Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Tue, 26 Dec 2023 13:30:49 -0500 Subject: docs: update `func_800FADF8` to `Audio_ResetActiveSequences` (#3471) --- soh/src/code/code_800EC960.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'soh/src/code/code_800EC960.c') diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index f2f72885d..27de9b2d5 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -4735,7 +4735,7 @@ void Audio_SetSequenceMode(u8 seqMode) { seqMode = SEQ_MODE_IGNORE; } - seqId = D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254; + seqId = gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId; if (seqId == NA_BGM_FIELD_LOGIC && func_800FA0B4(SEQ_PLAYER_BGM_SUB) == (NA_BGM_ENEMY | 0x800)) { seqMode = SEQ_MODE_IGNORE; @@ -4746,10 +4746,10 @@ void Audio_SetSequenceMode(u8 seqMode) { if (seqMode != (sPrevSeqMode & 0x7F)) { if (seqMode == SEQ_MODE_ENEMY) { // Start playing enemy bgm - if (D_8016E750[SEQ_PLAYER_BGM_SUB].volScales[1] - sAudioEnemyVol < 0) { - volumeFadeInTimer = -(D_8016E750[SEQ_PLAYER_BGM_SUB].volScales[1] - sAudioEnemyVol); + if (gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sAudioEnemyVol < 0) { + volumeFadeInTimer = -(gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sAudioEnemyVol); } else { - volumeFadeInTimer = D_8016E750[SEQ_PLAYER_BGM_SUB].volScales[1] - sAudioEnemyVol; + volumeFadeInTimer = gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sAudioEnemyVol; } Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 3, sAudioEnemyVol, volumeFadeInTimer); @@ -4812,11 +4812,11 @@ void Audio_SetBgmEnemyVolume(f32 dist) { sAudioEnemyVol = ((350.0f - adjDist) * 127.0f) / 350.0f; Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 3, sAudioEnemyVol, 10); - if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_AMBIENCE) { + if (gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId != NA_BGM_NATURE_AMBIENCE) { Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 3, (0x7F - sAudioEnemyVol), 10); } } - if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_AMBIENCE) { + if (gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId != NA_BGM_NATURE_AMBIENCE) { Audio_SplitBgmChannels(sAudioEnemyVol); } } @@ -4973,7 +4973,7 @@ void Audio_SetExtraFilter(u8 filter) { sAudioExtraFilter2 = filter; sAudioExtraFilter = filter; - if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 == NA_BGM_NATURE_AMBIENCE) { + if (gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId == NA_BGM_NATURE_AMBIENCE) { for (i = 0; i < 16; i++) { t = i; // CHAN_UPD_SCRIPT_IO (seq player 0, all channels, slot 6) @@ -5097,7 +5097,7 @@ void Audio_SetNatureAmbienceChannelIO(u8 channelIdxRange, u8 port, u8 val) { u8 lastChannelIdx; u8 channelIdx; - if ((D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_AMBIENCE) && func_800FA11C(1, 0xF00000FF)) { + if ((gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId != NA_BGM_NATURE_AMBIENCE) && func_800FA11C(1, 0xF00000FF)) { sAudioNatureFailed = true; return; } @@ -5159,8 +5159,8 @@ void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId) { 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)) { + if ((gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId == NA_BGM_DISABLED) || + !(sSeqFlags[((u8)gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId) & 0xFF] & 0x80)) { Audio_StartNatureAmbienceSequence(sNatureAmbienceDataIO[natureAmbienceId].playerIO, sNatureAmbienceDataIO[natureAmbienceId].channelMask); @@ -5202,12 +5202,12 @@ void func_800F71BC(s32 arg0) { func_800F6C34(); func_800EE930(); Audio_ResetSfxChannelState(); - func_800FADF8(); + Audio_ResetActiveSequences(); Audio_ResetSounds(); } void func_800F7208(void) { - func_800FADF8(); + Audio_ResetActiveSequences(); Audio_QueueCmdS32(0xF2000000, 1); func_800F6C34(); Audio_ResetSfxChannelState(); -- cgit v1.2.3 From be948339b965d76337bbec66563e7aabbcf489c1 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Thu, 1 Feb 2024 20:52:10 -0500 Subject: Lost Woods Ocarina Game Difficulty Options (#3371) * Menu options, note speed, unlimited playback time * Instant win * Add custom ocarina game cvar to all options and presets * Extra spaces * Add starting note count, ending note count by round, more presets * Block out vanilla code + comments * finish blocking out vanilla code * new documentation formatting * add starting notes to randomizer preset --- soh/src/code/code_800EC960.c | 61 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 12 deletions(-) (limited to 'soh/src/code/code_800EC960.c') diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index 27de9b2d5..41d2a8ec3 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -2065,16 +2065,40 @@ void func_800EE404(void) { void Audio_OcaMemoryGameStart(u8 minigameRound) { u8 i; + + // #region SOH [Enhancement] + if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + u8 startingNotes = 3; + u8 roundOneCount = CVarGetInteger("gOcarinaGameRoundOneNotes", 5); + u8 roundTwoCount = CVarGetInteger("gOcarinaGameRoundTwoNotes", 6); + u8 roundThreeCount = CVarGetInteger("gOcarinaGameRoundThreeNotes", 8); + u8 modMinigameNoteCnts[] = { roundOneCount, roundTwoCount, roundThreeCount }; - if (minigameRound > 2) { - minigameRound = 2; - } - sOcaMinigameAppendPos = 0; - sOcaMinigameEndPos = sOcaMinigameNoteCnts[minigameRound]; + startingNotes = CVarGetInteger("gOcarinaGameStartingNotes", 3); + + if (minigameRound > 2) { + minigameRound = 2; + } + + sOcaMinigameAppendPos = 0; + sOcaMinigameEndPos = modMinigameNoteCnts[minigameRound]; - for (i = 0; i < 3; i++) { - Audio_OcaMemoryGameGenNote(); + for (i = 0; i < startingNotes; i++) { + Audio_OcaMemoryGameGenNote(); + } + // #endregion + } else { + if (minigameRound > 2) { + minigameRound = 2; + } + + sOcaMinigameAppendPos = 0; + sOcaMinigameEndPos = sOcaMinigameNoteCnts[minigameRound]; + + for (i = 0; i < 3; i++) { + Audio_OcaMemoryGameGenNote(); + } } } @@ -2093,11 +2117,24 @@ s32 Audio_OcaMemoryGameGenNote(void) { rndNote = sOcarinaNoteValues[(rnd + 1) % 5]; } - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = 0x2D; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].volume = 0x50; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].vibrato = 0; - sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].tone = 0; + // #region SOH [Enhancement] + if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + int noteSpeed = 0x2D; + noteSpeed = noteSpeed / CVarGetInteger("gOcarinaGameNoteSpeed", 1); + + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = noteSpeed; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].volume = 0x50; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].vibrato = 0; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].tone = 0; + // #endregion + } else { + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = 0x2D; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].volume = 0x50; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].vibrato = 0; + sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].tone = 0; + } sOcaMinigameAppendPos++; -- cgit v1.2.3 From 694a876a7045a8a0b4a69d6aae0510b6dcef86db Mon Sep 17 00:00:00 2001 From: Malkierian Date: Sat, 20 Apr 2024 11:34:02 -0700 Subject: Step 2 of CVar macro/sectionalizing: Trackers/Windows (#3238) * Add all macros. Replace all randomizer seed setting CVars with appropriate macro. Cleaned up non-gameplay-critical things that are part of Spock Race rando presets (like RTA timing, displaying timer, displaying the glitch lineup tick, or Fast File Select). * Wrong slash... * Fix DEVELOPER_CVAR macro. Add GENERAL_CVAR macro. * Change Item Tracker CVars, including open window CVar. * Swapped open window CVars. * Swapped Entrance Tracker CVars. * Swapped Check Tracker CVars. Changed Item Tracker "HudEditMode" to "Draggable". * Renamed `RANDOMIZER_CVAR` to `RANDO_ENHANCEMENT_CVAR`. Swapped rando enhancement CVars. * Mirroring last commit from part 1 in randomizer.cpp * Another mirror from pt 1 --- soh/src/code/code_800EC960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'soh/src/code/code_800EC960.c') diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index 41d2a8ec3..b8e18c633 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -4025,7 +4025,7 @@ void Audio_PlayFanfare_Rando(GetItemEntry getItem) { temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; } // If the setting is toggled on and we get special quest items (longer fanfares): - if (CVarGetInteger("gRandoQuestItemFanfares", 0) != 0) { + if (CVarGetInteger(RANDO_ENHANCEMENT_CVAR("QuestItemFanfares"), 0) != 0) { // If we get a medallion, play the "get a medallion" fanfare if ((itemId >= ITEM_MEDALLION_FOREST) && (itemId <= ITEM_MEDALLION_LIGHT)) { temp1 = NA_BGM_MEDALLION_GET | 0x900; -- cgit v1.2.3 From 33aef87907cb68479f754e63e37b532f18170583 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Sun, 21 Apr 2024 08:25:06 -0700 Subject: CVar Macro Cleanup (#4062) * Standardized CVar macros to have `CVAR_` at the front instead of the end. Removed excluded and replaced sequence macros. * Missed a few developer CVars outside of `SohMenuBar.cpp` * 1 more. --- soh/src/code/code_800EC960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'soh/src/code/code_800EC960.c') diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index b8e18c633..c7238cb39 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -4025,7 +4025,7 @@ void Audio_PlayFanfare_Rando(GetItemEntry getItem) { temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; } // If the setting is toggled on and we get special quest items (longer fanfares): - if (CVarGetInteger(RANDO_ENHANCEMENT_CVAR("QuestItemFanfares"), 0) != 0) { + if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("QuestItemFanfares"), 0) != 0) { // If we get a medallion, play the "get a medallion" fanfare if ((itemId >= ITEM_MEDALLION_FOREST) && (itemId <= ITEM_MEDALLION_LIGHT)) { temp1 = NA_BGM_MEDALLION_GET | 0x900; -- cgit v1.2.3 From 56d8dd6d8b754e2f77aa6f27169f58b73701172a Mon Sep 17 00:00:00 2001 From: Malkierian Date: Thu, 25 Apr 2024 17:31:28 -0700 Subject: All MenuBar enhancement CVars done. (#4064) --- soh/src/code/code_800EC960.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'soh/src/code/code_800EC960.c') diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index c7238cb39..95387b448 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -1608,7 +1608,7 @@ void func_800ED458(s32 arg0) { if (D_80130F3C != 0 && sOcarinaDropInputTimer != 0) { sOcarinaDropInputTimer--; - if (!CVarGetInteger("gDpadNoDropOcarinaInput", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 0)) { return; } } @@ -2067,15 +2067,15 @@ void Audio_OcaMemoryGameStart(u8 minigameRound) { u8 i; // #region SOH [Enhancement] - if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 0)) { u8 startingNotes = 3; - u8 roundOneCount = CVarGetInteger("gOcarinaGameRoundOneNotes", 5); - u8 roundTwoCount = CVarGetInteger("gOcarinaGameRoundTwoNotes", 6); - u8 roundThreeCount = CVarGetInteger("gOcarinaGameRoundThreeNotes", 8); + u8 roundOneCount = CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.RoundOneNotes"), 5); + u8 roundTwoCount = CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.RoundTwoNotes"), 6); + u8 roundThreeCount = CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.RoundThreeNotes"), 8); u8 modMinigameNoteCnts[] = { roundOneCount, roundTwoCount, roundThreeCount }; - startingNotes = CVarGetInteger("gOcarinaGameStartingNotes", 3); + startingNotes = CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), 3); if (minigameRound > 2) { minigameRound = 2; @@ -2118,9 +2118,9 @@ s32 Audio_OcaMemoryGameGenNote(void) { } // #region SOH [Enhancement] - if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 0)) { int noteSpeed = 0x2D; - noteSpeed = noteSpeed / CVarGetInteger("gOcarinaGameNoteSpeed", 1); + noteSpeed = noteSpeed / CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.NoteSpeed"), 1); sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = noteSpeed; -- cgit v1.2.3 From 6443a986d9751b87a0b4e82c15f82a9971f88201 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Sun, 5 May 2024 12:14:55 -0700 Subject: Final Step of CVar macro/sectionalizing (#4107) * p * Missed the prefix renames. * More missed ones. * Mostly finished cleanup. Removed a few CVars and some related functionality. * Bit more (prepping non-existent title card color editing). * Resolve gCrowdControl. * Final cleanup. * Universal constant, not acceleration... * Preset CVars. --- soh/src/code/code_800EC960.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'soh/src/code/code_800EC960.c') diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index 95387b448..756dcaa89 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -1259,11 +1259,11 @@ void Audio_PlayFanfare_Rando(GetItemEntry getItem); // Function originally not called, so repurposing for control mapping void Audio_OcaUpdateBtnMap(bool customControls, bool dpad, bool rStick) { if (customControls) { - sOcarinaD5BtnMap = CVarGetInteger("gOcarinaD5BtnMap", BTN_CUP); - sOcarinaB4BtnMap = CVarGetInteger("gOcarinaB4BtnMap", BTN_CLEFT); - sOcarinaA4BtnMap = CVarGetInteger("gOcarinaA4BtnMap", BTN_CRIGHT); - sOcarinaF4BtnMap = CVarGetInteger("gOcarinaF4BtnMap", BTN_CDOWN); - sOcarinaD4BtnMap = CVarGetInteger("gOcarinaD4BtnMap", BTN_A); + sOcarinaD5BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.D5Button"), BTN_CUP); + sOcarinaB4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.B4Button"), BTN_CLEFT); + sOcarinaA4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.A4Button"), BTN_CRIGHT); + sOcarinaF4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.F4Button"), BTN_CDOWN); + sOcarinaD4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.D4Button"), BTN_A); } else { sOcarinaD5BtnMap = BTN_CUP; sOcarinaB4BtnMap = BTN_CLEFT; @@ -1540,8 +1540,8 @@ void func_800ED200(void) { u8 k; u32 disableSongBtnMap; - if (CVarGetInteger("gCustomOcarinaControls", 0)) { - disableSongBtnMap = CVarGetInteger("gOcarinaDisableBtnMap", BTN_L); + if (CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0)) { + disableSongBtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.DisableButton"), BTN_L); } else { disableSongBtnMap = BTN_L; } @@ -1602,9 +1602,9 @@ void func_800ED200(void) { void func_800ED458(s32 arg0) { u32 phi_v1_2; - bool customControls = CVarGetInteger("gCustomOcarinaControls", 0); - bool dpad = CVarGetInteger("gDpadOcarina", 0); - bool rStick = CVarGetInteger("gRStickOcarina", 0); + bool customControls = CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0); + bool dpad = CVarGetInteger(CVAR_SETTING("OcarinaControl.Dpad"), 0); + bool rStick = CVarGetInteger(CVAR_SETTING("OcarinaControl.RStick"), 0); if (D_80130F3C != 0 && sOcarinaDropInputTimer != 0) { sOcarinaDropInputTimer--; @@ -1650,7 +1650,7 @@ void func_800ED458(s32 arg0) { u32 noteSharpBtnMap; if (customControls) { - noteSharpBtnMap = CVarGetInteger("gOcarinaSharpBtnMap", BTN_R); + noteSharpBtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.SharpButton"), BTN_R); } else { noteSharpBtnMap = BTN_R; } @@ -1661,7 +1661,7 @@ void func_800ED458(s32 arg0) { u32 noteFlatBtnMap; if (customControls) { - noteFlatBtnMap = CVarGetInteger("gOcarinaFlatBtnMap", BTN_Z); + noteFlatBtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.FlatButton"), BTN_Z); } else { noteFlatBtnMap = BTN_Z; } -- cgit v1.2.3