Fixes a crash on Switch and cleans up some rando ui interactions. (#1832)

This commit is contained in:
Christopher Leggett 2022-10-22 12:31:20 -04:00 committed by GitHub
commit 6fe7728bd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 18 deletions

View file

@ -204,6 +204,8 @@ void SpriteDraw(FileChooseContext* this, Sprite* sprite, int left, int top, int
CLOSE_DISPS(this->state.gfxCtx);
}
bool fileSelectSpoilerFileLoaded = false;
void DrawSeedHashSprites(FileChooseContext* this) {
OPEN_DISPS(this->state.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
@ -226,9 +228,7 @@ void DrawSeedHashSprites(FileChooseContext* this) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0xFF, 0xFF, 0xFF, this->fileButtonAlpha[this->buttonIndex]);
if (CVar_GetS32("gRandomizer", 0) && strnlen(CVar_GetString("gSpoilerLog", ""), 1) != 0 &&
!((gSaveContext.mqDungeonCount > 0 && !ResourceMgr_GameHasMasterQuest())
|| (gSaveContext.mqDungeonCount < 12 && !ResourceMgr_GameHasOriginal()))) {
if (CVar_GetS32("gRandomizer", 0) && strnlen(CVar_GetString("gSpoilerLog", ""), 1) != 0 && fileSelectSpoilerFileLoaded) {
u16 xStart = 64;
for (unsigned int i = 0; i < 5; i++) {
SpriteLoad(this, GetSeedTexture(gSaveContext.seedIcons[i]));
@ -243,8 +243,6 @@ void DrawSeedHashSprites(FileChooseContext* this) {
}
u8 generating;
bool fileSelectSpoilerFileLoaded;
bool shouldLoadSpoilerFile;
/**
* Update the cursor and wait for the player to select a button to change menus accordingly.
@ -280,8 +278,7 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
if ((CVar_GetS32("gNewFileDropped", 0) != 0) ||
(CVar_GetS32("gNewSeedGenerated", 0) != 0) ||
(!fileSelectSpoilerFileLoaded && shouldLoadSpoilerFile &&
SpoilerFileExists(CVar_GetString("gSpoilerLog", "")))) {
(!fileSelectSpoilerFileLoaded && SpoilerFileExists(CVar_GetString("gSpoilerLog", "")))) {
if (CVar_GetS32("gNewFileDropped", 0) != 0) {
CVar_SetString("gSpoilerLog", CVar_GetString("gDroppedFile", "None"));
}
@ -298,9 +295,9 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
Randomizer_LoadSettings(fileLoc);
Randomizer_LoadHintLocations(fileLoc);
Randomizer_LoadRequiredTrials(fileLoc);
Randomizer_LoadMasterQuestDungeons(fileLoc);
Randomizer_LoadItemLocations(fileLoc, silent);
Randomizer_LoadMerchantMessages(fileLoc);
Randomizer_LoadMasterQuestDungeons(fileLoc);
fileSelectSpoilerFileLoaded = true;
}
@ -2102,7 +2099,6 @@ void FileChoose_Init(GameState* thisx) {
size_t size = (u32)_title_staticSegmentRomEnd - (u32)_title_staticSegmentRomStart;
s32 pad;
fileSelectSpoilerFileLoaded = false;
shouldLoadSpoilerFile = true;
CVar_SetS32("gOnFileSelectNameEntry", 0);
SREG(30) = 1;