Automate settings text to enum conversion and remove OptionGroups from the process (#4636)

* Automate settings text to enum conversion

* rename fortress setting into carpenters
This commit is contained in:
Pepper0ni 2024-12-10 02:18:00 +00:00 committed by GitHub
parent 6470522a02
commit ad23298500
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 196 additions and 991 deletions

View File

@ -1026,7 +1026,7 @@ void GenerateItemPool() {
} }
//Gerudo Fortress //Gerudo Fortress
if (ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_OPEN)) { if (ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_FREE)) {
ctx->PlaceItemInLocation(RC_GF_NORTH_F1_CARPENTER, RG_RECOVERY_HEART, false, true); ctx->PlaceItemInLocation(RC_GF_NORTH_F1_CARPENTER, RG_RECOVERY_HEART, false, true);
ctx->PlaceItemInLocation(RC_GF_NORTH_F2_CARPENTER, RG_RECOVERY_HEART, false, true); ctx->PlaceItemInLocation(RC_GF_NORTH_F2_CARPENTER, RG_RECOVERY_HEART, false, true);
ctx->PlaceItemInLocation(RC_GF_SOUTH_F1_CARPENTER, RG_RECOVERY_HEART, false, true); ctx->PlaceItemInLocation(RC_GF_SOUTH_F1_CARPENTER, RG_RECOVERY_HEART, false, true);
@ -1071,7 +1071,7 @@ void GenerateItemPool() {
} }
//Gerudo Membership Card //Gerudo Membership Card
if (ctx->GetOption(RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD) && ctx->GetOption(RSK_GERUDO_FORTRESS).IsNot(RO_GF_OPEN)) { if (ctx->GetOption(RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD) && ctx->GetOption(RSK_GERUDO_FORTRESS).IsNot(RO_GF_FREE)) {
AddItemToMainPool(RG_GERUDO_MEMBERSHIP_CARD); AddItemToMainPool(RG_GERUDO_MEMBERSHIP_CARD);
ctx->possibleIceTrapModels.push_back(RG_GERUDO_MEMBERSHIP_CARD); ctx->possibleIceTrapModels.push_back(RG_GERUDO_MEMBERSHIP_CARD);
} else if (ctx->GetOption(RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD)) { } else if (ctx->GetOption(RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD)) {

View File

@ -16,7 +16,7 @@ void RegionTable_Init_GerudoValley() {
Entrance(RR_GV_UPPER_STREAM, {[]{return true;}}), Entrance(RR_GV_UPPER_STREAM, {[]{return true;}}),
Entrance(RR_GV_CRATE_LEDGE, {[]{return logic->IsChild || logic->CanUse(RG_LONGSHOT);}}), Entrance(RR_GV_CRATE_LEDGE, {[]{return logic->IsChild || logic->CanUse(RG_LONGSHOT);}}),
Entrance(RR_GV_GROTTO_LEDGE, {[]{return true;}}), Entrance(RR_GV_GROTTO_LEDGE, {[]{return true;}}),
Entrance(RR_GV_FORTRESS_SIDE, {[]{return (logic->IsAdult && (logic->CanUse(RG_EPONA) || logic->CanUse(RG_LONGSHOT) || ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_OPEN) || logic->CarpenterRescue)) || (logic->IsChild && logic->CanUse(RG_HOOKSHOT));}}), Entrance(RR_GV_FORTRESS_SIDE, {[]{return (logic->IsAdult && (logic->CanUse(RG_EPONA) || logic->CanUse(RG_LONGSHOT) || ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_FREE) || logic->CarpenterRescue)) || (logic->IsChild && logic->CanUse(RG_HOOKSHOT));}}),
}); });
areaTable[RR_GV_UPPER_STREAM] = Region("GV Upper Stream", "Gerudo Valley", {RA_GERUDO_VALLEY}, DAY_NIGHT_CYCLE, { areaTable[RR_GV_UPPER_STREAM] = Region("GV Upper Stream", "Gerudo Valley", {RA_GERUDO_VALLEY}, DAY_NIGHT_CYCLE, {
@ -64,7 +64,7 @@ void RegionTable_Init_GerudoValley() {
//Exits //Exits
Entrance(RR_GERUDO_FORTRESS, {[]{return true;}}), Entrance(RR_GERUDO_FORTRESS, {[]{return true;}}),
Entrance(RR_GV_UPPER_STREAM, {[]{return true;}}), Entrance(RR_GV_UPPER_STREAM, {[]{return true;}}),
Entrance(RR_GERUDO_VALLEY, {[]{return logic->IsChild || logic->CanUse(RG_EPONA) || logic->CanUse(RG_LONGSHOT) || ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_OPEN) || logic->CarpenterRescue;}}), Entrance(RR_GERUDO_VALLEY, {[]{return logic->IsChild || logic->CanUse(RG_EPONA) || logic->CanUse(RG_LONGSHOT) || ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_FREE) || logic->CarpenterRescue;}}),
Entrance(RR_GV_CARPENTER_TENT, {[]{return logic->IsAdult;}}), Entrance(RR_GV_CARPENTER_TENT, {[]{return logic->IsAdult;}}),
Entrance(RR_GV_STORMS_GROTTO, {[]{return logic->IsAdult && logic->CanOpenStormsGrotto();}}), Entrance(RR_GV_STORMS_GROTTO, {[]{return logic->IsAdult && logic->CanOpenStormsGrotto();}}),
Entrance(RR_GV_CRATE_LEDGE, {[]{return false;}}), Entrance(RR_GV_CRATE_LEDGE, {[]{return false;}}),

View File

@ -139,14 +139,11 @@ static void WriteShuffledEntrance(std::string sphereString, Entrance* entrance)
// Writes the settings (without excluded locations, starting inventory and tricks) to the spoilerLog document. // Writes the settings (without excluded locations, starting inventory and tricks) to the spoilerLog document.
static void WriteSettings() { static void WriteSettings() {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
auto allOptionGroups = ctx->GetSettings()->GetOptionGroups(); std::array<Rando::Option, RSK_MAX> options = ctx->GetSettings()->GetAllOptions();
for (const Rando::OptionGroup& optionGroup : allOptionGroups) { for (const Rando::Option& option : options) {
if (optionGroup.GetContainsType() == Rando::OptionGroupType::DEFAULT && optionGroup.PrintInSpoiler()) { if (option.GetName() != ""){
for (Rando::Option* option : optionGroup.GetOptions()) { jsonData["settings"][option.GetName()] = option.GetSelectedOptionText();
std::string settingName = optionGroup.GetName() + ":" + option->GetName(); }
jsonData["settings"][settingName] = option->GetSelectedOptionText();
}
}
} }
} }

View File

@ -61,7 +61,7 @@ void GenerateStartingInventory() {
AddItemToInventory(RG_GANONS_CASTLE_BOSS_KEY); AddItemToInventory(RG_GANONS_CASTLE_BOSS_KEY);
} }
if (ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_OPEN) && !ctx->GetOption(RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD)) { if (ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_FREE) && !ctx->GetOption(RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD)) {
AddItemToInventory(RG_GERUDO_MEMBERSHIP_CARD); AddItemToInventory(RG_GERUDO_MEMBERSHIP_CARD);
} }

View File

@ -1124,7 +1124,7 @@ namespace Rando {
bool Logic::CanFinishGerudoFortress(){ bool Logic::CanFinishGerudoFortress(){
return (ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_NORMAL) && SmallKeys(RR_GERUDO_FORTRESS, 4) && (CanUse(RG_KOKIRI_SWORD) || CanUse(RG_MASTER_SWORD) || CanUse(RG_BIGGORON_SWORD)) && (HasItem(RG_GERUDO_MEMBERSHIP_CARD) || CanUse(RG_FAIRY_BOW) || CanUse(RG_HOOKSHOT) || CanUse(RG_HOVER_BOOTS) || ctx->GetTrickOption(RT_GF_KITCHEN))) || return (ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_NORMAL) && SmallKeys(RR_GERUDO_FORTRESS, 4) && (CanUse(RG_KOKIRI_SWORD) || CanUse(RG_MASTER_SWORD) || CanUse(RG_BIGGORON_SWORD)) && (HasItem(RG_GERUDO_MEMBERSHIP_CARD) || CanUse(RG_FAIRY_BOW) || CanUse(RG_HOOKSHOT) || CanUse(RG_HOVER_BOOTS) || ctx->GetTrickOption(RT_GF_KITCHEN))) ||
(ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_FAST) && SmallKeys(RR_GERUDO_FORTRESS, 1) && (CanUse(RG_KOKIRI_SWORD) || CanUse(RG_MASTER_SWORD) || CanUse(RG_BIGGORON_SWORD))) || (ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_FAST) && SmallKeys(RR_GERUDO_FORTRESS, 1) && (CanUse(RG_KOKIRI_SWORD) || CanUse(RG_MASTER_SWORD) || CanUse(RG_BIGGORON_SWORD))) ||
ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_OPEN); ctx->GetOption(RSK_GERUDO_FORTRESS).Is(RO_GF_FREE);
} }
bool Logic::CanStandingShield(){ bool Logic::CanStandingShield(){

View File

@ -178,6 +178,15 @@ void Option::RemoveFlag(const int imFlag_) {
imFlags &= ~imFlag_; imFlags &= ~imFlag_;
} }
void Option::SetContextIndexFromText(const std::string text) {
if (optionsTextToVar.contains(text)){
SetContextIndex(optionsTextToVar[text]);
} else {
SPDLOG_ERROR("Option {} does not have a var named {}.", name, text);
assert(false);
}
}
Option::Option(uint8_t var_, std::string name_, std::vector<std::string> options_, OptionCategory category_, Option::Option(uint8_t var_, std::string name_, std::vector<std::string> options_, OptionCategory category_,
std::string cvarName_, std::string description_, WidgetType widgetType_, uint8_t defaultOption_, std::string cvarName_, std::string description_, WidgetType widgetType_, uint8_t defaultOption_,
bool defaultHidden_, int imFlags_) bool defaultHidden_, int imFlags_)
@ -186,6 +195,7 @@ Option::Option(uint8_t var_, std::string name_, std::vector<std::string> options
defaultOption(defaultOption_), defaultHidden(defaultHidden_), imFlags(imFlags_) { defaultOption(defaultOption_), defaultHidden(defaultHidden_), imFlags(imFlags_) {
menuSelection = contextSelection = defaultOption; menuSelection = contextSelection = defaultOption;
hidden = defaultHidden; hidden = defaultHidden;
PopulateTextToNum();
SetFromCVar(); SetFromCVar();
} }
Option::Option(bool var_, std::string name_, std::vector<std::string> options_, const OptionCategory category_, Option::Option(bool var_, std::string name_, std::vector<std::string> options_, const OptionCategory category_,
@ -196,6 +206,7 @@ Option::Option(bool var_, std::string name_, std::vector<std::string> options_,
defaultOption(defaultOption_), defaultHidden(defaultHidden_), imFlags(imFlags_) { defaultOption(defaultOption_), defaultHidden(defaultHidden_), imFlags(imFlags_) {
menuSelection = contextSelection = defaultOption; menuSelection = contextSelection = defaultOption;
hidden = defaultHidden; hidden = defaultHidden;
PopulateTextToNum();
SetFromCVar(); SetFromCVar();
} }
@ -333,6 +344,12 @@ bool Option::RenderSlider() {
return changed; return changed;
} }
void Option::PopulateTextToNum(){
for (uint8_t count = 0; count < options.size(); count++){
optionsTextToVar[options[count]] = count;
}
}
TrickOption::TrickOption(const RandomizerCheckQuest quest_, const RandomizerArea area_, std::set<Tricks::Tag> tags_, const bool glitch_, const std::string& name_, std::string description_) : TrickOption::TrickOption(const RandomizerCheckQuest quest_, const RandomizerArea area_, std::set<Tricks::Tag> tags_, const bool glitch_, const std::string& name_, std::string description_) :
Option(false, name_, {"Disabled", "Enabled"}, OptionCategory::Setting, "", Option(false, name_, {"Disabled", "Enabled"}, OptionCategory::Setting, "",
std::move(description_), WidgetType::Checkbox, 0, false, IMFLAG_NONE), std::move(description_), WidgetType::Checkbox, 0, false, IMFLAG_NONE),
@ -363,26 +380,26 @@ const std::set<Tricks::Tag>& TrickOption::GetTags() const {
} }
OptionGroup::OptionGroup(std::string name, std::vector<Option*> options, const OptionGroupType groupType, OptionGroup::OptionGroup(std::string name, std::vector<Option*> options, const OptionGroupType groupType,
const bool printInSpoiler, const WidgetContainerType containerType, std::string description) const WidgetContainerType containerType, std::string description)
: mName(std::move(name)), mOptions(std::move(options)), mGroupType(groupType), mPrintInSpoiler(printInSpoiler), : mName(std::move(name)), mOptions(std::move(options)), mGroupType(groupType),
mContainerType(containerType), mDescription(std::move(description)) { mContainerType(containerType), mDescription(std::move(description)) {
} }
OptionGroup::OptionGroup(std::string name, std::vector<OptionGroup*> subGroups, const OptionGroupType groupType, OptionGroup::OptionGroup(std::string name, std::vector<OptionGroup*> subGroups, const OptionGroupType groupType,
const bool printInSpoiler, const WidgetContainerType containerType, std::string description) const WidgetContainerType containerType, std::string description)
: mName(std::move(name)), mSubGroups(std::move(subGroups)), mGroupType(groupType), mPrintInSpoiler(printInSpoiler), : mName(std::move(name)), mSubGroups(std::move(subGroups)), mGroupType(groupType),
mContainsType(OptionGroupType::SUBGROUP), mContainerType(containerType), mDescription(std::move(description)) { mContainsType(OptionGroupType::SUBGROUP), mContainerType(containerType), mDescription(std::move(description)) {
} }
OptionGroup OptionGroup::SubGroup(std::string name, std::vector<Option*> options, const bool printInSpoiler, OptionGroup OptionGroup::SubGroup(std::string name, std::vector<Option*> options,
const WidgetContainerType containerType, std::string description) { const WidgetContainerType containerType, std::string description) {
return {std::move(name), std::move(options), OptionGroupType::SUBGROUP, printInSpoiler, containerType, return {std::move(name), std::move(options), OptionGroupType::SUBGROUP, containerType,
std::move(description)}; std::move(description)};
} }
OptionGroup OptionGroup::SubGroup(std::string name, std::vector<OptionGroup*> subGroups, const bool printInSpoiler, OptionGroup OptionGroup::SubGroup(std::string name, std::vector<OptionGroup*> subGroups,
const WidgetContainerType containerType, std::string description) { const WidgetContainerType containerType, std::string description) {
return {std::move(name), std::move(subGroups), OptionGroupType::SUBGROUP, printInSpoiler, containerType, return {std::move(name), std::move(subGroups), OptionGroupType::SUBGROUP, containerType,
std::move(description)}; std::move(description)};
} }
@ -398,10 +415,6 @@ const std::vector<OptionGroup*>& OptionGroup::GetSubGroups() const {
return mSubGroups; return mSubGroups;
} }
bool OptionGroup::PrintInSpoiler() const {
return mPrintInSpoiler;
}
OptionGroupType OptionGroup::GetGroupType() const { OptionGroupType OptionGroup::GetGroupType() const {
return mGroupType; return mGroupType;
} }

View File

@ -56,9 +56,9 @@ class Option {
* @param options_ A vector of value names for this Option. This vector should have a size of 2. * @param options_ A vector of value names for this Option. This vector should have a size of 2.
* The name corresponding to the selected index for this option will be printed to the spoiler/patch file. * The name corresponding to the selected index for this option will be printed to the spoiler/patch file.
* @param category_ The desired `OptionCategory` for this option. * @param category_ The desired `OptionCategory` for this option.
* @param cvarName_ The name ofthe CVar this option should correspond with. Set as an empty string to not * @param cvarName_ The name of the CVar this option should correspond with. Set as an empty string to not
* link to any Cvar. * link to any Cvar.
* @param description_ A description of what this option affects. Will be rendered in a toolip in ImGui. * @param description_ A description of what this option affects. Will be rendered in a tooltip in ImGui.
* Can be left as an empty string if desired, no tooltip will be rendered. * Can be left as an empty string if desired, no tooltip will be rendered.
* @param widgetType_ What type of widget should be rendered. Should probably be `Checkbox` but technically * @param widgetType_ What type of widget should be rendered. Should probably be `Checkbox` but technically
* `Combobox` or `Slider` would render and function correctly. * `Combobox` or `Slider` would render and function correctly.
@ -305,6 +305,8 @@ class Option {
void SetFlag(int imFlag_); void SetFlag(int imFlag_);
void RemoveFlag(int imFlag_); void RemoveFlag(int imFlag_);
void SetContextIndexFromText(std::string text);
protected: protected:
Option(uint8_t var_, std::string name_, std::vector<std::string> options_, OptionCategory category_, Option(uint8_t var_, std::string name_, std::vector<std::string> options_, OptionCategory category_,
std::string cvarName_, std::string description_, WidgetType widgetType_, uint8_t defaultOption_, std::string cvarName_, std::string description_, WidgetType widgetType_, uint8_t defaultOption_,
@ -318,6 +320,7 @@ protected:
bool RenderTristateCheckbox(); bool RenderTristateCheckbox();
bool RenderCombobox(); bool RenderCombobox();
bool RenderSlider(); bool RenderSlider();
void PopulateTextToNum();
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;
@ -335,6 +338,7 @@ protected:
bool disabled = false; bool disabled = false;
UIWidgets::CheckboxGraphics disabledGraphic = UIWidgets::CheckboxGraphics::Cross; UIWidgets::CheckboxGraphics disabledGraphic = UIWidgets::CheckboxGraphics::Cross;
std::string disabledText; std::string disabledText;
std::unordered_map<std::string, uint8_t> optionsTextToVar = {};
}; };
class TrickOption : public Option { class TrickOption : public Option {
@ -416,13 +420,11 @@ class OptionGroup {
* @param options A vector of Option pointers * @param options A vector of Option pointers
* @param groupType `DEFAULT` if this group is not contained within any other groups, `SUBGROUP` if it is a * @param groupType `DEFAULT` if this group is not contained within any other groups, `SUBGROUP` if it is a
* subgroup of another group. * subgroup of another group.
* @param printInSpoiler Whether or not to print the contents of this group to the spoiler/patch file.
* @param containerType Specifies the type of container this widget should render as in ImGui. * @param containerType Specifies the type of container this widget should render as in ImGui.
* @param description A description that can appear in a tooltip in ImGui. * @param description A description that can appear in a tooltip in ImGui.
*/ */
OptionGroup(std::string name, std::vector<Option*> options, OptionGroupType groupType = OptionGroupType::DEFAULT, OptionGroup(std::string name, std::vector<Option*> options, OptionGroupType groupType = OptionGroupType::DEFAULT,
bool printInSpoiler = true, WidgetContainerType containerType = WidgetContainerType::BASIC, WidgetContainerType containerType = WidgetContainerType::BASIC, std::string description = "");
std::string description = "");
/** /**
* @brief Construct a new Option Group containing a list of `OptionGroup` pointers. * @brief Construct a new Option Group containing a list of `OptionGroup` pointers.
@ -431,13 +433,11 @@ class OptionGroup {
* @param subGroups A vector of OptionGroup pointers that will be subgroups of this group. * @param subGroups A vector of OptionGroup pointers that will be subgroups of this group.
* @param groupType `DEFAULT` if this group is not contained within any other groups, `SUBGROUP` if it is a * @param groupType `DEFAULT` if this group is not contained within any other groups, `SUBGROUP` if it is a
* subgroup of another group. * subgroup of another group.
* @param printInSpoiler Whether or not to print the contents of this group to spoiler/patch file.
* @param containerType Specifies the type of container this widget should render as in ImGui. * @param containerType Specifies the type of container this widget should render as in ImGui.
* @param description A description that can appear in a tooltip in ImGui. * @param description A description that can appear in a tooltip in ImGui.
*/ */
OptionGroup(std::string name, std::vector<OptionGroup*> subGroups, OptionGroupType groupType = OptionGroupType::DEFAULT, OptionGroup(std::string name, std::vector<OptionGroup*> subGroups, OptionGroupType groupType = OptionGroupType::DEFAULT,
bool printInSpoiler = true, WidgetContainerType containerType = WidgetContainerType::BASIC, WidgetContainerType containerType = WidgetContainerType::BASIC, std::string description = "");
std::string description = "");
/** /**
* @brief Convenience function for constructing an OptionGroup of groupType `SUBGROUP` with * @brief Convenience function for constructing an OptionGroup of groupType `SUBGROUP` with
@ -445,13 +445,11 @@ class OptionGroup {
* *
* @param name The name of this option group. Appears in the spoiler/patch file. * @param name The name of this option group. Appears in the spoiler/patch file.
* @param options A vector of Option pointers. * @param options A vector of Option pointers.
* @param printInSpoiler Whether or not to print the options of this group to the spoiler/patch file.
* @param containerType Specifies the type of container this widget should render as in ImGui. * @param containerType Specifies the type of container this widget should render as in ImGui.
* @param description A description that can appear in a tooltip in ImGui. * @param description A description that can appear in a tooltip in ImGui.
* @return OptionGroup * @return OptionGroup
*/ */
static OptionGroup SubGroup(std::string name, std::vector<Option*> options, bool printInSpoiler = true, static OptionGroup SubGroup(std::string name, std::vector<Option*> options, WidgetContainerType containerType = WidgetContainerType::BASIC,
WidgetContainerType containerType = WidgetContainerType::BASIC,
std::string description = ""); std::string description = "");
/** /**
@ -460,13 +458,11 @@ class OptionGroup {
* *
* @param name The name of this option group. Appears in the spoiler/patch file. * @param name The name of this option group. Appears in the spoiler/patch file.
* @param subGroups A vector of OptionGroup pointers. * @param subGroups A vector of OptionGroup pointers.
* @param printInSpoiler Whether or not to print the options of this group to the spoiler/patch file.
* @param containerType Specifies the type of container this widget should render as in ImGui. * @param containerType Specifies the type of container this widget should render as in ImGui.
* @param description A description that can appear in a tooltip in ImGui. * @param description A description that can appear in a tooltip in ImGui.
* @return OptionGroup * @return OptionGroup
*/ */
static OptionGroup SubGroup(std::string name, std::vector<OptionGroup*> subGroups, bool printInSpoiler = true, static OptionGroup SubGroup(std::string name, std::vector<OptionGroup*> subGroups, WidgetContainerType containerType = WidgetContainerType::BASIC,
WidgetContainerType containerType = WidgetContainerType::BASIC,
std::string description = ""); std::string description = "");
/** /**
@ -490,15 +486,6 @@ class OptionGroup {
*/ */
const std::vector<OptionGroup*>& GetSubGroups() const; const std::vector<OptionGroup*>& GetSubGroups() const;
/**
* @brief Returns whether or not this `OptionGroup`'s contents should be printed to the
* spoiler/patch file.
*
* @return true
* @return false
*/
bool PrintInSpoiler() const;
/** /**
* @brief Get the Group Type of this `OptionGroup`. `DEFAULT` means this group is not contained * @brief Get the Group Type of this `OptionGroup`. `DEFAULT` means this group is not contained
* within any other groups, while `SUBGROUP` means that it is contained within at least one other. * within any other groups, while `SUBGROUP` means that it is contained within at least one other.
@ -532,7 +519,6 @@ class OptionGroup {
std::vector<Option*> mOptions; std::vector<Option*> mOptions;
std::vector<OptionGroup*> mSubGroups; std::vector<OptionGroup*> mSubGroups;
OptionGroupType mGroupType = OptionGroupType::DEFAULT; OptionGroupType mGroupType = OptionGroupType::DEFAULT;
bool mPrintInSpoiler = true;
OptionGroupType mContainsType = OptionGroupType::DEFAULT; OptionGroupType mContainsType = OptionGroupType::DEFAULT;
WidgetContainerType mContainerType = WidgetContainerType::BASIC; WidgetContainerType mContainerType = WidgetContainerType::BASIC;
std::string mDescription; std::string mDescription;

View File

@ -43,14 +43,15 @@ void Settings::CreateOptionDescriptions() {
"Choose which age Link will start as.\n\n" "Choose which age Link will start as.\n\n"
"Starting as adult means you start with the Master Sword in your inventory.\n" "Starting as adult means you start with the Master Sword in your inventory.\n"
"The child option is forcefully set if it would conflict with other options."; "The child option is forcefully set if it would conflict with other options.";
mOptionDescriptions[RSK_GERUDO_FORTRESS] = "Sets the amount of carpenters required to repair the bridge " mOptionDescriptions[RSK_GERUDO_FORTRESS] = "Sets the state of the carpenters captured by Gerudo "
"in Gerudo Valley.\n" "in Gerudo Fortress, and with it the number of guards that spawn.\n"
"\n" "\n"
"Normal - All 4 carpenters are required to be saved.\n" "Normal - All 4 carpenters are required to be saved.\n"
"\n" "\n"
"Fast - Only the bottom left carpenter requires rescuing.\n" "Fast - Only the bottom left carpenter requires rescuing.\n"
"\n" "\n"
"Open - The bridge is repaired from the start.\n" "Free - The bridge is repaired from the start, and Nabooru cannot spawn.\n"
"If the Gerudo Membership Card isn't shuffled, you start with it.\n"
"\n" "\n"
"Only \"Normal\" is compatible with Gerudo Fortress Key Rings."; "Only \"Normal\" is compatible with Gerudo Fortress Key Rings.";
mOptionDescriptions[RSK_RAINBOW_BRIDGE] = mOptionDescriptions[RSK_RAINBOW_BRIDGE] =

View File

@ -4198,7 +4198,7 @@ typedef enum {
typedef enum { typedef enum {
RO_GF_NORMAL, RO_GF_NORMAL,
RO_GF_FAST, RO_GF_FAST,
RO_GF_OPEN, RO_GF_FREE,
} RandoOptionGerudoFortress; } RandoOptionGerudoFortress;
//Kakariko Gate settings (closed/open) //Kakariko Gate settings (closed/open)

View File

@ -206,7 +206,7 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() {
CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) !=
RO_GANON_BOSS_KEY_KAK_TOKENS) && // 100 skull reward ganon boss key RO_GANON_BOSS_KEY_KAK_TOKENS) && // 100 skull reward ganon boss key
(location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD || (location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD ||
(CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_OPEN && (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_FREE &&
location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD) || location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD) ||
(CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_FAST && (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_FAST &&
((location.GetRandomizerCheck() == RC_GF_GERUDO_MEMBERSHIP_CARD && ((location.GetRandomizerCheck() == RC_GF_GERUDO_MEMBERSHIP_CARD &&

View File

@ -1185,7 +1185,7 @@ void LoadSettings() {
fortressFast = false; fortressFast = false;
fortressNormal = false; fortressNormal = false;
switch (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GERUDO_FORTRESS)) { switch (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GERUDO_FORTRESS)) {
case RO_GF_OPEN: case RO_GF_FREE:
showGerudoFortressKeys = false; showGerudoFortressKeys = false;
showGerudoCard = false; showGerudoCard = false;
break; break;

View File

@ -453,7 +453,7 @@ extern "C" void Randomizer_InitSaveFile() {
} }
if (Randomizer_GetSettingValue(RSK_GERUDO_FORTRESS) == RO_GF_FAST || if (Randomizer_GetSettingValue(RSK_GERUDO_FORTRESS) == RO_GF_FAST ||
Randomizer_GetSettingValue(RSK_GERUDO_FORTRESS) == RO_GF_OPEN) { Randomizer_GetSettingValue(RSK_GERUDO_FORTRESS) == RO_GF_FREE) {
Flags_SetEventChkInf(EVENTCHKINF_CARPENTERS_FREE(1)); Flags_SetEventChkInf(EVENTCHKINF_CARPENTERS_FREE(1));
Flags_SetEventChkInf(EVENTCHKINF_CARPENTERS_FREE(2)); Flags_SetEventChkInf(EVENTCHKINF_CARPENTERS_FREE(2));
Flags_SetEventChkInf(EVENTCHKINF_CARPENTERS_FREE(3)); Flags_SetEventChkInf(EVENTCHKINF_CARPENTERS_FREE(3));
@ -471,7 +471,7 @@ extern "C" void Randomizer_InitSaveFile() {
gSaveContext.sceneFlags[SCENE_THIEVES_HIDEOUT].collect |= (1 << 0x0F); gSaveContext.sceneFlags[SCENE_THIEVES_HIDEOUT].collect |= (1 << 0x0F);
} }
if (Randomizer_GetSettingValue(RSK_GERUDO_FORTRESS) == RO_GF_OPEN) { if (Randomizer_GetSettingValue(RSK_GERUDO_FORTRESS) == RO_GF_FREE) {
Flags_SetEventChkInf(EVENTCHKINF_CARPENTERS_FREE(0)); Flags_SetEventChkInf(EVENTCHKINF_CARPENTERS_FREE(0));
gSaveContext.sceneFlags[SCENE_THIEVES_HIDEOUT].swch |= (1 << 0x01); // heard yell and unlocked door gSaveContext.sceneFlags[SCENE_THIEVES_HIDEOUT].swch |= (1 << 0x01); // heard yell and unlocked door
gSaveContext.sceneFlags[SCENE_THIEVES_HIDEOUT].swch |= (1 << 0x05); gSaveContext.sceneFlags[SCENE_THIEVES_HIDEOUT].swch |= (1 << 0x05);

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,14 @@ class Settings {
*/ */
void CreateOptions(); void CreateOptions();
/**
* @brief Populates the map used to translate strings into RandomiserSettingKeys
*
* @return std::unordered_map<std::string, RandomizerSettingKey>
*/
std::unordered_map<std::string, RandomizerSettingKey> PopulateOptionNameToEnum();
/** /**
* @brief Get a reference to the `Option` corresponding to the provided RandomizerSettingKey. * @brief Get a reference to the `Option` corresponding to the provided RandomizerSettingKey.
* *
@ -192,7 +200,6 @@ class Settings {
std::array<OptionGroup, RSG_MAX> mOptionGroups = {}; std::array<OptionGroup, RSG_MAX> mOptionGroups = {};
std::array<TrickOption, RT_MAX> mTrickOptions = {}; std::array<TrickOption, RT_MAX> mTrickOptions = {};
std::vector<std::vector<Option*>> mExcludeLocationsOptionsAreas = {}; std::vector<std::vector<Option*>> mExcludeLocationsOptionsAreas = {};
std::unordered_map<std::string, RandomizerSettingKey> mSpoilerfileSettingNameToEnum;
RandoOptionStartingAge mResolvedStartingAge = RO_AGE_CHILD; RandoOptionStartingAge mResolvedStartingAge = RO_AGE_CHILD;
RandoOptionLACSCondition mLACSCondition = RO_LACS_VANILLA; RandoOptionLACSCondition mLACSCondition = RO_LACS_VANILLA;
std::string mHash; std::string mHash;

View File

@ -251,7 +251,8 @@ std::unordered_map<std::string, uint32_t> StaticData::hintNameToEnum = {};
std::unordered_map<std::string, uint32_t> StaticData::hintTypeNameToEnum = {}; std::unordered_map<std::string, uint32_t> StaticData::hintTypeNameToEnum = {};
std::unordered_map<std::string, uint32_t> StaticData::areaNameToEnum = {}; std::unordered_map<std::string, uint32_t> StaticData::areaNameToEnum = {};
std::unordered_map<std::string, uint32_t> StaticData::trialNameToEnum = {}; std::unordered_map<std::string, uint32_t> StaticData::trialNameToEnum = {};
std::unordered_map<std::string, RandomizerCheck> StaticData::locationNameToEnum = {}; //is filled in context based on location table, not touching that because of VB std::unordered_map<std::string, RandomizerSettingKey> StaticData::optionNameToEnum = {};
std::unordered_map<std::string, RandomizerCheck> StaticData::locationNameToEnum = {}; //is filled in context based on location table
std::unordered_map<u32, RandomizerHint> StaticData::stoneParamsToHint{ std::unordered_map<u32, RandomizerHint> StaticData::stoneParamsToHint{
{0x1, RH_ZF_FAIRY_GOSSIP_STONE}, {0x1, RH_ZF_FAIRY_GOSSIP_STONE},

View File

@ -61,6 +61,7 @@ class StaticData {
static std::unordered_map<std::string, uint32_t> areaNameToEnum; static std::unordered_map<std::string, uint32_t> areaNameToEnum;
static std::unordered_map<uint32_t, RandomizerHintTextKey> trialData; static std::unordered_map<uint32_t, RandomizerHintTextKey> trialData;
static std::unordered_map<std::string, uint32_t> trialNameToEnum; static std::unordered_map<std::string, uint32_t> trialNameToEnum;
static std::unordered_map<std::string, RandomizerSettingKey> optionNameToEnum;
static std::unordered_map<RandomizerHint, StaticHintInfo> staticHintInfoMap; static std::unordered_map<RandomizerHint, StaticHintInfo> staticHintInfoMap;
static std::unordered_map<u32, RandomizerHint> stoneParamsToHint; static std::unordered_map<u32, RandomizerHint> stoneParamsToHint;
static std::unordered_map<u32, RandomizerHint> grottoChestParamsToHint; static std::unordered_map<u32, RandomizerHint> grottoChestParamsToHint;