diff --git a/soh/soh/Enhancements/Presets/Presets.cpp b/soh/soh/Enhancements/Presets/Presets.cpp index 13ae0da8c..59e227ffe 100644 --- a/soh/soh/Enhancements/Presets/Presets.cpp +++ b/soh/soh/Enhancements/Presets/Presets.cpp @@ -17,10 +17,10 @@ extern std::shared_ptr mSohMenu; } void BlankButton() { - ImGui::PushStyleColor(ImGuiCol_Button, {0, 0, 0, 0}); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, {0, 0, 0, 0}); - ImGui::PushStyleColor(ImGuiCol_ButtonActive, {0, 0, 0, 0}); - ImGui::PushStyleColor(ImGuiCol_Border, {0, 0, 0, 0}); + ImGui::PushStyleColor(ImGuiCol_Button, { 0, 0, 0, 0 }); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 0, 0, 0 }); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 0, 0, 0 }); + ImGui::PushStyleColor(ImGuiCol_Border, { 0, 0, 0, 0 }); ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(8.0f, 8.0f)); ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 5.0f); @@ -114,7 +114,8 @@ enum PresetSection { struct PresetInfo { nlohmann::json presetValues; std::string fileName; - bool applySettings = true, applyEnhancements = true, applyAudio = true, applyCosmetics = true, applyRando = true, applyTrackers = true; + bool applySettings = true, applyEnhancements = true, applyAudio = true, applyCosmetics = true, applyRando = true, + applyTrackers = true; }; static std::map presets; @@ -137,7 +138,8 @@ void DrawSectionCheck(const std::string& name, bool empty, bool* pointer, std::s } else { ImGui::PushFont(OTRGlobals::Instance->fontMono); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (ImGui::GetStyle().FramePadding.y)); - UIWidgets::Checkbox(("##" + name + section).c_str(), pointer, {.defaultValue = true, .padding = {6.0f, 6.0f}, .color = THEME_COLOR}); + UIWidgets::Checkbox(("##" + name + section).c_str(), pointer, + { .defaultValue = true, .padding = { 6.0f, 6.0f }, .color = THEME_COLOR }); ImGui::PopFont(); } } @@ -152,7 +154,8 @@ void LoadPresets() { auto json = nlohmann::json::parse(ifs); try { if (!json.contains("presetName")) { - spdlog::error(fmt::format("Attempted to load file {} as a preset, but was not a preset file.", preset.path().filename().string())); + spdlog::error(fmt::format("Attempted to load file {} as a preset, but was not a preset file.", + preset.path().filename().string())); return; } presets[json["presetName"]].presetValues = json; @@ -172,63 +175,93 @@ void SavePreset(std::string& presetName) { file.close(); } -std::vector sections = { CVAR_PREFIX_SETTING, CVAR_PREFIX_WINDOW, CVAR_PREFIX_ENHANCEMENT, CVAR_PREFIX_RANDOMIZER_ENHANCEMENT, - CVAR_PREFIX_AUDIO, CVAR_PREFIX_COSMETIC, CVAR_PREFIX_RANDOMIZER_SETTING, CVAR_PREFIX_TRACKER, CVAR_PREFIX_CHEAT }; +std::vector sections = { + CVAR_PREFIX_SETTING, CVAR_PREFIX_WINDOW, CVAR_PREFIX_ENHANCEMENT, CVAR_PREFIX_RANDOMIZER_ENHANCEMENT, + CVAR_PREFIX_AUDIO, CVAR_PREFIX_COSMETIC, CVAR_PREFIX_RANDOMIZER_SETTING, CVAR_PREFIX_TRACKER, + CVAR_PREFIX_CHEAT +}; static std::string newPresetName; -static bool newPresetSettings = true, newPresetEnhancements = true, newPresetAudio = true, newPresetCosmetics = true, newPresetRando = true, newPresetTrackers = true; +static bool newPresetSettings = true, newPresetEnhancements = true, newPresetAudio = true, newPresetCosmetics = true, + newPresetRando = true, newPresetTrackers = true; void PresetsCustomWidget(WidgetInfo& info) { ImGui::PushFont(OTRGlobals::Instance->fontMonoLargest); if (UIWidgets::Button("New Preset", UIWidgets::ButtonOptions().Size(UIWidgets::Sizes::Inline).Color(THEME_COLOR))) { ImGui::OpenPopup("newPreset"); } - ImGui::SetNextWindowSize({400, 400}); + ImGui::SetNextWindowSize({ 400, 400 }); if (ImGui::BeginPopup("newPreset", ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | - ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | - ImGuiWindowFlags_NoTitleBar)) { + ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | + ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoTitleBar)) { bool nameExists = presets.contains(newPresetName); - UIWidgets::InputString("Preset Name", &newPresetName, UIWidgets::InputOptions().Color(THEME_COLOR).Size({200, 40}) - .ComponentAlignment(UIWidgets::ComponentAlignments::Right).LabelPosition(UIWidgets::LabelPositions::Near).ErrorText("Preset name already exists").HasError(nameExists)); + UIWidgets::InputString("Preset Name", &newPresetName, + UIWidgets::InputOptions() + .Color(THEME_COLOR) + .Size({ 200, 40 }) + .ComponentAlignment(UIWidgets::ComponentAlignments::Right) + .LabelPosition(UIWidgets::LabelPositions::Near) + .ErrorText("Preset name already exists") + .HasError(nameExists)); nameExists = presets.contains(newPresetName); - bool noneSelected = !newPresetSettings && !newPresetEnhancements && !newPresetAudio && !newPresetCosmetics && !newPresetRando && !newPresetTrackers; - const char* disabledTooltip = (newPresetName.empty() ? "Preset name is empty" : (noneSelected ? "No sections selected" : "Preset name already exists")); - UIWidgets::Checkbox("Save Settings", &newPresetSettings, UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({6.0f, 6.0f})); - UIWidgets::Checkbox("Save Enhancements", &newPresetEnhancements, UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({6.0f, 6.0f})); - UIWidgets::Checkbox("Save Audio", &newPresetAudio, UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({6.0f, 6.0f})); - UIWidgets::Checkbox("Save Cosmetics", &newPresetCosmetics, UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({6.0f, 6.0f})); - UIWidgets::Checkbox("Save Rando Settings", &newPresetRando, UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({6.0f, 6.0f})); - UIWidgets::Checkbox("Save Trackers", &newPresetTrackers, UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({6.0f, 6.0f})); - if (UIWidgets::Button("Save", UIWidgets::ButtonOptions({.disabled = nameExists || noneSelected || newPresetName.empty(), .disabledTooltip = disabledTooltip}) - .Padding({6.0f, 6.0f}).Color(THEME_COLOR))) { + bool noneSelected = !newPresetSettings && !newPresetEnhancements && !newPresetAudio && !newPresetCosmetics && + !newPresetRando && !newPresetTrackers; + const char* disabledTooltip = + (newPresetName.empty() ? "Preset name is empty" + : (noneSelected ? "No sections selected" : "Preset name already exists")); + UIWidgets::Checkbox("Save Settings", &newPresetSettings, + UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({ 6.0f, 6.0f })); + UIWidgets::Checkbox("Save Enhancements", &newPresetEnhancements, + UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({ 6.0f, 6.0f })); + UIWidgets::Checkbox("Save Audio", &newPresetAudio, + UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({ 6.0f, 6.0f })); + UIWidgets::Checkbox("Save Cosmetics", &newPresetCosmetics, + UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({ 6.0f, 6.0f })); + UIWidgets::Checkbox("Save Rando Settings", &newPresetRando, + UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({ 6.0f, 6.0f })); + UIWidgets::Checkbox("Save Trackers", &newPresetTrackers, + UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({ 6.0f, 6.0f })); + if (UIWidgets::Button( + "Save", UIWidgets::ButtonOptions({ .disabled = nameExists || noneSelected || newPresetName.empty(), + .disabledTooltip = disabledTooltip }) + .Padding({ 6.0f, 6.0f }) + .Color(THEME_COLOR))) { presets[newPresetName] = {}; auto config = Ship::Context::GetInstance()->GetConfig()->GetNestedJson(); if (newPresetSettings) { - presets[newPresetName].presetValues["blocks"]["settings"][CVAR_PREFIX_SETTING] = config["CVars"][CVAR_PREFIX_SETTING]; - presets[newPresetName].presetValues["blocks"]["windows"][CVAR_PREFIX_WINDOW] = config["CVars"][CVAR_PREFIX_WINDOW]; + presets[newPresetName].presetValues["blocks"]["settings"][CVAR_PREFIX_SETTING] = + config["CVars"][CVAR_PREFIX_SETTING]; + presets[newPresetName].presetValues["blocks"]["windows"][CVAR_PREFIX_WINDOW] = + config["CVars"][CVAR_PREFIX_WINDOW]; } if (newPresetEnhancements) { - presets[newPresetName].presetValues["blocks"]["enhancements"][CVAR_PREFIX_ENHANCEMENT] = config["CVars"][CVAR_PREFIX_ENHANCEMENT]; - presets[newPresetName].presetValues["blocks"]["randoEnhancements"][CVAR_PREFIX_RANDOMIZER_ENHANCEMENT] = config["CVars"][CVAR_PREFIX_RANDOMIZER_ENHANCEMENT]; + presets[newPresetName].presetValues["blocks"]["enhancements"][CVAR_PREFIX_ENHANCEMENT] = + config["CVars"][CVAR_PREFIX_ENHANCEMENT]; + presets[newPresetName].presetValues["blocks"]["randoEnhancements"][CVAR_PREFIX_RANDOMIZER_ENHANCEMENT] = + config["CVars"][CVAR_PREFIX_RANDOMIZER_ENHANCEMENT]; } if (newPresetAudio) { - presets[newPresetName].presetValues["blocks"]["audio"][CVAR_PREFIX_AUDIO] = config["CVars"][CVAR_PREFIX_AUDIO]; + presets[newPresetName].presetValues["blocks"]["audio"][CVAR_PREFIX_AUDIO] = + config["CVars"][CVAR_PREFIX_AUDIO]; } if (newPresetCosmetics) { - presets[newPresetName].presetValues["blocks"]["cosmetics"][CVAR_PREFIX_COSMETIC] = config["CVars"][CVAR_PREFIX_COSMETIC]; + presets[newPresetName].presetValues["blocks"]["cosmetics"][CVAR_PREFIX_COSMETIC] = + config["CVars"][CVAR_PREFIX_COSMETIC]; } if (newPresetRando) { - presets[newPresetName].presetValues["blocks"]["rando"][CVAR_PREFIX_RANDOMIZER_SETTING] = config["CVars"][CVAR_PREFIX_RANDOMIZER_SETTING]; + presets[newPresetName].presetValues["blocks"]["rando"][CVAR_PREFIX_RANDOMIZER_SETTING] = + config["CVars"][CVAR_PREFIX_RANDOMIZER_SETTING]; } if (newPresetTrackers) { - presets[newPresetName].presetValues["blocks"]["trackers"][CVAR_PREFIX_TRACKER] = config["CVars"][CVAR_PREFIX_TRACKER]; + presets[newPresetName].presetValues["blocks"]["trackers"][CVAR_PREFIX_TRACKER] = + config["CVars"][CVAR_PREFIX_TRACKER]; } presets[newPresetName].fileName = newPresetName; SavePreset(newPresetName); newPresetName = ""; ImGui::CloseCurrentPopup(); } - if (UIWidgets::Button("Cancel", UIWidgets::ButtonOptions().Padding({6.0f, 6.0f}).Color(THEME_COLOR))) { + if (UIWidgets::Button("Cancel", UIWidgets::ButtonOptions().Padding({ 6.0f, 6.0f }).Color(THEME_COLOR))) { ImGui::CloseCurrentPopup(); } ImGui::EndPopup(); @@ -242,8 +275,10 @@ void PresetsCustomWidget(WidgetInfo& info) { ImGui::TableSetupColumn("Cosmetics"); ImGui::TableSetupColumn("Randomizer"); ImGui::TableSetupColumn("Trackers"); - ImGui::TableSetupColumn("Apply", ImGuiTableColumnFlags_WidthFixed, ImGui::CalcTextSize("Apply").x + ImGui::GetStyle().FramePadding.x * 2); - ImGui::TableSetupColumn("Delete", ImGuiTableColumnFlags_WidthFixed, ImGui::CalcTextSize("Delete").x + ImGui::GetStyle().FramePadding.x * 2); + ImGui::TableSetupColumn("Apply", ImGuiTableColumnFlags_WidthFixed, + ImGui::CalcTextSize("Apply").x + ImGui::GetStyle().FramePadding.x * 2); + ImGui::TableSetupColumn("Delete", ImGuiTableColumnFlags_WidthFixed, + ImGui::CalcTextSize("Delete").x + ImGui::GetStyle().FramePadding.x * 2); BlankButton(); ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -285,24 +320,27 @@ void PresetsCustomWidget(WidgetInfo& info) { ImGui::TableNextColumn(); DrawSectionCheck(name, !info.presetValues["blocks"].contains("settings"), &info.applySettings, "settings"); ImGui::TableNextColumn(); - DrawSectionCheck(name, !info.presetValues["blocks"].contains("enhancements"), &info.applyEnhancements, "enhancements"); + DrawSectionCheck(name, !info.presetValues["blocks"].contains("enhancements"), &info.applyEnhancements, + "enhancements"); ImGui::TableNextColumn(); DrawSectionCheck(name, !info.presetValues["blocks"].contains("audio"), &info.applyAudio, "audio"); ImGui::TableNextColumn(); - DrawSectionCheck(name, !info.presetValues["blocks"].contains("cosmetics"), &info.applyCosmetics, "cosmetics"); + DrawSectionCheck(name, !info.presetValues["blocks"].contains("cosmetics"), &info.applyCosmetics, + "cosmetics"); ImGui::TableNextColumn(); DrawSectionCheck(name, !info.presetValues["blocks"].contains("rando"), &info.applyRando, "rando"); ImGui::TableNextColumn(); DrawSectionCheck(name, !info.presetValues["blocks"].contains("trackers"), &info.applyTrackers, "trackers"); ImGui::TableNextColumn(); UIWidgets::PushStyleButton(THEME_COLOR); - if (UIWidgets::Button(("Apply##" + name).c_str(), UIWidgets::ButtonOptions().Padding({6.0f, 6.0f}))) { + if (UIWidgets::Button(("Apply##" + name).c_str(), UIWidgets::ButtonOptions().Padding({ 6.0f, 6.0f }))) { for (auto& section : info.presetValues["blocks"]) { for (auto& item : section.items()) { if (section[item.key()].is_null()) { CVarClearBlock(item.key().c_str()); } else { - Ship::Context::GetInstance()->GetConfig()->SetBlock(fmt::format("{}.{}", "CVars", item.key()), item.value()); + Ship::Context::GetInstance()->GetConfig()->SetBlock( + fmt::format("{}.{}", "CVars", item.key()), item.value()); Ship::Context::GetInstance()->GetConsoleVariables()->Load(); } } @@ -311,7 +349,7 @@ void PresetsCustomWidget(WidgetInfo& info) { UIWidgets::PopStyleButton(); ImGui::TableNextColumn(); UIWidgets::PushStyleButton(THEME_COLOR); - if (UIWidgets::Button(("Delete##" + name).c_str(), UIWidgets::ButtonOptions().Padding({6.0f, 6.0f}))) { + if (UIWidgets::Button(("Delete##" + name).c_str(), UIWidgets::ButtonOptions().Padding({ 6.0f, 6.0f }))) { auto path = FormatPresetPath(info.fileName); if (fs::exists(path)) { fs::remove(path); @@ -332,11 +370,10 @@ void PresetsCustomWidget(WidgetInfo& info) { void RegisterPresetsWidgets() { SohGui::mSohMenu->AddSidebarEntry("Settings", "Presets", 1); WidgetPath path = { "Settings", "Presets", SECTION_COLUMN_1 }; - SohGui::mSohMenu->AddWidget(path, "PresetsWidget", WIDGET_CUSTOM) - .CustomFunction(PresetsCustomWidget); + SohGui::mSohMenu->AddWidget(path, "PresetsWidget", WIDGET_CUSTOM).CustomFunction(PresetsCustomWidget); presetFolder = Ship::Context::GetInstance()->GetPathRelativeToAppDirectory("presets"); LoadPresets(); } -//static RegisterMenuUpdateFunc updateFunc(UpdateResolutionVars, "Settings", "General"); +// static RegisterMenuUpdateFunc updateFunc(UpdateResolutionVars, "Settings", "General"); static RegisterMenuInitFunc initFunc(RegisterPresetsWidgets); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 8166a474b..5b83dc9ca 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3651,47 +3651,48 @@ void RandomizerSettingsWindow::DrawElement() { bool disableEditingRandoSettings = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings); - //const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_RANDOMIZER); - //std::string comboboxTooltip = ""; - //for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { - // if (iter->first != 0) - // comboboxTooltip += "\n\n"; - // comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); - //} - //const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_RANDOMIZER); - //randomizerPresetSelected = CVarGetInteger(presetTypeCvar.c_str(), RANDOMIZER_PRESET_DEFAULT); + // const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_RANDOMIZER); + // std::string comboboxTooltip = ""; + // for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { + // if (iter->first != 0) + // comboboxTooltip += "\n\n"; + // comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); + // } + // const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_RANDOMIZER); + // randomizerPresetSelected = CVarGetInteger(presetTypeCvar.c_str(), RANDOMIZER_PRESET_DEFAULT); - //if (UIWidgets::Combobox("Randomizer Presets", &randomizerPresetSelected, randomizerPresetList, - // UIWidgets::ComboboxOptions() - // .DefaultIndex(RANDOMIZER_PRESET_DEFAULT) - // .Tooltip(comboboxTooltip.c_str()) - // .Color(THEME_COLOR))) { - // CVarSetInteger(presetTypeCvar.c_str(), randomizerPresetSelected); - //} - //ImGui::SameLine(); - //ImGui::SetCursorPosY(ImGui::GetCursorPos().y + 35.f); - //if (UIWidgets::Button( - // "Apply Preset##Randomizer", - // UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline).Padding(ImVec2(10.f, 6.f)))) { - // if (randomizerPresetSelected >= presetTypeDef.presets.size()) { - // randomizerPresetSelected = 0; - // } - // const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(randomizerPresetSelected); - // for (const char* block : presetTypeDef.blocksToClear) { - // CVarClearBlock(block); - // } - // if (randomizerPresetSelected != 0) { - // applyPreset(selectedPresetDef.entries); - // } - // CVarSetInteger(presetTypeCvar.c_str(), randomizerPresetSelected); - // Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); - // mSettings->UpdateOptionProperties(); - // // force excluded location list and trick list update if tab is open. - // locationsTabOpen = false; - // tricksTabOpen = false; - //} + // if (UIWidgets::Combobox("Randomizer Presets", &randomizerPresetSelected, randomizerPresetList, + // UIWidgets::ComboboxOptions() + // .DefaultIndex(RANDOMIZER_PRESET_DEFAULT) + // .Tooltip(comboboxTooltip.c_str()) + // .Color(THEME_COLOR))) { + // CVarSetInteger(presetTypeCvar.c_str(), randomizerPresetSelected); + // } + // ImGui::SameLine(); + // ImGui::SetCursorPosY(ImGui::GetCursorPos().y + 35.f); + // if (UIWidgets::Button( + // "Apply Preset##Randomizer", + // UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline).Padding(ImVec2(10.f, 6.f)))) + // { + // if (randomizerPresetSelected >= presetTypeDef.presets.size()) { + // randomizerPresetSelected = 0; + // } + // const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(randomizerPresetSelected); + // for (const char* block : presetTypeDef.blocksToClear) { + // CVarClearBlock(block); + // } + // if (randomizerPresetSelected != 0) { + // applyPreset(selectedPresetDef.entries); + // } + // CVarSetInteger(presetTypeCvar.c_str(), randomizerPresetSelected); + // Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + // mSettings->UpdateOptionProperties(); + // // force excluded location list and trick list update if tab is open. + // locationsTabOpen = false; + // tricksTabOpen = false; + // } - //UIWidgets::Spacer(0); + // UIWidgets::Spacer(0); UIWidgets::CVarCheckbox("Manual seed entry", CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), UIWidgets::CheckboxOptions().Color(THEME_COLOR)); if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0)) { diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index b90147ce1..d1ffbb196 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -78,7 +78,7 @@ void SohMenu::AddMenuEnhancements() { });*/ // Quality of Life - //path.sidebarName = "Quality of Life"; + // path.sidebarName = "Quality of Life"; WidgetPath path = { "Enhancements", "Quality of Life", SECTION_COLUMN_1 }; AddSidebarEntry("Enhancements", path.sidebarName, 3); path.column = SECTION_COLUMN_1; diff --git a/soh/soh/SohGui/UIWidgets.cpp b/soh/soh/SohGui/UIWidgets.cpp index 484c58dd4..a3385143f 100644 --- a/soh/soh/SohGui/UIWidgets.cpp +++ b/soh/soh/SohGui/UIWidgets.cpp @@ -809,11 +809,11 @@ bool InputString(const char* label, std::string* value, const InputOptions& opti PopStyleInput(); ImGui::EndDisabled(); ImGui::EndGroup(); - if (options.hasError&& ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && + if (options.hasError && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && !Ship_IsCStringEmpty(options.errorText)) { ImGui::SetTooltip("%s", WrappedText(options.errorText).c_str()); } else if (options.disabled && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && - !Ship_IsCStringEmpty(options.disabledTooltip)) { + !Ship_IsCStringEmpty(options.disabledTooltip)) { ImGui::SetTooltip("%s", WrappedText(options.disabledTooltip).c_str()); } else if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && !Ship_IsCStringEmpty(options.tooltip)) { ImGui::SetTooltip("%s", WrappedText(options.tooltip).c_str()); @@ -972,7 +972,8 @@ bool CVarColorPicker(const char* label, const char* cvarName, Color_RGBA8 defaul UIWidgets::CheckboxOptions({ { .tooltip = "Prevents this color from being changed" } }).Color(themeColor)); } if (changed) { - if (color.r == defaultColor.r && color.g == defaultColor.g && color.b == defaultColor.b && color.a == defaultColor.a) { + if (color.r == defaultColor.r && color.g == defaultColor.g && color.b == defaultColor.b && + color.a == defaultColor.a) { CVarClear(valueCVar.c_str()); } else { color.r = (uint8_t)(colorVec.x * 255.0f);