Decompile more pokemon_jump.c

This commit is contained in:
Marcus Huderle 2019-04-10 20:28:40 -05:00 committed by huderlem
parent 8a617c3d94
commit a65cffef42
3 changed files with 403 additions and 861 deletions

View File

@ -5,849 +5,6 @@
.text
thumb_func_start sub_802C1DC
sub_802C1DC: @ 802C1DC
push {r4,r5,lr}
ldr r4, =gUnknown_02022CFC
ldr r1, [r4]
ldr r0, [r1, 0x5C]
cmp r0, 0
beq _0802C21C
ldr r0, [r1, 0x78]
bl sub_802DD64
ldr r1, [r4]
movs r5, 0
str r5, [r1, 0x5C]
adds r0, r1, 0
adds r0, 0x4D
ldrb r0, [r0]
cmp r0, 0
beq _0802C21C
adds r0, r1, 0
adds r0, 0x71
ldrb r0, [r0]
bl sub_802DCCC
ldr r1, =gUnknown_082FB654
subs r0, 0x2
lsls r0, 1
adds r0, r1
ldrh r0, [r0]
bl PlaySE
ldr r0, [r4]
adds r0, 0x4D
strb r5, [r0]
_0802C21C:
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
adds r0, 0x74
ldrh r0, [r0]
bl sub_802DD74
bl sub_802C280
bl sub_802C240
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802C1DC
thumb_func_start sub_802C240
sub_802C240: @ 802C240
push {lr}
ldr r0, =gUnknown_02022CFC
ldr r1, [r0]
adds r0, r1, 0
adds r0, 0x46
ldrb r0, [r0]
cmp r0, 0
beq _0802C256
ldr r0, [r1, 0x14]
bl sub_802DC9C
_0802C256:
pop {r0}
bx r0
.pool
thumb_func_end sub_802C240
thumb_func_start sub_802C260
sub_802C260: @ 802C260
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
adds r0, 0x46
movs r1, 0
strb r1, [r0]
bx lr
.pool
thumb_func_end sub_802C260
thumb_func_start sub_802C270
sub_802C270: @ 802C270
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
adds r0, 0x46
movs r1, 0x1
strb r1, [r0]
bx lr
.pool
thumb_func_end sub_802C270
thumb_func_start sub_802C280
sub_802C280: @ 802C280
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
movs r6, 0
ldr r2, =gUnknown_02022CFC
ldr r0, [r2]
ldrb r0, [r0, 0x5]
mov r9, r0
movs r5, 0
cmp r6, r9
bge _0802C360
mov r10, r2
mov r8, r5
movs r7, 0
_0802C2A2:
mov r0, r10
ldr r3, [r0]
adds r1, r3, r7
ldr r2, =0x000082f4
adds r0, r1, r2
ldrh r2, [r0]
cmp r2, 0x1
beq _0802C2D4
cmp r2, 0x1
bgt _0802C2C4
cmp r2, 0
beq _0802C2CA
b _0802C354
.pool
_0802C2C4:
cmp r2, 0x2
beq _0802C338
b _0802C354
_0802C2CA:
adds r0, r5, 0
movs r1, 0
bl sub_802DC80
b _0802C354
_0802C2D4:
ldr r0, =0x000082f6
adds r4, r1, r0
ldrh r0, [r4]
cmp r0, 0x1
bne _0802C2F6
ldr r0, =0x000082f2
adds r0, r1
adds r1, r3, 0
adds r1, 0x9A
add r1, r8
str r1, [sp]
ldrh r1, [r0]
mov r12, r1
ldr r0, [sp]
ldrh r0, [r0]
cmp r12, r0
beq _0802C31E
_0802C2F6:
ldrb r3, [r3, 0x6]
cmp r5, r3
bne _0802C2FE
strh r2, [r4]
_0802C2FE:
orrs r6, r2
mov r1, r10
ldr r2, [r1]
ldr r1, =0x000082e8
adds r0, r2, r1
adds r0, r7
ldr r1, =0x7fffffff
str r1, [r0]
adds r1, r2, 0
adds r1, 0x9A
add r1, r8
adds r2, r7
ldr r0, =0x000082f2
adds r2, r0
ldrh r0, [r2]
strh r0, [r1]
_0802C31E:
adds r0, r5, 0
bl sub_802C398
b _0802C354
.pool
_0802C338:
ldr r0, =0x000082f6
adds r1, r0
ldrh r0, [r1]
cmp r0, 0x2
beq _0802C354
ldrb r3, [r3, 0x6]
cmp r5, r3
bne _0802C34A
strh r2, [r1]
_0802C34A:
orrs r6, r2
lsls r0, r5, 24
lsrs r0, 24
bl sub_802DD88
_0802C354:
movs r1, 0x2
add r8, r1
adds r7, 0x28
adds r5, 0x1
cmp r5, r9
blt _0802C2A2
_0802C360:
movs r0, 0x2
ands r0, r6
cmp r0, 0
beq _0802C378
movs r0, 0x83
lsls r0, 1
bl PlaySE
b _0802C386
.pool
_0802C378:
movs r0, 0x1
ands r6, r0
cmp r6, 0
beq _0802C386
movs r0, 0xA
bl PlaySE
_0802C386:
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_802C280
thumb_func_start sub_802C398
sub_802C398: @ 802C398
push {r4-r6,lr}
adds r6, r0, 0
ldr r0, =gUnknown_02022CFC
ldr r2, [r0]
ldr r0, [r2, 0x68]
cmp r0, 0
bne _0802C432
lsls r0, r6, 2
adds r0, r6
lsls r0, 3
ldr r1, =0x000082e4
adds r0, r1
adds r5, r2, r0
ldr r1, [r5, 0x4]
ldr r0, =0x7fffffff
cmp r1, r0
beq _0802C3D0
adds r0, r1, 0x1
str r0, [r5, 0x4]
adds r3, r0, 0
b _0802C3E8
.pool
_0802C3D0:
adds r0, r2, 0
adds r0, 0x4A
ldrh r1, [r0]
ldrh r0, [r5, 0xE]
subs r3, r1, r0
ldr r0, =0x0000fde7
cmp r3, r0
ble _0802C3E6
ldr r0, =0xffff0218
adds r3, r0
adds r3, r1
_0802C3E6:
str r3, [r5, 0x4]
_0802C3E8:
cmp r3, 0x3
ble _0802C432
subs r3, 0x4
cmp r3, 0x2F
bgt _0802C414
ldr r2, =gUnknown_082FB65C
ldrh r1, [r5, 0xC]
lsls r0, r1, 1
adds r0, r1
lsls r0, 4
adds r0, r3, r0
adds r0, r2
movs r4, 0
ldrsb r4, [r0, r4]
b _0802C416
.pool
_0802C414:
movs r4, 0
_0802C416:
adds r1, r4, 0
adds r0, r6, 0
bl sub_802DC80
cmp r4, 0
bne _0802C430
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
ldrb r0, [r0, 0x6]
cmp r6, r0
bne _0802C430
bl sub_802C1BC
_0802C430:
str r4, [r5]
_0802C432:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_802C398
thumb_func_start sub_802C43C
sub_802C43C: @ 802C43C
push {r4,r5,lr}
ldr r5, =gUnknown_02022CFC
ldr r1, [r5]
ldr r0, [r1, 0x14]
cmp r0, 0x8
bne _0802C4CE
ldr r0, [r1, 0x18]
cmp r0, 0x7
bne _0802C4CE
ldr r4, [r1, 0x58]
cmp r4, 0
bne _0802C46C
bl sub_802C780
ldr r0, [r5]
str r4, [r0, 0x54]
movs r1, 0x1
str r1, [r0, 0x58]
adds r0, 0x71
strb r4, [r0]
b _0802C4CE
.pool
_0802C46C:
ldr r0, [r1, 0x54]
cmp r0, 0x5
bne _0802C480
ldrh r0, [r1, 0xC]
adds r0, 0x1
strh r0, [r1, 0xC]
ldrh r0, [r1, 0xC]
bl sub_802C7A0
b _0802C484
_0802C480:
movs r0, 0
strh r0, [r1, 0xC]
_0802C484:
ldr r4, =gUnknown_02022CFC
ldr r1, [r4]
ldr r0, [r1, 0x54]
cmp r0, 0x1
ble _0802C49E
movs r0, 0x1
str r0, [r1, 0x64]
adds r0, r1, 0
adds r0, 0x86
adds r1, 0x81
movs r2, 0x5
bl memcpy
_0802C49E:
bl sub_802C780
ldr r0, [r4]
movs r2, 0
str r2, [r0, 0x54]
movs r1, 0x1
str r1, [r0, 0x58]
adds r0, 0x71
strb r2, [r0]
ldr r0, [r4]
adds r2, r0, 0
adds r2, 0x74
ldrh r1, [r2]
ldr r0, =0x0000270e
cmp r1, r0
bhi _0802C4C2
adds r0, r1, 0x1
strh r0, [r2]
_0802C4C2:
movs r0, 0xA
bl sub_802C688
movs r0, 0x3
bl sub_802AE14
_0802C4CE:
ldr r4, =gUnknown_02022CFC
ldr r0, [r4]
ldr r0, [r0, 0x64]
cmp r0, 0
beq _0802C504
bl sub_802C618
cmp r0, 0x1
beq _0802C4E8
ldr r0, [r4]
ldr r0, [r0, 0x14]
cmp r0, 0
bne _0802C504
_0802C4E8:
ldr r0, [r4]
adds r0, 0x86
bl sub_802C73C
bl sub_802C790
bl sub_802C688
movs r0, 0x3
bl sub_802AE14
ldr r1, [r4]
movs r0, 0
str r0, [r1, 0x64]
_0802C504:
ldr r4, =gUnknown_02022CFC
ldr r0, [r4]
ldr r0, [r0, 0x58]
cmp r0, 0
beq _0802C52A
bl sub_802C6B0
adds r2, r0, 0
ldr r1, [r4]
ldr r0, [r1, 0x54]
cmp r2, r0
ble _0802C52A
str r2, [r1, 0x54]
adds r0, r1, 0
adds r0, 0x81
adds r1, 0x7C
movs r2, 0x5
bl memcpy
_0802C52A:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802C43C
thumb_func_start sub_802C538
sub_802C538: @ 802C538
push {r4,r5,lr}
ldr r5, =gUnknown_02022CFC
ldr r1, [r5]
ldr r0, [r1, 0x14]
cmp r0, 0x6
bne _0802C582
ldr r4, =0x000083ac
adds r0, r1, r4
ldr r1, [r0]
ldr r0, [r1]
cmp r0, 0
bne _0802C582
ldrh r0, [r1, 0x12]
cmp r0, 0x1
bne _0802C578
bl sub_802C0DC
adds r1, r0, 0
cmp r1, 0x1
bne _0802C578
ldr r0, [r5]
adds r0, r4
ldr r0, [r0]
str r1, [r0, 0x14]
b _0802C582
.pool
_0802C574:
movs r0, 0
b _0802C5CA
_0802C578:
bl sub_802C18C
movs r0, 0x3
bl sub_802AE14
_0802C582:
ldr r0, =gUnknown_02022CFC
ldr r1, [r0]
ldr r0, [r1, 0x14]
cmp r0, 0x7
bne _0802C5A8
ldr r0, [r1, 0x18]
cmp r0, 0x6
bne _0802C5A8
ldr r2, =0x000083ac
adds r0, r1, r2
ldr r1, [r0]
ldrh r0, [r1, 0x10]
cmp r0, 0x2
beq _0802C5A8
movs r0, 0x1
str r0, [r1, 0x14]
movs r0, 0x3
bl sub_802AE14
_0802C5A8:
movs r2, 0
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
ldrb r1, [r0, 0x5]
cmp r2, r1
bge _0802C5C8
adds r3, r1, 0
ldr r4, =0x000082f4
adds r1, r0, r4
_0802C5BA:
ldrh r0, [r1]
cmp r0, 0x2
beq _0802C574
adds r1, 0x28
adds r2, 0x1
cmp r2, r3
blt _0802C5BA
_0802C5C8:
movs r0, 0x1
_0802C5CA:
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_802C538
thumb_func_start sub_802C5DC
sub_802C5DC: @ 802C5DC
push {r4,lr}
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
ldrb r3, [r0, 0x5]
movs r4, 0
cmp r4, r3
bge _0802C600
ldr r1, =0x000082f8
adds r2, r0, r1
adds r1, r3, 0
_0802C5F0:
ldr r0, [r2]
cmp r0, 0
beq _0802C5F8
adds r4, 0x1
_0802C5F8:
adds r2, 0x28
subs r1, 0x1
cmp r1, 0
bne _0802C5F0
_0802C600:
movs r0, 0
cmp r4, r3
bne _0802C608
movs r0, 0x1
_0802C608:
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_802C5DC
thumb_func_start sub_802C618
sub_802C618: @ 802C618
push {r4,lr}
movs r2, 0
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
ldrb r1, [r0, 0x5]
cmp r2, r1
bge _0802C648
adds r3, r1, 0
ldr r4, =0x000082f8
adds r1, r0, r4
_0802C62C:
ldr r0, [r1]
cmp r0, 0x1
beq _0802C640
movs r0, 0
b _0802C64A
.pool
_0802C640:
adds r1, 0x28
adds r2, 0x1
cmp r2, r3
blt _0802C62C
_0802C648:
movs r0, 0x1
_0802C64A:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_802C618
thumb_func_start sub_802C650
sub_802C650: @ 802C650
push {lr}
ldr r0, =gUnknown_02022CFC
ldr r1, [r0]
adds r0, r1, 0
adds r0, 0x45
ldrb r0, [r0]
cmp r0, 0x1
bne _0802C668
_0802C660:
movs r0, 0
b _0802C684
.pool
_0802C668:
movs r2, 0x1
ldrb r0, [r1, 0x5]
cmp r2, r0
bge _0802C682
adds r3, r0, 0
adds r1, 0x92
_0802C674:
ldrh r0, [r1]
cmp r0, 0x1
beq _0802C660
adds r1, 0x2
adds r2, 0x1
cmp r2, r3
blt _0802C674
_0802C682:
movs r0, 0x1
_0802C684:
pop {r1}
bx r1
thumb_func_end sub_802C650
thumb_func_start sub_802C688
sub_802C688: @ 802C688
push {lr}
ldr r1, =gUnknown_02022CFC
ldr r2, [r1]
ldr r1, [r2, 0x78]
adds r1, r0
str r1, [r2, 0x78]
movs r0, 0x1
str r0, [r2, 0x5C]
ldr r0, =0x00018695
cmp r1, r0
bls _0802C6A2
adds r0, 0x1
str r0, [r2, 0x78]
_0802C6A2:
pop {r0}
bx r0
.pool
thumb_func_end sub_802C688
thumb_func_start sub_802C6B0
sub_802C6B0: @ 802C6B0
push {r4-r7,lr}
movs r5, 0
ldr r1, =gUnknown_02022CFC
ldr r0, [r1]
ldrb r4, [r0, 0x5]
movs r2, 0
cmp r5, r4
bge _0802C702
mov r12, r1
movs r3, 0
ldr r7, =0x000082e4
movs r6, 0x1E
negs r6, r6
_0802C6CA:
mov r0, r12
ldr r1, [r0]
adds r0, r1, r7
adds r0, r3
ldr r0, [r0]
cmp r0, r6
bne _0802C6F0
adds r0, r1, 0
adds r0, 0x7C
adds r0, r2
movs r1, 0x1
strb r1, [r0]
adds r5, 0x1
b _0802C6FA
.pool
_0802C6F0:
adds r0, r1, 0
adds r0, 0x7C
adds r0, r2
movs r1, 0
strb r1, [r0]
_0802C6FA:
adds r3, 0x28
adds r2, 0x1
cmp r2, r4
blt _0802C6CA
_0802C702:
adds r0, r5, 0
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_802C6B0
thumb_func_start sub_802C70C
sub_802C70C: @ 802C70C
push {lr}
movs r2, 0
ldr r1, =gUnknown_03005000
ldr r3, =0x000009e6
adds r0, r1, r3
ldrb r0, [r0]
cmp r0, 0
bne _0802C728
ldr r3, =0x00000c1a
adds r0, r1, r3
ldrb r0, [r0]
cmp r0, 0
bne _0802C728
movs r2, 0x1
_0802C728:
adds r0, r2, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_802C70C
thumb_func_start sub_802C73C
sub_802C73C: @ 802C73C
push {r4-r6,lr}
adds r4, r0, 0
movs r1, 0
movs r2, 0
movs r3, 0
ldr r6, =gUnknown_02022CFC
movs r5, 0x1
_0802C74A:
adds r0, r4, r1
ldrb r0, [r0]
cmp r0, 0
beq _0802C75A
adds r0, r5, 0
lsls r0, r1
orrs r2, r0
adds r3, 0x1
_0802C75A:
adds r1, 0x1
cmp r1, 0x4
ble _0802C74A
ldr r0, [r6]
adds r0, 0x71
strb r2, [r0]
cmp r2, 0
beq _0802C772
ldr r0, [r6]
adds r0, 0x4D
movs r1, 0x1
strb r1, [r0]
_0802C772:
adds r0, r3, 0
pop {r4-r6}
pop {r1}
bx r1
.pool
thumb_func_end sub_802C73C
thumb_func_start sub_802C780
sub_802C780: @ 802C780
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
adds r0, 0x44
movs r1, 0
strb r1, [r0]
bx lr
.pool
thumb_func_end sub_802C780
thumb_func_start sub_802C790
sub_802C790: @ 802C790
ldr r1, =gUnknown_082FB6EC
lsls r0, 2
adds r0, r1
ldr r0, [r0]
bx lr
.pool
thumb_func_end sub_802C790
thumb_func_start sub_802C7A0
sub_802C7A0: @ 802C7A0
push {lr}
lsls r0, 16
lsrs r1, r0, 16
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
ldrh r2, [r0, 0xE]
cmp r1, r2
bls _0802C7B2
strh r1, [r0, 0xE]
_0802C7B2:
pop {r0}
bx r0
.pool
thumb_func_end sub_802C7A0
thumb_func_start sub_802C7BC
sub_802C7BC: @ 802C7BC
push {lr}
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
ldr r1, =gUnknown_082FB714
ldr r2, [r0, 0x78]
ldr r0, [r1]
cmp r2, r0
bcs _0802C7D8
movs r0, 0
b _0802C7DA
.pool
_0802C7D8:
movs r0, 0x1
_0802C7DA:
pop {r1}
bx r1
thumb_func_end sub_802C7BC
thumb_func_start sub_802C7E0
sub_802C7E0: @ 802C7E0
push {r4,lr}
bl sub_802C818
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
bl sub_802C838
lsls r0, 16
lsrs r0, 4
ldr r1, =0x00000fff
ands r4, r1
orrs r0, r4
lsls r0, 16
lsrs r0, 16
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_802C7E0
thumb_func_start sub_802C808
sub_802C808: @ 802C808
lsls r0, 16
lsrs r3, r0, 28
strh r3, [r2]
lsls r0, 4
lsrs r0, 20
strh r0, [r1]
bx lr
thumb_func_end sub_802C808
thumb_func_start sub_802C818
sub_802C818: @ 802C818
push {lr}
bl Random
lsls r0, 16
movs r1, 0xE0
lsls r1, 11
ands r1, r0
ldr r0, =gUnknown_082FB704
lsrs r1, 15
adds r1, r0
ldrh r0, [r1]
pop {r1}
bx r1
.pool
thumb_func_end sub_802C818
thumb_func_start sub_802C838
sub_802C838: @ 802C838
push {r4-r6,lr}

View File

@ -24,12 +24,14 @@ gUnknown_082FB65C:: @ 82FB65C
.byte 0xee, 0xef, 0xf1, 0xf3, 0xf5, 0xf8, 0xfa, 0xfc
.byte 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0xfd, 0xfa, 0xf7, 0xf5, 0xf2, 0xf0, 0xee, 0xec
.byte 0xea, 0xe8, 0xe6, 0xe4, 0xe3, 0xe2, 0xe2, 0xe4
.byte 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf5
.byte 0xf7, 0xfa, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0xfd, 0xfa, 0xf7, 0xf5, 0xf3, 0xf1, 0xef, 0xed
.byte 0xeb, 0xe9, 0xe7, 0xe5, 0xe4, 0xe3, 0xe2, 0xe2
.byte 0xe2, 0xe2, 0xe3, 0xe3, 0xe4, 0xe4, 0xe5, 0xe5

View File

@ -2,6 +2,7 @@
#include "alloc.h"
#include "item.h"
#include "link.h"
#include "link_rfu.h"
#include "main.h"
#include "menu.h"
#include "palette.h"
@ -90,9 +91,10 @@ struct PokemonJump1
u8 unk71;
u16 unk72;
u16 unk74;
int unk78;
u32 unk78;
u8 unk7C[MAX_RFU_PLAYERS];
u8 filler81[0xA];
u8 unk81[MAX_RFU_PLAYERS];
u8 unk86[MAX_RFU_PLAYERS];
u8 unk8B[MAX_RFU_PLAYERS];
u16 unk90[MAX_RFU_PLAYERS];
u16 unk9A[MAX_RFU_PLAYERS];
@ -167,18 +169,31 @@ static void sub_802C0E8(void);
static void sub_802C114(void);
static bool32 sub_802C130(u16);
static void sub_802C164(void);
void sub_802C1DC(void);
void sub_802C260(void);
void sub_802C270(void);
void sub_802C43C(void);
void sub_802C808(u16, u16 *, u16 *);
bool32 sub_802C538(void);
bool32 sub_802C650(void);
bool32 sub_802C5DC(void);
bool32 sub_802C70C(void);
bool32 sub_802C7BC(void);
u16 sub_802C7E0(void);
static void sub_802C1DC(void);
static void sub_802C240(void);
static void sub_802C260(void);
static void sub_802C270(void);
static void sub_802C280(void);
static void sub_802C398(int);
static void sub_802C43C(void);
static bool32 sub_802C538(void);
static bool32 sub_802C5DC(void);
static bool32 sub_802C618(void);
static bool32 sub_802C650(void);
static void sub_802C688(int);
static int sub_802C6B0(void);
static bool32 sub_802C70C(void);
static int sub_802C73C(u8 *);
static void sub_802C780(void);
static int sub_802C790(int);
static void sub_802C7A0(u16);
static bool32 sub_802C7BC(void);
static u16 sub_802C7E0(void);
static void sub_802C808(u16, u16 *, u16 *);
static u16 sub_802C818(void);
u16 sub_802C838(void);
u16 sub_802C880(u16, u16);
void sub_802DC9C(u32);
void sub_802D074(void *);
void sub_802D0AC(void);
void sub_802D0C8(int);
@ -190,9 +205,13 @@ void sub_802D884(u16);
void sub_802D8FC(u16);
bool32 sub_802D974(void);
void sub_802DA14(void);
void sub_802DC80(int, s8);
void sub_802DD88(u8);
bool32 sub_802DA44(void);
void sub_802DD64(int);
s8 sub_802DA8C(void);
int sub_802DCCC(u8);
void sub_802DD74(u16);
void sub_802DDA0(u8);
int sub_802DDB8(int);
void sub_802DDCC(void);
@ -343,6 +362,11 @@ bool32 (* const gUnknown_082FB618[])(void) =
extern const u16 gUnknown_082FB63C[];
extern const u16 gUnknown_082FB64C[4];
extern const u16 gUnknown_082FB654[];
extern s8 gUnknown_082FB65C[][48];
extern int gUnknown_082FB6EC[];
extern int gUnknown_082FB714[];
extern u16 gUnknown_082FB704[8];
void sub_802A9A8(u16 partyIndex, MainCallback callback)
{
@ -383,7 +407,7 @@ static void sub_802AA60(struct PokemonJump1 *arg0)
arg0->unk72 = 0;
sub_802AB20();
sub_802AA94(arg0);
if (arg0->unk5 == 5)
if (arg0->unk5 == MAX_RFU_PLAYERS)
sub_802E3A8();
}
@ -614,7 +638,7 @@ static void sub_802ACA0(u8 taskId)
}
}
void sub_802AE14(int arg0)
static void sub_802AE14(int arg0)
{
if (arg0 == 0)
{
@ -1650,7 +1674,7 @@ static void sub_802C0B8(void)
sub_802C270();
}
int sub_802C0DC(void)
static int sub_802C0DC(void)
{
return gUnknown_02022CFC->unk10;
}
@ -1683,7 +1707,7 @@ static void sub_802C164(void)
gUnknown_02022CFC->unk83AC->unk10 = 1;
}
void sub_802C18C(void)
static void sub_802C18C(void)
{
gUnknown_02022CFC->unk83AC->unk12 = gUnknown_02022CFC->unk83AC->unk10;
gUnknown_02022CFC->unk83AC->unk10 = 2;
@ -1691,8 +1715,367 @@ void sub_802C18C(void)
gUnknown_02022CFC->unk83AC->unk14 = 2;
}
void sub_802C1BC(void)
static void sub_802C1BC(void)
{
gUnknown_02022CFC->unk83AC->unk12 = gUnknown_02022CFC->unk83AC->unk10;
gUnknown_02022CFC->unk83AC->unk10 = 0;
}
static void sub_802C1DC(void)
{
if (gUnknown_02022CFC->unk5C)
{
sub_802DD64(gUnknown_02022CFC->unk78);
gUnknown_02022CFC->unk5C = 0;
if (gUnknown_02022CFC->unk4D)
{
int index = sub_802DCCC(gUnknown_02022CFC->unk71);
PlaySE(gUnknown_082FB654[index - 2]);
gUnknown_02022CFC->unk4D = 0;
}
}
sub_802DD74(gUnknown_02022CFC->unk74);
sub_802C280();
sub_802C240();
}
static void sub_802C240(void)
{
if (gUnknown_02022CFC->unk46)
sub_802DC9C(gUnknown_02022CFC->unk14);
}
static void sub_802C260(void)
{
gUnknown_02022CFC->unk46 = 0;
}
static void sub_802C270(void)
{
gUnknown_02022CFC->unk46 = 1;
}
static void sub_802C280(void)
{
int i;
int whichSound = 0;
int numLinkPlayers = gUnknown_02022CFC->unk5;
for (i = 0; i < numLinkPlayers; i++)
{
switch (gUnknown_02022CFC->unk82E4[i].unk10)
{
case 0:
sub_802DC80(i, 0);
break;
case 1:
if (gUnknown_02022CFC->unk82E4[i].unk12 != 1 || gUnknown_02022CFC->unk82E4[i].unkE != gUnknown_02022CFC->unk9A[i])
{
if (i == gUnknown_02022CFC->unk6)
gUnknown_02022CFC->unk82E4[i].unk12 = 1;
whichSound |= 0x1;
gUnknown_02022CFC->unk82E4[i].unk4 = 0x7FFFFFFF;
gUnknown_02022CFC->unk9A[i] = gUnknown_02022CFC->unk82E4[i].unkE;
}
sub_802C398(i);
break;
case 2:
if (gUnknown_02022CFC->unk82E4[i].unk12 != 2)
{
if (i == gUnknown_02022CFC->unk6)
gUnknown_02022CFC->unk82E4[i].unk12 = 2;
whichSound |= 0x2;
sub_802DD88(i);
}
break;
}
}
if (whichSound & 0x2)
PlaySE(SE_RG_NAWAMISS);
else if (whichSound & 0x1)
PlaySE(SE_DANSA);
}
static void sub_802C398(int multiplayerId)
{
int var0;
int var1;
struct PokemonJump1_82E4 *player;
if (gUnknown_02022CFC->unk68)
return;
player = &gUnknown_02022CFC->unk82E4[multiplayerId];
if (player->unk4 != 0x7FFFFFFF)
{
player->unk4++;
var0 = player->unk4;
}
else
{
var0 = gUnknown_02022CFC->unk4A - player->unkE;
if (var0 >= 65000)
{
var0 -= 65000;
var0 += gUnknown_02022CFC->unk4A;
}
player->unk4 = var0;
}
if (var0 < 4)
return;
var0 -= 4;
if (var0 < 48)
var1 = gUnknown_082FB65C[player->unkC][var0];
else
var1 = 0;
sub_802DC80(multiplayerId, var1);
if (!var1 && multiplayerId == gUnknown_02022CFC->unk6)
sub_802C1BC();
player->unk0 = var1;
}
static void sub_802C43C(void)
{
if (gUnknown_02022CFC->unk14 == 8 && gUnknown_02022CFC->unk18 == 7)
{
if (gUnknown_02022CFC->unk58 == 0)
{
sub_802C780();
gUnknown_02022CFC->unk54 = 0;
gUnknown_02022CFC->unk58 = 1;
gUnknown_02022CFC->unk71 = 0;
}
else
{
if (gUnknown_02022CFC->unk54 == 5)
{
gUnknown_02022CFC->unkC++;
sub_802C7A0(gUnknown_02022CFC->unkC);
}
else
{
gUnknown_02022CFC->unkC = 0;
}
if (gUnknown_02022CFC->unk54 > 1)
{
gUnknown_02022CFC->unk64 = 1;
memcpy(gUnknown_02022CFC->unk86, gUnknown_02022CFC->unk81, sizeof(u8) * MAX_RFU_PLAYERS);
}
sub_802C780();
gUnknown_02022CFC->unk54 = 0;
gUnknown_02022CFC->unk58 = 1;
gUnknown_02022CFC->unk71 = 0;
if (gUnknown_02022CFC->unk74 < 9999)
gUnknown_02022CFC->unk74++;
sub_802C688(10);
sub_802AE14(3);
}
}
if (gUnknown_02022CFC->unk64 && (sub_802C618() == TRUE || !gUnknown_02022CFC->unk14))
{
int var0 = sub_802C73C(gUnknown_02022CFC->unk86);
sub_802C688(sub_802C790(var0));
sub_802AE14(3);
gUnknown_02022CFC->unk64 = 0;
}
if (gUnknown_02022CFC->unk58)
{
int var1 = sub_802C6B0();
if (var1 > gUnknown_02022CFC->unk54)
{
gUnknown_02022CFC->unk54 = var1;
memcpy(gUnknown_02022CFC->unk81, gUnknown_02022CFC->unk7C, sizeof(u8) * MAX_RFU_PLAYERS);
}
}
}
static bool32 sub_802C538(void)
{
int i;
if (gUnknown_02022CFC->unk14 == 6 && !gUnknown_02022CFC->unk83AC->unk0)
{
if (gUnknown_02022CFC->unk83AC->unk12 == 1 && sub_802C0DC() == 1)
{
gUnknown_02022CFC->unk83AC->unk14 = 1;
}
else
{
sub_802C18C();
sub_802AE14(3);
}
}
if (gUnknown_02022CFC->unk14 == 7
&& gUnknown_02022CFC->unk18 == 6
&& gUnknown_02022CFC->unk83AC->unk10 != 2)
{
gUnknown_02022CFC->unk83AC->unk14 = 1;
sub_802AE14(3);
}
for (i = 0; i < gUnknown_02022CFC->unk5; i++)
{
if (gUnknown_02022CFC->unk82E4[i].unk10 == 2)
return FALSE;
}
return TRUE;
}
static bool32 sub_802C5DC(void)
{
int i;
int numPlayers = gUnknown_02022CFC->unk5;
int count = 0;
for (i = 0; i < numPlayers; i++)
{
if (gUnknown_02022CFC->unk82E4[i].unk14)
count++;
}
return count == numPlayers;
}
static bool32 sub_802C618(void)
{
int i;
for (i = 0; i < gUnknown_02022CFC->unk5; i++)
{
if (gUnknown_02022CFC->unk82E4[i].unk14 != 1)
return FALSE;
}
return TRUE;
}
static bool32 sub_802C650(void)
{
int i;
if (gUnknown_02022CFC->unk45 == 1)
return FALSE;
for (i = 1; i < gUnknown_02022CFC->unk5; i++)
{
if (gUnknown_02022CFC->unk90[i] == 1)
return FALSE;
}
return TRUE;
}
static void sub_802C688(int arg0)
{
gUnknown_02022CFC->unk78 += arg0;
gUnknown_02022CFC->unk5C = 1;
if (gUnknown_02022CFC->unk78 >= 99990)
gUnknown_02022CFC->unk78 = 99990;
}
static int sub_802C6B0(void)
{
int i;
int count = 0;
int numPlayers = gUnknown_02022CFC->unk5;
for (i = 0; i < numPlayers; i++)
{
if (gUnknown_02022CFC->unk82E4[i].unk0 == -30)
{
gUnknown_02022CFC->unk7C[i] = 1;
count++;
}
else
{
gUnknown_02022CFC->unk7C[i] = 0;
}
}
return count;
}
static bool32 sub_802C70C(void)
{
return !gUnknown_03005000.unk_124.unk_8c2 && !gUnknown_03005000.unk_9e8.unk_232;
}
static int sub_802C73C(u8 *arg0)
{
int i;
int flags;
int count;
for (i = 0, flags = 0, count = 0; i < MAX_RFU_PLAYERS; i++)
{
if (arg0[i])
{
flags |= 1 << i;
count++;
}
}
gUnknown_02022CFC->unk71 = flags;
if (flags)
gUnknown_02022CFC->unk4D = 1;
return count;
}
static void sub_802C780(void)
{
gUnknown_02022CFC->unk44 = 0;
}
static int sub_802C790(int arg0)
{
return gUnknown_082FB6EC[arg0];
}
static void sub_802C7A0(u16 arg0)
{
if (arg0 > gUnknown_02022CFC->unkE)
gUnknown_02022CFC->unkE = arg0;
}
static bool32 sub_802C7BC(void)
{
if (gUnknown_02022CFC->unk78 >= gUnknown_082FB714[0])
return TRUE;
else
return FALSE;
}
static u16 sub_802C7E0(void)
{
u16 lo = sub_802C818();
u16 hi = sub_802C838();
return (hi << 12) | (lo & 0xFFF);
}
static void sub_802C808(u16 arg0, u16 *arg1, u16 *arg2)
{
*arg2 = arg0 >> 12;
*arg1 = arg0 & 0xFFF;
}
static u16 sub_802C818(void)
{
u16 index = Random() % ARRAY_COUNT(gUnknown_082FB704);
return gUnknown_082FB704[index];
}