diff --git a/Makefile b/Makefile index c0569cbe13..c41cc941ff 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ ifeq ($(NON_MATCHING),1) COMPARE := 0 endif +DISASM_FLAGS ?= ifneq ($(FULL_DISASM), 0) DISASM_FLAGS += --full endif diff --git a/docs/tutorial/advanced_control_flow.md b/docs/tutorial/advanced_control_flow.md index 8cd9660ba0..4952f7586c 100644 --- a/docs/tutorial/advanced_control_flow.md +++ b/docs/tutorial/advanced_control_flow.md @@ -81,7 +81,7 @@ void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_80952734(EnMs* this, GlobalContext* globalCtx) { s16 temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (gSaveContext.inventory.items[10] == ITEM_NONE) { + if (gSaveContext.save.inventory.items[10] == ITEM_NONE) { this->actor.textId = 0x92E; } else { this->actor.textId = 0x932; @@ -187,12 +187,12 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { return; } func_801477B4(globalCtx); - if ((s32) gSaveContext.rupees < 0xA) { + if ((s32) gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); func_80151938(globalCtx, 0x935U); return; } - if ((s32) gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + if ((s32) gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); func_80151938(globalCtx, 0x937U); return; @@ -275,14 +275,14 @@ block_7: goto block_16; block_11: func_801477B4(globalCtx); - if ((s32) gSaveContext.rupees >= 0xA) { + if ((s32) gSaveContext.save.playerData.rupees >= 0xA) { goto block_13; } play_sound(0x4806U); func_80151938(globalCtx, 0x935U); return; block_13: - if ((s32) gSaveContext.inventory.ammo[gItemSlots[0xA]] < 0x14) { + if ((s32) gSaveContext.save.inventory.ammo[gItemSlots[0xA]] < 0x14) { goto block_15; } play_sound(0x4806U); @@ -312,7 +312,7 @@ which in many ways looks worse: you can see why the use of gotos in code is stro The simplest sort of block label to eliminate is one that is only used once, and where the corresponding goto jumps over a simple block of code with no extra internal control flow structure. There are two obvious examples of this here, the first being ```C - if ((s32) gSaveContext.rupees >= 0xA) { + if ((s32) gSaveContext.save.playerData.rupees >= 0xA) { goto block_13; } play_sound(0x4806U); @@ -324,7 +324,7 @@ block_13: Currently, this says to jump over the code block `play_sound...` if the condition in the if is satisfied. In non-goto terms, this means that the block should be run if the condition is *not* satisfied. This also illustrates a general property of goto-only mode: you have to reverse the senses of all of the ifs. Therefore the appropriate approach is to swap the if round, put the code block inside, and remove the goto and the label: ```C - if (gSaveContext.rupees < 0xA) { + if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); func_80151938(globalCtx, 0x935U); return; @@ -378,12 +378,12 @@ block_7: block_11: func_801477B4(globalCtx); - if (gSaveContext.rupees < 0xA) { + if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); func_80151938(globalCtx, 0x935U); return; } - if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); func_80151938(globalCtx, 0x937U); return; @@ -448,12 +448,12 @@ block_7: block_11: func_801477B4(globalCtx); - if (gSaveContext.rupees < 0xA) { + if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); func_80151938(globalCtx, 0x935U); return; } - if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); func_80151938(globalCtx, 0x937U); return; @@ -497,12 +497,12 @@ So let us rewrite the entire second half as a switch: case 0: func_801477B4(globalCtx); - if (gSaveContext.rupees < 0xA) { + if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); func_80151938(globalCtx, 0x935U); return; } - if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); func_80151938(globalCtx, 0x937U); return; @@ -532,10 +532,10 @@ There's a couple of other obvious things here: case 0: func_801477B4(globalCtx); - if (gSaveContext.rupees < 0xA) { + if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); func_80151938(globalCtx, 0x935U); - } else if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); func_80151938(globalCtx, 0x937U); } else { @@ -597,10 +597,10 @@ block_7: case 0: func_801477B4(globalCtx); - if (gSaveContext.rupees < 0xA) { + if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); func_80151938(globalCtx, 0x935U); - } else if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); func_80151938(globalCtx, 0x937U); } else { @@ -661,10 +661,10 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { case 0: func_801477B4(globalCtx); - if (gSaveContext.rupees < 0xA) { + if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); func_80151938(globalCtx, 0x935U); - } else if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); func_80151938(globalCtx, 0x937U); } else { @@ -713,10 +713,10 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { case 0: func_801477B4(globalCtx); - if (gSaveContext.rupees < 0xA) { + if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); func_80151938(globalCtx, 0x935U); - } else if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); func_80151938(globalCtx, 0x937U); } else { diff --git a/docs/tutorial/documenting.md b/docs/tutorial/documenting.md index e50921befa..a5e64d2a91 100644 --- a/docs/tutorial/documenting.md +++ b/docs/tutorial/documenting.md @@ -182,12 +182,12 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { func_80C10148(this); return; } - + if ((temp_v0_2 == 5) && (Message_ShouldAdvance(globalCtx) != 0)) { if (this->actor.textId == 0x2AD9) { Flags_SetSwitch(globalCtx, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); - if ((gSaveContext.weekEventReg[63] & 0x80)) { + if ((gSaveContext.save.weekEventReg[63] & 0x80)) { this->actor.textId = 0x2ADF; } else { this->actor.textId = 0x2ADA; @@ -504,7 +504,7 @@ void func_80C102D4(EnRecepgirl* this, GlobalContext* globalCtx) { if (this->actor.textId == 0x2AD9) { // "Welcome..." Flags_SetSwitch(globalCtx, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); - if (gSaveContext.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting + if (gSaveContext.save.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended) } else { this->actor.textId = 0x2ADA; // Mayor's office is on the left (meeting ongoing) diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index 0795fa76e3..796939dd86 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -378,7 +378,7 @@ There remains one thing we need to fix before trying to compile it, namely `*(&g /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" /* 0x0F5C */ u32 mapsVisited; // "area_arrival" ``` -so it's somewhere in `weekEventReg`. `0xF37 - 0xEF8 = 0x3F = 63`, and it's a byte array, so the access is actually `gSaveContext.weekEventReg[63] & 0x80`. Now it will compile. We also don't use `!= 0` for flag comparisons: just `if (gSaveContext.weekEventReg[63] & 0x80)` will do. +so it's somewhere in `weekEventReg`. `0xF37 - 0xEF8 = 0x3F = 63`, and it's a byte array, so the access is actually `gSaveContext.save.weekEventReg[63] & 0x80`. Now it will compile. We also don't use `!= 0` for flag comparisons: just `if (gSaveContext.save.weekEventReg[63] & 0x80)` will do. Running `./diff.py -mwo3 func_80C102D4` and scrolling down, we discover that this doesn't match! diff --git a/include/functions.h b/include/functions.h index 7c9f8d0440..121d9bb05b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1495,7 +1495,7 @@ void FireObj_Update(GlobalContext* globalCtx, FireObj* fire, Actor* actor); // void func_800F3940(void); // void func_800F39B4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void func_800F3A64(void); -// void func_800F3B2C(void); +void func_800F3B2C(GlobalContext* globalCtx); // void func_800F3B68(void); // void func_800F3C44(void); // void func_800F3ED4(void); @@ -1913,13 +1913,13 @@ void Interface_ChangeAlpha(u16 param_1); // void func_80111CB4(void); // void func_801129E4(void); void func_80112AFC(GlobalContext* globalCtx); -void func_80112B40(GlobalContext* globalCtx, s32 arg1); +void func_80112B40(GlobalContext* globalCtx, u8 arg1); // void func_80112BE4(void); // void func_80112C0C(void); u32 Item_Give(GlobalContext* globalCtx, u8 param_2); // void func_801143CC(void); UNK_TYPE func_80114978(UNK_TYPE arg0); -void func_801149A0(s32 arg0, s16 arg1); +void func_801149A0(s32 itemId, s16 slotId); // void func_80114A9C(void); // void func_80114B84(void); // void func_80114CA0(void); @@ -2574,39 +2574,7 @@ Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z); void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB); void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z); void SkyboxDraw_Noop(SkyboxContext* skyboxCtx); -void func_80143A10(u8 owlId); -// void func_80143A54(void); -void func_80143AC4(void); -void func_80143B0C(GlobalContext* globalCtx); -void Sram_IncrementDay(void); -u32 Sram_CalcChecksum(u8* data, u32 length); -// void func_80144628(void); -// void Sram_GenerateRandomSaveFields(void); -void func_80144890(void); -void Sram_InitDebugSave(void); -void func_80144A94(SramContext* sramCtx); -// void func_80144E78(void); -// void func_8014546C(void); -// void func_80145698(void); -void func_801457CC(GameState* gameState, SramContext* param_2); -void func_80146580(s32 param_1, SramContext* param_2, s32 param_3); -// void func_80146628(void); -// void func_80146AA0(void); -// void func_80146DF8(void); -void func_80146E40(GameState* gameState, SramContext* sramCtx); -void Sram_Alloc(GameState* gameState, SramContext* sramCtx); -// void func_80146EBC(SramContext* param_1, UNK_TYPE4 param_2, UNK_TYPE4 param_3); -void func_80146EE8(GlobalContext* globalCtx); -void func_80146F5C(GlobalContext* globalCtx); -// void func_80147008(void); -void func_80147020(SramContext* param_1); -void func_80147068(SramContext* param_1); -// void func_80147138(SramContext* param_1, UNK_TYPE4 param_2, UNK_TYPE4 param_3); -void func_80147150(SramContext* param_1); -void func_80147198(SramContext* param_1); -// void func_80147314(void); -// void func_80147414(void); -// void Sram_nop8014750C(UNK_TYPE4 param_1); + // void func_80147520(void); void func_80147564(GlobalContext* globalCtx); s32 Message_ShouldAdvance(GlobalContext* globalCtx); @@ -3234,17 +3202,17 @@ void Slowly_Stop(SlowlyTask* slowly); // char* func_801857D0(void); // void func_80185864(void); u32 func_80185908(void); -// void func_80185968(void); +UNK_TYPE func_80185968(void* arg0, UNK_TYPE arg1, UNK_TYPE arg2); // void func_801859F0(void); // void func_80185A2C(void); // void func_80185B1C(void); // void func_80185BE4(void); // void func_80185C24(void); void SysFlashrom_ThreadEntry(s80185D40* param_1); -// void func_80185DDC(void); -// void func_80185EC4(void); -// void func_80185F04(void); -// void func_80185F64(void); +void func_80185DDC(u8* arg0, u32 arg1, u32 arg2); +s32 func_80185EC4(void); +s32 func_80185F04(void); +void func_80185F64(void* arg0, UNK_TYPE arg1, UNK_TYPE arg2); s32 func_80185F90(u32 param_1); u32 osFlashGetAddr(u32 pageNum); OSPiHandle* osFlashReInit(u8 latency, u8 pulse, u8 pageSize, u8 relDuration, u32 start); @@ -3606,7 +3574,7 @@ void func_801A3B48(UNK_TYPE arg0); // void func_801A3B90(void); void func_801A3CD8(s8 param_1); // void func_801A3CF4(void); -// void func_801A3D98(void); +void func_801A3D98(s8 audioSetting); // void func_801A3E38(void); // void func_801A3EC0(void); void Audio_SetCutsceneFlag(u8 flag); diff --git a/include/ichain.h b/include/ichain.h index f9131545c2..07bd073133 100644 --- a/include/ichain.h +++ b/include/ichain.h @@ -1,5 +1,5 @@ -#ifndef _ICHAIN_H_ -#define _ICHAIN_H_ +#ifndef ICHAIN_H +#define ICHAIN_H #include "libc/stddef.h" diff --git a/include/macros.h b/include/macros.h index 8b5ec577f8..64f084efec 100644 --- a/include/macros.h +++ b/include/macros.h @@ -44,10 +44,10 @@ // linkAge still exists in MM, but is always set to 0 (always adult) // There are remnants of these macros from OOT, but they are essentially useless -#define LINK_IS_CHILD (gSaveContext.linkAge == 1) -#define LINK_IS_ADULT (gSaveContext.linkAge == 0) +#define LINK_IS_CHILD (gSaveContext.save.linkAge == 1) +#define LINK_IS_ADULT (gSaveContext.save.linkAge == 0) -#define CURRENT_DAY (((void)0, gSaveContext.day) % 5) +#define CURRENT_DAY (((void)0, gSaveContext.save.day) % 5) #define TIME_TO_MINUTES(time) (s32)((time) * ((24 * 60) / 0x10000)) #define CLOCK_TIME(hr, min) (s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60)) @@ -60,28 +60,53 @@ #define CLOCK_TIME_ALT_F(hr, min) (((hr) * 60.0f + (min)) / (24.0f * 60.0f / 0x10000)) #define SLOT(item) gItemSlots[item] -#define AMMO(item) gSaveContext.inventory.ammo[SLOT(item)] -#define INV_CONTENT(item) gSaveContext.inventory.items[SLOT(item)] +#define AMMO(item) gSaveContext.save.inventory.ammo[SLOT(item)] +#define INV_CONTENT(item) gSaveContext.save.inventory.items[SLOT(item)] +#define GET_INV_CONTENT(item) ((void)0, gSaveContext.save.inventory.items)[SLOT(item)] -#define ALL_EQUIP_VALUE_VOID(equip) \ - ((((void)0, gSaveContext.inventory.equipment) & gEquipMasks[equip]) >> gEquipShifts[equip]) -#define CUR_EQUIP_VALUE_VOID(equip) \ - ((((void)0, gSaveContext.equips.equipment) & gEquipMasks[equip]) >> gEquipShifts[equip]) -#define CUR_UPG_VALUE_VOID(upg) \ - ((((void)0, gSaveContext.inventory.upgrades) & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) -#define INV_CONTENT_VOID(item) ((void)0, gSaveContext.inventory.items)[SLOT(item)] +#define CUR_FORM ((gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) ? 0 : gSaveContext.save.playerForm) -#define CUR_FORM ((gSaveContext.playerForm == PLAYER_FORM_HUMAN) ? 0 : gSaveContext.playerForm) +#define GET_SAVE_EQUIPS_EQUIPMENT ((void)0, gSaveContext.save.equips.equipment) +#define GET_SAVE_INVENTORY_UPGRADES ((void)0, gSaveContext.save.inventory.upgrades) +#define GET_SAVE_INVENTORY_QUEST_ITEMS ((void)0, gSaveContext.save.inventory.questItems) -#define ALL_EQUIP_VALUE(equip) ((gSaveContext.inventory.equipment & gEquipMasks[equip]) >> gEquipShifts[equip]) -#define CUR_EQUIP_VALUE(equip) ((gSaveContext.equips.equipment & gEquipMasks[equip]) >> gEquipShifts[equip]) -#define CUR_UPG_VALUE(upg) ((gSaveContext.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) -#define SET_EQUIP_VALUE(equip, value) (gSaveContext.equips.equipment = ((((void)0, gSaveContext.equips.equipment) & (gEquipNegMasks[equip])) | (u16)((u16)(value) << gEquipShifts[equip]))) -#define CUR_FORM_EQUIP(button) (gSaveContext.equips.buttonItems[CUR_FORM][button]) -#define CHECK_QUEST_ITEM(item) (((void)0, gSaveContext.inventory.questItems) & gBitFlags[item]) -#define REMOVE_QUEST_ITEM(item) (gSaveContext.inventory.questItems = (((void)0, gSaveContext.inventory.questItems) & (-1 - gBitFlags[item]))) -#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.inventory.dungeonItems[(void)0, dungeonIndex] & gBitFlags[item]) -#define DUNGEON_KEY_COUNT(dungeonIndex) (gSaveContext.inventory.dungeonKeys[(void)0, dungeonIndex]) +#define GET_CUR_EQUIP_VALUE(equip) ((GET_SAVE_EQUIPS_EQUIPMENT & gEquipMasks[equip]) >> gEquipShifts[equip]) + +#define CUR_UPG_VALUE(upg) ((gSaveContext.save.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) +#define GET_CUR_UPG_VALUE(upg) ((GET_SAVE_INVENTORY_UPGRADES & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) + +#define SET_EQUIP_VALUE(equip, value) (gSaveContext.save.equips.equipment = ((GET_SAVE_EQUIPS_EQUIPMENT & gEquipNegMasks[equip]) | (u16)((u16)(value) << gEquipShifts[equip]))) + +#define BUTTON_ITEM_EQUIP(form, button) (gSaveContext.save.equips.buttonItems[form][button]) +#define CUR_FORM_EQUIP(button) BUTTON_ITEM_EQUIP(CUR_FORM, button) + +#define C_SLOT_EQUIP(form, button) (gSaveContext.save.equips.cButtonSlots[form][button]) +#define CHECK_QUEST_ITEM(item) (GET_SAVE_INVENTORY_QUEST_ITEMS & gBitFlags[item]) +#define REMOVE_QUEST_ITEM(item) (gSaveContext.save.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS & (-1 - gBitFlags[item]))) + +#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.inventory.dungeonItems[(void)0, dungeonIndex] & gBitFlags[item]) +#define DUNGEON_KEY_COUNT(dungeonIndex) (gSaveContext.save.inventory.dungeonKeys[(void)0, dungeonIndex]) + +#define GET_CUR_FORM_BTN_ITEM(btn) ((u8)((btn) == EQUIP_SLOT_B ? BUTTON_ITEM_EQUIP(CUR_FORM, btn) : BUTTON_ITEM_EQUIP(0, btn))) + +#define SET_CUR_FORM_BTN_ITEM(btn, item) \ + do { \ + if ((btn) == EQUIP_SLOT_B) { \ + BUTTON_ITEM_EQUIP(CUR_FORM, (btn)) = (item); \ + } else { \ + BUTTON_ITEM_EQUIP(0, (btn)) = (item); \ + } \ + } while (0) + +#define STOLEN_ITEM_NONE (0) + +#define STOLEN_ITEM_1 ((gSaveContext.save.stolenItems & 0xFF000000) >> 0x18) +#define STOLEN_ITEM_2 ((gSaveContext.save.stolenItems & 0x00FF0000) >> 0x10) + +#define SET_STOLEN_ITEM_1(itemId) \ + (gSaveContext.save.stolenItems = (gSaveContext.save.stolenItems & ~0xFF000000) | ((itemId & 0xFF) << 0x18)) +#define SET_STOLEN_ITEM_2(itemId) \ + (gSaveContext.save.stolenItems = (gSaveContext.save.stolenItems & ~0x00FF0000) | ((itemId & 0xFF) << 0x10)) #define CAPACITY(upg, value) gUpgradeCapacities[upg][value] #define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg)) @@ -182,4 +207,4 @@ extern GraphicsContext* __gfxCtx; #define ALIGNED8 #endif -#endif // _MACROS_H_ +#endif // MACROS_H diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 3f02baa5c0..e133437cc2 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -1,7 +1,8 @@ -#ifndef _SEGMENT_SYMBOLS_H_ -#define _SEGMENT_SYMBOLS_H_ +#ifndef SEGMENT_SYMBOLS_H +#define SEGMENT_SYMBOLS_H -#include "z64.h" +#include "libc/stddef.h" +#include "PR/ultratypes.h" #define DECLARE_SEGMENT(name) \ extern u8 _##name##SegmentStart[]; \ diff --git a/include/variables.h b/include/variables.h index 399fadc986..c5047526c8 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1369,36 +1369,7 @@ extern s32 D_801C5E9C[]; // D_801C5E9C extern s32 D_801C5EB0[]; // D_801C5EB0 extern s16 D_801C5EC4[]; // D_801C5EC4 extern struct_801C5F44 D_801C5F44[]; // D_801C5F44 -// extern UNK_TYPE4 D_801C5FC0; -// extern UNK_TYPE4 D_801C5FC4; -// extern UNK_TYPE4 D_801C5FC8; -// extern UNK_TYPE4 D_801C5FCC; -// extern UNK_TYPE4 D_801C5FD0; -// extern UNK_TYPE2 D_801C66D0; -// extern UNK_TYPE4 D_801C6798; -// extern UNK_TYPE1 D_801C67B0; -// extern UNK_TYPE4 D_801C67C8; -// extern UNK_TYPE4 D_801C67CC; -// extern UNK_TYPE4 D_801C67E8; -// extern UNK_TYPE4 D_801C67F0; -// extern UNK_TYPE4 D_801C67F4; -// extern UNK_TYPE1 D_801C6818; -// extern UNK_TYPE4 D_801C6838; -// extern UNK_TYPE1 D_801C6840; -// extern UNK_TYPE1 D_801C6850; -// extern UNK_TYPE1 D_801C6870; -// extern UNK_TYPE1 D_801C6890; -// extern UNK_TYPE1 D_801C6898; -// extern UNK_TYPE1 D_801C68C0; -extern Inventory gSaveDefaultInventory; -extern u16 gSaveDefaultChecksum; -// extern UNK_TYPE1 D_801C6970; -// extern UNK_TYPE1 D_801C6998; -extern Inventory D_801C69BC; -extern u16 D_801C6A44; -// extern UNK_TYPE1 D_801C6A48; -// extern UNK_TYPE1 D_801C6A50; -// extern UNK_TYPE1 D_801C6A58; + // extern UNK_TYPE1 D_801C6A70; // extern UNK_TYPE2 D_801C6A74; // extern UNK_TYPE2 D_801C6A78; diff --git a/include/z64.h b/include/z64.h index 5c6c931a46..f49686c6c2 100644 --- a/include/z64.h +++ b/include/z64.h @@ -315,19 +315,6 @@ typedef struct { /* 0x3 */ s8 pillarboxMagnitude; } ShrinkWindowContext; // size = 0x4 -typedef struct { - /* 0x00 */ u8* readBuff; - /* 0x04 */ u32* flashReadBuff; - /* 0x08 */ char unk_08[4]; - /* 0x0C */ s16 status; - /* 0x10 */ u32 curPage; - /* 0x14 */ u32 numPages; - /* 0x18 */ OSTime unk_18; - /* 0x20 */ s16 unk_20; - /* 0x22 */ s16 unk_22; - /* 0x24 */ s16 unk_24; -} SramContext; // size = 0x28 - typedef struct { /* 0x0 */ s32 topY; /* 0x4 */ s32 bottomY; diff --git a/include/z64item.h b/include/z64item.h index 00eb0a5a8d..77ceb240cb 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -31,7 +31,7 @@ typedef enum { /* 0x05 */ QUEST_SWORD, /* 0x06 */ QUEST_SONG_SONATA, /* 0x07 */ QUEST_SONG_LULLABY, - /* 0x08 */ QUEST_SONG_NOVA, + /* 0x08 */ QUEST_SONG_BOSSA_NOVA, /* 0x09 */ QUEST_SONG_ELEGY, /* 0x0A */ QUEST_SONG_OATH, /* 0x0B */ QUEST_SONG_SARIA, @@ -261,6 +261,7 @@ typedef enum { /* 0xA1 */ ITEM_GOLD_DUST_2, /* 0xA2 */ ITEM_HYLIAN_LOACH_2, /* 0xA3 */ ITEM_SEA_HORSE_CAUGHT, + /* 0xFD */ ITEM_UNK_FD = 0xFD, /* 0xFF */ ITEM_NONE = 0xFF } ItemID; diff --git a/include/z64save.h b/include/z64save.h index b7f4e60fd0..2595b3c275 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -1,99 +1,142 @@ -#ifndef _Z64SAVE_H_ -#define _Z64SAVE_H_ +#ifndef Z64SAVE_H +#define Z64SAVE_H #include "ultra64.h" #include "z64math.h" #include "os.h" -typedef struct { - /* 0x00 */ u8 buttonItems[4][4]; - /* 0x10 */ u8 cButtonSlots[4][4]; - /* 0x20 */ u16 equipment; -} ItemEquips; // size = 0x0A +struct GameState; +struct GlobalContext; +struct FileChooseContext; -typedef struct { - /* 0x00 */ u8 items[24]; - /* 0x18 */ u8 masks[24]; - /* 0x30 */ s8 ammo[24]; - /* 0x48 */ u32 upgrades; // some bits are wallet upgrades - /* 0x4C */ u32 questItems; - /* 0x50 */ u8 dungeonItems[10]; - /* 0x5A */ s8 dungeonKeys[10]; - /* 0x64 */ s8 strayFairies[10]; // "orange_fairy" - /* 0x6E */ char dekuPlaygroundPlayerName[3][8]; // Stores playerName (8 char) over (3 days) when getting a new high score. original name: degnuts_memory_name +// TODO: properly name DOWN, RETURN and TOP +typedef enum RespawnMode { + /* 0 */ RESTART_MODE_DOWN, // "RESTART_MODE_DOWN" + /* 1 */ RESTART_MODE_RETURN, // "RESTART_MODE_RETURN" + /* 2 */ RESTART_MODE_TOP, // "RESTART_MODE_TOP" + /* 3 */ RESPAWN_MODE_UNK_3, // Maybe related to grottos + /* 4 */ RESPAWN_MODE_GORON, // "RESTART_MODE_GORON" + /* 5 */ RESPAWN_MODE_ZORA, // "RESTART_MODE_ZORA" + /* 6 */ RESPAWN_MODE_DEKU, // "RESTART_MODE_NUTS" + /* 7 */ RESPAWN_MODE_HUMAN, // "RESTART_MODE_CHILD" + /* 8 */ RESPAWN_MODE_MAX +} RespawnMode; + +#define SAVE_BUFFER_SIZE 0x4000 + +typedef struct SramContext { + /* 0x00 */ u8* readBuff; + /* 0x04 */ u8 *saveBuf; + /* 0x08 */ char unk_08[4]; + /* 0x0C */ s16 status; + /* 0x10 */ u32 curPage; + /* 0x14 */ u32 numPages; + /* 0x18 */ OSTime unk_18; + /* 0x20 */ s16 unk_20; + /* 0x22 */ s16 unk_22; + /* 0x24 */ s16 unk_24; +} SramContext; // size = 0x28 + +typedef struct ItemEquips { + /* 0x00 */ u8 buttonItems[4][4]; // "register_item" + /* 0x10 */ u8 cButtonSlots[4][4]; // "register_item_pt" + /* 0x20 */ u16 equipment; +} ItemEquips; // size = 0x22 + +typedef struct Inventory { + /* 0x00 */ u8 items[48]; // "item_register", first 24 elements are normal items and the other 24 are masks + /* 0x30 */ s8 ammo[24]; // "item_count" + /* 0x48 */ u32 upgrades; // "non_equip_register" some bits are wallet upgrades + /* 0x4C */ u32 questItems; // "collect_register" + /* 0x50 */ u8 dungeonItems[10]; // "key_compass_map" + /* 0x5A */ s8 dungeonKeys[10]; // "key_register" + /* 0x64 */ s8 strayFairies[10]; // "orange_fairy" + /* 0x6E */ char dekuPlaygroundPlayerName[3][8]; // "degnuts_memory_name" Stores playerName (8 char) over (3 days) when getting a new high score } Inventory; // size = 0x88 -typedef struct { - /* 0x00 */ s16 scene; - /* 0x02 */ Vec3s pos; - /* 0x08 */ s16 angle; +typedef struct HorseData { + /* 0x00 */ s16 scene; // "spot_no" + /* 0x02 */ Vec3s pos; // "horse_x", "horse_y" and "horse_z" + /* 0x08 */ s16 yaw; // "horse_a" } HorseData; // size = 0x0A -typedef struct { - /* 0x0 */ Vec3f pos; - /* 0xC */ s16 yaw; - /* 0xE */ s16 playerParams; +typedef struct RespawnData { + /* 0x00 */ Vec3f pos; + /* 0x0C */ s16 yaw; + /* 0x0E */ s16 playerParams; /* 0x10 */ u16 entranceIndex; /* 0x12 */ u8 roomIndex; /* 0x13 */ s8 data; - /* 0x14 */ u32 tempSwchFlags; + /* 0x14 */ u32 tempSwitchFlags; /* 0x18 */ u32 unk_18; /* 0x1C */ u32 tempCollectFlags; } RespawnData; // size = 0x20 -typedef struct { +typedef struct PermanentSceneFlags { /* 0x00 */ u32 chest; - /* 0x04 */ u32 swch0; - /* 0x08 */ u32 swch1; + /* 0x04 */ u32 switch0; + /* 0x08 */ u32 switch1; /* 0x0C */ u32 clearedRoom; /* 0x10 */ u32 collectible; /* 0x14 */ u32 unk_14; /* 0x18 */ u32 unk_18; } PermanentSceneFlags; // size = 0x1C -typedef struct { +typedef struct CycleSceneFlags { /* 0x00 */ u32 chest; - /* 0x04 */ u32 swch0; - /* 0x08 */ u32 swch1; + /* 0x04 */ u32 switch0; + /* 0x08 */ u32 switch1; /* 0x0C */ u32 clearedRoom; /* 0x10 */ u32 collectible; } CycleSceneFlags; // size = 0x14 -typedef struct { - /* 0x0000 */ u32 entranceIndex; // "scene_no" - /* 0x0004 */ u8 equippedMask; // "player_mask" - /* 0x0005 */ u8 unk_05; // "opening_flag" +typedef struct SaveOptions { + /* 0x00 */ u16 optionId; // "option_id" + /* 0x02 */ u8 language; // "j_n" + /* 0x03 */ s8 audioSetting; // "s_sound" + /* 0x04 */ u8 languageSetting; // "language" + /* 0x05 */ u8 zTargetSetting; // "z_attention", 0: Switch; 1: Hold +} SaveOptions; // size = 0x06 + +typedef struct SavePlayerData { + /* 0x0000 */ char newf[6]; // "newf" Will always be "ZELDA3 for a valid save + /* 0x0006 */ u16 deaths; // "savect" + /* 0x0008 */ char playerName[8]; // "player_name" + /* 0x0010 */ s16 healthCapacity; // "max_life" + /* 0x0012 */ s16 health; // "now_life" + /* 0x0014 */ s8 magicLevel; // "magic_max" + /* 0x0015 */ s8 magic; // "magic_now" + /* 0x0016 */ s16 rupees; // "lupy_count" + /* 0x0018 */ u16 swordHealth; // "long_sword_hp" + /* 0x001A */ u16 tatlTimer; // "navi_timer" + /* 0x001C */ u8 magicAcquired; // "magic_mode" + /* 0x001D */ u8 doubleMagic; // "magic_ability" + /* 0x001E */ u8 doubleDefense; // "life_ability" + /* 0x001F */ u8 unk_1F; // "ocarina_round" + /* 0x0020 */ u8 unk_20; // "first_memory" + /* 0x0022 */ u16 owlActivationFlags; // "memory_warp_point" + /* 0x0024 */ u8 unk_24; // "last_warp_pt" + /* 0x0026 */ s16 savedSceneNum; // "scene_data_ID" +} SavePlayerData; // size = 0x28 + +typedef struct Save { + /* 0x0000 */ u32 entranceIndex; // "scene_no" + /* 0x0004 */ u8 equippedMask; // "player_mask" + /* 0x0005 */ u8 isFirstCycle; // "opening_flag" /* 0x0006 */ u8 unk_06; - /* 0x0007 */ u8 linkAge; // "link_age" - /* 0x0008 */ s32 cutscene; // "day_time" - /* 0x000C */ u16 time; // "zelda_time" + /* 0x0007 */ u8 linkAge; // "link_age" + /* 0x0008 */ s32 cutscene; // "day_time" + /* 0x000C */ u16 time; // "zelda_time" /* 0x000E */ u16 owlSaveLocation; - /* 0x0010 */ s32 isNight; // "asahiru_fg" - /* 0x0014 */ u32 unk_14; // "change_zelda_time" - /* 0x0018 */ s32 day; // "totalday" - /* 0x001C */ u32 daysElapsed; // "eventday" - /* 0x0020 */ u8 playerForm; // "player_character" - /* 0x0021 */ u8 snowheadCleared; // "spring_flag" - /* 0x0022 */ u8 hasTatl; // "bell_flag" + /* 0x0010 */ s32 isNight; // "asahiru_fg" + /* 0x0014 */ u32 daySpeed; // "change_zelda_time" + /* 0x0018 */ s32 day; // "totalday" + /* 0x001C */ u32 daysElapsed; // "eventday" + /* 0x0020 */ u8 playerForm; // "player_character" + /* 0x0021 */ u8 snowheadCleared; // "spring_flag" + /* 0x0022 */ u8 hasTatl; // "bell_flag" /* 0x0023 */ u8 isOwlSave; - /* 0x0024 */ char newf[6]; // Will always be "ZELDA3" for a valid save - /* 0x002B */ u16 deaths; // "savect" - /* 0x002C */ char playerName[8]; // "player_name" - /* 0x0034 */ s16 healthCapacity; // "max_life" - /* 0x0036 */ s16 health; // "now_life" - /* 0x0038 */ s8 magicLevel; // "magic_max" - /* 0x0039 */ s8 magic; // "magic_now" - /* 0x003A */ s16 rupees; // "lupy_count" - /* 0x003C */ u16 swordHealth; // "long_sword_hp" - /* 0x003E */ u16 tatlTimer; // "navi_timer" - /* 0x0040 */ u8 magicAcquired; // "magic_mode" - /* 0x0041 */ u8 doubleMagic; // "magic_ability" - /* 0x0042 */ u8 doubleDefense; // "life_ability" - /* 0x0043 */ u8 unk_43; // "ocarina_round" - /* 0x0044 */ u8 unk_44; // "first_memory" - /* 0x0046 */ u16 owlActivationFlags; // "memory_warp_point" - /* 0x0048 */ u8 unk_48; // "last_warp_pt" - /* 0x004A */ s16 savedSceneNum; // "scene_data_ID" + /* 0x0024 */ SavePlayerData playerData; /* 0x004C */ ItemEquips equips; /* 0x0070 */ Inventory inventory; /* 0x00F8 */ PermanentSceneFlags permanentSceneFlags[120]; @@ -103,144 +146,167 @@ typedef struct { /* 0x0E7C */ u32 pictoFlags1; /* 0x0E80 */ u32 unk_E80; /* 0x0E84 */ u32 unk_E84; - /* 0x0E88 */ u32 unk_E88[7]; // Invadepoh flags - /* 0x0EA4 */ u32 scenesVisible[7]; // tingle maps and clouded regions on pause map. Stores scenes bitwise for up to 224 scenes even though there are not that many scenes - /* 0x0EC0 */ u32 skullTokenCount; // upper 16 bits store Swamp skulls, lower 16 bits store Ocean skulls - /* 0x0EC4 */ u32 unk_EC4; // Gossic stone heart piece flags + /* 0x0E88 */ u32 unk_E88[7]; // Invadepoh flags + /* 0x0EA4 */ u32 scenesVisible[7]; // tingle maps and clouded regions on pause map. Stores scenes bitwise for up to 224 scenes even though there are not that many scenes + /* 0x0EC0 */ u32 skullTokenCount; // upper 16 bits store Swamp skulls, lower 16 bits store Ocean skulls + /* 0x0EC4 */ u32 unk_EC4; // Gossic stone heart piece flags /* 0x0EC8 */ u32 unk_EC8; - /* 0x0ECC */ u32 unk_ECC[2]; // Related to blue warps - /* 0x0ED4 */ u32 stolenItems; // Items stolen by Takkuri and given to Curiosity Shop Man + /* 0x0ECC */ u32 unk_ECC[2]; // Related to blue warps + /* 0x0ED4 */ u32 stolenItems; // Items stolen by Takkuri and given to Curiosity Shop Man /* 0x0ED8 */ u32 unk_DD8; /* 0x0EDC */ u32 bankRupees; /* 0x0EE0 */ u32 unk_EE0; - /* 0x0EE4 */ u32 unk_EE4; // Fishing flags + /* 0x0EE4 */ u32 unk_EE4; // Fishing flags /* 0x0EE8 */ u32 unk_EE8; /* 0x0EEC */ u32 horseBackBalloonHighScore; - /* 0x0EF0 */ u32 lotteryCodeGuess; // Lottery code chosen by player (only uses lower three hex digits) - /* 0x0EF4 */ u32 unk_EF4; // Shooting Gallery Man Flags - /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" - /* 0x0F5C */ u32 mapsVisited; // "area_arrival" - /* 0x0F60 */ u32 mapsVisible; // "cloud_clear" - /* 0x0F64 */ u8 unk_F64; // "oca_rec_flag" - /* 0x0F65 */ u8 unk_F65; // "oca_rec_flag8" - /* 0x0F66 */ u8 unk_F66[128]; // "oca_rec_buff8" - /* 0x0FE6 */ s8 unk_FE6; // "aikotoba_index" - /* 0x0FE7 */ s8 unk_FE7[5]; // "aikotoba_table" - /* 0x0FEC */ s8 lotteryCodes[3][3]; // Preset lottery codes "numbers_table" - /* 0x0FF5 */ s8 spiderHouseMaskOrder[6]; // "kinsta_color_table" - /* 0x0FFB */ s8 bomberCode[5]; // "bombers_aikotoba_table" + /* 0x0EF0 */ u32 lotteryCodeGuess; // Lottery code chosen by player (only uses lower three hex digits) + /* 0x0EF4 */ u32 unk_EF4; // Shooting Gallery Man Flags + /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" + /* 0x0F5C */ u32 mapsVisited; // "area_arrival" + /* 0x0F60 */ u32 mapsVisible; // "cloud_clear" + /* 0x0F64 */ u8 unk_F64; // "oca_rec_flag" has scarecrows song + /* 0x0F65 */ u8 unk_F65; // "oca_rec_flag8" scarecrows song set? + /* 0x0F66 */ u8 scarecrowsSong[128]; + /* 0x0FE6 */ s8 bombersCaughtNum; // "aikotoba_index" + /* 0x0FE7 */ s8 bombersCaughtOrder[5]; // "aikotoba_table" + /* 0x0FEC */ s8 lotteryCodes[3][3]; // "numbers_table", Preset lottery codes + /* 0x0FF5 */ s8 spiderHouseMaskOrder[6]; // "kinsta_color_table" + /* 0x0FFB */ s8 bomberCode[5]; // "bombers_aikotoba_table" /* 0x1000 */ HorseData horseData; - /* 0x100A */ u16 checksum; // "check_sum" - /* 0x100C */ u8 eventInf[8]; - /* 0x1014 */ u8 unk_1014; // "stone_set_flag" + /* 0x100A */ u16 checksum; // "check_sum" +} Save; // size = 0x100C + +typedef struct SaveContext { + /* 0x0000 */ Save save; + /* 0x100C */ u8 eventInf[8]; // "event_inf" + /* 0x1014 */ u8 unk_1014; // "stone_set_flag" /* 0x1015 */ u8 unk_1015; /* 0x1016 */ u16 jinxTimer; - /* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct" - /* 0x101A */ u8 unk_101A[6]; // "bottle_status", one entry for each bottle - /* 0x1020 */ OSTime unk_1020[6]; // "bottle_ostime", one entry for each bottle - /* 0x1050 */ OSTime unk_1050[6]; // "bottle_sub", one entry for each bottle - /* 0x1080 */ OSTime unk_1080[6]; // "bottle_time", one entry for each bottle - /* 0x10B0 */ OSTime unk_10B0[6]; // "bottle_stop_time", one entry for each bottle - /* 0x10E0 */ u64 pictoPhoto[1400]; // buffer containing the pictograph photo - /* 0x3CA0 */ s32 fileNum; // "file_no" - /* 0x3CA4 */ s16 powderKegTimer; // "big_bom_timer" + /* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct" + /* 0x101A */ u8 unk_101A[6]; // "bottle_status", one entry for each bottle + /* 0x1020 */ OSTime unk_1020[6]; // "bottle_ostime", one entry for each bottle + /* 0x1050 */ OSTime unk_1050[6]; // "bottle_sub", one entry for each bottle + /* 0x1080 */ OSTime unk_1080[6]; // "bottle_time", one entry for each bottle + /* 0x10B0 */ OSTime unk_10B0[6]; // "bottle_stop_time", one entry for each bottle + /* 0x10E0 */ u64 pictoPhoto[1400]; // buffer containing the pictograph photo + /* 0x3CA0 */ s32 fileNum; // "file_no" + /* 0x3CA4 */ s16 powderKegTimer; // "big_bom_timer" /* 0x3CA6 */ u8 unk_3CA6; - /* 0x3CA7 */ u8 unk_3CA7; // "day_night_flag" - /* 0x3CA8 */ s32 gameMode; // "mode" - /* 0x3CAC */ s32 sceneSetupIndex; // "counter" - /* 0x3CB0 */ s32 respawnFlag; // "restart_flag" - /* 0x3CB4 */ RespawnData respawn[8]; // "restart_data" - /* 0x3DB4 */ f32 entranceSpeed; // "player_wipe_speedF" - /* 0x3DB8 */ u16 entranceSound; // "player_wipe_door_SE" - /* 0x3DBA */ u8 unk_3DBA; // "player_wipe_item" - /* 0x3DBB */ u8 unk_3DBB; // "next_walk" - /* 0x3DBC */ u16 dogParams; // "dog_flag" - /* 0x3DBE */ u8 textTriggerFlags; // "guide_status" - /* 0x3DBF */ u8 showTitleCard; // "name_display" - /* 0x3DC0 */ s16 unk_3DC0; // "shield_magic_timer" - /* 0x3DC2 */ u8 unk_3DC2; // "pad1" - /* 0x3DC8 */ OSTime unk_3DC8; // "get_time" - /* 0x3DD0 */ u8 unk_3DD0[7]; // "event_fg" - /* 0x3DD7 */ u8 unk_3DD7[7]; // "calc_flag" - /* 0x3DE0 */ OSTime unk_3DE0[7]; // "event_ostime" - /* 0x3E18 */ OSTime unk_3E18[7]; // "event_sub" - /* 0x3E50 */ OSTime unk_3E50[7]; // "func_time" - /* 0x3E88 */ OSTime unk_3E88[7]; // "func_end_time" - /* 0x3EC0 */ OSTime unk_3EC0[7]; // "func_stop_time" - /* 0x3EF8 */ s16 timerX[7]; // "event_xp" - /* 0x3F06 */ s16 timerY[7]; // "event_yp" - /* 0x3F14 */ s16 unk_3F14; // "character_change" - /* 0x3F16 */ u8 seqIndex; // "old_bgm" - /* 0x3F17 */ u8 nightSeqIndex; // "old_env" - /* 0x3F18 */ u8 buttonStatus[6]; // "button_item" - /* 0x3F1E */ u8 unk_3F1E; // "ck_fg" - /* 0x3F20 */ u16 unk_3F20; // "alpha_type" - /* 0x3F22 */ u16 unk_3F22; // "prev_alpha_type" - /* 0x3F24 */ u16 unk_3F24; // "alpha_count" - /* 0x3F26 */ u16 unk_3F26; // "last_time_type" - /* 0x3F28 */ s16 unk_3F28; // "magic_flag" - /* 0x3F2A */ s16 unk_3F2A; // "recovery_magic_flag" - /* 0x3F2C */ s16 unk_3F2C; // "keep_magic_flag" - /* 0x3F2E */ s16 unk_3F2E; // "magic_now_max" - /* 0x3F30 */ s16 unk_3F30; // "magic_now_now" - /* 0x3F32 */ s16 unk_3F32; // "magic_used" - /* 0x3F34 */ s16 unk_3F34; // "magic_recovery" - /* 0x3F36 */ u16 mapIndex; // "scene_ID" - /* 0x3F38 */ u16 minigameState; // "yabusame_mode" - /* 0x3F3A */ u16 minigameScore; // "yabusame_total" - /* 0x3F3C */ u16 unk_3F3C; // "yabusame_out_ct" - /* 0x3F3E */ u8 unk_3F3E; // "no_save" - /* 0x3F3F */ u8 unk_3F3F; // "flash_flag" - /* 0x3F40 */ u16 option_id; // "option_id" - /* 0x3F42 */ u8 language; // "j_n" - /* 0x3F43 */ u8 audioSetting; // "s_sound" - /* 0x3F44 */ u8 unk_3F44; // "language" - /* 0x3F45 */ u8 zTargetSetting; // 0: Switch; 1: Hold - /* 0x3F46 */ u16 unk_3F46; // "NottoriBgm" - /* 0x3F48 */ u8 unk_3F48; // "fade_go" - /* 0x3F4A */ u16 nextCutsceneIndex; // "next_daytime" - /* 0x3F4C */ u8 cutsceneTrigger; // "doukidemo" - /* 0x3F4D */ u8 unk_3F4D; // "Kenjya_no" - /* 0x3F4E */ u16 nextDayTime; // "next_zelda_time" - /* 0x3F50 */ u8 fadeDuration; // "fade_speed" - /* 0x3F51 */ u8 unk_3F51; // "wipe_speed" - /* 0x3F52 */ u16 environmentTime; // "kankyo_time" - /* 0x3F54 */ u8 dogIsLost; // "dog_event_flag" - /* 0x3F55 */ u8 nextTransition; // "next_wipe" - /* 0x3F56 */ s16 worldMapArea; // "area_type" - /* 0x3F58 */ s16 sunsSongState; // "sunmoon_flag" - /* 0x3F5A */ s16 healthAccumulator; // "life_mode" - /* 0x3F5C */ s32 unk_3F5C; // "bet_rupees" - /* 0x3F60 */ u8 unk_3F60; // "framescale_flag" - /* 0x3F64 */ f32 unk_3F64; // "framescale_scale" - /* 0x3F68 */ CycleSceneFlags cycleSceneFlags[120]; // Scene flags that are temporarily stored over the duration of a single 3-day cycle - /* 0x48C8 */ u16 unk_48C8; // "scene_id_mix" - /* 0x48CA */ u8 maskMaskBit[3]; // masks given away on the Moon - /* 0x48CD */ char unk_48CD[24]; + /* 0x3CA7 */ u8 unk_3CA7; // "day_night_flag" + /* 0x3CA8 */ s32 gameMode; // "mode" + /* 0x3CAC */ s32 sceneSetupIndex; // "counter" + /* 0x3CB0 */ s32 respawnFlag; // "restart_flag" + /* 0x3CB4 */ RespawnData respawn[RESPAWN_MODE_MAX]; // "restart_data" + /* 0x3DB4 */ f32 entranceSpeed; // "player_wipe_speedF" + /* 0x3DB8 */ u16 entranceSound; // "player_wipe_door_SE" + /* 0x3DBA */ u8 unk_3DBA; // "player_wipe_item" + /* 0x3DBB */ u8 unk_3DBB; // "next_walk" + /* 0x3DBC */ u16 dogParams; // "dog_flag" + /* 0x3DBE */ u8 textTriggerFlags; // "guide_status" + /* 0x3DBF */ u8 showTitleCard; // "name_display" + /* 0x3DC0 */ s16 unk_3DC0; // "shield_magic_timer" + /* 0x3DC2 */ u8 unk_3DC2; // "pad1" + /* 0x3DC8 */ OSTime unk_3DC8; // "get_time" + /* 0x3DD0 */ u8 unk_3DD0[7]; // "event_fg" + /* 0x3DD7 */ u8 unk_3DD7[7]; // "calc_flag" + /* 0x3DE0 */ OSTime unk_3DE0[7]; // "event_ostime" + /* 0x3E18 */ OSTime unk_3E18[7]; // "event_sub" + /* 0x3E50 */ OSTime unk_3E50[7]; // "func_time" + /* 0x3E88 */ OSTime unk_3E88[7]; // "func_end_time" + /* 0x3EC0 */ OSTime unk_3EC0[7]; // "func_stop_time" + /* 0x3EF8 */ s16 timerX[7]; // "event_xp" + /* 0x3F06 */ s16 timerY[7]; // "event_yp" + /* 0x3F14 */ s16 unk_3F14; // "character_change" + /* 0x3F16 */ u8 seqIndex; // "old_bgm" + /* 0x3F17 */ u8 nightSeqIndex; // "old_env" + /* 0x3F18 */ u8 buttonStatus[6]; // "button_item" + /* 0x3F1E */ u8 unk_3F1E; // "ck_fg" + /* 0x3F20 */ u16 unk_3F20; // "alpha_type" + /* 0x3F22 */ u16 unk_3F22; // "prev_alpha_type" + /* 0x3F24 */ u16 unk_3F24; // "alpha_count" + /* 0x3F26 */ u16 unk_3F26; // "last_time_type" + /* 0x3F28 */ s16 unk_3F28; // "magic_flag" + /* 0x3F2A */ s16 unk_3F2A; // "recovery_magic_flag" + /* 0x3F2C */ s16 unk_3F2C; // "keep_magic_flag" + /* 0x3F2E */ s16 unk_3F2E; // "magic_now_max" + /* 0x3F30 */ s16 unk_3F30; // "magic_now_now" + /* 0x3F32 */ s16 unk_3F32; // "magic_used" + /* 0x3F34 */ s16 unk_3F34; // "magic_recovery" + /* 0x3F36 */ u16 mapIndex; // "scene_ID" + /* 0x3F38 */ u16 minigameState; // "yabusame_mode" + /* 0x3F3A */ u16 minigameScore; // "yabusame_total" + /* 0x3F3C */ u16 unk_3F3C; // "yabusame_out_ct" + /* 0x3F3E */ u8 unk_3F3E; // "no_save" + /* 0x3F3F */ u8 unk_3F3F; // "flash_flag" + /* 0x3F40 */ SaveOptions options; + /* 0x3F46 */ u16 unk_3F46; // "NottoriBgm" + /* 0x3F48 */ u8 unk_3F48; // "fade_go" + /* 0x3F4A */ u16 nextCutsceneIndex; // "next_daytime" + /* 0x3F4C */ u8 cutsceneTrigger; // "doukidemo" + /* 0x3F4D */ u8 unk_3F4D; // "Kenjya_no" + /* 0x3F4E */ u16 nextDayTime; // "next_zelda_time" + /* 0x3F50 */ u8 fadeDuration; // "fade_speed" + /* 0x3F51 */ u8 fadeSpeed; // "wipe_speed" transition related + /* 0x3F52 */ u16 environmentTime; // "kankyo_time" + /* 0x3F54 */ u8 dogIsLost; // "dog_event_flag" + /* 0x3F55 */ u8 nextTransition; // "next_wipe" + /* 0x3F56 */ s16 worldMapArea; // "area_type" + /* 0x3F58 */ s16 sunsSongState; // "sunmoon_flag" + /* 0x3F5A */ s16 healthAccumulator; // "life_mode" + /* 0x3F5C */ s32 unk_3F5C; // "bet_rupees" + /* 0x3F60 */ u8 screenScaleFlag; // "framescale_flag" + /* 0x3F64 */ f32 screenScale; // "framescale_scale" + /* 0x3F68 */ CycleSceneFlags cycleSceneFlags[120]; // Scene flags that are temporarily stored over the duration of a single 3-day cycle + /* 0x48C8 */ u16 unk_48C8; // "scene_id_mix" + /* 0x48CA */ u8 maskMaskBit[27]; // "mask_mask_bit", masks given away on the Moon } SaveContext; // size = 0x48C8 -typedef enum { - /* 0x00 */ RESPAWN_MODE_VOID_OUT, - /* 0x01 */ RESPAWN_MODE_GROTTO, // Exiting a grotto - /* 0x02 */ RESPAWN_MODE_FARORES_WIND, // Unused in MM - /* 0x03 */ RESPAWN_MODE_GORON, - /* 0x04 */ RESPAWN_MODE_ZORA, - /* 0x05 */ RESPAWN_MODE_DEKU, - /* 0x06 */ RESPAWN_MODE_CHILD_LINK, - /* 0x07 */ RESPAWN_MODE_UNK_7, - /* 0x07 */ RESPAWN_MODE_UNK_8 -} RespawnMode; - -typedef enum { +typedef enum ButtonStatus { /* 0x00 */ BTN_ENABLED, /* 0xFF */ BTN_DISABLED = 0xFF } ButtonStatus; -typedef enum { +typedef enum SunsSongState { /* 0 */ SUNSSONG_INACTIVE, /* 1 */ SUNSSONG_START, // the suns ocarina effect signals that the song has finished playing /* 2 */ SUNSSONG_SPEED_TIME, // suns was played where time passes, speed up the advancement of time /* 3 */ SUNSSONG_SPECIAL // time does not advance, but signals the song was played. used for freezing redeads } SunsSongState; +void Sram_ActivateOwl(u8 owlId); +void Sram_ClearFlagsAtDawnOfTheFirstDay(void); +void Sram_SaveEndOfCycle(struct GlobalContext* globalCtx); +void Sram_IncrementDay(void); +u16 Sram_CalcChecksum(void* data, size_t count); +void Sram_InitNewSave(void); +void Sram_InitDebugSave(void); +void func_80144A94(SramContext* sramCtx); +void Sram_OpenSave(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx); +void func_8014546C(SramContext* sramCtx); +void func_801457CC(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx); +void func_80146580(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx, s32 fileNum); +void func_80146628(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx); +void Sram_InitSave(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx); +void func_80146DF8(SramContext* sramCtx); +void Sram_InitSram(struct GameState* gameState, SramContext* sramCtx); +void Sram_Alloc(struct GameState* gamestate, SramContext* sramCtx); +void Sram_SaveSpecialEnterClockTown(struct GlobalContext* globalCtx); +void Sram_SaveSpecialNewDay(struct GlobalContext* globalCtx); +void func_80147008(SramContext* sramCtx, u32 curPage, u32 numPages); +void func_80147020(SramContext* sramCtx); +void func_80147068(SramContext* sramCtx); +void func_80147138(SramContext* sramCtx, s32 curPage, s32 numPages); +void func_80147150(SramContext* sramCtx); +void func_80147198(SramContext* sramCtx); + +extern s32 D_801C6798[]; +extern u8 D_801C67B0[24]; +extern s32 D_801C67C8[]; +extern s32 D_801C67E8[]; +extern s32 D_801C67F0[]; +extern s32 D_801C6818[]; +extern s32 D_801C6838[]; +extern s32 D_801C6840[]; +extern s32 D_801C6850[]; + #endif diff --git a/include/z64scene.h b/include/z64scene.h index b20313198d..5a1c39e16f 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -645,7 +645,8 @@ typedef enum { /* 0x6D */ SCENE_ICHIBA, /* 0x6E */ SCENE_BACKTOWN, /* 0x6F */ SCENE_CLOCKTOWER, - /* 0x70 */ SCENE_ALLEY + /* 0x70 */ SCENE_ALLEY, + /* 0x71 */ SCENE_MAX } SceneID; // SceneTableEntry draw configs diff --git a/spec b/spec index 9de1886e0d..152a2c41bc 100644 --- a/spec +++ b/spec @@ -544,9 +544,8 @@ beginseg include "build/src/code/z_vr_box.o" include "build/src/code/z_vr_box_draw.o" include "build/src/code/z_sram_NES.o" - include "build/data/code/z_sram_NES.data.o" - include "build/data/code/z_sram_NES.bss.o" include "build/src/code/z_message.o" + include "build/data/code/z_message.data.o" include "build/data/code/z_message.bss.o" include "build/src/code/z_message_nes.o" include "build/data/code/z_message_nes.data.o" diff --git a/src/boot_O2_g3/idle_extra_bss.c b/src/boot_O2_g3/idle_extra_bss.c index 019b626405..24fc0083f2 100644 --- a/src/boot_O2_g3/idle_extra_bss.c +++ b/src/boot_O2_g3/idle_extra_bss.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "PR/ultratypes.h" +#include "ultra64/vi.h" // This file is currently required to fix bss reordering in idle.c. It is not resolved by prevent_bss_reordering.h . // Hopefully it will not be permanent. diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index f60d98568c..5dee17fb5b 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -504,7 +504,7 @@ void Inventory_ChangeEquipment(s16 value) { u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) { Player* player = GET_PLAYER(globalCtx); - if (CUR_EQUIP_VALUE_VOID(EQUIP_SHIELD) != 0) { + if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) { SET_EQUIP_VALUE(EQUIP_SHIELD, 0); Player_SetEquipmentData(globalCtx, player); return true; @@ -514,12 +514,12 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) { } void Inventory_ChangeUpgrade(s16 upgrade, u32 value) { - u32 upgrades = gSaveContext.inventory.upgrades; + u32 upgrades = gSaveContext.save.inventory.upgrades; upgrades &= gUpgradeNegMasks[upgrade]; upgrades |= value << gUpgradeShifts[upgrade]; - gSaveContext.inventory.upgrades = upgrades; + gSaveContext.save.inventory.upgrades = upgrades; } s32 Inventory_IsMapVisible(s16 sceneNum) { @@ -546,7 +546,7 @@ s32 Inventory_IsMapVisible(s16 sceneNum) { } } - if (gSaveContext.scenesVisible[index] & gBitFlags[sceneNum - (index << 5)]) { + if (gSaveContext.save.scenesVisible[index] & gBitFlags[sceneNum - (index << 5)]) { return true; } @@ -659,23 +659,23 @@ void Inventory_SetMapVisibility(s16 tingleIndex) { index = 6; } - gSaveContext.scenesVisible[index] = - gSaveContext.scenesVisible[index] | gBitFlags[(s16)(*tingleMapSceneIndices)[i] - (index << 5)]; + gSaveContext.save.scenesVisible[index] = + gSaveContext.save.scenesVisible[index] | gBitFlags[(s16)(*tingleMapSceneIndices)[i] - (index << 5)]; i++; } if ((*tingleMapSceneIndices) == sScenesPerTingleMap[0]) { - gSaveContext.mapsVisible |= 3; + gSaveContext.save.mapsVisible |= 3; } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[1]) { - gSaveContext.mapsVisible |= 0x1C; + gSaveContext.save.mapsVisible |= 0x1C; } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[2]) { - gSaveContext.mapsVisible |= 0xE0; + gSaveContext.save.mapsVisible |= 0xE0; } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[3]) { - gSaveContext.mapsVisible |= 0x100; + gSaveContext.save.mapsVisible |= 0x100; } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[4]) { - gSaveContext.mapsVisible |= 0x1E00; + gSaveContext.save.mapsVisible |= 0x1E00; } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[5]) { - gSaveContext.mapsVisible |= 0x6000; + gSaveContext.save.mapsVisible |= 0x6000; } } @@ -688,32 +688,34 @@ void Inventory_SetMapVisibility(s16 tingleIndex) { void Inventory_SaveDekuPlaygroundHighScore(s16 timerId) { s16 i; - gSaveContext.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.unk_3DE0[timerId]; + gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.unk_3DE0[timerId]; for (i = 0; i < 8; i++) { - gSaveContext.inventory.dekuPlaygroundPlayerName[CURRENT_DAY - 1][i] = gSaveContext.playerName[i]; + gSaveContext.save.inventory.dekuPlaygroundPlayerName[CURRENT_DAY - 1][i] = + gSaveContext.save.playerData.playerName[i]; } } void Inventory_IncrementSkullTokenCount(s16 sceneIndex) { if (sceneIndex == SCENE_KINSTA1) { // Swamp Spider House (increment high bits of skullTokenCount) - gSaveContext.skullTokenCount = ((u16)(((gSaveContext.skullTokenCount & 0xFFFF0000) >> 0x10) + 1) << 0x10) | - (gSaveContext.skullTokenCount & 0xFFFF); + gSaveContext.save.skullTokenCount = + ((u16)(((gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10) + 1) << 0x10) | + (gSaveContext.save.skullTokenCount & 0xFFFF); } else { // Ocean Spider House (increment low bits of skullTokenCount) - gSaveContext.skullTokenCount = - (((u16)gSaveContext.skullTokenCount + 1) & 0xFFFF) | (gSaveContext.skullTokenCount & 0xFFFF0000); + gSaveContext.save.skullTokenCount = + (((u16)gSaveContext.save.skullTokenCount + 1) & 0xFFFF) | (gSaveContext.save.skullTokenCount & 0xFFFF0000); } } s16 Inventory_GetSkullTokenCount(s16 sceneIndex) { if (sceneIndex == SCENE_KINSTA1) { // Swamp Spider House - return (gSaveContext.skullTokenCount & 0xFFFF0000) >> 0x10; + return (gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10; } else { // Ocean Spider House - return gSaveContext.skullTokenCount & 0xFFFF; + return gSaveContext.save.skullTokenCount & 0xFFFF; } } @@ -723,5 +725,6 @@ void Inventory_SaveLotteryCodeGuess(GlobalContext* globalCtx) { lotteryCodeGuess = ((globalCtx->msgCtx.unk12054[0] & 0xF) << 8); // First Digit lotteryCodeGuess |= ((globalCtx->msgCtx.unk12054[1] & 0xF) << 4); // Second Digit lotteryCodeGuess |= (globalCtx->msgCtx.unk12054[2] & 0xF); // Third Digit - gSaveContext.lotteryCodeGuess = (gSaveContext.lotteryCodeGuess & 0xFFFF0000) | (lotteryCodeGuess & 0xFFFF); + gSaveContext.save.lotteryCodeGuess = + (gSaveContext.save.lotteryCodeGuess & 0xFFFF0000) | (lotteryCodeGuess & 0xFFFF); } diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 780884c852..53be7b68de 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -12,106 +12,106 @@ #include "global.h" static FlagSetEntry sFlagEntries[] = { - { &gSaveContext.weekEventReg[0], "week_event_reg[0]" }, - { &gSaveContext.weekEventReg[1], "week_event_reg[1]" }, - { &gSaveContext.weekEventReg[2], "week_event_reg[2]" }, - { &gSaveContext.weekEventReg[3], "week_event_reg[3]" }, - { &gSaveContext.weekEventReg[4], "week_event_reg[4]" }, - { &gSaveContext.weekEventReg[5], "week_event_reg[5]" }, - { &gSaveContext.weekEventReg[6], "week_event_reg[6]" }, - { &gSaveContext.weekEventReg[7], "week_event_reg[7]" }, - { &gSaveContext.weekEventReg[8], "week_event_reg[8]" }, - { &gSaveContext.weekEventReg[9], "week_event_reg[9]" }, - { &gSaveContext.weekEventReg[10], "week_event_reg[10]" }, - { &gSaveContext.weekEventReg[11], "week_event_reg[11]" }, - { &gSaveContext.weekEventReg[12], "week_event_reg[12]" }, - { &gSaveContext.weekEventReg[13], "week_event_reg[13]" }, - { &gSaveContext.weekEventReg[14], "week_event_reg[14]" }, - { &gSaveContext.weekEventReg[15], "week_event_reg[15]" }, - { &gSaveContext.weekEventReg[16], "week_event_reg[16]" }, - { &gSaveContext.weekEventReg[17], "week_event_reg[17]" }, - { &gSaveContext.weekEventReg[18], "week_event_reg[18]" }, - { &gSaveContext.weekEventReg[19], "week_event_reg[19]" }, - { &gSaveContext.weekEventReg[20], "week_event_reg[20]" }, - { &gSaveContext.weekEventReg[21], "week_event_reg[21]" }, - { &gSaveContext.weekEventReg[22], "week_event_reg[22]" }, - { &gSaveContext.weekEventReg[23], "week_event_reg[23]" }, - { &gSaveContext.weekEventReg[24], "week_event_reg[24]" }, - { &gSaveContext.weekEventReg[25], "week_event_reg[25]" }, - { &gSaveContext.weekEventReg[26], "week_event_reg[26]" }, - { &gSaveContext.weekEventReg[27], "week_event_reg[27]" }, - { &gSaveContext.weekEventReg[28], "week_event_reg[28]" }, - { &gSaveContext.weekEventReg[29], "week_event_reg[29]" }, - { &gSaveContext.weekEventReg[30], "week_event_reg[30]" }, - { &gSaveContext.weekEventReg[31], "week_event_reg[31]" }, - { &gSaveContext.weekEventReg[32], "week_event_reg[32]" }, - { &gSaveContext.weekEventReg[33], "week_event_reg[33]" }, - { &gSaveContext.weekEventReg[34], "week_event_reg[34]" }, - { &gSaveContext.weekEventReg[35], "week_event_reg[35]" }, - { &gSaveContext.weekEventReg[36], "week_event_reg[36]" }, - { &gSaveContext.weekEventReg[37], "week_event_reg[37]" }, - { &gSaveContext.weekEventReg[38], "week_event_reg[38]" }, - { &gSaveContext.weekEventReg[39], "week_event_reg[39]" }, - { &gSaveContext.weekEventReg[40], "week_event_reg[40]" }, - { &gSaveContext.weekEventReg[41], "week_event_reg[41]" }, - { &gSaveContext.weekEventReg[42], "week_event_reg[42]" }, - { &gSaveContext.weekEventReg[43], "week_event_reg[43]" }, - { &gSaveContext.weekEventReg[44], "week_event_reg[44]" }, - { &gSaveContext.weekEventReg[45], "week_event_reg[45]" }, - { &gSaveContext.weekEventReg[46], "week_event_reg[46]" }, - { &gSaveContext.weekEventReg[47], "week_event_reg[47]" }, - { &gSaveContext.weekEventReg[48], "week_event_reg[48]" }, - { &gSaveContext.weekEventReg[49], "week_event_reg[49]" }, - { &gSaveContext.weekEventReg[50], "week_event_reg[50]" }, - { &gSaveContext.weekEventReg[51], "week_event_reg[51]" }, - { &gSaveContext.weekEventReg[52], "week_event_reg[52]" }, - { &gSaveContext.weekEventReg[53], "week_event_reg[53]" }, - { &gSaveContext.weekEventReg[54], "week_event_reg[54]" }, - { &gSaveContext.weekEventReg[55], "week_event_reg[55]" }, - { &gSaveContext.weekEventReg[56], "week_event_reg[56]" }, - { &gSaveContext.weekEventReg[57], "week_event_reg[57]" }, - { &gSaveContext.weekEventReg[58], "week_event_reg[58]" }, - { &gSaveContext.weekEventReg[59], "week_event_reg[59]" }, - { &gSaveContext.weekEventReg[60], "week_event_reg[60]" }, - { &gSaveContext.weekEventReg[61], "week_event_reg[61]" }, - { &gSaveContext.weekEventReg[62], "week_event_reg[62]" }, - { &gSaveContext.weekEventReg[63], "week_event_reg[63]" }, - { &gSaveContext.weekEventReg[64], "week_event_reg[64]" }, - { &gSaveContext.weekEventReg[65], "week_event_reg[65]" }, - { &gSaveContext.weekEventReg[66], "week_event_reg[66]" }, - { &gSaveContext.weekEventReg[67], "week_event_reg[67]" }, - { &gSaveContext.weekEventReg[68], "week_event_reg[68]" }, - { &gSaveContext.weekEventReg[69], "week_event_reg[69]" }, - { &gSaveContext.weekEventReg[70], "week_event_reg[70]" }, - { &gSaveContext.weekEventReg[71], "week_event_reg[71]" }, - { &gSaveContext.weekEventReg[72], "week_event_reg[72]" }, - { &gSaveContext.weekEventReg[73], "week_event_reg[73]" }, - { &gSaveContext.weekEventReg[74], "week_event_reg[74]" }, - { &gSaveContext.weekEventReg[75], "week_event_reg[75]" }, - { &gSaveContext.weekEventReg[76], "week_event_reg[76]" }, - { &gSaveContext.weekEventReg[77], "week_event_reg[77]" }, - { &gSaveContext.weekEventReg[78], "week_event_reg[78]" }, - { &gSaveContext.weekEventReg[79], "week_event_reg[79]" }, - { &gSaveContext.weekEventReg[80], "week_event_reg[80]" }, - { &gSaveContext.weekEventReg[81], "week_event_reg[81]" }, - { &gSaveContext.weekEventReg[82], "week_event_reg[82]" }, - { &gSaveContext.weekEventReg[83], "week_event_reg[83]" }, - { &gSaveContext.weekEventReg[84], "week_event_reg[84]" }, - { &gSaveContext.weekEventReg[85], "week_event_reg[85]" }, - { &gSaveContext.weekEventReg[86], "week_event_reg[86]" }, - { &gSaveContext.weekEventReg[87], "week_event_reg[87]" }, - { &gSaveContext.weekEventReg[88], "week_event_reg[88]" }, - { &gSaveContext.weekEventReg[89], "week_event_reg[89]" }, - { &gSaveContext.weekEventReg[90], "week_event_reg[90]" }, - { &gSaveContext.weekEventReg[91], "week_event_reg[91]" }, - { &gSaveContext.weekEventReg[92], "week_event_reg[92]" }, - { &gSaveContext.weekEventReg[93], "week_event_reg[93]" }, - { &gSaveContext.weekEventReg[94], "week_event_reg[94]" }, - { &gSaveContext.weekEventReg[95], "week_event_reg[95]" }, - { &gSaveContext.weekEventReg[96], "week_event_reg[96]" }, - { &gSaveContext.weekEventReg[97], "week_event_reg[97]" }, - { &gSaveContext.weekEventReg[98], "week_event_reg[98]" }, - { &gSaveContext.weekEventReg[99], "week_event_reg[99]" }, + { &gSaveContext.save.weekEventReg[0], "week_event_reg[0]" }, + { &gSaveContext.save.weekEventReg[1], "week_event_reg[1]" }, + { &gSaveContext.save.weekEventReg[2], "week_event_reg[2]" }, + { &gSaveContext.save.weekEventReg[3], "week_event_reg[3]" }, + { &gSaveContext.save.weekEventReg[4], "week_event_reg[4]" }, + { &gSaveContext.save.weekEventReg[5], "week_event_reg[5]" }, + { &gSaveContext.save.weekEventReg[6], "week_event_reg[6]" }, + { &gSaveContext.save.weekEventReg[7], "week_event_reg[7]" }, + { &gSaveContext.save.weekEventReg[8], "week_event_reg[8]" }, + { &gSaveContext.save.weekEventReg[9], "week_event_reg[9]" }, + { &gSaveContext.save.weekEventReg[10], "week_event_reg[10]" }, + { &gSaveContext.save.weekEventReg[11], "week_event_reg[11]" }, + { &gSaveContext.save.weekEventReg[12], "week_event_reg[12]" }, + { &gSaveContext.save.weekEventReg[13], "week_event_reg[13]" }, + { &gSaveContext.save.weekEventReg[14], "week_event_reg[14]" }, + { &gSaveContext.save.weekEventReg[15], "week_event_reg[15]" }, + { &gSaveContext.save.weekEventReg[16], "week_event_reg[16]" }, + { &gSaveContext.save.weekEventReg[17], "week_event_reg[17]" }, + { &gSaveContext.save.weekEventReg[18], "week_event_reg[18]" }, + { &gSaveContext.save.weekEventReg[19], "week_event_reg[19]" }, + { &gSaveContext.save.weekEventReg[20], "week_event_reg[20]" }, + { &gSaveContext.save.weekEventReg[21], "week_event_reg[21]" }, + { &gSaveContext.save.weekEventReg[22], "week_event_reg[22]" }, + { &gSaveContext.save.weekEventReg[23], "week_event_reg[23]" }, + { &gSaveContext.save.weekEventReg[24], "week_event_reg[24]" }, + { &gSaveContext.save.weekEventReg[25], "week_event_reg[25]" }, + { &gSaveContext.save.weekEventReg[26], "week_event_reg[26]" }, + { &gSaveContext.save.weekEventReg[27], "week_event_reg[27]" }, + { &gSaveContext.save.weekEventReg[28], "week_event_reg[28]" }, + { &gSaveContext.save.weekEventReg[29], "week_event_reg[29]" }, + { &gSaveContext.save.weekEventReg[30], "week_event_reg[30]" }, + { &gSaveContext.save.weekEventReg[31], "week_event_reg[31]" }, + { &gSaveContext.save.weekEventReg[32], "week_event_reg[32]" }, + { &gSaveContext.save.weekEventReg[33], "week_event_reg[33]" }, + { &gSaveContext.save.weekEventReg[34], "week_event_reg[34]" }, + { &gSaveContext.save.weekEventReg[35], "week_event_reg[35]" }, + { &gSaveContext.save.weekEventReg[36], "week_event_reg[36]" }, + { &gSaveContext.save.weekEventReg[37], "week_event_reg[37]" }, + { &gSaveContext.save.weekEventReg[38], "week_event_reg[38]" }, + { &gSaveContext.save.weekEventReg[39], "week_event_reg[39]" }, + { &gSaveContext.save.weekEventReg[40], "week_event_reg[40]" }, + { &gSaveContext.save.weekEventReg[41], "week_event_reg[41]" }, + { &gSaveContext.save.weekEventReg[42], "week_event_reg[42]" }, + { &gSaveContext.save.weekEventReg[43], "week_event_reg[43]" }, + { &gSaveContext.save.weekEventReg[44], "week_event_reg[44]" }, + { &gSaveContext.save.weekEventReg[45], "week_event_reg[45]" }, + { &gSaveContext.save.weekEventReg[46], "week_event_reg[46]" }, + { &gSaveContext.save.weekEventReg[47], "week_event_reg[47]" }, + { &gSaveContext.save.weekEventReg[48], "week_event_reg[48]" }, + { &gSaveContext.save.weekEventReg[49], "week_event_reg[49]" }, + { &gSaveContext.save.weekEventReg[50], "week_event_reg[50]" }, + { &gSaveContext.save.weekEventReg[51], "week_event_reg[51]" }, + { &gSaveContext.save.weekEventReg[52], "week_event_reg[52]" }, + { &gSaveContext.save.weekEventReg[53], "week_event_reg[53]" }, + { &gSaveContext.save.weekEventReg[54], "week_event_reg[54]" }, + { &gSaveContext.save.weekEventReg[55], "week_event_reg[55]" }, + { &gSaveContext.save.weekEventReg[56], "week_event_reg[56]" }, + { &gSaveContext.save.weekEventReg[57], "week_event_reg[57]" }, + { &gSaveContext.save.weekEventReg[58], "week_event_reg[58]" }, + { &gSaveContext.save.weekEventReg[59], "week_event_reg[59]" }, + { &gSaveContext.save.weekEventReg[60], "week_event_reg[60]" }, + { &gSaveContext.save.weekEventReg[61], "week_event_reg[61]" }, + { &gSaveContext.save.weekEventReg[62], "week_event_reg[62]" }, + { &gSaveContext.save.weekEventReg[63], "week_event_reg[63]" }, + { &gSaveContext.save.weekEventReg[64], "week_event_reg[64]" }, + { &gSaveContext.save.weekEventReg[65], "week_event_reg[65]" }, + { &gSaveContext.save.weekEventReg[66], "week_event_reg[66]" }, + { &gSaveContext.save.weekEventReg[67], "week_event_reg[67]" }, + { &gSaveContext.save.weekEventReg[68], "week_event_reg[68]" }, + { &gSaveContext.save.weekEventReg[69], "week_event_reg[69]" }, + { &gSaveContext.save.weekEventReg[70], "week_event_reg[70]" }, + { &gSaveContext.save.weekEventReg[71], "week_event_reg[71]" }, + { &gSaveContext.save.weekEventReg[72], "week_event_reg[72]" }, + { &gSaveContext.save.weekEventReg[73], "week_event_reg[73]" }, + { &gSaveContext.save.weekEventReg[74], "week_event_reg[74]" }, + { &gSaveContext.save.weekEventReg[75], "week_event_reg[75]" }, + { &gSaveContext.save.weekEventReg[76], "week_event_reg[76]" }, + { &gSaveContext.save.weekEventReg[77], "week_event_reg[77]" }, + { &gSaveContext.save.weekEventReg[78], "week_event_reg[78]" }, + { &gSaveContext.save.weekEventReg[79], "week_event_reg[79]" }, + { &gSaveContext.save.weekEventReg[80], "week_event_reg[80]" }, + { &gSaveContext.save.weekEventReg[81], "week_event_reg[81]" }, + { &gSaveContext.save.weekEventReg[82], "week_event_reg[82]" }, + { &gSaveContext.save.weekEventReg[83], "week_event_reg[83]" }, + { &gSaveContext.save.weekEventReg[84], "week_event_reg[84]" }, + { &gSaveContext.save.weekEventReg[85], "week_event_reg[85]" }, + { &gSaveContext.save.weekEventReg[86], "week_event_reg[86]" }, + { &gSaveContext.save.weekEventReg[87], "week_event_reg[87]" }, + { &gSaveContext.save.weekEventReg[88], "week_event_reg[88]" }, + { &gSaveContext.save.weekEventReg[89], "week_event_reg[89]" }, + { &gSaveContext.save.weekEventReg[90], "week_event_reg[90]" }, + { &gSaveContext.save.weekEventReg[91], "week_event_reg[91]" }, + { &gSaveContext.save.weekEventReg[92], "week_event_reg[92]" }, + { &gSaveContext.save.weekEventReg[93], "week_event_reg[93]" }, + { &gSaveContext.save.weekEventReg[94], "week_event_reg[94]" }, + { &gSaveContext.save.weekEventReg[95], "week_event_reg[95]" }, + { &gSaveContext.save.weekEventReg[96], "week_event_reg[96]" }, + { &gSaveContext.save.weekEventReg[97], "week_event_reg[97]" }, + { &gSaveContext.save.weekEventReg[98], "week_event_reg[98]" }, + { &gSaveContext.save.weekEventReg[99], "week_event_reg[99]" }, { &gSaveContext.eventInf[0], "event_inf[0]" }, { &gSaveContext.eventInf[1], "event_inf[1]" }, @@ -245,8 +245,8 @@ void FlagSet_Update(GameState* gameState) { if (CHECK_BTN_ALL(input->cur.button, BTN_START)) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { s16 i; - for (i = 0; i < ARRAY_COUNT(gSaveContext.weekEventReg); i++) { - gSaveContext.weekEventReg[i] = 0; + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.weekEventReg); i++) { + gSaveContext.save.weekEventReg[i] = 0; } for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) { gSaveContext.eventInf[i] = 0; diff --git a/src/code/sched.c b/src/code/sched.c index 5f9cdf236a..927a48f66b 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #define RSP_DONE_MSG 667 diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 6b7c863aae..a0f479f544 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2224,7 +2224,7 @@ void func_800B90F4(GlobalContext* globalCtx) { void func_800B9120(ActorContext* actorCtx) { s32 phi_v0 = CURRENT_DAY * 2; - if (gSaveContext.time < CLOCK_TIME(6, 0) || gSaveContext.time > CLOCK_TIME(18, 0)) { + if (gSaveContext.save.time < CLOCK_TIME(6, 0) || gSaveContext.save.time > CLOCK_TIME(18, 0)) { phi_v0++; } @@ -2236,7 +2236,7 @@ void Actor_InitContext(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEn CycleSceneFlags* cycleFlags; s32 i; - gSaveContext.weekEventReg[92] |= 0x80; + gSaveContext.save.weekEventReg[92] |= 0x80; cycleFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(globalCtx->sceneNum)]; bzero(actorCtx, sizeof(ActorContext)); @@ -2252,8 +2252,8 @@ void Actor_InitContext(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEn } actorCtx->flags.chest = cycleFlags->chest; - actorCtx->flags.switches[0] = cycleFlags->swch0; - actorCtx->flags.switches[1] = cycleFlags->swch1; + actorCtx->flags.switches[0] = cycleFlags->switch0; + actorCtx->flags.switches[1] = cycleFlags->switch1; if (globalCtx->sceneNum == SCENE_INISIE_R) { cycleFlags = &gSaveContext.cycleSceneFlags[globalCtx->sceneNum]; } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 910458b77c..b2891de90e 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -6,11 +6,11 @@ #define DYNA_RAYCAST_WALLS 2 #define DYNA_RAYCAST_CEILINGS 4 -static u32 sWallFlags[32] = { +u32 sWallFlags[32] = { 0, 1, 3, 5, 8, 16, 32, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static u16 sSurfaceTypeSfx[] = { +u16 sSurfaceTypeSfx[] = { /* 0x00 */ NA_SE_PL_WALK_GROUND - SFX_FLAG, /* 0x01 */ NA_SE_PL_WALK_SAND - SFX_FLAG, /* 0x02 */ NA_SE_PL_WALK_CONCRETE - SFX_FLAG, @@ -28,7 +28,7 @@ static u16 sSurfaceTypeSfx[] = { /* 0x0E */ NA_SE_PL_WALK_SNOW - SFX_FLAG }; -static u8 D_801B46C0[] = { +u8 D_801B46C0[] = { /* 0x00 */ 1, /* 0x01 */ 1, /* 0x02 */ 0, @@ -46,7 +46,7 @@ static u8 D_801B46C0[] = { /* 0x0E */ 1 }; -static s16 sSmallMemScenes[] = { +s16 sSmallMemScenes[] = { SCENE_F01, }; @@ -55,7 +55,7 @@ typedef struct { u32 memSize; } BgCheckSceneMemEntry; -static BgCheckSceneMemEntry sSceneMemList[] = { +BgCheckSceneMemEntry sSceneMemList[] = { { SCENE_00KEIKOKU, 0xC800 }, }; diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 26fd324a73..3860cf153c 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -3,8 +3,9 @@ SaveContext gSaveContext; void SaveContext_Init(void) { - bzero(&gSaveContext, sizeof(gSaveContext)); - gSaveContext.playerForm = 0; + bzero(&gSaveContext, sizeof(SaveContext)); + + gSaveContext.save.playerForm = 0; gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; gSaveContext.nightSeqIndex = 0xFF; gSaveContext.unk_3F46 = NA_BGM_GENERAL_SFX; @@ -16,7 +17,8 @@ void SaveContext_Init(void) { gSaveContext.dogIsLost = true; gSaveContext.nextTransition = 0xFF; gSaveContext.unk_3F26 = 50; - gSaveContext.language = 1; - gSaveContext.audioSetting = 0; - gSaveContext.zTargetSetting = 0; + + gSaveContext.options.language = 1; + gSaveContext.options.audioSetting = 0; + gSaveContext.options.zTargetSetting = 0; } diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 23dd435ec0..e486bc7690 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -68,7 +68,7 @@ CutsceneStateHandler sCsStateHandlers1[] = { }; void Cutscene_Update1(GlobalContext* globalCtx, CutsceneContext* csCtx) { - if (gSaveContext.cutscene < 0xFFF0) { + if (gSaveContext.save.cutscene < 0xFFF0) { sCsStateHandlers1[csCtx->state](globalCtx, csCtx); } } @@ -87,11 +87,11 @@ void Cutscene_Update2(GlobalContext* globalCtx, CutsceneContext* csCtx) { } if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_0)) { - gSaveContext.cutscene = 0xFFFD; + gSaveContext.save.cutscene = 0xFFFD; gSaveContext.cutsceneTrigger = 1; } - if (gSaveContext.cutscene >= 0xFFF0) { + if (gSaveContext.save.cutscene >= 0xFFF0) { func_800EDA84(globalCtx, csCtx); sCsStateHandlers2[csCtx->state](globalCtx, csCtx); } @@ -250,12 +250,12 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs gSaveContext.sunsSongState = SUNSSONG_START; break; case 0x12: - if (!gSaveContext.isNight) { - time = gSaveContext.time; - gSaveContext.time = time - (u16)REG(15); + if (!gSaveContext.save.isNight) { + time = gSaveContext.save.time; + gSaveContext.save.time = time - (u16)REG(15); } else { - time = gSaveContext.time; - gSaveContext.time = time - (u16)(2 * REG(15)); + time = gSaveContext.save.time; + gSaveContext.save.time = time - (u16)(2 * REG(15)); } break; case 0x13: @@ -270,7 +270,7 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs EnvFlags_Set(globalCtx, 4); break; case 0x16: - gSaveContext.playerForm = PLAYER_FORM_DEKU; + gSaveContext.save.playerForm = PLAYER_FORM_DEKU; break; case 0x17: player->stateFlags2 |= 0x4000000; @@ -279,9 +279,9 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs player->stateFlags2 &= ~0x4000000; break; case 0x19: - sCutsceneStoredPlayerForm = gSaveContext.playerForm; - gSaveContext.playerForm = PLAYER_FORM_HUMAN; - gSaveContext.equippedMask = PLAYER_MASK_NONE; + sCutsceneStoredPlayerForm = gSaveContext.save.playerForm; + gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; + gSaveContext.save.equippedMask = PLAYER_MASK_NONE; break; case 0x1A: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG); @@ -306,7 +306,7 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs } break; case 0x1D: - gSaveContext.playerForm = sCutsceneStoredPlayerForm; + gSaveContext.save.playerForm = sCutsceneStoredPlayerForm; break; case 0x1E: D_801F4DE0 = true; @@ -316,7 +316,7 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs break; case 0x21: if (isStartFrame) { - func_80146EE8(globalCtx); + Sram_SaveSpecialEnterClockTown(globalCtx); } break; case 0x22: @@ -329,10 +329,10 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs D_801BB15C = csCtx->frames; if (REG(15) != 0) { - time = gSaveContext.time; - gSaveContext.time = (u16)REG(15) + time; - time = gSaveContext.time; - gSaveContext.time = (u16)gSaveContext.unk_14 + time; + time = gSaveContext.save.time; + gSaveContext.save.time = (u16)REG(15) + time; + time = gSaveContext.save.time; + gSaveContext.save.time = (u16)gSaveContext.save.daySpeed + time; } } break; @@ -349,7 +349,7 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs case 0x26: // Seems to be used to trigger "Dawn of A New Day" - gSaveContext.day = 9; + gSaveContext.save.day = 9; { GameState* gameState = &globalCtx->state; @@ -357,11 +357,11 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs } SET_NEXT_GAMESTATE(&globalCtx->state, Daytelop_Init, DaytelopContext); - func_80146F5C(globalCtx); + Sram_SaveSpecialNewDay(globalCtx); break; case 0x27: - gSaveContext.playerForm = PLAYER_FORM_ZORA; + gSaveContext.save.playerForm = PLAYER_FORM_ZORA; break; case 0x28: @@ -442,7 +442,7 @@ void func_800EADB0(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* u8 dayMinusOne; if (csCtx->frames == cmd->startFrame) { - dayMinusOne = (gSaveContext.day - 1); + dayMinusOne = (gSaveContext.save.day - 1); if (dayMinusOne >= 3) { dayMinusOne = 0; } @@ -557,7 +557,7 @@ void Cutscene_Command_SetTime(GlobalContext* globalCtx, CutsceneContext* csCtx, minutes = CLOCK_TIME_ALT_F(0, cmd->minute + 1); nextTime = hourAsMinutes + minutes; - gSaveContext.time = nextTime; + gSaveContext.save.time = nextTime; gSaveContext.environmentTime = nextTime; } } @@ -572,7 +572,7 @@ void Cutscene_TerminatorImpl(GlobalContext* globalCtx, CutsceneContext* csCtx, C gSaveContext.unk_3F1E = 1; } - gSaveContext.cutscene = 0; + gSaveContext.save.cutscene = 0; if (cmd->base == 1) { globalCtx->nextEntranceIndex = globalCtx->csCtx.sceneCsList[globalCtx->csCtx.currentCsIndex].nextEntranceIndex; gSaveContext.nextCutsceneIndex = 0; @@ -607,7 +607,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt switch (D_801F4DE2) { case 0x1F: - if (gSaveContext.weekEventReg[0x14] & 2) { + if (gSaveContext.save.weekEventReg[20] & 2) { globalCtx->nextEntranceIndex = 0x3010; globalCtx->sceneLoadFlag = 0x14; globalCtx->unk_1887F = 3; @@ -620,7 +620,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt break; case 0x44: - if (gSaveContext.weekEventReg[0x21] & 0x80) { + if (gSaveContext.save.weekEventReg[33] & 0x80) { globalCtx->nextEntranceIndex = 0xAE70; globalCtx->sceneLoadFlag = 0x14; globalCtx->unk_1887F = 3; @@ -633,7 +633,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt break; case 0x5F: - gSaveContext.weekEventReg[0x37] |= 0x80; + gSaveContext.save.weekEventReg[55] |= 0x80; globalCtx->nextEntranceIndex = 0x6A80; gSaveContext.nextCutsceneIndex = 0xFFF0; globalCtx->sceneLoadFlag = 0x14; @@ -641,7 +641,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt break; case 0x36: - gSaveContext.weekEventReg[0x34] |= 0x20; + gSaveContext.save.weekEventReg[52] |= 0x20; globalCtx->nextEntranceIndex = 0x2000; gSaveContext.nextCutsceneIndex = 0xFFF1; globalCtx->sceneLoadFlag = 0x14; @@ -813,7 +813,7 @@ void Cutscene_Command_GiveTatlToPlayer(GlobalContext* globalCtx, CutsceneContext if (csCtx->frames == cmd->startFrame) { if (cmd->base == 1) { - gSaveContext.hasTatl = true; + gSaveContext.save.hasTatl = true; if (player->tatlActor != NULL) { return; } @@ -1093,7 +1093,7 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, } } - if (dialogState == 5 && Message_ShouldAdvance(globalCtx) != 0) { + if (dialogState == 5 && Message_ShouldAdvance(globalCtx)) { func_80152434(globalCtx, cmd->base); } } @@ -1424,7 +1424,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, /* End of command handling section */ void func_800ED980(GlobalContext* globalCtx, CutsceneContext* csCtx) { - if (gSaveContext.cutscene >= 0xFFF0) { + if (gSaveContext.save.cutscene >= 0xFFF0) { csCtx->frames++; Cutscene_ProcessCommands(globalCtx, csCtx, (u8*)globalCtx->csCtx.csData); } @@ -1448,7 +1448,7 @@ void func_800EDA04(GlobalContext* globalCtx, CutsceneContext* csCtx) { csCtx->actorActions[i] = NULL; } - gSaveContext.cutscene = 0; + gSaveContext.save.cutscene = 0; gSaveContext.gameMode = 0; ActorCutscene_Stop(0x7F); Audio_SetCutsceneFlag(false); @@ -1458,10 +1458,10 @@ void func_800EDA04(GlobalContext* globalCtx, CutsceneContext* csCtx) { void func_800EDA84(GlobalContext* globalCtx, CutsceneContext* csCtx) { if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_0) && !Player_InCsMode(&globalCtx->state)) { - gSaveContext.cutscene = 0xFFFD; + gSaveContext.save.cutscene = 0xFFFD; } - if ((gSaveContext.cutscene >= 0xFFF0) && (csCtx->state == CS_STATE_0)) { + if ((gSaveContext.save.cutscene >= 0xFFF0) && (csCtx->state == CS_STATE_0)) { s16 i; D_801BB124 = 0; @@ -1515,8 +1515,9 @@ void func_800EDBE0(GlobalContext* globalCtx) { ActorCutscene_Start(sp2A, NULL); gSaveContext.showTitleCard = false; } else if (!((1 << (temp_a3[temp_v0_3].unk7 % 8)) & - gSaveContext.weekEventReg[temp_a3[temp_v0_3].unk7 / 8])) { - gSaveContext.weekEventReg[(temp_a3[temp_v0_3].unk7 / 8)] |= 1 << (temp_a3[temp_v0_3].unk7 % 8); + gSaveContext.save.weekEventReg[temp_a3[temp_v0_3].unk7 / 8])) { + gSaveContext.save.weekEventReg[(temp_a3[temp_v0_3].unk7 / 8)] |= + 1 << (temp_a3[temp_v0_3].unk7 % 8); ActorCutscene_Start(sp2A, NULL); gSaveContext.showTitleCard = false; } @@ -1530,8 +1531,8 @@ void func_800EDBE0(GlobalContext* globalCtx) { if ((gSaveContext.respawnFlag == 0) || (gSaveContext.respawnFlag == -2)) { sp24 = globalCtx->loadedScene; if ((sp24->titleTextId != 0) && gSaveContext.showTitleCard) { - if ((Entrance_GetTransitionFlags(gSaveContext.sceneSetupIndex + gSaveContext.entranceIndex) & 0x4000) != - 0) { + if ((Entrance_GetTransitionFlags(gSaveContext.sceneSetupIndex + gSaveContext.save.entranceIndex) & + 0x4000) != 0) { func_80151A68(globalCtx, sp24->titleTextId); } } diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index 7308b33f4e..cd2fa96b6e 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -7,17 +7,17 @@ u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) { if (CURRENT_DAY <= 0) { return 0; } - if (gSaveContext.weekEventReg[88] & 0x20) { + if (gSaveContext.save.weekEventReg[88] & 0x20) { return 0; } - if (gSaveContext.weekEventReg[79] & 0x10) { - if (gSaveContext.weekEventReg[8] & 0x40) { + if (gSaveContext.save.weekEventReg[79] & 0x10) { + if (gSaveContext.save.weekEventReg[8] & 0x40) { return 0; } return 0x224; } - if (!(gSaveContext.weekEventReg[8] & 0x80)) { - if (gSaveContext.weekEventReg[9] & 1) { + if (!(gSaveContext.save.weekEventReg[8] & 0x80)) { + if (gSaveContext.save.weekEventReg[9] & 1) { return 0x21E; } if (globalCtx->sceneNum == SCENE_YOUSEI_IZUMI) { @@ -25,7 +25,7 @@ u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) { } return 0x21D; } - if (gSaveContext.magicAcquired != true) { + if (gSaveContext.save.playerData.magicAcquired != true) { return 0x21F; } if (INV_CONTENT(ITEM_DEED_LAND) == ITEM_DEED_LAND) { @@ -35,27 +35,27 @@ u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) { return 0; } if (INV_CONTENT(ITEM_MOON_TEAR) == ITEM_MOON_TEAR) { - if (gSaveContext.weekEventReg[86] & 4) { + if (gSaveContext.save.weekEventReg[86] & 4) { return 0x242; } return 0x243; } - if (gSaveContext.weekEventReg[74] & 0x20) { + if (gSaveContext.save.weekEventReg[74] & 0x20) { return 0x223; } - if (gSaveContext.weekEventReg[73] & 0x80) { + if (gSaveContext.save.weekEventReg[73] & 0x80) { return 0x222; } - if (gSaveContext.weekEventReg[73] & 0x20) { + if (gSaveContext.save.weekEventReg[73] & 0x20) { return 0x221; } - if (gSaveContext.weekEventReg[77] & 2) { - if (gSaveContext.weekEventReg[73] & 0x10) { + if (gSaveContext.save.weekEventReg[77] & 2) { + if (gSaveContext.save.weekEventReg[73] & 0x10) { return 0x240; } return 0x241; } - if ((gSaveContext.weekEventReg[86] & 2) || (gSaveContext.weekEventReg[73] & 0x40)) { + if ((gSaveContext.save.weekEventReg[86] & 2) || (gSaveContext.save.weekEventReg[73] & 0x40)) { return 0x23F; } return 0x220; diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 5c8a75f982..b8fa0f4f10 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -822,13 +822,14 @@ s16 func_800A7650(s16 dropId) { (((dropId == ITEM00_ARROWS_10) || (dropId == ITEM00_ARROWS_30) || (dropId == ITEM00_ARROWS_40) || (dropId == ITEM00_ARROWS_50)) && (INV_CONTENT(ITEM_BOW) == ITEM_NONE)) || - (((dropId == ITEM00_MAGIC_LARGE) || (dropId == ITEM00_MAGIC_SMALL)) && (gSaveContext.magicLevel == 0))) { + (((dropId == ITEM00_MAGIC_LARGE) || (dropId == ITEM00_MAGIC_SMALL)) && + (gSaveContext.save.playerData.magicLevel == 0))) { return ITEM00_NO_DROP; } if (dropId == ITEM00_HEART) { - healthCapacity = gSaveContext.healthCapacity; - if (healthCapacity == gSaveContext.health) { + healthCapacity = gSaveContext.save.playerData.healthCapacity; + if (healthCapacity == gSaveContext.save.playerData.health) { return ITEM00_RUPEE_GREEN; } } @@ -1049,7 +1050,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 dropQuantity = sDropTableAmounts[params + dropTableIndex]; if (dropId == ITEM00_MASK) { - switch (gSaveContext.playerForm) { + switch (gSaveContext.save.playerForm) { case PLAYER_FORM_HUMAN: dropId = ITEM00_ARROWS_10; break; @@ -1085,26 +1086,27 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 } if (dropId == ITEM00_FLEXIBLE) { - if (gSaveContext.health <= 0x10) { + if (gSaveContext.save.playerData.health <= 0x10) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 2); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); return; } - if (gSaveContext.health <= 0x30) { + if (gSaveContext.save.playerData.health <= 0x30) { params = 0x10; dropId = ITEM00_HEART; dropQuantity = 3; - } else if (gSaveContext.health <= 0x50) { + } else if (gSaveContext.save.playerData.health <= 0x50) { params = 0x10; dropId = ITEM00_HEART; dropQuantity = 1; - } else if ((gSaveContext.magicLevel != 0) && (gSaveContext.magic == 0)) { + } else if ((gSaveContext.save.playerData.magicLevel != 0) && (gSaveContext.save.playerData.magic == 0)) { params = 0xD0; dropId = ITEM00_MAGIC_LARGE; dropQuantity = 1; - } else if ((gSaveContext.magicLevel != 0) && ((gSaveContext.magicLevel >> 1) >= gSaveContext.magic)) { + } else if ((gSaveContext.save.playerData.magicLevel != 0) && + ((gSaveContext.save.playerData.magicLevel >> 1) >= gSaveContext.save.playerData.magic)) { params = 0xD0; dropId = ITEM00_MAGIC_LARGE; dropQuantity = 1; @@ -1116,7 +1118,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 params = 0xB0; dropId = ITEM00_BOMBS_A; dropQuantity = 1; - } else if (gSaveContext.rupees < 11) { + } else if (gSaveContext.save.playerData.rupees < 11) { params = 0xA0; dropId = ITEM00_RUPEE_RED; dropQuantity = 1; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 411cb5d003..62d55bc00a 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -44,7 +44,7 @@ void GameOver_Update(GlobalContext* globalCtx) { } gSaveContext.unk_3DC0 = 2000; - gSaveContext.tatlTimer = 0; + gSaveContext.save.playerData.tatlTimer = 0; gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; gSaveContext.nightSeqIndex = 0xFF; gSaveContext.eventInf[0] = 0; @@ -72,11 +72,11 @@ void GameOver_Update(GlobalContext* globalCtx) { gSaveContext.respawnFlag = -6; } gSaveContext.nextTransition = 2; - gSaveContext.health = 48; + gSaveContext.save.playerData.health = 48; gameOverCtx->state++; if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) { - gSaveContext.playerForm = PLAYER_FORM_HUMAN; - gSaveContext.equippedMask = PLAYER_MASK_NONE; + gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; + gSaveContext.save.equippedMask = PLAYER_MASK_NONE; } func_8013EE24(); } diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 703b966deb..d89b427e9e 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -38,7 +38,7 @@ void LifeMeter_Init(GlobalContext* globalCtx) { interfaceCtx->unkTimer = 320; - interfaceCtx->health = gSaveContext.health; + interfaceCtx->health = gSaveContext.save.playerData.health; interfaceCtx->lifeColorChange = 0; interfaceCtx->lifeColorChangeDirection = 0; @@ -168,7 +168,7 @@ void LifeMeter_UpdateColors(GlobalContext* globalCtx) { } s32 LifeMeter_SaveInterfaceHealth(GlobalContext* globalCtx) { - gSaveContext.health = globalCtx->interfaceCtx.health; + gSaveContext.save.playerData.health = globalCtx->interfaceCtx.health; return 1; } @@ -178,8 +178,8 @@ s32 LifeMeter_IncreaseInterfaceHealth(GlobalContext* globalCtx) { interfaceCtx->unkTimer = 320; interfaceCtx->health += 0x10; - if (globalCtx->interfaceCtx.health >= gSaveContext.health) { - globalCtx->interfaceCtx.health = gSaveContext.health; + if (globalCtx->interfaceCtx.health >= gSaveContext.save.playerData.health) { + globalCtx->interfaceCtx.health = gSaveContext.save.playerData.health; return 1; } return 0; @@ -195,7 +195,7 @@ s32 LifeMeter_DecreaseInterfaceHealth(GlobalContext* globalCtx) { interfaceCtx->health -= 0x10; if (interfaceCtx->health <= 0) { interfaceCtx->health = 0; - globalCtx->damagePlayer(globalCtx, -(((void)0, gSaveContext.health) + 1)); + globalCtx->damagePlayer(globalCtx, -(((void)0, gSaveContext.save.playerData.health) + 1)); return 1; } } @@ -216,18 +216,18 @@ void LifeMeter_Draw(GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; Vtx* beatingHeartVtx = interfaceCtx->beatingHeartVtx; - s32 fractionHeartCount = gSaveContext.health % 0x10; - s16 healthCapacity = gSaveContext.healthCapacity / 0x10; - s16 fullHeartCount = gSaveContext.health / 0x10; + s32 fractionHeartCount = gSaveContext.save.playerData.health % 0x10; + s16 healthCapacity = gSaveContext.save.playerData.healthCapacity / 0x10; + s16 fullHeartCount = gSaveContext.save.playerData.health / 0x10; s32 pad2; f32 lifesize = interfaceCtx->lifeSizeChange * 0.1f; u32 curCombineModeSet = 0; TexturePtr temp = NULL; - s32 ddCount = gSaveContext.inventory.dungeonKeys[9] - 1; + s32 ddCount = gSaveContext.save.inventory.dungeonKeys[9] - 1; OPEN_DISPS(gfxCtx); - if ((gSaveContext.health % 0x10) == 0) { + if ((gSaveContext.save.playerData.health % 0x10) == 0) { fullHeartCount--; } offsetY = 0.0f; @@ -417,19 +417,19 @@ void LifeMeter_UpdateSizeAndBeep(GlobalContext* globalCtx) { u32 LifeMeter_IsCritical(void) { s16 criticalThreshold; - if (gSaveContext.healthCapacity <= 80) { // healthCapacity <= 5 hearts? + if (gSaveContext.save.playerData.healthCapacity <= 80) { // healthCapacity <= 5 hearts? criticalThreshold = 16; - } else if (gSaveContext.healthCapacity <= 160) { // healthCapacity <= 10 hearts? + } else if (gSaveContext.save.playerData.healthCapacity <= 160) { // healthCapacity <= 10 hearts? criticalThreshold = 24; - } else if (gSaveContext.healthCapacity <= 240) { // healthCapacity <= 15 hearts? + } else if (gSaveContext.save.playerData.healthCapacity <= 240) { // healthCapacity <= 15 hearts? criticalThreshold = 32; } else { criticalThreshold = 44; } - if ((criticalThreshold >= gSaveContext.health) && (gSaveContext.health > 0)) { + if ((criticalThreshold >= gSaveContext.save.playerData.health) && (gSaveContext.save.playerData.health > 0)) { return true; } return false; diff --git a/src/code/z_message.c b/src/code/z_message.c index 447c354c62..d7fdbff421 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -391,12 +391,12 @@ void func_80151BB4(GlobalContext* globalCtx, u8 arg1) { u8 temp = arg1; if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - if ((gSaveContext.weekEventReg[D_801C6B28[arg1] >> 8] & (u8)D_801C6B28[arg1]) == 0) { + if ((gSaveContext.save.weekEventReg[D_801C6B28[arg1] >> 8] & (u8)D_801C6B28[arg1]) == 0) { msgCtx->unk120B2[msgCtx->unk120B1] = temp; msgCtx->unk120B1++; } } else if (arg1 >= 20) { - if ((gSaveContext.weekEventReg[D_801C6B28[arg1] >> 8] & (u8)D_801C6B28[arg1]) == 0) { + if ((gSaveContext.save.weekEventReg[D_801C6B28[arg1] >> 8] & (u8)D_801C6B28[arg1]) == 0) { msgCtx->unk120B2[msgCtx->unk120B1] = temp; msgCtx->unk120B1++; } @@ -413,10 +413,10 @@ u32 func_80151C9C(GlobalContext* globalCtx) { } msgCtx->unk120B1--; - if ((gSaveContext.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8] & + if ((gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8] & (u8)D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]]) == 0) { - flag = gSaveContext.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8]; - gSaveContext.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8] = + flag = gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8]; + gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8] = flag | (u8)D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]]; if ((D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]] != 0) && CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { func_80151938(globalCtx, D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]]); @@ -474,7 +474,7 @@ void func_80152EC0(GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80153750.s") void func_80153E7C(GlobalContext* globalCtx, void* arg1) { - if ((gSaveContext.language == 0) && (globalCtx->msgCtx.unk12090 == 0)) { + if ((gSaveContext.options.language == 0) && (globalCtx->msgCtx.unk12090 == 0)) { func_8014ADBC(globalCtx, arg1); return; } diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index 7a961c8823..1de839d682 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -131,15 +131,15 @@ void Message_LoadLocalizedRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos msgCtx->decodedBuffer.schar[p] = ' '; p++; - for (j = 0; j < D_801D0710[gSaveContext.language - 1]; j++) { - Font_LoadCharNES(globalCtx, D_801D06F0[gSaveContext.language - 1][j], o); - msgCtx->decodedBuffer.schar[p] = D_801D06F0[gSaveContext.language - 1][j]; + for (j = 0; j < D_801D0710[gSaveContext.options.language - 1]; j++) { + Font_LoadCharNES(globalCtx, D_801D06F0[gSaveContext.options.language - 1][j], o); + msgCtx->decodedBuffer.schar[p] = D_801D06F0[gSaveContext.options.language - 1][j]; o += FONT_CHAR_TEX_SIZE; p++; } p--; - f += 16.0f * msgCtx->unk12098 * (D_801D0710[gSaveContext.language - 1] + 1); + f += 16.0f * msgCtx->unk12098 * (D_801D0710[gSaveContext.options.language - 1] + 1); *decodedBufPos = p; *offset = o; *arg3 = f; @@ -200,10 +200,10 @@ void Message_LoadTimeNES(GlobalContext* globalCtx, u8 arg1, s32* offset, f32* ar s16 i; if (arg1 == 0xCF) { - day = gSaveContext.day; - dayTime = 0x40000 - ((day % 5) << 16) - (u16)(-0x4000 + gSaveContext.time); + day = gSaveContext.save.day; + dayTime = 0x40000 - ((day % 5) << 16) - (u16)(-0x4000 + gSaveContext.save.time); } else { - dayTime = 0x10000 - (u16)(-0x4000 + gSaveContext.time); + dayTime = 0x10000 - (u16)(-0x4000 + gSaveContext.save.time); } timeInMinutes = TIME_TO_MINUTES_F(dayTime); diff --git a/src/code/z_play.c b/src/code/z_play.c index b5c2b15c89..57b09f67eb 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -158,8 +158,8 @@ void Play_SaveCycleSceneFlags(GameState* gameState) { cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(globalCtx->sceneNum)]; cycleSceneFlags->chest = globalCtx->actorCtx.flags.chest; - cycleSceneFlags->swch0 = globalCtx->actorCtx.flags.switches[0]; - cycleSceneFlags->swch1 = globalCtx->actorCtx.flags.switches[1]; + cycleSceneFlags->switch0 = globalCtx->actorCtx.flags.switches[0]; + cycleSceneFlags->switch1 = globalCtx->actorCtx.flags.switches[1]; if (globalCtx->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple cycleSceneFlags = &gSaveContext.cycleSceneFlags[globalCtx->sceneNum]; @@ -178,7 +178,7 @@ void Play_SetRespawnData(GameState* gameState, s32 respawnMode, u16 entranceInde gSaveContext.respawn[respawnMode].pos = *pos; gSaveContext.respawn[respawnMode].yaw = yaw; gSaveContext.respawn[respawnMode].playerParams = playerParams; - gSaveContext.respawn[respawnMode].tempSwchFlags = globalCtx->actorCtx.flags.switches[2]; + gSaveContext.respawn[respawnMode].tempSwitchFlags = globalCtx->actorCtx.flags.switches[2]; gSaveContext.respawn[respawnMode].unk_18 = globalCtx->actorCtx.flags.collectible[1]; gSaveContext.respawn[respawnMode].tempCollectFlags = globalCtx->actorCtx.flags.collectible[2]; } @@ -188,7 +188,7 @@ void Play_SetupRespawnPoint(GameState* gameState, s32 respawnMode, s32 playerPar Player* player = GET_PLAYER(globalCtx); if (globalCtx->sceneNum != SCENE_KAKUSIANA) { // Grottos - Play_SetRespawnData(&globalCtx->state, respawnMode, (u16)((void)0, gSaveContext.entranceIndex), + Play_SetRespawnData(&globalCtx->state, respawnMode, (u16)((void)0, gSaveContext.save.entranceIndex), globalCtx->roomCtx.currRoom.num, playerParams, &player->actor.world.pos, player->actor.shape.rot.y); } @@ -207,10 +207,10 @@ void func_80169ECC(GlobalContext* globalCtx) { void func_80169EFC(GameState* gameState) { GlobalContext* globalCtx = (GlobalContext*)gameState; - gSaveContext.respawn[0].tempSwchFlags = globalCtx->actorCtx.flags.switches[2]; - gSaveContext.respawn[0].unk_18 = globalCtx->actorCtx.flags.collectible[1]; - gSaveContext.respawn[0].tempCollectFlags = globalCtx->actorCtx.flags.collectible[2]; - globalCtx->nextEntranceIndex = gSaveContext.respawn[0].entranceIndex; + gSaveContext.respawn[RESTART_MODE_DOWN].tempSwitchFlags = globalCtx->actorCtx.flags.switches[2]; + gSaveContext.respawn[RESTART_MODE_DOWN].unk_18 = globalCtx->actorCtx.flags.collectible[1]; + gSaveContext.respawn[RESTART_MODE_DOWN].tempCollectFlags = globalCtx->actorCtx.flags.collectible[2]; + globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex; gSaveContext.respawnFlag = 1; func_80169ECC(globalCtx); globalCtx->sceneLoadFlag = 0x14; @@ -222,7 +222,7 @@ void func_80169EFC(GameState* gameState) { void func_80169F78(GameState* gameState) { GlobalContext* globalCtx = (GlobalContext*)gameState; - globalCtx->nextEntranceIndex = gSaveContext.respawn[2].entranceIndex; + globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_TOP].entranceIndex; gSaveContext.respawnFlag = -1; func_80169ECC(globalCtx); globalCtx->sceneLoadFlag = 0x14; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 6ef6a60913..8a9bdd4e7a 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -151,7 +151,7 @@ void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->linkActorEntry = (ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) + globalCtx->setupEntranceList[globalCtx->curSpawn].spawn; if ((globalCtx->linkActorEntry->params & 0x0F00) >> 8 == 0x0C || - (gSaveContext.respawnFlag == 0x02 && gSaveContext.respawn[1].playerParams == 0x0CFF)) { + (gSaveContext.respawnFlag == 0x02 && gSaveContext.respawn[RESTART_MODE_RETURN].playerParams == 0x0CFF)) { // Skull Kid Object Object_Spawn(&globalCtx->objectCtx, OBJECT_STK); return; @@ -161,7 +161,7 @@ void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) { nextObject = globalCtx2->objectCtx.status[globalCtx2->objectCtx.num].segment; globalCtx->objectCtx.num = loadedCount; globalCtx->objectCtx.spawnedObjectCount = loadedCount; - playerForm = gSaveContext.playerForm; + playerForm = gSaveContext.save.playerForm; playerObjectId = gLinkFormObjectIndexes[playerForm]; gActorOverlayTable[0].initInfo->objectId = playerObjectId; Object_Spawn(&globalCtx->objectCtx, playerObjectId); @@ -383,7 +383,7 @@ void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { u32 dayTime; if (cmd->timeSettings.hour != 0xFF && cmd->timeSettings.min != 0xFF) { - gSaveContext.environmentTime = gSaveContext.time = + gSaveContext.environmentTime = gSaveContext.save.time = (u16)(((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / 0.021972656f); } @@ -393,7 +393,7 @@ void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->envCtx.timeIncrement = 0; } - if ((gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) && (globalCtx->envCtx.timeIncrement != 0)) { + if ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) && (globalCtx->envCtx.timeIncrement != 0)) { globalCtx->envCtx.timeIncrement = 5; } @@ -401,15 +401,15 @@ void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { REG(15) = globalCtx->envCtx.timeIncrement; } - dayTime = gSaveContext.time; + dayTime = gSaveContext.save.time; globalCtx->envCtx.unk_4 = -(Math_SinS(dayTime - 0x8000) * 120.0f) * 25.0f; - dayTime = gSaveContext.time; + dayTime = gSaveContext.save.time; globalCtx->envCtx.unk_8 = (Math_CosS(dayTime - 0x8000) * 120.0f) * 25.0f; - dayTime = gSaveContext.time; + dayTime = gSaveContext.save.time; globalCtx->envCtx.unk_C = (Math_CosS(dayTime - 0x8000) * 20.0f) * 25.0f; - if (globalCtx->envCtx.timeIncrement == 0 && gSaveContext.cutscene < 0xFFF0) { - gSaveContext.environmentTime = gSaveContext.time; + if (globalCtx->envCtx.timeIncrement == 0 && gSaveContext.save.cutscene < 0xFFF0) { + gSaveContext.environmentTime = gSaveContext.save.time; if (gSaveContext.environmentTime >= CLOCK_TIME(4, 0) && gSaveContext.environmentTime < CLOCK_TIME(6, 30)) { gSaveContext.environmentTime = CLOCK_TIME(5, 0); @@ -527,7 +527,7 @@ void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd) } if (i < ARRAY_COUNT(gScenesPerRegion)) { - gSaveContext.mapsVisited = (gBitFlags[i] | gSaveContext.mapsVisited) | gSaveContext.mapsVisited; + gSaveContext.save.mapsVisited = (gBitFlags[i] | gSaveContext.save.mapsVisited) | gSaveContext.save.mapsVisited; } } @@ -610,5 +610,5 @@ u16 Entrance_CreateIndex(s32 sceneIndex, s32 spawnIndex, s32 sceneSetup) { * Creates an entrance index from the current entrance index with the given spawn index. */ u16 Entrance_CreateIndexFromSpawn(s32 spawnIndex) { - return Entrance_CreateIndex(gSaveContext.entranceIndex >> 9, spawnIndex, 0); + return Entrance_CreateIndex(gSaveContext.save.entranceIndex >> 9, spawnIndex, 0); } diff --git a/src/code/z_snap.c b/src/code/z_snap.c index bce1f67d7b..f85f33f0a7 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -12,8 +12,8 @@ s32 func_8013A240(GlobalContext* globalCtx) { s32 seen; s32 count = 0; - gSaveContext.pictoFlags0 = 0; - gSaveContext.pictoFlags1 = 0; + gSaveContext.save.pictoFlags0 = 0; + gSaveContext.save.pictoFlags1 = 0; if (globalCtx->sceneNum == SCENE_20SICHITAI) { func_8013A41C(1); @@ -76,19 +76,19 @@ s32 func_8013A240(GlobalContext* globalCtx) { void func_8013A41C(s32 flag) { if (flag < 0x20) { - gSaveContext.pictoFlags0 |= (1 << flag); + gSaveContext.save.pictoFlags0 |= (1 << flag); } else { flag &= 0x1F; - gSaveContext.pictoFlags1 |= (1 << flag); + gSaveContext.save.pictoFlags1 |= (1 << flag); } } void func_8013A46C(s32 flag) { if (flag < 0x20) { - gSaveContext.pictoFlags0 &= ~(1 << flag); + gSaveContext.save.pictoFlags0 &= ~(1 << flag); } else { flag &= 0x1F; - gSaveContext.pictoFlags1 &= ~(1 << flag); + gSaveContext.save.pictoFlags1 &= ~(1 << flag); } } @@ -96,10 +96,10 @@ u32 func_8013A4C4(s32 flag) { SaveContext* saveCtx = &gSaveContext; if (flag < 0x20) { - return saveCtx->pictoFlags0 & (1 << flag); + return saveCtx->save.pictoFlags0 & (1 << flag); } else { flag &= 0x1F; - return saveCtx->pictoFlags1 & (1 << flag); + return saveCtx->save.pictoFlags1 & (1 << flag); } } @@ -135,7 +135,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Actor_GetProjectedPos(globalCtx, pos, &screenSpace, &distance); x = (s16)(screenSpace.x * distance * 160.0f + 160.0f) - 85; y = (s16)(screenSpace.y * distance * -120.0f + 120.0f) - 67; - if ((x < 0) || (0x96 < x) || (y < 0) || (0x69 < y)) { + if ((x < 0) || (150 < x) || (y < 0) || (105 < y)) { func_8013A41C(0x3D); ret |= 0x3D; } diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 5b5b2f5f05..b1dbdb1fe6 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1,67 +1,1676 @@ #include "global.h" +#include "overlays/gamestates/ovl_file_choose/z_file_choose.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80143A10.s") +void func_80146EBC(SramContext* sramCtx, s32 curPage, s32 numPages); +void func_80147314(SramContext* sramCtx, s32 fileNum); +void func_80147414(SramContext* sramCtx, s32 fileNum, s32 arg2); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80143A54.s") +#define CHECK_NEWF(newf) \ + ((newf)[0] != 'Z' || (newf)[1] != 'E' || (newf)[2] != 'L' || (newf)[3] != 'D' || (newf)[4] != 'A' || \ + (newf)[5] != '3') -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80143AC4.s") +// default scene flags (?) +// indices of subarray: +// - 0: switch0 +// - 1: switch1 +// - 2: chest +// - 3: collectible +u32 D_801C5FC0[SCENE_MAX][4] = { + { 0xC00, 0, 0, 0x40000000 }, // SCENE_20SICHITAI2 + { 0, 0, 0, 0 }, // SCENE_UNSET_1 + { 0, 0, 0, 0 }, // SCENE_UNSET_2 + { 0, 0, 0, 0 }, // SCENE_UNSET_3 + { 0, 0, 0, 0 }, // SCENE_UNSET_4 + { 0, 0, 0, 0 }, // SCENE_UNSET_5 + { 0, 0, 0, 0 }, // SCENE_UNSET_6 + { 0, 0, 0, 0xC04 }, // SCENE_KAKUSIANA + { 0, 0, 0, 0 }, // SCENE_SPOT00 + { 0, 0, 0, 0 }, // SCENE_UNSET_9 + { 0, 0, 0, 0 }, // SCENE_WITCH_SHOP + { 0, 0, 0, 0x80000000 }, // SCENE_LAST_BS + { 0, 0, 0, 0x80000000 }, // SCENE_HAKASHITA + { 0, 0, 0, 0 }, // SCENE_AYASHIISHOP + { 0, 0, 0, 0 }, // SCENE_UNSET_E + { 0, 0, 0, 0 }, // SCENE_UNSET_F + { 0, 0, 0, 0 }, // SCENE_OMOYA + { 0, 0, 0, 0 }, // SCENE_BOWLING + { 0, 0, 0, 0 }, // SCENE_SONCHONOIE + { 0x100000, 0, 0, 0x40000002 }, // SCENE_IKANA + { 0, 0, 0, 0 }, // SCENE_KAIZOKU + { 0, 0, 0, 0 }, // SCENE_MILK_BAR + { 0x4000000, 0, 0, 0 }, // SCENE_INISIE_N + { 2, 0, 0, 0 }, // SCENE_TAKARAYA + { 0x4000000, 0, 0, 0 }, // SCENE_INISIE_R + { 0, 0, 0, 0 }, // SCENE_OKUJOU + { 0xF, 0, 0, 0 }, // SCENE_OPENINGDAN + { 0x70B000, 0, 0, 0 }, // SCENE_MITURIN + { 0, 0, 0, 0 }, // SCENE_13HUBUKINOMITI + { 0, 0x80000000, 0, 0x400 }, // SCENE_CASTLE + { 0, 0, 0, 0 }, // SCENE_DEKUTES + { 0, 0, 0, 0x80000000 }, // SCENE_MITURIN_BS + { 0, 0, 0, 0 }, // SCENE_SYATEKI_MIZU + { 0x1A00020, 0, 0, 0 }, // SCENE_HAKUGIN + { 0x400, 0, 0, 0 }, // SCENE_ROMANYMAE + { 0, 0, 0, 0x1000 }, // SCENE_PIRATE + { 0, 0, 0, 0 }, // SCENE_SYATEKI_MORI + { 0, 0, 0, 2 }, // SCENE_SINKAI + { 0x400, 0, 0, 0 }, // SCENE_YOUSEI_IZUMI + { 0, 0, 0, 0 }, // SCENE_KINSTA1 + { 0, 0, 0, 0x80000000 }, // SCENE_KINDAN2 + { 0, 0, 0, 0 }, // SCENE_TENMON_DAI + { 0, 0, 0, 2 }, // SCENE_LAST_DEKU + { 0, 0, 0, 0x40000000 }, // SCENE_22DEKUCITY + { 0, 0, 0, 0 }, // SCENE_KAJIYA + { 0x10, 0, 0, 0 }, // SCENE_00KEIKOKU + { 3, 0, 0, 0 }, // SCENE_POSTHOUSE + { 0, 0, 0, 0 }, // SCENE_LABO + { 0, 0, 0, 0x80000000 }, // SCENE_DANPEI2TEST + { 0, 0, 0, 0 }, // SCENE_UNSET_31 + { 0, 0, 0, 0 }, // SCENE_16GORON_HOUSE + { 0, 0, 0, 0 }, // SCENE_33ZORACITY + { 0, 0, 0, 0 }, // SCENE_8ITEMSHOP + { 0, 0, 0, 0 }, // SCENE_F01 + { 0, 0, 0, 0x80000000 }, // SCENE_INISIE_BS + { 0x100400, 0, 0, 0x22 }, // SCENE_30GYOSON + { 0x400, 0, 0, 0x80 }, // SCENE_31MISAKI + { 0, 0, 0, 0 }, // SCENE_TAKARAKUJI + { 0, 0, 0, 0 }, // SCENE_UNSET_3A + { 0x400, 0, 0, 0 }, // SCENE_TORIDE + { 0, 0, 0, 0 }, // SCENE_FISHERMAN + { 0, 0, 0, 0 }, // SCENE_GORONSHOP + { 0, 0, 0, 0 }, // SCENE_DEKU_KING + { 0, 0, 0, 2 }, // SCENE_LAST_GORON + { 0, 0, 0, 0x80000002 }, // SCENE_24KEMONOMITI + { 0, 0, 0, 0 }, // SCENE_F01_B + { 0, 0, 0, 0 }, // SCENE_F01C + { 0, 0, 0, 0 }, // SCENE_BOTI + { 0, 0, 0, 0x80000000 }, // SCENE_HAKUGIN_BS + { 0xC00, 0, 0, 0x40000000 }, // SCENE_20SICHITAI + { 0x102, 0, 0, 0x400 }, // SCENE_21MITURINMAE + { 0, 0, 0, 2 }, // SCENE_LAST_ZORA + { 0, 0, 0, 0x40000000 }, // SCENE_11GORONNOSATO2 + { 0x70, 0, 0, 0 }, // SCENE_SEA + { 0, 0, 0, 0 }, // SCENE_35TAKI + { 0, 0, 0, 0 }, // SCENE_REDEAD + { 0, 0, 0, 0x40000000 }, // SCENE_BANDROOM + { 0, 0, 0, 0x40000000 }, // SCENE_11GORONNOSATO + { 0, 0, 0, 0 }, // SCENE_GORON_HAKA + { 0, 0, 0, 0 }, // SCENE_SECOM + { 0x100000, 0, 0, 0x80000000 }, // SCENE_10YUKIYAMANOMURA + { 0, 0, 0, 0 }, // SCENE_TOUGITES + { 0, 0, 0, 0 }, // SCENE_DANPEI + { 0, 0, 0, 0 }, // SCENE_IKANAMAE + { 0, 0, 0, 0 }, // SCENE_DOUJOU + { 0, 0, 0, 0 }, // SCENE_MUSICHOUSE + { 0, 0, 0, 0 }, // SCENE_IKNINSIDE + { 0, 0, 0, 0 }, // SCENE_MAP_SHOP + { 0x400, 0, 0, 0 }, // SCENE_F40 + { 0x400, 0, 0, 0 }, // SCENE_F41 + { 0x100000, 0, 0, 0x80000000 }, // SCENE_10YUKIYAMANOMURA2 + { 0, 0, 0, 0x100 }, // SCENE_14YUKIDAMANOMITI + { 0x400, 0, 0, 0 }, // SCENE_12HAKUGINMAE + { 0, 0, 0, 0x80 }, // SCENE_17SETUGEN + { 0, 0, 0, 0x80 }, // SCENE_17SETUGEN2 + { 0, 0, 0, 0x80000000 }, // SCENE_SEA_BS + { 0, 0, 0, 0x400 }, // SCENE_RANDOM + { 0, 0, 0, 0 }, // SCENE_YADOYA + { 0, 0, 0, 0 }, // SCENE_KONPEKI_ENT + { 1, 0, 0, 0 }, // SCENE_INSIDETOWER + { 0, 0, 0, 0 }, // SCENE_26SARUNOMORI + { 0, 0, 0, 0 }, // SCENE_LOST_WOODS + { 0, 0, 0, 2 }, // SCENE_LAST_LINK + { 0, 0, 0, 0 }, // SCENE_SOUGEN + { 0, 0, 0, 0 }, // SCENE_BOMYA + { 0, 0, 0, 0 }, // SCENE_KYOJINNOMA + { 0, 0, 0, 0 }, // SCENE_KOEPONARACE + { 0, 0, 0, 0 }, // SCENE_GORONRACE + { 1, 0, 0, 0 }, // SCENE_TOWN + { 0, 0, 0, 0 }, // SCENE_ICHIBA + { 0, 0, 0, 0x400 }, // SCENE_BACKTOWN + { 0x100000, 0, 0, 0x400 }, // SCENE_CLOCKTOWER + { 0, 0, 1, 0 }, // SCENE_ALLEY +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80143B0C.s") +// Related to weekEventReg +u16 D_801C66D0[ARRAY_COUNT(gSaveContext.save.weekEventReg)] = { + 0xFFFC, 0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0, 0xC000, 0xC00, 0, 0xC0, 0, 0x300, + 0x3000, 0xC000, 0xC00, 0, 0, 0, 0, 0, 0, 0xC00C, 0xC00C, 0xC008, 3, + 0x3000, 0, 0, 0, 0xFF00, 0xC3F, 0x3F, 0, 0, 0xCFFF, 0, 0, 0xC00, + 0xC00, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3C, 0x20, + 0, 0x300C, 0x3000, 0, 0xC, 0xC0, 0, 0xFF0, 0x300, 0, 0, 0xC00, 0, + 0, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xC0, 0, 0xC000, 0, 3, + 0, 0xC000, 0, 0xC0, 0x300, 0, 0, 0, 0xC000, 0xFFF0, 0, 0, 0x300, + 0, 0xC000, 0xF0, 0, 0, 0, 0, 0, 0, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_IncrementDay.s") +// used in other files +s32 D_801C6798[] = { + 0x00000020, 0x00001470, 0x000028C0, 0x00003D10, 0x00005160, 0x000065B0, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_CalcChecksum.s") +u8 D_801C67B0[24] = { + ITEM_NONE, ITEM_BOW, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_BOMB, ITEM_BOMBCHU, + ITEM_STICK, ITEM_NUT, ITEM_MAGIC_BEANS, ITEM_NONE, ITEM_POWDER_KEG, ITEM_PICTO_BOX, ITEM_NONE, ITEM_NONE, + ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80144628.s") +s32 D_801C67C8[] = { 0, 0x40, 0x80, 0xC0, 0x100, 0x180, 0x200, 0x280 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_GenerateRandomSaveFields.s") +s32 D_801C67E8[] = { 0x300, 0x380 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80144890.s") +s32 D_801C67F0[] = { 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_InitDebugSave.s") +s32 D_801C6810[] = { 1, 1 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80144A94.s") +s32 D_801C6818[] = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80144E78.s") +s32 D_801C6838[] = { 1, 1 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_8014546C.s") +s32 D_801C6840[] = { 0x100, 0x180, 0x200, 0x280 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80145698.s") +s32 D_801C6850[] = { 0x80, 0x80, 0x80, 0x80, 0x300, 0x380, 1, 1 }; +s32 D_801C6870[] = { + sizeof(Save), + sizeof(Save), + sizeof(Save), + sizeof(Save), + offsetof(SaveContext, fileNum), + offsetof(SaveContext, fileNum), + offsetof(SaveContext, fileNum), + offsetof(SaveContext, fileNum), +}; + +u8 D_801C6890[8] = { 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80 }; + +u16 D_801F6AF0; +u8 D_801F6AF2; + +void Sram_ActivateOwl(u8 owlId) { + gSaveContext.save.playerData.owlActivationFlags = + ((void)0, gSaveContext.save.playerData.owlActivationFlags) | (u16)gBitFlags[owlId]; + + if (gSaveContext.save.playerData.unk_20 == 0xFF) { + gSaveContext.save.playerData.unk_20 = owlId; + } +} + +void Sram_ClearHighscores(void) { + gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF) | 0x130000; + gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF0000) | 0xA; + gSaveContext.save.horseBackBalloonHighScore = 6000; // 60 seconds + gSaveContext.save.unk_EF4 = (gSaveContext.save.unk_EF4 & 0xFFFF0000) | 0x27; + gSaveContext.save.unk_EF4 = (gSaveContext.save.unk_EF4 & 0xFFFF) | 0xA0000; + + gSaveContext.save.dekuPlaygroundHighScores[0] = 7500; // 75 seconds + gSaveContext.save.dekuPlaygroundHighScores[1] = 7500; // 75 seconds + gSaveContext.save.dekuPlaygroundHighScores[2] = 7600; // 76 seconds +} + +/** + * Clears specific weekEventReg flags. Used by the "Dawn of the First Day" message + */ +void Sram_ClearFlagsAtDawnOfTheFirstDay(void) { + // Unconfirmed: "Link the Goron Claims His Reservation: 4:30 PM" + gSaveContext.save.weekEventReg[55] &= (u8)~2; + // Unconfirmed: "Postman fleeing town" + gSaveContext.save.weekEventReg[90] &= (u8)~1; + // Unconfirmed: "Postman is about to flee" + gSaveContext.save.weekEventReg[89] &= (u8)~0x40; + // Unconfirmed: "Postman has delivered priority mail" + gSaveContext.save.weekEventReg[89] &= (u8)~8; + // Unconfirmed: "Postman showing priority mail to Madame" + gSaveContext.save.weekEventReg[85] &= (u8)~0x80; +} + +/** + * Used by Song of Time (when clicking "Yes") and (indirectly) by the "Dawn of the New Day" cutscene + */ +void Sram_SaveEndOfCycle(GlobalContext* globalCtx) { + s16 sceneNum; + s32 j; + s32 i; + u8 temp; + u8 temp2; + + gSaveContext.save.daySpeed = 0; + gSaveContext.save.daysElapsed = 0; + gSaveContext.save.day = 0; + gSaveContext.save.time = CLOCK_TIME(6, 0) - 1; + + gSaveContext.save.playerData.deaths++; + if (gSaveContext.save.playerData.deaths > 999) { + gSaveContext.save.playerData.deaths = 999; + } + + sceneNum = Play_GetOriginalSceneNumber(globalCtx->sceneNum); + Play_SaveCycleSceneFlags(&globalCtx->state); + + globalCtx->actorCtx.flags.chest &= D_801C5FC0[sceneNum][2]; + globalCtx->actorCtx.flags.switches[0] &= D_801C5FC0[sceneNum][0]; + globalCtx->actorCtx.flags.switches[1] &= D_801C5FC0[sceneNum][1]; + globalCtx->actorCtx.flags.collectible[0] &= D_801C5FC0[sceneNum][3]; + globalCtx->actorCtx.flags.clearedRoom = 0; + + for (i = 0; i < SCENE_MAX; i++) { + gSaveContext.cycleSceneFlags[i].switch0 = ((void)0, gSaveContext.cycleSceneFlags[i].switch0) & D_801C5FC0[i][0]; + gSaveContext.cycleSceneFlags[i].switch1 = ((void)0, gSaveContext.cycleSceneFlags[i].switch1) & D_801C5FC0[i][1]; + gSaveContext.cycleSceneFlags[i].chest = ((void)0, gSaveContext.cycleSceneFlags[i].chest) & D_801C5FC0[i][2]; + gSaveContext.cycleSceneFlags[i].collectible = + ((void)0, gSaveContext.cycleSceneFlags[i].collectible) & D_801C5FC0[i][3]; + gSaveContext.cycleSceneFlags[i].clearedRoom = 0; + gSaveContext.save.permanentSceneFlags[i].unk_14 = 0; + gSaveContext.save.permanentSceneFlags[i].unk_18 = 0; + } + + for (; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { + gSaveContext.cycleSceneFlags[i].chest = 0; + gSaveContext.cycleSceneFlags[i].switch0 = 0; + gSaveContext.cycleSceneFlags[i].switch1 = 0; + gSaveContext.cycleSceneFlags[i].clearedRoom = 0; + gSaveContext.cycleSceneFlags[i].collectible = 0; + } + + for (i = 0; i < ARRAY_COUNT(gSaveContext.maskMaskBit); i++) { + gSaveContext.maskMaskBit[i] = 0; + } + + if (gSaveContext.save.weekEventReg[84] & 0x20) { + func_801149A0(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY)); + } + + for (i = 0; i < ARRAY_COUNT(D_801C66D0); i++) { + u16 phi_v1_3 = D_801C66D0[i]; + + for (j = 0; j < ARRAY_COUNT(D_801C6890); j++) { + if ((phi_v1_3 & 3) == 0) { + gSaveContext.save.weekEventReg[i] = + ((void)0, gSaveContext.save.weekEventReg[i]) & (0xFF ^ D_801C6890[j]); + } + phi_v1_3 >>= 2; + } + } + + for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) { + gSaveContext.eventInf[i] = 0; + } + + gSaveContext.eventInf[7] &= (u8)~1; + gSaveContext.eventInf[7] &= (u8)~2; + gSaveContext.eventInf[7] &= (u8)~4; + gSaveContext.eventInf[7] &= (u8)~8; + gSaveContext.eventInf[7] &= (u8)~0x10; + + if (gSaveContext.save.playerData.rupees != 0) { + gSaveContext.eventInf[7] |= 1; + } + + if (INV_CONTENT(ITEM_BOMB) == ITEM_BOMB) { + temp2 = INV_CONTENT(ITEM_BOMB); + if (AMMO(temp2) != 0) { + gSaveContext.eventInf[7] |= 2; + } + } + if (INV_CONTENT(ITEM_NUT) == ITEM_NUT) { + temp2 = INV_CONTENT(ITEM_NUT); + if (AMMO(temp2) != 0) { + gSaveContext.eventInf[7] |= 4; + } + } + if (INV_CONTENT(ITEM_STICK) == ITEM_STICK) { + temp2 = INV_CONTENT(ITEM_STICK); + if (AMMO(temp2) != 0) { + gSaveContext.eventInf[7] |= 8; + } + } + if (INV_CONTENT(ITEM_BOW) == ITEM_BOW) { + temp2 = INV_CONTENT(ITEM_BOW); + if (AMMO(temp2) != 0) { + gSaveContext.eventInf[7] |= 0x10; + } + } + + for (i = 0; i < ARRAY_COUNT(D_801C67B0); i++) { + if (D_801C67B0[i] != ITEM_NONE) { + if ((gSaveContext.save.inventory.items[i] != ITEM_NONE) && (i != SLOT_PICTO_BOX)) { + temp2 = gSaveContext.save.inventory.items[i]; + AMMO(temp2) = 0; + } + } + } + + for (i = SLOT_BOTTLE_1; i <= SLOT_BOTTLE_6; i++) { + // Check for all bottled items + if (gSaveContext.save.inventory.items[i] >= ITEM_POTION_RED) { + if (gSaveContext.save.inventory.items[i] <= ITEM_OBABA_DRINK) { + for (j = 1; j < 4; j++) { + if (GET_CUR_FORM_BTN_ITEM(j) == gSaveContext.save.inventory.items[i]) { + SET_CUR_FORM_BTN_ITEM(j, ITEM_BOTTLE); + func_80112B40(globalCtx, j); + } + } + gSaveContext.save.inventory.items[i] = ITEM_BOTTLE; + } + } + } + + REMOVE_QUEST_ITEM(QUEST_UNK_19); + + if (gSaveContext.save.playerData.health < 0x30) { + gSaveContext.save.playerData.health = 0x30; + } + + if (GET_CUR_EQUIP_VALUE(EQUIP_SWORD) < 3) { + SET_EQUIP_VALUE(EQUIP_SWORD, 1); + + if (CUR_FORM == 0) { + if ((STOLEN_ITEM_1 >= ITEM_SWORD_GILDED) || (STOLEN_ITEM_2 >= ITEM_SWORD_GILDED)) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_GILDED; + SET_EQUIP_VALUE(EQUIP_SWORD, 3); + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; + } + } else { + if ((STOLEN_ITEM_1 >= ITEM_SWORD_GILDED) || (STOLEN_ITEM_2 >= ITEM_SWORD_GILDED)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_B) = ITEM_SWORD_GILDED; + SET_EQUIP_VALUE(EQUIP_SWORD, 3); + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; + } + } + } + + if ((STOLEN_ITEM_1 == ITEM_SWORD_GREAT_FAIRY) || (STOLEN_ITEM_2 == ITEM_SWORD_GREAT_FAIRY)) { + INV_CONTENT(ITEM_SWORD_GREAT_FAIRY) = ITEM_SWORD_GREAT_FAIRY; + } + + if (STOLEN_ITEM_1 == ITEM_BOTTLE) { + temp = SLOT(ITEM_BOTTLE); + for (i = 0; i < 6; i++) { + if (gSaveContext.save.inventory.items[temp + i] == ITEM_NONE) { + gSaveContext.save.inventory.items[temp + i] = ITEM_BOTTLE; + break; + } + } + } + + if (STOLEN_ITEM_2 == ITEM_BOTTLE) { + temp = SLOT(ITEM_BOTTLE); + for (i = 0; i < 6; i++) { + if (gSaveContext.save.inventory.items[temp + i] == ITEM_NONE) { + gSaveContext.save.inventory.items[temp + i] = ITEM_BOTTLE; + break; + } + } + } + + SET_STOLEN_ITEM_1(STOLEN_ITEM_NONE); + SET_STOLEN_ITEM_2(STOLEN_ITEM_NONE); + + // ?? + func_801149A0(ITEM_OCARINA_FAIRY, SLOT_TRADE_DEED); + func_801149A0(ITEM_SLINGSHOT, SLOT_TRADE_KEY_MAMA); + func_801149A0(ITEM_LONGSHOT, SLOT_TRADE_COUPLE); + + for (j = 1; j < 4; j++) { + if (GET_CUR_FORM_BTN_ITEM(j) >= ITEM_MOON_TEAR && GET_CUR_FORM_BTN_ITEM(j) <= ITEM_PENDANT_MEMORIES) { + SET_CUR_FORM_BTN_ITEM(j, ITEM_NONE); + func_80112B40(globalCtx, j); + } + } + + gSaveContext.save.skullTokenCount &= ~0xFFFF0000; + gSaveContext.save.skullTokenCount &= ~0x0000FFFF; + gSaveContext.save.unk_EC4 = 0; + + gSaveContext.save.unk_E88[0] = 0; + gSaveContext.save.unk_E88[1] = 0; + gSaveContext.save.unk_E88[2] = 0; + gSaveContext.save.unk_E88[3] = 0; + gSaveContext.save.unk_E88[4] = 0; + gSaveContext.save.unk_E88[5] = 0; + gSaveContext.save.unk_E88[6] = 0; + + Sram_ClearHighscores(); + + for (i = 0; i < 8; i++) { + gSaveContext.save.inventory.dungeonItems[i] &= (u8)~1; + gSaveContext.save.inventory.dungeonKeys[i] = 0; + gSaveContext.save.inventory.strayFairies[i] = 0; + } + + gSaveContext.save.playerData.rupees = 0; + gSaveContext.save.unk_F65 = 0; + gSaveContext.powderKegTimer = 0; + gSaveContext.unk_1014 = 0; + gSaveContext.jinxTimer = 0; + gSaveContext.rupeeAccumulator = 0; + + func_800F3B2C(globalCtx); +} + +void Sram_IncrementDay(void) { + if (CURRENT_DAY <= 3) { + gSaveContext.save.day++; + gSaveContext.save.daysElapsed++; + } + + gSaveContext.save.bombersCaughtNum = 0; + gSaveContext.save.bombersCaughtOrder[0] = 0; + gSaveContext.save.bombersCaughtOrder[1] = 0; + gSaveContext.save.bombersCaughtOrder[2] = 0; + gSaveContext.save.bombersCaughtOrder[3] = 0; + gSaveContext.save.bombersCaughtOrder[4] = 0; + + // Unconfirmed: "Bombers Hide & Seek started on Day 1???" + gSaveContext.save.weekEventReg[73] &= (u8)~0x10; + // Unconfirmed: "Bombers Hide & Seek in Progress" + gSaveContext.save.weekEventReg[85] &= (u8)~2; +} + +u16 Sram_CalcChecksum(void* data, size_t count) { + u8* dataPtr = data; + u16 chkSum = 0; + + while (count-- > 0) { + chkSum += *dataPtr; + dataPtr++; + } + return chkSum; +} + +// Resets `Save` substruct +void Sram_ResetSave(void) { + gSaveContext.save.entranceIndex = 0x1C00; + gSaveContext.save.equippedMask = 0; + gSaveContext.save.isFirstCycle = false; + gSaveContext.save.unk_06 = 0; + gSaveContext.save.linkAge = 0; + gSaveContext.save.isNight = false; + gSaveContext.save.daySpeed = 0; + gSaveContext.save.snowheadCleared = 0; + gSaveContext.save.hasTatl = false; + gSaveContext.save.isOwlSave = false; + + // Instead of bloating all save context accesses with an extra sub-struct, the size of the would-be sub-struct + // is calculated manually + bzero(&gSaveContext.save.playerData, sizeof(Save) - offsetof(Save, playerData)); +} + +/** + * Initializes with random values the following fields: + * - lotteryCodes + * - spiderHouseMaskOrder + * - bomberCode + */ +void Sram_GenerateRandomSaveFields(void) { + s32 randBombers; + s16 sp2A; + s16 pad; + s16 i; + s16 j; + s32 k; + s16 randSpiderHouse; + + Sram_ClearHighscores(); + + gSaveContext.save.lotteryCodes[0][0] = Rand_S16Offset(0, 10); + gSaveContext.save.lotteryCodes[0][1] = Rand_S16Offset(0, 10); + gSaveContext.save.lotteryCodes[0][2] = Rand_S16Offset(0, 10); + gSaveContext.save.lotteryCodes[1][0] = Rand_S16Offset(0, 10); + gSaveContext.save.lotteryCodes[1][1] = Rand_S16Offset(0, 10); + gSaveContext.save.lotteryCodes[1][2] = Rand_S16Offset(0, 10); + gSaveContext.save.lotteryCodes[2][0] = Rand_S16Offset(0, 10); + gSaveContext.save.lotteryCodes[2][1] = Rand_S16Offset(0, 10); + gSaveContext.save.lotteryCodes[2][2] = Rand_S16Offset(0, 10); + + // Needed to match... + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) {} + } + + i = 0; + sp2A = Rand_S16Offset(0, 16) & 3; + k = 6; + while (i != k) { + randSpiderHouse = Rand_S16Offset(0, 16) & 3; + if (sp2A != randSpiderHouse) { + gSaveContext.save.spiderHouseMaskOrder[i] = randSpiderHouse; + i++; + sp2A = randSpiderHouse; + } + } + + do { + randBombers = Rand_S16Offset(0, 6); + } while (randBombers <= 0 || randBombers >= 6); + + gSaveContext.save.bomberCode[0] = randBombers; + + i = 1; + while (i != 5) { + k = false; + + do { + randBombers = Rand_S16Offset(0, 6); + } while (randBombers <= 0 || randBombers >= 6); + + sp2A = 0; + do { + if (randBombers == gSaveContext.save.bomberCode[sp2A]) { + k = true; + } + sp2A++; + } while (sp2A < i); + + if (k == false) { + gSaveContext.save.bomberCode[i] = randBombers; + i++; + } + } +} + +SavePlayerData sSaveDefaultPlayerData = { + { '\0', '\0', '\0', '\0', '\0', '\0' }, // newf + 0, // deaths + { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName " " + 0x30, // healthCapacity + 0x30, // health + 0, // magicLevel + 0x30, // magic + 0, // rupees + 0, // swordHealth + 0, // tatlTimer + 0, // magicAcquired + 0, // doubleMagic + 0, // doubleDefense + 0, // unk_1F + 0xFF, // unk_20 + 0x0000, // owlActivationFlags + 0xFF, // unk_24 + SCENE_SPOT00, // savedSceneNum +}; + +ItemEquips sSaveDefaultItemEquips = { + { + { ITEM_SWORD_KOKIRI, ITEM_NONE, ITEM_NONE, ITEM_NONE }, + { ITEM_SWORD_KOKIRI, ITEM_NONE, ITEM_NONE, ITEM_NONE }, + { ITEM_SWORD_KOKIRI, ITEM_NONE, ITEM_NONE, ITEM_NONE }, + { ITEM_UNK_FD, ITEM_NONE, ITEM_NONE, ITEM_NONE }, + }, + { + { SLOT_OCARINA, SLOT_NONE, SLOT_NONE, SLOT_NONE }, + { SLOT_NONE, SLOT_NONE, SLOT_NONE, SLOT_NONE }, + { SLOT_NONE, SLOT_NONE, SLOT_NONE, SLOT_NONE }, + { SLOT_NONE, SLOT_NONE, SLOT_NONE, SLOT_NONE }, + }, + 0x11, +}; + +Inventory sSaveDefaultInventory = { + // items + { + ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, + ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, + ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, + ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, + ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, + }, + // ammo + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + // upgrades + 0x120000, + // questItems + 0, + // dungeonItems + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + // dungeonKeys + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0 }, + // strayFairies + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + // dekuPlaygroundPlayerName + { + // "LINK " + { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, + // "LINK " + { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, + // "LINK " + { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, + }, +}; + +u16 sSaveDefaultChecksum = 0; + +/** + * Initialize new save. + * This save has an empty inventory with 3 hearts, sword and shield. + */ +void Sram_InitNewSave(void) { + gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; + gSaveContext.save.daysElapsed = 0; + gSaveContext.save.day = 0; + gSaveContext.save.time = CLOCK_TIME(6, 0) - 1; + Sram_ResetSave(); + + Lib_MemCpy(&gSaveContext.save.playerData, &sSaveDefaultPlayerData, sizeof(SavePlayerData)); + Lib_MemCpy(&gSaveContext.save.equips, &sSaveDefaultItemEquips, sizeof(ItemEquips)); + Lib_MemCpy(&gSaveContext.save.inventory, &sSaveDefaultInventory, sizeof(Inventory)); + Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDefaultChecksum, sizeof(gSaveContext.save.checksum)); + + gSaveContext.save.horseData.scene = SCENE_F01; + gSaveContext.save.horseData.pos.x = -1420; + gSaveContext.save.horseData.pos.y = 257; + gSaveContext.save.horseData.pos.z = -1285; + gSaveContext.save.horseData.yaw = -0x7554; + + gSaveContext.nextCutsceneIndex = 0; + gSaveContext.save.playerData.magicLevel = 0; + Sram_GenerateRandomSaveFields(); +} + +SavePlayerData sSaveDebugPlayerData = { + { 'Z', 'E', 'L', 'D', 'A', '3' }, // newf + 0x0000, // deaths + { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName "LINK " + 0x80, // healthCapacity + 0x80, // health + 0, // magicLevel + 0x30, // magic + 0x32, // rupees + 0x64, // swordHealth + 0, // tatlTimer + 1, // magicAcquired + 0, // doubleMagic + 0, // doubleDefense + 0, // unk_1F + 0xFF, // unk_20 + 0, // owlActivationFlags + 0xFF, // unk_24 + SCENE_SPOT00, // savedSceneNum +}; + +ItemEquips sSaveDebugItemEquips = { + { + { ITEM_SWORD_KOKIRI, ITEM_BOW, ITEM_POTION_RED, ITEM_OCARINA }, + { ITEM_SWORD_KOKIRI, ITEM_BOW, ITEM_MASK_GORON, ITEM_OCARINA }, + { ITEM_SWORD_KOKIRI, ITEM_BOW, ITEM_MASK_ZORA, ITEM_OCARINA }, + { ITEM_NUT, ITEM_NUT, ITEM_MASK_DEKU, ITEM_OCARINA }, + }, + { + { SLOT_OCARINA, SLOT_BOW, SLOT_BOTTLE_2, SLOT_OCARINA }, + { SLOT_OCARINA, SLOT_MAGIC_BEANS, SLOT_MASK_GORON, SLOT_BOMBCHU }, + { SLOT_OCARINA, SLOT_POWDER_KEG, SLOT_MASK_ZORA, SLOT_BOMBCHU }, + { SLOT_OCARINA, SLOT_BOW, SLOT_MASK_DEKU, SLOT_BOMBCHU }, + }, + 0x11, +}; + +Inventory sSaveDebugInventory = { + // items + { + ITEM_OCARINA, + ITEM_BOW, + ITEM_ARROW_FIRE, + ITEM_ARROW_ICE, + ITEM_ARROW_LIGHT, + ITEM_MOON_TEAR, + ITEM_BOMB, + ITEM_BOMBCHU, + ITEM_STICK, + ITEM_NUT, + ITEM_MAGIC_BEANS, + ITEM_ROOM_KEY, + ITEM_POWDER_KEG, + ITEM_PICTO_BOX, + ITEM_LENS, + ITEM_HOOKSHOT, + ITEM_SWORD_GREAT_FAIRY, + ITEM_LETTER_TO_KAFEI, + ITEM_BOTTLE, + ITEM_POTION_RED, + ITEM_POTION_GREEN, + ITEM_POTION_BLUE, + ITEM_NONE, + ITEM_NONE, + ITEM_MASK_POSTMAN, + ITEM_MASK_ALL_NIGHT, + ITEM_MASK_BLAST, + ITEM_MASK_STONE, + ITEM_MASK_GREAT_FAIRY, + ITEM_MASK_DEKU, + ITEM_MASK_KEATON, + ITEM_MASK_BREMEN, + ITEM_MASK_BUNNY, + ITEM_MASK_DON_GERO, + ITEM_MASK_SCENTS, + ITEM_MASK_GORON, + ITEM_MASK_ROMANI, + ITEM_MASK_CIRCUS_LEADER, + ITEM_MASK_KAFEIS_MASK, + ITEM_MASK_COUPLE, + ITEM_MASK_TRUTH, + ITEM_MASK_ZORA, + ITEM_MASK_KAMARO, + ITEM_MASK_GIBDO, + ITEM_MASK_GARO, + ITEM_MASK_CAPTAIN, + ITEM_MASK_GIANT, + ITEM_MASK_FIERCE_DEITY, + }, + // ammo + { 1, 30, 1, 1, 1, 1, 30, 30, 30, 30, 1, 1, 1, 1, 30, 1, 1, 1, 1, 1, 1, 1, 0, 0 }, + // upgrades + 0x120009, + // questItems + (1 << QUEST_SONG_SONATA) | (1 << QUEST_SONG_LULLABY) | (1 << QUEST_SONG_BOSSA_NOVA) | (1 << QUEST_SONG_ELEGY) | + (1 << QUEST_SONG_OATH) | (1 << QUEST_SONG_TIME) | (1 << QUEST_SONG_HEALING) | (1 << QUEST_SONG_EPONA) | + (1 << QUEST_SONG_SOARING) | (1 << QUEST_SONG_STORMS) | (1 << QUEST_BOMBERS_NOTEBOOK) | + (1 << QUEST_SONG_LULLABY_INTRO), + // dungeonItems + { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }, + // dungeonKeys + { 8, 8, 8, 8, 8, 8, 8, 8, 8, 0 }, + // strayFairies + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + // dekuPlaygroundPlayerName + { + // "LINK " + { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, + // "LINK " + { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, + // "LINK " + { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, + }, +}; + +u16 sSaveDebugChecksum = 0; + +u8 D_801C6A48[] = { + ITEM_MASK_FIERCE_DEITY, ITEM_MASK_GORON, ITEM_MASK_ZORA, ITEM_MASK_DEKU, ITEM_MASK_FIERCE_DEITY, +}; + +u8 D_801C6A50[] = { + SLOT_MASK_FIERCE_DEITY, SLOT_MASK_GORON, SLOT_MASK_ZORA, SLOT_MASK_DEKU, SLOT_MASK_FIERCE_DEITY, +}; + +/** + * Initialize debug save. This is also used on the Title Screen + * This save has a mostly full inventory, every mask and 10 hearts. + * + * Some noteable flags that are set: + * TODO: Investigate the flags + */ +void Sram_InitDebugSave(void) { + Sram_ResetSave(); + + Lib_MemCpy(&gSaveContext.save.playerData, &sSaveDebugPlayerData, sizeof(SavePlayerData)); + Lib_MemCpy(&gSaveContext.save.equips, &sSaveDebugItemEquips, sizeof(ItemEquips)); + Lib_MemCpy(&gSaveContext.save.inventory, &sSaveDebugInventory, sizeof(Inventory)); + Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDebugChecksum, sizeof(gSaveContext.save.checksum)); + + if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + BUTTON_ITEM_EQUIP(0, 2) = D_801C6A48[((void)0, gSaveContext.save.playerForm & 0xFF)]; + C_SLOT_EQUIP(0, 2) = D_801C6A50[((void)0, gSaveContext.save.playerForm & 0xFF)]; + } + + gSaveContext.save.hasTatl = true; + + gSaveContext.save.horseData.scene = SCENE_F01; + gSaveContext.save.horseData.pos.x = -1420; + gSaveContext.save.horseData.pos.y = 257; + gSaveContext.save.horseData.pos.z = -1285; + gSaveContext.save.horseData.yaw = -0x7554; + + gSaveContext.save.entranceIndex = 0x1C00; + gSaveContext.save.isFirstCycle = true; + + // + gSaveContext.save.weekEventReg[0x0F] |= 0x20; + // Unconfirmed: "Entered South Clock Town" + gSaveContext.save.weekEventReg[0x3B] |= 0x04; + // Unconfirmed: "Tatl's Second Cycle Text?" + gSaveContext.save.weekEventReg[0x1F] |= 0x04; + + gSaveContext.cycleSceneFlags[SCENE_INSIDETOWER].switch0 = 1; + gSaveContext.save.permanentSceneFlags[SCENE_INSIDETOWER].switch0 = 1; + gSaveContext.save.playerData.magicLevel = 0; + + Sram_GenerateRandomSaveFields(); +} + +// Unused +void func_80144A94(SramContext* sramCtx) { + s32 i; + s32 cutscene = gSaveContext.save.cutscene; + + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + + if (func_80185968(sramCtx->saveBuf, D_801C67C8[gSaveContext.fileNum * 2], D_801C67F0[gSaveContext.fileNum * 2]) != + 0) { + func_80185968(sramCtx->saveBuf, D_801C67C8[gSaveContext.fileNum * 2 + 1], + D_801C67F0[gSaveContext.fileNum * 2 + 1]); + } + Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); + if (CHECK_NEWF(gSaveContext.save.playerData.newf)) { + func_80185968(sramCtx->saveBuf, D_801C67C8[gSaveContext.fileNum * 2 + 1], + D_801C67F0[gSaveContext.fileNum * 2 + 1]); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, sizeof(Save)); + } + gSaveContext.save.cutscene = cutscene; + + for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) { + gSaveContext.eventInf[i] = 0; + } + + for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { + gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.permanentSceneFlags[i].chest; + gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.permanentSceneFlags[i].switch0; + gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.permanentSceneFlags[i].switch1; + gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.permanentSceneFlags[i].clearedRoom; + gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible; + } + + for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) { + gSaveContext.unk_3DD0[i] = 0; + gSaveContext.unk_3DE0[i] = 0; + gSaveContext.unk_3E18[i] = 0; + gSaveContext.unk_3E50[i] = 0; + gSaveContext.unk_3E88[i] = 0; + gSaveContext.unk_3EC0[i] = 0; + } + + D_801BDAA0 = 1; + D_801BDA9C = 0; + gSaveContext.powderKegTimer = 0; + gSaveContext.unk_1014 = 0; + gSaveContext.jinxTimer = 0; +} + +u16 D_801C6A58[] = { 0x68B0, 0x6A60, 0xB230, 0x9A80, 0xD890, 0x3E40, 0x8640, 0x84A0, 0x2040, 0xAA30 }; + +#ifdef NON_MATCHING +// Small regalloc between v0/t6/t7 +void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { + s32 i; + s32 pad; + s32 phi_t1; + s32 pad1[2]; + s32 fileNum; + + if (gSaveContext.unk_3F3F) { + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + + if (gSaveContext.fileNum == 0xFF) { + func_80185968(sramCtx->saveBuf, D_801C67C8[0], D_801C67F0[0]); + } else if (fileChooseCtx->unk_2446A[gSaveContext.fileNum] != 0) { + phi_t1 = gSaveContext.fileNum + 2; + phi_t1 *= 2; + + if (func_80185968(sramCtx->saveBuf, D_801C67C8[phi_t1], D_801C67F0[phi_t1]) != 0) { + func_80185968(sramCtx->saveBuf, D_801C67C8[phi_t1 + 1], D_801C67F0[phi_t1 + 1]); + } + } else { + phi_t1 = gSaveContext.fileNum; + phi_t1 *= 2; + + if (func_80185968(sramCtx->saveBuf, D_801C67C8[phi_t1], D_801C67F0[phi_t1]) != 0) { + func_80185968(sramCtx->saveBuf, D_801C67C8[phi_t1 + 1], D_801C67F0[phi_t1 + 1]); + } + } + + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[phi_t1]); + + if (CHECK_NEWF(gSaveContext.save.playerData.newf)) { + func_80185968(sramCtx->saveBuf, D_801C67C8[phi_t1 + 1], D_801C67F0[phi_t1 + 1]); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[phi_t1]); + } + } + + gSaveContext.save.playerData.magicLevel = 0; + + if (!gSaveContext.save.isOwlSave) { + for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) { + gSaveContext.eventInf[i] = 0; + } + + for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { + gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.permanentSceneFlags[i].chest; + gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.permanentSceneFlags[i].switch0; + gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.permanentSceneFlags[i].switch1; + gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.permanentSceneFlags[i].clearedRoom; + gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible; + } + + for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) { + gSaveContext.unk_3DD0[i] = 0; + gSaveContext.unk_3DE0[i] = 0; + gSaveContext.unk_3E18[i] = 0; + gSaveContext.unk_3E50[i] = 0; + gSaveContext.unk_3E88[i] = 0; + gSaveContext.unk_3EC0[i] = 0; + } + + if (gSaveContext.save.isFirstCycle) { + gSaveContext.save.entranceIndex = 0xD800; + gSaveContext.save.day = 0; + gSaveContext.save.time = 0x3FFF; + } else { + gSaveContext.save.entranceIndex = 0x1C00; + gSaveContext.nextCutsceneIndex = 0; + gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; + } + } else { + gSaveContext.save.entranceIndex = D_801C6A58[gSaveContext.save.owlSaveLocation]; + if (D_801C6A58[gSaveContext.save.owlSaveLocation] == 0x84A0 && (gSaveContext.save.weekEventReg[20] & 2)) { + // Unconfirmed weekEventReg: "Woodfall Temple Prison Entrance raised / Water cleansed" + gSaveContext.save.entranceIndex = 0xCA0; + } else if (D_801C6A58[gSaveContext.save.owlSaveLocation] == 0x9A80 && + (gSaveContext.save.weekEventReg[33] & 0x80)) { + // Unconfirmed weekEventReg: "Mountain Village Unfrozen" + gSaveContext.save.entranceIndex = 0xAE80; + } + + for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { + gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.permanentSceneFlags[i].chest; + gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.permanentSceneFlags[i].switch0; + gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.permanentSceneFlags[i].switch1; + gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.permanentSceneFlags[i].clearedRoom; + gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible; + } + + if (gSaveContext.save.unk_F65) { + Lib_MemCpy(D_801D88A0, gSaveContext.save.scarecrowsSong, sizeof(gSaveContext.save.scarecrowsSong)); + + for (i = 0; i != ARRAY_COUNT(gSaveContext.save.scarecrowsSong); i++) {} + } + + fileNum = gSaveContext.fileNum; + func_80147314(sramCtx, fileNum); + } +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_OpenSave.s") +#endif + +// Similar to func_80145698, but accounts for owl saves? +void func_8014546C(SramContext* sramCtx) { + s32 i; + + if (gSaveContext.save.isOwlSave) { + for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { + gSaveContext.save.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; + gSaveContext.save.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; + gSaveContext.save.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; + gSaveContext.save.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; + gSaveContext.save.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; + } + + gSaveContext.save.checksum = 0; + gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum)); + + Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, offsetof(SaveContext, fileNum)); + } else { + for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { + gSaveContext.save.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; + gSaveContext.save.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; + gSaveContext.save.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; + gSaveContext.save.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; + gSaveContext.save.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; + } + + gSaveContext.save.checksum = 0; + gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); + + if (gSaveContext.unk_3F3F) { + Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, sizeof(Save)); + Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); + } + } +} + +/** + * Save permanent scene flags, calculate checksum, copy save context to the save buffer + */ +void func_80145698(SramContext* sramCtx) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { + gSaveContext.save.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; + gSaveContext.save.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; + gSaveContext.save.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; + gSaveContext.save.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; + gSaveContext.save.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; + } + + gSaveContext.save.checksum = 0; + gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); + if (gSaveContext.unk_3F3F) { + Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, sizeof(Save)); + Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); + } +} + +// Verifies save and use backup if corrupted? +#ifdef NON_EQUIVALENT +void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) { + FileChooseContext* fileChooseCtx = fileChooseCtx2; + u16 sp7A; + // u16 sp78; + u16 sp76; + // u16 sp74; + u16 sp6E; //! + // s32 sp68; + // u16 sp66; + u16 phi_s2; //! + u16 sp64; + // s32 sp60; + // s32 sp5C; + // s32 sp58; + // u32 new_var; + u16 phi_s2_3; + // s16 fakevar; + + u16 temp_s2; + u16 temp_v0_2; + u16 phi_a0; // maskCount + + if (gSaveContext.unk_3F3F) { + D_801F6AF0 = gSaveContext.save.time; + D_801F6AF2 = gSaveContext.unk_3F3F; + sp64 = 0; + + for (sp76 = 0; sp76 < 5; sp76++, sp64 += 2) { + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + + phi_s2 = false; + sp6E = 0; + if (func_80185968(sramCtx->saveBuf, D_801C67C8[sp64], D_801C67F0[sp64])) { + sp6E = 1; + if (func_80185968(sramCtx->saveBuf, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1])) { + phi_s2 = true; + } + } + + if (sp76 < 2) { + fileChooseCtx->unk_24468[sp76] = 0; + if (phi_s2) { + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + } else { + // Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + temp_s2 = gSaveContext.save.checksum; + gSaveContext.save.checksum = 0; + temp_v0_2 = Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]); + gSaveContext.save.checksum = temp_s2; + + if (CHECK_NEWF(gSaveContext.save.playerData.newf) || (temp_s2 != temp_v0_2)) { + sp6E = 1; + if (CHECK_NEWF2(gSaveContext.save.playerData.newf)) {} + + phi_s2 = false; + if (func_80185968(sramCtx->saveBuf, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1])) { + phi_s2 = true; + } + + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + temp_s2 = gSaveContext.save.checksum; + gSaveContext.save.checksum = 0; + if (phi_s2 || CHECK_NEWF(gSaveContext.save.playerData.newf) || + (temp_s2 != Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]))) { + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); + sp6E = 999; + } + } + } + + gSaveContext.save.checksum = 0; + gSaveContext.save.checksum = + Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64 & 0xFFFFFFFF]); // TODO: Needed? + + for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.newf); sp7A++) { + fileChooseCtx->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A]; + } + + if (!CHECK_NEWF(fileChooseCtx->newf[sp76])) { + fileChooseCtx->unk_2440C[sp76] = gSaveContext.save.playerData.deaths; + + for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.playerName); sp7A++) { + fileChooseCtx->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A]; + } + + fileChooseCtx->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity; + fileChooseCtx->health[sp76] = gSaveContext.save.playerData.health; + fileChooseCtx->unk_24454[sp76] = gSaveContext.save.inventory.dungeonKeys[9]; + fileChooseCtx->unk_24444[sp76] = gSaveContext.save.inventory.questItems; + fileChooseCtx->unk_24458[sp76] = gSaveContext.save.time; + fileChooseCtx->unk_24460[sp76] = gSaveContext.save.day; + fileChooseCtx->unk_24468[sp76] = gSaveContext.save.isOwlSave; + fileChooseCtx->rupees[sp76] = gSaveContext.save.playerData.rupees; + fileChooseCtx->unk_24474[sp76] = CUR_UPG_VALUE(4); + + for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) { + if (gSaveContext.save.inventory.items[sp7A + 24] != 0xFF) { + phi_a0++; + } + } + fileChooseCtx->maskCount[sp76] = phi_a0; + fileChooseCtx->heartPieceCount[sp76] = + ((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C); + } + + if (sp6E == 1) { + Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); + func_80146EBC(sramCtx, D_801C67C8[sp64], D_801C6818[sp64]); + } else if (sp6E == 0) { // TODO: == 0? + temp_s2 = gSaveContext.save.checksum; + if (func_80185968(sramCtx->saveBuf, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1])) { + phi_s2_3 = 1; + } else { + Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); + phi_s2_3 = gSaveContext.save.checksum; + gSaveContext.save.checksum = 0; + sp7A = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); + } + + if (CHECK_NEWF(gSaveContext.save.playerData.newf) || (phi_s2_3 != sp7A) || (phi_s2_3 != temp_s2)) { + func_80185968(sramCtx->saveBuf, D_801C67C8[sp64], D_801C67F0[sp64]); + Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); + Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); + func_80146EBC(sramCtx, D_801C67C8[sp64], D_801C6818[sp64]); + } + } + } else if (sp76 < 4) { + fileChooseCtx->unk_24468[sp76] = 0; + + if (!CHECK_NEWF(fileChooseCtx->newf2[(s32)sp76])) { // TODO: Needed? + if (phi_s2) { + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, + D_801C6870[sp64]); // TODO: Needed? + } else { + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + temp_s2 = gSaveContext.save.checksum; + + gSaveContext.save.checksum = 0; + temp_v0_2 = Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]); + gSaveContext.save.checksum = temp_s2; + if (CHECK_NEWF(gSaveContext.save.playerData.newf) || (temp_s2 != temp_v0_2)) { + sp6E = 1; + if ((gSaveContext.save.playerData.newf[0] == 'Z') && + (gSaveContext.save.playerData.newf[1] == 'E')) { + phi_s2 = false; + } + + if (func_80185968(sramCtx->saveBuf, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1])) { + phi_s2 = true; + } + + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + temp_s2 = gSaveContext.save.checksum; + gSaveContext.save.checksum = 0; + if (phi_s2 || CHECK_NEWF(gSaveContext.save.playerData.newf) || + (temp_s2 != Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]))) { + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + sp6E = 999; + } + } + } + + gSaveContext.save.checksum = 0; + gSaveContext.save.checksum = + Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64 & 0xFFFFFFFF]); // TODO: Needed? + + for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.newf); sp7A++) { + fileChooseCtx->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A]; + } + + if (!CHECK_NEWF(fileChooseCtx->newf[sp76])) { + fileChooseCtx->unk_2440C[sp76] = gSaveContext.save.playerData.deaths; + + for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.playerName); sp7A++) { + phi_s2 += 0; // TODO: Needed? + fileChooseCtx->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A]; + } + + fileChooseCtx->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity; + fileChooseCtx->health[sp76] = gSaveContext.save.playerData.health; + fileChooseCtx->unk_24454[sp76] = gSaveContext.save.inventory.dungeonKeys[9]; + fileChooseCtx->unk_24444[sp76] = gSaveContext.save.inventory.questItems; + fileChooseCtx->unk_24458[sp76] = gSaveContext.save.time; + fileChooseCtx->unk_24460[sp76] = gSaveContext.save.day; + fileChooseCtx->unk_24468[sp76] = gSaveContext.save.isOwlSave; + fileChooseCtx->rupees[sp76] = gSaveContext.save.playerData.rupees; + fileChooseCtx->unk_24474[sp76] = CUR_UPG_VALUE(4); + + for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) { + if (gSaveContext.save.inventory.items[sp7A + 24] != 0xFF) { + phi_a0++; + } + } + fileChooseCtx->maskCount[sp76] = phi_a0; + fileChooseCtx->heartPieceCount[sp76] = + ((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C); + } + + if (sp6E == 1) { + func_80146EBC(sramCtx, D_801C67C8[sp64], D_801C67F0[sp64]); + func_80146EBC(sramCtx, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1]); + } else if (!sp6E) { // TODO: == 0? + temp_s2 = gSaveContext.save.checksum; + if (func_80185968(sramCtx->saveBuf, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1])) { + phi_s2_3 = 1; + } else { + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + phi_s2_3 = gSaveContext.save.checksum; + gSaveContext.save.checksum = 0; + // phi_s2_3 = gSaveContext.save.checksum; + sp7A = Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]); + } + + if (CHECK_NEWF(gSaveContext.save.playerData.newf) || (phi_s2_3 != sp7A) || + (phi_s2_3 != temp_s2)) { + func_80185968(sramCtx->saveBuf, D_801C67C8[sp64], D_801C67F0[sp64]); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + func_80146EBC(sramCtx, D_801C67C8[sp64], D_801C67F0[sp64]); + func_80146EBC(sramCtx, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1]); + } + } + } else { + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); + func_80146EBC(sramCtx, D_801C67C8[sp64], D_801C67F0[sp64]); + func_80146EBC(sramCtx, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1]); + } + } else { + if (phi_s2) { + gSaveContext.options.optionId = 0xA51D; + gSaveContext.options.language = 1; + gSaveContext.options.audioSetting = 0; + gSaveContext.options.languageSetting = 0; + gSaveContext.options.zTargetSetting = 0; + } else { + Lib_MemCpy(&gSaveContext.options, sramCtx->saveBuf, sizeof(SaveOptions)); + if (gSaveContext.options.optionId != 0xA51D) { + gSaveContext.options.optionId = 0xA51D; + gSaveContext.options.language = 1; + gSaveContext.options.audioSetting = 0; + gSaveContext.options.languageSetting = 0; + gSaveContext.options.zTargetSetting = 0; + } + } + func_801A3D98(gSaveContext.options.audioSetting); + } + } + + gSaveContext.save.time = D_801F6AF0; + gSaveContext.unk_3F3F = D_801F6AF2; + } + + gSaveContext.options.language = 1; +} +#else #pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_801457CC.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146580.s") +void func_80146580(FileChooseContext* fileChooseCtx2, SramContext* sramCtx, s32 fileNum) { + FileChooseContext* fileChooseCtx = fileChooseCtx2; + s32 pad; + if (gSaveContext.unk_3F3F) { + if (fileChooseCtx->unk_2446A[fileNum]) { + func_80147314(sramCtx, fileNum); + fileChooseCtx->unk_2446A[fileNum] = 0; + } + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, sizeof(Save)); + } + + gSaveContext.save.time = D_801F6AF0; + gSaveContext.unk_3F3F = D_801F6AF2; +} + +#ifdef NON_MATCHING +// v0/v1 +void func_80146628(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) { + FileChooseContext* fileChooseCtx = fileChooseCtx2; + u16 i; + s16 maskCount; + + if (gSaveContext.unk_3F3F) { + if (fileChooseCtx->unk_2446A[fileChooseCtx->unk_2448E]) { + func_80147414(sramCtx, fileChooseCtx->unk_2448E, fileChooseCtx->fileNum); + fileChooseCtx->unk_24410[fileChooseCtx->fileNum] = gSaveContext.save.playerData.deaths; + + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) { + fileChooseCtx->unk_24424[fileChooseCtx->fileNum][i] = gSaveContext.save.playerData.playerName[i]; + } + + fileChooseCtx->unk_24438[fileChooseCtx->fileNum] = gSaveContext.save.playerData.healthCapacity; + fileChooseCtx->unk_24440[fileChooseCtx->fileNum] = gSaveContext.save.playerData.health; + fileChooseCtx->unk_24456[fileChooseCtx->fileNum] = gSaveContext.save.inventory.dungeonKeys[9]; + fileChooseCtx->unk_2444C[fileChooseCtx->fileNum] = gSaveContext.save.inventory.questItems; + fileChooseCtx->unk_2445C[fileChooseCtx->fileNum] = gSaveContext.save.time; + fileChooseCtx->unk_24464[fileChooseCtx->fileNum] = gSaveContext.save.day; + fileChooseCtx->unk_2446A[fileChooseCtx->fileNum] = gSaveContext.save.isOwlSave; + fileChooseCtx->unk_24470[fileChooseCtx->fileNum] = gSaveContext.save.playerData.rupees; + // = CUR_UPG_VALUE(UPG_WALLET); + fileChooseCtx->unk_24476[fileChooseCtx->fileNum] = + (gSaveContext.save.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4]; + + for (i = 0, maskCount = 0; i < 24; i++) { + if (gSaveContext.save.inventory.items[i + 24] != ITEM_NONE) { + maskCount++; + } + } + + fileChooseCtx->unk_2447A[fileChooseCtx->fileNum] = maskCount; + fileChooseCtx->unk_2447E[fileChooseCtx->fileNum] = + (gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C; + } + + // clear buffer + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + // read to buffer + func_80185968(sramCtx->saveBuf, D_801C67C8[fileChooseCtx->unk_2448E * 2], + D_801C67F0[fileChooseCtx->unk_2448E * 2]); + + if (1) {} + func_80185968(&sramCtx->saveBuf[0x2000], D_801C67C8[fileChooseCtx->unk_2448E * 2 + 1], + D_801C67F0[fileChooseCtx->unk_2448E * 2 + 1]); + if (1) {} + + // copy buffer to save context + Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); + + fileChooseCtx->unk_2440C[fileChooseCtx->fileNum] = gSaveContext.save.playerData.deaths; + + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) { + fileChooseCtx->unk_24414[fileChooseCtx->fileNum][i] = gSaveContext.save.playerData.playerName[i]; + } + + fileChooseCtx->healthCapacity[fileChooseCtx->fileNum] = gSaveContext.save.playerData.healthCapacity; + fileChooseCtx->health[fileChooseCtx->fileNum] = gSaveContext.save.playerData.health; + fileChooseCtx->unk_24454[fileChooseCtx->fileNum] = gSaveContext.save.inventory.dungeonKeys[9]; + fileChooseCtx->unk_24444[fileChooseCtx->fileNum] = gSaveContext.save.inventory.questItems; + fileChooseCtx->unk_24458[fileChooseCtx->fileNum] = gSaveContext.save.time; + fileChooseCtx->unk_24460[fileChooseCtx->fileNum] = gSaveContext.save.day; + fileChooseCtx->unk_24468[fileChooseCtx->fileNum] = gSaveContext.save.isOwlSave; + fileChooseCtx->rupees[fileChooseCtx->fileNum] = gSaveContext.save.playerData.rupees; + // = CUR_UPG_VALUE(UPG_WALLET); + fileChooseCtx->unk_24474[fileChooseCtx->fileNum] = + (gSaveContext.save.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4]; + + for (i = 0, maskCount = 0; i < 24; i++) { + if (gSaveContext.save.inventory.items[i + 24] != ITEM_NONE) { + maskCount++; + } + } + + fileChooseCtx->maskCount[fileChooseCtx->fileNum] = maskCount; + fileChooseCtx->heartPieceCount[fileChooseCtx->fileNum] = + (gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C; + } + + gSaveContext.save.time = D_801F6AF0; + gSaveContext.unk_3F3F = D_801F6AF2; +} +#else #pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146628.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146AA0.s") +void Sram_InitSave(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) { + s32 phi_v0; + u16 i; + FileChooseContext* fileChooseCtx = fileChooseCtx2; + s16 maskCount; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146DF8.s") + if (gSaveContext.unk_3F3F) { + Sram_InitNewSave(); + if (fileChooseCtx->unk_24480 == 0) { + gSaveContext.save.cutscene = 0xFFF0; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146E40.s") + for (phi_v0 = 0; phi_v0 < ARRAY_COUNT(gSaveContext.save.playerData.playerName); phi_v0++) { + gSaveContext.save.playerData.playerName[phi_v0] = + fileChooseCtx->unk_24414[fileChooseCtx->unk_24480][phi_v0]; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_Alloc.s") + gSaveContext.save.playerData.newf[0] = 'Z'; + gSaveContext.save.playerData.newf[1] = 'E'; + gSaveContext.save.playerData.newf[2] = 'L'; + gSaveContext.save.playerData.newf[3] = 'D'; + gSaveContext.save.playerData.newf[4] = 'A'; + gSaveContext.save.playerData.newf[5] = '3'; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146EBC.s") + gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146EE8.s") + Lib_MemCpy(sramCtx->saveBuf, &gSaveContext.save, sizeof(Save)); + Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146F5C.s") + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.newf); i++) { + fileChooseCtx->newf[fileChooseCtx->unk_24480][i] = gSaveContext.save.playerData.newf[i]; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80147008.s") + fileChooseCtx->unk_2440C[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.deaths; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80147020.s") + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) { + fileChooseCtx->unk_24414[fileChooseCtx->unk_24480][i] = gSaveContext.save.playerData.playerName[i]; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80147068.s") + fileChooseCtx->healthCapacity[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.healthCapacity; + fileChooseCtx->health[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.health; + fileChooseCtx->unk_24454[fileChooseCtx->unk_24480] = gSaveContext.save.inventory.dungeonKeys[9]; + fileChooseCtx->unk_24444[fileChooseCtx->unk_24480] = gSaveContext.save.inventory.questItems; + fileChooseCtx->unk_24458[fileChooseCtx->unk_24480] = gSaveContext.save.time; + fileChooseCtx->unk_24460[fileChooseCtx->unk_24480] = gSaveContext.save.day; + fileChooseCtx->unk_24468[fileChooseCtx->unk_24480] = gSaveContext.save.isOwlSave; + fileChooseCtx->rupees[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.rupees; + fileChooseCtx->unk_24474[fileChooseCtx->unk_24480] = CUR_UPG_VALUE(UPG_WALLET); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80147138.s") + for (i = 0, maskCount = 0; i < 24; i++) { + if (gSaveContext.save.inventory.items[i + 24] != ITEM_NONE) { + maskCount++; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80147150.s") + fileChooseCtx->maskCount[fileChooseCtx->unk_24480] = maskCount; + fileChooseCtx->heartPieceCount[fileChooseCtx->unk_24480] = + (gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80147198.s") + gSaveContext.save.time = D_801F6AF0; + gSaveContext.unk_3F3F = D_801F6AF2; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80147314.s") +void func_80146DF8(SramContext* sramCtx) { + if (gSaveContext.unk_3F3F) { + // TODO: macros for languages + gSaveContext.options.language = 1; + Lib_MemCpy(sramCtx->saveBuf, &gSaveContext.options, sizeof(SaveOptions)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80147414.s") +void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { + if (&gSaveContext.save) {} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_nop8014750C.s") + func_801A3D98(gSaveContext.options.audioSetting); +} + +void Sram_Alloc(GameState* gamestate, SramContext* sramCtx) { + if (gSaveContext.unk_3F3F) { + sramCtx->saveBuf = THA_AllocEndAlign16(&gamestate->heap, SAVE_BUFFER_SIZE); + sramCtx->status = 0; + } +} + +/** + * Synchronous flash write + */ +void func_80146EBC(SramContext* sramCtx, s32 curPage, s32 numPages) { + sramCtx->curPage = curPage; + sramCtx->numPages = numPages; + func_80185F64(sramCtx->saveBuf, curPage, numPages); +} + +/** + * Saves the game on the very first time Player enters South Clock Town from the Clock Tower + */ +void Sram_SaveSpecialEnterClockTown(GlobalContext* globalCtx) { + s32 pad[2]; + SramContext* sramCtx = &globalCtx->sramCtx; + + gSaveContext.save.isFirstCycle = true; + gSaveContext.save.isOwlSave = false; + func_80145698(sramCtx); + func_80185F64(sramCtx->saveBuf, D_801C67C8[gSaveContext.fileNum * 2], D_801C6818[gSaveContext.fileNum * 2]); +} + +/** + * Saves when beating the game, after showing the "Dawn of the New Day" message + */ +void Sram_SaveSpecialNewDay(GlobalContext* globalCtx) { + s32 cutscene = gSaveContext.save.cutscene; + s32 day; + u16 time = gSaveContext.save.time; + + day = gSaveContext.save.day; + + // Unconfirmed: "Obtained Fierce Deity Mask?" + gSaveContext.save.weekEventReg[84] &= (u8)~0x20; + + Sram_SaveEndOfCycle(globalCtx); + func_8014546C(&globalCtx->sramCtx); + + gSaveContext.save.day = day; + gSaveContext.save.time = time; + gSaveContext.save.cutscene = cutscene; + func_80185F64(globalCtx->sramCtx.saveBuf, D_801C67C8[gSaveContext.fileNum * 2], + D_801C67F0[gSaveContext.fileNum * 2]); +} + +void func_80147008(SramContext* sramCtx, u32 curPage, u32 numPages) { + sramCtx->curPage = curPage; + sramCtx->numPages = numPages; + sramCtx->status = 1; +} + +void func_80147020(SramContext* sramCtx) { + // async flash write + func_80185DDC(sramCtx->saveBuf, sramCtx->curPage, sramCtx->numPages); + + sramCtx->unk_18 = osGetTime(); + sramCtx->status = 2; +} + +void func_80147068(SramContext* sramCtx) { + if (sramCtx->status == 2) { + if (func_80185EC4() != 0) { // if task running + if (func_80185F04() == 0) { // wait for task done + // task success + sramCtx->status = 4; + } else { + // task failure + sramCtx->status = 4; + } + } + } else if (((osGetTime() - sramCtx->unk_18) * 0x40) / 3000 / 10000 >= 200) { + sramCtx->status = 0; + } +} + +void func_80147138(SramContext* sramCtx, s32 curPage, s32 numPages) { + sramCtx->curPage = curPage; + sramCtx->numPages = numPages; + sramCtx->status = 6; +} + +void func_80147150(SramContext* sramCtx) { + func_80185DDC(sramCtx->saveBuf, sramCtx->curPage, sramCtx->numPages); + + sramCtx->unk_18 = osGetTime(); + sramCtx->status = 7; +} + +void func_80147198(SramContext* sramCtx) { + if (sramCtx->status == 7) { + if (func_80185EC4() != 0) { // Is task running + if (func_80185F04() == 0) { // Wait for task done + func_80185DDC(sramCtx->saveBuf, sramCtx->curPage + 0x80, sramCtx->numPages); + sramCtx->status = 8; + } else { + func_80185DDC(sramCtx->saveBuf, sramCtx->curPage + 0x80, sramCtx->numPages); + sramCtx->status = 8; + } + } + } else if (sramCtx->status == 8) { + if (func_80185EC4() != 0) { // Is task running + if (func_80185F04() == 0) { // Wait for task done + sramCtx->status = 4; + } else { + sramCtx->status = 4; + } + } + } else if (((osGetTime() - sramCtx->unk_18) * 0x40) / 3000 / 10000 >= 200) { + sramCtx->status = 0; + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + gSaveContext.save.isOwlSave = false; + gSaveContext.save.checksum = 0; + // flash read to buffer then copy to save context + func_80185968(sramCtx->saveBuf, sramCtx->curPage, sramCtx->numPages); + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, offsetof(SaveContext, fileNum)); + } +} + +void func_80147314(SramContext* sramCtx, s32 fileNum) { + s32 pad; + + gSaveContext.save.isOwlSave = false; + + gSaveContext.save.playerData.newf[0] = '\0'; + gSaveContext.save.playerData.newf[1] = '\0'; + gSaveContext.save.playerData.newf[2] = '\0'; + gSaveContext.save.playerData.newf[3] = '\0'; + gSaveContext.save.playerData.newf[4] = '\0'; + gSaveContext.save.playerData.newf[5] = '\0'; + + gSaveContext.save.checksum = 0; + gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum)); + + Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, offsetof(SaveContext, fileNum)); + func_80146EBC(sramCtx, D_801C6840[fileNum * 2], D_801C6850[fileNum * 2]); + func_80146EBC(sramCtx, D_801C6840[fileNum * 2 + 1], D_801C6850[fileNum * 2]); + + gSaveContext.save.isOwlSave = true; + + gSaveContext.save.playerData.newf[0] = 'Z'; + gSaveContext.save.playerData.newf[1] = 'E'; + gSaveContext.save.playerData.newf[2] = 'L'; + gSaveContext.save.playerData.newf[3] = 'D'; + gSaveContext.save.playerData.newf[4] = 'A'; + gSaveContext.save.playerData.newf[5] = '3'; +} + +void func_80147414(SramContext* sramCtx, s32 fileNum, s32 arg2) { + s32 pad; + + // Clear save buffer + bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); + + // Read save file + if (func_80185968(sramCtx->saveBuf, D_801C6840[fileNum * 2], D_801C6850[fileNum * 2]) != 0) { + // If failed, read backup save file + func_80185968(sramCtx->saveBuf, D_801C6840[fileNum * 2 + 1], D_801C6850[fileNum * 2 + 1]); + } + + // Copy buffer to save context + Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, offsetof(SaveContext, fileNum)); + + func_80146EBC(sramCtx, D_801C6840[arg2 * 2], D_801C6850[arg2 * 2]); + func_80146EBC(sramCtx, D_801C6840[arg2 * 2 + 1], D_801C6850[arg2 * 2]); +} + +void Sram_nop8014750C(UNK_TYPE4 arg0) { +} diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index 7cd39251c3..023b4b7064 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -84,7 +84,7 @@ void BgIknvObj_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - gSaveContext.weekEventReg[51] &= (u8)~0x10; + gSaveContext.save.weekEventReg[51] &= (u8)~0x10; Actor_SetFocus(&this->dyna.actor, IREG(88)); break; default: @@ -98,7 +98,7 @@ void BgIknvObj_Destroy(Actor* thisx, GlobalContext* globalCtx) { if (IKNV_OBJ_TYPE(this) != IKNV_OBJ_RAISED_DOOR) { if (IKNV_OBJ_TYPE(this) == IKNV_OBJ_SAKON_DOOR) { Collider_DestroyCylinder(globalCtx, &this->collider); - gSaveContext.weekEventReg[51] &= (u8)~0x10; + gSaveContext.save.weekEventReg[51] &= (u8)~0x10; } else { return; } @@ -125,7 +125,7 @@ s32 func_80BD7CEC(BgIknvObj* this) { } void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, GlobalContext* globalCtx) { - if (gSaveContext.weekEventReg[14] & 4) { + if (gSaveContext.save.weekEventReg[14] & 4) { this->dyna.actor.shape.rot.z -= 0x64; func_800B9098(&this->dyna.actor); func_800B9010(&this->dyna.actor, NA_SE_EV_WOOD_WATER_WHEEL - SFX_FLAG); @@ -156,16 +156,16 @@ s32 func_80BD7E0C(BgIknvObj* this, s16 targetRotation, GlobalContext* globalCtx) void func_80BD7ED8(BgIknvObj* this, GlobalContext* globalCtx) { if (func_80BD7E0C(this, this->dyna.actor.home.rot.y, globalCtx)) { this->actionFunc = BgIknvObj_UpdateSakonDoor; - gSaveContext.weekEventReg[51] &= (u8)~0x10; + gSaveContext.save.weekEventReg[51] &= (u8)~0x10; } CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } void func_80BD7F4C(BgIknvObj* this, GlobalContext* globalCtx) { - if (gSaveContext.time > CLOCK_TIME(19, 30)) { + if (gSaveContext.save.time > CLOCK_TIME(19, 30)) { this->actionFunc = func_80BD7ED8; } - if ((this->dyna.actor.home.rot.x == 1) && !(gSaveContext.weekEventReg[58] & 0x80)) { + if ((this->dyna.actor.home.rot.x == 1) && !(gSaveContext.save.weekEventReg[58] & 0x80)) { ActorCutscene_Stop(this->dyna.actor.cutscene); this->dyna.actor.home.rot.x = 0; } @@ -175,7 +175,7 @@ void func_80BD7F4C(BgIknvObj* this, GlobalContext* globalCtx) { void func_80BD7FDC(BgIknvObj* this, GlobalContext* globalCtx) { if (func_80BD7E0C(this, this->dyna.actor.home.rot.y + 0x4000, globalCtx)) { this->actionFunc = func_80BD7F4C; - gSaveContext.weekEventReg[51] |= 0x10; + gSaveContext.save.weekEventReg[51] |= 0x10; this->dyna.actor.home.rot.x = 1; } } @@ -188,9 +188,9 @@ void func_80BD8040(BgIknvObj* this, GlobalContext* globalCtx) { } void BgIknvObj_UpdateSakonDoor(BgIknvObj* this, GlobalContext* globalCtx) { - if (gSaveContext.weekEventReg[58] & 0x80) { + if (gSaveContext.save.weekEventReg[58] & 0x80) { this->actionFunc = func_80BD8040; - gSaveContext.weekEventReg[89] |= 0x80; + gSaveContext.save.weekEventReg[89] |= 0x80; } CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index d84003061f..2648b3069c 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -194,7 +194,7 @@ void func_80953F9C(BgIngate* this, GlobalContext* globalCtx) { this->dyna.actor.textId = 0x9E4; Message_StartTextbox(globalCtx, this->dyna.actor.textId, NULL); this->unk16C += 1; - gSaveContext.weekEventReg[90] |= 0x40; + gSaveContext.save.weekEventReg[90] |= 0x40; this->actionFunc = func_809543D4; } else { @@ -253,7 +253,7 @@ void func_809542A0(BgIngate* this, GlobalContext* globalCtx) { globalCtx->unk_1887F = 3; gSaveContext.nextTransition = 3; this->actionFunc = func_80953F8C; - gSaveContext.weekEventReg[90] &= (u8)~0x40; + gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_800FE498(); } @@ -289,7 +289,7 @@ void func_809543D4(BgIngate* this, GlobalContext* globalCtx) { this->unk164 = &globalCtx->setupPathList[this->unk164->unk1]; } func_80953F14(this, globalCtx); - gSaveContext.weekEventReg[90] &= (u8)~0x40; + gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_8019F230(); } func_801477B4(globalCtx); @@ -297,7 +297,7 @@ void func_809543D4(BgIngate* this, GlobalContext* globalCtx) { case 0x9E6: if (globalCtx->msgCtx.choiceIndex == 0) { func_80953EA4(this, globalCtx); - gSaveContext.weekEventReg[90] &= (u8)~0x40; + gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_8019F208(); } else { this = this; @@ -330,10 +330,10 @@ void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetScale(&this->dyna.actor, 1.0f); this->unk164 = func_8013BB34(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), 0); this->dyna.actor.room = -1; - if (gSaveContext.weekEventReg[20] & 2) { - gSaveContext.weekEventReg[90] &= (u8)~0x40; + if (gSaveContext.save.weekEventReg[20] & 2) { + gSaveContext.save.weekEventReg[90] &= (u8)~0x40; } - if (!(gSaveContext.eventInf[3] & 0x20) && (gSaveContext.weekEventReg[90] & 0x40)) { + if (!(gSaveContext.eventInf[3] & 0x20) && (gSaveContext.save.weekEventReg[90] & 0x40)) { phi_a2 = 1; this->unk16C = 1; this->actionFunc = func_809541B8; diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c index d169be6de0..6e27d1dc9c 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c @@ -194,7 +194,7 @@ void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, GlobalContext* globalCtx) { if (this->collider.base.acFlags & AC_HIT) { hitMask = BgKin2Fence_CheckHitMask(this); if (hitMask >= 0) { - nextMask = (s8)gSaveContext.spiderHouseMaskOrder[this->masksHit]; + nextMask = (s8)gSaveContext.save.spiderHouseMaskOrder[this->masksHit]; if (hitMask == nextMask) { play_sound(NA_SE_SY_TRE_BOX_APPEAR); this->masksHit += 1; diff --git a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c index 5c2a972b59..71f1d2b6a4 100644 --- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c +++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c @@ -97,7 +97,7 @@ void BgLotus_Wait(BgLotus* this, GlobalContext* globalCtx) { EffectSsGRipple_Spawn(globalCtx, &this->dyna.actor.world.pos, 1000, 1400, 8); this->timer = 40; } - if (gSaveContext.playerForm != PLAYER_FORM_DEKU) { + if (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) { this->timer = 40; this->dyna.actor.flags |= ACTOR_FLAG_10; this->actionFunc = BgLotus_Sink; diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c index bf556345f1..186376d9bb 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c @@ -161,7 +161,7 @@ void BgNumaHana_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if (gSaveContext.weekEventReg[12] & 1) { + if (gSaveContext.save.weekEventReg[12] & 1) { func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); this->petalZRotation = 0x2000; @@ -219,7 +219,7 @@ void BgNumaHana_ClosedIdle(BgNumaHana* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FLAME_IGNITION); if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - gSaveContext.weekEventReg[12] |= 1; + gSaveContext.save.weekEventReg[12] |= 1; Flags_SetSwitch(globalCtx, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); BgNumaHana_SetupUnfoldInnerPetals(this); } else { diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c index 3adec0ce4e..f9b76fd006 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c @@ -38,13 +38,13 @@ void BgTobira01_Open(BgTobira01* this, GlobalContext* globalCtx) { ActorCutscene_Stop(0x7C); } else if (ActorCutscene_GetCanPlayNext(cutsceneId)) { ActorCutscene_StartAndSetUnkLinkFields(cutsceneId, &this->dyna.actor); - gSaveContext.weekEventReg[88] |= 0x40; + gSaveContext.save.weekEventReg[88] |= 0x40; this->playCutscene = false; } else { ActorCutscene_SetIntentToPlay(cutsceneId); } - } else if (!(gSaveContext.weekEventReg[88] & 0x40) && (this->timer == 0) && (globalCtx->actorCtx.unk1F5 != 0) && - (globalCtx->actorCtx.unk1F4 == 0) && + } else if (!(gSaveContext.save.weekEventReg[88] & 0x40) && (this->timer == 0) && + (globalCtx->actorCtx.unk1F5 != 0) && (globalCtx->actorCtx.unk1F4 == 0) && (SurfaceType_GetSceneExitIndex(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorBgId) == 6)) { this->playCutscene = true; @@ -53,7 +53,7 @@ void BgTobira01_Open(BgTobira01* this, GlobalContext* globalCtx) { prevTimer = this->timer; - if (gSaveContext.weekEventReg[88] & 0x40) { + if (gSaveContext.save.weekEventReg[88] & 0x40) { this->timer++; } else { this->timer--; @@ -68,8 +68,8 @@ void BgTobira01_Open(BgTobira01* this, GlobalContext* globalCtx) { this->timer2 = 180; } - if (!(player->stateFlags1 & 0x40) && (gSaveContext.weekEventReg[88] & 0x40) && (DECR(this->timer2) == 0)) { - gSaveContext.weekEventReg[88] &= (u8)~0x40; + if (!(player->stateFlags1 & 0x40) && (gSaveContext.save.weekEventReg[88] & 0x40) && (DECR(this->timer2) == 0)) { + gSaveContext.save.weekEventReg[88] &= (u8)~0x40; } } @@ -79,9 +79,9 @@ void BgTobira01_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 1); DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_spot11_obj_Colheader_0011C0); - gSaveContext.weekEventReg[88] &= (u8)~0x40; + gSaveContext.save.weekEventReg[88] &= (u8)~0x40; Actor_SetScale(&this->dyna.actor, 1.0f); - this->timer2 = gSaveContext.isNight; + this->timer2 = gSaveContext.save.isNight; this->timer = 0; this->actionFunc = BgTobira01_Open; } diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index af5e4fbe1c..e2a4e41f53 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -549,7 +549,7 @@ void Boss02_Init(Actor* thisx, GlobalContext* globalCtx) { s32 i; s32 pad[2]; - if ((gSaveContext.weekEventReg[52] & 0x20) && (this->actor.params == 0)) { + if ((gSaveContext.save.weekEventReg[52] & 0x20) && (this->actor.params == 0)) { D_809E0434 = (DoorWarp1*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, 60.0f, 0.0f, 0, 0, 0, 1); Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, 0); @@ -2057,7 +2057,7 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { break; case 1: - if ((gSaveContext.weekEventReg[52] & 0x20) || ((u32)(KREG(13) + 15) >= this->unk_1D1C)) { + if ((gSaveContext.save.weekEventReg[52] & 0x20) || ((u32)(KREG(13) + 15) >= this->unk_1D1C)) { break; } Cutscene_Start(globalCtx, &globalCtx->csCtx); diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 72fc0253a4..5a88f67c69 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -519,7 +519,7 @@ void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) { func_8012C2DC(globalCtx->state.gfxCtx); func_8012C28C(globalCtx->state.gfxCtx); - temp_v0 = gSaveContext.time; + temp_v0 = gSaveContext.save.time; if (temp_v0 > CLOCK_TIME(12, 0)) { temp_v0 = 0xFFFF - temp_v0; } diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c index 959207b8d5..b4537b1af5 100644 --- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c +++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c @@ -66,7 +66,7 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { switch (DMCHAR01_GET(&this->dyna.actor)) { case DMCHAR01_0: - if (gSaveContext.weekEventReg[20] & 2) { + if (gSaveContext.save.weekEventReg[20] & 2) { this->unk_34C = 2; this->actionFunc = func_80AA8F1C; break; @@ -96,7 +96,7 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { break; case DMCHAR01_1: - if ((gSaveContext.weekEventReg[20] & 2) || (gSaveContext.sceneSetupIndex == 1)) { + if ((gSaveContext.save.weekEventReg[20] & 2) || (gSaveContext.sceneSetupIndex == 1)) { this->unk_34C = 1; this->actionFunc = func_80AA8F1C; } else { @@ -106,7 +106,7 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { case DMCHAR01_2: this->unk_34C = 0; - if (!(gSaveContext.weekEventReg[20] & 1)) { + if (!(gSaveContext.save.weekEventReg[20] & 1)) { this->unk_34C = 1; this->dyna.actor.world.pos.y -= 400.0f; } @@ -122,7 +122,7 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { case DMCHAR01_3: this->dyna.actor.world.rot.y += 0x8000; this->dyna.actor.shape.rot.y += 0x8000; - if (!(gSaveContext.weekEventReg[20] & 1)) { + if (!(gSaveContext.save.weekEventReg[20] & 1)) { Actor_MarkForDeath(&this->dyna.actor); return; } @@ -132,7 +132,7 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_mtoride_Colheader_00FE5C); this->unk_34D = true; - if (!(gSaveContext.weekEventReg[20] & 2)) { + if (!(gSaveContext.save.weekEventReg[20] & 2)) { this->actionFunc = func_80AA9020; this->dyna.actor.world.pos.y -= 120.0f; } else { @@ -158,7 +158,7 @@ void func_80AA8698(DmChar01* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); Player* player2 = GET_PLAYER(globalCtx); - if (gSaveContext.weekEventReg[20] & 1) { + if (gSaveContext.save.weekEventReg[20] & 1) { return; } @@ -178,7 +178,7 @@ void func_80AA8698(DmChar01* this, GlobalContext* globalCtx) { if ((player2->actor.world.pos.x > -40.0f) && (player2->actor.world.pos.x < 40.0f) && (player2->actor.world.pos.z > 1000.0f) && (player2->actor.world.pos.z < 1078.0f)) { - gSaveContext.weekEventReg[20] |= 1; + gSaveContext.save.weekEventReg[20] |= 1; this->actionFunc = func_80AA884C; } } @@ -344,7 +344,7 @@ void func_80AA9020(DmChar01* this, GlobalContext* globalCtx) { CsCmdActorAction* temp_v1 = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 135)]; if ((temp_v1->startFrame == globalCtx->csCtx.frames) && (temp_v1->action == 2)) { - gSaveContext.weekEventReg[20] |= 2; + gSaveContext.save.weekEventReg[20] |= 2; this->actionFunc = func_80AA90AC; } } diff --git a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c index 4c39ddd544..bb8b735a40 100644 --- a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c +++ b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c @@ -30,7 +30,7 @@ const ActorInit Dm_Ravine_InitVars = { void DmRavine_Init(Actor* thisx, GlobalContext* globalCtx) { DmRavine* this = THIS; - u8 flag = gSaveContext.weekEventReg[0]; + u8 flag = gSaveContext.save.weekEventReg[0]; if (((flag & 0x10) | cREG(0)) != 0) { Actor_MarkForDeath(&this->actor); return; diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index eb1316f697..08e515d262 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -841,7 +841,7 @@ void DmStk_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_InitCylinder(globalCtx, &this->collider); - if (gSaveContext.entranceIndex == 0x2C00) { + if (gSaveContext.save.entranceIndex == 0x2C00) { if (gSaveContext.sceneSetupIndex == 0) { if (gSaveContext.unk_3DD0[3] == 0) { func_8010E9F0(3, 300); @@ -849,7 +849,7 @@ void DmStk_Init(Actor* thisx, GlobalContext* globalCtx) { XREG(81) = 115; } - if (gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { sCylinderInit.base.colType = COLTYPE_WOOD; this->actionFunc = func_80AA18D8; } else { @@ -938,7 +938,7 @@ void func_80AA1704(DmStk* this, GlobalContext* globalCtx) { void func_80AA1714(DmStk* this, GlobalContext* globalCtx) { Vec3f sp1C; - if (!(gSaveContext.weekEventReg[74] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[74] & 0x20)) { func_80169474(globalCtx, &this->actor.world.pos, &sp1C); if (globalCtx->view.fovy < 25.0f) { if ((sp1C.x >= 70.0f) && (sp1C.x < 250.0f) && (sp1C.y >= 30.0f) && (sp1C.y < 210.0f)) { @@ -955,10 +955,10 @@ void func_80AA17F8(DmStk* this, GlobalContext* globalCtx) { s16 sp18 = ActorCutscene_GetAdditionalCutscene(sp1C); s16 cutscene; - if (gSaveContext.day < 3) { + if (gSaveContext.save.day < 3) { cutscene = sp1E; - } else if ((gSaveContext.weekEventReg[8] & 0x40) || - ((CURRENT_DAY == 3) && (gSaveContext.time < CLOCK_TIME(6, 0)))) { + } else if ((gSaveContext.save.weekEventReg[8] & 0x40) || + ((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { cutscene = sp18; } else { cutscene = sp1C; @@ -1171,7 +1171,7 @@ void func_80AA1D1C(DmStk* this, GlobalContext* globalCtx) { case 22: this->unk_2E0 = 29; - if (gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->unk_32D = 3; } break; @@ -1183,7 +1183,7 @@ void func_80AA1D1C(DmStk* this, GlobalContext* globalCtx) { case 24: this->unk_2E0 = 32; - if (gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->unk_32D = 3; } break; @@ -1194,14 +1194,14 @@ void func_80AA1D1C(DmStk* this, GlobalContext* globalCtx) { case 26: this->unk_2E0 = 34; - if (gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->unk_32D = 3; } break; case 27: this->unk_2E0 = 36; - if (gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->unk_32D = 3; } break; @@ -1399,7 +1399,7 @@ void func_80AA1D1C(DmStk* this, GlobalContext* globalCtx) { if (this->unk_2E4 < 0) { this->unk_2E4 = 0; this->unk_32F = 0; - gSaveContext.weekEventReg[12] |= 4; + gSaveContext.save.weekEventReg[12] |= 4; if (!(globalCtx->actorCtx.unk5 & 2)) { Actor_MarkForDeath(&this->actor); } else { @@ -1569,11 +1569,11 @@ void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) { (globalCtx->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&globalCtx->state) && (globalCtx->sceneLoadFlag == 0) && (ActorCutscene_GetCurrentIndex() == -1) && (globalCtx->csCtx.state == 0)) { - time = gSaveContext.time; - gSaveContext.time = (u16)REG(15) + time; + time = gSaveContext.save.time; + gSaveContext.save.time = (u16)REG(15) + time; if (REG(15) != 0) { - time = gSaveContext.time; - gSaveContext.time = (u16)gSaveContext.unk_14 + time; + time = gSaveContext.save.time; + gSaveContext.save.time = (u16)gSaveContext.save.daySpeed + time; } } } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index f814eeafdb..b512dff9ab 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -139,13 +139,13 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { } else { s32 destinationIdx = DOORANA_GET_ENTRANCE(&this->actor); - Play_SetupRespawnPoint(&globalCtx->state, 3, 0x4FF); + Play_SetupRespawnPoint(&globalCtx->state, RESPAWN_MODE_UNK_3, 0x4FF); - gSaveContext.respawn[3].pos.y = this->actor.world.pos.y; - gSaveContext.respawn[3].yaw = this->actor.home.rot.y; + gSaveContext.respawn[RESPAWN_MODE_UNK_3].pos.y = this->actor.world.pos.y; + gSaveContext.respawn[RESPAWN_MODE_UNK_3].yaw = this->actor.home.rot.y; // Stores item and chest flag that ACTOR_EN_TORCH uses for spawning the grotto chest - gSaveContext.respawn[3].data = DOORANA_GET_ITEMFLAGS(&this->actor); + gSaveContext.respawn[RESPAWN_MODE_UNK_3].data = DOORANA_GET_ITEMFLAGS(&this->actor); if (destinationIdx < 0) { destinationIdx = DOORANA_GET_EX_ENTRANCE(&this->actor); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index e28e05a16b..01430acc30 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -344,7 +344,7 @@ void func_808A1090(DoorShutter* this, GlobalContext* globalCtx) { if (this->unk_166 != 0) { Flags_SetSwitch(globalCtx, DOORSHUTTER_GET_7F(&this->actor)); if (this->doorType != 5) { - gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--; + gSaveContext.save.inventory.dungeonKeys[gSaveContext.mapIndex]--; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK_B); @@ -367,7 +367,7 @@ void func_808A1090(DoorShutter* this, GlobalContext* globalCtx) { } if (this->doorType == 6) { - if (gSaveContext.healthCapacity < (DOORSHUTTER_GET_1F(&this->actor) * 0x10)) { + if (gSaveContext.save.playerData.healthCapacity < (DOORSHUTTER_GET_1F(&this->actor) * 0x10)) { player->doorType = -1; this->actor.textId = 0x14FC; } @@ -570,7 +570,7 @@ void func_808A1884(DoorShutter* this, GlobalContext* globalCtx) { if (DoorShutter_SetupDoor(this, globalCtx) && !(player->stateFlags1 & 0x800)) { DoorShutter_SetupAction(this, func_808A1C50); if (ActorCutscene_GetCurrentIndex() == 0x7D) { - s8 data = gSaveContext.respawn[0].data; + s8 data = gSaveContext.respawn[RESTART_MODE_DOWN].data; func_801226E0(globalCtx, data); player->unk_A86 = -1; diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 4f89b39b77..0360ae87a8 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -270,7 +270,7 @@ void func_808B8E78(DoorWarp1* this, GlobalContext* globalCtx) { this->unk_1A4 = 700.0f; if (globalCtx->sceneNum == SCENE_INISIE_N) { DoorWarp1_SetupAction(this, func_808B96A0); - } else if (gSaveContext.weekEventReg[86] & 0x80) { + } else if (gSaveContext.save.weekEventReg[86] & 0x80) { this->unk_1D4 = 0; DoorWarp1_SetupAction(this, func_808B921C); } else { @@ -553,27 +553,28 @@ void func_808B9CE8(DoorWarp1* this, GlobalContext* globalCtx) { switch (globalCtx->sceneNum) { case SCENE_MITURIN_BS: - gSaveContext.unk_ECC[0] = - (((void)0, gSaveContext.unk_ECC[0]) & 0xFFFFFF00) | (((u8)gSaveContext.unk_ECC[1]) & 0xFF); + gSaveContext.save.unk_ECC[0] = + (((void)0, gSaveContext.save.unk_ECC[0]) & 0xFFFFFF00) | (((u8)gSaveContext.save.unk_ECC[1]) & 0xFF); break; case SCENE_HAKUGIN_BS: - gSaveContext.unk_ECC[0] = - (((void)0, gSaveContext.unk_ECC[0]) & 0xFFFF00FF) | ((((u8)gSaveContext.unk_ECC[1]) & 0xFF) << 8); + gSaveContext.save.unk_ECC[0] = (((void)0, gSaveContext.save.unk_ECC[0]) & 0xFFFF00FF) | + ((((u8)gSaveContext.save.unk_ECC[1]) & 0xFF) << 8); break; case SCENE_INISIE_BS: - gSaveContext.unk_ECC[0] = - (((void)0, gSaveContext.unk_ECC[0]) & 0xFF00FFFF) | ((((u8)gSaveContext.unk_ECC[1]) & 0xFF) << 0x10); + gSaveContext.save.unk_ECC[0] = (((void)0, gSaveContext.save.unk_ECC[0]) & 0xFF00FFFF) | + ((((u8)gSaveContext.save.unk_ECC[1]) & 0xFF) << 0x10); break; case SCENE_SEA_BS: - gSaveContext.unk_ECC[0] = - (((void)0, gSaveContext.unk_ECC[0]) & 0x00FFFFFF) | ((((u8)gSaveContext.unk_ECC[1]) & 0xFF) << 0x18); + gSaveContext.save.unk_ECC[0] = (((void)0, gSaveContext.save.unk_ECC[0]) & 0x00FFFFFF) | + ((((u8)gSaveContext.save.unk_ECC[1]) & 0xFF) << 0x18); break; } - gSaveContext.unk_ECC[1] = (gSaveContext.unk_ECC[1] & 0xFFFFFF00) | ((((u8)gSaveContext.unk_ECC[1]) + 1) & 0xFF); + gSaveContext.save.unk_ECC[1] = + (gSaveContext.save.unk_ECC[1] & 0xFFFFFF00) | ((((u8)gSaveContext.save.unk_ECC[1]) + 1) & 0xFF); Item_Give(globalCtx, func_808B849C(this, globalCtx) + (ITEM_REMAINS_ODOLWA - 1)); DoorWarp1_SetupAction(this, func_808B9E94); } @@ -651,24 +652,24 @@ void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx) { if (this->unk_202 != 0) { if (phi_v0_2 > 0) { - gSaveContext.weekEventReg[7] |= 0x80; + gSaveContext.save.weekEventReg[7] |= 0x80; } switch (phi_v0_2) { case 0: - phi_a0 = gSaveContext.unk_ECC[0] & 0xFF; + phi_a0 = gSaveContext.save.unk_ECC[0] & 0xFF; break; case 1: - phi_a0 = (gSaveContext.unk_ECC[0] & 0xFF00) >> 8; + phi_a0 = (gSaveContext.save.unk_ECC[0] & 0xFF00) >> 8; break; case 2: - phi_a0 = (gSaveContext.unk_ECC[0] & 0xFF0000) >> 0x10; + phi_a0 = (gSaveContext.save.unk_ECC[0] & 0xFF0000) >> 0x10; break; case 3: - phi_a0 = (gSaveContext.unk_ECC[0] & 0xFF000000) >> 0x18; + phi_a0 = (gSaveContext.save.unk_ECC[0] & 0xFF000000) >> 0x18; break; default: @@ -709,8 +710,8 @@ void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx) { } else { switch (phi_v0_2) { case 0: - if (gSaveContext.weekEventReg[20] & 2) { - gSaveContext.weekEventReg[7] |= 0x80; + if (gSaveContext.save.weekEventReg[20] & 2) { + gSaveContext.save.weekEventReg[7] |= 0x80; globalCtx->nextEntranceIndex = 0x3010; globalCtx->sceneLoadFlag = 0x14; globalCtx->unk_1887F = 3; @@ -725,7 +726,7 @@ void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx) { break; case 1: - gSaveContext.weekEventReg[33] |= 0x80; + gSaveContext.save.weekEventReg[33] |= 0x80; globalCtx->nextEntranceIndex = 0xAE70; globalCtx->sceneLoadFlag = 0x14; globalCtx->unk_1887F = 3; @@ -733,14 +734,14 @@ void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx) { break; case 3: - if (gSaveContext.weekEventReg[55] & 0x80) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { globalCtx->nextEntranceIndex = 0x6A90; gSaveContext.nextCutsceneIndex = 0xFFF0; globalCtx->sceneLoadFlag = 0x14; globalCtx->unk_1887F = 3; gSaveContext.nextTransition = 3; } else { - gSaveContext.weekEventReg[55] |= 0x80; + gSaveContext.save.weekEventReg[55] |= 0x80; globalCtx->nextEntranceIndex = 0x6A80; gSaveContext.nextCutsceneIndex = 0xFFF0; globalCtx->sceneLoadFlag = 0x14; @@ -750,7 +751,7 @@ void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx) { break; case 2: - gSaveContext.weekEventReg[52] |= 0x20; + gSaveContext.save.weekEventReg[52] |= 0x20; globalCtx->nextEntranceIndex = 0x20F0; gSaveContext.nextCutsceneIndex = 0xFFF2; globalCtx->sceneLoadFlag = 0x14; @@ -885,14 +886,14 @@ void func_808BAAF4(DoorWarp1* this, GlobalContext* globalCtx) { phi_f2 = 85.0f; } - if (!(gSaveContext.weekEventReg[86] & 0x80) && (fabsf(this->dyna.actor.xzDistToPlayer) < phi_f2) && + if (!(gSaveContext.save.weekEventReg[86] & 0x80) && (fabsf(this->dyna.actor.xzDistToPlayer) < phi_f2) && ((player->actor.world.pos.y - 20.0f) < this->dyna.actor.world.pos.y) && (this->dyna.actor.world.pos.y < (player->actor.world.pos.y + 20.0f))) { cutscene = this->dyna.actor.cutscene; if (ActorCutscene_GetCanPlayNext(cutscene)) { ActorCutscene_Start(cutscene, &this->dyna.actor); - gSaveContext.weekEventReg[86] |= 0x80; + gSaveContext.save.weekEventReg[86] |= 0x80; DoorWarp1_SetupAction(this, func_808BABF4); } else { ActorCutscene_SetIntentToPlay(cutscene); diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c index 4250a71d5c..be25dec24f 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -338,7 +338,7 @@ s32* func_80BD3294(EnAh* this, GlobalContext* globalCtx) { switch (this->unk_1DC) { case 1: - if (gSaveContext.day == 2) { + if (gSaveContext.save.day == 2) { return D_80BD3DF0; } return D_80BD3DE8; diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index cd36694ccd..21691cbf8e 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -257,17 +257,17 @@ void func_80BED090(GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (player->transformation == PLAYER_FORM_DEKU) { - gSaveContext.weekEventReg[63] |= 8; - gSaveContext.weekEventReg[63] &= (u8)~0x10; + gSaveContext.save.weekEventReg[63] |= 8; + gSaveContext.save.weekEventReg[63] &= (u8)~0x10; } else if (player->transformation == PLAYER_FORM_ZORA) { - gSaveContext.weekEventReg[63] &= (u8)~8; - gSaveContext.weekEventReg[63] |= 0x10; + gSaveContext.save.weekEventReg[63] &= (u8)~8; + gSaveContext.save.weekEventReg[63] |= 0x10; } else if (player->transformation == PLAYER_FORM_GORON) { - gSaveContext.weekEventReg[63] |= 8; - gSaveContext.weekEventReg[63] |= 0x10; + gSaveContext.save.weekEventReg[63] |= 8; + gSaveContext.save.weekEventReg[63] |= 0x10; } else if (player->transformation == PLAYER_FORM_HUMAN) { - gSaveContext.weekEventReg[63] &= (u8)~8; - gSaveContext.weekEventReg[63] &= (u8)~0x10; + gSaveContext.save.weekEventReg[63] &= (u8)~8; + gSaveContext.save.weekEventReg[63] &= (u8)~0x10; } } @@ -275,19 +275,19 @@ s32 func_80BED140(GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (player->transformation == PLAYER_FORM_DEKU) { - if ((gSaveContext.weekEventReg[63] & 8) && !(gSaveContext.weekEventReg[63] & 0x10)) { + if ((gSaveContext.save.weekEventReg[63] & 8) && !(gSaveContext.save.weekEventReg[63] & 0x10)) { return true; } } else if (player->transformation == PLAYER_FORM_ZORA) { - if (!(gSaveContext.weekEventReg[63] & 8) && (gSaveContext.weekEventReg[63] & 0x10)) { + if (!(gSaveContext.save.weekEventReg[63] & 8) && (gSaveContext.save.weekEventReg[63] & 0x10)) { return true; } } else if (player->transformation == PLAYER_FORM_GORON) { - if ((gSaveContext.weekEventReg[63] & 8) && (gSaveContext.weekEventReg[63] & 0x10)) { + if ((gSaveContext.save.weekEventReg[63] & 8) && (gSaveContext.save.weekEventReg[63] & 0x10)) { return true; } } else if (player->transformation == PLAYER_FORM_HUMAN) { - if (!(gSaveContext.weekEventReg[63] & 8) && !(gSaveContext.weekEventReg[63] & 0x10)) { + if (!(gSaveContext.save.weekEventReg[63] & 8) && !(gSaveContext.save.weekEventReg[63] & 0x10)) { return true; } } @@ -300,7 +300,7 @@ s32 func_80BED208(EnAkindonuts* this) { return 0; } - if (gSaveContext.rupees < 10) { + if (gSaveContext.save.playerData.rupees < 10) { return 1; } @@ -314,15 +314,15 @@ s32 func_80BED208(EnAkindonuts* this) { } s32 func_80BED27C(EnAkindonuts* this) { - if (CUR_UPG_VALUE_VOID(UPG_BOMB_BAG) == 3) { + if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 3) { return 2; } - if (CUR_UPG_VALUE_VOID(UPG_BOMB_BAG) < 2) { + if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) < 2) { return 0; } - if (gSaveContext.rupees < 200) { + if (gSaveContext.save.playerData.rupees < 200) { return 1; } @@ -336,7 +336,7 @@ s32 func_80BED2FC(EnAkindonuts* this) { return 2; } - if (gSaveContext.rupees < 40) { + if (gSaveContext.save.playerData.rupees < 40) { return 1; } @@ -350,7 +350,7 @@ s32 func_80BED35C(EnAkindonuts* this) { return 2; } - if (gSaveContext.rupees < 100) { + if (gSaveContext.save.playerData.rupees < 100) { return 1; } @@ -384,8 +384,8 @@ void func_80BED3BC(EnAkindonuts* this, GlobalContext* globalCtx) { break; case 0x15E7: - if (!(gSaveContext.weekEventReg[61] & 0x20)) { - gSaveContext.weekEventReg[61] |= 0x20; + if (!(gSaveContext.save.weekEventReg[61] & 0x20)) { + gSaveContext.save.weekEventReg[61] |= 0x20; this->unk_33C = 0x15E8; break; } @@ -446,7 +446,7 @@ void func_80BED3BC(EnAkindonuts* this, GlobalContext* globalCtx) { case 0x15E5: this->unk_33C = 0x15E6; func_80BED090(globalCtx); - gSaveContext.weekEventReg[61] |= 0x10; + gSaveContext.save.weekEventReg[61] |= 0x10; this->unk_32C |= 0x20; break; @@ -461,8 +461,8 @@ void func_80BED3BC(EnAkindonuts* this, GlobalContext* globalCtx) { void func_80BED680(EnAkindonuts* this, GlobalContext* globalCtx) { switch (this->unk_33C) { case 0: - if (func_80BED140(globalCtx) && !(gSaveContext.weekEventReg[61] & 0x40)) { - gSaveContext.weekEventReg[61] |= 0x40; + if (func_80BED140(globalCtx) && !(gSaveContext.save.weekEventReg[61] & 0x40)) { + gSaveContext.save.weekEventReg[61] |= 0x40; this->unk_33C = 0x15F0; break; } @@ -562,8 +562,8 @@ void func_80BED8A4(EnAkindonuts* this, GlobalContext* globalCtx) { break; case 0x15FE: - if (!(gSaveContext.weekEventReg[62] & 1)) { - gSaveContext.weekEventReg[62] |= 1; + if (!(gSaveContext.save.weekEventReg[62] & 1)) { + gSaveContext.save.weekEventReg[62] |= 1; this->unk_33C = 0x15FF; break; } @@ -623,7 +623,7 @@ void func_80BED8A4(EnAkindonuts* this, GlobalContext* globalCtx) { case 0x15FA: this->unk_33C = 0x15FB; - gSaveContext.weekEventReg[61] |= 0x80; + gSaveContext.save.weekEventReg[61] |= 0x80; this->unk_32C |= 0x20; break; @@ -640,8 +640,8 @@ void func_80BEDB88(EnAkindonuts* this, GlobalContext* globalCtx) { switch (this->unk_33C) { case 0: - if ((player->transformation == PLAYER_FORM_DEKU) && !(gSaveContext.weekEventReg[62] & 2)) { - gSaveContext.weekEventReg[62] |= 2; + if ((player->transformation == PLAYER_FORM_DEKU) && !(gSaveContext.save.weekEventReg[62] & 2)) { + gSaveContext.save.weekEventReg[62] |= 2; this->unk_33C = 0x15F0; break; } @@ -740,8 +740,8 @@ void func_80BEDDAC(EnAkindonuts* this, GlobalContext* globalCtx) { break; case 0x1610: - if (!(gSaveContext.weekEventReg[62] & 8)) { - gSaveContext.weekEventReg[62] |= 8; + if (!(gSaveContext.save.weekEventReg[62] & 8)) { + gSaveContext.save.weekEventReg[62] |= 8; this->unk_33C = 0x1611; break; } @@ -796,7 +796,7 @@ void func_80BEDDAC(EnAkindonuts* this, GlobalContext* globalCtx) { case 0x15FA: this->unk_33C = 0x160D; - gSaveContext.weekEventReg[62] |= 4; + gSaveContext.save.weekEventReg[62] |= 4; this->unk_32C |= 0x20; break; @@ -813,8 +813,8 @@ void func_80BEE070(EnAkindonuts* this, GlobalContext* globalCtx) { switch (this->unk_33C) { case 0: - if ((player->transformation == PLAYER_FORM_GORON) && !(gSaveContext.weekEventReg[62] & 0x10)) { - gSaveContext.weekEventReg[62] |= 0x10; + if ((player->transformation == PLAYER_FORM_GORON) && !(gSaveContext.save.weekEventReg[62] & 0x10)) { + gSaveContext.save.weekEventReg[62] |= 0x10; this->unk_33C = 0x1614; break; } @@ -900,8 +900,8 @@ void func_80BEE274(EnAkindonuts* this, GlobalContext* globalCtx) { break; case 0x1624: - if (!(gSaveContext.weekEventReg[62] & 0x40)) { - gSaveContext.weekEventReg[62] |= 0x40; + if (!(gSaveContext.save.weekEventReg[62] & 0x40)) { + gSaveContext.save.weekEventReg[62] |= 0x40; this->unk_33C = 0x1625; break; } @@ -957,7 +957,7 @@ void func_80BEE274(EnAkindonuts* this, GlobalContext* globalCtx) { case 0x1622: this->unk_33C = 0x1623; - gSaveContext.weekEventReg[62] |= 0x20; + gSaveContext.save.weekEventReg[62] |= 0x20; this->unk_32C |= 0x20; break; @@ -974,8 +974,8 @@ void func_80BEE530(EnAkindonuts* this, GlobalContext* globalCtx) { switch (this->unk_33C) { case 0: - if ((player->transformation == PLAYER_FORM_ZORA) && !(gSaveContext.weekEventReg[62] & 0x80)) { - gSaveContext.weekEventReg[62] |= 0x80; + if ((player->transformation == PLAYER_FORM_ZORA) && !(gSaveContext.save.weekEventReg[62] & 0x80)) { + gSaveContext.save.weekEventReg[62] |= 0x80; this->unk_33C = 0x162A; break; } @@ -1095,7 +1095,7 @@ void func_80BEE73C(EnAkindonuts* this, GlobalContext* globalCtx) { void func_80BEE938(EnAkindonuts* this, GlobalContext* globalCtx) { switch (ENAKINDONUTS_GET_3(&this->actor)) { case 0: - if (gSaveContext.weekEventReg[61] & 0x10) { + if (gSaveContext.save.weekEventReg[61] & 0x10) { if (ENAKINDONUTS_GET_4(&this->actor)) { this->unk_2DC = func_80BED680; } else { @@ -1109,7 +1109,7 @@ void func_80BEE938(EnAkindonuts* this, GlobalContext* globalCtx) { break; case 1: - if (gSaveContext.weekEventReg[61] & 0x80) { + if (gSaveContext.save.weekEventReg[61] & 0x80) { if (ENAKINDONUTS_GET_4(&this->actor)) { this->unk_2DC = func_80BEDB88; } else { @@ -1123,7 +1123,7 @@ void func_80BEE938(EnAkindonuts* this, GlobalContext* globalCtx) { break; case 2: - if (gSaveContext.weekEventReg[62] & 4) { + if (gSaveContext.save.weekEventReg[62] & 4) { if (ENAKINDONUTS_GET_4(&this->actor)) { this->unk_2DC = func_80BEE070; } else { @@ -1137,7 +1137,7 @@ void func_80BEE938(EnAkindonuts* this, GlobalContext* globalCtx) { break; case 3: - if (gSaveContext.weekEventReg[62] & 0x20) { + if (gSaveContext.save.weekEventReg[62] & 0x20) { if (ENAKINDONUTS_GET_4(&this->actor)) { this->unk_2DC = func_80BEE530; } else { diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index 0aef5ae402..e86f3971d5 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -187,7 +187,7 @@ Actor* func_80BDE384(EnAl* this, GlobalContext* globalCtx) { switch (this->unk_35C) { case 2: - if (!(gSaveContext.weekEventReg[89] & 8) && (gSaveContext.weekEventReg[85] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[89] & 8) && (gSaveContext.save.weekEventReg[85] & 0x80)) { actor = func_80BDE1A0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_PM); } else { actor = &GET_PLAYER(globalCtx)->actor; @@ -398,7 +398,7 @@ s32 func_80BDEA14(EnAl* this, GlobalContext* globalCtx) { switch (this->unk_4E6) { case 0: case 1: - if ((gSaveContext.weekEventReg[75] & 2)) { + if ((gSaveContext.save.weekEventReg[75] & 2)) { sp18 = true; } else if (func_80BDE4E0(this, &this->unk_4E6, 0)) { sp18 = true; @@ -439,7 +439,7 @@ s32* func_80BDEABC(EnAl* this, GlobalContext* globalCtx) { return D_80BDFE84; case 2: - if (!(gSaveContext.weekEventReg[89] & 8) && (gSaveContext.weekEventReg[85] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[89] & 8) && (gSaveContext.save.weekEventReg[85] & 0x80)) { this->unk_4EC = func_80BDE7FC; return D_80BDFCBC; } @@ -687,15 +687,15 @@ void func_80BDF414(EnAl* this, GlobalContext* globalCtx) { switch (this->unk_4EA) { case 0: case 1: - if (!(gSaveContext.weekEventReg[89] & 8)) { - if (gSaveContext.weekEventReg[85] & 0x80) { + if (!(gSaveContext.save.weekEventReg[89] & 8)) { + if (gSaveContext.save.weekEventReg[85] & 0x80) { func_80BDE4E0(this, &this->unk_4EA, 0); } } break; case 2: - if (gSaveContext.weekEventReg[89] & 8) { + if (gSaveContext.save.weekEventReg[89] & 8) { this->unk_4EA++; } break; @@ -734,7 +734,7 @@ void func_80BDF578(EnAl* this, GlobalContext* globalCtx) { } void func_80BDF5E8(EnAl* this, GlobalContext* globalCtx) { - u32* unk14 = &gSaveContext.unk_14; + u32* unk14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 sp20; this->unk_4E0 = REG(15) + *unk14; diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 9fcd115178..41cb917249 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -101,11 +101,11 @@ void func_809C10B0(EnAob01* this, s32 arg1) { } void func_809C1124(void) { - u16 time = gSaveContext.time; + u16 time = gSaveContext.save.time; - gSaveContext.time = (u16)REG(15) + time; - time = gSaveContext.time; - gSaveContext.time = (u16)gSaveContext.unk_14 + time; + gSaveContext.save.time = (u16)REG(15) + time; + time = gSaveContext.save.time; + gSaveContext.save.time = (u16)gSaveContext.save.daySpeed + time; } void func_809C1158(EnAob01* this, GlobalContext* globalCtx) { @@ -219,18 +219,18 @@ void func_809C16DC(EnAob01* this, GlobalContext* globalCtx) { case 0x3548: case 0x3549: case 0x354A: - switch (gSaveContext.day) { + switch (gSaveContext.save.day) { case 1: - if (!gSaveContext.isNight) { - if (!(gSaveContext.weekEventReg[64] & 0x80)) { - gSaveContext.weekEventReg[64] |= 0x80; + if (!gSaveContext.save.isNight) { + if (!(gSaveContext.save.weekEventReg[64] & 0x80)) { + gSaveContext.save.weekEventReg[64] |= 0x80; this->unk_210 = 0x3520; } else { this->unk_210 = 0x352F; } } else { - if (!(gSaveContext.weekEventReg[65] & 1)) { - gSaveContext.weekEventReg[65] |= 1; + if (!(gSaveContext.save.weekEventReg[65] & 1)) { + gSaveContext.save.weekEventReg[65] |= 1; this->unk_210 = 0x3530; } else { this->unk_210 = 0x352F; @@ -239,16 +239,16 @@ void func_809C16DC(EnAob01* this, GlobalContext* globalCtx) { break; case 2: - if (!gSaveContext.isNight) { - if (!(gSaveContext.weekEventReg[65] & 2)) { - gSaveContext.weekEventReg[65] |= 2; + if (!gSaveContext.save.isNight) { + if (!(gSaveContext.save.weekEventReg[65] & 2)) { + gSaveContext.save.weekEventReg[65] |= 2; this->unk_210 = 0x3531; } else { this->unk_210 = 0x352F; } } else { - if (!(gSaveContext.weekEventReg[65] & 4)) { - gSaveContext.weekEventReg[65] |= 4; + if (!(gSaveContext.save.weekEventReg[65] & 4)) { + gSaveContext.save.weekEventReg[65] |= 4; this->unk_210 = 0x3532; } else { this->unk_210 = 0x352F; @@ -257,16 +257,16 @@ void func_809C16DC(EnAob01* this, GlobalContext* globalCtx) { break; case 3: - if (!gSaveContext.isNight) { - if (!(gSaveContext.weekEventReg[65] & 8)) { - gSaveContext.weekEventReg[65] |= 8; + if (!gSaveContext.save.isNight) { + if (!(gSaveContext.save.weekEventReg[65] & 8)) { + gSaveContext.save.weekEventReg[65] |= 8; this->unk_210 = 0x3533; } else { this->unk_210 = 0x352F; } } else { - if (!(gSaveContext.weekEventReg[65] & 0x10)) { - gSaveContext.weekEventReg[65] |= 0x10; + if (!(gSaveContext.save.weekEventReg[65] & 0x10)) { + gSaveContext.save.weekEventReg[65] |= 0x10; this->unk_210 = 0x3534; } else { this->unk_210 = 0x352F; @@ -307,7 +307,7 @@ void func_809C16DC(EnAob01* this, GlobalContext* globalCtx) { break; case PLAYER_FORM_HUMAN: - if (gSaveContext.rupees < 10) { + if (gSaveContext.save.playerData.rupees < 10) { this->unk_210 = 0x3524; this->unk_2D2 |= 0x10; } else { @@ -371,7 +371,7 @@ void func_809C16DC(EnAob01* this, GlobalContext* globalCtx) { break; case 0x3528: - if (gSaveContext.rupees < this->unk_434) { + if (gSaveContext.save.playerData.rupees < this->unk_434) { this->unk_210 = 0x3536; this->unk_2D2 |= 0x40; this->unk_43C = 1; @@ -416,8 +416,8 @@ void func_809C16DC(EnAob01* this, GlobalContext* globalCtx) { void func_809C1C9C(EnAob01* this, GlobalContext* globalCtx) { if (gSaveContext.rupeeAccumulator == 0) { - gSaveContext.weekEventReg[63] |= 1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] |= 1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; this->unk_2D2 |= 0x20; func_800FD750(0x40); globalCtx->nextEntranceIndex = 0x7C10; @@ -436,7 +436,7 @@ void func_809C1D64(EnAob01* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.choiceIndex) { case 0: - if (gSaveContext.rupees < 10) { + if (gSaveContext.save.playerData.rupees < 10) { play_sound(NA_SE_SY_ERROR); this->unk_210 = 0x3524; Message_StartTextbox(globalCtx, this->unk_210, &this->actor); @@ -761,13 +761,13 @@ void func_809C2A64(EnAob01* this, GlobalContext* globalCtx) { this->unk_2E0 = this->unk_2F2; this->actor.parent = NULL; this->actor.shape.rot.y = this->actor.world.rot.y; - if (gSaveContext.weekEventReg[8] & 0x20) { + if (gSaveContext.save.weekEventReg[8] & 0x20) { this->actionFunc = func_809C2BE4; } else { - gSaveContext.weekEventReg[8] |= 0x20; + gSaveContext.save.weekEventReg[8] |= 0x20; this->actionFunc = func_809C2BE4; } - } else if (gSaveContext.weekEventReg[8] & 0x20) { + } else if (gSaveContext.save.weekEventReg[8] & 0x20) { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_RED, 300.0f, 300.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 300.0f, 300.0f); @@ -779,12 +779,12 @@ void func_809C2BE4(EnAob01* this, GlobalContext* globalCtx) { u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); if (((temp_v0 == 5) || (temp_v0 == 6)) && Message_ShouldAdvance(globalCtx)) { - if (gSaveContext.weekEventReg[63] & 2) { - gSaveContext.weekEventReg[63] &= (u8)~2; + if (gSaveContext.save.weekEventReg[63] & 2) { + gSaveContext.save.weekEventReg[63] &= (u8)~2; } - if (gSaveContext.weekEventReg[63] & 1) { - gSaveContext.weekEventReg[63] &= (u8)~1; + if (gSaveContext.save.weekEventReg[63] & 1) { + gSaveContext.save.weekEventReg[63] &= (u8)~1; } this->unk_210 = 0; @@ -833,12 +833,12 @@ void func_809C2D0C(EnAob01* this, GlobalContext* globalCtx) { this->unk_434 = 0; this->actor.shape.rot.y = this->actor.world.rot.y; - if (gSaveContext.weekEventReg[63] & 2) { - gSaveContext.weekEventReg[63] &= (u8)~2; + if (gSaveContext.save.weekEventReg[63] & 2) { + gSaveContext.save.weekEventReg[63] &= (u8)~2; } - if (gSaveContext.weekEventReg[63] & 1) { - gSaveContext.weekEventReg[63] &= (u8)~1; + if (gSaveContext.save.weekEventReg[63] & 1) { + gSaveContext.save.weekEventReg[63] &= (u8)~1; } this->unk_210 = 0x354C; @@ -902,7 +902,7 @@ void func_809C2FA0(void) { } for (i = 0; i < ARRAY_COUNT(sp44); i++) { - gSaveContext.weekEventReg[42 + i] = 0; + gSaveContext.save.weekEventReg[42 + i] = 0; sp44[i] = 0; } @@ -912,8 +912,8 @@ void func_809C2FA0(void) { if (i % 2) { sp44[idx2] |= orig2 << 0x4; - idx = gSaveContext.weekEventReg[42 + idx2]; - gSaveContext.weekEventReg[42 + idx2] = idx | sp44[idx2]; + idx = gSaveContext.save.weekEventReg[42 + idx2]; + gSaveContext.save.weekEventReg[42 + idx2] = idx | sp44[idx2]; } else { sp44[idx2] |= orig2; } @@ -967,7 +967,7 @@ void EnAob01_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnAob01* this = THIS; if (!(this->unk_2D2 & 0x20)) { - gSaveContext.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~1; } Collider_DestroyCylinder(globalCtx, &this->collider); } diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 061d7bcea3..7ce0ea2609 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -130,12 +130,12 @@ void func_80BA886C(EnBaba* this, GlobalContext* globalCtx) { switch (this->unk_1E0) { case 0: if (this->unk_40A & 8) { - if (gSaveContext.weekEventReg[33] & 8) { + if (gSaveContext.save.weekEventReg[33] & 8) { this->unk_1E0 = 0x2A34; break; } - if (gSaveContext.weekEventReg[79] & 0x40) { + if (gSaveContext.save.weekEventReg[79] & 0x40) { this->unk_40A |= 1; this->unk_1E0 = 0x2A33; break; @@ -145,8 +145,8 @@ void func_80BA886C(EnBaba* this, GlobalContext* globalCtx) { this->unk_1E0 = 0x2A32; break; } else if (player->transformation == PLAYER_FORM_DEKU) { - if (!(gSaveContext.weekEventReg[79] & 0x20)) { - gSaveContext.weekEventReg[79] |= 0x20; + if (!(gSaveContext.save.weekEventReg[79] & 0x20)) { + gSaveContext.save.weekEventReg[79] |= 0x20; this->unk_40A |= 1; this->unk_1E0 = 0x2A37; break; @@ -155,15 +155,15 @@ void func_80BA886C(EnBaba* this, GlobalContext* globalCtx) { this->unk_1E0 = 0x2A38; } break; - } else if (!(gSaveContext.weekEventReg[33] & 8)) { - if (!(gSaveContext.weekEventReg[73] & 1)) { + } else if (!(gSaveContext.save.weekEventReg[33] & 8)) { + if (!(gSaveContext.save.weekEventReg[73] & 1)) { this->unk_1E0 = 0x660; break; } this->unk_1E0 = 0x662; break; } else { - if (!(gSaveContext.weekEventReg[73] & 2)) { + if (!(gSaveContext.save.weekEventReg[73] & 2)) { this->unk_1E0 = 0x65A; break; } @@ -185,7 +185,7 @@ void func_80BA886C(EnBaba* this, GlobalContext* globalCtx) { case 0x662: Actor_ChangeFocus(&this->actor, globalCtx, &this->unk_144->actor); this->unk_1E0 = 0x663; - gSaveContext.weekEventReg[73] |= 1; + gSaveContext.save.weekEventReg[73] |= 1; this->unk_40A |= 1; break; @@ -202,7 +202,7 @@ void func_80BA886C(EnBaba* this, GlobalContext* globalCtx) { case 0x65C: Actor_ChangeFocus(&this->actor, globalCtx, &this->unk_144->actor); this->unk_1E0 = 0x65D; - gSaveContext.weekEventReg[73] |= 2; + gSaveContext.save.weekEventReg[73] |= 2; this->unk_40A |= 1; break; @@ -306,7 +306,7 @@ void func_80BA8DF4(EnBaba* this, GlobalContext* globalCtx) { } s32 func_80BA8F88(EnBaba* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { - u16 sp26 = (u16)(gSaveContext.time - 0x3FFC); + u16 sp26 = (u16)(gSaveContext.save.time - 0x3FFC); u16 temp; u8 sp23 = ENBABA_GET_3F00(&this->actor); @@ -413,7 +413,7 @@ s32 func_80BA9160(EnBaba* this, GlobalContext* globalCtx) { void func_80BA93AC(EnBaba* this, GlobalContext* globalCtx) { if (this->unk_434 != 1) { if (this->unk_434 == 2) { - gSaveContext.weekEventReg[58] |= 0x40; + gSaveContext.save.weekEventReg[58] |= 0x40; this->unk_40A |= 2; func_80BA9160(this, globalCtx); } @@ -443,10 +443,10 @@ void func_80BA9480(EnBaba* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); this->actionFunc = func_80BA9758; } else if (globalCtx->sceneNum == SCENE_BACKTOWN) { - if ((ENBABA_GET_C000(&this->actor) == ENBABA_C000_0) && (gSaveContext.entranceIndex != 0xD670) && + if ((ENBABA_GET_C000(&this->actor) == ENBABA_C000_0) && (gSaveContext.save.entranceIndex != 0xD670) && ((ENBABA_GET_3F00(&this->actor)) != ENBABA_3F00_3F)) { - if ((gSaveContext.weekEventReg[58] & 0x40) || - (!(gSaveContext.time < CLOCK_TIME(0, 20)) && (gSaveContext.time < CLOCK_TIME(6, 0)))) { + if ((gSaveContext.save.weekEventReg[58] & 0x40) || + (!(gSaveContext.save.time < CLOCK_TIME(0, 20)) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { Actor_MarkForDeath(&this->actor); return; } @@ -455,14 +455,14 @@ void func_80BA9480(EnBaba* this, GlobalContext* globalCtx) { this->unk_40C = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); this->actionFunc = func_80BA9B80; - } else if ((ENBABA_GET_C000(&this->actor) == ENBABA_C000_1) && (gSaveContext.entranceIndex == 0xD670)) { - if (gSaveContext.weekEventReg[81] & 2) { + } else if ((ENBABA_GET_C000(&this->actor) == ENBABA_C000_1) && (gSaveContext.save.entranceIndex == 0xD670)) { + if (gSaveContext.save.weekEventReg[81] & 2) { Actor_MarkForDeath(&this->actor); return; } this->unk_40A |= 2; - if (gSaveContext.weekEventReg[33] & 8) { + if (gSaveContext.save.weekEventReg[33] & 8) { this->unk_40C = 0; } else { this->unk_40C = 1; @@ -534,12 +534,12 @@ void func_80BA98EC(EnBaba* this, GlobalContext* globalCtx) { if (this->unk_40A & 8) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { if (globalCtx->msgCtx.unk120B1 == 0) { - gSaveContext.weekEventReg[81] |= 2; + gSaveContext.save.weekEventReg[81] |= 2; func_80BA8C4C(globalCtx, 0xD670); return; } } else { - gSaveContext.weekEventReg[81] |= 2; + gSaveContext.save.weekEventReg[81] |= 2; func_80BA8C4C(globalCtx, 0xD670); } } else { @@ -557,7 +557,7 @@ void func_80BA98EC(EnBaba* this, GlobalContext* globalCtx) { } } else if (temp_v0 == 6) { if (Message_ShouldAdvance(globalCtx) && (globalCtx->msgCtx.unk120B1 == 0)) { - gSaveContext.weekEventReg[81] |= 2; + gSaveContext.save.weekEventReg[81] |= 2; func_80BA8C4C(globalCtx, 0xD670); } } @@ -583,7 +583,7 @@ void func_80BA9B24(EnBaba* this, GlobalContext* globalCtx) { } void func_80BA9B80(EnBaba* this, GlobalContext* globalCtx) { - u32* unk14 = &gSaveContext.unk_14; + u32* unk14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 sp20; this->unk_436 = REG(15) + *unk14; @@ -629,7 +629,7 @@ void func_80BA9CD4(EnBaba* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); } } else { - if ((gSaveContext.weekEventReg[79] & 0x40) && (DECR(this->unk_404) == 0)) { + if ((gSaveContext.save.weekEventReg[79] & 0x40) && (DECR(this->unk_404) == 0)) { Audio_QueueSeqCmd(0x101400FF); func_80BA8C4C(globalCtx, 0xD670); } else { diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c index 3d4c5cab53..193c899c99 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c @@ -71,14 +71,16 @@ void EnBaisen_Init(Actor* thisx, GlobalContext* globalCtx) { this->paramCopy = this->actor.params; if (this->actor.params == 0) { this->unk290 = true; - if (!(gSaveContext.weekEventReg[63] & 0x80) && ((gSaveContext.day != 3) || !gSaveContext.isNight)) { + if (!(gSaveContext.save.weekEventReg[63] & 0x80) && + ((gSaveContext.save.day != 3) || !gSaveContext.save.isNight)) { Actor_MarkForDeath(&this->actor); } } else { this->collider.dim.radius = 30; this->collider.dim.height = 60; this->collider.dim.yShift = 0; - if ((gSaveContext.weekEventReg[63] & 0x80) || ((gSaveContext.day == 3) && (gSaveContext.isNight))) { + if ((gSaveContext.save.weekEventReg[63] & 0x80) || + ((gSaveContext.save.day == 3) && (gSaveContext.save.isNight))) { Actor_MarkForDeath(&this->actor); } } @@ -153,7 +155,7 @@ void func_80BE887C(EnBaisen* this, GlobalContext* globalCtx) { } else { if (this->paramCopy != 0) { this->textIdIndex = 0; - if (gSaveContext.weekEventReg[60] & 8) { + if (gSaveContext.save.weekEventReg[60] & 8) { this->textIdIndex = 1; } if (Player_GetMask(globalCtx) == PLAYER_MASK_COUPLE) { @@ -246,7 +248,7 @@ void EnBaisen_Update(Actor* thisx, GlobalContext* globalCtx) { this->unusedCounter--; } this->actor.shape.rot.y = this->actor.world.rot.y; - if ((this->paramCopy != 0) && (gSaveContext.day == 3) && gSaveContext.isNight) { + if ((this->paramCopy != 0) && (gSaveContext.save.day == 3) && gSaveContext.save.isNight) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 10ea3a7a2e..8431d67067 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -105,7 +105,7 @@ void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - if (gSaveContext.weekEventReg[20] & 2 || + if (gSaveContext.save.weekEventReg[20] & 2 || ((this->actor.params != 0xFF) && Flags_GetSwitch(globalCtx, this->actor.params))) { Actor_MarkForDeath(&this->actor); } else { diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 5475650caf..c0c1326a3b 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -309,7 +309,7 @@ static InitChainEntry sInitChain[] = { }; void EnBigslime_Init(Actor* thisx, GlobalContext* globalCtx2) { - // gSaveContext.weekEventReg[KEY] = VALUE + // gSaveContext.save.weekEventReg[KEY] = VALUE // KEY | VALUE static s32 isFrogReturnedFlags[] = { (32 << 8) | 0x40, // Woodfall Temple Frog Returned @@ -340,7 +340,7 @@ void EnBigslime_Init(Actor* thisx, GlobalContext* globalCtx2) { if (Flags_GetClear(globalCtx, globalCtx->roomCtx.currRoom.num)) { Actor_MarkForDeath(&this->actor); - if (!(gSaveContext.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & + if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & (u8)isFrogReturnedFlags[this->actor.params - 1])) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, @@ -1614,7 +1614,7 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, GlobalContext* globalCt if (this->numGekkoMeleeAttacks == 0) { this->numGekkoPosGrabPlayer--; - if ((gSaveContext.health < 5) || (this->numGekkoPosGrabPlayer == 0)) { + if ((gSaveContext.save.playerData.health < 5) || (this->numGekkoPosGrabPlayer == 0)) { this->numGekkoPosGrabPlayer = 0; this->gekkoRot.y = this->actor.world.rot.y; this->gekkoPosOffset.x = Math_SinS(this->gekkoRot.y) * -50.0f; diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 897f699d22..8185154465 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -122,44 +122,44 @@ void func_809CD028(EnBji01* this, GlobalContext* globalCtx) { switch (this->actor.params) { case ENBJI01_PARAMS_DEFAULT: case ENBJI01_PARAMS_FINISHED_CONVERSATION: - switch (gSaveContext.playerForm) { + switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: - if (gSaveContext.weekEventReg[17] & 0x10) { - if (gSaveContext.weekEventReg[74] & 0x80) { + if (gSaveContext.save.weekEventReg[17] & 0x10) { + if (gSaveContext.save.weekEventReg[74] & 0x80) { this->textId = 0x5F4; } else { this->textId = 0x5E2; } } else { this->textId = 0x5EC; - gSaveContext.weekEventReg[17] |= 0x10; + gSaveContext.save.weekEventReg[17] |= 0x10; } break; case PLAYER_FORM_HUMAN: if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { this->textId = 0x236A; - } else if (gSaveContext.weekEventReg[74] & 0x10) { + } else if (gSaveContext.save.weekEventReg[74] & 0x10) { this->textId = 0x5F6; } else { this->textId = 0x5F5; - gSaveContext.weekEventReg[74] |= 0x10; + gSaveContext.save.weekEventReg[74] |= 0x10; } break; case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: - if (gSaveContext.weekEventReg[75] & 8) { + if (gSaveContext.save.weekEventReg[75] & 8) { this->textId = 0x5E4; } else { this->textId = 0x5DC; - gSaveContext.weekEventReg[75] |= 8; + gSaveContext.save.weekEventReg[75] |= 8; } break; } break; case ENBJI01_PARAMS_LOOKED_THROUGH_TELESCOPE: - switch (gSaveContext.playerForm) { + switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: - if (gSaveContext.weekEventReg[74] & 0x80) { + if (gSaveContext.save.weekEventReg[74] & 0x80) { this->textId = 0x5F2; } else { this->textId = 0x5F1; @@ -180,9 +180,9 @@ void func_809CD028(EnBji01* this, GlobalContext* globalCtx) { this->textId = 0x5EA; break; case 3: - tempDay = gSaveContext.day; + tempDay = gSaveContext.save.day; tempTimeBeforeMoonCrash = - ((-(tempDay % 5 << 0x10) - ((u16)(gSaveContext.time - 0x4000))) + 0x40000); + ((-(tempDay % 5 << 0x10) - ((u16)(gSaveContext.save.time - 0x4000))) + 0x40000); if (tempTimeBeforeMoonCrash < CLOCK_TIME_F(1, 0)) { /* 1 hr */ this->textId = 0x5E8; } else { @@ -218,7 +218,7 @@ void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) { break; case 1: func_8019F230(); - switch (gSaveContext.playerForm) { + switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: func_80151938(globalCtx, 0x5F0); break; @@ -298,7 +298,7 @@ void func_809CD634(EnBji01* this, GlobalContext* globalCtx) { func_801A5BD0(0x6F); Audio_QueueSeqCmd(0xE0000101); globalCtx->nextEntranceIndex = 0x54A0; /* Termina Field from telescope */ - gSaveContext.respawn[0].entranceIndex = globalCtx->nextEntranceIndex; + gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex = globalCtx->nextEntranceIndex; func_80169EFC(&globalCtx->state); /* Load new entrance? */ gSaveContext.respawnFlag = -2; this->actionFunc = EnBji01_DoNothing; @@ -344,7 +344,7 @@ void EnBji01_Init(Actor* thisx, GlobalContext* globalCtx) { SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); this->moonsTear = (ObjMoonStone*)SubS_FindActor(globalCtx, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE); - switch (gSaveContext.entranceIndex) { + switch (gSaveContext.save.entranceIndex) { case 0x4C00: /* Observatory from ECT */ case 0x4C10: /* Observatory from Termina Field door */ this->actor.params = ENBJI01_PARAMS_DEFAULT; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index ecaea29849..49e6caa637 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -97,7 +97,7 @@ void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx) { this->path = func_8013D648(globalCtx, this->unk_29A, 0x3F); this->unk_2C8 = 80.0f; - if ((gSaveContext.entranceIndex == 0xD220) && (gSaveContext.weekEventReg[73] & 0x80) && + if ((gSaveContext.save.entranceIndex == 0xD220) && (gSaveContext.save.weekEventReg[73] & 0x80) && !CHECK_QUEST_ITEM(ITEM_BOTTLE)) { this->unk_2D6 = this->actor.cutscene; if (this->unk_2D6 == 0) { @@ -173,9 +173,9 @@ void func_809C4BC4(EnBomBowlMan* this, GlobalContext* globalCtx) { func_809C4B50(this); func_809C493C(this, 0, 1.0f); - for (i = 0; i < ARRAY_COUNT(gSaveContext.bomberCode); i++) { + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.bomberCode); i++) { Math_Vec3f_Copy(&sp7C, &this->actor.home.pos); - code = gSaveContext.bomberCode[i]; + code = gSaveContext.save.bomberCode[i]; if (code == 1) { Math_Vec3f_Copy(&this->actor.world.pos, &D_809C61A0[i]); this->unk_2D8[code] = this; @@ -203,8 +203,8 @@ void func_809C4BC4(EnBomBowlMan* this, GlobalContext* globalCtx) { func_809C493C(this, 3, 1.0f); this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_290 = this->actor.yawTowardsPlayer; - gSaveContext.weekEventReg[73] &= (u8)~0x10; - gSaveContext.weekEventReg[85] &= (u8)~2; + gSaveContext.save.weekEventReg[73] &= (u8)~0x10; + gSaveContext.save.weekEventReg[85] &= (u8)~2; this->unk_29C = 0; this->actionFunc = func_809C4DA4; } @@ -338,13 +338,13 @@ void func_809C51B4(EnBomBowlMan* this, GlobalContext* globalCtx) { globalCtx->sceneLoadFlag = 0x14; globalCtx->unk_1887F = 0x56; gSaveContext.nextTransition = 3; - gSaveContext.weekEventReg[75] &= (u8)~0x40; + gSaveContext.save.weekEventReg[75] &= (u8)~0x40; if (player->transformation == PLAYER_FORM_HUMAN) { - gSaveContext.weekEventReg[84] |= 0x80; - gSaveContext.weekEventReg[77] &= (u8)~2; + gSaveContext.save.weekEventReg[84] |= 0x80; + gSaveContext.save.weekEventReg[77] &= (u8)~2; } else { - gSaveContext.weekEventReg[73] |= 0x20; - gSaveContext.weekEventReg[85] &= (u8)~1; + gSaveContext.save.weekEventReg[73] |= 0x20; + gSaveContext.save.weekEventReg[85] &= (u8)~1; } } } @@ -402,7 +402,7 @@ void func_809C5408(EnBomBowlMan* this, GlobalContext* globalCtx) { void func_809C5524(EnBomBowlMan* this, GlobalContext* globalCtx) { this->actor.textId = 0x730; - if (!(gSaveContext.weekEventReg[85] & 2)) { + if (!(gSaveContext.save.weekEventReg[85] & 2)) { this->actor.textId = 0x72F; } func_809C493C(this, 3, 1.0f); @@ -484,8 +484,8 @@ void func_809C5738(EnBomBowlMan* this, GlobalContext* globalCtx) { (this->path != NULL)) { this->unk_298++; if (this->unk_298 >= this->path->count) { - gSaveContext.weekEventReg[84] |= 0x80; - gSaveContext.weekEventReg[83] &= (u8)~4; + gSaveContext.save.weekEventReg[84] |= 0x80; + gSaveContext.save.weekEventReg[83] &= (u8)~4; ActorCutscene_Stop(this->unk_2D6); Actor_MarkForDeath(&this->actor); } else { diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index c4fab73655..a76c901eb0 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -104,19 +104,19 @@ void EnBombers_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_2BE = ENBOMBERS_GET_F(&this->actor); if (this->unk_2BC == ENBOMBERS_F0_0) { - if ((gSaveContext.weekEventReg[73] & 0x10) || (gSaveContext.weekEventReg[85] & 2)) { + if ((gSaveContext.save.weekEventReg[73] & 0x10) || (gSaveContext.save.weekEventReg[85] & 2)) { Actor_MarkForDeath(&this->actor); } else { this->unk_2BE++; func_80C03ACC(this); } - } else if (((gSaveContext.weekEventReg[73] & 0x10) || (gSaveContext.weekEventReg[85] & 2)) && - (((this->unk_2BE == ENBOMBERS_F_0) && (gSaveContext.weekEventReg[76] & 1)) || - ((this->unk_2BE == ENBOMBERS_F_1) && (gSaveContext.weekEventReg[76] & 2)) || - ((this->unk_2BE == ENBOMBERS_F_2) && (gSaveContext.weekEventReg[76] & 4)) || - ((this->unk_2BE == ENBOMBERS_F_3) && (gSaveContext.weekEventReg[76] & 8)) || - ((this->unk_2BE == ENBOMBERS_F_4) && (gSaveContext.weekEventReg[76] & 0x10)))) { - if (gSaveContext.weekEventReg[75] & 0x40) { + } else if (((gSaveContext.save.weekEventReg[73] & 0x10) || (gSaveContext.save.weekEventReg[85] & 2)) && + (((this->unk_2BE == ENBOMBERS_F_0) && (gSaveContext.save.weekEventReg[76] & 1)) || + ((this->unk_2BE == ENBOMBERS_F_1) && (gSaveContext.save.weekEventReg[76] & 2)) || + ((this->unk_2BE == ENBOMBERS_F_2) && (gSaveContext.save.weekEventReg[76] & 4)) || + ((this->unk_2BE == ENBOMBERS_F_3) && (gSaveContext.save.weekEventReg[76] & 8)) || + ((this->unk_2BE == ENBOMBERS_F_4) && (gSaveContext.save.weekEventReg[76] & 0x10)))) { + if (gSaveContext.save.weekEventReg[75] & 0x40) { if (this->unk_2BE == ENBOMBERS_F_0) { EnBomBowlMan* bomBowlMan = (EnBomBowlMan*)Actor_Spawn( &globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM_BOWL_MAN, this->actor.world.pos.x, @@ -130,11 +130,11 @@ void EnBombers_Init(Actor* thisx, GlobalContext* globalCtx) { while (cs != -1) { bomBowlMan->unk_2CC[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); i++; } // clang-format on - gSaveContext.weekEventReg[76] &= (u8)~1; - gSaveContext.weekEventReg[76] &= (u8)~2; - gSaveContext.weekEventReg[76] &= (u8)~4; - gSaveContext.weekEventReg[76] &= (u8)~8; - gSaveContext.weekEventReg[76] &= (u8)~0x10; + gSaveContext.save.weekEventReg[76] &= (u8)~1; + gSaveContext.save.weekEventReg[76] &= (u8)~2; + gSaveContext.save.weekEventReg[76] &= (u8)~4; + gSaveContext.save.weekEventReg[76] &= (u8)~8; + gSaveContext.save.weekEventReg[76] &= (u8)~0x10; } } Actor_MarkForDeath(&this->actor); @@ -180,7 +180,7 @@ void func_80C039A8(EnBombers* this, GlobalContext* globalCtx) { switch (player->transformation) { case PLAYER_FORM_HUMAN: this->actor.textId = 0x73D; - if (gSaveContext.weekEventReg[84] & 0x80) { + if (gSaveContext.save.weekEventReg[84] & 0x80) { this->actor.textId = 0x74B; } break; @@ -194,14 +194,14 @@ void func_80C039A8(EnBombers* this, GlobalContext* globalCtx) { break; case PLAYER_FORM_DEKU: - if (gSaveContext.weekEventReg[73] & 0x20) { + if (gSaveContext.save.weekEventReg[73] & 0x20) { this->actor.textId = 0x75A; - } else if (gSaveContext.weekEventReg[73] & 0x40) { + } else if (gSaveContext.save.weekEventReg[73] & 0x40) { this->actor.textId = 0x749; - if (((this->unk_2BE == ENBOMBERS_F_1) && (gSaveContext.weekEventReg[74] & 1)) || - ((this->unk_2BE == ENBOMBERS_F_2) && (gSaveContext.weekEventReg[74] & 2)) || - ((this->unk_2BE == ENBOMBERS_F_3) && (gSaveContext.weekEventReg[74] & 4)) || - ((this->unk_2BE == ENBOMBERS_F_4) && (gSaveContext.weekEventReg[74] & 8))) { + if (((this->unk_2BE == ENBOMBERS_F_1) && (gSaveContext.save.weekEventReg[74] & 1)) || + ((this->unk_2BE == ENBOMBERS_F_2) && (gSaveContext.save.weekEventReg[74] & 2)) || + ((this->unk_2BE == ENBOMBERS_F_3) && (gSaveContext.save.weekEventReg[74] & 4)) || + ((this->unk_2BE == ENBOMBERS_F_4) && (gSaveContext.save.weekEventReg[74] & 8))) { this->actor.textId = 0x74A; } } else { @@ -375,7 +375,7 @@ void func_80C03FAC(EnBombers* this, GlobalContext* globalCtx) { sp2A = 1; } } else if (this->actor.textId == 0x744) { - s32 day = gSaveContext.day - 1; + s32 day = gSaveContext.save.day - 1; if (day == 2) { this->actor.textId = 0x746; @@ -393,22 +393,22 @@ void func_80C03FAC(EnBombers* this, GlobalContext* globalCtx) { } else if (this->actor.textId == 0x748) { switch (this->unk_2BE) { case ENBOMBERS_F_1: - gSaveContext.weekEventReg[74] |= 1; + gSaveContext.save.weekEventReg[74] |= 1; break; case ENBOMBERS_F_2: - gSaveContext.weekEventReg[74] |= 2; + gSaveContext.save.weekEventReg[74] |= 2; break; case ENBOMBERS_F_3: - gSaveContext.weekEventReg[74] |= 4; + gSaveContext.save.weekEventReg[74] |= 4; break; case ENBOMBERS_F_4: - gSaveContext.weekEventReg[74] |= 8; + gSaveContext.save.weekEventReg[74] |= 8; break; } - gSaveContext.weekEventReg[73] |= 0x40; + gSaveContext.save.weekEventReg[73] |= 0x40; } switch (sp2A) { diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index 5aacb88200..8b2fa6d906 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -94,7 +94,7 @@ void EnBombers2_Init(Actor* thisx, GlobalContext* globalCtx) { this->jointTable, OBJECT_CS_LIMB_MAX); this->actor.targetMode = 6; Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - if ((gSaveContext.weekEventReg[0x49] & 0x80) || (gSaveContext.entranceIndex == 0xD220)) { + if ((gSaveContext.save.weekEventReg[73] & 0x80) || (gSaveContext.save.entranceIndex == 0xD220)) { this->actor.world.pos.x += Math_SinS(this->actor.home.rot.y + 0xC100) * 50.0f; cos = Math_CosS(this->actor.home.rot.y + 0xC100) * 50.0f; this->unk_2AC = 1; @@ -165,7 +165,7 @@ void func_80C04BA0(EnBombers2* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->unk_2B6 = this->actor.world.rot.y; - gSaveContext.weekEventReg[0x56] |= 2; + gSaveContext.save.weekEventReg[86] |= 2; func_80C04D00(this); return; } @@ -219,7 +219,8 @@ void func_80C04D8C(EnBombers2* this, GlobalContext* globalCtx) { s32 correctDigits; for (i = 0; i < ARRAY_COUNT(this->correctDigitSlots); i++) { - if (!(this->correctDigitSlots[i]) && (globalCtx->msgCtx.unk12054[i] == gSaveContext.bomberCode[i])) { + if (!(this->correctDigitSlots[i]) && + (globalCtx->msgCtx.unk12054[i] == gSaveContext.save.bomberCode[i])) { this->correctDigitSlots[i] = true; } } @@ -329,7 +330,7 @@ void func_80C0520C(EnBombers2* this, GlobalContext* globalCtx) { EnBombers2_ChangeAnim(this, 6, 1.0f); this->unk_2A8 = 0; this->unk_2C0 = 1; - gSaveContext.weekEventReg[0x49] |= 0x80; + gSaveContext.save.weekEventReg[73] |= 0x80; ActorCutscene_Stop(this->cutscene); this->unk_2AC = 1; this->actor.textId = sTextIds[this->textIdIndex]; diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index 9d1cd39702..300679a4e5 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -117,7 +117,7 @@ void EnBomjima_Init(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, this->morphTable, OBJECT_CS_LIMB_MAX); Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - gSaveContext.weekEventReg[83] &= (u8)~4; + gSaveContext.save.weekEventReg[83] &= (u8)~4; this->actor.targetMode = 0; this->unk_2E6 = ENBOMJIMA_GET_F0(&this->actor); this->unk_2E4 = ENBOMJIMA_GET_F(&this->actor); @@ -139,8 +139,8 @@ void EnBomjima_Init(Actor* thisx, GlobalContext* globalCtx) { func_80BFFCFC(this); } - if ((gSaveContext.weekEventReg[75] & 0x40) || (gSaveContext.weekEventReg[73] & 0x10) || - (gSaveContext.weekEventReg[85] & 2)) { + if ((gSaveContext.save.weekEventReg[75] & 0x40) || (gSaveContext.save.weekEventReg[73] & 0x10) || + (gSaveContext.save.weekEventReg[85] & 2)) { Actor_MarkForDeath(&this->actor); } } @@ -166,12 +166,12 @@ void func_80BFE32C(EnBomjima* this, GlobalContext* globalCtx, s32 arg2) { case 0: if (player->transformation == PLAYER_FORM_DEKU) { this->actor.textId = 0x759; - if (!(gSaveContext.weekEventReg[73] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[73] & 0x20)) { this->actor.textId = 0x708; } } else if (player->transformation == PLAYER_FORM_HUMAN) { this->actor.textId = 0x75A; - if (!(gSaveContext.weekEventReg[84] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[84] & 0x80)) { this->actor.textId = 0x719; } } else if ((this->unk_2C8 == 1) || (this->unk_2C8 == 2)) { @@ -350,18 +350,18 @@ void func_80BFEB64(EnBomjima* this, GlobalContext* globalCtx) { func_80BFE32C(this, globalCtx, 0); if (player->transformation == PLAYER_FORM_DEKU) { - if (gSaveContext.weekEventReg[73] & 0x20) { + if (gSaveContext.save.weekEventReg[73] & 0x20) { this->unk_2C8 = 3; func_80BFE32C(this, globalCtx, 3); - } else if (gSaveContext.weekEventReg[77] & 2) { + } else if (gSaveContext.save.weekEventReg[77] & 2) { this->unk_2C8 = 11; func_80BFE32C(this, globalCtx, 2); } } else if (player->transformation == PLAYER_FORM_HUMAN) { - if (gSaveContext.weekEventReg[84] & 0x80) { + if (gSaveContext.save.weekEventReg[84] & 0x80) { this->unk_2C8 = 0; func_80BFE32C(this, globalCtx, 3); - } else if (gSaveContext.weekEventReg[85] & 1) { + } else if (gSaveContext.save.weekEventReg[85] & 1) { this->unk_2C8 = 11; func_80BFE32C(this, globalCtx, 2); } @@ -460,7 +460,7 @@ void func_80BFF03C(EnBomjima* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->unk_2D4[0]); } else { player->stateFlags1 &= ~0x20; - gSaveContext.weekEventReg[83] &= (u8)~4; + gSaveContext.save.weekEventReg[83] &= (u8)~4; this->actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); this->unk_2DC = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[0], &this->actor); @@ -506,11 +506,11 @@ void func_80BFF174(EnBomjima* this, GlobalContext* globalCtx) { } if (player->transformation == PLAYER_FORM_DEKU) { - if (gSaveContext.weekEventReg[73] & 0x20) { + if (gSaveContext.save.weekEventReg[73] & 0x20) { this->unk_2C8 = 3; func_80BFE32C(this, globalCtx, 3); } else { - if (!(gSaveContext.weekEventReg[77] & 2)) { + if (!(gSaveContext.save.weekEventReg[77] & 2)) { if (this->unk_2E8 == 0) { this->unk_2C8 = 4; } else { @@ -522,11 +522,11 @@ void func_80BFF174(EnBomjima* this, GlobalContext* globalCtx) { func_80BFE32C(this, globalCtx, 2); } } else if (player->transformation == PLAYER_FORM_HUMAN) { - if (gSaveContext.weekEventReg[84] & 0x80) { + if (gSaveContext.save.weekEventReg[84] & 0x80) { this->unk_2C8 = 0; func_80BFE32C(this, globalCtx, 3); } else { - if (!(gSaveContext.weekEventReg[85] & 1)) { + if (!(gSaveContext.save.weekEventReg[85] & 1)) { if (this->unk_2EA == 0) { this->unk_2C8 = 4; } else { @@ -566,7 +566,7 @@ void func_80BFF430(EnBomjima* this, GlobalContext* globalCtx) { bombal->unk_150 = 0.0f; bombal->unk_14C = this->unk_2F4; Actor_ChangeFocus(&this->actor, globalCtx, &bombal->actor); - gSaveContext.weekEventReg[83] &= (u8)~4; + gSaveContext.save.weekEventReg[83] &= (u8)~4; func_80BFE65C(this); func_801477B4(globalCtx); this->actionFunc = func_80BFEA94; @@ -689,31 +689,31 @@ void func_80BFF9B0(EnBomjima* this, GlobalContext* globalCtx) { D_80C009F0 = 0; this->unk_2C8 = 9; if (player->transformation == PLAYER_FORM_DEKU) { - gSaveContext.weekEventReg[73] |= 0x10; - gSaveContext.weekEventReg[77] |= 2; + gSaveContext.save.weekEventReg[73] |= 0x10; + gSaveContext.save.weekEventReg[77] |= 2; } else { - gSaveContext.weekEventReg[85] |= 2; - gSaveContext.weekEventReg[85] |= 1; + gSaveContext.save.weekEventReg[85] |= 2; + gSaveContext.save.weekEventReg[85] |= 1; } - gSaveContext.weekEventReg[11] &= (u8)~1; - gSaveContext.weekEventReg[11] &= (u8)~2; - gSaveContext.weekEventReg[11] &= (u8)~4; - gSaveContext.weekEventReg[11] &= (u8)~8; - gSaveContext.weekEventReg[11] &= (u8)~0x10; + gSaveContext.save.weekEventReg[11] &= (u8)~1; + gSaveContext.save.weekEventReg[11] &= (u8)~2; + gSaveContext.save.weekEventReg[11] &= (u8)~4; + gSaveContext.save.weekEventReg[11] &= (u8)~8; + gSaveContext.save.weekEventReg[11] &= (u8)~0x10; - gSaveContext.weekEventReg[76] &= (u8)~1; - gSaveContext.weekEventReg[76] &= (u8)~2; - gSaveContext.weekEventReg[76] &= (u8)~4; - gSaveContext.weekEventReg[76] &= (u8)~8; - gSaveContext.weekEventReg[76] &= (u8)~0x10; + gSaveContext.save.weekEventReg[76] &= (u8)~1; + gSaveContext.save.weekEventReg[76] &= (u8)~2; + gSaveContext.save.weekEventReg[76] &= (u8)~4; + gSaveContext.save.weekEventReg[76] &= (u8)~8; + gSaveContext.save.weekEventReg[76] &= (u8)~0x10; - gSaveContext.unk_FE6 = 0; - gSaveContext.unk_FE7[0] = 0; - gSaveContext.unk_FE7[1] = 0; - gSaveContext.unk_FE7[2] = 0; - gSaveContext.unk_FE7[3] = 0; - gSaveContext.unk_FE7[4] = 0; + gSaveContext.save.bombersCaughtNum = 0; + gSaveContext.save.bombersCaughtOrder[0] = 0; + gSaveContext.save.bombersCaughtOrder[1] = 0; + gSaveContext.save.bombersCaughtOrder[2] = 0; + gSaveContext.save.bombersCaughtOrder[3] = 0; + gSaveContext.save.bombersCaughtOrder[4] = 0; func_80BFE494(this, 3, 1.0f); this->unk_2C8 = 9; diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index 6835a90fc7..915b785cd9 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -99,38 +99,38 @@ void EnBomjimb_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_2C6 = ENBOMJIMB_F0_0; } - if ((gSaveContext.weekEventReg[73] & 0x10) || (gSaveContext.weekEventReg[85] & 2)) { + if ((gSaveContext.save.weekEventReg[73] & 0x10) || (gSaveContext.save.weekEventReg[85] & 2)) { switch (this->unk_2C8) { case ENBOMJIMB_F_0: - if (gSaveContext.weekEventReg[11] & 1) { + if (gSaveContext.save.weekEventReg[11] & 1) { Actor_MarkForDeath(&this->actor); return; } break; case ENBOMJIMB_F_1: - if (gSaveContext.weekEventReg[11] & 2) { + if (gSaveContext.save.weekEventReg[11] & 2) { Actor_MarkForDeath(&this->actor); return; } break; case ENBOMJIMB_F_2: - if (gSaveContext.weekEventReg[11] & 4) { + if (gSaveContext.save.weekEventReg[11] & 4) { Actor_MarkForDeath(&this->actor); return; } break; case ENBOMJIMB_F_3: - if (gSaveContext.weekEventReg[11] & 8) { + if (gSaveContext.save.weekEventReg[11] & 8) { Actor_MarkForDeath(&this->actor); return; } break; case ENBOMJIMB_F_4: - if (gSaveContext.weekEventReg[11] & 0x10) { + if (gSaveContext.save.weekEventReg[11] & 0x10) { Actor_MarkForDeath(&this->actor); return; } @@ -138,8 +138,8 @@ void EnBomjimb_Init(Actor* thisx, GlobalContext* globalCtx) { } } - if ((!(gSaveContext.weekEventReg[73] & 0x10) && !(gSaveContext.weekEventReg[85] & 2)) || - (gSaveContext.weekEventReg[75] & 0x40)) { + if ((!(gSaveContext.save.weekEventReg[73] & 0x10) && !(gSaveContext.save.weekEventReg[85] & 2)) || + (gSaveContext.save.weekEventReg[75] & 0x40)) { Actor_MarkForDeath(&this->actor); return; } @@ -671,8 +671,8 @@ void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) { return; } - if (((player->transformation == PLAYER_FORM_DEKU) && !(gSaveContext.weekEventReg[73] & 0x10)) || - ((player->transformation == PLAYER_FORM_HUMAN) && !(gSaveContext.weekEventReg[85] & 2))) { + if (((player->transformation == PLAYER_FORM_DEKU) && !(gSaveContext.save.weekEventReg[73] & 0x10)) || + ((player->transformation == PLAYER_FORM_HUMAN) && !(gSaveContext.save.weekEventReg[85] & 2))) { func_80C0113C(this, 17, 1.0f); Message_StartTextbox(globalCtx, 0x72E, &this->actor); player->stateFlags1 |= 0x10000000; @@ -683,13 +683,13 @@ void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) { return; } - idx = gSaveContext.unk_FE6; + idx = gSaveContext.save.bombersCaughtNum; Message_StartTextbox(globalCtx, D_80C03230[idx], &this->actor); - idx = gSaveContext.unk_FE6; - gSaveContext.unk_FE7[idx] = this->unk_2C8 + 1; - gSaveContext.unk_FE6++; + idx = gSaveContext.save.bombersCaughtNum; + gSaveContext.save.bombersCaughtOrder[idx] = this->unk_2C8 + 1; + gSaveContext.save.bombersCaughtNum++; - if (gSaveContext.unk_FE6 > 4) { + if (gSaveContext.save.bombersCaughtNum > 4) { func_801A3098(0x922); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); @@ -697,28 +697,28 @@ void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) { switch (this->unk_2C8) { case ENBOMJIMB_F_0: - gSaveContext.weekEventReg[76] |= 1; - gSaveContext.weekEventReg[11] |= 1; + gSaveContext.save.weekEventReg[76] |= 1; + gSaveContext.save.weekEventReg[11] |= 1; break; case ENBOMJIMB_F_1: - gSaveContext.weekEventReg[76] |= 2; - gSaveContext.weekEventReg[11] |= 2; + gSaveContext.save.weekEventReg[76] |= 2; + gSaveContext.save.weekEventReg[11] |= 2; break; case ENBOMJIMB_F_2: - gSaveContext.weekEventReg[76] |= 4; - gSaveContext.weekEventReg[11] |= 4; + gSaveContext.save.weekEventReg[76] |= 4; + gSaveContext.save.weekEventReg[11] |= 4; break; case ENBOMJIMB_F_3: - gSaveContext.weekEventReg[76] |= 8; - gSaveContext.weekEventReg[11] |= 8; + gSaveContext.save.weekEventReg[76] |= 8; + gSaveContext.save.weekEventReg[11] |= 8; break; case ENBOMJIMB_F_4: - gSaveContext.weekEventReg[76] |= 0x10; - gSaveContext.weekEventReg[11] |= 0x10; + gSaveContext.save.weekEventReg[76] |= 0x10; + gSaveContext.save.weekEventReg[11] |= 0x10; break; } @@ -760,7 +760,7 @@ void func_80C02A14(EnBomjimb* this, GlobalContext* globalCtx) { if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { func_801477B4(globalCtx); - if ((this->unk_2CA == 8) && (gSaveContext.unk_FE6 >= 5)) { + if ((this->unk_2CA == 8) && (gSaveContext.save.bombersCaughtNum >= 5)) { func_80C02CA4(this, globalCtx); } else { if (this->unk_2CA == 8) { @@ -800,8 +800,8 @@ void func_80C02CA4(EnBomjimb* this, GlobalContext* globalCtx) { globalCtx->unk_1887F = 0x56; gSaveContext.nextTransition = 3; } - gSaveContext.weekEventReg[75] |= 0x40; - gSaveContext.weekEventReg[83] |= 4; + gSaveContext.save.weekEventReg[75] |= 0x40; + gSaveContext.save.weekEventReg[83] |= 4; this->actionFunc = func_80C02DAC; } diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c index 129045a6c7..0f340da3af 100644 --- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c +++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c @@ -61,7 +61,7 @@ void EnCha_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.z = 0; this->actionFunc = EnCha_Idle; this->actor.home.rot.x = this->actor.home.rot.z; - gSaveContext.weekEventReg[60] &= (u8)~4; + gSaveContext.save.weekEventReg[60] &= (u8)~4; } void EnCha_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -83,16 +83,16 @@ void EnCha_Ring(EnCha* this, GlobalContext* globalCtx) { } void EnCha_Idle(EnCha* this, GlobalContext* globalCtx) { - if (gSaveContext.weekEventReg[60] & 4) { + if (gSaveContext.save.weekEventReg[60] & 4) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DOOR_BELL); - gSaveContext.weekEventReg[60] &= (u8)~4; + gSaveContext.save.weekEventReg[60] &= (u8)~4; this->actor.home.rot.z = 0x7D0; } if (this->collider.base.acFlags & AC_HIT) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DOOR_BELL); this->actor.home.rot.z = 0x7D0; - if (!(gSaveContext.weekEventReg[51] & 4)) { - gSaveContext.weekEventReg[51] |= 4; + if (!(gSaveContext.save.weekEventReg[51] & 4)) { + gSaveContext.save.weekEventReg[51] |= 4; this->actionFunc = EnCha_Ring; } } diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c index f5f399a653..6817c1830f 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c @@ -94,7 +94,7 @@ void EnColMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_80AFDD60(EnColMan* this) { - if (!(gSaveContext.weekEventReg[56] & 2)) { + if (!(gSaveContext.save.weekEventReg[56] & 2)) { this->actor.draw = func_80AFE414; this->actor.shape.yOffset = 700.0f; if (this->actor.params == EN_COL_MAN_HEART_PIECE) { @@ -123,14 +123,14 @@ void func_80AFDE00(EnColMan* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; } } - if (!(gSaveContext.weekEventReg[56] & 2)) { + if (!(gSaveContext.save.weekEventReg[56] & 2)) { this->actor.shape.rot.y += 0x3E8; } if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; this->actor.draw = NULL; this->actionFunc = EnColMan_SetHeartPieceCollectedAndKill; - } else if (!(gSaveContext.weekEventReg[56] & 2)) { + } else if (!(gSaveContext.save.weekEventReg[56] & 2)) { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 40.0f, 40.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_RECOVERY_HEART, 40.0f, 40.0f); @@ -139,7 +139,7 @@ void func_80AFDE00(EnColMan* this, GlobalContext* globalCtx) { void EnColMan_SetHeartPieceCollectedAndKill(EnColMan* this, GlobalContext* globalCtx) { if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { - gSaveContext.weekEventReg[56] |= 2; + gSaveContext.save.weekEventReg[56] |= 2; Actor_MarkForDeath(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 13e4c8868a..772d054abb 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -116,7 +116,7 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnCow_Idle; - if (!(gSaveContext.weekEventReg[22] & 1) && (CURRENT_DAY != 1) && + if (!(gSaveContext.save.weekEventReg[22] & 1) && (CURRENT_DAY != 1) && (EN_COW_TYPE(thisx) == EN_COW_TYPE_ABDUCTED)) { Actor_MarkForDeath(&this->actor); return; @@ -153,7 +153,7 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); this->flags = 0; - gSaveContext.weekEventReg[87] &= (u8)~1; + gSaveContext.save.weekEventReg[87] &= (u8)~1; } void EnCow_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -289,8 +289,8 @@ void EnCow_Idle(EnCow* this, GlobalContext* globalCtx) { if (this->actor.xzDistToPlayer < 150.0f && ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 25000) { if (func_801A5100() == 4) { - if (!(gSaveContext.weekEventReg[87] & 1)) { - gSaveContext.weekEventReg[87] |= 1; + if (!(gSaveContext.save.weekEventReg[87] & 1)) { + gSaveContext.save.weekEventReg[87] |= 1; if (Interface_HasEmptyBottle()) { this->actor.textId = 0x32C9; // Text to give milk. } else { @@ -301,7 +301,7 @@ void EnCow_Idle(EnCow* this, GlobalContext* globalCtx) { this->actionFunc = EnCow_Talk; } } else { - gSaveContext.weekEventReg[87] &= (u8)~1; + gSaveContext.save.weekEventReg[87] &= (u8)~1; } } diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 3b96d1b4d6..bd7de1418c 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -179,7 +179,7 @@ s32 func_80B3E69C(EnDai* this, GlobalContext* globalCtx) { s32 ret = false; if ((globalCtx->csCtx.state != 0) && (globalCtx->sceneNum == SCENE_12HAKUGINMAE) && - (globalCtx->csCtx.currentCsIndex == 0) && !(gSaveContext.weekEventReg[30] & 1)) { + (globalCtx->csCtx.currentCsIndex == 0) && !(gSaveContext.save.weekEventReg[30] & 1)) { if (!(this->unk_1CE & 0x10)) { Flags_SetSwitch(globalCtx, 20); this->unk_1CE |= (0x80 | 0x10); @@ -194,7 +194,7 @@ s32 func_80B3E69C(EnDai* this, GlobalContext* globalCtx) { } else if (this->unk_1CE & 0x10) { this->unk_1CE &= ~0x10; this->unk_1CE |= 0x200; - gSaveContext.weekEventReg[30] |= 1; + gSaveContext.save.weekEventReg[30] |= 1; this->actionFunc = func_80B3F00C; } @@ -525,7 +525,7 @@ void EnDai_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1CE = 0; this->unk_1D6 = 0; - if (gSaveContext.weekEventReg[33] & 0x80) { + if (gSaveContext.save.weekEventReg[33] & 0x80) { SubS_UpdateFlags(&this->unk_1CE, 3, 7); this->unk_1CE |= 0x80; this->unk_1CD = 0xFF; @@ -533,7 +533,7 @@ void EnDai_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if (gSaveContext.weekEventReg[30] & 1) { + if (gSaveContext.save.weekEventReg[30] & 1) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 79012db840..a15d095159 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -77,10 +77,11 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.height = 60; this->collider.dim.yShift = 0; this->actor.flags |= ACTOR_FLAG_8000000; - if ((gSaveContext.weekEventReg[63] & 0x80) || ((gSaveContext.day == 3) && gSaveContext.isNight)) { + if ((gSaveContext.save.weekEventReg[63] & 0x80) || + ((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { Actor_MarkForDeath(&this->actor); } - } else if ((gSaveContext.day == 3) && gSaveContext.isNight) { + } else if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { Actor_MarkForDeath(&this->actor); } @@ -140,7 +141,7 @@ void func_809437C8(EnDaiku* this) { } void func_80943820(EnDaiku* this) { - s32 day = gSaveContext.day - 1; + s32 day = gSaveContext.save.day - 1; switch (this->unk_278) { case 0: @@ -167,7 +168,7 @@ void func_80943820(EnDaiku* this) { void func_809438F8(EnDaiku* this, GlobalContext* globalCtx) { f32 currentFrame = this->skelAnime.curFrame; s32 pad; - s32 day = gSaveContext.day - 1; + s32 day = gSaveContext.save.day - 1; s32 pad2; if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { @@ -255,7 +256,7 @@ void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } - if ((this->unk_278 == ENDAIKU_PARAMS_FF_0) && (gSaveContext.day == 3) && (gSaveContext.isNight)) { + if ((this->unk_278 == ENDAIKU_PARAMS_FF_0) && (gSaveContext.save.day == 3) && (gSaveContext.save.isNight)) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index 0a1195b1a6..009094f93d 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -78,7 +78,7 @@ void func_80BE61D0(EnDaiku2* this) { void EnDaiku2_Init(Actor* thisx, GlobalContext* globalCtx) { EnDaiku2* this = THIS; - s32 day = gSaveContext.day; + s32 day = gSaveContext.save.day; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); @@ -163,10 +163,10 @@ s32 func_80BE64C0(EnDaiku2* this, GlobalContext* globalCtx) { } void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx) { - switch (gSaveContext.day - 1) { + switch (gSaveContext.save.day - 1) { case 0: this->unk_28A = 0; - if (gSaveContext.weekEventReg[64] & 2) { + if (gSaveContext.save.weekEventReg[64] & 2) { this->unk_28A = 6; } func_80BE6408(this, 8); @@ -174,7 +174,7 @@ void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx) { case 1: this->unk_28A = 2; - if (gSaveContext.weekEventReg[64] & 4) { + if (gSaveContext.save.weekEventReg[64] & 4) { this->unk_28A = 7; } func_80BE6408(this, 8); @@ -201,7 +201,7 @@ void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx) { void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) { f32 sp9C = this->skelAnime.curFrame; - s32 sp98 = gSaveContext.day - 1; + s32 sp98 = gSaveContext.save.day - 1; s32 i; Vec3f sp88; Vec3f sp7C; @@ -279,7 +279,7 @@ void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) { } void func_80BE6B40(EnDaiku2* this, GlobalContext* globalCtx) { - s32 day = gSaveContext.day; + s32 day = gSaveContext.save.day; this->unk_288 = 1; if ((day != 3) && Flags_GetSwitch(globalCtx, this->unk_278)) { @@ -293,7 +293,7 @@ void func_80BE6B40(EnDaiku2* this, GlobalContext* globalCtx) { void func_80BE6BC0(EnDaiku2* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0x0); if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - s32 day = gSaveContext.day - 1; + s32 day = gSaveContext.save.day - 1; func_801477B4(globalCtx); @@ -307,11 +307,11 @@ void func_80BE6BC0(EnDaiku2* this, GlobalContext* globalCtx) { } else { switch (day) { case 0: - gSaveContext.weekEventReg[64] |= 2; + gSaveContext.save.weekEventReg[64] |= 2; break; case 1: - gSaveContext.weekEventReg[64] |= 4; + gSaveContext.save.weekEventReg[64] |= 4; break; } func_80BE65B4(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index da8b51cbc4..5d477d21f1 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -348,10 +348,11 @@ void func_80989BF8(EnDg* this) { if (this->unk_286 < 14) { if (this->unk_286 % 2) { D_8098C2A8[this->unk_286].unk_04 = - 0x3538 + ((gSaveContext.weekEventReg[42 + (this->unk_286 / 2)] & (0x10 | 0x20 | 0x40 | 0x80)) >> 4); + 0x3538 + + ((gSaveContext.save.weekEventReg[42 + (this->unk_286 / 2)] & (0x10 | 0x20 | 0x40 | 0x80)) >> 4); } else { D_8098C2A8[this->unk_286].unk_04 = - 0x3538 + (gSaveContext.weekEventReg[42 + (this->unk_286 / 2)] & (1 | 2 | 4 | 8)); + 0x3538 + (gSaveContext.save.weekEventReg[42 + (this->unk_286 / 2)] & (1 | 2 | 4 | 8)); } } else { Actor_MarkForDeath(&this->actor); diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 10e3fd8b85..9236ce6fad 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -450,7 +450,7 @@ s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) { return true; } - if ((gSaveContext.playerForm == PLAYER_FORM_GORON) && (player->actor.velocity.y < -5.0f) && + if ((gSaveContext.save.playerForm == PLAYER_FORM_GORON) && (player->actor.velocity.y < -5.0f) && (player->unk_AE7 == 1) && (this->unk_28B == 0)) { this->unk_28B = 1; for (i = 0; i < ARRAY_COUNT(this->colliderJntSphElement) - 3; i++) { diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index 57e6973801..ceffe3d938 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -211,7 +211,7 @@ void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) { switch (ENDNO_GET_C000(thisx)) { case ENDNO_GET_C000_0: func_80A71788(this, globalCtx); - if (!(gSaveContext.weekEventReg[23] & 0x20) || (gSaveContext.weekEventReg[93] & 2)) { + if (!(gSaveContext.save.weekEventReg[23] & 0x20) || (gSaveContext.save.weekEventReg[93] & 2)) { Actor_MarkForDeath(thisx); } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); @@ -225,7 +225,7 @@ void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ENDNO_GET_C000_1: - if (gSaveContext.weekEventReg[23] & 0x20) { + if (gSaveContext.save.weekEventReg[23] & 0x20) { Actor_MarkForDeath(thisx); } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); @@ -267,7 +267,7 @@ void func_80A71B68(EnDno* this, GlobalContext* globalCtx) { this->unk_452 = 0; this->actor.textId = 0; if (CHECK_QUEST_ITEM(QUEST_SONG_SONATA)) { - if (gSaveContext.weekEventReg[27] & 1) { + if (gSaveContext.save.weekEventReg[27] & 1) { if (!(this->unk_3B0 & 0x20)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 6, &this->unk_32C); this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->unk_460); @@ -331,17 +331,17 @@ void func_80A71C3C(EnDno* this, GlobalContext* globalCtx) { void func_80A71E54(EnDno* this, GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_SONG_SONATA)) { - if (gSaveContext.weekEventReg[27] & 1) { + if (gSaveContext.save.weekEventReg[27] & 1) { this->textId = 0x811; } else { this->textId = 0x80F; - gSaveContext.weekEventReg[27] |= 1; + gSaveContext.save.weekEventReg[27] |= 1; } - } else if (gSaveContext.weekEventReg[26] & 0x80) { + } else if (gSaveContext.save.weekEventReg[26] & 0x80) { this->textId = 0x80B; } else { this->textId = 0x80C; - gSaveContext.weekEventReg[26] |= 0x80; + gSaveContext.save.weekEventReg[26] |= 0x80; } if (this->textId != 0x811) { @@ -558,7 +558,7 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) { case 2: if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x2D8)) { - gSaveContext.weekEventReg[93] |= 2; + gSaveContext.save.weekEventReg[93] |= 2; Message_StartTextbox(globalCtx, 0x802, &this->actor); } break; diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index d7274837cb..13a02345d6 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -206,7 +206,7 @@ s32 func_80B3CF60(EnDnp* this, GlobalContext* globalCtx) { this->unk_322 |= 8; this->actionFunc = func_80B3D3F8; ret = true; - } else if (!(gSaveContext.weekEventReg[23] & 0x20) && Actor_HasParent(&this->actor, globalCtx)) { + } else if (!(gSaveContext.save.weekEventReg[23] & 0x20) && Actor_HasParent(&this->actor, globalCtx)) { SubS_UpdateFlags(&this->unk_322, 0, 7); this->unk_322 &= ~0x500; this->actor.parent = NULL; @@ -247,10 +247,10 @@ void func_80B3D11C(EnDnp* this, GlobalContext* globalCtx) { s32 temp_v0; s32 val; - if (!(gSaveContext.weekEventReg[29] & 0x40) && (globalCtx->sceneNum == SCENE_MITURIN) && + if (!(gSaveContext.save.weekEventReg[29] & 0x40) && (globalCtx->sceneNum == SCENE_MITURIN) && (globalCtx->csCtx.currentCsIndex == 0)) { this->unk_322 |= 0x20; - gSaveContext.weekEventReg[29] |= 0x40; + gSaveContext.save.weekEventReg[29] |= 0x40; } if (Cutscene_CheckActorAction(globalCtx, 101)) { @@ -337,7 +337,7 @@ void func_80B3D47C(EnDnp* this, GlobalContext* globalCtx) { void func_80B3D558(EnDnp* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - gSaveContext.weekEventReg[23] |= 0x20; + gSaveContext.save.weekEventReg[23] |= 0x20; } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } @@ -366,12 +366,12 @@ void EnDnp_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.cutscene = 0x10; this->actionFunc = func_80B3D47C; } else if (((ENDNP_GET_7(&this->actor) == ENDNP_GET_7_0) && !Interface_HasItemInBottle(ITEM_DEKU_PRINCESS) && - !(gSaveContext.weekEventReg[23] & 0x20)) || - ((ENDNP_GET_7(&this->actor) == ENDNP_GET_7_2) && (gSaveContext.weekEventReg[23] & 0x20))) { + !(gSaveContext.save.weekEventReg[23] & 0x20)) || + ((ENDNP_GET_7(&this->actor) == ENDNP_GET_7_2) && (gSaveContext.save.weekEventReg[23] & 0x20))) { Actor_SetScale(&this->actor, 0.0085f); SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 |= 0x400; - if ((globalCtx->sceneNum == SCENE_MITURIN) && (gSaveContext.weekEventReg[29] & 0x40)) { + if ((globalCtx->sceneNum == SCENE_MITURIN) && (gSaveContext.save.weekEventReg[29] & 0x40)) { this->unk_322 |= 0x20; func_80B3CC38(this, 1); } @@ -407,7 +407,7 @@ void EnDnp_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); sp2C = this->collider.dim.radius + 50; sp28 = this->collider.dim.height + 30; - if ((this->unk_322 & 0x400) && !(gSaveContext.weekEventReg[23] & 0x20)) { + if ((this->unk_322 & 0x400) && !(gSaveContext.save.weekEventReg[23] & 0x20)) { Actor_PickUp(&this->actor, globalCtx, GI_MAX, sp2C, sp28); } func_8013C964(&this->actor, globalCtx, sp2C, sp28, 0, this->unk_322 & 7); diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index d5bedf3335..535201ac3b 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -306,7 +306,7 @@ void func_80A52C6C(EnDnq* this, GlobalContext* globalCtx) { } s32* func_80A52CF8(EnDnq* this, GlobalContext* globalCtx) { - if (gSaveContext.weekEventReg[23] & 0x20) { + if (gSaveContext.save.weekEventReg[23] & 0x20) { return &D_80A53400[14]; } @@ -340,11 +340,11 @@ void func_80A52DC8(EnDnq* this, GlobalContext* globalCtx) { SubS_UpdateFlags(&this->unk_37C, 0, 7); } - if (!(gSaveContext.weekEventReg[23] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { this->unk_390 = 70.0f; if (Interface_HasItemInBottle(ITEM_DEKU_PRINCESS) && !func_801690CC(globalCtx) && (Message_GetState(&globalCtx->msgCtx) == 0) && (ActorCutscene_GetCurrentIndex() == -1)) { - if ((DECR(this->unk_384) == 0) && (gSaveContext.weekEventReg[29] & 0x40)) { + if ((DECR(this->unk_384) == 0) && (gSaveContext.save.weekEventReg[29] & 0x40)) { Message_StartTextbox(globalCtx, 0x969, NULL); this->unk_384 = 200; } @@ -358,7 +358,7 @@ void func_80A52DC8(EnDnq* this, GlobalContext* globalCtx) { this->actor.xzDistToPlayer = this->unk_394; - if (gSaveContext.weekEventReg[83] & 8) { + if (gSaveContext.save.weekEventReg[83] & 8) { func_80A52A78(this, globalCtx); } else if (this->unk_3A4 == 0) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); @@ -427,7 +427,7 @@ void EnDnq_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_386 = 0; this->unk_37C = 0; SubS_UpdateFlags(&this->unk_37C, 3, 7); - if (gSaveContext.weekEventReg[9] & 0x80) { + if (gSaveContext.save.weekEventReg[9] & 0x80) { this->unk_3A4 = 1; } else { this->unk_3A4 = 0; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index b9f1605f9d..646a2b7788 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -182,7 +182,7 @@ void func_8092C934(EnDns* this) { s32* func_8092C9BC(EnDns* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - if (!(gSaveContext.weekEventReg[23] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { if (player->transformation != PLAYER_FORM_DEKU) { return &D_8092DCB0[16]; } else if (this->unk_2FC != 0) { @@ -361,14 +361,14 @@ s32 func_8092D068(EnDns* this) { s32 ret = false; if (ENDNS_GET_8000(&this->actor)) { - if (gSaveContext.weekEventReg[23] & 0x20) { + if (gSaveContext.save.weekEventReg[23] & 0x20) { ret = true; } } else if (ENDNS_GET_4000(&this->actor)) { - if ((gSaveContext.weekEventReg[9] & 0x80) && !(gSaveContext.weekEventReg[23] & 0x20)) { + if ((gSaveContext.save.weekEventReg[9] & 0x80) && !(gSaveContext.save.weekEventReg[23] & 0x20)) { ret = true; } - } else if (!(gSaveContext.weekEventReg[9] & 0x80) && !(gSaveContext.weekEventReg[23] & 0x20)) { + } else if (!(gSaveContext.save.weekEventReg[9] & 0x80) && !(gSaveContext.save.weekEventReg[23] & 0x20)) { ret = true; } @@ -399,7 +399,8 @@ void func_8092D1B8(EnDns* this, GlobalContext* globalCtx) { } if (!ENDNS_GET_4000(&this->actor) || (this->unk_2D2 != 0)) { - if (!(gSaveContext.weekEventReg[23] & 0x20) && !(gSaveContext.eventInf[1] & 0x20) && func_8092CC68(globalCtx)) { + if (!(gSaveContext.save.weekEventReg[23] & 0x20) && !(gSaveContext.eventInf[1] & 0x20) && + func_8092CC68(globalCtx)) { player->stateFlags1 |= 0x20; this->unk_2C6 |= 0x100; SubS_UpdateFlags(&this->unk_2C6, 4, 7); @@ -524,7 +525,7 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { SubS_UpdateFlags(&this->unk_2C6, 3, 7); this->unk_2C6 |= (0x40 | 0x10); this->unk_2C6 |= 0x200; - if (gSaveContext.weekEventReg[9] & 0x80) { + if (gSaveContext.save.weekEventReg[9] & 0x80) { this->unk_2FC = 1; } else { this->unk_2FC = 0; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index e5733c2b16..1fdbbd32f2 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -346,7 +346,7 @@ void func_80866B20(EnDoor* this, GlobalContext* globalCtx) { Animation_PlayOnceSetSpeed(&this->skelAnime, sAnimations[this->animIndex], (player->stateFlags1 & 0x8000000) ? 0.75f : 1.5f); if (this->unk_1A6 != 0) { - gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--; + gSaveContext.save.inventory.dungeonKeys[gSaveContext.mapIndex]--; Flags_SetSwitch(globalCtx, this->switchFlag); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } @@ -366,7 +366,7 @@ void func_80866B20(EnDoor* this, GlobalContext* globalCtx) { player->doorDirection = playerPosRelToDoor.z >= 0.0f ? 1.0f : -1.0f; player->doorActor = &this->dyna.actor; if (this->unk_1A6 != 0) { - if (gSaveContext.inventory.dungeonKeys[((void)0, gSaveContext.mapIndex)] <= 0) { + if (gSaveContext.save.inventory.dungeonKeys[((void)0, gSaveContext.mapIndex)] <= 0) { player->doorType = -1; this->dyna.actor.textId = 0x1802; } else { diff --git a/src/overlays/actors/ovl_En_Drs/z_en_drs.c b/src/overlays/actors/ovl_En_Drs/z_en_drs.c index 8643dfa91a..74f4f19cc9 100644 --- a/src/overlays/actors/ovl_En_Drs/z_en_drs.c +++ b/src/overlays/actors/ovl_En_Drs/z_en_drs.c @@ -108,7 +108,7 @@ void EnDrs_PostLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Gfx** dList, V // Anju removes the Moon Mask at the start of the Couple's Mask cutscene // after that it will no longer be rendered. - if (!(gSaveContext.weekEventReg[87] & 2) && (limbIndex == WEDDING_DRESS_MANNEQUIN_LIMB_MASK)) { + if (!(gSaveContext.save.weekEventReg[87] & 2) && (limbIndex == WEDDING_DRESS_MANNEQUIN_LIMB_MASK)) { OPEN_DISPS(globalCtx->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[temp].segment); gSPDisplayList(POLY_OPA_DISP++, &gMoonMaskDL); diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 34fcedd509..782b56f7ee 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -355,8 +355,8 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx2) { this->elfMsg = NULL; this->unk_234 = NULL; this->unk_269 = 20; - if ((gSaveContext.tatlTimer >= 25800) || (gSaveContext.tatlTimer < 3000)) { - gSaveContext.tatlTimer = 0; + if ((gSaveContext.save.playerData.tatlTimer >= 25800) || (gSaveContext.save.playerData.tatlTimer < 3000)) { + gSaveContext.save.playerData.tatlTimer = 0; } this->unk_266 = ElfMessage_GetFirstCycleHint(globalCtx); break; @@ -675,7 +675,8 @@ void func_8088DD34(EnElf* this, GlobalContext* globalCtx) { !func_8088C804(&this->actor.world.pos, &refActor->actor.world.pos, 10.0f)) { func_80115908(globalCtx, 0x80); if (this->fairyFlags & 0x200) { - Parameter_AddMagic(globalCtx, ((void)0, gSaveContext.unk_3F30) + (gSaveContext.doubleMagic * 0x30) + 0x30); + Parameter_AddMagic(globalCtx, ((void)0, gSaveContext.unk_3F30) + + (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30); } gSaveContext.jinxTimer = 0; this->unk_254 = 50.0f; @@ -1414,10 +1415,10 @@ void func_8088FE64(Actor* thisx, GlobalContext* globalCtx2) { break; case 3: - if (!gSaveContext.isNight) { + if (!gSaveContext.save.isNight) { func_80151938(globalCtx, 0x248); - } else if ((gSaveContext.time < CLOCK_TIME(6, 0)) && - (gSaveContext.weekEventReg[74] & 0x20)) { + } else if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && + (gSaveContext.save.weekEventReg[74] & 0x20)) { func_80151938(globalCtx, 0x225); } else { func_80151938(globalCtx, 0x249); @@ -1454,11 +1455,11 @@ void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { if (temp_v0 != this->unk_266) { this->unk_266 = temp_v0; - gSaveContext.tatlTimer = 0; + gSaveContext.save.playerData.tatlTimer = 0; } if ((player->tatlTextId == 0) && (player->unk_730 == NULL)) { - if ((gSaveContext.tatlTimer >= 600) && (gSaveContext.tatlTimer <= 3000)) { + if ((gSaveContext.save.playerData.tatlTimer >= 600) && (gSaveContext.save.playerData.tatlTimer <= 3000)) { player->tatlTextId = ElfMessage_GetFirstCycleHint(globalCtx); } } @@ -1473,7 +1474,7 @@ void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { if (thisx->textId == ElfMessage_GetFirstCycleHint(globalCtx)) { this->fairyFlags |= 0x80; - gSaveContext.tatlTimer = 3001; + gSaveContext.save.playerData.tatlTimer = 3001; } this->fairyFlags |= 0x10; @@ -1504,10 +1505,10 @@ void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if (!func_801690CC(globalCtx)) { - if (gSaveContext.tatlTimer < 25800) { - gSaveContext.tatlTimer++; + if (gSaveContext.save.playerData.tatlTimer < 25800) { + gSaveContext.save.playerData.tatlTimer++; } else if (!(this->fairyFlags & 0x80)) { - gSaveContext.tatlTimer = 0; + gSaveContext.save.playerData.tatlTimer = 0; } } } diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index ee74750610..3acd2adf5d 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -91,7 +91,7 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->unk_147) { case ENELFGRP_1: - if (gSaveContext.weekEventReg[23] & 2) { + if (gSaveContext.save.weekEventReg[23] & 2) { func_80A396B0(this, 1); } else { this->unk_14A |= 4; @@ -99,13 +99,13 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ENELFGRP_2: - if (gSaveContext.doubleMagic == true) { + if (gSaveContext.save.playerData.doubleMagic == true) { func_80A396B0(this, 1); } break; case ENELFGRP_3: - if (gSaveContext.doubleDefense) { + if (gSaveContext.save.playerData.doubleDefense) { func_80A396B0(this, 1); } break; @@ -123,7 +123,7 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.textId = (this->unk_147 * 3) + 0x581; } else { this->actionFunc = func_80A3A8F8; - if ((gSaveContext.weekEventReg[9] & this->unk_146)) { + if ((gSaveContext.save.weekEventReg[9] & this->unk_146)) { this->actor.textId = (this->unk_147 * 3) + 0x580; } else { this->actor.textId = (this->unk_147 * 3) + 0x57F; @@ -146,7 +146,7 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_14A |= 2; func_80A396B0(this, 6); } - } else if ((gSaveContext.weekEventReg[8] & 0x80)) { + } else if ((gSaveContext.save.weekEventReg[8] & 0x80)) { func_80A39DC8(this, globalCtx, 24, 0); this->actionFunc = func_80A3A398; if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) { @@ -156,13 +156,13 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A396B0(this, 3); this->unk_14A |= 2; } - } else if (gSaveContext.magicAcquired == true) { + } else if (gSaveContext.save.playerData.magicAcquired == true) { func_80A396B0(this, 1); } } else { func_80A39DC8(this, globalCtx, 24, 0); this->actionFunc = func_80A3A8F8; - if ((gSaveContext.weekEventReg[9] & this->unk_146)) { + if ((gSaveContext.save.weekEventReg[9] & this->unk_146)) { this->actor.textId = 0x580; } else { this->actor.textId = 0x578; @@ -183,7 +183,7 @@ s32 func_80A39BD0(GlobalContext* globalCtx, s32 arg2) { return 0; } - sp1F = gSaveContext.inventory.strayFairies[arg2 - 1]; + sp1F = gSaveContext.save.inventory.strayFairies[arg2 - 1]; return (sp1F - func_80A39C1C(globalCtx, arg2)) + 10; } @@ -208,13 +208,13 @@ s32 func_80A39C1C(GlobalContext* globalCtx, s32 arg1) { } if (arg1 == 0) { - if (gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1) { + if (gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1) { return 25; } return 24; } - temp_v1 = (gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; + temp_v1 = (gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; if (temp_v1 < 10) { temp_v1 = 10; } else if (temp_v1 > 25) { @@ -230,13 +230,13 @@ void func_80A39CD4(GlobalContext* globalCtx, s32 arg1, s32 arg2) { if (arg1 == 0) { if (arg2 == 25) { - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 1; + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 1; } else { - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~1; + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~1; } } else { - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= arg2 << ((arg1 * 5) - 4); + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= arg2 << ((arg1 * 5) - 4); } } @@ -425,7 +425,7 @@ void func_80A3A398(EnElfgrp* this, GlobalContext* globalCtx) { } if ((this->unk_14A & 4) != 0) { - gSaveContext.weekEventReg[23] |= 2; + gSaveContext.save.weekEventReg[23] |= 2; } if (this->unk_14A & 0x10) { @@ -481,7 +481,8 @@ void func_80A3A610(EnElfgrp* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (this->unk_144 == 60) { - Parameter_AddMagic(globalCtx, ((void)0, gSaveContext.unk_3F30) + (gSaveContext.doubleMagic * 0x30) + 0x30); + Parameter_AddMagic(globalCtx, + ((void)0, gSaveContext.unk_3F30) + (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30); gSaveContext.healthAccumulator = 320; } @@ -526,7 +527,7 @@ void func_80A3A7FC(EnElfgrp* this, GlobalContext* globalCtx) { s32 temp_s0; if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - gSaveContext.weekEventReg[9] |= this->unk_146; + gSaveContext.save.weekEventReg[9] |= this->unk_146; this->actionFunc = func_80A3A6F4; temp_s0 = func_80A39BD0(globalCtx, this->unk_147); func_80A39DC8(this, globalCtx, temp_s0, 1); @@ -546,7 +547,7 @@ void func_80A3A8F8(EnElfgrp* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - gSaveContext.weekEventReg[9] |= this->unk_146; + gSaveContext.save.weekEventReg[9] |= this->unk_146; this->actionFunc = func_80A3A6F4; return; } @@ -559,13 +560,13 @@ void func_80A3A8F8(EnElfgrp* this, GlobalContext* globalCtx) { } if (this->actor.xzDistToPlayer < 30.0f) { - if (gSaveContext.playerForm == PLAYER_FORM_DEKU) { + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { this->actor.flags &= ~ACTOR_FLAG_10000; player->actor.freezeTimer = 100; player->stateFlags1 |= 0x20000000; Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); this->actionFunc = func_80A3A77C; - gSaveContext.weekEventReg[9] |= this->unk_146; + gSaveContext.save.weekEventReg[9] |= this->unk_146; } else { this->actor.flags |= ACTOR_FLAG_10000; func_800B8614(&this->actor, globalCtx, 100.0f); diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 3c263c0182..36ad91c0fb 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -81,7 +81,7 @@ void EnElforg_Init(Actor* thisx, GlobalContext* globalCtx) { switch (STRAY_FAIRY_TYPE(&this->actor)) { case STRAY_FAIRY_TYPE_CLOCK_TOWN: - if (gSaveContext.weekEventReg[8] & 0x80) { + if (gSaveContext.save.weekEventReg[8] & 0x80) { Actor_MarkForDeath(&this->actor); return; } @@ -364,7 +364,7 @@ void EnElforg_CirclePlayer(EnElforg* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); f32 distanceFromPlayer; - if (gSaveContext.playerForm == PLAYER_FORM_GORON) { + if (gSaveContext.save.playerForm == PLAYER_FORM_GORON) { distanceFromPlayer = 40.0f; } else { distanceFromPlayer = 20.0f; @@ -407,7 +407,7 @@ void EnElforg_ClockTownFairyCollected(EnElforg* this, GlobalContext* globalCtx) player->actor.freezeTimer = 0; player->stateFlags1 &= ~0x20000000; Actor_MarkForDeath(&this->actor); - gSaveContext.weekEventReg[8] |= 0x80; + gSaveContext.save.weekEventReg[8] |= 0x80; ActorCutscene_Stop(0x7C); } else { func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); @@ -463,9 +463,9 @@ void EnElforg_FreeFloating(EnElforg* this, GlobalContext* globalCtx) { } if (func_8010A074(globalCtx)) { - gSaveContext.inventory.strayFairies[gSaveContext.unk_48C8]++; + gSaveContext.save.inventory.strayFairies[gSaveContext.unk_48C8]++; Message_StartTextbox(globalCtx, 0x11, NULL); - if (gSaveContext.inventory.strayFairies[(void)0, gSaveContext.unk_48C8] >= 15) { + if (gSaveContext.save.inventory.strayFairies[(void)0, gSaveContext.unk_48C8] >= 15) { func_801A3098(NA_BGM_GET_ITEM | 0x900); } } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index 8c7f291ce5..dabd62e0fa 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -77,7 +77,7 @@ const ActorInit En_Fall_InitVars = { * it also moves the moon closer to the ground depending on the current time. */ void EnFall_Moon_AdjustScaleAndPosition(EnFall* this, GlobalContext* globalCtx) { - u16 currentTime = gSaveContext.time; + u16 currentTime = gSaveContext.save.time; u16 dayStartTime = this->dayStartTime; f32 finalDayRelativeHeight; @@ -218,7 +218,7 @@ void EnFall_Setup(EnFall* this, GlobalContext* globalCtx) { this->actor.draw = EnFall_Moon_Draw; this->actionFunc = EnFall_StoppedClosedMouthMoon_PerformCutsceneActions; Actor_SetScale(&this->actor, this->scale * 3.0f); - if (!(gSaveContext.weekEventReg[25] & 2)) { + if (!(gSaveContext.save.weekEventReg[25] & 2)) { Actor_MarkForDeath(&this->actor); } break; @@ -227,7 +227,7 @@ void EnFall_Setup(EnFall* this, GlobalContext* globalCtx) { this->actionFunc = EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions; Actor_SetScale(&this->actor, this->scale * 3.0f); this->actor.draw = EnFall_Moon_Draw; - if (gSaveContext.weekEventReg[25] & 2) { + if (gSaveContext.save.weekEventReg[25] & 2) { Actor_MarkForDeath(&this->actor); } break; @@ -325,7 +325,7 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, GlobalContext* globa case 2: if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA) && CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { - if (gSaveContext.weekEventReg[93] & 4) { + if (gSaveContext.save.weekEventReg[93] & 4) { if (ActorCutscene_GetCanPlayNext(0xC)) { ActorCutscene_Start(0xC, &this->actor); sGiantsCutsceneState++; @@ -334,7 +334,7 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, GlobalContext* globa } } else if (ActorCutscene_GetCanPlayNext(0xB)) { ActorCutscene_Start(0xB, &this->actor); - gSaveContext.weekEventReg[93] |= 4; + gSaveContext.save.weekEventReg[93] |= 4; sGiantsCutsceneState++; } else { ActorCutscene_SetIntentToPlay(0xB); @@ -481,7 +481,7 @@ void EnFall_Moon_PerformDefaultActions(EnFall* this, GlobalContext* globalCtx) { currentDay = CURRENT_DAY; if ((u16)this->currentDay != (u32)currentDay) { this->currentDay = currentDay; - this->dayStartTime = gSaveContext.time; + this->dayStartTime = gSaveContext.save.time; } EnFall_Moon_AdjustScaleAndPosition(this, globalCtx); } @@ -518,8 +518,8 @@ void EnFall_MoonsTear_Fall(EnFall* this, GlobalContext* globalCtx) { if (this->actor.draw != NULL) { if (Math_Vec3f_StepTo(&this->actor.world.pos, &this->actor.home.pos, this->actor.speedXZ) <= 0.0f) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_BOUND_1); - gSaveContext.weekEventReg[74] |= 0x80; - gSaveContext.weekEventReg[74] |= 0x20; + gSaveContext.save.weekEventReg[74] |= 0x80; + gSaveContext.save.weekEventReg[74] |= 0x20; Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, -2); Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index d20b828653..f86cda7d85 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -161,27 +161,27 @@ void EnFish2_Init(Actor* thisx, GlobalContext* globalCtx) { this->jointTable, this->morphTable, 24); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if (this->unk_344 == 0) { - if (gSaveContext.weekEventReg[81] & 0x10) { + if (gSaveContext.save.weekEventReg[81] & 0x10) { this->unk_2C0 = 1; } - if (gSaveContext.weekEventReg[81] & 0x20) { + if (gSaveContext.save.weekEventReg[81] & 0x20) { this->unk_2C0 = 2; } - if (gSaveContext.weekEventReg[81] & 0x40) { + if (gSaveContext.save.weekEventReg[81] & 0x40) { this->unk_2C0 = 3; } } else { - if (gSaveContext.weekEventReg[81] & 0x80) { + if (gSaveContext.save.weekEventReg[81] & 0x80) { this->unk_2C0 = 1; } - if (gSaveContext.weekEventReg[82] & 1) { + if (gSaveContext.save.weekEventReg[82] & 1) { this->unk_2C0 = 2; } - if (gSaveContext.weekEventReg[82] & 2) { + if (gSaveContext.save.weekEventReg[82] & 2) { this->unk_2C0 = 3; } } @@ -619,18 +619,18 @@ void func_80B297FC(EnFish2* this, GlobalContext* globalCtx) { this->unk_2C0++; if (this->unk_344 == 0) { if (this->unk_2C0 == 1) { - gSaveContext.weekEventReg[81] |= 0x10; + gSaveContext.save.weekEventReg[81] |= 0x10; } else if (this->unk_2C0 == 2) { - gSaveContext.weekEventReg[81] |= 0x20; + gSaveContext.save.weekEventReg[81] |= 0x20; } else if (this->unk_2C0 == 3) { - gSaveContext.weekEventReg[81] |= 0x40; + gSaveContext.save.weekEventReg[81] |= 0x40; } } else if (this->unk_2C0 == 1) { - gSaveContext.weekEventReg[81] |= 0x80; + gSaveContext.save.weekEventReg[81] |= 0x80; } else if (this->unk_2C0 == 2) { - gSaveContext.weekEventReg[82] |= 1; + gSaveContext.save.weekEventReg[82] |= 1; } else if (this->unk_2C0 == 3) { - gSaveContext.weekEventReg[82] |= 2; + gSaveContext.save.weekEventReg[82] |= 2; } if (this->unk_2B0 != 0) { @@ -890,12 +890,12 @@ void func_80B2A498(EnFish2* this, GlobalContext* globalCtx) { temp_v0->speedXZ = 4.0f; temp_v0->velocity.y = 15.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); - gSaveContext.weekEventReg[81] &= (u8)~0x10; - gSaveContext.weekEventReg[81] &= (u8)~0x20; - gSaveContext.weekEventReg[81] &= (u8)~0x40; - gSaveContext.weekEventReg[81] &= (u8)~0x80; - gSaveContext.weekEventReg[82] &= (u8)~1; - gSaveContext.weekEventReg[82] &= (u8)~2; + gSaveContext.save.weekEventReg[81] &= (u8)~0x10; + gSaveContext.save.weekEventReg[81] &= (u8)~0x20; + gSaveContext.save.weekEventReg[81] &= (u8)~0x40; + gSaveContext.save.weekEventReg[81] &= (u8)~0x80; + gSaveContext.save.weekEventReg[82] &= (u8)~1; + gSaveContext.save.weekEventReg[82] &= (u8)~2; } } diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 9bf1643b23..eccee0fe9f 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -119,86 +119,86 @@ typedef struct { #define LINE_SEG_COUNT 200 #define SINKING_LURE_SEG_COUNT 20 -static f32 D_809101B0; -static f32 D_809101B4; -static s16 D_809101B8; -static f32 D_809101BC; -static f32 D_809101C0; -static f32 D_809101C4; -static f32 D_809101C8; -static s16 D_809101CC; -static f32 D_809101D0; -static Vec3f sRodTipPos; -static Vec3f sReelLinePos[LINE_SEG_COUNT]; -static Vec3f sReelLineRot[LINE_SEG_COUNT]; -static Vec3f sReelLineUnk[LINE_SEG_COUNT]; -static Vec3f sLureHookRefPos[2]; -static f32 sLureHookRotY[2]; -static u8 D_80911E28; -static Vec3f sSinkingLurePos[SINKING_LURE_SEG_COUNT]; -static s16 D_80911F20; -static f32 sProjectedW; -static Vec3f sCameraEye; -static Vec3f sCameraAt; -static s16 sCameraId; -static f32 D_80911F48; -static f32 D_80911F4C; -static f32 D_80911F50; -static Vec3f sSinkingLureBasePos; -static f32 D_80911F64; -static s32 sRandSeed0; -static s32 sRandSeed1; -static s32 sRandSeed2; -static FishingProp sPondProps[POND_PROP_COUNT]; -static FishingGroupFish sGroupFishes[GROUP_FISH_COUNT]; -static f32 sFishGroupAngle1; -static f32 sFishGroupAngle2; -static f32 sFishGroupAngle3; -static FishingEffect sFishingEffects[EFFECT_COUNT]; -static Vec3f sStreamSoundProjectedPos; -static EnFishing* sFishingMain; -static u8 D_809171C8; -static u8 sLinkAge; -static u8 D_809171CA; -static u8 D_809171CB; -static f32 D_809171CC; -static u8 D_809171D0; -static u8 D_809171D1; -static u8 D_809171D2; -static s16 D_809171D4; -static u8 D_809171D6; -static u16 D_809171D8; -static u16 D_809171DA; -static s8 D_809171DC; -static Vec3f sOwnerHeadPos; -static Vec3s sEffOwnerHatRot; -static u8 D_809171F2; -static s16 D_809171F4; -static s16 D_809171F6; -static EnFishing* sFishingHookedFish; -static s16 D_809171FC; -static s16 D_809171FE; -static s16 D_80917200; -static s16 D_80917202; -static s16 D_80917204; -static u8 D_80917206; -static Vec3f sLurePos; -static Vec3f D_80917218; -static Vec3f sLureRot; -static Vec3f D_80917238; -static Vec3f D_80917248; -static f32 D_80917254; -static f32 D_80917258; -static f32 D_8091725C; -static f32 D_80917260; -static s8 D_80917264; -static s16 D_80917266; -static u8 D_80917268; -static f32 D_8091726C; -static u8 D_80917270; -static s16 D_80917272; -static u8 D_80917274; -static Vec3f D_80917278; +f32 D_809101B0; +f32 D_809101B4; +s16 D_809101B8; +f32 D_809101BC; +f32 D_809101C0; +f32 D_809101C4; +f32 D_809101C8; +s16 D_809101CC; +f32 D_809101D0; +Vec3f sRodTipPos; +Vec3f sReelLinePos[LINE_SEG_COUNT]; +Vec3f sReelLineRot[LINE_SEG_COUNT]; +Vec3f sReelLineUnk[LINE_SEG_COUNT]; +Vec3f sLureHookRefPos[2]; +f32 sLureHookRotY[2]; +u8 D_80911E28; +Vec3f sSinkingLurePos[SINKING_LURE_SEG_COUNT]; +s16 D_80911F20; +f32 sProjectedW; +Vec3f sCameraEye; +Vec3f sCameraAt; +s16 sCameraId; +f32 D_80911F48; +f32 D_80911F4C; +f32 D_80911F50; +Vec3f sSinkingLureBasePos; +f32 D_80911F64; +s32 sRandSeed0; +s32 sRandSeed1; +s32 sRandSeed2; +FishingProp sPondProps[POND_PROP_COUNT]; +FishingGroupFish sGroupFishes[GROUP_FISH_COUNT]; +f32 sFishGroupAngle1; +f32 sFishGroupAngle2; +f32 sFishGroupAngle3; +FishingEffect sFishingEffects[EFFECT_COUNT]; +Vec3f sStreamSoundProjectedPos; +EnFishing* sFishingMain; +u8 D_809171C8; +u8 sLinkAge; +u8 D_809171CA; +u8 D_809171CB; +f32 D_809171CC; +u8 D_809171D0; +u8 D_809171D1; +u8 D_809171D2; +s16 D_809171D4; +u8 D_809171D6; +u16 D_809171D8; +u16 D_809171DA; +s8 D_809171DC; +Vec3f sOwnerHeadPos; +Vec3s sEffOwnerHatRot; +u8 D_809171F2; +s16 D_809171F4; +s16 D_809171F6; +EnFishing* sFishingHookedFish; +s16 D_809171FC; +s16 D_809171FE; +s16 D_80917200; +s16 D_80917202; +s16 D_80917204; +u8 D_80917206; +Vec3f sLurePos; +Vec3f D_80917218; +Vec3f sLureRot; +Vec3f D_80917238; +Vec3f D_80917248; +f32 D_80917254; +f32 D_80917258; +f32 D_8091725C; +f32 D_80917260; +s8 D_80917264; +s16 D_80917266; +u8 D_80917268; +f32 D_8091726C; +u8 D_80917270; +s16 D_80917272; +u8 D_80917274; +Vec3f D_80917278; const ActorInit En_Fishing_InitVars = { ACTOR_EN_FISHING, @@ -212,38 +212,38 @@ const ActorInit En_Fishing_InitVars = { (ActorFunc)EnFishing_DrawFish, }; -static f32 D_8090CCD0 = 0.0f; -static u8 D_8090CCD4 = 0; -static f32 D_8090CCD8 = 0.0f; -static Vec3f D_8090CCDC = { 0.0f, 0.0f, 0.0f }; -static f32 D_8090CCE8 = 0.0f; -static u8 sSinkingLureLocation = 0; -static f32 D_8090CCF0 = 0.0f; -static u8 D_8090CCF4 = true; -static u16 D_8090CCF8 = 0; -static u8 D_8090CCFC = 0; -static s32 D_8090CD00 = 0; -static s16 D_8090CD04 = 0; -static u8 D_8090CD08 = 0; -static u8 D_8090CD0C = 0; -static u8 D_8090CD10 = 0; -static s16 D_8090CD14 = 0; -static Vec3f sFishMouthOffset = { 500.0f, 500.0f, 0.0f }; -static u8 D_8090CD24 = 0; -static f32 D_8090CD28 = 0; -static f32 D_8090CD2C = 0; -static f32 D_8090CD30 = 0.0f; -static f32 D_8090CD34 = 0.0f; -static f32 D_8090CD38 = 0.0f; -static f32 D_8090CD3C = 0.0f; -static f32 D_8090CD40 = 0.0f; -static s16 D_8090CD44 = 0; -static s16 D_8090CD48 = 0; -static u8 D_8090CD4C = 0; -static u8 D_8090CD50 = 0; -static u8 D_8090CD54 = 0; +f32 D_8090CCD0 = 0.0f; +u8 D_8090CCD4 = 0; +f32 D_8090CCD8 = 0.0f; +Vec3f D_8090CCDC = { 0.0f, 0.0f, 0.0f }; +f32 D_8090CCE8 = 0.0f; +u8 sSinkingLureLocation = 0; +f32 D_8090CCF0 = 0.0f; +u8 D_8090CCF4 = true; +u16 D_8090CCF8 = 0; +u8 D_8090CCFC = 0; +s32 D_8090CD00 = 0; +s16 D_8090CD04 = 0; +u8 D_8090CD08 = 0; +u8 D_8090CD0C = 0; +u8 D_8090CD10 = 0; +s16 D_8090CD14 = 0; +Vec3f sFishMouthOffset = { 500.0f, 500.0f, 0.0f }; +u8 D_8090CD24 = 0; +f32 D_8090CD28 = 0; +f32 D_8090CD2C = 0; +f32 D_8090CD30 = 0.0f; +f32 D_8090CD34 = 0.0f; +f32 D_8090CD38 = 0.0f; +f32 D_8090CD3C = 0.0f; +f32 D_8090CD40 = 0.0f; +s16 D_8090CD44 = 0; +s16 D_8090CD48 = 0; +u8 D_8090CD4C = 0; +u8 D_8090CD50 = 0; +u8 D_8090CD54 = 0; -static ColliderJntSphElementInit sJntSphElementsInit[12] = { +static ColliderJntSphElementInit sJntSphElementsInit[] = { { { ELEMTYPE_UNK0, @@ -387,13 +387,13 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 12, + ARRAY_COUNT(sJntSphElementsInit), sJntSphElementsInit, }; -static u8 D_8090CF18 = 0; +u8 D_8090CF18 = 0; static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; -static Vec3f D_8090CF28 = { 0.0f, 0.0f, 2000.0f }; // Unused +Vec3f D_8090CF28 = { 0.0f, 0.0f, 2000.0f }; // Unused void EnFishing_SetColliderElement(s32 index, ColliderJntSph* collider, Vec3f* pos, f32 scale) { collider->elements[index].dim.worldSphere.center.x = pos->x; @@ -580,7 +580,7 @@ void EnFishing_SpawnRainDrop(FishingEffect* effect, Vec3f* pos, Vec3f* rot) { } } -static FishingPropInit sPondPropInits[POND_PROP_COUNT + 1] = { +FishingPropInit sPondPropInits[POND_PROP_COUNT + 1] = { { FS_PROP_ROCK, { 529, -53, -498 } }, { FS_PROP_ROCK, { 461, -66, -480 } }, { FS_PROP_ROCK, { 398, -73, -474 } }, @@ -780,7 +780,7 @@ void EnFishing_InitPondProps(EnFishing* this, GlobalContext* globalCtx) { } } -static FishingFishInit sFishInits[] = { +FishingFishInit sFishInits[] = { { 0, { 666, -45, 354 }, 38, 0.1f }, { 0, { 681, -45, 240 }, 36, 0.1f }, { 0, { 670, -45, 90 }, 41, 0.05f }, { 0, { 615, -45, -450 }, 35, 0.2f }, { 0, { 500, -45, -420 }, 39, 0.1f }, { 0, { 420, -45, -550 }, 44, 0.05f }, { 0, { -264, -45, -640 }, 40, 0.1f }, { 0, { -470, -45, -540 }, 34, 0.2f }, { 0, { -557, -45, -430 }, 54, 0.01f }, @@ -802,7 +802,7 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); - sLinkAge = gSaveContext.linkAge; + sLinkAge = gSaveContext.save.linkAge; if (thisx->params < 100) { s16 i; @@ -834,7 +834,7 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { if (sLinkAge != 1) { // HIGH_SCORE(HS_FISHING) from OoT - if (gSaveContext.unk_EE4 & 0x1000) { + if (gSaveContext.save.unk_EE4 & 0x1000) { D_8090CD08 = 0; } else { D_8090CD08 = 1; @@ -852,18 +852,18 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { Audio_QueueSeqCmd(0x100100FF); if (sLinkAge == 1) { - if (gSaveContext.unk_EE4 & 0x7F) { - D_809171CC = gSaveContext.unk_EE4 & 0x7F; + if (gSaveContext.save.unk_EE4 & 0x7F) { + D_809171CC = gSaveContext.save.unk_EE4 & 0x7F; } else { D_809171CC = 40.0f; } - } else if (gSaveContext.unk_EE4 & 0x7F000000) { - D_809171CC = (gSaveContext.unk_EE4 & 0x7F000000) >> 0x18; + } else if (gSaveContext.save.unk_EE4 & 0x7F000000) { + D_809171CC = (gSaveContext.save.unk_EE4 & 0x7F000000) >> 0x18; } else { D_809171CC = 45.0f; } - D_809171D1 = (gSaveContext.unk_EE4 & 0xFF0000) >> 0x10; + D_809171D1 = (gSaveContext.save.unk_EE4 & 0xFF0000) >> 0x10; if ((D_809171D1 & 7) == 7) { globalCtx->roomCtx.unk7A[0] = 90; D_809171CA = 1; @@ -1700,7 +1700,7 @@ void EnFishing_UpdateSinkingLure(GlobalContext* globalCtx) { } } -static f32 sSinkingLureSizes[] = { +f32 sSinkingLureSizes[] = { 1.0f, 1.5f, 1.8f, 2.0f, 1.8f, 1.6f, 1.4f, 1.2f, 1.0f, 1.0f, 0.9f, 0.85f, 0.8f, 0.7f, 0.8f, 1.0f, 1.2f, 1.1f, 1.0f, 0.8f, }; @@ -1905,18 +1905,18 @@ void EnFishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* CLOSE_DISPS(globalCtx->state.gfxCtx); } -static f32 sRodScales[22] = { +f32 sRodScales[22] = { 1.0f, 1.0f, 1.0f, 0.9625f, 0.925f, 0.8875f, 0.85f, 0.8125f, 0.775f, 0.73749995f, 0.7f, 0.6625f, 0.625f, 0.5875f, 0.54999995f, 0.5125f, 0.47499996f, 0.4375f, 0.39999998f, 0.36249995f, 0.325f, 0.28749996f, }; -static f32 sRodBendRatios[22] = { +f32 sRodBendRatios[22] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.06f, 0.12f, 0.18f, 0.24f, 0.30f, 0.36f, 0.42f, 0.48f, 0.54f, 0.60f, 0.60f, 0.5142f, 0.4285f, 0.3428f, 0.2571f, 0.1714f, 0.0857f, }; -static Vec3f sRodTipOffset = { 0.0f, 0.0f, 0.0f }; +Vec3f sRodTipOffset = { 0.0f, 0.0f, 0.0f }; void EnFishing_DrawRod(GlobalContext* globalCtx) { s16 i; @@ -2057,7 +2057,7 @@ void EnFishing_DrawRod(GlobalContext* globalCtx) { CLOSE_DISPS(globalCtx->state.gfxCtx); } -static Vec3f D_8090D614 = { 0.0f, 0.0f, 0.0f }; +Vec3f D_8090D614 = { 0.0f, 0.0f, 0.0f }; void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { f32 spE4; @@ -2801,8 +2801,8 @@ void func_80903C60(EnFishing* this, u8 arg1) { void EnFishing_HandleAquariumDialog(EnFishing* this, GlobalContext* globalCtx) { if (sLinkAge == 1) { - if (gSaveContext.unk_EE4 & 0x7F) { - if (gSaveContext.unk_EE4 & 0x80) { + if (gSaveContext.save.unk_EE4 & 0x7F) { + if (gSaveContext.save.unk_EE4 & 0x80) { this->actor.textId = 0x40B1; } else { this->actor.textId = 0x4089; @@ -2810,8 +2810,8 @@ void EnFishing_HandleAquariumDialog(EnFishing* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x40AE; } - } else if (gSaveContext.unk_EE4 & 0x7F000000) { - if (gSaveContext.unk_EE4 & 0x80000000) { + } else if (gSaveContext.save.unk_EE4 & 0x7F000000) { + if (gSaveContext.save.unk_EE4 & 0x80000000) { this->actor.textId = 0x40B1; } else { this->actor.textId = 0x4089; @@ -3065,11 +3065,11 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } if (Message_GetState(&globalCtx->msgCtx) == 0) { - if ((gSaveContext.time >= 0xC000) && (gSaveContext.time <= 0xC01B)) { + if ((gSaveContext.save.time >= CLOCK_TIME(18, 0)) && (gSaveContext.save.time <= 0xC01B)) { this->unk_150 = 7; this->unk_172[3] = Rand_ZeroFloat(150.0f) + 200.0f; } - if ((gSaveContext.time >= 0x3AAA) && (gSaveContext.time <= 0x3AC5)) { + if ((gSaveContext.save.time >= CLOCK_TIME(5, 30)) && (gSaveContext.save.time <= 0x3AC5)) { this->unk_150 = 7; this->unk_172[3] = Rand_ZeroFloat(150.0f) + 200.0f; } @@ -3313,9 +3313,9 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { multiplier = 1.0f; } - if ((gSaveContext.time >= 0xB555) && (gSaveContext.time <= 0xCAAA)) { + if ((gSaveContext.save.time >= 0xB555) && (gSaveContext.save.time <= 0xCAAA)) { multiplier *= 1.75f; - } else if ((gSaveContext.time >= 0x3555) && (gSaveContext.time <= 0x4AAA)) { + } else if ((gSaveContext.save.time >= 0x3555) && (gSaveContext.save.time <= 0x4AAA)) { multiplier *= 1.5f; } else if (D_809171CA != 0) { multiplier *= 1.5f; @@ -3752,8 +3752,8 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { if ((D_80917272 == 0) && (D_80917274 == 0)) { // Assignment of OoT's D_80B7E086 here removed in MM - if (((sLinkAge == 1) && (gSaveContext.unk_EE4 & 0x400)) || - ((sLinkAge != 1) && (gSaveContext.unk_EE4 & 0x800))) { + if (((sLinkAge == 1) && (gSaveContext.save.unk_EE4 & 0x400)) || + ((sLinkAge != 1) && (gSaveContext.save.unk_EE4 & 0x800))) { // Assignment of OoT's D_80B7A67C here removed in MM, this is now an empty branch } } else { @@ -4685,14 +4685,14 @@ void EnFishing_DrawGroupFishes(GlobalContext* globalCtx) { CLOSE_DISPS(globalCtx->state.gfxCtx); } -static u16 D_8090D638[] = { 0x4096, 0x408D, 0x408E, 0x408F, 0x4094, 0x4095 }; +u16 D_8090D638[] = { 0x4096, 0x408D, 0x408E, 0x408F, 0x4094, 0x4095 }; void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { switch (this->unk_154) { case 0: if (D_809171FC == 0) { if (sLinkAge != 1) { - if ((gSaveContext.unk_EE4 & 0x100) && !(gSaveContext.unk_EE4 & 0x200)) { + if ((gSaveContext.save.unk_EE4 & 0x100) && !(gSaveContext.save.unk_EE4 & 0x200)) { this->actor.textId = 0x4093; } else { this->actor.textId = 0x407B; @@ -4710,9 +4710,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { if (D_809171FC == 0) { this->unk_154 = 1; if (sLinkAge != 1) { - gSaveContext.unk_EE4 |= 0x200; + gSaveContext.save.unk_EE4 |= 0x200; } else { - gSaveContext.unk_EE4 |= 0x100; + gSaveContext.save.unk_EE4 |= 0x100; } } else { this->unk_154 = 10; @@ -4728,7 +4728,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { switch (globalCtx->msgCtx.choiceIndex) { case 0: - if (gSaveContext.rupees >= 20) { + if (gSaveContext.save.playerData.rupees >= 20) { func_801159EC(-20); if (func_8013EE04() == 0) { this->actor.textId = 0x407C; @@ -4795,8 +4795,8 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { D_8090CD04 = 20; this->unk_154 = 0; - if ((gSaveContext.unk_EE4 & 0xFF0000) < 0xFF0000) { - gSaveContext.unk_EE4 += 0x10000; + if ((gSaveContext.save.unk_EE4 & 0xFF0000) < 0xFF0000) { + gSaveContext.save.unk_EE4 += 0x10000; } } break; @@ -4904,30 +4904,29 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { if (sLinkAge == 1) { f32 temp; - gSaveContext.unk_EE4 &= 0xFFFFFF00; - gSaveContext.unk_EE4 |= ((s16)D_809171CC & 0x7F); - - temp = (gSaveContext.unk_EE4 & 0x7F000000) >> 0x18; + gSaveContext.save.unk_EE4 &= 0xFFFFFF00; + gSaveContext.save.unk_EE4 |= ((s16)D_809171CC & 0x7F); + temp = (gSaveContext.save.unk_EE4 & 0x7F000000) >> 0x18; if (temp < D_809171CC) { - gSaveContext.unk_EE4 &= 0xFFFFFF; - gSaveContext.unk_EE4 |= ((s16)D_809171CC & 0x7F) << 0x18; + gSaveContext.save.unk_EE4 &= 0xFFFFFF; + gSaveContext.save.unk_EE4 |= ((s16)D_809171CC & 0x7F) << 0x18; if (D_809171D2 == 2) { - gSaveContext.unk_EE4 |= 0x80000000; + gSaveContext.save.unk_EE4 |= 0x80000000; } } if (D_809171D2 == 2) { - gSaveContext.unk_EE4 |= 0x80; + gSaveContext.save.unk_EE4 |= 0x80; this->unk_154 = 0; break; } } else { - gSaveContext.unk_EE4 &= 0xFFFFFF; - gSaveContext.unk_EE4 |= ((s16)D_809171CC & 0x7F) << 0x18; + gSaveContext.save.unk_EE4 &= 0xFFFFFF; + gSaveContext.save.unk_EE4 |= ((s16)D_809171CC & 0x7F) << 0x18; if (D_809171D2 == 2) { - gSaveContext.unk_EE4 |= 0x80000000; + gSaveContext.save.unk_EE4 |= 0x80000000; this->unk_154 = 0; break; } @@ -4944,14 +4943,14 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { } if (sLinkAge == 1) { - if ((D_809171CC >= 50.0f) && !(gSaveContext.unk_EE4 & 0x400)) { - gSaveContext.unk_EE4 |= 0x400; + if ((D_809171CC >= 50.0f) && !(gSaveContext.save.unk_EE4 & 0x400)) { + gSaveContext.save.unk_EE4 |= 0x400; getItemId = GI_HEART_PIECE; sSinkingLureLocation = Rand_ZeroFloat(3.999f) + 1.0f; } } else { - if ((D_809171CC >= 60.0f) && !(gSaveContext.unk_EE4 & 0x800)) { - gSaveContext.unk_EE4 |= 0x800; + if ((D_809171CC >= 60.0f) && !(gSaveContext.save.unk_EE4 & 0x800)) { + gSaveContext.save.unk_EE4 |= 0x800; getItemId = GI_SCALE_GOLD; sSinkingLureLocation = Rand_ZeroFloat(3.999f) + 1.0f; } @@ -5029,11 +5028,11 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { } } -static s16 D_8090D644[] = { 0, 1, 2, 2, 1 }; +s16 D_8090D644[] = { 0, 1, 2, 2, 1 }; -static Vec3f sStreamSoundPos = { 670.0f, 0.0f, -600.0f }; +Vec3f sStreamSoundPos = { 670.0f, 0.0f, -600.0f }; -static Vec3s sSinkingLureLocationPos[] = { +Vec3s sSinkingLureLocationPos[] = { { -364, -30, -269 }, { 1129, 3, -855 }, { -480, 0, -1055 }, @@ -5114,9 +5113,9 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } if (D_8090CD08 == 0) { - gSaveContext.unk_EE4 |= 0x1000; + gSaveContext.save.unk_EE4 |= 0x1000; } else if (D_8090CD08 == 1) { - gSaveContext.unk_EE4 &= ~0x1000; + gSaveContext.save.unk_EE4 &= ~0x1000; } if (D_8090CCFC != 0) { @@ -5579,7 +5578,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Audio_PlaySfxAtPos(&sStreamSoundProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG); - if (gSaveContext.language == 0) { // Added in MM + if (gSaveContext.options.language == 0) { // Added in MM gSaveContext.minigameScore = D_8090CCF8; } else { gSaveContext.minigameScore = (SQ((f32)D_8090CCF8) * 0.0036f) + 0.5f; @@ -5613,10 +5612,10 @@ void EnFishing_OwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** } } -static UNK_TYPE sFishingOwnerEyeTexs[] = { - &gFishingOwnerEyeOpenTex, - &gFishingOwnerEyeHalfTex, - &gFishingOwnerEyeClosedTex, +TexturePtr sFishingOwnerEyeTexs[] = { + gFishingOwnerEyeOpenTex, + gFishingOwnerEyeHalfTex, + gFishingOwnerEyeClosedTex, }; void EnFishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 12ac7cdf40..ce5928004e 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -721,7 +721,7 @@ void func_808D217C(EnFloormas* this, Player* player) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; func_808D08D0(this); - playerForm = gSaveContext.playerForm; + playerForm = gSaveContext.save.playerForm; ptr = &D_808D3900[playerForm]; this->actor.home.pos.x = ptr->z * Math_SinS(this->actor.shape.rot.y); this->actor.home.pos.y = CLAMP(-this->actor.playerHeightRel, ptr->x, ptr->y); diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index 2cef9e38e3..a69730bed0 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -153,7 +153,7 @@ u16 EnFsn_GetWelcome(GlobalContext* globalCtx) { void EnFsn_HandleConversationBackroom(EnFsn* this, GlobalContext* globalCtx) { switch (this->textId) { case 0: - if (!(gSaveContext.weekEventReg[80] & 0x10)) { + if (!(gSaveContext.save.weekEventReg[80] & 0x10)) { this->textId = 0x29E0; break; } else { @@ -166,7 +166,7 @@ void EnFsn_HandleConversationBackroom(EnFsn* this, GlobalContext* globalCtx) { this->flags |= ENFSN_GIVE_ITEM; this->flags |= ENFSN_GAVE_LETTER_TO_MAMA; this->getItemId = GI_LETTER_TO_MAMA; - gSaveContext.weekEventReg[80] |= 0x10; + gSaveContext.save.weekEventReg[80] |= 0x10; this->textId = 0x29F1; break; } else { @@ -186,7 +186,7 @@ void EnFsn_HandleConversationBackroom(EnFsn* this, GlobalContext* globalCtx) { this->flags |= ENFSN_GIVE_ITEM; this->flags |= ENFSN_GAVE_LETTER_TO_MAMA; this->getItemId = GI_LETTER_TO_MAMA; - gSaveContext.weekEventReg[80] |= 0x10; + gSaveContext.save.weekEventReg[80] |= 0x10; this->textId = 0x29F1; break; case 0x29F1: @@ -301,8 +301,8 @@ void EnFsn_CursorLeftRight(EnFsn* this) { } s16 EnFsn_GetThirdDayItemId(void) { - if (!(gSaveContext.weekEventReg[33] & 4) && CURRENT_DAY == 3) { - if (!(gSaveContext.weekEventReg[33] & 8) && !(gSaveContext.weekEventReg[79] & 0x40)) { + if (!(gSaveContext.save.weekEventReg[33] & 4) && CURRENT_DAY == 3) { + if (!(gSaveContext.save.weekEventReg[33] & 8) && !(gSaveContext.save.weekEventReg[79] & 0x40)) { return SI_BOMB_BAG_30_1; } return SI_MASK_ALL_NIGHT; @@ -328,22 +328,23 @@ s16 EnFsn_GetStolenItemId(u32 stolenItem) { s32 EnFsn_HasItemsToSell(void) { if (CURRENT_DAY != 3) { - if (((gSaveContext.stolenItems & 0xFF000000) >> 0x18) || ((gSaveContext.stolenItems & 0xFF0000) >> 0x10)) { - return true; - } - return false; - } else { - if (((gSaveContext.stolenItems & 0xFF000000) >> 0x18) || ((gSaveContext.stolenItems & 0xFF0000) >> 0x10) || - !(gSaveContext.weekEventReg[33] & 4)) { + if ((STOLEN_ITEM_1 != STOLEN_ITEM_NONE) || (STOLEN_ITEM_2 != STOLEN_ITEM_NONE)) { return true; } return false; } + + if ((STOLEN_ITEM_1 != STOLEN_ITEM_NONE) || (STOLEN_ITEM_2 != STOLEN_ITEM_NONE) || + !(gSaveContext.save.weekEventReg[33] & 4)) { + return true; + } + + return false; } void EnFsn_GetShopItemIds(EnFsn* this) { - u32 stolenItem1 = (gSaveContext.stolenItems & 0xFF000000) >> 0x18; - u32 stolenItem2 = (gSaveContext.stolenItems & 0xFF0000) >> 0x10; + u32 stolenItem1 = STOLEN_ITEM_1; + u32 stolenItem2 = STOLEN_ITEM_2; s16 itemId; this->stolenItem1 = this->stolenItem2 = 0; @@ -440,9 +441,9 @@ s32 EnFsn_FacingShopkeeperDialogResult(EnFsn* this, GlobalContext* globalCtx) { func_8019F208(); if (CURRENT_DAY != 3) { this->actor.textId = 0x29FB; - } else if (gSaveContext.weekEventReg[33] & 4) { + } else if (gSaveContext.save.weekEventReg[33] & 4) { this->actor.textId = 0x29FF; - } else if (!(gSaveContext.weekEventReg[33] & 8) && !(gSaveContext.weekEventReg[79] & 0x40)) { + } else if (!(gSaveContext.save.weekEventReg[33] & 8) && !(gSaveContext.save.weekEventReg[79] & 0x40)) { this->actor.textId = 0x29D7; } else { this->actor.textId = 0x29D8; @@ -860,9 +861,10 @@ void EnFsn_AskBuyOrSell(EnFsn* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); break; case 0x29D2: - if (gSaveContext.weekEventReg[33] & 4) { + if (gSaveContext.save.weekEventReg[33] & 4) { this->actor.textId = 0x2A01; - } else if (!(gSaveContext.weekEventReg[33] & 8) && !(gSaveContext.weekEventReg[79] & 0x40)) { + } else if (!(gSaveContext.save.weekEventReg[33] & 8) && + !(gSaveContext.save.weekEventReg[79] & 0x40)) { this->actor.textId = 0x29D3; } else { this->actor.textId = 0x29D4; @@ -923,7 +925,7 @@ void EnFsn_DeterminePrice(EnFsn* this, GlobalContext* globalCtx) { if (player->heldItemButton == 0) { buttonItem = CUR_FORM_EQUIP(player->heldItemButton); } else { - buttonItem = gSaveContext.equips.buttonItems[0][player->heldItemButton]; + buttonItem = gSaveContext.save.equips.buttonItems[0][player->heldItemButton]; } this->price = (buttonItem < ITEM_MOON_TEAR) ? gItemPrices[buttonItem] : 0; if (this->price > 0) { @@ -1147,7 +1149,7 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, GlobalContext* globalCtx) { switch (item->canBuyFunc(globalCtx, item)) { case CANBUY_RESULT_SUCCESS_2: func_8019F208(); - gSaveContext.weekEventReg[33] |= 4; + gSaveContext.save.weekEventReg[33] |= 4; case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); @@ -1165,9 +1167,9 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, GlobalContext* globalCtx) { item = this->items[this->cursorIdx]; item->boughtFunc(globalCtx, item); if (this->stolenItem1 == this->cursorIdx) { - gSaveContext.stolenItems &= ~0xFF000000; + SET_STOLEN_ITEM_1(STOLEN_ITEM_NONE); } else if (this->stolenItem2 == this->cursorIdx) { - gSaveContext.stolenItems &= ~0xFF0000; + SET_STOLEN_ITEM_2(STOLEN_ITEM_NONE); } this->numSellingItems--; this->itemIds[this->cursorIdx] = -1; @@ -1416,7 +1418,7 @@ void EnFsn_Init(Actor* thisx, GlobalContext* globalCtx) { EnFsn_GetCutscenes(this); EnFsn_InitShop(this, globalCtx); } else { - if ((gSaveContext.weekEventReg[33] & 8) || (gSaveContext.weekEventReg[79] & 0x40)) { + if ((gSaveContext.save.weekEventReg[33] & 8) || (gSaveContext.save.weekEventReg[79] & 0x40)) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 99e32fee82..ba83b5f234 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -112,7 +112,7 @@ void func_809616E0(EnFu* this, GlobalContext* globalCtx) { s16 spA0 = false; Vec3f sp94; - if ((gSaveContext.playerForm == PLAYER_FORM_DEKU) && (CURRENT_DAY == 3)) { + if ((gSaveContext.save.playerForm == PLAYER_FORM_DEKU) && (CURRENT_DAY == 3)) { spA0 = true; } this->unk_54C = 0; @@ -230,8 +230,8 @@ void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnFu* this = THIS; - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[8] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[8] &= (u8)~1; Collider_DestroyCylinder(globalCtx, &this->collider); } @@ -386,12 +386,12 @@ void func_80962340(EnFu* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { if (this->unk_54A == 2) { if (this->unk_552 == 0x287D) { - if (gSaveContext.playerForm == PLAYER_FORM_DEKU) { + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { Message_StartTextbox(globalCtx, 0x287E, &this->actor); this->unk_552 = 0x287E; - } else if ((CURRENT_DAY == 3) && (gSaveContext.weekEventReg[22] & 0x10) && - (gSaveContext.weekEventReg[22] & 0x20)) { - if ((gSaveContext.weekEventReg[22] & 0x40)) { + } else if ((CURRENT_DAY == 3) && (gSaveContext.save.weekEventReg[22] & 0x10) && + (gSaveContext.save.weekEventReg[22] & 0x20)) { + if ((gSaveContext.save.weekEventReg[22] & 0x40)) { Message_StartTextbox(globalCtx, 0x2883, &this->actor); this->unk_552 = 0x2883; } else { @@ -429,7 +429,7 @@ void func_80962588(EnFu* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx) && (this->unk_552 == 0x2871)) { if (1) {} if (globalCtx->msgCtx.choiceIndex == 0) { - if (gSaveContext.rupees >= 10) { + if (gSaveContext.save.playerData.rupees >= 10) { func_8019F208(); func_801159EC(-10); func_80963DE4(this, globalCtx); @@ -532,8 +532,8 @@ void func_80962660(EnFu* this, GlobalContext* globalCtx) { break; case 0x287D: - gSaveContext.weekEventReg[63] |= 1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] |= 1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; func_801477B4(globalCtx); player->stateFlags1 |= 0x20; this->unk_53C = 0; @@ -605,8 +605,8 @@ void func_809628D0(EnFu* this, GlobalContext* globalCtx) { case 0x2884: case 0x2887: case 0x288A: - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; func_809622FC(this); break; @@ -652,10 +652,10 @@ void func_80962A10(EnFu* this, GlobalContext* globalCtx) { this->unk_546 = 1; } - if ((gSaveContext.playerForm == PLAYER_FORM_DEKU) && gSaveContext.magicAcquired) { + if ((gSaveContext.save.playerForm == PLAYER_FORM_DEKU) && gSaveContext.save.playerData.magicAcquired) { s16 temp = gSaveContext.unk_3F30; - Parameter_AddMagic(globalCtx, temp + (gSaveContext.doubleMagic * 48) + 48); + Parameter_AddMagic(globalCtx, temp + (gSaveContext.save.playerData.doubleMagic * 48) + 48); } func_80962F10(this); @@ -739,7 +739,7 @@ void func_80962EBC(EnFu* this, GlobalContext* globalCtx) { void func_80962F10(EnFu* this) { this->unk_548 = 0; this->actor.flags &= ~ACTOR_FLAG_1; - gSaveContext.weekEventReg[8] |= 1; + gSaveContext.save.weekEventReg[8] |= 1; this->actionFunc = func_80962F4C; } @@ -749,7 +749,7 @@ void func_80962F4C(EnFu* this, GlobalContext* globalCtx) { switch (this->unk_542) { case 0: - if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { player->stateFlags3 |= 0x400; } break; @@ -822,11 +822,11 @@ void func_8096326C(EnFu* this, GlobalContext* globalCtx) { } void func_809632D0(EnFu* this) { - if (gSaveContext.playerForm == PLAYER_FORM_DEKU) { + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { Interface_ChangeAlpha(50); } - gSaveContext.weekEventReg[8] &= (u8)~1; + gSaveContext.save.weekEventReg[8] &= (u8)~1; if (this->unk_2D4 != NULL) { BgFuMizu* mizu = this->unk_2D4; @@ -879,7 +879,7 @@ void func_80963560(EnFu* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; func_80963610(this); - } else if ((this->unk_552 == 0x2880) && !(gSaveContext.weekEventReg[22] & 0x80)) { + } else if ((this->unk_552 == 0x2880) && !(gSaveContext.save.weekEventReg[22] & 0x80)) { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); @@ -896,13 +896,13 @@ void func_80963630(EnFu* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - if ((gSaveContext.weekEventReg[22] & 0x10) && (gSaveContext.weekEventReg[22] & 0x20) && (CURRENT_DAY == 3) && - (gSaveContext.playerForm == PLAYER_FORM_HUMAN)) { - if (gSaveContext.weekEventReg[22] & 0x40) { + if ((gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20) && + (CURRENT_DAY == 3) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + if (gSaveContext.save.weekEventReg[22] & 0x40) { Message_StartTextbox(globalCtx, 0x2884, &this->actor); this->unk_552 = 0x2884; - } else if (!(gSaveContext.weekEventReg[22] & 0x80)) { - gSaveContext.weekEventReg[22] |= 0x80; + } else if (!(gSaveContext.save.weekEventReg[22] & 0x80)) { + gSaveContext.save.weekEventReg[22] |= 0x80; Message_StartTextbox(globalCtx, 0x2882, &this->actor); this->unk_552 = 0x2882; } else { @@ -918,18 +918,18 @@ void func_80963630(EnFu* this, GlobalContext* globalCtx) { this->actor.child->freezeTimer = 0; func_809628BC(this); - if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { switch (CURRENT_DAY) { case 1: - gSaveContext.weekEventReg[22] |= 0x10; + gSaveContext.save.weekEventReg[22] |= 0x10; break; case 2: - gSaveContext.weekEventReg[22] |= 0x20; + gSaveContext.save.weekEventReg[22] |= 0x20; break; case 3: - gSaveContext.weekEventReg[22] |= 0x40; + gSaveContext.save.weekEventReg[22] |= 0x40; break; } } @@ -1016,11 +1016,11 @@ s32 func_809638F8(GlobalContext* globalCtx) { void func_809639D0(EnFu* this, GlobalContext* globalCtx) { switch (CURRENT_DAY) { case 1: - if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { Message_StartTextbox(globalCtx, 0x2853, &this->actor); this->unk_552 = 0x2853; - } else if (gSaveContext.weekEventReg[22] & 0x10) { + } else if (gSaveContext.save.weekEventReg[22] & 0x10) { Message_StartTextbox(globalCtx, 0x284D, &this->actor); this->unk_552 = 0x284D; } else if (this->unk_53E == 1) { @@ -1038,13 +1038,13 @@ void func_809639D0(EnFu* this, GlobalContext* globalCtx) { break; case 2: - if (gSaveContext.playerForm != PLAYER_FORM_HUMAN) { + if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { Message_StartTextbox(globalCtx, 0x286F, &this->actor); this->unk_552 = 0x286F; } else if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { Message_StartTextbox(globalCtx, 0x2853, &this->actor); this->unk_552 = 0x2853; - } else if (!(gSaveContext.weekEventReg[22] & 0x10)) { + } else if (!(gSaveContext.save.weekEventReg[22] & 0x10)) { if (this->unk_53E == 1) { Message_StartTextbox(globalCtx, 0x285B, &this->actor); this->unk_552 = 0x285B; @@ -1053,7 +1053,7 @@ void func_809639D0(EnFu* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x285D, &this->actor); this->unk_552 = 0x285D; } - } else if (gSaveContext.weekEventReg[22] & 0x20) { + } else if (gSaveContext.save.weekEventReg[22] & 0x20) { Message_StartTextbox(globalCtx, 0x2855, &this->actor); this->unk_552 = 0x2855; } else if (this->unk_53E == 1) { @@ -1067,8 +1067,8 @@ void func_809639D0(EnFu* this, GlobalContext* globalCtx) { break; case 3: - if (gSaveContext.playerForm != PLAYER_FORM_HUMAN) { - if (gSaveContext.playerForm == PLAYER_FORM_DEKU) { + if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { func_80963EAC(this, globalCtx); } else { Message_StartTextbox(globalCtx, 0x2841, &this->actor); @@ -1077,15 +1077,15 @@ void func_809639D0(EnFu* this, GlobalContext* globalCtx) { } else if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { Message_StartTextbox(globalCtx, 0x284B, &this->actor); this->unk_552 = 0x284B; - } else if (gSaveContext.weekEventReg[22] & 0x40) { - if ((gSaveContext.weekEventReg[22] & 0x10) && (gSaveContext.weekEventReg[22] & 0x20)) { + } else if (gSaveContext.save.weekEventReg[22] & 0x40) { + if ((gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20)) { Message_StartTextbox(globalCtx, 0x285F, &this->actor); this->unk_552 = 0x285F; } else { Message_StartTextbox(globalCtx, 0x2861, &this->actor); this->unk_552 = 0x2861; } - } else if ((gSaveContext.weekEventReg[22] & 0x10) && (gSaveContext.weekEventReg[22] & 0x20)) { + } else if ((gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20)) { if (this->unk_53E == 1) { Message_StartTextbox(globalCtx, 0x2863, &this->actor); this->unk_552 = 0x2863; @@ -1094,7 +1094,7 @@ void func_809639D0(EnFu* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x2865, &this->actor); this->unk_552 = 0x2865; } - } else if ((gSaveContext.weekEventReg[22] & 0x10) || (gSaveContext.weekEventReg[22] & 0x20)) { + } else if ((gSaveContext.save.weekEventReg[22] & 0x10) || (gSaveContext.save.weekEventReg[22] & 0x20)) { if (this->unk_53E == 1) { Message_StartTextbox(globalCtx, 0x2867, &this->actor); this->unk_552 = 0x2867; @@ -1118,7 +1118,7 @@ void func_809639D0(EnFu* this, GlobalContext* globalCtx) { void func_80963DE4(EnFu* this, GlobalContext* globalCtx) { switch (this->unk_542) { case 0: - if (gSaveContext.playerForm != PLAYER_FORM_HUMAN) { + if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { Message_StartTextbox(globalCtx, 0x2875, &this->actor); this->unk_552 = 0x2875; } else { @@ -1140,7 +1140,7 @@ void func_80963DE4(EnFu* this, GlobalContext* globalCtx) { } void func_80963EAC(EnFu* this, GlobalContext* globalCtx) { - if (gSaveContext.magicAcquired) { + if (gSaveContext.save.playerData.magicAcquired) { if (this->unk_540 == 1) { Message_StartTextbox(globalCtx, 0x2847, &this->actor); this->unk_552 = 0x2847; diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c index 6923c6679a..1d9175b494 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c @@ -207,7 +207,7 @@ void EnGakufu_GiveReward(EnGakufu* this, GlobalContext* globalCtx) { play_sound(NA_SE_SY_CORRECT_CHIME); - hour = gSaveContext.time * (24.0f / 0x10000); + hour = gSaveContext.save.time * (24.0f / 0x10000); for (i = 0; i < 3; i++) { Item_DropCollectible(globalCtx, &sRewardDropsSpawnTerminaFieldPos, sRewardDrops[i + sRewardDropsIndex[hour]]); } diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index b350aa76b1..82010f1930 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -120,8 +120,8 @@ s32 func_80B0F660(EnGb2* this, GlobalContext* globalCtx) { } void func_80B0F6DC(EnGb2* this) { - if (!(gSaveContext.weekEventReg[54] & 0x20)) { - gSaveContext.weekEventReg[54] |= 0x20; + if (!(gSaveContext.save.weekEventReg[54] & 0x20)) { + gSaveContext.save.weekEventReg[54] |= 0x20; this->unk_26E = 0x14D0; } else { this->unk_26E = 0x14D1; @@ -163,7 +163,7 @@ u16 func_80B0F7FC(EnGb2* this) { return 0x14E4; } - if (gSaveContext.health > 48) { + if (gSaveContext.save.playerData.health > 48) { return 0x14D2; } @@ -171,7 +171,7 @@ u16 func_80B0F7FC(EnGb2* this) { return 0x14D3; case 0x14E4: - if (gSaveContext.health > 48) { + if (gSaveContext.save.playerData.health > 48) { return 0x14D2; } @@ -208,7 +208,7 @@ u16 func_80B0F8F8(EnGb2* this) { case 0x14DE: this->unk_26C |= 2; - gSaveContext.weekEventReg[54] |= 0x80; + gSaveContext.save.weekEventReg[54] |= 0x80; return 0x14DF; case 0x14E1: @@ -226,7 +226,7 @@ u16 func_80B0F97C(EnGb2* this) { return 0x14F7; case 0x14F7: - gSaveContext.weekEventReg[76] |= 0x80; + gSaveContext.save.weekEventReg[76] |= 0x80; this->unk_26C |= 2; return 0x14F8; @@ -259,7 +259,7 @@ s32 func_80B0FA48(EnGb2* this, GlobalContext* globalCtx) { return false; case PLAYER_MASK_CAPTAIN: - if (!(gSaveContext.weekEventReg[80] & 0x40)) { + if (!(gSaveContext.save.weekEventReg[80] & 0x40)) { this->unk_26E = 0x14EB; return false; } @@ -267,7 +267,7 @@ s32 func_80B0FA48(EnGb2* this, GlobalContext* globalCtx) { return true; } - if (!(gSaveContext.weekEventReg[80] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[80] & 0x20)) { this->unk_26E = 0x14EF; return false; } else { @@ -407,7 +407,7 @@ void func_80B0FFA8(EnGb2* this, GlobalContext* globalCtx) { if (this->unk_26E == 0x14D5) { switch (globalCtx->msgCtx.choiceIndex) { case 0: - if (gSaveContext.rupees < this->unk_288) { + if (gSaveContext.save.playerData.rupees < this->unk_288) { play_sound(NA_SE_SY_ERROR); this->unk_26E = 0x14D7; this->unk_26C |= 2; @@ -505,7 +505,7 @@ void func_80B10344(EnGb2* this, GlobalContext* globalCtx) { } } - if (gSaveContext.health < 49) { + if (gSaveContext.save.playerData.health < 49) { gSaveContext.unk_3DD0[1] = 5; gSaveContext.eventInf[4] |= 0x40; gSaveContext.eventInf[4] |= 0x20; @@ -575,7 +575,7 @@ void func_80B10634(EnGb2* this, GlobalContext* globalCtx) { } else if ((temp_v0 == 4) && Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.choiceIndex) { case 0: - if (gSaveContext.rupees < this->unk_288) { + if (gSaveContext.save.playerData.rupees < this->unk_288) { play_sound(NA_SE_SY_ERROR); this->unk_26E = 0x14D7; this->unk_26C |= 2; @@ -617,7 +617,7 @@ void func_80B10868(EnGb2* this, GlobalContext* globalCtx) { void func_80B10924(EnGb2* this, GlobalContext* globalCtx) { s32 sp24; - if (gSaveContext.weekEventReg[54] & 0x40) { + if (gSaveContext.save.weekEventReg[54] & 0x40) { sp24 = 5; } else { sp24 = 12; @@ -626,7 +626,7 @@ void func_80B10924(EnGb2* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; if (sp24 == 12) { - gSaveContext.weekEventReg[54] |= 0x40; + gSaveContext.save.weekEventReg[54] |= 0x40; } else { func_801159EC(50); } @@ -706,9 +706,9 @@ void func_80B10B5C(EnGb2* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_10000; Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); if (this->unk_26E == 0x14EB) { - gSaveContext.weekEventReg[80] |= 0x40; + gSaveContext.save.weekEventReg[80] |= 0x40; } else if (this->unk_26E == 0x14EF) { - gSaveContext.weekEventReg[80] |= 0x20; + gSaveContext.save.weekEventReg[80] |= 0x20; } this->unk_26C &= ~0x20; this->unk_290 = 0; @@ -885,13 +885,13 @@ void EnGb2_Init(Actor* thisx, GlobalContext* globalCtx) { switch (ENGB2_GET_7(&this->actor)) { case ENGB2_7_0: - if (gSaveContext.weekEventReg[54] & 0x80) { + if (gSaveContext.save.weekEventReg[54] & 0x80) { Actor_MarkForDeath(&this->actor); - } else if (gSaveContext.weekEventReg[52] & 0x20) { + } else if (gSaveContext.save.weekEventReg[52] & 0x20) { Actor_MarkForDeath(&this->actor); } - if (gSaveContext.entranceIndex == 0x9C10) { + if (gSaveContext.save.entranceIndex == 0x9C10) { func_800FE484(); this->actionFunc = func_80B10240; break; @@ -910,7 +910,7 @@ void EnGb2_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ENGB2_7_1: - if ((globalCtx->curSpawn == 1) || (gSaveContext.weekEventReg[80] & 0x80)) { + if ((globalCtx->curSpawn == 1) || (gSaveContext.save.weekEventReg[80] & 0x80)) { Actor_MarkForDeath(&this->actor); return; } @@ -940,7 +940,7 @@ void EnGb2_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if (gSaveContext.weekEventReg[76] & 0x80) { + if (gSaveContext.save.weekEventReg[76] & 0x80) { this->actor.draw = NULL; this->unk_26C |= 0x100; this->actor.flags &= ~ACTOR_FLAG_1; diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c index 5bf1ca75ec..d022058dd8 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -452,7 +452,7 @@ void func_80BB221C(EnGeg* this, GlobalContext* globalCtx) { } } else { this->unk_230 &= ~4; - if (gSaveContext.weekEventReg[35] & 0x40) { + if (gSaveContext.save.weekEventReg[35] & 0x40) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) && (this->unk_230 & 8)) { this->unk_496 = 0xD62; Message_StartTextbox(globalCtx, this->unk_496, &this->actor); @@ -463,7 +463,7 @@ void func_80BB221C(EnGeg* this, GlobalContext* globalCtx) { this->unk_230 |= 8; } } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) && (this->unk_230 & 8)) { - gSaveContext.weekEventReg[35] |= 0x40; + gSaveContext.save.weekEventReg[35] |= 0x40; this->unk_496 = 0xD5E; this->unk_49A = this->unk_49C[0]; Message_StartTextbox(globalCtx, this->unk_496, &this->actor); @@ -655,7 +655,7 @@ void func_80BB2B1C(EnGeg* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCurrentIndex() != this->unk_49C[4]) { if (ActorCutscene_GetCanPlayNext(this->unk_498)) { - gSaveContext.weekEventReg[37] |= 8; + gSaveContext.save.weekEventReg[37] |= 8; if (this->actor.child != NULL) { Actor_MarkForDeath(this->actor.child); } @@ -797,7 +797,7 @@ void func_80BB31B8(EnGeg* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; - gSaveContext.weekEventReg[61] |= 1; + gSaveContext.save.weekEventReg[61] |= 1; if (getItemId == GI_MASK_DON_GERO) { this->unk_230 |= 0x40; } @@ -860,7 +860,7 @@ void EnGeg_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad2; s32 sp34[] = { 0x3E, 0xF64 }; - if (gSaveContext.weekEventReg[61] & 1) { + if (gSaveContext.save.weekEventReg[61] & 1) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c index ab86e0161e..d889bc7a06 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -129,7 +129,7 @@ s32 func_80B34FB4(EnGg* this, GlobalContext* globalCtx) { pitch = Math_Vec3f_Pitch(&sp34, &sp40); if ((this->actor.xzDistToPlayer < 250.0f) && (this->actor.xzDistToPlayer > 50.0f) && - (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (gSaveContext.weekEventReg[19] & 0x80))) { + (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (gSaveContext.save.weekEventReg[19] & 0x80))) { Math_SmoothStepToS(&this->unk_2E8, pitch, 4, 0x2AA8, 1); } else { Math_SmoothStepToS(&this->unk_2E8, 0, 4, 0x2AA8, 1); @@ -212,7 +212,7 @@ void func_80B352A4(EnGg* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); break; } - gSaveContext.weekEventReg[19] |= 0x80; + gSaveContext.save.weekEventReg[19] |= 0x80; this->actionFunc = func_80B3556C; } else if ((this->unk_2E6 == 0) && ((this->actor.textId == 0xCED) || (this->actor.textId == 0xCEE))) { if (sp26 < (lastFrame - 1)) { @@ -225,7 +225,7 @@ void func_80B352A4(EnGg* this, GlobalContext* globalCtx) { } void func_80B35450(EnGg* this, GlobalContext* globalCtx) { - if ((gSaveContext.weekEventReg[91] & 0x10) && (globalCtx->csCtx.state == 0)) { + if ((gSaveContext.save.weekEventReg[91] & 0x10) && (globalCtx->csCtx.state == 0)) { func_80B359DC(this, globalCtx); } @@ -236,7 +236,7 @@ void func_80B35450(EnGg* this, GlobalContext* globalCtx) { this->unk_308 = 1; this->actionFunc = func_80B352A4; } else if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.xzDistToPlayer > 50.0f)) { - if (gSaveContext.weekEventReg[19] & 0x80) { + if (gSaveContext.save.weekEventReg[19] & 0x80) { func_800B863C(&this->actor, globalCtx); this->actor.textId = 0xCEE; } else if CHECK_FLAG_ALL (this->actor.flags, ACTOR_FLAG_80) { @@ -400,8 +400,8 @@ void func_80B359DC(EnGg* this, GlobalContext* globalCtx) { if ((player->transformation == PLAYER_FORM_HUMAN) && (globalCtx->msgCtx.ocarinaMode == 3) && (globalCtx->msgCtx.unk1202E == 7)) { - if (!(gSaveContext.weekEventReg[19] & 0x80)) { - gSaveContext.weekEventReg[19] |= 0x80; + if (!(gSaveContext.save.weekEventReg[19] & 0x80)) { + gSaveContext.save.weekEventReg[19] |= 0x80; } this->unk_307 = true; } @@ -661,9 +661,9 @@ void EnGg_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - gSaveContext.weekEventReg[20] &= (u8)~4; - gSaveContext.weekEventReg[20] &= (u8)~8; - gSaveContext.weekEventReg[20] &= (u8)~0x10; + gSaveContext.save.weekEventReg[20] &= (u8)~4; + gSaveContext.save.weekEventReg[20] &= (u8)~8; + gSaveContext.save.weekEventReg[20] &= (u8)~0x10; this->actor.flags &= ~ACTOR_FLAG_80; this->unk_310 = this->actor.home.pos.y; this->unk_2DC = this->actor.cutscene; @@ -691,7 +691,7 @@ void EnGg_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; } - if (gSaveContext.weekEventReg[19] & 0x80) { + if (gSaveContext.save.weekEventReg[19] & 0x80) { if (globalCtx->csCtx.state == 0) { this->actor.flags |= ACTOR_FLAG_1; } else { @@ -709,10 +709,10 @@ void EnGg_Update(Actor* thisx, GlobalContext* globalCtx) { func_80B35968(this, globalCtx); } - if (!(gSaveContext.weekEventReg[91] & 0x10) && - ((gSaveContext.weekEventReg[19] & 0x80) || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || + if (!(gSaveContext.save.weekEventReg[91] & 0x10) && + ((gSaveContext.save.weekEventReg[19] & 0x80) || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (this->unk_308 == 1))) { - gSaveContext.weekEventReg[91] |= 0x10; + gSaveContext.save.weekEventReg[91] |= 0x10; } this->actionFunc(this, globalCtx); @@ -790,7 +790,7 @@ void EnGg_Draw(Actor* thisx, GlobalContext* globalCtx) { this->unk_344.unk_38(&this->unk_344, globalCtx); } - if (gSaveContext.weekEventReg[19] & 0x80) { + if (gSaveContext.save.weekEventReg[19] & 0x80) { func_8012C28C(globalCtx->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B36DFC[this->unk_2E2])); diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index f3ecfd9aa8..7b019933fc 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -214,17 +214,17 @@ void func_80B3B294(EnGg2* this, GlobalContext* globalCtx) { if (this->unk_2F1 == 0) { if (globalCtx->sceneNum == SCENE_11GORONNOSATO) { - gSaveContext.weekEventReg[20] |= 4; - gSaveContext.weekEventReg[20] &= (u8)~8; - gSaveContext.weekEventReg[20] &= (u8)~0x10; + gSaveContext.save.weekEventReg[20] |= 4; + gSaveContext.save.weekEventReg[20] &= (u8)~8; + gSaveContext.save.weekEventReg[20] &= (u8)~0x10; } else if (globalCtx->sceneNum == SCENE_17SETUGEN) { - gSaveContext.weekEventReg[20] &= (u8)~4; - gSaveContext.weekEventReg[20] |= 8; - gSaveContext.weekEventReg[20] &= (u8)~0x10; + gSaveContext.save.weekEventReg[20] &= (u8)~4; + gSaveContext.save.weekEventReg[20] |= 8; + gSaveContext.save.weekEventReg[20] &= (u8)~0x10; } else if (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA) { - gSaveContext.weekEventReg[20] &= (u8)~4; - gSaveContext.weekEventReg[20] &= (u8)~8; - gSaveContext.weekEventReg[20] |= 0x10; + gSaveContext.save.weekEventReg[20] &= (u8)~4; + gSaveContext.save.weekEventReg[20] &= (u8)~8; + gSaveContext.save.weekEventReg[20] |= 0x10; } if (this->unk_1D8 != NULL) { @@ -240,17 +240,17 @@ void func_80B3B294(EnGg2* this, GlobalContext* globalCtx) { } else { this->unk_2F1 = 1; if (globalCtx->sceneNum == SCENE_11GORONNOSATO) { - gSaveContext.weekEventReg[20] |= 4; - gSaveContext.weekEventReg[20] &= (u8)~8; - gSaveContext.weekEventReg[20] &= (u8)~0x10; + gSaveContext.save.weekEventReg[20] |= 4; + gSaveContext.save.weekEventReg[20] &= (u8)~8; + gSaveContext.save.weekEventReg[20] &= (u8)~0x10; } else if (globalCtx->sceneNum == SCENE_17SETUGEN) { - gSaveContext.weekEventReg[20] &= (u8)~4; - gSaveContext.weekEventReg[20] |= 8; - gSaveContext.weekEventReg[20] &= (u8)~0x10; + gSaveContext.save.weekEventReg[20] &= (u8)~4; + gSaveContext.save.weekEventReg[20] |= 8; + gSaveContext.save.weekEventReg[20] &= (u8)~0x10; } else if (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA) { - gSaveContext.weekEventReg[20] &= (u8)~4; - gSaveContext.weekEventReg[20] &= (u8)~8; - gSaveContext.weekEventReg[20] |= 0x10; + gSaveContext.save.weekEventReg[20] &= (u8)~4; + gSaveContext.save.weekEventReg[20] &= (u8)~8; + gSaveContext.save.weekEventReg[20] |= 0x10; } } } @@ -360,7 +360,7 @@ void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { return; } - if (gSaveContext.weekEventReg[91] & 0x10) { + if (gSaveContext.save.weekEventReg[91] & 0x10) { Actor_MarkForDeath(&this->actor); return; } @@ -381,16 +381,16 @@ void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { this->unk_2EA = 0; if (globalCtx->sceneNum == SCENE_11GORONNOSATO) { - gSaveContext.weekEventReg[20] &= (u8)~4; - gSaveContext.weekEventReg[20] &= (u8)~8; - gSaveContext.weekEventReg[20] &= (u8)~0x10; + gSaveContext.save.weekEventReg[20] &= (u8)~4; + gSaveContext.save.weekEventReg[20] &= (u8)~8; + gSaveContext.save.weekEventReg[20] &= (u8)~0x10; this->unk_2EE = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); this->actionFunc = func_80B3AFB0; } else if (globalCtx->sceneNum == SCENE_17SETUGEN) { - if ((gSaveContext.weekEventReg[20] & 4) && !(gSaveContext.weekEventReg[20] & 8) && - !(gSaveContext.weekEventReg[20] & 0x10)) { - gSaveContext.weekEventReg[20] &= (u8)~4; + if ((gSaveContext.save.weekEventReg[20] & 4) && !(gSaveContext.save.weekEventReg[20] & 8) && + !(gSaveContext.save.weekEventReg[20] & 0x10)) { + gSaveContext.save.weekEventReg[20] &= (u8)~4; this->unk_2EE = 8; Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); this->actionFunc = func_80B3B05C; @@ -398,9 +398,9 @@ void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_MarkForDeath(&this->actor); } } else if (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA) { - if (!(gSaveContext.weekEventReg[20] & 4) && (gSaveContext.weekEventReg[20] & 8) && - !(gSaveContext.weekEventReg[20] & 0x10)) { - gSaveContext.weekEventReg[20] &= (u8)~8; + if (!(gSaveContext.save.weekEventReg[20] & 4) && (gSaveContext.save.weekEventReg[20] & 8) && + !(gSaveContext.save.weekEventReg[20] & 0x10)) { + gSaveContext.save.weekEventReg[20] &= (u8)~8; this->unk_2EE = 8; Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); this->actionFunc = func_80B3B05C; @@ -408,9 +408,9 @@ void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_MarkForDeath(&this->actor); } } else { - gSaveContext.weekEventReg[20] &= (u8)~4; - gSaveContext.weekEventReg[20] &= (u8)~8; - gSaveContext.weekEventReg[20] &= (u8)~0x10; + gSaveContext.save.weekEventReg[20] &= (u8)~4; + gSaveContext.save.weekEventReg[20] &= (u8)~8; + gSaveContext.save.weekEventReg[20] &= (u8)~0x10; Actor_MarkForDeath(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index c509db2b8c..90d945e2a0 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -183,10 +183,11 @@ void EnGiant_Init(Actor* thisx, GlobalContext* globalCtx) { } if (GIANT_TYPE_IS_CLOCK_TOWER_SUCCESS(type)) { - if (!(gSaveContext.weekEventReg[25] & 2)) { + if (!(gSaveContext.save.weekEventReg[25] & 2)) { Actor_MarkForDeath(&this->actor); return; } + this->actorActionCommand = 0x1C5; Actor_SetScale(&this->actor, 0.32f); this->actionFunc = EnGiant_PerformClockTowerSuccessActions; diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c index 5ed7ccdf3e..34b0e36b48 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c @@ -81,13 +81,13 @@ void EnGinkoMan_Idle(EnGinkoMan* this, GlobalContext* globalCtx) { EnGinkoMan_SwitchAnimation(this, globalCtx); if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - if ((gSaveContext.bankRupees & 0xFFFF) == 0) { + if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); Message_StartTextbox(globalCtx, 0x44C, &this->actor); this->curTextId = 0x44C; // would you like to make an account } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - if ((CURRENT_DAY == 3) && (gSaveContext.isNight == 1)) { + if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { Message_StartTextbox(globalCtx, 0x467, &this->actor); this->curTextId = 0x467; // "What's this? You need somethin' on a day like this? } else { @@ -110,7 +110,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { switch (this->curTextId) { case 0x44C: // "Hey there, little guy! Won't you deposit some Rupees? (first dialogue) Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - if (gSaveContext.weekEventReg[10] & 8) { + if (gSaveContext.save.weekEventReg[10] & 8) { Message_StartTextbox(globalCtx, 0x44E, &this->actor); this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" } else { @@ -145,7 +145,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); } - globalCtx->msgCtx.bankRupees = gSaveContext.bankRupees & 0xFFFF; + globalCtx->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; Message_StartTextbox(globalCtx, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" } @@ -156,22 +156,22 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" break; case 0x45A: // "All right, little guy, now I've got a total of [rupees] from you!" - if (((gSaveContext.bankRupees & 0xFFFF) >= 200) && (this->previousBankValue < 200) && - !(gSaveContext.weekEventReg[59] & 0x40)) { - gSaveContext.weekEventReg[59] |= 0x40; + if (((gSaveContext.save.bankRupees & 0xFFFF) >= 200) && (this->previousBankValue < 200) && + !(gSaveContext.save.weekEventReg[59] & 0x40)) { + gSaveContext.save.weekEventReg[59] |= 0x40; Message_StartTextbox(globalCtx, 0x45B, &this->actor); this->curTextId = 0x45B; // "What's this? You've already saved up 200 Rupees!?! - } else if (((gSaveContext.bankRupees & 0xFFFF) >= 1000) && ((this->previousBankValue) < 1000) && - !(gSaveContext.weekEventReg[59] & 0x80)) { - gSaveContext.weekEventReg[59] |= 0x80; + } else if (((gSaveContext.save.bankRupees & 0xFFFF) >= 1000) && ((this->previousBankValue) < 1000) && + !(gSaveContext.save.weekEventReg[59] & 0x80)) { + gSaveContext.save.weekEventReg[59] |= 0x80; Message_StartTextbox(globalCtx, 0x45C, &this->actor); this->curTextId = 0x45C; // "What's this? You've already saved up 1000 Rupees!?! - } else if ((gSaveContext.bankRupees & 0xFFFF) >= 5000) { - if ((this->previousBankValue < 5000) && !(gSaveContext.weekEventReg[60] & 1)) { - gSaveContext.weekEventReg[60] |= 1; + } else if ((gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { + if ((this->previousBankValue < 5000) && !(gSaveContext.save.weekEventReg[60] & 1)) { + gSaveContext.save.weekEventReg[60] |= 1; Message_StartTextbox(globalCtx, 0x45D, &this->actor); this->curTextId = 0x45D; // "What's this? You've already saved up 5000 Rupees?! - } else if (this->previousBankValue < (s16)(gSaveContext.bankRupees & 0xFFFF)) { + } else if (this->previousBankValue < (s16)(gSaveContext.save.bankRupees & 0xFFFF)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); Message_StartTextbox(globalCtx, 0x45E, &this->actor); this->curTextId = @@ -213,7 +213,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { break; case 0x465: // "There! Now I'll know you when I see you!" Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); - globalCtx->msgCtx.bankRupees = gSaveContext.bankRupees & 0xFFFF; + globalCtx->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; Message_StartTextbox(globalCtx, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" break; @@ -229,10 +229,10 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { case 0x46C: // "Ah, yes...[Link], right? If I remember, you're the little guy who deposited [rupees]." case 0x47E: // "Your deposits total [rupees]." if (this->choiceDepositWithdrawl == GINKOMAN_CHOICE_DEPOSIT) { - if ((u32)(gSaveContext.bankRupees & 0xFFFF) >= 5000) { + if ((u32)(gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { Message_StartTextbox(globalCtx, 0x45F, &this->actor); this->curTextId = 0x45F; // "Excuuuse me! But I can't take anymore deposits! - } else if (gSaveContext.rupees == 0) { + } else if (gSaveContext.save.playerData.rupees == 0) { Message_StartTextbox(globalCtx, 0x458, &this->actor); this->curTextId = 0x458; // "Hmm...You play mean jokes, little guy! You haven't even got a single Rupee! @@ -240,7 +240,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x479, &this->actor); this->curTextId = 0x479; // "Well, are you gonna make a deposit?" } - } else if ((CURRENT_DAY == 3) && (gSaveContext.isNight == 1)) { + } else if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { Message_StartTextbox(globalCtx, 0x46D, &this->actor); // "Look, little guy, if it's 'cause of the bad rumors going around, forget it! They're just rumors!" this->curTextId = 0x46D; @@ -280,12 +280,12 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { case 0x473: // Use it wisely... case 0x474: // "Aw, you're taking out all that? If you spend it like that, it'll all be gone before you know // it!" - if ((gSaveContext.bankRupees & 0xFFFF) == 0) { + if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { Message_StartTextbox(globalCtx, 0x478, &this->actor); // "Look, little guy, all the Rupees you deposited are gone, so you can't use that stamp anymore." this->curTextId = 0x478; } else { - globalCtx->msgCtx.bankRupees = gSaveContext.bankRupees & 0xFFFF; + globalCtx->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; Message_StartTextbox(globalCtx, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" } @@ -311,12 +311,12 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, GlobalContext* globalCtx) switch (this->curTextId) { case 0x44E: // "...So, what'll it be? if (globalCtx->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { - if ((gSaveContext.bankRupees & 0xFFFF) >= 5000) { + if ((gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(globalCtx, 0x45F, &this->actor); this->curTextId = 0x45F; // bank full, cannot accept more } else { - if (gSaveContext.rupees > 0) { + if (gSaveContext.save.playerData.rupees > 0) { func_8019F208(); Message_StartTextbox(globalCtx, 0x44F, &this->actor); this->curTextId = 0x44F; // "All right! so..." @@ -334,7 +334,7 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, GlobalContext* globalCtx) break; case 0x452: // Really? are you really depositing rupees? if (globalCtx->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { - if (gSaveContext.rupees < globalCtx->msgCtx.bankRupeesSelected) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.bankRupeesSelected) { play_sound(NA_SE_SY_ERROR); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); Message_StartTextbox(globalCtx, 0x459, &this->actor); @@ -353,20 +353,20 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, GlobalContext* globalCtx) this->curTextId = 0x453; // That's it? That aint nothing at all } - if ((gSaveContext.bankRupees & 0xFFFF) == 0) { + if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { this->isNewAccount = true; } func_801159EC((s16)-globalCtx->msgCtx.bankRupeesSelected); - this->previousBankValue = gSaveContext.bankRupees & 0xFFFF; - gSaveContext.bankRupees = - ((gSaveContext.bankRupees & 0xFFFF) + globalCtx->msgCtx.bankRupeesSelected) | - (gSaveContext.bankRupees & 0xFFFF0000); + this->previousBankValue = gSaveContext.save.bankRupees & 0xFFFF; + gSaveContext.save.bankRupees = + ((gSaveContext.save.bankRupees & 0xFFFF) + globalCtx->msgCtx.bankRupeesSelected) | + (gSaveContext.save.bankRupees & 0xFFFF0000); } } else { // GINKOMAN_CHOICE_NO func_8019F230(); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - if ((gSaveContext.bankRupees & 0xFFFF) == 0) { + if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { Message_StartTextbox(globalCtx, 0x456, &this->actor); this->curTextId = 0x456; // Is that so? think about it } else { @@ -395,13 +395,14 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, GlobalContext* globalCtx) break; case 0x471: // Are you really withdrawling [selected rupees]? if (globalCtx->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { - if ((s32)((gSaveContext.bankRupees & 0xFFFF)) < + if ((s32)((gSaveContext.save.bankRupees & 0xFFFF)) < ((s32)(globalCtx->msgCtx.bankRupeesSelected + this->serviceFee))) { play_sound(NA_SE_SY_ERROR); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); Message_StartTextbox(globalCtx, 0x476, &this->actor); this->curTextId = 0x476; // you dont have enough deposited to withdrawl - } else if (CUR_CAPACITY(UPG_WALLET) < (globalCtx->msgCtx.bankRupeesSelected + gSaveContext.rupees)) { + } else if (CUR_CAPACITY(UPG_WALLET) < + (globalCtx->msgCtx.bankRupeesSelected + gSaveContext.save.playerData.rupees)) { // check if wallet is big enough play_sound(NA_SE_SY_ERROR); Message_StartTextbox(globalCtx, 0x475, &this->actor); @@ -419,11 +420,11 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, GlobalContext* globalCtx) this->curTextId = 0x472; // It's a waste to take out such a tiny bit } - this->previousBankValue = (s16)(gSaveContext.bankRupees & 0xFFFF); - gSaveContext.bankRupees = - (((gSaveContext.bankRupees & 0xFFFF) - globalCtx->msgCtx.bankRupeesSelected) - + this->previousBankValue = (s16)(gSaveContext.save.bankRupees & 0xFFFF); + gSaveContext.save.bankRupees = + (((gSaveContext.save.bankRupees & 0xFFFF) - globalCtx->msgCtx.bankRupeesSelected) - this->serviceFee) | - (gSaveContext.bankRupees & 0xFFFF0000); + (gSaveContext.save.bankRupees & 0xFFFF0000); func_801159EC(globalCtx->msgCtx.bankRupeesSelected); } } else { @@ -452,7 +453,7 @@ void EnGinkoMan_WaitForRupeeCount(EnGinkoMan* this, GlobalContext* globalCtx) { if (globalCtx->msgCtx.bankRupeesSelected == 0) { Message_StartTextbox(globalCtx, 0x46F, &this->actor); this->curTextId = 0x46F; // "Zero Rupees?!? That's a cruel joke!" - } else if (gSaveContext.isNight == 1) { + } else if (gSaveContext.save.isNight == true) { Message_StartTextbox(globalCtx, 0x477, &this->actor); this->curTextId = 0x477; // "...You know, at this time of day there's a 4 Rupee service charge... } else { @@ -510,14 +511,14 @@ void EnGinkoMan_BankAward(EnGinkoMan* this, GlobalContext* globalCtx) { this->actor.parent = NULL; EnGinkoMan_SetupBankAward2(this); } else if (this->curTextId == 0x45B) { // "Whats this, you already saved up 200?" - if (!(gSaveContext.weekEventReg[10] & 8)) { + if (!(gSaveContext.save.weekEventReg[10] & 8)) { Actor_PickUp(&this->actor, globalCtx, GI_WALLET_ADULT + CUR_UPG_VALUE(UPG_WALLET), 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_BLUE, 500.0f, 100.0f); } } else if (this->curTextId == 0x45C) { // "Whats this, you already saved up 5000?" Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_BLUE, 500.0f, 100.0f); - } else if (!(gSaveContext.weekEventReg[59] & 8)) { + } else if (!(gSaveContext.save.weekEventReg[59] & 8)) { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_BLUE, 500.0f, 100.0f); @@ -532,10 +533,10 @@ void EnGinkoMan_SetupBankAward2(EnGinkoMan* this) { // separate function to handle bank rewards... called while the player is receiving the award void EnGinkoMan_BankAward2(EnGinkoMan* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - if (!(gSaveContext.weekEventReg[10] & 8) && (this->curTextId == 0x45B)) { + if (!(gSaveContext.save.weekEventReg[10] & 8) && (this->curTextId == 0x45B)) { // "What's this? You've already saved up 200 Rupees!?! Well, little guy, here's your special gift. Take // it!" - gSaveContext.weekEventReg[10] |= 8; + gSaveContext.save.weekEventReg[10] |= 8; Message_StartTextbox(globalCtx, 0x47A, &this->actor); this->curTextId = 0x47A; // Message after receiving reward for depositing 200 rupees. } else { @@ -547,8 +548,8 @@ void EnGinkoMan_BankAward2(EnGinkoMan* this, GlobalContext* globalCtx) { EnGinkoMan_SetupDialogue(this); } else if (this->curTextId == 0x45D) { // saved up 5000 rupees for HP if ((Message_GetState(&globalCtx->msgCtx) == 6) && Message_ShouldAdvance(globalCtx)) { - if (!(gSaveContext.weekEventReg[59] & 8)) { - gSaveContext.weekEventReg[59] |= 8; + if (!(gSaveContext.save.weekEventReg[59] & 8)) { + gSaveContext.save.weekEventReg[59] |= 8; } EnGinkoMan_SetupIdle(this); } @@ -577,8 +578,8 @@ void EnGinkoMan_Stamp(EnGinkoMan* this, GlobalContext* globalCtx) { break; case 0x469: // "Excuse me, but let me take a look at you..." Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - globalCtx->msgCtx.bankRupees = (gSaveContext.bankRupees & 0xFFFF); - if ((CURRENT_DAY == 3) && (gSaveContext.isNight == 1)) { + globalCtx->msgCtx.bankRupees = (gSaveContext.save.bankRupees & 0xFFFF); + if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { Message_StartTextbox(globalCtx, 0x46C, &this->actor); this->curTextId = 0x46C; // "Ah, yes...[Link], right? } else { diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index df22065222..b509d45002 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -188,7 +188,7 @@ s32 EnGirlA_CanBuyPotionRed(GlobalContext* globalCtx, EnGirlA* this) { if (!Interface_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; @@ -198,46 +198,46 @@ s32 EnGirlA_CanBuyPotionGreen(GlobalContext* globalCtx, EnGirlA* this) { if (!Interface_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } s32 EnGirlA_CanBuyPotionBlue(GlobalContext* globalCtx, EnGirlA* this) { - if (!(gSaveContext.weekEventReg[53] & 8)) { + if (!(gSaveContext.save.weekEventReg[53] & 8)) { return CANBUY_RESULT_CANNOT_GET_NOW; } if (!Interface_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (!(gSaveContext.weekEventReg[53] & 0x10)) { + if (!(gSaveContext.save.weekEventReg[53] & 0x10)) { return CANBUY_RESULT_SUCCESS_2; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } s32 EnGirlA_CanBuyArrows(GlobalContext* globalCtx, EnGirlA* this) { - if (CUR_UPG_VALUE_VOID(UPG_QUIVER) == 0) { + if (GET_CUR_UPG_VALUE(UPG_QUIVER) == 0) { return CANBUY_RESULT_CANNOT_GET_NOW_2; } if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) { return CANBUY_RESULT_NO_ROOM_2; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } s32 EnGirlA_CanBuyNuts(GlobalContext* globalCtx, EnGirlA* this) { - if (CUR_CAPACITY(UPG_NUTS) != 0 && AMMO(ITEM_NUT) >= CUR_CAPACITY(UPG_NUTS)) { + if (CUR_CAPACITY(UPG_NUTS) != 0 && CUR_CAPACITY(UPG_NUTS) <= AMMO(ITEM_NUT)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } if (func_80114978(ITEM_NUT) == ITEM_NONE) { @@ -247,10 +247,10 @@ s32 EnGirlA_CanBuyNuts(GlobalContext* globalCtx, EnGirlA* this) { } s32 EnGirlA_CanBuyShieldHero(GlobalContext* globalCtx, EnGirlA* this) { - if (CUR_EQUIP_VALUE_VOID(EQUIP_SHIELD) != 0) { + if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; @@ -260,7 +260,7 @@ s32 EnGirlA_CanBuyStick(GlobalContext* globalCtx, EnGirlA* this) { if (CUR_CAPACITY(UPG_STICKS) != 0 && AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } if (func_80114978(ITEM_STICK) == ITEM_NONE) { @@ -270,56 +270,56 @@ s32 EnGirlA_CanBuyStick(GlobalContext* globalCtx, EnGirlA* this) { } s32 EnGirlA_CanBuyMaskAllNight(GlobalContext* globalCtx, EnGirlA* this) { - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } s32 EnGirlA_CanBuyBombBagCuriosityShop(GlobalContext* globalCtx, EnGirlA* this) { - if (CUR_UPG_VALUE_VOID(UPG_BOMB_BAG) >= 2) { + if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) >= 2) { return CANBUY_RESULT_CANNOT_GET_NOW; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } s32 EnGirlA_CanBuyBombBag20BombShop(GlobalContext* globalCtx, EnGirlA* this) { - if (CUR_UPG_VALUE_VOID(UPG_BOMB_BAG) == 1) { + if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 1) { return CANBUY_RESULT_ALREADY_HAVE; } - if (CUR_UPG_VALUE_VOID(UPG_BOMB_BAG) >= 2) { + if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) >= 2) { return CANBUY_RESULT_HAVE_BETTER; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } s32 EnGirlA_CanBuyBombBag30BombShop(GlobalContext* globalCtx, EnGirlA* this) { - if (CUR_UPG_VALUE_VOID(UPG_BOMB_BAG) == 2) { + if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 2) { return CANBUY_RESULT_ALREADY_HAVE; } - if (CUR_UPG_VALUE_VOID(UPG_BOMB_BAG) == 3) { + if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 3) { return CANBUY_RESULT_HAVE_BETTER; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } s32 EnGirlA_CanBuyBombchus(GlobalContext* globalCtx, EnGirlA* this) { - if (CUR_UPG_VALUE_VOID(UPG_BOMB_BAG) == 0) { + if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { return CANBUY_RESULT_CANNOT_GET_NOW; } if (AMMO(ITEM_BOMBCHU) >= CUR_CAPACITY(UPG_BOMB_BAG)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } if (func_80114978(ITEM_BOMBCHU) == ITEM_NONE) { @@ -329,37 +329,37 @@ s32 EnGirlA_CanBuyBombchus(GlobalContext* globalCtx, EnGirlA* this) { } s32 EnGirlA_CanBuyBombs(GlobalContext* globalCtx, EnGirlA* this) { - if (CUR_UPG_VALUE_VOID(UPG_BOMB_BAG) == 0) { + if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { return CANBUY_RESULT_CANNOT_GET_NOW; } if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } s32 EnGirlA_CanBuyBottle(GlobalContext* globalCtx, EnGirlA* this) { - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } s32 EnGirlA_CanBuySword(GlobalContext* globalCtx, EnGirlA* this) { - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } s32 EnGirlA_CanBuyShieldMirror(GlobalContext* globalCtx, EnGirlA* this) { - if (CUR_EQUIP_VALUE_VOID(EQUIP_SHIELD) != 0) { + if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; @@ -369,7 +369,7 @@ s32 EnGirlA_CanBuyFairy(GlobalContext* globalCtx, EnGirlA* this) { if (!Interface_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 5ac1c8cb38..135d9f6d7c 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -120,7 +120,7 @@ u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { if (globalCtx->sceneNum == SCENE_17SETUGEN2) { if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.weekEventReg[40] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[40] & 0x80)) { switch (this->unk_31C) { case 0xE7A: return 0xE7B; @@ -133,7 +133,7 @@ u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { case 0xE7E: return 0xE7F; case 0xE7F: - gSaveContext.weekEventReg[40] |= 0x80; + gSaveContext.save.weekEventReg[40] |= 0x80; this->unk_1E4 |= 1; return 0xE80; default: @@ -143,7 +143,7 @@ u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { this->unk_1E4 |= 1; return 0xE81; } - } else if (!(gSaveContext.weekEventReg[41] & 1)) { + } else if (!(gSaveContext.save.weekEventReg[41] & 1)) { switch (this->unk_31C) { case 0xE82: return 0xE83; @@ -154,7 +154,7 @@ u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { case 0xE7E: return 0xE7F; case 0xE7F: - gSaveContext.weekEventReg[41] |= 1; + gSaveContext.save.weekEventReg[41] |= 1; this->unk_1E4 |= 1; return 0xE80; default: @@ -166,12 +166,12 @@ u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { } } else if (globalCtx->sceneNum == SCENE_GORONRACE) { if (player->transformation == PLAYER_FORM_GORON) { - if (!(gSaveContext.weekEventReg[41] & 4)) { + if (!(gSaveContext.save.weekEventReg[41] & 4)) { if (this->unk_31C == 0xE88) { - if (!(gSaveContext.weekEventReg[41] & 8) || Interface_HasEmptyBottle()) { + if (!(gSaveContext.save.weekEventReg[41] & 8) || Interface_HasEmptyBottle()) { return 0xE89; } - gSaveContext.weekEventReg[41] |= 4; + gSaveContext.save.weekEventReg[41] |= 4; this->unk_1E4 |= 1; return 0xE94; } @@ -179,10 +179,10 @@ u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { } if ((this->unk_31C == 0xE8D) || (this->unk_31C == 0xE98)) { - if (!(gSaveContext.weekEventReg[41] & 8) || Interface_HasEmptyBottle()) { + if (!(gSaveContext.save.weekEventReg[41] & 8) || Interface_HasEmptyBottle()) { return 0xE89; } - gSaveContext.weekEventReg[41] |= 4; + gSaveContext.save.weekEventReg[41] |= 4; this->unk_1E4 |= 1; return 0xE94; } @@ -193,12 +193,12 @@ u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { return 0xE98; } - if (!(gSaveContext.weekEventReg[41] & 2)) { + if (!(gSaveContext.save.weekEventReg[41] & 2)) { switch (this->unk_31C) { case 0xE85: return 0xE86; case 0xE86: - gSaveContext.weekEventReg[41] |= 2; + gSaveContext.save.weekEventReg[41] |= 2; this->unk_1E4 |= 1; return 0xE87; default: @@ -216,7 +216,7 @@ u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { u16 func_80B50710(EnGk* this) { switch (this->unk_31C) { case 0xE8E: - gSaveContext.weekEventReg[41] |= 4; + gSaveContext.save.weekEventReg[41] |= 4; this->unk_1E4 &= ~0x10; this->unk_1E4 |= 1; return 0xE8F; @@ -225,7 +225,7 @@ u16 func_80B50710(EnGk* this) { return 0xE8B; case 0xE8B: - gSaveContext.weekEventReg[41] |= 4; + gSaveContext.save.weekEventReg[41] |= 4; this->unk_1E4 |= 0x10; this->unk_1E4 |= 1; return 0xE8C; @@ -633,7 +633,7 @@ void func_80B51760(EnGk* this, GlobalContext* globalCtx) { } } else { if (Flags_GetSwitch(globalCtx, ENGK_GET_3F00(&this->actor))) { - gSaveContext.weekEventReg[40] |= 0x40; + gSaveContext.save.weekEventReg[40] |= 0x40; this->actionFunc = func_80B51D9C; return; } @@ -648,7 +648,7 @@ void func_80B51760(EnGk* this, GlobalContext* globalCtx) { this->unk_1E4 |= 2; } } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && - (gSaveContext.entranceIndex != 0xD010)) { + (gSaveContext.save.entranceIndex != 0xD010)) { func_800B863C(&this->actor, globalCtx); } @@ -727,8 +727,8 @@ void func_80B51B40(EnGk* this, GlobalContext* globalCtx) { globalCtx->sceneLoadFlag = 0x14; globalCtx->unk_1887F = 3; gSaveContext.nextTransition = 3; - Parameter_AddMagic(globalCtx, - ((void)0, gSaveContext.unk_3F30) + (gSaveContext.doubleMagic * 0x30) + 0x30); + Parameter_AddMagic(globalCtx, ((void)0, gSaveContext.unk_3F30) + + (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30); } else { this->actionFunc = func_80B51760; } @@ -833,7 +833,7 @@ void func_80B51EA4(EnGk* this, GlobalContext* globalCtx) { } void func_80B51FD0(EnGk* this, GlobalContext* globalCtx) { - if (!(gSaveContext.weekEventReg[22] & 4)) { + if (!(gSaveContext.save.weekEventReg[22] & 4)) { if (this->unk_1E4 & 2) { func_801A4748(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); } else { @@ -851,7 +851,7 @@ void func_80B5202C(EnGk* this, GlobalContext* globalCtx) { if (!func_80B50854(this, globalCtx)) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - gSaveContext.weekEventReg[24] |= 0x80; + gSaveContext.save.weekEventReg[24] |= 0x80; this->actionFunc = func_80B51698; } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { func_800B863C(&this->actor, globalCtx); @@ -900,7 +900,7 @@ void func_80B5227C(EnGk* this, GlobalContext* globalCtx) { func_800B14D4(globalCtx, 20.0f, &this->actor.home.pos); this->unk_350 = 60; if (!(this->unk_1E4 & 0x80)) { - gSaveContext.weekEventReg[22] |= 4; + gSaveContext.save.weekEventReg[22] |= 4; } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SIT_IMT); this->unk_350 = 0x4000; @@ -960,7 +960,7 @@ void func_80B52430(EnGk* this, GlobalContext* globalCtx) { void func_80B5253C(EnGk* this, GlobalContext* globalCtx) { s32 sp24; - if (gSaveContext.weekEventReg[41] & 8) { + if (gSaveContext.save.weekEventReg[41] & 8) { sp24 = 0x93; } else { sp24 = 0x6A; @@ -969,7 +969,7 @@ void func_80B5253C(EnGk* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; if (sp24 == 0x6A) { - gSaveContext.weekEventReg[41] |= 8; + gSaveContext.save.weekEventReg[41] |= 8; } this->actionFunc = func_80B525E0; } else { @@ -990,7 +990,7 @@ void func_80B525E0(EnGk* this, GlobalContext* globalCtx) { void func_80B52654(EnGk* this, GlobalContext* globalCtx) { this->unk_350 += 0x400; if ((this->unk_1E4 & 0x80) && (globalCtx->csCtx.frames == 250)) { - gSaveContext.weekEventReg[22] |= 4; + gSaveContext.save.weekEventReg[22] |= 4; } this->unk_354 = Math_SinS(this->unk_350) * 0.006f * 0.06f; @@ -1032,10 +1032,10 @@ void EnGk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B51760; } } else if (globalCtx->sceneNum == SCENE_GORONRACE) { - if (gSaveContext.weekEventReg[33] & 0x80) { - if (gSaveContext.entranceIndex == 0xD010) { + if (gSaveContext.save.weekEventReg[33] & 0x80) { + if (gSaveContext.save.entranceIndex == 0xD010) { this->actionFunc = func_80B51760; - } else if (gSaveContext.entranceIndex == 0xD020) { + } else if (gSaveContext.save.entranceIndex == 0xD020) { this->actionFunc = func_80B52340; } else { this->actionFunc = func_80B51760; @@ -1047,7 +1047,7 @@ void EnGk_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } } else if (ENGK_GET_F(&this->actor) == ENGK_F_2) { - if (!(gSaveContext.weekEventReg[22] & 4)) { + if (!(gSaveContext.save.weekEventReg[22] & 4)) { this->actionFunc = func_80B51FD0; this->actor.draw = NULL; this->actor.flags |= ACTOR_FLAG_10; @@ -1055,7 +1055,7 @@ void EnGk_Init(Actor* thisx, GlobalContext* globalCtx) { } else { Actor_MarkForDeath(&this->actor); } - } else if (!(gSaveContext.weekEventReg[22] & 4)) { + } else if (!(gSaveContext.save.weekEventReg[22] & 4)) { this->unk_2E4 = 0; this->unk_318 = this->actor.cutscene; this->actor.flags |= ACTOR_FLAG_10; @@ -1079,7 +1079,7 @@ void EnGk_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if ((ENGK_GET_F(&this->actor) == ENGK_F_1) || - ((ENGK_GET_F(&this->actor) == ENGK_F_0) && !(gSaveContext.weekEventReg[22] & 4))) { + ((ENGK_GET_F(&this->actor) == ENGK_F_0) && !(gSaveContext.save.weekEventReg[22] & 4))) { func_80B507A0(this, globalCtx); SkelAnime_Update(&this->skelAnime); func_800E9250(globalCtx, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); @@ -1238,7 +1238,7 @@ void EnGk_Draw(Actor* thisx, GlobalContext* globalCtx) { func_8012C28C(globalCtx->state.gfxCtx); - if ((ENGK_GET_F(&this->actor) == ENGK_F_0) && (gSaveContext.weekEventReg[22] & 4)) { + if ((ENGK_GET_F(&this->actor) == ENGK_F_0) && (gSaveContext.save.weekEventReg[22] & 4)) { Matrix_InsertXRotation_s(-0x4000, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index b034a5899e..50a809dfd5 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -382,7 +382,7 @@ s32 func_8094E52C(EnGm* this, GlobalContext* globalCtx) { } case 2: - if (!(gSaveContext.weekEventReg[86] & 0x40) && (this->unk_3E0 == 2)) { + if (!(gSaveContext.save.weekEventReg[86] & 0x40) && (this->unk_3E0 == 2)) { ActorCutscene_Stop(sp2A); } else { Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); @@ -552,8 +552,8 @@ s32 func_8094EB1C(EnGm* this, GlobalContext* globalCtx) { switch (this->unk_3E0) { case 0: - if ((gSaveContext.weekEventReg[50] & 1) || (gSaveContext.weekEventReg[51] & 0x80) || - (gSaveContext.weekEventReg[75] & 2)) { + if ((gSaveContext.save.weekEventReg[50] & 1) || (gSaveContext.save.weekEventReg[51] & 0x80) || + (gSaveContext.save.weekEventReg[75] & 2)) { ret = true; break; } @@ -659,14 +659,14 @@ s32 func_8094EE84(EnGm* this, GlobalContext* globalCtx) { this->actor.child = this->unk_268; this->unk_264 = func_8094EDBC(this, globalCtx); - if ((this->unk_258 == 5) && !(gSaveContext.weekEventReg[50] & 1) && - !(gSaveContext.weekEventReg[51] & 0x80) && !(gSaveContext.weekEventReg[75] & 2)) { + if ((this->unk_258 == 5) && !(gSaveContext.save.weekEventReg[50] & 1) && + !(gSaveContext.save.weekEventReg[51] & 0x80) && !(gSaveContext.save.weekEventReg[75] & 2)) { this->unk_3A4 |= 0x20; } else if ((this->unk_258 != 1) && (this->unk_258 != 5) && (this->unk_258 != 7)) { this->unk_3A4 |= 0x20; } - if ((this->unk_258 == 3) && (gSaveContext.weekEventReg[75] & 1)) { + if ((this->unk_258 == 3) && (gSaveContext.save.weekEventReg[75] & 1)) { this->unk_3A4 &= ~0x20; } @@ -920,7 +920,7 @@ s32 func_8094F7D0(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { - u16 sp56 = gSaveContext.time - 0x3FFC; + u16 sp56 = gSaveContext.save.time - 0x3FFC; u8 sp55 = ENGM_GET_FF(&this->actor); EnDoor* door; Vec3s* sp4C; @@ -966,7 +966,7 @@ s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } s32 func_8094FAC4(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { - u16 sp2E = gSaveContext.time - 0x3FFC; + u16 sp2E = gSaveContext.save.time - 0x3FFC; u16 phi_v1; u8 sp2B = ENGM_GET_FF(&this->actor); s32 pad; @@ -1052,7 +1052,7 @@ s32 func_8094FE10(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar func_8094E054(this, globalCtx, 11); SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_268 = al; - if (!(gSaveContext.weekEventReg[86] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[86] & 0x20)) { this->unk_3C8 = 2; this->unk_3CA = 2; this->unk_3CC = 8; @@ -1267,7 +1267,7 @@ s32 func_80950490(EnGm* this, GlobalContext* globalCtx) { }; s32 pad; - if ((gSaveContext.weekEventReg[50] & 1) || (gSaveContext.weekEventReg[51] & 0x80)) { + if ((gSaveContext.save.weekEventReg[50] & 1) || (gSaveContext.save.weekEventReg[51] & 0x80)) { if (this->unk_400 == 0) { this->unk_3C8 = 1; this->unk_3CA = 1; @@ -1493,7 +1493,7 @@ void func_80950C24(EnGm* this, GlobalContext* globalCtx) { } void func_80950CDC(EnGm* this, GlobalContext* globalCtx) { - u32* unk_14 = &gSaveContext.unk_14; + u32* unk_14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 sp20; this->unk_3C4 = REG(15) + *unk_14; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index f173e26f94..dbe7c3d72b 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -536,7 +536,7 @@ s32 func_80A1222C(EnGo* this, GlobalContext* globalCtx) { if (((player->transformation == PLAYER_FORM_GORON) && (globalCtx->msgCtx.ocarinaMode == 3) && (globalCtx->msgCtx.unk1202E == 1) && (this->unk_3EC == 0) && (this->actor.xzDistToPlayer < 400.0f)) || - (!(gSaveContext.weekEventReg[22] & 4) && (globalCtx->sceneNum == SCENE_16GORON_HOUSE) && + (!(gSaveContext.save.weekEventReg[22] & 4) && (globalCtx->sceneNum == SCENE_16GORON_HOUSE) && (gSaveContext.sceneSetupIndex == 0) && (this->unk_3EC == 0) && (globalCtx->csCtx.currentCsIndex == 1))) { ret = true; } @@ -943,7 +943,7 @@ void func_80A132C8(EnGo* this, GlobalContext* globalCtx) { if ((fabsf(this->actor.playerHeightRel) > 20.0f) || (this->actor.xzDistToPlayer > 300.0f)) { SubS_UpdateFlags(&this->unk_390, 3, 7); } else if ((player->transformation != PLAYER_FORM_GORON) || (ABS_ALT(temp_v1) >= 0x1C70) || - (gSaveContext.weekEventReg[21] & 4) || (gSaveContext.weekEventReg[21] & 8)) { + (gSaveContext.save.weekEventReg[21] & 4) || (gSaveContext.save.weekEventReg[21] & 8)) { SubS_UpdateFlags(&this->unk_390, 3, 7); } else { SubS_UpdateFlags(&this->unk_390, 4, 7); @@ -951,7 +951,7 @@ void func_80A132C8(EnGo* this, GlobalContext* globalCtx) { } void func_80A133A8(EnGo* this, GlobalContext* globalCtx) { - if (gSaveContext.weekEventReg[21] & 8) { + if (gSaveContext.save.weekEventReg[21] & 8) { SubS_UpdateFlags(&this->unk_390, 3, 7); } else { SubS_UpdateFlags(&this->unk_390, 4, 7); @@ -986,7 +986,7 @@ Actor* func_80A13400(EnGo* this, GlobalContext* globalCtx) { } void func_80A134B0(EnGo* this, GlobalContext* globalCtx, s32 arg2) { - if ((gSaveContext.weekEventReg[18] & 0x80) || (globalCtx->actorCtx.unk5 & 1) || arg2) { + if ((gSaveContext.save.weekEventReg[18] & 0x80) || (globalCtx->actorCtx.unk5 & 1) || arg2) { this->colliderSphere.dim.modelSphere.radius = 300; } else { this->colliderSphere.dim.modelSphere.radius = 380; @@ -1177,7 +1177,7 @@ s32 func_80A13B1C(EnGo* this, GlobalContext* globalCtx) { func_80A13728(this, globalCtx); this->unk_3C4++; this->unk_3C2 = 0; - gSaveContext.weekEventReg[88] |= 0x40; + gSaveContext.save.weekEventReg[88] |= 0x40; } break; @@ -1197,19 +1197,19 @@ s32 func_80A13B1C(EnGo* this, GlobalContext* globalCtx) { if (this->unk_3C0 >= 65) { switch (player->transformation) { case 4: - gSaveContext.weekEventReg[88] |= 0x80; + gSaveContext.save.weekEventReg[88] |= 0x80; break; case 1: - gSaveContext.weekEventReg[89] |= 4; + gSaveContext.save.weekEventReg[89] |= 4; break; case 2: - gSaveContext.weekEventReg[89] |= 2; + gSaveContext.save.weekEventReg[89] |= 2; break; case 3: - gSaveContext.weekEventReg[89] |= 1; + gSaveContext.save.weekEventReg[89] |= 1; break; } ret = true; @@ -1373,8 +1373,8 @@ void func_80A143A8(EnGo* this, GlobalContext* globalCtx) { } void func_80A14430(EnGo* this, GlobalContext* globalCtx) { - if (((gSaveContext.entranceIndex == 0xD000) || (gSaveContext.entranceIndex == 0xD020)) && - (gSaveContext.weekEventReg[33] & 0x80)) { + if (((gSaveContext.save.entranceIndex == 0xD000) || (gSaveContext.save.entranceIndex == 0xD020)) && + (gSaveContext.save.weekEventReg[33] & 0x80)) { func_80A14018(this, globalCtx); this->actionFunc = func_80A149B0; } else { @@ -1383,7 +1383,7 @@ void func_80A14430(EnGo* this, GlobalContext* globalCtx) { } void func_80A1449C(EnGo* this, GlobalContext* globalCtx) { - if ((gSaveContext.entranceIndex == 0xD010) || (gSaveContext.entranceIndex == 0x1C00)) { + if ((gSaveContext.save.entranceIndex == 0xD010) || (gSaveContext.save.entranceIndex == 0x1C00)) { func_80A14104(this, globalCtx); this->actionFunc = func_80A149B0; } else { @@ -1392,7 +1392,7 @@ void func_80A1449C(EnGo* this, GlobalContext* globalCtx) { } void func_80A144F4(EnGo* this, GlobalContext* globalCtx) { - if (gSaveContext.day >= 2) { + if (gSaveContext.save.day >= 2) { this->unk_284 = func_8013BEDC(globalCtx, ENGO_GET_7F80(&this->actor), 0xFF, &this->unk_3E4); if (this->unk_284 != NULL) { this->unk_3E4 = 1; @@ -1411,7 +1411,7 @@ void func_80A145AC(EnGo* this, GlobalContext* globalCtx) { if ((ENGO_GET_70(&this->actor) == ENGO_70_1) && (((globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && (globalCtx->csCtx.currentCsIndex == 0)) || - !(gSaveContext.weekEventReg[21] & 8))) { + !(gSaveContext.save.weekEventReg[21] & 8))) { this->actor.child = func_80A13400(this, globalCtx); this->actor.child->child = &this->actor; func_80A141D4(this, globalCtx); @@ -1423,7 +1423,7 @@ void func_80A145AC(EnGo* this, GlobalContext* globalCtx) { } void func_80A14668(EnGo* this, GlobalContext* globalCtx) { - if (!(gSaveContext.weekEventReg[22] & 4)) { + if (!(gSaveContext.save.weekEventReg[22] & 4)) { func_80A14324(this, globalCtx); this->actionFunc = func_80A149B0; } else { @@ -1511,7 +1511,7 @@ void func_80A14798(EnGo* this, GlobalContext* globalCtx) { void func_80A149B0(EnGo* this, GlobalContext* globalCtx) { s16 sp26 = this->actor.world.rot.y; - if ((ENGO_GET_F(&this->actor) == ENGO_F_2) && (gSaveContext.entranceIndex == 0xD010)) { + if ((ENGO_GET_F(&this->actor) == ENGO_F_2) && (gSaveContext.save.entranceIndex == 0xD010)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_CHEER - SFX_FLAG); } else if (ENGO_GET_F(&this->actor) != ENGO_F_8) { if (func_80A1222C(this, globalCtx)) { @@ -1568,7 +1568,7 @@ void func_80A14B30(EnGo* this, GlobalContext* globalCtx) { this->unk_390 &= ~0x200; this->unk_390 |= 0x8000; this->actor.shape.yOffset = 0.0f; - } else if ((this->unk_3EC != 0) && (gSaveContext.weekEventReg[22] & 4)) { + } else if ((this->unk_3EC != 0) && (gSaveContext.save.weekEventReg[22] & 4)) { this->actor.scale.x = this->unk_3A4 - (Math_SinS(this->unk_3AE) * 0.001f); this->actor.scale.y = (Math_SinS(this->unk_3AE) * 0.001f) + this->unk_3A4; this->actor.scale.z = (Math_SinS(this->unk_3AE) * 0.001f) + this->unk_3A4; @@ -1771,7 +1771,7 @@ void func_80A153FC(EnGo* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_COLD); - if (gSaveContext.day == 3) { + if (gSaveContext.save.day == 3) { func_80A141D4(this, globalCtx); this->actionFunc = func_80A14E14; } else { diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index b0a451aab3..3e7f73775e 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -112,7 +112,7 @@ s8 func_80997A90(s16 arg0, s16 arg1) { if ((arg0 == 0) || ((arg0 != 1) && (arg0 != 2) && (arg0 == 3))) { phi_v1 = 0; } else { - phi_v1 = (gSaveContext.unk_EC4 >> (arg1 * 3)) & 7; + phi_v1 = (gSaveContext.save.unk_EC4 >> (arg1 * 3)) & 7; } return phi_v1; } @@ -296,7 +296,7 @@ void func_8099807C(EnGs* this, GlobalContext* globalCtx) { break; case 0: - if ((this->actor.params == ENGS_1) && (gSaveContext.playerForm == PLAYER_FORM_DEKU)) { + if ((this->actor.params == ENGS_1) && (gSaveContext.save.playerForm == PLAYER_FORM_DEKU)) { this->unk_194 = 1; this->unk_19C = 5; this->unk_19A |= 1; @@ -306,7 +306,7 @@ void func_8099807C(EnGs* this, GlobalContext* globalCtx) { break; case 2: - if ((this->actor.params == ENGS_1) && (gSaveContext.playerForm == PLAYER_FORM_ZORA)) { + if ((this->actor.params == ENGS_1) && (gSaveContext.save.playerForm == PLAYER_FORM_ZORA)) { this->unk_194 = 3; this->unk_19C = 5; this->unk_19A |= 1; @@ -316,7 +316,7 @@ void func_8099807C(EnGs* this, GlobalContext* globalCtx) { break; case 1: - if ((this->actor.params == ENGS_1) && (gSaveContext.playerForm == PLAYER_FORM_GORON)) { + if ((this->actor.params == ENGS_1) && (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { this->unk_194 = 2; this->unk_19C = 5; this->unk_19A |= 1; @@ -388,8 +388,8 @@ void func_809985B8(EnGs* this, GlobalContext* globalCtx) { Math_Vec3f_Sum(&player->actor.world.pos, &sp38, &player->actor.world.pos); Math_Vec3f_Copy(&player->actor.prevPos, &player->actor.world.pos); this->unk_200 = 0.0f; - gSaveContext.unk_EC4 = - ((u32)gSaveContext.unk_EC4 & ~(7 << (this->unk_198 * 3))) | ((this->unk_194 & 7) << (this->unk_198 * 3)); + gSaveContext.save.unk_EC4 = ((u32)gSaveContext.save.unk_EC4 & ~(7 << (this->unk_198 * 3))) | + ((this->unk_194 & 7) << (this->unk_198 * 3)); gossipStone = NULL; do { @@ -450,7 +450,7 @@ void func_8099874C(EnGs* this, GlobalContext* globalCtx) { phi_v0 = 1; for (i = 0; i < 4; i++) { - if (((gSaveContext.unk_EC4 >> (i * 3)) & 7) != (u32)this->unk_194) { + if (((gSaveContext.save.unk_EC4 >> (i * 3)) & 7) != (u32)this->unk_194) { phi_v0 = 0; } } @@ -459,29 +459,29 @@ void func_8099874C(EnGs* this, GlobalContext* globalCtx) { this->unk_20C = -1; switch (this->unk_194) { case 1: - if (!(gSaveContext.weekEventReg[77] & 8)) { + if (!(gSaveContext.save.weekEventReg[77] & 8)) { this->unk_20C = 6; - gSaveContext.weekEventReg[77] |= 8; + gSaveContext.save.weekEventReg[77] |= 8; } break; case 3: - if (!(gSaveContext.weekEventReg[77] & 0x10)) { + if (!(gSaveContext.save.weekEventReg[77] & 0x10)) { this->unk_20C = 6; - gSaveContext.weekEventReg[77] |= 0x10; + gSaveContext.save.weekEventReg[77] |= 0x10; } break; case 2: - if (!(gSaveContext.weekEventReg[77] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[77] & 0x20)) { this->unk_20C = 6; - gSaveContext.weekEventReg[77] |= 0x20; + gSaveContext.save.weekEventReg[77] |= 0x20; } break; } - if (!(gSaveContext.weekEventReg[90] & 0x10)) { - gSaveContext.weekEventReg[90] |= 0x10; + if (!(gSaveContext.save.weekEventReg[90] & 0x10)) { + gSaveContext.save.weekEventReg[90] |= 0x10; this->unk_20C = 12; } diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c index 9eef9f1881..2434ca2cf0 100644 --- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c +++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c @@ -108,7 +108,7 @@ void EnGuardNuts_Init(Actor* thisx, GlobalContext* globalCtx) { sGuardCount++; // If you have returned deku princess guards will init burrowed. - if (!(gSaveContext.weekEventReg[23] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { EnGuardNuts_SetupWait(this); } else { EnGuardNuts_Burrow(this, globalCtx); @@ -157,10 +157,10 @@ void EnGuardNuts_Wait(EnGuardNuts* this, GlobalContext* globalCtx) { if (player->transformation == PLAYER_FORM_DEKU) { // this is the palace of... this->guardTextIndex = 0; - if ((gSaveContext.weekEventReg[17] & 4) && (!this->hasCompletedConversation)) { + if ((gSaveContext.save.weekEventReg[17] & 4) && (!this->hasCompletedConversation)) { // I told you not to enter!! this->guardTextIndex = 7; - } else if (gSaveContext.weekEventReg[12] & 0x40) { + } else if (gSaveContext.save.weekEventReg[12] & 0x40) { // come to see the monkey again? this->guardTextIndex = 4; } @@ -233,7 +233,7 @@ void func_80ABB590(EnGuardNuts* this, GlobalContext* globalCtx) { if (D_80ABBE38[this->guardTextIndex] == 2) { func_801477B4(globalCtx); D_80ABBE20 = 2; - gSaveContext.weekEventReg[12] |= 0x40; + gSaveContext.save.weekEventReg[12] |= 0x40; EnGuardNuts_Burrow(this, globalCtx); } else { this->guardTextIndex++; @@ -299,7 +299,7 @@ void EnGuardNuts_Unburrow(EnGuardNuts* this, GlobalContext* globalCtx) { Vec3f digPos; // If you have returned Deku Princess, guards will not unburrow - if (!(gSaveContext.weekEventReg[23] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); if ((yawDiff < 0x4000) && ((D_80ABBE20 == 0) || (this->actor.xzDistToPlayer > 150.0f))) { Math_Vec3f_Copy(&digPos, &this->actor.world.pos); diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index 5e16755832..8844062b80 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -79,7 +79,7 @@ void EnGuruguru_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params != 2) { Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); } - if (!gSaveContext.isNight) { + if (!gSaveContext.save.isNight) { if (this->actor.params == 0) { func_80BC6E10(this); } else if (this->actor.params == 2) { @@ -119,10 +119,10 @@ void func_80BC6E10(EnGuruguru* this) { this->textIdIndex = 0; this->unk270 = 0; if (this->actor.params == 0) { - if (gSaveContext.weekEventReg[38] & 0x10) { + if (gSaveContext.save.weekEventReg[38] & 0x10) { this->textIdIndex = 1; } - } else if (gSaveContext.weekEventReg[38] & 0x40) { + } else if (gSaveContext.save.weekEventReg[38] & 0x40) { this->textIdIndex = 2; } else { this->textIdIndex = 3; @@ -131,8 +131,8 @@ void func_80BC6E10(EnGuruguru* this) { this->headZRotTarget = 0; this->unk268 = 1; this->actor.textId = textIDs[this->textIdIndex]; - if ((this->textIdIndex == 0 || this->textIdIndex == 1) && (gSaveContext.weekEventReg[77] & 4)) { - if (!(gSaveContext.weekEventReg[88] & 4)) { + if ((this->textIdIndex == 0 || this->textIdIndex == 1) && (gSaveContext.save.weekEventReg[77] & 4)) { + if (!(gSaveContext.save.weekEventReg[88] & 4)) { this->actor.textId = 0x295F; } else { this->actor.textId = 0x2960; @@ -153,7 +153,7 @@ void func_80BC6F14(EnGuruguru* this, GlobalContext* globalCtx) { this->textIdIndex = 3; if (player->transformation == PLAYER_FORM_DEKU) { this->textIdIndex = 13; - if (gSaveContext.weekEventReg[79] & 4) { + if (gSaveContext.save.weekEventReg[79] & 4) { this->textIdIndex = 14; } } @@ -212,16 +212,16 @@ void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) { this->headZRotTarget = 0; if ((this->textIdIndex == 13) || (this->textIdIndex == 14)) { func_80151BB4(globalCtx, 0x13); - gSaveContext.weekEventReg[79] |= 4; + gSaveContext.save.weekEventReg[79] |= 4; func_80BC6E10(this); return; } if (this->actor.params == 0) { if (this->actor.textId == 0x295F) { - gSaveContext.weekEventReg[88] |= 4; + gSaveContext.save.weekEventReg[88] |= 4; } if (this->actor.textId == 0x292A) { - gSaveContext.weekEventReg[38] |= 0x10; + gSaveContext.save.weekEventReg[38] |= 0x10; } func_80151BB4(globalCtx, 0x13); func_80BC6E10(this); @@ -232,7 +232,7 @@ void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) { return; } if (this->textIdIndex == 12) { - gSaveContext.weekEventReg[38] |= 0x40; + gSaveContext.save.weekEventReg[38] |= 0x40; func_801A3B48(0); func_80151BB4(globalCtx, 0x36); func_80151BB4(globalCtx, 0x13); @@ -297,7 +297,7 @@ void func_80BC7440(EnGuruguru* this, GlobalContext* globalCtx) { func_801A3B48(1); func_800B8500(&this->actor, globalCtx, 400.0f, 400.0f, EXCH_ITEM_MINUS1); this->unk268 = 0; - gSaveContext.weekEventReg[38] |= 0x40; + gSaveContext.save.weekEventReg[38] |= 0x40; this->actionFunc = func_80BC7520; } else { Actor_PickUp(&this->actor, globalCtx, GI_MASK_BREMEN, 300.0f, 300.0f); @@ -319,7 +319,7 @@ void EnGuruguru_Update(Actor* thisx, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); s16 yawTemp; - if (!gSaveContext.isNight) { + if (!gSaveContext.save.isNight) { if (this->actor.params == 1) { Actor_MarkForDeath(&this->actor); return; diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c index 7d485ce611..d7ec6103f4 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -324,7 +324,7 @@ void func_80B23910(EnHanabi* this, GlobalContext* globalCtx) { } void func_80B23934(EnHanabi* this, GlobalContext* globalCtx) { - if ((gSaveContext.entranceIndex == 0x5410) && (gSaveContext.sceneSetupIndex == 7)) { + if ((gSaveContext.save.entranceIndex == 0x5410) && (gSaveContext.sceneSetupIndex == 7)) { if (globalCtx->csCtx.frames > 1650) { func_80B236C8(this, globalCtx); func_800B8FE8(&this->actor, NA_SE_EV_FIREWORKS_LAUNCH - SFX_FLAG); diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c index 14bbf6a995..bb2fb002b7 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -73,14 +73,16 @@ void EnHeishi_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->paramsCopy == 0) { this->shouldSetHeadRotation = 1; - if (!(gSaveContext.weekEventReg[63] & 0x80) && !((gSaveContext.day == 3) && gSaveContext.isNight)) { + if (!(gSaveContext.save.weekEventReg[63] & 0x80) && + !((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { Actor_MarkForDeath(&this->actor); } } else { this->colliderCylinder.dim.radius = 30; this->colliderCylinder.dim.height = 60; this->colliderCylinder.dim.yShift = 0; - if ((gSaveContext.weekEventReg[63] & 0x80) || ((gSaveContext.day == 3) && gSaveContext.isNight)) { + if ((gSaveContext.save.weekEventReg[63] & 0x80) || + ((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { Actor_MarkForDeath(&this->actor); } } @@ -150,7 +152,7 @@ void EnHeishi_Update(Actor* thisx, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y; - if ((this->paramsCopy != 0) && (gSaveContext.day == 3) && gSaveContext.isNight) { + if ((this->paramsCopy != 0) && (gSaveContext.save.day == 3) && gSaveContext.save.isNight) { Actor_MarkForDeath(&this->actor); } else { this->actionFunc(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index 2af301e139..0bbef0b9e3 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -126,7 +126,7 @@ void EnHg_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); - if ((gSaveContext.weekEventReg[75] & 0x20) || (gSaveContext.weekEventReg[52] & 0x20)) { + if ((gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.weekEventReg[52] & 0x20)) { Actor_MarkForDeath(&this->actor); } this->actor.targetMode = 1; @@ -304,7 +304,7 @@ void func_80BCF95C(EnHg* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); break; case 6: - gSaveContext.weekEventReg[75] |= 0x20; + gSaveContext.save.weekEventReg[75] |= 0x20; Actor_MarkForDeath(&this->actor); break; } @@ -358,7 +358,7 @@ void func_80BCFC0C(EnHg* this, GlobalContext* globalCtx) { D_80BD00C8 = false; } if (globalCtx->msgCtx.ocarinaMode == 3) { - if (globalCtx->msgCtx.unk1202E == 7 && gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + if (globalCtx->msgCtx.unk1202E == 7 && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { if (INV_CONTENT(ITEM_MASK_GIBDO) == ITEM_MASK_GIBDO) { this->unk218 = 3; } else { @@ -369,8 +369,8 @@ void func_80BCFC0C(EnHg* this, GlobalContext* globalCtx) { } else { if (this->actor.xzDistToPlayer < 60.0f && fabsf(this->actor.playerHeightRel) < 40.0f) { if ((this->actionFunc != func_80BCF8A0) && (this->actionFunc != func_80BCF95C)) { - if (!(gSaveContext.weekEventReg[61] & 2)) { - gSaveContext.weekEventReg[61] |= 2; + if (!(gSaveContext.save.weekEventReg[61] & 2)) { + gSaveContext.save.weekEventReg[61] |= 2; this->unk218 = 0; } else { this->unk218 = 2; diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c index b827e4d623..2aa2178463 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -94,7 +94,7 @@ void EnHgo_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_314 = 0; this->unk_310 = 0; this->unk_312 = 0; - if ((gSaveContext.weekEventReg[75] & 0x20) || (gSaveContext.weekEventReg[52] & 0x20)) { + if ((gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.weekEventReg[52] & 0x20)) { func_80BD049C(this); } else { thisx->draw = NULL; @@ -144,7 +144,7 @@ void func_80BD04E0(EnHgo* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x15A7, &this->actor); this->unk_314 = 0x15A7; // can I research that mask } - } else if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { if (!(this->unk_310 & 1)) { this->unk_310 |= 1; Message_StartTextbox(globalCtx, 0x158F, &this->actor); @@ -201,7 +201,7 @@ void func_80BD06FC(EnHgo* this, GlobalContext* globalCtx) { this->unk_314 = 0x1590; break; case 0x1590: - if (gSaveContext.weekEventReg[14] & 4) { + if (gSaveContext.save.weekEventReg[14] & 4) { Message_StartTextbox(globalCtx, 0x1591, &this->actor); this->unk_314 = 0x1591; break; @@ -303,7 +303,7 @@ s32 func_80BD0898(EnHgo* this, GlobalContext* globalCtx) { Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); return true; } - if ((globalCtx->csCtx.state == 0) && (((gSaveContext.weekEventReg[75]) & 0x20)) && + if ((globalCtx->csCtx.state == 0) && (((gSaveContext.save.weekEventReg[75]) & 0x20)) && (this->actionFunc == func_80BD0410)) { this->actor.shape.rot.y = this->actor.world.rot.y; Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ELF_MSG2, this->actor.focus.pos.x, this->actor.focus.pos.y, diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h index 27187ee46a..1e4bf4f5a8 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h @@ -32,13 +32,14 @@ enum { #define RACE_FLAG_4 4 #define RACE_FLAGS 7 -#define GET_RACE_FLAGS (gSaveContext.weekEventReg[92] & RACE_FLAGS) +#define GET_RACE_FLAGS (gSaveContext.save.weekEventReg[92] & RACE_FLAGS) -#define SET_RACE_FLAGS(flag) { \ - gSaveContext.weekEventReg[92] &= (u8) ~RACE_FLAGS; \ - gSaveContext.weekEventReg[92] = \ - gSaveContext.weekEventReg[92] | (u8)((gSaveContext.weekEventReg[92] & ~RACE_FLAGS) | (flag)); \ -} +#define SET_RACE_FLAGS(flag) \ + { \ + gSaveContext.save.weekEventReg[92] &= (u8)~RACE_FLAGS; \ + gSaveContext.save.weekEventReg[92] = \ + gSaveContext.save.weekEventReg[92] | (u8)((gSaveContext.save.weekEventReg[92] & ~RACE_FLAGS) | (flag)); \ + } typedef struct EnHorseGameCheck { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index 93e62e137c..6ab8fb486e 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -341,7 +341,7 @@ s32 func_80BF17BC(EnIg* this, GlobalContext* globalCtx) { case 1: case 3: - if (!(gSaveContext.weekEventReg[75] & 0x10) && (this->unk_3F6 == 3)) { + if (!(gSaveContext.save.weekEventReg[75] & 0x10) && (this->unk_3F6 == 3)) { ActorCutscene_Stop(sp2A); this->unk_3F6 = 5; } else { @@ -509,7 +509,7 @@ s32 func_80BF1D78(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } s32 func_80BF1DF4(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { - u16 sp56 = gSaveContext.time - 0x3FFC; + u16 sp56 = gSaveContext.save.time - 0x3FFC; u8 sp55 = ENIG_GET_FF(&this->actor); EnDoor* door; Vec3s* sp4C; @@ -554,7 +554,7 @@ s32 func_80BF1DF4(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } s32 func_80BF1FA8(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { - u16 sp2E = gSaveContext.time - 0x3FFC; + u16 sp2E = gSaveContext.save.time - 0x3FFC; u16 phi_v1; u8 sp2B = ENIG_GET_FF(&this->actor); s32 temp_t8; @@ -840,7 +840,7 @@ void func_80BF2A50(EnIg* this, GlobalContext* globalCtx) { } void func_80BF2AF8(EnIg* this, GlobalContext* globalCtx) { - u32* unk_14 = &gSaveContext.unk_14; + u32* unk_14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 sp20; this->unk_3EC = REG(15) + *unk_14; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 39ef956d5a..f3293f6dde 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -218,12 +218,11 @@ s32 func_808F3334(EnIn* this, GlobalContext* globalCtx) { } s32 func_808F33B8(void) { - s32 ret; + s32 ret = (((gSaveContext.save.day == 1) && + ((gSaveContext.save.time >= CLOCK_TIME(5, 30)) && (gSaveContext.save.time <= CLOCK_TIME(6, 0)))) || + (gSaveContext.save.day >= 2)) && + !(gSaveContext.save.weekEventReg[22] & 1); - if (((ret = gSaveContext.day == 1) && (ret = gSaveContext.time >= 0x3AAA) && (ret = gSaveContext.time <= 0x4000)) || - (ret = gSaveContext.day >= 2)) { - ret = (gSaveContext.weekEventReg[22] & 1) == 0; - } return ret; } @@ -347,7 +346,7 @@ void func_808F395C(EnIn* this, GlobalContext* globalCtx) { void func_808F39DC(EnIn* this, GlobalContext* globalCtx) { u16 textId = 0; - if (gSaveContext.day != 3) { + if (gSaveContext.save.day != 3) { switch (GET_RACE_FLAGS) { case RACE_FLAG_2: textId = 0x347A; @@ -395,7 +394,7 @@ void func_808F3B40(EnIn* this, GlobalContext* globalCtx) { this->actor.parent = NULL; this->actor.flags |= ACTOR_FLAG_10000; this->actionFunc = func_808F3AD4; - textId = gSaveContext.day != 3 ? 0x3481 : 0x34A4; + textId = gSaveContext.save.day != 3 ? 0x3481 : 0x34A4; this->actor.textId = textId; } else { Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); @@ -419,7 +418,7 @@ void func_808F3C40(EnIn* this, GlobalContext* globalCtx) { this->actor.parent = NULL; this->actor.flags |= ACTOR_FLAG_10000; this->actionFunc = func_808F3BD4; - textId = gSaveContext.day != 3 ? 0x346A : 0x3492; + textId = gSaveContext.save.day != 3 ? 0x346A : 0x3492; this->actor.textId = textId; } else { Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); @@ -442,7 +441,7 @@ void func_808F3D40(EnIn* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; this->actionFunc = func_808F3CD4; - textId = gSaveContext.day != 3 ? 0x347D : 0x34A0; + textId = gSaveContext.save.day != 3 ? 0x347D : 0x34A0; this->actor.textId = textId; this->actor.flags |= ACTOR_FLAG_10000; } else { @@ -456,7 +455,7 @@ u16 func_808F3DD4(GlobalContext* globalCtx, EnIn* this, u32 arg2) { if (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER) { s32 requiredScopeTemp; - if (!(gSaveContext.weekEventReg[63] & 0x40)) { + if (!(gSaveContext.save.weekEventReg[63] & 0x40)) { return 0x34A9; } else if (this->unk4AC & 8) { return 0x34B1; @@ -466,41 +465,43 @@ u16 func_808F3DD4(GlobalContext* globalCtx, EnIn* this, u32 arg2) { } else { switch (arg2) { case 0: - if ((gSaveContext.playerForm == PLAYER_FORM_ZORA) || (gSaveContext.playerForm == PLAYER_FORM_GORON)) { + if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || + (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { textId = 0x345C; - } else if (gSaveContext.playerForm == PLAYER_FORM_DEKU) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { textId = 0x3460; - } else if (!(gSaveContext.weekEventReg[15] & 8)) { + } else if (!(gSaveContext.save.weekEventReg[15] & 8)) { textId = 0x3458; } else { textId = 0x345B; } break; case 1: - if (!(gSaveContext.weekEventReg[15] & 0x10)) { + if (!(gSaveContext.save.weekEventReg[15] & 0x10)) { textId = 0x3463; } else { textId = 0x346B; } break; case 3: - if (gSaveContext.playerForm == PLAYER_FORM_DEKU) { + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { textId = 0x3485; - } else if (gSaveContext.playerForm == PLAYER_FORM_ZORA || - gSaveContext.playerForm == PLAYER_FORM_GORON) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA || + gSaveContext.save.playerForm == PLAYER_FORM_GORON) { textId = 0x3484; - } else if (!(gSaveContext.weekEventReg[56] & 4)) { + } else if (!(gSaveContext.save.weekEventReg[56] & 4)) { textId = 0x346D; } else { textId = 0x3482; } break; case 4: - if (gSaveContext.playerForm == PLAYER_FORM_ZORA || gSaveContext.playerForm == PLAYER_FORM_GORON) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA || + gSaveContext.save.playerForm == PLAYER_FORM_GORON) { textId = 0x348A; - } else if (gSaveContext.playerForm == PLAYER_FORM_DEKU) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { textId = 0x348B; - } else if (!(gSaveContext.weekEventReg[16] & 1)) { + } else if (!(gSaveContext.save.weekEventReg[16] & 1)) { textId = 0x3486; } else { textId = 0x3489; @@ -509,19 +510,19 @@ u16 func_808F3DD4(GlobalContext* globalCtx, EnIn* this, u32 arg2) { case 5: if (func_808F33B8()) { textId = 0x34B3; - } else if (!(gSaveContext.weekEventReg[16] & 2)) { + } else if (!(gSaveContext.save.weekEventReg[16] & 2)) { textId = 0x348E; } else { textId = 0x3493; } break; case 7: - if (gSaveContext.playerForm == PLAYER_FORM_DEKU) { + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { textId = 0x34A8; - } else if (gSaveContext.playerForm == PLAYER_FORM_ZORA || - gSaveContext.playerForm == PLAYER_FORM_GORON) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA || + gSaveContext.save.playerForm == PLAYER_FORM_GORON) { textId = 0x34A7; - } else if (!(gSaveContext.weekEventReg[16] & 4)) { + } else if (!(gSaveContext.save.weekEventReg[16] & 4)) { textId = 0x3495; } else { textId = 0x34A5; @@ -572,9 +573,9 @@ s32 func_808F4150(GlobalContext* globalCtx, EnIn* this, s32 arg2, MessageContext if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.rupees >= globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { func_801159EC(-globalCtx->msgCtx.unk1206C); - if (!(gSaveContext.weekEventReg[57] & 1)) { + if (!(gSaveContext.save.weekEventReg[57] & 1)) { func_808F4108(this, globalCtx, 0x3474); } else if (this->unk4AC & 8) { func_808F4108(this, globalCtx, 0x3475); @@ -598,9 +599,9 @@ s32 func_808F4270(GlobalContext* globalCtx, EnIn* this, s32 arg2, MessageContext if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.rupees >= fee) { + if (gSaveContext.save.playerData.rupees >= fee) { func_801159EC(-fee); - if (!(gSaveContext.weekEventReg[57] & 1)) { + if (!(gSaveContext.save.weekEventReg[57] & 1)) { if (arg4 != 0) { func_800E8EA0(globalCtx, &this->actor, 0x3474); } else { @@ -648,7 +649,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { break; case 0x34A9: func_808F4108(this, globalCtx, 0x34AA); - gSaveContext.weekEventReg[63] |= 0x40; + gSaveContext.save.weekEventReg[63] |= 0x40; ret = false; break; case 0x34AA: @@ -679,7 +680,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { case 0: switch (textId) { case 0x3458: - gSaveContext.weekEventReg[15] |= 8; + gSaveContext.save.weekEventReg[15] |= 8; func_800E8EA0(globalCtx, &this->actor, 0x3459); ret = false; break; @@ -728,7 +729,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { case 1: switch (textId) { case 0x3463: - gSaveContext.weekEventReg[15] |= 0x10; + gSaveContext.save.weekEventReg[15] |= 0x10; func_800E8EA0(globalCtx, &this->actor, 0x3464); ret = false; break; @@ -743,7 +744,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { case 0x3466: if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.rupees >= globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { if (Interface_HasEmptyBottle()) { this->actionFunc = func_808F3C40; Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); @@ -804,12 +805,12 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { break; case 0x3472: func_808F43E0(this); - gSaveContext.weekEventReg[56] &= (u8)~8; + gSaveContext.save.weekEventReg[56] &= (u8)~8; func_80151BB4(globalCtx, 0x11); ret = true; break; case 0x3473: - gSaveContext.weekEventReg[56] &= (u8)~8; + gSaveContext.save.weekEventReg[56] &= (u8)~8; func_80151BB4(globalCtx, 0x11); break; case 0x3475: @@ -818,7 +819,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { globalCtx->nextEntranceIndex = 0xCE50; globalCtx->unk_1887F = 5; globalCtx->sceneLoadFlag = 0x14; - gSaveContext.weekEventReg[57] |= 1; + gSaveContext.save.weekEventReg[57] |= 1; break; case 0x3478: if (msgCtx->choiceIndex == 0) { @@ -826,14 +827,14 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { ret = false; } else { func_8019F230(); - gSaveContext.weekEventReg[56] &= (u8)~8; + gSaveContext.save.weekEventReg[56] &= (u8)~8; func_808F4108(this, globalCtx, 0x3479); ret = false; } break; case 0x347B: func_808F4108(this, globalCtx, 0x347C); - gSaveContext.weekEventReg[56] &= (u8)~8; + gSaveContext.save.weekEventReg[56] &= (u8)~8; ret = false; break; } @@ -842,8 +843,8 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { switch (textId) { case 0x346D: func_808F4108(this, globalCtx, 0x346E); - gSaveContext.weekEventReg[56] |= 4; - gSaveContext.weekEventReg[56] |= 8; + gSaveContext.save.weekEventReg[56] |= 4; + gSaveContext.save.weekEventReg[56] |= 8; ret = false; break; case 0x346F: @@ -852,7 +853,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { break; case 0x3482: func_808F4108(this, globalCtx, 0x3483); - gSaveContext.weekEventReg[56] |= 8; + gSaveContext.save.weekEventReg[56] |= 8; ret = false; break; case 0x3484: @@ -872,7 +873,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { ret = false; break; case 0x3477: - gSaveContext.weekEventReg[56] |= 8; + gSaveContext.save.weekEventReg[56] |= 8; func_808F4108(this, globalCtx, 0x3478); ret = false; break; @@ -883,7 +884,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { func_800E8EA0(globalCtx, &this->actor, 0x347E); ret = false; } else { - gSaveContext.weekEventReg[56] |= 8; + gSaveContext.save.weekEventReg[56] |= 8; func_808F4108(this, globalCtx, 0x347B); ret = false; } @@ -939,7 +940,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { switch (textId) { case 0x3486: func_800E8EA0(globalCtx, &this->actor, 0x3487); - gSaveContext.weekEventReg[16] |= 1; + gSaveContext.save.weekEventReg[16] |= 1; ret = false; break; case 0x3487: @@ -980,7 +981,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { case 0x348E: case 0x34B3: func_800E8EA0(globalCtx, &this->actor, 0x348F); - gSaveContext.weekEventReg[16] |= 2; + gSaveContext.save.weekEventReg[16] |= 2; ret = false; break; case 0x3493: @@ -995,7 +996,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { case 0x3490: if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.rupees >= globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { if (Interface_HasEmptyBottle()) { this->actionFunc = func_808F3C40; Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); @@ -1032,8 +1033,8 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { break; case 0x3495: func_808F4108(this, globalCtx, 0x3496); - gSaveContext.weekEventReg[16] |= 4; - gSaveContext.weekEventReg[56] |= 8; + gSaveContext.save.weekEventReg[16] |= 4; + gSaveContext.save.weekEventReg[56] |= 8; ret = false; break; case 0x3497: @@ -1048,11 +1049,11 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { break; case 0x34A5: func_808F4108(this, globalCtx, 0x34A6); - gSaveContext.weekEventReg[56] |= 8; + gSaveContext.save.weekEventReg[56] |= 8; ret = false; break; case 0x3473: - gSaveContext.weekEventReg[56] &= (u8)~8; + gSaveContext.save.weekEventReg[56] &= (u8)~8; func_80151BB4(globalCtx, 0x11); break; case 0x3474: @@ -1065,7 +1066,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { globalCtx->nextEntranceIndex = 0xCE50; globalCtx->unk_1887F = 5; globalCtx->sceneLoadFlag = 0x14; - gSaveContext.weekEventReg[57] |= 1; + gSaveContext.save.weekEventReg[57] |= 1; break; case 0x349D: func_808F30B0(&this->skelAnime, 1); @@ -1074,7 +1075,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { func_800E8EA0(globalCtx, &this->actor, 0x34A1); ret = false; } else { - gSaveContext.weekEventReg[56] |= 8; + gSaveContext.save.weekEventReg[56] |= 8; func_808F4108(this, globalCtx, 0x349E); ret = false; } @@ -1157,13 +1158,13 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { break; case 0x3472: func_808F43E0(this); - gSaveContext.weekEventReg[56] &= (u8)~8; + gSaveContext.save.weekEventReg[56] &= (u8)~8; func_80151BB4(globalCtx, 0x11); ret = true; break; case 0x349E: func_808F4108(this, globalCtx, 0x349F); - gSaveContext.weekEventReg[56] &= (u8)~8; + gSaveContext.save.weekEventReg[56] &= (u8)~8; ret = false; break; } @@ -1274,7 +1275,7 @@ s32 func_808F5994(EnIn* this, GlobalContext* globalCtx, Vec3f* arg2, s16 arg3) { } void func_808F5A34(EnIn* this, GlobalContext* globalCtx) { - if (gSaveContext.day != 3) { + if (gSaveContext.save.day != 3) { func_808F5728(globalCtx, this, 3, &this->unk48C); } else { func_808F5728(globalCtx, this, 7, &this->unk48C); @@ -1283,13 +1284,13 @@ void func_808F5A34(EnIn* this, GlobalContext* globalCtx) { void func_808F5A94(EnIn* this, GlobalContext* globalCtx) { if (func_800F41E4(globalCtx, &globalCtx->actorCtx)) { - if (gSaveContext.day == 3) { + if (gSaveContext.save.day == 3) { func_808F5728(globalCtx, this, 7, &this->unk48C); } else { func_808F5728(globalCtx, this, 3, &this->unk48C); } } else { - if (gSaveContext.day == 3) { + if (gSaveContext.save.day == 3) { func_808F5728(globalCtx, this, 5, &this->unk48C); } else { func_808F5728(globalCtx, this, 1, &this->unk48C); @@ -1299,17 +1300,17 @@ void func_808F5A94(EnIn* this, GlobalContext* globalCtx) { void func_808F5B58(EnIn* this, GlobalContext* globalCtx) { if (func_800F41E4(globalCtx, &globalCtx->actorCtx)) { - if ((Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.weekEventReg[63] & 0x40) || - gSaveContext.weekEventReg[56] & 8) { - if (gSaveContext.day == 3) { + if ((Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40) || + gSaveContext.save.weekEventReg[56] & 8) { + if (gSaveContext.save.day == 3) { func_808F5728(globalCtx, this, 6, &this->unk48C); } else { func_808F5728(globalCtx, this, 2, &this->unk48C); } } } else if (Player_GetMask(globalCtx) != PLAYER_MASK_CIRCUS_LEADER || - (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.weekEventReg[63] & 0x40)) { - if (gSaveContext.day == 3) { + (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40)) { + if (gSaveContext.save.day == 3) { func_808F5728(globalCtx, this, 4, &this->unk48C); } else { func_808F5728(globalCtx, this, 0, &this->unk48C); @@ -1321,9 +1322,9 @@ void func_808F5C98(EnIn* this, GlobalContext* globalCtx) { if (this->unk4B0 == RACE_FLAG_END) { this->actionFunc = func_808F5B58; } - if ((Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.weekEventReg[63] & 0x40) || - gSaveContext.weekEventReg[56] & 8) { - if (gSaveContext.day != 3) { + if ((Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40) || + gSaveContext.save.weekEventReg[56] & 8) { + if (gSaveContext.save.day != 3) { func_808F5728(globalCtx, this, 2, &this->unk48C); } else { func_808F5728(globalCtx, this, 6, &this->unk48C); @@ -1385,7 +1386,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk23D = 0; if (type == ENIN_YELLOW_SHIRT || type == ENIN_BLUE_SHIRT) { if (GET_RACE_FLAGS == RACE_FLAG_2 || (GET_RACE_FLAGS) == RACE_FLAG_3) { - gSaveContext.weekEventReg[56] &= (u8)~8; + gSaveContext.save.weekEventReg[56] &= (u8)~8; this->unk4A8 = 0; this->unk4AC |= 2; func_808F35AC(this, globalCtx); @@ -1406,7 +1407,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { } } else { if (GET_RACE_FLAGS != RACE_FLAG_START) { - gSaveContext.weekEventReg[56] &= (u8)~8; + gSaveContext.save.weekEventReg[56] &= (u8)~8; this->unk23C = 0; this->unk4AC |= 2; if (type == ENIN_BLUE_SHIRT) { @@ -1414,7 +1415,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { func_808F30B0(&this->skelAnime, 0); this->actionFunc = func_808F5A94; } else { - if (gSaveContext.weekEventReg[52] & 1) { + if (gSaveContext.save.weekEventReg[52] & 1) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_KANBAN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 0xF); @@ -1425,7 +1426,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { } } } else { - if (gSaveContext.weekEventReg[52] & 1) { + if (gSaveContext.save.weekEventReg[52] & 1) { Actor_MarkForDeath(&this->actor); } else { func_808F30B0(&this->skelAnime, 7); diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 180483cd5c..8d2f416a72 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -628,9 +628,10 @@ void func_80B439B0(s32 arg0, s32 arg1) { } if (!(arg0 & 1)) { - gSaveContext.unk_E88[arg0 >> 1] = (gSaveContext.unk_E88[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); + gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); } else { - gSaveContext.unk_E88[arg0 >> 1] = (gSaveContext.unk_E88[arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); + gSaveContext.save.unk_E88[arg0 >> 1] = + (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); } } @@ -638,19 +639,19 @@ s32 func_80B43A24(s32 arg0) { u32 phi_v1; if ((arg0 & 1) == 0) { - phi_v1 = gSaveContext.unk_E88[arg0 >> 1] & 0xFFFF; + phi_v1 = gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF; } else { - phi_v1 = (gSaveContext.unk_E88[arg0 >> 1] & 0xFFFF0000) >> 0x10; + phi_v1 = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) >> 0x10; } return phi_v1 + 0x1AAA; } void func_80B43A74(s32 arg0) { - gSaveContext.unk_E88[4] = (gSaveContext.unk_E88[4] & ~0xFF) | (arg0 & 0xFF); + gSaveContext.save.unk_E88[4] = (gSaveContext.save.unk_E88[4] & ~0xFF) | (arg0 & 0xFF); } s32 func_80B43A9C(void) { - return (gSaveContext.unk_E88[4] >> 0) & 0xFF; + return (gSaveContext.save.unk_E88[4] >> 0) & 0xFF; } s32 func_80B43AB0(void) { @@ -664,7 +665,7 @@ s32 func_80B43AB0(void) { } void func_80B43AF0(s32 arg0) { - s32 currentTime = gSaveContext.time; + s32 currentTime = gSaveContext.save.time; if (((CURRENT_DAY == 1) && (currentTime >= CLOCK_TIME(2, 30))) && (currentTime < CLOCK_TIME(5, 15))) { s32 adjustment = (0xC - func_80B43A9C()) * 25.0f; @@ -872,7 +873,7 @@ s32 func_80B44234(EnInvadepoh* this, Vec3f* vec) { void func_80B442E4(EnInvadepoh* this) { s32 pad; - s32 sp18 = gSaveContext.time; + s32 sp18 = gSaveContext.save.time; s32 temp_v1_2 = sp18 - func_80B43A24(this->actor.params & 7); if (D_80B4E940 == 1) { @@ -945,7 +946,7 @@ void func_80B44540(EnInvadepoh* this, GlobalContext* globalCtx) { } void func_80B44570(EnInvadepoh* this) { - s32 currentTime = gSaveContext.time; + s32 currentTime = gSaveContext.save.time; if ((currentTime < CLOCK_TIME(2, 0)) || (currentTime >= CLOCK_TIME(6, 0))) { this->clockTime = 0.0f; @@ -989,7 +990,7 @@ void func_80B446D0(EnInvadepoh* this, GlobalContext* globalCtx) { } void func_80B44700(EnInvadepoh* this) { - s32 currentTime = gSaveContext.time; + s32 currentTime = gSaveContext.save.time; s32 new_var4 = 0xFFFF2AAB; if ((currentTime < CLOCK_TIME(20, 0)) && (currentTime >= CLOCK_TIME(6, 0))) { @@ -1262,7 +1263,7 @@ void func_80B451A0(EnInvadepoh* this, GlobalContext* globalCtx) { if (CURRENT_DAY <= 0) { D_80B4E940 = 1; } else if (CURRENT_DAY == 1) { - currentTime = gSaveContext.time; + currentTime = gSaveContext.save.time; if ((currentTime < CLOCK_TIME(2, 30)) || (currentTime >= CLOCK_TIME(6, 0))) { D_80B4E940 = 1; } else if (currentTime < CLOCK_TIME(5, 15)) { @@ -1283,7 +1284,7 @@ void func_80B451A0(EnInvadepoh* this, GlobalContext* globalCtx) { } if (D_80B4E940 == 0) { - if (gSaveContext.weekEventReg[22] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { D_80B4E940 = 3; } else { D_80B4E940 = 4; @@ -1648,7 +1649,7 @@ void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx) { if (D_80B4E940 == 1) { func_80B46DA8(this); } else if (D_80B4E940 == 2) { - if (gSaveContext.time < CLOCK_TIME(2, 31)) { + if (gSaveContext.save.time < CLOCK_TIME(2, 31)) { func_80B46DA8(this); } else { func_80B454BC(this, globalCtx); @@ -1657,10 +1658,10 @@ void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx) { func_80B46F88(this); } } else if (D_80B4E940 == 3) { - if (gSaveContext.entranceIndex == 0x6460) { + if (gSaveContext.save.entranceIndex == 0x6460) { func_80B471C0(this); - } else if (gSaveContext.entranceIndex == 0x6470) { + } else if (gSaveContext.save.entranceIndex == 0x6470) { func_80B47248(this); } else { func_80B47248(this); @@ -1747,23 +1748,23 @@ void EnInvadepoh_InitRomani(EnInvadepoh* this, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } if (temp == 5) { - if (gSaveContext.weekEventReg[22] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { Actor_MarkForDeath(&this->actor); return; } } else if (temp == 7) { - if (gSaveContext.time < CLOCK_TIME(6, 0) && gSaveContext.time >= CLOCK_TIME(2, 15)) { + if (gSaveContext.save.time < CLOCK_TIME(6, 0) && gSaveContext.save.time >= CLOCK_TIME(2, 15)) { Actor_MarkForDeath(&this->actor); return; } } else if (temp != 8) { if (temp == 9) { - if (gSaveContext.entranceIndex != 0x6460) { + if (gSaveContext.save.entranceIndex != 0x6460) { Actor_MarkForDeath(&this->actor); return; } } else if (temp == 0xC) { - if (!(gSaveContext.weekEventReg[22] & 1)) { + if (!(gSaveContext.save.weekEventReg[22] & 1)) { Actor_MarkForDeath(&this->actor); } D_80B503F4 = this; @@ -1776,7 +1777,7 @@ void func_80B468B4(EnInvadepoh* this, GlobalContext* globalCtx) { this->actor.update = func_80B49B1C; this->actor.draw = func_80B4E3F0; func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_NPC); - if (D_80B4E940 == 1 || gSaveContext.time < CLOCK_TIME(2, 31)) { + if (D_80B4E940 == 1 || gSaveContext.save.time < CLOCK_TIME(2, 31)) { this->actor.world.pos.x += D_80B4E934.x; this->actor.world.pos.y += D_80B4E934.y + 3000.0f; this->actor.world.pos.z += D_80B4E934.z; @@ -1818,7 +1819,7 @@ void EnInvadepoh_InitCremia(EnInvadepoh* this, GlobalContext* globalCtx) { if (this->bankIndex < 0) { Actor_MarkForDeath(&this->actor); } - if (!(gSaveContext.weekEventReg[22] & 1)) { + if (!(gSaveContext.save.weekEventReg[22] & 1)) { Actor_MarkForDeath(&this->actor); } D_80B503F8 = this; @@ -1899,7 +1900,7 @@ void func_80B46DA8(EnInvadepoh* this) { } void func_80B46DC8(EnInvadepoh* this, GlobalContext* globalCtx) { - if ((gSaveContext.time < CLOCK_TIME(6, 0)) && (gSaveContext.time >= CLOCK_TIME(2, 30))) { + if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 30))) { func_80B454BC(this, globalCtx); func_80B452EC(this, globalCtx); func_80B46E20(this); @@ -1954,8 +1955,8 @@ void func_80B46F88(EnInvadepoh* this) { void func_80B46FA8(EnInvadepoh* this, GlobalContext* globalCtx) { s32 i; - if ((gSaveContext.time < CLOCK_TIME(6, 0)) && (gSaveContext.time >= CLOCK_TIME(5, 15))) { - gSaveContext.weekEventReg[22] |= 1; + if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { + gSaveContext.save.weekEventReg[22] |= 1; func_80B47064(this); } else { func_80B457A0(this); @@ -2040,7 +2041,7 @@ void func_80B47298(EnInvadepoh* this, GlobalContext* globalCtx) { globalCtx->sceneLoadFlag = 0x14; globalCtx->unk_1887F = 0x48; gSaveContext.nextTransition = 0x48; - gSaveContext.weekEventReg[89] |= 0x10; + gSaveContext.save.weekEventReg[89] |= 0x10; func_80B47304(this); } @@ -2289,7 +2290,7 @@ void func_80B47BAC(Actor* thisx, GlobalContext* globalCtx) { func_80B447C0(this, globalCtx); func_80B43F0C(this); func_80B4516C(this); - if (D_80B4E940 == 1 || gSaveContext.time < CLOCK_TIME(2, 31)) { + if (D_80B4E940 == 1 || gSaveContext.save.time < CLOCK_TIME(2, 31)) { func_80B47380(this); } else if (D_80B4E940 == 2) { if (this->clockTime >= 0.0001f) { @@ -3061,7 +3062,7 @@ void func_80B49DFC(EnInvadepoh* this, GlobalContext* globalCtx) { substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { if (this->actor.textId == 0x332D) { - gSaveContext.weekEventReg[54] |= 0x10; + gSaveContext.save.weekEventReg[54] |= 0x10; this->actor.textId = 0x332E; } func_80B49BD0(this); @@ -3074,7 +3075,7 @@ void func_80B49F88(Actor* thisx, GlobalContext* globalCtx) { s32 sp38; if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.time; + sp38 = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(globalCtx, &this->actor); func_80B44F58(); @@ -3086,8 +3087,8 @@ void func_80B49F88(Actor* thisx, GlobalContext* globalCtx) { func_80B44C24(this, globalCtx); func_80B43F0C(this); func_80B4516C(this); - if (0x20 & gSaveContext.weekEventReg[21]) { - if (gSaveContext.weekEventReg[54] & 0x10) { + if (0x20 & gSaveContext.save.weekEventReg[21]) { + if (gSaveContext.save.weekEventReg[54] & 0x10) { this->actor.textId = 0x332E; } else { this->actor.textId = 0x332D; @@ -3113,7 +3114,7 @@ void func_80B49F88(Actor* thisx, GlobalContext* globalCtx) { void func_80B4A168(Actor* thisx, GlobalContext* globalCtx) { EnInvadepoh* this = THIS; - if ((gSaveContext.time < CLOCK_TIME(6, 0)) && (gSaveContext.time >= CLOCK_TIME(2, 0))) { + if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 0))) { this->actor.update = func_80B4A1B8; this->actor.draw = func_80B4E324; func_80B49BD0(this); @@ -3288,7 +3289,7 @@ void func_80B4A81C(EnInvadepoh* this, GlobalContext* globalCtx) { if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { if (this->actor.textId == 0x332D) { - gSaveContext.weekEventReg[54] |= 0x10; + gSaveContext.save.weekEventReg[54] |= 0x10; this->actor.textId = 0x332E; } if (this->pathIndex == this->endPoint) { @@ -3305,7 +3306,7 @@ void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx) { s32 sp38; if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.time; + sp38 = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(globalCtx, &this->actor); func_80B44F58(); @@ -3327,8 +3328,8 @@ void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx) { func_80B43F0C(this); func_800B4AEC(globalCtx, &this->actor, 50.0f); func_80B4516C(this); - if (gSaveContext.weekEventReg[21] & 0x20) { - if (gSaveContext.weekEventReg[54] & 0x10) { + if (gSaveContext.save.weekEventReg[21] & 0x20) { + if (gSaveContext.save.weekEventReg[54] & 0x10) { this->actor.textId = 0x332E; } else { this->actor.textId = 0x332D; @@ -3342,7 +3343,7 @@ void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx) { void func_80B4AB8C(Actor* thisx, GlobalContext* globalCtx) { EnInvadepoh* this = THIS; - if ((gSaveContext.time < CLOCK_TIME(6, 0)) && (gSaveContext.time >= CLOCK_TIME(2, 15))) { + if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { this->actor.update = func_80B4ABDC; this->actor.draw = func_80B4E324; func_80B4A614(this); @@ -3376,7 +3377,7 @@ void func_80B4ACDC(EnInvadepoh* this) { } void func_80B4ACF0(EnInvadepoh* this, GlobalContext* globalCtx) { - if (gSaveContext.weekEventReg[22] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { this->actor.draw = func_80B4E324; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); func_80B4AD3C(this); @@ -3404,7 +3405,7 @@ void func_80B4ADB8(EnInvadepoh* this) { void func_80B4ADCC(EnInvadepoh* this, GlobalContext* globalCtx) { if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { if (this->textId == 0x3331) { - if (gSaveContext.weekEventReg[22] & 2) { + if (gSaveContext.save.weekEventReg[22] & 2) { EnInvadepoh_SetTextID(this, globalCtx, 0x3334); func_80151BB4(globalCtx, 0x1D); func_80151BB4(globalCtx, 5); @@ -3436,7 +3437,7 @@ void func_80B4AEDC(EnInvadepoh* this, GlobalContext* globalCtx) { } if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; - gSaveContext.weekEventReg[22] |= 2; + gSaveContext.save.weekEventReg[22] |= 2; func_80B4AF80(this); } else { Actor_PickUp(&this->actor, globalCtx, GI_MILK_BOTTLE, 2000.0f, 2000.0f); @@ -3791,7 +3792,7 @@ void func_80B4BC4C(EnInvadepoh* this, GlobalContext* globalCtx) { (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } - if (gSaveContext.time > CLOCK_TIME(20, 15)) { + if (gSaveContext.save.time > CLOCK_TIME(20, 15)) { Actor_MarkForDeath(&this->actor); } else if ((temp_t6 != NULL) && (temp_t6->actionFunc == func_80B4CB0C)) { func_80B4C1BC(this); @@ -3868,7 +3869,7 @@ void func_80B4C3A0(Actor* thisx, GlobalContext* globalCtx) { if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { s32 pad[2]; - s32 currentTime = gSaveContext.time; + s32 currentTime = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(globalCtx, &this->actor); @@ -3904,7 +3905,7 @@ void func_80B4C3A0(Actor* thisx, GlobalContext* globalCtx) { void func_80B4C568(Actor* thisx, GlobalContext* globalCtx) { EnInvadepoh* this = THIS; - if ((gSaveContext.time >= 0xD573) && (gSaveContext.time < CLOCK_TIME(20, 15))) { + if ((gSaveContext.save.time >= 0xD573) && (gSaveContext.save.time < CLOCK_TIME(20, 15))) { this->actor.update = func_80B4C5C0; this->actor.draw = func_80B4E7BC; func_80B4BBE0(this); @@ -4089,7 +4090,7 @@ void func_80B4CE54(Actor* thisx, GlobalContext* globalCtx) { s32 sp38; if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.time; + sp38 = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(globalCtx, &this->actor); @@ -4120,7 +4121,7 @@ void func_80B4CE54(Actor* thisx, GlobalContext* globalCtx) { void func_80B4CFFC(Actor* thisx, GlobalContext* globalCtx) { EnInvadepoh* this = THIS; - if ((gSaveContext.time >= CLOCK_TIME(20, 0)) && (gSaveContext.time < 0xD7E1)) { + if ((gSaveContext.save.time >= CLOCK_TIME(20, 0)) && (gSaveContext.save.time < 0xD7E1)) { this->actor.update = func_80B4D054; this->actor.draw = func_80B4E324; func_80B4C6C8(this); diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.c b/src/overlays/actors/ovl_En_Ja/z_en_ja.c index 7f6d53f607..392d8091e7 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c @@ -291,7 +291,7 @@ void func_80BC2150(EnJa* this, GlobalContext* globalCtx) { } void func_80BC21A8(EnJa* this, GlobalContext* globalCtx) { - u32* unk_14 = &gSaveContext.unk_14; + u32* unk_14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 sp18; this->unk_35C = REG(15) + *unk_14; diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index 216ce8f80d..8bc5df4cc1 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -493,14 +493,14 @@ void EnJg_Talk(EnJg* this, GlobalContext* globalCtx) { temp = this->textId; if ((temp == 0xDBB) || (temp == 0xDBC)) { - if (!(gSaveContext.weekEventReg[24] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[24] & 0x80)) { // The player hasn't talked to the Goron Child at least once, so they can't learn // the Lullaby Intro. End the current conversation with the player. globalCtx->msgCtx.msgMode = 0x43; globalCtx->msgCtx.unk12023 = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_SetupWalk; - } else if (((gSaveContext.weekEventReg[24] & 0x40)) || + } else if (((gSaveContext.save.weekEventReg[24] & 0x40)) || (CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY_INTRO))) { // The player already has the Lullaby or Lullaby Intro, so say "I'm counting on you" this->textId = EnJg_GetNextTextId(this); @@ -700,7 +700,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, GlobalContext* globalCtx) { } else { this->csAction = 99; this->freezeTimer = 1000; - gSaveContext.weekEventReg[24] |= 0x40; + gSaveContext.save.weekEventReg[24] |= 0x40; this->actionFunc = EnJg_Idle; } } @@ -830,7 +830,7 @@ s32 EnJg_GetNextTextId(EnJg* this) { return 0xDDC; // Everyone would accept you case 0xDDC: // Everyone would accept you - gSaveContext.weekEventReg[77] |= 0x80; + gSaveContext.save.weekEventReg[77] |= 0x80; return 0xDDD; // Think it over slowly default: @@ -848,7 +848,7 @@ s32 EnJg_GetStartingConversationTextId(EnJg* this, GlobalContext* globalCtx) { if (!EN_JG_IS_IN_GORON_SHRINE(&this->actor)) { if (player->transformation == PLAYER_FORM_GORON) { - if ((gSaveContext.weekEventReg[24] & 0x10) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || + if ((gSaveContext.save.weekEventReg[24] & 0x10) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY_INTRO)) { // The player has already talked as a Goron at least once. return 0xDBC; // Following me won't do you any good @@ -858,7 +858,7 @@ s32 EnJg_GetStartingConversationTextId(EnJg* this, GlobalContext* globalCtx) { return 0xDB6; // "Hunh???" } - if (gSaveContext.weekEventReg[24] & 0x20) { + if (gSaveContext.save.weekEventReg[24] & 0x20) { // The player has already talked as a non-Goron at least once. return 0xDB5; // This is our problem (repeat) } @@ -868,7 +868,7 @@ s32 EnJg_GetStartingConversationTextId(EnJg* this, GlobalContext* globalCtx) { } if (player->transformation == PLAYER_FORM_GORON) { - if (gSaveContext.weekEventReg[77] & 0x80) { + if (gSaveContext.save.weekEventReg[77] & 0x80) { // The player has heard the Goron Shrine cheer as a Goron at least once. return 0xDDE; // Come back after entering the race } @@ -908,9 +908,9 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, GlobalContext* if (this->textId == 0xDAC) { this->action = EN_JG_ACTION_FIRST_THAW; } else if (this->textId == 0xDAE) { - gSaveContext.weekEventReg[24] |= 0x20; + gSaveContext.save.weekEventReg[24] |= 0x20; } else if (this->textId == 0xDB6) { - gSaveContext.weekEventReg[24] |= 0x10; + gSaveContext.save.weekEventReg[24] |= 0x10; } Message_StartTextbox(globalCtx, this->textId, &this->actor); diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 586fe34cd6..104e2bc3c7 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -94,7 +94,7 @@ void EnJgameTsn_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.velocity.y = 0.0f; - if (gSaveContext.entranceIndex == 0x68D0) { + if (gSaveContext.save.entranceIndex == 0x68D0) { this->actor.flags |= ACTOR_FLAG_10000; } @@ -141,7 +141,7 @@ void EnJgameTsn_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnJgameTsn* this = THIS; Collider_DestroyCylinder(globalCtx, &this->collider); - gSaveContext.weekEventReg[90] &= (u8)~0x20; + gSaveContext.save.weekEventReg[90] &= (u8)~0x20; } void func_80C13B74(EnJgameTsn* this) { @@ -168,8 +168,8 @@ void func_80C13BB8(EnJgameTsn* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x10A3, &this->actor); this->unk_300 = 0x10A3; } - } else if (((gSaveContext.time > CLOCK_TIME(4, 0)) && (gSaveContext.time < CLOCK_TIME(7, 0))) || - ((gSaveContext.time > CLOCK_TIME(16, 0)) && (gSaveContext.time < CLOCK_TIME(19, 0)))) { + } else if (((gSaveContext.save.time > CLOCK_TIME(4, 0)) && (gSaveContext.save.time < CLOCK_TIME(7, 0))) || + ((gSaveContext.save.time > CLOCK_TIME(16, 0)) && (gSaveContext.save.time < CLOCK_TIME(19, 0)))) { Message_StartTextbox(globalCtx, 0x1094, &this->actor); this->unk_300 = 0x1094; } else if (this->unk_2F8 == 0) { @@ -190,7 +190,7 @@ void func_80C13BB8(EnJgameTsn* this, GlobalContext* globalCtx) { } if ((player->actor.bgCheckFlags & 1) && !(player->stateFlags1 & 0x2000) && (this->unk_2FE == 0) && - (gSaveContext.playerForm == PLAYER_FORM_HUMAN) && func_80C149B0(globalCtx, &this->unk_1F8)) { + (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) && func_80C149B0(globalCtx, &this->unk_1F8)) { this->unk_2FE = 1; func_80C13E6C(this); } else if (!(player->actor.bgCheckFlags & 1)) { @@ -209,8 +209,8 @@ void func_80C13E6C(EnJgameTsn* this) { void func_80C13E90(EnJgameTsn* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - if (((gSaveContext.time > CLOCK_TIME(4, 0)) && (gSaveContext.time < CLOCK_TIME(7, 0))) || - ((gSaveContext.time > CLOCK_TIME(16, 0)) && (gSaveContext.time < CLOCK_TIME(19, 0)))) { + if (((gSaveContext.save.time > CLOCK_TIME(4, 0)) && (gSaveContext.save.time < CLOCK_TIME(7, 0))) || + ((gSaveContext.save.time > CLOCK_TIME(16, 0)) && (gSaveContext.save.time < CLOCK_TIME(19, 0)))) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); Message_StartTextbox(globalCtx, 0x1094, &this->actor); this->unk_300 = 0x1094; @@ -286,7 +286,7 @@ void func_80C1410C(EnJgameTsn* this, GlobalContext* globalCtx) { func_801A2BB8(0x25); globalCtx->interfaceCtx.unk_280 = 1; func_80112AFC(globalCtx); - gSaveContext.weekEventReg[90] |= 0x20; + gSaveContext.save.weekEventReg[90] |= 0x20; func_8010E9F0(4, 0x78); this->actionFunc = func_80C1418C; } @@ -379,11 +379,11 @@ void func_80C14540(EnJgameTsn* this) { void func_80C14554(EnJgameTsn* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { - if (!(gSaveContext.weekEventReg[82] & 0x10)) { - gSaveContext.weekEventReg[82] |= 0x10; + if (!(gSaveContext.save.weekEventReg[82] & 0x10)) { + gSaveContext.save.weekEventReg[82] |= 0x10; } func_80C145FC(this); - } else if (gSaveContext.weekEventReg[82] & 0x10) { + } else if (gSaveContext.save.weekEventReg[82] & 0x10) { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); @@ -407,7 +407,7 @@ void func_80C14610(EnJgameTsn* this, GlobalContext* globalCtx) { void func_80C14684(EnJgameTsn* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx)) { if (globalCtx->msgCtx.choiceIndex == 0) { - if (gSaveContext.rupees >= 20) { + if (gSaveContext.save.playerData.rupees >= 20) { Message_StartTextbox(globalCtx, 0x109E, &this->actor); this->unk_300 = 0x109E; func_801159EC(-20); @@ -480,7 +480,7 @@ void func_80C147B4(EnJgameTsn* this, GlobalContext* globalCtx) { func_801477B4(globalCtx); gSaveContext.minigameState = 3; gSaveContext.unk_3DD0[4] = 5; - gSaveContext.weekEventReg[90] &= (u8)~0x20; + gSaveContext.save.weekEventReg[90] &= (u8)~0x20; func_80C144E4(this); break; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 648542adf4..c3194461d9 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -176,14 +176,14 @@ void EnKakasi_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->aboveGroundStatus) { - if (gSaveContext.weekEventReg[79] & 8) { + if (gSaveContext.save.weekEventReg[79] & 8) { this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; this->songSummonDist = 80.0f; EnKakasi_SetupIdleUnderground(this); } else { Actor_SetFocus(&this->actor, 60.0f); this->unkFunc = EnKakasi_8096F88C; - if (gSaveContext.weekEventReg[83] & 1) { + if (gSaveContext.save.weekEventReg[83] & 1) { EnKakasi_InitTimeSkipDialogue(this); } else { EnKakasi_SetupIdleStanding(this); @@ -302,13 +302,13 @@ void EnKakasi_TimeSkipDialogue(EnKakasi* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (gSaveContext.respawnFlag != -4 && gSaveContext.respawnFlag != -8) { - if (gSaveContext.time != CLOCK_TIME(6, 0) && gSaveContext.time != CLOCK_TIME(18, 0) && + if (gSaveContext.save.time != CLOCK_TIME(6, 0) && gSaveContext.save.time != CLOCK_TIME(18, 0) && !(gSaveContext.eventInf[1] & 0x80)) { if (this->actor.textId == 0) { // dialogue after skipped time 'did you feel that? went by in an instant' this->actor.textId = 0x1653; - gSaveContext.weekEventReg[83] &= (u8)~1; + gSaveContext.save.weekEventReg[83] &= (u8)~1; this->unkMsgState1AC = 5; player->stateFlags1 |= 0x20; this->actor.flags |= ACTOR_FLAG_10000; @@ -332,7 +332,7 @@ void EnKakasi_SetupIdleStanding(EnKakasi* this) { } void EnKakasi_IdleStanding(EnKakasi* this, GlobalContext* globalCtx) { - u32 saveContextDay = gSaveContext.day; + u32 saveContextDay = gSaveContext.save.day; s16 x; s16 y; @@ -361,7 +361,7 @@ void EnKakasi_IdleStanding(EnKakasi* this, GlobalContext* globalCtx) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); this->skelanime.playSpeed = 2.0f; } - } else if (saveContextDay == 3 && gSaveContext.isNight) { + } else if (saveContextDay == 3 && gSaveContext.save.isNight) { this->skelanime.playSpeed = 1.0f; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, 1); @@ -388,7 +388,7 @@ void EnKakasi_SetupDialogue(EnKakasi* this) { } void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { - u32 saveContextDay = gSaveContext.day; + u32 saveContextDay = gSaveContext.save.day; f32 currentAnimeFrame = this->skelanime.curFrame; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 2000, 0); @@ -425,16 +425,16 @@ void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { // after timeskip if (this->actor.textId == 0x1653) { - u32 saveContextDay2 = gSaveContext.day; + u32 saveContextDay2 = gSaveContext.save.day; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - if (saveContextDay2 == 3 && gSaveContext.isNight) { + if (saveContextDay2 == 3 && gSaveContext.save.isNight) { // text: dangerous outside this->actor.textId = 0x164F; - } else if (gSaveContext.isNight) { + } else if (gSaveContext.save.isNight) { // text: would you like to skip time? this->actor.textId = 0x164E; } else { @@ -475,7 +475,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - if (gSaveContext.isNight) { + if (gSaveContext.save.isNight) { this->actor.textId = 0x164E; } else { this->actor.textId = 0x1645; @@ -519,7 +519,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { this->actor.textId = 0x1658; } else if (this->actor.textId == 0x165C) { this->actor.textId = 0x165E; - } else if (saveContextDay == 3 && gSaveContext.isNight) { + } else if (saveContextDay == 3 && gSaveContext.save.isNight) { this->actor.textId = 0x164F; } else { this->actor.textId = 0x1652; @@ -788,7 +788,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { * talking before dancing the night away, and cutscene setup */ void EnKakasi_DancingRemark(EnKakasi* this, GlobalContext* globalCtx) { - u32 currentDay = gSaveContext.day; + u32 currentDay = gSaveContext.save.day; this->unkState196 = 3; if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -799,7 +799,7 @@ void EnKakasi_DancingRemark(EnKakasi* this, GlobalContext* globalCtx) { } else { ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); this->cutsceneCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); - if (currentDay == 3 && gSaveContext.isNight) { + if (currentDay == 3 && gSaveContext.save.isNight) { EnKakasi_SetupDigAway(this); } else { func_801A2BB8(NA_BGM_SARIAS_SONG); @@ -931,20 +931,20 @@ void EnKakasi_DancingNightAway(EnKakasi* this, GlobalContext* globalCtx) { if (this->unk204 == 0) { player = GET_PLAYER(globalCtx); - Play_SetRespawnData(&globalCtx->state, 0, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, 0xBFF, - &player->unk_3C0, player->unk_3CC); + Play_SetRespawnData(&globalCtx->state, RESTART_MODE_DOWN, Entrance_CreateIndexFromSpawn(0), + player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); func_80169EFC(&globalCtx->state); if (0) {} - if (gSaveContext.time > CLOCK_TIME(18, 0) || gSaveContext.time < CLOCK_TIME(6, 0)) { - gSaveContext.time = CLOCK_TIME(6, 0); + if (gSaveContext.save.time > CLOCK_TIME(18, 0) || gSaveContext.save.time < CLOCK_TIME(6, 0)) { + gSaveContext.save.time = CLOCK_TIME(6, 0); gSaveContext.respawnFlag = -4; gSaveContext.eventInf[2] |= 0x80; } else { - gSaveContext.time = CLOCK_TIME(18, 0); + gSaveContext.save.time = CLOCK_TIME(18, 0); gSaveContext.respawnFlag = -8; } - gSaveContext.weekEventReg[83] |= 1; + gSaveContext.save.weekEventReg[83] |= 1; this->unk190 = 0; this->actionFunc = EnKakasi_DoNothing; } @@ -1013,7 +1013,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.shape.yOffset, -6000.0f, 0.5f, 200.0f); if (fabsf(this->actor.shape.yOffset + 6000.0f) < 10.0f) { - gSaveContext.weekEventReg[79] |= 8; + gSaveContext.save.weekEventReg[79] |= 8; func_800B7298(globalCtx, &this->actor, 6); ActorCutscene_Stop(this->actorCutscenes[0]); this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; @@ -1031,7 +1031,7 @@ void EnKakasi_SetupIdleUnderground(EnKakasi* this) { } void EnKakasi_IdleUnderground(EnKakasi* this, GlobalContext* globalCtx) { - if ((gSaveContext.weekEventReg[79] & 8) && this->actor.xzDistToPlayer < this->songSummonDist && + if ((gSaveContext.save.weekEventReg[79] & 8) && this->actor.xzDistToPlayer < this->songSummonDist && (BREG(1) != 0 || globalCtx->msgCtx.ocarinaMode == 0xD)) { this->actor.flags &= ~ACTOR_FLAG_8000000; globalCtx->msgCtx.ocarinaMode = 4; diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 849e3e1d67..33474cda5d 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -991,7 +991,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.projectedPos.z <= 400.0f) && (this->actor.projectedPos.z > 0.0f) && (this->actor.floorHeight > -3000.0f) && ((this->bounceX != 0) || (this->bounceZ != 0))) { - u16 dayTime = gSaveContext.time; + u16 dayTime = gSaveContext.save.time; f32 shadowAlpha; if (dayTime >= CLOCK_TIME(12, 0)) { diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c index afcaafbf3c..9a42980db3 100644 --- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c +++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c @@ -71,12 +71,12 @@ void EnKbt_Destroy(Actor* thisx, GlobalContext* globalCtx) { } s32 func_80B33E64(GlobalContext* globalCtx) { - return gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1; + return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1; } s32 func_80B33E8C(GlobalContext* globalCtx) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 2))) { return true; } return false; @@ -250,7 +250,7 @@ void func_80B34314(EnKbt* this, GlobalContext* globalCtx) { } else if (this->actor.xzDistToPlayer < 250.0f) { if ((this->unk_278 != NULL) && (this->unk_278->xzDistToPlayer < 250.0f)) { if (this->unk_27C & 4) { - playerForm = gSaveContext.playerForm; + playerForm = gSaveContext.save.playerForm; if (((playerForm ^ 0) != PLAYER_FORM_HUMAN) || ((CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_KOKIRI) && (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_RAZOR) && (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED))) { @@ -266,10 +266,10 @@ void func_80B34314(EnKbt* this, GlobalContext* globalCtx) { if (this->actor.textId != 0xC37) { if (((this->actor.textId == 0xC4E) || (this->actor.textId == 0xC4F) || (this->actor.textId == 0xC50)) && - (gSaveContext.playerForm != PLAYER_FORM_HUMAN)) { + (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN)) { this->actor.textId = 0xC37; } - } else if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { if (func_80B33E8C(globalCtx)) { this->actor.textId = 0xC50; } else { diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index 973e4be9cc..92053374a1 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -109,7 +109,8 @@ void EnKendoJs_Init(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_js_Skel_006990, &object_js_Anim_000F4C, this->jointTable, this->morphTable, 13); - if ((CURRENT_DAY == 3) && !((gSaveContext.time <= CLOCK_TIME(23, 0)) && (gSaveContext.time >= CLOCK_TIME(6, 0)))) { + if ((CURRENT_DAY == 3) && + !((gSaveContext.save.time <= CLOCK_TIME(23, 0)) && (gSaveContext.save.time >= CLOCK_TIME(6, 0)))) { if (ENKENDOJS_GET_FF(&this->actor) != ENKENDOJS_FF_1) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_KANBAN, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z - 10.0f, this->actor.home.rot.x, @@ -145,7 +146,7 @@ void EnKendoJs_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnKendoJs* this = THIS; Collider_DestroyCylinder(globalCtx, &this->collider); - gSaveContext.weekEventReg[82] &= (u8)~8; + gSaveContext.save.weekEventReg[82] &= (u8)~8; } void func_80B26538(EnKendoJs* this) { @@ -166,8 +167,8 @@ void func_80B2654C(EnKendoJs* this, GlobalContext* globalCtx) { if (ENKENDOJS_GET_FF(&this->actor) == ENKENDOJS_FF_1) { Message_StartTextbox(globalCtx, 0x273C, &this->actor); this->unk_288 = 0x273C; - } else if (gSaveContext.playerForm != PLAYER_FORM_HUMAN) { - switch (gSaveContext.playerForm) { + } else if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: phi_v0 = 0; break; @@ -215,12 +216,12 @@ void func_80B26758(EnKendoJs* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx) && (this->unk_288 == 0x2716)) { switch (globalCtx->msgCtx.choiceIndex) { case 0: - if (CUR_EQUIP_VALUE_VOID(EQUIP_SWORD) == EQUIP_SWORD) { + if (GET_CUR_EQUIP_VALUE(EQUIP_SWORD) == EQUIP_SWORD) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(globalCtx, 0x272C, &this->actor); this->unk_288 = 0x272C; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - } else if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + } else if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(globalCtx, 0x2718, &this->actor); this->unk_288 = 0x2718; @@ -233,12 +234,12 @@ void func_80B26758(EnKendoJs* this, GlobalContext* globalCtx) { break; case 1: - if (CUR_EQUIP_VALUE_VOID(EQUIP_SWORD) == EQUIP_SWORD) { + if (GET_CUR_EQUIP_VALUE(EQUIP_SWORD) == EQUIP_SWORD) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(globalCtx, 0x272C, &this->actor); this->unk_288 = 0x272C; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - } else if (gSaveContext.rupees < globalCtx->msgCtx.unk12070) { + } else if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk12070) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(globalCtx, 0x2718, &this->actor); this->unk_288 = 0x2718; @@ -492,7 +493,7 @@ void func_80B27030(EnKendoJs* this, GlobalContext* globalCtx) { } void func_80B2714C(EnKendoJs* this) { - gSaveContext.weekEventReg[82] |= 8; + gSaveContext.save.weekEventReg[82] |= 8; this->unk_28C = 1; this->unk_290 = 0; this->unk_284 = 0; @@ -553,14 +554,14 @@ void func_80B27188(EnKendoJs* this, GlobalContext* globalCtx) { } if (this->unk_284 == 7) { - gSaveContext.weekEventReg[82] &= (u8)~8; + gSaveContext.save.weekEventReg[82] &= (u8)~8; func_80B26AE8(this); } } } void func_80B273D0(EnKendoJs* this) { - gSaveContext.weekEventReg[82] |= 8; + gSaveContext.save.weekEventReg[82] |= 8; this->unk_290 = 120; this->unk_284 = 0; this->unk_286 = 1; @@ -593,7 +594,7 @@ void func_80B274BC(EnKendoJs* this, GlobalContext* globalCtx) { this->unk_288 = 0x272E; } player->stateFlags1 |= 0x20; - gSaveContext.weekEventReg[82] &= (u8)~8; + gSaveContext.save.weekEventReg[82] &= (u8)~8; func_80B26AE8(this); return; } @@ -635,7 +636,7 @@ void func_80B276D8(EnKendoJs* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; func_80B27760(this); - } else if (!(gSaveContext.weekEventReg[63] & 0x20)) { + } else if (!(gSaveContext.save.weekEventReg[63] & 0x20)) { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 800.0f, 100.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_RED, 800.0f, 100.0f); @@ -650,8 +651,8 @@ void func_80B27774(EnKendoJs* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - if (!(gSaveContext.weekEventReg[63] & 0x20)) { - gSaveContext.weekEventReg[63] |= 0x20; + if (!(gSaveContext.save.weekEventReg[63] & 0x20)) { + gSaveContext.save.weekEventReg[63] |= 0x20; Message_StartTextbox(globalCtx, 0x272F, &this->actor); this->unk_288 = 0x272F; } else { diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index f41ab8de34..176a556e57 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -60,10 +60,10 @@ void EnKgy_Init(Actor* thisx, GlobalContext* globalCtx) { this->zubora = EnKgy_FindZubora(globalCtx); this->iceBlock = EnKgy_FindIceBlock(globalCtx); Flags_UnsetSwitch(globalCtx, ENKGY_GET_FE00(&this->actor) + 1); - if (Flags_GetSwitch(globalCtx, ENKGY_GET_FE00(&this->actor)) || (gSaveContext.weekEventReg[33] & 0x80)) { + if (Flags_GetSwitch(globalCtx, ENKGY_GET_FE00(&this->actor)) || (gSaveContext.save.weekEventReg[33] & 0x80)) { Flags_SetSwitch(globalCtx, ENKGY_GET_FE00(&this->actor) + 1); globalCtx->envCtx.lightSettingOverride = 1; - gSaveContext.weekEventReg[21] |= 1; + gSaveContext.save.weekEventReg[21] |= 1; if (!func_80B40D64(globalCtx)) { EnKgy_ChangeAnim(this, 4, 0, 0); this->actionFunc = func_80B425A0; @@ -80,7 +80,7 @@ void EnKgy_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.textId = 0xC50; } } else { - if (gSaveContext.weekEventReg[20] & 0x80) { + if (gSaveContext.save.weekEventReg[20] & 0x80) { EnKgy_ChangeAnim(this, 4, 0, 0); } else { EnKgy_ChangeAnim(this, 0, 0, 0); @@ -153,33 +153,33 @@ ObjIcePoly* EnKgy_FindIceBlock(GlobalContext* globalCtx) { } void func_80B40C74(GlobalContext* globalCtx) { - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 1; + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 1; if (CURRENT_DAY == 1) { - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 2; + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 2; } else { - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~2; + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~2; } } void func_80B40D00(GlobalContext* globalCtx) { - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 4; + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 4; } void func_80B40D30(GlobalContext* globalCtx) { - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~7; + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~7; } s32 func_80B40D64(GlobalContext* globalCtx) { - return gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1; + return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1; } s32 func_80B40D8C(GlobalContext* globalCtx) { - return gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 4; + return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 4; } s32 func_80B40DB4(GlobalContext* globalCtx) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 2))) { return true; } return false; @@ -362,7 +362,7 @@ void func_80B413C8(EnKgy* this) { } s32 func_80B41460(void) { - if ((gSaveContext.playerForm != PLAYER_FORM_HUMAN) || + if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || ((CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_KOKIRI) && (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_RAZOR) && (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED))) { return 0xC38; @@ -623,7 +623,7 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { case 0xC3B: switch (globalCtx->msgCtx.choiceIndex) { case 0: - if (gSaveContext.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { play_sound(NA_SE_SY_ERROR); func_80B40E74(this, globalCtx, 0xC3F); } else { @@ -1056,7 +1056,7 @@ void func_80B42D28(EnKgy* this, GlobalContext* globalCtx) { func_80B40BC0(this, 1); } else { EnKgy_ChangeAnim(this, 5, 2, -5.0f); - gSaveContext.weekEventReg[20] |= 0x80; + gSaveContext.save.weekEventReg[20] |= 0x80; } func_80B411DC(this, globalCtx, 0); func_80B40E18(this, this->actor.textId); @@ -1064,7 +1064,7 @@ void func_80B42D28(EnKgy* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, ENKGY_GET_FE00(&this->actor))) { this->actor.textId = 0xC30; this->actionFunc = func_80B4296C; - gSaveContext.weekEventReg[21] |= 1; + gSaveContext.save.weekEventReg[21] |= 1; } else if (this->actor.xzDistToPlayer < 200.0f) { if (this->unk_2D2 == 4) { this->actor.textId = 0xC2D; diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c index 2c15b22bab..f93851035a 100644 --- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c +++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c @@ -297,7 +297,7 @@ void EnLookNuts_SendPlayerToSpawn(EnLookNuts* this, GlobalContext* globalCtx) { gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(globalCtx); globalCtx->sceneLoadFlag = 0x14; - gSaveContext.weekEventReg[17] |= 4; + gSaveContext.save.weekEventReg[17] |= 4; } } @@ -339,7 +339,7 @@ void EnLookNuts_Update(Actor* thisx, GlobalContext* globalCtx) { Matrix_StatePop(); if (!this->isPlayerDetected) { s16 drawFlag = 1; - if (gSaveContext.isNight) { + if (gSaveContext.save.isNight) { drawFlag = 0; } if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) { diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 32c29db3f0..031f2113f2 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -202,7 +202,7 @@ void EnMa4_Init(Actor* thisx, GlobalContext* globalCtx) { if (CURRENT_DAY == 1) { this->type = MA4_TYPE_DAY1; - } else if (gSaveContext.weekEventReg[22] & 1) { // Aliens defeated + } else if (gSaveContext.save.weekEventReg[22] & 1) { // Aliens defeated this->type = MA4_TYPE_ALIENS_DEFEATED; } else { this->type = MA4_TYPE_ALIENS_WON; @@ -216,10 +216,10 @@ void EnMa4_Init(Actor* thisx, GlobalContext* globalCtx) { } else { EnMa4_InitPath(this, globalCtx); - if (gSaveContext.entranceIndex == 0x6410) { + if (gSaveContext.save.entranceIndex == 0x6410) { EnMa4_ChangeAnim(this, 0); this->state = MA4_STATE_AFTERHORSEBACKGAME; - } else if (gSaveContext.entranceIndex == 0x64A0) { + } else if (gSaveContext.save.entranceIndex == 0x64A0) { EnMa4_ChangeAnim(this, 0); this->state = MA4_STATE_AFTERDESCRIBETHEMCS; } else { @@ -240,7 +240,7 @@ void EnMa4_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnMa4* this = THIS; Collider_DestroyCylinder(globalCtx, &this->collider); - gSaveContext.weekEventReg[8] &= (u8)~1; + gSaveContext.save.weekEventReg[8] &= (u8)~1; } // Running in circles in the ranch @@ -374,7 +374,7 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, GlobalContext* globalCtx) { case 0x3341: if (globalCtx->msgCtx.choiceIndex == 0) { func_8019F208(); - gSaveContext.weekEventReg[21] |= 0x20; + gSaveContext.save.weekEventReg[21] |= 0x20; Message_StartTextbox(globalCtx, 0x3343, &this->actor); this->textId = 0x3343; } else { @@ -390,7 +390,7 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, GlobalContext* globalCtx) { case 0x3346: if (globalCtx->msgCtx.choiceIndex == 0) { func_8019F208(); - gSaveContext.weekEventReg[21] |= 0x20; + gSaveContext.save.weekEventReg[21] |= 0x20; Message_StartTextbox(globalCtx, 0x3343, &this->actor); this->textId = 0x3343; } else { @@ -605,7 +605,7 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, GlobalContext* globalCtx) { break; case 0x3358: - if ((gSaveContext.playerForm != PLAYER_FORM_HUMAN) || !(CHECK_QUEST_ITEM(QUEST_SONG_EPONA))) { + if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || !(CHECK_QUEST_ITEM(QUEST_SONG_EPONA))) { Message_StartTextbox(globalCtx, 0x335C, &this->actor); this->textId = 0x335C; func_80151BB4(globalCtx, 5); @@ -694,7 +694,7 @@ void EnMa4_InitHorsebackGame(EnMa4* this, GlobalContext* globalCtx) { globalCtx->interfaceCtx.unk_280 = 1; func_8010E9F0(4, 0); - gSaveContext.weekEventReg[8] |= 1; + gSaveContext.save.weekEventReg[8] |= 1; func_80112AFC(globalCtx); player->stateFlags1 |= 0x20; this->actionFunc = EnMa4_SetupHorsebackGameWait; @@ -730,7 +730,7 @@ void EnMa4_HorsebackGameWait(EnMa4* this, GlobalContext* globalCtx) { } void EnMa4_SetupHorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) { - gSaveContext.weekEventReg[8] &= (u8)~1; + gSaveContext.save.weekEventReg[8] &= (u8)~1; this->actionFunc = EnMa4_HorsebackGameEnd; Audio_QueueSeqCmd(NA_BGM_STOP); Audio_QueueSeqCmd(NA_BGM_HORSE_GOAL | 0x8000); @@ -876,8 +876,8 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { switch (this->type) { case MA4_TYPE_DAY1: - if (gSaveContext.playerForm != PLAYER_FORM_HUMAN) { - if ((gSaveContext.weekEventReg[21] & 0x80)) { + if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if ((gSaveContext.save.weekEventReg[21] & 0x80)) { EnMa4_SetFaceExpression(this, 3, 3); Message_StartTextbox(globalCtx, 0x3337, &this->actor); this->textId = 0x3337; @@ -885,11 +885,11 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { } else { Message_StartTextbox(globalCtx, 0x3335, &this->actor); this->textId = 0x3335; - gSaveContext.weekEventReg[21] |= 0x80; + gSaveContext.save.weekEventReg[21] |= 0x80; } } else if (this->state == MA4_STATE_DEFAULT) { - if ((gSaveContext.weekEventReg[21] & 0x40)) { - if (!(gSaveContext.weekEventReg[21] & 0x20)) { + if ((gSaveContext.save.weekEventReg[21] & 0x40)) { + if (!(gSaveContext.save.weekEventReg[21] & 0x20)) { Message_StartTextbox(globalCtx, 0x3346, &this->actor); this->textId = 0x3346; } else { @@ -899,7 +899,7 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { } else { Message_StartTextbox(globalCtx, 0x3338, &this->actor); this->textId = 0x3338; - gSaveContext.weekEventReg[21] |= 0x40; + gSaveContext.save.weekEventReg[21] |= 0x40; } } else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) { if (gSaveContext.unk_3DE0[4] >= 2 * 60 * 100) { @@ -909,9 +909,9 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { this->textId = 0x336D; } else { time = gSaveContext.unk_3DE0[4]; - if ((s32)time < (s32)gSaveContext.horseBackBalloonHighScore) { + if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { // [Score] New record! - gSaveContext.horseBackBalloonHighScore = time; + gSaveContext.save.horseBackBalloonHighScore = time; EnMa4_SetFaceExpression(this, 0, 3); Message_StartTextbox(globalCtx, 0x3350, &this->actor); this->textId = 0x3350; @@ -932,8 +932,8 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { break; case MA4_TYPE_ALIENS_DEFEATED: - if (gSaveContext.playerForm != PLAYER_FORM_HUMAN) { - if ((gSaveContext.weekEventReg[21] & 0x80)) { + if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if ((gSaveContext.save.weekEventReg[21] & 0x80)) { EnMa4_SetFaceExpression(this, 3, 3); Message_StartTextbox(globalCtx, 0x3337, &this->actor); this->textId = 0x3337; @@ -941,7 +941,7 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { } else { Message_StartTextbox(globalCtx, 0x3335, &this->actor); this->textId = 0x3335; - gSaveContext.weekEventReg[21] |= 0x80; + gSaveContext.save.weekEventReg[21] |= 0x80; } } else if (this->state == MA4_STATE_DEFAULT) { Message_StartTextbox(globalCtx, 0x3354, &this->actor); @@ -953,8 +953,8 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { this->textId = 0x3356; } else { time = gSaveContext.unk_3DE0[4]; - if ((s32)time < (s32)gSaveContext.horseBackBalloonHighScore) { - gSaveContext.horseBackBalloonHighScore = time; + if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { + gSaveContext.save.horseBackBalloonHighScore = time; EnMa4_SetFaceExpression(this, 0, 3); Message_StartTextbox(globalCtx, 0x3350, &this->actor); this->textId = 0x3350; @@ -980,9 +980,9 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { this->textId = 0x3356; } else { time = gSaveContext.unk_3DE0[4]; - if ((s32)time < (s32)gSaveContext.horseBackBalloonHighScore) { + if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { // New record - gSaveContext.horseBackBalloonHighScore = time; + gSaveContext.save.horseBackBalloonHighScore = time; Message_StartTextbox(globalCtx, 0x335D, &this->actor); this->textId = 0x335D; } else { diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index 60edae4031..bd92db4bc1 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -146,7 +146,7 @@ void EnMaYto_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk320 = 0; this->eyeTexIndex = 0; - if (CURRENT_DAY == 1 || (gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { EnMaYto_SetFaceExpression(this, 0, 1); } else { EnMaYto_SetFaceExpression(this, 5, 2); @@ -180,34 +180,34 @@ void EnMaYto_Init(Actor* thisx, GlobalContext* globalCtx) { s32 EnMaYto_CheckValidSpawn(EnMaYto* this, GlobalContext* globalCtx) { switch (this->type) { case MA_YTO_TYPE_DEFAULT: - if (CURRENT_DAY == 3 && !(gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 3 && !(gSaveContext.save.weekEventReg[22] & 1)) { return false; } break; case MA_YTO_TYPE_DINNER: - if (CURRENT_DAY != 1 && (gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY != 1 && (gSaveContext.save.weekEventReg[22] & 1)) { return false; } break; case MA_YTO_TYPE_BARN: - if (gSaveContext.weekEventReg[22] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { if (((this->actor.params & 0x0F00) >> 8) != 0) { return false; } } else if (((this->actor.params & 0x0F00) >> 8) == 0) { return false; } - if (gSaveContext.time >= CLOCK_TIME(20, 0) && CURRENT_DAY == 3) { + if (gSaveContext.save.time >= CLOCK_TIME(20, 0) && CURRENT_DAY == 3) { return false; } break; case MA_YTO_TYPE_AFTERMILKRUN: - // if (!(ProtectedCremia) && !(gSaveContext.weekEventReg[52] & 2)) || (PlayedMilkMinigame)) - if ((!(gSaveContext.weekEventReg[52] & 1) && !(gSaveContext.weekEventReg[52] & 2)) || - (gSaveContext.weekEventReg[14] & 1)) { + // if (!(ProtectedCremia) && !(gSaveContext.save.weekEventReg[52] & 2)) || (PlayedMilkMinigame)) + if ((!(gSaveContext.save.weekEventReg[52] & 1) && !(gSaveContext.save.weekEventReg[52] & 2)) || + (gSaveContext.save.weekEventReg[14] & 1)) { return false; } break; @@ -235,7 +235,7 @@ void EnMaYto_InitAnimation(EnMaYto* this, GlobalContext* globalCtx) { case MA_YTO_TYPE_BARN: // if (AliensDefeated) - if (gSaveContext.weekEventReg[22] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { EnMaYto_ChangeAnim(this, 12); } else { EnMaYto_ChangeAnim(this, 8); @@ -273,7 +273,7 @@ void EnMaYto_ChooseAction(EnMaYto* this, GlobalContext* globalCtx) { case MA_YTO_TYPE_AFTERMILKRUN: this->unk310 = 0; - if (INV_CONTENT(ITEM_MASK_ROMANI) == ITEM_MASK_ROMANI && (gSaveContext.weekEventReg[52] & 1) && + if (INV_CONTENT(ITEM_MASK_ROMANI) == ITEM_MASK_ROMANI && (gSaveContext.save.weekEventReg[52] & 1) && (Rand_Next() & 0x80)) { EnMaYto_SetupBeginWarmFuzzyFeelingCs(this); } else { @@ -328,7 +328,7 @@ s32 EnMaYto_TryFindRomani(EnMaYto* this, GlobalContext* globalCtx) { return 0; case MA_YTO_TYPE_DINNER: - if (!(gSaveContext.weekEventReg[22] & 1) && CURRENT_DAY == 2) { + if (!(gSaveContext.save.weekEventReg[22] & 1) && CURRENT_DAY == 2) { return 0; } if (EnMaYto_SearchRomani(this, globalCtx)) { @@ -338,7 +338,7 @@ s32 EnMaYto_TryFindRomani(EnMaYto* this, GlobalContext* globalCtx) { case MA_YTO_TYPE_BARN: // if (AliensDefeated) - if (gSaveContext.weekEventReg[22] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { if (EnMaYto_SearchRomani(this, globalCtx)) { return 2; } @@ -492,7 +492,7 @@ void EnMaYto_DefaultChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx) } void EnMaYto_SetupDinnerWait(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { func_80B90E50(this, 0); this->unk31E = 0; } else { @@ -533,7 +533,7 @@ void EnMaYto_DinnerWait(EnMaYto* this, GlobalContext* globalCtx) { } void EnMaYto_SetupDinnerDialogueHandler(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { func_80B90E50(this, 1); } else { func_80B90E50(this, 2); @@ -684,7 +684,7 @@ void EnMaYto_DinnerChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx) { } void EnMaYto_SetupBarnWait(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { EnMaYto_ChangeAnim(this, 13); func_80B90E50(this, 0); this->unk31E = 0; @@ -712,7 +712,7 @@ void EnMaYto_BarnWait(EnMaYto* this, GlobalContext* globalCtx) { Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); EnMaYto_BarnStartDialogue(this, globalCtx); EnMaYto_SetupBarnDialogueHandler(this); - } else if (!(gSaveContext.weekEventReg[22] & 1) || ABS_ALT(direction) < 0x2000) { + } else if (!(gSaveContext.save.weekEventReg[22] & 1) || ABS_ALT(direction) < 0x2000) { func_800B8614(&this->actor, globalCtx, 100.0f); child = this->actor.child; @@ -724,7 +724,7 @@ void EnMaYto_BarnWait(EnMaYto* this, GlobalContext* globalCtx) { } void EnMaYto_SetupBarnDialogueHandler(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { func_80B90E50(this, 1); } else { func_80B90E50(this, 2); @@ -872,7 +872,7 @@ void EnMaYto_BarnChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx) { } void EnMaYto_SetupAfterMilkRunInit(EnMaYto* this) { - if (gSaveContext.weekEventReg[52] & 1) { // if (ProtectedCremia) + if (gSaveContext.save.weekEventReg[52] & 1) { // if (ProtectedCremia) EnMaYto_SetFaceExpression(this, 3, 1); } else { func_801A3098(NA_BGM_FAILURE_1); @@ -887,7 +887,7 @@ void EnMaYto_AfterMilkRunInit(EnMaYto* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - if (gSaveContext.weekEventReg[52] & 1) { // if (ProtectedCremia) + if (gSaveContext.save.weekEventReg[52] & 1) { // if (ProtectedCremia) Message_StartTextbox(globalCtx, 0x33C1, &this->actor); this->textId = 0x33C1; } else { @@ -896,7 +896,7 @@ void EnMaYto_AfterMilkRunInit(EnMaYto* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x33C0, &this->actor); this->textId = 0x33C0; // Attempted Cremia Cart Ride - gSaveContext.weekEventReg[14] |= 1; + gSaveContext.save.weekEventReg[14] |= 1; this->unk310 = 4; EnMaYto_SetupPostMilkRunWaitDialogueEnd(this); func_80151BB4(globalCtx, 6); @@ -978,7 +978,7 @@ void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x33C3, &this->actor); this->textId = 0x33C3; // Attempted Cremia Cart Ride - gSaveContext.weekEventReg[14] |= 1; + gSaveContext.save.weekEventReg[14] |= 1; this->unk310 = 3; func_80151BB4(globalCtx, 0x20); func_80151BB4(globalCtx, 0x1F); @@ -990,7 +990,7 @@ void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x33D0, &this->actor); this->textId = 0x33D0; // Attempted Cremia Cart Ride - gSaveContext.weekEventReg[14] |= 1; + gSaveContext.save.weekEventReg[14] |= 1; this->unk310 = 3; func_80151BB4(globalCtx, 6); EnMaYto_SetupPostMilkRunWaitDialogueEnd(this); @@ -1041,7 +1041,7 @@ void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, GlobalContext* globalCtx) { case 2: // Attempted Cremia Cart Ride - gSaveContext.weekEventReg[14] |= 1; + gSaveContext.save.weekEventReg[14] |= 1; EnMaYto_ChangeAnim(this, 18); break; @@ -1099,7 +1099,7 @@ void EnMaYto_PostMilkRunEnd(EnMaYto* this, GlobalContext* globalCtx) { void EnMaYto_DefaultStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { if (CURRENT_DAY == 1) { - if (Player_GetMask(globalCtx) != PLAYER_MASK_NONE && gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + if (Player_GetMask(globalCtx) != PLAYER_MASK_NONE && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { switch (Player_GetMask(globalCtx)) { case PLAYER_MASK_ROMANI: Message_StartTextbox(globalCtx, 0x235D, &this->actor); @@ -1158,7 +1158,7 @@ void EnMaYto_DefaultStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { void EnMaYto_DinnerStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { switch (CURRENT_DAY) { case 1: - if (Player_GetMask(globalCtx) != PLAYER_MASK_NONE && gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + if (Player_GetMask(globalCtx) != PLAYER_MASK_NONE && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { switch (Player_GetMask(globalCtx)) { case PLAYER_MASK_ROMANI: Message_StartTextbox(globalCtx, 0x235D, &this->actor); @@ -1225,7 +1225,7 @@ void EnMaYto_DinnerStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { void EnMaYto_BarnStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { // if (AliensDefeated) - if (gSaveContext.weekEventReg[22] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { if (CURRENT_DAY == 2) { if (this->unk310 == 1) { Message_StartTextbox(globalCtx, 0x33AE, &this->actor); @@ -1348,7 +1348,7 @@ void EnMaYto_SetFaceExpression(EnMaYto* this, s16 overrideEyeTexIndex, s16 mouth } void EnMaYto_InitFaceExpression(EnMaYto* this) { - if (CURRENT_DAY == 1 || (gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { EnMaYto_SetFaceExpression(this, 0, 1); EnMaYto_SetRomaniFaceExpression(this, 0, 0); } else { @@ -1360,19 +1360,19 @@ void EnMaYto_InitFaceExpression(EnMaYto* this) { s32 EnMaYto_HasSpokeToPlayerToday(void) { switch (CURRENT_DAY) { case 1: - if (gSaveContext.weekEventReg[13] & 4) { + if (gSaveContext.save.weekEventReg[13] & 4) { return true; } break; case 2: - if (gSaveContext.weekEventReg[13] & 8) { + if (gSaveContext.save.weekEventReg[13] & 8) { return true; } break; case 3: - if (gSaveContext.weekEventReg[13] & 0x10) { + if (gSaveContext.save.weekEventReg[13] & 0x10) { return true; } break; @@ -1384,17 +1384,17 @@ s32 EnMaYto_HasSpokeToPlayer(void) { // Please note each case doesn't have their respective `break`s. switch (CURRENT_DAY) { case 3: - if (gSaveContext.weekEventReg[13] & 0x10) { + if (gSaveContext.save.weekEventReg[13] & 0x10) { return true; } case 2: - if (gSaveContext.weekEventReg[13] & 8) { + if (gSaveContext.save.weekEventReg[13] & 8) { return true; } case 1: - if (gSaveContext.weekEventReg[13] & 4) { + if (gSaveContext.save.weekEventReg[13] & 4) { return true; } } @@ -1404,15 +1404,15 @@ s32 EnMaYto_HasSpokeToPlayer(void) { void EnMaYto_SetTalkedFlag(void) { switch (CURRENT_DAY) { case 1: - gSaveContext.weekEventReg[13] |= 4; + gSaveContext.save.weekEventReg[13] |= 4; break; case 2: - gSaveContext.weekEventReg[13] |= 8; + gSaveContext.save.weekEventReg[13] |= 8; break; case 3: - gSaveContext.weekEventReg[13] |= 0x10; + gSaveContext.save.weekEventReg[13] |= 0x10; break; } } @@ -1464,7 +1464,7 @@ void EnMaYto_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; OPEN_DISPS(globalCtx->state.gfxCtx); - if (this->type == MA_YTO_TYPE_BARN && (gSaveContext.weekEventReg[22] & 1)) { // Aliens defeated + if (this->type == MA_YTO_TYPE_BARN && (gSaveContext.save.weekEventReg[22] & 1)) { // Aliens defeated gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gCremiaWoodenBox); } diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index f1bd0d7732..29eb6cdcc7 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -145,7 +145,7 @@ void EnMaYts_InitAnimation(EnMaYts* this, GlobalContext* globalCtx) { case MA_YTS_TYPE_SITTING: this->actor.targetMode = 6; // Day 1 or "Winning" the alien invasion - if (CURRENT_DAY == 1 || (gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { EnMaYts_ChangeAnim(this, 14); } else { EnMaYts_ChangeAnim(this, 18); @@ -178,14 +178,14 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, GlobalContext* globalCtx) { case 2: // Failing the alien invasion - if (!(gSaveContext.weekEventReg[22] & 1)) { + if (!(gSaveContext.save.weekEventReg[22] & 1)) { return false; } break; case 3: // "Winning" the alien invasion - if (gSaveContext.weekEventReg[22] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { return false; } break; @@ -194,16 +194,16 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, GlobalContext* globalCtx) { case MA_YTS_TYPE_BARN: // Failing the alien invasion - if (!(gSaveContext.weekEventReg[22] & 1)) { + if (!(gSaveContext.save.weekEventReg[22] & 1)) { return false; - } else if (gSaveContext.time >= CLOCK_TIME(20, 0) && CURRENT_DAY == 3) { + } else if (gSaveContext.save.time >= CLOCK_TIME(20, 0) && CURRENT_DAY == 3) { return false; } break; case MA_YTS_TYPE_SLEEPING: // "Winning" the alien invasion - if (gSaveContext.weekEventReg[22] & 1) { + if (gSaveContext.save.weekEventReg[22] & 1) { return false; } break; @@ -250,7 +250,7 @@ void EnMaYts_Init(Actor* thisx, GlobalContext* globalCtx) { this->hasBow = false; } - if (CURRENT_DAY == 1 || (gSaveContext.weekEventReg[22] & 1)) { + if (CURRENT_DAY == 1 || (gSaveContext.save.weekEventReg[22] & 1)) { this->overrideEyeTexIndex = 0; this->eyeTexIndex = 0; this->mouthTexIndex = 0; @@ -268,7 +268,7 @@ void EnMaYts_Init(Actor* thisx, GlobalContext* globalCtx) { this->mouthTexIndex = 0; this->unk_32C = 2; EnMaYts_SetupEndCreditsHandler(this); - } else if (CURRENT_DAY == 2 && gSaveContext.isNight == 1 && (gSaveContext.weekEventReg[22] & 1)) { + } else if (CURRENT_DAY == 2 && gSaveContext.save.isNight == 1 && (gSaveContext.save.weekEventReg[22] & 1)) { EnMaYts_SetupStartDialogue(this); } else { EnMaYts_SetupDoNothing(this); @@ -297,10 +297,10 @@ void EnMaYts_StartDialogue(EnMaYts* this, GlobalContext* globalCtx) { s16 sp26 = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - if (!(gSaveContext.playerForm == PLAYER_FORM_HUMAN)) { - if (!(gSaveContext.weekEventReg[65] & 0x80)) { + if (!(gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + if (!(gSaveContext.save.weekEventReg[65] & 0x80)) { // Saying to non-human Link: "Cremia went to town." - gSaveContext.weekEventReg[65] |= 0x80; + gSaveContext.save.weekEventReg[65] |= 0x80; EnMaYts_SetFaceExpression(this, 0, 0); Message_StartTextbox(globalCtx, 0x335F, &this->actor); this->textId = 0x335F; @@ -312,8 +312,8 @@ void EnMaYts_StartDialogue(EnMaYts* this, GlobalContext* globalCtx) { func_80151BB4(globalCtx, 5); } } else if (Player_GetMask(globalCtx) != PLAYER_MASK_NONE) { - if (!(gSaveContext.weekEventReg[65] & 0x40)) { - gSaveContext.weekEventReg[65] |= 0x40; + if (!(gSaveContext.save.weekEventReg[65] & 0x40)) { + gSaveContext.save.weekEventReg[65] |= 0x40; EnMaYts_SetFaceExpression(this, 0, 0); Message_StartTextbox(globalCtx, 0x3363, &this->actor); this->textId = 0x3363; @@ -323,14 +323,14 @@ void EnMaYts_StartDialogue(EnMaYts* this, GlobalContext* globalCtx) { this->textId = 0x3366; func_80151BB4(globalCtx, 5); } - } else if (!(gSaveContext.weekEventReg[21] & 0x20)) { + } else if (!(gSaveContext.save.weekEventReg[21] & 0x20)) { EnMaYts_SetFaceExpression(this, 0, 0); Message_StartTextbox(globalCtx, 0x3367, &this->actor); this->textId = 0x3367; } else { - if (!(gSaveContext.weekEventReg[65] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[65] & 0x20)) { // Saying to Grasshopper: "Cremia went to town." - gSaveContext.weekEventReg[65] |= 0x20; + gSaveContext.save.weekEventReg[65] |= 0x20; EnMaYts_SetFaceExpression(this, 4, 2); Message_StartTextbox(globalCtx, 0x3369, &this->actor); this->textId = 0x3369; diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 9e6b3e9e9e..907ba619b1 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -162,7 +162,7 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { this->state = MAG_STATE_FADE_IN_MASK; sInputDelayTimer = 20; gSaveContext.fadeDuration = 1; - gSaveContext.unk_3F51 = 255; + gSaveContext.fadeSpeed = 255; } Font_LoadOrderedFont(&this->font); @@ -246,7 +246,7 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk11F02 = 30; sInputDelayTimer = 20; gSaveContext.fadeDuration = 1; - gSaveContext.unk_3F51 = 255; + gSaveContext.fadeSpeed = 255; } } } else { @@ -392,7 +392,7 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { globalCtx->sceneLoadFlag = 0x14; globalCtx->unk_1887F = 2; globalCtx->nextEntranceIndex = 0x1C00; - gSaveContext.cutscene = 0; + gSaveContext.save.cutscene = 0; gSaveContext.sceneSetupIndex = 0; } this->unk11F54 = 15; diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index 8b6fc45e8c..27192800ef 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -66,7 +66,7 @@ static TexturePtr D_808A4D74[] = { object_fr_Tex_005BA0, }; -// gSaveContext.weekEventReg[KEY] = VALUE +// gSaveContext.save.weekEventReg[KEY] = VALUE // KEY | VALUE static u16 isFrogReturnedFlags[] = { (0 << 8) | 0x00, // NULL @@ -114,7 +114,7 @@ void EnMinifrog_Init(Actor* thisx, GlobalContext* globalCtx) { if (1) {} if (!EN_MINIFROG_IS_RETURNED(this)) { if ((this->frogIndex == MINIFROG_YELLOW) || - ((gSaveContext.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] & + ((gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] & (u8)isFrogReturnedFlags[this->frogIndex]))) { Actor_MarkForDeath(&this->actor); } else { @@ -129,7 +129,7 @@ void EnMinifrog_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnMinifrog_SetupYellowFrogDialog; // Not spoken to MINIFROG_YELLOW - if (!(gSaveContext.weekEventReg[34] & 1)) { + if (!(gSaveContext.save.weekEventReg[34] & 1)) { this->actor.flags |= ACTOR_FLAG_10000; } @@ -140,7 +140,7 @@ void EnMinifrog_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; // Frog has been returned - if ((gSaveContext.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] & + if ((gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] & (u8)isFrogReturnedFlags[this->frogIndex])) { this->actionFunc = EnMinifrog_SetupNextFrogInit; } else { @@ -270,15 +270,15 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, GlobalContext* globalCtx) { case 0xD87: // "Ah! You need not say a thing. Upon seeing that face, I understand!" ... func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); break; - case 0xD82: // "What has brought you all this way?" - if (gSaveContext.weekEventReg[33] & 0x80) { // Mountain village is unfrozen + case 0xD82: // "What has brought you all this way?" + if (gSaveContext.save.weekEventReg[33] & 0x80) { // Mountain village is unfrozen func_80151938(globalCtx, 0xD83); // "Could it be... Has spring finally come to the mountains?" } else { func_80151938(globalCtx, 0xD86); // "Could it be... You came all this way looking for me?" } - flag = gSaveContext.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8]; - gSaveContext.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] = + flag = gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8]; + gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] = flag | (u8)isFrogReturnedFlags[this->frogIndex]; break; case 0xD85: // "I understand. I shall head for the mountains immediately." @@ -518,7 +518,7 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx) { // you've lost a little weight..." func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); this->actor.flags &= ~ACTOR_FLAG_10000; - gSaveContext.weekEventReg[34] |= 1; // Spoken to MINIFROG_YELLOW + gSaveContext.save.weekEventReg[34] |= 1; // Spoken to MINIFROG_YELLOW break; case 0xD78: // "Unfortunately, it seems not all of our members have gathered." case 0xD79: // "Perhaps it is because winter was too long? They must not have realized that spring @@ -532,11 +532,11 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx) { globalCtx->msgCtx.unk11F10 = 0; break; case 0xD7C: // "The conducting was spectacular. And all of our members rose to the occasion!" - if (gSaveContext.weekEventReg[35] & 0x80) { // Obtained Heart Piece + if (gSaveContext.save.weekEventReg[35] & 0x80) { // Obtained Heart Piece func_80151938(globalCtx, 0xD7E); } else { func_80151938(globalCtx, 0xD7D); // Get Heart Piece - gSaveContext.weekEventReg[35] |= 0x80; + gSaveContext.save.weekEventReg[35] |= 0x80; } break; case 0xD7D: // "This is how deeply we were moved by your spectacular conducting..." @@ -564,7 +564,7 @@ void EnMinifrog_SetupYellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx EnMinifrog_JumpTimer(this); if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actionFunc = EnMinifrog_YellowFrogDialog; - if (!(gSaveContext.weekEventReg[34] & 1)) { // Not spoken with MINIFROG_YELLOW + if (!(gSaveContext.save.weekEventReg[34] & 1)) { // Not spoken with MINIFROG_YELLOW Message_StartTextbox(globalCtx, 0xD76, &this->actor); // "I have been waiting for you, Don Gero. Forgive me if I'm mistaken, // but it looks like you've lost a little weight..." diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 062a75a125..8c20b41066 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -120,7 +120,7 @@ void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx) { } s32 func_80959524(GlobalContext* globalCtx) { - return gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 7; + return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 7; } void func_8095954C(EnMk* this, GlobalContext* globalCtx) { @@ -145,10 +145,10 @@ void func_8095954C(EnMk* this, GlobalContext* globalCtx) { void func_80959624(EnMk* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (this->unk_27A & 4) { textId = 0xFB9; - } else if (gSaveContext.weekEventReg[55] & 0x80) { + } else if (gSaveContext.save.weekEventReg[55] & 0x80) { textId = 0xFBC; } else { textId = 0xFBB; @@ -203,17 +203,17 @@ void func_80959844(EnMk* this, GlobalContext* globalCtx) { if ((this->unk_27A & 2) && (func_80959524(globalCtx) >= 7)) { textId = 0xFB3; - } else if (gSaveContext.weekEventReg[20] & 0x40) { + } else if (gSaveContext.save.weekEventReg[20] & 0x40) { textId = 0xFB9; - } else if (gSaveContext.weekEventReg[19] & 0x40) { + } else if (gSaveContext.save.weekEventReg[19] & 0x40) { textId = 0xFB5; } else if (func_80959524(globalCtx) >= 7) { textId = 0xFB3; } else { - switch (gSaveContext.playerForm) { + switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: - if (gSaveContext.weekEventReg[19] & 0x10) { - if (gSaveContext.weekEventReg[55] & 0x80) { + if (gSaveContext.save.weekEventReg[19] & 0x10) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { textId = 0xFAF; } else { textId = 0xFAE; @@ -224,8 +224,8 @@ void func_80959844(EnMk* this, GlobalContext* globalCtx) { break; case PLAYER_FORM_GORON: - if (gSaveContext.weekEventReg[19] & 8) { - if (gSaveContext.weekEventReg[55] & 0x80) { + if (gSaveContext.save.weekEventReg[19] & 8) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { textId = 0xFAB; } else { textId = 0xFAA; @@ -239,8 +239,8 @@ void func_80959844(EnMk* this, GlobalContext* globalCtx) { case PLAYER_FORM_HUMAN: if (func_80959524(globalCtx) > 0) { textId = 0xFA7; - } else if (gSaveContext.weekEventReg[19] & 4) { - if (gSaveContext.weekEventReg[55] & 0x80) { + } else if (gSaveContext.save.weekEventReg[19] & 4) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { textId = 0xFBF; } else { textId = 0xFA6; @@ -253,7 +253,7 @@ void func_80959844(EnMk* this, GlobalContext* globalCtx) { default: if (func_80959524(globalCtx) > 0) { textId = 0xFB0; - } else if (gSaveContext.weekEventReg[19] & 0x20) { + } else if (gSaveContext.save.weekEventReg[19] & 0x20) { textId = 0xFB2; } else { textId = 0xFB1; @@ -284,7 +284,7 @@ void func_80959A24(EnMk* this, GlobalContext* globalCtx) { break; case 0xFA2: - if (gSaveContext.weekEventReg[55] & 0x80) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { func_801477B4(globalCtx); this->actionFunc = func_80959E18; break; @@ -309,13 +309,13 @@ void func_80959A24(EnMk* this, GlobalContext* globalCtx) { break; case 0xFA0: - gSaveContext.weekEventReg[19] |= 4; + gSaveContext.save.weekEventReg[19] |= 4; func_80151938(globalCtx, 0xFA1); break; case 0xFA8: - gSaveContext.weekEventReg[19] |= 8; - if (gSaveContext.weekEventReg[55] & 0x80) { + gSaveContext.save.weekEventReg[19] |= 8; + if (gSaveContext.save.weekEventReg[55] & 0x80) { func_80151938(globalCtx, 0xFBD); break; } @@ -323,8 +323,8 @@ void func_80959A24(EnMk* this, GlobalContext* globalCtx) { break; case 0xFAC: - gSaveContext.weekEventReg[19] |= 0x10; - if (gSaveContext.weekEventReg[55] & 0x80) { + gSaveContext.save.weekEventReg[19] |= 0x10; + if (gSaveContext.save.weekEventReg[55] & 0x80) { func_80151938(globalCtx, 0xFBE); break; } @@ -332,7 +332,7 @@ void func_80959A24(EnMk* this, GlobalContext* globalCtx) { break; case 0xFB1: - gSaveContext.weekEventReg[19] |= 0x20; + gSaveContext.save.weekEventReg[19] |= 0x20; func_801477B4(globalCtx); this->actionFunc = func_80959E18; break; @@ -374,7 +374,7 @@ void func_80959D28(EnMk* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if ((globalCtx->csCtx.state == 0) && (this->actor.cutscene == -1)) { - if (gSaveContext.weekEventReg[20] & 0x40) { + if (gSaveContext.save.weekEventReg[20] & 0x40) { this->unk_27A &= ~1; this->actionFunc = func_80959774; this->actor.home.rot.y += 0x4E20; @@ -402,7 +402,7 @@ void func_80959E18(EnMk* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); - if (gSaveContext.weekEventReg[20] & 0x40) { + if (gSaveContext.save.weekEventReg[20] & 0x40) { this->unk_27A &= ~1; this->actionFunc = func_80959774; this->actor.home.rot.y += 0x4E20; @@ -412,9 +412,9 @@ void func_80959E18(EnMk* this, GlobalContext* globalCtx) { if (func_800B8718(&this->actor, &globalCtx->state)) { globalCtx->msgCtx.ocarinaMode = 4; this->actionFunc = func_80959D28; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { this->actor.cutscene = this->unk_276[0]; - gSaveContext.weekEventReg[20] |= 0x40; + gSaveContext.save.weekEventReg[20] |= 0x40; Item_Give(globalCtx, ITEM_SONG_NOVA); } else { this->actor.cutscene = this->unk_276[1]; @@ -429,7 +429,7 @@ void func_80959E18(EnMk* this, GlobalContext* globalCtx) { } else if ((this->actor.xzDistToPlayer < 120.0f) && (ABS_ALT(sp22) <= 0x4300)) { this->unk_27A |= 1; func_800B8614(&this->actor, globalCtx, 200.0f); - if (!(gSaveContext.weekEventReg[20] & 0x40) && (gSaveContext.weekEventReg[19] & 0x40)) { + if (!(gSaveContext.save.weekEventReg[20] & 0x40) && (gSaveContext.save.weekEventReg[19] & 0x40)) { func_800B874C(&this->actor, globalCtx, 200.0f, 100.0f); } } else { diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index dfb69be0f5..5f79cf9e4d 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -74,8 +74,8 @@ void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { EnMm* this = THIS; EnMmActionFunc action; - if ((this->actor.params >= 0) && ((!(gSaveContext.weekEventReg[37] & 0x10)) || - (gSaveContext.weekEventReg[37] & 8) || (gSaveContext.unk_1014 != 0))) { + if ((this->actor.params >= 0) && ((!(gSaveContext.save.weekEventReg[37] & 0x10)) || + (gSaveContext.save.weekEventReg[37] & 8) || (gSaveContext.unk_1014 != 0))) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index e6024c79ae..396a3f0406 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -102,7 +102,7 @@ void EnMm3_Init(Actor* thisx, GlobalContext* globalCtx) { void EnMm3_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnMm3* this = THIS; - gSaveContext.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~1; Collider_DestroyCylinder(globalCtx, &this->collider); } @@ -144,7 +144,7 @@ void func_80A6F3B4(EnMm3* this, GlobalContext* globalCtx) { case 0x278E: if (globalCtx->msgCtx.choiceIndex == 0) { if (this->unk_2B2 & 0x20) { - if (gSaveContext.rupees >= globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { func_8019F208(); Message_StartTextbox(globalCtx, 0x2790, &this->actor); this->unk_2B4 = 0x2790; @@ -170,7 +170,7 @@ void func_80A6F3B4(EnMm3* this, GlobalContext* globalCtx) { case 0x279A: if (globalCtx->msgCtx.choiceIndex == 0) { - if (gSaveContext.rupees >= globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { func_8019F208(); Message_StartTextbox(globalCtx, 0x2790, &this->actor); this->unk_2B4 = 0x2790; @@ -274,7 +274,7 @@ void func_80A6F5E4(EnMm3* this, GlobalContext* globalCtx) { case 0x2795: case 0x2796: case 0x2797: - if (gSaveContext.weekEventReg[63] & 2) { + if (gSaveContext.save.weekEventReg[63] & 2) { Message_StartTextbox(globalCtx, 0x279B, &this->actor); this->unk_2B4 = 0x279B; func_80151BB4(globalCtx, 0xB); @@ -346,8 +346,8 @@ void func_80A6F9DC(EnMm3* this, GlobalContext* globalCtx) { play_sound(NA_SE_SY_START_SHOT); func_80A6FBA0(this); } else { - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; func_80A6F270(this); } } @@ -368,8 +368,8 @@ void func_80A6F9DC(EnMm3* this, GlobalContext* globalCtx) { void func_80A6FBA0(EnMm3* this) { func_801A5BD0(0x6F); func_801A0238(0, 5); - gSaveContext.weekEventReg[63] |= 1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] |= 1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; this->actionFunc = func_80A6FBFC; } @@ -424,12 +424,12 @@ void func_80A6FE1C(EnMm3* this) { void func_80A6FE30(EnMm3* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { - if (!(gSaveContext.weekEventReg[77] & 1)) { - gSaveContext.weekEventReg[77] |= 1; + if (!(gSaveContext.save.weekEventReg[77] & 1)) { + gSaveContext.save.weekEventReg[77] |= 1; } this->actor.parent = NULL; func_80A6FED8(this); - } else if (gSaveContext.weekEventReg[77] & 1) { + } else if (gSaveContext.save.weekEventReg[77] & 1) { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); @@ -457,7 +457,7 @@ void func_80A6FEEC(EnMm3* this, GlobalContext* globalCtx) { } s32 func_80A6FFAC(EnMm3* this, GlobalContext* globalCtx) { - switch (gSaveContext.playerForm) { + switch (gSaveContext.save.playerForm) { case 4: if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { if (this->unk_2B2 & 0x10) { @@ -491,7 +491,7 @@ s32 func_80A6FFAC(EnMm3* this, GlobalContext* globalCtx) { } void func_80A70084(EnMm3* this, GlobalContext* globalCtx) { - switch (gSaveContext.playerForm) { + switch (gSaveContext.save.playerForm) { case 4: if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { this->unk_2B2 |= 0x10; diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 4497b7945b..729e36d496 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -83,7 +83,7 @@ void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) { s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (gSaveContext.inventory.items[SLOT_MAGIC_BEANS] == ITEM_NONE) { + if (gSaveContext.save.inventory.items[SLOT_MAGIC_BEANS] == ITEM_NONE) { this->actor.textId = 0x92E; // "[...] You're the first customer [...]" } else { this->actor.textId = 0x932; // "[...] So you liked my Magic Beans [...]" @@ -118,7 +118,7 @@ void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) { switch (globalCtx->msgCtx.choiceIndex) { case 0: // yes func_801477B4(globalCtx); - if (gSaveContext.rupees < 10) { + if (gSaveContext.save.playerData.rupees < 10) { play_sound(NA_SE_SY_ERROR); func_80151938(globalCtx, 0x935); // "[...] You don't have enough Rupees." } else if (AMMO(ITEM_MAGIC_BEANS) >= 20) { diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index 2a20e81351..6952f10c21 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -234,7 +234,7 @@ s32 EnMttag_UpdateCheckpoints(EnMttag* this, GlobalContext* globalCtx) { s32 EnMttag_ExitRace(GlobalContext* globalCtx, s32 arg1, s32 nextTransition) { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; globalCtx->nextEntranceIndex = 0xD020; - if ((gSaveContext.weekEventReg[33] & 0x80)) { + if ((gSaveContext.save.weekEventReg[33] & 0x80)) { // Spring gSaveContext.nextCutsceneIndex = 0xFFF0; } else { @@ -288,7 +288,7 @@ void EnMttag_ShowIntroCutscene(EnMttag* this, GlobalContext* globalCtx) { */ void EnMttag_WaitForIntroCutsceneToEnd(EnMttag* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { - gSaveContext.weekEventReg[12] |= 2; + gSaveContext.save.weekEventReg[12] |= 2; this->actionFunc = EnMttag_RaceStart; } } @@ -420,7 +420,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, GlobalContext* globalCtx) { if (this->shouldRestartRace) { globalCtx->nextEntranceIndex = 0xD010; - if (gSaveContext.weekEventReg[33] & 0x80) { + if (gSaveContext.save.weekEventReg[33] & 0x80) { // Spring gSaveContext.nextCutsceneIndex = 0xFFF0; } else { @@ -433,7 +433,8 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, GlobalContext* globalCtx) { gSaveContext.nextTransition = 2; func_801477B4(globalCtx); func_800B7298(globalCtx, &this->actor, 7); - Parameter_AddMagic(globalCtx, ((void)0, gSaveContext.unk_3F30) + (gSaveContext.doubleMagic * 48) + 48); + Parameter_AddMagic(globalCtx, + ((void)0, gSaveContext.unk_3F30) + (gSaveContext.save.playerData.doubleMagic * 48) + 48); gSaveContext.eventInf[1] &= (u8)~1; gSaveContext.eventInf[1] &= (u8)~2; @@ -477,7 +478,7 @@ void EnMttag_Init(Actor* thisx, GlobalContext* globalCtx) { Player* player; EnMttag* this = THIS; - if (gSaveContext.entranceIndex == 0xD010) { + if (gSaveContext.save.entranceIndex == 0xD010) { player = GET_PLAYER(globalCtx); player->stateFlags1 |= 0x20; this->raceInitialized = false; @@ -488,7 +489,7 @@ void EnMttag_Init(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.eventInf[1] &= (u8)~4; gSaveContext.eventInf[1] &= (u8)~8; - if (!(gSaveContext.weekEventReg[12] & 2)) { + if (!(gSaveContext.save.weekEventReg[12] & 2)) { this->actionFunc = EnMttag_ShowIntroCutscene; } else { s32 requiredScopeTemp; diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c index b8e4750a75..4aed3132f2 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -70,11 +70,11 @@ void EnMuto_Init(Actor* thisx, GlobalContext* globalCtx) { if (!this->isInMayorsRoom) { this->shouldSetHeadRotation = true; this->textIdIndex = 2; - if (gSaveContext.weekEventReg[60] & 0x80) { + if (gSaveContext.save.weekEventReg[60] & 0x80) { this->textIdIndex = 3; } - if (gSaveContext.day != 3 || !gSaveContext.isNight) { + if (gSaveContext.save.day != 3 || !gSaveContext.save.isNight) { Actor_MarkForDeath(&this->actor); } } else { @@ -82,7 +82,7 @@ void EnMuto_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.height = 60; this->collider.dim.yShift = 0; - if (gSaveContext.weekEventReg[63] & 0x80 || (gSaveContext.day == 3 && gSaveContext.isNight)) { + if (gSaveContext.save.weekEventReg[63] & 0x80 || (gSaveContext.save.day == 3 && gSaveContext.save.isNight)) { Actor_MarkForDeath(&this->actor); } } @@ -134,7 +134,7 @@ void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx) { this->actor.textId = sTextIds[this->textIdIndex]; if (!this->isInMayorsRoom && (player = GET_PLAYER(globalCtx))->transformation == PLAYER_FORM_DEKU) { - if (!(gSaveContext.weekEventReg[88] & 8)) { + if (!(gSaveContext.save.weekEventReg[88] & 8)) { this->actor.textId = 0x62C; } else { this->actor.textId = 0x62B; @@ -161,7 +161,7 @@ void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx) { } } else { this->textIdIndex = 0; - if (gSaveContext.weekEventReg[60] & 8) { + if (gSaveContext.save.weekEventReg[60] & 8) { this->textIdIndex = 1; } if (Player_GetMask(globalCtx) == PLAYER_MASK_COUPLE) { @@ -199,10 +199,10 @@ void EnMuto_InDialogue(EnMuto* this, GlobalContext* globalCtx) { func_801477B4(globalCtx); if (this->actor.textId == 0x62C) { - gSaveContext.weekEventReg[88] |= 8; + gSaveContext.save.weekEventReg[88] |= 8; } if (this->actor.textId == 0x624) { - gSaveContext.weekEventReg[60] |= 0x80; + gSaveContext.save.weekEventReg[60] |= 0x80; } this->textIdIndex = 3; @@ -251,7 +251,7 @@ void EnMuto_Update(Actor* thisx, GlobalContext* globalCtx2) { EnMuto_SetHeadRotation(this); } - if (this->isInMayorsRoom && gSaveContext.day == 3 && gSaveContext.isNight) { + if (this->isInMayorsRoom && gSaveContext.save.day == 3 && gSaveContext.save.isNight) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index f53912c4d4..48a87b30ef 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -324,7 +324,8 @@ s32 func_80AD0B38(EnOsn* this, GlobalContext* globalCtx) { break; } this->unk_1EA |= 0x20; - if (gSaveContext.day == 3 && gSaveContext.time >= CLOCK_TIME(5, 0) && gSaveContext.time < CLOCK_TIME(6, 0)) { + if (gSaveContext.save.day == 3 && gSaveContext.save.time >= CLOCK_TIME(5, 0) && + gSaveContext.save.time < CLOCK_TIME(6, 0)) { return 0x2006; } return 0x1FCD; @@ -333,13 +334,13 @@ s32 func_80AD0B38(EnOsn* this, GlobalContext* globalCtx) { s32 func_80AD0E10(EnOsn* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - if ((gSaveContext.inventory.items[SLOT_OCARINA] != ITEM_NONE) && CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { + if ((gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE) && CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { if (this->unk_1EA & 1) { this->unk_1EA |= 0x20; - if ((gSaveContext.inventory.items[SLOT_OCARINA] != ITEM_NONE) && + if ((gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE) && (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { - if ((gSaveContext.day == 3) && (gSaveContext.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && + (gSaveContext.save.time < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; @@ -350,8 +351,8 @@ s32 func_80AD0E10(EnOsn* this, GlobalContext* globalCtx) { if (player->transformation == PLAYER_FORM_DEKU) { if (this->unk_1EA & 4) { this->unk_1EA |= 0x20; - if ((gSaveContext.day == 3) && (gSaveContext.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && + (gSaveContext.save.time < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; @@ -363,43 +364,43 @@ s32 func_80AD0E10(EnOsn* this, GlobalContext* globalCtx) { if (player->transformation == PLAYER_FORM_GORON) { if (this->unk_1EA & 8) { this->unk_1EA |= 0x20; - if ((gSaveContext.day == 3) && (gSaveContext.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && + (gSaveContext.save.time < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; } this->unk_1EA |= 8; - if (gSaveContext.weekEventReg[76] & 0x20) { + if (gSaveContext.save.weekEventReg[76] & 0x20) { return 0x1FC8; } - gSaveContext.weekEventReg[76] |= 0x20; + gSaveContext.save.weekEventReg[76] |= 0x20; return 0x1FCE; } if (player->transformation == PLAYER_FORM_ZORA) { if (this->unk_1EA & 0x10) { this->unk_1EA |= 0x20; - if ((gSaveContext.day == 3) && (gSaveContext.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && + (gSaveContext.save.time < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; } this->unk_1EA |= 0x10; - if (gSaveContext.weekEventReg[76] & 0x40) { + if (gSaveContext.save.weekEventReg[76] & 0x40) { return 0x1FC8; } - gSaveContext.weekEventReg[76] |= 0x40; + gSaveContext.save.weekEventReg[76] |= 0x40; return 0x1FD0; } if (Player_GetMask(globalCtx) == PLAYER_MASK_NONE) { if (this->unk_1EA & 2) { this->unk_1EA |= 0x20; - if ((gSaveContext.day == 3) && (gSaveContext.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && + (gSaveContext.save.time < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; @@ -412,7 +413,8 @@ s32 func_80AD0E10(EnOsn* this, GlobalContext* globalCtx) { } this->unk_1EA |= 0x20; - if ((gSaveContext.day == 3) && (gSaveContext.time >= CLOCK_TIME(5, 0)) && (gSaveContext.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && + (gSaveContext.save.time < CLOCK_TIME(6, 0))) { return 0x2004; } @@ -430,8 +432,8 @@ void func_80AD10FC(EnOsn* this, GlobalContext* globalCtx) { break; case 0x1FCA: - if ((gSaveContext.day == 3 && gSaveContext.time >= CLOCK_TIME(5, 0)) && - gSaveContext.time < CLOCK_TIME(6, 0)) { + if ((gSaveContext.save.day == 3 && gSaveContext.save.time >= CLOCK_TIME(5, 0)) && + gSaveContext.save.time < CLOCK_TIME(6, 0)) { this->unk_1F4 = 0x2007; } else { this->unk_1F4 = 0x1FCB; @@ -579,10 +581,11 @@ void func_80AD10FC(EnOsn* this, GlobalContext* globalCtx) { void func_80AD1398(EnOsn* this) { this->cutscene = this->actor.cutscene; - if ((gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) || (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { + if ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) || + (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); - if ((gSaveContext.inventory.items[SLOT_OCARINA] != ITEM_NONE) || + if ((gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE) || (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); } @@ -604,7 +607,7 @@ void func_80AD144C(EnOsn* this, GlobalContext* globalCtx) { void func_80AD14C8(EnOsn* this, GlobalContext* globalCtx) { s16 temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (gSaveContext.inventory.items[SLOT_OCARINA] != ITEM_NONE && !CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { + if (gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE && !CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actionFunc = func_80AD1634; } else if ((((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && (temp_v1 < 0x4000)) && @@ -774,17 +777,17 @@ void EnOsn_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1FA = 255; switch (ENOSN_GET_3(&this->actor)) { case 0: - if (((gSaveContext.entranceIndex == 0xC020) || (gSaveContext.entranceIndex == 0xC030)) || - (gSaveContext.entranceIndex == 0xC060)) { + if (((gSaveContext.save.entranceIndex == 0xC020) || (gSaveContext.save.entranceIndex == 0xC030)) || + (gSaveContext.save.entranceIndex == 0xC060)) { this->unk_1EA |= 1; } this->unk_1F0 = 1; if (globalCtx->sceneNum == SCENE_INSIDETOWER) { - if ((gSaveContext.entranceIndex == 0xC020) || (gSaveContext.entranceIndex == 0xC060)) { + if ((gSaveContext.save.entranceIndex == 0xC020) || (gSaveContext.save.entranceIndex == 0xC060)) { this->actionFunc = func_80AD16A8; return; } - if (gSaveContext.entranceIndex == 0xC030) { + if (gSaveContext.save.entranceIndex == 0xC030) { func_80AD1398(this); this->actionFunc = func_80AD1634; return; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 625e9674f3..3464314b11 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -207,10 +207,10 @@ s32 EnOssan_TestItemSelected(GlobalContext* globalCtx) { } void EnOssan_CheckValidSpawn(EnOssan* this) { - switch (gSaveContext.day) { + switch (gSaveContext.save.day) { case 1: case 2: - if (gSaveContext.time <= CLOCK_TIME(21, 30) && gSaveContext.time > CLOCK_TIME(6, 00)) { + if (gSaveContext.save.time <= CLOCK_TIME(21, 30) && gSaveContext.save.time > CLOCK_TIME(6, 00)) { if (this->actor.params != ENOSSAN_CURIOSITY_SHOP_MAN) { Actor_MarkForDeath(&this->actor); } @@ -222,7 +222,7 @@ void EnOssan_CheckValidSpawn(EnOssan* this) { if (this->actor.params == ENOSSAN_CURIOSITY_SHOP_MAN) { Actor_MarkForDeath(&this->actor); } - if (!(gSaveContext.time <= CLOCK_TIME(22, 00) && gSaveContext.time >= CLOCK_TIME(6, 00))) { + if (!(gSaveContext.save.time <= CLOCK_TIME(22, 00) && gSaveContext.save.time >= CLOCK_TIME(6, 00))) { if (this->actor.params != ENOSSAN_CURIOSITY_SHOP_MAN) { Actor_MarkForDeath(&this->actor); } @@ -1386,19 +1386,19 @@ u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, GlobalContext* globalCtx) switch (player->transformation) { case PLAYER_FORM_DEKU: this->animationIndex = FSN_ANIMATION_SLAM_COUNTER_START; - if (gSaveContext.weekEventReg[18] & 0x10) { + if (gSaveContext.save.weekEventReg[18] & 0x10) { return sWelcomeDekuTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeDekuFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; case PLAYER_FORM_ZORA: this->animationIndex = FSN_ANIMATION_LEAN_FORWARD_START; - if (gSaveContext.weekEventReg[18] & 8) { + if (gSaveContext.save.weekEventReg[18] & 8) { return sWelcomeZoraTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeZoraFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; case PLAYER_FORM_GORON: this->animationIndex = FSN_ANIMATION_HAND_ON_FACE_START; - if (gSaveContext.weekEventReg[18] & 4) { + if (gSaveContext.save.weekEventReg[18] & 4) { return sWelcomeGoronTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeGoronFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; @@ -1417,17 +1417,17 @@ u16 EnOssan_PartTimerWorker_GetWelcome(EnOssan* this, GlobalContext* globalCtx) } switch (player->transformation) { case PLAYER_FORM_DEKU: - if (gSaveContext.weekEventReg[55] & 0x10) { + if (gSaveContext.save.weekEventReg[55] & 0x10) { return sWelcomeDekuTextIds[ENOSSAN_PART_TIME_WORKER]; } return sWelcomeDekuFirstTimeTextIds[ENOSSAN_PART_TIME_WORKER]; case PLAYER_FORM_ZORA: - if (gSaveContext.weekEventReg[55] & 8) { + if (gSaveContext.save.weekEventReg[55] & 8) { return sWelcomeZoraTextIds[ENOSSAN_PART_TIME_WORKER]; } return sWelcomeZoraFirstTimeTextIds[ENOSSAN_PART_TIME_WORKER]; case PLAYER_FORM_GORON: - if (gSaveContext.weekEventReg[55] & 4) { + if (gSaveContext.save.weekEventReg[55] & 4) { return sWelcomeGoronTextIds[ENOSSAN_PART_TIME_WORKER]; } return sWelcomeGoronFirstTimeTextIds[ENOSSAN_PART_TIME_WORKER]; @@ -1438,22 +1438,22 @@ u16 EnOssan_PartTimerWorker_GetWelcome(EnOssan* this, GlobalContext* globalCtx) void EnOssan_SetHaveMet(EnOssan* this) { switch (this->textId) { case 0x06A9: - gSaveContext.weekEventReg[18] |= 0x10; + gSaveContext.save.weekEventReg[18] |= 0x10; break; case 0x06C6: - gSaveContext.weekEventReg[55] |= 0x10; + gSaveContext.save.weekEventReg[55] |= 0x10; break; case 0x06A7: - gSaveContext.weekEventReg[18] |= 8; + gSaveContext.save.weekEventReg[18] |= 8; break; case 0x06C4: - gSaveContext.weekEventReg[55] |= 8; + gSaveContext.save.weekEventReg[55] |= 8; break; case 0x06A5: - gSaveContext.weekEventReg[18] |= 4; + gSaveContext.save.weekEventReg[18] |= 4; break; case 0x06C2: - gSaveContext.weekEventReg[55] |= 4; + gSaveContext.save.weekEventReg[55] |= 4; break; } } diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index 229f1d661e..7573947e6e 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -180,7 +180,7 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor.world.pos) + 50.0f; - if (gSaveContext.weekEventReg[84] & 0x10) { + if (gSaveContext.save.weekEventReg[84] & 0x10) { Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_NEW); Matrix_GetStateTranslationAndScaledZ(52.519997f, &sp64); Math_Vec3f_Sum(&this->actor.world.pos, &sp64, &sp64); @@ -195,7 +195,7 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_394.y = this->actor.world.pos.y; this->unk_394.z = (this->actor.world.pos.z + this->unk_360->actor.world.pos.z) * 0.5f; Math_Vec3f_Copy(&this->unk_360->unk_394, &this->unk_394); - if (gSaveContext.weekEventReg[32] & 1) { + if (gSaveContext.save.weekEventReg[32] & 1) { func_80B5C244(this, globalCtx); } else { func_80B5C684(this, globalCtx); @@ -230,7 +230,7 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->unk_344) { case 0: Actor_SetScale(&this->actor, 0.0f); - if (!(gSaveContext.weekEventReg[13] & 1)) { + if (!(gSaveContext.save.weekEventReg[13] & 1)) { Actor_SetScale(&this->actor, 0.0f); func_80B5C910(this, globalCtx); } else { @@ -250,8 +250,8 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { case 1: Actor_SetScale(&this->actor, 0.012999999f); - if (gSaveContext.weekEventReg[84] & 0x10) { - if (gSaveContext.weekEventReg[32] & 1) { + if (gSaveContext.save.weekEventReg[84] & 0x10) { + if (gSaveContext.save.weekEventReg[32] & 1) { func_80B5C244(this, globalCtx); } else { func_80B5C684(this, globalCtx); @@ -264,7 +264,7 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { break; case 3: - if (!(gSaveContext.weekEventReg[26] & 8)) { + if (!(gSaveContext.save.weekEventReg[26] & 8)) { this->actor.flags |= ACTOR_FLAG_8000000; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); Actor_SetScale(&this->actor, 0.0064999997f); @@ -376,11 +376,11 @@ void func_80B5BFB8(EnOt* this, GlobalContext* globalCtx) { } void func_80B5C154(EnOt* this, GlobalContext* globalCtx) { - if (gSaveContext.weekEventReg[32] & 1) { + if (gSaveContext.save.weekEventReg[32] & 1) { this->unk_38C = GI_RUPEE_RED; } else { this->unk_38C = GI_HEART_PIECE; - gSaveContext.weekEventReg[32] |= 1; + gSaveContext.save.weekEventReg[32] |= 1; } Actor_PickUp(&this->actor, globalCtx, this->unk_38C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_80B5C1CC; @@ -482,7 +482,7 @@ void func_80B5C634(EnOt* this, GlobalContext* globalCtx) { } void func_80B5C64C(EnOt* this, GlobalContext* globalCtx) { - if (gSaveContext.weekEventReg[26] & 8) { + if (gSaveContext.save.weekEventReg[26] & 8) { Actor_MarkForDeath(&this->actor); } } @@ -505,7 +505,7 @@ void func_80B5C6DC(EnOt* this, GlobalContext* globalCtx) { Matrix_GetStateTranslationAndScaledZ(26.259998f, &sp30); } else { if (this->unk_73C == 0) { - gSaveContext.weekEventReg[84] |= 0x10; + gSaveContext.save.weekEventReg[84] |= 0x10; switch (this->unk_388) { case 0: ActorCutscene_Stop(this->cutscenes[2]); @@ -527,7 +527,7 @@ void func_80B5C6DC(EnOt* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.x, this->unk_348.x, 1.0f, 2.0f, 0.01f); Math_SmoothStepToF(&this->actor.world.pos.z, this->unk_348.z, 1.0f, 2.0f, 0.01f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); - if ((gSaveContext.weekEventReg[84] & 0x10) && (this->unk_33C == 1)) { + if ((gSaveContext.save.weekEventReg[84] & 0x10) && (this->unk_33C == 1)) { this->actor.textId = 0; this->unk_384 = 1; if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { @@ -556,7 +556,7 @@ void func_80B5C910(EnOt* this, GlobalContext* globalCtx) { void func_80B5C950(EnOt* this, GlobalContext* globalCtx) { if (this->unk_32C & 8) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SEAHORSE_OUT_BOTTLE); - gSaveContext.weekEventReg[25] |= 4; + gSaveContext.save.weekEventReg[25] |= 4; func_80B5CAD0(this, globalCtx); } } @@ -650,7 +650,7 @@ void func_80B5CD40(EnOt* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; if (1) {} if (!temp) { - gSaveContext.weekEventReg[23] |= 0x10; + gSaveContext.save.weekEventReg[23] |= 0x10; Message_StartTextbox(globalCtx, 0x1069, NULL); } break; @@ -701,7 +701,7 @@ void func_80B5CEC8(EnOt* this, GlobalContext* globalCtx) { } } - if (!(gSaveContext.weekEventReg[84] & 0x10) && (ENOT_GET_C000(&this->actor) == 1)) { + if (!(gSaveContext.save.weekEventReg[84] & 0x10) && (ENOT_GET_C000(&this->actor) == 1)) { if ((fabsf(this->actor.xzDistToPlayer) <= 130.0f) && (fabsf(this->actor.playerHeightRel) <= 130.0f)) { player->unk_B2B = 29; } @@ -754,7 +754,7 @@ void func_80B5D160(EnOt* this, GlobalContext* globalCtx) { phi_a1 = 0x1069; } } else if (Flags_GetSwitch(globalCtx, ENOT_GET_3F80(&this->actor))) { - if (gSaveContext.weekEventReg[23] & 0x10) { + if (gSaveContext.save.weekEventReg[23] & 0x10) { phi_a1 = 0x106C; } else { phi_a1 = 0x106B; @@ -985,8 +985,8 @@ void func_80B5DB6C(Actor* thisx, GlobalContext* globalCtx) { EnOt* this = THIS; Player* player = GET_PLAYER(globalCtx); - if (!(gSaveContext.weekEventReg[84] & 0x10) && !(this->unk_32C & 8)) { - if (gSaveContext.weekEventReg[25] & 4) { + if (!(gSaveContext.save.weekEventReg[84] & 0x10) && !(this->unk_32C & 8)) { + if (gSaveContext.save.weekEventReg[25] & 4) { Vec3f sp50; func_80B5B2E0(globalCtx, &this->actor.world.pos, ENOT_GET_7F(&this->actor), &sp50, &this->unk_340); @@ -998,7 +998,7 @@ void func_80B5DB6C(Actor* thisx, GlobalContext* globalCtx) { } else if (D_80B5E888 != NULL) { s32 sp4C = false; - if (gSaveContext.weekEventReg[13] & 1) { + if (gSaveContext.save.weekEventReg[13] & 1) { if (!SurfaceType_IsHorseBlocked(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { sp4C = true; } diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 5a020ef5e4..ab8f721aef 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -157,7 +157,7 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ENOWL_GET_TYPE_2: - if (gSaveContext.inventory.items[SLOT_LENS] == ITEM_LENS) { + if (gSaveContext.save.inventory.items[ITEM_LENS] == ITEM_LENS) { Actor_MarkForDeath(&this->actor); return; } @@ -183,7 +183,7 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { case ENOWL_GET_TYPE_2: this->actionFunc = func_8095BE0C; - if (gSaveContext.weekEventReg[9] & 0x20) { + if (gSaveContext.save.weekEventReg[9] & 0x20) { this->actor.textId = 0xBF0; } else { this->actor.textId = 0xBEA; @@ -613,10 +613,10 @@ void func_8095BA84(EnOwl* this, GlobalContext* globalCtx) { switch (globalCtx->msgCtx.choiceIndex) { case 0: func_8019F208(); - if (gSaveContext.weekEventReg[9] & 0x40) { + if (gSaveContext.save.weekEventReg[9] & 0x40) { func_80151938(globalCtx, 0xBF4); } else { - gSaveContext.weekEventReg[9] |= 0x40; + gSaveContext.save.weekEventReg[9] |= 0x40; func_80151938(globalCtx, 0xBED); } break; @@ -649,7 +649,7 @@ void func_8095BA84(EnOwl* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.currentTextId) { case 0xBEA: - gSaveContext.weekEventReg[9] |= 0x20; + gSaveContext.save.weekEventReg[9] |= 0x20; func_80151938(globalCtx, 0xBEB); break; diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index ae14fa125a..06cf9b22dd 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -155,14 +155,14 @@ void EnPamera_Init(Actor* thisx, GlobalContext* globalCtx) { func_80BD8588(this, globalCtx); func_80BD8658(this); if (1) {} - if (!(gSaveContext.weekEventReg[14] & 4) || (gSaveContext.weekEventReg[52] & 0x20) || - (gSaveContext.weekEventReg[75] & 0x20) || (gSaveContext.entranceIndex == 0x2090)) { + if (!(gSaveContext.save.weekEventReg[14] & 4) || (gSaveContext.save.weekEventReg[52] & 0x20) || + (gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.entranceIndex == 0x2090)) { Actor_MarkForDeath(&this->actor); } - if (gSaveContext.weekEventReg[61] & 4) { - if (!(gSaveContext.weekEventReg[59] & 1) || (gSaveContext.entranceIndex != 0x2020)) { - if ((gSaveContext.entranceIndex != 0x2020) && (gSaveContext.weekEventReg[59] & 1)) { - gSaveContext.weekEventReg[59] &= (u8)~1; + if (gSaveContext.save.weekEventReg[61] & 4) { + if (!(gSaveContext.save.weekEventReg[59] & 1) || (gSaveContext.save.entranceIndex != 0x2020)) { + if ((gSaveContext.save.entranceIndex != 0x2020) && (gSaveContext.save.weekEventReg[59] & 1)) { + gSaveContext.save.weekEventReg[59] &= (u8)~1; } func_80BD8700(this); } else { @@ -173,7 +173,7 @@ void EnPamera_Init(Actor* thisx, GlobalContext* globalCtx) { func_80BD8CCC(this); } } else { - gSaveContext.weekEventReg[59] |= 1; + gSaveContext.save.weekEventReg[59] |= 1; func_80BD8FF0(this); } } @@ -200,7 +200,7 @@ void func_80BD8588(EnPamera* this, GlobalContext* globalCtx) { if (path == NULL) { Actor_MarkForDeath(&this->actor); } - if (gSaveContext.weekEventReg[61] & 4) { + if (gSaveContext.save.weekEventReg[61] & 4) { path = &globalCtx->setupPathList[path->unk1]; } this->pathPoints = Lib_SegmentedToVirtual(path->points); @@ -289,7 +289,7 @@ void func_80BD8964(EnPamera* this, GlobalContext* globalCtx) { if (Math_Vec3f_StepTo(&this->actor.world.pos, &vec, 1.0f) < 5.0f) { this->actor.speedXZ = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); - gSaveContext.weekEventReg[59] |= 1; + gSaveContext.save.weekEventReg[59] |= 1; func_80BD8B50(this); } } @@ -304,10 +304,10 @@ void func_80BD8A7C(EnPamera* this, GlobalContext* globalCtx) { 0x3000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; if (Math_Vec3f_StepTo(&this->actor.world.pos, &this->actor.home.pos, 1.5f) < 10.0f) { - gSaveContext.weekEventReg[59] &= (u8)~1; - if (!(gSaveContext.weekEventReg[61] & 4)) { + gSaveContext.save.weekEventReg[59] &= (u8)~1; + if (!(gSaveContext.save.weekEventReg[61] & 4)) { func_80BD92D0(this, globalCtx); - gSaveContext.weekEventReg[61] |= 4; + gSaveContext.save.weekEventReg[61] |= 4; } func_80BD8700(this); } @@ -567,7 +567,7 @@ void func_80BD9840(EnPamera* this, GlobalContext* globalCtx) { this->actor.update = func_80BDA344; this->actor.flags |= ACTOR_FLAG_2000000; this->actor.flags |= ACTOR_FLAG_100000; - if ((gSaveContext.weekEventReg[75] & 0x20) || (gSaveContext.weekEventReg[52] & 0x20)) { + if ((gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.weekEventReg[52] & 0x20)) { func_80BD9E60(this); func_80BD9938(this); } else { @@ -575,7 +575,7 @@ void func_80BD9840(EnPamera* this, GlobalContext* globalCtx) { func_80BD9E60(this); func_80BD9904(this); } - if (gSaveContext.weekEventReg[14] & 4) { + if (gSaveContext.save.weekEventReg[14] & 4) { func_801A0204(NA_BGM_MUSIC_BOX_HOUSE); } else { func_801A0204(NA_BGM_INSIDE_A_HOUSE); @@ -602,8 +602,8 @@ void func_80BD994C(EnPamera* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x15A8, &this->actor); this->unk_324 = 0x15A8; - } else if ((gSaveContext.playerForm != PLAYER_FORM_HUMAN) || - ((gSaveContext.weekEventReg[52] & 0x20) && (!(gSaveContext.weekEventReg[75] & 0x20)))) { + } else if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || + ((gSaveContext.save.weekEventReg[52] & 0x20) && (!(gSaveContext.save.weekEventReg[75] & 0x20)))) { func_80BD93CC(this, 1, 0); Message_StartTextbox(globalCtx, 0x158E, &this->actor); this->unk_324 = 0x158E; @@ -726,7 +726,7 @@ s32 func_80BD9CB8(EnPamera* this, GlobalContext* globalCtx) { this->setupFunc(this, globalCtx); return 1; } - if ((globalCtx->csCtx.state == 0) && (gSaveContext.weekEventReg[75] & 0x20)) { + if ((globalCtx->csCtx.state == 0) && (gSaveContext.save.weekEventReg[75] & 0x20)) { if ((this->actionFunc != func_80BD994C) && (this->actionFunc != EnPamera_HandleDialogue)) { this->actor.shape.rot.y = this->actor.world.rot.y; func_80BD9904(this); @@ -850,11 +850,11 @@ void func_80BDA344(Actor* thisx, GlobalContext* globalCtx) { func_80BD9384(this, globalCtx); if (func_80BD9CB8(this, globalCtx)) { // Pamela is outside - if (gSaveContext.weekEventReg[59] & 1) { - gSaveContext.weekEventReg[59] &= (u8)~1; + if (gSaveContext.save.weekEventReg[59] & 1) { + gSaveContext.save.weekEventReg[59] &= (u8)~1; } - if (!(gSaveContext.weekEventReg[61] & 4)) { - gSaveContext.weekEventReg[61] |= 4; + if (!(gSaveContext.save.weekEventReg[61] & 4)) { + gSaveContext.save.weekEventReg[61] |= 4; } func_800E8F08(&this->limb9Rot, &this->limb8Rot); } else { @@ -863,7 +863,7 @@ void func_80BDA344(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } - if (gSaveContext.weekEventReg[14] & 4) { + if (gSaveContext.save.weekEventReg[14] & 4) { globalCtx->roomCtx.unk7A[0]++; } } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index d8731cc857..901e226c5e 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -170,7 +170,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 10, ICHAIN_STOP), }; -// gSaveContext.weekEventReg[KEY] = VALUE +// gSaveContext.save.weekEventReg[KEY] = VALUE // KEY | VALUE static s32 isFrogReturnedFlags[] = { (32 << 8) | 0x40, // Woodfall Temple Frog Returned @@ -192,7 +192,7 @@ void EnPametfrog_Init(Actor* thisx, GlobalContext* globalCtx) { this->params = CLAMP(this->actor.params, 1, 4); if (Flags_GetClear(globalCtx, globalCtx->roomCtx.currRoom.num)) { Actor_MarkForDeath(&this->actor); - if (!(gSaveContext.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & + if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & (u8)isFrogReturnedFlags[this->actor.params - 1])) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->params); diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index b528e60c30..a5321bf269 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -189,7 +189,7 @@ void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 0) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit1); - if (gSaveContext.isNight) { + if (gSaveContext.save.isNight) { this->actor.shape.yOffset = -1000.0f; } Actor_SetScale(&this->actor, 0.036f); @@ -296,7 +296,7 @@ void func_80897498(EnPeehat* this) { } void func_80897520(EnPeehat* this, GlobalContext* globalCtx) { - if (!gSaveContext.isNight) { + if (!gSaveContext.save.isNight) { this->actor.flags |= ACTOR_FLAG_1; this->colliderSphere.base.acFlags |= AC_ON; if (this->actor.xzDistToPlayer < 740.0f) { @@ -381,7 +381,7 @@ void func_80897910(EnPeehat* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 3.0f, 0.25f); Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 80.0f, 3.0f); SkelAnime_Update(&this->skelAnime); - if (!gSaveContext.isNight && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 1200.0f)) { + if (!gSaveContext.save.isNight && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 1200.0f)) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1000); this->actor.shape.rot.y += (s16)(this->unk_2AD * 450); } else { @@ -521,7 +521,7 @@ void func_80897F44(EnPeehat* this, GlobalContext* globalCtx) { this->actor.world.rot.y += this->unk_2B6; this->actor.shape.rot.y += 0x15E; - if (!gSaveContext.isNight && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 1200.0f)) { + if (!gSaveContext.save.isNight && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 1200.0f)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80897864(this); } else { @@ -566,7 +566,7 @@ void func_80898144(EnPeehat* this, GlobalContext* globalCtx) { func_80897D00(this); } - if (!gSaveContext.isNight && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 1200.0f)) { + if (!gSaveContext.save.isNight && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 1200.0f)) { func_80897864(this); } func_800B9010(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 0ff811a393..27c7af9f5b 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -248,19 +248,19 @@ static AnimationInfoS sAnimations[] = { }; s32 func_80AF7B40(void) { - if (gSaveContext.weekEventReg[90] & 1) { + if (gSaveContext.save.weekEventReg[90] & 1) { return 4; } - if (gSaveContext.weekEventReg[89] & 0x40) { + if (gSaveContext.save.weekEventReg[89] & 0x40) { return 3; } - if (gSaveContext.weekEventReg[89] & 8) { + if (gSaveContext.save.weekEventReg[89] & 8) { return 2; } - if (gSaveContext.weekEventReg[86] & 1) { + if (gSaveContext.save.weekEventReg[86] & 1) { return 1; } @@ -270,29 +270,29 @@ s32 func_80AF7B40(void) { s32 func_80AF7BAC(EnPm* this) { switch (this->unk_38C) { case 0: - if (gSaveContext.weekEventReg[86] & 1) { - D_801F4E78 = gSaveContext.time; + if (gSaveContext.save.weekEventReg[86] & 1) { + D_801F4E78 = gSaveContext.save.time; this->unk_38C++; } break; case 1: - if (gSaveContext.weekEventReg[89] & 8) { - D_801F4E78 = gSaveContext.time; + if (gSaveContext.save.weekEventReg[89] & 8) { + D_801F4E78 = gSaveContext.save.time; this->unk_38C++; } break; case 2: - if (gSaveContext.weekEventReg[89] & 0x40) { + if (gSaveContext.save.weekEventReg[89] & 0x40) { D_801F4E78 = 0; this->unk_38C++; } break; case 3: - if (gSaveContext.weekEventReg[90] & 1) { - D_801F4E78 = gSaveContext.time; + if (gSaveContext.save.weekEventReg[90] & 1) { + D_801F4E78 = gSaveContext.save.time; this->unk_38C++; } break; @@ -547,7 +547,7 @@ s32 func_80AF81E8(EnPm* this, GlobalContext* globalCtx) { case 1: case 3: case 5: - if ((gSaveContext.weekEventReg[86] & 8) && (this->unk_378 == 3)) { + if ((gSaveContext.save.weekEventReg[86] & 8) && (this->unk_378 == 3)) { ActorCutscene_Stop(sp2A); } else { Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); @@ -816,24 +816,26 @@ void func_80AF8BA8(s32 arg0) { }; s32 temp; - if (!(gSaveContext.weekEventReg[88] & 2)) { - if (gSaveContext.weekEventReg[D_80AFB8D4[arg0] >> 8] & (D_80AFB8D4[arg0] & (1 | 2 | 4 | 0x38 | 0x40 | 0x80))) { - switch (gSaveContext.day) { + if (!(gSaveContext.save.weekEventReg[88] & 2)) { + if (gSaveContext.save.weekEventReg[D_80AFB8D4[arg0] >> 8] & + (D_80AFB8D4[arg0] & (1 | 2 | 4 | 0x38 | 0x40 | 0x80))) { + switch (gSaveContext.save.day) { case 2: - gSaveContext.weekEventReg[28] |= 8; + gSaveContext.save.weekEventReg[28] |= 8; break; case 3: - gSaveContext.weekEventReg[28] |= 0x10; + gSaveContext.save.weekEventReg[28] |= 0x10; break; } - gSaveContext.weekEventReg[51] |= 2; - gSaveContext.weekEventReg[90] |= 8; + gSaveContext.save.weekEventReg[51] |= 2; + gSaveContext.save.weekEventReg[90] |= 8; } } - temp = gSaveContext.weekEventReg[D_80AFB8E0[arg0] >> 8]; - gSaveContext.weekEventReg[D_80AFB8E0[arg0] >> 8] = temp | (D_80AFB8E0[arg0] & (1 | 2 | 4 | 0x38 | 0x40 | 0x80)); + temp = gSaveContext.save.weekEventReg[D_80AFB8E0[arg0] >> 8]; + gSaveContext.save.weekEventReg[D_80AFB8E0[arg0] >> 8] = + temp | (D_80AFB8E0[arg0] & (1 | 2 | 4 | 0x38 | 0x40 | 0x80)); } void func_80AF8C68(EnPm* this, GlobalContext* globalCtx) { @@ -933,7 +935,7 @@ s32 func_80AF8ED4(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { - u16 sp56 = gSaveContext.time - 0x3FFC; + u16 sp56 = gSaveContext.save.time - 0x3FFC; u8 sp55 = this->actor.params & 0xFF; EnDoor* door; Vec3s* sp4C; @@ -967,7 +969,7 @@ s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar this->unk_36C = arg2->unk8 - arg2->unk4; this->unk_36E = sp56 - arg2->unk4; this->actor.flags &= ~ACTOR_FLAG_1; - if (gSaveContext.weekEventReg[90] & 8) { + if (gSaveContext.save.weekEventReg[90] & 8) { this->unk_356 |= 0x800; } this->unk_356 |= 0x9000; @@ -981,7 +983,7 @@ s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } s32 func_80AF91E8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { - u16 sp2E = (u16)(gSaveContext.time - 0x3FFC); + u16 sp2E = (u16)(gSaveContext.save.time - 0x3FFC); u16 phi_v1; u8 sp2B = this->actor.params & 0xFF; s32 pad; @@ -1045,7 +1047,7 @@ s32 func_80AF91E8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar default: SubS_UpdateFlags(&this->unk_356, 3, 7); func_80AF7E98(this, 0); - if (gSaveContext.weekEventReg[90] & 8) { + if (gSaveContext.save.weekEventReg[90] & 8) { this->unk_356 |= 0x800; } this->unk_356 |= 0x9000; @@ -1161,10 +1163,10 @@ s32 func_80AF95E8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar break; case 23: - if (gSaveContext.weekEventReg[90] & 8) { + if (gSaveContext.save.weekEventReg[90] & 8) { this->unk_356 |= 0x800; } - gSaveContext.weekEventReg[60] |= 4; + gSaveContext.save.weekEventReg[60] |= 4; default: if (arg2->unk0 == 0x1D) { @@ -1482,11 +1484,11 @@ s32 func_80AF9E7C(EnPm* this, GlobalContext* globalCtx) { } if ((this->unk_356 & 0x10) && (this->unk_258 == 90)) { - u8 val = gSaveContext.weekEventReg[89] | 0x40; + u8 val = gSaveContext.save.weekEventReg[89] | 0x40; - gSaveContext.weekEventReg[89] = val; + gSaveContext.save.weekEventReg[89] = val; if (val == 0) { - gSaveContext.weekEventReg[89] |= 0x40; + gSaveContext.save.weekEventReg[89] |= 0x40; } } @@ -1499,8 +1501,8 @@ s32 func_80AFA170(EnPm* this, GlobalContext* globalCtx) { switch (this->unk_258) { case 28: - if (gSaveContext.time >= CLOCK_TIME(1, 39)) { - gSaveContext.weekEventReg[89] |= 8; + if (gSaveContext.save.time >= CLOCK_TIME(1, 39)) { + gSaveContext.save.weekEventReg[89] |= 8; } case 16: @@ -1689,16 +1691,16 @@ void func_80AFA4D0(EnPm* this, GlobalContext* globalCtx) { static UNK_PTR D_80AFB900[] = { D_80AFAD80, D_80AFB30C, D_80AFB3C0, D_80AFB3FC, D_80AFB41C, }; - u16 time = gSaveContext.time; + u16 time = gSaveContext.save.time; u16 sp3C = 0; - u32* unk_14 = &gSaveContext.unk_14; + u32* unk_14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 sp2C; this->unk_374 = REG(15) + *unk_14; if (this->unk_38C != 0) { - time = gSaveContext.time - D_801F4E78; - sp3C = gSaveContext.time; - gSaveContext.time = time; + time = gSaveContext.save.time - D_801F4E78; + sp3C = gSaveContext.save.time; + gSaveContext.save.time = time; } if (!func_80133038(globalCtx, D_80AFB900[this->unk_38C], &sp2C) || @@ -1715,7 +1717,7 @@ void func_80AFA4D0(EnPm* this, GlobalContext* globalCtx) { this->unk_268 = func_80AF8040(this, globalCtx); func_80AFA438(this, globalCtx); if (this->unk_38C != 0) { - gSaveContext.time = sp3C; + gSaveContext.save.time = sp3C; } } @@ -1824,7 +1826,7 @@ void EnPm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Matrix_MultiplyVector3fByState(&gZeroVec3f, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); } - if ((this->unk_356 & 0x8000) && !(gSaveContext.weekEventReg[90] & 4)) { + if ((this->unk_356 & 0x8000) && !(gSaveContext.save.weekEventReg[90] & 4)) { func_80AF8890(this, gfx, 1); } break; diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.c b/src/overlays/actors/ovl_En_Pr/z_en_pr.c index f8c702479d..8c5d417f39 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.c +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.c @@ -345,7 +345,7 @@ void func_80A32B20(EnPr* this, GlobalContext* globalCtx) { this->actor.speedXZ = BREG(57) + 3.0f; Math_SmoothStepToS(&this->unk_22C, this->actor.yawTowardsPlayer, BREG(49) + 1, BREG(50) + 1000, BREG(51)); - this->unk_2B8 = D_80A338C0[(void)0, gSaveContext.playerForm] + player->actor.world.pos.y; + this->unk_2B8 = D_80A338C0[(void)0, gSaveContext.save.playerForm] + player->actor.world.pos.y; func_80A324E0(this, globalCtx); if (!(player->stateFlags1 & 0x8000000)) { @@ -382,7 +382,7 @@ void func_80A32D28(EnPr* this, GlobalContext* globalCtx) { } else { Math_SmoothStepToS(&this->unk_22C, this->actor.yawTowardsPlayer, BREG(49) + 1, BREG(50) + 1000, BREG(51)); func_80A325E4(this); - this->unk_2B8 = D_80A338C0[(void)0, gSaveContext.playerForm] + player->actor.world.pos.y; + this->unk_2B8 = D_80A338C0[(void)0, gSaveContext.save.playerForm] + player->actor.world.pos.y; func_80A324E0(this, globalCtx); if (this->unk_2C8 < sqrtf(SQ(player->actor.world.pos.x - this->actor.home.pos.x) + SQ(player->actor.world.pos.z - this->actor.home.pos.z))) { diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.c b/src/overlays/actors/ovl_En_Prz/z_en_prz.c index 2a86294dc6..29df2aa2c2 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.c +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.c @@ -354,7 +354,7 @@ void func_80A767A8(EnPrz* this, GlobalContext* globalCtx) { this->unk_1C8 = 1; } - playerForm = gSaveContext.playerForm; + playerForm = gSaveContext.save.playerForm; this->unk_1D8.y = (player->actor.world.pos.y + D_80A771E0[playerForm]) + randPlusMinusPoint5Scaled((2.0f * this->unk_1E6) + 1.0f); func_80A76070(this, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_1D8), globalCtx); diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index ce19523145..064c2d2e48 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -330,10 +330,10 @@ void func_80B24CB4(EnRacedog* this, GlobalContext* globalCtx) { void func_80B24E14(EnRacedog* this) { if (this->unk_290 % 2) { D_80B25D88[this->unk_290].unk_0E = - (((gSaveContext.weekEventReg[42 + (this->unk_290 / 2)]) & (0x10 | 0x20 | 0x40 | 0x80)) >> 4) + 0x3539; + (((gSaveContext.save.weekEventReg[42 + (this->unk_290 / 2)]) & (0x10 | 0x20 | 0x40 | 0x80)) >> 4) + 0x3539; } else { D_80B25D88[this->unk_290].unk_0E = - ((gSaveContext.weekEventReg[42 + (this->unk_290 / 2)]) & (1 | 2 | 4 | 8)) + 0x3539; + ((gSaveContext.save.weekEventReg[42 + (this->unk_290 / 2)]) & (1 | 2 | 4 | 8)) + 0x3539; } if ((D_80B25D88[this->unk_290].unk_0E >= 0x3547) || (D_80B25D88[this->unk_290].unk_0E < 0x3539)) { diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index b1c6b76cba..70d9fb7088 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -254,7 +254,7 @@ void EnRailgibud_Init(Actor* thisx, GlobalContext* globalCtx) { EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(this, globalCtx); this->playerStunWaitTimer = 0; - this->timeInitialized = gSaveContext.time; + this->timeInitialized = gSaveContext.save.time; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->type = EN_RAILGIBUD_TYPE_GIBDO; this->textId = 0; @@ -270,7 +270,7 @@ void EnRailgibud_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if (gSaveContext.weekEventReg[14] & 4) { + if (gSaveContext.save.weekEventReg[14] & 4) { Actor_MarkForDeath(&this->actor); } @@ -381,7 +381,8 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, GlobalContext* globalCtx) { if (EnRailgibud_PlayerInRangeWithCorrectState(this, globalCtx) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { if ((this->grabWaitTimer == 0) && (this->actor.xzDistToPlayer <= 45.0f)) { player->actor.freezeTimer = 0; - if ((gSaveContext.playerForm == PLAYER_FORM_GORON) || (gSaveContext.playerForm == PLAYER_FORM_DEKU)) { + if ((gSaveContext.save.playerForm == PLAYER_FORM_GORON) || + (gSaveContext.save.playerForm == PLAYER_FORM_DEKU)) { // If the Gibdo/Redead tries to grab Goron or Deku Link, it will fail to // do so. It will appear to take damage and shake its head side-to-side. EnRailgibud_SetupGrabFail(this); @@ -552,7 +553,7 @@ void EnRailgibud_WalkToHome(EnRailgibud* this, GlobalContext* globalCtx) { this->actor.world.rot = this->actor.shape.rot; } if (EnRailgibud_PlayerInRangeWithCorrectState(this, globalCtx)) { - if ((gSaveContext.playerForm != PLAYER_FORM_GORON) && (gSaveContext.playerForm != PLAYER_FORM_DEKU) && + if ((gSaveContext.save.playerForm != PLAYER_FORM_GORON) && (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { EnRailgibud_SetupWalkToPlayer(this); } @@ -865,7 +866,7 @@ s32 EnRailgibud_MoveToIdealGrabPositionAndRotation(EnRailgibud* this, GlobalCont distanceFromTargetPos = Math_Vec3f_StepTo(&this->actor.world.pos, &targetPos, 10.0f); distanceFromTargetAngle = Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 0x1770, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { distanceFromTargetYOffset = Math_SmoothStepToF(&this->actor.shape.yOffset, -1500.0f, 1.0f, 150.0f, 0.0f); } @@ -1112,8 +1113,7 @@ void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, GlobalContext* globalCtx) Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - - if (gSaveContext.entranceIndex != 0x2090) { // NOT Cutscene: Music Box House Opens + if (gSaveContext.save.entranceIndex != 0x2090) { // NOT Cutscene: Music Box House Opens Actor_MarkForDeath(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c index 30449a3b49..8c2f5b6c83 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c @@ -149,8 +149,8 @@ void EnRecepgirl_Talk(EnRecepgirl* this, GlobalContext* globalCtx) { Flags_SetSwitch(globalCtx, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); - if (gSaveContext.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting - this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended) + if (gSaveContext.save.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting + this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended) } else { this->actor.textId = 0x2ADA; // Mayor's office is on the left (meeting ongoing) } diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index b7d4f5d5dd..4e41b70a94 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -667,7 +667,7 @@ void func_80BF4EBC(EnRg* this, GlobalContext* globalCtx) { this->actor.shape.yOffset = 14.0f; this->actionFunc = func_80BF4FC4; } - } else if (gSaveContext.weekEventReg[12] & 2) { + } else if (gSaveContext.save.weekEventReg[12] & 2) { if (DECR(this->unk_318) == 0) { func_80BF409C(this, 1); this->unk_310 &= ~8; @@ -733,7 +733,7 @@ void func_80BF4FC4(EnRg* this, GlobalContext* globalCtx) { void EnRg_Init(Actor* thisx, GlobalContext* globalCtx) { EnRg* this = THIS; - if (gSaveContext.entranceIndex == 0xD010) { + if (gSaveContext.save.entranceIndex == 0xD010) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_oF1d_map_Skel_011AC8, NULL, this->jointTable, this->morphTable, 18); @@ -759,7 +759,7 @@ void EnRg_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; SubS_UpdateFlags(&this->unk_310, 3, 7); - if (!(gSaveContext.weekEventReg[12] & 2)) { + if (!(gSaveContext.save.weekEventReg[12] & 2)) { this->unk_318 = Rand_S16Offset(30, 30); } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 17324a3b68..4bd5bcf324 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -304,8 +304,8 @@ void func_808FA4F4(EnRr* this, GlobalContext* globalCtx) { this->unk_210 = 0.0f; this->unk_20C = 0x800; - if (((this->unk_1E2 == 0) && (gSaveContext.playerForm == PLAYER_FORM_HUMAN)) && - (CUR_EQUIP_VALUE_VOID(EQUIP_SHIELD) == EQUIP_SHIELD)) { + if (((this->unk_1E2 == 0) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) && + (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) == 1)) { sp34 = true; this->unk_1E2 = Inventory_DeleteEquipment(globalCtx, 1); } else { diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index bbe21471c8..cf4935187d 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -170,7 +170,7 @@ void func_80BCAE78(EnScopenuts* this, GlobalContext* globalCtx) { s16 func_80BCAF0C(EnScopenuts* this) { switch (this->unk_33C) { case 0x0: - if (gSaveContext.weekEventReg[53] & 2) { + if (gSaveContext.save.weekEventReg[53] & 2) { this->unk_328 |= 1; return 0x1638; } @@ -239,7 +239,7 @@ void func_80BCB1C8(EnScopenuts* this, GlobalContext* globalCtx) { this->unk_350 *= 0.92f; Actor_SetScale(&this->actor, this->unk_350); if (this->actor.bgCheckFlags & 1) { - gSaveContext.weekEventReg[52] |= 0x40; + gSaveContext.save.weekEventReg[52] |= 0x40; Actor_MarkForDeath(&this->actor); } } @@ -334,7 +334,7 @@ void func_80BCB6D0(EnScopenuts* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx) != 0) { switch (globalCtx->msgCtx.choiceIndex) { case 0: - if (gSaveContext.rupees < this->unk_358) { + if (gSaveContext.save.playerData.rupees < this->unk_358) { play_sound(NA_SE_SY_ERROR); this->unk_33C = 0x1636; this->unk_328 |= 1; @@ -368,7 +368,7 @@ void func_80BCB6D0(EnScopenuts* this, GlobalContext* globalCtx) { void func_80BCB90C(EnScopenuts* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; - gSaveContext.weekEventReg[53] |= 2; + gSaveContext.save.weekEventReg[53] |= 2; this->actionFunc = func_80BCB6D0; } else { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 300.0f, 300.0f); @@ -594,7 +594,7 @@ void func_80BCBFFC(EnScopenuts* this, GlobalContext* globalCtx) { if (sp32 == 3) { if (this->unk_334 >= (this->path->count - 1)) { ActorCutscene_Stop(this->unk_338); - gSaveContext.weekEventReg[52] &= (u8)~0x40; + gSaveContext.save.weekEventReg[52] &= (u8)~0x40; this->actionFunc = func_80BCC288; } else { this->unk_334++; @@ -684,7 +684,8 @@ void EnScopenuts_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnScopenuts* this = THIS; - if (!(gSaveContext.weekEventReg[74] & 0x40) && (gSaveContext.inventory.items[ITEM_OCARINA] == ITEM_NONE)) { + if (!(gSaveContext.save.weekEventReg[74] & 0x40) && + (gSaveContext.save.inventory.items[ITEM_OCARINA] == ITEM_NONE)) { Actor_MarkForDeath(&this->actor); return; } @@ -704,7 +705,7 @@ void EnScopenuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_0) { - if (gSaveContext.weekEventReg[52] & 0x40) { + if (gSaveContext.save.weekEventReg[52] & 0x40) { Actor_MarkForDeath(&this->actor); } else if (globalCtx->actorCtx.unk5 & 2) { this->path = func_8013D648(globalCtx, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); @@ -715,7 +716,7 @@ void EnScopenuts_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } } else if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_1) { - if (gSaveContext.weekEventReg[52] & 0x40) { + if (gSaveContext.save.weekEventReg[52] & 0x40) { this->path = func_8013D648(globalCtx, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); if (this->path == NULL) { Actor_MarkForDeath(&this->actor); diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index e1f52ceed1..199338bf17 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -348,21 +348,21 @@ void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { } else { switch (this->unk_340) { case 0x60E: - gSaveContext.weekEventReg[17] |= 0x20; - gSaveContext.weekEventReg[86] |= 4; + gSaveContext.save.weekEventReg[17] |= 0x20; + gSaveContext.save.weekEventReg[86] |= 4; Message_StartTextbox(globalCtx, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; case 0x628: - gSaveContext.weekEventReg[77] |= 0x40; - gSaveContext.weekEventReg[86] |= 4; + gSaveContext.save.weekEventReg[77] |= 0x40; + gSaveContext.save.weekEventReg[86] |= 4; Message_StartTextbox(globalCtx, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; case 0x614: - gSaveContext.weekEventReg[17] |= 0x40; + gSaveContext.save.weekEventReg[17] |= 0x40; Message_StartTextbox(globalCtx, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; @@ -384,22 +384,22 @@ void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { this->actor.isTargeted) { func_800B85E0(&this->actor, globalCtx, 80.0f, EXCH_ITEM_2A); if (player->transformation == PLAYER_FORM_DEKU) { - if (gSaveContext.day == 3) { + if (gSaveContext.save.day == 3) { this->unk_33A = 2; - if (gSaveContext.weekEventReg[77] & 0x40) { + if (gSaveContext.save.weekEventReg[77] & 0x40) { this->unk_340 = D_80ADD918[this->unk_33A]; } else { this->unk_340 = D_80ADD910[this->unk_33A]; } } else { this->unk_33A = 1; - if (gSaveContext.weekEventReg[17] & 0x20) { + if (gSaveContext.save.weekEventReg[17] & 0x20) { this->unk_340 = D_80ADD918[this->unk_33A]; } else { this->unk_340 = D_80ADD910[this->unk_33A]; } } - } else if (gSaveContext.weekEventReg[17] & 0x40) { + } else if (gSaveContext.save.weekEventReg[17] & 0x40) { this->unk_340 = D_80ADD918[this->unk_33A]; } else { this->unk_340 = D_80ADD910[this->unk_33A]; @@ -479,7 +479,7 @@ void func_80ADBAB8(EnSellnuts* this, GlobalContext* globalCtx) { void func_80ADBBEC(EnSellnuts* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; - gSaveContext.weekEventReg[17] |= 0x80; + gSaveContext.save.weekEventReg[17] |= 0x80; this->actionFunc = func_80ADBCE4; } else { Actor_PickUp(&this->actor, globalCtx, GI_DEED_LAND, 300.0f, 300.0f); @@ -723,7 +723,7 @@ void func_80ADC6D0(EnSellnuts* this, GlobalContext* globalCtx) { globalCtx->msgCtx.msgMode = 0x43; globalCtx->msgCtx.unk12023 = 4; if (player->transformation == PLAYER_FORM_DEKU) { - if (gSaveContext.day == 3) { + if (gSaveContext.save.day == 3) { this->unk_33A = 2; } else { this->unk_33A = 1; @@ -835,7 +835,7 @@ void func_80ADCA64(EnSellnuts* this, GlobalContext* globalCtx) { SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 17); } else if (this->unk_34C == 17) { ActorCutscene_Stop(this->cutscene); - gSaveContext.weekEventReg[73] |= 4; + gSaveContext.save.weekEventReg[73] |= 4; Actor_MarkForDeath(&this->actor); } } @@ -871,7 +871,7 @@ void func_80ADCC04(EnSellnuts* this, GlobalContext* globalCtx) { void func_80ADCD3C(EnSellnuts* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); - if (gSaveContext.weekEventReg[73] & 4) { + if (gSaveContext.save.weekEventReg[73] & 4) { this->unk_338 |= 2; this->unk_338 |= 1; this->unk_340 = 0x626; @@ -947,7 +947,7 @@ void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); s32 pad2; - if ((gSaveContext.weekEventReg[17] & 0x80) || (gSaveContext.weekEventReg[61] & 0x10)) { + if ((gSaveContext.save.weekEventReg[17] & 0x80) || (gSaveContext.save.weekEventReg[61] & 0x10)) { Actor_MarkForDeath(&this->actor); } @@ -969,7 +969,7 @@ void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_36C = 0.01f; this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; - if (gSaveContext.weekEventReg[73] & 4) { + if (gSaveContext.save.weekEventReg[73] & 4) { if (ENSELLNUTS_GET_1(&this->actor)) { Actor_MarkForDeath(&this->actor); return; @@ -977,7 +977,7 @@ void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_338 |= 2; this->unk_338 |= 1; if (player->transformation == PLAYER_FORM_DEKU) { - if (gSaveContext.day == 3) { + if (gSaveContext.save.day == 3) { this->unk_33A = 2; } else { this->unk_33A = 1; @@ -1035,7 +1035,7 @@ void EnSellnuts_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_328++; if (player->transformation == PLAYER_FORM_DEKU) { - if (gSaveContext.day == 3) { + if (gSaveContext.save.day == 3) { this->unk_33A = 2; } else { this->unk_33A = 1; diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index d1bc0f8ba0..92d4c7514c 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -220,7 +220,7 @@ s32 func_80AE65F4(EnShn* this, GlobalContext* globalCtx) { this->unk_1DA = temp; this->unk_1D8 |= 0x40; } else if (this->unk_1D8 & 0x40) { - if (!(gSaveContext.weekEventReg[23] & 8)) { + if (!(gSaveContext.save.weekEventReg[23] & 8)) { func_80AE615C(this, 3); } this->unk_1DA = 0; @@ -256,7 +256,7 @@ s32 func_80AE6704(EnShn* thisx, GlobalContext* globalCtx) { } break; case 6: - gSaveContext.weekEventReg[90] &= (u8)~0x40; + gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_800B7298(globalCtx, &this->actor, 7); globalCtx->nextEntranceIndex = 0x8460; gSaveContext.nextCutsceneIndex = 0; @@ -301,7 +301,7 @@ s32 func_80AE68F0(EnShn* this, GlobalContext* globalCtx) { SubS_UpdateFlags(&this->unk_1D8, 0, 7); this->unk_1DC = func_80AE6880(this, globalCtx); this->unk_2C6 = 0; - if (gSaveContext.weekEventReg[23] & 8) { + if (gSaveContext.save.weekEventReg[23] & 8) { this->unk_1D8 |= 8; } this->actionFunc = func_80AE6A64; @@ -313,7 +313,7 @@ s32 func_80AE68F0(EnShn* this, GlobalContext* globalCtx) { void func_80AE69E8(EnShn* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); - if ((gSaveContext.weekEventReg[23] & 8) && EnShn_IsFacingPlayer(this)) { + if ((gSaveContext.save.weekEventReg[23] & 8) && EnShn_IsFacingPlayer(this)) { this->unk_1D8 |= 8; } else { this->unk_1D8 &= ~0x8; @@ -348,7 +348,7 @@ void EnShn_Init(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectShnSkel, NULL, this->jointTable, this->morphTable, OBJECT_SHN_LIMB_MAX); this->unk_2E8 = -1; - if (gSaveContext.weekEventReg[23] & 8) { + if (gSaveContext.save.weekEventReg[23] & 8) { func_80AE615C(this, 0); } else { func_80AE615C(this, 2); @@ -358,7 +358,7 @@ void EnShn_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_2E0 = 0; this->unk_2D8 = 0; this->unk_1D8 = 0; - if (gSaveContext.entranceIndex != 0xA820) { + if (gSaveContext.save.entranceIndex != 0xA820) { SubS_UpdateFlags(&this->unk_1D8, 3, 7); this->unk_2BE = 0; } else { diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 8a0e4f02c0..f7fca74480 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -807,7 +807,7 @@ void func_809964A0(EnSkb* this, GlobalContext* globalCtx) { void func_809964DC(EnSkb* this, GlobalContext* globalCtx) { if (this->unk_3D6 == 0) { if ((this->actionFunc != func_80994E94) && (this->actionFunc != func_80996284) && - (this->actionFunc != func_809964A0) && (gSaveContext.weekEventReg[85] & 0x40)) { + (this->actionFunc != func_809964A0) && (gSaveContext.save.weekEventReg[85] & 0x40)) { this->actor.colChkInfo.health = 0; func_809961E4(this, globalCtx); } diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index e344a574d1..8579dc8f0d 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -185,9 +185,9 @@ u16 EnSob1_GetTalkOption(EnSob1* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (this->shopType == BOMB_SHOP) { - if (gSaveContext.day == 1 && gSaveContext.time >= CLOCK_TIME(6, 00)) { + if (gSaveContext.save.day == 1 && gSaveContext.save.time >= CLOCK_TIME(6, 00)) { return 0x648; - } else if (gSaveContext.weekEventReg[33] & 8) { + } else if (gSaveContext.save.weekEventReg[33] & 8) { return 0x649; } else { return 0x64A; @@ -257,58 +257,58 @@ u16 EnSob1_GetWelcome(EnSob1* this, GlobalContext* globalCtx) { } else if (this->shopType == ZORA_SHOP) { switch (player->transformation) { case PLAYER_FORM_HUMAN: - if (gSaveContext.weekEventReg[57] & 0x10) { + if (gSaveContext.save.weekEventReg[57] & 0x10) { return 0x12CF; } - gSaveContext.weekEventReg[57] |= 0x10; + gSaveContext.save.weekEventReg[57] |= 0x10; return 0x12CE; case PLAYER_FORM_DEKU: - if (gSaveContext.weekEventReg[57] & 0x20) { + if (gSaveContext.save.weekEventReg[57] & 0x20) { return 0x12D1; } - gSaveContext.weekEventReg[57] |= 0x20; + gSaveContext.save.weekEventReg[57] |= 0x20; return 0x12D0; case PLAYER_FORM_GORON: - if (gSaveContext.weekEventReg[57] & 0x40) { + if (gSaveContext.save.weekEventReg[57] & 0x40) { return 0x12D3; } - gSaveContext.weekEventReg[57] |= 0x40; + gSaveContext.save.weekEventReg[57] |= 0x40; return 0x12D2; case PLAYER_FORM_ZORA: - if (gSaveContext.weekEventReg[57] & 0x80) { + if (gSaveContext.save.weekEventReg[57] & 0x80) { return 0x12D5; } - gSaveContext.weekEventReg[57] |= 0x80; + gSaveContext.save.weekEventReg[57] |= 0x80; return 0x12D4; default: return 0x12CE; } } else if (this->shopType == GORON_SHOP) { if (player->transformation != PLAYER_FORM_GORON) { - if (gSaveContext.weekEventReg[58] & 4) { + if (gSaveContext.save.weekEventReg[58] & 4) { return 0xBB9; } - gSaveContext.weekEventReg[58] |= 4; + gSaveContext.save.weekEventReg[58] |= 4; return 0xBB8; } else { - if (gSaveContext.weekEventReg[58] & 8) { + if (gSaveContext.save.weekEventReg[58] & 8) { return 0xBBB; } - gSaveContext.weekEventReg[58] |= 8; + gSaveContext.save.weekEventReg[58] |= 8; return 0xBBA; } } else if (this->shopType == GORON_SHOP_SPRING) { if (player->transformation != PLAYER_FORM_GORON) { - if (gSaveContext.weekEventReg[58] & 0x10) { + if (gSaveContext.save.weekEventReg[58] & 0x10) { return 0xBBD; } - gSaveContext.weekEventReg[58] |= 0x10; + gSaveContext.save.weekEventReg[58] |= 0x10; return 0xBBC; } else { - if (gSaveContext.weekEventReg[58] & 0x20) { + if (gSaveContext.save.weekEventReg[58] & 0x20) { return 0xBBF; } - gSaveContext.weekEventReg[58] |= 0x20; + gSaveContext.save.weekEventReg[58] |= 0x20; return 0xBBE; } } @@ -317,11 +317,11 @@ u16 EnSob1_GetWelcome(EnSob1* this, GlobalContext* globalCtx) { u16 EnSob1_GetGoodbye(EnSob1* this) { if (this->shopType == BOMB_SHOP) { - if (gSaveContext.day == 1) { + if (gSaveContext.save.day == 1) { return 0x64C; - } else if (gSaveContext.day == 2) { + } else if (gSaveContext.save.day == 2) { return 0x64D; - } else if (!gSaveContext.isNight) { + } else if (!gSaveContext.save.isNight) { return 0x64E; } else { return 0x64F; @@ -383,7 +383,7 @@ void EnSob1_Init(Actor* thisx, GlobalContext* globalCtx) { this->shopType = ZORA_SHOP; break; case GORON_SHOP: - if (gSaveContext.weekEventReg[33] & 0x80) { + if (gSaveContext.save.weekEventReg[33] & 0x80) { this->shopType = GORON_SHOP_SPRING; } else { this->shopType = GORON_SHOP; @@ -1360,7 +1360,7 @@ void EnSob1_InitShop(EnSob1* this, GlobalContext* globalCtx) { this->actor.world.pos.y += posOffset->y; this->actor.world.pos.z += posOffset->z; shopItems = sShops[this->shopType]; - if ((this->shopType == BOMB_SHOP) && (gSaveContext.weekEventReg[33] & 8)) { + if ((this->shopType == BOMB_SHOP) && (gSaveContext.save.weekEventReg[33] & 8)) { sShops[this->shopType][0].shopItemId = SI_BOMB_BAG_30_2; } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index c73c934d08..d880c48738 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -707,11 +707,11 @@ void EnSsh_Talk(EnSsh* this, GlobalContext* globalCtx) { void func_809756D0(EnSsh* this, GlobalContext* globalCtx) { u16 phi_a1; - if (gSaveContext.weekEventReg[34] & 8) { + if (gSaveContext.save.weekEventReg[34] & 8) { phi_a1 = 0x914; } else { phi_a1 = 0x910; - gSaveContext.weekEventReg[34] |= 8; + gSaveContext.save.weekEventReg[34] |= 8; } Message_StartTextbox(globalCtx, phi_a1, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 774dcf40eb..82e314d606 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -119,13 +119,13 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } this->actor.textId = 0; - if (!(gSaveContext.weekEventReg[34] & 0x40) || !(gSaveContext.weekEventReg[34] & 8)) { + if (!(gSaveContext.save.weekEventReg[34] & 0x40) || !(gSaveContext.save.weekEventReg[34] & 8)) { this->unk_29C |= 1; } break; case ENSTH_F_3: - if ((gSaveContext.skullTokenCount & 0xFFFF) >= 30) { + if ((gSaveContext.save.skullTokenCount & 0xFFFF) >= 30) { Actor_MarkForDeath(&this->actor); return; } @@ -136,19 +136,20 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ENSTH_F_4: - if (gSaveContext.weekEventReg[13] & 0x20) { + if (gSaveContext.save.weekEventReg[13] & 0x20) { Actor_MarkForDeath(&this->actor); return; } this->actor.textId = 0; this->actionFunc = func_80B677BC; - if (gSaveContext.weekEventReg[13] & 0x80) { + if (gSaveContext.save.weekEventReg[13] & 0x80) { this->unk_29C |= 2; } break; case ENSTH_F_5: - if (!(gSaveContext.weekEventReg[13] & 0x20) || (Inventory_GetSkullTokenCount(globalCtx->sceneNum) < 30)) { + if (!(gSaveContext.save.weekEventReg[13] & 0x20) || + (Inventory_GetSkullTokenCount(globalCtx->sceneNum) < 30)) { Actor_MarkForDeath(&this->actor); return; } @@ -258,7 +259,7 @@ void func_80B67348(EnSth* this, GlobalContext* globalCtx) { break; case 5: - if (gSaveContext.weekEventReg[13] & 0x40) { + if (gSaveContext.save.weekEventReg[13] & 0x40) { phi_a1 = 0x113D; } else { phi_a1 = 0x113C; @@ -266,7 +267,7 @@ void func_80B67348(EnSth* this, GlobalContext* globalCtx) { break; default: - if (gSaveContext.weekEventReg[13] & 0x40) { + if (gSaveContext.save.weekEventReg[13] & 0x40) { phi_a1 = 0x1142; } else { phi_a1 = 0x1141; @@ -331,14 +332,14 @@ void func_80B67540(EnSth* this, GlobalContext* globalCtx) { break; case 0x1136: - gSaveContext.weekEventReg[13] |= 0x80; + gSaveContext.save.weekEventReg[13] |= 0x80; switch (sp2C) { case 0: - if (gSaveContext.weekEventReg[13] & 0x40) { + if (gSaveContext.save.weekEventReg[13] & 0x40) { this->actor.home.rot.z = 6; } else { - gSaveContext.weekEventReg[13] |= 0x40; + gSaveContext.save.weekEventReg[13] |= 0x40; switch (CUR_UPG_VALUE(UPG_WALLET)) { case 0: this->actor.home.rot.z = 8; @@ -416,7 +417,7 @@ void func_80B678A8(EnSth* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actionFunc = func_80B67838; } else if (func_80B6703C(this, globalCtx) || this->actor.isTargeted) { - if ((gSaveContext.time >= CLOCK_TIME(6, 0)) && (gSaveContext.time <= CLOCK_TIME(18, 0))) { + if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= CLOCK_TIME(18, 0))) { this->actor.textId = 0x1130; } else { this->actor.textId = 0x1131; @@ -433,14 +434,14 @@ void func_80B67958(EnSth* this, GlobalContext* globalCtx) { void func_80B67984(EnSth* this, GlobalContext* globalCtx) { u16 sp1E; - if (gSaveContext.weekEventReg[34] & 0x10) { + if (gSaveContext.save.weekEventReg[34] & 0x10) { sp1E = 0x903; func_80B670A4(this, 2); - } else if (gSaveContext.weekEventReg[34] & 0x20) { + } else if (gSaveContext.save.weekEventReg[34] & 0x20) { sp1E = 0x90F; func_80B670A4(this, 2); - } else if (gSaveContext.weekEventReg[34] & 0x40) { - if (!(gSaveContext.weekEventReg[34] & 8)) { + } else if (gSaveContext.save.weekEventReg[34] & 0x40) { + if (!(gSaveContext.save.weekEventReg[34] & 8)) { sp1E = 0x91B; } else { sp1E = 0x918; @@ -453,11 +454,11 @@ void func_80B67984(EnSth* this, GlobalContext* globalCtx) { } else { sp1E = 0x916; } - } else if (gSaveContext.weekEventReg[34] & 2) { + } else if (gSaveContext.save.weekEventReg[34] & 2) { sp1E = 0x8FF; } else { sp1E = 0x8FC; - gSaveContext.weekEventReg[34] |= 2; + gSaveContext.save.weekEventReg[34] |= 2; } Message_StartTextbox(globalCtx, sp1E, &this->actor); } @@ -467,7 +468,7 @@ void func_80B67AB4(EnSth* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actionFunc = func_80B67C1C; - gSaveContext.weekEventReg[34] |= 0x40; + gSaveContext.save.weekEventReg[34] |= 0x40; Message_StartTextbox(globalCtx, 0x918, &this->actor); } else { func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); @@ -484,7 +485,7 @@ void func_80B67B50(EnSth* this, GlobalContext* globalCtx) { func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); } else { this->unk_29C &= ~1; - gSaveContext.weekEventReg[34] |= 8; + gSaveContext.save.weekEventReg[34] |= 8; Actor_PickUp(&this->actor, globalCtx, GI_MASK_CAPTAIN, 10000.0f, 50.0f); } } @@ -524,8 +525,8 @@ void func_80B67C1C(EnSth* this, GlobalContext* globalCtx) { break; case 0x91A: - gSaveContext.weekEventReg[34] |= 0x40; - gSaveContext.weekEventReg[34] &= (u8)~8; + gSaveContext.save.weekEventReg[34] |= 0x40; + gSaveContext.save.weekEventReg[34] &= (u8)~8; case 0x902: case 0x903: @@ -579,8 +580,9 @@ void EnSth_Update(Actor* thisx, GlobalContext* globalCtx) { this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, &ovl_En_Sth_Anim_0045B4); this->unk_29A = 1; - if ((gSaveContext.weekEventReg[34] & 0x10) || (gSaveContext.weekEventReg[34] & 0x20) || - (gSaveContext.weekEventReg[34] & 0x40) || (Inventory_GetSkullTokenCount(globalCtx->sceneNum) >= 30)) { + if ((gSaveContext.save.weekEventReg[34] & 0x10) || (gSaveContext.save.weekEventReg[34] & 0x20) || + (gSaveContext.save.weekEventReg[34] & 0x40) || + (Inventory_GetSkullTokenCount(globalCtx->sceneNum) >= 30)) { func_80B670A4(this, 3); } } else { @@ -598,7 +600,7 @@ void EnSth_Update(Actor* thisx, GlobalContext* globalCtx) { break; case ENSTH_F_4: - if (gSaveContext.weekEventReg[13] & 0x80) { + if (gSaveContext.save.weekEventReg[13] & 0x80) { func_80B670A4(this, 5); } else { func_80B670A4(this, 5); diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 5935aa2c19..a989ee8ad9 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -186,12 +186,12 @@ void EnSuttari_SetNextEntrance(GlobalContext* globalCtx, u16 nextEntranceIndex) } void EnSuttari_UpdateTime(void) { - u32* unk_14 = &gSaveContext.unk_14; - u16 time = gSaveContext.time; + u32* unk_14 = &gSaveContext.save.daySpeed; + u16 time = gSaveContext.save.time; - gSaveContext.time = (u16)REG(15) + time; - time = gSaveContext.time; - gSaveContext.time = (u16)*unk_14 + time; + gSaveContext.save.time = (u16)REG(15) + time; + time = gSaveContext.save.time; + gSaveContext.save.time = (u16)*unk_14 + time; } s32 func_80BAA904(EnSuttari* this, GlobalContext* globalCtx) { @@ -323,7 +323,7 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) { } else if (this->flags1 & 1) { switch (this->textId) { case 0: - if (gSaveContext.weekEventReg[81] & 1) { + if (gSaveContext.save.weekEventReg[81] & 1) { this->textId = 0x1455; ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk_264 |= 8; this->flags2 |= 1; @@ -341,12 +341,12 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) { } else { this->flags1 |= 0x400; this->textId = 0x1452; - gSaveContext.weekEventReg[81] |= 1; + gSaveContext.save.weekEventReg[81] |= 1; } break; case 0x1453: this->flags1 |= 0x400; - gSaveContext.weekEventReg[81] |= 1; + gSaveContext.save.weekEventReg[81] |= 1; ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk_264 |= 8; this->flags2 |= 1; this->textId = 0x1454; @@ -414,7 +414,7 @@ void func_80BAAFDC(EnSuttari* this, GlobalContext* globalCtx) { if (this->unk1F4[0] != 0) { this->unk1F4[0]--; } - gSaveContext.weekEventReg[61] |= 8; + gSaveContext.save.weekEventReg[61] |= 8; this->unk3F6 = 20; this->actionFunc = func_80BADE8C; } @@ -446,7 +446,7 @@ void func_80BAB1A0(EnSuttari* this, GlobalContext* globalCtx) { if (this->unk1F4[0] != 0) { this->unk1F4[0]--; } - gSaveContext.weekEventReg[61] |= 8; + gSaveContext.save.weekEventReg[61] |= 8; this->unk3F6 = 20; this->actionFunc = func_80BADE8C; } else { @@ -636,7 +636,7 @@ void func_80BABB90(EnSuttari* this, s32 arg1) { } s32 func_80BABC48(EnSuttari* this, GlobalContext* globalCtx, struct_80133038_arg2* unkStruct) { - u16 sp26 = gSaveContext.time - 0x3FFC; + u16 sp26 = gSaveContext.save.time - 0x3FFC; u16 pad1; u8 sp23 = ENSUTTARI_GET_PATH(&this->actor); u16 pad2; @@ -679,7 +679,7 @@ s32 func_80BABDD8(EnSuttari* this, GlobalContext* globalCtx, struct_80133038_arg UNK_TYPE sp24; sp47 = ENSUTTARI_GET_PATH(&this->actor); - sp44 = gSaveContext.time - 0x3FFC; + sp44 = gSaveContext.save.time - 0x3FFC; if (this->unk428 == 10 || this->unk428 == 11 || this->unk428 == 2) { return 0; } @@ -819,7 +819,7 @@ void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { this->animationIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); } - if (!(gSaveContext.weekEventReg[83] & 4) && !(this->flags1 & 0x1000)) { + if (!(gSaveContext.save.weekEventReg[83] & 4) && !(this->flags1 & 0x1000)) { if (ActorCutscene_GetCanPlayNext(this->cutscenes[0])) { ActorCutscene_Start(this->cutscenes[0], &this->actor); if (!(player->stateFlags1 & 0x10000000)) { @@ -868,7 +868,7 @@ void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); break; case 2: - if (!(gSaveContext.weekEventReg[81] & 4)) { + if (!(gSaveContext.save.weekEventReg[81] & 4)) { this->flags1 |= 0x80; this->actor.world.pos.x = -16.0f; this->actor.world.pos.z = -16.0f; @@ -878,7 +878,7 @@ void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { } break; case 4: - if (!(gSaveContext.weekEventReg[33] & 8)) { + if (!(gSaveContext.save.weekEventReg[33] & 8)) { if (this->animationIndex == 2 || this->animationIndex == 1) { this->animationIndex = 5; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); @@ -908,25 +908,25 @@ void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_1; if (globalCtx->sceneNum == SCENE_IKANA) { this->flags1 |= 1; - if (gSaveContext.day == 1 || gSaveContext.day == 2) { + if (gSaveContext.save.day == 1 || gSaveContext.save.day == 2) { this->animationIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); this->flags1 |= 0x80; this->actionFunc = func_80BACA14; return; - } else if ((gSaveContext.day == 3) && (gSaveContext.time <= CLOCK_TIME(19, 00)) && - !(gSaveContext.weekEventReg[61] & 8) && !(gSaveContext.weekEventReg[33] & 8) && - (gSaveContext.weekEventReg[51] & 8)) { + } else if ((gSaveContext.save.day == 3) && (gSaveContext.save.time <= CLOCK_TIME(19, 0)) && + !(gSaveContext.save.weekEventReg[61] & 8) && !(gSaveContext.save.weekEventReg[33] & 8) && + (gSaveContext.save.weekEventReg[51] & 8)) { this->animationIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); this->actionFunc = func_80BACEE0; return; } } else if (globalCtx->sceneNum == SCENE_BACKTOWN) { - if (gSaveContext.time >= CLOCK_TIME(0, 20) && gSaveContext.time < CLOCK_TIME(6, 00)) { + if (gSaveContext.save.time >= CLOCK_TIME(0, 20) && gSaveContext.save.time < CLOCK_TIME(6, 00)) { Actor_MarkForDeath(&this->actor); } - if ((gSaveContext.entranceIndex == 0xD670) || (gSaveContext.weekEventReg[58] & 0x40)) { + if ((gSaveContext.save.entranceIndex == 0xD670) || (gSaveContext.save.weekEventReg[58] & 0x40)) { Actor_MarkForDeath(&this->actor); } this->cutscenes[0] = this->actor.cutscene; @@ -938,7 +938,7 @@ void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { this->actionFunc = func_80BAD004; return; } else if (globalCtx->sceneNum == SCENE_ICHIBA) { - if (gSaveContext.weekEventReg[33] & 8) { + if (gSaveContext.save.weekEventReg[33] & 8) { Actor_MarkForDeath(&this->actor); return; } @@ -948,7 +948,7 @@ void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { this->actionFunc = func_80BAD5F8; return; } else if (globalCtx->sceneNum == SCENE_AYASHIISHOP) { - if (gSaveContext.weekEventReg[33] & 8) { + if (gSaveContext.save.weekEventReg[33] & 8) { Actor_MarkForDeath(&this->actor); return; } @@ -982,7 +982,7 @@ void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) { this->unk3F2 = this->unk2DC.y; this->actionFunc = func_80BACBB0; } - } else if ((player->transformation == PLAYER_FORM_HUMAN) && CUR_EQUIP_VALUE_VOID(EQUIP_SWORD) != 0) { + } else if ((player->transformation == PLAYER_FORM_HUMAN) && GET_CUR_EQUIP_VALUE(EQUIP_SWORD) != 0) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->unk3F2 = this->unk2DC.y; func_80BAAB78(this, globalCtx); @@ -1061,7 +1061,7 @@ void func_80BACE4C(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BACEE0(EnSuttari* this, GlobalContext* globalCtx) { - u32* unk_14 = &gSaveContext.unk_14; + u32* unk_14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 unkStruct; this->unk42A = REG(15) + *unk_14; @@ -1076,7 +1076,7 @@ void func_80BACEE0(EnSuttari* this, GlobalContext* globalCtx) { func_80BAC2FC(this, globalCtx); func_80BAB434(this); if (this->unk428 == 5) { - gSaveContext.weekEventReg[58] |= 0x80; + gSaveContext.save.weekEventReg[58] |= 0x80; this->actionFunc = func_80BADDB4; this->actor.speedXZ = 0.0f; } else if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) { @@ -1086,7 +1086,7 @@ void func_80BACEE0(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BAD004(EnSuttari* this, GlobalContext* globalCtx) { - u32* unk_14 = &gSaveContext.unk_14; + u32* unk_14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 unkStruct; this->unk42A = REG(15) + *unk_14; @@ -1181,7 +1181,7 @@ void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) { this->flags2 |= 8; func_80BAAF1C(this); } else if (this->flags1 & 0x200) { - gSaveContext.weekEventReg[79] |= 0x40; + gSaveContext.save.weekEventReg[79] |= 0x40; this->flags2 |= 4; this->actor.speedXZ = 0.0f; Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, @@ -1192,7 +1192,7 @@ void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) { } if (this->unk1F4[1] == -0x63) { if (this->flags2 & 8) { - gSaveContext.weekEventReg[33] |= 8; + gSaveContext.save.weekEventReg[33] |= 8; } this->actor.speedXZ = 0.0f; Audio_QueueSeqCmd(0x101400FF); @@ -1208,7 +1208,7 @@ void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BAD5F8(EnSuttari* this, GlobalContext* globalCtx) { - u32* unk_14 = &gSaveContext.unk_14; + u32* unk_14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 unkStruct; s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -1244,7 +1244,7 @@ void func_80BAD5F8(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BAD7F8(EnSuttari* this, GlobalContext* globalCtx) { - u32* unk_14 = &gSaveContext.unk_14; + u32* unk_14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 unkStruct; s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -1286,7 +1286,7 @@ void func_80BADA08(EnSuttari* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; func_80BAAB78(this, globalCtx); - gSaveContext.weekEventReg[81] |= 4; + gSaveContext.save.weekEventReg[81] |= 4; } else if (this->actor.xzDistToPlayer < 500.0f) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8614(&this->actor, globalCtx, 500.0f); @@ -1364,7 +1364,7 @@ void func_80BADD0C(EnSuttari* this, GlobalContext* globalCtx) { void func_80BADDB4(EnSuttari* this, GlobalContext* globalCtx) { func_80BABA90(this, 1, 1); func_80BAB434(this); - if (gSaveContext.weekEventReg[51] & 0x10) { + if (gSaveContext.save.weekEventReg[51] & 0x10) { this->actionFunc = func_80BADE14; } Actor_MoveWithGravity(&this->actor); @@ -1410,7 +1410,7 @@ void EnSuttari_Init(Actor* thisx, GlobalContext* globalCtx) { EnSuttari* this = THIS; s32 pad; - if (gSaveContext.weekEventReg[79] & 0x40) { + if (gSaveContext.save.weekEventReg[79] & 0x40) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 36030a12d3..e69c7e5ab7 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -164,7 +164,7 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { } void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { - gSaveContext.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~1; } s32 func_809C6720(GlobalContext* globalCtx, Vec3f arg1) { @@ -258,7 +258,7 @@ void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(globalCtx, 0xA30, &this->actor); this->unk_284 = 0xA30; - } else if (gSaveContext.rupees < 20) { + } else if (gSaveContext.save.playerData.rupees < 20) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(globalCtx, 0xA31, &this->actor); this->unk_284 = 0xA31; @@ -269,8 +269,8 @@ void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) { } else { func_8019F208(); func_801159EC(-20); - gSaveContext.weekEventReg[63] |= 1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] |= 1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; globalCtx->msgCtx.msgMode = 0x43; globalCtx->msgCtx.unk12023 = 4; this->unk_26A = 7; @@ -332,11 +332,11 @@ void func_809C6C2C(EnSyatekiMan* this, GlobalContext* globalCtx) { break; case 0xA32: - if (gSaveContext.weekEventReg[63] & 2) { + if (gSaveContext.save.weekEventReg[63] & 2) { func_801477B4(globalCtx); player->stateFlags1 &= ~0x20; - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; this->actionFunc = func_809C6848; gSaveContext.minigameState = 3; this->unk_26A = 0; @@ -391,8 +391,8 @@ void func_809C6E30(EnSyatekiMan* this, GlobalContext* globalCtx) { globalCtx->msgCtx.msgMode = 0x43; globalCtx->msgCtx.unk12023 = 4; player->stateFlags1 &= ~0x20; - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; this->actionFunc = func_809C6848; this->unk_26A = 0; } @@ -416,7 +416,7 @@ void func_809C6E30(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C6F98(EnSyatekiMan* this, GlobalContext* globalCtx) { - switch (gSaveContext.playerForm) { + switch (gSaveContext.save.playerForm) { case PLAYER_FORM_HUMAN: Flags_SetAllTreasure(globalCtx, Flags_GetAllTreasure(globalCtx) + 1); if (CURRENT_DAY != 3) { @@ -530,7 +530,7 @@ void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x3FA, &this->actor); this->unk_284 = 0x3FA; } - } else if (gSaveContext.rupees < 20) { + } else if (gSaveContext.save.playerData.rupees < 20) { play_sound(NA_SE_SY_ERROR); if (CURRENT_DAY != 3) { Message_StartTextbox(globalCtx, 0x3FB, &this->actor); @@ -557,8 +557,8 @@ void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x3FF, &this->actor); this->unk_284 = 0x3FF; } - gSaveContext.weekEventReg[63] |= 1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] |= 1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; } } else { func_8019F230(); @@ -633,8 +633,8 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { player->actor.freezeTimer = 0; this->unk_26A = 7; player->stateFlags1 |= 0x20; - gSaveContext.weekEventReg[63] |= 1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] |= 1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; this->actionFunc = func_809C8710; } break; @@ -653,10 +653,10 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { break; case 0x401: - if (gSaveContext.weekEventReg[63] & 2) { + if (gSaveContext.save.weekEventReg[63] & 2) { func_801477B4(globalCtx); - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; this->unk_26A = 0; this->actionFunc = func_809C72D8; } else { @@ -666,10 +666,10 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { break; case 0x403: - if (gSaveContext.weekEventReg[63] & 2) { + if (gSaveContext.save.weekEventReg[63] & 2) { func_801477B4(globalCtx); - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; this->unk_26A = 0; this->actionFunc = func_809C72D8; } else { @@ -722,8 +722,8 @@ void func_809C7990(EnSyatekiMan* this, GlobalContext* globalCtx) { case 6: if (Message_ShouldAdvance(globalCtx)) { - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; player->stateFlags1 &= ~0x20; this->actionFunc = func_809C72D8; this->unk_26A = 0; @@ -745,19 +745,19 @@ void func_809C7A90(EnSyatekiMan* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (Actor_HasParent(&this->actor, globalCtx)) { - if (!(gSaveContext.weekEventReg[59] & 0x10)) { - gSaveContext.weekEventReg[59] |= 0x10; - } else if (!(gSaveContext.weekEventReg[32] & 2) && (this->unk_280 >= 0x884)) { - gSaveContext.weekEventReg[32] |= 2; + if (!(gSaveContext.save.weekEventReg[59] & 0x10)) { + gSaveContext.save.weekEventReg[59] |= 0x10; + } else if (!(gSaveContext.save.weekEventReg[32] & 2) && (this->unk_280 >= 0x884)) { + gSaveContext.save.weekEventReg[32] |= 2; } this->actor.parent = NULL; this->actionFunc = func_809C7C14; } else { - if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.weekEventReg[59] & 0x10)) { + if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.save.weekEventReg[59] & 0x10)) { Actor_PickUp(&this->actor, globalCtx, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else if (this->unk_280 < 0x884) { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_RED, 500.0f, 100.0f); - } else if (!(gSaveContext.weekEventReg[32] & 2)) { + } else if (!(gSaveContext.save.weekEventReg[32] & 2)) { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); @@ -774,7 +774,7 @@ void func_809C7C14(EnSyatekiMan* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - if ((CURRENT_DAY == 3) && (gSaveContext.time > CLOCK_TIME(12, 00))) { + if ((CURRENT_DAY == 3) && (gSaveContext.save.time > CLOCK_TIME(12, 0))) { Message_StartTextbox(globalCtx, 0xA36, &this->actor); this->unk_284 = 0xA36; } else { @@ -796,26 +796,26 @@ void func_809C7D14(EnSyatekiMan* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { if (this->unk_284 == 0x407) { - if (!(gSaveContext.weekEventReg[59] & 0x20)) { - gSaveContext.weekEventReg[59] |= 0x20; + if (!(gSaveContext.save.weekEventReg[59] & 0x20)) { + gSaveContext.save.weekEventReg[59] |= 0x20; } } if ((this->unk_284 == 0x405) || (this->unk_284 == 0x406)) { - if (!(gSaveContext.weekEventReg[32] & 4)) { - gSaveContext.weekEventReg[32] |= 4; + if (!(gSaveContext.save.weekEventReg[32] & 4)) { + gSaveContext.save.weekEventReg[32] |= 4; } } this->actor.parent = NULL; this->actionFunc = func_809C7EB4; } else { if (this->unk_284 == 0x407) { - if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.weekEventReg[59] & 0x20)) { + if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.save.weekEventReg[59] & 0x20)) { Actor_PickUp(&this->actor, globalCtx, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); } - } else if (!(gSaveContext.weekEventReg[32] & 4)) { + } else if (!(gSaveContext.save.weekEventReg[32] & 4)) { Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_HUGE, 500.0f, 100.0f); @@ -836,8 +836,8 @@ void func_809C7EB4(EnSyatekiMan* this, GlobalContext* globalCtx) { player->stateFlags1 &= ~0x20; this->unk_280 = 0; this->unk_26A = 0; - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[63] &= (u8)~2; + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; this->actionFunc = func_809C6810; } } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { @@ -974,8 +974,8 @@ void func_809C8488(EnSyatekiMan* this, GlobalContext* globalCtx) { this->unk_274 = 0; this->unk_276 = 0; if (this->unk_270 <= 0) { - if ((s32)((gSaveContext.unk_EF4 & 0xFFFF0000) >> 0x10) < this->unk_280) { - gSaveContext.unk_EF4 = ((gSaveContext.unk_EF4) & 0xFFFF) | ((u16)this->unk_280 << 0x10); + if ((s32)((gSaveContext.save.unk_EF4 & 0xFFFF0000) >> 0x10) < this->unk_280) { + gSaveContext.save.unk_EF4 = ((gSaveContext.save.unk_EF4) & 0xFFFF) | ((u16)this->unk_280 << 0x10); } this->unk_270 = 15; if (this->unk_280 >= 0x848) { @@ -983,9 +983,9 @@ void func_809C8488(EnSyatekiMan* this, GlobalContext* globalCtx) { this->unk_284 = 0xA34; this->unk_26A = 6; } else if (this->unk_280 >= 0x7D0) { - if (gSaveContext.weekEventReg[63] & 2) { - gSaveContext.weekEventReg[63] &= (u8)~1; - gSaveContext.weekEventReg[63] &= (u8)~2; + if (gSaveContext.save.weekEventReg[63] & 2) { + gSaveContext.save.weekEventReg[63] &= (u8)~1; + gSaveContext.save.weekEventReg[63] &= (u8)~2; this->unk_26A = 0; gSaveContext.minigameState = 3; this->actionFunc = func_809C6848; @@ -1039,7 +1039,7 @@ void func_809C8610(EnSyatekiMan* this, GlobalContext* globalCtx) { void func_809C8710(EnSyatekiMan* this, GlobalContext* globalCtx) { Vec3f sp24; - if (gSaveContext.playerForm == PLAYER_FORM_FIERCE_DEITY) { + if (gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) { sp24 = D_809C9480; } else { sp24 = D_809C948C; @@ -1164,9 +1164,9 @@ void func_809C8BF0(EnSyatekiMan* this, GlobalContext* globalCtx) { if ((this->unk_270 <= 0) && (globalCtx->interfaceCtx.unk_286 == 0)) { Flags_SetAllTreasure(globalCtx, this->unk_280); this->unk_270 = 15; - if (((s32)(gSaveContext.unk_EF4 & 0xFFFF) < this->unk_280) || (this->unk_280 == 50)) { - if ((s32)(gSaveContext.unk_EF4 & 0xFFFF) < this->unk_280) { - if (!(gSaveContext.weekEventReg[59] & 0x20)) { + if (((s32)(gSaveContext.save.unk_EF4 & 0xFFFF) < this->unk_280) || (this->unk_280 == 50)) { + if ((s32)(gSaveContext.save.unk_EF4 & 0xFFFF) < this->unk_280) { + if (!(gSaveContext.save.weekEventReg[59] & 0x20)) { Message_StartTextbox(globalCtx, 0x407, &this->actor); this->unk_284 = 0x407; } else if (this->unk_280 == 50) { @@ -1180,7 +1180,7 @@ void func_809C8BF0(EnSyatekiMan* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x406, &this->actor); this->unk_284 = 0x406; } - gSaveContext.unk_EF4 = (gSaveContext.unk_EF4 & 0xFFFF0000) | (this->unk_280 & 0xFFFF); + gSaveContext.save.unk_EF4 = (gSaveContext.save.unk_EF4 & 0xFFFF0000) | (this->unk_280 & 0xFFFF); this->unk_26A = 6; } else { if (CURRENT_DAY != 3) { diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index a3b31b93fe..48a1bc0649 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -333,7 +333,7 @@ s32* func_80BE0E04(EnTab* this, GlobalContext* globalCtx) { return D_80BE1998; } - if (gSaveContext.day == 3) { + if (gSaveContext.save.day == 3) { return D_80BE1A0C; } return D_80BE19A0; @@ -422,7 +422,8 @@ s32 func_80BE10BC(EnTab* this, GlobalContext* globalCtx) { } else { dist = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_1E4->actor.world.pos); - if ((gSaveContext.weekEventReg[75] & 1) || (this->unk_1E4->actor.draw == NULL) || !(dist < 160.0f)) { + if ((gSaveContext.save.weekEventReg[75] & 1) || (this->unk_1E4->actor.draw == NULL) || + !(dist < 160.0f)) { tempActor = &GET_PLAYER(globalCtx)->actor; this->actor.child = tempActor; } else { @@ -458,7 +459,7 @@ void func_80BE1224(EnTab* this, GlobalContext* globalCtx) { } void func_80BE127C(EnTab* this, GlobalContext* globalCtx) { - u32* unk_14 = &gSaveContext.unk_14; + u32* unk_14 = &gSaveContext.save.daySpeed; struct_80133038_arg2 sp18; this->unk_31A = REG(15) + *unk_14; diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index 2f7b5c5c64..a2324aaf6d 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -344,7 +344,7 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, GlobalContext* globalCtx) { if (EnTalkGibud_PlayerInRangeWithCorrectState(this, globalCtx) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { if ((this->grabWaitTimer == 0) && (this->actor.xzDistToPlayer <= 45.0f)) { player->actor.freezeTimer = 0; - if ((gSaveContext.playerForm == PLAYER_FORM_GORON) || (gSaveContext.playerForm == PLAYER_FORM_DEKU)) { + if (gSaveContext.save.playerForm == PLAYER_FORM_GORON || gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { // If the Gibdo/Redead tries to grab Goron or Deku Link, it will fail to // do so. It will appear to take damage and shake its head side-to-side. EnTalkGibud_SetupGrabFail(this); @@ -510,7 +510,7 @@ void EnTalkGibud_WalkToHome(EnTalkGibud* this, GlobalContext* globalCtx) { this->actor.world.rot = this->actor.shape.rot; } if (EnTalkGibud_PlayerInRangeWithCorrectState(this, globalCtx)) { - if ((gSaveContext.playerForm != PLAYER_FORM_GORON) && (gSaveContext.playerForm != PLAYER_FORM_DEKU) && + if (gSaveContext.save.playerForm != PLAYER_FORM_GORON && gSaveContext.save.playerForm != PLAYER_FORM_DEKU && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { EnTalkGibud_SetupWalkToPlayer(this); } @@ -980,7 +980,7 @@ s32 EnTalkGibud_MoveToIdealGrabPositionAndRotation(EnTalkGibud* this, GlobalCont distanceFromTargetPos = Math_Vec3f_StepTo(&this->actor.world.pos, &targetPos, 10.0f); distanceFromTargetAngle = Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 0x1770, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { distanceFromTargetYOffset = Math_SmoothStepToF(&this->actor.shape.yOffset, -1500.0f, 1.0f, 150.0f, 0.0f); } diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c index 86f4d5ea54..969a87cf6e 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c @@ -73,7 +73,7 @@ void EnTanron4_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - if ((gSaveContext.time > CLOCK_TIME(20, 0)) || (gSaveContext.time < CLOCK_TIME(4, 0))) { + if ((gSaveContext.save.time > CLOCK_TIME(20, 0)) || (gSaveContext.save.time < CLOCK_TIME(4, 0))) { this->timeInfluence = 1500.0f; thisx->world.pos.y += 1500.0f; } @@ -99,7 +99,7 @@ void EnTanron4_FlyNearHome(EnTanron4* this, GlobalContext* globalCtx) { // `timeInfluence` controls both the height of the seagulls and when they are visible. // They fly higher in the sky as the night goes on, and they disapear as dawn approaches. - if ((gSaveContext.time > CLOCK_TIME(20, 0)) || (gSaveContext.time < CLOCK_TIME(4, 0))) { + if ((gSaveContext.save.time > CLOCK_TIME(20, 0)) || (gSaveContext.save.time < CLOCK_TIME(4, 0))) { Math_ApproachF(&this->timeInfluence, 1500.0f, 1.0f, 1.0f); } else { Math_ApproachZeroF(&this->timeInfluence, 1.0f, 1.0f); diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 6886d2b29e..5dc94a1c45 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -51,11 +51,11 @@ void func_80A41D70(EnTest4* this, GlobalContext* globalCtx) { } else if ((sCutscenes[this->unk_144] < 0) || ((globalCtx->actorCtx.unk5 & 2) != 0)) { if (globalCtx->actorCtx.unk5 & 2) { Sram_IncrementDay(); - gSaveContext.time = CLOCK_TIME(6, 0); + gSaveContext.save.time = CLOCK_TIME(6, 0); func_80151A68(globalCtx, sDayMessages1[CURRENT_DAY - 1]); } else { this->unk_144 = 0; - this->unk_146 = gSaveContext.time += CLOCK_TIME_MINUTE; + this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; } func_8010EE74(globalCtx, CURRENT_DAY); @@ -84,7 +84,7 @@ void func_80A41D70(EnTest4* this, GlobalContext* globalCtx) { this->unk_144 = 0; } - this->unk_146 = gSaveContext.time += CLOCK_TIME_MINUTE; + this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; } } @@ -93,7 +93,7 @@ void func_80A41FA4(EnTest4* this, GlobalContext* globalCtx) { func_80151A68(globalCtx, sNightMessages2[CURRENT_DAY - 1]); } else if ((sCutscenes[this->unk_144] < 0) || ((globalCtx->actorCtx.unk5 & 2) != 0)) { Sram_IncrementDay(); - gSaveContext.time = CLOCK_TIME(6, 0); + gSaveContext.save.time = CLOCK_TIME(6, 0); func_8010EE74(globalCtx, CURRENT_DAY); func_80151A68(globalCtx, sDayMessages2[CURRENT_DAY - 1]); D_801BDBC8 = 0xFE; @@ -121,168 +121,168 @@ void func_80A41FA4(EnTest4* this, GlobalContext* globalCtx) { this->unk_144 = 0; } - this->unk_146 = gSaveContext.time += CLOCK_TIME_MINUTE; + this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; } } // Bells on last day void func_80A42198(EnTest4* this) { - if ((gSaveContext.time >= CLOCK_TIME(6, 0)) && (gSaveContext.time <= CLOCK_TIME(18, 0))) { - if (gSaveContext.time < CLOCK_TIME(17, 30)) { + if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= CLOCK_TIME(18, 0))) { + if (gSaveContext.save.time < CLOCK_TIME(17, 30)) { this->nextBellTime = CLOCK_TIME(17, 30); - } else if (gSaveContext.time < CLOCK_TIME(17, 36)) { + } else if (gSaveContext.save.time < CLOCK_TIME(17, 36)) { this->nextBellTime = CLOCK_TIME(17, 36); - } else if (gSaveContext.time < CLOCK_TIME(17, 42)) { + } else if (gSaveContext.save.time < CLOCK_TIME(17, 42)) { this->nextBellTime = CLOCK_TIME(17, 42); - } else if (gSaveContext.time < CLOCK_TIME(17, 48)) { + } else if (gSaveContext.save.time < CLOCK_TIME(17, 48)) { this->nextBellTime = CLOCK_TIME(17, 48); - } else if (gSaveContext.time < CLOCK_TIME(17, 54)) { + } else if (gSaveContext.save.time < CLOCK_TIME(17, 54)) { this->nextBellTime = CLOCK_TIME(17, 54); } else { this->nextBellTime = CLOCK_TIME(0, 0); } - } else if (gSaveContext.time > CLOCK_TIME(6, 0)) { + } else if (gSaveContext.save.time > CLOCK_TIME(6, 0)) { this->nextBellTime = CLOCK_TIME(0, 0); - } else if (gSaveContext.time < CLOCK_TIME(0, 10)) { + } else if (gSaveContext.save.time < CLOCK_TIME(0, 10)) { this->nextBellTime = CLOCK_TIME(0, 10); - } else if (gSaveContext.time < CLOCK_TIME(0, 20)) { + } else if (gSaveContext.save.time < CLOCK_TIME(0, 20)) { this->nextBellTime = CLOCK_TIME(0, 20); - } else if (gSaveContext.time < CLOCK_TIME(0, 30)) { + } else if (gSaveContext.save.time < CLOCK_TIME(0, 30)) { this->nextBellTime = CLOCK_TIME(0, 30); - } else if (gSaveContext.time < CLOCK_TIME(0, 40)) { + } else if (gSaveContext.save.time < CLOCK_TIME(0, 40)) { this->nextBellTime = CLOCK_TIME(0, 40); - } else if (gSaveContext.time < CLOCK_TIME(0, 50)) { + } else if (gSaveContext.save.time < CLOCK_TIME(0, 50)) { this->nextBellTime = CLOCK_TIME(0, 50); - } else if (gSaveContext.time < CLOCK_TIME(1, 0)) { + } else if (gSaveContext.save.time < CLOCK_TIME(1, 0)) { this->nextBellTime = CLOCK_TIME(1, 0); - } else if (gSaveContext.time < CLOCK_TIME(1, 10)) { + } else if (gSaveContext.save.time < CLOCK_TIME(1, 10)) { this->nextBellTime = CLOCK_TIME(1, 10); - } else if (gSaveContext.time < CLOCK_TIME(1, 20)) { + } else if (gSaveContext.save.time < CLOCK_TIME(1, 20)) { this->nextBellTime = CLOCK_TIME(1, 20); - } else if (gSaveContext.time < CLOCK_TIME(1, 30) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(1, 30) - 1) { this->nextBellTime = CLOCK_TIME(1, 30) - 1; - } else if (gSaveContext.time < CLOCK_TIME(1, 40) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(1, 40) - 1) { this->nextBellTime = CLOCK_TIME(1, 40) - 1; - } else if (gSaveContext.time < CLOCK_TIME(1, 50) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(1, 50) - 1) { this->nextBellTime = CLOCK_TIME(1, 50) - 1; - } else if (gSaveContext.time < CLOCK_TIME(2, 0)) { + } else if (gSaveContext.save.time < CLOCK_TIME(2, 0)) { this->nextBellTime = CLOCK_TIME(2, 0); - } else if (gSaveContext.time < CLOCK_TIME(2, 10)) { + } else if (gSaveContext.save.time < CLOCK_TIME(2, 10)) { this->nextBellTime = CLOCK_TIME(2, 10); - } else if (gSaveContext.time < CLOCK_TIME(2, 20)) { + } else if (gSaveContext.save.time < CLOCK_TIME(2, 20)) { this->nextBellTime = CLOCK_TIME(2, 20); - } else if (gSaveContext.time < CLOCK_TIME(2, 30)) { + } else if (gSaveContext.save.time < CLOCK_TIME(2, 30)) { this->nextBellTime = CLOCK_TIME(2, 30); - } else if (gSaveContext.time < CLOCK_TIME(2, 40)) { + } else if (gSaveContext.save.time < CLOCK_TIME(2, 40)) { this->nextBellTime = CLOCK_TIME(2, 40); - } else if (gSaveContext.time < CLOCK_TIME(2, 50)) { + } else if (gSaveContext.save.time < CLOCK_TIME(2, 50)) { this->nextBellTime = CLOCK_TIME(2, 50); - } else if (gSaveContext.time < CLOCK_TIME(3, 0)) { + } else if (gSaveContext.save.time < CLOCK_TIME(3, 0)) { this->nextBellTime = CLOCK_TIME(3, 0); - } else if (gSaveContext.time < CLOCK_TIME(3, 10)) { + } else if (gSaveContext.save.time < CLOCK_TIME(3, 10)) { this->nextBellTime = CLOCK_TIME(3, 10); - } else if (gSaveContext.time < CLOCK_TIME(3, 20)) { + } else if (gSaveContext.save.time < CLOCK_TIME(3, 20)) { this->nextBellTime = CLOCK_TIME(3, 20); - } else if (gSaveContext.time < CLOCK_TIME(3, 30)) { + } else if (gSaveContext.save.time < CLOCK_TIME(3, 30)) { this->nextBellTime = CLOCK_TIME(3, 30); - } else if (gSaveContext.time < CLOCK_TIME(3, 40)) { + } else if (gSaveContext.save.time < CLOCK_TIME(3, 40)) { this->nextBellTime = CLOCK_TIME(3, 40); - } else if (gSaveContext.time < CLOCK_TIME(3, 50)) { + } else if (gSaveContext.save.time < CLOCK_TIME(3, 50)) { this->nextBellTime = CLOCK_TIME(3, 50); - } else if (gSaveContext.time < CLOCK_TIME(4, 0)) { + } else if (gSaveContext.save.time < CLOCK_TIME(4, 0)) { this->nextBellTime = CLOCK_TIME(4, 0); - } else if (gSaveContext.time < CLOCK_TIME(4, 10)) { + } else if (gSaveContext.save.time < CLOCK_TIME(4, 10)) { this->nextBellTime = CLOCK_TIME(4, 10); - } else if (gSaveContext.time < CLOCK_TIME(4, 20)) { + } else if (gSaveContext.save.time < CLOCK_TIME(4, 20)) { this->nextBellTime = CLOCK_TIME(4, 20); - } else if (gSaveContext.time < CLOCK_TIME(4, 30) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(4, 30) - 1) { this->nextBellTime = CLOCK_TIME(4, 30) - 1; - } else if (gSaveContext.time < CLOCK_TIME(4, 40) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(4, 40) - 1) { this->nextBellTime = CLOCK_TIME(4, 40) - 1; - } else if (gSaveContext.time < CLOCK_TIME(4, 50) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(4, 50) - 1) { this->nextBellTime = CLOCK_TIME(4, 50) - 1; - } else if (gSaveContext.time < CLOCK_TIME(5, 0)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 0)) { this->nextBellTime = CLOCK_TIME(5, 0); - } else if (gSaveContext.time < CLOCK_TIME(5, 5)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 5)) { this->nextBellTime = CLOCK_TIME(5, 5); - } else if (gSaveContext.time < CLOCK_TIME(5, 10)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 10)) { this->nextBellTime = CLOCK_TIME(5, 10); - } else if (gSaveContext.time < CLOCK_TIME(5, 15) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 15) - 1) { this->nextBellTime = CLOCK_TIME(5, 15) - 1; - } else if (gSaveContext.time < CLOCK_TIME(5, 20)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 20)) { this->nextBellTime = CLOCK_TIME(5, 20); - } else if (gSaveContext.time < CLOCK_TIME(5, 25) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 25) - 1) { this->nextBellTime = CLOCK_TIME(5, 25) - 1; - } else if (gSaveContext.time < CLOCK_TIME(5, 30)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 30)) { this->nextBellTime = CLOCK_TIME(5, 30); - } else if (gSaveContext.time < CLOCK_TIME(5, 33) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 33) - 1) { this->nextBellTime = CLOCK_TIME(5, 33) - 1; - } else if (gSaveContext.time < CLOCK_TIME(5, 36)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 36)) { this->nextBellTime = CLOCK_TIME(5, 36); - } else if (gSaveContext.time < CLOCK_TIME(5, 39) - 1) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 39) - 1) { this->nextBellTime = CLOCK_TIME(5, 39) - 1; - } else if (gSaveContext.time < CLOCK_TIME(5, 42)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 42)) { this->nextBellTime = CLOCK_TIME(5, 42); - } else if (gSaveContext.time < CLOCK_TIME(5, 45)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 45)) { this->nextBellTime = CLOCK_TIME(5, 45); - } else if (gSaveContext.time < CLOCK_TIME(5, 48)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 48)) { this->nextBellTime = CLOCK_TIME(5, 48); - } else if (gSaveContext.time < CLOCK_TIME(5, 51)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 51)) { this->nextBellTime = CLOCK_TIME(5, 51); - } else if (gSaveContext.time < CLOCK_TIME(5, 54)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 54)) { this->nextBellTime = CLOCK_TIME(5, 54); - } else if (gSaveContext.time < CLOCK_TIME(5, 57)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 57)) { this->nextBellTime = CLOCK_TIME(5, 57); - } else if (gSaveContext.time < CLOCK_TIME(6, 0)) { + } else if (gSaveContext.save.time < CLOCK_TIME(6, 0)) { this->nextBellTime = CLOCK_TIME(6, 0); } } // Bells on first and second day void func_80A425E4(EnTest4* this, GlobalContext* globalCtx) { - gSaveContext.unk_3F64 = 1000.0f; + gSaveContext.screenScale = 1000.0f; - if ((gSaveContext.time >= CLOCK_TIME(6, 0)) && (gSaveContext.time < CLOCK_TIME(18, 0))) { - if (gSaveContext.time < CLOCK_TIME(17, 30)) { + if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time < CLOCK_TIME(18, 0))) { + if (gSaveContext.save.time < CLOCK_TIME(17, 30)) { this->nextBellTime = CLOCK_TIME(17, 30); - } else if (gSaveContext.time < CLOCK_TIME(17, 36)) { + } else if (gSaveContext.save.time < CLOCK_TIME(17, 36)) { this->nextBellTime = CLOCK_TIME(17, 36); - } else if (gSaveContext.time < CLOCK_TIME(17, 42)) { + } else if (gSaveContext.save.time < CLOCK_TIME(17, 42)) { this->nextBellTime = CLOCK_TIME(17, 42); - } else if (gSaveContext.time < CLOCK_TIME(17, 48)) { + } else if (gSaveContext.save.time < CLOCK_TIME(17, 48)) { this->nextBellTime = CLOCK_TIME(17, 48); - } else if (gSaveContext.time < CLOCK_TIME(17, 54)) { + } else if (gSaveContext.save.time < CLOCK_TIME(17, 54)) { this->nextBellTime = CLOCK_TIME(17, 54); } else { this->nextBellTime = CLOCK_TIME(5, 30); } } else { - if (gSaveContext.time < CLOCK_TIME(5, 30)) { + if (gSaveContext.save.time < CLOCK_TIME(5, 30)) { this->nextBellTime = CLOCK_TIME(5, 30); - } else if (gSaveContext.time < CLOCK_TIME(5, 36)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 36)) { this->nextBellTime = CLOCK_TIME(5, 36); - } else if (gSaveContext.time < CLOCK_TIME(5, 42)) { + } else if (gSaveContext.save.time < CLOCK_TIME(5, 42)) { this->nextBellTime = CLOCK_TIME(5, 42); - gSaveContext.unk_3F64 -= 50.0f; - } else if (gSaveContext.time < CLOCK_TIME(5, 48)) { + gSaveContext.screenScale -= 50.0f; + } else if (gSaveContext.save.time < CLOCK_TIME(5, 48)) { this->nextBellTime = CLOCK_TIME(5, 48); - gSaveContext.unk_3F64 -= 100.0f; - } else if (gSaveContext.time < CLOCK_TIME(5, 54)) { + gSaveContext.screenScale -= 100.0f; + } else if (gSaveContext.save.time < CLOCK_TIME(5, 54)) { this->nextBellTime = CLOCK_TIME(5, 54); - gSaveContext.unk_3F64 -= 150.0f; - } else if (gSaveContext.time < CLOCK_TIME(6, 0)) { + gSaveContext.screenScale -= 150.0f; + } else if (gSaveContext.save.time < CLOCK_TIME(6, 0)) { this->nextBellTime = CLOCK_TIME(17, 30); - gSaveContext.unk_3F64 -= 200.0f; + gSaveContext.screenScale -= 200.0f; } else { this->nextBellTime = CLOCK_TIME(17, 30); } if ((sCutscenes[this->unk_144] < 0) || ((globalCtx->actorCtx.unk5 & 2) != 0) || (CURRENT_DAY == 3) || - (gSaveContext.time >= CLOCK_TIME(17, 0))) { - gSaveContext.unk_3F64 = 1000.0f; + (gSaveContext.save.time >= CLOCK_TIME(17, 0))) { + gSaveContext.screenScale = 1000.0f; } - if (gSaveContext.unk_3F64 != 1000.0f) { - gSaveContext.unk_3F60 = 1; + if (gSaveContext.screenScale != 1000.0f) { + gSaveContext.screenScaleFlag = 1; } } } @@ -309,11 +309,11 @@ void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) { } else { sIsLoaded = true; this->actor.room = -1; - gSaveContext.unk_3F60 = 0; - gSaveContext.unk_3F64 = 1000.0f; + gSaveContext.screenScaleFlag = 0; + gSaveContext.screenScale = 1000.0f; if (CURRENT_DAY == 0) { - if (gSaveContext.time < CLOCK_TIME(6, 1)) { - gSaveContext.time = CLOCK_TIME(6, 0); + if (gSaveContext.save.time < CLOCK_TIME(6, 1)) { + gSaveContext.save.time = CLOCK_TIME(6, 0); gSaveContext.gameMode = 0; { GameState* state = &globalCtx->state; @@ -322,17 +322,17 @@ void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) { SET_NEXT_GAMESTATE(&globalCtx->state, Daytelop_Init, DaytelopContext); if (this && this && this) {} this->unk_144 = 1; - gSaveContext.time = CLOCK_TIME(6, 0); + gSaveContext.save.time = CLOCK_TIME(6, 0); Actor_MarkForDeath(&this->actor); } else { - gSaveContext.day = 1; - dayTemp = gSaveContext.day; - gSaveContext.daysElapsed = dayTemp; + gSaveContext.save.day = 1; + dayTemp = gSaveContext.save.day; + gSaveContext.save.daysElapsed = dayTemp; this->unk_144 = 1; - this->unk_146 = gSaveContext.time; + this->unk_146 = gSaveContext.save.time; this->actionFunc = func_80A42AB8; } - } else if (gSaveContext.time == CLOCK_TIME(6, 0)) { + } else if (gSaveContext.save.time == CLOCK_TIME(6, 0)) { this->unk_144 = 0; func_80A41D70(this, globalCtx); if ((gSaveContext.cutsceneTrigger == 0) && (sCutscenes[this->unk_144] >= 0) && @@ -340,12 +340,12 @@ void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) { player->stateFlags1 |= 0x200; } } else { - if ((gSaveContext.time > CLOCK_TIME(18, 0)) || (gSaveContext.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { this->unk_144 = 0; } else { this->unk_144 = 1; } - this->unk_146 = gSaveContext.time; + this->unk_146 = gSaveContext.save.time; this->actionFunc = func_80A42AB8; } } @@ -356,10 +356,10 @@ void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A425E4(this, globalCtx); } - this->lastBellTime = gSaveContext.time; + this->lastBellTime = gSaveContext.save.time; if ((sCutscenes[this->unk_144] < 0) || (globalCtx->actorCtx.unk5 & 2)) { - gSaveContext.unk_3F60 = 0; - gSaveContext.unk_3F64 = 1000.0f; + gSaveContext.screenScaleFlag = 0; + gSaveContext.screenScale = 1000.0f; } } @@ -377,10 +377,10 @@ void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { s16 bellDiff; s16 new_var; - temp_a3 = gSaveContext.time - temp_a0; + temp_a3 = gSaveContext.save.time - temp_a0; temp_a2 = this->unk_146 - temp_a0; bellDiff = this->lastBellTime - this->nextBellTime; - new_var = gSaveContext.time - this->nextBellTime; + new_var = gSaveContext.save.time - this->nextBellTime; if ((temp_a3 * temp_a2) <= 0) { gSaveContext.unk_3CA7 = 1; @@ -398,9 +398,9 @@ void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { } else if (((sCutscenes[this->unk_144] < 0) || (globalCtx->actorCtx.unk5 & 2)) && CURRENT_DAY != 3) { func_80A41FA4(this, globalCtx); } else { - gSaveContext.unk_3F64 = 0.0f; - Play_SetRespawnData(&globalCtx->state, 0, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, 0xBFF, - &player->unk_3C0, player->unk_3CC); + gSaveContext.screenScale = 0.0f; + Play_SetRespawnData(&globalCtx->state, RESTART_MODE_DOWN, Entrance_CreateIndexFromSpawn(0), + player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); func_80169EFC(&globalCtx->state); if (player->stateFlags1 & 0x800000) { EnHorse* rideActor = (EnHorse*)player->rideActor; @@ -422,7 +422,7 @@ void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { if ((sCutscenes[this->unk_144] >= 0) && ((globalCtx->actorCtx.unk5 & 2) == 0)) { player->stateFlags1 |= 0x200; - this->unk_146 = gSaveContext.time; + this->unk_146 = gSaveContext.save.time; } else { if (this->unk_144 == 0) { this->unk_144 = 1; @@ -430,26 +430,26 @@ void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { this->unk_144 = 0; } - this->unk_146 = gSaveContext.time += CLOCK_TIME_MINUTE; + this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; } } else if ((new_var * bellDiff) <= 0) { func_801A0124(&this->actor.projectedPos, (this->actor.params >> 5) & 0xF); - this->lastBellTime = gSaveContext.time; + this->lastBellTime = gSaveContext.save.time; if (CURRENT_DAY == 3) { if ((this->nextBellTime == CLOCK_TIME(0, 0)) && - ((gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) || + ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) || (globalCtx->sceneNum == SCENE_CLOCKTOWER))) { s32 playerParams; - u32 entranceIndex = gSaveContext.entranceIndex; + u32 entranceIndex = gSaveContext.save.entranceIndex; if ((globalCtx->actorCtx.unk5 & 2)) { playerParams = 0xCFF; } else { playerParams = 0xBFF; } - Play_SetRespawnData(&globalCtx->state, 1, entranceIndex, player->unk_3CE, playerParams, - &player->unk_3C0, player->unk_3CC); + Play_SetRespawnData(&globalCtx->state, RESTART_MODE_RETURN, entranceIndex, player->unk_3CE, + playerParams, &player->unk_3C0, player->unk_3CC); if ((globalCtx->sceneNum == SCENE_TENMON_DAI) || (globalCtx->sceneNum == SCENE_00KEIKOKU)) { globalCtx->nextEntranceIndex = 0x5400; @@ -494,8 +494,8 @@ void func_80A42F20(EnTest4* this, GlobalContext* globalCtx) { if (this->transitionCsTimer == 60) { Player* player = GET_PLAYER(globalCtx); - gSaveContext.time += CLOCK_TIME_MINUTE; - this->unk_146 = gSaveContext.time; + gSaveContext.save.time += CLOCK_TIME_MINUTE; + this->unk_146 = gSaveContext.save.time; globalCtx->numSetupActors = -globalCtx->numSetupActors; player->stateFlags1 &= ~0x200; } @@ -517,8 +517,8 @@ void func_80A42F20(EnTest4* this, GlobalContext* globalCtx) { } void func_80A430C8(EnTest4* this, GlobalContext* globalCtx) { - if ((CURRENT_DAY == 2) && (gSaveContext.time >= CLOCK_TIME(7, 0)) && (gSaveContext.time < CLOCK_TIME(17, 30)) && - (globalCtx->envCtx.unk_F2[2] == 0)) { + if ((CURRENT_DAY == 2) && (gSaveContext.save.time >= CLOCK_TIME(7, 0)) && + (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (globalCtx->envCtx.unk_F2[2] == 0)) { // rain? D_801BDBB0 = 1; @@ -542,7 +542,7 @@ void func_80A430C8(EnTest4* this, GlobalContext* globalCtx) { } void func_80A431C8(EnTest4* this, GlobalContext* globalCtx) { - if (((gSaveContext.time >= CLOCK_TIME(17, 30)) && (gSaveContext.time < CLOCK_TIME(23, 0)) && + if (((gSaveContext.save.time >= CLOCK_TIME(17, 30)) && (gSaveContext.save.time < CLOCK_TIME(23, 0)) && (globalCtx->envCtx.unk_F2[0] != 0)) || (globalCtx->envCtx.unk_F2[2] != 0)) { D_801BDBB0 = 0; diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index c16d8c2200..5a89347e76 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -168,7 +168,7 @@ void EnThiefbird_Init(Actor* thisx, GlobalContext* globalCtx) { D_80C1392C = 1; Math_Vec3f_Copy(&D_80C13920, &this->actor.world.pos); Actor_MarkForDeath(&this->actor); - } else if ((gSaveContext.stolenItems & 0xFF000000) >> 0x18) { + } else if (STOLEN_ITEM_1 != STOLEN_ITEM_NONE) { Actor_MarkForDeath(&this->actor); } else { func_80C11538(this); @@ -213,17 +213,17 @@ s32 func_80C10B0C(EnThiefbird* this, GlobalContext* globalCtx) { s32 itemId1; s16 itemId2 = 0; - for (; slotId < ARRAY_COUNT(gSaveContext.inventory.items); slotId++) { - if ((gSaveContext.inventory.items[slotId] >= ITEM_BOTTLE) && - (gSaveContext.inventory.items[slotId] <= ITEM_POTION_BLUE)) { + for (; slotId < 24; slotId++) { + if ((gSaveContext.save.inventory.items[slotId] >= ITEM_BOTTLE) && + (gSaveContext.save.inventory.items[slotId] <= ITEM_POTION_BLUE)) { isItemFound = true; - itemId2 = gSaveContext.inventory.items[slotId]; + itemId2 = gSaveContext.save.inventory.items[slotId]; break; } } - if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) { - phi_a3 = CUR_EQUIP_VALUE_VOID(EQUIP_SWORD); + if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + phi_a3 = GET_CUR_EQUIP_VALUE(EQUIP_SWORD); if (INV_CONTENT(ITEM_SWORD_GREAT_FAIRY) == ITEM_SWORD_GREAT_FAIRY) { phi_a3 += 4; } @@ -271,10 +271,10 @@ s32 func_80C10B0C(EnThiefbird* this, GlobalContext* globalCtx) { return false; } - if (!((gSaveContext.stolenItems & 0xFF000000) >> 0x18)) { - gSaveContext.stolenItems = (gSaveContext.stolenItems & 0xFFFFFF) | ((itemId1 & 0xFF) << 0x18); + if (STOLEN_ITEM_1 == STOLEN_ITEM_NONE) { + SET_STOLEN_ITEM_1(itemId1); } else { - gSaveContext.stolenItems = (gSaveContext.stolenItems & 0xFF00FFFF) | ((itemId1 & 0xFF) << 0x10); + SET_STOLEN_ITEM_2(itemId1); } return true; @@ -334,7 +334,7 @@ s32 func_80C10E98(GlobalContext* globalCtx) { spAC = 0; } - sp98 = (gSaveContext.rupees / 4) * 3; + sp98 = (gSaveContext.save.playerData.rupees / 4) * 3; phi_s0_2 = sp98 / 50; sp5C = (-spB0 - spAC); sp5C += 8; @@ -570,8 +570,7 @@ void func_80C1193C(EnThiefbird* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_THIEFBIRD_VOICE); if (!(this->collider.base.atFlags & AT_BOUNCED)) { if ((D_80C1392C != 0) && CUR_UPG_VALUE(UPG_QUIVER) && - (!((gSaveContext.stolenItems & 0xFF000000) >> 0x18) || - !((gSaveContext.stolenItems & 0xFF0000) >> 0x10)) && + ((STOLEN_ITEM_1 == STOLEN_ITEM_NONE) || (STOLEN_ITEM_2 == STOLEN_ITEM_NONE)) && (Rand_ZeroOne() < 0.5f) && func_80C10B0C(this, globalCtx)) { func_80C1242C(this); } else if (func_80C10E98(globalCtx)) { diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 60488183ec..58d0fc0a2e 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -502,7 +502,7 @@ s32 func_80AED354(EnTk* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } s32 func_80AED38C(EnTk* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { - u16 sp1E = gSaveContext.time - 0x3FFC; + u16 sp1E = gSaveContext.save.time - 0x3FFC; u8 params = ENTK_GET_F800(&this->actor); u16 phi_a1; s32 idx = arg2->unk0 - 1; @@ -534,14 +534,14 @@ void func_80AED4F8(EnTk* this, GlobalContext* globalCtx) { } void func_80AED544(EnTk* this, GlobalContext* globalCtx) { - if (!(gSaveContext.weekEventReg[31] & 0x10)) { + if (!(gSaveContext.save.weekEventReg[31] & 0x10)) { Message_StartTextbox(globalCtx, 0x13FE, &this->actor); - gSaveContext.weekEventReg[31] |= 0x10; - } else if (gSaveContext.time < CLOCK_TIME(9, 0)) { + gSaveContext.save.weekEventReg[31] |= 0x10; + } else if (gSaveContext.save.time < CLOCK_TIME(9, 0)) { Message_StartTextbox(globalCtx, 0x13FF, &this->actor); - } else if (gSaveContext.time < CLOCK_TIME(12, 0)) { + } else if (gSaveContext.save.time < CLOCK_TIME(12, 0)) { Message_StartTextbox(globalCtx, 0x1400, &this->actor); - } else if (gSaveContext.time < CLOCK_TIME(15, 0)) { + } else if (gSaveContext.save.time < CLOCK_TIME(15, 0)) { Message_StartTextbox(globalCtx, 0x1401, &this->actor); } else { Message_StartTextbox(globalCtx, 0x1402, &this->actor); @@ -563,7 +563,7 @@ void func_80AED610(EnTk* this, GlobalContext* globalCtx) { func_80AED544(this, globalCtx); } else if (!Flags_GetSwitch(globalCtx, ENTK_GET_7F0(&this->actor))) { Message_StartTextbox(globalCtx, 0x1403, &this->actor); - } else if (gSaveContext.weekEventReg[60] & 2) { + } else if (gSaveContext.save.weekEventReg[60] & 2) { func_80AED544(this, globalCtx); } else { Message_StartTextbox(globalCtx, 0x1413, &this->actor); @@ -594,7 +594,7 @@ void func_80AED610(EnTk* this, GlobalContext* globalCtx) { case 0x1413: func_801159EC(30); - gSaveContext.weekEventReg[60] |= 2; + gSaveContext.save.weekEventReg[60] |= 2; func_80151938(globalCtx, 0x13FF); break; @@ -757,7 +757,7 @@ void func_80AEDE10(EnTk* this, GlobalContext* globalCtx) { switch (this->unk_310) { case 0: this->unk_2CA &= ~0x1000; - if (!(gSaveContext.weekEventReg[52] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[52] & 0x80)) { this->unk_2E6 = 0x1405; } else { this->unk_2E6 = 0x140B; @@ -862,7 +862,7 @@ void func_80AEDF5C(EnTk* this, GlobalContext* globalCtx) { break; case 0x140A: - gSaveContext.weekEventReg[52] |= 0x80; + gSaveContext.save.weekEventReg[52] |= 0x80; case 0x140B: func_80AEE784(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Torch/z_en_torch.c b/src/overlays/actors/ovl_En_Torch/z_en_torch.c index b5c891af0a..fc06cff18c 100644 --- a/src/overlays/actors/ovl_En_Torch/z_en_torch.c +++ b/src/overlays/actors/ovl_En_Torch/z_en_torch.c @@ -21,7 +21,7 @@ static u8 sChestContents[] = { 0x02, 0x04, 0x05, 0x06, 0x36, 0x3A, 0x14, 0x14 }; void EnTorch_Init(Actor* thisx, GlobalContext* globalCtx) { EnTorch* this = THIS; - s8 returnData = gSaveContext.respawn[3].data; + s8 returnData = gSaveContext.respawn[RESPAWN_MODE_UNK_3].data; Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOX, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 3789bb99ab..c6931fac5c 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -87,8 +87,8 @@ void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnTorch2* this = THIS; Collider_DestroyCylinder(globalCtx, &this->collider); - Play_SetRespawnData(&globalCtx->state, this->actor.params + 3, 0xFF, 0, 0xBFF, &this->actor.world.pos, - this->actor.shape.rot.y); + Play_SetRespawnData(&globalCtx->state, this->actor.params + RESPAWN_MODE_GORON - 1, 0xFF, 0, 0xBFF, + &this->actor.world.pos, this->actor.shape.rot.y); globalCtx->actorCtx.unk254[this->actor.params] = 0; } diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index d446fd9d3a..f12baac71c 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -11,7 +11,7 @@ #define THIS ((EnToto*)thisx) -#define ENTOTO_WEEK_EVENT_FLAGS (gSaveContext.weekEventReg[50] & 1 || gSaveContext.weekEventReg[51] & 0x80) +#define ENTOTO_WEEK_EVENT_FLAGS (gSaveContext.save.weekEventReg[50] & 1 || gSaveContext.save.weekEventReg[51] & 0x80) void EnToto_Init(Actor* thisx, GlobalContext* globalCtx); void EnToto_Destroy(Actor* thisx, GlobalContext* globalCtx); @@ -185,7 +185,7 @@ void EnToto_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); if (globalCtx->sceneNum == SCENE_MILK_BAR && - (gSaveContext.time >= CLOCK_TIME(6, 0) && gSaveContext.time < CLOCK_TIME(21, 30))) { + (gSaveContext.save.time >= CLOCK_TIME(6, 0) && gSaveContext.save.time < CLOCK_TIME(21, 30))) { Actor_MarkForDeath(&this->actor); return; } @@ -253,7 +253,7 @@ void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) { //! @TODO: 0xED02 nor 0xED01 match CLOCK_TIME macro if ((globalCtx->sceneNum == SCENE_MILK_BAR && - !(gSaveContext.time >= CLOCK_TIME(6, 0) && gSaveContext.time < 0xED02)) || + !(gSaveContext.save.time >= CLOCK_TIME(6, 0) && gSaveContext.save.time < 0xED02)) || (globalCtx->sceneNum != SCENE_MILK_BAR && func_80BA397C(this, 0x2000))) { if (this->unk2B6 != 0) { this->text = D_80BA5044; @@ -438,7 +438,7 @@ s32 func_80BA4204(EnToto* this, GlobalContext* globalCtx) { if (DECR(this->unk2B1) == 0) { if (!ENTOTO_WEEK_EVENT_FLAGS) { - temp_v1_2 = &D_80BA50DC[gSaveContext.playerForm - 1]; + temp_v1_2 = &D_80BA50DC[gSaveContext.save.playerForm - 1]; Message_StartTextbox(globalCtx, (this->text->unk0 == 6) ? temp_v1_2->unk0 : temp_v1_2->unk4, NULL); } return 1; @@ -516,7 +516,7 @@ s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { return this->text->unk1; } if (player->actor.bgCheckFlags & 1) { - temp_s0 = &D_80BA50DC[gSaveContext.playerForm - 1]; + temp_s0 = &D_80BA50DC[gSaveContext.save.playerForm - 1]; if (func_80BA44D4(temp_s0, player)) { Math_Vec3s_ToVec3f(&player->actor.world.pos, &temp_s0->unk6); player->actor.shape.rot.y = 0; @@ -529,8 +529,8 @@ s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { if (this->unk2B1 < 10) { this->unk2B1++; if (this->unk2B1 >= 10) { - Message_StartTextbox(globalCtx, D_80BA50DC[((void)0, gSaveContext.playerForm) - 1].unk2, - NULL); + Message_StartTextbox(globalCtx, + D_80BA50DC[((void)0, gSaveContext.save.playerForm) - 1].unk2, NULL); } } return 0; @@ -550,17 +550,17 @@ s32 func_80BA46D8(EnToto* this, GlobalContext* globalCtx) { s32 func_80BA4740(EnToto* this, GlobalContext* globalCtx) { if (globalCtx->msgCtx.ocarinaMode == 4) { - if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) { - gSaveContext.weekEventReg[56] |= 0x10; + if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + gSaveContext.save.weekEventReg[56] |= 0x10; } - if (gSaveContext.playerForm == PLAYER_FORM_DEKU) { - gSaveContext.weekEventReg[56] |= 0x20; + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + gSaveContext.save.weekEventReg[56] |= 0x20; } - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - gSaveContext.weekEventReg[56] |= 0x40; + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + gSaveContext.save.weekEventReg[56] |= 0x40; } - if (gSaveContext.playerForm == PLAYER_FORM_GORON) { - gSaveContext.weekEventReg[56] |= 0x80; + if (gSaveContext.save.playerForm == PLAYER_FORM_GORON) { + gSaveContext.save.weekEventReg[56] |= 0x80; } return 1; } @@ -572,20 +572,20 @@ s32 func_80BA47E0(EnToto* this, GlobalContext* globalCtx) { s32 i; this->unk2B3 = 0; - if (gSaveContext.weekEventReg[56] & 0x10) { + if (gSaveContext.save.weekEventReg[56] & 0x10) { this->unk2B3 += 1; } - if (gSaveContext.weekEventReg[56] & 0x20) { + if (gSaveContext.save.weekEventReg[56] & 0x20) { this->unk2B3 += 2; } - if (gSaveContext.weekEventReg[56] & 0x40) { + if (gSaveContext.save.weekEventReg[56] & 0x40) { this->unk2B3 += 4; } - if (gSaveContext.weekEventReg[56] & 0x80) { + if (gSaveContext.save.weekEventReg[56] & 0x80) { this->unk2B3 += 8; } for (i = 0; i < 4; i++) { - if (gSaveContext.playerForm != (i + 1) && (D_80BA5128[i] & this->unk2B3)) { + if (gSaveContext.save.playerForm != (i + 1) && (D_80BA5128[i] & this->unk2B3)) { Math_Vec3s_ToVec3f(&spawnPos, &D_80BA50DC[i].unk6); Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_PLAYER, spawnPos.x, spawnPos.y, spawnPos.z, i + 2, 0, 0, -1); @@ -622,9 +622,9 @@ s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx) { func_800B7298(globalCtx, NULL, 0x45); if (this->unk2B3 == 0xF) { if (CURRENT_DAY == 1) { - gSaveContext.weekEventReg[50] |= 1; + gSaveContext.save.weekEventReg[50] |= 1; } else { - gSaveContext.weekEventReg[51] |= 0x80; + gSaveContext.save.weekEventReg[51] |= 0x80; } } else { func_80BA402C(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index 13a3d20cbe..dde803708f 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -189,7 +189,7 @@ u16 EnTrt_GetItemTextId(EnTrt* this) { u16 EnTrt_GetItemChoiceTextId(EnTrt* this) { EnGirlA* item = this->items[this->cursorIdx]; - if (item->actor.params == SI_POTION_BLUE && !(gSaveContext.weekEventReg[53] & 0x10)) { + if (item->actor.params == SI_POTION_BLUE && !(gSaveContext.save.weekEventReg[53] & 0x10)) { this->textId = 0x881; return 0x881; } @@ -335,7 +335,7 @@ void EnTrt_GetMushroom(EnTrt* this, GlobalContext* globalCtx) { case 0x883: this->textId = 0x884; Message_StartTextbox(globalCtx, this->textId, &this->actor); - gSaveContext.weekEventReg[53] |= 8; + gSaveContext.save.weekEventReg[53] |= 8; func_80123D50(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); break; case 0x888: @@ -387,7 +387,7 @@ void EnTrt_Goodbye(EnTrt* this, GlobalContext* globalCtx) { void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) { if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { if (this->textId == 0x88F) { - if (Interface_HasEmptyBottle() || !(gSaveContext.weekEventReg[12] & 0x10)) { + if (Interface_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; @@ -398,28 +398,28 @@ void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) { } else { this->tmpTextId = this->textId; this->textId = 0x88E; - gSaveContext.weekEventReg[85] |= 8; + gSaveContext.save.weekEventReg[85] |= 8; Message_StartTextbox(globalCtx, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } } else { - if (gSaveContext.weekEventReg[12] & 8) { + if (gSaveContext.save.weekEventReg[12] & 8) { this->textId = 0x83D; EnTrt_SetupStartShopping(globalCtx, this, 0); - } else if (gSaveContext.weekEventReg[84] & 0x40) { + } else if (gSaveContext.save.weekEventReg[84] & 0x40) { this->textId = 0x83B; if (Interface_HasItemInBottle(ITEM_POTION_RED)) { EnTrt_SetupStartShopping(globalCtx, this, false); } else { this->actionFunc = EnTrt_TryToGiveRedPotion; } - } else if (gSaveContext.weekEventReg[16] & 0x10) { + } else if (gSaveContext.save.weekEventReg[16] & 0x10) { this->timer = 30; this->textId = 0x838; this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING_SPECIAL; this->actionFunc = EnTrt_Surprised; return; - } else if (gSaveContext.weekEventReg[17] & 1) { + } else if (gSaveContext.save.weekEventReg[17] & 1) { this->textId = 0x835; EnTrt_SetupStartShopping(globalCtx, this, false); } @@ -433,13 +433,13 @@ void EnTrt_GiveRedPotionForKoume(EnTrt* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; - if (!(gSaveContext.weekEventReg[12] & 0x10)) { - gSaveContext.weekEventReg[12] |= 0x10; + if (!(gSaveContext.save.weekEventReg[12] & 0x10)) { + gSaveContext.save.weekEventReg[12] |= 0x10; } - gSaveContext.weekEventReg[84] |= 0x40; + gSaveContext.save.weekEventReg[84] |= 0x40; player->stateFlags2 &= ~0x20000000; this->actionFunc = EnTrt_GivenRedPotionForKoume; - } else if (gSaveContext.weekEventReg[12] & 0x10) { + } else if (gSaveContext.save.weekEventReg[12] & 0x10) { Actor_PickUp(&this->actor, globalCtx, GI_POTION_RED, 300.0f, 300.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_BOTTLE_POTION_RED, 300.0f, 300.0f); @@ -732,7 +732,7 @@ void EnTrt_SelectItem(EnTrt* this, GlobalContext* globalCtx) { this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; item->boughtFunc(globalCtx, item); - gSaveContext.weekEventReg[53] |= 0x10; + gSaveContext.save.weekEventReg[53] |= 0x10; } } } @@ -741,14 +741,14 @@ void EnTrt_SelectItem(EnTrt* this, GlobalContext* globalCtx) { void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - if ((gSaveContext.weekEventReg[85] & 8) && !(gSaveContext.weekEventReg[84] & 0x40)) { + if ((gSaveContext.save.weekEventReg[85] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40)) { this->textId = 0x88F; } else if (!(this->flags & ENTRT_MET)) { this->textId = 0x834; } else { this->textId = 0x83E; } - if (!(gSaveContext.weekEventReg[53] & 8)) { + if (!(gSaveContext.save.weekEventReg[53] & 8)) { this->talkOptionTextId = 0x845; } else if (this->flags & ENTRT_GIVEN_MUSHROOM) { this->talkOptionTextId = 0x882; @@ -873,8 +873,8 @@ void EnTrt_BeginInteraction(EnTrt* this, GlobalContext* globalCtx) { this->animationIndex = 5; switch (this->textId) { case 0x834: - if (!(gSaveContext.weekEventReg[12] & 8) && !(gSaveContext.weekEventReg[84] & 0x40) && - !(gSaveContext.weekEventReg[16] & 0x10) && !(gSaveContext.weekEventReg[17] & 1)) { + if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) && + !(gSaveContext.save.weekEventReg[16] & 0x10) && !(gSaveContext.save.weekEventReg[17] & 1)) { func_8011552C(globalCtx, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; @@ -931,7 +931,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, GlobalContext* globalCt this->blinkFunc = EnTrt_Blink; if (talkState == 6 && Message_ShouldAdvance(globalCtx)) { - if (Interface_HasEmptyBottle() || !(gSaveContext.weekEventReg[12] & 0x10)) { + if (Interface_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; @@ -940,7 +940,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, GlobalContext* globalCt } else { this->tmpTextId = this->textId; this->textId = 0x88E; - gSaveContext.weekEventReg[85] |= 8; + gSaveContext.save.weekEventReg[85] |= 8; Message_StartTextbox(globalCtx, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } @@ -961,7 +961,7 @@ void EnTrt_TryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) { } else { this->tmpTextId = this->textId; this->textId = 0x88E; - gSaveContext.weekEventReg[85] |= 8; + gSaveContext.save.weekEventReg[85] |= 8; Message_StartTextbox(globalCtx, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } @@ -1033,7 +1033,7 @@ void EnTrt_ShopkeeperGone(EnTrt* this, GlobalContext* globalCtx) { } } if (talkState == 6 && Message_ShouldAdvance(globalCtx)) { - if (gSaveContext.weekEventReg[20] & 2) { + if (gSaveContext.save.weekEventReg[20] & 2) { globalCtx->nextEntranceIndex = 0xC50; } else { globalCtx->nextEntranceIndex = 0x8450; @@ -1373,7 +1373,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, GlobalContext* globalCtx) { itemGiven = func_80123810(globalCtx); if (itemGiven > EXCH_ITEM_NONE) { if (itemGiven == EXCH_ITEM_1E) { - if (gSaveContext.weekEventReg[53] & 8) { + if (gSaveContext.save.weekEventReg[53] & 8) { player->actor.textId = 0x888; } else { player->actor.textId = 0x883; @@ -1442,7 +1442,8 @@ void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, GlobalContext* globalCtx) { void EnTrt_InitShopkeeper(EnTrt* this, GlobalContext* globalCtx) { SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_trt_Skel_00FEF0, &object_trt_Anim_00FD34, NULL, NULL, 0); - if (!(gSaveContext.weekEventReg[12] & 8) && !(gSaveContext.weekEventReg[84] & 0x40) && gSaveContext.day >= 2) { + if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) && + gSaveContext.save.day >= 2) { this->actor.draw = NULL; } else { this->actor.draw = EnTrt_Draw; @@ -1457,7 +1458,8 @@ void EnTrt_InitShop(EnTrt* this, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.cylRadius = 50; this->timer = Rand_S16Offset(40, 20); - if (!(gSaveContext.weekEventReg[12] & 8) && !(gSaveContext.weekEventReg[84] & 0x40) && gSaveContext.day >= 2) { + if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) && + gSaveContext.save.day >= 2) { this->textId = 0x84A; this->actionFunc = EnTrt_ShopkeeperGone; } else { @@ -1522,7 +1524,7 @@ void EnTrt_InitShop(EnTrt* this, GlobalContext* globalCtx) { this->blinkTimer = 20; this->eyeTextureIdx = 0; this->blinkFunc = EnTrt_EyesClosed; - if (gSaveContext.weekEventReg[53] & 8) { + if (gSaveContext.save.weekEventReg[53] & 8) { this->flags |= ENTRT_GIVEN_MUSHROOM; } diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index f8de547cde..bca0f4b84e 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -131,13 +131,13 @@ void func_80AD341C(EnTrt2* this, GlobalContext* globalCtx) { } void func_80AD349C(EnTrt2* this) { - if ((gSaveContext.weekEventReg[85] & 0x10) && !(gSaveContext.weekEventReg[84] & 0x40)) { + if ((gSaveContext.save.weekEventReg[85] & 0x10) && !(gSaveContext.save.weekEventReg[84] & 0x40)) { this->unk_3A8 = 0x88F; } else if (this->unk_3A8 == 0) { this->unk_3A8 = 0x84B; - } else if (gSaveContext.weekEventReg[16] & 0x10) { + } else if (gSaveContext.save.weekEventReg[16] & 0x10) { this->unk_3A8 = 0x838; - } else if (gSaveContext.weekEventReg[17] & 1) { + } else if (gSaveContext.save.weekEventReg[17] & 1) { this->unk_3A8 = 0x84D; } else { this->unk_3A8 = 0x849; @@ -365,7 +365,7 @@ void func_80AD3E34(EnTrt2* this, GlobalContext* globalCtx) { globalCtx->msgCtx.unk12023 = 4; this->unk_3B2 = 12; } else { - gSaveContext.weekEventReg[85] |= 0x10; + gSaveContext.save.weekEventReg[85] |= 0x10; this->unk_3A8 = 0x88E; Message_StartTextbox(globalCtx, this->unk_3A8, &this->actor); this->unk_3B2 = 10; @@ -378,11 +378,11 @@ void func_80AD3EF0(EnTrt2* this, GlobalContext* globalCtx) { if (temp_v0 == 6) { if (Message_ShouldAdvance(globalCtx)) { - if ((Interface_HasEmptyBottle() && !(gSaveContext.weekEventReg[84] & 0x40)) || - !(gSaveContext.weekEventReg[12] & 0x10)) { + if ((Interface_HasEmptyBottle() && !(gSaveContext.save.weekEventReg[84] & 0x40)) || + !(gSaveContext.save.weekEventReg[12] & 0x10)) { this->unk_3B2 = 12; } else { - gSaveContext.weekEventReg[85] |= 0x10; + gSaveContext.save.weekEventReg[85] |= 0x10; this->unk_3A8 = 0x88E; Message_StartTextbox(globalCtx, this->unk_3A8, &this->actor); this->unk_3B2 = 10; @@ -397,13 +397,13 @@ void func_80AD3EF0(EnTrt2* this, GlobalContext* globalCtx) { void func_80AD3FF4(EnTrt2* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { - if (!(gSaveContext.weekEventReg[12] & 0x10)) { - gSaveContext.weekEventReg[12] |= 0x10; + if (!(gSaveContext.save.weekEventReg[12] & 0x10)) { + gSaveContext.save.weekEventReg[12] |= 0x10; } - gSaveContext.weekEventReg[84] |= 0x40; + gSaveContext.save.weekEventReg[84] |= 0x40; this->actor.parent = NULL; this->unk_3B2 = 14; - } else if (gSaveContext.weekEventReg[12] & 0x10) { + } else if (gSaveContext.save.weekEventReg[12] & 0x10) { Actor_PickUp(&this->actor, globalCtx, GI_POTION_RED, 300.0f, 300.0f); } else { Actor_PickUp(&this->actor, globalCtx, GI_BOTTLE_POTION_RED, 300.0f, 300.0f); @@ -729,20 +729,20 @@ void func_80AD4DB4(EnTrt2* this, GlobalContext* globalCtx) { this->unk_3B8 = 0; this->unk_3BC = func_80AD4608; - if (gSaveContext.weekEventReg[12] & 8) { + if (gSaveContext.save.weekEventReg[12] & 8) { Actor_MarkForDeath(&this->actor); return; } - if (gSaveContext.weekEventReg[84] & 0x40) { + if (gSaveContext.save.weekEventReg[84] & 0x40) { Actor_MarkForDeath(&this->actor); return; } if ((globalCtx->sceneNum == SCENE_20SICHITAI) || (globalCtx->sceneNum == SCENE_20SICHITAI2)) { - if (gSaveContext.day == 2) { - if (!(gSaveContext.weekEventReg[15] & 0x80)) { - gSaveContext.weekEventReg[15] |= 0x80; + if (gSaveContext.save.day == 2) { + if (!(gSaveContext.save.weekEventReg[15] & 0x80)) { + gSaveContext.save.weekEventReg[15] |= 0x80; this->unk_3B2 = 3; } else { Actor_MarkForDeath(&this->actor); @@ -752,14 +752,14 @@ void func_80AD4DB4(EnTrt2* this, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); return; } - } else if (gSaveContext.day == 2) { - if (gSaveContext.weekEventReg[15] & 0x80) { + } else if (gSaveContext.save.day == 2) { + if (gSaveContext.save.weekEventReg[15] & 0x80) { this->unk_3B2 = 4; } else { Actor_MarkForDeath(&this->actor); return; } - } else if (gSaveContext.day == 3) { + } else if (gSaveContext.save.day == 3) { this->unk_3B2 = 4; } this->actionFunc = func_80AD4FE4; diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index 41d40649b5..e3bfe7f361 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -654,11 +654,11 @@ UNK_TYPE* func_80A871E0(EnTru* this, GlobalContext* globalCtx) { return D_80A88924; } - if (!(this->unk_34E & 0x40) && !(gSaveContext.weekEventReg[16] & 0x10)) { + if (!(this->unk_34E & 0x40) && !(gSaveContext.save.weekEventReg[16] & 0x10)) { return D_80A88918; } - if ((this->unk_34E & 0x1000) && !(gSaveContext.weekEventReg[16] & 0x10)) { + if ((this->unk_34E & 0x1000) && !(gSaveContext.save.weekEventReg[16] & 0x10)) { return D_80A88910; } @@ -753,7 +753,7 @@ s32 func_80A875AC(Actor* thisx, GlobalContext* globalCtx) { switch (this->unk_364) { case 0: - if ((this->unk_34E & 0x40) || (gSaveContext.weekEventReg[16] & 0x10)) { + if ((this->unk_34E & 0x40) || (gSaveContext.save.weekEventReg[16] & 0x10)) { this->unk_374 = this->actor.cutscene; this->unk_364++; } else { @@ -1029,7 +1029,7 @@ s32 func_80A87DC0(Actor* thisx, GlobalContext* globalCtx) { case 4: if (func_80A87400(this, globalCtx) || (DECR(this->unk_362) == 0)) { ret = true; - gSaveContext.weekEventReg[12] |= 8; + gSaveContext.save.weekEventReg[12] |= 8; } break; } @@ -1046,7 +1046,7 @@ s32 func_80A87DC0(Actor* thisx, GlobalContext* globalCtx) { void func_80A87FD0(EnTru* this, GlobalContext* globalCtx) { if (this->actor.draw != NULL) { - if ((this->unk_34E & 0x80) || (gSaveContext.weekEventReg[16] & 0x10)) { + if ((this->unk_34E & 0x80) || (gSaveContext.save.weekEventReg[16] & 0x10)) { if (func_80A873B8(this)) { SubS_UpdateFlags(&this->unk_34E, 3, 7); } else { @@ -1068,7 +1068,7 @@ void func_80A87FD0(EnTru* this, GlobalContext* globalCtx) { func_80A86924(this, 2); } } - } else if (!(gSaveContext.weekEventReg[16] & 0x10) && (fabsf(this->actor.playerHeightRel) < 10.0f) && + } else if (!(gSaveContext.save.weekEventReg[16] & 0x10) && (fabsf(this->actor.playerHeightRel) < 10.0f) && (this->actor.xzDistToPlayer < 140.0f)) { SubS_UpdateFlags(&this->unk_34E, 4, 7); this->unk_34E |= 0x1040; @@ -1093,12 +1093,12 @@ void func_80A881E0(EnTru* this, GlobalContext* globalCtx) { ActorCutscene_Stop(ActorCutscene_GetCurrentIndex()); } - if (!(this->unk_34E & 0x40) && !(gSaveContext.weekEventReg[16] & 0x10)) { + if (!(this->unk_34E & 0x40) && !(gSaveContext.save.weekEventReg[16] & 0x10)) { func_80A86924(this, 0); } else if (this->unk_34E & 0x80) { func_80A86924(this, 0); func_80A86460(this); - } else if (gSaveContext.weekEventReg[16] & 0x10) { + } else if (gSaveContext.save.weekEventReg[16] & 0x10) { func_80A86924(this, 6); } @@ -1115,7 +1115,7 @@ void func_80A881E0(EnTru* this, GlobalContext* globalCtx) { void EnTru_Init(Actor* thisx, GlobalContext* globalCtx) { EnTru* this = THIS; - if ((gSaveContext.entranceIndex != 0xC200) || (gSaveContext.weekEventReg[12] & 8)) { + if ((gSaveContext.save.entranceIndex != 0xC200) || (gSaveContext.save.weekEventReg[12] & 8)) { Actor_MarkForDeath(&this->actor); return; } @@ -1136,7 +1136,7 @@ void EnTru_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.008f); this->unk_34E = 0; - if (gSaveContext.weekEventReg[16] & 0x10) { + if (gSaveContext.save.weekEventReg[16] & 0x10) { func_80A86924(this, 5); } else { this->unk_388 = 0; diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index 4425e7f874..37715b5138 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -332,8 +332,9 @@ void func_80B76980(EnTruMt* this, GlobalContext* globalCtx) { } else if (gSaveContext.eventInf[4] & 1) { u32 score = gSaveContext.minigameScore; - if (((gSaveContext.unk_EE8 & 0xFFFF0000) >> 0x10) < score) { - gSaveContext.unk_EE8 = ((gSaveContext.minigameScore & 0xFFFF) << 0x10) | (gSaveContext.unk_EE8 & 0xFFFF); + if (((gSaveContext.save.unk_EE8 & 0xFFFF0000) >> 0x10) < score) { + gSaveContext.save.unk_EE8 = + ((gSaveContext.minigameScore & 0xFFFF) << 0x10) | (gSaveContext.save.unk_EE8 & 0xFFFF); gSaveContext.eventInf[3] |= 0x80; } } diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index e3d6831b6f..e999e5c5c8 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -86,7 +86,7 @@ void func_80ADFCEC(EnTsn* this, GlobalContext* globalCtx) { switch (ENTSN_GET_F(&this->actor)) { case ENTSN_F_0: - if (gSaveContext.weekEventReg[26] & 8) { + if (gSaveContext.save.weekEventReg[26] & 8) { Actor_MarkForDeath(&this->actor); return; } @@ -94,7 +94,7 @@ void func_80ADFCEC(EnTsn* this, GlobalContext* globalCtx) { break; case ENTSN_F_1: - if (gSaveContext.weekEventReg[26] & 4) { + if (gSaveContext.save.weekEventReg[26] & 4) { this->actor.textId = 0x1091; } else { this->actor.textId = 0x108A; @@ -102,7 +102,7 @@ void func_80ADFCEC(EnTsn* this, GlobalContext* globalCtx) { break; } - if (gSaveContext.weekEventReg[55] & 0x80) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { if ((ENTSN_GET_F(&this->actor)) == ENTSN_F_0) { this->actionFunc = func_80AE0D78; } else { @@ -143,7 +143,7 @@ void EnTsn_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.terminalVelocity = -9.0f; this->actor.gravity = -1.0f; - if (gSaveContext.weekEventReg[55] & 0x80) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { Actor_MarkForDeath(&this->actor); } } @@ -157,15 +157,15 @@ void EnTsn_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_80ADFF84(EnTsn* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.weekEventReg[26] & 8) { + if (gSaveContext.save.weekEventReg[26] & 8) { textId = 0x107E; - } else if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[25] & 0x80) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[25] & 0x80) { textId = 0x1083; } else { textId = 0x107F; } - } else if (gSaveContext.weekEventReg[26] & 1) { + } else if (gSaveContext.save.weekEventReg[26] & 1) { textId = 0x1089; } else { textId = 0x1084; @@ -207,14 +207,14 @@ void func_80AE0010(EnTsn* this, GlobalContext* globalCtx) { case 0x1082: Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); - gSaveContext.weekEventReg[25] |= 0x80; + gSaveContext.save.weekEventReg[25] |= 0x80; func_801477B4(globalCtx); this->actionFunc = func_80AE0304; this->actor.textId = 0; break; case 0x1083: - gSaveContext.weekEventReg[25] |= 0x80; + gSaveContext.save.weekEventReg[25] |= 0x80; func_801477B4(globalCtx); this->actionFunc = func_80AE0304; this->actor.textId = 0; @@ -232,7 +232,7 @@ void func_80AE0010(EnTsn* this, GlobalContext* globalCtx) { case 0x1089: case 0x1093: - gSaveContext.weekEventReg[26] |= 1; + gSaveContext.save.weekEventReg[26] |= 1; func_801477B4(globalCtx); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); this->actionFunc = func_80AE0304; @@ -245,7 +245,7 @@ void func_80AE0010(EnTsn* this, GlobalContext* globalCtx) { break; case 0x1088: - gSaveContext.weekEventReg[26] |= 1; + gSaveContext.save.weekEventReg[26] |= 1; if (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA) { func_801477B4(globalCtx); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); @@ -316,7 +316,7 @@ void func_80AE04FC(EnTsn* this, GlobalContext* globalCtx) { if (Message_GetState(&globalCtx->msgCtx) == 0x10) { sp24 = func_80123810(globalCtx); if (sp24 != 0) { - gSaveContext.weekEventReg[26] |= 2; + gSaveContext.save.weekEventReg[26] |= 2; } if (sp24 > 0) { @@ -388,13 +388,13 @@ void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.currentTextId) { case 0x106E: - if (gSaveContext.weekEventReg[25] & 0x40) { + if (gSaveContext.save.weekEventReg[25] & 0x40) { func_80151938(globalCtx, 0x1074); } else { func_80151938(globalCtx, 0x106F); } this->unk_220 |= 2; - gSaveContext.weekEventReg[25] |= 0x40; + gSaveContext.save.weekEventReg[25] |= 0x40; ENTSN_SET_Z(&this->unk_1D8->actor, true); this->unk_220 |= 4; break; @@ -425,7 +425,7 @@ void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { case 0x107C: if (Interface_HasEmptyBottle()) { - gSaveContext.weekEventReg[26] |= 8; + gSaveContext.save.weekEventReg[26] |= 8; func_801477B4(globalCtx); this->actionFunc = func_80AE0460; func_80AE0460(this, globalCtx); @@ -462,7 +462,7 @@ void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { case 0x108A: case 0x1091: - gSaveContext.weekEventReg[26] |= 4; + gSaveContext.save.weekEventReg[26] |= 4; func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); this->unk_220 |= 2; this->actor.textId = 0x1091; @@ -477,7 +477,7 @@ void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { break; case 0x1092: - if (gSaveContext.weekEventReg[26] & 8) { + if (gSaveContext.save.weekEventReg[26] & 8) { func_80AE0698(this, globalCtx); } else { func_80151938(globalCtx, 0x10A7); diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c index ffbb9526b8..51ef3ef38f 100644 --- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c +++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c @@ -112,7 +112,7 @@ void func_80A66278(EnWarpUzu* this, GlobalContext* globalCtx) { void func_80A66384(EnWarpUzu* this, GlobalContext* globalCtx) { globalCtx->nextEntranceIndex = 0x22A0; - gSaveContext.respawn[0].entranceIndex = globalCtx->nextEntranceIndex; + gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex = globalCtx->nextEntranceIndex; func_80169EFC(&globalCtx->state); gSaveContext.respawnFlag = -2; this->actionFunc = EnWarpUzu_DoNothing; diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index feea467714..f4d999fae0 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -77,7 +77,7 @@ void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) { EnWeatherTag_SetupAction(this, func_80966A08); break; case WEATHERTAG_TYPE_UNK1: - if (gSaveContext.weekEventReg[52] & 0x20) { // if cleared STT + if (gSaveContext.save.weekEventReg[52] & 0x20) { // if cleared STT Actor_MarkForDeath(&this->actor); } EnWeatherTag_SetupAction(this, func_80966B08); @@ -252,7 +252,7 @@ void func_80966BF4(EnWeatherTag* this, GlobalContext* globalCtx) { if (Cutscene_CheckActorAction(globalCtx, 567)) { tmpAction = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 567)]; if ((globalCtx->csCtx.frames >= tmpAction->startFrame) && (tmpAction->action >= 2)) { - switch (gSaveContext.day) { + switch (gSaveContext.save.day) { case 0: case 1: default: @@ -282,7 +282,7 @@ void func_80966BF4(EnWeatherTag* this, GlobalContext* globalCtx) { void func_80966D20(EnWeatherTag* this, GlobalContext* globalCtx) { u8 newUnk20; - switch (gSaveContext.day) { + switch (gSaveContext.save.day) { case 0: case 1: default: @@ -452,7 +452,7 @@ void func_809674C8(EnWeatherTag* this, GlobalContext* globalCtx) { if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this)) { if (CURRENT_DAY == 2) { - if ((gSaveContext.time >= CLOCK_TIME(7, 0)) && (gSaveContext.time < CLOCK_TIME(17, 30)) && + if ((gSaveContext.save.time >= CLOCK_TIME(7, 0)) && (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (globalCtx->envCtx.unk_F2[2] == 0)) { D_801BDBB0 = 1; @@ -489,11 +489,11 @@ void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) { (globalCtx->msgCtx.currentTextId == 0x5E6) && (!FrameAdvance_IsEnabled(&globalCtx->state)) && (globalCtx->sceneLoadFlag == 0) && (ActorCutscene_GetCurrentIndex() == -1) && (globalCtx->csCtx.state == 0)) { - oldTime = gSaveContext.time; - gSaveContext.time = (u16)REG(0xF) + oldTime; // cast req + oldTime = gSaveContext.save.time; + gSaveContext.save.time = (u16)REG(0xF) + oldTime; // cast req if (REG(0xF) != 0) { - oldTime = gSaveContext.time; - gSaveContext.time = (u16)gSaveContext.unk_14 + oldTime; + oldTime = gSaveContext.save.time; + gSaveContext.save.time = (u16)gSaveContext.save.daySpeed + oldTime; } } } diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 9db26a88cc..446d92cbdd 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -196,7 +196,7 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); } - if ((this->actor.params == WOOD_TREE_SPECIAL) && !gSaveContext.isNight && (this->unk_144 != -1) && + if ((this->actor.params == WOOD_TREE_SPECIAL) && !gSaveContext.save.isNight && (this->unk_144 != -1) && !Flags_GetCollectible(globalCtx, this->unk_144)) { this->actor.child = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ANI, this->actor.world.pos.x, diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index d2bf094fc2..25cf4c4736 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -112,7 +112,7 @@ void EnYb_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.cutscene = this->cutscenes[0]; // between midnight and morning start spawned - if (gSaveContext.time < CLOCK_TIME(6, 0)) { + if (gSaveContext.save.time < CLOCK_TIME(6, 0)) { this->alpha = 255; } else { // else (night 6pm to midnight): wait to appear this->alpha = 0; @@ -121,7 +121,7 @@ void EnYb_Init(Actor* thisx, GlobalContext* globalCtx) { } // check if already healed - if (gSaveContext.weekEventReg[82] & 4) { + if (gSaveContext.save.weekEventReg[82] & 4) { Actor_MarkForDeath(&this->actor); } } @@ -292,7 +292,7 @@ void EnYb_Talk(EnYb* this, GlobalContext* globalCtx) { case 0x147D: // I am counting on you func_801477B4(globalCtx); this->actionFunc = EnYb_Disappear; - gSaveContext.weekEventReg[82] |= 0x4; + gSaveContext.save.weekEventReg[82] |= 0x4; break; case 0x147C: // Spread my dance across the world if (Player_GetMask(globalCtx) == PLAYER_MASK_KAMARO) { @@ -353,7 +353,7 @@ void EnYb_Idle(EnYb* this, GlobalContext* globalCtx) { EnYb_UpdateAnimation(this, globalCtx); if (this->actor.xzDistToPlayer < 180.0f && fabsf(this->actor.playerHeightRel) < 50.0f && globalCtx->msgCtx.ocarinaMode == 3 && globalCtx->msgCtx.unk1202E == 7 && - gSaveContext.playerForm == PLAYER_FORM_HUMAN) { + gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { this->actionFunc = EnYb_TeachingDance; this->teachingCutsceneTimer = 200; EnYb_ChangeCutscene(this, 0); @@ -385,7 +385,7 @@ void EnYb_Idle(EnYb* this, GlobalContext* globalCtx) { } void EnYb_WaitForMidnight(EnYb* this, GlobalContext* globalCtx) { - if (gSaveContext.time < CLOCK_TIME(6, 0)) { + if (gSaveContext.save.time < CLOCK_TIME(6, 0)) { EnYb_UpdateAnimation(this, globalCtx); this->alpha += 5; if (this->alpha > 250) { diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.c b/src/overlays/actors/ovl_En_Zob/z_en_zob.c index 3fe0808a0f..6e9ddb5c0a 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.c +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.c @@ -114,13 +114,13 @@ void EnZob_Init(Actor* thisx, GlobalContext* globalCtx) { switch (ENZOB_GET_F(&this->actor)) { case ENZOB_F_1: - if (gSaveContext.weekEventReg[78] & 1) { + if (gSaveContext.save.weekEventReg[78] & 1) { this->actionFunc = func_80BA0BB4; } else { this->actionFunc = func_80BA0AD8; } - if (!(gSaveContext.weekEventReg[55] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { Actor_MarkForDeath(&this->actor); return; } @@ -135,7 +135,7 @@ void EnZob_Init(Actor* thisx, GlobalContext* globalCtx) { break; default: - if (gSaveContext.weekEventReg[55] & 0x80) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { Actor_MarkForDeath(&this->actor); } this->actor.flags |= ACTOR_FLAG_10; @@ -210,8 +210,8 @@ void func_80B9FA3C(EnZob* this, GlobalContext* globalCtx) { this->unk_2F4 |= 1; - if (gSaveContext.playerForm != PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[30] & 2) { + if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[30] & 2) { textId = 0x11F9; } else { textId = 0x11F8; @@ -222,7 +222,7 @@ void func_80B9FA3C(EnZob* this, GlobalContext* globalCtx) { textId = 0x1210; this->unk_304 = 3; func_80B9F7E4(this, 5, 2); - } else if (gSaveContext.weekEventReg[31] & 8) { + } else if (gSaveContext.save.weekEventReg[31] & 8) { textId = 0x1205; this->unk_304 = 1; func_80B9F7E4(this, 3, 0); @@ -234,12 +234,12 @@ void func_80B9FA3C(EnZob* this, GlobalContext* globalCtx) { textId = 0x1203; this->unk_304 = 1; func_80B9F7E4(this, 2, 2); - } else if (gSaveContext.weekEventReg[30] & 8) { + } else if (gSaveContext.save.weekEventReg[30] & 8) { textId = 0x11FA; this->unk_304 = 1; func_80B9F7E4(this, 2, 2); - } else if (!(gSaveContext.weekEventReg[30] & 4)) { - gSaveContext.weekEventReg[30] |= 4; + } else if (!(gSaveContext.save.weekEventReg[30] & 4)) { + gSaveContext.save.weekEventReg[30] |= 4; textId = 0x11FB; this->unk_304 = 1; func_80B9F7E4(this, 2, 2); @@ -420,7 +420,7 @@ void func_80BA00BC(EnZob* this, GlobalContext* globalCtx) { break; case 0x120F: - gSaveContext.weekEventReg[31] |= 8; + gSaveContext.save.weekEventReg[31] |= 8; this->unk_2F4 |= 0x10; func_80B9FCA0(this, globalCtx); break; @@ -473,7 +473,7 @@ void func_80BA0374(EnZob* this, GlobalContext* globalCtx) { if (Message_ShouldAdvance(globalCtx)) { switch (globalCtx->msgCtx.currentTextId) { case 0x11F8: - gSaveContext.weekEventReg[30] |= 2; + gSaveContext.save.weekEventReg[30] |= 2; func_80151938(globalCtx, 0x11F9); break; @@ -563,9 +563,9 @@ void func_80BA0728(EnZob* this, GlobalContext* globalCtx) { func_80B9F86C(this); if (func_800B8718(&this->actor, &globalCtx->state)) { - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { Message_StartTextbox(globalCtx, 0x1208, NULL); - gSaveContext.weekEventReg[30] |= 8; + gSaveContext.save.weekEventReg[30] |= 8; } else { Message_StartTextbox(globalCtx, 0x1216, NULL); } @@ -594,18 +594,18 @@ void func_80BA0728(EnZob* this, GlobalContext* globalCtx) { void func_80BA08E8(EnZob* this, GlobalContext* globalCtx) { s32 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[79] & 1) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[79] & 1) { textId = 0x1257; this->unk_304 = 3; func_80B9F7E4(this, 4, 2); - } else if (gSaveContext.weekEventReg[78] & 0x40) { + } else if (gSaveContext.save.weekEventReg[78] & 0x40) { textId = 0x1256; this->unk_304 = 1; func_80B9F7E4(this, 2, 2); } else { textId = 0x1255; - gSaveContext.weekEventReg[78] |= 0x40; + gSaveContext.save.weekEventReg[78] |= 0x40; this->unk_304 = 1; func_80B9F7E4(this, 2, 2); } @@ -663,7 +663,7 @@ void func_80BA0AD8(EnZob* this, GlobalContext* globalCtx) { void func_80BA0BB4(EnZob* this, GlobalContext* globalCtx) { func_80B9F86C(this); - if (gSaveContext.weekEventReg[79] & 1) { + if (gSaveContext.save.weekEventReg[79] & 1) { this->actionFunc = func_80BA09E0; func_80B9F7E4(this, 0, 2); this->unk_304 = 5; diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 0806413b2c..f4514a9aa0 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -265,7 +265,7 @@ void EnZog_Init(Actor* thisx, GlobalContext* globalCtx) { } } - if ((ENZOG_GET_F(&this->actor) != ENZOG_F_2) && (gSaveContext.weekEventReg[88] & 0x10)) { + if ((ENZOG_GET_F(&this->actor) != ENZOG_F_2) && (gSaveContext.save.weekEventReg[88] & 0x10)) { this->unk_302 = this->unk_300 = 0; this->unk_2FC = this->unk_2FE = 3; this->actor.flags |= ACTOR_FLAG_2000000; @@ -275,7 +275,7 @@ void EnZog_Init(Actor* thisx, GlobalContext* globalCtx) { Animation_PlayLoop(&this->skelAnime, D_80B958DC[0]); this->actor.textId = 0x1009; - if (gSaveContext.weekEventReg[91] & 2) { + if (gSaveContext.save.weekEventReg[91] & 2) { this->actor.textId = 0x103C; this->actionFunc = func_80B9451C; } else { @@ -629,7 +629,7 @@ void func_80B9451C(EnZog* this, GlobalContext* globalCtx) { this->unk_300 = 2; this->actionFunc = func_80B94470; } else if ((globalCtx->msgCtx.ocarinaMode == 3) && (this->actor.xzDistToPlayer < 120.0f)) { - if ((globalCtx->msgCtx.unk1202E == 7) && (gSaveContext.playerForm == PLAYER_FORM_HUMAN)) { + if ((globalCtx->msgCtx.unk1202E == 7) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { func_80B93BA8(this, 2); this->actionFunc = func_80B943C0; this->actor.shape.shadowDraw = NULL; @@ -645,7 +645,7 @@ void func_80B9461C(EnZog* this, GlobalContext* globalCtx) { this->actor.textId = 0x103C; this->actionFunc = func_80B9451C; this->actor.flags |= ACTOR_FLAG_2000000; - gSaveContext.weekEventReg[91] |= 2; + gSaveContext.save.weekEventReg[91] |= 2; } if ((this->unk_304 == 11) && ((s32)this->skelAnime.curFrame >= 55)) { @@ -717,7 +717,7 @@ void func_80B948A8(EnZog* this, GlobalContext* globalCtx) { this->unk_300 = 2; this->actionFunc = func_80B946FC; } else if ((globalCtx->msgCtx.ocarinaMode == 3) && (this->actor.xzDistToPlayer < 120.0f)) { - if ((globalCtx->msgCtx.unk1202E == 7) && (gSaveContext.playerForm == PLAYER_FORM_HUMAN)) { + if ((globalCtx->msgCtx.unk1202E == 7) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { func_80B93BA8(this, 2); this->actionFunc = func_80B943C0; this->actor.shape.shadowDraw = NULL; @@ -747,11 +747,11 @@ void func_80B94A00(EnZog* this, GlobalContext* globalCtx) { if (func_80B93BE0(this, globalCtx)) { this->actionFunc = func_80B948A8; this->actor.flags |= ACTOR_FLAG_2000000; - if (gSaveContext.weekEventReg[29] & 0x20) { + if (gSaveContext.save.weekEventReg[29] & 0x20) { this->actor.textId = 0x1009; } else { this->actor.textId = 0x1008; - gSaveContext.weekEventReg[29] |= 0x20; + gSaveContext.save.weekEventReg[29] |= 0x20; } this->unk_300 = 2; this->unk_31C = 2; @@ -904,7 +904,7 @@ void func_80B94E34(EnZog* this, GlobalContext* globalCtx) { this->unk_31C = 1; this->unk_31E = 0; func_80B93BA8(this, 0); - gSaveContext.weekEventReg[88] |= 0x10; + gSaveContext.save.weekEventReg[88] |= 0x10; } else if ((this->actor.yawTowardsPlayer > 16000) && (this->actor.yawTowardsPlayer < 32000) && (this->unk_302 == 0)) { func_800B8614(&this->actor, globalCtx, 150.0f); @@ -938,7 +938,7 @@ void func_80B95128(EnZog* this, GlobalContext* globalCtx) { } this->actor.flags &= ~ACTOR_FLAG_10000; - gSaveContext.weekEventReg[91] |= 1; + gSaveContext.save.weekEventReg[91] |= 1; } else { func_800B8614(&this->actor, globalCtx, 150.0f); } diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index 7250daaa84..61be7c8e75 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -118,7 +118,7 @@ void EnZoraegg_Init(Actor* thisx, GlobalContext* globalCtx) { case ENZORAEGG_1F_7: case ENZORAEGG_1F_8: case ENZORAEGG_1F_9: - if (gSaveContext.weekEventReg[19] & 0x40) { + if (gSaveContext.save.weekEventReg[19] & 0x40) { Actor_MarkForDeath(&this->actor); return; } @@ -131,7 +131,7 @@ void EnZoraegg_Init(Actor* thisx, GlobalContext* globalCtx) { case ENZORAEGG_1F_14: case ENZORAEGG_1F_15: case ENZORAEGG_1F_16: - if (!(gSaveContext.weekEventReg[19] & 0x40)) { + if (!(gSaveContext.save.weekEventReg[19] & 0x40)) { Actor_MarkForDeath(&this->actor); return; } @@ -206,13 +206,13 @@ void EnZoraegg_Destroy(Actor* thisx, GlobalContext* globalCtx) { } s32 func_80B319A8(GlobalContext* globalCtx) { - return gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 7; + return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 7; } void func_80B319D0(GlobalContext* globalCtx, s32 arg1) { if ((arg1 < 8) && (arg1 >= 0)) { - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~7; - gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= arg1; + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~7; + gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= arg1; } } @@ -479,7 +479,7 @@ void func_80B326F4(EnZoraegg* this, GlobalContext* globalCtx) { Animation_GetLastFrame(&object_zoraegg_Anim_004D20), 2, 5.0f); this->unk_1E8 = 0; this->actionFunc = func_80B32644; - gSaveContext.weekEventReg[19] |= 0x40; + gSaveContext.save.weekEventReg[19] |= 0x40; this->unk_1EC = 2; this->unk_1EE = 100; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_2); diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 6d355f1a0c..419d3325e4 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -84,11 +84,11 @@ void EnZos_Init(Actor* thisx, GlobalContext* globalCtx) { switch (ENZOS_GET_F(&this->actor)) { case ENZOS_F_1: - if (!(gSaveContext.weekEventReg[55] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { Actor_MarkForDeath(&this->actor); } - if (gSaveContext.weekEventReg[78] & 1) { + if (gSaveContext.save.weekEventReg[78] & 1) { this->actionFunc = func_80BBC24C; } else { this->actionFunc = func_80BBC14C; @@ -104,7 +104,7 @@ void EnZos_Init(Actor* thisx, GlobalContext* globalCtx) { break; default: - if (gSaveContext.weekEventReg[55] & 0x80) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { Actor_MarkForDeath(&this->actor); } this->actor.flags |= ACTOR_FLAG_10; @@ -115,7 +115,7 @@ void EnZos_Init(Actor* thisx, GlobalContext* globalCtx) { void EnZos_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnZos* this = THIS; - gSaveContext.weekEventReg[52] &= (u8)~0x10; + gSaveContext.save.weekEventReg[52] &= (u8)~0x10; } void func_80BBAE84(EnZos* this, s16 arg1, u8 arg2) { @@ -187,7 +187,7 @@ void func_80BBB0D4(EnZos* this, GlobalContext* globalCtx) { void func_80BBB15C(EnZos* this, GlobalContext* globalCtx) { s32 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (this->unk_2B6 & 8) { textId = 0x1235; func_80BBAE84(this, 6, 0); @@ -196,7 +196,7 @@ void func_80BBB15C(EnZos* this, GlobalContext* globalCtx) { textId = 0x123E; func_80BBAE84(this, 6, 0); this->unk_2B6 |= 2; - } else if (gSaveContext.weekEventReg[40] & 0x20) { + } else if (gSaveContext.save.weekEventReg[40] & 0x20) { textId = 0x1236; func_80BBAE84(this, 6, 0); this->unk_2B6 |= 0x80; @@ -207,13 +207,13 @@ void func_80BBB15C(EnZos* this, GlobalContext* globalCtx) { } } else { this->unk_2B6 &= ~2; - if (gSaveContext.weekEventReg[39] & 0x10) { + if (gSaveContext.save.weekEventReg[39] & 0x10) { textId = 0x1243; func_80BBAE84(this, 6, 0); this->unk_2B6 |= 0x80; } else { textId = 0x1244; - gSaveContext.weekEventReg[39] |= 0x10; + gSaveContext.save.weekEventReg[39] |= 0x10; func_80BBAE84(this, 4, 0); this->unk_2B6 |= 0x10; } @@ -237,11 +237,11 @@ void func_80BBB354(EnZos* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; this->actionFunc = func_80BBB2C4; - gSaveContext.weekEventReg[39] |= 0x20; + gSaveContext.save.weekEventReg[39] |= 0x20; this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); } else { - if (gSaveContext.weekEventReg[39] & 0x20) { + if (gSaveContext.save.weekEventReg[39] & 0x20) { item = GI_RUPEE_PURPLE; } else { item = GI_HEART_PIECE; @@ -348,22 +348,22 @@ void func_80BBB718(EnZos* this, GlobalContext* globalCtx) { player->actor.textId = 0x1232; func_80BBAE84(this, 5, 0); this->unk_2B6 |= 8; - gSaveContext.weekEventReg[40] |= 0x20; - } else if (gSaveContext.weekEventReg[39] & 8) { + gSaveContext.save.weekEventReg[40] |= 0x20; + } else if (gSaveContext.save.weekEventReg[39] & 8) { player->actor.textId = 0x1241; } else { player->actor.textId = 0x1237; - gSaveContext.weekEventReg[39] |= 8; + gSaveContext.save.weekEventReg[39] |= 8; func_80BBAE84(this, 4, 0); this->unk_2B6 |= 4; } this->actionFunc = func_80BBB8AC; } else if (sp24 < 0) { - if (gSaveContext.weekEventReg[39] & 8) { + if (gSaveContext.save.weekEventReg[39] & 8) { func_80151938(globalCtx, 0x1241); } else { func_80151938(globalCtx, 0x1237); - gSaveContext.weekEventReg[39] |= 8; + gSaveContext.save.weekEventReg[39] |= 8; func_80BBAE84(this, 4, 0); this->unk_2B6 |= 4; } @@ -470,17 +470,17 @@ void func_80BBB8AC(EnZos* this, GlobalContext* globalCtx) { void func_80BBBB84(EnZos* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { Message_StartTextbox(globalCtx, 0x1248, &this->actor); this->actionFunc = func_80BBB8AC; func_80BBAE84(this, 6, 0); this->unk_2B6 |= 2; - } else if (gSaveContext.weekEventReg[41] & 0x10) { + } else if (gSaveContext.save.weekEventReg[41] & 0x10) { Message_StartTextbox(globalCtx, 0x124A, &this->actor); this->actionFunc = func_80BBB8AC; func_80BBAE84(this, 6, 0); } else { - gSaveContext.weekEventReg[41] |= 0x10; + gSaveContext.save.weekEventReg[41] |= 0x10; Message_StartTextbox(globalCtx, 0x124B, &this->actor); this->actionFunc = func_80BBB574; func_80BBAE84(this, 9, 2); @@ -544,9 +544,9 @@ void func_80BBBDE0(EnZos* this, GlobalContext* globalCtx) { } if (!Actor_IsFacingPlayer(&this->actor, 0x4000) && (this->actor.xzDistToPlayer < 100.0f)) { - gSaveContext.weekEventReg[52] |= 0x10; + gSaveContext.save.weekEventReg[52] |= 0x10; } else { - gSaveContext.weekEventReg[52] &= (u8)~0x10; + gSaveContext.save.weekEventReg[52] &= (u8)~0x10; } sp28.x = this->actor.projectedPos.x; @@ -558,14 +558,14 @@ void func_80BBBDE0(EnZos* this, GlobalContext* globalCtx) { void func_80BBBFBC(EnZos* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[79] & 1) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[79] & 1) { textId = 0x125B; - } else if (gSaveContext.weekEventReg[78] & 0x80) { + } else if (gSaveContext.save.weekEventReg[78] & 0x80) { textId = 0x125A; } else { textId = 0x1259; - gSaveContext.weekEventReg[78] |= 0x80; + gSaveContext.save.weekEventReg[78] |= 0x80; } func_80BBAE84(this, 5, 0); } else { @@ -626,7 +626,7 @@ void func_80BBC22C(EnZos* this, GlobalContext* globalCtx) { void func_80BBC24C(EnZos* this, GlobalContext* globalCtx) { func_80BBB0D4(this, globalCtx); - if (gSaveContext.weekEventReg[79] & 1) { + if (gSaveContext.save.weekEventReg[79] & 1) { this->actionFunc = func_80BBC22C; func_80BBAE84(this, 7, 2); } diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 95bdbc9640..bfab9fcf66 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -184,14 +184,14 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { func_80B96BEC(this, 2, 0); this->actor.colChkInfo.cylRadius = 0; this->actor.shape.yOffset = -1400.0f; - if (!(gSaveContext.weekEventReg[55] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { Actor_MarkForDeath(&this->actor); } break; case 18: this->actionFunc = func_80B99384; - if (!(gSaveContext.weekEventReg[55] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { Actor_MarkForDeath(&this->actor); } break; @@ -219,7 +219,7 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { break; } - if ((ENZOT_GET_1F(thisx) >= 2) && (ENZOT_GET_1F(thisx) < 11) && (gSaveContext.weekEventReg[55] & 0x80)) { + if ((ENZOT_GET_1F(thisx) >= 2) && (ENZOT_GET_1F(thisx) < 11) && (gSaveContext.save.weekEventReg[55] & 0x80)) { Actor_MarkForDeath(&this->actor); } } @@ -229,7 +229,7 @@ void EnZot_Destroy(Actor* thisx, GlobalContext* globalCtx) { Collider_DestroyCylinder(globalCtx, &this->collider); if (ENZOT_GET_1F(&this->actor) == 8) { - gSaveContext.weekEventReg[41] &= (u8)~0x20; + gSaveContext.save.weekEventReg[41] &= (u8)~0x20; } } @@ -359,19 +359,19 @@ void func_80B97100(EnZot* this, GlobalContext* globalCtx) { void func_80B97110(EnZot* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { textId = 0x125F; - if (gSaveContext.weekEventReg[28] & 0x80) { + if (gSaveContext.save.weekEventReg[28] & 0x80) { textId = 0x1261; } else { - gSaveContext.weekEventReg[28] |= 0x80; + gSaveContext.save.weekEventReg[28] |= 0x80; } } else { textId = 0x125C; - if (gSaveContext.weekEventReg[28] & 0x40) { + if (gSaveContext.save.weekEventReg[28] & 0x40) { textId = 0x125E; } else { - gSaveContext.weekEventReg[28] |= 0x40; + gSaveContext.save.weekEventReg[28] |= 0x40; } } Message_StartTextbox(globalCtx, textId, &this->actor); @@ -409,35 +409,35 @@ void func_80B97240(EnZot* this, GlobalContext* globalCtx) { void func_80B972E8(EnZot* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.weekEventReg[29] & 0x10) { - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[29] & 0x10) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { textId = 0x126A; - if (gSaveContext.weekEventReg[29] & 1) { + if (gSaveContext.save.weekEventReg[29] & 1) { textId = 0x126D; } else { - gSaveContext.weekEventReg[29] |= 1; + gSaveContext.save.weekEventReg[29] |= 1; } } else { textId = 0x1267; - if (gSaveContext.weekEventReg[29] & 2) { + if (gSaveContext.save.weekEventReg[29] & 2) { textId = 0x1269; } else { - gSaveContext.weekEventReg[29] |= 2; + gSaveContext.save.weekEventReg[29] |= 2; } } - } else if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { textId = 0x1265; - if (gSaveContext.weekEventReg[29] & 4) { + if (gSaveContext.save.weekEventReg[29] & 4) { textId = 0x1266; } else { - gSaveContext.weekEventReg[29] |= 4; + gSaveContext.save.weekEventReg[29] |= 4; } } else { textId = 0x1262; - if (gSaveContext.weekEventReg[29] & 8) { + if (gSaveContext.save.weekEventReg[29] & 8) { textId = 0x1264; } else { - gSaveContext.weekEventReg[29] |= 8; + gSaveContext.save.weekEventReg[29] |= 8; } } Message_StartTextbox(globalCtx, textId, &this->actor); @@ -466,7 +466,7 @@ void func_80B973BC(EnZot* this, GlobalContext* globalCtx) { break; case 0x1275: - if (gSaveContext.rupees < 10) { + if (gSaveContext.save.playerData.rupees < 10) { func_80151938(globalCtx, 0x1277); } else { func_80151938(globalCtx, 0x1278); @@ -559,15 +559,15 @@ void func_80B97708(EnZot* this, GlobalContext* globalCtx) { } if (phi_v1 != 0) { - gSaveContext.weekEventReg[29] |= 0x10; + gSaveContext.save.weekEventReg[29] |= 0x10; this->actor.flags |= ACTOR_FLAG_10000; if (phi_v1 == 5) { - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { this->actor.textId = 0x126E; } else { this->actor.textId = 0x1272; } - } else if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { this->actor.textId = 0x1273; } else { this->actor.textId = 0x1276; @@ -584,61 +584,61 @@ void func_80B9787C(EnZot* this, GlobalContext* globalCtx) { u16 textId; if (this->actor.textId == 0) { - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { switch (ENZOT_GET_1F(&this->actor)) { case 2: - if (gSaveContext.weekEventReg[37] & 0x40) { + if (gSaveContext.save.weekEventReg[37] & 0x40) { textId = 0x127E; } else { textId = 0x127C; - gSaveContext.weekEventReg[37] |= 0x40; + gSaveContext.save.weekEventReg[37] |= 0x40; } break; case 3: - if (gSaveContext.weekEventReg[38] & 1) { + if (gSaveContext.save.weekEventReg[38] & 1) { textId = 0x1284; } else { textId = 0x1282; - gSaveContext.weekEventReg[38] |= 1; + gSaveContext.save.weekEventReg[38] |= 1; } break; default: - if (gSaveContext.weekEventReg[38] & 4) { + if (gSaveContext.save.weekEventReg[38] & 4) { textId = 0x128A; } else { textId = 0x1288; - gSaveContext.weekEventReg[38] |= 4; + gSaveContext.save.weekEventReg[38] |= 4; } break; } } else { switch (ENZOT_GET_1F(&this->actor)) { case 2: - if (gSaveContext.weekEventReg[37] & 0x20) { + if (gSaveContext.save.weekEventReg[37] & 0x20) { textId = 0x127B; } else { textId = 0x1279; - gSaveContext.weekEventReg[37] |= 0x20; + gSaveContext.save.weekEventReg[37] |= 0x20; } break; case 3: - if (gSaveContext.weekEventReg[37] & 0x80) { + if (gSaveContext.save.weekEventReg[37] & 0x80) { textId = 0x1281; } else { textId = 0x127F; - gSaveContext.weekEventReg[37] |= 0x80; + gSaveContext.save.weekEventReg[37] |= 0x80; } break; default: - if (gSaveContext.weekEventReg[38] & 2) { + if (gSaveContext.save.weekEventReg[38] & 2) { textId = 0x1287; } else { textId = 0x1285; - gSaveContext.weekEventReg[38] |= 2; + gSaveContext.save.weekEventReg[38] |= 2; } break; } @@ -707,7 +707,7 @@ void func_80B97B5C(EnZot* this, GlobalContext* globalCtx) { void func_80B97BF8(EnZot* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { textId = 0x128C; } else { textId = 0x128B; @@ -786,7 +786,7 @@ void func_80B97E4C(EnZot* this, GlobalContext* globalCtx) { this->actionFunc = func_80B97D6C; this->unk_2F2 |= 4; func_80B96BEC(this, 3, 0); - gSaveContext.weekEventReg[38] |= 8; + gSaveContext.save.weekEventReg[38] |= 8; break; case 0x128B: @@ -803,8 +803,8 @@ void func_80B97FD0(EnZot* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actionFunc = func_80B97E4C; func_80B97BF8(this, globalCtx); - } else if (gSaveContext.weekEventReg[38] & 8) { - if ((this->actor.xzDistToPlayer < 120.0f) && (gSaveContext.playerForm == PLAYER_FORM_ZORA)) { + } else if (gSaveContext.save.weekEventReg[38] & 8) { + if ((this->actor.xzDistToPlayer < 120.0f) && (gSaveContext.save.playerForm == PLAYER_FORM_ZORA)) { this->unk_2F2 |= 4; this->actionFunc = func_80B97E0C; func_80B96BEC(this, 6, 2); @@ -834,38 +834,38 @@ void func_80B98178(EnZot* this, GlobalContext* globalCtx) { switch (ENZOT_GET_1F(&this->actor)) { case 6: - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (CURRENT_DAY == 3) { textId = 0x129D; - } else if (gSaveContext.weekEventReg[39] & 1) { + } else if (gSaveContext.save.weekEventReg[39] & 1) { textId = 0x129C; } else { textId = 0x129B; - gSaveContext.weekEventReg[39] |= 1; + gSaveContext.save.weekEventReg[39] |= 1; } - } else if (gSaveContext.weekEventReg[38] & 0x80) { + } else if (gSaveContext.save.weekEventReg[38] & 0x80) { textId = 0x1293; } else { textId = 0x1291; - gSaveContext.weekEventReg[38] |= 0x80; + gSaveContext.save.weekEventReg[38] |= 0x80; } break; case 7: - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[39] & 4) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[39] & 4) { textId = 0x12AA; } else { textId = 0x12A6; - gSaveContext.weekEventReg[39] |= 4; + gSaveContext.save.weekEventReg[39] |= 4; } } else if (Flags_GetSwitch(globalCtx, this->actor.home.rot.z & 0x7F)) { textId = 0x12A0; - } else if (gSaveContext.weekEventReg[39] & 2) { + } else if (gSaveContext.save.weekEventReg[39] & 2) { textId = 0x12A5; } else { textId = 0x12A2; - gSaveContext.weekEventReg[39] |= 2; + gSaveContext.save.weekEventReg[39] |= 2; } break; @@ -877,18 +877,18 @@ void func_80B98178(EnZot* this, GlobalContext* globalCtx) { case 16: case 17: phi_v0 = (ENZOT_GET_1F(&this->actor) * 4) - 44; - if (gSaveContext.weekEventReg[79] & 1) { + if (gSaveContext.save.weekEventReg[79] & 1) { phi_v0 += 2; } - if (gSaveContext.playerForm != PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { phi_v0++; } textId = phi_v0 + 0x1302; break; default: - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { textId = 0x129F; } else { textId = 0x1295; @@ -1074,18 +1074,18 @@ void func_80B98998(EnZot* this, GlobalContext* globalCtx) { void func_80B98A4C(EnZot* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[39] & 0x80) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[39] & 0x80) { textId = 0x12B6; } else { textId = 0x12B4; - gSaveContext.weekEventReg[39] |= 0x80; + gSaveContext.save.weekEventReg[39] |= 0x80; } - } else if (gSaveContext.weekEventReg[39] & 0x40) { + } else if (gSaveContext.save.weekEventReg[39] & 0x40) { textId = 0x12B3; } else { textId = 0x12B1; - gSaveContext.weekEventReg[39] |= 0x40; + gSaveContext.save.weekEventReg[39] |= 0x40; } Message_StartTextbox(globalCtx, textId, &this->actor); } @@ -1103,14 +1103,14 @@ void func_80B98AD0(EnZot* this, GlobalContext* globalCtx) { case 0x12B8: func_801477B4(globalCtx); this->actionFunc = func_80B98CA8; - gSaveContext.weekEventReg[41] &= (u8)~0x20; + gSaveContext.save.weekEventReg[41] &= (u8)~0x20; AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); break; case 0x12BA: func_801477B4(globalCtx); this->actionFunc = func_80B98CA8; - gSaveContext.weekEventReg[41] |= 0x20; + gSaveContext.save.weekEventReg[41] |= 0x20; AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); break; @@ -1125,7 +1125,7 @@ void func_80B98AD0(EnZot* this, GlobalContext* globalCtx) { void func_80B98BF4(EnZot* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - if (gSaveContext.weekEventReg[41] & 0x20) { + if (gSaveContext.save.weekEventReg[41] & 0x20) { Message_StartTextbox(globalCtx, 0x12B7, &this->actor); this->actionFunc = func_80B98AD0; } else { @@ -1152,32 +1152,32 @@ void func_80B98CA8(EnZot* this, GlobalContext* globalCtx) { func_800B8614(&this->actor, globalCtx, 120.0f); } - if ((gSaveContext.playerForm == PLAYER_FORM_ZORA) || (this->actor.xzDistToPlayer < 100.0f)) { + if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || (this->actor.xzDistToPlayer < 100.0f)) { func_800B874C(&this->actor, globalCtx, 120.0, 100.0f); } } if (this->actor.xzDistToPlayer > 100.0f) { - gSaveContext.weekEventReg[41] &= (u8)~0x20; + gSaveContext.save.weekEventReg[41] &= (u8)~0x20; } } void func_80B98E10(EnZot* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (Flags_GetSwitch(globalCtx, this->actor.home.rot.z & 0x7F)) { - if (gSaveContext.weekEventReg[40] & 4) { + if (gSaveContext.save.weekEventReg[40] & 4) { textId = 0x12C5; } else { textId = 0x12C3; - gSaveContext.weekEventReg[40] |= 4; + gSaveContext.save.weekEventReg[40] |= 4; } - } else if (gSaveContext.weekEventReg[40] & 2) { + } else if (gSaveContext.save.weekEventReg[40] & 2) { textId = 0x12C2; } else { textId = 0x12C0; - gSaveContext.weekEventReg[40] |= 2; + gSaveContext.save.weekEventReg[40] |= 2; } } else { if (Flags_GetSwitch(globalCtx, this->actor.home.rot.z & 0x7F)) { @@ -1187,10 +1187,10 @@ void func_80B98E10(EnZot* this, GlobalContext* globalCtx) { textId = 0x12BE; this->unk_2F2 |= 0x10; } - } else if (gSaveContext.weekEventReg[40] & 1) { + } else if (gSaveContext.save.weekEventReg[40] & 1) { textId = 0x12BC; } else { - gSaveContext.weekEventReg[40] |= 1; + gSaveContext.save.weekEventReg[40] |= 1; this->unk_2F2 |= 4; textId = 0x12BB; } @@ -1252,18 +1252,18 @@ void func_80B990A4(EnZot* this, GlobalContext* globalCtx) { void func_80B99160(EnZot* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[40] & 0x10) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[40] & 0x10) { textId = 0x12CD; } else { textId = 0x12CA; - gSaveContext.weekEventReg[40] |= 0x10; + gSaveContext.save.weekEventReg[40] |= 0x10; } - } else if (gSaveContext.weekEventReg[40] & 8) { + } else if (gSaveContext.save.weekEventReg[40] & 8) { textId = 0x12C9; } else { textId = 0x12C6; - gSaveContext.weekEventReg[40] |= 8; + gSaveContext.save.weekEventReg[40] |= 8; } Message_StartTextbox(globalCtx, textId, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c index a23f5da2b6..f593709cff 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -107,7 +107,7 @@ void EnZov_Init(Actor* thisx, GlobalContext* globalCtx) { case ENZOV_F_1: this->actionFunc = func_80BD1F1C; func_80BD1570(this, 9, 0); - if (!(gSaveContext.weekEventReg[55] & 0x80)) { + if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { Actor_MarkForDeath(&this->actor); return; } @@ -120,7 +120,7 @@ void EnZov_Init(Actor* thisx, GlobalContext* globalCtx) { default: this->unk_320 |= 2; - if ((gSaveContext.weekEventReg[55] & 0x80) || (gSaveContext.weekEventReg[53] & 0x20)) { + if ((gSaveContext.save.weekEventReg[55] & 0x80) || (gSaveContext.save.weekEventReg[53] & 0x20)) { Actor_MarkForDeath(&this->actor); } break; @@ -185,9 +185,9 @@ s32 func_80BD15A4(EnZov* this, GlobalContext* globalCtx) { void func_80BD160C(EnZov* this, GlobalContext* globalCtx) { s32 textId = 0; - if (gSaveContext.weekEventReg[53] & 0x20) { + if (gSaveContext.save.weekEventReg[53] & 0x20) { this->unk_320 &= ~2; - if (gSaveContext.playerForm != PLAYER_FORM_ZORA) { + if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { textId = 0x1024; if ((this->unk_322 == 0) || (this->unk_322 == 4)) { func_80BD1570(this, 4, 2); @@ -201,7 +201,7 @@ void func_80BD160C(EnZov* this, GlobalContext* globalCtx) { this->unk_320 |= 4; func_80BD1570(this, 3, 2); } - } else if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { func_80BD1570(this, 2, 2); this->actionFunc = func_80BD19FC; this->unk_324 = 10; @@ -390,8 +390,8 @@ void func_80BD1C84(EnZov* this, GlobalContext* globalCtx) { void func_80BD1D30(EnZov* this, GlobalContext* globalCtx) { u16 textId; - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[79] & 1) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[79] & 1) { textId = 0x1032; } else { textId = 0x1033; @@ -426,7 +426,7 @@ void func_80BD1DB8(EnZov* this, GlobalContext* globalCtx) { globalCtx->nextEntranceIndex = globalCtx->setupExitList[ENZOV_GET_FE00(&this->actor)]; globalCtx->unk_1887F = 5; globalCtx->sceneLoadFlag = 0x14; - gSaveContext.weekEventReg[78] |= 1; + gSaveContext.save.weekEventReg[78] |= 1; this->actionFunc = func_80BD1D94; globalCtx->msgCtx.unk11F10 = 0; Audio_QueueSeqCmd(0x101400FF); diff --git a/src/overlays/actors/ovl_En_Zow/z_en_zow.c b/src/overlays/actors/ovl_En_Zow/z_en_zow.c index d9d8b18640..ff258fc200 100644 --- a/src/overlays/actors/ovl_En_Zow/z_en_zow.c +++ b/src/overlays/actors/ovl_En_Zow/z_en_zow.c @@ -360,45 +360,45 @@ void func_80BDD1E0(EnZow* this, GlobalContext* globalCtx) { u16 phi_a1; if (ENZOW_GET_F(&this->actor) == ENZOW_F_1) { - if (gSaveContext.weekEventReg[55] & 0x80) { - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[78] & 4) { + if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[78] & 4) { phi_a1 = 0x12FD; } else { phi_a1 = 0x12FA; - gSaveContext.weekEventReg[78] |= 4; + gSaveContext.save.weekEventReg[78] |= 4; } - } else if (gSaveContext.weekEventReg[78] & 0x10) { + } else if (gSaveContext.save.weekEventReg[78] & 0x10) { phi_a1 = 0x1301; } else { - gSaveContext.weekEventReg[78] |= 0x10; + gSaveContext.save.weekEventReg[78] |= 0x10; phi_a1 = 0x12FF; } - } else if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[78] & 8) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[78] & 8) { phi_a1 = 0x12F8; } else { phi_a1 = 0x12F3; - gSaveContext.weekEventReg[78] |= 8; + gSaveContext.save.weekEventReg[78] |= 8; } - } else if (gSaveContext.weekEventReg[78] & 0x10) { + } else if (gSaveContext.save.weekEventReg[78] & 0x10) { phi_a1 = 0x1301; } else { - gSaveContext.weekEventReg[78] |= 0x10; + gSaveContext.save.weekEventReg[78] |= 0x10; phi_a1 = 0x12FF; } - } else if (gSaveContext.weekEventReg[55] & 0x80) { - if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { + } else if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { phi_a1 = 0x12EC; } else { phi_a1 = 0x12F1; } - } else if (gSaveContext.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.weekEventReg[78] & 2) { + } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (gSaveContext.save.weekEventReg[78] & 2) { phi_a1 = 0x12EB; } else { phi_a1 = 0x12E8; - gSaveContext.weekEventReg[78] |= 2; + gSaveContext.save.weekEventReg[78] |= 2; } } else { phi_a1 = 0x12EF; diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 16dd4943a6..2d84030f1f 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -311,9 +311,9 @@ void ObjChan_PotAction(ObjChan* this, GlobalContext* globalCtx) { SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_CHANDELIER_BROKEN); func_80BB9A1C((ObjChan*)this->actor.parent, 40.0f); if (this->myPotIndex == 4) { - temp_v0_2 = gSaveContext.weekEventReg[0x25]; + temp_v0_2 = gSaveContext.save.weekEventReg[0x25]; if (!(temp_v0_2 & 0x10)) { - gSaveContext.weekEventReg[0x25] = temp_v0_2 | 0x10; + gSaveContext.save.weekEventReg[0x25] = temp_v0_2 | 0x10; Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x8000, this->actor.cutscene, this->actor.unk20, NULL); diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index f406340448..573b34fdc5 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -334,7 +334,7 @@ void ObjComb_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitJntSph(globalCtx, &this->collider); - if ((sp2C == 1) && OBJCOMB_GET_10(&this->actor) && (gSaveContext.weekEventReg[83] & 2)) { + if ((sp2C == 1) && OBJCOMB_GET_10(&this->actor) && (gSaveContext.save.weekEventReg[83] & 2)) { Actor_MarkForDeath(&this->actor); return; } @@ -531,7 +531,7 @@ void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx) { if (((OBJCOMB_GET_8000(&this->actor) | OBJCOMB_GET_80(&this->actor)) == 1) && OBJCOMB_GET_10(&this->actor)) { - gSaveContext.weekEventReg[83] |= 2; + gSaveContext.save.weekEventReg[83] |= 2; } this->unk_1B5 = 2; diff --git a/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c b/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c index 03e73043fb..57f9d75505 100644 --- a/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c +++ b/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c @@ -31,7 +31,7 @@ const ActorInit Obj_Dinner_InitVars = { void ObjDinner_Init(Actor* thisx, GlobalContext* globalCtx) { ObjDinner* this = THIS; - if (gSaveContext.isNight != true || (CURRENT_DAY == 3 && gSaveContext.weekEventReg[22] & 1)) { + if (gSaveContext.save.isNight != true || (CURRENT_DAY == 3 && gSaveContext.save.weekEventReg[22] & 1)) { Actor_MarkForDeath(&this->actor); } Actor_SetScale(&this->actor, 0.1f); diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index 6e55293a36..bedb0a38f5 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -44,7 +44,7 @@ static InitChainEntry D_80B3C96C[] = { }; void func_80B3C260(ObjGhaka* this) { - if (gSaveContext.weekEventReg[20] & 0x20) { + if (gSaveContext.save.weekEventReg[20] & 0x20) { this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + 100.0f; } this->actionFunc = func_80B3C39C; @@ -59,7 +59,7 @@ void func_80B3C2B0(ObjGhaka* this) { } void func_80B3C2C4(ObjGhaka* this, GlobalContext* globalCtx) { - if (!(gSaveContext.weekEventReg[20] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[20] & 0x20)) { Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, 0, this->dyna.actor.cutscene, this->dyna.actor.unk20, 0); } else { @@ -84,7 +84,8 @@ void func_80B3C39C(ObjGhaka* this, GlobalContext* globalCtx) { } } } - if (this->dyna.pushForce < 0.0f && !(gSaveContext.weekEventReg[20] & 0x20) && + + if (this->dyna.pushForce < 0.0f && !(gSaveContext.save.weekEventReg[20] & 0x20) && player->transformation == PLAYER_FORM_GORON) { func_80B3C2B0(this); } else { @@ -135,7 +136,7 @@ void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; func_80B3C2C4(this, globalCtx); - gSaveContext.weekEventReg[20] |= 0x20; + gSaveContext.save.weekEventReg[20] |= 0x20; func_80B3C260(this); Audio_PlaySfxAtPos(&D_80B3C960, NA_SE_EV_BLOCK_BOUND); } else { @@ -157,7 +158,7 @@ void ObjGhaka_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->dyna.actor.floorPoly == 0) { Actor_MarkForDeath(&this->dyna.actor); } - if (gSaveContext.weekEventReg[20] & 0x20) { + if (gSaveContext.save.weekEventReg[20] & 0x20) { func_80B3C2C4(this, globalCtx); } func_80B3C260(this); diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c index 6c37e68b55..4e6b3791de 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c @@ -96,7 +96,7 @@ void ObjHgdoor_SetupCheckShouldOpen(ObjHgdoor* this) { } void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, GlobalContext* globalCtx) { - if (!(gSaveContext.weekEventReg[75] & 0x20) && !(gSaveContext.weekEventReg[52] & 0x20) && + if (!(gSaveContext.save.weekEventReg[75] & 0x20) && !(gSaveContext.save.weekEventReg[52] & 0x20) && (this->dyna.actor.xzDistToPlayer < 100.0f) && (this->dyna.actor.playerHeightRel < 40.0f) && OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) { ObjHgdoor_SetChild(this, globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index 74e00403c3..06293bf40c 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -409,7 +409,7 @@ void func_80A54CEC(ObjHugebombiwa* this, GlobalContext* globalCtx) { Flags_SetSwitch(globalCtx, ENHUGEBOMBIWA_GET_7F(&this->actor)); if (!(ENHUGEBOMBIWA_GET_100(&this->actor)) && ((globalCtx->sceneNum == SCENE_17SETUGEN) || (globalCtx->sceneNum == SCENE_17SETUGEN2))) { - gSaveContext.weekEventReg[19] |= 2; + gSaveContext.save.weekEventReg[19] |= 2; } if (!(ENHUGEBOMBIWA_GET_100(&this->actor))) { diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index 05f6b212da..4e09bb6554 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -4,6 +4,7 @@ * Description: Switch-Activated Geyser */ +#include "prevent_bss_reordering.h" #include "z_obj_hunsui.h" #include "objects/object_hunsui/object_hunsui.h" diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index f122dca410..d6ac6f3427 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -116,7 +116,7 @@ void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->shape.rot.z = -0x500; if (((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(globalCtx, this->unk_149)) || - ((globalCtx->sceneNum == SCENE_KAJIYA) && (gSaveContext.weekEventReg[33] & 0x80))) { + ((globalCtx->sceneNum == SCENE_KAJIYA) && (gSaveContext.save.weekEventReg[33] & 0x80))) { Actor_MarkForDeath(thisx); return; } diff --git a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c index 81090139ba..a32f791bc8 100644 --- a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c +++ b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c @@ -58,7 +58,7 @@ void ObjMilkBin_Init(Actor* thisx, GlobalContext* globalCtx) { this->disableDraw = 0; this->type = thisx->params; - if ((this->type == OBJ_MILK_BIN_TYPE_2) && !(gSaveContext.weekEventReg[52] & 1)) { + if ((this->type == OBJ_MILK_BIN_TYPE_2) && !(gSaveContext.save.weekEventReg[52] & 1)) { this->disableDraw |= 1; } } @@ -74,14 +74,14 @@ void ObjMilkBin_Update(Actor* thisx, GlobalContext* globalCtx2) { ObjMilkBin* this = THIS; if (this->type == OBJ_MILK_BIN_TYPE_1) { - if (gSaveContext.weekEventReg[22] & 1) { - if (((gSaveContext.day == 2) && (gSaveContext.isNight == 1)) || (gSaveContext.day >= 3)) { + if (gSaveContext.save.weekEventReg[22] & 1) { + if (((gSaveContext.save.day == 2) && (gSaveContext.save.isNight == 1)) || (gSaveContext.save.day >= 3)) { Actor_MarkForDeath(&this->actor); return; } } } else if (this->type == OBJ_MILK_BIN_TYPE_2) { - if (gSaveContext.weekEventReg[52] & 1) { + if (gSaveContext.save.weekEventReg[52] & 1) { this->disableDraw &= ~1; } else { this->disableDraw |= 1; diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c index 6f79fa1f3a..546f0db16e 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c @@ -49,17 +49,15 @@ void ObjMoonStone_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.health = 0; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); func_80C0662C(this); - } else { - if ((gSaveContext.weekEventReg[74] & 0x40) == 0) { - if ((gSaveContext.weekEventReg[74] & 0x80)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, 1, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, -1); - } - this->actor.flags &= ~ACTOR_FLAG_1; - func_80C0673C(this); - } else { - Actor_MarkForDeath(&this->actor); + } else if (!(gSaveContext.save.weekEventReg[74] & 0x40)) { + if ((gSaveContext.save.weekEventReg[74] & 0x80)) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, 1, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, -1); } + this->actor.flags &= ~ACTOR_FLAG_1; + func_80C0673C(this); + } else { + Actor_MarkForDeath(&this->actor); } } @@ -99,15 +97,15 @@ void func_80C0670C(ObjMoonStone* this, GlobalContext* globalCtx) { } void func_80C0673C(ObjMoonStone* this) { - if ((gSaveContext.weekEventReg[74] & 0x80) == 0) { + if (!(gSaveContext.save.weekEventReg[74] & 0x80)) { this->actor.draw = NULL; } this->actionFunc = func_80C06768; } void func_80C06768(ObjMoonStone* this, GlobalContext* globalCtx) { - if ((gSaveContext.weekEventReg[74] & 0x80)) { - if (this->actor.draw == 0) { + if ((gSaveContext.save.weekEventReg[74] & 0x80)) { + if (this->actor.draw == NULL) { this->actor.draw = ObjMoonStone_Draw; Actor_Spawn(&globalCtx->actorCtx, globalCtx, 1, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, -1); @@ -130,7 +128,7 @@ void func_80C0685C(ObjMoonStone* this) { void func_80C06870(ObjMoonStone* this, GlobalContext* globalCtx) { if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { - gSaveContext.weekEventReg[74] |= 0x40; + gSaveContext.save.weekEventReg[74] |= 0x40; Actor_MarkForDeath(&this->actor); } } @@ -139,7 +137,7 @@ void ObjMoonStone_Update(Actor* thisx, GlobalContext* globalCtx) { ObjMoonStone* this = THIS; Player* player = GET_PLAYER(globalCtx); - if ((player->stateFlags1 & 0x10000282) == 0) { + if (!(player->stateFlags1 & 0x10000282)) { this->actionFunc(this, globalCtx); } } diff --git a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c index bfb244aa32..f81b4fe47e 100644 --- a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c +++ b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c @@ -40,7 +40,7 @@ const ActorInit Obj_Mu_Pict_InitVars = { void ObjMuPict_Init(Actor* thisx, GlobalContext* globalCtx) { ObjMuPict* this = THIS; - if (!(gSaveContext.weekEventReg[75] & 0x20) && !(gSaveContext.weekEventReg[52] & 0x20)) { + if (!(gSaveContext.save.weekEventReg[75] & 0x20) && !(gSaveContext.save.weekEventReg[52] & 0x20)) { Actor_MarkForDeath(&this->actor); } diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index 9ff5b45999..b46f2626e9 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -197,7 +197,7 @@ void ObjTokeiStep_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClocktowerPanelCol); ObjTokeiStep_InitSteps(this); ObjTokeiStep_SetupBeginOpen(this); - } else if (((CURRENT_DAY == 3) && (gSaveContext.time < CLOCK_TIME(6, 0))) || (gSaveContext.day >= 4)) { + } else if (((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (gSaveContext.save.day >= 4)) { this->dyna.actor.draw = ObjTokeiStep_DrawOpen; ObjTokeiStep_InitStepsOpen(this); ObjTokeiStep_SetupDoNothingOpen(this); diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 3ecac575f6..d13a3bb4d8 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -88,7 +88,7 @@ static InitChainEntry sInitChain[] = { * the middle of rotating. */ s32 ObjTokeidai_GetTargetSunMoonPanelRotation() { - if (gSaveContext.isNight) { + if (gSaveContext.save.isNight) { return 0x8000; } return 0; @@ -126,11 +126,11 @@ void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, GlobalContext* globalCtx) ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && (globalCtx->csCtx.currentCsIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); - } else if ((CURRENT_DAY == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { + } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { this->actionFunc = ObjTokeidai_ExteriorGear_OpenedIdle; this->actor.world.pos.y += this->actor.scale.y * 1900.0f; this->actor.shape.yOffset = 1500.0f; - gSaveContext.weekEventReg[8] |= 0x40; + gSaveContext.save.weekEventReg[8] |= 0x40; } else { this->actionFunc = ObjTokeidai_ExteriorGear_Idle; } @@ -145,7 +145,7 @@ void ObjTokeidai_TowerClock_Init(ObjTokeidai* this, GlobalContext* globalCtx) { ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && (globalCtx->csCtx.currentCsIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); - } else if ((CURRENT_DAY == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { + } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { this->actor.world.pos.y += (this->actor.scale.y * 5191.0f) - 50.0f; this->actor.world.pos.x += Math_SinS(this->actor.world.rot.y) * this->actor.scale.z * 1791.0f; this->actor.world.pos.z += -Math_CosS(this->actor.world.rot.y) * this->actor.scale.z * 1791.0f; @@ -169,7 +169,7 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, GlobalContext* globalCtx) this->actor.draw = ObjTokeidai_Counterweight_Draw; this->opaDList = gClockTowerCounterweightDL; this->xluDList = gClockTowerSpotlightDL; - if (gSaveContext.isNight) { + if (gSaveContext.save.isNight) { this->spotlightIntensity = 100; } else { this->spotlightIntensity = 0; @@ -199,7 +199,7 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, GlobalContext* globalCtx) this->actor.child->home.rot.x = 0x12C; } } - } else if ((CURRENT_DAY == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { + } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { this->spotlightIntensity = 0; this->actor.world.pos.y += this->actor.scale.y * -2160.0f; this->actor.world.pos.x += Math_SinS(this->actor.world.rot.y) * this->actor.scale.z * 5400.0f; @@ -221,7 +221,7 @@ void ObjTokeidai_Init(Actor* thisx, GlobalContext* globalCtx) { this->xRotation = 0; this->yTranslation = 0; this->clockFaceZTranslation = 0; - this->clockTime = gSaveContext.time; + this->clockTime = gSaveContext.save.time; this->actor.home.rot.x = 0; switch (OBJ_TOKEIDAI_TYPE(&this->actor)) { @@ -448,19 +448,19 @@ void ObjTokeidai_TerminaFieldWalls_Idle(ObjTokeidai* this, GlobalContext* global void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, GlobalContext* globalCtx) { if (Cutscene_CheckActorAction(globalCtx, 132) != 0 && globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 132)]->action == 5) { - gSaveContext.weekEventReg[8] |= 0x40; + gSaveContext.save.weekEventReg[8] |= 0x40; if (((globalCtx->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && (globalCtx->csCtx.currentCsIndex == 0)) || ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && (globalCtx->csCtx.currentCsIndex == 0))) { Audio_SetCutsceneFlag(false); - gSaveContext.cutscene = 0; + gSaveContext.save.cutscene = 0; gSaveContext.nextCutsceneIndex = 0; gSaveContext.respawnFlag = 2; globalCtx->sceneLoadFlag = 0x14; - globalCtx->nextEntranceIndex = gSaveContext.respawn[1].entranceIndex; + globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_RETURN].entranceIndex; globalCtx->unk_1887F = 2; - if (gSaveContext.respawn[1].playerParams == 0xCFF) { + if (gSaveContext.respawn[RESTART_MODE_RETURN].playerParams == 0xCFF) { gSaveContext.nextTransition = 0x15; } else { gSaveContext.nextTransition = 2; @@ -595,7 +595,7 @@ void ObjTokeidai_TowerOpening_RaiseTower(ObjTokeidai* this, GlobalContext* globa void ObjTokeidai_TowerOpening_Start(ObjTokeidai* this, GlobalContext* globalCtx) { if ((Cutscene_CheckActorAction(globalCtx, 132) && globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 132)]->action == 4) || - (gSaveContext.weekEventReg[8] & 0x40)) { + (gSaveContext.save.weekEventReg[8] & 0x40)) { this->actionFunc = ObjTokeidai_TowerOpening_RaiseTower; } } @@ -617,8 +617,8 @@ void ObjTokeidai_DoNothing(ObjTokeidai* this, GlobalContext* globalCtx) { } void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { - if (((CURRENT_DAY == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) || - (gSaveContext.weekEventReg[8] & 0x40)) { + if (((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) || + (gSaveContext.save.weekEventReg[8] & 0x40)) { this->actor.draw = ObjTokeidai_Draw; } else { this->actor.draw = NULL; @@ -626,10 +626,10 @@ void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, GlobalContext* globa } s32 ObjTokeidai_IsPostFirstCycleFinalHours(ObjTokeidai* this, GlobalContext* globalCtx) { - if (gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { return false; } - if (CURRENT_DAY == 3 && gSaveContext.time < CLOCK_TIME(6, 0)) { + if (CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) { ObjTokeidai_SetupTowerOpening(this); return true; } @@ -690,10 +690,10 @@ void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, GlobalContext* globalCtx) } void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { - if (CURRENT_DAY == 3 && this->clockHour < 6 && gSaveContext.time < CLOCK_TIME(6, 0)) { + if (CURRENT_DAY == 3 && this->clockHour < 6 && gSaveContext.save.time < CLOCK_TIME(6, 0)) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_SetupTowerOpening(this); - gSaveContext.weekEventReg[8] |= 0x40; + gSaveContext.save.weekEventReg[8] |= 0x40; return; } @@ -707,21 +707,21 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { ActorCutscene_GetCurrentIndex() == -1) { this->actor.draw = NULL; } - this->clockTime = gSaveContext.time; + this->clockTime = gSaveContext.save.time; if (this->actor.home.rot.x != 0) { ObjTokeidai_Clock_Init(this); this->actor.home.rot.x = 0; } } - if (CURRENT_DAY != 3 || gSaveContext.time >= CLOCK_TIME(6, 0)) { + if (CURRENT_DAY != 3 || gSaveContext.save.time >= CLOCK_TIME(6, 0)) { ObjTokeidai_RotateOnMinuteChange(this, true); } ObjTokeidai_RotateOnHourChange(this, globalCtx); } void ObjTokeidai_WallClock_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { - this->clockTime = gSaveContext.time; + this->clockTime = gSaveContext.save.time; ObjTokeidai_RotateOnMinuteChange(this, true); ObjTokeidai_RotateOnHourChange(this, globalCtx); } @@ -740,7 +740,7 @@ void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, GlobalContext* globalCtx) ActorCutscene_GetCurrentIndex() == -1) { this->actor.draw = NULL; } - this->clockTime = gSaveContext.time; + this->clockTime = gSaveContext.save.time; if (this->actor.home.rot.x != 0) { ObjTokeidai_SetupClockOrExteriorGear(this); this->actor.home.rot.x = 0; @@ -775,7 +775,7 @@ void ObjTokeidai_Counterweight_Idle(ObjTokeidai* this, GlobalContext* globalCtx) } } else { this->actor.shape.rot.y -= 0x40; - if (gSaveContext.isNight) { + if (gSaveContext.save.isNight) { if (this->spotlightIntensity < 100) { this->spotlightIntensity += 4; } diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c index cc888cdcdb..fde0406f15 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c @@ -110,7 +110,7 @@ s32 ObjWarpstone_BeginOpeningCutscene(ObjWarpstone* this, GlobalContext* globalC s32 ObjWarpstone_PlayOpeningCutscene(ObjWarpstone* this, GlobalContext* globalCtx) { if (this->openingCSTimer++ >= OBJ_WARPSTONE_TIMER_ACTIVATE_THRESHOLD) { ActorCutscene_Stop(this->dyna.actor.cutscene); - func_80143A10(OBJ_WARPSTONE_GET_ID(this)); + Sram_ActivateOwl(OBJ_WARPSTONE_GET_ID(this)); ObjWarpstone_SetupAction(this, ObjWarpstone_OpenedIdle); } else if (this->openingCSTimer < OBJ_WARPSTONE_TIMER_OPEN_THRESHOLD) { Math_StepToF(&this->dyna.actor.velocity.x, 0.01f, 0.001f); @@ -144,7 +144,7 @@ void ObjWarpstone_Update(Actor* thisx, GlobalContext* globalCtx) { globalCtx->msgCtx.msgMode = 0x4D; globalCtx->msgCtx.unk120D6 = 0; globalCtx->msgCtx.unk120D4 = 0; - gSaveContext.owlSaveLocation = OBJ_WARPSTONE_GET_ID(this); + gSaveContext.save.owlSaveLocation = OBJ_WARPSTONE_GET_ID(this); } else { func_801477B4(globalCtx); } diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h index 47163ec2c9..37cfb99abd 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h @@ -29,6 +29,6 @@ typedef struct ObjWarpstone { extern const ActorInit Obj_Warpstone_InitVars; #define OBJ_WARPSTONE_GET_ID(this) ((u16)(this->dyna.actor.params & 0xF)) -#define OBJ_WARPSTONE_IS_ACTIVATED(owlId) (((void)0,gSaveContext.owlActivationFlags) & (u16)gBitFlags[owlId]) +#define OBJ_WARPSTONE_IS_ACTIVATED(owlId) (((void)0, gSaveContext.save.playerData.owlActivationFlags) & (u16)gBitFlags[owlId]) #endif // Z_OBJ_WARPSTONE_H diff --git a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c index 91bc39495e..997941057a 100644 --- a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c +++ b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c @@ -39,7 +39,7 @@ void ObjYado_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); D_80C16470 = Lib_SegmentedToVirtual(object_yado_obj_Matanimheader_0012E8); - this->isNight = gSaveContext.isNight; + this->isNight = gSaveContext.save.isNight; } void ObjYado_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -48,7 +48,7 @@ void ObjYado_Destroy(Actor* thisx, GlobalContext* globalCtx) { void ObjYado_Update(Actor* thisx, GlobalContext* globalCtx) { ObjYado* this = THIS; - this->isNight = gSaveContext.isNight; + this->isNight = gSaveContext.save.isNight; } void ObjYado_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c index f38818cbe4..0ac471162d 100644 --- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c +++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c @@ -70,11 +70,11 @@ void Daytelop_Update(DaytelopContext* this, GameState* gameState) { this->transitionCountdown--; if (this->transitionCountdown == 0) { - if (gSaveContext.day < 9) { + if (gSaveContext.save.day < 9) { gSaveContext.gameMode = 0; } else { gSaveContext.nextCutsceneIndex = 0xFFF6; - gSaveContext.day = 1; + gSaveContext.save.day = 1; } { @@ -83,7 +83,7 @@ void Daytelop_Update(DaytelopContext* this, GameState* gameState) { } SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); - gSaveContext.time = CLOCK_TIME(6, 0); + gSaveContext.save.time = CLOCK_TIME(6, 0); D_801BDBC8 = 0xFE; } else if (this->transitionCountdown == 90) { this->fadeInState = DAYTELOP_HOURSTEXT_FADEIN; @@ -132,7 +132,7 @@ void Daytelop_Draw(DaytelopContext* this) { OPEN_DISPS(gfxCtx); func_8012C628(this->state.gfxCtx); - if (gSaveContext.day >= 9) { + if (gSaveContext.save.day >= 9) { // Draw a white screen gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); @@ -145,12 +145,12 @@ void Daytelop_Draw(DaytelopContext* this) { gDPSetRenderMode(POLY_OPA_DISP++, G_RM_OPA_SURF, G_RM_OPA_SURF2); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); - if (gSaveContext.day >= 9) { + if (gSaveContext.save.day >= 9) { gDPSetAlphaCompare(POLY_OPA_DISP++, G_AC_NONE); } // Draw the left side of the "Dawn of" texture - if (gSaveContext.day < 9) { + if (gSaveContext.save.day < 9) { gDPLoadTextureBlock_4b(POLY_OPA_DISP++, sDayLeftTextures[CURRENT_DAY - 1], G_IM_FMT_I, 128, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); @@ -163,7 +163,7 @@ void Daytelop_Draw(DaytelopContext* this) { 0x0400, 0x0400); // Draw the right side of the "Dawn of" texture - if (gSaveContext.day < 9) { + if (gSaveContext.save.day < 9) { gDPLoadTextureBlock_4b(POLY_OPA_DISP++, sDayRightTextures[CURRENT_DAY - 1], G_IM_FMT_I, 128, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); @@ -176,7 +176,7 @@ void Daytelop_Draw(DaytelopContext* this) { 0x0400, 0x0400); // Draw the "Hours left" texture - if (gSaveContext.day < 9) { + if (gSaveContext.save.day < 9) { gDPPipeSync(POLY_OPA_DISP++); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->alpha); @@ -234,9 +234,9 @@ void Daytelop_Init(GameState* thisx) { this->transitionCountdown = 140; this->fadeInState = DAYTELOP_HOURSTEXT_OFF; - if (gSaveContext.day < 9) { - if (gSaveContext.day == 0) { - func_80143AC4(); + if (gSaveContext.save.day < 9) { + if (gSaveContext.save.day == 0) { + Sram_ClearFlagsAtDawnOfTheFirstDay(); } Sram_IncrementDay(); } diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.h b/src/overlays/gamestates/ovl_file_choose/z_file_choose.h index d2e71587dd..74fd293d09 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.h +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.h @@ -1,12 +1,12 @@ -#ifndef _Z64_FILE_CHOOSE_H_ -#define _Z64_FILE_CHOOSE_H_ +#ifndef Z64_FILE_CHOOSE_H +#define Z64_FILE_CHOOSE_H #include "global.h" void FileChoose_Init(GameState* thisx); void FileChoose_Destroy(GameState* thisx); -typedef struct { +typedef struct FileChooseContext { /* 0x00000 */ GameState state; /* 0x000A4 */ Vtx* unk_A4; /* 0x000A8 */ u8* staticSegment; @@ -21,23 +21,35 @@ typedef struct { /* 0x242E0 */ EnvironmentContext envCtx; /* 0x243E0 */ Vtx* unk_243E0; /* 0x243E4 */ Vtx* unk_243E4; - /* 0x243E8 */ Vtx* unk_243E8; - /* 0x243EC */ Vtx* unk_243EC; - /* 0x243F0 */ Vtx* unk_243F0; - /* 0x243F4 */ u8 newf[6][4]; - /* 0x2440C */ u16 unk_2440C[4]; - /* 0x24414 */ u8 unk_24414[8][4]; - /* 0x24434 */ s16 healthCapacity[4]; - /* 0x2443C */ s16 health[4]; - /* 0x24444 */ u32 unk_24444[4]; - /* 0x24454 */ s8 unk_24454[4]; - /* 0x24458 */ u16 unk_24458[4]; - /* 0x24460 */ s16 unk_24460[4]; - /* 0x24468 */ u8 unk_24468[4]; - /* 0x2446C */ s16 rupees[4]; - /* 0x24474 */ u8 unk_24474[4]; - /* 0x24478 */ u8 unk_24478[4]; - /* 0x2447C */ u8 unk_2447C[4]; + /* 0x243E8 */ u8 newf2[2][6]; + /* 0x243F4 */ u8 newf[2][6]; + /* 0x24400 */ UNK_TYPE1 unk_24400[0xC]; + /* 0x2440C */ u16 unk_2440C[2]; + /* 0x24410 */ u16 unk_24410[2]; + /* 0x24414 */ u8 unk_24414[2][8]; // playername + /* 0x24424 */ u8 unk_24424[2][8]; // playername + /* 0x24434 */ s16 healthCapacity[2]; + /* 0x24438 */ u16 unk_24438[2]; + /* 0x2443C */ s16 health[2]; + /* 0x24440 */ u16 unk_24440[2]; + /* 0x24444 */ u32 unk_24444[2]; + /* 0x2444C */ u32 unk_2444C[2]; + /* 0x24454 */ s8 unk_24454[2]; + /* 0x24456 */ u8 unk_24456[2]; + /* 0x24458 */ u16 unk_24458[2]; + /* 0x2445C */ u16 unk_2445C[2]; + /* 0x24460 */ s16 unk_24460[2]; + /* 0x24464 */ s16 unk_24464[2]; + /* 0x24468 */ u8 unk_24468[2]; + /* 0x2446A */ u8 unk_2446A[2]; + /* 0x2446C */ s16 rupees[2]; + /* 0x24470 */ s16 unk_24470[2]; + /* 0x24474 */ s8 unk_24474[2]; + /* 0x24476 */ s8 unk_24476[2]; + /* 0x24478 */ s8 maskCount[2]; + /* 0x2447A */ s8 unk_2447A[2]; + /* 0x2447C */ s8 heartPieceCount[2]; + /* 0x2447E */ s8 unk_2447E[2]; /* 0x24480 */ s16 unk_24480; /* 0x24482 */ s16 unk_24482; /* 0x24484 */ s16 unk_24484; @@ -50,7 +62,7 @@ typedef struct { /* 0x24492 */ s16 unk_24492[3]; /* 0x24498 */ s16 unk_24498; /* 0x2449A */ s16 unk_2449A[6]; - /* 0x244A6 */ s16 unk_244A6; + /* 0x244A6 */ s16 fileNum; /* 0x244A8 */ s16 unk_244A8; /* 0x244AA */ s16 unk_244AA; /* 0x244AC */ s16 unk_244AC; diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index cff312816d..f0dd8190e0 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -13,21 +13,21 @@ void Opening_SetupForTitleCutscene(OpeningContext* this) { gSaveContext.eventInf[1] &= (u8)~0x80; gSaveContext.gameMode = 1; - func_80144890(); + Sram_InitNewSave(); - gSaveContext.entranceIndex = openingEntrances[D_801BB12C]; - gSaveContext.nextCutsceneIndex = gSaveContext.cutscene = openingCutscenes[D_801BB12C]; + gSaveContext.save.entranceIndex = openingEntrances[D_801BB12C]; + gSaveContext.nextCutsceneIndex = gSaveContext.save.cutscene = openingCutscenes[D_801BB12C]; gSaveContext.sceneSetupIndex = 0; - gSaveContext.time = CLOCK_TIME(8, 0); - gSaveContext.day = 1; + gSaveContext.save.time = CLOCK_TIME(8, 0); + gSaveContext.save.day = 1; { GameState* thisx = &this->gameState; thisx->running = false; } SET_NEXT_GAMESTATE(&this->gameState, Play_Init, GlobalContext); - gSaveContext.playerForm = PLAYER_FORM_HUMAN; + gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; } void func_80803EA0(OpeningContext* this) { @@ -57,8 +57,8 @@ void Opening_Init(GameState* thisx) { this->gameState.destroy = Opening_Destroy; gSaveContext.respawnFlag = 0; - gSaveContext.respawn[4].entranceIndex = 0xFF; - gSaveContext.respawn[5].entranceIndex = 0xFF; - gSaveContext.respawn[6].entranceIndex = 0xFF; - gSaveContext.respawn[7].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_GORON].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_ZORA].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_DEKU].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_HUMAN].entranceIndex = 0xFF; } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index ccc0d434c7..53dbc266ff 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -33,26 +33,26 @@ void Select_LoadGame(SelectContext* this, u32 entranceIndex, s32 opt) { gSaveContext.unk_3F24 = 0; Audio_QueueSeqCmd(NA_BGM_STOP); - gSaveContext.entranceIndex = entranceIndex; + gSaveContext.save.entranceIndex = entranceIndex; if (opt != 0) { - gSaveContext.entranceIndex = - Entrance_CreateIndex((s32)gSaveContext.entranceIndex >> 9, opt, gSaveContext.entranceIndex & 0xF); + gSaveContext.save.entranceIndex = + Entrance_CreateIndex((s32)gSaveContext.save.entranceIndex >> 9, opt, gSaveContext.save.entranceIndex & 0xF); } - if (gSaveContext.entranceIndex == 0xC000) { - gSaveContext.day = 0; - gSaveContext.time = CLOCK_TIME(6, 0) - 1; + if (gSaveContext.save.entranceIndex == 0xC000) { + gSaveContext.save.day = 0; + gSaveContext.save.time = CLOCK_TIME(6, 0) - 1; } - gSaveContext.respawn[0].entranceIndex = 0xFFFF; + gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex = 0xFFFF; gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; gSaveContext.nightSeqIndex = 0xFF; gSaveContext.showTitleCard = true; gSaveContext.respawnFlag = 0; - gSaveContext.respawn[4].entranceIndex = 0xFF; - gSaveContext.respawn[5].entranceIndex = 0xFF; - gSaveContext.respawn[6].entranceIndex = 0xFF; - gSaveContext.respawn[7].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_GORON].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_ZORA].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_DEKU].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_HUMAN].entranceIndex = 0xFF; D_801BDBB0 = 0; do { @@ -382,78 +382,78 @@ void Select_UpdateMenu(SelectContext* this) { } if (CHECK_BTN_ALL(controller1->press.button, BTN_B)) { - playerForm = gSaveContext.playerForm - 1; + playerForm = gSaveContext.save.playerForm - 1; if (playerForm < PLAYER_FORM_FIERCE_DEITY) { playerForm = PLAYER_FORM_HUMAN; } - gSaveContext.playerForm = playerForm; + gSaveContext.save.playerForm = playerForm; } if (CHECK_BTN_ALL(controller1->press.button, BTN_Z)) { - if (gSaveContext.cutscene == 0x8000) { - gSaveContext.cutscene = 0; - } else if (gSaveContext.cutscene == 0) { - gSaveContext.cutscene = 0x8800; - } else if (gSaveContext.cutscene == 0x8800) { - gSaveContext.cutscene = 0xFFF0; - } else if (gSaveContext.cutscene == 0xFFF0) { - gSaveContext.cutscene = 0xFFF1; - } else if (gSaveContext.cutscene == 0xFFF1) { - gSaveContext.cutscene = 0xFFF2; - } else if (gSaveContext.cutscene == 0xFFF2) { - gSaveContext.cutscene = 0xFFF3; - } else if (gSaveContext.cutscene == 0xFFF3) { - gSaveContext.cutscene = 0xFFF4; - } else if (gSaveContext.cutscene == 0xFFF4) { - gSaveContext.cutscene = 0xFFF5; - } else if (gSaveContext.cutscene == 0xFFF5) { - gSaveContext.cutscene = 0xFFF6; - } else if (gSaveContext.cutscene == 0xFFF6) { - gSaveContext.cutscene = 0xFFF7; - } else if (gSaveContext.cutscene == 0xFFF7) { - gSaveContext.cutscene = 0xFFF8; - } else if (gSaveContext.cutscene == 0xFFF8) { - gSaveContext.cutscene = 0xFFF9; - } else if (gSaveContext.cutscene == 0xFFF9) { - gSaveContext.cutscene = 0xFFFA; - } else if (gSaveContext.cutscene == 0xFFFA) { - gSaveContext.cutscene = 0x8000; + if (gSaveContext.save.cutscene == 0x8000) { + gSaveContext.save.cutscene = 0; + } else if (gSaveContext.save.cutscene == 0) { + gSaveContext.save.cutscene = 0x8800; + } else if (gSaveContext.save.cutscene == 0x8800) { + gSaveContext.save.cutscene = 0xFFF0; + } else if (gSaveContext.save.cutscene == 0xFFF0) { + gSaveContext.save.cutscene = 0xFFF1; + } else if (gSaveContext.save.cutscene == 0xFFF1) { + gSaveContext.save.cutscene = 0xFFF2; + } else if (gSaveContext.save.cutscene == 0xFFF2) { + gSaveContext.save.cutscene = 0xFFF3; + } else if (gSaveContext.save.cutscene == 0xFFF3) { + gSaveContext.save.cutscene = 0xFFF4; + } else if (gSaveContext.save.cutscene == 0xFFF4) { + gSaveContext.save.cutscene = 0xFFF5; + } else if (gSaveContext.save.cutscene == 0xFFF5) { + gSaveContext.save.cutscene = 0xFFF6; + } else if (gSaveContext.save.cutscene == 0xFFF6) { + gSaveContext.save.cutscene = 0xFFF7; + } else if (gSaveContext.save.cutscene == 0xFFF7) { + gSaveContext.save.cutscene = 0xFFF8; + } else if (gSaveContext.save.cutscene == 0xFFF8) { + gSaveContext.save.cutscene = 0xFFF9; + } else if (gSaveContext.save.cutscene == 0xFFF9) { + gSaveContext.save.cutscene = 0xFFFA; + } else if (gSaveContext.save.cutscene == 0xFFFA) { + gSaveContext.save.cutscene = 0x8000; } } else if (CHECK_BTN_ALL(controller1->press.button, BTN_R)) { - if (gSaveContext.cutscene == 0x8000) { - gSaveContext.cutscene = 0xFFFA; - } else if (gSaveContext.cutscene == 0) { - gSaveContext.cutscene = 0x8000; - } else if (gSaveContext.cutscene == 0x8800) { - gSaveContext.cutscene = 0; - } else if (gSaveContext.cutscene == 0xFFF0) { - gSaveContext.cutscene = 0x8800; - } else if (gSaveContext.cutscene == 0xFFF1) { - gSaveContext.cutscene = 0xFFF0; - } else if (gSaveContext.cutscene == 0xFFF2) { - gSaveContext.cutscene = 0xFFF1; - } else if (gSaveContext.cutscene == 0xFFF3) { - gSaveContext.cutscene = 0xFFF2; - } else if (gSaveContext.cutscene == 0xFFF4) { - gSaveContext.cutscene = 0xFFF3; - } else if (gSaveContext.cutscene == 0xFFF5) { - gSaveContext.cutscene = 0xFFF4; - } else if (gSaveContext.cutscene == 0xFFF6) { - gSaveContext.cutscene = 0xFFF5; - } else if (gSaveContext.cutscene == 0xFFF7) { - gSaveContext.cutscene = 0xFFF6; - } else if (gSaveContext.cutscene == 0xFFF8) { - gSaveContext.cutscene = 0xFFF7; - } else if (gSaveContext.cutscene == 0xFFF9) { - gSaveContext.cutscene = 0xFFF8; - } else if (gSaveContext.cutscene == 0xFFFA) { - gSaveContext.cutscene = 0xFFF9; + if (gSaveContext.save.cutscene == 0x8000) { + gSaveContext.save.cutscene = 0xFFFA; + } else if (gSaveContext.save.cutscene == 0) { + gSaveContext.save.cutscene = 0x8000; + } else if (gSaveContext.save.cutscene == 0x8800) { + gSaveContext.save.cutscene = 0; + } else if (gSaveContext.save.cutscene == 0xFFF0) { + gSaveContext.save.cutscene = 0x8800; + } else if (gSaveContext.save.cutscene == 0xFFF1) { + gSaveContext.save.cutscene = 0xFFF0; + } else if (gSaveContext.save.cutscene == 0xFFF2) { + gSaveContext.save.cutscene = 0xFFF1; + } else if (gSaveContext.save.cutscene == 0xFFF3) { + gSaveContext.save.cutscene = 0xFFF2; + } else if (gSaveContext.save.cutscene == 0xFFF4) { + gSaveContext.save.cutscene = 0xFFF3; + } else if (gSaveContext.save.cutscene == 0xFFF5) { + gSaveContext.save.cutscene = 0xFFF4; + } else if (gSaveContext.save.cutscene == 0xFFF6) { + gSaveContext.save.cutscene = 0xFFF5; + } else if (gSaveContext.save.cutscene == 0xFFF7) { + gSaveContext.save.cutscene = 0xFFF6; + } else if (gSaveContext.save.cutscene == 0xFFF8) { + gSaveContext.save.cutscene = 0xFFF7; + } else if (gSaveContext.save.cutscene == 0xFFF9) { + gSaveContext.save.cutscene = 0xFFF8; + } else if (gSaveContext.save.cutscene == 0xFFFA) { + gSaveContext.save.cutscene = 0xFFF9; } } - gSaveContext.isNight = false; - if (gSaveContext.cutscene == 0x8800) { - gSaveContext.isNight = true; + gSaveContext.save.isNight = false; + if (gSaveContext.save.cutscene == 0x8800) { + gSaveContext.save.isNight = true; } if (CHECK_BTN_ALL(controller1->press.button, BTN_CUP)) { @@ -464,14 +464,14 @@ void Select_UpdateMenu(SelectContext* this) { } if (CHECK_BTN_ALL(controller1->press.button, BTN_CLEFT)) { - if (gSaveContext.day > 1) { - gSaveContext.day--; + if (gSaveContext.save.day > 1) { + gSaveContext.save.day--; } } if (CHECK_BTN_ALL(controller1->press.button, BTN_CRIGHT)) { - if (gSaveContext.day < 4) { - gSaveContext.day++; + if (gSaveContext.save.day < 4) { + gSaveContext.save.day++; } } @@ -723,19 +723,19 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI case 0: // clang-format off // "Afternoon-jara" - gSaveContext.time = CLOCK_TIME(12, 0); stage = "\x8Dオヒル\x8Cジャラ"; + gSaveContext.save.time = CLOCK_TIME(12, 0); stage = "\x8Dオヒル\x8Cジャラ"; // clang-format on break; case 0x8000: // clang-format off // "Morning-jara" - gSaveContext.time = CLOCK_TIME(6, 0) + 1; stage = "\x8Dアサ \x8Cジャラ"; + gSaveContext.save.time = CLOCK_TIME(6, 0) + 1; stage = "\x8Dアサ \x8Cジャラ"; // clang-format on break; case 0x8800: - gSaveContext.time = CLOCK_TIME(18, 1); + gSaveContext.save.time = CLOCK_TIME(18, 1); // "Night-jara" stage = "\x8Dヨル \x8Cジャラ"; break; @@ -743,7 +743,7 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI case 0xFFF0: // clang-format off // "Cutscene 00" - gSaveContext.time = CLOCK_TIME(12, 0); stage = "デモ00"; + gSaveContext.save.time = CLOCK_TIME(12, 0); stage = "デモ00"; // clang-format on break; case 0xFFF1: @@ -791,13 +791,13 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI stage = "???"; break; } - gSaveContext.environmentTime = gSaveContext.time; + gSaveContext.environmentTime = gSaveContext.save.time; GfxPrint_Printf(printer, "Stage:\x8C%s", stage); GfxPrint_SetPos(printer, 23, 25); GfxPrint_SetColor(printer, 255, 255, 55, 255); - switch (gSaveContext.day) { + switch (gSaveContext.save.day) { case 1: // "The First Day" day = "\x8Dサイショノヒ"; @@ -815,7 +815,7 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI day = "\x8Dクリアーノヒ"; break; default: - gSaveContext.day = 1; + gSaveContext.save.day = 1; // "The First Day" day = "\x8Dサイショノヒ"; break; @@ -837,8 +837,8 @@ void Select_DrawMenu(SelectContext* this) { GfxPrint_Open(printer, POLY_OPA_DISP); Select_PrintMenu(this, printer); - Select_PrintAgeSetting(this, printer, ((void)0, gSaveContext.playerForm)); - Select_PrintCutsceneSetting(this, printer, ((void)0, gSaveContext.cutscene)); + Select_PrintAgeSetting(this, printer, ((void)0, gSaveContext.save.playerForm)); + Select_PrintCutsceneSetting(this, printer, ((void)0, gSaveContext.save.cutscene)); POLY_OPA_DISP = GfxPrint_Close(printer); GfxPrint_Destroy(printer); @@ -928,7 +928,7 @@ void Select_Init(GameState* thisx) { } Game_SetFramerateDivisor(&this->state, 1); - gSaveContext.cutscene = 0; - gSaveContext.playerForm = PLAYER_FORM_HUMAN; - gSaveContext.linkAge = 0; + gSaveContext.save.cutscene = 0; + gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; + gSaveContext.save.linkAge = 0; } diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 79d1c19f20..afeafe09fe 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -145,7 +145,7 @@ void Title_Main(GameState* thisx) { void Title_Destroy(GameState* thisx) { TitleContext* this = (TitleContext*)thisx; - func_80146E40(&this->gameState, &this->sramCtx); + Sram_InitSram(&this->gameState, &this->sramCtx); ShrinkWindow_Destroy(); CIC6105_Nop80081828(); } @@ -173,7 +173,7 @@ void Title_Init(GameState* thisx) { gSaveContext.fileNum = 0xFF; } - gSaveContext.unk_3F3F = 1; + gSaveContext.unk_3F3F = true; Sram_Alloc(thisx, &this->sramCtx); this->ult = 0; this->timer = 20; diff --git a/tools/actorfixer.py b/tools/actorfixer.py index 3ca33148d8..0c6eedbad4 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -489,16 +489,32 @@ animdict = { "actor.minVelocityY": "actor.terminalVelocity", "actor.yDistToWater": "actor.depthInWater", "actor.yDistToPlayer": "actor.playerHeightRel", - "globalCtx->mf_187FC": "globalCtx->billboardMtxF", - "globalCtx->projectionMatrix": "globalCtx->viewProjectionMtxF", - "csCtx.npcActions": "csCtx.actorActions", - "csCtx->npcActions": "csCtx->actorActions", - "csCtx.unk_12": "csCtx.currentCsIndex", - "globalCtx->envCtx.unk_8C": "globalCtx->envCtx.lightSettings", - "globalCtx->envCtx.unk_E5": "globalCtx->envCtx.fillScreen", - "globalCtx->envCtx.unk_E6": "globalCtx->envCtx.screenFillColor", - "globalCtx->envCtx.unk_C3": "globalCtx->envCtx.lightSettingOverride", - "globalCtx->envCtx.unk_DC": "globalCtx->envCtx.lightBlend", + "gSaveContext.weekEventReg": "gSaveContext.save.weekEventReg", + "gSaveContext.playerForm": "gSaveContext.save.playerForm", + "gSaveContext.day": "gSaveContext.save.day", + # "gSaveContext.cutscene": "gSaveContext.save.cutscene", + "gSaveContext.isNight": "gSaveContext.save.isNight", + "gSaveContext.naviTimer": "gSaveContext.save.playerData.tatlTimer", + "gSaveContext.tatlTimer": "gSaveContext.save.playerData.tatlTimer", + # "gSaveContext.health": "gSaveContext.save.playerData.health", + "gSaveContext.rupees": "gSaveContext.save.playerData.rupees", + "gSaveContext.magicAcquired": "gSaveContext.save.playerData.magicAcquired", + "gSaveContext.doubleMagic": "gSaveContext.save.playerData.doubleMagic", + "gSaveContext.doubleDefense": "gSaveContext.save.playerData.doubleDefense", + "gSaveContext.playerName": "gSaveContext.save.playerData.playerName", + "gSaveContext.inventory": "gSaveContext.save.inventory", + "gSaveContext.equippedMask": "gSaveContext.save.equippedMask", + "gSaveContext.entranceIndex": "gSaveContext.save.entranceIndex", + "gSaveContext.time": "gSaveContext.save.time", + "gSaveContext.unk_14": "gSaveContext.save.daySpeed", + "gSaveContext.unk_FE6": "gSaveContext.save.bombersCaughtNum", + "gSaveContext.unk_FE7": "gSaveContext.save.bombersCaughtOrder", + "gSaveContext.linkAge": "gSaveContext.save.linkAge", + "gSaveContext.dekuPlaygroundHighScores": "gSaveContext.save.dekuPlaygroundHighScores", + "gSaveContext.lotteryCodeGuess": "gSaveContext.save.lotteryCodeGuess", + "gSaveContext.permanentSceneFlags": "gSaveContext.save.permanentSceneFlags", + "gSaveContext.bomberCode": "gSaveContext.save.bomberCode", + "gSaveContext.skullTokenCount": "gSaveContext.save.skullTokenCount", "player->unk_A87": "player->exchangeItemId", "player->leftHandActor": "player->heldActor", "player->unk_384": "player->getItemId", @@ -506,7 +522,17 @@ animdict = { "player->unk_388": "player->interactRangeActor", "player->unk_38C": "player->mountSide", "player->unk_394": "player->csMode", + "csCtx.npcActions": "csCtx.actorActions", + "csCtx->npcActions": "csCtx->actorActions", + "csCtx.unk_12": "csCtx.currentCsIndex", + "globalCtx->mf_187FC": "globalCtx->billboardMtxF", + "globalCtx->projectionMatrix": "globalCtx->viewProjectionMtxF", "globalCtx->actorCtx.actorList[": "globalCtx->actorCtx.actorLists[", + "globalCtx->envCtx.unk_8C": "globalCtx->envCtx.lightSettings", + "globalCtx->envCtx.unk_E5": "globalCtx->envCtx.fillScreen", + "globalCtx->envCtx.unk_E6": "globalCtx->envCtx.screenFillColor", + "globalCtx->envCtx.unk_C3": "globalCtx->envCtx.lightSettingOverride", + "globalCtx->envCtx.unk_DC": "globalCtx->envCtx.lightBlend", "gSaveContext.unk_1016": "gSaveContext.jinxTimer", "gSaveContext.unk_3F58": "gSaveContext.sunsSongState", "globalCtx->msgCtx.unk1202A": "globalCtx->msgCtx.ocarinaMode", @@ -527,6 +553,9 @@ animdict = { "ActorAnimationEntryS": "AnimationInfoS", "struct_80B8E1A8": "AnimationSpeedInfo", + # Macros + "CUR_EQUIP_VALUE_VOID": "GET_CUR_EQUIP_VALUE", + "CUR_UPG_VALUE_VOID": "GET_CUR_UPG_VALUE", "ICHAIN_F32_DIV1000(minVelocityY,": "ICHAIN_F32_DIV1000(terminalVelocity,", "ICHAIN_F32(minVelocityY,": "ICHAIN_F32(terminalVelocity,", } diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index a43ef93f45..cd1bbac2fd 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -561,6 +561,7 @@ 0x801C5DD0 : "z_vimode", 0x801C5E30 : "z_vr_box", 0x801C5FC0 : "z_sram_NES", + 0x801C6A70 : "z_message", 0x801D0470 : "z_message_nes", 0x801D0B50 : "z_player_call", 0x801D0B70 : "z_kaleido_manager", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 9a4c19d2c3..8c6a53946f 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2787,30 +2787,30 @@ 0x80143624:("SkyboxDraw_SetColors",), 0x80143668:("SkyboxDraw_Draw",), 0x80143A04:("SkyboxDraw_Noop",), - 0x80143A10:("func_80143A10",), - 0x80143A54:("func_80143A54",), - 0x80143AC4:("func_80143AC4",), - 0x80143B0C:("func_80143B0C",), + 0x80143A10:("Sram_ActivateOwl",), + 0x80143A54:("Sram_ClearHighscores",), + 0x80143AC4:("Sram_ClearFlagsAtDawnOfTheFirstDay",), + 0x80143B0C:("Sram_SaveEndOfCycle",), 0x80144574:("Sram_IncrementDay",), 0x801445E4:("Sram_CalcChecksum",), - 0x80144628:("func_80144628",), + 0x80144628:("Sram_ResetSave",), 0x80144684:("Sram_GenerateRandomSaveFields",), - 0x80144890:("func_80144890",), + 0x80144890:("Sram_InitNewSave",), 0x80144968:("Sram_InitDebugSave",), 0x80144A94:("func_80144A94",), - 0x80144E78:("func_80144E78",), + 0x80144E78:("Sram_OpenSave",), 0x8014546C:("func_8014546C",), 0x80145698:("func_80145698",), 0x801457CC:("func_801457CC",), 0x80146580:("func_80146580",), 0x80146628:("func_80146628",), - 0x80146AA0:("func_80146AA0",), + 0x80146AA0:("Sram_InitSave",), 0x80146DF8:("func_80146DF8",), - 0x80146E40:("func_80146E40",), + 0x80146E40:("Sram_InitSram",), 0x80146E70:("Sram_Alloc",), 0x80146EBC:("func_80146EBC",), - 0x80146EE8:("func_80146EE8",), - 0x80146F5C:("func_80146F5C",), + 0x80146EE8:("Sram_SaveSpecialEnterClockTown",), + 0x80146F5C:("Sram_SaveSpecialNewDay",), 0x80147008:("func_80147008",), 0x80147020:("func_80147020",), 0x80147068:("func_80147068",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 2b6e72ca91..5e1be9b2a2 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1983,33 +1983,27 @@ 0x801C5EB0:("D_801C5EB0","UNK_TYPE4","",0x4), 0x801C5EC4:("D_801C5EC4","UNK_TYPE2","",0x2), 0x801C5F44:("D_801C5F44","UNK_TYPE4","",0x4), - 0x801C5FC0:("D_801C5FC0","UNK_TYPE4","",0x4), - 0x801C5FC4:("D_801C5FC4","UNK_TYPE4","",0x4), - 0x801C5FC8:("D_801C5FC8","UNK_TYPE4","",0x4), - 0x801C5FCC:("D_801C5FCC","UNK_TYPE4","",0x4), - 0x801C5FD0:("D_801C5FD0","UNK_TYPE4","",0x4), + 0x801C5FC0:("D_801C5FC0","u32","[452]",0x710), 0x801C66D0:("D_801C66D0","UNK_TYPE2","",0x2), 0x801C6798:("D_801C6798","UNK_TYPE4","",0x4), 0x801C67B0:("D_801C67B0","UNK_TYPE1","",0x1), - 0x801C67C8:("D_801C67C8","UNK_TYPE4","",0x4), - 0x801C67CC:("D_801C67CC","UNK_TYPE4","",0x4), + 0x801C67C8:("D_801C67C8","s32","[8]",0x20), 0x801C67E8:("D_801C67E8","UNK_TYPE4","",0x4), - 0x801C67F0:("D_801C67F0","UNK_TYPE4","",0x4), - 0x801C67F4:("D_801C67F4","UNK_TYPE4","",0x4), + 0x801C67F0:("D_801C67F0","s32","[8]",0x20), 0x801C6818:("D_801C6818","UNK_TYPE1","",0x1), 0x801C6838:("D_801C6838","UNK_TYPE4","",0x4), 0x801C6840:("D_801C6840","UNK_TYPE1","",0x1), 0x801C6850:("D_801C6850","UNK_TYPE1","",0x1), 0x801C6870:("D_801C6870","UNK_TYPE1","",0x1), 0x801C6890:("D_801C6890","UNK_TYPE1","",0x1), - 0x801C6898:("D_801C6898","SaveInfo","",0x28), - 0x801C68C0:("D_801C68C0","SaveContext_struct2","",0x22), - 0x801C68E4:("gSaveDefaultInventory","Inventory","",0x88), - 0x801C696C:("gSaveDefaultChecksum","u16","",0x2), - 0x801C6970:("D_801C6970","SaveInfo","",0x28), - 0x801C6998:("D_801C6998","SaveContext_struct2","",0x22), - 0x801C69BC:("D_801C69BC","Inventory","",0x88), - 0x801C6A44:("D_801C6A44","u16","",0x2), + 0x801C6898:("sSaveDefaultPlayerData","SavePlayerData","",0x28), + 0x801C68C0:("sSaveDefaultItemEquips","ItemEquips","",0x22), + 0x801C68E4:("sSaveDefaultInventory","Inventory","",0x88), + 0x801C696C:("sSaveDefaultChecksum","u16","",0x2), + 0x801C6970:("sSaveDebugPlayerData","SaveInfo","",0x28), + 0x801C6998:("sSaveDebugItemEquips","ItemEquips","",0x22), + 0x801C69BC:("sSaveDebugInventory","Inventory","",0x88), + 0x801C6A44:("sSaveDebugChecksum","u16","",0x2), 0x801C6A48:("D_801C6A48","UNK_TYPE1","",0x1), 0x801C6A50:("D_801C6A50","UNK_TYPE1","",0x1), 0x801C6A58:("D_801C6A58","UNK_TYPE1","",0x1), diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index eb2f1ac4b0..2676d13ee8 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -13,6 +13,7 @@ SQ = "int" CLAMP = "int" CLOCK_TIME = "int" CURRENT_DAY = "int" +CHECK_NEWF = "int" NULL = "int" [decompme.compilers] diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 58e4703e15..78ac67dba2 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2301,30 +2301,30 @@ asm/non_matchings/code/z_vr_box_draw/func_801435A0.s,func_801435A0,0x801435A0,0x asm/non_matchings/code/z_vr_box_draw/func_80143624.s,func_80143624,0x80143624,0x11 asm/non_matchings/code/z_vr_box_draw/func_80143668.s,func_80143668,0x80143668,0xE7 asm/non_matchings/code/z_vr_box_draw/func_80143A04.s,func_80143A04,0x80143A04,0x3 -asm/non_matchings/code/z_sram_NES/func_80143A10.s,func_80143A10,0x80143A10,0x11 -asm/non_matchings/code/z_sram_NES/func_80143A54.s,func_80143A54,0x80143A54,0x1C -asm/non_matchings/code/z_sram_NES/func_80143AC4.s,func_80143AC4,0x80143AC4,0x12 -asm/non_matchings/code/z_sram_NES/func_80143B0C.s,func_80143B0C,0x80143B0C,0x29A +asm/non_matchings/code/z_sram_NES/Sram_ActivateOwl.s,Sram_ActivateOwl,0x80143A10,0x11 +asm/non_matchings/code/z_sram_NES/Sram_ClearHighscores.s,Sram_ClearHighscores,0x80143A54,0x1C +asm/non_matchings/code/z_sram_NES/Sram_ClearFlagsAtDawnOfTheFirstDay.s,Sram_ClearFlagsAtDawnOfTheFirstDay,0x80143AC4,0x12 +asm/non_matchings/code/z_sram_NES/Sram_SaveEndOfCycle.s,Sram_SaveEndOfCycle,0x80143B0C,0x29A asm/non_matchings/code/z_sram_NES/Sram_IncrementDay.s,Sram_IncrementDay,0x80144574,0x1C asm/non_matchings/code/z_sram_NES/Sram_CalcChecksum.s,Sram_CalcChecksum,0x801445E4,0x11 -asm/non_matchings/code/z_sram_NES/func_80144628.s,func_80144628,0x80144628,0x17 +asm/non_matchings/code/z_sram_NES/Sram_ResetSave.s,Sram_ResetSave,0x80144628,0x17 asm/non_matchings/code/z_sram_NES/Sram_GenerateRandomSaveFields.s,Sram_GenerateRandomSaveFields,0x80144684,0x83 asm/non_matchings/code/z_sram_NES/func_80144890.s,func_80144890,0x80144890,0x36 asm/non_matchings/code/z_sram_NES/Sram_InitDebugSave.s,Sram_InitDebugSave,0x80144968,0x4B asm/non_matchings/code/z_sram_NES/func_80144A94.s,func_80144A94,0x80144A94,0xF9 -asm/non_matchings/code/z_sram_NES/func_80144E78.s,func_80144E78,0x80144E78,0x17D +asm/non_matchings/code/z_sram_NES/Sram_OpenSave.s,Sram_OpenSave,0x80144E78,0x17D asm/non_matchings/code/z_sram_NES/func_8014546C.s,func_8014546C,0x8014546C,0x8B asm/non_matchings/code/z_sram_NES/func_80145698.s,func_80145698,0x80145698,0x4D asm/non_matchings/code/z_sram_NES/func_801457CC.s,func_801457CC,0x801457CC,0x36D asm/non_matchings/code/z_sram_NES/func_80146580.s,func_80146580,0x80146580,0x2A asm/non_matchings/code/z_sram_NES/func_80146628.s,func_80146628,0x80146628,0x11E -asm/non_matchings/code/z_sram_NES/func_80146AA0.s,func_80146AA0,0x80146AA0,0xD6 +asm/non_matchings/code/z_sram_NES/Sram_InitSave.s,Sram_InitSave,0x80146AA0,0xD6 asm/non_matchings/code/z_sram_NES/func_80146DF8.s,func_80146DF8,0x80146DF8,0x12 -asm/non_matchings/code/z_sram_NES/func_80146E40.s,func_80146E40,0x80146E40,0xC +asm/non_matchings/code/z_sram_NES/Sram_InitSram.s,Sram_InitSram,0x80146E40,0xC asm/non_matchings/code/z_sram_NES/Sram_Alloc.s,Sram_Alloc,0x80146E70,0x13 asm/non_matchings/code/z_sram_NES/func_80146EBC.s,func_80146EBC,0x80146EBC,0xB -asm/non_matchings/code/z_sram_NES/func_80146EE8.s,func_80146EE8,0x80146EE8,0x1D -asm/non_matchings/code/z_sram_NES/func_80146F5C.s,func_80146F5C,0x80146F5C,0x2B +asm/non_matchings/code/z_sram_NES/Sram_SaveSpecialEnterClockTown.s,Sram_SaveSpecialEnterClockTown,0x80146EE8,0x1D +asm/non_matchings/code/z_sram_NES/Sram_SaveSpecialNewDay.s,Sram_SaveSpecialNewDay,0x80146F5C,0x2B asm/non_matchings/code/z_sram_NES/func_80147008.s,func_80147008,0x80147008,0x6 asm/non_matchings/code/z_sram_NES/func_80147020.s,func_80147020,0x80147020,0x12 asm/non_matchings/code/z_sram_NES/func_80147068.s,func_80147068,0x80147068,0x34