mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-19 21:03:42 -07:00
Swap Audio search to menu widget search system.
This commit is contained in:
parent
b767d89e26
commit
a96ecdc12b
3 changed files with 101 additions and 69 deletions
|
@ -11,7 +11,7 @@
|
|||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include <utils/StringHelper.h>
|
||||
#include "soh/SohGui/UIWidgets.hpp"
|
||||
#include "soh/SohGui/SohMenu.h"
|
||||
#include "soh/SohGui/SohGui.hpp"
|
||||
#include "AudioCollection.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
|
@ -25,6 +25,22 @@ Vec3f pos = { 0.0f, 0.0f, 0.0f };
|
|||
f32 freqScale = 1.0f;
|
||||
s8 reverbAdd = 0;
|
||||
|
||||
using namespace UIWidgets;
|
||||
|
||||
static WidgetInfo lowHpAlarm;
|
||||
static WidgetInfo naviCall;
|
||||
static WidgetInfo enemyProx;
|
||||
static WidgetInfo leadingMusic;
|
||||
static WidgetInfo displaySeqName;
|
||||
static WidgetInfo ovlDuration;
|
||||
static WidgetInfo voicePitch;
|
||||
static WidgetInfo randoMusicOnSceneChange;
|
||||
static WidgetInfo lowerOctaves;
|
||||
|
||||
namespace SohGui {
|
||||
extern std::shared_ptr<SohMenu> mSohMenu;
|
||||
}
|
||||
|
||||
// Authentic sequence counts
|
||||
// used to ensure we have enough to shuffle
|
||||
#define SEQ_COUNT_BGM_WORLD 30
|
||||
|
@ -515,69 +531,21 @@ void AudioEditor::DrawElement() {
|
|||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::BeginChild("SfxOptions", ImVec2(0, -8))) {
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Mute Low HP Alarm", CVAR_AUDIO("LowHpAlarm"),
|
||||
UIWidgets::CheckboxOptions().Color(THEME_COLOR).Tooltip("Disable the low HP beeping sound."));
|
||||
UIWidgets::CVarCheckbox("Disable Navi Call Audio", CVAR_AUDIO("DisableNaviCallAudio"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Disables the voice audio when Navi calls you."));
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Disable Enemy Proximity Music", CVAR_AUDIO("EnemyBGMDisable"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Disables the music change when getting close to enemies. Useful for hearing "
|
||||
"your custom music for each scene more often."));
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Disable Leading Music in Lost Woods", CVAR_AUDIO("LostWoodsConsistentVolume"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Disables the volume shifting in the Lost Woods. Useful for hearing "
|
||||
"your custom music in the Lost Woods if you don't need the navigation assitance "
|
||||
"the volume changing provides. If toggling this while in the Lost Woods, reload "
|
||||
"the area for the effect to kick in."));
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Display Sequence Name on Overlay", CVAR_AUDIO("SeqNameOverlay"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Displays the name of the current sequence in the corner of the screen whenever a new "
|
||||
"sequence "
|
||||
"is loaded to the main sequence player (does not apply to fanfares or enemy BGM)."));
|
||||
UIWidgets::CVarSliderInt("Overlay Duration: %d seconds", CVAR_AUDIO("SeqNameOverlayDuration"),
|
||||
UIWidgets::IntSliderOptions()
|
||||
.Min(1)
|
||||
.Max(10)
|
||||
.DefaultValue(5)
|
||||
.Size(ImVec2(300.0f, 0.0f))
|
||||
.Color(THEME_COLOR));
|
||||
UIWidgets::CVarSliderFloat("Link's Voice Pitch Multiplier", CVAR_AUDIO("LinkVoiceFreqMultiplier"),
|
||||
UIWidgets::FloatSliderOptions()
|
||||
.IsPercentage()
|
||||
.Min(0.4f)
|
||||
.Max(2.5f)
|
||||
.DefaultValue(1.0f)
|
||||
.Size(ImVec2(300.0f, 0.0f))
|
||||
.Color(THEME_COLOR));
|
||||
SohGui::mSohMenu->MenuDrawItem(lowHpAlarm, ImGui::GetContentRegionAvail().x, THEME_COLOR);
|
||||
SohGui::mSohMenu->MenuDrawItem(naviCall, ImGui::GetContentRegionAvail().x, THEME_COLOR);
|
||||
SohGui::mSohMenu->MenuDrawItem(enemyProx, ImGui::GetContentRegionAvail().x, THEME_COLOR);
|
||||
SohGui::mSohMenu->MenuDrawItem(leadingMusic, ImGui::GetContentRegionAvail().x, THEME_COLOR);
|
||||
SohGui::mSohMenu->MenuDrawItem(displaySeqName, ImGui::GetContentRegionAvail().x, THEME_COLOR);
|
||||
SohGui::mSohMenu->MenuDrawItem(ovlDuration, ImGui::GetContentRegionAvail().x, THEME_COLOR);
|
||||
SohGui::mSohMenu->MenuDrawItem(voicePitch, ImGui::GetContentRegionAvail().x, THEME_COLOR);
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPos().y + 40.f);
|
||||
if (UIWidgets::Button("Reset##linkVoiceFreqMultiplier",
|
||||
UIWidgets::ButtonOptions().Size(ImVec2(80, 36)).Padding(ImVec2(5.0f, 0.0f)))) {
|
||||
CVarSetFloat(CVAR_AUDIO("LinkVoiceFreqMultiplier"), 1.0f);
|
||||
}
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Randomize All Music and Sound Effects on New Scene", CVAR_AUDIO("RandomizeAllOnNewScene"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip(
|
||||
"Enables randomizing all unlocked music and sound effects when you enter a new scene."));
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Lower Octaves of Unplayable High Notes", CVAR_AUDIO("ExperimentalOctaveDrop"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Some custom sequences may have notes that are too high for the game's audio "
|
||||
"engine to play. Enabling this checkbox will cause these notes to drop a "
|
||||
"couple of octaves so they can still harmonize with the other notes of the "
|
||||
"sequence."));
|
||||
SohGui::mSohMenu->MenuDrawItem(randoMusicOnSceneChange, ImGui::GetContentRegionAvail().x, THEME_COLOR);
|
||||
SohGui::mSohMenu->MenuDrawItem(lowerOctaves, ImGui::GetContentRegionAvail().x, THEME_COLOR);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTable();
|
||||
|
@ -831,3 +799,77 @@ void AudioEditor_UnlockAll() {
|
|||
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||
}
|
||||
|
||||
void RegisterAudioWidgets() {
|
||||
lowHpAlarm = { .name = "Mute Low HP Alarm", .type = WidgetType::WIDGET_CVAR_CHECKBOX };
|
||||
lowHpAlarm.CVar(CVAR_AUDIO("LowHpAlarm"))
|
||||
.Options(CheckboxOptions().Color(THEME_COLOR).Tooltip("Disable the low HP beeping sound."));
|
||||
SohGui::mSohMenu->AddSearchWidget({ lowHpAlarm, "Enhancements", "Audio Editor", "Audio Options" });
|
||||
|
||||
naviCall = { .name = "Disable Navi Call Audio", .type = WidgetType::WIDGET_CVAR_CHECKBOX };
|
||||
naviCall.CVar(CVAR_AUDIO("DisableNaviCallAudio"))
|
||||
.Options(CheckboxOptions().Color(THEME_COLOR).Tooltip("Disables the voice audio when Navi calls you."));
|
||||
SohGui::mSohMenu->AddSearchWidget({ naviCall, "Enhancements", "Audio Editor", "Audio Options" });
|
||||
|
||||
enemyProx = { .name = "Disable Enemy Proximity Music", .type = WidgetType::WIDGET_CVAR_CHECKBOX };
|
||||
enemyProx.CVar(CVAR_AUDIO("EnemyBGMDisable"))
|
||||
.Options(CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Disables the music change when getting close to enemies. Useful for hearing "
|
||||
"your custom music for each scene more often."));
|
||||
|
||||
leadingMusic = { .name = "Disable Leading Music in Lost Woods", .type = WidgetType::WIDGET_CVAR_CHECKBOX };
|
||||
leadingMusic.CVar(CVAR_AUDIO("LostWoodsConsistentVolume"))
|
||||
.Options(CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Disables the volume shifting in the Lost Woods. Useful for hearing "
|
||||
"your custom music in the Lost Woods if you don't need the navigation assitance "
|
||||
"the volume changing provides. If toggling this while in the Lost Woods, reload "
|
||||
"the area for the effect to kick in."));
|
||||
SohGui::mSohMenu->AddSearchWidget({ leadingMusic, "Enhancements", "Audio Editor", "Audio Options" });
|
||||
|
||||
displaySeqName = { .name = "Display Sequence Name on Overlay", .type = WidgetType::WIDGET_CVAR_CHECKBOX };
|
||||
displaySeqName.CVar(CVAR_AUDIO("SeqNameOverlay"))
|
||||
.Options(CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Displays the name of the current sequence in the corner of the screen whenever a new "
|
||||
"sequence "
|
||||
"is loaded to the main sequence player (does not apply to fanfares or enemy BGM)."));
|
||||
SohGui::mSohMenu->AddSearchWidget({ displaySeqName, "Enhancements", "Audio Editor", "Audio Options" });
|
||||
|
||||
ovlDuration = { .name = "Overlay Duration: %d seconds", .type = WidgetType::WIDGET_CVAR_SLIDER_INT };
|
||||
ovlDuration.CVar(CVAR_AUDIO("SeqNameOverlayDuration"))
|
||||
.Options(IntSliderOptions().Color(THEME_COLOR).Min(1).Max(10).DefaultValue(5).Size(ImVec2(300.0f, 0.0f)));
|
||||
SohGui::mSohMenu->AddSearchWidget({ ovlDuration, "Enhancements", "Audio Editor", "Audio Options" });
|
||||
|
||||
voicePitch = { .name = "Link's Voice Pitch Multiplier", .type = WidgetType::WIDGET_CVAR_SLIDER_FLOAT };
|
||||
voicePitch.CVar(CVAR_AUDIO("LinkVoiceFreqMultiplier"))
|
||||
.Options(FloatSliderOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.IsPercentage()
|
||||
.Min(0.4f)
|
||||
.Max(2.5f)
|
||||
.DefaultValue(1.0f)
|
||||
.Size(ImVec2(300.0f, 0.0f)));
|
||||
SohGui::mSohMenu->AddSearchWidget({ voicePitch, "Enhancements", "Audio Editor", "Audio Options" });
|
||||
|
||||
randoMusicOnSceneChange = { .name = "Randomize All Music and Sound Effects on New Scene",
|
||||
.type = WidgetType::WIDGET_CVAR_CHECKBOX };
|
||||
randoMusicOnSceneChange.CVar(CVAR_AUDIO("RandomizeAllOnNewScene"))
|
||||
.Options(CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Enables randomizing all unlocked music and sound effects when you enter a new scene."));
|
||||
SohGui::mSohMenu->AddSearchWidget({ randoMusicOnSceneChange, "Enhancements", "Audio Editor", "Audio Options" });
|
||||
|
||||
lowerOctaves = { .name = "Lower Octaves of Unplayable High Notes", .type = WidgetType::WIDGET_CVAR_CHECKBOX };
|
||||
lowerOctaves.CVar(CVAR_AUDIO("ExperimentalOctaveDrop"))
|
||||
.Options(CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Some custom sequences may have notes that are too high for the game's audio "
|
||||
"engine to play. Enabling this checkbox will cause these notes to drop a "
|
||||
"couple of octaves so they can still harmonize with the other notes of the "
|
||||
"sequence."));
|
||||
SohGui::mSohMenu->AddSearchWidget({ lowerOctaves, "Enhancements", "Audio Editor", "Audio Options" });
|
||||
}
|
||||
|
||||
static RegisterMenuInitFunc initAudioWidgets(RegisterAudioWidgets);
|
||||
|
|
|
@ -1942,4 +1942,4 @@ void RegisterInputWidgets() {
|
|||
SohGui::mSohMenu->AddSearchWidget({ dpadText, "Settings", "Controls", "Dpad Controls" });
|
||||
}
|
||||
|
||||
static RegisterMenuInitFunc initFunc(RegisterInputWidgets);
|
||||
static RegisterMenuInitFunc initInputWidgets(RegisterInputWidgets);
|
||||
|
|
|
@ -1882,16 +1882,6 @@ void SohMenu::AddMenuEnhancements() {
|
|||
.CVar(timer.timeEnable)
|
||||
.Callback([](WidgetInfo& info) { TimeDisplayUpdateDisplayOptions(); });
|
||||
}
|
||||
|
||||
AddSearchEntry({ "Mute Low HP Alarm", "Enhancements", "Audio Editor", "Audio Options" });
|
||||
AddSearchEntry({ "Disable Navi Audio Call", "Enhancements", "Audio Editor", "Audio Options", "mute" });
|
||||
AddSearchEntry({ "Disable Enemy Proximity Music", "Enhancements", "Audio Editor", "Audio Options", "mute" });
|
||||
AddSearchEntry({ "Disable Leading Music in Lost Woods", "Enhancements", "Audio Editor", "Audio Options", "mute" });
|
||||
AddSearchEntry({ "Overlay Duration", "Enhancements", "Audio Editor", "Audio Options", "sequencetracktitle" });
|
||||
AddSearchEntry({ "Link's Voice Pitch Multiplier", "Enhancements", "Audio Editor", "Audio Options" });
|
||||
AddSearchEntry(
|
||||
{ "Randomize All Music and Sound Effects on New Scene", "Enhancements", "Audio Editor", "Audio Options" });
|
||||
AddSearchEntry({ "Lower Octaves of Unplayable High Notes", "Enhancements", "Audio Editor", "Audio Options" });
|
||||
}
|
||||
|
||||
} // namespace SohGui
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue