summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Bird <Archez@users.noreply.github.com>2023-11-04 17:52:09 -0400
committerGitHub <noreply@github.com>2023-11-04 22:52:09 +0100
commit44ee6da0aaa640fad8a38bc160a97adeda6a0214 (patch)
tree11c8aa807c218ae5b26be787da49ff710667439a
parent25f05e68b3896439684c4bf8493c52489edcdfa9 (diff)
fix quest assignment (#3343)
-rw-r--r--soh/include/z64save.h6
-rw-r--r--soh/soh/Enhancements/boss-rush/BossRush.cpp1
-rw-r--r--soh/soh/SaveManager.cpp10
-rw-r--r--soh/src/code/z_play.c2
-rw-r--r--soh/src/code/z_sram.c9
-rw-r--r--soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c6
-rw-r--r--soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c3
7 files changed, 17 insertions, 20 deletions
diff --git a/soh/include/z64save.h b/soh/include/z64save.h
index 9458f28c7..c7bee045f 100644
--- a/soh/include/z64save.h
+++ b/soh/include/z64save.h
@@ -279,14 +279,13 @@ typedef struct {
/* 0x1420 */ s16 worldMapArea;
/* 0x1422 */ s16 sunsSongState; // controls the effects of suns song
/* 0x1424 */ s16 healthAccumulator;
- /* 0x1426 */ u16 pendingSale;
- /* 0x1428 */ u16 pendingSaleMod;
// #region SOH [General]
// Upstream TODO: Move these to their own struct or name to more obviously specific to SoH
+ /* */ u16 pendingSale;
+ /* */ u16 pendingSaleMod;
/* */ uint8_t questId;
/* */ uint32_t isBossRushPaused;
/* */ uint8_t bossRushOptions[BOSSRUSH_OPTIONS_AMOUNT];
- /* */ u8 mqDungeonCount;
/* */ u8 pendingIceTrapCount;
/* */ SohStats sohStats;
/* */ FaroresWindData backupFW;
@@ -322,6 +321,7 @@ typedef struct {
/* */ u32 finalSeed;
/* */ u8 seedIcons[5];
/* */ u16 randomizerInf[10];
+ /* */ u8 mqDungeonCount;
/* */ u16 adultTradeItems;
/* */ u8 triforcePiecesCollected;
// #endregion
diff --git a/soh/soh/Enhancements/boss-rush/BossRush.cpp b/soh/soh/Enhancements/boss-rush/BossRush.cpp
index 9c5311922..e9d94c503 100644
--- a/soh/soh/Enhancements/boss-rush/BossRush.cpp
+++ b/soh/soh/Enhancements/boss-rush/BossRush.cpp
@@ -291,6 +291,7 @@ void BossRush_InitSave() {
gSaveContext.playerName[i] = brPlayerName[i];
}
+ gSaveContext.questId = QUEST_BOSSRUSH;
gSaveContext.isBossRushPaused = 1;
gSaveContext.entranceIndex = 107;
gSaveContext.cutsceneIndex = 0x8000;
diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp
index 235a7bd5f..14ab736dc 100644
--- a/soh/soh/SaveManager.cpp
+++ b/soh/soh/SaveManager.cpp
@@ -603,13 +603,11 @@ void SaveManager::InitFileNormal() {
gSaveContext.backupFW = gSaveContext.fw;
gSaveContext.pendingSale = ITEM_NONE;
gSaveContext.pendingSaleMod = MOD_NONE;
+ gSaveContext.isBossRushPaused = 0;
+ gSaveContext.pendingIceTrapCount = 0;
- // 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;
- }
+ // Init with normal quest unless only an MQ rom is provided
+ gSaveContext.questId = OTRGlobals::Instance->HasOriginal() ? QUEST_NORMAL : QUEST_MASTER;
//RANDOTODO (ADD ITEMLOCATIONS TO GSAVECONTEXT)
}
diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c
index 112a71888..bf7016884 100644
--- a/soh/src/code/z_play.c
+++ b/soh/src/code/z_play.c
@@ -1202,7 +1202,7 @@ void Play_Update(PlayState* play) {
play->gameplayFrames++;
// Gameplay stat tracking
if (!gSaveContext.sohStats.gameComplete &&
- (!IS_BOSS_RUSH || (IS_BOSS_RUSH && !gSaveContext.isBossRushPaused))) {
+ (!IS_BOSS_RUSH || !gSaveContext.isBossRushPaused)) {
gSaveContext.sohStats.playTimer++;
gSaveContext.sohStats.sceneTimer++;
gSaveContext.sohStats.roomTimer++;
diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c
index 057460b62..1ce20abc3 100644
--- a/soh/src/code/z_sram.c
+++ b/soh/src/code/z_sram.c
@@ -10,6 +10,8 @@
void Save_LoadFile(void);
+void BossRush_InitSave(void);
+
/**
* Initialize new save.
* This save has an empty inventory with 3 hearts and single magic.
@@ -33,6 +35,7 @@ void Sram_InitDebugSave(void) {
void Sram_InitBossRushSave(void) {
Save_InitFile(false);
+ BossRush_InitSave();
}
/**
@@ -221,11 +224,15 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
gSaveContext.n64ddFlag = fileChooseCtx->n64ddFlag;
- if (fileChooseCtx->questType[fileChooseCtx->buttonIndex] == QUEST_RANDOMIZER &&
+ u8 currentQuest = fileChooseCtx->questType[fileChooseCtx->buttonIndex];
+
+ if (currentQuest == QUEST_RANDOMIZER &&
strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0) {
gSaveContext.questId = QUEST_RANDOMIZER;
Randomizer_InitSaveFile();
+ } else if (currentQuest == QUEST_MASTER) {
+ gSaveContext.questId = QUEST_MASTER;
}
Save_SaveFile();
diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c
index 5de6df23d..9c83f9322 100644
--- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c
+++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c
@@ -1293,8 +1293,6 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) {
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
gSaveContext.questId = this->questType[this->buttonIndex];
- gSaveContext.isBossRushPaused = false;
-
if (this->questType[this->buttonIndex] == QUEST_BOSSRUSH) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->prevConfigMode = this->configMode;
@@ -2819,10 +2817,6 @@ void FileChoose_ConfirmFile(GameState* thisx) {
if (this->confirmButtonIndex == FS_BTN_CONFIRM_YES) {
func_800AA000(300.0f, 180, 20, 100);
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 = QUEST_NORMAL;
- }
this->selectMode = SM_FADE_OUT;
func_800F6964(0xF);
} else {
diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
index 87c4a99f5..55a5075a6 100644
--- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
+++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
@@ -4307,9 +4307,6 @@ void KaleidoScope_Update(PlayState* play)
osSyncPrintf(VT_RST);
} else {
play->state.running = 0;
- if (IS_BOSS_RUSH) {
- gSaveContext.questId = QUEST_NORMAL;
- }
SET_NEXT_GAMESTATE(&play->state, Opening_Init, OpeningContext);
GameInteractor_ExecuteOnExitGame(gSaveContext.fileNum);
}