Rando: Starting Age fixes (#1755)

* Updated starting age restrictions;
patched specific circumstances in 3d rando

* cleanup some testing stuff

* whoops

* become Sherlock Holmes; tooltip cleanup

* Explicit logic for forcing child age

* Apply bria's suggestion

Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>

Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
This commit is contained in:
Ralphie Morell 2022-10-20 23:22:58 -04:00 committed by GitHub
parent dbd5585e15
commit 262e036c22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 8 deletions

View File

@ -1860,6 +1860,16 @@ namespace Settings {
StartingAge.Unlock();
}
//Adult is also not compatible with the following combination:
//DoT:Intended, ShuffleOcarinas:false, Logic:Glitchless
if (OpenDoorOfTime.Is(OPENDOOROFTIME_INTENDED) && !ShuffleOcarinas &&
Logic.Is(LOGIC_GLITCHLESS)) {
StartingAge.SetSelectedIndex(AGE_CHILD);
StartingAge.Lock();
} else {
StartingAge.Unlock();
}
//Only show stone count option if Stones is selected
if (Bridge.Is(RAINBOWBRIDGE_STONES)) {
BridgeStoneCount.Unhide();
@ -2741,9 +2751,11 @@ namespace Settings {
int choice = Random(0, 2); //50% chance of each
if (choice == 0) {
ResolvedStartingAge = AGE_CHILD;
StartingAge.SetSelectedIndex(AGE_CHILD);
}
else {
ResolvedStartingAge = AGE_ADULT;
StartingAge.SetSelectedIndex(AGE_ADULT);
}
}
else {

View File

@ -3731,9 +3731,7 @@ void GenerateRandomizerImgui() {
cvarSettings[RSK_KAK_GATE] = CVar_GetS32("gRandomizeKakarikoGate", 0);
cvarSettings[RSK_DOOR_OF_TIME] = CVar_GetS32("gRandomizeDoorOfTime", 0);
cvarSettings[RSK_ZORAS_FOUNTAIN] = CVar_GetS32("gRandomizeZorasFountain", 0);
//Starting Age is forced to child if forest setting is set to closed. (0 = Child, 1 = Adult)
cvarSettings[RSK_STARTING_AGE] = ((CVar_GetS32("gRandomizeForest", 0)) &&
(CVar_GetS32("gRandomizeStartingAge", 0)));
cvarSettings[RSK_STARTING_AGE] = CVar_GetS32("gRandomizeStartingAge", 0);
cvarSettings[RSK_GERUDO_FORTRESS] = CVar_GetS32("gRandomizeGerudoFortress", 0);
cvarSettings[RSK_RAINBOW_BRIDGE] = CVar_GetS32("gRandomizeRainbowBridge", 0);
cvarSettings[RSK_RAINBOW_BRIDGE_STONE_COUNT] = CVar_GetS32("gRandomizeStoneCount", 3);
@ -4043,14 +4041,19 @@ void DrawRandoEditor(bool& open) {
ImGui::PushItemWidth(-FLT_MIN);
//Starting Age
//Disabled when Forest is set to Closed
bool disableRandoStartingAge = !CVar_GetS32("gRandomizeForest", 0);
const char* disableRandoStartingAgeText = "This option is disabled because \"Forest\" is set to \"Closed\".";
//Disabled when Forest is set to Closed or under very specific conditions
//RANDOTODO: Replace magic number checks with enums
bool disableRandoStartingAge = (CVar_GetS32("gRandomizeLogicRules", 0) == 0) && // glitchless logic
((CVar_GetS32("gRandomizeForest", 0) == 0) || // Closed Forest
((CVar_GetS32("gRandomizeDoorOfTime", 0) == 0) && // Closed Door of Time
(CVar_GetS32("gRandomizeShuffleOcarinas", 0) == 0))); // ocarinas not shuffled
const char* disableRandoStartingAgeText = "This option is disabled due to other options making the game unbeatable.";
ImGui::Text(Settings::StartingAge.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Choose which age Link will start as.\n\n"
"Starting as adult means you start with the Master Sword in your inventory.\n"
"Only the child option is compatible with Closed Forest."
"The child option is forcefully set if it would conflict with other options."
);
if (disableRandoStartingAge) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);

View File

@ -376,9 +376,11 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
gSaveContext.entranceIndex = 0x5F4;
gSaveContext.savedSceneNum = SCENE_SPOT20; //Set scene num manually to ToT
break;
default: //Child
case 0: //Child
gSaveContext.linkAge = 1;
break;
default:
break;
}
int doorOfTime = Randomizer_GetSettingValue(RSK_DOOR_OF_TIME);