From e21a3e4c0f33c76c5eab7257125ae38d56a2cdc5 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Fri, 21 Mar 2025 04:22:22 -0700 Subject: [PATCH] Add check for GAMEMODE_END_CREDITS in Audio Editor's OnSceneInit hook (#5172) * Add check for GAMEMODE_END_CREDITS in Audio Editor's OnSceneInit hook to prevent sequence shuffles mid-credits. * Move extern "C" block up. --- soh/soh/Enhancements/audio/AudioEditor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/audio/AudioEditor.cpp b/soh/soh/Enhancements/audio/AudioEditor.cpp index 3daeff01f..caa40c66f 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.cpp +++ b/soh/soh/Enhancements/audio/AudioEditor.cpp @@ -16,6 +16,11 @@ #include "AudioCollection.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" +extern "C" { + #include "z64save.h" + extern SaveContext gSaveContext; +} + Vec3f pos = { 0.0f, 0.0f, 0.0f }; f32 freqScale = 1.0f; s8 reverbAdd = 0; @@ -440,7 +445,7 @@ void DrawTypeChip(SeqType type, std::string sequenceName) { void AudioEditorRegisterOnSceneInitHook() { GameInteractor::Instance->RegisterGameHook([](int16_t sceneNum) { - if (CVarGetInteger(CVAR_AUDIO("RandomizeAllOnNewScene"), 0)) { + if (gSaveContext.gameMode != GAMEMODE_END_CREDITS && CVarGetInteger(CVAR_AUDIO("RandomizeAllOnNewScene"), 0)) { AudioEditor_RandomizeAll(); } });