Match sub_0801E82C

This commit is contained in:
octorock
2022-11-06 10:18:02 +00:00
parent ec13298471
commit 521bb8250b
2 changed files with 64 additions and 77 deletions
+64 -8
View File
@@ -824,16 +824,72 @@ bool32 sub_0801E810(u32 kinstoneId) {
return ReadBit(&gSave.unk24E, kinstoneId);
}
ASM_FUNC("asm/non_matching/common/sub_0801E82C.inc", void sub_0801E82C(void));
void sub_0801E82C(void) {
#ifdef NON_MATCHING
u32 r5;
s32 sub_0801E8B0(u32 idx) {
u32 i;
for (i = 0; i < 18; ++i) {
if (idx == gSave.unk118[i])
return i;
for (r5 = 0; r5 < 0x13; r5++) {
if (gSave.unk12B[r5] == 0) {
gSave.unk118[r5] = gSave.unk12B[r5];
}
}
return -1;
gSave.unk118[0x12] = 0;
gSave.unk12B[0x12] = 0;
for (r5 = 0; r5 < 0x12; r5++) {
if ((gSave.unk118[r5] - 0x65) > 0x10) {
MemCopy(&gSave.unk118[r5 + 1], &gSave.unk118[r5], 0x12 - r5);
MemCopy(&gSave.unk12B[r5 + 1], &gSave.unk12B[r5], 0x12 - r5);
}
}
#else
u32 r0, r4, r5;
u32 new_var;
u8 *r1, *r2, *r3, *r6, *r7, *r8, *r9, *r10;
new_var = 4;
r1 = &gSave.inventory[34];
r5 = 0;
r2 = gSave.unk118;
code0_0:
r0 = r2[0x13];
r3 = &r1[4];
r10 = r3;
if (r0 == 0) {
*r2 = r0;
}
r2++;
r5++;
if (r5 <= 0x12)
goto code0_0;
r1[0x16] = 0;
r1[0x29] = 0;
r5 = 0;
r9 = &r1[0x17];
r3 = &r1[0x18];
r8 = r3;
r7 = &r1[new_var];
r6 = &r1[5];
code0_2:
r0 = r10[r5] - 0x65;
if (r0 > 0x10) {
MemCopy(r6, r7, 0x12 - r5);
MemCopy(r8, r9, 0x12 - r5);
}
r9++;
r8++;
r7++;
r6++;
r5++;
if (r5 <= 0x11)
goto code0_2;
#endif
}
return i;
}
return -1;
}
// Check conditions, something with kinstones