Skip to content

Commit

Permalink
Menu Theme and Some Opt-ins
Browse files Browse the repository at this point in the history
  • Loading branch information
Caladius committed Jan 16, 2024
1 parent efc0569 commit 6933aaa
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 50 deletions.
120 changes: 75 additions & 45 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ std::string GetWindowButtonText(const char* text, bool menuOpen) {
};

static const char* chestStyleMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" };
static const char* uiMenuColors[9] = { "White", "Gray", "Indigo", "Red", "Dark Red", "Light Green", "Green", "Dark Green", "Yellow" };
static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" };
static const char* mirroredWorldModes[9] = {
"Disabled", "Always", "Random", "Random (Seeded)", "Dungeons",
Expand Down Expand Up @@ -95,6 +96,7 @@ std::string GetWindowButtonText(const char* text, bool menuOpen) {
"OHKO"
};
static const char* timeTravelOptions[3] = { "Disabled", "Ocarina of Time", "Any Ocarina" };
static ImVec4 colorChoice;

extern "C" SaveContext gSaveContext;

Expand Down Expand Up @@ -256,6 +258,41 @@ void DrawSettingsMenu() {
UIWidgets::Spacer(0);

if (ImGui::BeginMenu("Graphics")) {
// New
UIWidgets::CVarCombobox("Menu Theme", "gMenuTheme", uiMenuColors, {
.color = colorChoice,
.tooltip = "Change the Color Theme of the Menu Bar."
});
switch (CVarGetInteger("gMenuTheme", 0)) {
case 1:
colorChoice = ImVec4(0.4f, 0.4f, 0.4f, 0.4f);
break;
case 2:
colorChoice = ImVec4(0.24f, 0.31f, 0.71f, 1.0f);
break;
case 3:
colorChoice = ImVec4(0.5f, 0.0f, 0.0f, 1.0f);
break;
case 4:
colorChoice = ImVec4(0.3f, 0.0f, 0.0f, 1.0f);
break;
case 5:
colorChoice = ImVec4(0.0f, 0.7f, 0.0f, 1.0f);
break;
case 6:
colorChoice = ImVec4(0.0f, 0.5f, 0.0f, 1.0f);
break;
case 7:
colorChoice = ImVec4(0.0f, 0.3f, 0.0f, 1.0f);
break;
case 8:
colorChoice = ImVec4(1.0f, 0.627f, 0.0f, 1.0f);
break;
default:
colorChoice = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
break;
}
// Old
#ifndef __APPLE__
if (UIWidgets::EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true)) {
LUS::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1));
Expand Down Expand Up @@ -480,6 +517,7 @@ extern std::shared_ptr<CosmeticsEditorWindow> mCosmeticsEditorWindow;
extern std::shared_ptr<GameplayStatsWindow> mGameplayStatsWindow;

void DrawEnhancementsMenu() {

if (ImGui::BeginMenu("Enhancements"))
{
DrawPresetSelector(PRESET_TYPE_ENHANCEMENTS);
Expand All @@ -492,41 +530,52 @@ void DrawEnhancementsMenu() {
{
// new
UIWidgets::CVarSliderInt("Text Speed", "gTextSpeed", 1, 5, 1, {
.color = colorChoice,
.format = "%dx",
});
UIWidgets::CVarCheckbox("Skip Text", "gSkipText", {
.color = colorChoice,
.tooltip = "Holding down B skips text",
});
UIWidgets::CVarSliderInt("King Zora Speed", "gMweepSpeed", 1, 5, 1, {
.color = colorChoice,
.format = "%dx",
});
UIWidgets::CVarSliderInt("Biggoron Forge Time", "gForgeTime", 0, 3, 3, {
.color = colorChoice,
.tooltip = "Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword",
.format = "%d days"
});
UIWidgets::CVarSliderInt("Vine/Ladder Climb speed", "gClimbSpeed", 0, 12, 0, {
.color = colorChoice,
.format = "%dx",
});
UIWidgets::CVarSliderInt("Block pushing speed", "gFasterBlockPush", 0, 5, 0, {
.color = colorChoice,
.format = "%dx",
});
UIWidgets::CVarCheckbox("Faster Heavy Block Lift", "gFasterHeavyBlockLift", {
.color = colorChoice,
.tooltip = "Speeds up lifting silver rocks and obelisks",
});
UIWidgets::CVarCheckbox("Link as default file name", "gLinkDefaultName", {
.color = colorChoice,
.tooltip = "Allows you to have \"Link\" as a premade file name",
});
UIWidgets::CVarCheckbox("No Forced Navi", "gNoForcedNavi", {
.color = colorChoice,
.tooltip = "Prevent forced Navi conversations",
});
UIWidgets::CVarCheckbox("No Skulltula Freeze", "gSkulltulaFreeze", {
.color = colorChoice,
.tooltip = "Stops the game from freezing the player when picking up Gold Skulltulas",
});
UIWidgets::CVarCheckbox("Fast Chests", "gFastChests", {
.color = colorChoice,
.tooltip = "Kick open every chest",
});
UIWidgets::CVarCombobox("Chest size & texture matches contents", "gChestSizeAndTextureMatchesContents", chestStyleMatchesContentsOptions, {
.defaultIndex = CSMC_DISABLED,
.color = colorChoice,
.tooltip =
"Chest sizes and textures are changed to help identify the item inside.\n"
" - Major items: Large gold chests\n"
Expand All @@ -535,57 +584,38 @@ void DrawEnhancementsMenu() {
" - Small keys: Small silver chest\n"
" - Boss keys: Vanilla size and texture\n"
" - Skulltula Tokens: Small skulltula chest\n",
.defaultIndex = CSMC_DISABLED,
});
// old
UIWidgets::PaddedEnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "", 1, true, false, true);
UIWidgets::PaddedEnhancementCheckbox("Skip Text", "gSkipText", false, true);
UIWidgets::Tooltip("Holding down B skips text");
UIWidgets::PaddedEnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, "", 1, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "", 3, true, false, true);
UIWidgets::Tooltip("Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword");
UIWidgets::PaddedEnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "", 0, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("Block pushing speed +%d", "##BLOCKSPEED", "gFasterBlockPush", 0, 5, "", 0, true, false, true);
UIWidgets::PaddedEnhancementCheckbox("Faster Heavy Block Lift", "gFasterHeavyBlockLift", true, false);
UIWidgets::Tooltip("Speeds up lifting silver rocks and obelisks");
UIWidgets::PaddedEnhancementCheckbox("Link as default file name", "gLinkDefaultName", true, false);
UIWidgets::Tooltip("Allows you to have \"Link\" as a premade file name");
UIWidgets::PaddedEnhancementCheckbox("No Forced Navi", "gNoForcedNavi", true, false);
UIWidgets::Tooltip("Prevent forced Navi conversations");
UIWidgets::PaddedEnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze", true, false);
UIWidgets::Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas");
UIWidgets::PaddedEnhancementCheckbox("Fast Chests", "gFastChests", true, false);
UIWidgets::Tooltip("Kick open every chest");
UIWidgets::PaddedText("Chest size & texture matches contents", true, false);
if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestStyleMatchesContentsOptions, CSMC_DISABLED)) {
if (CVarGetInteger("gChestSizeAndTextureMatchesContents", CSMC_DISABLED) == CSMC_DISABLED) {
CVarSetInteger("gChestSizeDependsStoneOfAgony", 0);
}
}
UIWidgets::Tooltip(
"Chest sizes and textures are changed to help identify the item inside.\n"
" - Major items: Large gold chests\n"
" - Lesser items: Large brown chests\n"
" - Junk items: Small brown chests\n"
" - Small keys: Small silver chest\n"
" - Boss keys: Vanilla size and texture\n"
" - Skulltula Tokens: Small skulltula chest\n"
);
if (CVarGetInteger("gChestSizeAndTextureMatchesContents", CSMC_DISABLED) != CSMC_DISABLED) {
UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", true, false);
UIWidgets::Tooltip("Only change the size/texture of chests if you have the Stone of Agony.");
UIWidgets::CVarCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", {
.color = colorChoice,
.tooltip = "Only change the size/texture of chests if you have the Stone of Agony.",
});
}
UIWidgets::PaddedEnhancementCheckbox("Skip Pickup Messages", "gFastDrops", true, false);
UIWidgets::Tooltip("Skip pickup messages for new consumable items and bottle swipes");
UIWidgets::PaddedEnhancementCheckbox("Ask to Equip New Items", "gAskToEquip", true, false);
UIWidgets::Tooltip("Adds a prompt to equip newly-obtained swords, shields and tunics");
UIWidgets::PaddedEnhancementCheckbox("Better Owl", "gBetterOwl", true, false);
UIWidgets::Tooltip("The default response to Kaepora Gaebora is always that you understood what he said");
UIWidgets::PaddedEnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback", true, false);
UIWidgets::CVarCheckbox("Skip Pickup Messages", "gFastDrops", {
.color = colorChoice,
.tooltip = "Only change the size/texture of chests if you have the Stone of Agony.",
});
UIWidgets::CVarCheckbox("Ask to Equip New Items", "gAskToEquip", {
.color = colorChoice,
.tooltip = "Adds a prompt to equip newly-obtained swords, shields and tunics",
});
UIWidgets::CVarCheckbox("Better Owl", "gBetterOwl", {
.color = colorChoice,
.tooltip = "The default response to Kaepora Gaebora is always that you understood what he said",
});
UIWidgets::CVarCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback", {
.color = colorChoice,
.tooltip = "Skip the part where the Ocarina playback is called when you play a song",
});
bool forceSkipScarecrow = IS_RANDO &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SKIP_SCARECROWS_SONG);
static const char* forceSkipScarecrowText =
"This setting is forcefully enabled because a savefile\nwith \"Skip Scarecrow Song\" is loaded";
UIWidgets::Tooltip("Skip the part where the Ocarina playback is called when you play a song");
// old



UIWidgets::PaddedEnhancementCheckbox("Skip Scarecrow Song", "gSkipScarecrow", true, false,
forceSkipScarecrow, forceSkipScarecrowText, UIWidgets::CheckboxGraphics::Checkmark);
UIWidgets::Tooltip("Pierre appears when Ocarina is pulled out. Requires learning scarecrow song.");
Expand Down
10 changes: 5 additions & 5 deletions soh/soh/UIWidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ namespace UIWidgets {
ImGui::PushID(label);
bool dirty = false;
float startX = ImGui::GetCursorPosX();
const char* invisibleLabel = ("##" + std::string(label)).c_str();
const char* invisibleLabel = ""; //("##" + std::string(label)).c_str();
ImGui::BeginDisabled(options.disabled);
PushStyleCheckbox(options.color);
if (options.alignment == ComponentAlignment::Right) {
Expand Down Expand Up @@ -883,7 +883,7 @@ namespace UIWidgets {
bool Combobox(const char* label, uint8_t* value, std::span<const char*, std::dynamic_extent> comboArray, const ComboboxOptions& options) {
bool dirty = false;
float startX = ImGui::GetCursorPosX();
const char* invisibleLabel = ("##" + std::string(label)).c_str();
const char* invisibleLabel = ""; //("##" + std::string(label)).c_str();
ImGui::PushID(label);
ImGui::BeginGroup();
ImGui::BeginDisabled(options.disabled);
Expand Down Expand Up @@ -1024,7 +1024,7 @@ namespace UIWidgets {

bool CVarSliderInt(const char* label, const char* cvarName, int32_t min, int32_t max, const int32_t defaultValue, const SliderOptions& options){
bool dirty = false;
const char* invisibleLabel = ("##" + std::string(label)).c_str();
const char* invisibleLabel = "";//("##" + std::string(label)).c_str();
int32_t value = CVarGetInteger(cvarName, defaultValue);
ImGui::PushID(label);
ImGui::BeginGroup();
Expand All @@ -1042,7 +1042,7 @@ namespace UIWidgets {
}
}
if (options.showButtons) {
if (Button("-", { .size = Sizes::Inline, .color = options.color }) && value > min) {
if (Button("-", { .color = options.color, .size = Sizes::Inline }) && value > min) {
value--;
CVarSetInteger(cvarName, value);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Expand All @@ -1061,7 +1061,7 @@ namespace UIWidgets {
if (options.showButtons) {
ImGui::SameLine(0, 3.0f);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (Button("+", { .size = Sizes::Inline, .color = options.color }) && value < max) {
if (Button("+", { .color = options.color, .size = Sizes::Inline }) && value < max) {
value++;
CVarSetInteger(cvarName, value);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Expand Down

0 comments on commit 6933aaa

Please sign in to comment.