Use enum for kak gate (#2043)

Co-authored-by: briaguya <briaguya@alice>
Co-authored-by: David Chavez <david@dcvz.io>
This commit is contained in:
briaguya 2022-11-29 18:33:38 -05:00 committed by GitHub
parent bfc0ca5388
commit ec8ec8d322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 12 deletions

View File

@ -558,7 +558,7 @@ const std::vector<PresetEntry> s6PresetEntries = {
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", 0), PRESET_ENTRY_S32("gRandomizeIceTraps", 0),
PRESET_ENTRY_S32("gRandomizeKakarikoGate", 1), PRESET_ENTRY_S32("gRandomizeKakarikoGate", RO_KAK_GATE_OPEN),
PRESET_ENTRY_S32("gRandomizeMedallionCount", 6), PRESET_ENTRY_S32("gRandomizeMedallionCount", 6),
PRESET_ENTRY_S32("gRandomizeMqDungeons", 0), PRESET_ENTRY_S32("gRandomizeMqDungeons", 0),
PRESET_ENTRY_S32("gRandomizeRainbowBridge", 3), PRESET_ENTRY_S32("gRandomizeRainbowBridge", 3),
@ -597,7 +597,7 @@ const std::vector<PresetEntry> hellModePresetEntries = {
PRESET_ENTRY_S32("gRandomizeGsExpectSunsSong", 1), PRESET_ENTRY_S32("gRandomizeGsExpectSunsSong", 1),
PRESET_ENTRY_S32("gRandomizeIceTraps", 4), PRESET_ENTRY_S32("gRandomizeIceTraps", 4),
PRESET_ENTRY_S32("gRandomizeItemPool", RO_ITEM_POOL_MINIMAL), PRESET_ENTRY_S32("gRandomizeItemPool", RO_ITEM_POOL_MINIMAL),
PRESET_ENTRY_S32("gRandomizeKakarikoGate", 1), PRESET_ENTRY_S32("gRandomizeKakarikoGate", RO_KAK_GATE_OPEN),
PRESET_ENTRY_S32("gRandomizeKeysanity", 5), PRESET_ENTRY_S32("gRandomizeKeysanity", 5),
PRESET_ENTRY_S32("gRandomizeLinksPocket", 3), PRESET_ENTRY_S32("gRandomizeLinksPocket", 3),
PRESET_ENTRY_S32("gRandomizeMqDungeons", 2), PRESET_ENTRY_S32("gRandomizeMqDungeons", 2),

View File

@ -603,9 +603,9 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) {
break; break;
case RSK_KAK_GATE: case RSK_KAK_GATE:
if(it.value() == "Closed") { if(it.value() == "Closed") {
gSaveContext.randoSettings[index].value = RO_GENERIC_OFF; gSaveContext.randoSettings[index].value = RO_KAK_GATE_CLOSED;
} else if(it.value() == "Open") { } else if(it.value() == "Open") {
gSaveContext.randoSettings[index].value = RO_GENERIC_ON; gSaveContext.randoSettings[index].value = RO_KAK_GATE_OPEN;
} }
break; break;
case RSK_DOOR_OF_TIME: case RSK_DOOR_OF_TIME:
@ -2561,7 +2561,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", 0);
cvarSettings[RSK_KAK_GATE] = CVar_GetS32("gRandomizeKakarikoGate", 0); 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);
cvarSettings[RSK_STARTING_AGE] = CVar_GetS32("gRandomizeStartingAge", 0); cvarSettings[RSK_STARTING_AGE] = CVar_GetS32("gRandomizeStartingAge", 0);
@ -2841,7 +2841,7 @@ void DrawRandoEditor(bool& open) {
"Open - The gate is always open. The happy mask shop " "Open - The gate is always open. The happy mask shop "
"will open immediately after obtaining Zelda's letter." "will open immediately after obtaining Zelda's letter."
); );
UIWidgets::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, 2, RO_GENERIC_DONT_SKIP); UIWidgets::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, 2, RO_KAK_GATE_CLOSED);
UIWidgets::PaddedSeparator(); UIWidgets::PaddedSeparator();

View File

@ -1105,6 +1105,10 @@ typedef enum RandoOption {
RO_GF_FAST, RO_GF_FAST,
RO_GF_OPEN, RO_GF_OPEN,
//Kakariko Gate settings (closed/open)
RO_KAK_GATE_CLOSED = 0,
RO_KAK_GATE_OPEN,
//Rainbow Bridge settings (always open, vanilla, stones, medallions, dungeon rewards, dungeons, tokens) //Rainbow Bridge settings (always open, vanilla, stones, medallions, dungeon rewards, dungeons, tokens)
RO_BRIDGE_ALWAYS_OPEN = 0, RO_BRIDGE_ALWAYS_OPEN = 0,
RO_BRIDGE_VANILLA, RO_BRIDGE_VANILLA,

View File

@ -404,11 +404,8 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
break; break;
} }
int kakGate = Randomizer_GetSettingValue(RSK_KAK_GATE); if (Randomizer_GetSettingValue(RSK_KAK_GATE) == RO_KAK_GATE_OPEN) {
switch (kakGate) { gSaveContext.infTable[7] |= 0x40;
case 1: // open
gSaveContext.infTable[7] |= 0x40;
break;
} }
if(Randomizer_GetSettingValue(RSK_STARTING_KOKIRI_SWORD)) Item_Give(NULL, ITEM_SWORD_KOKIRI); if(Randomizer_GetSettingValue(RSK_STARTING_KOKIRI_SWORD)) Item_Give(NULL, ITEM_SWORD_KOKIRI);

View File

@ -46,7 +46,7 @@ void BgGateShutter_Init(Actor* thisx, PlayState* play) {
this->somePos.z = thisx->world.pos.z; this->somePos.z = thisx->world.pos.z;
if (((gSaveContext.infTable[7] & 0x40) || if (((gSaveContext.infTable[7] & 0x40) ||
(!gSaveContext.n64ddFlag && (gSaveContext.eventChkInf[4] & 0x20)) || (!gSaveContext.n64ddFlag && (gSaveContext.eventChkInf[4] & 0x20)) ||
(gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_KAK_GATE))) && (gSaveContext.n64ddFlag && (Randomizer_GetSettingValue(RSK_KAK_GATE) == RO_KAK_GATE_OPEN))) &&
(play->sceneNum == SCENE_SPOT01)) { (play->sceneNum == SCENE_SPOT01)) {
thisx->world.pos.x = -89.0f; thisx->world.pos.x = -89.0f;
thisx->world.pos.z = -1375.0f; thisx->world.pos.z = -1375.0f;