pokenav_unk_2 staging

This commit is contained in:
PikalaxALT 2019-07-30 19:46:56 -04:00
parent f13e1c78b2
commit a08cbaee0a
3 changed files with 106 additions and 229 deletions

View File

@ -5,235 +5,6 @@
@ File centered around AllocSubstruct(2)
thumb_func_start sub_81CA20C
sub_81CA20C: @ 81CA20C
push {r4-r7,lr}
mov r7, r8
push {r7}
movs r0, 0x2
bl GetSubstructPtr
adds r6, r0, 0
bl sub_81C98A4
mov r8, r0
movs r7, 0
movs r5, 0
adds r4, r6, 0
adds r4, 0x2C
_081CA228:
lsls r0, r5, 2
adds r1, r6, 0
adds r1, 0x10
adds r1, r0
ldr r0, [r1]
cmp r0, 0
beq _081CA25C
adds r0, r7, 0
adds r7, 0x1
cmp r0, r8
bne _081CA244
movs r2, 0x82
strb r5, [r6, 0xB]
b _081CA246
_081CA244:
movs r2, 0x8C
_081CA246:
adds r0, r4, 0
movs r1, 0x80
lsls r1, 1
movs r3, 0xC
bl sub_81CA35C
adds r0, r4, 0
movs r1, 0
bl sub_81CA448
b _081CA264
_081CA25C:
adds r0, r4, 0
movs r1, 0x1
bl sub_81CA448
_081CA264:
adds r4, 0x10
adds r5, 0x1
cmp r5, 0x5
ble _081CA228
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_81CA20C
thumb_func_start sub_81CA278
sub_81CA278: @ 81CA278
push {r4,r5,lr}
movs r0, 0x2
bl GetSubstructPtr
adds r4, r0, 0
bl sub_81C98A4
adds r3, r0, 0
movs r2, 0
movs r5, 0
ldr r0, [r4, 0x10]
cmp r0, 0
beq _081CA298
cmp r5, r3
beq _081CA2B2
_081CA296:
adds r5, 0x1
_081CA298:
adds r2, 0x1
cmp r2, 0x5
bgt _081CA2B2
lsls r0, r2, 2
adds r1, r4, 0
adds r1, 0x10
adds r1, r0
ldr r0, [r1]
cmp r0, 0
beq _081CA298
cmp r5, r3
bne _081CA296
adds r5, r2, 0
_081CA2B2:
ldrb r0, [r4, 0xB]
lsls r0, 4
adds r0, 0x2C
adds r0, r4, r0
movs r1, 0x82
movs r2, 0x8C
movs r3, 0x4
bl sub_81CA35C
lsls r0, r5, 4
adds r0, 0x2C
adds r0, r4, r0
movs r1, 0x8C
movs r2, 0x82
movs r3, 0x4
bl sub_81CA35C
strb r5, [r4, 0xB]
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81CA278
thumb_func_start sub_81CA2DC
sub_81CA2DC: @ 81CA2DC
push {r4-r6,lr}
movs r0, 0x2
bl GetSubstructPtr
adds r6, r0, 0
movs r5, 0
adds r4, r6, 0
adds r4, 0x2C
_081CA2EC:
lsls r0, r5, 2
adds r1, r6, 0
adds r1, 0x10
adds r1, r0
ldr r0, [r1]
cmp r0, 0
beq _081CA316
ldrb r0, [r6, 0xB]
cmp r0, r5
beq _081CA310
adds r0, r4, 0
movs r1, 0x8C
movs r2, 0x80
lsls r2, 1
movs r3, 0x8
bl sub_81CA35C
b _081CA316
_081CA310:
adds r0, r4, 0
bl sub_81CA3B4
_081CA316:
adds r4, 0x10
adds r5, 0x1
cmp r5, 0x5
ble _081CA2EC
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_81CA2DC
thumb_func_start sub_81CA324
sub_81CA324: @ 81CA324
push {r4,lr}
movs r0, 0x2
bl GetSubstructPtr
adds r3, r0, 0
movs r2, 0
ldr r4, =SpriteCallbackDummy
adds r1, r3, 0
adds r1, 0x2C
_081CA336:
ldr r0, [r1]
ldr r0, [r0, 0x1C]
cmp r0, r4
bne _081CA354
adds r1, 0x10
adds r2, 0x1
cmp r2, 0x5
ble _081CA336
ldrb r0, [r3, 0xC]
cmp r0, 0
bne _081CA354
movs r0, 0
b _081CA356
.pool
_081CA354:
movs r0, 0x1
_081CA356:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81CA324
thumb_func_start sub_81CA35C
sub_81CA35C: @ 81CA35C
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
adds r4, r0, 0
adds r5, r1, 0
mov r9, r2
adds r6, r3, 0
ldr r0, =sub_81CA474
mov r8, r0
subs r0, r2, r5
lsls r0, 4
adds r1, r6, 0
bl __divsi3
adds r3, r0, 0
movs r1, 0x3
lsls r2, r5, 4
_081CA380:
ldr r0, [r4]
strh r5, [r0, 0x20]
ldr r0, [r4]
strh r6, [r0, 0x2E]
ldr r0, [r4]
strh r3, [r0, 0x30]
ldr r0, [r4]
strh r2, [r0, 0x32]
ldr r0, [r4]
mov r7, r9
strh r7, [r0, 0x3C]
ldm r4!, {r0}
mov r7, r8
str r7, [r0, 0x1C]
subs r1, 0x1
cmp r1, 0
bge _081CA380
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81CA35C
thumb_func_start sub_81CA3B4
sub_81CA3B4: @ 81CA3B4
push {r4-r7,lr}

View File

@ -139,6 +139,7 @@ void sub_81C9430(void);
int sub_81C9894(void);
const u8 *sub_81CAF78(int index, u8 *arg1);
u16 sub_81C98C4(void);
int sub_81C98A4(void);
// pokenav_unk_2.c
void sub_81C99D4(void);

View File

@ -46,6 +46,10 @@ void sub_81CA0C8(void);
void sub_81CA0EC(const u16 *const * a0, s32 a1, s32 a2);
void sub_81CA20C(void);
void sub_81CA278(void);
void sub_81CA35C(struct Sprite ** sprites, s32 a1, s32 a2, s32 a3);
void sub_81CA3B4(struct Sprite ** sprites);
void sub_81CA448(struct Sprite ** sprites, s32 a1);
void sub_81CA474(struct Sprite * sprite);
void sub_81CA2DC(void);
bool32 sub_81CA324(void);
void sub_81CA640(void);
@ -661,3 +665,104 @@ void sub_81CA0EC(const u16 *const *a0, s32 a1, s32 a2)
a1 += a2;
}
}
void sub_81CA20C(void)
{
s32 i;
struct Pokenav2Struct * unk = GetSubstructPtr(2);
s32 r8 = sub_81C98A4();
s32 r7 = 0;
s32 r2;
for (i = 0; i < 6; i++)
{
if (unk->field_010[i])
{
if (r7++ == r8)
{
r2 = 0x82;
unk->field_00b = i;
}
else
r2 = 0x8c;
sub_81CA35C(unk->field_02c[i], 0x100, r2, 0xC);
sub_81CA448(unk->field_02c[i], 0);
}
else
sub_81CA448(unk->field_02c[i], 1);
}
}
void sub_81CA278(void)
{
s32 i;
struct Pokenav2Struct * unk = GetSubstructPtr(2);
s32 r3 = sub_81C98A4();
s32 r5;
for (i = 0, r5 = 0; i < 6; i++)
{
if (unk->field_010[i])
{
if (r5 == r3)
{
r5 = i;
break;
}
r5++;
}
}
sub_81CA35C(unk->field_02c[unk->field_00b], 0x82, 0x8c, 0x4);
sub_81CA35C(unk->field_02c[r5], 0x8c, 0x82, 0x4);
unk->field_00b = r5;
}
void sub_81CA2DC(void)
{
s32 i;
struct Pokenav2Struct * unk = GetSubstructPtr(2);
for (i = 0; i < 6; i++)
{
if (unk->field_010[i])
{
if (unk->field_00b != i)
sub_81CA35C(unk->field_02c[i], 0x8C, 0x100, 0x8);
else
sub_81CA3B4(unk->field_02c[i]);
}
}
}
bool32 sub_81CA324(void)
{
s32 i;
struct Pokenav2Struct * unk = GetSubstructPtr(2);
for (i = 0; i < 6; i++)
{
if (unk->field_02c[i][0]->callback != SpriteCallbackDummy)
return TRUE;
}
if (unk->field_00c)
return TRUE;
return FALSE;
}
void sub_81CA35C(struct Sprite ** sprites, s32 a1, s32 a2, s32 a3)
{
s32 i;
for (i = 0; i < 4; i++)
{
sprites[i]->pos1.x = a1;
sprites[i]->data[0] = a3;
sprites[i]->data[1] = 16 * (a2 - a1) / a3;
sprites[i]->data[2] = 16 * a1;
sprites[i]->data[7] = a2;
sprites[i]->callback = sub_81CA474;
}
}