Separate option values into context and menu indexes. (#4581)

* Separate option values into context and menu indexes.

* Fix option index reference in `CleanCheckConditionString`.

* Update soh/soh/Enhancements/randomizer/3drando/location_access.cpp

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>

* Restore `const` classification to functions returning `string&`.

* Restore `const` classification to getter functions.

* Restore a couple more `const`s; cleanup header.

* Final consts; rename `SetCVar` to `SaveCVar`.
This commit is contained in:
Malkierian 2024-11-29 17:58:30 -07:00 committed by GitHub
parent f7378a9f76
commit 55960da402
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 377 additions and 369 deletions

View File

@ -10,7 +10,7 @@ extern "C" {
#include "variables.h" #include "variables.h"
} }
#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetSelectedOptionIndex() #define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetContextOptionIndex()
static bool sEnteredBlueWarp = false; static bool sEnteredBlueWarp = false;

View File

@ -125,8 +125,8 @@ namespace Rando {
std::make_shared<KaleidoEntryIconCountRequired>( std::make_shared<KaleidoEntryIconCountRequired>(
gTriforcePieceTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, Color_RGBA8{ 255,255,255,255 }, 0, gTriforcePieceTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, Color_RGBA8{ 255,255,255,255 }, 0,
yOffset, reinterpret_cast<int*>(&gSaveContext.triforcePiecesCollected), yOffset, reinterpret_cast<int*>(&gSaveContext.triforcePiecesCollected),
ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_REQUIRED).GetSelectedOptionIndex() + 1, ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_REQUIRED).GetContextOptionIndex() + 1,
ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_TOTAL).GetSelectedOptionIndex() + 1)); ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_TOTAL).GetContextOptionIndex() + 1));
yOffset += 18; yOffset += 18;
} }
if (ctx->GetOption(RSK_SHUFFLE_OCARINA_BUTTONS)) { if (ctx->GetOption(RSK_SHUFFLE_OCARINA_BUTTONS)) {

View File

@ -238,10 +238,10 @@ static int GetMaxGSCount() {
int maxBridge = 0; int maxBridge = 0;
int maxLACS = 0; int maxLACS = 0;
if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS)) { if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS)) {
maxBridge = ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).Value<uint8_t>(); maxBridge = ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).GetContextOptionIndex();
} }
if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_TOKENS)) { if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_TOKENS)) {
maxLACS = ctx->GetOption(RSK_LACS_TOKEN_COUNT).Value<uint8_t>(); maxLACS = ctx->GetOption(RSK_LACS_TOKEN_COUNT).GetContextOptionIndex();
} }
maxBridge = std::max(maxBridge, maxLACS); maxBridge = std::max(maxBridge, maxLACS);
//Get the max amount of GS which could be useful from token reward locations //Get the max amount of GS which could be useful from token reward locations
@ -266,7 +266,7 @@ static int GetMaxGSCount() {
maxUseful = 10; maxUseful = 10;
} }
//Return max of the two possible reasons tokens could be important, minus the tokens in the starting inventory //Return max of the two possible reasons tokens could be important, minus the tokens in the starting inventory
return std::max(maxUseful, maxBridge) - ctx->GetOption(RSK_STARTING_SKULLTULA_TOKEN).Value<uint8_t>(); return std::max(maxUseful, maxBridge) - ctx->GetOption(RSK_STARTING_SKULLTULA_TOKEN).GetContextOptionIndex();
} }
std::string GetShopItemBaseName(std::string itemName) { std::string GetShopItemBaseName(std::string itemName) {

View File

@ -222,18 +222,18 @@ uint8_t StonesRequiredBySettings() {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
uint8_t stones = 0; uint8_t stones = 0;
if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_STONES)) { if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_STONES)) {
stones = ctx->GetOption(RSK_RAINBOW_BRIDGE_STONE_COUNT).Value<uint8_t>(); stones = ctx->GetOption(RSK_RAINBOW_BRIDGE_STONE_COUNT).GetContextOptionIndex();
} else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) { } else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) {
stones = ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).Value<uint8_t>() - 6; stones = ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).GetContextOptionIndex() - 6;
} else if ((ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS)) && (ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON))) { } else if ((ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS)) && (ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON))) {
stones = ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).Value<uint8_t>() - 6; stones = ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).GetContextOptionIndex() - 6;
} }
if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) { if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) {
stones = std::max<uint8_t>({ stones, ctx->GetOption(RSK_LACS_STONE_COUNT).Value<uint8_t>() }); stones = std::max<uint8_t>({ stones, ctx->GetOption(RSK_LACS_STONE_COUNT).GetContextOptionIndex() });
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) { } else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) {
stones = std::max<uint8_t>({ stones, (uint8_t)(ctx->GetOption(RSK_LACS_REWARD_COUNT).Value<uint8_t>() - 6 )}); stones = std::max<uint8_t>({ stones, (uint8_t)(ctx->GetOption(RSK_LACS_REWARD_COUNT).GetContextOptionIndex() - 6 )});
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS)) { } else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS)) {
stones = std::max<uint8_t>({ stones, (uint8_t)(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).Value<uint8_t>() - 6 )}); stones = std::max<uint8_t>({ stones, (uint8_t)(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).GetContextOptionIndex() - 6 )});
} }
return stones; return stones;
} }
@ -242,18 +242,18 @@ uint8_t MedallionsRequiredBySettings() {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
uint8_t medallions = 0; uint8_t medallions = 0;
if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_MEDALLIONS)) { if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_MEDALLIONS)) {
medallions = ctx->GetOption(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).Value<uint8_t>(); medallions = ctx->GetOption(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).GetContextOptionIndex();
} else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) { } else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) {
medallions = ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).Value<uint8_t>() - 3; medallions = ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).GetContextOptionIndex() - 3;
} else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS) && ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON)) { } else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS) && ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON)) {
medallions = ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).Value<uint8_t>() - 3; medallions = ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).GetContextOptionIndex() - 3;
} }
if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_MEDALLIONS)) { if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_MEDALLIONS)) {
medallions = std::max({ medallions, ctx->GetOption(RSK_LACS_MEDALLION_COUNT).Value<uint8_t>() }); medallions = std::max({ medallions, ctx->GetOption(RSK_LACS_MEDALLION_COUNT).GetContextOptionIndex() });
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_REWARDS)) { } else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_REWARDS)) {
medallions = std::max({ medallions, (uint8_t)(ctx->GetOption(RSK_LACS_REWARD_COUNT).Value<uint8_t>() - 3 )}); medallions = std::max({ medallions, (uint8_t)(ctx->GetOption(RSK_LACS_REWARD_COUNT).GetContextOptionIndex() - 3 )});
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS) && ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON)) { } else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS) && ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON)) {
medallions = std::max({ medallions, (uint8_t)(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).Value<uint8_t>() - 3 )}); medallions = std::max({ medallions, (uint8_t)(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).GetContextOptionIndex() - 3 )});
} }
return medallions; return medallions;
} }
@ -262,10 +262,10 @@ uint8_t TokensRequiredBySettings() {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
uint8_t tokens = 0; uint8_t tokens = 0;
if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS)) { if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS)) {
tokens = ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).Value<uint8_t>(); tokens = ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).GetContextOptionIndex();
} }
if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_TOKENS)) { if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_TOKENS)) {
tokens = std::max<uint8_t>({ tokens, ctx->GetOption(RSK_LACS_TOKEN_COUNT).Value<uint8_t>() }); tokens = std::max<uint8_t>({ tokens, ctx->GetOption(RSK_LACS_TOKEN_COUNT).GetContextOptionIndex() });
} }
return tokens; return tokens;
} }
@ -273,7 +273,7 @@ uint8_t TokensRequiredBySettings() {
std::vector<std::pair<RandomizerCheck, std::function<bool()>>> conditionalAlwaysHints = { std::vector<std::pair<RandomizerCheck, std::function<bool()>>> conditionalAlwaysHints = {
std::make_pair(RC_MARKET_10_BIG_POES, []() { std::make_pair(RC_MARKET_10_BIG_POES, []() {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
return ctx->GetOption(RSK_BIG_POE_COUNT).Value<uint8_t>() >= 3 && !ctx->GetOption(RSK_BIG_POES_HINT); return ctx->GetOption(RSK_BIG_POE_COUNT).GetContextOptionIndex() >= 3 && !ctx->GetOption(RSK_BIG_POES_HINT);
}), // Remember, the option's value being 3 means 4 are required }), // Remember, the option's value being 3 means 4 are required
std::make_pair(RC_DEKU_THEATER_MASK_OF_TRUTH, []() { std::make_pair(RC_DEKU_THEATER_MASK_OF_TRUTH, []() {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
@ -483,7 +483,7 @@ static void CreateTrialHints(uint8_t copies) {
AddGossipStoneHintCopies(copies, HINT_TYPE_HINT_KEY, "Trial", {RHT_ZERO_TRIALS}); AddGossipStoneHintCopies(copies, HINT_TYPE_HINT_KEY, "Trial", {RHT_ZERO_TRIALS});
} else { } else {
std::vector<TrialInfo*> trials = ctx->GetTrials()->GetTrialList(); //there's probably a way to remove this assignment std::vector<TrialInfo*> trials = ctx->GetTrials()->GetTrialList(); //there's probably a way to remove this assignment
if (ctx->GetOption(RSK_TRIAL_COUNT).Value<uint8_t>() >= 4) {//4 or 5 required trials, get skipped trials if (ctx->GetOption(RSK_TRIAL_COUNT).GetContextOptionIndex() >= 4) {//4 or 5 required trials, get skipped trials
trials = FilterFromPool(trials, [](TrialInfo* trial){return trial->IsSkipped();}); trials = FilterFromPool(trials, [](TrialInfo* trial){return trial->IsSkipped();});
} else {//1 to 3 trials, get requried trials } else {//1 to 3 trials, get requried trials
auto requiredTrials = FilterFromPool(trials, [](TrialInfo* trial){return trial->IsRequired();}); auto requiredTrials = FilterFromPool(trials, [](TrialInfo* trial){return trial->IsRequired();});
@ -611,7 +611,7 @@ uint8_t PlaceHints(std::vector<uint8_t>& selectedHints, std::vector<HintDistribu
void CreateStoneHints() { void CreateStoneHints() {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
SPDLOG_DEBUG("\nNOW CREATING HINTS\n"); SPDLOG_DEBUG("\nNOW CREATING HINTS\n");
const HintSetting& hintSetting = hintSettingTable[ctx->GetOption(RSK_HINT_DISTRIBUTION).Value<uint8_t>()]; const HintSetting& hintSetting = hintSettingTable[ctx->GetOption(RSK_HINT_DISTRIBUTION).GetContextOptionIndex()];
std::vector<HintDistributionSetting> distTable = hintSetting.distTable; std::vector<HintDistributionSetting> distTable = hintSetting.distTable;
// Apply impa's song exclusions when zelda is skipped // Apply impa's song exclusions when zelda is skipped

View File

@ -655,7 +655,7 @@ static void SetMinimalItemPool() {
ReplaceMaxItem(RG_PROGRESSIVE_BOMB_BAG, 1); ReplaceMaxItem(RG_PROGRESSIVE_BOMB_BAG, 1);
ReplaceMaxItem(RG_PIECE_OF_HEART, 0); ReplaceMaxItem(RG_PIECE_OF_HEART, 0);
// Need an extra heart container when starting with 1 heart to be able to reach 3 hearts // Need an extra heart container when starting with 1 heart to be able to reach 3 hearts
ReplaceMaxItem(RG_HEART_CONTAINER, (ctx->GetOption(RSK_STARTING_HEARTS).Value<uint8_t>() == 18)? 1 : 0); ReplaceMaxItem(RG_HEART_CONTAINER, (ctx->GetOption(RSK_STARTING_HEARTS).GetContextOptionIndex() == 18)? 1 : 0);
} }
void GenerateItemPool() { void GenerateItemPool() {
@ -721,7 +721,7 @@ void GenerateItemPool() {
if (ctx->GetOption(RSK_TRIFORCE_HUNT)) { if (ctx->GetOption(RSK_TRIFORCE_HUNT)) {
ctx->possibleIceTrapModels.push_back(RG_TRIFORCE_PIECE); ctx->possibleIceTrapModels.push_back(RG_TRIFORCE_PIECE);
AddItemToMainPool(RG_TRIFORCE_PIECE, (ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_TOTAL).Value<uint8_t>() + 1)); AddItemToMainPool(RG_TRIFORCE_PIECE, (ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_TOTAL).GetContextOptionIndex() + 1));
ctx->PlaceItemInLocation(RC_TRIFORCE_COMPLETED, RG_TRIFORCE); // Win condition ctx->PlaceItemInLocation(RC_TRIFORCE_COMPLETED, RG_TRIFORCE); // Win condition
ctx->PlaceItemInLocation(RC_GANON, GetJunkItem(), false, true); ctx->PlaceItemInLocation(RC_GANON, GetJunkItem(), false, true);
} else { } else {
@ -821,7 +821,7 @@ void GenerateItemPool() {
if (fsMode.IsNot(RO_FISHSANITY_OFF)) { if (fsMode.IsNot(RO_FISHSANITY_OFF)) {
if (fsMode.Is(RO_FISHSANITY_POND) || fsMode.Is(RO_FISHSANITY_BOTH)) { if (fsMode.Is(RO_FISHSANITY_POND) || fsMode.Is(RO_FISHSANITY_BOTH)) {
// 17 max child pond fish // 17 max child pond fish
uint8_t pondCt = ctx->GetOption(RSK_FISHSANITY_POND_COUNT).GetSelectedOptionIndex(); uint8_t pondCt = ctx->GetOption(RSK_FISHSANITY_POND_COUNT).GetContextOptionIndex();
for (uint8_t i = 0; i < pondCt; i++) { for (uint8_t i = 0; i < pondCt; i++) {
AddItemToMainPool(GetJunkItem()); AddItemToMainPool(GetJunkItem());
} }
@ -1348,7 +1348,7 @@ void GenerateItemPool() {
if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_KAK_TOKENS)) { if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_KAK_TOKENS)) {
ctx->PlaceItemInLocation(RC_KAK_100_GOLD_SKULLTULA_REWARD, RG_GANONS_CASTLE_BOSS_KEY); ctx->PlaceItemInLocation(RC_KAK_100_GOLD_SKULLTULA_REWARD, RG_GANONS_CASTLE_BOSS_KEY);
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Value<uint8_t>() >= RO_GANON_BOSS_KEY_LACS_VANILLA && ctx->GetOption(RSK_GANONS_BOSS_KEY).IsNot(RO_GANON_BOSS_KEY_TRIFORCE_HUNT)) { } else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).GetContextOptionIndex() >= RO_GANON_BOSS_KEY_LACS_VANILLA && ctx->GetOption(RSK_GANONS_BOSS_KEY).IsNot(RO_GANON_BOSS_KEY_TRIFORCE_HUNT)) {
ctx->PlaceItemInLocation(RC_TOT_LIGHT_ARROWS_CUTSCENE, RG_GANONS_CASTLE_BOSS_KEY); ctx->PlaceItemInLocation(RC_TOT_LIGHT_ARROWS_CUTSCENE, RG_GANONS_CASTLE_BOSS_KEY);
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_VANILLA)) { } else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_VANILLA)) {
ctx->PlaceItemInLocation(RC_GANONS_TOWER_BOSS_KEY_CHEST, RG_GANONS_CASTLE_BOSS_KEY); ctx->PlaceItemInLocation(RC_GANONS_TOWER_BOSS_KEY_CHEST, RG_GANONS_CASTLE_BOSS_KEY);

View File

@ -260,7 +260,7 @@ void RegionTable_Init() {
areaTable[RR_ROOT] = Region("Root", "", {RA_LINKS_POCKET}, NO_DAY_NIGHT_CYCLE, {}, { areaTable[RR_ROOT] = Region("Root", "", {RA_LINKS_POCKET}, NO_DAY_NIGHT_CYCLE, {}, {
//Locations //Locations
LOCATION(RC_LINKS_POCKET, true), LOCATION(RC_LINKS_POCKET, true),
LOCATION(RC_TRIFORCE_COMPLETED, logic->GetSaveContext()->triforcePiecesCollected >= ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_REQUIRED).Value<uint8_t>();), LOCATION(RC_TRIFORCE_COMPLETED, logic->GetSaveContext()->triforcePiecesCollected >= ctx->GetOption(RSK_TRIFORCE_HUNT_PIECES_REQUIRED).GetContextOptionIndex();),
LOCATION(RC_SARIA_SONG_HINT, logic->CanUse(RG_SARIAS_SONG)), LOCATION(RC_SARIA_SONG_HINT, logic->CanUse(RG_SARIAS_SONG)),
}, { }, {
//Exits //Exits
@ -395,7 +395,7 @@ void ReplaceAllInString(std::string& s, std::string const& toReplace, std::strin
std::string CleanCheckConditionString(std::string condition) { std::string CleanCheckConditionString(std::string condition) {
ReplaceAllInString(condition, "logic->", ""); ReplaceAllInString(condition, "logic->", "");
ReplaceAllInString(condition, "ctx->", ""); ReplaceAllInString(condition, "ctx->", "");
ReplaceAllInString(condition, ".Value<uint8_t>()", ""); ReplaceAllInString(condition, ".GetContextOptionIndex()", "");
ReplaceAllInString(condition, "GetSaveContext()->", ""); ReplaceAllInString(condition, "GetSaveContext()->", "");
return condition; return condition;
} }

View File

@ -156,7 +156,7 @@ int GetPriceFromMax(int max) {
uint16_t GetPriceFromSettings(Rando::Location *loc, PriceSettingsStruct priceSettings) { uint16_t GetPriceFromSettings(Rando::Location *loc, PriceSettingsStruct priceSettings) {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
switch (ctx->GetOption(priceSettings.main).Value<uint8_t>()){ switch (ctx->GetOption(priceSettings.main).GetContextOptionIndex()){
case RO_PRICE_VANILLA: case RO_PRICE_VANILLA:
return loc->GetVanillaPrice(); return loc->GetVanillaPrice();
case RO_PRICE_CHEAP_BALANCED: case RO_PRICE_CHEAP_BALANCED:
@ -172,19 +172,19 @@ uint16_t GetPriceFromSettings(Rando::Location *loc, PriceSettingsStruct priceSet
return 150; return 150;
} }
case RO_PRICE_FIXED: case RO_PRICE_FIXED:
return (uint16_t)ctx->GetOption(priceSettings.fixedPrice).Value<uint8_t>() * 5; return (uint16_t)ctx->GetOption(priceSettings.fixedPrice).GetContextOptionIndex() * 5;
case RO_PRICE_RANGE:{ case RO_PRICE_RANGE:{
uint16_t range1 = (uint16_t)ctx->GetOption(priceSettings.range1).Value<uint8_t>() * 5; uint16_t range1 = (uint16_t)ctx->GetOption(priceSettings.range1).GetContextOptionIndex() * 5;
uint16_t range2 = (uint16_t)ctx->GetOption(priceSettings.range2).Value<uint8_t>() * 5; uint16_t range2 = (uint16_t)ctx->GetOption(priceSettings.range2).GetContextOptionIndex() * 5;
return range1 < range2 ? Random(range1, range2+1) : Random(range2, range1+1); return range1 < range2 ? Random(range1, range2+1) : Random(range2, range1+1);
} }
case RO_PRICE_SET_BY_WALLET:{ case RO_PRICE_SET_BY_WALLET:{
bool isTycoon = ctx->GetOption(RSK_INCLUDE_TYCOON_WALLET).Value<bool>(); bool isTycoon = ctx->GetOption(RSK_INCLUDE_TYCOON_WALLET).GetContextOptionIndex();
uint16_t noWeight = ctx->GetOption(priceSettings.noWallet).Value<uint8_t>(); uint16_t noWeight = ctx->GetOption(priceSettings.noWallet).GetContextOptionIndex();
uint16_t childWeight = ctx->GetOption(priceSettings.childWallet).Value<uint8_t>(); uint16_t childWeight = ctx->GetOption(priceSettings.childWallet).GetContextOptionIndex();
uint16_t adultWeight = ctx->GetOption(priceSettings.adultWallet).Value<uint8_t>(); uint16_t adultWeight = ctx->GetOption(priceSettings.adultWallet).GetContextOptionIndex();
uint16_t giantWeight = ctx->GetOption(priceSettings.giantWallet).Value<uint8_t>(); uint16_t giantWeight = ctx->GetOption(priceSettings.giantWallet).GetContextOptionIndex();
uint16_t tycoonWeight = isTycoon ? ctx->GetOption(priceSettings.tycoonWallet).Value<uint8_t>() : 0; uint16_t tycoonWeight = isTycoon ? ctx->GetOption(priceSettings.tycoonWallet).GetContextOptionIndex() : 0;
uint16_t totalWeight = noWeight + childWeight + adultWeight + giantWeight + tycoonWeight; uint16_t totalWeight = noWeight + childWeight + adultWeight + giantWeight + tycoonWeight;
if (totalWeight == 0){ //if no weight, return from sane range if (totalWeight == 0){ //if no weight, return from sane range
return Random(0, 501); return Random(0, 501);

View File

@ -176,7 +176,7 @@ static void WriteSettings() {
auto allOptionGroups = ctx->GetSettings()->GetOptionGroups(); auto allOptionGroups = ctx->GetSettings()->GetOptionGroups();
for (const Rando::OptionGroup& optionGroup : allOptionGroups) { for (const Rando::OptionGroup& optionGroup : allOptionGroups) {
if (optionGroup.GetContainsType() == Rando::OptionGroupType::DEFAULT && optionGroup.PrintInSpoiler()) { if (optionGroup.GetContainsType() == Rando::OptionGroupType::DEFAULT && optionGroup.PrintInSpoiler()) {
for (const Rando::Option* option : optionGroup.GetOptions()) { for (Rando::Option* option : optionGroup.GetOptions()) {
std::string settingName = optionGroup.GetName() + ":" + option->GetName(); std::string settingName = optionGroup.GetName() + ":" + option->GetName();
jsonData["settings"][settingName] = option->GetSelectedOptionText(); jsonData["settings"][settingName] = option->GetSelectedOptionText();
} }
@ -191,7 +191,7 @@ static void WriteExcludedLocations() {
for (size_t i = 1; i < ctx->GetSettings()->GetExcludeLocationsOptions().size(); i++) { for (size_t i = 1; i < ctx->GetSettings()->GetExcludeLocationsOptions().size(); i++) {
for (const auto& location : ctx->GetSettings()->GetExcludeLocationsOptions()[i]) { for (const auto& location : ctx->GetSettings()->GetExcludeLocationsOptions()[i]) {
if (location->GetSelectedOptionIndex() == RO_LOCATION_INCLUDE) { if (location->GetContextOptionIndex() == RO_LOCATION_INCLUDE) {
continue; continue;
} }
@ -214,7 +214,7 @@ static void WriteStartingInventory() {
const Rando::OptionGroup& optionGroup = ctx->GetSettings()->GetOptionGroup(RSG_STARTING_INVENTORY); const Rando::OptionGroup& optionGroup = ctx->GetSettings()->GetOptionGroup(RSG_STARTING_INVENTORY);
for (const Rando::OptionGroup* subGroup : optionGroup.GetSubGroups()) { for (const Rando::OptionGroup* subGroup : optionGroup.GetSubGroups()) {
if (subGroup->GetContainsType() == Rando::OptionGroupType::DEFAULT) { if (subGroup->GetContainsType() == Rando::OptionGroupType::DEFAULT) {
for (const Rando::Option* option : subGroup->GetOptions()) { for (Rando::Option* option : subGroup->GetOptions()) {
jsonData["settings"][option->GetName()] = option->GetSelectedOptionText(); jsonData["settings"][option->GetName()] = option->GetSelectedOptionText();
} }
} }
@ -227,7 +227,7 @@ static void WriteEnabledTricks(tinyxml2::XMLDocument& spoilerLog) {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
for (const auto& setting : ctx->GetSettings()->GetOptionGroup(RSG_TRICKS).GetOptions()) { for (const auto& setting : ctx->GetSettings()->GetOptionGroup(RSG_TRICKS).GetOptions()) {
if (setting->GetSelectedOptionIndex() != RO_GENERIC_ON/* || !setting->IsCategory(OptionCategory::Setting)*/) { if (setting->GetContextOptionIndex() != RO_GENERIC_ON/* || !setting->IsCategory(OptionCategory::Setting)*/) {
continue; continue;
} }
jsonData["enabledTricks"].push_back(RemoveLineBreaks(setting->GetName()).c_str()); jsonData["enabledTricks"].push_back(RemoveLineBreaks(setting->GetName()).c_str());

View File

@ -112,7 +112,7 @@ void GenerateStartingInventory() {
// AddItemToInventory(RG_EMPTY_BOTTLE, 1); // AddItemToInventory(RG_EMPTY_BOTTLE, 1);
// } // }
// AddItemToInventory(RG_RUTOS_LETTER, StartingRutoBottle.Value<uint8_t>()); // AddItemToInventory(RG_RUTOS_LETTER, StartingRutoBottle.Value<uint8_t>());
AddItemToInventory(RG_PROGRESSIVE_OCARINA, ctx->GetOption(RSK_STARTING_OCARINA).Value<uint8_t>()); AddItemToInventory(RG_PROGRESSIVE_OCARINA, ctx->GetOption(RSK_STARTING_OCARINA).GetContextOptionIndex());
AddItemToInventory(RG_ZELDAS_LULLABY, ctx->GetOption(RSK_STARTING_ZELDAS_LULLABY) ? 1 : 0); AddItemToInventory(RG_ZELDAS_LULLABY, ctx->GetOption(RSK_STARTING_ZELDAS_LULLABY) ? 1 : 0);
AddItemToInventory(RG_EPONAS_SONG, ctx->GetOption(RSK_STARTING_EPONAS_SONG) ? 1 : 0); AddItemToInventory(RG_EPONAS_SONG, ctx->GetOption(RSK_STARTING_EPONAS_SONG) ? 1 : 0);
AddItemToInventory(RG_SARIAS_SONG, ctx->GetOption(RSK_STARTING_SARIAS_SONG) ? 1 : 0); AddItemToInventory(RG_SARIAS_SONG, ctx->GetOption(RSK_STARTING_SARIAS_SONG) ? 1 : 0);
@ -153,21 +153,21 @@ void GenerateStartingInventory() {
// AddItemToInventory(RG_SPIRIT_MEDALLION, StartingSpiritMedallion.Value<uint8_t>()); // AddItemToInventory(RG_SPIRIT_MEDALLION, StartingSpiritMedallion.Value<uint8_t>());
// AddItemToInventory(RG_SHADOW_MEDALLION, StartingShadowMedallion.Value<uint8_t>()); // AddItemToInventory(RG_SHADOW_MEDALLION, StartingShadowMedallion.Value<uint8_t>());
// AddItemToInventory(RG_LIGHT_MEDALLION, StartingLightMedallion.Value<uint8_t>()); // AddItemToInventory(RG_LIGHT_MEDALLION, StartingLightMedallion.Value<uint8_t>());
AddItemToInventory(RG_GOLD_SKULLTULA_TOKEN, ctx->GetOption(RSK_STARTING_SKULLTULA_TOKEN).Value<uint8_t>()); AddItemToInventory(RG_GOLD_SKULLTULA_TOKEN, ctx->GetOption(RSK_STARTING_SKULLTULA_TOKEN).GetContextOptionIndex());
int8_t hearts = ctx->GetOption(RSK_STARTING_HEARTS).Value<uint8_t>() - 2; int8_t hearts = ctx->GetOption(RSK_STARTING_HEARTS).GetContextOptionIndex() - 2;
AdditionalHeartContainers = 0; AdditionalHeartContainers = 0;
if (hearts < 0) { if (hearts < 0) {
AddItemToInventory(RG_PIECE_OF_HEART, 4); AddItemToInventory(RG_PIECE_OF_HEART, 4);
// Plentiful and minimal have less than 4 standard pieces of heart so also replace the winner heart // Plentiful and minimal have less than 4 standard pieces of heart so also replace the winner heart
if (ctx->GetOption(RSK_ITEM_POOL).Value<uint8_t>() == 0 || ctx->GetOption(RSK_ITEM_POOL).Value<uint8_t>() == 3) { if (ctx->GetOption(RSK_ITEM_POOL).GetContextOptionIndex() == 0 || ctx->GetOption(RSK_ITEM_POOL).GetContextOptionIndex() == 3) {
AddItemToInventory(RG_TREASURE_GAME_HEART); AddItemToInventory(RG_TREASURE_GAME_HEART);
} }
AdditionalHeartContainers = 1 - hearts; AdditionalHeartContainers = 1 - hearts;
} else if (hearts > 0) { } else if (hearts > 0) {
// 16 containers in plentiful, 8 in balanced and 0 in the others // 16 containers in plentiful, 8 in balanced and 0 in the others
uint8_t maxContainers = 8 * std::max(0, 2 - ctx->GetOption(RSK_ITEM_POOL).Value<uint8_t>()); uint8_t maxContainers = 8 * std::max(0, 2 - ctx->GetOption(RSK_ITEM_POOL).GetContextOptionIndex());
if (hearts <= maxContainers) { if (hearts <= maxContainers) {
AddItemToInventory(RG_HEART_CONTAINER, hearts); AddItemToInventory(RG_HEART_CONTAINER, hearts);

View File

@ -1333,12 +1333,12 @@ int EntranceShuffler::ShuffleAllEntrances() {
(ctx->GetOption(RSK_MIX_OVERWORLD_ENTRANCES) ? 1 : 0) + (ctx->GetOption(RSK_MIX_INTERIOR_ENTRANCES) ? 1 : 0) + (ctx->GetOption(RSK_MIX_OVERWORLD_ENTRANCES) ? 1 : 0) + (ctx->GetOption(RSK_MIX_INTERIOR_ENTRANCES) ? 1 : 0) +
(ctx->GetOption(RSK_MIX_GROTTO_ENTRANCES) ? 1 : 0); (ctx->GetOption(RSK_MIX_GROTTO_ENTRANCES) ? 1 : 0);
if (totalMixedPools < 2) { if (totalMixedPools < 2) {
ctx->GetOption(RSK_MIXED_ENTRANCE_POOLS).SetSelectedIndex(RO_GENERIC_OFF); ctx->GetOption(RSK_MIXED_ENTRANCE_POOLS).SetContextIndex(RO_GENERIC_OFF);
ctx->GetOption(RSK_MIX_DUNGEON_ENTRANCES).SetSelectedIndex(RO_GENERIC_OFF); ctx->GetOption(RSK_MIX_DUNGEON_ENTRANCES).SetContextIndex(RO_GENERIC_OFF);
ctx->GetOption(RSK_MIX_BOSS_ENTRANCES).SetSelectedIndex(RO_GENERIC_OFF); ctx->GetOption(RSK_MIX_BOSS_ENTRANCES).SetContextIndex(RO_GENERIC_OFF);
ctx->GetOption(RSK_MIX_OVERWORLD_ENTRANCES).SetSelectedIndex(RO_GENERIC_OFF); ctx->GetOption(RSK_MIX_OVERWORLD_ENTRANCES).SetContextIndex(RO_GENERIC_OFF);
ctx->GetOption(RSK_MIX_INTERIOR_ENTRANCES).SetSelectedIndex(RO_GENERIC_OFF); ctx->GetOption(RSK_MIX_INTERIOR_ENTRANCES).SetContextIndex(RO_GENERIC_OFF);
ctx->GetOption(RSK_MIX_GROTTO_ENTRANCES).SetSelectedIndex(RO_GENERIC_OFF); ctx->GetOption(RSK_MIX_GROTTO_ENTRANCES).SetContextIndex(RO_GENERIC_OFF);
} }
if (ctx->GetOption(RSK_MIXED_ENTRANCE_POOLS)) { if (ctx->GetOption(RSK_MIXED_ENTRANCE_POOLS)) {
std::set<EntranceType> poolsToMix = {}; std::set<EntranceType> poolsToMix = {};

View File

@ -17,7 +17,7 @@ extern PlayState* gPlayState;
#define FSi OTRGlobals::Instance->gRandoContext->GetFishsanity() #define FSi OTRGlobals::Instance->gRandoContext->GetFishsanity()
#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetSelectedOptionIndex() #define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetContextOptionIndex()
/** /**
* @brief Parallel list of pond fish checks for both ages * @brief Parallel list of pond fish checks for both ages

View File

@ -559,23 +559,23 @@ CustomMessage Hint::GetBridgeReqsText() {
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_STONES)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_STONES)) {
bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_STONES_HINT].GetHintMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_STONES_HINT].GetHintMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_STONE_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_STONE_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_MEDALLIONS)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_MEDALLIONS)) {
bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_MEDALLIONS_HINT].GetHintMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_MEDALLIONS_HINT].GetHintMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) {
bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_REWARDS_HINT].GetHintMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_REWARDS_HINT].GetHintMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS)) {
bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_DUNGEONS_HINT].GetHintMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_DUNGEONS_HINT].GetHintMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS)) {
bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_TOKENS_HINT].GetHintMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_TOKENS_HINT].GetHintMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_GREG)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_GREG)) {
return StaticData::hintTextTable[RHT_BRIDGE_GREG_HINT].GetHintMessage(); return StaticData::hintTextTable[RHT_BRIDGE_GREG_HINT].GetHintMessage();
@ -613,23 +613,23 @@ CustomMessage Hint::GetGanonBossKeyText() {
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) {
ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_STONES_HINT].GetHintMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_STONES_HINT].GetHintMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_STONE_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_STONE_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_MEDALLIONS)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_MEDALLIONS)) {
ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_MEDALLIONS_HINT].GetHintMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_MEDALLIONS_HINT].GetHintMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_MEDALLION_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_MEDALLION_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_REWARDS)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_REWARDS)) {
ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_REWARDS_HINT].GetHintMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_REWARDS_HINT].GetHintMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_REWARD_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_REWARD_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS)) {
ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_DUNGEONS_HINT].GetHintMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_DUNGEONS_HINT].GetHintMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_TOKENS)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_TOKENS)) {
ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_TOKENS_HINT].GetHintMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_TOKENS_HINT].GetHintMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_TOKEN_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_TOKEN_COUNT).GetContextOptionIndex());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_TRIFORCE_HUNT)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_TRIFORCE_HUNT)) {
return StaticData::hintTextTable[RHT_GANON_BK_TRIFORCE_HINT].GetHintMessage(); return StaticData::hintTextTable[RHT_GANON_BK_TRIFORCE_HINT].GetHintMessage();

View File

@ -62,7 +62,7 @@ extern s32 Player_SetupWaitForPutAway(PlayState* play, Player* player, AfterPutA
extern void Play_InitEnvironment(PlayState * play, s16 skyboxId); extern void Play_InitEnvironment(PlayState * play, s16 skyboxId);
} }
#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetSelectedOptionIndex() #define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetContextOptionIndex()
bool LocMatchesQuest(Rando::Location loc) { bool LocMatchesQuest(Rando::Location loc) {
if (loc.GetQuest() == RCQUEST_BOTH) { if (loc.GetQuest() == RCQUEST_BOTH) {

View File

@ -176,8 +176,8 @@ void ItemLocation::SetHidden(const bool hidden_) {
hidden = hidden_; hidden = hidden_;
} }
bool ItemLocation::IsExcluded() const { bool ItemLocation::IsExcluded() {
return excludedOption.Value<bool>(); return excludedOption.GetContextOptionIndex();
} }
Option* ItemLocation::GetExcludedOption() { Option* ItemLocation::GetExcludedOption() {
@ -197,7 +197,7 @@ void ItemLocation::AddExcludeOption() {
// RANDOTODO: this without string compares and loops // RANDOTODO: this without string compares and loops
bool alreadyAdded = false; bool alreadyAdded = false;
const Location* loc = StaticData::GetLocation(rc); const Location* loc = StaticData::GetLocation(rc);
for (const Option* location : Context::GetInstance()->GetSettings()->GetExcludeOptionsForArea(loc->GetArea())) { for (Option* location : Context::GetInstance()->GetSettings()->GetExcludeOptionsForArea(loc->GetArea())) {
if (location->GetName() == excludedOption.GetName()) { if (location->GetName() == excludedOption.GetName()) {
alreadyAdded = true; alreadyAdded = true;
} }

View File

@ -45,7 +45,7 @@ class ItemLocation {
const std::vector<RandomizerHint>& GetHintedBy() const; const std::vector<RandomizerHint>& GetHintedBy() const;
void AddHintedBy(RandomizerHint hintKey); void AddHintedBy(RandomizerHint hintKey);
bool IsHidden() const; bool IsHidden() const;
bool IsExcluded() const; bool IsExcluded();
void AddExcludeOption(); void AddExcludeOption();
Option* GetExcludedOption(); Option* GetExcludedOption();
void SetHidden(bool hidden_); void SetHidden(bool hidden_);

View File

@ -974,7 +974,7 @@ namespace Rando {
10 for OHKO. 10 for OHKO.
This is the number of shifts to apply, not a real multiplier This is the number of shifts to apply, not a real multiplier
*/ */
uint8_t Multiplier = (ctx->GetOption(RSK_DAMAGE_MULTIPLIER).Value<uint8_t>() < 6) ? ctx->GetOption(RSK_DAMAGE_MULTIPLIER).Value<uint8_t>() : 10; uint8_t Multiplier = (ctx->GetOption(RSK_DAMAGE_MULTIPLIER).GetContextOptionIndex() < 6) ? ctx->GetOption(RSK_DAMAGE_MULTIPLIER).GetContextOptionIndex() : 10;
//(Hearts() << (2 + HasItem(RG_DOUBLE_DEFENSE))) is quarter hearts after DD //(Hearts() << (2 + HasItem(RG_DOUBLE_DEFENSE))) is quarter hearts after DD
//>> Multiplier halves on normal and does nothing on half, meaning we're working with half hearts on normal damage //>> Multiplier halves on normal and does nothing on half, meaning we're working with half hearts on normal damage
return ((Hearts() << (2 + HasItem(RG_DOUBLE_DEFENSE))) >> Multiplier) + return ((Hearts() << (2 + HasItem(RG_DOUBLE_DEFENSE))) >> Multiplier) +
@ -1103,21 +1103,21 @@ namespace Rando {
bool Logic::CanBuildRainbowBridge(){ bool Logic::CanBuildRainbowBridge(){
return ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_ALWAYS_OPEN) || return ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_ALWAYS_OPEN) ||
(ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_VANILLA) && HasItem(RG_SHADOW_MEDALLION) && HasItem(RG_SPIRIT_MEDALLION) && CanUse(RG_LIGHT_ARROWS)) || (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_VANILLA) && HasItem(RG_SHADOW_MEDALLION) && HasItem(RG_SPIRIT_MEDALLION) && CanUse(RG_LIGHT_ARROWS)) ||
(ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_STONES) && StoneCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_BRIDGE_OPTIONS).Is(RO_BRIDGE_GREG_REWARD)) >= ctx->GetOption(RSK_RAINBOW_BRIDGE_STONE_COUNT).Value<uint8_t>()) || (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_STONES) && StoneCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_BRIDGE_OPTIONS).Is(RO_BRIDGE_GREG_REWARD)) >= ctx->GetOption(RSK_RAINBOW_BRIDGE_STONE_COUNT).GetContextOptionIndex()) ||
(ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_MEDALLIONS) && MedallionCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_BRIDGE_OPTIONS).Is(RO_BRIDGE_GREG_REWARD)) >= ctx->GetOption(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).Value<uint8_t>()) || (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_MEDALLIONS) && MedallionCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_BRIDGE_OPTIONS).Is(RO_BRIDGE_GREG_REWARD)) >= ctx->GetOption(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).GetContextOptionIndex()) ||
(ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS) && StoneCount() + MedallionCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_BRIDGE_OPTIONS).Is(RO_BRIDGE_GREG_REWARD)) >= ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).Value<uint8_t>()) || (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS) && StoneCount() + MedallionCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_BRIDGE_OPTIONS).Is(RO_BRIDGE_GREG_REWARD)) >= ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).GetContextOptionIndex()) ||
(ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS) && DungeonCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_BRIDGE_OPTIONS).Is(RO_BRIDGE_GREG_REWARD)) >= ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).Value<uint8_t>()) || (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS) && DungeonCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_BRIDGE_OPTIONS).Is(RO_BRIDGE_GREG_REWARD)) >= ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).GetContextOptionIndex()) ||
(ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS) && GetGSCount() >= ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).Value<uint8_t>()) || (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS) && GetGSCount() >= ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).GetContextOptionIndex()) ||
(ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_GREG) && HasItem(RG_GREG_RUPEE)); (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_GREG) && HasItem(RG_GREG_RUPEE));
} }
bool Logic::CanTriggerLACS(){ bool Logic::CanTriggerLACS(){
return (ctx->GetSettings()->LACSCondition() == RO_LACS_VANILLA && HasItem(RG_SHADOW_MEDALLION) && HasItem(RG_SPIRIT_MEDALLION)) || return (ctx->GetSettings()->LACSCondition() == RO_LACS_VANILLA && HasItem(RG_SHADOW_MEDALLION) && HasItem(RG_SPIRIT_MEDALLION)) ||
(ctx->GetSettings()->LACSCondition() == RO_LACS_STONES && StoneCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_LACS_OPTIONS).Is(RO_LACS_GREG_REWARD)) >= ctx->GetOption(RSK_LACS_STONE_COUNT).Value<uint8_t>()) || (ctx->GetSettings()->LACSCondition() == RO_LACS_STONES && StoneCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_LACS_OPTIONS).Is(RO_LACS_GREG_REWARD)) >= ctx->GetOption(RSK_LACS_STONE_COUNT).GetContextOptionIndex()) ||
(ctx->GetSettings()->LACSCondition() == RO_LACS_MEDALLIONS && MedallionCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_LACS_OPTIONS).Is(RO_LACS_GREG_REWARD)) >= ctx->GetOption(RSK_LACS_MEDALLION_COUNT).Value<uint8_t>()) || (ctx->GetSettings()->LACSCondition() == RO_LACS_MEDALLIONS && MedallionCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_LACS_OPTIONS).Is(RO_LACS_GREG_REWARD)) >= ctx->GetOption(RSK_LACS_MEDALLION_COUNT).GetContextOptionIndex()) ||
(ctx->GetSettings()->LACSCondition() == RO_LACS_REWARDS && StoneCount() + MedallionCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_LACS_OPTIONS).Is(RO_LACS_GREG_REWARD)) >= ctx->GetOption(RSK_LACS_REWARD_COUNT).Value<uint8_t>()) || (ctx->GetSettings()->LACSCondition() == RO_LACS_REWARDS && StoneCount() + MedallionCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_LACS_OPTIONS).Is(RO_LACS_GREG_REWARD)) >= ctx->GetOption(RSK_LACS_REWARD_COUNT).GetContextOptionIndex()) ||
(ctx->GetSettings()->LACSCondition() == RO_LACS_DUNGEONS && DungeonCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_LACS_OPTIONS).Is(RO_LACS_GREG_REWARD)) >= ctx->GetOption(RSK_LACS_DUNGEON_COUNT).Value<uint8_t>()) || (ctx->GetSettings()->LACSCondition() == RO_LACS_DUNGEONS && DungeonCount() + (HasItem(RG_GREG_RUPEE) && ctx->GetOption(RSK_LACS_OPTIONS).Is(RO_LACS_GREG_REWARD)) >= ctx->GetOption(RSK_LACS_DUNGEON_COUNT).GetContextOptionIndex()) ||
(ctx->GetSettings()->LACSCondition() == RO_LACS_TOKENS && GetGSCount() >= ctx->GetOption(RSK_LACS_TOKEN_COUNT).Value<uint8_t>()); (ctx->GetSettings()->LACSCondition() == RO_LACS_TOKENS && GetGSCount() >= ctx->GetOption(RSK_LACS_TOKEN_COUNT).GetContextOptionIndex());
} }
bool Logic::SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmount) { bool Logic::SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmount) {
@ -2089,7 +2089,7 @@ namespace Rando {
//CanPlantBean = false; //CanPlantBean = false;
BigPoeKill = false; BigPoeKill = false;
BaseHearts = ctx->GetOption(RSK_STARTING_HEARTS).Value<uint8_t>() + 1; BaseHearts = ctx->GetOption(RSK_STARTING_HEARTS).GetContextOptionIndex() + 1;
//Bridge Requirements //Bridge Requirements

View File

@ -31,10 +31,7 @@ Option Option::LogicTrick(std::string name_) {
} }
Option::operator bool() const { Option::operator bool() const {
if (std::holds_alternative<bool>(var)) { return contextSelection != 0;
return Value<bool>();
}
return Value<uint8_t>() != 0;
} }
size_t Option::GetOptionCount() const { size_t Option::GetOptionCount() const {
@ -49,12 +46,16 @@ const std::string& Option::GetDescription() const {
return description; return description;
} }
uint8_t Option::GetSelectedOptionIndex() const { uint8_t Option::GetMenuOptionIndex() const {
return selectedOption; return menuSelection;
}
uint8_t Option::GetContextOptionIndex() const {
return contextSelection;
} }
const std::string& Option::GetSelectedOptionText() const { const std::string& Option::GetSelectedOptionText() const {
return options[selectedOption]; return options[menuSelection];
} }
const std::string& Option::GetCVarName() const { const std::string& Option::GetCVarName() const {
@ -63,39 +64,45 @@ const std::string& Option::GetCVarName() const {
void Option::SetVariable() { void Option::SetVariable() {
if (std::holds_alternative<bool>(var)) { if (std::holds_alternative<bool>(var)) {
var.emplace<bool>(selectedOption != 0); var.emplace<bool>(menuSelection != 0);
} else { } else {
var.emplace<uint8_t>(selectedOption); var.emplace<uint8_t>(menuSelection);
} }
} }
void Option::SetCVar() const { void Option::SaveCVar() const {
if (!cvarName.empty()) { if (!cvarName.empty()) {
CVarSetInteger(cvarName.c_str(), GetSelectedOptionIndex()); CVarSetInteger(cvarName.c_str(), GetMenuOptionIndex());
} }
} }
void Option::SetFromCVar() { void Option::SetFromCVar() {
if (!cvarName.empty()) { if (!cvarName.empty()) {
SetSelectedIndex(CVarGetInteger(cvarName.c_str(), defaultOption)); SetMenuIndex(CVarGetInteger(cvarName.c_str(), defaultOption));
} }
} }
void Option::SetDelayedOption() { void Option::SetDelayedOption() {
delayedOption = selectedOption; delayedSelection = contextSelection;
} }
void Option::RestoreDelayedOption() { void Option::RestoreDelayedOption() {
selectedOption = delayedOption; contextSelection = delayedSelection;
}
void Option::SetMenuIndex(size_t idx) {
menuSelection = idx;
if (menuSelection > options.size() - 1) {
menuSelection = options.size() - 1;
}
SetVariable(); SetVariable();
} }
void Option::SetSelectedIndex(size_t idx) { void Option::SetContextIndex(size_t idx) {
selectedOption = idx; contextSelection = idx;
if (selectedOption > options.size() - 1) { if (contextSelection > options.size() - 1) {
selectedOption = options.size() - 1; contextSelection = options.size() - 1;
} }
SetVariable();
} }
void Option::Hide() { void Option::Hide() {
@ -111,8 +118,8 @@ bool Option::IsHidden() const {
} }
void Option::ChangeOptions(std::vector<std::string> opts) { void Option::ChangeOptions(std::vector<std::string> opts) {
if (selectedOption >= opts.size()) { if (menuSelection >= opts.size()) {
selectedOption = opts.size() - 1; menuSelection = opts.size() - 1;
} }
options = std::move(opts); options = std::move(opts);
} }
@ -177,7 +184,7 @@ Option::Option(uint8_t var_, std::string name_, std::vector<std::string> options
: var(var_), name(std::move(name_)), options(std::move(options_)), category(category_), : var(var_), name(std::move(name_)), options(std::move(options_)), category(category_),
cvarName(std::move(cvarName_)), description(std::move(description_)), widgetType(widgetType_), cvarName(std::move(cvarName_)), description(std::move(description_)), widgetType(widgetType_),
defaultOption(defaultOption_), defaultHidden(defaultHidden_), imFlags(imFlags_) { defaultOption(defaultOption_), defaultHidden(defaultHidden_), imFlags(imFlags_) {
selectedOption = defaultOption; menuSelection = contextSelection = defaultOption;
hidden = defaultHidden; hidden = defaultHidden;
SetFromCVar(); SetFromCVar();
} }
@ -187,7 +194,7 @@ Option::Option(bool var_, std::string name_, std::vector<std::string> options_,
: var(var_), name(std::move(name_)), options(std::move(options_)), category(category_), : var(var_), name(std::move(name_)), options(std::move(options_)), category(category_),
cvarName(std::move(cvarName_)), description(std::move(description_)), widgetType(widgetType_), cvarName(std::move(cvarName_)), description(std::move(description_)), widgetType(widgetType_),
defaultOption(defaultOption_), defaultHidden(defaultHidden_), imFlags(imFlags_) { defaultOption(defaultOption_), defaultHidden(defaultHidden_), imFlags(imFlags_) {
selectedOption = defaultOption; menuSelection = contextSelection = defaultOption;
hidden = defaultHidden; hidden = defaultHidden;
SetFromCVar(); SetFromCVar();
} }
@ -270,7 +277,7 @@ bool Option::RenderCombobox() {
bool Option::RenderSlider() { bool Option::RenderSlider() {
bool changed = false; bool changed = false;
int val = GetSelectedOptionIndex(); int val = GetMenuOptionIndex();
if (val > options.size() - 1) { if (val > options.size() - 1) {
val = options.size() - 1; val = options.size() - 1;
CVarSetInteger(cvarName.c_str(), val); CVarSetInteger(cvarName.c_str(), val);

View File

@ -126,42 +126,25 @@ class Option {
*/ */
static Option LogicTrick(std::string name_); static Option LogicTrick(std::string name_);
/**
* @brief Gets the selected index or boolean value of the Option.
*
* @tparam T uint8_t or bool, depending on how the option was constructed.
* @return T
*/
template <typename T> T Value() const {
return std::get<T>(var);
}
/** /**
* @brief Determines if the value/selected index of this Option matches the provided value. * @brief Determines if the value/selected index of this Option matches the provided value.
* *
* @tparam T uint8_t, bool, or an enum (which will be cast to uint8_t).
* @param other The value to compare. * @param other The value to compare.
* @return true * @return true
* @return false * @return false
*/ */
template <typename T> bool Is(T other) const { bool Is(uint32_t other) const {
static_assert(std::is_integral_v<T> || std::is_enum_v<T>, "T must be an integral type or an enum."); return contextSelection == other;
if constexpr ((std::is_integral_v<T> && !std::is_same_v<bool, T>) || std::is_enum_v<T>) {
return Value<uint8_t>() == static_cast<uint8_t>(other);
} else {
return Value<bool>() == static_cast<bool>(other);
}
} }
/** /**
* @brief Determines if the value/selected index of this Option does not match the provided value. * @brief Determines if the value/selected index of this Option does not match the provided value.
* *
* @tparam T uint8_t, book, or an enum (which will be cast to uint8_t).
* @param other The value to compare. * @param other The value to compare.
* @return true * @return true
* @return false * @return false
*/ */
template <typename T> bool IsNot(T other) const { bool IsNot(uint32_t other) const {
return !Is(other); return !Is(other);
} }
@ -203,11 +186,18 @@ class Option {
const std::string& GetCVarName() const; const std::string& GetCVarName() const;
/** /**
* @brief Get the selected index for this Option. * @brief Get the menu index for this Option.
* *
* @return uint8_t * @return uint8_t
*/ */
uint8_t GetSelectedOptionIndex() const; uint8_t GetMenuOptionIndex() const;
/**
* @brief Get the rando context index for this Option.
*
* @return uint8_t
*/
uint8_t GetContextOptionIndex() const;
/** /**
* @brief Sets the variable to the currently selected index for this Option. * @brief Sets the variable to the currently selected index for this Option.
@ -218,7 +208,7 @@ class Option {
* @brief Sets the CVar corresponding to the property `cvarName` equal to the value * @brief Sets the CVar corresponding to the property `cvarName` equal to the value
* of the property `selectedValue`. * of the property `selectedValue`.
*/ */
void SetCVar() const; void SaveCVar() const;
/** /**
* @brief Sets the value of property `selectedValue` equal to the CVar corresponding * @brief Sets the value of property `selectedValue` equal to the CVar corresponding
@ -237,11 +227,18 @@ class Option {
void RestoreDelayedOption(); void RestoreDelayedOption();
/** /**
* @brief Set the selected index for this Option. Also calls `SetVariable()`. * @brief Set the menu index for this Option. Also calls `SetVariable()`.
* *
* @param idx the index to set as the selected index. * @param idx the index to set as the selected index.
*/ */
void SetSelectedIndex(size_t idx); void SetMenuIndex(size_t idx);
/**
* @brief Set the rando context index for this Option. Also calls `SetVariable()`.
*
* @param idx the index to set as the selected index.
*/
void SetContextIndex(size_t idx);
/** /**
* @brief Hides this Option in the menu. (Not currently being used afaik, we prefer to * @brief Hides this Option in the menu. (Not currently being used afaik, we prefer to
@ -324,8 +321,9 @@ protected:
std::variant<bool, uint8_t> var; std::variant<bool, uint8_t> var;
std::string name; std::string name;
std::vector<std::string> options; std::vector<std::string> options;
uint8_t selectedOption = 0; uint8_t menuSelection = 0;
uint8_t delayedOption = 0; uint8_t contextSelection = 0;
uint8_t delayedSelection = 0;
bool hidden = false; bool hidden = false;
OptionCategory category = OptionCategory::Setting; OptionCategory category = OptionCategory::Setting;
std::string cvarName; std::string cvarName;

View File

@ -1270,7 +1270,7 @@ FishIdentity Randomizer::IdentifyFish(s32 sceneNum, s32 actorParams) {
} }
u8 Randomizer::GetRandoSettingValue(RandomizerSettingKey randoSettingKey) { u8 Randomizer::GetRandoSettingValue(RandomizerSettingKey randoSettingKey) {
return Rando::Context::GetInstance()->GetOption(randoSettingKey).GetSelectedOptionIndex(); return Rando::Context::GetInstance()->GetOption(randoSettingKey).GetContextOptionIndex();
} }
GetItemEntry Randomizer::GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogItemId, bool checkObtainability) { GetItemEntry Randomizer::GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogItemId, bool checkObtainability) {

View File

@ -1468,7 +1468,7 @@ TrickOption& Settings::GetTrickOption(const RandomizerTrick key) {
void Settings::ResetTrickOptions() { void Settings::ResetTrickOptions() {
for (int count = 0; count < RT_MAX; count++){ for (int count = 0; count < RT_MAX; count++){
mTrickOptions[count].SetSelectedIndex(0); //RANDOTODO this can probably be done better mTrickOptions[count].SetContextIndex(0); //RANDOTODO this can probably be done better
}; };
} }
@ -2212,6 +2212,9 @@ void Settings::UpdateOptionProperties() {
void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocations, const std::set<RandomizerTrick>& enabledTricks) { void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocations, const std::set<RandomizerTrick>& enabledTricks) {
const auto ctx = Rando::Context::GetInstance(); const auto ctx = Rando::Context::GetInstance();
if (!ctx->IsSpoilerLoaded()) { if (!ctx->IsSpoilerLoaded()) {
for (Option& option : mOptions) {
option.SetContextIndex(option.GetMenuOptionIndex());
}
// If we've loaded a spoiler file, the settings have already been populated, so we // If we've loaded a spoiler file, the settings have already been populated, so we
// only need to do things like resolve the starting age or determine MQ dungeons. // only need to do things like resolve the starting age or determine MQ dungeons.
// Any logic dependent on cvarSettings should go in this if statement // Any logic dependent on cvarSettings should go in this if statement
@ -2219,39 +2222,39 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
// if we skip child zelda, we start with zelda's letter, and malon starts // if we skip child zelda, we start with zelda's letter, and malon starts
// at the ranch, so we should *not* shuffle the weird egg // at the ranch, so we should *not* shuffle the weird egg
if (mOptions[RSK_SKIP_CHILD_ZELDA]) { if (mOptions[RSK_SKIP_CHILD_ZELDA]) {
mOptions[RSK_SHUFFLE_WEIRD_EGG].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_SHUFFLE_WEIRD_EGG].SetContextIndex(RO_GENERIC_OFF);
} }
// With certain access settings, the seed is only beatable if Starting Age is set to Child. // With certain access settings, the seed is only beatable if Starting Age is set to Child.
if (mOptions[RSK_FOREST].Is(RO_FOREST_CLOSED) || (mOptions[RSK_DOOR_OF_TIME].Is(RO_DOOROFTIME_CLOSED) && if (mOptions[RSK_FOREST].Is(RO_FOREST_CLOSED) || (mOptions[RSK_DOOR_OF_TIME].Is(RO_DOOROFTIME_CLOSED) &&
!mOptions[RSK_SHUFFLE_OCARINA])) { !mOptions[RSK_SHUFFLE_OCARINA])) {
mOptions[RSK_STARTING_AGE].SetSelectedIndex(RO_AGE_CHILD); mOptions[RSK_STARTING_AGE].SetContextIndex(RO_AGE_CHILD);
} }
if (mOptions[RSK_TRIFORCE_HUNT]) { if (mOptions[RSK_TRIFORCE_HUNT]) {
mOptions[RSK_GANONS_BOSS_KEY].SetSelectedIndex(RO_GANON_BOSS_KEY_TRIFORCE_HUNT); mOptions[RSK_GANONS_BOSS_KEY].SetContextIndex(RO_GANON_BOSS_KEY_TRIFORCE_HUNT);
} }
// Force 100 GS Shuffle if that's where Ganon's Boss Key is // Force 100 GS Shuffle if that's where Ganon's Boss Key is
if (mOptions[RSK_GANONS_BOSS_KEY].Is(RO_GANON_BOSS_KEY_KAK_TOKENS)) { if (mOptions[RSK_GANONS_BOSS_KEY].Is(RO_GANON_BOSS_KEY_KAK_TOKENS)) {
mOptions[RSK_SHUFFLE_100_GS_REWARD].SetSelectedIndex(1); mOptions[RSK_SHUFFLE_100_GS_REWARD].SetContextIndex(1);
} }
// If we only have MQ, set all dungeons to MQ // If we only have MQ, set all dungeons to MQ
if (OTRGlobals::Instance->HasMasterQuest() && !OTRGlobals::Instance->HasOriginal()) { if (OTRGlobals::Instance->HasMasterQuest() && !OTRGlobals::Instance->HasOriginal()) {
mOptions[RSK_MQ_DUNGEON_RANDOM].SetSelectedIndex(RO_MQ_DUNGEONS_SET_NUMBER); mOptions[RSK_MQ_DUNGEON_RANDOM].SetContextIndex(RO_MQ_DUNGEONS_SET_NUMBER);
mOptions[RSK_MQ_DUNGEON_COUNT].SetSelectedIndex(12); mOptions[RSK_MQ_DUNGEON_COUNT].SetContextIndex(12);
mOptions[RSK_MQ_DUNGEON_SET].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_MQ_DUNGEON_SET].SetContextIndex(RO_GENERIC_OFF);
} }
// If we don't have MQ, set all dungeons to Vanilla // If we don't have MQ, set all dungeons to Vanilla
if (OTRGlobals::Instance->HasOriginal() && !OTRGlobals::Instance->HasMasterQuest()) { if (OTRGlobals::Instance->HasOriginal() && !OTRGlobals::Instance->HasMasterQuest()) {
mOptions[RSK_MQ_DUNGEON_RANDOM].SetSelectedIndex(RO_MQ_DUNGEONS_NONE); mOptions[RSK_MQ_DUNGEON_RANDOM].SetContextIndex(RO_MQ_DUNGEONS_NONE);
} }
if (mOptions[RSK_MQ_DUNGEON_RANDOM].Is(RO_MQ_DUNGEONS_NONE)) { if (mOptions[RSK_MQ_DUNGEON_RANDOM].Is(RO_MQ_DUNGEONS_NONE)) {
mOptions[RSK_MQ_DUNGEON_COUNT].SetSelectedIndex(0); mOptions[RSK_MQ_DUNGEON_COUNT].SetContextIndex(0);
mOptions[RSK_MQ_DUNGEON_SET].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_MQ_DUNGEON_SET].SetContextIndex(RO_GENERIC_OFF);
} }
// If any of the individual shuffle settings are on, turn on the main Shuffle Entrances option // If any of the individual shuffle settings are on, turn on the main Shuffle Entrances option
@ -2261,53 +2264,53 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
|| mOptions[RSK_SHUFFLE_INTERIOR_ENTRANCES].IsNot(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF) || mOptions[RSK_SHUFFLE_INTERIOR_ENTRANCES].IsNot(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF)
|| mOptions[RSK_SHUFFLE_GROTTO_ENTRANCES] || mOptions[RSK_SHUFFLE_OWL_DROPS] || mOptions[RSK_SHUFFLE_GROTTO_ENTRANCES] || mOptions[RSK_SHUFFLE_OWL_DROPS]
|| mOptions[RSK_SHUFFLE_WARP_SONGS] || mOptions[RSK_SHUFFLE_OVERWORLD_SPAWNS]) { || mOptions[RSK_SHUFFLE_WARP_SONGS] || mOptions[RSK_SHUFFLE_OVERWORLD_SPAWNS]) {
mOptions[RSK_SHUFFLE_ENTRANCES].SetSelectedIndex(RO_GENERIC_ON); mOptions[RSK_SHUFFLE_ENTRANCES].SetContextIndex(RO_GENERIC_ON);
} else { } else {
mOptions[RSK_SHUFFLE_ENTRANCES].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_SHUFFLE_ENTRANCES].SetContextIndex(RO_GENERIC_OFF);
} }
if (mOptions[RSK_SHUFFLE_DUNGEON_REWARDS].Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON)) { if (mOptions[RSK_SHUFFLE_DUNGEON_REWARDS].Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON)) {
mOptions[RSK_LINKS_POCKET].SetSelectedIndex(RO_LINKS_POCKET_DUNGEON_REWARD); mOptions[RSK_LINKS_POCKET].SetContextIndex(RO_LINKS_POCKET_DUNGEON_REWARD);
} }
if (!ctx->IsSpoilerLoaded()) { if (!ctx->IsSpoilerLoaded()) {
ctx->AddExcludedOptions(); ctx->AddExcludedOptions();
for (const auto locationKey : ctx->everyPossibleLocation) { for (const auto locationKey : ctx->everyPossibleLocation) {
if (const auto location = ctx->GetItemLocation(locationKey); excludedLocations.contains(location->GetRandomizerCheck())) { if (const auto location = ctx->GetItemLocation(locationKey); excludedLocations.contains(location->GetRandomizerCheck())) {
location->GetExcludedOption()->SetSelectedIndex(1); location->GetExcludedOption()->SetContextIndex(1);
} else { } else {
location->GetExcludedOption()->SetSelectedIndex(0); location->GetExcludedOption()->SetContextIndex(0);
} }
} }
// Tricks // Tricks
ResetTrickOptions(); ResetTrickOptions();
for (const auto randomizerTrick : enabledTricks) { for (const auto randomizerTrick : enabledTricks) {
mTrickOptions[randomizerTrick].SetSelectedIndex(1); mTrickOptions[randomizerTrick].SetContextIndex(1);
} }
} }
if (!mOptions[RSK_SHUFFLE_KOKIRI_SWORD]) { if (!mOptions[RSK_SHUFFLE_KOKIRI_SWORD]) {
if (mOptions[RSK_STARTING_KOKIRI_SWORD]) { if (mOptions[RSK_STARTING_KOKIRI_SWORD]) {
ctx->GetItemLocation(RC_KF_KOKIRI_SWORD_CHEST)->GetExcludedOption()->SetSelectedIndex(1); ctx->GetItemLocation(RC_KF_KOKIRI_SWORD_CHEST)->GetExcludedOption()->SetContextIndex(1);
} }
} }
if (!mOptions[RSK_SHUFFLE_MASTER_SWORD]) { if (!mOptions[RSK_SHUFFLE_MASTER_SWORD]) {
if (mOptions[RSK_STARTING_MASTER_SWORD]) { if (mOptions[RSK_STARTING_MASTER_SWORD]) {
ctx->GetItemLocation(RC_MASTER_SWORD_PEDESTAL)->GetExcludedOption()->SetSelectedIndex(1); ctx->GetItemLocation(RC_MASTER_SWORD_PEDESTAL)->GetExcludedOption()->SetContextIndex(1);
} }
} }
if (!mOptions[RSK_SHUFFLE_OCARINA]) { if (!mOptions[RSK_SHUFFLE_OCARINA]) {
if (mOptions[RSK_STARTING_OCARINA].IsNot(RO_STARTING_OCARINA_OFF)) { if (mOptions[RSK_STARTING_OCARINA].IsNot(RO_STARTING_OCARINA_OFF)) {
ctx->GetItemLocation(RC_LW_GIFT_FROM_SARIA)->GetExcludedOption()->SetSelectedIndex(1); ctx->GetItemLocation(RC_LW_GIFT_FROM_SARIA)->GetExcludedOption()->SetContextIndex(1);
if (mOptions[RSK_STARTING_OCARINA].Is(RO_STARTING_OCARINA_TIME)) { if (mOptions[RSK_STARTING_OCARINA].Is(RO_STARTING_OCARINA_TIME)) {
ctx->GetItemLocation(RC_HF_OCARINA_OF_TIME_ITEM)->GetExcludedOption()->SetSelectedIndex(1); ctx->GetItemLocation(RC_HF_OCARINA_OF_TIME_ITEM)->GetExcludedOption()->SetContextIndex(1);
} }
} }
} }
} }
// RANDOTODO implement chest shuffle with keysanity // RANDOTODO implement chest shuffle with keysanity
// ShuffleChestMinigame.SetSelectedIndex(cvarSettings[RSK_SHUFFLE_CHEST_MINIGAME]); // ShuffleChestMinigame.SetContextIndex(cvarSettings[RSK_SHUFFLE_CHEST_MINIGAME]);
mOptions[RSK_SHUFFLE_CHEST_MINIGAME].SetSelectedIndex(RO_CHEST_GAME_OFF); mOptions[RSK_SHUFFLE_CHEST_MINIGAME].SetContextIndex(RO_CHEST_GAME_OFF);
//TODO: RandomizeAllSettings(true) when implementing the ability to randomize the options themselves. //TODO: RandomizeAllSettings(true) when implementing the ability to randomize the options themselves.
std::array<DungeonInfo*, 12> dungeons = ctx->GetDungeons()->GetDungeonList(); std::array<DungeonInfo*, 12> dungeons = ctx->GetDungeons()->GetDungeonList();
@ -2318,12 +2321,12 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
dungeon->SetDungeonKnown(true); dungeon->SetDungeonKnown(true);
} }
//if it's selection mode, process the selection directly //if it's selection mode, process the selection directly
if (mOptions[RSK_MQ_DUNGEON_RANDOM].Value<uint8_t>() == RO_MQ_DUNGEONS_SELECTION){ if (mOptions[RSK_MQ_DUNGEON_RANDOM].GetContextOptionIndex() == RO_MQ_DUNGEONS_SELECTION){
mOptions[RSK_MQ_DUNGEON_SET].SetSelectedIndex(RO_GENERIC_ON); mOptions[RSK_MQ_DUNGEON_SET].SetContextIndex(RO_GENERIC_ON);
//How many dungeons are set to MQ in selection //How many dungeons are set to MQ in selection
uint8_t mqSet = 0; uint8_t mqSet = 0;
for (auto dungeon: dungeons) { for (auto dungeon: dungeons) {
switch (mOptions[dungeon->GetMQSetting()].Value<uint8_t>()) { switch (mOptions[dungeon->GetMQSetting()].GetContextOptionIndex()) {
case RO_MQ_SET_MQ: case RO_MQ_SET_MQ:
dungeon->SetMQ(); dungeon->SetMQ();
mqSet += 1; mqSet += 1;
@ -2342,11 +2345,11 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
} }
} }
//override the dungeons set with the ones set by selection, so it's accurate for anything that wants to know MQ dungeon count //override the dungeons set with the ones set by selection, so it's accurate for anything that wants to know MQ dungeon count
mOptions[RSK_MQ_DUNGEON_COUNT].SetSelectedIndex(mqSet); mOptions[RSK_MQ_DUNGEON_COUNT].SetContextIndex(mqSet);
//handling set number and random number together //handling set number and random number together
} else if (mOptions[RSK_MQ_DUNGEON_RANDOM].Value<uint8_t>() != RO_MQ_DUNGEONS_NONE){ } else if (mOptions[RSK_MQ_DUNGEON_RANDOM].GetContextOptionIndex() != RO_MQ_DUNGEONS_NONE){
// so we don't have to call this repeatedly // so we don't have to call this repeatedly
uint8_t mqCount = mOptions[RSK_MQ_DUNGEON_COUNT].Value<uint8_t>(); uint8_t mqCount = mOptions[RSK_MQ_DUNGEON_COUNT].GetContextOptionIndex();
//How many dungeons are set to MQ in selection //How many dungeons are set to MQ in selection
uint8_t mqSet = 0; uint8_t mqSet = 0;
//the number of random //the number of random
@ -2356,7 +2359,7 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
//if dungeons have been preset, process them //if dungeons have been preset, process them
if (mOptions[RSK_MQ_DUNGEON_SET]){ if (mOptions[RSK_MQ_DUNGEON_SET]){
for (size_t i = 0; i < dungeons.size(); i++) { for (size_t i = 0; i < dungeons.size(); i++) {
switch (mOptions[dungeons[i]->GetMQSetting()].Value<uint8_t>()) { switch (mOptions[dungeons[i]->GetMQSetting()].GetContextOptionIndex()) {
case RO_MQ_SET_MQ: case RO_MQ_SET_MQ:
dungeons[i]->SetMQ(); dungeons[i]->SetMQ();
mqSet += 1; mqSet += 1;
@ -2372,22 +2375,22 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
//otherwise, every dungeon is possible //otherwise, every dungeon is possible
} else { } else {
//if the count is fixed to 12, we know everything is MQ, so can skip some setps and do not set Known //if the count is fixed to 12, we know everything is MQ, so can skip some setps and do not set Known
if (mOptions[RSK_MQ_DUNGEON_RANDOM].Value<uint8_t>() == RO_MQ_DUNGEONS_SET_NUMBER && if (mOptions[RSK_MQ_DUNGEON_RANDOM].GetContextOptionIndex() == RO_MQ_DUNGEONS_SET_NUMBER &&
mqCount == 12) { mqCount == 12) {
randMQOption = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; randMQOption = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
for (auto dungeon: dungeons) { for (auto dungeon: dungeons) {
mOptions[dungeon->GetMQSetting()].SetSelectedIndex(RO_MQ_SET_MQ); mOptions[dungeon->GetMQSetting()].SetContextIndex(RO_MQ_SET_MQ);
} }
//if it's fixed to zero, set it to None instead. the rest is processed after //if it's fixed to zero, set it to None instead. the rest is processed after
} else if (mOptions[RSK_MQ_DUNGEON_RANDOM].Value<uint8_t>() == RO_MQ_DUNGEONS_SET_NUMBER && } else if (mOptions[RSK_MQ_DUNGEON_RANDOM].GetContextOptionIndex() == RO_MQ_DUNGEONS_SET_NUMBER &&
mqCount == 0){ mqCount == 0){
mOptions[RSK_MQ_DUNGEON_RANDOM].SetSelectedIndex(RO_MQ_DUNGEONS_NONE); mOptions[RSK_MQ_DUNGEON_RANDOM].SetContextIndex(RO_MQ_DUNGEONS_NONE);
//otherwise, make everything a possibility and unknown //otherwise, make everything a possibility and unknown
} else { } else {
for (size_t i = 0; i < dungeons.size(); i++) { for (size_t i = 0; i < dungeons.size(); i++) {
randMQOption.push_back(i); randMQOption.push_back(i);
dungeons[i]->SetDungeonKnown(false); dungeons[i]->SetDungeonKnown(false);
mOptions[dungeons[i]->GetMQSetting()].SetSelectedIndex(RO_MQ_SET_RANDOM); mOptions[dungeons[i]->GetMQSetting()].SetContextIndex(RO_MQ_SET_RANDOM);
} }
} }
} }
@ -2409,20 +2412,20 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
} else { } else {
//if there's no random options, check if we can collapse the setting into None or Selection //if there's no random options, check if we can collapse the setting into None or Selection
if (mqSet == 0){ if (mqSet == 0){
mOptions[RSK_MQ_DUNGEON_RANDOM].SetSelectedIndex(RO_MQ_DUNGEONS_NONE); mOptions[RSK_MQ_DUNGEON_RANDOM].SetContextIndex(RO_MQ_DUNGEONS_NONE);
} else { } else {
mOptions[RSK_MQ_DUNGEON_RANDOM].SetSelectedIndex(RO_MQ_DUNGEONS_SELECTION); mOptions[RSK_MQ_DUNGEON_RANDOM].SetContextIndex(RO_MQ_DUNGEONS_SELECTION);
} }
} }
//reset the value set based on what was actually set //reset the value set based on what was actually set
mOptions[RSK_MQ_DUNGEON_COUNT].SetSelectedIndex(mqToSet + mqSet); mOptions[RSK_MQ_DUNGEON_COUNT].SetContextIndex(mqToSet + mqSet);
} }
//Not an if else as other settings can become None in processing //Not an if else as other settings can become None in processing
if (mOptions[RSK_MQ_DUNGEON_RANDOM].Value<uint8_t>() == RO_MQ_DUNGEONS_NONE) { if (mOptions[RSK_MQ_DUNGEON_RANDOM].GetContextOptionIndex() == RO_MQ_DUNGEONS_NONE) {
mOptions[RSK_MQ_DUNGEON_SET].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_MQ_DUNGEON_SET].SetContextIndex(RO_GENERIC_OFF);
mOptions[RSK_MQ_DUNGEON_COUNT].SetSelectedIndex(0); mOptions[RSK_MQ_DUNGEON_COUNT].SetContextIndex(0);
for (auto dungeon: dungeons) { for (auto dungeon: dungeons) {
mOptions[dungeon->GetMQSetting()].SetSelectedIndex(RO_MQ_SET_VANILLA); mOptions[dungeon->GetMQSetting()].SetContextIndex(RO_MQ_SET_VANILLA);
} }
} }
@ -2448,16 +2451,16 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
if (mOptions[RSK_GERUDO_FORTRESS].Is(RO_GF_NORMAL) && mOptions[RSK_GERUDO_KEYS].IsNot(RO_GERUDO_KEYS_VANILLA)) { if (mOptions[RSK_GERUDO_FORTRESS].Is(RO_GF_NORMAL) && mOptions[RSK_GERUDO_KEYS].IsNot(RO_GERUDO_KEYS_VANILLA)) {
keyrings.push_back(&mOptions[RSK_KEYRINGS_GERUDO_FORTRESS]); keyrings.push_back(&mOptions[RSK_KEYRINGS_GERUDO_FORTRESS]);
} else { } else {
mOptions[RSK_KEYRINGS_GERUDO_FORTRESS].SetSelectedIndex(RO_KEYRING_FOR_DUNGEON_OFF); mOptions[RSK_KEYRINGS_GERUDO_FORTRESS].SetContextIndex(RO_KEYRING_FOR_DUNGEON_OFF);
} }
if (mOptions[RSK_KEYRINGS].Is(RO_KEYRINGS_RANDOM) || mOptions[RSK_KEYRINGS].Is(RO_KEYRINGS_COUNT)) { if (mOptions[RSK_KEYRINGS].Is(RO_KEYRINGS_RANDOM) || mOptions[RSK_KEYRINGS].Is(RO_KEYRINGS_COUNT)) {
const uint32_t keyRingCount = mOptions[RSK_KEYRINGS].Is(RO_KEYRINGS_COUNT) ? mOptions[RSK_KEYRINGS_RANDOM_COUNT].Value<uint8_t>() : Random(0, static_cast<int>(keyrings.size())); const uint32_t keyRingCount = mOptions[RSK_KEYRINGS].Is(RO_KEYRINGS_COUNT) ? mOptions[RSK_KEYRINGS_RANDOM_COUNT].GetContextOptionIndex() : Random(0, static_cast<int>(keyrings.size()));
Shuffle(keyrings); Shuffle(keyrings);
for (size_t i = 0; i < keyRingCount; i++) { for (size_t i = 0; i < keyRingCount; i++) {
keyrings[i]->SetSelectedIndex(RO_KEYRING_FOR_DUNGEON_ON); keyrings[i]->SetContextIndex(RO_KEYRING_FOR_DUNGEON_ON);
} }
for (size_t i = keyRingCount; i < keyrings.size(); i++) { for (size_t i = keyRingCount; i < keyrings.size(); i++) {
keyrings[i]->SetSelectedIndex(RO_KEYRING_FOR_DUNGEON_OFF); keyrings[i]->SetContextIndex(RO_KEYRING_FOR_DUNGEON_OFF);
} }
} }
if (mOptions[RSK_KEYRINGS_BOTTOM_OF_THE_WELL].Is(RO_KEYRING_FOR_DUNGEON_ON) || (mOptions[RSK_KEYRINGS_BOTTOM_OF_THE_WELL].Is(RO_KEYRING_FOR_DUNGEON_RANDOM) && Random(0, 2) == 1)) { if (mOptions[RSK_KEYRINGS_BOTTOM_OF_THE_WELL].Is(RO_KEYRING_FOR_DUNGEON_ON) || (mOptions[RSK_KEYRINGS_BOTTOM_OF_THE_WELL].Is(RO_KEYRING_FOR_DUNGEON_RANDOM) && Random(0, 2) == 1)) {
@ -2492,11 +2495,11 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
trial->SetAsSkipped(); trial->SetAsSkipped();
} }
if(mOptions[RSK_GANONS_TRIALS].Is(RO_GANONS_TRIALS_SKIP)){ if(mOptions[RSK_GANONS_TRIALS].Is(RO_GANONS_TRIALS_SKIP)){
mOptions[RSK_TRIAL_COUNT].SetSelectedIndex(0); mOptions[RSK_TRIAL_COUNT].SetContextIndex(0);
} else if(mOptions[RSK_GANONS_TRIALS].Is(RO_GANONS_TRIALS_RANDOM_NUMBER)) { } else if(mOptions[RSK_GANONS_TRIALS].Is(RO_GANONS_TRIALS_RANDOM_NUMBER)) {
mOptions[RSK_TRIAL_COUNT].SetSelectedIndex(Random(0, static_cast<int>(mOptions[RSK_TRIAL_COUNT].GetOptionCount()))); mOptions[RSK_TRIAL_COUNT].SetContextIndex(Random(0, static_cast<int>(mOptions[RSK_TRIAL_COUNT].GetOptionCount())));
} }
for (uint8_t i = 0; i < mOptions[RSK_TRIAL_COUNT].Value<uint8_t>(); i++) { for (uint8_t i = 0; i < mOptions[RSK_TRIAL_COUNT].GetContextOptionIndex(); i++) {
trials[i]->SetAsRequired(); trials[i]->SetAsRequired();
} }
@ -2504,7 +2507,7 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
(mOptions[RSK_SHUFFLE_INTERIOR_ENTRANCES].Is(RO_INTERIOR_ENTRANCE_SHUFFLE_ALL) || (mOptions[RSK_SHUFFLE_INTERIOR_ENTRANCES].Is(RO_INTERIOR_ENTRANCE_SHUFFLE_ALL) ||
mOptions[RSK_SHUFFLE_OVERWORLD_ENTRANCES] || mOptions[RSK_SHUFFLE_OVERWORLD_SPAWNS] || mOptions[RSK_SHUFFLE_OVERWORLD_ENTRANCES] || mOptions[RSK_SHUFFLE_OVERWORLD_SPAWNS] ||
mOptions[RSK_DECOUPLED_ENTRANCES] || mOptions[RSK_MIXED_ENTRANCE_POOLS])) { mOptions[RSK_DECOUPLED_ENTRANCES] || mOptions[RSK_MIXED_ENTRANCE_POOLS])) {
mOptions[RSK_FOREST].SetSelectedIndex(RO_FOREST_CLOSED_DEKU); mOptions[RSK_FOREST].SetContextIndex(RO_FOREST_CLOSED_DEKU);
} }
if (mOptions[RSK_STARTING_AGE].Is(RO_AGE_RANDOM)) { if (mOptions[RSK_STARTING_AGE].Is(RO_AGE_RANDOM)) {
@ -2514,7 +2517,7 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
mResolvedStartingAge = RO_AGE_ADULT; mResolvedStartingAge = RO_AGE_ADULT;
} }
} else { } else {
mResolvedStartingAge = static_cast<RandoOptionStartingAge>(mOptions[RSK_STARTING_AGE].Value<uint8_t>()); mResolvedStartingAge = static_cast<RandoOptionStartingAge>(mOptions[RSK_STARTING_AGE].GetContextOptionIndex());
} }
// TODO: Random Starting Time // TODO: Random Starting Time
@ -2535,35 +2538,35 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
if (mOptions[RSK_LOGIC_RULES].Is(RO_LOGIC_VANILLA)) { if (mOptions[RSK_LOGIC_RULES].Is(RO_LOGIC_VANILLA)) {
for (Option* setting : VanillaLogicDefaults) { for (Option* setting : VanillaLogicDefaults) {
setting->SetDelayedOption(); //setting->SetDelayedOption();
setting->SetSelectedIndex(0); setting->SetContextIndex(0);
} }
mOptions[RSK_KEYSANITY].SetDelayedOption(); //mOptions[RSK_KEYSANITY].SetDelayedOption();
mOptions[RSK_KEYSANITY].SetSelectedIndex(3); mOptions[RSK_KEYSANITY].SetContextIndex(3);
} }
if (!mOptions[RSK_SHUFFLE_WARP_SONGS]) { if (!mOptions[RSK_SHUFFLE_WARP_SONGS]) {
mOptions[RSK_WARP_SONG_HINTS].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_WARP_SONG_HINTS].SetContextIndex(RO_GENERIC_OFF);
} }
if (!mOptions[RSK_SHUFFLE_COWS]) { if (!mOptions[RSK_SHUFFLE_COWS]) {
mOptions[RSK_MALON_HINT].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_MALON_HINT].SetContextIndex(RO_GENERIC_OFF);
} }
if (!mOptions[RSK_SHUFFLE_100_GS_REWARD]) { if (!mOptions[RSK_SHUFFLE_100_GS_REWARD]) {
mOptions[RSK_KAK_100_SKULLS_HINT].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_KAK_100_SKULLS_HINT].SetContextIndex(RO_GENERIC_OFF);
} }
if (!mOptions[RSK_SHUFFLE_FISHING_POLE]) { if (!mOptions[RSK_SHUFFLE_FISHING_POLE]) {
mOptions[RSK_FISHING_POLE_HINT].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_FISHING_POLE_HINT].SetContextIndex(RO_GENERIC_OFF);
} }
if (mOptions[RSK_FISHSANITY].IsNot(RO_FISHSANITY_HYRULE_LOACH)) { if (mOptions[RSK_FISHSANITY].IsNot(RO_FISHSANITY_HYRULE_LOACH)) {
mOptions[RSK_LOACH_HINT].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_LOACH_HINT].SetContextIndex(RO_GENERIC_OFF);
} }
if (mOptions[RSK_CUCCO_COUNT].Is(0)) { if (mOptions[RSK_CUCCO_COUNT].Is(0)) {
mOptions[RSK_CHICKENS_HINT].SetSelectedIndex(RO_GENERIC_OFF); mOptions[RSK_CHICKENS_HINT].SetContextIndex(RO_GENERIC_OFF);
} }
} }
void Settings::ParseJson(nlohmann::json spoilerFileJson) { void Settings::ParseJson(nlohmann::json spoilerFileJson) {
@ -2581,115 +2584,115 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) {
switch (const RandomizerSettingKey index = mSpoilerfileSettingNameToEnum[it.key()]) { switch (const RandomizerSettingKey index = mSpoilerfileSettingNameToEnum[it.key()]) {
case RSK_LOGIC_RULES: case RSK_LOGIC_RULES:
if (it.value() == "Glitchless") { if (it.value() == "Glitchless") {
mOptions[index].SetSelectedIndex(RO_LOGIC_GLITCHLESS); mOptions[index].SetContextIndex(RO_LOGIC_GLITCHLESS);
} else if (it.value() == "No Logic") { } else if (it.value() == "No Logic") {
mOptions[index].SetSelectedIndex(RO_LOGIC_NO_LOGIC); mOptions[index].SetContextIndex(RO_LOGIC_NO_LOGIC);
} else if (it.value() == "Vanilla") { } else if (it.value() == "Vanilla") {
mOptions[index].SetSelectedIndex(RO_LOGIC_VANILLA); mOptions[index].SetContextIndex(RO_LOGIC_VANILLA);
} }
break; break;
case RSK_FOREST: case RSK_FOREST:
if (it.value() == "Closed") { if (it.value() == "Closed") {
mOptions[index].SetSelectedIndex(RO_FOREST_CLOSED); mOptions[index].SetContextIndex(RO_FOREST_CLOSED);
} else if (it.value() == "Open") { } else if (it.value() == "Open") {
mOptions[index].SetSelectedIndex(RO_FOREST_OPEN); mOptions[index].SetContextIndex(RO_FOREST_OPEN);
} else if (it.value() == "Closed Deku") { } else if (it.value() == "Closed Deku") {
mOptions[index].SetSelectedIndex(RO_FOREST_CLOSED_DEKU); mOptions[index].SetContextIndex(RO_FOREST_CLOSED_DEKU);
} }
break; break;
case RSK_KAK_GATE: case RSK_KAK_GATE:
if (it.value() == "Closed") { if (it.value() == "Closed") {
mOptions[index].SetSelectedIndex(RO_KAK_GATE_CLOSED); mOptions[index].SetContextIndex(RO_KAK_GATE_CLOSED);
} else if (it.value() == "Open") { } else if (it.value() == "Open") {
mOptions[index].SetSelectedIndex(RO_KAK_GATE_OPEN); mOptions[index].SetContextIndex(RO_KAK_GATE_OPEN);
} }
break; break;
case RSK_DOOR_OF_TIME: case RSK_DOOR_OF_TIME:
if (it.value() == "Open") { if (it.value() == "Open") {
mOptions[index].SetSelectedIndex(RO_DOOROFTIME_OPEN); mOptions[index].SetContextIndex(RO_DOOROFTIME_OPEN);
} else if (it.value() == "Song only") { } else if (it.value() == "Song only") {
mOptions[index].SetSelectedIndex(RO_DOOROFTIME_SONGONLY); mOptions[index].SetContextIndex(RO_DOOROFTIME_SONGONLY);
} else if (it.value() == "Closed") { } else if (it.value() == "Closed") {
mOptions[index].SetSelectedIndex(RO_DOOROFTIME_CLOSED); mOptions[index].SetContextIndex(RO_DOOROFTIME_CLOSED);
} }
break; break;
case RSK_ZORAS_FOUNTAIN: case RSK_ZORAS_FOUNTAIN:
if (it.value() == "Closed") { if (it.value() == "Closed") {
mOptions[index].SetSelectedIndex(RO_ZF_CLOSED); mOptions[index].SetContextIndex(RO_ZF_CLOSED);
} else if (it.value() == "Closed as child") { } else if (it.value() == "Closed as child") {
mOptions[index].SetSelectedIndex(RO_ZF_CLOSED_CHILD); mOptions[index].SetContextIndex(RO_ZF_CLOSED_CHILD);
} else if (it.value() == "Open") { } else if (it.value() == "Open") {
mOptions[index].SetSelectedIndex(RO_ZF_OPEN); mOptions[index].SetContextIndex(RO_ZF_OPEN);
} }
break; break;
case RSK_STARTING_AGE: case RSK_STARTING_AGE:
if (it.value() == "Child") { if (it.value() == "Child") {
mOptions[index].SetSelectedIndex(RO_AGE_CHILD); mOptions[index].SetContextIndex(RO_AGE_CHILD);
} else if (it.value() == "Adult") { } else if (it.value() == "Adult") {
mOptions[index].SetSelectedIndex(RO_AGE_ADULT); mOptions[index].SetContextIndex(RO_AGE_ADULT);
} }
break; break;
case RSK_GERUDO_FORTRESS: case RSK_GERUDO_FORTRESS:
if (it.value() == "Normal") { if (it.value() == "Normal") {
mOptions[index].SetSelectedIndex(RO_GF_NORMAL); mOptions[index].SetContextIndex(RO_GF_NORMAL);
} else if (it.value() == "Fast") { } else if (it.value() == "Fast") {
mOptions[index].SetSelectedIndex(RO_GF_FAST); mOptions[index].SetContextIndex(RO_GF_FAST);
} else if (it.value() == "Open") { } else if (it.value() == "Open") {
mOptions[index].SetSelectedIndex(RO_GF_OPEN); mOptions[index].SetContextIndex(RO_GF_OPEN);
} }
break; break;
case RSK_RAINBOW_BRIDGE: case RSK_RAINBOW_BRIDGE:
if (it.value() == "Vanilla") { if (it.value() == "Vanilla") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_VANILLA); mOptions[index].SetContextIndex(RO_BRIDGE_VANILLA);
} else if (it.value() == "Always open") { } else if (it.value() == "Always open") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_ALWAYS_OPEN); mOptions[index].SetContextIndex(RO_BRIDGE_ALWAYS_OPEN);
} else if (it.value() == "Stones") { } else if (it.value() == "Stones") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_STONES); mOptions[index].SetContextIndex(RO_BRIDGE_STONES);
} else if (it.value() == "Medallions") { } else if (it.value() == "Medallions") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_MEDALLIONS); mOptions[index].SetContextIndex(RO_BRIDGE_MEDALLIONS);
} else if (it.value() == "Dungeon rewards") { } else if (it.value() == "Dungeon rewards") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_DUNGEON_REWARDS); mOptions[index].SetContextIndex(RO_BRIDGE_DUNGEON_REWARDS);
} else if (it.value() == "Dungeons") { } else if (it.value() == "Dungeons") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_DUNGEONS); mOptions[index].SetContextIndex(RO_BRIDGE_DUNGEONS);
} else if (it.value() == "Tokens") { } else if (it.value() == "Tokens") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_TOKENS); mOptions[index].SetContextIndex(RO_BRIDGE_TOKENS);
} else if (it.value() == "Greg") { } else if (it.value() == "Greg") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_GREG); mOptions[index].SetContextIndex(RO_BRIDGE_GREG);
} }
break; break;
case RSK_BRIDGE_OPTIONS: case RSK_BRIDGE_OPTIONS:
if (it.value() == "Standard Rewards") { if (it.value() == "Standard Rewards") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_STANDARD_REWARD); mOptions[index].SetContextIndex(RO_BRIDGE_STANDARD_REWARD);
} else if (it.value() == "Greg as Reward") { } else if (it.value() == "Greg as Reward") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_GREG_REWARD); mOptions[index].SetContextIndex(RO_BRIDGE_GREG_REWARD);
} else if (it.value() == "Greg as Wildcard") { } else if (it.value() == "Greg as Wildcard") {
mOptions[index].SetSelectedIndex(RO_BRIDGE_WILDCARD_REWARD); mOptions[index].SetContextIndex(RO_BRIDGE_WILDCARD_REWARD);
} }
break; break;
case RSK_LACS_OPTIONS: case RSK_LACS_OPTIONS:
if (it.value() == "Standard Reward") { if (it.value() == "Standard Reward") {
mOptions[index].SetSelectedIndex(RO_LACS_STANDARD_REWARD); mOptions[index].SetContextIndex(RO_LACS_STANDARD_REWARD);
} else if (it.value() == "Greg as Reward") { } else if (it.value() == "Greg as Reward") {
mOptions[index].SetSelectedIndex(RO_LACS_GREG_REWARD); mOptions[index].SetContextIndex(RO_LACS_GREG_REWARD);
} else if (it.value() == "Greg as Wildcard") { } else if (it.value() == "Greg as Wildcard") {
mOptions[index].SetSelectedIndex(RO_LACS_WILDCARD_REWARD); mOptions[index].SetContextIndex(RO_LACS_WILDCARD_REWARD);
} }
break; break;
case RSK_DAMAGE_MULTIPLIER: case RSK_DAMAGE_MULTIPLIER:
if (it.value() == "x1/2") { if (it.value() == "x1/2") {
mOptions[index].SetSelectedIndex(RO_DAMAGE_MULTIPLIER_HALF); mOptions[index].SetContextIndex(RO_DAMAGE_MULTIPLIER_HALF);
} else if (it.value() == "x1") { } else if (it.value() == "x1") {
mOptions[index].SetSelectedIndex(RO_DAMAGE_MULTIPLIER_DEFAULT); mOptions[index].SetContextIndex(RO_DAMAGE_MULTIPLIER_DEFAULT);
} else if (it.value() == "x2") { } else if (it.value() == "x2") {
mOptions[index].SetSelectedIndex(RO_DAMAGE_MULTIPLIER_DOUBLE); mOptions[index].SetContextIndex(RO_DAMAGE_MULTIPLIER_DOUBLE);
} else if (it.value() == "x4") { } else if (it.value() == "x4") {
mOptions[index].SetSelectedIndex(RO_DAMAGE_MULTIPLIER_QUADRUPLE); mOptions[index].SetContextIndex(RO_DAMAGE_MULTIPLIER_QUADRUPLE);
} else if (it.value() == "x8") { } else if (it.value() == "x8") {
mOptions[index].SetSelectedIndex(RO_DAMAGE_MULTIPLIER_OCTUPLE); mOptions[index].SetContextIndex(RO_DAMAGE_MULTIPLIER_OCTUPLE);
} else if (it.value() == "x16") { } else if (it.value() == "x16") {
mOptions[index].SetSelectedIndex(RO_DAMAGE_MULTIPLIER_SEXDECUPLE); mOptions[index].SetContextIndex(RO_DAMAGE_MULTIPLIER_SEXDECUPLE);
} else if (it.value() == "OHKO") { } else if (it.value() == "OHKO") {
mOptions[index].SetSelectedIndex(RO_DAMAGE_MULTIPLIER_OHKO); mOptions[index].SetContextIndex(RO_DAMAGE_MULTIPLIER_OHKO);
} }
break; break;
case RSK_RAINBOW_BRIDGE_STONE_COUNT: case RSK_RAINBOW_BRIDGE_STONE_COUNT:
@ -2709,7 +2712,7 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) {
case RSK_STARTING_SKULLTULA_TOKEN: case RSK_STARTING_SKULLTULA_TOKEN:
case RSK_SHOPSANITY_COUNT: case RSK_SHOPSANITY_COUNT:
numericValueString = it.value(); numericValueString = it.value();
mOptions[index].SetSelectedIndex(std::stoi(numericValueString)); mOptions[index].SetContextIndex(std::stoi(numericValueString));
break; break;
// Same as the above section, but the indexes are off by one from the text // Same as the above section, but the indexes are off by one from the text
// (i.e. 10 Big Poes is index 9). // (i.e. 10 Big Poes is index 9).
@ -2718,49 +2721,49 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) {
case RSK_TRIFORCE_HUNT_PIECES_REQUIRED: case RSK_TRIFORCE_HUNT_PIECES_REQUIRED:
case RSK_STARTING_HEARTS: case RSK_STARTING_HEARTS:
numericValueString = it.value(); numericValueString = it.value();
mOptions[index].SetSelectedIndex(std::stoi(numericValueString) - 1); mOptions[index].SetContextIndex(std::stoi(numericValueString) - 1);
break; break;
case RSK_GANONS_TRIALS: case RSK_GANONS_TRIALS:
if (it.value() == "Skip") { if (it.value() == "Skip") {
mOptions[index].SetSelectedIndex(RO_GANONS_TRIALS_SKIP); mOptions[index].SetContextIndex(RO_GANONS_TRIALS_SKIP);
} else if (it.value() == "Set Number") { } else if (it.value() == "Set Number") {
mOptions[index].SetSelectedIndex(RO_GANONS_TRIALS_SET_NUMBER); mOptions[index].SetContextIndex(RO_GANONS_TRIALS_SET_NUMBER);
} else if (it.value() == "Random Number") { } else if (it.value() == "Random Number") {
mOptions[index].SetSelectedIndex(RO_GANONS_TRIALS_RANDOM_NUMBER); mOptions[index].SetContextIndex(RO_GANONS_TRIALS_RANDOM_NUMBER);
} }
case RSK_SHOPSANITY: case RSK_SHOPSANITY:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_SHOPSANITY_OFF); mOptions[index].SetContextIndex(RO_SHOPSANITY_OFF);
} else if (it.value() == "Specific Count") { } else if (it.value() == "Specific Count") {
mOptions[index].SetSelectedIndex(RO_SHOPSANITY_SPECIFIC_COUNT); mOptions[index].SetContextIndex(RO_SHOPSANITY_SPECIFIC_COUNT);
} else if (it.value() == "Random") { } else if (it.value() == "Random") {
mOptions[index].SetSelectedIndex(RO_SHOPSANITY_RANDOM); mOptions[index].SetContextIndex(RO_SHOPSANITY_RANDOM);
} }
break; break;
case RSK_SHOPSANITY_PRICES: case RSK_SHOPSANITY_PRICES:
case RSK_SCRUBS_PRICES: case RSK_SCRUBS_PRICES:
case RSK_MERCHANT_PRICES: case RSK_MERCHANT_PRICES:
if (it.value() == "Vanilla") { if (it.value() == "Vanilla") {
mOptions[index].SetSelectedIndex(RO_PRICE_VANILLA); mOptions[index].SetContextIndex(RO_PRICE_VANILLA);
} else if (it.value() == "Cheap Balanced") { } else if (it.value() == "Cheap Balanced") {
mOptions[index].SetSelectedIndex(RO_PRICE_CHEAP_BALANCED); mOptions[index].SetContextIndex(RO_PRICE_CHEAP_BALANCED);
} else if (it.value() == "Balanced") { } else if (it.value() == "Balanced") {
mOptions[index].SetSelectedIndex(RO_PRICE_BALANCED); mOptions[index].SetContextIndex(RO_PRICE_BALANCED);
} else if (it.value() == "Fixed") { } else if (it.value() == "Fixed") {
mOptions[index].SetSelectedIndex(RO_PRICE_FIXED); mOptions[index].SetContextIndex(RO_PRICE_FIXED);
} else if (it.value() == "Range") { } else if (it.value() == "Range") {
mOptions[index].SetSelectedIndex(RO_PRICE_RANGE); mOptions[index].SetContextIndex(RO_PRICE_RANGE);
} else if (it.value() == "Set By Wallet") { } else if (it.value() == "Set By Wallet") {
mOptions[index].SetSelectedIndex(RO_PRICE_SET_BY_WALLET); mOptions[index].SetContextIndex(RO_PRICE_SET_BY_WALLET);
} }
break; break;
case RSK_SHUFFLE_SCRUBS: case RSK_SHUFFLE_SCRUBS:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_SCRUBS_OFF); mOptions[index].SetContextIndex(RO_SCRUBS_OFF);
} else if (it.value() == "Major Items Only") { } else if (it.value() == "Major Items Only") {
mOptions[index].SetSelectedIndex(RO_SCRUBS_MAJOR_ONLY); mOptions[index].SetContextIndex(RO_SCRUBS_MAJOR_ONLY);
} else if (it.value() == "All") { } else if (it.value() == "All") {
mOptions[index].SetSelectedIndex(RO_SCRUBS_ALL); mOptions[index].SetContextIndex(RO_SCRUBS_ALL);
} }
break; break;
case RSK_SHUFFLE_FISHING_POLE: case RSK_SHUFFLE_FISHING_POLE:
@ -2848,20 +2851,20 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) {
case RSK_SHUFFLE_DEKU_NUT_BAG: case RSK_SHUFFLE_DEKU_NUT_BAG:
case RSK_SHUFFLE_DEKU_STICK_BAG: case RSK_SHUFFLE_DEKU_STICK_BAG:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_GENERIC_OFF); mOptions[index].SetContextIndex(RO_GENERIC_OFF);
} else if (it.value() == "On") { } else if (it.value() == "On") {
mOptions[index].SetSelectedIndex(RO_GENERIC_ON); mOptions[index].SetContextIndex(RO_GENERIC_ON);
} }
break; break;
case RSK_KEYRINGS: case RSK_KEYRINGS:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_KEYRINGS_OFF); mOptions[index].SetContextIndex(RO_KEYRINGS_OFF);
} else if (it.value() == "Random") { } else if (it.value() == "Random") {
mOptions[index].SetSelectedIndex(RO_KEYRINGS_RANDOM); mOptions[index].SetContextIndex(RO_KEYRINGS_RANDOM);
} else if (it.value() == "Count") { } else if (it.value() == "Count") {
mOptions[index].SetSelectedIndex(RO_KEYRINGS_COUNT); mOptions[index].SetContextIndex(RO_KEYRINGS_COUNT);
} else if (it.value() == "Selection") { } else if (it.value() == "Selection") {
mOptions[index].SetSelectedIndex(RO_KEYRINGS_SELECTION); mOptions[index].SetContextIndex(RO_KEYRINGS_SELECTION);
} }
break; break;
case RSK_KEYRINGS_GERUDO_FORTRESS: case RSK_KEYRINGS_GERUDO_FORTRESS:
@ -2874,283 +2877,283 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) {
case RSK_KEYRINGS_GTG: case RSK_KEYRINGS_GTG:
case RSK_KEYRINGS_GANONS_CASTLE: case RSK_KEYRINGS_GANONS_CASTLE:
if (it.value() == "No") { if (it.value() == "No") {
mOptions[index].SetSelectedIndex(RO_KEYRING_FOR_DUNGEON_OFF); mOptions[index].SetContextIndex(RO_KEYRING_FOR_DUNGEON_OFF);
} else if (it.value() == "Random") { } else if (it.value() == "Random") {
mOptions[index].SetSelectedIndex(RO_KEYRING_FOR_DUNGEON_RANDOM); mOptions[index].SetContextIndex(RO_KEYRING_FOR_DUNGEON_RANDOM);
} else if (it.value() == "Yes") { } else if (it.value() == "Yes") {
mOptions[index].SetSelectedIndex(RO_KEYRING_FOR_DUNGEON_ON); mOptions[index].SetContextIndex(RO_KEYRING_FOR_DUNGEON_ON);
} }
break; break;
case RSK_SHUFFLE_MERCHANTS: case RSK_SHUFFLE_MERCHANTS:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_SHUFFLE_MERCHANTS_OFF); mOptions[index].SetContextIndex(RO_SHUFFLE_MERCHANTS_OFF);
} else if (it.value() == "Beans Only") { } else if (it.value() == "Beans Only") {
mOptions[index].SetSelectedIndex(RO_SHUFFLE_MERCHANTS_BEANS_ONLY); mOptions[index].SetContextIndex(RO_SHUFFLE_MERCHANTS_BEANS_ONLY);
} else if (it.value() == "All but Beans") { } else if (it.value() == "All but Beans") {
mOptions[index].SetSelectedIndex(RO_SHUFFLE_MERCHANTS_ALL_BUT_BEANS); mOptions[index].SetContextIndex(RO_SHUFFLE_MERCHANTS_ALL_BUT_BEANS);
} else if (it.value() == "All") { } else if (it.value() == "All") {
mOptions[index].SetSelectedIndex(RO_SHUFFLE_MERCHANTS_ALL); mOptions[index].SetContextIndex(RO_SHUFFLE_MERCHANTS_ALL);
} }
break; break;
// Uses Ammo Drops option for now. "Off" not yet implemented // Uses Ammo Drops option for now. "Off" not yet implemented
// TODO: Change to Ammo Drops // TODO: Change to Ammo Drops
case RSK_ENABLE_BOMBCHU_DROPS: case RSK_ENABLE_BOMBCHU_DROPS:
if (it.value() == "Yes") { if (it.value() == "Yes") {
mOptions[index].SetSelectedIndex(RO_AMMO_DROPS_ON); mOptions[index].SetContextIndex(RO_AMMO_DROPS_ON);
// } else if (it.value() == "On + Bombchu") { // } else if (it.value() == "On + Bombchu") {
// mOptions[index].SetSelectedIndex(RO_AMMO_DROPS_ON_PLUS_BOMBCHU); // mOptions[index].SetContextIndex(RO_AMMO_DROPS_ON_PLUS_BOMBCHU);
} else if (it.value() == "No") { } else if (it.value() == "No") {
mOptions[index].SetSelectedIndex(RO_AMMO_DROPS_OFF); mOptions[index].SetContextIndex(RO_AMMO_DROPS_OFF);
} }
break; break;
case RSK_FISHSANITY: case RSK_FISHSANITY:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_FISHSANITY_OFF); mOptions[index].SetContextIndex(RO_FISHSANITY_OFF);
} else if (it.value() == "Shuffle Fishing Pond") { } else if (it.value() == "Shuffle Fishing Pond") {
mOptions[index].SetSelectedIndex(RO_FISHSANITY_POND); mOptions[index].SetContextIndex(RO_FISHSANITY_POND);
} else if (it.value() == "Shuffle Overworld Fish") { } else if (it.value() == "Shuffle Overworld Fish") {
mOptions[index].SetSelectedIndex(RO_FISHSANITY_OVERWORLD); mOptions[index].SetContextIndex(RO_FISHSANITY_OVERWORLD);
} else if (it.value() == "Shuffle Both") { } else if (it.value() == "Shuffle Both") {
mOptions[index].SetSelectedIndex(RO_FISHSANITY_BOTH); mOptions[index].SetContextIndex(RO_FISHSANITY_BOTH);
} }
break; break;
case RSK_SHUFFLE_BOSS_SOULS: case RSK_SHUFFLE_BOSS_SOULS:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_BOSS_SOULS_OFF); mOptions[index].SetContextIndex(RO_BOSS_SOULS_OFF);
} else if (it.value() == "On") { } else if (it.value() == "On") {
mOptions[index].SetSelectedIndex(RO_BOSS_SOULS_ON); mOptions[index].SetContextIndex(RO_BOSS_SOULS_ON);
} else if (it.value() == "On + Ganon") { } else if (it.value() == "On + Ganon") {
mOptions[index].SetSelectedIndex(RO_BOSS_SOULS_ON_PLUS_GANON); mOptions[index].SetContextIndex(RO_BOSS_SOULS_ON_PLUS_GANON);
} }
case RSK_STARTING_OCARINA: case RSK_STARTING_OCARINA:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_STARTING_OCARINA_OFF); mOptions[index].SetContextIndex(RO_STARTING_OCARINA_OFF);
} else if (it.value() == "Fairy Ocarina") { } else if (it.value() == "Fairy Ocarina") {
mOptions[index].SetSelectedIndex(RO_STARTING_OCARINA_FAIRY); mOptions[index].SetContextIndex(RO_STARTING_OCARINA_FAIRY);
} }
break; break;
case RSK_ITEM_POOL: case RSK_ITEM_POOL:
if (it.value() == "Plentiful") { if (it.value() == "Plentiful") {
mOptions[index].SetSelectedIndex(RO_ITEM_POOL_PLENTIFUL); mOptions[index].SetContextIndex(RO_ITEM_POOL_PLENTIFUL);
} else if (it.value() == "Balanced") { } else if (it.value() == "Balanced") {
mOptions[index].SetSelectedIndex(RO_ITEM_POOL_BALANCED); mOptions[index].SetContextIndex(RO_ITEM_POOL_BALANCED);
} else if (it.value() == "Scarce") { } else if (it.value() == "Scarce") {
mOptions[index].SetSelectedIndex(RO_ITEM_POOL_SCARCE); mOptions[index].SetContextIndex(RO_ITEM_POOL_SCARCE);
} else if (it.value() == "Minimal") { } else if (it.value() == "Minimal") {
mOptions[index].SetSelectedIndex(RO_ITEM_POOL_MINIMAL); mOptions[index].SetContextIndex(RO_ITEM_POOL_MINIMAL);
} }
break; break;
case RSK_ICE_TRAPS: case RSK_ICE_TRAPS:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_ICE_TRAPS_OFF); mOptions[index].SetContextIndex(RO_ICE_TRAPS_OFF);
} else if (it.value() == "Normal") { } else if (it.value() == "Normal") {
mOptions[index].SetSelectedIndex(RO_ICE_TRAPS_NORMAL); mOptions[index].SetContextIndex(RO_ICE_TRAPS_NORMAL);
} else if (it.value() == "Extra") { } else if (it.value() == "Extra") {
mOptions[index].SetSelectedIndex(RO_ICE_TRAPS_EXTRA); mOptions[index].SetContextIndex(RO_ICE_TRAPS_EXTRA);
} else if (it.value() == "Mayhem") { } else if (it.value() == "Mayhem") {
mOptions[index].SetSelectedIndex(RO_ICE_TRAPS_MAYHEM); mOptions[index].SetContextIndex(RO_ICE_TRAPS_MAYHEM);
} else if (it.value() == "Onslaught") { } else if (it.value() == "Onslaught") {
mOptions[index].SetSelectedIndex(RO_ICE_TRAPS_ONSLAUGHT); mOptions[index].SetContextIndex(RO_ICE_TRAPS_ONSLAUGHT);
} }
break; break;
case RSK_GOSSIP_STONE_HINTS: case RSK_GOSSIP_STONE_HINTS:
if (it.value() == "No Hints") { if (it.value() == "No Hints") {
mOptions[index].SetSelectedIndex(RO_GOSSIP_STONES_NONE); mOptions[index].SetContextIndex(RO_GOSSIP_STONES_NONE);
} else if (it.value() == "Need Nothing") { } else if (it.value() == "Need Nothing") {
mOptions[index].SetSelectedIndex(RO_GOSSIP_STONES_NEED_NOTHING); mOptions[index].SetContextIndex(RO_GOSSIP_STONES_NEED_NOTHING);
} else if (it.value() == "Mask of Truth") { } else if (it.value() == "Mask of Truth") {
mOptions[index].SetSelectedIndex(RO_GOSSIP_STONES_NEED_TRUTH); mOptions[index].SetContextIndex(RO_GOSSIP_STONES_NEED_TRUTH);
} else if (it.value() == "Stone of Agony") { } else if (it.value() == "Stone of Agony") {
mOptions[index].SetSelectedIndex(RO_GOSSIP_STONES_NEED_STONE); mOptions[index].SetContextIndex(RO_GOSSIP_STONES_NEED_STONE);
} }
break; break;
case RSK_HINT_CLARITY: case RSK_HINT_CLARITY:
if (it.value() == "Obscure") { if (it.value() == "Obscure") {
mOptions[index].SetSelectedIndex(RO_HINT_CLARITY_OBSCURE); mOptions[index].SetContextIndex(RO_HINT_CLARITY_OBSCURE);
} else if (it.value() == "Ambiguous") { } else if (it.value() == "Ambiguous") {
mOptions[index].SetSelectedIndex(RO_HINT_CLARITY_AMBIGUOUS); mOptions[index].SetContextIndex(RO_HINT_CLARITY_AMBIGUOUS);
} else if (it.value() == "Clear") { } else if (it.value() == "Clear") {
mOptions[index].SetSelectedIndex(RO_HINT_CLARITY_CLEAR); mOptions[index].SetContextIndex(RO_HINT_CLARITY_CLEAR);
} }
break; break;
case RSK_HINT_DISTRIBUTION: case RSK_HINT_DISTRIBUTION:
if (it.value() == "Useless") { if (it.value() == "Useless") {
mOptions[index].SetSelectedIndex(RO_HINT_DIST_USELESS); mOptions[index].SetContextIndex(RO_HINT_DIST_USELESS);
} else if (it.value() == "Balanced") { } else if (it.value() == "Balanced") {
mOptions[index].SetSelectedIndex(RO_HINT_DIST_BALANCED); mOptions[index].SetContextIndex(RO_HINT_DIST_BALANCED);
} else if (it.value() == "Strong") { } else if (it.value() == "Strong") {
mOptions[index].SetSelectedIndex(RO_HINT_DIST_STRONG); mOptions[index].SetContextIndex(RO_HINT_DIST_STRONG);
} else if (it.value() == "Very Strong") { } else if (it.value() == "Very Strong") {
mOptions[index].SetSelectedIndex(RO_HINT_DIST_VERY_STRONG); mOptions[index].SetContextIndex(RO_HINT_DIST_VERY_STRONG);
} }
break; break;
case RSK_GERUDO_KEYS: case RSK_GERUDO_KEYS:
if (it.value() == "Vanilla") { if (it.value() == "Vanilla") {
mOptions[index].SetSelectedIndex(RO_GERUDO_KEYS_VANILLA); mOptions[index].SetContextIndex(RO_GERUDO_KEYS_VANILLA);
} else if (it.value() == "Any Dungeon") { } else if (it.value() == "Any Dungeon") {
mOptions[index].SetSelectedIndex(RO_GERUDO_KEYS_ANY_DUNGEON); mOptions[index].SetContextIndex(RO_GERUDO_KEYS_ANY_DUNGEON);
} else if (it.value() == "Overworld") { } else if (it.value() == "Overworld") {
mOptions[index].SetSelectedIndex(RO_GERUDO_KEYS_OVERWORLD); mOptions[index].SetContextIndex(RO_GERUDO_KEYS_OVERWORLD);
} else if (it.value() == "Anywhere") { } else if (it.value() == "Anywhere") {
mOptions[index].SetSelectedIndex(RO_GERUDO_KEYS_ANYWHERE); mOptions[index].SetContextIndex(RO_GERUDO_KEYS_ANYWHERE);
} }
break; break;
case RSK_KEYSANITY: case RSK_KEYSANITY:
case RSK_BOSS_KEYSANITY: case RSK_BOSS_KEYSANITY:
case RSK_SHUFFLE_MAPANDCOMPASS: case RSK_SHUFFLE_MAPANDCOMPASS:
if (it.value() == "Start With") { if (it.value() == "Start With") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_ITEM_LOC_STARTWITH); mOptions[index].SetContextIndex(RO_DUNGEON_ITEM_LOC_STARTWITH);
} else if (it.value() == "Vanilla") { } else if (it.value() == "Vanilla") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_ITEM_LOC_VANILLA); mOptions[index].SetContextIndex(RO_DUNGEON_ITEM_LOC_VANILLA);
} else if (it.value() == "Own Dungeon") { } else if (it.value() == "Own Dungeon") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_ITEM_LOC_OWN_DUNGEON); mOptions[index].SetContextIndex(RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
} else if (it.value() == "Any Dungeon") { } else if (it.value() == "Any Dungeon") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_ITEM_LOC_ANY_DUNGEON); mOptions[index].SetContextIndex(RO_DUNGEON_ITEM_LOC_ANY_DUNGEON);
} else if (it.value() == "Overworld") { } else if (it.value() == "Overworld") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_ITEM_LOC_OVERWORLD); mOptions[index].SetContextIndex(RO_DUNGEON_ITEM_LOC_OVERWORLD);
} else if (it.value() == "Anywhere") { } else if (it.value() == "Anywhere") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_ITEM_LOC_ANYWHERE); mOptions[index].SetContextIndex(RO_DUNGEON_ITEM_LOC_ANYWHERE);
} }
break; break;
case RSK_GANONS_BOSS_KEY: case RSK_GANONS_BOSS_KEY:
if (it.value() == "Vanilla") { if (it.value() == "Vanilla") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_VANILLA); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_VANILLA);
} else if (it.value() == "Own dungeon") { } else if (it.value() == "Own dungeon") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_OWN_DUNGEON); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_OWN_DUNGEON);
} else if (it.value() == "Start with") { } else if (it.value() == "Start with") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_STARTWITH); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_STARTWITH);
} else if (it.value() == "Any Dungeon") { } else if (it.value() == "Any Dungeon") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_ANY_DUNGEON); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_ANY_DUNGEON);
} else if (it.value() == "Overworld") { } else if (it.value() == "Overworld") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_OVERWORLD); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_OVERWORLD);
} else if (it.value() == "Anywhere") { } else if (it.value() == "Anywhere") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_ANYWHERE); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_ANYWHERE);
} else if (it.value() == "LACS-Vanilla") { } else if (it.value() == "LACS-Vanilla") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_LACS_VANILLA); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_LACS_VANILLA);
} else if (it.value() == "LACS-Stones") { } else if (it.value() == "LACS-Stones") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_LACS_STONES); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_LACS_STONES);
} else if (it.value() == "LACS-Medallions") { } else if (it.value() == "LACS-Medallions") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_LACS_MEDALLIONS); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_LACS_MEDALLIONS);
} else if (it.value() == "LACS-Rewards") { } else if (it.value() == "LACS-Rewards") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_LACS_REWARDS); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_LACS_REWARDS);
} else if (it.value() == "LACS-Dungeons") { } else if (it.value() == "LACS-Dungeons") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_LACS_DUNGEONS); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_LACS_DUNGEONS);
} else if (it.value() == "LACS-Tokens") { } else if (it.value() == "LACS-Tokens") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_LACS_TOKENS); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_LACS_TOKENS);
} else if (it.value() == "100 GS Reward") { } else if (it.value() == "100 GS Reward") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_KAK_TOKENS); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_KAK_TOKENS);
} else if (it.value() == "Triforce Hunt") { } else if (it.value() == "Triforce Hunt") {
mOptions[index].SetSelectedIndex(RO_GANON_BOSS_KEY_TRIFORCE_HUNT); mOptions[index].SetContextIndex(RO_GANON_BOSS_KEY_TRIFORCE_HUNT);
} }
break; break;
case RSK_MQ_DUNGEON_RANDOM: case RSK_MQ_DUNGEON_RANDOM:
if (it.value() == "None") { if (it.value() == "None") {
mOptions[index].SetSelectedIndex(RO_MQ_DUNGEONS_NONE); mOptions[index].SetContextIndex(RO_MQ_DUNGEONS_NONE);
} else if (it.value() == "Random Number") { } else if (it.value() == "Random Number") {
mOptions[index].SetSelectedIndex(RO_MQ_DUNGEONS_RANDOM_NUMBER); mOptions[index].SetContextIndex(RO_MQ_DUNGEONS_RANDOM_NUMBER);
} else if (it.value() == "Set Number") { } else if (it.value() == "Set Number") {
mOptions[index].SetSelectedIndex(RO_MQ_DUNGEONS_SET_NUMBER); mOptions[index].SetContextIndex(RO_MQ_DUNGEONS_SET_NUMBER);
} else if (it.value() == "Selection Only") { } else if (it.value() == "Selection Only") {
mOptions[index].SetSelectedIndex(RO_MQ_DUNGEONS_SELECTION); mOptions[index].SetContextIndex(RO_MQ_DUNGEONS_SELECTION);
} }
break; break;
case RSK_STARTING_CONSUMABLES: case RSK_STARTING_CONSUMABLES:
case RSK_FULL_WALLETS: case RSK_FULL_WALLETS:
if (it.value() == "No") { if (it.value() == "No") {
mOptions[index].SetSelectedIndex(RO_GENERIC_NO); mOptions[index].SetContextIndex(RO_GENERIC_NO);
} else if (it.value() == "Yes") { } else if (it.value() == "Yes") {
mOptions[index].SetSelectedIndex(RO_GENERIC_YES); mOptions[index].SetContextIndex(RO_GENERIC_YES);
} }
break; break;
case RSK_SKIP_CHILD_ZELDA: case RSK_SKIP_CHILD_ZELDA:
case RSK_SKIP_CHILD_STEALTH: case RSK_SKIP_CHILD_STEALTH:
case RSK_SKIP_EPONA_RACE: case RSK_SKIP_EPONA_RACE:
if (it.value() == "Don't Skip") { if (it.value() == "Don't Skip") {
mOptions[index].SetSelectedIndex(RO_GENERIC_DONT_SKIP); mOptions[index].SetContextIndex(RO_GENERIC_DONT_SKIP);
} else if (it.value() == "Skip") { } else if (it.value() == "Skip") {
mOptions[index].SetSelectedIndex(RO_GENERIC_SKIP); mOptions[index].SetContextIndex(RO_GENERIC_SKIP);
} }
break; break;
case RSK_SHUFFLE_DUNGEON_REWARDS: case RSK_SHUFFLE_DUNGEON_REWARDS:
if (it.value() == "End of dungeons") { if (it.value() == "End of dungeons") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_REWARDS_END_OF_DUNGEON); mOptions[index].SetContextIndex(RO_DUNGEON_REWARDS_END_OF_DUNGEON);
} else if (it.value() == "Any dungeon") { } else if (it.value() == "Any dungeon") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_REWARDS_ANY_DUNGEON); mOptions[index].SetContextIndex(RO_DUNGEON_REWARDS_ANY_DUNGEON);
} else if (it.value() == "Overworld") { } else if (it.value() == "Overworld") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_REWARDS_OVERWORLD); mOptions[index].SetContextIndex(RO_DUNGEON_REWARDS_OVERWORLD);
} else if (it.value() == "Anywhere") { } else if (it.value() == "Anywhere") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_REWARDS_ANYWHERE); mOptions[index].SetContextIndex(RO_DUNGEON_REWARDS_ANYWHERE);
} }
break; break;
case RSK_SHUFFLE_SONGS: case RSK_SHUFFLE_SONGS:
if (it.value() == "Song locations") { if (it.value() == "Song locations") {
mOptions[index].SetSelectedIndex(RO_SONG_SHUFFLE_SONG_LOCATIONS); mOptions[index].SetContextIndex(RO_SONG_SHUFFLE_SONG_LOCATIONS);
} else if (it.value() == "Dungeon rewards") { } else if (it.value() == "Dungeon rewards") {
mOptions[index].SetSelectedIndex(RO_SONG_SHUFFLE_DUNGEON_REWARDS); mOptions[index].SetContextIndex(RO_SONG_SHUFFLE_DUNGEON_REWARDS);
} else if (it.value() == "Anywhere") { } else if (it.value() == "Anywhere") {
mOptions[index].SetSelectedIndex(RO_SONG_SHUFFLE_ANYWHERE); mOptions[index].SetContextIndex(RO_SONG_SHUFFLE_ANYWHERE);
} }
break; break;
case RSK_SHUFFLE_TOKENS: case RSK_SHUFFLE_TOKENS:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_TOKENSANITY_OFF); mOptions[index].SetContextIndex(RO_TOKENSANITY_OFF);
} else if (it.value() == "Dungeons") { } else if (it.value() == "Dungeons") {
mOptions[index].SetSelectedIndex(RO_TOKENSANITY_DUNGEONS); mOptions[index].SetContextIndex(RO_TOKENSANITY_DUNGEONS);
} else if (it.value() == "Overworld") { } else if (it.value() == "Overworld") {
mOptions[index].SetSelectedIndex(RO_TOKENSANITY_OVERWORLD); mOptions[index].SetContextIndex(RO_TOKENSANITY_OVERWORLD);
} else if (it.value() == "All Tokens") { } else if (it.value() == "All Tokens") {
mOptions[index].SetSelectedIndex(RO_TOKENSANITY_ALL); mOptions[index].SetContextIndex(RO_TOKENSANITY_ALL);
} }
break; break;
case RSK_LINKS_POCKET: case RSK_LINKS_POCKET:
if (it.value() == "Dungeon Reward") { if (it.value() == "Dungeon Reward") {
mOptions[index].SetSelectedIndex(RO_LINKS_POCKET_DUNGEON_REWARD); mOptions[index].SetContextIndex(RO_LINKS_POCKET_DUNGEON_REWARD);
} else if (it.value() == "Advancement") { } else if (it.value() == "Advancement") {
mOptions[index].SetSelectedIndex(RO_LINKS_POCKET_ADVANCEMENT); mOptions[index].SetContextIndex(RO_LINKS_POCKET_ADVANCEMENT);
} else if (it.value() == "Anything") { } else if (it.value() == "Anything") {
mOptions[index].SetSelectedIndex(RO_LINKS_POCKET_ANYTHING); mOptions[index].SetContextIndex(RO_LINKS_POCKET_ANYTHING);
} else if (it.value() == "Nothing") { } else if (it.value() == "Nothing") {
mOptions[index].SetSelectedIndex(RO_LINKS_POCKET_NOTHING); mOptions[index].SetContextIndex(RO_LINKS_POCKET_NOTHING);
} }
break; break;
case RSK_MQ_DUNGEON_COUNT: case RSK_MQ_DUNGEON_COUNT:
numericValueString = it.value(); numericValueString = it.value();
mOptions[index].SetSelectedIndex(std::stoi(numericValueString)); mOptions[index].SetContextIndex(std::stoi(numericValueString));
break; break;
case RSK_SHUFFLE_DUNGEON_ENTRANCES: case RSK_SHUFFLE_DUNGEON_ENTRANCES:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_ENTRANCE_SHUFFLE_OFF); mOptions[index].SetContextIndex(RO_DUNGEON_ENTRANCE_SHUFFLE_OFF);
} else if (it.value() == "On") { } else if (it.value() == "On") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_ENTRANCE_SHUFFLE_ON); mOptions[index].SetContextIndex(RO_DUNGEON_ENTRANCE_SHUFFLE_ON);
} else if (it.value() == "On + Ganon") { } else if (it.value() == "On + Ganon") {
mOptions[index].SetSelectedIndex(RO_DUNGEON_ENTRANCE_SHUFFLE_ON_PLUS_GANON); mOptions[index].SetContextIndex(RO_DUNGEON_ENTRANCE_SHUFFLE_ON_PLUS_GANON);
} }
break; break;
case RSK_SHUFFLE_BOSS_ENTRANCES: case RSK_SHUFFLE_BOSS_ENTRANCES:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF); mOptions[index].SetContextIndex(RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF);
} else if (it.value() == "Age Restricted") { } else if (it.value() == "Age Restricted") {
mOptions[index].SetSelectedIndex(RO_BOSS_ROOM_ENTRANCE_SHUFFLE_AGE_RESTRICTED); mOptions[index].SetContextIndex(RO_BOSS_ROOM_ENTRANCE_SHUFFLE_AGE_RESTRICTED);
} else if (it.value() == "Full") { } else if (it.value() == "Full") {
mOptions[index].SetSelectedIndex(RO_BOSS_ROOM_ENTRANCE_SHUFFLE_FULL); mOptions[index].SetContextIndex(RO_BOSS_ROOM_ENTRANCE_SHUFFLE_FULL);
} }
break; break;
case RSK_SHUFFLE_INTERIOR_ENTRANCES: case RSK_SHUFFLE_INTERIOR_ENTRANCES:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF); mOptions[index].SetContextIndex(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF);
} else if (it.value() == "Simple") { } else if (it.value() == "Simple") {
mOptions[index].SetSelectedIndex(RO_INTERIOR_ENTRANCE_SHUFFLE_SIMPLE); mOptions[index].SetContextIndex(RO_INTERIOR_ENTRANCE_SHUFFLE_SIMPLE);
} else if (it.value() == "All") { } else if (it.value() == "All") {
mOptions[index].SetSelectedIndex(RO_INTERIOR_ENTRANCE_SHUFFLE_ALL); mOptions[index].SetContextIndex(RO_INTERIOR_ENTRANCE_SHUFFLE_ALL);
} }
break; break;
case RSK_SHUFFLE_CHEST_MINIGAME: case RSK_SHUFFLE_CHEST_MINIGAME:
if (it.value() == "Off") { if (it.value() == "Off") {
mOptions[index].SetSelectedIndex(RO_CHEST_GAME_OFF); mOptions[index].SetContextIndex(RO_CHEST_GAME_OFF);
} else if (it.value() == "On (Separate)") { } else if (it.value() == "On (Separate)") {
mOptions[index].SetSelectedIndex(RO_CHEST_GAME_SINGLE_KEYS); mOptions[index].SetContextIndex(RO_CHEST_GAME_SINGLE_KEYS);
} else if (it.value() == "On (Pack)") { } else if (it.value() == "On (Pack)") {
mOptions[index].SetSelectedIndex(RO_CHEST_GAME_PACK); mOptions[index].SetContextIndex(RO_CHEST_GAME_PACK);
} }
break; break;
case RSK_MQ_DEKU_TREE: case RSK_MQ_DEKU_TREE:
@ -3166,11 +3169,11 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) {
case RSK_MQ_GTG: case RSK_MQ_GTG:
case RSK_MQ_GANONS_CASTLE: case RSK_MQ_GANONS_CASTLE:
if (it.value() == "Vanilla") { if (it.value() == "Vanilla") {
mOptions[index].SetSelectedIndex(RO_MQ_SET_VANILLA); mOptions[index].SetContextIndex(RO_MQ_SET_VANILLA);
} else if (it.value() == "Master Quest") { } else if (it.value() == "Master Quest") {
mOptions[index].SetSelectedIndex(RO_MQ_SET_MQ); mOptions[index].SetContextIndex(RO_MQ_SET_MQ);
} else if (it.value() == "Random") { } else if (it.value() == "Random") {
mOptions[index].SetSelectedIndex(RO_MQ_SET_RANDOM); mOptions[index].SetContextIndex(RO_MQ_SET_RANDOM);
} }
break; break;
default: default:
@ -3186,13 +3189,13 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) {
ctx->AddExcludedOptions(); ctx->AddExcludedOptions();
for (auto it = jsonExcludedLocations.begin(); it != jsonExcludedLocations.end(); ++it) { for (auto it = jsonExcludedLocations.begin(); it != jsonExcludedLocations.end(); ++it) {
const RandomizerCheck rc = Rando::StaticData::locationNameToEnum[it.value()]; const RandomizerCheck rc = Rando::StaticData::locationNameToEnum[it.value()];
ctx->GetItemLocation(rc)->GetExcludedOption()->SetSelectedIndex(RO_GENERIC_ON); ctx->GetItemLocation(rc)->GetExcludedOption()->SetContextIndex(RO_GENERIC_ON);
} }
nlohmann::json enabledTricksJson = spoilerFileJson["enabledTricks"]; nlohmann::json enabledTricksJson = spoilerFileJson["enabledTricks"];
for (auto it = enabledTricksJson.begin(); it != enabledTricksJson.end(); ++it) { for (auto it = enabledTricksJson.begin(); it != enabledTricksJson.end(); ++it) {
const RandomizerTrick rt = mTrickNameToEnum[it.value()]; const RandomizerTrick rt = mTrickNameToEnum[it.value()];
GetTrickOption(rt).SetSelectedIndex(RO_GENERIC_ON); GetTrickOption(rt).SetContextIndex(RO_GENERIC_ON);
} }
} }

View File

@ -38,7 +38,7 @@ extern int32_t D_8011D3AC;
extern void func_80AF36EC(EnRu2* enRu2, PlayState* play); extern void func_80AF36EC(EnRu2* enRu2, PlayState* play);
} }
#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetSelectedOptionIndex() #define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetContextOptionIndex()
void EnMa1_EndTeachSong(EnMa1* enMa1, PlayState* play) { void EnMa1_EndTeachSong(EnMa1* enMa1, PlayState* play) {
if (Message_GetState(&gPlayState->msgCtx) == TEXT_STATE_CLOSING) { if (Message_GetState(&gPlayState->msgCtx) == TEXT_STATE_CLOSING) {

View File

@ -1920,7 +1920,7 @@ extern "C" u32 SpoilerFileExists(const char* spoilerFileName) {
} }
extern "C" u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey) { extern "C" u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey) {
return OTRGlobals::Instance->gRandoContext->GetOption(randoSettingKey).GetSelectedOptionIndex(); return OTRGlobals::Instance->gRandoContext->GetOption(randoSettingKey).GetContextOptionIndex();
} }
extern "C" RandomizerCheck Randomizer_GetCheckFromActor(s16 actorId, s16 sceneNum, s16 actorParams) { extern "C" RandomizerCheck Randomizer_GetCheckFromActor(s16 actorId, s16 sceneNum, s16 actorParams) {

View File

@ -180,7 +180,7 @@ void SaveManager::LoadRandomizerVersion1() {
int key, value; int key, value;
SaveManager::Instance->LoadData("sk" + std::to_string(i), key); SaveManager::Instance->LoadData("sk" + std::to_string(i), key);
SaveManager::Instance->LoadData("sv" + std::to_string(i), value); SaveManager::Instance->LoadData("sv" + std::to_string(i), value);
randoContext->GetOption(RandomizerSettingKey(key)).SetSelectedIndex(value); randoContext->GetOption(RandomizerSettingKey(key)).SetContextIndex(value);
} }
for (int i = 0; i < 50; i++) { for (int i = 0; i < 50; i++) {
@ -286,7 +286,7 @@ void SaveManager::LoadRandomizerVersion2() {
SaveManager::Instance->LoadArray("randoSettings", RSK_MAX, [&](size_t i) { SaveManager::Instance->LoadArray("randoSettings", RSK_MAX, [&](size_t i) {
int value = 0; int value = 0;
SaveManager::Instance->LoadData("", value); SaveManager::Instance->LoadData("", value);
randoContext->GetOption(RandomizerSettingKey(i)).SetSelectedIndex(value); randoContext->GetOption(RandomizerSettingKey(i)).SetContextIndex(value);
}); });
SaveManager::Instance->LoadArray("hintLocations", RH_ZR_OPEN_GROTTO_GOSSIP_STONE + 1, [&](size_t i) { SaveManager::Instance->LoadArray("hintLocations", RH_ZR_OPEN_GROTTO_GOSSIP_STONE + 1, [&](size_t i) {
@ -435,7 +435,7 @@ void SaveManager::LoadRandomizerVersion3() {
SaveManager::Instance->LoadArray("randoSettings", RSK_MAX, [&](size_t i) { SaveManager::Instance->LoadArray("randoSettings", RSK_MAX, [&](size_t i) {
int value = 0; int value = 0;
SaveManager::Instance->LoadData("", value); SaveManager::Instance->LoadData("", value);
randoContext->GetOption(RandomizerSettingKey(i)).SetSelectedIndex(value); randoContext->GetOption(RandomizerSettingKey(i)).SetContextIndex(value);
}); });
SaveManager::Instance->LoadArray("hintLocations", RH_MAX, [&](size_t i) { SaveManager::Instance->LoadArray("hintLocations", RH_MAX, [&](size_t i) {
@ -464,7 +464,7 @@ void SaveManager::LoadRandomizerVersion3() {
}); });
randoContext->GetTrials()->SkipAll(); randoContext->GetTrials()->SkipAll();
SaveManager::Instance->LoadArray("requiredTrials", randoContext->GetOption(RSK_TRIAL_COUNT).GetSelectedOptionIndex()+1, [&](size_t i) { SaveManager::Instance->LoadArray("requiredTrials", randoContext->GetOption(RSK_TRIAL_COUNT).GetContextOptionIndex() + 1, [&](size_t i) {
size_t trialId; size_t trialId;
SaveManager::Instance->LoadData("", trialId); SaveManager::Instance->LoadData("", trialId);
randoContext->GetTrial(trialId)->SetAsRequired(); randoContext->GetTrial(trialId)->SetAsRequired();
@ -513,7 +513,7 @@ void SaveManager::SaveRandomizer(SaveContext* saveContext, int sectionID, bool f
SaveManager::Instance->SaveData("finalSeed", randoContext->GetSettings()->GetSeed()); SaveManager::Instance->SaveData("finalSeed", randoContext->GetSettings()->GetSeed());
SaveManager::Instance->SaveArray("randoSettings", RSK_MAX, [&](size_t i) { SaveManager::Instance->SaveArray("randoSettings", RSK_MAX, [&](size_t i) {
SaveManager::Instance->SaveData("", randoContext->GetOption((RandomizerSettingKey(i))).GetSelectedOptionIndex()); SaveManager::Instance->SaveData("", randoContext->GetOption((RandomizerSettingKey(i))).GetContextOptionIndex());
}); });
SaveManager::Instance->SaveArray("hintLocations", RH_MAX, [&](size_t i) { SaveManager::Instance->SaveArray("hintLocations", RH_MAX, [&](size_t i) {