Adds a modal registration for pressing F1 and confirming Quit from the menu button. (#5154)

Fixes near shortcuts gossip stone name to include "grotto" to signify it's in the grotto.
This commit is contained in:
Malkierian 2025-03-19 15:57:08 -07:00 committed by GitHub
parent 4243eb67ae
commit 6ad503e1d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 6 deletions

View file

@ -992,7 +992,7 @@ void Rando::StaticData::InitLocationTable() { //
locationTable[RC_HF_OPEN_GROTTO_GOSSIP_STONE] = Location::HintStone(RC_HF_OPEN_GROTTO_GOSSIP_STONE, RCQUEST_BOTH, RCAREA_HYRULE_FIELD, SCENE_GROTTOS, -22947, "Open Grotto Gossip Stone");
locationTable[RC_KAK_OPEN_GROTTO_GOSSIP_STONE] = Location::HintStone(RC_KAK_OPEN_GROTTO_GOSSIP_STONE, RCQUEST_BOTH, RCAREA_KAKARIKO_VILLAGE, SCENE_GROTTOS, -22984, "Open Grotto Gossip Stone");
locationTable[RC_ZR_OPEN_GROTTO_GOSSIP_STONE] = Location::HintStone(RC_ZR_OPEN_GROTTO_GOSSIP_STONE, RCQUEST_BOTH, RCAREA_ZORAS_RIVER, SCENE_GROTTOS, -22985, "Open Grotto Gossip Stone");
locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_GOSSIP_STONE] = Location::HintStone(RC_LW_NEAR_SHORTCUTS_GROTTO_GOSSIP_STONE, RCQUEST_BOTH, RCAREA_LOST_WOODS, SCENE_GROTTOS, -22964, "Near Shortcuts Gossip Stone");
locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_GOSSIP_STONE] = Location::HintStone(RC_LW_NEAR_SHORTCUTS_GROTTO_GOSSIP_STONE, RCQUEST_BOTH, RCAREA_LOST_WOODS, SCENE_GROTTOS, -22964, "Near Shortcuts Grotto Gossip Stone");
locationTable[RC_DMT_STORMS_GROTTO_GOSSIP_STONE] = Location::HintStone(RC_DMT_STORMS_GROTTO_GOSSIP_STONE, RCQUEST_BOTH, RCAREA_DEATH_MOUNTAIN_TRAIL, SCENE_GROTTOS, -23255, "Storms Grotto Gossip Stone");
locationTable[RC_DMC_UPPER_GROTTO_GOSSIP_STONE] = Location::HintStone(RC_DMC_UPPER_GROTTO_GOSSIP_STONE, RCQUEST_BOTH, RCAREA_DEATH_MOUNTAIN_CRATER, SCENE_GROTTOS, -23802, "Upper Grotto Gossip Stone");

View file

@ -1293,6 +1293,11 @@ extern "C" void Graph_StartFrame() {
OTRGlobals::Instance->context->GetWindow()->SetLastScancode(-1);
switch (dwScancode) {
case KbScancode::LUS_KB_F1: {
std::shared_ptr<SohModalWindow> modal = static_pointer_cast<SohModalWindow>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Modal Window"));
modal->RegisterPopup("Menu Moved", "The menubar, accessed by hitting F1, no longer exists.\nThe new menu can be accessed by hitting the Esc button instead.", "OK");
break;
}
case KbScancode::LUS_KB_F5: {
if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) {
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->

View file

@ -4,6 +4,7 @@
#include "soh/Enhancements/controls/SohInputEditorWindow.h"
#include "window/gui/GuiMenuBar.h"
#include "window/gui/GuiElement.h"
#include "SohModals.h"
#include <variant>
#include <spdlog/fmt/fmt.h>
#include "variables.h"
@ -19,7 +20,9 @@ std::vector<ImVec2> windowTypeSizes = { {} };
extern std::unordered_map<s16, const char*> warpPointSceneList;
extern void Warp();
namespace SohGui {}
namespace SohGui {
extern std::shared_ptr<SohModalWindow> mModalWindow;
}
namespace Ship {
std::string disabledTempTooltip;
@ -104,6 +107,10 @@ void Menu::UpdateWindowBackendObjects() {
}
}
bool Menu::IsMenuPopped() {
return popped;
}
UIWidgets::Colors Menu::GetMenuThemeColor() {
return menuThemeIndex;
}
@ -650,10 +657,13 @@ void Menu::DrawElement() {
options3.size = UIWidgets::Sizes::Inline;
options3.tooltip = "Quit SoH";
if (UIWidgets::Button(ICON_FA_POWER_OFF, options3)) {
if (!popped) {
ToggleVisibility();
SohGui::mModalWindow->RegisterPopup("Quit SoH", "Are you sure you want to quit SoH?", "Quit", "Cancel", []() {
std::shared_ptr<Menu> menu = static_pointer_cast<Menu>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenu());
if (!menu->IsMenuPopped()) {
menu->ToggleVisibility();
}
Ship::Context::GetInstance()->GetWindow()->Close();
}, nullptr);
}
ImGui::PopStyleVar();
ImGui::SameLine();

View file

@ -21,6 +21,7 @@ class Menu : public GuiWindow {
void InsertSidebarSearch();
void RemoveSidebarSearch();
void UpdateWindowBackendObjects();
bool IsMenuPopped();
UIWidgets::Colors GetMenuThemeColor();
void MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors menuThemeIndex);