mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-10-13 15:33:53 -04:00
Avoid randomizer generation races with file select (#7136)
Fixes both starting file while generating, & starting generation in file loading transition Remove RandoGenerating cvar
This commit is contained in:
@@ -389,11 +389,11 @@ int retries = 0;
|
||||
bool fileSelectSpoilerFileLoaded = false;
|
||||
|
||||
void FileChoose_UpdateRandomizer() {
|
||||
if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) != 0 && generating == 0) {
|
||||
if (Randomizer_IsGenerating() && generating == 0) {
|
||||
generating = 1;
|
||||
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, NA_BGM_HORSE, 0, 7, 1);
|
||||
return;
|
||||
} else if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) == 0 && generating) {
|
||||
} else if (!Randomizer_IsGenerating() && generating) {
|
||||
if (Randomizer_IsSeedGenerated()) {
|
||||
Audio_PlayFanfare(NA_BGM_HORSE_GOAL);
|
||||
retries = 0;
|
||||
@@ -463,6 +463,9 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
|
||||
u8 isDefaultNameOptionSet;
|
||||
|
||||
FileChoose_UpdateRandomizer();
|
||||
if (generating) {
|
||||
return;
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -2544,6 +2547,7 @@ void FileChoose_LoadGame(GameState* thisx) {
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
gSaveContext.fileNum = this->buttonIndex;
|
||||
gSaveContext.gameMode = GAMEMODE_NORMAL;
|
||||
Randomizer_WaitForGeneration();
|
||||
|
||||
if ((this->buttonIndex == FS_BTN_SELECT_FILE_1 && CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) ||
|
||||
this->buttonIndex == 0xFF) {
|
||||
|
||||
Reference in New Issue
Block a user