Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved rando settings #3980

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 65 additions & 65 deletions soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,95 +639,95 @@ void InitEntranceTrackingData() {
SortEntranceListByType(destListSortedByType, 1);
}

void EntranceTrackerWindow::DrawElement() {
void EntranceTrackerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);

if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
if (!ImGui::Begin("Entrance Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

// Begin tracker settings
ImGui::SetNextItemOpen(false, ImGuiCond_Once);
if (ImGui::TreeNode("Tracker Settings")) {
// Reduce indentation from the tree node for the table
ImGui::SetCursorPosX((ImGui::GetCursorPosX() / 2) + 4.0f);
if (ImGui::BeginTable("entranceTrackerSettings", 1, ImGuiTableFlags_BordersInnerH)) {

ImGui::TableNextColumn();

UIWidgets::Spacer(0);
ImGui::TextWrapped("The entrance tracker will only track shuffled entrances");
UIWidgets::Spacer(0);

if (ImGui::BeginTable("entranceTrackerSettings", 1, ImGuiTableFlags_BordersInnerH)) {
ImGui::TableNextColumn();

if (ImGui::BeginTable("entranceTrackerSubSettings", 2, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_SizingStretchProp)) {

ImGui::TableNextColumn();

UIWidgets::Spacer(0);
ImGui::TextWrapped("The entrance tracker will only track shuffled entrances");
ImGui::Text("Sort By");
UIWidgets::EnhancementRadioButton("To", CVAR_TRACKER_ENTRANCE("SortBy"), 0);
UIWidgets::Tooltip("Sort entrances by the original source entrance");
UIWidgets::EnhancementRadioButton("From", CVAR_TRACKER_ENTRANCE("SortBy"), 1);
UIWidgets::Tooltip("Sort entrances by the overrided destination");

UIWidgets::Spacer(2.0f);

ImGui::Text("List Items");
UIWidgets::PaddedEnhancementCheckbox("Auto scroll", CVAR_TRACKER_ENTRANCE("AutoScroll"), true, false);
UIWidgets::Tooltip("Automatically scroll to the first aviable entrance in the current scene");
UIWidgets::PaddedEnhancementCheckbox("Highlight previous", CVAR_TRACKER_ENTRANCE("HighlightPrevious"), true, false);
UIWidgets::Tooltip("Highlight the previous entrance that Link came from");
UIWidgets::PaddedEnhancementCheckbox("Highlight available", CVAR_TRACKER_ENTRANCE("HighlightAvailable"), true, false);
UIWidgets::Tooltip("Highlight available entrances in the current scene");
UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", CVAR_TRACKER_ENTRANCE("CollapseUndiscovered"), true, false);
UIWidgets::Tooltip("Collapse undiscovered entrances towards the bottom of each group");
bool disableHideReverseEntrances = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_ON;
static const char* disableHideReverseEntrancesText = "This option is disabled because \"Decouple Entrances\" is enabled.";
UIWidgets::PaddedEnhancementCheckbox("Hide reverse", CVAR_TRACKER_ENTRANCE("HideReverseEntrances"), true, false,
disableHideReverseEntrances, disableHideReverseEntrancesText, UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Hide reverse entrance transitions when Decouple Entrances is off");
UIWidgets::Spacer(0);

ImGui::TableNextColumn();

if (ImGui::BeginTable("entranceTrackerSubSettings", 2, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_SizingStretchProp)) {

ImGui::TableNextColumn();

ImGui::Text("Sort By");
UIWidgets::EnhancementRadioButton("To", CVAR_TRACKER_ENTRANCE("SortBy"), 0);
UIWidgets::Tooltip("Sort entrances by the original source entrance");
UIWidgets::EnhancementRadioButton("From", CVAR_TRACKER_ENTRANCE("SortBy"), 1);
UIWidgets::Tooltip("Sort entrances by the overrided destination");

UIWidgets::Spacer(2.0f);

ImGui::Text("List Items");
UIWidgets::PaddedEnhancementCheckbox("Auto scroll", CVAR_TRACKER_ENTRANCE("AutoScroll"), true, false);
UIWidgets::Tooltip("Automatically scroll to the first aviable entrance in the current scene");
UIWidgets::PaddedEnhancementCheckbox("Highlight previous", CVAR_TRACKER_ENTRANCE("HighlightPrevious"), true, false);
UIWidgets::Tooltip("Highlight the previous entrance that Link came from");
UIWidgets::PaddedEnhancementCheckbox("Highlight available", CVAR_TRACKER_ENTRANCE("HighlightAvailable"), true, false);
UIWidgets::Tooltip("Highlight available entrances in the current scene");
UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", CVAR_TRACKER_ENTRANCE("CollapseUndiscovered"), true, false);
UIWidgets::Tooltip("Collapse undiscovered entrances towards the bottom of each group");
bool disableHideReverseEntrances = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_ON;
static const char* disableHideReverseEntrancesText = "This option is disabled because \"Decouple Entrances\" is enabled.";
UIWidgets::PaddedEnhancementCheckbox("Hide reverse", CVAR_TRACKER_ENTRANCE("HideReverseEntrances"), true, false,
disableHideReverseEntrances, disableHideReverseEntrancesText, UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Hide reverse entrance transitions when Decouple Entrances is off");
UIWidgets::Spacer(0);
ImGui::Text("Group By");
UIWidgets::EnhancementRadioButton("Area", CVAR_TRACKER_ENTRANCE("GroupBy"), 0);
UIWidgets::Tooltip("Group entrances by their area");
UIWidgets::EnhancementRadioButton("Type", CVAR_TRACKER_ENTRANCE("GroupBy"), 1);
UIWidgets::Tooltip("Group entrances by their entrance type");

ImGui::TableNextColumn();
UIWidgets::Spacer(2.0f);

ImGui::Text("Group By");
UIWidgets::EnhancementRadioButton("Area", CVAR_TRACKER_ENTRANCE("GroupBy"), 0);
UIWidgets::Tooltip("Group entrances by their area");
UIWidgets::EnhancementRadioButton("Type", CVAR_TRACKER_ENTRANCE("GroupBy"), 1);
UIWidgets::Tooltip("Group entrances by their entrance type");
ImGui::Text("Spoiler Reveal");
UIWidgets::PaddedEnhancementCheckbox("Show \"To\"", CVAR_TRACKER_ENTRANCE("ShowTo"), true, false);
UIWidgets::Tooltip("Reveal the \"To\" entrance for undiscovered entrances");
UIWidgets::PaddedEnhancementCheckbox("Show \"From\"", CVAR_TRACKER_ENTRANCE("ShowFrom"), true, false);
UIWidgets::Tooltip("Reveal the \"From\" entrance for undiscovered entrances");

UIWidgets::Spacer(2.0f);
ImGui::EndTable();
}

ImGui::Text("Spoiler Reveal");
UIWidgets::PaddedEnhancementCheckbox("Show \"To\"", CVAR_TRACKER_ENTRANCE("ShowTo"), true, false);
UIWidgets::Tooltip("Reveal the \"To\" entrance for undiscovered entrances");
UIWidgets::PaddedEnhancementCheckbox("Show \"From\"", CVAR_TRACKER_ENTRANCE("ShowFrom"), true, false);
UIWidgets::Tooltip("Reveal the \"From\" entrance for undiscovered entrances");
ImGui::TableNextColumn();

ImGui::EndTable();
}
ImGui::SetNextItemOpen(false, ImGuiCond_Once);
if (ImGui::TreeNode("Legend")) {
ImGui::TextColored(ImColor(COLOR_ORANGE), "Last Entrance");
ImGui::TextColored(ImColor(COLOR_GREEN), "Available Entrances");
ImGui::TextColored(ImColor(COLOR_GRAY), "Undiscovered Entrances");
ImGui::TreePop();
}

ImGui::TableNextColumn();
UIWidgets::Spacer(0);

ImGui::SetNextItemOpen(false, ImGuiCond_Once);
if (ImGui::TreeNode("Legend")) {
ImGui::TextColored(ImColor(COLOR_ORANGE), "Last Entrance");
ImGui::TextColored(ImColor(COLOR_GREEN), "Available Entrances");
ImGui::TextColored(ImColor(COLOR_GRAY), "Undiscovered Entrances");
ImGui::TreePop();
}
ImGui::EndTable();
}

UIWidgets::Spacer(0);
ImGui::End();
}

ImGui::EndTable();
}
void EntranceTrackerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);

ImGui::TreePop();
} else {
UIWidgets::PaddedSeparator();
if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

static ImGuiTextFilter locationSearch;
Expand Down
10 changes: 10 additions & 0 deletions soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ s16 GetLastEntranceOverride();
s16 GetCurrentGrottoId();
const EntranceData* GetEntranceData(s16);

class EntranceTrackerSettingsWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;

protected:
void InitElement() override {};
void DrawElement() override;
void UpdateElement() override {};
};

class EntranceTrackerWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;
Expand Down
6 changes: 5 additions & 1 deletion soh/soh/SohGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ namespace SohGui {
std::shared_ptr<GameplayStatsWindow> mGameplayStatsWindow;
std::shared_ptr<CheckTracker::CheckTrackerSettingsWindow> mCheckTrackerSettingsWindow;
std::shared_ptr<CheckTracker::CheckTrackerWindow> mCheckTrackerWindow;
std::shared_ptr<EntranceTrackerSettingsWindow> mEntranceTrackerSettingsWindow;
std::shared_ptr<EntranceTrackerWindow> mEntranceTrackerWindow;
std::shared_ptr<ItemTrackerSettingsWindow> mItemTrackerSettingsWindow;
std::shared_ptr<ItemTrackerWindow> mItemTrackerWindow;
Expand Down Expand Up @@ -191,8 +192,10 @@ namespace SohGui {
gui->AddGuiWindow(mCheckTrackerWindow);
mCheckTrackerSettingsWindow = std::make_shared<CheckTracker::CheckTrackerSettingsWindow>(CVAR_WINDOW("CheckTrackerSettings"), "Check Tracker Settings");
gui->AddGuiWindow(mCheckTrackerSettingsWindow);
mEntranceTrackerWindow = std::make_shared<EntranceTrackerWindow>(CVAR_WINDOW("EntranceTracker"),"Entrance Tracker");
mEntranceTrackerWindow = std::make_shared<EntranceTrackerWindow>(CVAR_WINDOW("EntranceTracker"), "Entrance Tracker");
gui->AddGuiWindow(mEntranceTrackerWindow);
mEntranceTrackerSettingsWindow = std::make_shared<EntranceTrackerSettingsWindow>(CVAR_WINDOW("EntranceTrackerSettings"), "Entrance Tracker Settings");
gui->AddGuiWindow(mEntranceTrackerSettingsWindow);
mItemTrackerWindow = std::make_shared<ItemTrackerWindow>(CVAR_WINDOW("ItemTracker"), "Item Tracker");
gui->AddGuiWindow(mItemTrackerWindow);
mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>(CVAR_WINDOW("ItemTrackerSettings"), "Item Tracker Settings");
Expand All @@ -213,6 +216,7 @@ namespace SohGui {
mItemTrackerWindow = nullptr;
mItemTrackerSettingsWindow = nullptr;
mEntranceTrackerWindow = nullptr;
mEntranceTrackerSettingsWindow = nullptr;
mCheckTrackerWindow = nullptr;
mCheckTrackerSettingsWindow = nullptr;
mGameplayStatsWindow = nullptr;
Expand Down
55 changes: 48 additions & 7 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#include "Enhancements/randomizer/randomizer_settings_window.h"
#include "Enhancements/resolution-editor/ResolutionEditor.h"

// FA icons are kind of wonky, if they worked how I expected them to the "+ 2.0f" wouldn't be needed, but
// they don't work how I expect them to so I added that because it looked good when I eyeballed it
#define FA_ICON_BUTTON_FRAME_PADDING_X(icon) (((optionsButtonSize.x - ImGui::CalcTextSize(icon).x) / 2) + 2.0f)

extern bool ToggleAltAssetsAtEndOfFrame;
extern bool isBetaQuestEnabled;

Expand Down Expand Up @@ -1963,6 +1967,7 @@ extern std::shared_ptr<RandomizerSettingsWindow> mRandomizerSettingsWindow;
extern std::shared_ptr<ItemTrackerWindow> mItemTrackerWindow;
extern std::shared_ptr<ItemTrackerSettingsWindow> mItemTrackerSettingsWindow;
extern std::shared_ptr<EntranceTrackerWindow> mEntranceTrackerWindow;
extern std::shared_ptr<EntranceTrackerSettingsWindow> mEntranceTrackerSettingsWindow;
extern std::shared_ptr<CheckTracker::CheckTrackerWindow> mCheckTrackerWindow;
extern std::shared_ptr<CheckTracker::CheckTrackerSettingsWindow> mCheckTrackerSettingsWindow;
extern "C" u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey);
Expand All @@ -1981,48 +1986,84 @@ void DrawRandomizerMenu() {
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));

#ifdef __WIIU__
Malkierian marked this conversation as resolved.
Show resolved Hide resolved
static ImVec2 buttonSize(200.0f * 2.0f, 0.0f);
static ImVec2 buttonWithOptionsSize(170.0f * 2.0f, 0.0f);
static ImVec2 optionsButtonSize(25.0f * 2.0f, 0.0f);
static float separationToOptionsButton = 5.0f * 2.0f;
#else
static ImVec2 buttonSize(200.0f, 0.0f);
static ImVec2 buttonWithOptionsSize(170.0f, 0.0f);
static ImVec2 optionsButtonSize(25.0f, 0.0f);
static float separationToOptionsButton = 5.0f;
#endif

if (mRandomizerSettingsWindow) {
if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger(CVAR_WINDOW("RandomizerSettings"), 0)).c_str(), buttonSize)) {
mRandomizerSettingsWindow->ToggleVisibility();
}
}

UIWidgets::Spacer(0);

if (mItemTrackerWindow) {
if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger(CVAR_WINDOW("ItemTracker"), 0)).c_str(), buttonSize)) {
if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger(CVAR_WINDOW("ItemTracker"), 0)).c_str(), buttonWithOptionsSize)) {
mItemTrackerWindow->ToggleVisibility();
}
}

UIWidgets::Spacer(0);
ImGui::SameLine(0, 0);
ImVec2 cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + separationToOptionsButton, cursor.y));

if (mItemTrackerSettingsWindow) {
if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVarGetInteger(CVAR_WINDOW("ItemTrackerSettings"), 0)).c_str(), buttonSize)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(FA_ICON_BUTTON_FRAME_PADDING_X(ICON_FA_COG), 6.0f));
if (ImGui::Button(ICON_FA_COG "##ItemTrackerSettings", optionsButtonSize)) {
mItemTrackerSettingsWindow->ToggleVisibility();
}
ImGui::PopStyleVar();
}

UIWidgets::Spacer(0);
if (mEntranceTrackerWindow) {
if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger(CVAR_WINDOW("EntranceTracker"), 0)).c_str(), buttonSize)) {
if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger(CVAR_WINDOW("EntranceTracker"), 0)).c_str(), buttonWithOptionsSize)) {
mEntranceTrackerWindow->ToggleVisibility();
}
}

ImGui::SameLine(0, 0);
cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + separationToOptionsButton, cursor.y));

if (mEntranceTrackerSettingsWindow) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(FA_ICON_BUTTON_FRAME_PADDING_X(ICON_FA_COG), 6.0f));
if (ImGui::Button(ICON_FA_COG "##EntranceTrackerSettings", optionsButtonSize)) {
mEntranceTrackerSettingsWindow->ToggleVisibility();
}
ImGui::PopStyleVar();
}

UIWidgets::Spacer(0);

if (mCheckTrackerWindow) {
if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger(CVAR_WINDOW("CheckTracker"), 0)).c_str(), buttonSize)) {
if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger(CVAR_WINDOW("CheckTracker"), 0)).c_str(), buttonWithOptionsSize)) {
mCheckTrackerWindow->ToggleVisibility();
}
}
UIWidgets::Spacer(0);

ImGui::SameLine(0, 0);
cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + separationToOptionsButton, cursor.y));

if (mCheckTrackerSettingsWindow) {
if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVarGetInteger(CVAR_WINDOW("CheckTrackerSettings"), 0)).c_str(), buttonSize)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(FA_ICON_BUTTON_FRAME_PADDING_X(ICON_FA_COG), 6.0f));
if (ImGui::Button(ICON_FA_COG "##CheckTrackerSettings", optionsButtonSize)) {
mCheckTrackerSettingsWindow->ToggleVisibility();
}
ImGui::PopStyleVar();
}

ImGui::PopStyleVar(3);
ImGui::PopStyleColor(1);

Expand Down
Loading