Add modal to teach player about presets (#5903)

* Add modal to teach player about presets

* Change cvar to CVAR_GENERAL

* Update soh/soh/Enhancements/FileSelectEnhancements.cpp

Co-authored-by: Philip Dubé <serprex@users.noreply.github.com>

---------

Co-authored-by: Philip Dubé <serprex@users.noreply.github.com>
This commit is contained in:
aMannus
2026-01-04 21:28:06 +01:00
committed by GitHub
parent 34728efe6f
commit 0e7212d939
15 changed files with 53 additions and 11 deletions

View File

@@ -52,6 +52,6 @@
"gRandoEnhancements": null
}
},
"presetName": "Main Vanilla+",
"presetName": "Enhancements - Curated First Time Vanilla",
"isBuiltIn": true
}

View File

@@ -133,6 +133,6 @@
"gRandoEnhancements": null
}
},
"presetName": "Main Randomizer",
"presetName": "Enhancements - Curated Randomizer",
"isBuiltIn": true
}

View File

@@ -55,6 +55,6 @@
"gRandoEnhancements": null
}
},
"presetName": "Main Enhanced",
"presetName": "Enhancements - Curated Returning Vanilla",
"isBuiltIn": true
}

View File

@@ -6,6 +6,6 @@
"gRandoEnhancements": null
}
},
"presetName": "Main Default",
"presetName": "Enhancements - Reset to Default",
"isBuiltIn": true
}

View File

@@ -64,6 +64,6 @@
}
}
},
"presetName": "Rando Advanced",
"presetName": "Rando Seed Settings - Advanced",
"isBuiltIn": true
}

View File

@@ -46,6 +46,6 @@
}
}
},
"presetName": "Rando Beginner",
"presetName": "Rando Seed Settings - Beginner",
"isBuiltIn": true
}

View File

@@ -78,6 +78,6 @@
}
}
},
"presetName": "Rando Hell Mode",
"presetName": "Rando Seed Settings - Hell Mode",
"isBuiltIn": true
}

View File

@@ -4,6 +4,6 @@
"gRandoSettings": null
}
},
"presetName": "Rando Default",
"presetName": "Rando Seed Settings - Reset to Default",
"isBuiltIn": true
}

View File

@@ -58,6 +58,6 @@
}
}
},
"presetName": "Rando Standard",
"presetName": "Rando Seed Settings - Standard",
"isBuiltIn": true
}

View File

@@ -1,6 +1,8 @@
#include "FileSelectEnhancements.h"
#include "soh/OTRGlobals.h"
#include "soh/SohGui/SohModals.h"
#include "soh/SohGui/SohGui.hpp"
#include <array>
#include <string>
@@ -65,3 +67,36 @@ std::array<std::string, LANGUAGE_MAX> 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<SohModalWindow> modal = static_pointer_cast<SohModalWindow>(
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);
}
}

View File

@@ -7,6 +7,7 @@
extern "C" {
#endif
const char* SohFileSelect_GetSettingText(u8 optionIndex, u8 language);
void SohFileSelect_ShowPresetModal();
#ifdef __cplusplus
};
#endif

View File

@@ -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());
}

View File

@@ -252,4 +252,8 @@ void ShowRandomizerSettingsMenu() {
CVarSetString(CVAR_SETTING("Menu.RandomizerSidebarSection"), "General");
mSohMenu->Show();
}
void ShowEscMenu() {
mSohMenu->Show();
}
} // namespace SohGui

View File

@@ -38,6 +38,7 @@ void Destroy();
void RegisterPopup(std::string title, std::string message, std::string button1 = "OK", std::string button2 = "",
std::function<void()> button1callback = nullptr, std::function<void()> button2callback = nullptr);
void ShowRandomizerSettingsMenu();
void ShowEscMenu();
UIWidgets::Colors GetMenuThemeColor();
} // namespace SohGui

View File

@@ -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 };