Preset Manager (#5459)

* Add presets sidebar, proof of concept row-based listing.

* Complete and unify section check/x drawing.

* Add error state to InputString, and corresponding members and builders to InputOptions.
Implement saving and loading of preset files.

* Implement `Config::SetBlock()`.
Implement Apply.
Implement Delete.
Some json structure changes.

* Apply `CVarClear()` calls in CVar-prefixed widget functions.

* Comment out satellite preset pickers for now.

* clang

* Fix ButtonOptions initializer list.

* I hate clang...

* Loop new preset checkbox creation.
Restore auto-resizing to new preset popup.
Remove errant BeginDisabled in randomizer (merge artifact?).

* Add BlockInfo struct to make array with all info for each block.
Setup loops for all other same-ish situations (applying presets, setting up columns, etc) based on blockInfo.

* Save tracker windows info for later restoration.
Lay the groundwork for said restoration.

* Complete tracker window restoration on preset application.

* Fix RadioButtonsOptions builder parameter type.
Add race lockout to new and apply buttons.

* Revert application of CVarClear on UIWidgets widgets (need to preserve manually-set default states).

* Remove enhancements satellite picker.
Swap randomizer satellite picker to use the manager presets, only displays presets with randomizer section included.
Move built-in presets to the asset archive, and remove delete button on them.
Remove PresetEntries.cpp.

* Fix locations and tricks tabs not updating live when applying preset with new system.

* Apply RandoGenerating lockout to rando preset Apply button.

* Fix new presets not being properly filtered in satellite selectors.

* Fix currently selected presets getting deleted still being selected in satellite selectors.

* Change BigPoeTargetCount in preset files to 1.
This commit is contained in:
Malkierian 2025-05-23 14:57:49 -07:00 committed by GitHub
parent 3a069e621e
commit 99c3fa6006
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 1114 additions and 889 deletions

View file

@ -91,6 +91,10 @@ bool previousShowHidden = false;
bool hideShopUnshuffledChecks = false;
bool alwaysShowGS = false;
static bool presetLoaded = false;
static ImVec2 presetPos;
static ImVec2 presetSize;
std::map<uint32_t, RandomizerCheck> startingShopItem = {
{ SCENE_KOKIRI_SHOP, RC_KF_SHOP_ITEM_1 },
{ SCENE_BAZAAR, RC_MARKET_BAZAAR_ITEM_1 },
@ -979,7 +983,13 @@ void CheckTrackerWindow::DrawElement() {
}
}
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
if (presetLoaded) {
ImGui::SetNextWindowSize(presetSize);
ImGui::SetNextWindowPos(presetPos);
presetLoaded = false;
} else {
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
}
BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar);
if (!GameInteractor::IsSaveLoaded() || !initialized) {
@ -2000,6 +2010,12 @@ void RecalculateAvailableChecks() {
GetPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS).count());
}
void CheckTracker_LoadFromPreset(nlohmann::json info) {
presetLoaded = true;
presetPos = { info["pos"]["x"], info["pos"]["y"] };
presetSize = { info["size"]["width"], info["size"]["height"] };
}
void CheckTrackerWindow::Draw() {
if (!IsVisible()) {
return;