Fix some frontier gfx, adjacent cleanup

This commit is contained in:
GriffinR
2023-07-31 20:00:34 -04:00
parent da238562f0
commit 16c0be7ed2
17 changed files with 428 additions and 612 deletions
+4 -4
View File
@@ -3175,7 +3175,7 @@ void CalcApprenticeChecksum(struct Apprentice *apprentice)
s32 i;
apprentice->checksum = 0;
for (i = 0; i < (sizeof(struct Apprentice) - 4) / 4; i++)
for (i = 0; i < offsetof(struct Apprentice, checksum) / sizeof(u32); i++)
apprentice->checksum += ((u32 *)apprentice)[i];
}
@@ -3183,7 +3183,7 @@ static void ClearApprentice(struct Apprentice *apprentice)
{
s32 i;
for (i = 0; i < (sizeof(struct Apprentice)) / 4; i++)
for (i = 0; i < sizeof(struct Apprentice) / sizeof(u32); i++)
((u32 *)apprentice)[i] = 0;
ResetApprenticeStruct(apprentice);
}
@@ -3196,7 +3196,7 @@ static void ValidateApprenticesChecksums(void)
{
u32 *data = (u32 *) &gSaveBlock2Ptr->apprentices[i];
u32 checksum = 0;
for (j = 0; j < (sizeof(struct Apprentice) - 4) / 4; j++)
for (j = 0; j < offsetof(struct Apprentice, checksum) / sizeof(u32); j++)
checksum += data[j];
if (gSaveBlock2Ptr->apprentices[i].checksum != checksum)
ClearApprentice(&gSaveBlock2Ptr->apprentices[i]);
@@ -3506,7 +3506,7 @@ bool32 ValidateBattleTowerRecord(u8 recordId) // unused
u32 *record = (u32 *)(&gSaveBlock2Ptr->frontier.towerRecords[recordId]);
u32 checksum = 0;
u32 hasData = 0;
for (i = 0; i < (sizeof(struct EmeraldBattleTowerRecord) - 4) / 4; i++) // - 4, because of the last fjeld bejng the checksum jtself.
for (i = 0; i < offsetof(struct EmeraldBattleTowerRecord, checksum) / sizeof(u32); i++)
{
checksum += record[i];
hasData |= record[i];