mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-23 00:28:51 -05:00
use trial enum instead of magic numbers (#2039)
* use trial enum instead of magic numbers * simplify trial count/random trial logic * set default to set number Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
parent
806b9dc84b
commit
00a862a252
@ -555,7 +555,7 @@ const std::vector<PresetEntry> s6PresetEntries = {
|
||||
PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN),
|
||||
PRESET_ENTRY_STRING("gRandomizeExcludedLocations", "48,"),
|
||||
PRESET_ENTRY_S32("gRandomizeForest", RO_FOREST_CLOSED_DEKU),
|
||||
PRESET_ENTRY_S32("gRandomizeGanonTrial", 0),
|
||||
PRESET_ENTRY_S32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SKIP),
|
||||
PRESET_ENTRY_S32("gRandomizeGerudoFortress", RO_GF_FAST),
|
||||
PRESET_ENTRY_S32("gRandomizeIceTraps", RO_ICE_TRAPS_OFF),
|
||||
PRESET_ENTRY_S32("gRandomizeKakarikoGate", RO_KAK_GATE_OPEN),
|
||||
@ -591,7 +591,7 @@ const std::vector<PresetEntry> hellModePresetEntries = {
|
||||
PRESET_ENTRY_S32("gRandomizeEnableBombchuDrops", 1),
|
||||
PRESET_ENTRY_S32("gRandomizeEnableGlitchCutscenes", 1),
|
||||
PRESET_ENTRY_S32("gRandomizeForest", RO_FOREST_OPEN),
|
||||
PRESET_ENTRY_S32("gRandomizeGanonTrial", 2),
|
||||
PRESET_ENTRY_S32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SET_NUMBER),
|
||||
PRESET_ENTRY_S32("gRandomizeGanonTrialCount", 6),
|
||||
PRESET_ENTRY_S32("gRandomizeGerudoKeys", 3),
|
||||
PRESET_ENTRY_S32("gRandomizeGsExpectSunsSong", 1),
|
||||
|
@ -2537,12 +2537,12 @@ namespace Settings {
|
||||
BridgeRewardCount.SetSelectedIndex(cvarSettings[RSK_RAINBOW_BRIDGE_REWARD_COUNT]);
|
||||
BridgeDungeonCount.SetSelectedIndex(cvarSettings[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT]);
|
||||
BridgeTokenCount.SetSelectedIndex(cvarSettings[RSK_RAINBOW_BRIDGE_TOKEN_COUNT]);
|
||||
if (cvarSettings[RSK_RANDOM_TRIALS] == 2) {
|
||||
if (cvarSettings[RSK_GANONS_TRIALS] == RO_GANONS_TRIALS_RANDOM_NUMBER) {
|
||||
RandomGanonsTrials.SetSelectedIndex(1);
|
||||
} else {
|
||||
RandomGanonsTrials.SetSelectedIndex(0);
|
||||
}
|
||||
if (cvarSettings[RSK_RANDOM_TRIALS] == 0) {
|
||||
if (cvarSettings[RSK_GANONS_TRIALS] == RO_GANONS_TRIALS_SKIP) {
|
||||
GanonsTrialsCount.SetSelectedIndex(0);
|
||||
} else {
|
||||
GanonsTrialsCount.SetSelectedIndex(cvarSettings[RSK_TRIAL_COUNT]);
|
||||
|
@ -194,8 +194,6 @@ std::unordered_map<std::string, RandomizerSettingKey> SpoilerfileSettingNameToEn
|
||||
{ "Open Settings:Reward Count", RSK_RAINBOW_BRIDGE_REWARD_COUNT },
|
||||
{ "Open Settings:Dungeon Count", RSK_RAINBOW_BRIDGE_DUNGEON_COUNT },
|
||||
{ "Open Settings:Token Count", RSK_RAINBOW_BRIDGE_TOKEN_COUNT },
|
||||
{ "Open Settings:Random Ganon's Trials", RSK_RANDOM_TRIALS },
|
||||
{ "Open Settings:Trial Count", RSK_TRIAL_COUNT },
|
||||
{ "Shuffle Settings:Link's Pocket", RSK_LINKS_POCKET},
|
||||
{ "Shuffle Settings:Shuffle Gerudo Card", RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD },
|
||||
{ "Shuffle Settings:Shopsanity", RSK_SHOPSANITY },
|
||||
@ -669,7 +667,6 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) {
|
||||
case RSK_LACS_REWARD_COUNT:
|
||||
case RSK_LACS_DUNGEON_COUNT:
|
||||
case RSK_LACS_TOKEN_COUNT:
|
||||
case RSK_TRIAL_COUNT:
|
||||
case RSK_BIG_POE_COUNT:
|
||||
case RSK_CUCCO_COUNT:
|
||||
case RSK_STARTING_SKULLTULA_TOKEN:
|
||||
@ -708,7 +705,6 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) {
|
||||
case RSK_SHUFFLE_COWS:
|
||||
case RSK_SHUFFLE_ADULT_TRADE:
|
||||
case RSK_SHUFFLE_MAGIC_BEANS:
|
||||
case RSK_RANDOM_TRIALS:
|
||||
case RSK_RANDOM_MQ_DUNGEONS:
|
||||
case RSK_STARTING_DEKU_SHIELD:
|
||||
case RSK_STARTING_KOKIRI_SWORD:
|
||||
@ -2578,7 +2574,7 @@ void GenerateRandomizerImgui() {
|
||||
cvarSettings[RSK_RAINBOW_BRIDGE_REWARD_COUNT] = CVar_GetS32("gRandomizeRewardCount", 9);
|
||||
cvarSettings[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT] = CVar_GetS32("gRandomizeDungeonCount", 8);
|
||||
cvarSettings[RSK_RAINBOW_BRIDGE_TOKEN_COUNT] = CVar_GetS32("gRandomizeTokenCount", 100);
|
||||
cvarSettings[RSK_RANDOM_TRIALS] = CVar_GetS32("gRandomizeGanonTrial", 0);
|
||||
cvarSettings[RSK_GANONS_TRIALS] = CVar_GetS32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SET_NUMBER);
|
||||
cvarSettings[RSK_TRIAL_COUNT] = CVar_GetS32("gRandomizeGanonTrialCount", 6);
|
||||
cvarSettings[RSK_STARTING_OCARINA] = CVar_GetS32("gRandomizeStartingOcarina", 0);
|
||||
cvarSettings[RSK_SHUFFLE_OCARINA] = CVar_GetS32("gRandomizeShuffleOcarinas", 0) ||
|
||||
@ -3011,13 +3007,12 @@ void DrawRandoEditor(bool& open) {
|
||||
"\n"
|
||||
"Random Number - A Random number and set of trials will be required."
|
||||
);
|
||||
UIWidgets::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, 3, CVar_GetS32("gRandomizeGanonTrial", 0));
|
||||
UIWidgets::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, 3, RO_GANONS_TRIALS_SET_NUMBER);
|
||||
ImGui::PopItemWidth();
|
||||
if (CVar_GetS32("gRandomizeGanonTrial", 0) == 1) {
|
||||
if (CVar_GetS32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SET_NUMBER) == RO_GANONS_TRIALS_SET_NUMBER) {
|
||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||
UIWidgets::EnhancementSliderInt("Ganon's Trial Count: %d", "##RandoTrialCount",
|
||||
"gRandomizeGanonTrialCount", 1, 6, "",
|
||||
CVar_GetS32("gRandomizeGanonTrialCount", 6), true);
|
||||
"gRandomizeGanonTrialCount", 1, 6, "", 6, true);
|
||||
UIWidgets::InsertHelpHoverText("Set the number of trials required to enter Ganon's Tower.");
|
||||
}
|
||||
|
||||
|
@ -987,7 +987,7 @@ typedef enum {
|
||||
RSK_RAINBOW_BRIDGE_REWARD_COUNT,
|
||||
RSK_RAINBOW_BRIDGE_DUNGEON_COUNT,
|
||||
RSK_RAINBOW_BRIDGE_TOKEN_COUNT,
|
||||
RSK_RANDOM_TRIALS,
|
||||
RSK_GANONS_TRIALS,
|
||||
RSK_TRIAL_COUNT,
|
||||
RSK_STARTING_OCARINA,
|
||||
RSK_SHUFFLE_OCARINA,
|
||||
@ -1174,6 +1174,11 @@ typedef enum RandoOption {
|
||||
RO_GANON_BOSS_KEY_LACS_DUNGEONS,
|
||||
RO_GANON_BOSS_KEY_LACS_TOKENS,
|
||||
|
||||
//Ganon's Trials
|
||||
RO_GANONS_TRIALS_SKIP = 0,
|
||||
RO_GANONS_TRIALS_SET_NUMBER,
|
||||
RO_GANONS_TRIALS_RANDOM_NUMBER,
|
||||
|
||||
//Shuffle Dungeon Entrance Settings (Off, on, plus ganon)
|
||||
RO_DUNGEON_ENTRANCE_SHUFFLE_OFF = 0,
|
||||
RO_DUNGEON_ENTRANCE_SHUFFLE_ON,
|
||||
|
@ -324,12 +324,10 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
|
||||
gSaveContext.randomizerInf[i] = 0;
|
||||
}
|
||||
|
||||
// Set all trials to cleared if trial count is random or anything other than 6
|
||||
if (Randomizer_GetSettingValue(RSK_RANDOM_TRIALS) || (Randomizer_GetSettingValue(RSK_TRIAL_COUNT) != 6)) {
|
||||
for (u16 i = RAND_INF_TRIALS_DONE_LIGHT_TRIAL; i <= RAND_INF_TRIALS_DONE_SHADOW_TRIAL; i++) {
|
||||
if (!Randomizer_IsTrialRequired(i)) {
|
||||
Flags_SetRandomizerInf(i);
|
||||
}
|
||||
// If any trials aren't required, set them as completed
|
||||
for (u16 i = RAND_INF_TRIALS_DONE_LIGHT_TRIAL; i <= RAND_INF_TRIALS_DONE_SHADOW_TRIAL; i++) {
|
||||
if (!Randomizer_IsTrialRequired(i)) {
|
||||
Flags_SetRandomizerInf(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user