mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 17:32:19 -05:00
adjust closed forest and starting age settings for edge cases (#2421)
This commit is contained in:
parent
44f963e310
commit
4e08eca1b9
@ -2965,6 +2965,13 @@ namespace Settings {
|
||||
trials[i]->SetAsRequired();
|
||||
}
|
||||
|
||||
// If any ER option is on that would allow you to escape forest, then we should set closed forest to closed deku
|
||||
if (OpenForest.Is(OPENFOREST_CLOSED) &&
|
||||
(ShuffleInteriorEntrances.Is(SHUFFLEINTERIORS_ALL) || ShuffleOverworldEntrances || ShuffleOverworldSpawns ||
|
||||
DecoupleEntrances || MixedEntrancePools)) {
|
||||
OpenForest.SetSelectedIndex(OPENFOREST_CLOSED_DEKU);
|
||||
}
|
||||
|
||||
if (StartingAge.Is(AGE_RANDOM)) {
|
||||
int choice = Random(0, 2); //50% chance of each
|
||||
if (choice == 0) {
|
||||
|
@ -3168,11 +3168,9 @@ void DrawRandoEditor(bool& open) {
|
||||
|
||||
//Starting Age
|
||||
//Disabled when Forest is set to Closed or under very specific conditions
|
||||
//RANDOTODO: Replace magic number checks with enums
|
||||
bool disableRandoStartingAge = (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) &&
|
||||
((CVarGetInteger("gRandomizeForest", RO_FOREST_CLOSED) == RO_FOREST_CLOSED) ||
|
||||
bool disableRandoStartingAge = CVarGetInteger("gRandomizeForest", RO_FOREST_CLOSED) == RO_FOREST_CLOSED ||
|
||||
((CVarGetInteger("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED) &&
|
||||
(CVarGetInteger("gRandomizeShuffleOcarinas", 0) == 0))); // ocarinas not shuffled
|
||||
(CVarGetInteger("gRandomizeShuffleOcarinas", RO_GENERIC_OFF) == RO_GENERIC_OFF)); // closed door of time with ocarina shuffle off
|
||||
|
||||
static const char* disableRandoStartingAgeText = "This option is disabled due to other options making the game unbeatable.";
|
||||
ImGui::Text(Settings::StartingAge.GetName().c_str());
|
||||
@ -3181,19 +3179,7 @@ void DrawRandoEditor(bool& open) {
|
||||
"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."
|
||||
);
|
||||
if (disableRandoStartingAge) {
|
||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
||||
}
|
||||
UIWidgets::EnhancementCombobox("gRandomizeStartingAge", randoStartingAge, RO_AGE_MAX, RO_AGE_CHILD);
|
||||
if (disableRandoStartingAge) {
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||
ImGui::SetTooltip("%s", disableRandoStartingAgeText);
|
||||
}
|
||||
CVarSetInteger("gRandomizeStartingAge", RO_AGE_CHILD);
|
||||
ImGui::PopStyleVar(1);
|
||||
ImGui::PopItemFlag();
|
||||
}
|
||||
UIWidgets::EnhancementCombobox("gRandomizeStartingAge", randoStartingAge, RO_AGE_MAX, RO_AGE_CHILD, disableRandoStartingAge, disableRandoStartingAgeText, RO_AGE_CHILD);
|
||||
|
||||
UIWidgets::PaddedSeparator();
|
||||
|
||||
|
@ -245,11 +245,17 @@ namespace UIWidgets {
|
||||
}
|
||||
}
|
||||
|
||||
bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue) {
|
||||
bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue, bool disabled, const char* disabledTooltipText, uint8_t disabledValue) {
|
||||
bool changed = false;
|
||||
if (FirstTimeValue <= 0) {
|
||||
FirstTimeValue = 0;
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
||||
}
|
||||
|
||||
uint8_t selected = CVarGetInteger(name, FirstTimeValue);
|
||||
uint8_t DefaultValue = selected;
|
||||
std::string comboName = std::string("##") + std::string(name);
|
||||
@ -266,6 +272,21 @@ namespace UIWidgets {
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
ImGui::PopStyleVar(1);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
|
||||
ImGui::SetTooltip("%s", disabledTooltipText);
|
||||
}
|
||||
ImGui::PopItemFlag();
|
||||
|
||||
if (disabledValue >= 0 && selected != disabledValue) {
|
||||
CVarSetInteger(name, disabledValue);
|
||||
changed = true;
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace UIWidgets {
|
||||
bool EnhancementCheckbox(const char* text, const char* cvarName, bool disabled = false, const char* disabledTooltipText = "", CheckboxGraphics disabledGraphic = CheckboxGraphics::Cross, bool defaultValue = false);
|
||||
bool PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "", CheckboxGraphics disabledGraphic = CheckboxGraphics::Cross, bool defaultValue = false);
|
||||
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue = 0);
|
||||
bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue);
|
||||
bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue, bool disabled = false, const char* disabledTooltipText = "", uint8_t disabledValue = -1);
|
||||
void PaddedText(const char* text, bool padTop = true, bool padBottom = true);
|
||||
bool EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false, bool disabled = false, const char* disabledTooltipText = "");
|
||||
void PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "");
|
||||
|
Loading…
Reference in New Issue
Block a user