Fix rando presets (#4491)

* Fix application of preset values to sliders.

* Add new rando CVars to preset list, and alphabetize.
This commit is contained in:
Malkierian 2024-10-28 08:25:26 -07:00 committed by GitHub
parent 2c08fca46c
commit fd8e98ed12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 94 additions and 52 deletions

View File

@ -74,6 +74,7 @@ void DrawPresetSelector(PresetType presetTypeId) {
applyPreset(selectedPresetDef.entries);
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Rando::Context::GetInstance()->GetSettings()->ReloadOptions();
}
ImGui::PopStyleVar(1);
}

View File

@ -378,6 +378,12 @@ const std::vector<const char*> cheatCvars = {
};
const std::vector<const char*> randomizerCvars = {
CVAR_RANDOMIZER_ENHANCEMENT("MatchKeyColors"),
CVAR_RANDOMIZER_ENHANCEMENT("QuestItemFanfares"),
CVAR_RANDOMIZER_ENHANCEMENT("RandoRelevantNavi"),
CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"),
CVAR_RANDOMIZER_ENHANCEMENT("RandomizeRupeeNames"),
CVAR_RANDOMIZER_SETTING("100GSHint"),
CVAR_RANDOMIZER_SETTING("10GSHint"),
CVAR_RANDOMIZER_SETTING("20GSHint"),
CVAR_RANDOMIZER_SETTING("30GSHint"),
@ -386,10 +392,13 @@ const std::vector<const char*> randomizerCvars = {
CVAR_RANDOMIZER_SETTING("AllLocationsReachable"),
CVAR_RANDOMIZER_SETTING("AltarHint"),
CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"),
CVAR_RANDOMIZER_SETTING("BigPoesHint"),
CVAR_RANDOMIZER_SETTING("BiggoronHint"),
CVAR_RANDOMIZER_SETTING("BlueFireArrows"),
CVAR_RANDOMIZER_SETTING("BombchusInLogic"),
CVAR_RANDOMIZER_SETTING("BossKeysanity"),
CVAR_RANDOMIZER_SETTING("BridgeRewardOptions"),
CVAR_RANDOMIZER_SETTING("ChickensHint"),
CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"),
CVAR_RANDOMIZER_SETTING("CuccosToReturn"),
CVAR_RANDOMIZER_SETTING("DampeHint"),
@ -398,24 +407,27 @@ const std::vector<const char*> randomizerCvars = {
CVAR_RANDOMIZER_SETTING("DungeonCount"),
CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"),
CVAR_RANDOMIZER_SETTING("EnableGlitchCutscenes"),
CVAR_RANDOMIZER_SETTING("EnabledGlitches"),
CVAR_RANDOMIZER_SETTING("EnabledTricks"),
CVAR_RANDOMIZER_SETTING("ExcludedLocations"),
CVAR_RANDOMIZER_SETTING("Forest"),
CVAR_RANDOMIZER_SETTING("FullWallets"),
CVAR_RANDOMIZER_SETTING("FishingPoleHint"),
CVAR_RANDOMIZER_SETTING("Fishsanity"),
CVAR_RANDOMIZER_SETTING("FishsanityPondCount"),
CVAR_RANDOMIZER_SETTING("FishsanityAgeSplit"),
CVAR_RANDOMIZER_SETTING("FishsanityPondCount"),
CVAR_RANDOMIZER_SETTING("Forest"),
CVAR_RANDOMIZER_SETTING("FrogsHint"),
CVAR_RANDOMIZER_SETTING("FullWallets"),
CVAR_RANDOMIZER_SETTING("GanonTrial"),
CVAR_RANDOMIZER_SETTING("GanonTrialCount"),
CVAR_RANDOMIZER_SETTING("GanondorfHint"),
CVAR_RANDOMIZER_SETTING("GerudoFortress"),
CVAR_RANDOMIZER_SETTING("GerudoKeys"),
CVAR_RANDOMIZER_SETTING("GossipStoneHints"),
CVAR_RANDOMIZER_SETTING("GregHint"),
CVAR_RANDOMIZER_SETTING("GsExpectSunsSong"),
CVAR_RANDOMIZER_SETTING("HBAHint"),
CVAR_RANDOMIZER_SETTING("HintClarity"),
CVAR_RANDOMIZER_SETTING("HintDistribution"),
CVAR_RANDOMIZER_SETTING("IceTraps"),
CVAR_RANDOMIZER_SETTING("IncludeTycoonWallet"),
CVAR_RANDOMIZER_SETTING("InfiniteUpgrades"),
CVAR_RANDOMIZER_SETTING("ItemPool"),
CVAR_RANDOMIZER_SETTING("KakarikoGate"),
CVAR_RANDOMIZER_SETTING("Keysanity"),
@ -425,36 +437,81 @@ const std::vector<const char*> randomizerCvars = {
CVAR_RANDOMIZER_SETTING("LacsRewardOptions"),
CVAR_RANDOMIZER_SETTING("LacsStoneCount"),
CVAR_RANDOMIZER_SETTING("LacsTokenCount"),
CVAR_RANDOMIZER_SETTING("GanondorfHint"),
CVAR_RANDOMIZER_SETTING("LAHint"),
CVAR_RANDOMIZER_SETTING("LinksPocket"),
CVAR_RANDOMIZER_SETTING("LoachHint"),
CVAR_RANDOMIZER_SETTING("LogicRules"),
CVAR_RANDOMIZER_SETTING("MQDungeonCount"),
CVAR_RANDOMIZER_SETTING("MQDungeons"),
CVAR_RANDOMIZER_SETTING("MQDungeonsBottomOfTheWell"),
CVAR_RANDOMIZER_SETTING("MQDungeonsDekuTree"),
CVAR_RANDOMIZER_SETTING("MQDungeonsDodongosCavern"),
CVAR_RANDOMIZER_SETTING("MQDungeonsFireTemple"),
CVAR_RANDOMIZER_SETTING("MQDungeonsForestTemple"),
CVAR_RANDOMIZER_SETTING("MQDungeonsGTG"),
CVAR_RANDOMIZER_SETTING("MQDungeonsGanonsCastle"),
CVAR_RANDOMIZER_SETTING("MQDungeonsIceCavern"),
CVAR_RANDOMIZER_SETTING("MQDungeonsJabuJabu"),
CVAR_RANDOMIZER_SETTING("MQDungeonsSelection"),
CVAR_RANDOMIZER_SETTING("MQDungeonsShadowTemple"),
CVAR_RANDOMIZER_SETTING("MQDungeonsSpiritTemple"),
CVAR_RANDOMIZER_SETTING("MQDungeonsWaterTemple"),
CVAR_RANDOMIZER_SETTING("MalonHint"),
CVAR_RANDOMIZER_SETTING("MaskShopHint"),
CVAR_RANDOMIZER_SETTING("MedallionCount"),
CVAR_RANDOMIZER_SETTING("MerchantAdultWalletWeight"),
CVAR_RANDOMIZER_SETTING("MerchantChildWalletWeight"),
CVAR_RANDOMIZER_SETTING("MerchantFixedPrice"),
CVAR_RANDOMIZER_SETTING("MerchantGiantWalletWeight"),
CVAR_RANDOMIZER_SETTING("MerchantNoWalletWeight"),
CVAR_RANDOMIZER_SETTING("MerchantPriceRange1"),
CVAR_RANDOMIZER_SETTING("MerchantPriceRange2"),
CVAR_RANDOMIZER_SETTING("MerchantPrices"),
CVAR_RANDOMIZER_SETTING("MerchantPricesAffordable"),
CVAR_RANDOMIZER_SETTING("MerchantText"),
CVAR_RANDOMIZER_SETTING("MerchantTycoonWalletWeight"),
CVAR_RANDOMIZER_SETTING("MixBosses"),
CVAR_RANDOMIZER_SETTING("MixDungeons"),
CVAR_RANDOMIZER_SETTING("MixedEntrances"),
CVAR_RANDOMIZER_SETTING("MixGrottos"),
CVAR_RANDOMIZER_SETTING("MixInteriors"),
CVAR_RANDOMIZER_SETTING("MixOverworld"),
CVAR_RANDOMIZER_SETTING("MQDungeonCount"),
CVAR_RANDOMIZER_SETTING("MQDungeons"),
CVAR_RANDOMIZER_SETTING("MixedEntrances"),
CVAR_RANDOMIZER_SETTING("OoTHint"),
CVAR_RANDOMIZER_SETTING("RainbowBridge"),
CVAR_RANDOMIZER_SETTING("RewardCount"),
CVAR_RANDOMIZER_SETTING("SariaHint"),
CVAR_RANDOMIZER_SETTING("ScrubText"),
CVAR_RANDOMIZER_SETTING("ScrubsAdultWalletWeight"),
CVAR_RANDOMIZER_SETTING("ScrubsChildWalletWeight"),
CVAR_RANDOMIZER_SETTING("ScrubsFixedPrice"),
CVAR_RANDOMIZER_SETTING("ScrubsGiantWalletWeight"),
CVAR_RANDOMIZER_SETTING("ScrubsNoWalletWeight"),
CVAR_RANDOMIZER_SETTING("ScrubsPriceRange1"),
CVAR_RANDOMIZER_SETTING("ScrubsPriceRange2"),
CVAR_RANDOMIZER_SETTING("ScrubsPrices"),
CVAR_RANDOMIZER_SETTING("ScrubsPricesAffordable"),
CVAR_RANDOMIZER_SETTING("ScrubsTycoonWalletWeight"),
CVAR_RANDOMIZER_SETTING("SheikLAHint"),
CVAR_RANDOMIZER_SETTING("Shopsanity"),
CVAR_RANDOMIZER_SETTING("ShopsanityAdultWalletWeight"),
CVAR_RANDOMIZER_SETTING("ShopsanityChildWalletWeight"),
CVAR_RANDOMIZER_SETTING("ShopsanityCount"),
CVAR_RANDOMIZER_SETTING("ShopsanityPrices"),
CVAR_RANDOMIZER_SETTING("ShopsanityFixedPrice"),
CVAR_RANDOMIZER_SETTING("ShopsanityGiantWalletWeight"),
CVAR_RANDOMIZER_SETTING("ShopsanityNoWalletWeight"),
CVAR_RANDOMIZER_SETTING("ShopsanityPriceRange1"),
CVAR_RANDOMIZER_SETTING("ShopsanityPriceRange2"),
CVAR_RANDOMIZER_SETTING("ShopsanityNoWalletWeight"),
CVAR_RANDOMIZER_SETTING("ShopsanityChildWalletWeight"),
CVAR_RANDOMIZER_SETTING("ShopsanityAdultWalletWeight"),
CVAR_RANDOMIZER_SETTING("ShopsanityGiantWalletWeight"),
CVAR_RANDOMIZER_SETTING("ShopsanityTycoonWalletWeight"),
CVAR_RANDOMIZER_SETTING("ShopsanityPrices"),
CVAR_RANDOMIZER_SETTING("ShopsanityPricesAffordable"),
CVAR_RANDOMIZER_SETTING("ShopsanityTycoonWalletWeight"),
CVAR_RANDOMIZER_SETTING("Shuffle100GSReward"),
CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"),
CVAR_RANDOMIZER_SETTING("ShuffleBeehives"),
CVAR_RANDOMIZER_SETTING("ShuffleBossEntrances"),
CVAR_RANDOMIZER_SETTING("ShuffleBossSouls"),
CVAR_RANDOMIZER_SETTING("ShuffleChildWallet"),
CVAR_RANDOMIZER_SETTING("ShuffleCows"),
CVAR_RANDOMIZER_SETTING("ShuffleDekuNutBag"),
CVAR_RANDOMIZER_SETTING("ShuffleDekuStickBag"),
CVAR_RANDOMIZER_SETTING("ShuffleDungeonReward"),
CVAR_RANDOMIZER_SETTING("ShuffleDungeonsEntrances"),
CVAR_RANDOMIZER_SETTING("ShuffleFishingPole"),
@ -467,54 +524,41 @@ const std::vector<const char*> randomizerCvars = {
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsBottomOfTheWell"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsFireTemple"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsForestTemple"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGTG"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGanonsCastle"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGerudoFortress"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGTG"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsRandomCount"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsShadowTemple"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsSpiritTemple"),
CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsWaterTemple"),
CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"),
CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"),
CVAR_RANDOMIZER_SETTING("ShuffleMerchants"),
CVAR_RANDOMIZER_SETTING("MerchantFixedPrice"),
CVAR_RANDOMIZER_SETTING("MerchantPriceRange1"),
CVAR_RANDOMIZER_SETTING("MerchantPriceRange2"),
CVAR_RANDOMIZER_SETTING("MerchantNoWalletWeight"),
CVAR_RANDOMIZER_SETTING("MerchantChildWalletWeight"),
CVAR_RANDOMIZER_SETTING("MerchantAdultWalletWeight"),
CVAR_RANDOMIZER_SETTING("MerchantGiantWalletWeight"),
CVAR_RANDOMIZER_SETTING("MerchantTycoonWalletWeight"),
CVAR_RANDOMIZER_SETTING("MerchantPricesAffordable"),
CVAR_RANDOMIZER_SETTING("ShuffleOcarinaButtons"),
CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"),
CVAR_RANDOMIZER_SETTING("ShuffleOverworldEntrances"),
CVAR_RANDOMIZER_SETTING("ShuffleOverworldSpawns"),
CVAR_RANDOMIZER_SETTING("ShuffleOwlDrops"),
CVAR_RANDOMIZER_SETTING("ShuffleScrubs"),
CVAR_RANDOMIZER_SETTING("ScrubsFixedPrice"),
CVAR_RANDOMIZER_SETTING("ScrubsPriceRange1"),
CVAR_RANDOMIZER_SETTING("ScrubsPriceRange2"),
CVAR_RANDOMIZER_SETTING("ScrubsNoWalletWeight"),
CVAR_RANDOMIZER_SETTING("ScrubsChildWalletWeight"),
CVAR_RANDOMIZER_SETTING("ScrubsAdultWalletWeight"),
CVAR_RANDOMIZER_SETTING("ScrubstGiantWalletWeight"),
CVAR_RANDOMIZER_SETTING("ScrubsTycoonWalletWeight"),
CVAR_RANDOMIZER_SETTING("ScrubsPricesAffordable"),
CVAR_RANDOMIZER_SETTING("ShuffleSongs"),
CVAR_RANDOMIZER_SETTING("ShuffleSwim"),
CVAR_RANDOMIZER_SETTING("ShuffleTokens"),
CVAR_RANDOMIZER_SETTING("ShuffleWarpSongs"),
CVAR_RANDOMIZER_SETTING("ShuffleWeirdEgg"),
CVAR_RANDOMIZER_SETTING("SkeletonKey"),
CVAR_RANDOMIZER_SETTING("SkipChildStealth"),
CVAR_RANDOMIZER_SETTING("SkipChildZelda"),
CVAR_RANDOMIZER_SETTING("SkipEponaRace"),
CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"),
CVAR_RANDOMIZER_SETTING("SkipTowerEscape"),
CVAR_RANDOMIZER_SETTING("StartingAge"),
CVAR_RANDOMIZER_SETTING("StartingConsumables"),
CVAR_RANDOMIZER_SETTING("StartingBoleroOfFire"),
CVAR_RANDOMIZER_SETTING("StartingConsumables"),
CVAR_RANDOMIZER_SETTING("StartingDekuShield"),
CVAR_RANDOMIZER_SETTING("StartingEponasSong"),
CVAR_RANDOMIZER_SETTING("StartingHearts"),
CVAR_RANDOMIZER_SETTING("StartingKokiriSword"),
CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"),
CVAR_RANDOMIZER_SETTING("StartingMasterSword"),
CVAR_RANDOMIZER_SETTING("StartingMinuetOfForest"),
CVAR_RANDOMIZER_SETTING("StartingNocturneOfShadow"),
CVAR_RANDOMIZER_SETTING("StartingOcarina"),
@ -530,21 +574,11 @@ const std::vector<const char*> randomizerCvars = {
CVAR_RANDOMIZER_SETTING("StoneCount"),
CVAR_RANDOMIZER_SETTING("SunlightArrows"),
CVAR_RANDOMIZER_SETTING("TokenCount"),
CVAR_RANDOMIZER_SETTING("TriforceHunt"),
CVAR_RANDOMIZER_SETTING("TriforceHuntRequiredPieces"),
CVAR_RANDOMIZER_SETTING("TriforceHuntTotalPieces"),
CVAR_RANDOMIZER_SETTING("WarpSongText"),
CVAR_RANDOMIZER_SETTING("ZorasFountain"),
CVAR_RANDOMIZER_SETTING("Shuffle100GSReward"),
CVAR_RANDOMIZER_SETTING("GregHint"),
CVAR_RANDOMIZER_SETTING("ManualSeedEntry"),
CVAR_RANDOMIZER_SETTING("TriforceHuntTotalPieces"),
CVAR_RANDOMIZER_SETTING("TriforceHuntRequiredPieces"),
CVAR_RANDOMIZER_SETTING("TriforceHunt"),
CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"),
CVAR_RANDOMIZER_SETTING("SariaHint"),
CVAR_RANDOMIZER_ENHANCEMENT("RandomizeRupeeNames"),
CVAR_RANDOMIZER_SETTING("FrogsHint"),
CVAR_RANDOMIZER_SETTING("OoTHint"),
CVAR_RANDOMIZER_ENHANCEMENT("RandoRelevantNavi"),
CVAR_RANDOMIZER_ENHANCEMENT("QuestItemFanfares"),
};
const std::vector<PresetEntry> vanillaPlusPresetEntries = {

View File

@ -302,7 +302,7 @@ void Settings::CreateOptions() {
mOptions[RSK_STARTING_NOCTURNE_OF_SHADOW] = Option::Bool("Start with Nocturne of Shadow", CVAR_RANDOMIZER_SETTING("StartingNocturneOfShadow"), "", IMFLAG_NONE);
mOptions[RSK_STARTING_PRELUDE_OF_LIGHT] = Option::Bool("Start with Prelude of Light", CVAR_RANDOMIZER_SETTING("StartingPreludeOfLight"));
mOptions[RSK_STARTING_SKULLTULA_TOKEN] = Option::U8("Gold Skulltula Tokens", {NumOpts(0, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("StartingSkulltulaToken"), "", WidgetType::Slider);
mOptions[RSK_STARTING_HEARTS] = Option::U8("Hearts", {NumOpts(1, 20)}, OptionCategory::Setting, "gRandomizeStartingHearts", "", WidgetType::Slider, 2);
mOptions[RSK_STARTING_HEARTS] = Option::U8("Hearts", {NumOpts(1, 20)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("StartingHearts"), "", WidgetType::Slider, 2);
// TODO: Remainder of Starting Items
mOptions[RSK_LOGIC_RULES] = Option::U8("Logic", {"Glitchless", "Glitched", "No Logic", "Vanilla"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LogicRules"), mOptionDescriptions[RSK_LOGIC_RULES], WidgetType::Combobox, RO_LOGIC_GLITCHLESS);
mOptions[RSK_ALL_LOCATIONS_REACHABLE] = Option::Bool("All Locations Reachable", {"Off", "On"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("AllLocationsReachable"), mOptionDescriptions[RSK_ALL_LOCATIONS_REACHABLE], WidgetType::Checkbox, RO_GENERIC_ON);
@ -3149,4 +3149,10 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) {
GetTrickOption(rt).SetSelectedIndex(RO_GENERIC_ON);
}
}
void Settings::ReloadOptions() {
for (int i = 0; i < RSK_MAX; i++) {
mOptions[i].SetFromCVar();
}
}
} // namespace Rando

View File

@ -180,6 +180,7 @@ class Settings {
void ParseJson(nlohmann::json spoilerFileJson);
std::vector<Option*> VanillaLogicDefaults = {};
std::map<RandomizerArea, std::vector<RandomizerTrick>> mTricksByArea = {};
void ReloadOptions();
private:
/**