From 0d2346d322b00df45470338406ef290d210ac92e Mon Sep 17 00:00:00 2001 From: Tim Schneeberger Date: Tue, 23 Jun 2026 07:09:25 +0200 Subject: [PATCH] Reduce LUS header bloat & improve build speed (#6802) * Avoid `randomizer_check_tracker.h` in widely used `randomizer.h` due to transitive `libultraship.h`/`UIWidgets.hpp` inclusion * Avoid `libultraship.h` inclusion in heavily used `GameInteractor.h` header * Remove unused libultraship includes * Break huge unneeded transitive include chain (via UIWidgets.hpp) This avoids that changing just UIWidgets.hpp, for example, would retrigger a rebuild of like half the project. There were a huge transitive include chains, mostly via MenuTypes.h and UIWidgets.hpp. Because of that, I'm splitting UIWidgets into a second header file UIWidgetOptions.hpp, which can be consumed by MenuTypes.h. MenuTypes.h is split into BackendTypes.h to avoid pulling in Fast3D/Windowing/GUI stuff into unrelated code. Example chain, one of many: libultraship.h <- UIWidgets.hpp <- MenuTypes.hpp <- randomizer/option.h <- randomizer/item_location.h <- trial.h <- static_data.h <- SeedContext <- (basically all randomizer related sources, lots of other sources in Enhancement, more...) * Avoid libultraship.h in Notification.h and ObjectExtension.h; these headers are also heavily used * Add missing include * Remove unused libultraship includes * Include only ship/window/GuiWindow.h in GUI-related headers instead of libultraship.h * Cleanup ConfigUpdater.h and playthrough.cpp * Remove libultraship.h from Anchor.h and fix transitive dependencies in OTRGlobals.cpp * Remove unused libultraship.h includes in Anchor code --- soh/include/global.h | 6 + .../Enhancements/Cheats/EasyFrameAdvance.cpp | 1 - .../Difficulty/PermanentLosses.cpp | 3 + soh/soh/Enhancements/Fixes/FixWaterMQLock.cpp | 1 + .../Graphics/AgeDependentMasks.cpp | 1 + soh/soh/Enhancements/Presets/Presets.cpp | 2 - soh/soh/Enhancements/QoL/ResetHotKey.cpp | 2 +- .../Restorations/GraveHoleJumps.cpp | 2 +- .../Restorations/PauseBufferInputs.cpp | 1 - .../Enhancements/TimeDisplay/TimeDisplay.cpp | 3 +- .../Enhancements/TimeDisplay/TimeDisplay.h | 3 +- .../TimeSavers/timesaver_hook_handlers.cpp | 1 + soh/soh/Enhancements/Warping.cpp | 3 + .../Enhancements/audio/AudioCollection.cpp | 6 +- soh/soh/Enhancements/audio/AudioEditor.cpp | 1 - soh/soh/Enhancements/audio/AudioEditor.h | 4 +- soh/soh/Enhancements/audio/AudioHooks.cpp | 1 + soh/soh/Enhancements/boss-rush/BossRush.cpp | 1 + soh/soh/Enhancements/controls/InputViewer.h | 2 +- soh/soh/Enhancements/controls/Mouse.cpp | 1 + soh/soh/Enhancements/controls/Mouse.h | 2 +- .../controls/SohInputEditorWindow.cpp | 2 + .../controls/SohInputEditorWindow.h | 6 +- .../cosmetics/CosmeticsEditor.cpp | 2 - .../Enhancements/cosmetics/CosmeticsEditor.h | 2 +- soh/soh/Enhancements/customequipment.cpp | 1 + soh/soh/Enhancements/debugconsole.cpp | 4 +- .../Enhancements/debugger/SohStatsWindow.h | 2 +- soh/soh/Enhancements/debugger/actorViewer.cpp | 1 - soh/soh/Enhancements/debugger/actorViewer.h | 2 +- soh/soh/Enhancements/debugger/colViewer.h | 2 +- .../Enhancements/debugger/debugSaveEditor.cpp | 2 - .../Enhancements/debugger/debugSaveEditor.h | 2 +- soh/soh/Enhancements/debugger/dlViewer.cpp | 2 +- soh/soh/Enhancements/debugger/dlViewer.h | 2 +- .../Enhancements/debugger/hookDebugger.cpp | 1 + soh/soh/Enhancements/debugger/hookDebugger.h | 2 +- soh/soh/Enhancements/debugger/valueViewer.cpp | 1 + soh/soh/Enhancements/debugger/valueViewer.h | 3 +- .../game-interactor/GameInteractor.h | 3 +- soh/soh/Enhancements/gameplaystats.cpp | 1 - soh/soh/Enhancements/gameplaystatswindow.h | 2 +- soh/soh/Enhancements/mod_menu.h | 2 +- .../randomizer/3drando/playthrough.cpp | 2 +- .../randomizer/LakeHyliaWaterControl.cpp | 1 - .../randomizer/LockOverworldDoors.cpp | 1 - soh/soh/Enhancements/randomizer/Plandomizer.h | 2 +- soh/soh/Enhancements/randomizer/SeedContext.h | 2 +- .../Enhancements/randomizer/hook_handlers.cpp | 1 + .../Enhancements/randomizer/item_location.cpp | 2 + .../randomizer/location_access.cpp | 1 + .../Enhancements/randomizer/randomizer.cpp | 1 - soh/soh/Enhancements/randomizer/randomizer.h | 1 - .../randomizer/randomizer_check_tracker.cpp | 1 - .../randomizer/randomizer_check_tracker.h | 2 - .../randomizer_entrance_tracker.cpp | 1 - .../randomizer/randomizer_entrance_tracker.h | 6 +- .../randomizer/randomizer_item_tracker.cpp | 1 - .../randomizer/randomizer_item_tracker.h | 1 - soh/soh/Enhancements/randomizer/savefile.cpp | 2 + soh/soh/Enhancements/randomizer/settings.cpp | 2 +- soh/soh/Enhancements/randomizer/static_data.h | 1 + .../speechsynthesizer/SpeechLogger.cpp | 2 +- soh/soh/Enhancements/timesplits/TimeSplits.h | 3 +- soh/soh/Network/Anchor/Anchor.cpp | 1 - soh/soh/Network/Anchor/Anchor.h | 4 +- soh/soh/Network/Anchor/AnchorRoomWindow.cpp | 1 + soh/soh/Network/Anchor/HookHandlers.cpp | 1 - soh/soh/Network/Anchor/JsonConversions.hpp | 1 - soh/soh/Network/Anchor/Menu.cpp | 1 - .../Network/Anchor/Packets/AllClientState.cpp | 3 +- .../Network/Anchor/Packets/DamagePlayer.cpp | 1 - .../Network/Anchor/Packets/DisableAnchor.cpp | 1 - .../Anchor/Packets/EntranceDiscovered.cpp | 1 - .../Network/Anchor/Packets/GameComplete.cpp | 1 - soh/soh/Network/Anchor/Packets/GiveItem.cpp | 1 - soh/soh/Network/Anchor/Packets/Handshake.cpp | 2 - soh/soh/Network/Anchor/Packets/OcarinaSfx.cpp | 1 - soh/soh/Network/Anchor/Packets/PlayerSfx.cpp | 1 - .../Network/Anchor/Packets/PlayerUpdate.cpp | 1 - .../Anchor/Packets/RequestTeamState.cpp | 1 - .../Anchor/Packets/RequestTeleport.cpp | 1 - .../Network/Anchor/Packets/ServerMessage.cpp | 2 - .../Network/Anchor/Packets/SetCheckStatus.cpp | 3 +- soh/soh/Network/Anchor/Packets/SetFlag.cpp | 1 - soh/soh/Network/Anchor/Packets/TeleportTo.cpp | 1 - soh/soh/Network/Anchor/Packets/UnsetFlag.cpp | 1 - .../Anchor/Packets/UpdateBeansCount.cpp | 1 - .../Anchor/Packets/UpdateClientState.cpp | 1 - .../Anchor/Packets/UpdateDungeonItems.cpp | 1 - .../Anchor/Packets/UpdateRoomState.cpp | 1 - .../Anchor/Packets/UpdateTeamState.cpp | 1 - soh/soh/Network/CrowdControl/CrowdControl.cpp | 2 - soh/soh/Network/CrowdControl/CrowdControl.h | 1 + soh/soh/Network/Network.cpp | 1 - soh/soh/Network/Sail/Sail.cpp | 1 - soh/soh/Notification/Notification.h | 2 +- soh/soh/OTRGlobals.cpp | 5 +- soh/soh/ObjectExtension/ObjectExtension.h | 3 +- soh/soh/SaveManager.cpp | 1 - soh/soh/ShipUtils.cpp | 3 +- soh/soh/ShipUtils.h | 4 +- soh/soh/SohGui/BackendTypes.h | 20 + soh/soh/SohGui/Menu.cpp | 3 +- soh/soh/SohGui/Menu.h | 6 +- soh/soh/SohGui/MenuTypes.h | 19 +- soh/soh/SohGui/ResolutionEditor.cpp | 1 - soh/soh/SohGui/ResolutionEditor.h | 2 - soh/soh/SohGui/SohMenu.cpp | 3 + soh/soh/SohGui/SohMenu.h | 1 - soh/soh/SohGui/SohMenuEnhancements.cpp | 1 + soh/soh/SohGui/SohMenuSettings.cpp | 2 +- soh/soh/SohGui/SohMenuStartingItems.cpp | 1 - soh/soh/SohGui/SohModals.h | 4 +- soh/soh/SohGui/UIWidgetOptions.hpp | 593 ++++++++++++++++++ soh/soh/SohGui/UIWidgets.cpp | 1 - soh/soh/SohGui/UIWidgets.hpp | 589 +---------------- soh/soh/config/ConfigUpdaters.cpp | 2 + soh/soh/config/ConfigUpdaters.h | 2 +- 119 files changed, 730 insertions(+), 710 deletions(-) create mode 100644 soh/soh/SohGui/BackendTypes.h create mode 100644 soh/soh/SohGui/UIWidgetOptions.hpp diff --git a/soh/include/global.h b/soh/include/global.h index b453439fd3..a313bcb212 100644 --- a/soh/include/global.h +++ b/soh/include/global.h @@ -9,8 +9,14 @@ #include "variables.h" #include "macros.h" #include "soh/cvar_prefixes.h" +#ifdef __cplusplus +extern "C++" { +#endif #include "soh/Enhancements/gameconsole.h" #include "soh/Enhancements/gameplaystats.h" +#ifdef __cplusplus +} +#endif #include #define _AudioseqSegmentRomStart "Audioseq" diff --git a/soh/soh/Enhancements/Cheats/EasyFrameAdvance.cpp b/soh/soh/Enhancements/Cheats/EasyFrameAdvance.cpp index ab7bba3776..1c1506b503 100644 --- a/soh/soh/Enhancements/Cheats/EasyFrameAdvance.cpp +++ b/soh/soh/Enhancements/Cheats/EasyFrameAdvance.cpp @@ -1,4 +1,3 @@ -#include #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ShipInit.hpp" diff --git a/soh/soh/Enhancements/Difficulty/PermanentLosses.cpp b/soh/soh/Enhancements/Difficulty/PermanentLosses.cpp index 5a7935fd7c..4d3975aca2 100644 --- a/soh/soh/Enhancements/Difficulty/PermanentLosses.cpp +++ b/soh/soh/Enhancements/Difficulty/PermanentLosses.cpp @@ -1,3 +1,6 @@ +#include +#include + #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/randomizer/randomizer.h" #include "soh/OTRGlobals.h" diff --git a/soh/soh/Enhancements/Fixes/FixWaterMQLock.cpp b/soh/soh/Enhancements/Fixes/FixWaterMQLock.cpp index c4a9c78457..a49c086d87 100644 --- a/soh/soh/Enhancements/Fixes/FixWaterMQLock.cpp +++ b/soh/soh/Enhancements/Fixes/FixWaterMQLock.cpp @@ -3,6 +3,7 @@ #include "soh/ShipInit.hpp" extern "C" { +#include "variables.h" #include "src/overlays/actors/ovl_En_Door/z_en_door.h" extern PlayState* gPlayState; } diff --git a/soh/soh/Enhancements/Graphics/AgeDependentMasks.cpp b/soh/soh/Enhancements/Graphics/AgeDependentMasks.cpp index f4d8331f70..33faff297f 100644 --- a/soh/soh/Enhancements/Graphics/AgeDependentMasks.cpp +++ b/soh/soh/Enhancements/Graphics/AgeDependentMasks.cpp @@ -1,3 +1,4 @@ +#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/ShipInit.hpp" #include "soh/ResourceManagerHelpers.h" diff --git a/soh/soh/Enhancements/Presets/Presets.cpp b/soh/soh/Enhancements/Presets/Presets.cpp index 8701a41764..d3c75c3912 100644 --- a/soh/soh/Enhancements/Presets/Presets.cpp +++ b/soh/soh/Enhancements/Presets/Presets.cpp @@ -2,9 +2,7 @@ #include #include #include -#include #include -#include #include #include "soh/OTRGlobals.h" #include "soh/util.h" diff --git a/soh/soh/Enhancements/QoL/ResetHotKey.cpp b/soh/soh/Enhancements/QoL/ResetHotKey.cpp index 644b797f07..589ff89032 100644 --- a/soh/soh/Enhancements/QoL/ResetHotKey.cpp +++ b/soh/soh/Enhancements/QoL/ResetHotKey.cpp @@ -1,4 +1,4 @@ -#include +#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/ShipInit.hpp" #include "functions.h" diff --git a/soh/soh/Enhancements/Restorations/GraveHoleJumps.cpp b/soh/soh/Enhancements/Restorations/GraveHoleJumps.cpp index 676e05d953..adb2664ee0 100644 --- a/soh/soh/Enhancements/Restorations/GraveHoleJumps.cpp +++ b/soh/soh/Enhancements/Restorations/GraveHoleJumps.cpp @@ -1,4 +1,4 @@ -#include +#include #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ShipInit.hpp" #include "functions.h" diff --git a/soh/soh/Enhancements/Restorations/PauseBufferInputs.cpp b/soh/soh/Enhancements/Restorations/PauseBufferInputs.cpp index 090c46a60e..a9a1b61056 100644 --- a/soh/soh/Enhancements/Restorations/PauseBufferInputs.cpp +++ b/soh/soh/Enhancements/Restorations/PauseBufferInputs.cpp @@ -1,4 +1,3 @@ -#include #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ShipInit.hpp" diff --git a/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp b/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp index 3833562554..959d6156c0 100644 --- a/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp +++ b/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp @@ -7,8 +7,7 @@ #include "soh/SohGui/ImGuiUtils.h" #include - -#include +#include extern "C" { #include "macros.h" diff --git a/soh/soh/Enhancements/TimeDisplay/TimeDisplay.h b/soh/soh/Enhancements/TimeDisplay/TimeDisplay.h index c6635b5a77..46a67c639a 100644 --- a/soh/soh/Enhancements/TimeDisplay/TimeDisplay.h +++ b/soh/soh/Enhancements/TimeDisplay/TimeDisplay.h @@ -1,4 +1,5 @@ -#include +#include +#include class TimeDisplayWindow final : public Ship::GuiWindow { public: diff --git a/soh/soh/Enhancements/TimeSavers/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/TimeSavers/timesaver_hook_handlers.cpp index 12b3c83ef2..9661d1a369 100644 --- a/soh/soh/Enhancements/TimeSavers/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/TimeSavers/timesaver_hook_handlers.cpp @@ -1,4 +1,5 @@ #include +#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/enhancementTypes.h" diff --git a/soh/soh/Enhancements/Warping.cpp b/soh/soh/Enhancements/Warping.cpp index 0a11c6e27f..fa0f3be016 100644 --- a/soh/soh/Enhancements/Warping.cpp +++ b/soh/soh/Enhancements/Warping.cpp @@ -1,9 +1,12 @@ #include +#include +#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ShipInit.hpp" #include "functions.h" #include "soh/SohGui/MenuTypes.h" +#include "soh/SohGui/UIWidgets.hpp" #include "soh/util.h" extern "C" { diff --git a/soh/soh/Enhancements/audio/AudioCollection.cpp b/soh/soh/Enhancements/audio/AudioCollection.cpp index f1e323d7e9..4ed88a60c0 100644 --- a/soh/soh/Enhancements/audio/AudioCollection.cpp +++ b/soh/soh/Enhancements/audio/AudioCollection.cpp @@ -4,9 +4,11 @@ #include "soh/cvar_prefixes.h" #include "soh/Notification/Notification.h" #include +#include +#include +#include #include -#include -#include +#include #include #include #include diff --git a/soh/soh/Enhancements/audio/AudioEditor.cpp b/soh/soh/Enhancements/audio/AudioEditor.cpp index 44746e46db..59d8774692 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.cpp +++ b/soh/soh/Enhancements/audio/AudioEditor.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include "soh/ShipUtils.h" #include "soh/OTRGlobals.h" diff --git a/soh/soh/Enhancements/audio/AudioEditor.h b/soh/soh/Enhancements/audio/AudioEditor.h index d308c9bd35..1a6e887746 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.h +++ b/soh/soh/Enhancements/audio/AudioEditor.h @@ -3,7 +3,9 @@ #ifdef __cplusplus -#include +#include +#include + #include #include "AudioCollection.h" diff --git a/soh/soh/Enhancements/audio/AudioHooks.cpp b/soh/soh/Enhancements/audio/AudioHooks.cpp index f035eb0d18..00d9b9b50d 100644 --- a/soh/soh/Enhancements/audio/AudioHooks.cpp +++ b/soh/soh/Enhancements/audio/AudioHooks.cpp @@ -3,6 +3,7 @@ #include "AudioCollection.h" #include #include +#include extern "C" { #include "variables.h" diff --git a/soh/soh/Enhancements/boss-rush/BossRush.cpp b/soh/soh/Enhancements/boss-rush/BossRush.cpp index dde3e306c4..016be3ed73 100644 --- a/soh/soh/Enhancements/boss-rush/BossRush.cpp +++ b/soh/soh/Enhancements/boss-rush/BossRush.cpp @@ -8,6 +8,7 @@ #include #include #include +#include extern "C" { #include "functions.h" diff --git a/soh/soh/Enhancements/controls/InputViewer.h b/soh/soh/Enhancements/controls/InputViewer.h index 67303b7eb5..650497f31a 100644 --- a/soh/soh/Enhancements/controls/InputViewer.h +++ b/soh/soh/Enhancements/controls/InputViewer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #define CVAR_INPUT_VIEWER(var) "gInputViewer." var diff --git a/soh/soh/Enhancements/controls/Mouse.cpp b/soh/soh/Enhancements/controls/Mouse.cpp index 3d560bcc32..9cadf0a8c3 100644 --- a/soh/soh/Enhancements/controls/Mouse.cpp +++ b/soh/soh/Enhancements/controls/Mouse.cpp @@ -2,6 +2,7 @@ #include "soh/OTRGlobals.h" #include "z64player.h" #include "global.h" +#include #include #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ShipInit.hpp" diff --git a/soh/soh/Enhancements/controls/Mouse.h b/soh/soh/Enhancements/controls/Mouse.h index 2ab954e47d..c25360185a 100644 --- a/soh/soh/Enhancements/controls/Mouse.h +++ b/soh/soh/Enhancements/controls/Mouse.h @@ -3,7 +3,7 @@ #pragma once -#include +#include struct Player; diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index 49175f6ce5..c02f310e47 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -1,5 +1,7 @@ #include "SohInputEditorWindow.h" +#include #include +#include #include #include "soh/OTRGlobals.h" #include "soh/SohGui/SohMenu.h" diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.h b/soh/soh/Enhancements/controls/SohInputEditorWindow.h index 53d8861c68..c6fe826037 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.h +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.h @@ -1,14 +1,16 @@ #pragma once -#include -#include #include #include +#include #include #include #include #include +#include +#include + typedef CONTROLLERBUTTONS_T N64ButtonMask; typedef struct { diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index c8a21c5fda..9bc3cc9ea5 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -4,8 +4,6 @@ #include "soh/Enhancements/game-interactor/GameInteractor.h" #include -#include -#include #include #include "soh/SohGui/UIWidgets.hpp" diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h index c432d49d10..3a4e74bb2c 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h @@ -1,5 +1,4 @@ #pragma once -#include // Not to be confused with tabs, groups are 1:1 with the boxes shown in the UI, grouping them allows us to // reset/randomize every item in a group at once. If you are looking for tabs they are rendered manually in ImGui in @@ -32,6 +31,7 @@ typedef enum { #ifdef __cplusplus #include #include +#include #include "soh/SohGui/UIWidgets.hpp" extern "C" { #endif //__cplusplus diff --git a/soh/soh/Enhancements/customequipment.cpp b/soh/soh/Enhancements/customequipment.cpp index be622330d1..e8c2721543 100644 --- a/soh/soh/Enhancements/customequipment.cpp +++ b/soh/soh/Enhancements/customequipment.cpp @@ -1,4 +1,5 @@ #include +#include #include "objects/object_link_boy/object_link_boy.h" #include "objects/object_link_child/object_link_child.h" #include "objects/object_custom_equip/object_custom_equip.h" diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index b7ae40d550..caa0f9f7a6 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -13,6 +13,7 @@ #include "soh/Enhancements/audio/AudioEditor.h" #include "soh/Enhancements/randomizer/logic.h" #include "soh/Enhancements/randomizer/randomizer.h" +#include "soh/Enhancements/randomizer/randomizer_check_tracker.h" #define Path _Path #define PATH_HACK @@ -33,9 +34,6 @@ extern "C" { extern PlayState* gPlayState; } -#include -#include - #define CMD_REGISTER Ship::Context::GetRawInstance()->GetConsole()->AddCommand // TODO: Commands should be using the output passed in. #define ERROR_MESSAGE \ diff --git a/soh/soh/Enhancements/debugger/SohStatsWindow.h b/soh/soh/Enhancements/debugger/SohStatsWindow.h index 09b495cdb6..ed1b1c6c59 100644 --- a/soh/soh/Enhancements/debugger/SohStatsWindow.h +++ b/soh/soh/Enhancements/debugger/SohStatsWindow.h @@ -1,7 +1,7 @@ #ifndef SOH_STATS_H #define SOH_STATS_H -#include +#include class SohStatsWindow final : public Ship::GuiWindow { public: diff --git a/soh/soh/Enhancements/debugger/actorViewer.cpp b/soh/soh/Enhancements/debugger/actorViewer.cpp index 4141bcf45b..6d9c400e6c 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.cpp +++ b/soh/soh/Enhancements/debugger/actorViewer.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include "soh/OTRGlobals.h" #include "soh/cvar_prefixes.h" diff --git a/soh/soh/Enhancements/debugger/actorViewer.h b/soh/soh/Enhancements/debugger/actorViewer.h index 07c7e5e24d..809fdf1d44 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.h +++ b/soh/soh/Enhancements/debugger/actorViewer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include "z64actor.h" diff --git a/soh/soh/Enhancements/debugger/colViewer.h b/soh/soh/Enhancements/debugger/colViewer.h index 04f457aa00..b34747cf72 100644 --- a/soh/soh/Enhancements/debugger/colViewer.h +++ b/soh/soh/Enhancements/debugger/colViewer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include typedef enum { COLVIEW_DISABLED, COLVIEW_SOLID, COLVIEW_TRANSPARENT } ColViewerRenderSetting; diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index 6a20efe805..99c6eee523 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -13,8 +13,6 @@ #include #include #include -#include -#include #include #include diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.h b/soh/soh/Enhancements/debugger/debugSaveEditor.h index 856b3002a3..f448be4a73 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.h +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.h @@ -5,7 +5,7 @@ #include #include #include "soh/Enhancements/randomizer/randomizerTypes.h" -#include +#include typedef enum { EVENT_CHECK_INF, diff --git a/soh/soh/Enhancements/debugger/dlViewer.cpp b/soh/soh/Enhancements/debugger/dlViewer.cpp index ad52e5c7af..df3bff6465 100644 --- a/soh/soh/Enhancements/debugger/dlViewer.cpp +++ b/soh/soh/Enhancements/debugger/dlViewer.cpp @@ -2,6 +2,7 @@ #include "soh/util.h" #include "soh/SohGui/UIWidgets.hpp" #include "soh/SohGui/SohGui.hpp" +#include #include #include #include @@ -11,7 +12,6 @@ #include #include #include -#include #include "dlViewer.h" extern "C" { diff --git a/soh/soh/Enhancements/debugger/dlViewer.h b/soh/soh/Enhancements/debugger/dlViewer.h index a75fead971..4e81cc82d3 100644 --- a/soh/soh/Enhancements/debugger/dlViewer.h +++ b/soh/soh/Enhancements/debugger/dlViewer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include class DLViewerWindow final : public Ship::GuiWindow { public: diff --git a/soh/soh/Enhancements/debugger/hookDebugger.cpp b/soh/soh/Enhancements/debugger/hookDebugger.cpp index 709bbb1d42..c101b7c716 100644 --- a/soh/soh/Enhancements/debugger/hookDebugger.cpp +++ b/soh/soh/Enhancements/debugger/hookDebugger.cpp @@ -1,4 +1,5 @@ #include "hookDebugger.h" +#include #include "soh/SohGui/SohGui.hpp" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/SohGui/UIWidgets.hpp" diff --git a/soh/soh/Enhancements/debugger/hookDebugger.h b/soh/soh/Enhancements/debugger/hookDebugger.h index c1f439f302..7cf22b1b0f 100644 --- a/soh/soh/Enhancements/debugger/hookDebugger.h +++ b/soh/soh/Enhancements/debugger/hookDebugger.h @@ -1,7 +1,7 @@ #ifndef hookDebugger_h #define hookDebugger_h -#include +#include class HookDebuggerWindow final : public Ship::GuiWindow { public: diff --git a/soh/soh/Enhancements/debugger/valueViewer.cpp b/soh/soh/Enhancements/debugger/valueViewer.cpp index 2bcb5626a8..85d78f5cbc 100644 --- a/soh/soh/Enhancements/debugger/valueViewer.cpp +++ b/soh/soh/Enhancements/debugger/valueViewer.cpp @@ -1,4 +1,5 @@ #include "valueViewer.h" +#include #include "soh/SohGui/UIWidgets.hpp" #include "soh/SohGui/SohGui.hpp" #include "soh/OTRGlobals.h" diff --git a/soh/soh/Enhancements/debugger/valueViewer.h b/soh/soh/Enhancements/debugger/valueViewer.h index c841f19c63..6549370db8 100644 --- a/soh/soh/Enhancements/debugger/valueViewer.h +++ b/soh/soh/Enhancements/debugger/valueViewer.h @@ -2,7 +2,8 @@ #ifdef __cplusplus -#include +#include +#include typedef enum { TYPE_S8, diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index abe3c29974..45840b4890 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -3,7 +3,7 @@ #ifndef GameInteractor_h #define GameInteractor_h -#include "libultraship/libultraship.h" +#include #include "vanilla-behavior/GIVanillaBehavior.h" #include @@ -82,6 +82,7 @@ void GameInteractor_SetTriforceHuntCreditsWarpActive(uint8_t state); #ifdef __cplusplus #include +#include #include #include #include diff --git a/soh/soh/Enhancements/gameplaystats.cpp b/soh/soh/Enhancements/gameplaystats.cpp index 7475bd942e..06a6db848c 100644 --- a/soh/soh/Enhancements/gameplaystats.cpp +++ b/soh/soh/Enhancements/gameplaystats.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include "soh/Enhancements/enhancementTypes.h" #include "soh/OTRGlobals.h" diff --git a/soh/soh/Enhancements/gameplaystatswindow.h b/soh/soh/Enhancements/gameplaystatswindow.h index 515820307d..59cb6bfafe 100644 --- a/soh/soh/Enhancements/gameplaystatswindow.h +++ b/soh/soh/Enhancements/gameplaystatswindow.h @@ -1,4 +1,4 @@ -#include +#include class GameplayStatsWindow final : public Ship::GuiWindow { public: diff --git a/soh/soh/Enhancements/mod_menu.h b/soh/soh/Enhancements/mod_menu.h index cb29b4001e..21da676dc1 100644 --- a/soh/soh/Enhancements/mod_menu.h +++ b/soh/soh/Enhancements/mod_menu.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #ifdef __cplusplus class ModMenuWindow : public Ship::GuiWindow { diff --git a/soh/soh/Enhancements/randomizer/3drando/playthrough.cpp b/soh/soh/Enhancements/randomizer/3drando/playthrough.cpp index 6b58bc8019..4f174a8556 100644 --- a/soh/soh/Enhancements/randomizer/3drando/playthrough.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/playthrough.cpp @@ -1,6 +1,6 @@ #include "playthrough.hpp" -#include +#include #include "fill.hpp" #include "../location_access.h" #include "random.hpp" diff --git a/soh/soh/Enhancements/randomizer/LakeHyliaWaterControl.cpp b/soh/soh/Enhancements/randomizer/LakeHyliaWaterControl.cpp index 17903949ab..8b4cb26329 100644 --- a/soh/soh/Enhancements/randomizer/LakeHyliaWaterControl.cpp +++ b/soh/soh/Enhancements/randomizer/LakeHyliaWaterControl.cpp @@ -1,4 +1,3 @@ -#include #include "soh/OTRGlobals.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ShipInit.hpp" diff --git a/soh/soh/Enhancements/randomizer/LockOverworldDoors.cpp b/soh/soh/Enhancements/randomizer/LockOverworldDoors.cpp index dbec1554c1..5d945e4749 100644 --- a/soh/soh/Enhancements/randomizer/LockOverworldDoors.cpp +++ b/soh/soh/Enhancements/randomizer/LockOverworldDoors.cpp @@ -1,4 +1,3 @@ -#include #include "soh/OTRGlobals.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/randomizer/SeedContext.h" diff --git a/soh/soh/Enhancements/randomizer/Plandomizer.h b/soh/soh/Enhancements/randomizer/Plandomizer.h index bfb118bbf4..1c45e2d8ba 100644 --- a/soh/soh/Enhancements/randomizer/Plandomizer.h +++ b/soh/soh/Enhancements/randomizer/Plandomizer.h @@ -12,7 +12,7 @@ extern "C" { #endif // PLANDOMIZER_H -#include +#include #include "soh/Enhancements/randomizer/item.h" #ifdef __cplusplus diff --git a/soh/soh/Enhancements/randomizer/SeedContext.h b/soh/soh/Enhancements/randomizer/SeedContext.h index a1d5adb261..8b46efb9c2 100644 --- a/soh/soh/Enhancements/randomizer/SeedContext.h +++ b/soh/soh/Enhancements/randomizer/SeedContext.h @@ -2,7 +2,6 @@ #include "randomizerTypes.h" #include "z64save.h" -#include "item_location.h" #include "item_override.h" #include "soh/Enhancements/custom-message/text.h" #include "hint.h" @@ -33,6 +32,7 @@ class DungeonInfo; class TrialInfo; class Trials; class Kaleido; +class ItemLocation; class Context { public: diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 596aab536c..fb3fbc8a35 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -15,6 +15,7 @@ #include "soh/ObjectExtension/ObjectExtension.h" #include "item_category_adj.h" #include "soh/Enhancements/randomizer/randomizer.h" +#include "soh/Enhancements/randomizer/randomizer_check_tracker.h" #include "soh/Enhancements/randomizer/RCToRandInf.h" extern "C" { diff --git a/soh/soh/Enhancements/randomizer/item_location.cpp b/soh/soh/Enhancements/randomizer/item_location.cpp index 713bb560d0..b21b716616 100644 --- a/soh/soh/Enhancements/randomizer/item_location.cpp +++ b/soh/soh/Enhancements/randomizer/item_location.cpp @@ -3,6 +3,8 @@ #include "logic.h" #include "3drando/random.hpp" +#include + namespace Rando { ItemLocation::ItemLocation() : rc(RC_UNKNOWN_CHECK) { } diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index 694af768a5..adc825a9e7 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -6,6 +6,7 @@ #include "soh/Enhancements/debugger/performanceTimer.h" #include +#include #include #include "3drando/shops.hpp" diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index b5376c5c20..67459e6775 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include "3drando/menu.hpp" diff --git a/soh/soh/Enhancements/randomizer/randomizer.h b/soh/soh/Enhancements/randomizer/randomizer.h index 5f3fd2c6d4..bd105d782a 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.h +++ b/soh/soh/Enhancements/randomizer/randomizer.h @@ -7,7 +7,6 @@ #include "SeedContext.h" #include #include "soh/Enhancements/randomizer/randomizer_check_objects.h" -#include "soh/Enhancements/randomizer/randomizer_check_tracker.h" #include "soh/Enhancements/randomizer/tricks.h" #include #include "soh/Enhancements/item-tables/ItemTableTypes.h" diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 17cfeda919..ade412b7d4 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "location.h" #include "item_location.h" diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h index 396f95c280..99aea52d36 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h @@ -5,8 +5,6 @@ #include "randomizer_check_objects.h" #include "soh/SohGui/UIWidgets.hpp" -#include - namespace CheckTracker { class CheckTrackerSettingsWindow final : public Ship::GuiWindow { diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index b847a19dc0..a4180971aa 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include "soh/Enhancements/randomizer/randomizer.h" extern "C" { diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h index 281b6f6d99..0dac2f9ed0 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h @@ -1,10 +1,14 @@ #pragma once #include +#include #include #include -#include +#include +#include +#include +#include #include "randomizerTypes.h" typedef enum { diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index bc527bc4f8..95af06fe11 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include "randomizer_check_tracker.h" diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h index 0538e9f71a..26cf5aa03d 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h @@ -3,7 +3,6 @@ #include #include #include -#include void DrawItemAmmo(int itemId); diff --git a/soh/soh/Enhancements/randomizer/savefile.cpp b/soh/soh/Enhancements/randomizer/savefile.cpp index f668ec799c..69298aaba7 100644 --- a/soh/soh/Enhancements/randomizer/savefile.cpp +++ b/soh/soh/Enhancements/randomizer/savefile.cpp @@ -5,6 +5,8 @@ #include "soh/Enhancements/randomizer/logic.h" #include "soh/Enhancements/randomizer/randomizer.h" +#include + extern "C" { #include #include "variables.h" diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 78988f6359..d27933cca3 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include namespace Rando { std::shared_ptr Settings::mInstance; diff --git a/soh/soh/Enhancements/randomizer/static_data.h b/soh/soh/Enhancements/randomizer/static_data.h index 5390c9ba1e..94aead4a91 100644 --- a/soh/soh/Enhancements/randomizer/static_data.h +++ b/soh/soh/Enhancements/randomizer/static_data.h @@ -6,6 +6,7 @@ #include #include "randomizerTypes.h" #include "item.h" +#include "item_location.h" #include "location.h" namespace Rando { diff --git a/soh/soh/Enhancements/speechsynthesizer/SpeechLogger.cpp b/soh/soh/Enhancements/speechsynthesizer/SpeechLogger.cpp index a47a61d62c..dd4526dad2 100644 --- a/soh/soh/Enhancements/speechsynthesizer/SpeechLogger.cpp +++ b/soh/soh/Enhancements/speechsynthesizer/SpeechLogger.cpp @@ -1,5 +1,5 @@ #include "SpeechLogger.h" -#include +#include SpeechLogger::SpeechLogger() { } diff --git a/soh/soh/Enhancements/timesplits/TimeSplits.h b/soh/soh/Enhancements/timesplits/TimeSplits.h index 2d4a4ba3fd..a005e568d8 100644 --- a/soh/soh/Enhancements/timesplits/TimeSplits.h +++ b/soh/soh/Enhancements/timesplits/TimeSplits.h @@ -2,8 +2,7 @@ #ifndef TIMESPLITS_H #define TIMESPLITS_H -#include -#include +#include #ifdef __cplusplus class TimeSplitWindow final : public Ship::GuiWindow { diff --git a/soh/soh/Network/Anchor/Anchor.cpp b/soh/soh/Network/Anchor/Anchor.cpp index d4bba613ee..f3883e2b9c 100644 --- a/soh/soh/Network/Anchor/Anchor.cpp +++ b/soh/soh/Network/Anchor/Anchor.cpp @@ -1,6 +1,5 @@ #include "Anchor.h" #include -#include #include "soh/OTRGlobals.h" #include "soh/Enhancements/nametag.h" #include "soh/ObjectExtension/ObjectExtension.h" diff --git a/soh/soh/Network/Anchor/Anchor.h b/soh/soh/Network/Anchor/Anchor.h index a7277a0a71..ae79228472 100644 --- a/soh/soh/Network/Anchor/Anchor.h +++ b/soh/soh/Network/Anchor/Anchor.h @@ -3,7 +3,9 @@ #ifdef __cplusplus #include "soh/Network/Network.h" -#include +#include +#include +#include #include #include diff --git a/soh/soh/Network/Anchor/AnchorRoomWindow.cpp b/soh/soh/Network/Anchor/AnchorRoomWindow.cpp index 6163bc8939..ec6ff51493 100644 --- a/soh/soh/Network/Anchor/AnchorRoomWindow.cpp +++ b/soh/soh/Network/Anchor/AnchorRoomWindow.cpp @@ -1,4 +1,5 @@ #include "Anchor.h" +#include #include "soh/OTRGlobals.h" #include "soh/util.h" #include "soh/Enhancements/randomizer/SeedContext.h" diff --git a/soh/soh/Network/Anchor/HookHandlers.cpp b/soh/soh/Network/Anchor/HookHandlers.cpp index 8b2817f490..f379b74f80 100644 --- a/soh/soh/Network/Anchor/HookHandlers.cpp +++ b/soh/soh/Network/Anchor/HookHandlers.cpp @@ -1,5 +1,4 @@ #include "Anchor.h" -#include #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/frame_interpolation.h" diff --git a/soh/soh/Network/Anchor/JsonConversions.hpp b/soh/soh/Network/Anchor/JsonConversions.hpp index 9a3e802884..f2720058af 100644 --- a/soh/soh/Network/Anchor/JsonConversions.hpp +++ b/soh/soh/Network/Anchor/JsonConversions.hpp @@ -3,7 +3,6 @@ #ifdef __cplusplus #include -#include #include "Anchor.h" extern "C" { diff --git a/soh/soh/Network/Anchor/Menu.cpp b/soh/soh/Network/Anchor/Menu.cpp index adaa6de905..aeb2561ae0 100644 --- a/soh/soh/Network/Anchor/Menu.cpp +++ b/soh/soh/Network/Anchor/Menu.cpp @@ -1,5 +1,4 @@ #include "Anchor.h" -#include #include "soh/SohGui/SohGui.hpp" #include "soh/SohGui/SohMenu.h" #include "soh/util.h" diff --git a/soh/soh/Network/Anchor/Packets/AllClientState.cpp b/soh/soh/Network/Anchor/Packets/AllClientState.cpp index 8e01d1f34e..10ed22db68 100644 --- a/soh/soh/Network/Anchor/Packets/AllClientState.cpp +++ b/soh/soh/Network/Anchor/Packets/AllClientState.cpp @@ -1,7 +1,8 @@ #include "soh/Network/Anchor/Anchor.h" #include "soh/Network/Anchor/JsonConversions.hpp" #include -#include +#include +#include #include "soh/OTRGlobals.h" #include "soh/Notification/Notification.h" diff --git a/soh/soh/Network/Anchor/Packets/DamagePlayer.cpp b/soh/soh/Network/Anchor/Packets/DamagePlayer.cpp index 7b0f05a1bd..6238a7f781 100644 --- a/soh/soh/Network/Anchor/Packets/DamagePlayer.cpp +++ b/soh/soh/Network/Anchor/Packets/DamagePlayer.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" extern "C" { diff --git a/soh/soh/Network/Anchor/Packets/DisableAnchor.cpp b/soh/soh/Network/Anchor/Packets/DisableAnchor.cpp index 914601bf74..4ee60b8f44 100644 --- a/soh/soh/Network/Anchor/Packets/DisableAnchor.cpp +++ b/soh/soh/Network/Anchor/Packets/DisableAnchor.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" /** diff --git a/soh/soh/Network/Anchor/Packets/EntranceDiscovered.cpp b/soh/soh/Network/Anchor/Packets/EntranceDiscovered.cpp index 85671f0ed9..6198496052 100644 --- a/soh/soh/Network/Anchor/Packets/EntranceDiscovered.cpp +++ b/soh/soh/Network/Anchor/Packets/EntranceDiscovered.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" #include "soh/OTRGlobals.h" diff --git a/soh/soh/Network/Anchor/Packets/GameComplete.cpp b/soh/soh/Network/Anchor/Packets/GameComplete.cpp index 7f41ecfeb6..0b01e3b64c 100644 --- a/soh/soh/Network/Anchor/Packets/GameComplete.cpp +++ b/soh/soh/Network/Anchor/Packets/GameComplete.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Notification/Notification.h" #include "soh/ShipUtils.h" diff --git a/soh/soh/Network/Anchor/Packets/GiveItem.cpp b/soh/soh/Network/Anchor/Packets/GiveItem.cpp index 74caa0367e..4ab439894d 100644 --- a/soh/soh/Network/Anchor/Packets/GiveItem.cpp +++ b/soh/soh/Network/Anchor/Packets/GiveItem.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Notification/Notification.h" #include "soh/Enhancements/randomizer/randomizer.h" diff --git a/soh/soh/Network/Anchor/Packets/Handshake.cpp b/soh/soh/Network/Anchor/Packets/Handshake.cpp index b93e632785..bfbb94f8ec 100644 --- a/soh/soh/Network/Anchor/Packets/Handshake.cpp +++ b/soh/soh/Network/Anchor/Packets/Handshake.cpp @@ -1,8 +1,6 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" -#include "soh/OTRGlobals.h" /** * HANDSHAKE diff --git a/soh/soh/Network/Anchor/Packets/OcarinaSfx.cpp b/soh/soh/Network/Anchor/Packets/OcarinaSfx.cpp index c2b958102a..8d4cb7c700 100644 --- a/soh/soh/Network/Anchor/Packets/OcarinaSfx.cpp +++ b/soh/soh/Network/Anchor/Packets/OcarinaSfx.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include extern "C" { #include "macros.h" diff --git a/soh/soh/Network/Anchor/Packets/PlayerSfx.cpp b/soh/soh/Network/Anchor/Packets/PlayerSfx.cpp index 6dff899eb3..8645d09fee 100644 --- a/soh/soh/Network/Anchor/Packets/PlayerSfx.cpp +++ b/soh/soh/Network/Anchor/Packets/PlayerSfx.cpp @@ -1,7 +1,6 @@ #include "soh/Network/Anchor/Anchor.h" #include "soh/Network/Anchor/JsonConversions.hpp" #include -#include extern "C" { #include "macros.h" diff --git a/soh/soh/Network/Anchor/Packets/PlayerUpdate.cpp b/soh/soh/Network/Anchor/Packets/PlayerUpdate.cpp index ad373e38e0..b43ae0a480 100644 --- a/soh/soh/Network/Anchor/Packets/PlayerUpdate.cpp +++ b/soh/soh/Network/Anchor/Packets/PlayerUpdate.cpp @@ -1,7 +1,6 @@ #include "soh/Network/Anchor/Anchor.h" #include "soh/Network/Anchor/JsonConversions.hpp" #include -#include extern "C" { #include "macros.h" diff --git a/soh/soh/Network/Anchor/Packets/RequestTeamState.cpp b/soh/soh/Network/Anchor/Packets/RequestTeamState.cpp index dda8524731..a876c9a259 100644 --- a/soh/soh/Network/Anchor/Packets/RequestTeamState.cpp +++ b/soh/soh/Network/Anchor/Packets/RequestTeamState.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/OTRGlobals.h" /** diff --git a/soh/soh/Network/Anchor/Packets/RequestTeleport.cpp b/soh/soh/Network/Anchor/Packets/RequestTeleport.cpp index 4d9c572638..17b1d27938 100644 --- a/soh/soh/Network/Anchor/Packets/RequestTeleport.cpp +++ b/soh/soh/Network/Anchor/Packets/RequestTeleport.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" /** diff --git a/soh/soh/Network/Anchor/Packets/ServerMessage.cpp b/soh/soh/Network/Anchor/Packets/ServerMessage.cpp index e7b1197311..9fdd7e428a 100644 --- a/soh/soh/Network/Anchor/Packets/ServerMessage.cpp +++ b/soh/soh/Network/Anchor/Packets/ServerMessage.cpp @@ -1,7 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include -#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Notification/Notification.h" /** diff --git a/soh/soh/Network/Anchor/Packets/SetCheckStatus.cpp b/soh/soh/Network/Anchor/Packets/SetCheckStatus.cpp index 86551783ad..31d107e0aa 100644 --- a/soh/soh/Network/Anchor/Packets/SetCheckStatus.cpp +++ b/soh/soh/Network/Anchor/Packets/SetCheckStatus.cpp @@ -1,9 +1,8 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/OTRGlobals.h" -#include "soh/Enhancements/randomizer/randomizerEnums/RandomizerCheck.h" +#include "soh/Enhancements/randomizer/randomizer_check_tracker.h" #include "soh/Enhancements/randomizer/randomizer.h" static bool isResultOfHandling = false; diff --git a/soh/soh/Network/Anchor/Packets/SetFlag.cpp b/soh/soh/Network/Anchor/Packets/SetFlag.cpp index a3bec14c50..2403efbc30 100644 --- a/soh/soh/Network/Anchor/Packets/SetFlag.cpp +++ b/soh/soh/Network/Anchor/Packets/SetFlag.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/OTRGlobals.h" diff --git a/soh/soh/Network/Anchor/Packets/TeleportTo.cpp b/soh/soh/Network/Anchor/Packets/TeleportTo.cpp index 34cf074262..82eddf1f2b 100644 --- a/soh/soh/Network/Anchor/Packets/TeleportTo.cpp +++ b/soh/soh/Network/Anchor/Packets/TeleportTo.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Network/Anchor/JsonConversions.hpp" diff --git a/soh/soh/Network/Anchor/Packets/UnsetFlag.cpp b/soh/soh/Network/Anchor/Packets/UnsetFlag.cpp index a0609ca7f0..03ce9568c2 100644 --- a/soh/soh/Network/Anchor/Packets/UnsetFlag.cpp +++ b/soh/soh/Network/Anchor/Packets/UnsetFlag.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/OTRGlobals.h" diff --git a/soh/soh/Network/Anchor/Packets/UpdateBeansCount.cpp b/soh/soh/Network/Anchor/Packets/UpdateBeansCount.cpp index c536459fbf..57ece94346 100644 --- a/soh/soh/Network/Anchor/Packets/UpdateBeansCount.cpp +++ b/soh/soh/Network/Anchor/Packets/UpdateBeansCount.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/OTRGlobals.h" diff --git a/soh/soh/Network/Anchor/Packets/UpdateClientState.cpp b/soh/soh/Network/Anchor/Packets/UpdateClientState.cpp index 67a4d3891a..2e05d6869f 100644 --- a/soh/soh/Network/Anchor/Packets/UpdateClientState.cpp +++ b/soh/soh/Network/Anchor/Packets/UpdateClientState.cpp @@ -1,7 +1,6 @@ #include "soh/Network/Anchor/Anchor.h" #include "soh/Network/Anchor/JsonConversions.hpp" #include -#include #include "soh/OTRGlobals.h" #include "soh/Enhancements/randomizer/SeedContext.h" diff --git a/soh/soh/Network/Anchor/Packets/UpdateDungeonItems.cpp b/soh/soh/Network/Anchor/Packets/UpdateDungeonItems.cpp index 59f3b80c97..faee527260 100644 --- a/soh/soh/Network/Anchor/Packets/UpdateDungeonItems.cpp +++ b/soh/soh/Network/Anchor/Packets/UpdateDungeonItems.cpp @@ -1,6 +1,5 @@ #include "soh/Network/Anchor/Anchor.h" #include -#include #include extern "C" { diff --git a/soh/soh/Network/Anchor/Packets/UpdateRoomState.cpp b/soh/soh/Network/Anchor/Packets/UpdateRoomState.cpp index 327385715f..496d7784e4 100644 --- a/soh/soh/Network/Anchor/Packets/UpdateRoomState.cpp +++ b/soh/soh/Network/Anchor/Packets/UpdateRoomState.cpp @@ -1,7 +1,6 @@ #include "soh/Network/Anchor/Anchor.h" #include "soh/Network/Anchor/JsonConversions.hpp" #include -#include #include "soh/OTRGlobals.h" extern "C" { diff --git a/soh/soh/Network/Anchor/Packets/UpdateTeamState.cpp b/soh/soh/Network/Anchor/Packets/UpdateTeamState.cpp index e26fed954c..436ac92fd9 100644 --- a/soh/soh/Network/Anchor/Packets/UpdateTeamState.cpp +++ b/soh/soh/Network/Anchor/Packets/UpdateTeamState.cpp @@ -1,7 +1,6 @@ #include "soh/Network/Anchor/Anchor.h" #include "soh/Network/Anchor/JsonConversions.hpp" #include -#include #include "soh/OTRGlobals.h" #include "soh/Notification/Notification.h" #include "soh/Enhancements/randomizer/randomizer.h" diff --git a/soh/soh/Network/CrowdControl/CrowdControl.cpp b/soh/soh/Network/CrowdControl/CrowdControl.cpp index 9eeeef7dbc..57647af811 100644 --- a/soh/soh/Network/CrowdControl/CrowdControl.cpp +++ b/soh/soh/Network/CrowdControl/CrowdControl.cpp @@ -1,7 +1,5 @@ #include "CrowdControl.h" #include "CrowdControlTypes.h" -#include -#include #include #include #include diff --git a/soh/soh/Network/CrowdControl/CrowdControl.h b/soh/soh/Network/CrowdControl/CrowdControl.h index 8effe1ebed..b9f76f1c04 100644 --- a/soh/soh/Network/CrowdControl/CrowdControl.h +++ b/soh/soh/Network/CrowdControl/CrowdControl.h @@ -4,6 +4,7 @@ #include #include +#include #include #include "soh/Network/Network.h" diff --git a/soh/soh/Network/Network.cpp b/soh/soh/Network/Network.cpp index 15d692c577..57c166445d 100644 --- a/soh/soh/Network/Network.cpp +++ b/soh/soh/Network/Network.cpp @@ -1,6 +1,5 @@ #include "Network.h" #include -#include // MARK: - Public diff --git a/soh/soh/Network/Sail/Sail.cpp b/soh/soh/Network/Sail/Sail.cpp index 43de5115cf..ce6a1ece2d 100644 --- a/soh/soh/Network/Sail/Sail.cpp +++ b/soh/soh/Network/Sail/Sail.cpp @@ -1,5 +1,4 @@ #include "Sail.h" -#include #include #include #include "soh/ShipUtils.h" diff --git a/soh/soh/Notification/Notification.h b/soh/soh/Notification/Notification.h index bf1d4ec04e..9550572626 100644 --- a/soh/soh/Notification/Notification.h +++ b/soh/soh/Notification/Notification.h @@ -3,7 +3,7 @@ #ifdef __cplusplus #include -#include +#include namespace Notification { diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index e7c8df8ca2..e0a256aacf 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1,4 +1,4 @@ -#include "OTRGlobals.h" +#include "OTRGlobals.h" #include "OTRAudio.h" #include #include @@ -24,6 +24,8 @@ #include #endif #include +#include +#include #include "Enhancements/speechsynthesizer/SpeechSynthesizer.h" #include "Enhancements/controls/SohInputEditorWindow.h" #include "Enhancements/audio/AudioCollection.h" @@ -82,7 +84,6 @@ #include "soh/Network/Anchor/Anchor.h" #include "Enhancements/game-interactor/GameInteractor.h" #include "Enhancements/randomizer/draw.h" -#include #include #include diff --git a/soh/soh/ObjectExtension/ObjectExtension.h b/soh/soh/ObjectExtension/ObjectExtension.h index d59edffd01..0a42607b92 100644 --- a/soh/soh/ObjectExtension/ObjectExtension.h +++ b/soh/soh/ObjectExtension/ObjectExtension.h @@ -2,9 +2,8 @@ #ifdef __cplusplus -#include - #include +#include #include #include #include diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 3f551567eb..696836874c 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -16,7 +16,6 @@ #include "functions.h" #include "macros.h" #include -#include #include "soh/SohGui/SohGui.hpp" #define NOGDI // avoid various windows defines that conflict with things in z64.h diff --git a/soh/soh/ShipUtils.cpp b/soh/soh/ShipUtils.cpp index b11b6ef8ca..976106757f 100644 --- a/soh/soh/ShipUtils.cpp +++ b/soh/soh/ShipUtils.cpp @@ -1,7 +1,8 @@ #include "ShipUtils.h" -#include +#include #include #include "soh_assets.h" +#include extern "C" { #include "z64.h" diff --git a/soh/soh/ShipUtils.h b/soh/soh/ShipUtils.h index f0c85adaba..fdcc2a9126 100644 --- a/soh/soh/ShipUtils.h +++ b/soh/soh/ShipUtils.h @@ -1,10 +1,12 @@ #ifndef SHIP_UTILS_H #define SHIP_UTILS_H -#include +#include #ifdef __cplusplus +#include #include +#include void LoadGuiTextures(); diff --git a/soh/soh/SohGui/BackendTypes.h b/soh/soh/SohGui/BackendTypes.h new file mode 100644 index 0000000000..85b327c51b --- /dev/null +++ b/soh/soh/SohGui/BackendTypes.h @@ -0,0 +1,20 @@ +#ifndef SHIP_BACKENDTYPES_H +#define SHIP_BACKENDTYPES_H + +#include +#include + +static const std::map audioBackendsMap = { + { Ship::AudioBackend::WASAPI, "Windows Audio Session API" }, + { Ship::AudioBackend::SDL, "SDL" }, + { Ship::AudioBackend::COREAUDIO, "Core Audio" }, + { Ship::AudioBackend::NUL, "Null" }, +}; + +static const std::map windowBackendsMap = { + { Fast::WindowBackend::FAST3D_DXGI_DX11, "DirectX" }, + { Fast::WindowBackend::FAST3D_SDL_OPENGL, "OpenGL" }, + { Fast::WindowBackend::FAST3D_SDL_METAL, "Metal" }, +}; + +#endif // SHIP_BACKENDTYPES_H diff --git a/soh/soh/SohGui/Menu.cpp b/soh/soh/SohGui/Menu.cpp index 455fd6b024..594bb544c8 100644 --- a/soh/soh/SohGui/Menu.cpp +++ b/soh/soh/SohGui/Menu.cpp @@ -1,7 +1,8 @@ #include "Menu.h" +#include "BackendTypes.h" #include "UIWidgets.hpp" #include "soh/OTRGlobals.h" -#include +#include #include #include "SohModals.h" #include diff --git a/soh/soh/SohGui/Menu.h b/soh/soh/SohGui/Menu.h index 7fcbab7a93..988d969a2d 100644 --- a/soh/soh/SohGui/Menu.h +++ b/soh/soh/SohGui/Menu.h @@ -1,8 +1,10 @@ #ifndef MENU_H #define MENU_H -#include -#include +#include +#include +#include +#include #include "MenuTypes.h" namespace Ship { diff --git a/soh/soh/SohGui/MenuTypes.h b/soh/soh/SohGui/MenuTypes.h index 192c49da30..ec5607f41c 100644 --- a/soh/soh/SohGui/MenuTypes.h +++ b/soh/soh/SohGui/MenuTypes.h @@ -1,9 +1,9 @@ #ifndef MENUTYPES_H #define MENUTYPES_H -#include -#include -#include "UIWidgets.hpp" +#include + +#include "UIWidgetOptions.hpp" typedef enum { DISABLE_FOR_NO_VSYNC, @@ -265,19 +265,6 @@ struct MainMenuEntry { std::vector sidebarOrder = {}; }; -static const std::map audioBackendsMap = { - { Ship::AudioBackend::WASAPI, "Windows Audio Session API" }, - { Ship::AudioBackend::SDL, "SDL" }, - { Ship::AudioBackend::COREAUDIO, "Core Audio" }, - { Ship::AudioBackend::NUL, "Null" }, -}; - -static const std::map windowBackendsMap = { - { Fast::WindowBackend::FAST3D_DXGI_DX11, "DirectX" }, - { Fast::WindowBackend::FAST3D_SDL_OPENGL, "OpenGL" }, - { Fast::WindowBackend::FAST3D_SDL_METAL, "Metal" }, -}; - struct MenuInit { static std::vector>& GetInitFuncs() { static std::vector> menuInitFuncs; diff --git a/soh/soh/SohGui/ResolutionEditor.cpp b/soh/soh/SohGui/ResolutionEditor.cpp index 829df9f0b6..fc7323e8b4 100644 --- a/soh/soh/SohGui/ResolutionEditor.cpp +++ b/soh/soh/SohGui/ResolutionEditor.cpp @@ -1,6 +1,5 @@ #include "ResolutionEditor.h" #include -#include #include "soh/SohGui/UIWidgets.hpp" #include diff --git a/soh/soh/SohGui/ResolutionEditor.h b/soh/soh/SohGui/ResolutionEditor.h index 358598a875..55f728ce03 100644 --- a/soh/soh/SohGui/ResolutionEditor.h +++ b/soh/soh/SohGui/ResolutionEditor.h @@ -1,8 +1,6 @@ #ifndef RESOLUTIONEDITOR_H #define RESOLUTIONEDITOR_H -#include - namespace SohGui { bool IsDroppingFrames(); void RegisterResolutionWidgets(); diff --git a/soh/soh/SohGui/SohMenu.cpp b/soh/soh/SohGui/SohMenu.cpp index ff793deb24..4a746e3a91 100644 --- a/soh/soh/SohGui/SohMenu.cpp +++ b/soh/soh/SohGui/SohMenu.cpp @@ -1,4 +1,7 @@ #include "SohMenu.h" +#include +#include +#include #include #include #include diff --git a/soh/soh/SohGui/SohMenu.h b/soh/soh/SohGui/SohMenu.h index c50c436740..aeb5349d16 100644 --- a/soh/soh/SohGui/SohMenu.h +++ b/soh/soh/SohGui/SohMenu.h @@ -1,7 +1,6 @@ #ifndef SOHMENU_H #define SOHMENU_H -#include #include "Menu.h" #include #include "soh/cvar_prefixes.h" diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 649eab3f1f..dc04eebac4 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -6,6 +6,7 @@ #include #include #include "soh/Enhancements/randomizer/randomizer.h" +#include extern "C" { #include "functions.h" diff --git a/soh/soh/SohGui/SohMenuSettings.cpp b/soh/soh/SohGui/SohMenuSettings.cpp index 587b6a4aa6..6431677269 100644 --- a/soh/soh/SohGui/SohMenuSettings.cpp +++ b/soh/soh/SohGui/SohMenuSettings.cpp @@ -6,7 +6,7 @@ #include #include "soh/ResourceManagerHelpers.h" #include "UIWidgets.hpp" -#include +#include extern "C" { #include "include/z64audio.h" diff --git a/soh/soh/SohGui/SohMenuStartingItems.cpp b/soh/soh/SohGui/SohMenuStartingItems.cpp index f2c5c4960d..32139f07a8 100644 --- a/soh/soh/SohGui/SohMenuStartingItems.cpp +++ b/soh/soh/SohGui/SohMenuStartingItems.cpp @@ -9,7 +9,6 @@ #include #include -#include extern "C" { #include "variables.h" diff --git a/soh/soh/SohGui/SohModals.h b/soh/soh/SohGui/SohModals.h index fbb1237350..bc404b4f74 100644 --- a/soh/soh/SohGui/SohModals.h +++ b/soh/soh/SohGui/SohModals.h @@ -1,8 +1,8 @@ #pragma once -#include +#include +#include #include -#include class SohModalWindow final : public Ship::GuiWindow { public: diff --git a/soh/soh/SohGui/UIWidgetOptions.hpp b/soh/soh/SohGui/UIWidgetOptions.hpp new file mode 100644 index 0000000000..7b5e66b595 --- /dev/null +++ b/soh/soh/SohGui/UIWidgetOptions.hpp @@ -0,0 +1,593 @@ +#ifndef UIWidgetOptions_hpp +#define UIWidgetOptions_hpp + +#include +#include +#include +#include +#include +#define IMGUI_DEFINE_MATH_OPERATORS +#include + +#include + +#include "soh/ShipInit.hpp" +#include "soh/ShipUtils.h" + +namespace UIWidgets { +namespace Sizes { +const ImVec2 Inline = ImVec2(0.0f, 0.0f); +const ImVec2 Fill = ImVec2(-1.0f, 0.0f); +} // namespace Sizes + +// mostly in order for colors usable by the menu without custom text color +enum Colors { + Red, + DarkRed, + Orange, + Green, + DarkGreen, + LightBlue, + Blue, + DarkBlue, + Indigo, + Violet, + Purple, + Brown, + Gray, + DarkGray, + // not suitable for menu theme use + Pink, + Yellow, + Cyan, + Black, + LightGray, + White, + NoColor +}; + +enum InputTypes { String, Scalar }; + +enum LabelPositions { + Near, + Far, + Above, + None, + Within, +}; + +enum ComponentAlignments { + Left, + Right, +}; + +struct WidgetOptions { + std::string tooltip = ""; + bool disabled = false; + std::string disabledTooltip = ""; + + WidgetOptions& Tooltip(std::string tooltip_) { + tooltip = tooltip_; + return *this; + } + + WidgetOptions& Disabled(bool disabled_) { + disabled = disabled_; + return *this; + } + + WidgetOptions& DisabledTooltip(std::string disabledTooltip_) { + disabledTooltip = disabledTooltip_; + return *this; + } +}; + +struct TextOptions : WidgetOptions { + Colors color = Colors::NoColor; + + TextOptions& Color(Colors color_) { + color = color_; + return *this; + } +}; + +struct ButtonOptions : WidgetOptions { + ImVec2 size = Sizes::Fill; + ImVec2 padding = ImVec2(10.0f, 8.0f); + Colors color = Colors::Gray; + + ButtonOptions& Size(ImVec2 size_) { + size = size_; + return *this; + } + + ButtonOptions& Padding(ImVec2 padding_) { + padding = padding_; + return *this; + } + + ButtonOptions& Tooltip(std::string tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + ButtonOptions& Color(Colors color_) { + color = color_; + return *this; + } + ButtonOptions& DisabledTooltip(const char* disabledTooltip_) { + WidgetOptions::disabledTooltip = disabledTooltip_; + return *this; + } +}; + +struct ColorPickerOptions : WidgetOptions { + ImVec2 size = Sizes::Fill; + ImVec2 padding = ImVec2(10.0f, 8.0f); + Colors color = Colors::Gray; + Color_RGBA8 defaultValue = { 255, 255, 255, 255 }; + bool useAlpha, showReset, showRandom, showRainbow, showLock; + + ColorPickerOptions& Size(ImVec2 size_) { + size = size_; + return *this; + } + + ColorPickerOptions& Padding(ImVec2 padding_) { + padding = padding_; + return *this; + } + + ColorPickerOptions& Tooltip(std::string tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + ColorPickerOptions& ShowReset(bool showReset_ = true) { + showReset = showReset_; + return *this; + } + + ColorPickerOptions& ShowRandom(bool showRandom_ = true) { + showRandom = showRandom_; + return *this; + } + + ColorPickerOptions& ShowRainbow(bool showRainbow_ = true) { + showRainbow = showRainbow_; + return *this; + } + + ColorPickerOptions& ShowLock(bool showLock_ = true) { + showLock = showLock_; + return *this; + } + + ColorPickerOptions& UseAlpha(bool useAlpha_ = true) { + useAlpha = useAlpha_; + return *this; + } + + ColorPickerOptions& Color(Colors color_) { + color = color_; + return *this; + } + + ColorPickerOptions& DefaultValue(Color_RGBA8 defaultValue_) { + defaultValue = defaultValue_; + return *this; + } +}; + +struct WindowButtonOptions : WidgetOptions { + ImVec2 size = Sizes::Inline; + ImVec2 padding = ImVec2(10.0f, 8.0f); + Colors color = Colors::Gray; + bool showButton = true; + bool embedWindow = true; + + WindowButtonOptions& Size(ImVec2 size_) { + size = size_; + return *this; + } + + WindowButtonOptions& Padding(ImVec2 padding_) { + padding = padding_; + return *this; + } + + WindowButtonOptions& Tooltip(std::string tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + WindowButtonOptions& Color(Colors color_) { + color = color_; + return *this; + } + + WindowButtonOptions& ShowButton(bool showButton_) { + showButton = showButton_; + return *this; + } + + WindowButtonOptions& EmbedWindow(bool embedWindow_) { + embedWindow = embedWindow_; + return *this; + } +}; + +struct CheckboxOptions : WidgetOptions { + bool defaultValue = false; // Only applicable to CVarCheckbox + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Near; + ImVec2 padding = ImVec2(10.0f, 8.0f); + Colors color = Colors::LightBlue; + + CheckboxOptions& DefaultValue(bool defaultValue_) { + defaultValue = defaultValue_; + return *this; + } + + CheckboxOptions& ComponentAlignment(ComponentAlignments alignment_) { + alignment = alignment_; + return *this; + } + + CheckboxOptions& LabelPosition(LabelPositions labelPosition_) { + labelPosition = labelPosition_; + return *this; + } + + CheckboxOptions& Tooltip(std::string tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + CheckboxOptions& Color(Colors color_) { + color = color_; + return *this; + } + + CheckboxOptions& DisabledTooltip(std::string disabledTooltip_) { + WidgetOptions::disabledTooltip = disabledTooltip_; + return *this; + } + + CheckboxOptions& Padding(ImVec2 padding_) { + padding = padding_; + return *this; + } +}; + +struct ComboboxOptions : WidgetOptions { + std::map comboMap = {}; + uint32_t defaultIndex = 0; // Only applicable to CVarCombobox + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Above; + ImGuiComboFlags flags = 0; + Colors color = Colors::LightBlue; + + ComboboxOptions& ComboMap(std::map comboMap_) { + comboMap = comboMap_; + return *this; + } + + ComboboxOptions& DefaultIndex(uint32_t defaultIndex_) { + defaultIndex = defaultIndex_; + return *this; + } + + ComboboxOptions& ComponentAlignment(ComponentAlignments alignment_) { + alignment = alignment_; + return *this; + } + + ComboboxOptions& LabelPosition(LabelPositions labelPosition_) { + labelPosition = labelPosition_; + return *this; + } + + ComboboxOptions& Tooltip(std::string tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + ComboboxOptions& Color(Colors color_) { + color = color_; + return *this; + } +}; + +struct IntSliderOptions : WidgetOptions { + bool showButtons = true; + const char* format = "%d"; + int32_t step = 1; + int32_t min = 1; + int32_t max = 10; + int32_t defaultValue = 1; + bool clamp = true; + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Above; + Colors color = Colors::Gray; + ImGuiSliderFlags flags = 0; + ImVec2 size = { 0, 0 }; + + IntSliderOptions& ShowButtons(bool showButtons_) { + showButtons = showButtons_; + return *this; + } + + IntSliderOptions& Format(const char* format_) { + format = format_; + return *this; + } + + IntSliderOptions& Step(int32_t step_) { + step = step_; + return *this; + } + + IntSliderOptions& Min(int32_t min_) { + min = min_; + return *this; + } + + IntSliderOptions& Max(int32_t max_) { + max = max_; + return *this; + } + + IntSliderOptions& DefaultValue(int32_t defaultValue_) { + defaultValue = defaultValue_; + return *this; + } + + IntSliderOptions& ComponentAlignment(ComponentAlignments alignment_) { + alignment = alignment_; + return *this; + } + + IntSliderOptions& LabelPosition(LabelPositions labelPosition_) { + labelPosition = labelPosition_; + return *this; + } + + IntSliderOptions& Tooltip(std::string tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + IntSliderOptions& Color(Colors color_) { + color = color_; + return *this; + } + + IntSliderOptions& Size(ImVec2 size_) { + size = size_; + return *this; + } + + IntSliderOptions& Clamp(bool clamp_) { + clamp = clamp_; + return *this; + } +}; + +struct FloatSliderOptions : WidgetOptions { + bool showButtons = true; + const char* format = "%f"; + float step = 0.01f; + float min = 0.01f; + float max = 10.0f; + float defaultValue = 1.0f; + bool clamp = true; + bool isPercentage = false; // Multiplies visual value by 100 + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Above; + Colors color = Colors::Gray; + ImGuiSliderFlags flags = 0; + ImVec2 size = { 0, 0 }; + + FloatSliderOptions& ShowButtons(bool showButtons_) { + showButtons = showButtons_; + return *this; + } + + FloatSliderOptions& Format(const char* format_) { + format = format_; + return *this; + } + + FloatSliderOptions& Step(float step_) { + step = step_; + return *this; + } + + FloatSliderOptions& Min(float min_) { + min = min_; + return *this; + } + + FloatSliderOptions& Max(float max_) { + max = max_; + return *this; + } + + FloatSliderOptions& DefaultValue(float defaultValue_) { + defaultValue = defaultValue_; + return *this; + } + + FloatSliderOptions& ComponentAlignment(ComponentAlignments alignment_) { + alignment = alignment_; + return *this; + } + + FloatSliderOptions& LabelPosition(LabelPositions labelPosition_) { + labelPosition = labelPosition_; + return *this; + } + + FloatSliderOptions& IsPercentage(bool isPercentage_ = true) { + isPercentage = isPercentage_; + format = "%.0f%%"; + min = 0.0f; + max = 1.0f; + return *this; + } + + FloatSliderOptions& Tooltip(std::string tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + FloatSliderOptions& Color(Colors color_) { + color = color_; + return *this; + } + + FloatSliderOptions& Size(ImVec2 size_) { + size = size_; + return *this; + } + + FloatSliderOptions& Clamp(bool clamp_) { + clamp = clamp_; + return *this; + } +}; + +struct BtnSelectorOptions : WidgetOptions { + s32 defaultValue = 0; + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Above; + Colors color = Colors::Gray; + + BtnSelectorOptions& DefaultValue(int32_t defaultValue_) { + defaultValue = defaultValue_; + return *this; + } + + BtnSelectorOptions& ComponentAlignment(ComponentAlignments alignment_) { + alignment = alignment_; + return *this; + } + + BtnSelectorOptions& LabelPosition(LabelPositions labelPosition_) { + labelPosition = labelPosition_; + return *this; + } + + BtnSelectorOptions& Tooltip(const char* tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + BtnSelectorOptions& Color(Colors color_) { + color = color_; + return *this; + } +}; + +struct RadioButtonsOptions : WidgetOptions { + std::map buttonMap; + int32_t defaultIndex = 0; + Colors color = Colors::LightBlue; + + RadioButtonsOptions& ButtonMap(std::map buttonMap_) { + buttonMap = buttonMap_; + return *this; + } + + RadioButtonsOptions& Tooltip(std::string tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + RadioButtonsOptions& Color(Colors color_) { + color = color_; + return *this; + } + + RadioButtonsOptions& DefaultIndex(int32_t defaultIndex_) { + defaultIndex = defaultIndex_; + return *this; + } +}; + +struct InputOptions : WidgetOptions { + ComponentAlignments alignment = ComponentAlignments::Left; + LabelPositions labelPosition = LabelPositions::Above; + Colors color = Colors::Gray; + ImVec2 size = { 0, 0 }; + std::string placeholder = ""; + InputTypes type = InputTypes::String; + std::string defaultValue = ""; + bool secret = false; + ImGuiInputFlags addedFlags = 0; + bool hasError = false; + std::string errorText = ""; + + InputOptions& Tooltip(std::string tooltip_) { + WidgetOptions::tooltip = tooltip_; + return *this; + } + + InputOptions& Color(Colors color_) { + color = color_; + return *this; + } + + InputOptions& Size(ImVec2 size_) { + size = size_; + return *this; + } + + InputOptions& LabelPosition(LabelPositions labelPosition_) { + labelPosition = labelPosition_; + return *this; + } + + InputOptions& PlaceholderText(std::string&& placeholder_) { + placeholder = std::move(placeholder_); + return *this; + } + + InputOptions& PlaceholderText(std::string& placeholder_) { + placeholder = placeholder_; + return *this; + } + + InputOptions& InputType(InputTypes type_) { + type = type_; + return *this; + } + + InputOptions& ComponentAlignment(ComponentAlignments alignment_) { + alignment = alignment_; + return *this; + } + + InputOptions& DefaultValue(std::string defaultValue_) { + defaultValue = defaultValue_; + return *this; + } + + InputOptions& IsSecret(bool secret_ = false) { + secret = secret_; + return *this; + } + + InputOptions& HasError(bool error_ = false) { + hasError = error_; + return *this; + } + + InputOptions& ErrorText(std::string errorText_) { + errorText = errorText_; + return *this; + } +}; +}; // namespace UIWidgets +#endif /* UIWidgetOptions_hpp */ diff --git a/soh/soh/SohGui/UIWidgets.cpp b/soh/soh/SohGui/UIWidgets.cpp index 4154fde36b..a96a21c6d3 100644 --- a/soh/soh/SohGui/UIWidgets.cpp +++ b/soh/soh/SohGui/UIWidgets.cpp @@ -1,7 +1,6 @@ #include "UIWidgets.hpp" #define IMGUI_DEFINE_MATH_OPERATORS #include -#include #include #include #include diff --git a/soh/soh/SohGui/UIWidgets.hpp b/soh/soh/SohGui/UIWidgets.hpp index f9902f97d8..02216466cb 100644 --- a/soh/soh/SohGui/UIWidgets.hpp +++ b/soh/soh/SohGui/UIWidgets.hpp @@ -1,14 +1,12 @@ #ifndef UIWidgets2_hpp #define UIWidgets2_hpp -#include -#include -#include -#include -#define IMGUI_DEFINE_MATH_OPERATORS -#include -#include -#include "soh/ShipUtils.h" +#include "UIWidgetOptions.hpp" + +#include +#include +#include +#include #include "soh/ShipInit.hpp" namespace UIWidgets { @@ -45,34 +43,6 @@ typedef enum ColorPickerModifiers { ColorPickerLockCheck = 8, } ColorPickerModifiers; -// mostly in order for colors usable by the menu without custom text color -enum Colors { - Red, - DarkRed, - Orange, - Green, - DarkGreen, - LightBlue, - Blue, - DarkBlue, - Indigo, - Violet, - Purple, - Brown, - Gray, - DarkGray, - // not suitable for menu theme use - Pink, - Yellow, - Cyan, - Black, - LightGray, - White, - NoColor -}; - -enum InputTypes { String, Scalar }; - const std::unordered_map ColorValues = { { Colors::Pink, ImVec4(0.87f, 0.3f, 0.87f, 1.0f) }, { Colors::Red, ImVec4(0.55f, 0.0f, 0.0f, 1.0f) }, { Colors::DarkRed, ImVec4(0.3f, 0.0f, 0.0f, 1.0f) }, { Colors::Orange, ImVec4(0.85f, 0.55f, 0.0f, 1.0f) }, @@ -87,553 +57,6 @@ const std::unordered_map ColorValues = { { Colors::NoColor, ImVec4(0.0f, 0.0f, 0.0f, 0.0f) }, }; -namespace Sizes { -const ImVec2 Inline = ImVec2(0.0f, 0.0f); -const ImVec2 Fill = ImVec2(-1.0f, 0.0f); -} // namespace Sizes - -enum LabelPositions { - Near, - Far, - Above, - None, - Within, -}; - -enum ComponentAlignments { - Left, - Right, -}; - -struct WidgetOptions { - std::string tooltip = ""; - bool disabled = false; - std::string disabledTooltip = ""; - - WidgetOptions& Tooltip(std::string tooltip_) { - tooltip = tooltip_; - return *this; - } - - WidgetOptions& Disabled(bool disabled_) { - disabled = disabled_; - return *this; - } - - WidgetOptions& DisabledTooltip(std::string disabledTooltip_) { - disabledTooltip = disabledTooltip_; - return *this; - } -}; - -struct TextOptions : WidgetOptions { - Colors color = Colors::NoColor; - - TextOptions& Color(Colors color_) { - color = color_; - return *this; - } -}; - -struct ButtonOptions : WidgetOptions { - ImVec2 size = Sizes::Fill; - ImVec2 padding = ImVec2(10.0f, 8.0f); - Colors color = Colors::Gray; - - ButtonOptions& Size(ImVec2 size_) { - size = size_; - return *this; - } - - ButtonOptions& Padding(ImVec2 padding_) { - padding = padding_; - return *this; - } - - ButtonOptions& Tooltip(std::string tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - ButtonOptions& Color(Colors color_) { - color = color_; - return *this; - } - ButtonOptions& DisabledTooltip(const char* disabledTooltip_) { - WidgetOptions::disabledTooltip = disabledTooltip_; - return *this; - } -}; - -struct ColorPickerOptions : WidgetOptions { - ImVec2 size = Sizes::Fill; - ImVec2 padding = ImVec2(10.0f, 8.0f); - Colors color = Colors::Gray; - Color_RGBA8 defaultValue = { 255, 255, 255, 255 }; - bool useAlpha, showReset, showRandom, showRainbow, showLock; - - ColorPickerOptions& Size(ImVec2 size_) { - size = size_; - return *this; - } - - ColorPickerOptions& Padding(ImVec2 padding_) { - padding = padding_; - return *this; - } - - ColorPickerOptions& Tooltip(std::string tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - ColorPickerOptions& ShowReset(bool showReset_ = true) { - showReset = showReset_; - return *this; - } - - ColorPickerOptions& ShowRandom(bool showRandom_ = true) { - showRandom = showRandom_; - return *this; - } - - ColorPickerOptions& ShowRainbow(bool showRainbow_ = true) { - showRainbow = showRainbow_; - return *this; - } - - ColorPickerOptions& ShowLock(bool showLock_ = true) { - showLock = showLock_; - return *this; - } - - ColorPickerOptions& UseAlpha(bool useAlpha_ = true) { - useAlpha = useAlpha_; - return *this; - } - - ColorPickerOptions& Color(Colors color_) { - color = color_; - return *this; - } - - ColorPickerOptions& DefaultValue(Color_RGBA8 defaultValue_) { - defaultValue = defaultValue_; - return *this; - } -}; - -struct WindowButtonOptions : WidgetOptions { - ImVec2 size = Sizes::Inline; - ImVec2 padding = ImVec2(10.0f, 8.0f); - Colors color = Colors::Gray; - bool showButton = true; - bool embedWindow = true; - - WindowButtonOptions& Size(ImVec2 size_) { - size = size_; - return *this; - } - - WindowButtonOptions& Padding(ImVec2 padding_) { - padding = padding_; - return *this; - } - - WindowButtonOptions& Tooltip(std::string tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - WindowButtonOptions& Color(Colors color_) { - color = color_; - return *this; - } - - WindowButtonOptions& ShowButton(bool showButton_) { - showButton = showButton_; - return *this; - } - - WindowButtonOptions& EmbedWindow(bool embedWindow_) { - embedWindow = embedWindow_; - return *this; - } -}; - -struct CheckboxOptions : WidgetOptions { - bool defaultValue = false; // Only applicable to CVarCheckbox - ComponentAlignments alignment = ComponentAlignments::Left; - LabelPositions labelPosition = LabelPositions::Near; - ImVec2 padding = ImVec2(10.0f, 8.0f); - Colors color = Colors::LightBlue; - - CheckboxOptions& DefaultValue(bool defaultValue_) { - defaultValue = defaultValue_; - return *this; - } - - CheckboxOptions& ComponentAlignment(ComponentAlignments alignment_) { - alignment = alignment_; - return *this; - } - - CheckboxOptions& LabelPosition(LabelPositions labelPosition_) { - labelPosition = labelPosition_; - return *this; - } - - CheckboxOptions& Tooltip(std::string tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - CheckboxOptions& Color(Colors color_) { - color = color_; - return *this; - } - - CheckboxOptions& DisabledTooltip(std::string disabledTooltip_) { - WidgetOptions::disabledTooltip = disabledTooltip_; - return *this; - } - - CheckboxOptions& Padding(ImVec2 padding_) { - padding = padding_; - return *this; - } -}; - -struct ComboboxOptions : WidgetOptions { - std::map comboMap = {}; - uint32_t defaultIndex = 0; // Only applicable to CVarCombobox - ComponentAlignments alignment = ComponentAlignments::Left; - LabelPositions labelPosition = LabelPositions::Above; - ImGuiComboFlags flags = 0; - Colors color = Colors::LightBlue; - - ComboboxOptions& ComboMap(std::map comboMap_) { - comboMap = comboMap_; - return *this; - } - - ComboboxOptions& DefaultIndex(uint32_t defaultIndex_) { - defaultIndex = defaultIndex_; - return *this; - } - - ComboboxOptions& ComponentAlignment(ComponentAlignments alignment_) { - alignment = alignment_; - return *this; - } - - ComboboxOptions& LabelPosition(LabelPositions labelPosition_) { - labelPosition = labelPosition_; - return *this; - } - - ComboboxOptions& Tooltip(std::string tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - ComboboxOptions& Color(Colors color_) { - color = color_; - return *this; - } -}; - -struct IntSliderOptions : WidgetOptions { - bool showButtons = true; - const char* format = "%d"; - int32_t step = 1; - int32_t min = 1; - int32_t max = 10; - int32_t defaultValue = 1; - bool clamp = true; - ComponentAlignments alignment = ComponentAlignments::Left; - LabelPositions labelPosition = LabelPositions::Above; - Colors color = Colors::Gray; - ImGuiSliderFlags flags = 0; - ImVec2 size = { 0, 0 }; - - IntSliderOptions& ShowButtons(bool showButtons_) { - showButtons = showButtons_; - return *this; - } - - IntSliderOptions& Format(const char* format_) { - format = format_; - return *this; - } - - IntSliderOptions& Step(int32_t step_) { - step = step_; - return *this; - } - - IntSliderOptions& Min(int32_t min_) { - min = min_; - return *this; - } - - IntSliderOptions& Max(int32_t max_) { - max = max_; - return *this; - } - - IntSliderOptions& DefaultValue(int32_t defaultValue_) { - defaultValue = defaultValue_; - return *this; - } - - IntSliderOptions& ComponentAlignment(ComponentAlignments alignment_) { - alignment = alignment_; - return *this; - } - - IntSliderOptions& LabelPosition(LabelPositions labelPosition_) { - labelPosition = labelPosition_; - return *this; - } - - IntSliderOptions& Tooltip(std::string tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - IntSliderOptions& Color(Colors color_) { - color = color_; - return *this; - } - - IntSliderOptions& Size(ImVec2 size_) { - size = size_; - return *this; - } - - IntSliderOptions& Clamp(bool clamp_) { - clamp = clamp_; - return *this; - } -}; - -struct FloatSliderOptions : WidgetOptions { - bool showButtons = true; - const char* format = "%f"; - float step = 0.01f; - float min = 0.01f; - float max = 10.0f; - float defaultValue = 1.0f; - bool clamp = true; - bool isPercentage = false; // Multiplies visual value by 100 - ComponentAlignments alignment = ComponentAlignments::Left; - LabelPositions labelPosition = LabelPositions::Above; - Colors color = Colors::Gray; - ImGuiSliderFlags flags = 0; - ImVec2 size = { 0, 0 }; - - FloatSliderOptions& ShowButtons(bool showButtons_) { - showButtons = showButtons_; - return *this; - } - - FloatSliderOptions& Format(const char* format_) { - format = format_; - return *this; - } - - FloatSliderOptions& Step(float step_) { - step = step_; - return *this; - } - - FloatSliderOptions& Min(float min_) { - min = min_; - return *this; - } - - FloatSliderOptions& Max(float max_) { - max = max_; - return *this; - } - - FloatSliderOptions& DefaultValue(float defaultValue_) { - defaultValue = defaultValue_; - return *this; - } - - FloatSliderOptions& ComponentAlignment(ComponentAlignments alignment_) { - alignment = alignment_; - return *this; - } - - FloatSliderOptions& LabelPosition(LabelPositions labelPosition_) { - labelPosition = labelPosition_; - return *this; - } - - FloatSliderOptions& IsPercentage(bool isPercentage_ = true) { - isPercentage = isPercentage_; - format = "%.0f%%"; - min = 0.0f; - max = 1.0f; - return *this; - } - - FloatSliderOptions& Tooltip(std::string tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - FloatSliderOptions& Color(Colors color_) { - color = color_; - return *this; - } - - FloatSliderOptions& Size(ImVec2 size_) { - size = size_; - return *this; - } - - FloatSliderOptions& Clamp(bool clamp_) { - clamp = clamp_; - return *this; - } -}; - -struct BtnSelectorOptions : WidgetOptions { - s32 defaultValue = 0; - ComponentAlignments alignment = ComponentAlignments::Left; - LabelPositions labelPosition = LabelPositions::Above; - Colors color = Colors::Gray; - - BtnSelectorOptions& DefaultValue(int32_t defaultValue_) { - defaultValue = defaultValue_; - return *this; - } - - BtnSelectorOptions& ComponentAlignment(ComponentAlignments alignment_) { - alignment = alignment_; - return *this; - } - - BtnSelectorOptions& LabelPosition(LabelPositions labelPosition_) { - labelPosition = labelPosition_; - return *this; - } - - BtnSelectorOptions& Tooltip(const char* tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - BtnSelectorOptions& Color(Colors color_) { - color = color_; - return *this; - } -}; - -struct RadioButtonsOptions : WidgetOptions { - std::map buttonMap; - int32_t defaultIndex = 0; - Colors color = Colors::LightBlue; - - RadioButtonsOptions& ButtonMap(std::map buttonMap_) { - buttonMap = buttonMap_; - return *this; - } - - RadioButtonsOptions& Tooltip(std::string tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - RadioButtonsOptions& Color(Colors color_) { - color = color_; - return *this; - } - - RadioButtonsOptions& DefaultIndex(int32_t defaultIndex_) { - defaultIndex = defaultIndex_; - return *this; - } -}; - -struct InputOptions : WidgetOptions { - ComponentAlignments alignment = ComponentAlignments::Left; - LabelPositions labelPosition = LabelPositions::Above; - Colors color = Colors::Gray; - ImVec2 size = { 0, 0 }; - std::string placeholder = ""; - InputTypes type = InputTypes::String; - std::string defaultValue = ""; - bool secret = false; - ImGuiInputFlags addedFlags = 0; - bool hasError = false; - std::string errorText = ""; - - InputOptions& Tooltip(std::string tooltip_) { - WidgetOptions::tooltip = tooltip_; - return *this; - } - - InputOptions& Color(Colors color_) { - color = color_; - return *this; - } - - InputOptions& Size(ImVec2 size_) { - size = size_; - return *this; - } - - InputOptions& LabelPosition(LabelPositions labelPosition_) { - labelPosition = labelPosition_; - return *this; - } - - InputOptions& PlaceholderText(std::string&& placeholder_) { - placeholder = std::move(placeholder_); - return *this; - } - - InputOptions& PlaceholderText(std::string& placeholder_) { - placeholder = placeholder_; - return *this; - } - - InputOptions& InputType(InputTypes type_) { - type = type_; - return *this; - } - - InputOptions& ComponentAlignment(ComponentAlignments alignment_) { - alignment = alignment_; - return *this; - } - - InputOptions& DefaultValue(std::string defaultValue_) { - defaultValue = defaultValue_; - return *this; - } - - InputOptions& IsSecret(bool secret_ = false) { - secret = secret_; - return *this; - } - - InputOptions& HasError(bool error_ = false) { - hasError = error_; - return *this; - } - - InputOptions& ErrorText(std::string errorText_) { - errorText = errorText_; - return *this; - } -}; - void PushStyleMenu(const ImVec4& color); void PushStyleMenu(Colors color = Colors::LightBlue); void PopStyleMenu(); diff --git a/soh/soh/config/ConfigUpdaters.cpp b/soh/soh/config/ConfigUpdaters.cpp index 8249bb48d3..b08fb7512e 100644 --- a/soh/soh/config/ConfigUpdaters.cpp +++ b/soh/soh/config/ConfigUpdaters.cpp @@ -1,5 +1,7 @@ #include "ConfigUpdaters.h" +#include + namespace SOH { struct Migration { const char* from; diff --git a/soh/soh/config/ConfigUpdaters.h b/soh/soh/config/ConfigUpdaters.h index c09ae499db..eba834af27 100644 --- a/soh/soh/config/ConfigUpdaters.h +++ b/soh/soh/config/ConfigUpdaters.h @@ -1,4 +1,4 @@ -#include "libultraship/libultraship.h" +#include namespace SOH { class ConfigVersion1Updater final : public Ship::ConfigVersionUpdater {