Pokenav unk 1 almost done

This commit is contained in:
Phlosioneer 2019-04-10 12:18:44 -04:00 committed by huderlem
parent 2b740b46e8
commit 8338e29279
2 changed files with 136 additions and 246 deletions

View File

@ -3,248 +3,7 @@
.syntax unified
thumb_func_start sub_81C963C
sub_81C963C: @ 81C963C
push {r4-r6,lr}
adds r4, r0, 0
bl sub_81C9814
adds r3, r0, 0
cmp r3, 0
beq _081C964E
movs r0, 0x1
b _081C96F6
_081C964E:
ldr r2, =gMain
ldrh r1, [r2, 0x2E]
movs r0, 0x1
ands r0, r1
adds r6, r2, 0
cmp r0, 0
beq _081C96B8
ldr r5, =gUnknown_0861FC59
movs r1, 0x2
ldrsh r0, [r4, r1]
ldrh r2, [r4]
lsls r1, r2, 1
adds r1, r2
lsls r1, 1
adds r0, r1
adds r0, r5
ldrb r0, [r0]
cmp r0, 0x6
beq _081C968E
cmp r0, 0x6
bgt _081C9688
cmp r0, 0x5
beq _081C96A4
b _081C96B8
.pool
_081C9688:
cmp r0, 0x7
beq _081C96E4
b _081C96B8
_081C968E:
movs r0, 0x4
strh r0, [r4]
strh r3, [r4, 0x2]
ldrb r0, [r5, 0x18]
strh r0, [r4, 0x4]
ldr r0, =sub_81C96FC
str r0, [r4, 0xC]
movs r0, 0x4
b _081C96F6
.pool
_081C96A4:
strh r3, [r4, 0x6]
ldr r1, =0x000186a7
adds r0, r4, 0
bl sub_81C97B0
movs r0, 0x8
b _081C96F6
.pool
_081C96B8:
ldrh r1, [r6, 0x2E]
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _081C96F4
movs r0, 0x2
ldrsh r2, [r4, r0]
ldr r1, =gUnknown_0861FC54
ldrh r0, [r4]
adds r0, r1
ldrb r0, [r0]
cmp r2, r0
beq _081C96E4
strh r0, [r4, 0x2]
ldr r0, =sub_81C9798
str r0, [r4, 0xC]
movs r0, 0x1
b _081C96F6
.pool
_081C96E4:
movs r0, 0x5
bl PlaySE
adds r0, r4, 0
bl sub_81C97C0
movs r0, 0x3
b _081C96F6
_081C96F4:
movs r0, 0
_081C96F6:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_81C963C
thumb_func_start sub_81C96FC
sub_81C96FC: @ 81C96FC
push {r4,lr}
adds r4, r0, 0
bl sub_81C9814
cmp r0, 0
beq _081C970C
movs r0, 0x1
b _081C9792
_081C970C:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _081C9754
ldr r3, =gUnknown_0861FC59
movs r0, 0x2
ldrsh r1, [r4, r0]
ldrh r2, [r4]
lsls r0, r2, 1
adds r0, r2
lsls r0, 1
adds r1, r0
adds r1, r3
ldrb r0, [r1]
cmp r0, 0xD
beq _081C9780
subs r0, 0x8
bl sub_81C7694
ldr r1, =0x000186a8
adds r0, r4, 0
bl sub_81C97B0
movs r0, 0x3
strh r0, [r4, 0x6]
movs r0, 0x8
b _081C9792
.pool
_081C9754:
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _081C9790
movs r0, 0x2
ldrsh r2, [r4, r0]
ldr r1, =gUnknown_0861FC54
ldrh r0, [r4]
adds r0, r1
ldrb r0, [r0]
cmp r2, r0
beq _081C9780
strh r0, [r4, 0x2]
ldr r0, =sub_81C97A4
str r0, [r4, 0xC]
movs r0, 0x1
b _081C9792
.pool
_081C9780:
movs r0, 0x5
bl PlaySE
adds r0, r4, 0
bl sub_81C97F8
movs r0, 0x5
b _081C9792
_081C9790:
movs r0, 0
_081C9792:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81C96FC
thumb_func_start sub_81C9798
sub_81C9798: @ 81C9798
push {lr}
bl sub_81C97C0
movs r0, 0x3
pop {r1}
bx r1
thumb_func_end sub_81C9798
thumb_func_start sub_81C97A4
sub_81C97A4: @ 81C97A4
push {lr}
bl sub_81C97F8
movs r0, 0x5
pop {r1}
bx r1
thumb_func_end sub_81C97A4
thumb_func_start sub_81C97B0
sub_81C97B0: @ 81C97B0
str r1, [r0, 0x8]
ldr r1, =sub_81C97BC
str r1, [r0, 0xC]
bx lr
.pool
thumb_func_end sub_81C97B0
thumb_func_start sub_81C97BC
sub_81C97BC: @ 81C97BC
ldr r0, [r0, 0x8]
bx lr
thumb_func_end sub_81C97BC
thumb_func_start sub_81C97C0
sub_81C97C0: @ 81C97C0
push {r4,lr}
adds r4, r0, 0
bl sub_81C9268
lsls r0, 24
lsrs r0, 24
strh r0, [r4]
movs r0, 0x1
strh r0, [r4, 0x2]
ldr r2, =gUnknown_0861FC59
ldrh r1, [r4]
lsls r0, r1, 1
adds r0, r1
lsls r0, 1
adds r0, 0x1
adds r0, r2
ldrb r0, [r0]
strh r0, [r4, 0x4]
ldr r0, =sub_81C943C
str r0, [r4, 0xC]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C97C0
thumb_func_start sub_81C97F8
sub_81C97F8: @ 81C97F8
movs r1, 0x3
strh r1, [r0]
movs r1, 0x1
strh r1, [r0, 0x2]
ldr r1, =gUnknown_0861FC59
ldrb r1, [r1, 0x13]
strh r1, [r0, 0x4]
ldr r1, =sub_81C963C
str r1, [r0, 0xC]
bx lr
.pool
thumb_func_end sub_81C97F8
thumb_func_start sub_81C9814
thumb_func_start sub_81C9814
sub_81C9814: @ 81C9814
push {r4,r5,lr}
adds r4, r0, 0

View File

@ -17,11 +17,17 @@ struct Pokenav1Struct
extern u32 sub_81C76AC(void);
extern u32 sub_81C963C(struct Pokenav1Struct *a0);
extern u32 sub_81C96FC(struct Pokenav1Struct *a0);
extern u32 sub_81C9814(void);
extern void sub_81C97B0(struct Pokenav1Struct *a0, u32 a1);
extern void sub_81C7694(u32 a0);
u32 sub_81C9814(void);
void sub_81C97F8(struct Pokenav1Struct *a0);
void sub_81C97C0(struct Pokenav1Struct *a0);
u32 sub_81C97BC(struct Pokenav1Struct *a0);
void sub_81C97B0(struct Pokenav1Struct *a0, u32 a1);
u32 sub_81C97A4(struct Pokenav1Struct *a0);
u32 sub_81C9798(struct Pokenav1Struct *a0);
u32 sub_81C96FC(struct Pokenav1Struct *a0);
u32 sub_81C963C(struct Pokenav1Struct *a0);
u32 sub_81C9600(struct Pokenav1Struct *a0);
u32 sub_81C9588(struct Pokenav1Struct *a0);
u32 sub_81C9520(struct Pokenav1Struct *a0);
@ -29,6 +35,7 @@ u32 sub_81C943C(struct Pokenav1Struct *a0);
u32 (*sub_81C93EC(void))(struct Pokenav1Struct*);
void sub_81C939C(struct Pokenav1Struct *state);
extern u8 gUnknown_0861FC54[];
extern u8 gUnknown_0861FC59[];
u8 sub_81C9268(void)
@ -293,4 +300,128 @@ u32 sub_81C9600(struct Pokenav1Struct *a0)
}
return 0;
}
u32 sub_81C963C(struct Pokenav1Struct *a0)
{
u32 v0 = sub_81C9814();
if (v0)
return 1;
if (gMain.newKeys & A_BUTTON)
{
switch (gUnknown_0861FC59[a0->unk2 + a0->unk0 * 6])
{
case 6:
a0->unk0 = 4;
a0->unk2 = v0;
a0->unk4 = gUnknown_0861FC59[24];
a0->unkC = sub_81C96FC;
return 4;
case 5:
a0->unk6 = v0;
sub_81C97B0(a0, UNKNOWN_POKENAV_OFFSET + 7);
return 8;
case 7:
PlaySE(SE_SELECT);
sub_81C97C0(a0);
return 3;
}
}
if (gMain.newKeys & B_BUTTON)
{
if (a0->unk2 != gUnknown_0861FC54[a0->unk0])
{
a0->unk2 = gUnknown_0861FC54[a0->unk0];
a0->unkC = sub_81C9798;
return 1;
}
else
{
PlaySE(SE_SELECT);
sub_81C97C0(a0);
return 3;
}
}
return 0;
}
u32 sub_81C96FC(struct Pokenav1Struct *a0)
{
if (sub_81C9814())
return 1;
if (gMain.newKeys & A_BUTTON)
{
u8 v0 = gUnknown_0861FC59[a0->unk2 + a0->unk0 * 6];
if (v0 != 13)
{
sub_81C7694(v0 - 8);
sub_81C97B0(a0, UNKNOWN_POKENAV_OFFSET + 8);
a0->unk6 = 3;
return 8;
}
else
{
PlaySE(SE_SELECT);
sub_81C97F8(a0);
return 5;
}
}
if (gMain.newKeys & B_BUTTON)
{
if (a0->unk2 != gUnknown_0861FC54[a0->unk0])
{
a0->unk2 = gUnknown_0861FC54[a0->unk0];
a0->unkC = sub_81C97A4;
return 1;
}
else
{
PlaySE(SE_SELECT);
sub_81C97F8(a0);
return 5;
}
}
return 0;
}
u32 sub_81C9798(struct Pokenav1Struct *a0)
{
sub_81C97C0(a0);
return 3;
}
u32 sub_81C97A4(struct Pokenav1Struct *a0)
{
sub_81C97F8(a0);
return 5;
}
void sub_81C97B0(struct Pokenav1Struct *a0, u32 a1)
{
a0->unk8 = a1;
a0->unkC = sub_81C97BC;
}
u32 sub_81C97BC(struct Pokenav1Struct *a0)
{
return a0->unk8;
}
void sub_81C97C0(struct Pokenav1Struct *a0)
{
a0->unk0 = sub_81C9268();
a0->unk2 = 1;
a0->unk4 = gUnknown_0861FC59[a0->unk2 + a0->unk0 * 6];
a0->unkC = sub_81C943C;
}
void sub_81C97F8(struct Pokenav1Struct *a0)
{
a0->unk0 = 3;
a0->unk2 = 1;
a0->unk4 = gUnknown_0861FC59[19];
a0->unkC = sub_81C963C;
}