Organize ship specific save context additions (#4597)

* Basic restructure

* Undo most randomizerInf changes for now

* Small fixes

* Fix linux & mac builds?

* Fix remnants of randomizerInf changes

* Post-merge fix

* Post-merge fix
This commit is contained in:
Pepe20129
2025-01-15 13:04:47 +01:00
committed by GitHub
parent 0d80c4695f
commit 7f31fd2e4e
42 changed files with 695 additions and 640 deletions

View File

@@ -157,6 +157,42 @@ typedef struct {
char hintText[200];
} HintLocationRando;
#pragma region SoH
typedef struct ShipRandomizerSaveContextData {
u16 adultTradeItems;
u8 triforcePiecesCollected;
} ShipRandomizerSaveContextData;
typedef struct ShipBossRushSaveContextData {
u32 isPaused;
u8 options[BR_OPTIONS_MAX];
} ShipBossRushSaveContextData;
typedef union ShipQuestSpecificSaveContextData {
ShipRandomizerSaveContextData randomizer;
ShipBossRushSaveContextData bossRush;
} ShipQuestSpecificSaveContextData;
typedef struct ShipQuestSaveContextData {
u8 id;
ShipQuestSpecificSaveContextData data;
} ShipQuestSaveContextData;
typedef struct ShipSaveContextData {
u16 pendingSale;
u16 pendingSaleMod;
u8 pendingIceTrapCount;
SohStats stats;
FaroresWindData backupFW;
ShipQuestSaveContextData quest;
u8 maskMemory;
//TODO: Move non-rando specific flags to a new sohInf and move the remaining randomizerInf to ShipRandomizerSaveContextData
u16 randomizerInf[(RAND_INF_MAX + 15) / 16];
} ShipSaveContextData;
#pragma endregion
typedef struct {
/* 0x0000 */ s32 entranceIndex; // start of `save` substruct, originally called "memory"
/* 0x0004 */ s32 linkAge; // 0: Adult; 1: Child (see enum `LinkAge`)
@@ -270,25 +306,7 @@ typedef struct {
/* 0x1420 */ s16 worldMapArea;
/* 0x1422 */ s16 sunsSongState; // controls the effects of suns song
/* 0x1424 */ s16 healthAccumulator;
// #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[BR_OPTIONS_MAX];
/* */ u8 pendingIceTrapCount;
/* */ SohStats sohStats;
/* */ FaroresWindData backupFW;
/* */ u8 maskMemory;
// #endregion
// #region SOH [Randomizer]
// Upstream TODO: Move these to their own struct or name to more obviously specific to Randomizer
/* */ u16 randomizerInf[(RAND_INF_MAX + 15) / 16];
/* */ u8 mqDungeonCount;
/* */ u16 adultTradeItems;
/* */ u8 triforcePiecesCollected;
// #endregion
/* */ ShipSaveContextData ship;
} SaveContext; // size = 0x1428
typedef enum {
@@ -298,10 +316,10 @@ typedef enum {
/* 03 */ QUEST_BOSSRUSH,
} Quest;
#define IS_VANILLA (gSaveContext.questId == QUEST_NORMAL)
#define IS_MASTER_QUEST (gSaveContext.questId == QUEST_MASTER)
#define IS_RANDO (gSaveContext.questId == QUEST_RANDOMIZER)
#define IS_BOSS_RUSH (gSaveContext.questId == QUEST_BOSSRUSH)
#define IS_VANILLA (gSaveContext.ship.quest.id == QUEST_NORMAL)
#define IS_MASTER_QUEST (gSaveContext.ship.quest.id == QUEST_MASTER)
#define IS_RANDO (gSaveContext.ship.quest.id == QUEST_RANDOMIZER)
#define IS_BOSS_RUSH (gSaveContext.ship.quest.id == QUEST_BOSSRUSH)
typedef enum {
/* 0x00 */ BTN_ENABLED,