From 0e7212d93998f4328b587acdf2944bf7fbaa8c4f Mon Sep 17 00:00:00 2001 From: aMannus Date: Sun, 4 Jan 2026 21:28:06 +0100 Subject: [PATCH] Add modal to teach player about presets (#5903) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add modal to teach player about presets * Change cvar to CVAR_GENERAL * Update soh/soh/Enhancements/FileSelectEnhancements.cpp Co-authored-by: Philip Dubé --------- Co-authored-by: Philip Dubé --- ...cements - Curated First Time Vanilla.json} | 2 +- ...=> Enhancements - Curated Randomizer.json} | 2 +- ...ncements - Curated Returning Vanilla.json} | 2 +- ...n => Enhancements - Reset to Default.json} | 2 +- ...on => Rando Seed Settings - Advanced.json} | 2 +- ...on => Rando Seed Settings - Beginner.json} | 2 +- ...n => Rando Seed Settings - Hell Mode.json} | 2 +- ...ndo Seed Settings - Reset to Default.json} | 2 +- ...on => Rando Seed Settings - Standard.json} | 2 +- .../Enhancements/FileSelectEnhancements.cpp | 35 +++++++++++++++++++ soh/soh/Enhancements/FileSelectEnhancements.h | 1 + soh/soh/Enhancements/Presets/Presets.cpp | 4 +-- soh/soh/SohGui/SohGui.cpp | 4 +++ soh/soh/SohGui/SohGui.hpp | 1 + .../ovl_file_choose/z_file_choose.c | 1 + 15 files changed, 53 insertions(+), 11 deletions(-) rename soh/assets/custom/presets/{Main Vanilla+.json => Enhancements - Curated First Time Vanilla.json} (96%) rename soh/assets/custom/presets/{Main Randomizer.json => Enhancements - Curated Randomizer.json} (98%) rename soh/assets/custom/presets/{Main Enhanced.json => Enhancements - Curated Returning Vanilla.json} (97%) rename soh/assets/custom/presets/{Main Default.json => Enhancements - Reset to Default.json} (77%) rename soh/assets/custom/presets/{Rando Advanced.json => Rando Seed Settings - Advanced.json} (97%) rename soh/assets/custom/presets/{Rando Beginner.json => Rando Seed Settings - Beginner.json} (96%) rename soh/assets/custom/presets/{Rando Hell Mode.json => Rando Seed Settings - Hell Mode.json} (98%) rename soh/assets/custom/presets/{Rando Default.json => Rando Seed Settings - Reset to Default.json} (64%) rename soh/assets/custom/presets/{Rando Standard.json => Rando Seed Settings - Standard.json} (97%) diff --git a/soh/assets/custom/presets/Main Vanilla+.json b/soh/assets/custom/presets/Enhancements - Curated First Time Vanilla.json similarity index 96% rename from soh/assets/custom/presets/Main Vanilla+.json rename to soh/assets/custom/presets/Enhancements - Curated First Time Vanilla.json index 1ac97a567..3b483d5ce 100644 --- a/soh/assets/custom/presets/Main Vanilla+.json +++ b/soh/assets/custom/presets/Enhancements - Curated First Time Vanilla.json @@ -52,6 +52,6 @@ "gRandoEnhancements": null } }, - "presetName": "Main Vanilla+", + "presetName": "Enhancements - Curated First Time Vanilla", "isBuiltIn": true } \ No newline at end of file diff --git a/soh/assets/custom/presets/Main Randomizer.json b/soh/assets/custom/presets/Enhancements - Curated Randomizer.json similarity index 98% rename from soh/assets/custom/presets/Main Randomizer.json rename to soh/assets/custom/presets/Enhancements - Curated Randomizer.json index fae2fe957..78d1e5d75 100644 --- a/soh/assets/custom/presets/Main Randomizer.json +++ b/soh/assets/custom/presets/Enhancements - Curated Randomizer.json @@ -133,6 +133,6 @@ "gRandoEnhancements": null } }, - "presetName": "Main Randomizer", + "presetName": "Enhancements - Curated Randomizer", "isBuiltIn": true } \ No newline at end of file diff --git a/soh/assets/custom/presets/Main Enhanced.json b/soh/assets/custom/presets/Enhancements - Curated Returning Vanilla.json similarity index 97% rename from soh/assets/custom/presets/Main Enhanced.json rename to soh/assets/custom/presets/Enhancements - Curated Returning Vanilla.json index eabda809f..8a00f87f3 100644 --- a/soh/assets/custom/presets/Main Enhanced.json +++ b/soh/assets/custom/presets/Enhancements - Curated Returning Vanilla.json @@ -55,6 +55,6 @@ "gRandoEnhancements": null } }, - "presetName": "Main Enhanced", + "presetName": "Enhancements - Curated Returning Vanilla", "isBuiltIn": true } \ No newline at end of file diff --git a/soh/assets/custom/presets/Main Default.json b/soh/assets/custom/presets/Enhancements - Reset to Default.json similarity index 77% rename from soh/assets/custom/presets/Main Default.json rename to soh/assets/custom/presets/Enhancements - Reset to Default.json index 7d87c3d95..c41f72961 100644 --- a/soh/assets/custom/presets/Main Default.json +++ b/soh/assets/custom/presets/Enhancements - Reset to Default.json @@ -6,6 +6,6 @@ "gRandoEnhancements": null } }, - "presetName": "Main Default", + "presetName": "Enhancements - Reset to Default", "isBuiltIn": true } \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Advanced.json b/soh/assets/custom/presets/Rando Seed Settings - Advanced.json similarity index 97% rename from soh/assets/custom/presets/Rando Advanced.json rename to soh/assets/custom/presets/Rando Seed Settings - Advanced.json index 4042c0688..f8fb2b9d1 100644 --- a/soh/assets/custom/presets/Rando Advanced.json +++ b/soh/assets/custom/presets/Rando Seed Settings - Advanced.json @@ -64,6 +64,6 @@ } } }, - "presetName": "Rando Advanced", + "presetName": "Rando Seed Settings - Advanced", "isBuiltIn": true } \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Beginner.json b/soh/assets/custom/presets/Rando Seed Settings - Beginner.json similarity index 96% rename from soh/assets/custom/presets/Rando Beginner.json rename to soh/assets/custom/presets/Rando Seed Settings - Beginner.json index 595734fe0..be4c18567 100644 --- a/soh/assets/custom/presets/Rando Beginner.json +++ b/soh/assets/custom/presets/Rando Seed Settings - Beginner.json @@ -46,6 +46,6 @@ } } }, - "presetName": "Rando Beginner", + "presetName": "Rando Seed Settings - Beginner", "isBuiltIn": true } \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Hell Mode.json b/soh/assets/custom/presets/Rando Seed Settings - Hell Mode.json similarity index 98% rename from soh/assets/custom/presets/Rando Hell Mode.json rename to soh/assets/custom/presets/Rando Seed Settings - Hell Mode.json index cdcceb451..5e0d7e586 100644 --- a/soh/assets/custom/presets/Rando Hell Mode.json +++ b/soh/assets/custom/presets/Rando Seed Settings - Hell Mode.json @@ -78,6 +78,6 @@ } } }, - "presetName": "Rando Hell Mode", + "presetName": "Rando Seed Settings - Hell Mode", "isBuiltIn": true } \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Default.json b/soh/assets/custom/presets/Rando Seed Settings - Reset to Default.json similarity index 64% rename from soh/assets/custom/presets/Rando Default.json rename to soh/assets/custom/presets/Rando Seed Settings - Reset to Default.json index f5c5818e9..b87323821 100644 --- a/soh/assets/custom/presets/Rando Default.json +++ b/soh/assets/custom/presets/Rando Seed Settings - Reset to Default.json @@ -4,6 +4,6 @@ "gRandoSettings": null } }, - "presetName": "Rando Default", + "presetName": "Rando Seed Settings - Reset to Default", "isBuiltIn": true } \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Standard.json b/soh/assets/custom/presets/Rando Seed Settings - Standard.json similarity index 97% rename from soh/assets/custom/presets/Rando Standard.json rename to soh/assets/custom/presets/Rando Seed Settings - Standard.json index ad91912de..b89a36abc 100644 --- a/soh/assets/custom/presets/Rando Standard.json +++ b/soh/assets/custom/presets/Rando Seed Settings - Standard.json @@ -58,6 +58,6 @@ } } }, - "presetName": "Rando Standard", + "presetName": "Rando Seed Settings - Standard", "isBuiltIn": true } \ No newline at end of file diff --git a/soh/soh/Enhancements/FileSelectEnhancements.cpp b/soh/soh/Enhancements/FileSelectEnhancements.cpp index d2671f20e..08dd81509 100644 --- a/soh/soh/Enhancements/FileSelectEnhancements.cpp +++ b/soh/soh/Enhancements/FileSelectEnhancements.cpp @@ -1,6 +1,8 @@ #include "FileSelectEnhancements.h" #include "soh/OTRGlobals.h" +#include "soh/SohGui/SohModals.h" +#include "soh/SohGui/SohGui.hpp" #include #include @@ -65,3 +67,36 @@ std::array RandomizerSettingsMenuText[RSM_MAX] = { const char* SohFileSelect_GetSettingText(uint8_t optionIndex, uint8_t language) { return RandomizerSettingsMenuText[optionIndex][language].c_str(); } + +void SohFileSelect_ShowPresetMenu() { + SohGui::ShowEscMenu(); + CVarSetString(CVAR_SETTING("Menu.ActiveHeader"), "Settings"); + CVarSetString(CVAR_SETTING("Menu.SettingsSidebarSection"), "Presets"); + CVarSetInteger(CVAR_GENERAL("HasSeenPresetModal"), 1); +} + +void SohFileSelect_DismissPresetModal() { + CVarSetInteger(CVAR_GENERAL("HasSeenPresetModal"), 1); +} + +void SohFileSelect_ShowPresetModal() { + if (CVarGetInteger(CVAR_GENERAL("HasSeenPresetModal"), 0)) { + return; + } + std::shared_ptr modal = static_pointer_cast( + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Modal Window")); + if (modal->IsPopupOpen("Take a look at our presets!")) { + modal->DismissPopup(); + } else { + modal->RegisterPopup("Take a look at our presets!", + "\nHey there! Ship comes with a ton of options, but none of them are on by default,\n" + "even in randomizer. If you haven't already, we highly recommend applying the\n" + "\"Enhancements - Curated Randomizer\" preset for a great, curated out of the\n" + "box rando experience.\n" + "\n" + "Afterwards, consider taking a look at the rest of the ESC menu to further tweak\n" + "the experience to your liking!\n", + "Cool, show me the presets!", "Got it, just let me play!", SohFileSelect_ShowPresetMenu, + SohFileSelect_DismissPresetModal); + } +} diff --git a/soh/soh/Enhancements/FileSelectEnhancements.h b/soh/soh/Enhancements/FileSelectEnhancements.h index 070d270dc..440084154 100644 --- a/soh/soh/Enhancements/FileSelectEnhancements.h +++ b/soh/soh/Enhancements/FileSelectEnhancements.h @@ -7,6 +7,7 @@ extern "C" { #endif const char* SohFileSelect_GetSettingText(u8 optionIndex, u8 language); +void SohFileSelect_ShowPresetModal(); #ifdef __cplusplus }; #endif diff --git a/soh/soh/Enhancements/Presets/Presets.cpp b/soh/soh/Enhancements/Presets/Presets.cpp index d08859ae3..b0d9fa033 100644 --- a/soh/soh/Enhancements/Presets/Presets.cpp +++ b/soh/soh/Enhancements/Presets/Presets.cpp @@ -359,7 +359,7 @@ void DrawNewPresetPopup() { } void PresetsCustomWidget(WidgetInfo& info) { - ImGui::PushFont(OTRGlobals::Instance->fontMonoLargest); + ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger); if (UIWidgets::Button("New Preset", UIWidgets::ButtonOptions( { { .disabled = (CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) != 0), .disabledTooltip = "Disabled because of race lockout" } }) @@ -378,7 +378,7 @@ void PresetsCustomWidget(WidgetInfo& info) { bool hideBuiltIn = CVarGetInteger(CVAR_GENERAL("HideBuiltInPresets"), 0); UIWidgets::PushStyleTabs(THEME_COLOR); if (ImGui::BeginTable("PresetWidgetTable", PRESET_SECTION_MAX + 3)) { - ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, 250); + ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, 400); for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { ImGui::TableSetupColumn(blockInfo[i].names[0].c_str()); } diff --git a/soh/soh/SohGui/SohGui.cpp b/soh/soh/SohGui/SohGui.cpp index c4d1d8dba..286beb180 100644 --- a/soh/soh/SohGui/SohGui.cpp +++ b/soh/soh/SohGui/SohGui.cpp @@ -252,4 +252,8 @@ void ShowRandomizerSettingsMenu() { CVarSetString(CVAR_SETTING("Menu.RandomizerSidebarSection"), "General"); mSohMenu->Show(); } + +void ShowEscMenu() { + mSohMenu->Show(); +} } // namespace SohGui diff --git a/soh/soh/SohGui/SohGui.hpp b/soh/soh/SohGui/SohGui.hpp index 3d218651b..941772bba 100644 --- a/soh/soh/SohGui/SohGui.hpp +++ b/soh/soh/SohGui/SohGui.hpp @@ -38,6 +38,7 @@ void Destroy(); void RegisterPopup(std::string title, std::string message, std::string button1 = "OK", std::string button2 = "", std::function button1callback = nullptr, std::function button2callback = nullptr); void ShowRandomizerSettingsMenu(); +void ShowEscMenu(); UIWidgets::Colors GetMenuThemeColor(); } // namespace SohGui diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index bd64839c3..e88e433b4 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -779,6 +779,7 @@ void FileChoose_UpdateRandomizerMenu(GameState* thisx) { if (CHECK_BTN_ALL(input->press.button, BTN_A)) { if (this->randomizerIndex == RSM_START_RANDOMIZER) { if (Randomizer_IsSeedGenerated() || Randomizer_IsSpoilerLoaded()) { + SohFileSelect_ShowPresetModal(); Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E };