summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2023-08-06 18:52:38 -0700
committerGitHub <noreply@github.com>2023-08-06 18:52:38 -0700
commit2ebab6f49fab270672082bafcee79c895ee78f1b (patch)
tree5db2aceb19b59c0275b86f7386c704ef63cf5463 /src
parent8a294a49b68212a111d3fa2b25a80698eeb94051 (diff)
parent758ec0722cee29ff94c415575a27ad5f5aea344d (diff)
Merge pull request #620 from Henny022p/savefile
SaveFile cleanup
Diffstat (limited to 'src')
-rw-r--r--src/affine.c2
-rw-r--r--src/beanstalkSubtask.c4
-rw-r--r--src/code_0805EC04.c2
-rw-r--r--src/color.c2
-rw-r--r--src/enemy/vaatiWrath.c4
-rw-r--r--src/enemyUtils.c2
-rw-r--r--src/game.c2
-rw-r--r--src/gameUtils.c57
-rw-r--r--src/item/itemJarEmpty.c32
-rw-r--r--src/itemUtils.c2
-rw-r--r--src/kinstone.c5
-rw-r--r--src/manager/rollingBarrelManager.c2
-rw-r--r--src/manager/vaati3StartManager.c2
-rw-r--r--src/menu/figurineMenu.c4
-rw-r--r--src/menu/pauseMenu.c29
-rw-r--r--src/menu/pauseMenuScreen6.c2
-rw-r--r--src/npc/bigGoron.c2
-rw-r--r--src/npc/forestMinish.c4
-rw-r--r--src/npc/sittingPerson.c2
-rw-r--r--src/npc/stockwell.c6
-rw-r--r--src/object/bigBarrel.c4
-rw-r--r--src/object/figurineDevice.c42
-rw-r--r--src/player.c2
-rw-r--r--src/playerUtils.c15
-rw-r--r--src/roomInit.c31
-rw-r--r--src/subtask.c19
-rw-r--r--src/subtask/subtaskFastTravel.c2
-rw-r--r--src/subtask/subtaskMapHint.c2
-rw-r--r--src/title.c4
-rw-r--r--src/ui.c3
30 files changed, 143 insertions, 148 deletions
diff --git a/src/affine.c b/src/affine.c
index eb114665..04c0be86 100644
--- a/src/affine.c
+++ b/src/affine.c
@@ -53,7 +53,7 @@ void CopyOAM(void) {
void DrawEntities(void) {
void (*fn)(void);
- gOAMControls._0[6] = gRoomTransition.field_0x2c[2] ? 15 : 0;
+ gOAMControls._0[6] = gRoomTransition.field2f ? 15 : 0;
gOAMControls._4 = gRoomControls.aff_x + gRoomControls.scroll_x;
gOAMControls._6 = gRoomControls.aff_y + gRoomControls.scroll_y;
gOAMControls.field_0x1++;
diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c
index f1f85a4a..89e2f40c 100644
--- a/src/beanstalkSubtask.c
+++ b/src/beanstalkSubtask.c
@@ -1024,7 +1024,7 @@ void sub_0801AE44(bool32 loadGfx) {
}
sub_080809D4();
UpdateIsDiggingCave();
- if (gRoomTransition.field_0x2c[0] != 0) {
+ if (gRoomTransition.field2d != 0) {
sub_0807C898();
}
if (gArea.lightType != 0) {
@@ -1061,7 +1061,7 @@ void SetMultipleTiles(const TileData* tileData, u32 basePosition, u32 layer) {
// Add a new entry at the end of gUnk_0200B240
void sub_0801AF48(u32 data, u32 position, u32 layer) {
u32 index;
- if ((data < 0x4000) && (gRoomTransition.field_0x2c[3] == 0)) {
+ if ((data < 0x4000) && (gRoomTransition.field30 == 0)) {
index = gRoomVars.unk_0e;
if (index < 0x100) {
gUnk_0200B240[index].data = data;
diff --git a/src/code_0805EC04.c b/src/code_0805EC04.c
index c3a7bdbd..01fa2d32 100644
--- a/src/code_0805EC04.c
+++ b/src/code_0805EC04.c
@@ -183,7 +183,7 @@ u32 ConvInputToState(u32 keys) {
}
void sub_0805EE88(void) {
- if ((gRoomTransition.field_0x2c[2] != 0) && ((gRoomTransition.frameCount & 3) == 0)) {
+ if ((gRoomTransition.field2f != 0) && ((gRoomTransition.frameCount & 3) == 0)) {
LoadPaletteGroup((((u32)gRoomTransition.frameCount & 0xc) >> 2) + 0x2f);
}
}
diff --git a/src/color.c b/src/color.c
index 78cb5a11..8df8a607 100644
--- a/src/color.c
+++ b/src/color.c
@@ -54,7 +54,7 @@ void sub_0801D000(u32 a1) {
tmp = 0;
}
- roomTransition->field_0x2c[2] = tmp;
+ roomTransition->field2f = tmp;
if (a1) {
CleanUpObjPalettes();
sub_0801CFD0(0xf);
diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c
index b7c9fd3a..7a0af279 100644
--- a/src/enemy/vaatiWrath.c
+++ b/src/enemy/vaatiWrath.c
@@ -998,8 +998,8 @@ void sub_0804235C(Entity* this) {
void VaatiWrathType0PreAction(Entity* this) {
int temp;
if ((gRoomTransition.field_0x38 & 2) == 0) {
- if (gSave.timers[3] != 0) {
- gSave.timers[3]--;
+ if (gSave.vaati_timer != 0) {
+ gSave.vaati_timer--;
} else {
temp = gPlayerState.framestate_last;
switch (temp) {
diff --git a/src/enemyUtils.c b/src/enemyUtils.c
index d484865a..05d59a98 100644
--- a/src/enemyUtils.c
+++ b/src/enemyUtils.c
@@ -192,7 +192,7 @@ void CreateDeathFx(GenericEntity* parent, u32 parentId, u32 fixedItem) {
int tmp = parent->base.gustJarState & 2;
if (tmp == 0) {
sub_08049CF4(&(parent->base));
- gSave.unk50++;
+ gSave.enemies_killed++;
parent->base.gustJarState |= 2;
parent->base.timer = 255;
SetDefaultPriority(&(parent->base), 3);
diff --git a/src/game.c b/src/game.c
index 206b9ef2..e1a0822f 100644
--- a/src/game.c
+++ b/src/game.c
@@ -229,7 +229,7 @@ static void GameMain_ChangeRoom(void) {
sub_0801855C();
}
#elif defined(DEMO_JP)
- if (gRoomTransition.field_0x2c[4])
+ if (gRoomTransition.field31)
CheckAreaDiscovery();
if (gArea.unk28.textBaseIndex != 0xff) {
sub_0801855C();
diff --git a/src/gameUtils.c b/src/gameUtils.c
index eb2eb7fb..d4543147 100644
--- a/src/gameUtils.c
+++ b/src/gameUtils.c
@@ -25,8 +25,8 @@
u32 StairsAreValid(void);
void ClearFlagArray(const u16*);
void DummyHandler(u32* a1);
-void sub_08053434(u32* a1);
-void sub_080534E4(u32* a1);
+void DarknutTimerHandler(u32* a1);
+void BiggoronTimerHandler(u32* a1);
void InitAllRoomResInfo(void);
void InitRoomResInfo(RoomResInfo* info, RoomHeader* hdr, u32 area, u32 room);
void sub_080532E4(void);
@@ -207,7 +207,7 @@ s32 ModHealth(s32 delta) {
newHealth = 0;
}
if (stats->maxHealth < newHealth) {
- newHealth = (u32)stats->maxHealth;
+ newHealth = stats->maxHealth;
}
stats->health = newHealth;
gPlayerEntity.health = newHealth;
@@ -448,16 +448,10 @@ bool32 CanDispEzloMessage(void) {
void DisplayEzloMessage(void) {
u32 height;
u32 idx;
-#if defined(JP) || defined(EU)
- idx = 0x10;
-#else
- idx = 0x11;
-#endif
-
- if (gRoomTransition.player_status.field_0x24[idx] == 0) {
+ if (gRoomTransition.hint_height == 0) {
height = gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y > 96 ? 1 : 13;
} else {
- height = gRoomTransition.player_status.field_0x24[idx];
+ height = gRoomTransition.hint_height;
}
MessageAtHeight(gRoomTransition.hint_idx, height);
}
@@ -466,11 +460,11 @@ void DisplayEzloMessage(void) {
void CreateMiscManager(void) {
Entity* e = NULL;
- if (gRoomTransition.player_status.field_0x24[13])
+ if (gRoomTransition.field31)
return;
- gRoomTransition.player_status.field_0x24[13] = 1;
+ gRoomTransition.field31 = 1;
#ifndef DEMO_JP
- gRoomTransition.player_status.field_0x24[10] = gArea.locationIndex;
+ gRoomTransition.location = gArea.locationIndex;
#endif
e = (Entity*)GetEmptyManager();
if (e == NULL)
@@ -714,7 +708,7 @@ u32 sub_08053144(void) {
return 0;
ret = 0;
if (gArea.locationIndex != 0)
- ret = !!(gRoomTransition.player_status.field_0x24[10] ^ gArea.locationIndex);
+ ret = !!(gRoomTransition.location ^ gArea.locationIndex);
return ret;
}
@@ -722,7 +716,7 @@ void CheckAreaDiscovery(void) {
if (!sub_08053144())
return;
- gRoomTransition.player_status.field_0x24[10] = gArea.locationIndex;
+ gRoomTransition.location = gArea.locationIndex;
if (!CheckGlobalFlag(TABIDACHI))
return;
@@ -772,7 +766,7 @@ void sub_0805329C(void) {
if (sub_08053144()) {
switch (gRoomControls.area) {
case AREA_DEEPWOOD_SHRINE:
- gSave.unk7 = 0;
+ gSave.dws_barrel_state = 0;
break;
case AREA_CAVE_OF_FLAMES:
sub_080530B0();
@@ -837,24 +831,25 @@ void sub_080533CC(void) {
void UpdateTimerCallbacks(void) {
static void (*const sHandlers[])(u32*) = {
- sub_08053434, DummyHandler, sub_080534E4, DummyHandler, DummyHandler, DummyHandler, DummyHandler, DummyHandler,
+ DarknutTimerHandler, DummyHandler, BiggoronTimerHandler, DummyHandler,
+ DummyHandler, DummyHandler, DummyHandler, DummyHandler,
};
u32* p;
u32 i;
- p = gSave.timers;
+ p = &gSave.darknut_timer;
for (i = 0; i < 8; i++, p++) {
(sHandlers[i])(p);
}
}
-void DummyHandler(u32* a1) {
+void DummyHandler(u32* timer) {
}
-void sub_08053434(u32* a1) {
- if (gArea.locationIndex == 29 && *a1) {
- if (!--*a1) {
+void DarknutTimerHandler(u32* timer) {
+ if (gArea.locationIndex == 29 && *timer) {
+ if (!--*timer) {
ResetTimerFlags();
MenuFadeIn(5, 6);
}
@@ -876,33 +871,31 @@ void ResetTimerFlags(void) {
0xFFFF,
};
- gSave.timers[0] = 0;
+ gSave.darknut_timer = 0;
if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_ZELDA_DISCURSE))
ClearGlobalFlag(ZELDA_CHASE);
ClearFlagArray(sClearFlags);
}
void StartDarkNutTimer(void) {
- gSave.timers[0] = 10800;
+ gSave.darknut_timer = 10800;
}
void sub_080534AC(void) {
if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START)) {
ClearLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START);
- gSave.timers[0] = 0;
+ gSave.darknut_timer = 0;
SoundReq(SONG_STOP_BGM);
}
}
-void sub_080534E4(u32* a1) {
- if (gRoomControls.area != AREA_VEIL_FALLS_TOP) {
- if (*a1)
- --*a1;
- }
+void BiggoronTimerHandler(u32* timer) {
+ if (gRoomControls.area != AREA_VEIL_FALLS_TOP && *timer)
+ --*timer;
}
void InitBiggoronTimer(void) {
- gSave.timers[2] = 36000;
+ gSave.biggoron_timer = 36000;
}
void ResetTmpFlags(void) {
diff --git a/src/item/itemJarEmpty.c b/src/item/itemJarEmpty.c
index 60997922..cf4b06ec 100644
--- a/src/item/itemJarEmpty.c
+++ b/src/item/itemJarEmpty.c
@@ -24,30 +24,30 @@ void sub_08077534(ItemBehavior* this, u32 index) {
sub_08077BB8(this);
this->priority |= 0xf;
tmp = this->behaviorId;
- this->timer = gSave.filler86[tmp + 0x14];
+ this->timer = gSave.stats.bottles[tmp - ITEM_BOTTLE1];
switch (this->timer) {
- case 0x20:
+ case ITEM_BOTTLE_EMPTY:
SetItemAnim(this, 0x614);
return;
- case 0x21:
- case 0x22:
- case 0x23:
- case 0x24:
- case 0x25:
- case 0x29:
- case 0x2a:
- case 0x2b:
- case 0x2c:
- case 0x2d:
- case 0x2e:
+ case ITEM_BOTTLE_BUTTER:
+ case ITEM_BOTTLE_MILK:
+ case ITEM_BOTTLE_HALF_MILK:
+ case ITEM_BOTTLE_RED_POTION:
+ case ITEM_BOTTLE_BLUE_POTION:
+ case ITEM_BOTTLE_PICOLYTE_RED:
+ case ITEM_BOTTLE_PICOLYTE_ORANGE:
+ case ITEM_BOTTLE_PICOLYTE_YELLOW:
+ case ITEM_BOTTLE_PICOLYTE_GREEN:
+ case ITEM_BOTTLE_PICOLYTE_BLUE:
+ case ITEM_BOTTLE_PICOLYTE_WHITE:
this->stateID = 3;
gPlayerEntity.animationState = 4;
gPlayerEntity.spriteSettings.flipX = 0;
SetItemAnim(this, 0x2df);
break;
- case 0x2f:
- case 0x30:
- case 0x31:
+ case BOTTLE_CHARM_NAYRU:
+ case BOTTLE_CHARM_FARORE:
+ case BOTTLE_CHARM_DIN:
default:
this->stateID = 3;
SetItemAnim(this, 0x610);
diff --git a/src/itemUtils.c b/src/itemUtils.c
index 72cd7608..9436621f 100644
--- a/src/itemUtils.c
+++ b/src/itemUtils.c
@@ -385,7 +385,7 @@ void sub_08054524(void) {
bVar1 = gArea.locationIndex;
if (gArea.locationIndex == 0) {
- bVar1 = gRoomTransition.player_status.field_0x24[0xa];
+ bVar1 = gRoomTransition.location;
}
if (bVar1 > 0x16) {
bVar1 = 0;
diff --git a/src/kinstone.c b/src/kinstone.c
index 1dff20c6..71a93a7b 100644
--- a/src/kinstone.c
+++ b/src/kinstone.c
@@ -179,12 +179,7 @@ void GenerateAreaHint(void) {
struct_area_28* ptr;
gPlayerState.queued_action = PLAYER_TALKEZLO;
-#if defined(EU) || defined(JP)
- // TODO what fields of the room transition are switched in these variants?
- gRoomTransition.field_0x2c[7] = 0;
-#else
gRoomTransition.hint_height = 0;
-#endif
ptr = &gArea.unk28;
if (ptr->textBaseIndex == 0xff) {
gRoomTransition.hint_idx = ptr->ezloHintTexts[0];
diff --git a/src/manager/rollingBarrelManager.c b/src/manager/rollingBarrelManager.c
index 3b1d6d41..20c8b3f1 100644
--- a/src/manager/rollingBarrelManager.c
+++ b/src/manager/rollingBarrelManager.c
@@ -192,7 +192,7 @@ void sub_08058B5C(RollingBarrelManager* this, u32 unk1) {
gRoomTransition.player_status.start_anim = unk1 & 1 ? 4 : 0;
gRoomTransition.player_status.start_pos_x = gUnk_081082E8[unk1 * 3];
gRoomTransition.player_status.start_pos_y = gUnk_081082E8[unk1 * 3 + 1];
- gSave.unk7 = gUnk_081082E8[unk1 * 3 + 2];
+ gSave.dws_barrel_state = gUnk_081082E8[unk1 * 3 + 2];
SoundReq(SFX_STAIRS);
}
diff --git a/src/manager/vaati3StartManager.c b/src/manager/vaati3StartManager.c
index 9a57b25a..6d1c666d 100644
--- a/src/manager/vaati3StartManager.c
+++ b/src/manager/vaati3StartManager.c
@@ -54,7 +54,7 @@ void Vaati3StartManager_Type0_Init(Vaati3StartManager* this) {
*(u8*)&gRoomTransition.field_0x3a = 0x20;
*((u8*)&gRoomTransition.field_0x3a + 1) = 0x20;
#if !defined(EU) && !defined(JP)
- gSave.timers[3] = 0x1194;
+ gSave.vaati_timer = 0x1194;
#endif
}
diff --git a/src/menu/figurineMenu.c b/src/menu/figurineMenu.c
index 2a19f06d..b6dcf8b0 100644
--- a/src/menu/figurineMenu.c
+++ b/src/menu/figurineMenu.c
@@ -147,7 +147,7 @@ void FigurineMenu0_Type2(void) {
gFigurineMenu.unk20++;
switch (gFigurineMenu.unk20) {
case 0x40:
- gFigurineMenu.duplicate = WriteBit(&gSave.stats.filler4[4], gFigurineMenu.figure_idx);
+ gFigurineMenu.duplicate = WriteBit(gSave.figurines, gFigurineMenu.figure_idx);
gMenu.column_idx = 1;
default:
bVar1 = gFigurineMenu.unk20 >> 2;
@@ -285,7 +285,7 @@ u32 sub_080A4948(s32 param_1) {
uVar2 = 0;
iVar1 = !gSave.saw_staffroll ? 0x82 : 0x88;
if ((0 < param_1) || (iVar1 >= param_1)) {
- if (ReadBit((u32*)&gSave.stats.filler4[4], param_1)) {
+ if (ReadBit((u32*)gSave.figurines, param_1)) {
uVar2 = 1;
}
}
diff --git a/src/menu/pauseMenu.c b/src/menu/pauseMenu.c
index 7561c19a..27f747d9 100644
--- a/src/menu/pauseMenu.c
+++ b/src/menu/pauseMenu.c
@@ -431,7 +431,7 @@ void PauseMenu_ItemMenu_Update(void) {
case MENU_SLOT_BOTTLE2:
case MENU_SLOT_BOTTLE3:
if (item != 0) {
- item = gSave.saved_status.field_0x24[item - 6];
+ item = gSave.stats.bottles[item - ITEM_BOTTLE1];
}
break;
case MENU_SLOT_SAVE_BUTTON:
@@ -1232,7 +1232,7 @@ bool32 sub_080A5F24(void) {
return result;
}
-void sub_080A5F48(u32 param_1, u32 param_2) {
+void sub_080A5F48(Item item, u32 param_2) {
extern u32 gSprite_082E68F4[];
u32 ammoCount;
u32 tensDigit;
@@ -1242,19 +1242,24 @@ void sub_080A5F48(u32 param_1, u32 param_2) {
u32 temp3;
register u32 rem asm("r1");
- switch (param_1) {
- case 0x1c ... 0x1f:
- param_1 = (u32)gSave.saved_status.field_0x24[param_1 - 6];
+ switch (item) {
+ case ITEM_BOTTLE1:
+ case ITEM_BOTTLE2:
+ case ITEM_BOTTLE3:
+ case ITEM_BOTTLE4:
+ item = gSave.stats.bottles[item - ITEM_BOTTLE1];
+ break;
+ default:
break;
}
temp1 = param_2 * 0x20 + 0x6010000;
- temp3 = gSpriteAnimations_322[param_1]->index;
+ temp3 = gSpriteAnimations_322[item]->index;
temp2 = &gMoreSpritePtrs[1][temp3 * 2];
DmaCopy32(3, &gMoreSpritePtrs[2][temp2[1] * 0x10], temp1, 0x40 * 4);
ammoCount = -1;
- switch (param_1) {
+ switch (item) {
case 7:
case 8:
ammoCount = gSave.stats.bombCount;
@@ -1267,12 +1272,12 @@ void sub_080A5F48(u32 param_1, u32 param_2) {
if (-1 < (int)ammoCount) {
tensDigit = Div(ammoCount, 10);
- param_1 = rem;
+ item = rem;
if ((int)tensDigit >= 10) {
tensDigit = 9;
}
DmaCopy32(3, gUnk_085C4620 + tensDigit * 0x8, temp1, 0x8 * 4);
- DmaCopy32(3, gUnk_085C4620 + (param_1 + 10) * 0x8, temp1 + 0x20, 0x8 * 4);
+ DmaCopy32(3, gUnk_085C4620 + (item + 10) * 0x8, temp1 + 0x20, 0x8 * 4);
}
}
@@ -1431,7 +1436,7 @@ void sub_080A62E0(void) {
switch (gInput.newKeys) {
case A_BUTTON:
- if ((gSave.windcrests & (1 << gMenu.field_0x3)) != 0) {
+ if (IS_BIT_SET(gSave.windcrests, gMenu.field_0x3)) {
SoundReq(SFX_TEXTBOX_SELECT);
sub_080A4E84(6);
windcrest = -1;
@@ -1495,7 +1500,7 @@ void sub_080A6438(void) {
gOamCmd._4 = 0x400;
gOamCmd._6 = 0;
gOamCmd._8 = 0;
- uVar1 = gSave.field_0x20 & gGenericMenu.unk10.h[0];
+ uVar1 = gSave.map_hints & gGenericMenu.unk10.h[0];
for (pcVar2 = gUnk_08128F58, uVar3 = 0; pcVar2->frameIndex != 0; uVar3++, pcVar2++) {
if ((1 << uVar3 & uVar1) != 0) {
gOamCmd.x = pcVar2->unk1;
@@ -1512,7 +1517,7 @@ void sub_080A6498(void) {
gOamCmd._6 = 0;
gOamCmd._8 = 0;
for (i = 0; i <= 0x10; i++) {
- if ((gSave.windcrests & (1 << i)) == 0) {
+ if (!IS_BIT_SET(gSave.windcrests, i)) {
gUnk_08128DE8_struct* ptr = &gUnk_08128DE8[i];
gOamCmd.x = ptr->unk6;
gOamCmd.y = ptr->unk7;
diff --git a/src/menu/pauseMenuScreen6.c b/src/menu/pauseMenuScreen6.c
index c9a085c9..89ef214b 100644
--- a/src/menu/pauseMenuScreen6.c
+++ b/src/menu/pauseMenuScreen6.c
@@ -196,7 +196,7 @@ void sub_080A68D4(void) {
sub_080A698C(gRoomTransition.player_status.overworld_map_x, gRoomTransition.player_status.overworld_map_y,
DRAW_DIRECT_SPRITE_INDEX, iVar6 + 0x100);
uVar1 = sub_080A6F40();
- uVar1 &= gSave.field_0x20;
+ uVar1 &= gSave.map_hints;
for (pcVar4 = gUnk_08128F58, i = 0; pcVar4->frameIndex != 0; i++, pcVar4++) {
if (((1 << i) & uVar1) != 0) {
diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c
index 2e3c3c11..a0e2c729 100644
--- a/src/npc/bigGoron.c
+++ b/src/npc/bigGoron.c
@@ -440,7 +440,7 @@ void sub_0806D5D4(void) {
}
void sub_0806D600(Entity* this, ScriptExecutionContext* context) {
- context->condition = gSave.timers[2] == 0;
+ context->condition = gSave.biggoron_timer == 0;
}
void sub_0806D620(void) {
diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c
index 2392515b..a920ccbb 100644
--- a/src/npc/forestMinish.c
+++ b/src/npc/forestMinish.c
@@ -723,13 +723,13 @@ void sub_08060318(void) {
}
void sub_08060340(void) {
- gSave.timers[1] = gSave.unk50;
+ gSave.drug_kill_count = gSave.enemies_killed;
}
u32 sub_08060354(void) {
s32 iVar2;
- iVar2 = gSave.unk50 - gSave.timers[1];
+ iVar2 = gSave.enemies_killed - gSave.drug_kill_count;
if (CheckGlobalFlag(DRUG_1) == 0) {
if (4 < iVar2) {
return 0x8444;
diff --git a/src/npc/sittingPerson.c b/src/npc/sittingPerson.c
index b972962c..f98a036a 100644
--- a/src/npc/sittingPerson.c
+++ b/src/npc/sittingPerson.c
@@ -197,7 +197,7 @@ void sub_0806387C(Entity* this) {
if (CheckLocalFlag(SHOP05_OPEN) == 0) {
r5 = 0;
for (r4 = 1; r4 <= 0x82; r4++) {
- if (ReadBit(&gSave.stats.filler4[4], r4)) {
+ if (ReadBit(gSave.figurines, r4)) {
r5++;
}
}
diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c
index e327cda9..f8fd11ed 100644
--- a/src/npc/stockwell.c
+++ b/src/npc/stockwell.c
@@ -264,11 +264,11 @@ void sub_08065370(Entity* this, ScriptExecutionContext* context) {
if (localFlag) {
SetLocalFlag(localFlag);
}
- if (gSave.unk5C <= ~1u) {
- gSave.unk5C++;
+ if (gSave.items_bought <= ~1u) {
+ gSave.items_bought++;
}
- if (gSave.unk5C >= 10) {
+ if (gSave.items_bought >= 10) {
context->intVariable = TEXT_INDEX(TEXT_STOCKWELL, 0x11);
} else {
if (itemPrice >= 100) {
diff --git a/src/object/bigBarrel.c b/src/object/bigBarrel.c
index 2ecc63be..e1515106 100644
--- a/src/object/bigBarrel.c
+++ b/src/object/bigBarrel.c
@@ -53,9 +53,9 @@ void BigBarrel_Type0(BigBarrelEntity* this) {
super->spriteSettings.draw = 3;
super->updatePriority = 3;
if (CheckGlobalFlag(LV1TARU_OPEN)) {
- super->frameIndex = gSave.unk7 + 1;
+ super->frameIndex = gSave.dws_barrel_state + 1;
} else {
- super->frameIndex = gSave.unk7;
+ super->frameIndex = gSave.dws_barrel_state;
}
sub_08088BE0(this);
if (CheckPlayerInRegion(super->x.HALF.HI - gRoomControls.origin_x, super->y.HALF.HI - gRoomControls.origin_y,
diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c
index 927d74ad..7cdfc32c 100644
--- a/src/object/figurineDevice.c
+++ b/src/object/figurineDevice.c
@@ -473,13 +473,13 @@ void sub_080880D8(FigurineDeviceEntity* this) {
it++;
}
if (++this->unk_7b == 4) {
- if (gSave.field_0x9[0] != this->unk_80) {
- if (gSave.field_0x9[0] != 0) {
+ if (gSave.available_figurines != this->unk_80) {
+ if (gSave.available_figurines != 0) {
SetRoomFlag(6);
}
- gSave.field_0x9[0] = this->unk_80;
+ gSave.available_figurines = this->unk_80;
}
- if (CheckLocalFlag(SHOP07_COMPLETE) && (this->unk_80 != gSave.stats.filler[0])) {
+ if (CheckLocalFlag(SHOP07_COMPLETE) && (this->unk_80 != gSave.stats.figurineCount)) {
ClearLocalFlag(SHOP07_COMPLETE);
}
}
@@ -563,7 +563,7 @@ END_NONMATCH
void sub_0808826C(FigurineDeviceEntity* this) {
s32 tmp = 0x64;
- tmp *= ((this->unk_80 - gSave.stats.filler[0]));
+ tmp *= ((this->unk_80 - gSave.stats.figurineCount));
tmp = tmp / this->unk_80;
if (tmp == 0 && !CheckLocalFlag(SHOP07_COMPLETE)) {
tmp = 1;
@@ -625,7 +625,7 @@ void sub_08088328(FigurineDeviceEntity* this) {
if (uVar6 > 0x88) {
uVar6 = 1;
}
- if (sub_08088160(this, uVar6) && ReadBit(&gSave.stats.filler4[4], uVar6) == 0) {
+ if (sub_08088160(this, uVar6) && ReadBit(gSave.figurines, uVar6) == 0) {
uVar2 = TRUE;
} else {
uVar6++;
@@ -639,7 +639,7 @@ void sub_08088328(FigurineDeviceEntity* this) {
if (uVar6 > 0x88) {
uVar6 = 1;
}
- if (sub_08088160(this, uVar6) && ReadBit(&gSave.stats.filler4[4], uVar6) != 0) {
+ if (sub_08088160(this, uVar6) && ReadBit(gSave.figurines, uVar6) != 0) {
uVar2 = FALSE;
} else {
uVar6++;
@@ -647,8 +647,8 @@ void sub_08088328(FigurineDeviceEntity* this) {
} while (uVar5 != uVar6);
}
if (uVar2) {
- gSave.stats.filler[0]++;
- if (gSave.stats.filler[0] != this->unk_80) {
+ gSave.stats.figurineCount++;
+ if (gSave.stats.figurineCount != this->unk_80) {
SetRoomFlag(7);
} else {
SetLocalFlag(SHOP07_COMPLETE);
@@ -660,15 +660,15 @@ void sub_08088328(FigurineDeviceEntity* this) {
}
void sub_08088424(FigurineDeviceEntity* this) {
- if (gSave.stats.filler[0] < 0x32) {
+ if (gSave.stats.figurineCount < 50) {
if (this->unk_83 < 0x0f) {
this->unk_83 = 0x0f;
}
- } else if (gSave.stats.filler[0] < 0x50) {
+ } else if (gSave.stats.figurineCount < 80) {
if (this->unk_83 < 0xc) {
this->unk_83 = 0xc;
}
- } else if (gSave.stats.filler[0] < 0x6e) {
+ } else if (gSave.stats.figurineCount < 110) {
if (this->unk_83 < 9) {
this->unk_83 = 9;
}
@@ -690,12 +690,12 @@ void sub_08088478(void) {
messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x25);
}
} else {
- switch (gSave.stats.filler[0]) {
- case 0x88:
- gSave.stats.filler[1] = 0xff;
+ switch (gSave.stats.figurineCount) {
+ case 136:
+ gSave.stats._hasAllFigurines = 0xff;
messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x29);
break;
- case 0x82:
+ case 130:
if (gSave.saw_staffroll) {
messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x27);
} else {
@@ -719,11 +719,11 @@ void sub_08088478(void) {
void sub_08088504(void) {
u32 index;
- switch (gSave.stats.filler[0]) {
- case 0x88:
+ switch (gSave.stats.figurineCount) {
+ case 136:
index = TEXT_INDEX(TEXT_CARLOV, 0x2f);
break;
- case 0x82:
+ case 130:
index = TEXT_INDEX(TEXT_CARLOV, 0x14);
break;
default:
@@ -737,7 +737,7 @@ void sub_08088504(void) {
void sub_08088544(void) {
u32 index;
- if (gSave.stats.filler[0] != 0x82) {
+ if (gSave.stats.figurineCount != 130) {
index = TEXT_INDEX(TEXT_CARLOV, 0xe);
} else {
index = TEXT_INDEX(TEXT_CARLOV, 0x15);
@@ -775,7 +775,7 @@ void sub_080885B0(void) {
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0xc;
}
- } else if (gSave.stats.filler[1] != 0) {
+ } else if (gSave.stats._hasAllFigurines != 0) {
// GOT ALL THEM FIGURINES (:
gSave.stats.hasAllFigurines = 1;
CreateItemEntity(ITEM_QST_CARLOV_MEDAL, 0, 0);
diff --git a/src/player.c b/src/player.c
index 2d50b1f8..b22572a3 100644
--- a/src/player.c
+++ b/src/player.c
@@ -282,7 +282,7 @@ extern ScriptExecutionContext gPlayerScriptExecutionContext;
bool32 CheckInitPauseMenu(void) {
u32 framestate;
if (((gInput.newKeys & START_BUTTON) == 0 || gFadeControl.active || gPauseMenuOptions.disabled ||
- (gMessage.doTextBox & 0x7F) || gSave.stats.health == 0 || !gSave.fillerD0[34] ||
+ (gMessage.doTextBox & 0x7F) || gSave.stats.health == 0 || !gSave.inventory[0] ||
gPlayerState.controlMode != 0 || gPriorityHandler.priority_timer != 0)) {
return FALSE;
}
diff --git a/src/playerUtils.c b/src/playerUtils.c
index 3515748c..7514488c 100644
--- a/src/playerUtils.c
+++ b/src/playerUtils.c
@@ -1288,12 +1288,7 @@ void SetPlayerControl(PlayerControlMode mode) {
void CreateEzloHint(u32 hintId, u32 hintHeight) {
gPlayerState.queued_action = PLAYER_TALKEZLO;
gRoomTransition.hint_idx = hintId;
-#if defined(EU) || defined(JP)
- // TODO what fields of the room transition are switched in these variants?
- gRoomTransition.field_0x2c[7] = hintHeight;
-#else
gRoomTransition.hint_height = hintHeight;
-#endif
}
void sub_08078AC0(u32 param_1, u32 param_2, u32 param_3) {
@@ -3509,10 +3504,10 @@ void LoadRoomGfx(void) {
MemClear(gMapBottom.mapData, sizeof(gMapBottom.mapData));
tmp = TRUE;
}
- if (gRoomTransition.field_0x2c[0] == 0) {
+ if (gRoomTransition.field2d == 0) {
MemCopy(gMapBottom.mapData, gMapBottom.mapDataClone, sizeof(gMapBottom.mapData));
MemCopy(gMapTop.mapData, gMapTop.mapDataClone, sizeof(gMapBottom.mapData));
- } else if (gRoomTransition.field_0x2c[0] == 2) {
+ } else if (gRoomTransition.field2d == 2) {
MemCopy(gMapBottom.mapData, gMapBottom.unkData3, 0x1000);
MemCopy(gMapBottom.mapDataClone, gMapBottom.mapData, 0x1000);
MemCopy(gMapBottom.unkData3, gMapBottom.mapDataClone, 0x1000);
@@ -3844,15 +3839,15 @@ void sub_0807C810(void) {
* This function is used to create a copy of the map data for temporary cutscene changes.
*/
void CloneMapData(void) {
- gRoomTransition.field_0x2c[0] = 1;
+ gRoomTransition.field2d = 1;
MemCopy(&gMapBottom.mapData, &gMapBottom.mapDataClone, 0x2000);
MemCopy(&gMapTop.mapData, &gMapTop.mapDataClone, 0x2000);
}
void sub_0807C898(void) {
- gRoomTransition.field_0x2c[0] = 2;
+ gRoomTransition.field2d = 2;
LoadRoomGfx();
- gRoomTransition.field_0x2c[0] = 0;
+ gRoomTransition.field2d = 0;
}
ASM_FUNC("asm/non_matching/playerUtils/sub_0807C8B0.inc", void sub_0807C8B0(u16* a, u32 b, u32 c))
diff --git a/src/roomInit.c b/src/roomInit.c
index 51b92921..bbe55eae 100644
--- a/src/roomInit.c
+++ b/src/roomInit.c
@@ -13,6 +13,7 @@
#include "screen.h"
#include "screenTransitions.h"
#include "sound.h"
+#include "windcrest.h"
extern u32 sub_08060354(void);
extern void sub_08057E64(void);
@@ -1219,7 +1220,7 @@ void sub_StateChange_CastorWilds_Main(void) {
if (CheckKinstoneFused(KINSTONE_5B))
LoadRoomEntityList(&gUnk_080D9CC8);
- if ((gSave.windcrests & 0x20000000) == 0)
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_CASTOR_WILDS))
LoadRoomEntityList(&gUnk_080D9CE8);
if (!GetInventoryValue(ITEM_PEGASUS_BOOTS))
@@ -1227,7 +1228,7 @@ void sub_StateChange_CastorWilds_Main(void) {
}
void sub_unk1_CastorWilds_Main(void) {
- if ((gSave.windcrests & 0x20000000) == 0)
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_CASTOR_WILDS))
LoadRoomEntityList(&gUnk_080D9CE8);
}
@@ -2003,13 +2004,13 @@ u32 sub_unk3_CloudTops_House(void) {
extern EntityData gUnk_080DD364;
void sub_StateChange_CloudTops_House(void) {
- if (!(gSave.windcrests & 0x4000000)) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_CLOUD_TOPS)) {
LoadRoomEntityList(&gUnk_080DD364);
}
}
void sub_unk1_CloudTops_House(void) {
- if (!(gSave.windcrests & 0x4000000)) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_CLOUD_TOPS)) {
LoadRoomEntityList(&gUnk_080DD364);
}
}
@@ -2187,7 +2188,7 @@ u32 sub_unk3_DeepwoodShrine_Barrel(void) {
}
void sub_StateChange_DeepwoodShrine_Barrel(void) {
- switch (gSave.unk7) {
+ switch (gSave.dws_barrel_state) {
case 0:
default:
SetTileType(0x90, 0x20b, 1);
@@ -4420,7 +4421,7 @@ void sub_StateChange_HyruleTown_0(void) {
if ((gSave.global_progress < 6) && !CheckGlobalFlag(MIZUKAKI_START)) {
LoadRoomEntityList(&gUnk_080EEA9C);
}
- if ((gSave.windcrests & 0x8000000) == 0) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_HYRULE_TOWN)) {
LoadRoomEntityList(&gUnk_080EEBAC);
}
sub_0804E150();
@@ -4428,7 +4429,7 @@ void sub_StateChange_HyruleTown_0(void) {
}
void sub_unk1_HyruleTown_8(void) {
- if ((gSave.windcrests & 0x8000000) == 0) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_HYRULE_TOWN)) {
LoadRoomEntityList(&gUnk_080EEBAC);
}
}
@@ -5207,7 +5208,7 @@ void sub_StateChange_MinishWoods_Main(void) {
if (CheckKinstoneFused(KINSTONE_4E)) {
LoadRoomEntityList(&gUnk_080F4F10);
}
- if ((s32)gSave.windcrests > -1) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_MINISH_WOODS)) {
LoadRoomEntityList(&gUnk_080F4E10);
}
#ifdef DEMO_USA
@@ -5217,7 +5218,7 @@ void sub_StateChange_MinishWoods_Main(void) {
}
void sub_unk1_MinishWoods_Main(void) {
- if ((s32)gSave.windcrests > -1) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_MINISH_WOODS)) {
LoadRoomEntityList(&gUnk_080F4E10);
}
}
@@ -5652,7 +5653,7 @@ void sub_StateChange_HyruleField_SouthHyruleField(void) {
if (!CheckGlobalFlag(TABIDACHI)) {
gArea.queued_bgm = BGM_FESTIVAL_APPROACH;
}
- if ((gSave.windcrests & 0x40000000) == 0) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_SOUTH_HYRULE_FIELD)) {
LoadRoomEntityList(&gUnk_080F70D8);
}
if (gSave.global_progress > 3) {
@@ -5661,7 +5662,7 @@ void sub_StateChange_HyruleField_SouthHyruleField(void) {
}
void sub_unk1_HyruleField_SouthHyruleField(void) {
- if ((gSave.windcrests & 0x40000000) == 0) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_SOUTH_HYRULE_FIELD)) {
LoadRoomEntityList(&gUnk_080F70D8);
}
}
@@ -6169,13 +6170,13 @@ u32 sub_unk3_VeilFalls_Main(void) {
extern EntityData gUnk_080F9304;
void sub_StateChange_VeilFalls_Main(void) {
- if ((gSave.windcrests & 0x2000000) == 0) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_VEIL_FALLS)) {
LoadRoomEntityList(&gUnk_080F9304);
}
}
void sub_unk1_VeilFalls_Main(void) {
- if ((gSave.windcrests & 0x2000000) == 0) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_VEIL_FALLS)) {
LoadRoomEntityList(&gUnk_080F9304);
}
}
@@ -6581,7 +6582,7 @@ void sub_StateChange_MtCrenel_CaveOfFlamesEntrance(void) {
if (CheckGlobalFlag(LV2_CLEAR) && !CheckLocalFlag(LV1_CLEAR)) {
LoadRoomEntityList(&gUnk_080FAFE4);
}
- if ((gSave.windcrests & 0x1000000) == 0) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_MT_CRENEL)) {
LoadRoomEntityList(&gUnk_080FB004);
}
if (GetInventoryValue(ITEM_GREEN_SWORD)) {
@@ -6590,7 +6591,7 @@ void sub_StateChange_MtCrenel_CaveOfFlamesEntrance(void) {
}
void sub_unk1_MtCrenel_CaveOfFlamesEntrance(void) {
- if ((gSave.windcrests & 0x1000000) == 0) {
+ if (!IS_BIT_SET(gSave.windcrests, WINDCREST_MT_CRENEL)) {
LoadRoomEntityList(&gUnk_080FB004);
}
}
diff --git a/src/subtask.c b/src/subtask.c
index 6af46d94..e801bade 100644
--- a/src/subtask.c
+++ b/src/subtask.c
@@ -13,6 +13,7 @@
#include "screen.h"
#include "subtask.h"
#include "ui.h"
+#include "windcrest.h"
extern Screen gUnk_03001020;
extern u8 gPaletteBufferBackup[];
@@ -61,7 +62,7 @@ void sub_080A6F6C(u32 textIndexOrPtr) {
gScreen.bg0.yOffset = 2;
}
-void sub_080A6FB4(u32 param_1, u32 param_2) {
+void sub_080A6FB4(WindcrestID windcrest, u32 param_2) {
extern u16 gUnk_08128FF0[];
extern Font gUnk_08128FD8;
extern Font gUnk_08128FC0;
@@ -71,16 +72,20 @@ void sub_080A6FB4(u32 param_1, u32 param_2) {
textIndexOrPtr = 0;
switch (param_2) {
case 0:
- if ((gSave.windcrests & (1 << param_1)) == 0)
+ if (!IS_BIT_SET(gSave.windcrests, windcrest))
break;
case 2:
- textIndexOrPtr = gUnk_08127F94[param_1]._6;
+ // TODO this probably references later data with index param_1-24
+ textIndexOrPtr = gUnk_08127F94[windcrest]._6;
font = &gUnk_08128FC0;
break;
case 1:
- textIndexOrPtr = gUnk_08128FF0[param_1];
+ // TODO this probably references later data with index param_1-24
+ textIndexOrPtr = gUnk_08128FF0[windcrest];
font = &gUnk_08128FD8;
break;
+ default:
+ break;
}
if (gGenericMenu.unk2e.HWORD != textIndexOrPtr) {
@@ -211,7 +216,7 @@ void Subtask_FadeIn(void) {
MemCopy(gUnk_03000420, gUI.unk_2a8, sizeof(gUI.unk_2a8));
MemCopy(&gActiveScriptInfo, &gUI.activeScriptInfo, sizeof(ActiveScriptInfo));
sub_0805E958();
- gUI.unk_d = gRoomTransition.field_0x2c[2];
+ gUI.unk_d = gRoomTransition.field2f;
gUI.controlMode = gPlayerState.controlMode;
gUI.currentRoomProperties = gCurrentRoomProperties;
gUI.mapBottomBgSettings = gMapBottom.bgSettings;
@@ -234,7 +239,7 @@ void Subtask_Init(void) {
ResetPaletteTable(0);
gGFXSlots.unk0 = 1;
gUI.nextToLoad = 2; // Subtask_Update
- gRoomTransition.field_0x2c[3] = 1;
+ gRoomTransition.field30 = 1;
}
}
@@ -263,7 +268,7 @@ void Subtask_FadeOut(void) {
SetFadeInverted(gUI.fadeInTime);
}
gUI.nextToLoad = 4; // Subtask_Die
- gRoomTransition.field_0x2c[3] = 0;
+ gRoomTransition.field30 = 0;
}
}
diff --git a/src/subtask/subtaskFastTravel.c b/src/subtask/subtaskFastTravel.c
index 0f657cb7..6e4749e6 100644
--- a/src/subtask/subtaskFastTravel.c
+++ b/src/subtask/subtaskFastTravel.c
@@ -168,7 +168,7 @@ void sub_080A6E70(void) {
DrawDirect(DRAW_DIRECT_SPRITE_INDEX, frameIndex);
for (i = 0; i < 8; i++) {
- if ((gSave.windcrests & (1 << (i + 0x18))) != 0) {
+ if (IS_BIT_SET(gSave.windcrests, i + 24)) {
sub_080A6EE0(i);
DrawDirect(DRAW_DIRECT_SPRITE_INDEX, 0x5c);
}
diff --git a/src/subtask/subtaskMapHint.c b/src/subtask/subtaskMapHint.c
index 2a802f2b..201a8638 100644
--- a/src/subtask/subtaskMapHint.c
+++ b/src/subtask/subtaskMapHint.c
@@ -38,7 +38,7 @@ void Subtask_MapHint_0(void) {
gScreen.lcd.displayControl = gScreen.lcd.displayControl & 0xf7ff;
SetColor(0, gPaletteBuffer[0x51]);
val = gUnk_08128F4C[gUI.field_0x3];
- gSave.field_0x20 |= val;
+ gSave.map_hints |= val;
gGenericMenu.unk10.h[1] = val & gGenericMenu.unk10.h[0];
gGenericMenu.unk10.h[0] = 0;
gMenu.transitionTimer = 60;
diff --git a/src/title.c b/src/title.c
index 4473b24b..353604e3 100644
--- a/src/title.c
+++ b/src/title.c
@@ -72,9 +72,9 @@ static const SaveFile gDemoSave = {
.msg_speed = 1,
.brightness = 1,
.global_progress = 1,
- .field_0x20 = 0x1F,
+ .map_hints = 0x1F,
.windcrests = 0x00013780,
- .unk50 = 7,
+ .enemies_killed = 7,
.areaVisitFlags = { 0x0114C300 },
.name = "\x97\x7f\xdd",
.saved_status = {
diff --git a/src/ui.c b/src/ui.c
index 7e660167..dcc5b573 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -8,6 +8,7 @@
#include "player.h"
#include "area.h"
#include "game.h"
+#include "item.h"
extern void sub_0805ECEC(u32, u32, u32, u32);
extern u32 sub_08000E44(u32);
@@ -664,7 +665,7 @@ u32 sub_0801CC80(UIElement* element) {
u32 buttonId = (type ^ 3) != 0;
u32 itemId = gSave.stats.itemButtons[buttonId];
if (ItemIsBottle(itemId)) {
- itemId = gSave.saved_status.field_0x24[itemId - 6];
+ itemId = gSave.stats.bottles[itemId - ITEM_BOTTLE1];
}
return itemId;
}