Fixes bug with generating seed on the choose-quest screen. (#1892)

This commit is contained in:
Christopher Leggett 2022-11-02 17:30:44 -04:00 committed by GitHub
parent 3b7b4913eb
commit d49a1cd6b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -419,6 +419,49 @@ void DrawSeedHashSprites(FileChooseContext* this) {
u8 generating; u8 generating;
void FileChoose_UpdateRandomizer() {
if (CVar_GetS32("gRandoGenerating", 0) != 0 && generating == 0) {
generating = 1;
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_HORSE, 0, 7, 1);
return;
} else if (CVar_GetS32("gRandoGenerating", 0) == 0 && generating) {
Audio_PlayFanfare(NA_BGM_HORSE_GOAL);
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
generating = 0;
return;
} else if (generating) {
return;
}
if (!SpoilerFileExists(CVar_GetString("gSpoilerLog", ""))) {
CVar_SetString("gSpoilerLog", "");
fileSelectSpoilerFileLoaded = false;
}
if ((CVar_GetS32("gNewFileDropped", 0) != 0) || (CVar_GetS32("gNewSeedGenerated", 0) != 0) ||
(!fileSelectSpoilerFileLoaded && SpoilerFileExists(CVar_GetString("gSpoilerLog", "")))) {
if (CVar_GetS32("gNewFileDropped", 0) != 0) {
CVar_SetString("gSpoilerLog", CVar_GetString("gDroppedFile", "None"));
}
bool silent = true;
if ((CVar_GetS32("gNewFileDropped", 0) != 0) || (CVar_GetS32("gNewSeedGenerated", 0) != 0)) {
silent = false;
}
CVar_SetS32("gNewSeedGenerated", 0);
CVar_SetS32("gNewFileDropped", 0);
CVar_SetString("gDroppedFile", "");
fileSelectSpoilerFileLoaded = false;
const char* fileLoc = CVar_GetString("gSpoilerLog", "");
Randomizer_LoadSettings(fileLoc);
Randomizer_LoadHintLocations(fileLoc);
Randomizer_LoadRequiredTrials(fileLoc);
Randomizer_LoadItemLocations(fileLoc, silent);
Randomizer_LoadMerchantMessages(fileLoc);
Randomizer_LoadMasterQuestDungeons(fileLoc);
fileSelectSpoilerFileLoaded = true;
}
}
/** /**
* Update the cursor and wait for the player to select a button to change menus accordingly. * Update the cursor and wait for the player to select a button to change menus accordingly.
* If an empty file is selected, enter the name entry config mode. * If an empty file is selected, enter the name entry config mode.
@ -433,48 +476,7 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
Input* input = &this->state.input[0]; Input* input = &this->state.input[0];
bool dpad = CVar_GetS32("gDpadText", 0); bool dpad = CVar_GetS32("gDpadText", 0);
if (CVar_GetS32("gRandoGenerating", 0) != 0 && generating == 0) { FileChoose_UpdateRandomizer();
generating = 1;
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_HORSE, 0, 7, 1);
return;
} else if (CVar_GetS32("gRandoGenerating", 0) == 0 && generating) {
Audio_PlayFanfare(NA_BGM_HORSE_GOAL);
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
generating = 0;
return;
} else if (generating) {
return;
}
if (!SpoilerFileExists(CVar_GetString("gSpoilerLog", ""))) {
CVar_SetString("gSpoilerLog", "");
fileSelectSpoilerFileLoaded = false;
}
if ((CVar_GetS32("gNewFileDropped", 0) != 0) ||
(CVar_GetS32("gNewSeedGenerated", 0) != 0) ||
(!fileSelectSpoilerFileLoaded && SpoilerFileExists(CVar_GetString("gSpoilerLog", "")))) {
if (CVar_GetS32("gNewFileDropped", 0) != 0) {
CVar_SetString("gSpoilerLog", CVar_GetString("gDroppedFile", "None"));
}
bool silent = true;
if ((CVar_GetS32("gNewFileDropped", 0) != 0) ||
(CVar_GetS32("gNewSeedGenerated", 0) != 0)) {
silent = false;
}
CVar_SetS32("gNewSeedGenerated", 0);
CVar_SetS32("gNewFileDropped", 0);
CVar_SetString("gDroppedFile", "");
fileSelectSpoilerFileLoaded = false;
const char* fileLoc = CVar_GetString("gSpoilerLog", "");
Randomizer_LoadSettings(fileLoc);
Randomizer_LoadHintLocations(fileLoc);
Randomizer_LoadRequiredTrials(fileLoc);
Randomizer_LoadItemLocations(fileLoc, silent);
Randomizer_LoadMerchantMessages(fileLoc);
Randomizer_LoadMasterQuestDungeons(fileLoc);
fileSelectSpoilerFileLoaded = true;
}
if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_A)) { if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_A)) {
if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) { if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) {
@ -656,6 +658,8 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) {
s8 i = 0; s8 i = 0;
bool dpad = CVar_GetS32("gDpadText", 0);(dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP)); bool dpad = CVar_GetS32("gDpadText", 0);(dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP));
FileChoose_UpdateRandomizer();
if (ABS(this->stickRelX) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DRIGHT))) { if (ABS(this->stickRelX) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DRIGHT))) {
if (this->stickRelX > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT))) { if (this->stickRelX > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT))) {
this->questType[this->buttonIndex] += 1; this->questType[this->buttonIndex] += 1;