Fix quest type bleeding through saves (#3241)

This commit is contained in:
Adam Bird 2023-10-05 15:35:49 -04:00 committed by GitHub
parent 85432ce496
commit e66be83eb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 7 deletions

View File

@ -520,7 +520,7 @@ void SaveManager::InitFileNormal() {
}
gSaveContext.adultEquips.equipment = 0;
gSaveContext.unk_54 = 0;
gSaveContext.savedSceneNum = 0x34;
gSaveContext.savedSceneNum = SCENE_LINKS_HOUSE;
// Equipment
for (int button = 0; button < ARRAY_COUNT(gSaveContext.equips.buttonItems); button++) {
@ -568,7 +568,6 @@ void SaveManager::InitFileNormal() {
gSaveContext.fw.set = 0;
gSaveContext.fw.tempSwchFlags = 0;
gSaveContext.fw.tempCollectFlags = 0;
gSaveContext.backupFW = gSaveContext.fw;
for (int flag = 0; flag < ARRAY_COUNT(gSaveContext.gsFlags); flag++) {
gSaveContext.gsFlags[flag] = 0;
}
@ -614,11 +613,17 @@ void SaveManager::InitFileNormal() {
gSaveContext.magicLevel = 0;
gSaveContext.infTable[29] = 1;
gSaveContext.sceneFlags[5].swch = 0x40000000;
// SoH specific
gSaveContext.backupFW = gSaveContext.fw;
gSaveContext.pendingSale = ITEM_NONE;
gSaveContext.pendingSaleMod = MOD_NONE;
// Boss Rush is set ahead of time in z_file_choose, otherwise init the save with the normal quest
if (IS_BOSS_RUSH) {
BossRush_InitSave();
} else {
gSaveContext.questId = QUEST_NORMAL;
}
//RANDOTODO (ADD ITEMLOCATIONS TO GSAVECONTEXT)

View File

@ -220,8 +220,9 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
gSaveContext.n64ddFlag = fileChooseCtx->n64ddFlag;
if (fileChooseCtx->questType[fileChooseCtx->buttonIndex] == 2 && strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0) {
gSaveContext.questId = 2;
if (fileChooseCtx->questType[fileChooseCtx->buttonIndex] == QUEST_RANDOMIZER &&
strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0) {
gSaveContext.questId = QUEST_RANDOMIZER;
Randomizer_InitSaveFile();
}

View File

@ -989,7 +989,8 @@ void DrawSeedHashSprites(FileChooseContext* this) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0xFF, 0xFF, 0xFF, alpha);
// Draw Seed Icons for spoiler log
if (this->configMode == CM_QUEST_MENU && this->questType[this->buttonIndex] == QUEST_RANDOMIZER && strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0 && fileSelectSpoilerFileLoaded) {
if (this->configMode == CM_QUEST_MENU && this->questType[this->buttonIndex] == QUEST_RANDOMIZER &&
strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0 && fileSelectSpoilerFileLoaded) {
u16 xStart = 64;
for (unsigned int i = 0; i < 5; i++) {
SpriteLoad(this, GetSeedTexture(gSaveContext.seedIcons[i]));
@ -2818,7 +2819,7 @@ void FileChoose_ConfirmFile(GameState* thisx) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
// Reset Boss Rush because it's only ever saved in memory.
if (IS_BOSS_RUSH) {
gSaveContext.questId = 0;
gSaveContext.questId = QUEST_NORMAL;
}
this->selectMode = SM_FADE_OUT;
func_800F6964(0xF);

View File

@ -4181,7 +4181,7 @@ void KaleidoScope_Update(PlayState* play)
} else {
play->state.running = 0;
if (IS_BOSS_RUSH) {
gSaveContext.questId = 0;
gSaveContext.questId = QUEST_NORMAL;
}
SET_NEXT_GAMESTATE(&play->state, Opening_Init, OpeningContext);
GameInteractor_ExecuteOnExitGame(gSaveContext.fileNum);