From 28944cc68fba230deb08eaab649a54e6e14b37fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Wed, 19 Mar 2025 16:30:44 +0000 Subject: [PATCH] fix some warnings (#5135) * fix some warnings * fix error caught by mac build, fix 3 more warnings * merge fix * feedback * remove color refactor --- soh/soh/Enhancements/controls/InputViewer.cpp | 2 +- .../cosmetics/CosmeticsEditor.cpp | 4 +- soh/soh/Enhancements/debugconsole.cpp | 1 + .../Enhancements/debugger/debugSaveEditor.cpp | 2 +- .../GameInteractor_RawAction.cpp | 2 +- soh/soh/Enhancements/presets.cpp | 2 +- .../Enhancements/randomizer/Plandomizer.cpp | 12 +- soh/soh/Enhancements/randomizer/item.cpp | 2 + soh/soh/Enhancements/randomizer/option.cpp | 2 +- .../randomizer/randomizer_check_tracker.cpp | 8 +- .../randomizer_entrance_tracker.cpp | 3 +- .../randomizer/randomizer_item_tracker.cpp | 80 +++++------ .../Enhancements/timesplits/TimeSplits.cpp | 2 +- soh/soh/SohGui/ResolutionEditor.cpp | 4 +- soh/soh/SohGui/SohMenuNetwork.cpp | 8 +- soh/soh/SohGui/SohMenuSettings.cpp | 8 +- soh/soh/SohGui/UIWidgets.cpp | 90 ++++++------ soh/soh/SohGui/UIWidgets.hpp | 134 +++++++++--------- soh/soh/z_scene_otr.cpp | 4 - 19 files changed, 180 insertions(+), 190 deletions(-) diff --git a/soh/soh/Enhancements/controls/InputViewer.cpp b/soh/soh/Enhancements/controls/InputViewer.cpp index c354e0319..d26de6719 100644 --- a/soh/soh/Enhancements/controls/InputViewer.cpp +++ b/soh/soh/Enhancements/controls/InputViewer.cpp @@ -564,7 +564,7 @@ void InputViewerSettingsWindow::DrawElement() { ImGui::Unindent(); } - UIWidgets:PaddedSeparator(true, true); + UIWidgets::PaddedSeparator(true, true); } if (ImGui::CollapsingHeader("Analog Stick")) { diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index ac78353ee..ddd36fa56 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -2045,8 +2045,8 @@ void CosmeticsEditorWindow::DrawElement() { UIWidgets::ComboboxOptions() .DefaultIndex(COLORSCHEME_N64) .Color(THEME_COLOR) - .LabelPosition(UIWidgets::LabelPosition::Near) - .ComponentAlignment(UIWidgets::ComponentAlignment::Right)); + .LabelPosition(UIWidgets::LabelPositions::Near) + .ComponentAlignment(UIWidgets::ComponentAlignments::Right)); UIWidgets::CVarCheckbox("Sync Rainbow colors", CVAR_COSMETIC("RainbowSync"), UIWidgets::CheckboxOptions() .Color(THEME_COLOR)); diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 67547437d..33eed43f9 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -79,6 +79,7 @@ static bool ActorSpawnHandler(std::shared_ptr Console, const std: if (args[8][0] != ',') { spawnPoint.rot.z = std::stoi(args[8]); } + [[fallthrough]]; case 6: if (args[3][0] != ',') { spawnPoint.pos.x = std::stoi(args[3]); diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index dfc4d9681..0e9bbc79a 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -1550,7 +1550,7 @@ void ResetBaseOptions() { intSliderOptionsBase.Color(THEME_COLOR).Size({320.0f, 0.0f}).Tooltip(""); buttonOptionsBase.Color(THEME_COLOR).Size(Sizes::Inline).Tooltip(""); checkboxOptionsBase.Color(THEME_COLOR).Tooltip(""); - comboboxOptionsBase.Color(THEME_COLOR).ComponentAlignment(ComponentAlignment::Left).LabelPosition(LabelPosition::Near).Tooltip(""); + comboboxOptionsBase.Color(THEME_COLOR).ComponentAlignment(ComponentAlignments::Left).LabelPosition(LabelPositions::Near).Tooltip(""); } void SaveEditorWindow::DrawElement() { diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp index aa8c72d00..d0b32018a 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp @@ -564,7 +564,7 @@ void GameInteractor::RawAction::SetRandomWind(bool active) { void GameInteractor::RawAction::SetPlayerInvincibility(bool active) { Player* player = GET_PLAYER(gPlayState); if (active) { - player->invincibilityTimer = 1000; + player->invincibilityTimer = -20; } else { player->invincibilityTimer = 0; } diff --git a/soh/soh/Enhancements/presets.cpp b/soh/soh/Enhancements/presets.cpp index 240d0fa81..c8760caca 100644 --- a/soh/soh/Enhancements/presets.cpp +++ b/soh/soh/Enhancements/presets.cpp @@ -50,7 +50,7 @@ void DrawPresetSelector(PresetType presetTypeId) { comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); } - ImGui::Text("Presets", false, true); + ImGui::Text("Presets"); UIWidgets::PushStyleCombobox(THEME_COLOR); if (ImGui::BeginCombo("##PresetsComboBox", selectedPresetDef.label)) { for ( auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter ) { diff --git a/soh/soh/Enhancements/randomizer/Plandomizer.cpp b/soh/soh/Enhancements/randomizer/Plandomizer.cpp index 4741d9d0c..39b20d876 100644 --- a/soh/soh/Enhancements/randomizer/Plandomizer.cpp +++ b/soh/soh/Enhancements/randomizer/Plandomizer.cpp @@ -838,8 +838,8 @@ void PlandomizerDrawItemSlots(uint32_t index) { void PlandomizerDrawShopSlider(uint32_t index) { ImGui::PushID(index); UIWidgets::SliderInt("Price:", &plandoLogData[index].shopPrice, UIWidgets::IntSliderOptions() - .Color(THEME_COLOR).Format("%d Rupees").Min(0).Max(999).LabelPosition(UIWidgets::LabelPosition::Near) - .ComponentAlignment(UIWidgets::ComponentAlignment::Right).Size(UIWidgets::Sizes::Inline)); + .Color(THEME_COLOR).Format("%d Rupees").Min(0).Max(999).LabelPosition(UIWidgets::LabelPositions::Near) + .ComponentAlignment(UIWidgets::ComponentAlignments::Right).Size(UIWidgets::Sizes::Inline)); ImGui::PopID(); } @@ -878,7 +878,7 @@ void PlandomizerDrawIceTrapSetup(uint32_t index) { } ImGui::SameLine(); } - if (UIWidgets::InputString("##TrapName", &trapTextInput, UIWidgets::InputOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::None))) { + if (UIWidgets::InputString("##TrapName", &trapTextInput, UIWidgets::InputOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::None))) { plandoLogData[index].iceTrapName = trapTextInput.c_str(); } @@ -933,7 +933,7 @@ void PlandomizerDrawOptions() { PlandomizerPopulateSeedList(); static size_t selectedList = 0; if (existingSeedList.size() != 0) { - UIWidgets::Combobox("##JsonFiles", &selectedList, existingSeedList, UIWidgets::ComboboxOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::None)); + UIWidgets::Combobox("##JsonFiles", &selectedList, existingSeedList, UIWidgets::ComboboxOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::None)); } else { ImGui::Text("No Spoiler Logs found."); @@ -1024,7 +1024,7 @@ void PlandomizerDrawOptions() { } if (getTabID == TAB_LOCATIONS) { if (plandoLogData.size() > 0) { - UIWidgets::Combobox("Filter by Area:##AreaFilter", &selectedArea, rcAreaNameMap, UIWidgets::ComboboxOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::Near).ComponentAlignment(UIWidgets::ComponentAlignment::Right)); + UIWidgets::Combobox("Filter by Area:##AreaFilter", &selectedArea, rcAreaNameMap, UIWidgets::ComboboxOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::Near).ComponentAlignment(UIWidgets::ComponentAlignments::Right)); ImGui::SameLine(); if (UIWidgets::Button("Empty All Rewards", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline).Padding(ImVec2(10.f, 6.f)))) { PlandomizerRemoveAllItems(); @@ -1061,7 +1061,7 @@ void PlandomizerDrawHintsWindow() { } ImGui::SameLine(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 10); - if (UIWidgets::InputString("##HintMessage", &hintInputText, UIWidgets::InputOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::None).Tooltip(plandomizerHintsTooltip().c_str()))) { + if (UIWidgets::InputString("##HintMessage", &hintInputText, UIWidgets::InputOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::None).Tooltip(plandomizerHintsTooltip().c_str()))) { plandoHintData[index].hintText = hintInputText.c_str(); } index++; diff --git a/soh/soh/Enhancements/randomizer/item.cpp b/soh/soh/Enhancements/randomizer/item.cpp index 6f0309223..1c315b47f 100644 --- a/soh/soh/Enhancements/randomizer/item.cpp +++ b/soh/soh/Enhancements/randomizer/item.cpp @@ -94,6 +94,7 @@ std::shared_ptr Item::GetGIEntry() const { // NOLINT(*-no-recursio actual = RG_DEKU_STICK_BAG; break; } + [[fallthrough]]; case 1: if (infiniteUpgrades == RO_INF_UPGRADES_CONDENSED_PROGRESSIVE) { actual = RG_STICK_UPGRADE_INF; @@ -123,6 +124,7 @@ std::shared_ptr Item::GetGIEntry() const { // NOLINT(*-no-recursio actual = RG_DEKU_NUT_BAG; break; } + [[fallthrough]]; case 1: if (infiniteUpgrades == RO_INF_UPGRADES_CONDENSED_PROGRESSIVE) { actual = RG_NUT_UPGRADE_INF; diff --git a/soh/soh/Enhancements/randomizer/option.cpp b/soh/soh/Enhancements/randomizer/option.cpp index 2c478e34c..64ca107c5 100644 --- a/soh/soh/Enhancements/randomizer/option.cpp +++ b/soh/soh/Enhancements/randomizer/option.cpp @@ -232,7 +232,7 @@ bool Option::RenderCombobox() { } UIWidgets::ComboboxOptions widgetOptions = UIWidgets::ComboboxOptions().Color(THEME_COLOR).Tooltip(description.c_str()); if (this->GetKey() == RSK_LOGIC_RULES) { - widgetOptions = widgetOptions.LabelPosition(UIWidgets::LabelPosition::None).ComponentAlignment(UIWidgets::ComponentAlignment::Right); + widgetOptions = widgetOptions.LabelPosition(UIWidgets::LabelPositions::None).ComponentAlignment(UIWidgets::ComponentAlignments::Right); } widgetOptions.disabled = disabled; if(UIWidgets::Combobox(name.c_str(), &selected, options, widgetOptions)) { diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 6c4177198..c51650bbd 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -1772,21 +1772,21 @@ void CheckTrackerSettingsWindow::DrawElement() { ImGui::PopItemWidth(); UIWidgets::CVarCombobox("Window Type", CVAR_TRACKER_CHECK("WindowType"), windowType, - UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPosition::Far).ComponentAlignment(UIWidgets::ComponentAlignment::Right) + UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPositions::Far).ComponentAlignment(UIWidgets::ComponentAlignments::Right) .Color(THEME_COLOR).DefaultIndex(TRACKER_WINDOW_WINDOW)); if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { UIWidgets::CVarCheckbox("Enable Dragging", CVAR_TRACKER_CHECK("Draggable"), UIWidgets::CheckboxOptions().Color(THEME_COLOR)); UIWidgets::CVarCheckbox("Only enable while paused", CVAR_TRACKER_CHECK("ShowOnlyPaused"), UIWidgets::CheckboxOptions().Color(THEME_COLOR)); UIWidgets::CVarCombobox("Display Mode", CVAR_TRACKER_CHECK("DisplayType"), displayType, - UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPosition::Far).ComponentAlignment(UIWidgets::ComponentAlignment::Right) + UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPositions::Far).ComponentAlignment(UIWidgets::ComponentAlignments::Right) .Color(THEME_COLOR).DefaultIndex(0)); if (CVarGetInteger(CVAR_TRACKER_CHECK("DisplayType"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { UIWidgets::CVarCombobox("Combo Button 1", CVAR_TRACKER_CHECK("ComboButton1"), buttonStrings, - UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPosition::Far).ComponentAlignment(UIWidgets::ComponentAlignment::Right) + UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPositions::Far).ComponentAlignment(UIWidgets::ComponentAlignments::Right) .Color(THEME_COLOR).DefaultIndex(TRACKER_COMBO_BUTTON_L)); UIWidgets::CVarCombobox("Combo Button 2", CVAR_TRACKER_CHECK("ComboButton2"), buttonStrings, - UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPosition::Far).ComponentAlignment(UIWidgets::ComponentAlignment::Right) + UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPositions::Far).ComponentAlignment(UIWidgets::ComponentAlignments::Right) .Color(THEME_COLOR).DefaultIndex(TRACKER_COMBO_BUTTON_L)); } } diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index a6e1c6d07..fab17acf1 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -674,8 +674,7 @@ void EntranceTrackerSettingsWindow::DrawElement() { ImGui::Text("Sort By"); UIWidgets::CVarRadioButton("To", CVAR_TRACKER_ENTRANCE("SortBy"), 0, UIWidgets::RadioButtonsOptions() - .Color(THEME_COLOR) - .Tooltip("Sort entrances by the original source entrance")); + .Color(THEME_COLOR).Tooltip("Sort entrances by the original source entrance")); UIWidgets::CVarRadioButton("From", CVAR_TRACKER_ENTRANCE("SortBy"), 1, UIWidgets::RadioButtonsOptions() .Color(THEME_COLOR).Tooltip("Sort entrances by the overrided destination")); diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 51f161def..92c7491fc 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -1388,8 +1388,8 @@ void ItemTrackerSettingsWindow::DrawElement() { ImGui::PopItemWidth(); if (CVarCombobox("Window Type", CVAR_TRACKER_ITEM("WindowType"), windowTypes, ComboboxOptions() - .DefaultIndex(TRACKER_WINDOW_FLOATING).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(TRACKER_WINDOW_FLOATING).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } @@ -1401,19 +1401,19 @@ void ItemTrackerSettingsWindow::DrawElement() { shouldUpdateVectors = true; } if (CVarCombobox("Display Mode", CVAR_TRACKER_ITEM("DisplayType.Main"), displayModes, ComboboxOptions() - .DefaultIndex(TRACKER_DISPLAY_ALWAYS).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(TRACKER_DISPLAY_ALWAYS).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { if (CVarCombobox("Combo Button 1", CVAR_TRACKER_ITEM("ComboButton1"), buttons, ComboboxOptions() - .DefaultIndex(TRACKER_COMBO_BUTTON_L).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(TRACKER_COMBO_BUTTON_L).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Combo Button 2", CVAR_TRACKER_ITEM("ComboButton2"), buttons, ComboboxOptions() - .DefaultIndex(TRACKER_COMBO_BUTTON_R).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(TRACKER_COMBO_BUTTON_R).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } } @@ -1425,8 +1425,8 @@ void ItemTrackerSettingsWindow::DrawElement() { ImGui::NewLine(); CVarCombobox("Ammo/Capacity Tracking", CVAR_TRACKER_ITEM("ItemCountType"), itemTrackerCapacityTrackOptions, ComboboxOptions() - .DefaultIndex(ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY).ComponentAlignment(ComponentAlignment::Left) - .LabelPosition(LabelPosition::Above).Color(THEME_COLOR) + .DefaultIndex(ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY).ComponentAlignment(ComponentAlignments::Left) + .LabelPosition(LabelPositions::Above).Color(THEME_COLOR) .Tooltip("Customize what the numbers under each item are tracking." "\n\nNote: items without capacity upgrades will track ammo even in capacity mode")); if (CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) { @@ -1436,35 +1436,35 @@ void ItemTrackerSettingsWindow::DrawElement() { } CVarCombobox("Key Count Tracking", CVAR_TRACKER_ITEM("KeyCounts"), itemTrackerKeyTrackOptions, ComboboxOptions() - .DefaultIndex(KEYS_COLLECTED_MAX).ComponentAlignment(ComponentAlignment::Left) - .LabelPosition(LabelPosition::Above).Color(THEME_COLOR) + .DefaultIndex(KEYS_COLLECTED_MAX).ComponentAlignment(ComponentAlignments::Left) + .LabelPosition(LabelPositions::Above).Color(THEME_COLOR) .Tooltip("Customize what numbers are shown for key tracking.")); CVarCombobox("Triforce Piece Count Tracking", CVAR_TRACKER_ITEM("TriforcePieceCounts"), itemTrackerTriforcePieceTrackOptions, ComboboxOptions() - .DefaultIndex(TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX).ComponentAlignment(ComponentAlignment::Left) - .LabelPosition(LabelPosition::Above).Color(THEME_COLOR) + .DefaultIndex(TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX).ComponentAlignment(ComponentAlignments::Left) + .LabelPosition(LabelPositions::Above).Color(THEME_COLOR) .Tooltip("Customize what numbers are shown for triforce piece tracking.")); ImGui::TableNextColumn(); if (CVarCombobox("Inventory", CVAR_TRACKER_ITEM("DisplayType.Inventory"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Equipment", CVAR_TRACKER_ITEM("DisplayType.Equipment"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Misc", CVAR_TRACKER_ITEM("DisplayType.Misc"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Dungeon Rewards", CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { @@ -1473,13 +1473,13 @@ void ItemTrackerSettingsWindow::DrawElement() { } } if (CVarCombobox("Songs", CVAR_TRACKER_ITEM("DisplayType.Songs"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Dungeon Items", CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) != SECTION_DISPLAY_HIDDEN) { @@ -1493,45 +1493,45 @@ void ItemTrackerSettingsWindow::DrawElement() { } } if (CVarCombobox("Greg", CVAR_TRACKER_ITEM("DisplayType.Greg"), extendedDisplayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_EXTENDED_HIDDEN).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_EXTENDED_HIDDEN).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Triforce Pieces", CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Boss Souls", CVAR_TRACKER_ITEM("DisplayType.BossSouls"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Ocarina Buttons", CVAR_TRACKER_ITEM("DisplayType.OcarinaButtons"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Fishing Pole", CVAR_TRACKER_ITEM("DisplayType.FishingPole"), extendedDisplayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_EXTENDED_HIDDEN).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_EXTENDED_HIDDEN).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarCombobox("Total Checks", "gTrackers.ItemTracker.TotalChecks.DisplayType", minimalDisplayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_MINIMAL_HIDDEN).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_MINIMAL_HIDDEN).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { if (CVarCombobox("Personal notes", CVAR_TRACKER_ITEM("DisplayType.Notes"), displayTypes, ComboboxOptions() - .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) - .LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { + .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right) + .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) { shouldUpdateVectors = true; } } diff --git a/soh/soh/Enhancements/timesplits/TimeSplits.cpp b/soh/soh/Enhancements/timesplits/TimeSplits.cpp index a16a98f9e..046536f45 100644 --- a/soh/soh/Enhancements/timesplits/TimeSplits.cpp +++ b/soh/soh/Enhancements/timesplits/TimeSplits.cpp @@ -809,7 +809,7 @@ void TimeSplitsDrawOptionsMenu() { static uint32_t selectedItem = 0; ImGui::Text("Select List to Load: "); ImGui::PushItemWidth(150.0f); - Combobox("", &selectedItem, keys, ComboboxOptions().Color(THEME_COLOR).LabelPosition(LabelPosition::Near)); + Combobox("", &selectedItem, keys, ComboboxOptions().Color(THEME_COLOR).LabelPosition(LabelPositions::Near)); ImGui::PopItemWidth(); ImGui::SameLine(); if (Button("Load List", ButtonOptions().Color(THEME_COLOR).Size(Sizes::Inline))) { diff --git a/soh/soh/SohGui/ResolutionEditor.cpp b/soh/soh/SohGui/ResolutionEditor.cpp index c270444fb..6b287fde5 100644 --- a/soh/soh/SohGui/ResolutionEditor.cpp +++ b/soh/soh/SohGui/ResolutionEditor.cpp @@ -422,10 +422,10 @@ void RegisterResolutionWidgets() { // Declare input interaction bools outside of IF statement to prevent Y field from disappearing. const bool input_X = UIWidgets::SliderFloat("X", &aspectRatioX, UIWidgets::FloatSliderOptions({{ .disabled = disabled_everything }}).Min(0.1f).Max(32.0f).Step(0.001f).Format("%3f") - .Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::Near).ComponentAlignment(UIWidgets::ComponentAlignment::Right)); + .Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::Near).ComponentAlignment(UIWidgets::ComponentAlignments::Right)); const bool input_Y = UIWidgets::SliderFloat("Y", &aspectRatioY, UIWidgets::FloatSliderOptions({{ .disabled = disabled_everything }}).Min(0.1f).Max(24.0f).Step(0.001f).Format("%3f") - .Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::Near).ComponentAlignment(UIWidgets::ComponentAlignment::Right)); + .Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::Near).ComponentAlignment(UIWidgets::ComponentAlignments::Right)); if (input_X || input_Y) { item_aspectRatio = default_aspectRatio; update[UPDATE_aspectRatioX] = true; diff --git a/soh/soh/SohGui/SohMenuNetwork.cpp b/soh/soh/SohGui/SohMenuNetwork.cpp index 29511a9e9..135f7e2be 100644 --- a/soh/soh/SohGui/SohMenuNetwork.cpp +++ b/soh/soh/SohGui/SohMenuNetwork.cpp @@ -42,11 +42,11 @@ void SohMenu::AddMenuNetwork() { .CustomFunction([](WidgetInfo& info) { ImGui::BeginDisabled(Sail::Instance->isEnabled); ImGui::Text("%s", info.name.c_str()); - CVarInputString("##HostSail", CVAR_REMOTE_SAIL("Host"), InputOptions().Color(THEME_COLOR).PlaceholderText("127.0.0.1").DefaultValue("127.0.0.1").Size(ImVec2(ImGui::GetFontSize() * 15, 0)).LabelPosition(LabelPosition::None)); + CVarInputString("##HostSail", CVAR_REMOTE_SAIL("Host"), InputOptions().Color(THEME_COLOR).PlaceholderText("127.0.0.1").DefaultValue("127.0.0.1").Size(ImVec2(ImGui::GetFontSize() * 15, 0)).LabelPosition(LabelPositions::None)); ImGui::SameLine(); ImGui::Text(":"); ImGui::SameLine(); - CVarInputInt("##PortSail", CVAR_REMOTE_SAIL("Port"), InputOptions().Color(THEME_COLOR).PlaceholderText("43384").DefaultValue("43384").Size(ImVec2(ImGui::GetFontSize() * 5, 0)).LabelPosition(LabelPosition::None)); + CVarInputInt("##PortSail", CVAR_REMOTE_SAIL("Port"), InputOptions().Color(THEME_COLOR).PlaceholderText("43384").DefaultValue("43384").Size(ImVec2(ImGui::GetFontSize() * 5, 0)).LabelPosition(LabelPositions::None)); ImGui::EndDisabled(); }); AddWidget(path, "Enable##Sail", WIDGET_BUTTON) @@ -104,11 +104,11 @@ void SohMenu::AddMenuNetwork() { .CustomFunction([](WidgetInfo& info) { ImGui::BeginDisabled(CrowdControl::Instance->isEnabled); ImGui::Text("%s", info.name.c_str()); - CVarInputString("##HostCrowdControl", CVAR_REMOTE_CROWD_CONTROL("Host"), InputOptions().Color(THEME_COLOR).PlaceholderText("127.0.0.1").DefaultValue("127.0.0.1").Size(ImVec2(ImGui::GetFontSize() * 15, 0)).LabelPosition(LabelPosition::None)); + CVarInputString("##HostCrowdControl", CVAR_REMOTE_CROWD_CONTROL("Host"), InputOptions().Color(THEME_COLOR).PlaceholderText("127.0.0.1").DefaultValue("127.0.0.1").Size(ImVec2(ImGui::GetFontSize() * 15, 0)).LabelPosition(LabelPositions::None)); ImGui::SameLine(); ImGui::Text(":"); ImGui::SameLine(); - CVarInputInt("##PortCrowdControl", CVAR_REMOTE_CROWD_CONTROL("Port"), InputOptions().Color(THEME_COLOR).PlaceholderText("43384").DefaultValue("43384").Size(ImVec2(ImGui::GetFontSize() * 5, 0)).LabelPosition(LabelPosition::None)); + CVarInputInt("##PortCrowdControl", CVAR_REMOTE_CROWD_CONTROL("Port"), InputOptions().Color(THEME_COLOR).PlaceholderText("43384").DefaultValue("43384").Size(ImVec2(ImGui::GetFontSize() * 5, 0)).LabelPosition(LabelPositions::None)); ImGui::EndDisabled(); }); AddWidget(path, "Enable##CrowdControl", WIDGET_BUTTON) diff --git a/soh/soh/SohGui/SohMenuSettings.cpp b/soh/soh/SohGui/SohMenuSettings.cpp index dc821ecc4..093e98618 100644 --- a/soh/soh/SohGui/SohMenuSettings.cpp +++ b/soh/soh/SohGui/SohMenuSettings.cpp @@ -108,8 +108,8 @@ void SohMenu::AddMenuSettings() { .CVar(CVAR_ENHANCEMENT("BootSequence")) .Options(ComboboxOptions() .DefaultIndex(BOOTSEQUENCE_DEFAULT) - .LabelPosition(LabelPosition::Far) - .ComponentAlignment(ComponentAlignment::Right) + .LabelPosition(LabelPositions::Far) + .ComponentAlignment(ComponentAlignments::Right) .ComboMap(bootSequenceLabels) .Tooltip("Configure what happens when starting or resetting the game.\n\n" "Default: LUS logo -> N64 logo\n" @@ -121,7 +121,7 @@ void SohMenu::AddMenuSettings() { .CVar(CVAR_SETTING("TitleScreenTranslation")); AddWidget(path, "Menu Language", WIDGET_CVAR_COMBOBOX) .CVar(CVAR_SETTING("Languages")) - .Options(ComboboxOptions().LabelPosition(LabelPosition::Far).ComponentAlignment(ComponentAlignment::Right).ComboMap(languages).DefaultIndex(LANGUAGE_ENG)); + .Options(ComboboxOptions().LabelPosition(LabelPositions::Far).ComponentAlignment(ComponentAlignments::Right).ComboMap(languages).DefaultIndex(LANGUAGE_ENG)); AddWidget(path, "Accessibility", WIDGET_SEPARATOR_TEXT); #if defined(_WIN32) || defined(__APPLE__) AddWidget(path, "Text to Speech", WIDGET_CVAR_CHECKBOX) @@ -136,7 +136,7 @@ void SohMenu::AddMenuSettings() { AddWidget(path, "ImGui Menu Scaling", WIDGET_CVAR_COMBOBOX) .CVar(CVAR_SETTING("ImGuiScale")) .Options(ComboboxOptions().ComboMap(imguiScaleOptions).Tooltip("Changes the scaling of the ImGui menu elements.").DefaultIndex(1) - .ComponentAlignment(ComponentAlignment::Right).LabelPosition(LabelPosition::Far)) + .ComponentAlignment(ComponentAlignments::Right).LabelPosition(LabelPositions::Far)) .Callback([](WidgetInfo& info) { OTRGlobals::Instance->ScaleImGui(); }); diff --git a/soh/soh/SohGui/UIWidgets.cpp b/soh/soh/SohGui/UIWidgets.cpp index 7b6883628..9875cf7b9 100644 --- a/soh/soh/SohGui/UIWidgets.cpp +++ b/soh/soh/SohGui/UIWidgets.cpp @@ -285,10 +285,10 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) { ImGui::BeginDisabled(options.disabled); - bool above = options.labelPosition == LabelPosition::Above; - bool lpFar = options.labelPosition == LabelPosition::Far; - bool right = options.alignment == ComponentAlignment::Right; - bool none = options.labelPosition == LabelPosition::None; + bool above = options.labelPosition == LabelPositions::Above; + bool lpFar = options.labelPosition == LabelPositions::Far; + bool right = options.alignment == ComponentAlignments::Right; + bool none = options.labelPosition == LabelPositions::None; std::string labelStr = (none ? "##" : ""); labelStr.append(_label); @@ -327,12 +327,12 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) { PushStyleCheckbox(options.color); ImVec2 checkPos = pos; ImVec2 labelPos = pos; - if (options.labelPosition == LabelPosition::Above) { + if (options.labelPosition == LabelPositions::Above) { checkPos.y += label_size.y + (style.ItemInnerSpacing.y * 2.0f); } else { labelPos.y += (square_sz / 2) - (label_size.y / 2); } - if (options.alignment == ComponentAlignment::Right) { + if (options.alignment == ComponentAlignments::Right) { checkPos.x = total_bb.Max.x - square_sz; } else { float labelFarOffset = ImGui::GetContentRegionAvail().x - label_size.x; @@ -518,22 +518,22 @@ bool SliderInt(const char* label, int32_t* value, const IntSliderOptions& option ImGui::BeginDisabled(options.disabled); PushStyleSlider(options.color); float width = (options.size == ImVec2(0,0)) ? ImGui::GetContentRegionAvail().x : options.size.x; - if (options.labelPosition == LabelPosition::Near || options.labelPosition == LabelPosition::Far) { + if (options.labelPosition == LabelPositions::Near || options.labelPosition == LabelPositions::Far) { width = width - (ImGui::CalcTextSize(label).x + ImGui::GetStyle().FramePadding.x); } ImGui::AlignTextToFramePadding(); - if (options.alignment == ComponentAlignment::Right) { + if (options.alignment == ComponentAlignments::Right) { ImGui::Text(label, *value); - if (options.labelPosition == LabelPosition::Above) { + if (options.labelPosition == LabelPositions::Above) { ImGui::NewLine(); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); - } else if (options.labelPosition == LabelPosition::Near) { + } else if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); - } else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) { + } else if (options.labelPosition == LabelPositions::Far || options.labelPosition == LabelPositions::None) { ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); } - } else if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Above) { + } else if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Above) { ImGui::Text(label, *value); } } @@ -576,11 +576,11 @@ bool SliderInt(const char* label, int32_t* value, const IntSliderOptions& option } } - if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Near) { + if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); ImGui::Text(label, *value); - } else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) { + } else if (options.labelPosition == LabelPositions::Far || options.labelPosition == LabelPositions::None) { ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize(label).x + ImGui::GetStyle().ItemSpacing.x); ImGui::Text(label, *value); } @@ -611,33 +611,25 @@ bool CVarSliderInt(const char* label, const char* cvarName, const IntSliderOptio } void ClampFloat(float* value, float min, float max, float step) { - int ticks = 0; - float increment = 1.0f; + int factor = 1; if (step < 1.0f) { - ticks++; - increment = 0.1f; + factor *= 10; } if (step < 0.1f) { - ticks++; - increment = 0.01f; + factor *= 10; } if (step < 0.01f) { - ticks++; - increment = 0.001f; + factor *= 10; } if (step < 0.001f) { - ticks++; - increment = 0.0001f; + factor *= 10; } if (step < 0.0001f) { - ticks++; - increment = 0.00001f; + factor *= 10; } if (step < 0.00001f) { - ticks++; - increment = 0.000001f; + factor *= 10; } - int factor = 1 * std::pow(10, ticks); if (*value < min) { *value = min; } else if (*value > max) { @@ -661,24 +653,24 @@ bool SliderFloat(const char* label, float* value, const FloatSliderOptions& opti PushStyleSlider(options.color); float labelSpacing = ImGui::CalcTextSize(label).x + ImGui::GetStyle().ItemSpacing.x; float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x; - if (options.labelPosition == LabelPosition::Near || options.labelPosition == LabelPosition::Far) { + if (options.labelPosition == LabelPositions::Near || options.labelPosition == LabelPositions::Far) { width = width - (ImGui::CalcTextSize(label).x + ImGui::GetStyle().FramePadding.x); } ImGui::AlignTextToFramePadding(); - if (options.alignment == ComponentAlignment::Right) { + if (options.alignment == ComponentAlignments::Right) { ImGui::Text(label, *value); - if (options.labelPosition == LabelPosition::Above) { + if (options.labelPosition == LabelPositions::Above) { ImGui::NewLine(); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); - } else if (options.labelPosition == LabelPosition::Near) { + } else if (options.labelPosition == LabelPositions::Near) { width -= labelSpacing; ImGui::SameLine(); - } else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) { + } else if (options.labelPosition == LabelPositions::Far || options.labelPosition == LabelPositions::None) { width -= labelSpacing; ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); } - } else if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Above) { + } else if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Above) { ImGui::Text(label, *value); } } @@ -715,11 +707,11 @@ bool SliderFloat(const char* label, float* value, const FloatSliderOptions& opti } } - if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Near) { + if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); ImGui::Text(label, *value); - } else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) { + } else if (options.labelPosition == LabelPositions::Far || options.labelPosition == LabelPositions::None) { ImGui::SameLine(ImGui::GetContentRegionAvail().x - labelSpacing); ImGui::Text(label, *value); } @@ -765,12 +757,12 @@ bool InputString(const char* label, std::string* value, const InputOptions& opti ImGui::BeginDisabled(options.disabled); PushStyleInput(options.color); float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x; - if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Above) { + if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Above) { ImGui::Text(label, *value->c_str()); } - } else if (options.alignment == ComponentAlignment::Right) { - if (options.labelPosition == LabelPosition::Above) { + } else if (options.alignment == ComponentAlignments::Right) { + if (options.labelPosition == LabelPositions::Above) { ImGui::NewLine(); ImGui::SameLine(width - ImGui::CalcTextSize(label).x); ImGui::Text(label, *value->c_str()); @@ -821,12 +813,12 @@ bool InputInt(const char* label, int32_t* value, const InputOptions& options) { ImGui::BeginDisabled(options.disabled); PushStyleInput(options.color); float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x; - if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Above) { + if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Above) { ImGui::Text(label, *value); } - } else if (options.alignment == ComponentAlignment::Right) { - if (options.labelPosition == LabelPosition::Above) { + } else if (options.alignment == ComponentAlignments::Right) { + if (options.labelPosition == LabelPositions::Above) { ImGui::NewLine(); ImGui::SameLine(width - ImGui::CalcTextSize(label).x); ImGui::Text(label, *value); diff --git a/soh/soh/SohGui/UIWidgets.hpp b/soh/soh/SohGui/UIWidgets.hpp index 4e30de6d1..325795023 100644 --- a/soh/soh/SohGui/UIWidgets.hpp +++ b/soh/soh/SohGui/UIWidgets.hpp @@ -105,7 +105,7 @@ namespace UIWidgets { const ImVec2 Fill = ImVec2(-1.0f, 0.0f); } - enum LabelPosition { + enum LabelPositions { Near, Far, Above, @@ -113,7 +113,7 @@ namespace UIWidgets { Within, }; - enum ComponentAlignment { + enum ComponentAlignments { Left, Right, }; @@ -204,19 +204,19 @@ namespace UIWidgets { struct CheckboxOptions : WidgetOptions { bool defaultValue = false; // Only applicable to CVarCheckbox - ComponentAlignment alignment = ComponentAlignment::Left; - LabelPosition labelPosition = LabelPosition::Near; + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Near; Colors color = Colors::LightBlue; CheckboxOptions& DefaultValue(bool defaultValue_) { defaultValue = defaultValue_; return *this; } - CheckboxOptions& ComponentAlignment(ComponentAlignment alignment_) { + CheckboxOptions& ComponentAlignment(ComponentAlignments alignment_) { alignment = alignment_; return *this; } - CheckboxOptions& LabelPosition(LabelPosition labelPosition_) { + CheckboxOptions& LabelPosition(LabelPositions labelPosition_) { labelPosition = labelPosition_; return *this; } @@ -237,8 +237,8 @@ namespace UIWidgets { struct ComboboxOptions : WidgetOptions { std::unordered_map comboMap = {}; uint32_t defaultIndex = 0; // Only applicable to CVarCombobox - ComponentAlignment alignment = ComponentAlignment::Left; - LabelPosition labelPosition = LabelPosition::Above; + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Above; ImGuiComboFlags flags = 0; Colors color = Colors::LightBlue; @@ -250,11 +250,11 @@ namespace UIWidgets { defaultIndex = defaultIndex_; return *this; } - ComboboxOptions& ComponentAlignment(ComponentAlignment alignment_) { + ComboboxOptions& ComponentAlignment(ComponentAlignments alignment_) { alignment = alignment_; return *this; } - ComboboxOptions& LabelPosition(LabelPosition labelPosition_) { + ComboboxOptions& LabelPosition(LabelPositions labelPosition_) { labelPosition = labelPosition_; return *this; } @@ -276,8 +276,8 @@ namespace UIWidgets { int32_t max = 10; int32_t defaultValue = 1; bool clamp = true; - ComponentAlignment alignment = ComponentAlignment::Left; - LabelPosition labelPosition = LabelPosition::Above; + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Above; Colors color = Colors::Gray; ImGuiSliderFlags flags = 0; ImVec2 size = {0,0}; @@ -306,11 +306,11 @@ namespace UIWidgets { defaultValue = defaultValue_; return *this; } - IntSliderOptions& ComponentAlignment(ComponentAlignment alignment_) { + IntSliderOptions& ComponentAlignment(ComponentAlignments alignment_) { alignment = alignment_; return *this; } - IntSliderOptions& LabelPosition(LabelPosition labelPosition_) { + IntSliderOptions& LabelPosition(LabelPositions labelPosition_) { labelPosition = labelPosition_; return *this; } @@ -341,8 +341,8 @@ namespace UIWidgets { float defaultValue = 1.0f; bool clamp = true; bool isPercentage = false; // Multiplies visual value by 100 - ComponentAlignment alignment = ComponentAlignment::Left; - LabelPosition labelPosition = LabelPosition::Above; + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Above; Colors color = Colors::Gray; ImGuiSliderFlags flags = 0; ImVec2 size = {0,0}; @@ -371,11 +371,11 @@ namespace UIWidgets { defaultValue = defaultValue_; return *this; } - FloatSliderOptions& ComponentAlignment(ComponentAlignment alignment_) { + FloatSliderOptions& ComponentAlignment(ComponentAlignments alignment_) { alignment = alignment_; return *this; } - FloatSliderOptions& LabelPosition(LabelPosition labelPosition_) { + FloatSliderOptions& LabelPosition(LabelPositions labelPosition_) { labelPosition = labelPosition_; return *this; } @@ -423,8 +423,8 @@ namespace UIWidgets { }; struct InputOptions : WidgetOptions { - ComponentAlignment alignment = ComponentAlignment::Left; - LabelPosition labelPosition = LabelPosition::Above; + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Above; Colors color = Colors::Gray; ImVec2 size = {0,0}; std::string placeholder = ""; @@ -446,7 +446,7 @@ namespace UIWidgets { return *this; } - InputOptions& LabelPosition(LabelPosition labelPosition_) { + InputOptions& LabelPosition(LabelPositions labelPosition_) { labelPosition = labelPosition_; return *this; } @@ -545,20 +545,20 @@ namespace UIWidgets { float comboWidth = CalcComboWidth(longest, options.flags); ImGui::AlignTextToFramePadding(); - if (options.labelPosition != LabelPosition::None) { - if (options.alignment == ComponentAlignment::Right) { - ImGui::Text(label); - if (options.labelPosition == LabelPosition::Above) { + if (options.labelPosition != LabelPositions::None) { + if (options.alignment == ComponentAlignments::Right) { + ImGui::Text("%s", label); + if (options.labelPosition == LabelPositions::Above) { ImGui::NewLine(); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); - } else if (options.labelPosition == LabelPosition::Near) { + } else if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); - } else if (options.labelPosition == LabelPosition::Far) { + } else if (options.labelPosition == LabelPositions::Far) { ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); } - } else if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Above) { - ImGui::Text(label); + } else if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Above) { + ImGui::Text("%s", label); } } } @@ -578,12 +578,12 @@ namespace UIWidgets { ImGui::EndCombo(); } - if (options.labelPosition != LabelPosition::None) { - if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Near) { + if (options.labelPosition != LabelPositions::None) { + if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); ImGui::Text("%s", label); - } else if (options.labelPosition == LabelPosition::Far) { + } else if (options.labelPosition == LabelPositions::Far) { float width = ImGui::CalcTextSize(comboMap.at(*value)).x + ImGui::GetStyle().FramePadding.x * 2; ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::Text("%s", label); @@ -625,19 +625,19 @@ namespace UIWidgets { float comboWidth = CalcComboWidth(longest, options.flags); ImGui::AlignTextToFramePadding(); - if (options.labelPosition != LabelPosition::None) { - if (options.alignment == ComponentAlignment::Right) { + if (options.labelPosition != LabelPositions::None) { + if (options.alignment == ComponentAlignments::Right) { ImGui::Text("%s", label); - if (options.labelPosition == LabelPosition::Above) { + if (options.labelPosition == LabelPositions::Above) { ImGui::NewLine(); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); - } else if (options.labelPosition == LabelPosition::Near) { + } else if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); - } else if (options.labelPosition == LabelPosition::Far) { + } else if (options.labelPosition == LabelPositions::Far) { ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); } - } else if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Above) { + } else if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Above) { ImGui::Text("%s", label); } } @@ -659,12 +659,12 @@ namespace UIWidgets { ImGui::EndCombo(); } - if (options.labelPosition != LabelPosition::None) { - if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Near) { + if (options.labelPosition != LabelPositions::None) { + if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); ImGui::Text("%s", label); - } else if (options.labelPosition == LabelPosition::Far) { + } else if (options.labelPosition == LabelPositions::Far) { float width = ImGui::CalcTextSize(comboVector.at(*value)).x + ImGui::GetStyle().FramePadding.x * 2; ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::Text("%s", label); @@ -707,19 +707,19 @@ namespace UIWidgets { float comboWidth = CalcComboWidth(longest, options.flags); ImGui::AlignTextToFramePadding(); - if (options.labelPosition != LabelPosition::None) { - if (options.alignment == ComponentAlignment::Right) { + if (options.labelPosition != LabelPositions::None) { + if (options.alignment == ComponentAlignments::Right) { ImGui::Text("%s", label); - if (options.labelPosition == LabelPosition::Above) { + if (options.labelPosition == LabelPositions::Above) { ImGui::NewLine(); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); - } else if (options.labelPosition == LabelPosition::Near) { + } else if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); - } else if (options.labelPosition == LabelPosition::Far) { + } else if (options.labelPosition == LabelPositions::Far) { ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); } - } else if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Above) { + } else if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Above) { ImGui::Text("%s", label); } } @@ -741,12 +741,12 @@ namespace UIWidgets { ImGui::EndCombo(); } - if (options.labelPosition != LabelPosition::None) { - if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Near) { + if (options.labelPosition != LabelPositions::None) { + if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); ImGui::Text("%s", label); - } else if (options.labelPosition == LabelPosition::Far) { + } else if (options.labelPosition == LabelPositions::Far) { float width = ImGui::CalcTextSize(comboVector.at(*value).c_str()).x + ImGui::GetStyle().FramePadding.x * 2; ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::Text("%s", label); @@ -792,19 +792,19 @@ namespace UIWidgets { float comboWidth = CalcComboWidth(longest, options.flags); ImGui::AlignTextToFramePadding(); - if (options.labelPosition != LabelPosition::None) { - if (options.alignment == ComponentAlignment::Right) { + if (options.labelPosition != LabelPositions::None) { + if (options.alignment == ComponentAlignments::Right) { ImGui::Text("%s", label); - if (options.labelPosition == LabelPosition::Above) { + if (options.labelPosition == LabelPositions::Above) { ImGui::NewLine(); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); - } else if (options.labelPosition == LabelPosition::Near) { + } else if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); - } else if (options.labelPosition == LabelPosition::Far) { + } else if (options.labelPosition == LabelPositions::Far) { ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); } - } else if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Above) { + } else if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Above) { ImGui::Text("%s", label); } } @@ -826,12 +826,12 @@ namespace UIWidgets { ImGui::EndCombo(); } - if (options.labelPosition != LabelPosition::None) { - if (options.alignment == ComponentAlignment::Left) { - if (options.labelPosition == LabelPosition::Near) { + if (options.labelPosition != LabelPositions::None) { + if (options.alignment == ComponentAlignments::Left) { + if (options.labelPosition == LabelPositions::Near) { ImGui::SameLine(); ImGui::Text("%s", label); - } else if (options.labelPosition == LabelPosition::Far) { + } else if (options.labelPosition == LabelPositions::Far) { float width = ImGui::CalcTextSize(comboArray[*value]).x + ImGui::GetStyle().FramePadding.x * 2; ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::Text("%s", label); diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 022aeee37..f03db52ba 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -150,17 +150,13 @@ bool Scene_CommandObjectList(PlayState* play, SOH::ISceneCommand* cmd) { s32 i; s32 j; s32 k; - ObjectStatus* status; ObjectStatus* status2; - ObjectStatus* firstStatus; // s16* objectEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.segment); s16* objectEntry = (s16*)cmdObj->GetRawPointer(); void* nextPtr; k = 0; i = play->objectCtx.unk_09; - firstStatus = &play->objectCtx.status[0]; - status = &play->objectCtx.status[i]; // Loop until a mismatch in the object lists // Then clear all object ids past that in the context object list and kill actors for those objects