SaveFile cleanup part 2

This commit is contained in:
Henny022p 2023-08-02 21:19:43 +02:00
parent bc22015987
commit 1e02286d2c
5 changed files with 22 additions and 21 deletions

View File

@ -353,14 +353,15 @@ typedef struct {
/*0x05*/ u8 arrowCount;
/*0x06*/ u8 bombBagType;
/*0x07*/ u8 quiverType;
/*0x08*/ u8 filler[2];
/*0x08*/ u8 figurineCount;
/*0x09*/ u8 _hasAllFigurines;
/*0x0a*/ u8 charm;
/*0x0b*/ u8 picolyteType;
/*0x0c*/ u8 itemButtons[2];
/*0x0e*/ u8 bottles[4];
/*0x12*/ u8 effect;
/*0x13*/ u8 hasAllFigurines;
/*0x14*/ u8 filler3[4];
/*0x14*/ u8 filler14[4];
/*0x18*/ u16 rupees;
/*0x1a*/ u16 shells;
/*0x1c*/ u16 charmTimer;

View File

@ -53,7 +53,7 @@ typedef struct {
/*0x05C*/ u32 items_bought; /**< number of items bought in stockwells shop */
/*0x060*/ u32 areaVisitFlags[8]; /**< Area visit flags. */
/*0x080*/ char name[FILENAME_LENGTH]; /**< Save file name. */
/*0x086*/ u8 filler86[0x2]; /**< unused filler */
/*0x086*/ u8 filler86[2]; /**< unused filler */
/*0x088*/ PlayerRoomStatus saved_status; /**< Player room status. */
/*0x0A8*/ Stats stats; /**< Player stats. */
/*0x0D0*/ u8 fillerD0[34];

View File

@ -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;

View File

@ -480,7 +480,7 @@ void sub_080880D8(FigurineDeviceEntity* this) {
}
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);
}
}
@ -564,7 +564,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;
@ -648,8 +648,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);
@ -661,15 +661,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;
}
@ -691,12 +691,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 {
@ -720,11 +720,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:
@ -738,7 +738,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);
@ -776,7 +776,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);

View File

@ -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;
}