use forest enum values instead of magic numbers (#2038)

This commit is contained in:
briaguya 2022-11-29 20:32:22 -05:00 committed by GitHub
parent 17c6a3653c
commit 06df45efc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 12 deletions

View File

@ -554,7 +554,7 @@ const std::vector<PresetEntry> s6PresetEntries = {
PRESET_ENTRY_S32("gRandomizeCuccosToReturn", 4), PRESET_ENTRY_S32("gRandomizeCuccosToReturn", 4),
PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN), PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN),
PRESET_ENTRY_STRING("gRandomizeExcludedLocations", "48,"), PRESET_ENTRY_STRING("gRandomizeExcludedLocations", "48,"),
PRESET_ENTRY_S32("gRandomizeForest", 1), PRESET_ENTRY_S32("gRandomizeForest", RO_FOREST_CLOSED_DEKU),
PRESET_ENTRY_S32("gRandomizeGanonTrial", 0), PRESET_ENTRY_S32("gRandomizeGanonTrial", 0),
PRESET_ENTRY_S32("gRandomizeGerudoFortress", RO_GF_FAST), PRESET_ENTRY_S32("gRandomizeGerudoFortress", RO_GF_FAST),
PRESET_ENTRY_S32("gRandomizeIceTraps", RO_ICE_TRAPS_OFF), PRESET_ENTRY_S32("gRandomizeIceTraps", RO_ICE_TRAPS_OFF),
@ -590,7 +590,7 @@ const std::vector<PresetEntry> hellModePresetEntries = {
PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN), PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN),
PRESET_ENTRY_S32("gRandomizeEnableBombchuDrops", 1), PRESET_ENTRY_S32("gRandomizeEnableBombchuDrops", 1),
PRESET_ENTRY_S32("gRandomizeEnableGlitchCutscenes", 1), PRESET_ENTRY_S32("gRandomizeEnableGlitchCutscenes", 1),
PRESET_ENTRY_S32("gRandomizeForest", 2), PRESET_ENTRY_S32("gRandomizeForest", RO_FOREST_OPEN),
PRESET_ENTRY_S32("gRandomizeGanonTrial", 2), PRESET_ENTRY_S32("gRandomizeGanonTrial", 2),
PRESET_ENTRY_S32("gRandomizeGanonTrialCount", 6), PRESET_ENTRY_S32("gRandomizeGanonTrialCount", 6),
PRESET_ENTRY_S32("gRandomizeGerudoKeys", 3), PRESET_ENTRY_S32("gRandomizeGerudoKeys", 3),

View File

@ -596,9 +596,9 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) {
if(it.value() == "Closed") { if(it.value() == "Closed") {
gSaveContext.randoSettings[index].value = RO_FOREST_CLOSED; gSaveContext.randoSettings[index].value = RO_FOREST_CLOSED;
} else if(it.value() == "Open") { } else if(it.value() == "Open") {
gSaveContext.randoSettings[index].value = RO_FOREST_CLOSED_DEKU;
} else if(it.value() == "Closed Deku") {
gSaveContext.randoSettings[index].value = RO_FOREST_OPEN; gSaveContext.randoSettings[index].value = RO_FOREST_OPEN;
} else if(it.value() == "Closed Deku") {
gSaveContext.randoSettings[index].value = RO_FOREST_CLOSED_DEKU;
} }
break; break;
case RSK_KAK_GATE: case RSK_KAK_GATE:
@ -2566,7 +2566,7 @@ void GenerateRandomizerImgui() {
std::unordered_map<RandomizerSettingKey, u8> cvarSettings; std::unordered_map<RandomizerSettingKey, u8> cvarSettings;
cvarSettings[RSK_LOGIC_RULES] = CVar_GetS32("gRandomizeLogicRules", 0); cvarSettings[RSK_LOGIC_RULES] = CVar_GetS32("gRandomizeLogicRules", 0);
cvarSettings[RSK_FOREST] = CVar_GetS32("gRandomizeForest", 0); cvarSettings[RSK_FOREST] = CVar_GetS32("gRandomizeForest", RO_FOREST_CLOSED);
cvarSettings[RSK_KAK_GATE] = CVar_GetS32("gRandomizeKakarikoGate", RO_KAK_GATE_CLOSED); cvarSettings[RSK_KAK_GATE] = CVar_GetS32("gRandomizeKakarikoGate", RO_KAK_GATE_CLOSED);
cvarSettings[RSK_DOOR_OF_TIME] = CVar_GetS32("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED); cvarSettings[RSK_DOOR_OF_TIME] = CVar_GetS32("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED);
cvarSettings[RSK_ZORAS_FOUNTAIN] = CVar_GetS32("gRandomizeZorasFountain", 0); cvarSettings[RSK_ZORAS_FOUNTAIN] = CVar_GetS32("gRandomizeZorasFountain", 0);
@ -2896,7 +2896,7 @@ void DrawRandoEditor(bool& open) {
//Disabled when Forest is set to Closed or under very specific conditions //Disabled when Forest is set to Closed or under very specific conditions
//RANDOTODO: Replace magic number checks with enums //RANDOTODO: Replace magic number checks with enums
bool disableRandoStartingAge = (CVar_GetS32("gRandomizeLogicRules", 0) == 0) && // glitchless logic bool disableRandoStartingAge = (CVar_GetS32("gRandomizeLogicRules", 0) == 0) && // glitchless logic
((CVar_GetS32("gRandomizeForest", 0) == 0) || // Closed Forest ((CVar_GetS32("gRandomizeForest", RO_FOREST_CLOSED) == RO_FOREST_CLOSED) ||
((CVar_GetS32("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED) && ((CVar_GetS32("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED) &&
(CVar_GetS32("gRandomizeShuffleOcarinas", 0) == 0))); // ocarinas not shuffled (CVar_GetS32("gRandomizeShuffleOcarinas", 0) == 0))); // ocarinas not shuffled

View File

@ -372,15 +372,15 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
int openForest = Randomizer_GetSettingValue(RSK_FOREST); int openForest = Randomizer_GetSettingValue(RSK_FOREST);
switch (openForest) { switch (openForest) {
case 0: // closed case RO_FOREST_CLOSED:
break; break;
case 1: // open case RO_FOREST_CLOSED_DEKU:
Flags_SetEventChkInf(7);
break;
case RO_FOREST_OPEN:
Flags_SetEventChkInf(7); Flags_SetEventChkInf(7);
gSaveContext.eventChkInf[0] |= 0x10; gSaveContext.eventChkInf[0] |= 0x10;
break; break;
case 2: // closed deku
Flags_SetEventChkInf(7);
break;
} }
int startingAge = Randomizer_GetSettingValue(RSK_STARTING_AGE); int startingAge = Randomizer_GetSettingValue(RSK_STARTING_AGE);

View File

@ -487,7 +487,6 @@ u8 EnMd_ShouldSpawn(EnMd* this, PlayState* play) {
// if we have beaten deku tree or have open forest turned on // if we have beaten deku tree or have open forest turned on
// or have already shown mido we have an equipped sword/shield // or have already shown mido we have an equipped sword/shield
if (Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_DEKU_TREE) || if (Flags_GetRandomizerInf(RAND_INF_DUNGEONS_DONE_DEKU_TREE) ||
Randomizer_GetSettingValue(RSK_FOREST) == 1 ||
gSaveContext.eventChkInf[0] & 0x10) { gSaveContext.eventChkInf[0] & 0x10) {
return 0; return 0;
} }