Add modal to teach player about presets

This commit is contained in:
aMannus
2025-10-30 12:29:31 +01:00
parent a03ba65465
commit 841caab026
15 changed files with 55 additions and 12 deletions

View File

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

View File

@@ -132,6 +132,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>
@@ -137,4 +139,37 @@ const char* SohFileSelect_GetRandomizerSettingText(uint8_t optionIndex, uint8_t
const char* SohFileSelect_GetArchipelagoSettingText(uint8_t optionIndex, uint8_t language) {
return ArchipelagoSettingsMenuText[optionIndex][language].c_str();
}
}
void SohFileSelect_ShowPresetMenu() {
SohGui::ShowEscMenu();
CVarSetString(CVAR_SETTING("Menu.ActiveHeader"), "Settings");
CVarSetString(CVAR_SETTING("Menu.SettingsSidebarSection"), "Presets");
CVarSetInteger(CVAR_SETTING("Menu.HasSeenPresetModal"), 1);
}
void SohFileSelect_DismissPresetModal() {
CVarSetInteger(CVAR_SETTING("Menu.HasSeenPresetModal"), 1);
}
void SohFileSelect_ShowPresetModal() {
if (CVarGetInteger(CVAR_SETTING("Menu.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

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

View File

@@ -341,7 +341,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" } })
@@ -360,7 +360,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

@@ -265,4 +265,8 @@ void ShowRandomizerSettingsMenu() {
void ShowArchipelagoSettingsMenu() {
mArchipelagoSettingsWindow->Show();
}
void ShowEscMenu() {
mSohMenu->Show();
}
} // namespace SohGui

View File

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

View File

@@ -1455,6 +1455,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 };