Decompile pokemon_jump through sub_802CE48()

This commit is contained in:
Marcus Huderle 2019-04-13 11:29:53 -05:00 committed by huderlem
parent 8338e29279
commit cb9d471a2a
5 changed files with 393 additions and 851 deletions

View File

@ -5,847 +5,6 @@
.text .text
thumb_func_start sub_802C838
sub_802C838: @ 802C838
push {r4-r6,lr}
movs r5, 0
movs r4, 0
ldr r3, =gUnknown_02022CFC
ldr r0, [r3]
ldr r2, =gUnknown_082FB714
ldr r1, [r0, 0x78]
ldr r0, [r2]
cmp r1, r0
bcc _0802C874
ldr r5, [r2, 0x4]
adds r6, r3, 0
adds r3, r2, 0x4
_0802C852:
adds r3, 0x8
adds r2, 0x8
adds r4, 0x1
cmp r4, 0x4
bhi _0802C874
ldr r0, [r6]
ldr r1, [r0, 0x78]
ldr r0, [r2]
cmp r1, r0
bcc _0802C874
ldr r5, [r3]
b _0802C852
.pool
_0802C874:
lsls r0, r5, 16
lsrs r0, 16
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_802C838
thumb_func_start sub_802C880
sub_802C880: @ 802C880
push {r4,r5,lr}
lsls r0, 16
lsrs r5, r0, 16
lsls r1, 16
lsrs r4, r1, 16
b _0802C892
_0802C88C:
subs r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
_0802C892:
cmp r4, 0
beq _0802C8A4
adds r0, r5, 0
adds r1, r4, 0
bl CheckBagHasSpace
lsls r0, 24
cmp r0, 0
beq _0802C88C
_0802C8A4:
adds r0, r4, 0
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_802C880
thumb_func_start sub_802C8AC
sub_802C8AC: @ 802C8AC
push {lr}
bl GetLinkPlayerCount
lsls r0, 24
lsrs r0, 24
pop {r1}
bx r1
thumb_func_end sub_802C8AC
thumb_func_start sub_802C8BC
sub_802C8BC: @ 802C8BC
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
ldrb r0, [r0, 0x6]
bx lr
.pool
thumb_func_end sub_802C8BC
thumb_func_start sub_802C8C8
sub_802C8C8: @ 802C8C8
lsls r0, 24
lsrs r0, 24
ldr r2, =gUnknown_02022CFC
lsls r1, r0, 1
adds r1, r0
lsls r1, 2
ldr r0, =0x000082a8
adds r1, r0
ldr r0, [r2]
adds r0, r1
bx lr
.pool
thumb_func_end sub_802C8C8
thumb_func_start sub_802C8E8
sub_802C8E8: @ 802C8E8
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
ldr r2, =gUnknown_02022CFC
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
ldr r1, [r2]
adds r0, r1
movs r1, 0x83
lsls r1, 8
adds r0, r1
bx lr
.pool
thumb_func_end sub_802C8E8
thumb_func_start sub_802C908
sub_802C908: @ 802C908
push {lr}
lsls r0, 16
lsrs r0, 16
bl sub_802AC00
lsls r0, 16
asrs r0, 16
mvns r0, r0
lsrs r0, 31
pop {r1}
bx r1
thumb_func_end sub_802C908
thumb_func_start sub_802C920
sub_802C920: @ 802C920
push {r4,r5,lr}
movs r5, 0
_0802C924:
movs r0, 0x64
adds r1, r5, 0
muls r1, r0
ldr r0, =gPlayerParty
adds r4, r1, r0
adds r0, r4, 0
movs r1, 0x5
bl GetMonData
cmp r0, 0
beq _0802C95C
adds r0, r4, 0
movs r1, 0x41
bl GetMonData
lsls r0, 16
lsrs r0, 16
bl sub_802C908
cmp r0, 0
beq _0802C95C
ldr r1, =gSpecialVar_Result
movs r0, 0x1
b _0802C966
.pool
_0802C95C:
adds r5, 0x1
cmp r5, 0x5
ble _0802C924
ldr r1, =gSpecialVar_Result
movs r0, 0
_0802C966:
strh r0, [r1]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802C920
thumb_func_start sub_802C974
sub_802C974: @ 802C974
push {r4-r6,lr}
adds r6, r0, 0
movs r4, 0
ldr r5, =gUnknown_082FBE08
_0802C97C:
adds r0, r5, 0
bl LoadCompressedSpriteSheet
adds r5, 0x8
adds r4, 0x1
cmp r4, 0x4
bls _0802C97C
movs r4, 0
ldr r5, =gUnknown_082FBE30
_0802C98E:
adds r0, r5, 0
bl LoadSpritePalette
adds r5, 0x8
adds r4, 0x1
cmp r4, 0x1
bls _0802C98E
movs r0, 0x5
bl IndexOfSpritePaletteTag
strb r0, [r6, 0xE]
movs r0, 0x6
bl IndexOfSpritePaletteTag
strb r0, [r6, 0xF]
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_802C974
thumb_func_start sub_802C9BC
sub_802C9BC: @ 802C9BC
push {lr}
movs r2, 0
movs r1, 0x7
adds r0, 0x3C
_0802C9C4:
strh r2, [r0]
subs r0, 0x2
subs r1, 0x1
cmp r1, 0
bge _0802C9C4
pop {r0}
bx r0
thumb_func_end sub_802C9BC
thumb_func_start sub_802C9D4
sub_802C9D4: @ 802C9D4
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x34
mov r9, r0
adds r7, r1, 0
ldr r0, [sp, 0x54]
lsls r2, 16
lsrs r2, 16
str r2, [sp, 0x28]
lsls r3, 16
lsrs r3, 16
str r3, [sp, 0x2C]
lsls r0, 24
lsrs r6, r0, 24
mov r1, sp
ldr r0, =gUnknown_082FBE40
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
movs r0, 0x80
lsls r0, 6
bl Alloc
mov r8, r0
movs r0, 0x80
lsls r0, 4
bl Alloc
mov r10, r0
bl sub_802C8BC
lsls r0, 16
lsrs r0, 16
cmp r6, r0
bne _0802CA2C
movs r0, 0x3
b _0802CA32
.pool
_0802CA2C:
adds r0, r6, 0x4
lsls r0, 24
lsrs r0, 24
_0802CA32:
str r0, [sp, 0x30]
mov r1, r8
cmp r1, 0
beq _0802CAF4
mov r2, r10
cmp r2, 0
beq _0802CAF4
ldrh r2, [r7]
lsls r0, r2, 3
ldr r1, =gMonStillFrontPicTable
adds r0, r1
ldr r3, [r7, 0x8]
mov r1, r8
bl HandleLoadSpecialPokePic
mov r3, r8
str r3, [sp, 0x18]
adds r4, r6, 0
add r0, sp, 0x18
ldr r5, =0xffff0000
lsls r1, r4, 16
movs r2, 0x80
lsls r2, 4
orrs r1, r2
str r1, [r0, 0x4]
bl LoadSpriteSheet
ldrh r0, [r7]
ldr r1, [r7, 0x4]
ldr r2, [r7, 0x8]
bl GetFrontSpritePalFromSpeciesAndPersonality
str r0, [sp, 0x20]
add r0, sp, 0x20
ldr r1, [r0, 0x4]
ands r1, r5
orrs r1, r4
str r1, [r0, 0x4]
bl LoadCompressedSpritePalette
mov r0, r8
bl Free
mov r0, r10
bl Free
mov r1, sp
mov r0, sp
ldrh r0, [r0]
adds r0, r6
strh r0, [r1]
mov r0, sp
ldrh r0, [r0, 0x2]
adds r0, r6
strh r0, [r1, 0x2]
ldr r4, [sp, 0x28]
lsls r1, r4, 16
asrs r1, 16
ldr r0, [sp, 0x2C]
lsls r2, r0, 16
asrs r2, 16
mov r0, sp
ldr r3, [sp, 0x30]
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x40
beq _0802CAF4
lsls r0, r6, 2
ldr r2, =0x000081a8
add r2, r9
adds r2, r0
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
str r0, [r2]
ldr r0, =0x000081fc
add r0, r9
adds r0, r6
add r1, sp, 0x30
ldrb r1, [r1]
strb r1, [r0]
b _0802CB00
.pool
_0802CAF4:
lsls r0, r6, 2
ldr r1, =0x000081a8
add r1, r9
adds r1, r0
movs r0, 0
str r0, [r1]
_0802CB00:
add sp, 0x34
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_802C9D4
thumb_func_start sub_802CB14
sub_802CB14: @ 802CB14
push {r4-r6,lr}
adds r4, r0, 0
lsls r6, r1, 2
ldr r0, =0x000081bc
adds r5, r4, r0
adds r5, r6
ldr r0, [r5]
bl sub_802C9BC
ldr r2, [r5]
ldr r0, =0x000081a8
adds r4, r0
adds r4, r6
ldr r1, [r4]
ldr r0, =gSprites
subs r1, r0
lsls r0, r1, 4
subs r0, r1
lsls r1, r0, 8
adds r0, r1
lsls r1, r0, 16
adds r0, r1
negs r0, r0
asrs r0, 2
strh r0, [r2, 0x3C]
ldr r1, [r5]
adds r1, 0x3E
ldrb r2, [r1]
movs r0, 0x5
negs r0, r0
ands r0, r2
strb r0, [r1]
ldr r1, [r5]
movs r0, 0x60
strh r0, [r1, 0x22]
ldr r0, [r5]
ldr r1, =sub_802CB7C
str r1, [r0, 0x1C]
movs r1, 0x1
bl StartSpriteAnim
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CB14
thumb_func_start sub_802CB7C
sub_802CB7C: @ 802CB7C
push {lr}
adds r2, r0, 0
movs r1, 0x2E
ldrsh r0, [r2, r1]
cmp r0, 0x1
beq _0802CBA8
cmp r0, 0x1
bgt _0802CB92
cmp r0, 0
beq _0802CB98
b _0802CBE6
_0802CB92:
cmp r0, 0x2
beq _0802CBC8
b _0802CBE6
_0802CB98:
adds r0, r2, 0
adds r0, 0x3F
ldrb r1, [r0]
movs r0, 0x10
ands r0, r1
cmp r0, 0
beq _0802CBE6
b _0802CBD6
_0802CBA8:
ldrh r1, [r2, 0x22]
subs r1, 0x1
strh r1, [r2, 0x22]
ldrh r0, [r2, 0x30]
adds r0, 0x1
strh r0, [r2, 0x30]
lsls r1, 16
asrs r1, 16
cmp r1, 0x48
bgt _0802CBE6
movs r0, 0x48
strh r0, [r2, 0x22]
ldrh r0, [r2, 0x2E]
adds r0, 0x1
strh r0, [r2, 0x2E]
b _0802CBE6
_0802CBC8:
ldrh r0, [r2, 0x30]
adds r0, 0x1
strh r0, [r2, 0x30]
lsls r0, 16
asrs r0, 16
cmp r0, 0x2F
ble _0802CBE6
_0802CBD6:
adds r3, r2, 0
adds r3, 0x3E
ldrb r0, [r3]
movs r1, 0x4
orrs r0, r1
strb r0, [r3]
ldr r0, =SpriteCallbackDummy
str r0, [r2, 0x1C]
_0802CBE6:
pop {r0}
bx r0
.pool
thumb_func_end sub_802CB7C
thumb_func_start sub_802CBF0
sub_802CBF0: @ 802CBF0
push {lr}
lsls r1, 2
ldr r2, =0x000081a8
adds r0, r2
adds r0, r1
ldr r2, [r0]
ldr r1, =sub_802CC40
str r1, [r2, 0x1C]
movs r1, 0
strh r1, [r2, 0x26]
ldr r0, [r0]
bl sub_802C9BC
pop {r0}
bx r0
.pool
thumb_func_end sub_802CBF0
thumb_func_start sub_802CC18
sub_802CC18: @ 802CC18
push {lr}
movs r2, 0
lsls r1, 2
ldr r3, =0x000081a8
adds r0, r3
adds r0, r1
ldr r0, [r0]
ldr r1, [r0, 0x1C]
ldr r0, =sub_802CC40
cmp r1, r0
bne _0802CC30
movs r2, 0x1
_0802CC30:
adds r0, r2, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_802CC18
thumb_func_start sub_802CC40
sub_802CC40: @ 802CC40
push {lr}
adds r2, r0, 0
ldrh r0, [r2, 0x30]
adds r0, 0x1
strh r0, [r2, 0x30]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
ble _0802CC6C
ldrh r0, [r2, 0x32]
adds r0, 0x1
strh r0, [r2, 0x32]
movs r1, 0x1
ands r0, r1
cmp r0, 0
beq _0802CC64
movs r0, 0x2
b _0802CC66
_0802CC64:
ldr r0, =0x0000fffe
_0802CC66:
strh r0, [r2, 0x26]
movs r0, 0
strh r0, [r2, 0x30]
_0802CC6C:
movs r1, 0x32
ldrsh r0, [r2, r1]
cmp r0, 0xC
ble _0802CC7C
movs r0, 0
strh r0, [r2, 0x26]
ldr r0, =SpriteCallbackDummy
str r0, [r2, 0x1C]
_0802CC7C:
pop {r0}
bx r0
.pool
thumb_func_end sub_802CC40
thumb_func_start sub_802CC88
sub_802CC88: @ 802CC88
push {r4,lr}
adds r4, r0, 0
lsls r1, 2
ldr r0, =0x000081a8
adds r4, r0
adds r4, r1
ldr r0, [r4]
bl sub_802C9BC
ldr r1, [r4]
ldr r0, =sub_802CD08
str r0, [r1, 0x1C]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CC88
thumb_func_start sub_802CCB0
sub_802CCB0: @ 802CCB0
push {r4-r7,lr}
adds r4, r0, 0
bl sub_802C8AC
lsls r0, 16
lsrs r0, 16
cmp r0, 0
beq _0802CCF4
movs r1, 0x5
negs r1, r1
mov r12, r1
ldr r1, =0x000081a8
adds r3, r4, r1
ldr r7, =sub_802CD08
ldr r6, =SpriteCallbackDummy
movs r5, 0xA
adds r4, r0, 0
_0802CCD2:
ldr r2, [r3]
ldr r0, [r2, 0x1C]
cmp r0, r7
bne _0802CCEC
adds r2, 0x3E
ldrb r1, [r2]
mov r0, r12
ands r0, r1
strb r0, [r2]
ldr r0, [r3]
str r6, [r0, 0x1C]
adds r0, 0x43
strb r5, [r0]
_0802CCEC:
adds r3, 0x4
subs r4, 0x1
cmp r4, 0
bne _0802CCD2
_0802CCF4:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CCB0
thumb_func_start sub_802CD08
sub_802CD08: @ 802CD08
push {lr}
adds r3, r0, 0
ldrh r0, [r3, 0x2E]
adds r0, 0x1
strh r0, [r3, 0x2E]
lsls r0, 16
asrs r0, 16
cmp r0, 0x3
ble _0802CD36
movs r0, 0
strh r0, [r3, 0x2E]
adds r3, 0x3E
ldrb r2, [r3]
lsls r0, r2, 29
lsrs r0, 31
movs r1, 0x1
eors r1, r0
lsls r1, 2
movs r0, 0x5
negs r0, r0
ands r0, r2
orrs r0, r1
strb r0, [r3]
_0802CD36:
pop {r0}
bx r0
thumb_func_end sub_802CD08
thumb_func_start sub_802CD3C
sub_802CD3C: @ 802CD3C
push {r4,r5,lr}
adds r4, r0, 0
bl sub_802C8AC
lsls r0, 16
lsrs r3, r0, 16
movs r2, 0
cmp r2, r3
bge _0802CD66
ldr r0, =0x000081fc
adds r5, r4, r0
subs r0, 0x54
adds r4, r0
_0802CD56:
ldm r4!, {r0}
adds r1, r5, r2
ldrb r1, [r1]
adds r0, 0x43
strb r1, [r0]
adds r2, 0x1
cmp r2, r3
blt _0802CD56
_0802CD66:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CD3C
thumb_func_start sub_802CD70
sub_802CD70: @ 802CD70
push {r4,lr}
adds r4, r0, 0
lsls r1, 2
ldr r0, =0x000081a8
adds r4, r0
adds r4, r1
ldr r0, [r4]
bl sub_802C9BC
ldr r1, [r4]
ldr r0, =sub_802CDD4
str r0, [r1, 0x1C]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CD70
thumb_func_start sub_802CD98
sub_802CD98: @ 802CD98
push {r4,r5,lr}
adds r4, r0, 0
bl sub_802C8AC
lsls r0, 16
lsrs r3, r0, 16
movs r2, 0
cmp r2, r3
bge _0802CDCC
ldr r5, =sub_802CDD4
ldr r0, =0x000081a8
adds r1, r4, r0
_0802CDB0:
ldr r0, [r1]
ldr r0, [r0, 0x1C]
cmp r0, r5
bne _0802CDC4
movs r0, 0x1
b _0802CDCE
.pool
_0802CDC4:
adds r1, 0x4
adds r2, 0x1
cmp r2, r3
blt _0802CDB0
_0802CDCC:
movs r0, 0
_0802CDCE:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_802CD98
thumb_func_start sub_802CDD4
sub_802CDD4: @ 802CDD4
push {r4,r5,lr}
adds r5, r0, 0
movs r0, 0x2E
ldrsh r4, [r5, r0]
cmp r4, 0
beq _0802CDE6
cmp r4, 0x1
beq _0802CDF4
b _0802CE3C
_0802CDE6:
movs r0, 0x22
bl PlaySE
strh r4, [r5, 0x30]
ldrh r0, [r5, 0x2E]
adds r0, 0x1
strh r0, [r5, 0x2E]
_0802CDF4:
ldrh r0, [r5, 0x30]
adds r0, 0x4
strh r0, [r5, 0x30]
lsls r0, 16
asrs r0, 16
cmp r0, 0x7F
ble _0802CE06
movs r0, 0
strh r0, [r5, 0x30]
_0802CE06:
ldr r1, =gSineTable
movs r2, 0x30
ldrsh r0, [r5, r2]
lsls r0, 1
adds r0, r1
ldrh r0, [r0]
lsls r0, 16
asrs r0, 19
negs r0, r0
strh r0, [r5, 0x26]
movs r0, 0x30
ldrsh r1, [r5, r0]
cmp r1, 0
bne _0802CE3C
ldrh r0, [r5, 0x32]
adds r0, 0x1
strh r0, [r5, 0x32]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
bgt _0802CE38
strh r1, [r5, 0x2E]
b _0802CE3C
.pool
_0802CE38:
ldr r0, =SpriteCallbackDummy
str r0, [r5, 0x1C]
_0802CE3C:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CDD4
thumb_func_start sub_802CE48
sub_802CE48: @ 802CE48
push {r4,r5,lr}
adds r5, r0, 0
lsls r3, 24
lsrs r4, r3, 24
ldr r0, =gUnknown_082FC00C
lsls r1, 16
asrs r1, 16
lsls r2, 16
asrs r2, 16
movs r3, 0x1
bl CreateSprite
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x40
beq _0802CE88
ldr r0, =gSprites
lsls r1, r2, 4
adds r1, r2
lsls r1, 2
adds r1, r0
adds r3, r1, 0
adds r3, 0x3E
ldrb r0, [r3]
movs r2, 0x4
orrs r0, r2
strb r0, [r3]
lsls r2, r4, 2
ldr r3, =0x000081bc
adds r0, r5, r3
adds r0, r2
str r1, [r0]
_0802CE88:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CE48
thumb_func_start sub_802CE9C thumb_func_start sub_802CE9C
sub_802CE9C: @ 802CE9C sub_802CE9C: @ 802CE9C
push {r4-r7,lr} push {r4-r7,lr}

View File

@ -4,6 +4,7 @@
#include "main.h" #include "main.h"
void sub_802A9A8(u16 monId, MainCallback callback); void sub_802A9A8(u16 monId, MainCallback callback);
bool32 sub_802C908(u16 species);
#endif // GUARD_POKEMON_JUMP_H #endif // GUARD_POKEMON_JUMP_H

View File

@ -162,7 +162,6 @@ extern u8 gUnknown_02022C3E;
// Exported ROM declarations // Exported ROM declarations
u8 sub_8013F78(void); u8 sub_8013F78(void);
bool32 sub_802C908(u16);
void nullsub_89(u8 taskId); void nullsub_89(u8 taskId);
void var_800D_set_xB(void); void var_800D_set_xB(void);
void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0); void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0);

View File

@ -45,11 +45,11 @@
#include "player_pc.h" #include "player_pc.h"
#include "pokemon.h" #include "pokemon.h"
#include "pokemon_icon.h" #include "pokemon_icon.h"
#include "pokemon_jump.h"
#include "pokemon_storage_system.h" #include "pokemon_storage_system.h"
#include "pokemon_summary_screen.h" #include "pokemon_summary_screen.h"
#include "region_map.h" #include "region_map.h"
#include "reshow_battle_screen.h" #include "reshow_battle_screen.h"
#include "union_room.h"
#include "scanline_effect.h" #include "scanline_effect.h"
#include "script.h" #include "script.h"
#include "sound.h" #include "sound.h"
@ -61,6 +61,7 @@
#include "text.h" #include "text.h"
#include "text_window.h" #include "text_window.h"
#include "trade.h" #include "trade.h"
#include "union_room.h"
#include "window.h" #include "window.h"
#include "constants/battle.h" #include "constants/battle.h"
#include "constants/battle_frontier.h" #include "constants/battle_frontier.h"

View File

@ -1,5 +1,8 @@
#include "global.h" #include "global.h"
#include "alloc.h" #include "alloc.h"
#include "data.h"
#include "decompress.h"
#include "event_data.h"
#include "item.h" #include "item.h"
#include "link.h" #include "link.h"
#include "link_rfu.h" #include "link_rfu.h"
@ -12,6 +15,7 @@
#include "sprite.h" #include "sprite.h"
#include "string_util.h" #include "string_util.h"
#include "task.h" #include "task.h"
#include "trig.h"
#include "pokemon.h" #include "pokemon.h"
#include "pokemon_jump.h" #include "pokemon_jump.h"
#include "constants/rgb.h" #include "constants/rgb.h"
@ -121,11 +125,25 @@ struct Unk802B078
int unk8; int unk8;
}; };
struct PokemonJump2
{
u8 filler0[0xE];
u8 unkE;
u8 unkF;
u8 filler10[0x8198];
struct Sprite *unk81A8[MAX_RFU_PLAYERS];
struct Sprite *unk81BC[MAX_RFU_PLAYERS];
struct Sprite *unk81D0[8];
u8 filler81F0[0xC];
u8 unk81FC[MAX_RFU_PLAYERS];
};
static void sub_802AA60(struct PokemonJump1 *); static void sub_802AA60(struct PokemonJump1 *);
void sub_802AA94(struct PokemonJump1 *); void sub_802AA94(struct PokemonJump1 *);
void sub_802AB20(void); void sub_802AB20(void);
static void sub_802AB98(void); static void sub_802AB98(void);
s16 sub_802AC00(u16); static s16 sub_802AC00(u16 species);
static void sub_802AC2C(struct PokemonJump1_MonInfo *monInfo, struct Pokemon *mon); static void sub_802AC2C(struct PokemonJump1_MonInfo *monInfo, struct Pokemon *mon);
static void sub_802AC6C(void); static void sub_802AC6C(void);
static void sub_802ACA0(u8 taskId); static void sub_802ACA0(u8 taskId);
@ -191,8 +209,12 @@ static bool32 sub_802C7BC(void);
static u16 sub_802C7E0(void); static u16 sub_802C7E0(void);
static void sub_802C808(u16, u16 *, u16 *); static void sub_802C808(u16, u16 *, u16 *);
static u16 sub_802C818(void); static u16 sub_802C818(void);
u16 sub_802C838(void); static u16 sub_802C838(void);
u16 sub_802C880(u16, u16); static u16 sub_802C880(u16 item, u16 quantity);
static void sub_802CB7C(struct Sprite *sprite);
static void sub_802CC40(struct Sprite *sprite);
static void sub_802CD08(struct Sprite *sprite);
static void sub_802CDD4(struct Sprite *sprite);
void sub_802DC9C(u32); void sub_802DC9C(u32);
void sub_802D074(void *); void sub_802D074(void *);
void sub_802D0AC(void); void sub_802D0AC(void);
@ -229,6 +251,7 @@ int sub_802E354(int, u16, u16);
void sub_802E3A8(void); void sub_802E3A8(void);
extern struct PokemonJump1 *gUnknown_02022CFC; extern struct PokemonJump1 *gUnknown_02022CFC;
extern struct PokemonJump2 *gUnknown_02022D00;
const struct PokemonJumpMons gPkmnJumpSpecies[] = const struct PokemonJumpMons gPkmnJumpSpecies[] =
{ {
@ -363,10 +386,17 @@ bool32 (* const gUnknown_082FB618[])(void) =
extern const u16 gUnknown_082FB63C[]; extern const u16 gUnknown_082FB63C[];
extern const u16 gUnknown_082FB64C[4]; extern const u16 gUnknown_082FB64C[4];
extern const u16 gUnknown_082FB654[]; extern const u16 gUnknown_082FB654[];
extern s8 gUnknown_082FB65C[][48]; extern const s8 gUnknown_082FB65C[][48];
extern int gUnknown_082FB6EC[]; extern const int gUnknown_082FB6EC[];
extern int gUnknown_082FB714[]; extern const int gUnknown_082FB714[];
extern u16 gUnknown_082FB704[8]; extern const u16 gUnknown_082FB704[8];
extern const struct CompressedSpriteSheet gUnknown_082FBE08[5];
extern const struct SpritePalette gUnknown_082FBE30[2];
extern const struct SpriteTemplate gUnknown_082FBE40;
extern const struct SpriteTemplate gUnknown_082FC00C;
extern const s16 gUnknown_082FBE58[];
extern const s16 gUnknown_082FBEA8[8];
extern const struct SpriteTemplate gUnknown_082FBEB8[4];
void sub_802A9A8(u16 partyIndex, MainCallback callback) void sub_802A9A8(u16 partyIndex, MainCallback callback)
{ {
@ -480,7 +510,7 @@ static void sub_802AB98(void)
} }
} }
s16 sub_802AC00(u16 species) static s16 sub_802AC00(u16 species)
{ {
u32 i; u32 i;
for (i = 0; i < ARRAY_COUNT(gPkmnJumpSpecies); i++) for (i = 0; i < ARRAY_COUNT(gPkmnJumpSpecies); i++)
@ -2022,3 +2052,355 @@ static u16 sub_802C818(void)
u16 index = Random() % ARRAY_COUNT(gUnknown_082FB704); u16 index = Random() % ARRAY_COUNT(gUnknown_082FB704);
return gUnknown_082FB704[index]; return gUnknown_082FB704[index];
} }
NAKED
static u16 sub_802C838(void)
{
asm_unified("\n\
push {r4-r6,lr}\n\
movs r5, 0\n\
movs r4, 0\n\
ldr r3, =gUnknown_02022CFC\n\
ldr r0, [r3]\n\
ldr r2, =gUnknown_082FB714\n\
ldr r1, [r0, 0x78]\n\
ldr r0, [r2]\n\
cmp r1, r0\n\
bcc _0802C874\n\
ldr r5, [r2, 0x4]\n\
adds r6, r3, 0\n\
adds r3, r2, 0x4\n\
_0802C852:\n\
adds r3, 0x8\n\
adds r2, 0x8\n\
adds r4, 0x1\n\
cmp r4, 0x4\n\
bhi _0802C874\n\
ldr r0, [r6]\n\
ldr r1, [r0, 0x78]\n\
ldr r0, [r2]\n\
cmp r1, r0\n\
bcc _0802C874\n\
ldr r5, [r3]\n\
b _0802C852\n\
.pool\n\
_0802C874:\n\
lsls r0, r5, 16\n\
lsrs r0, 16\n\
pop {r4-r6}\n\
pop {r1}\n\
bx r1");
}
static u16 sub_802C880(u16 item, u16 quantity)
{
while (quantity && !CheckBagHasSpace(item, quantity))
quantity--;
return quantity;
}
u16 sub_802C8AC(void)
{
return GetLinkPlayerCount();
}
u16 sub_802C8BC(void)
{
return gUnknown_02022CFC->unk6;
}
struct PokemonJump1_MonInfo *sub_802C8C8(u8 multiplayerId)
{
return &gUnknown_02022CFC->unk82A8[multiplayerId];
}
u8 *sub_802C8E8(u8 multiplayerId)
{
return gUnknown_02022CFC->unk82E4[multiplayerId].unk1C;
}
bool32 sub_802C908(u16 species)
{
return sub_802AC00(species) > -1;
}
void sub_802C920(void)
{
int i;
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES))
{
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
if (sub_802C908(species))
{
gSpecialVar_Result = 1;
return;
}
}
}
gSpecialVar_Result = 0;
}
void sub_802C974(struct PokemonJump2 *arg0)
{
int i;
for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE08); i++)
LoadCompressedSpriteSheet(&gUnknown_082FBE08[i]);
for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE30); i++)
LoadSpritePalette(&gUnknown_082FBE30[i]);
arg0->unkE = IndexOfSpritePaletteTag(5);
arg0->unkF = IndexOfSpritePaletteTag(6);
}
static void sub_802C9BC(struct Sprite *sprite)
{
int i;
for (i = 0; i < 8; i++)
sprite->data[i] = 0;
}
void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo *jumpMon, u16 x, u16 y, u8 multiplayerId)
{
struct SpriteTemplate spriteTemplate;
struct SpriteSheet spriteSheet;
struct CompressedSpritePalette spritePalette;
u8 *buffer;
u8 *unusedBuffer;
u8 subpriority;
u8 spriteId;
spriteTemplate = gUnknown_082FBE40;
buffer = Alloc(0x2000);
unusedBuffer = Alloc(0x800);
if (multiplayerId == sub_802C8BC())
subpriority = 3;
else
subpriority = multiplayerId + 4;
if (buffer && unusedBuffer)
{
HandleLoadSpecialPokePic(
&gMonStillFrontPicTable[jumpMon->species],
buffer,
jumpMon->species,
jumpMon->personality);
spriteSheet.data = buffer;
spriteSheet.tag = multiplayerId;
spriteSheet.size = 0x800;
LoadSpriteSheet(&spriteSheet);
spritePalette.data = GetFrontSpritePalFromSpeciesAndPersonality(jumpMon->species, jumpMon->otId, jumpMon->personality);
spritePalette.tag = multiplayerId;
LoadCompressedSpritePalette(&spritePalette);
Free(buffer);
Free(unusedBuffer);
spriteTemplate.tileTag += multiplayerId;
spriteTemplate.paletteTag += multiplayerId;
spriteId = CreateSprite(&spriteTemplate, x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
arg0->unk81A8[multiplayerId] = &gSprites[spriteId];
arg0->unk81FC[multiplayerId] = subpriority;
return;
}
}
arg0->unk81A8[multiplayerId] = NULL;
}
void sub_802CB14(struct PokemonJump2 *arg0, int multiplayerId)
{
sub_802C9BC(arg0->unk81BC[multiplayerId]);
arg0->unk81BC[multiplayerId]->data[7] = arg0->unk81A8[multiplayerId] - gSprites;
arg0->unk81BC[multiplayerId]->invisible = 0;
arg0->unk81BC[multiplayerId]->pos1.y = 96;
arg0->unk81BC[multiplayerId]->callback = sub_802CB7C;
StartSpriteAnim(arg0->unk81BC[multiplayerId], 1);
}
static void sub_802CB7C(struct Sprite *sprite)
{
switch (sprite->data[0])
{
case 0:
if (sprite->animEnded)
{
sprite->invisible = 1;
sprite->callback = SpriteCallbackDummy;
}
break;
case 1:
sprite->pos1.y--;
sprite->data[1]++;
if (sprite->pos1.y <= 72)
{
sprite->pos1.y = 72;
sprite->data[0]++;
}
break;
case 2:
if (++sprite->data[1] >= 48)
{
sprite->invisible = 1;
sprite->callback = SpriteCallbackDummy;
}
break;
}
}
void sub_802CBF0(struct PokemonJump2 *arg0, int multiplayerId)
{
arg0->unk81A8[multiplayerId]->callback = sub_802CC40;
arg0->unk81A8[multiplayerId]->pos2.y = 0;
sub_802C9BC(arg0->unk81A8[multiplayerId]);
}
bool32 sub_802CC18(struct PokemonJump2 *arg0, int multiplayerId)
{
return arg0->unk81A8[multiplayerId]->callback == sub_802CC40;
}
static void sub_802CC40(struct Sprite *sprite)
{
if (++sprite->data[1] > 1)
{
if (++sprite->data[2] & 1)
sprite->pos2.y = 2;
else
sprite->pos2.y = -2;
sprite->data[1] = 0;
}
if (sprite->data[2] > 12)
{
sprite->pos2.y = 0;
sprite->callback = SpriteCallbackDummy;
}
}
void sub_802CC88(struct PokemonJump2 *arg0, int multiplayerId)
{
sub_802C9BC(arg0->unk81A8[multiplayerId]);
arg0->unk81A8[multiplayerId]->callback = sub_802CD08;
}
void sub_802CCB0(struct PokemonJump2 *arg0)
{
int i;
u16 numPlayers = sub_802C8AC();
for (i = 0; i < numPlayers; i++)
{
if (arg0->unk81A8[i]->callback == sub_802CD08)
{
arg0->unk81A8[i]->invisible = 0;
arg0->unk81A8[i]->callback = SpriteCallbackDummy;
arg0->unk81A8[i]->subpriority = 10;
}
}
}
static void sub_802CD08(struct Sprite *sprite)
{
if (++sprite->data[0] > 3)
{
sprite->data[0] = 0;
sprite->invisible ^= 1;
}
}
void sub_802CD3C(struct PokemonJump2 *arg0)
{
int i;
u16 numPlayers = sub_802C8AC();
for (i = 0; i < numPlayers; i++)
arg0->unk81A8[i]->subpriority = arg0->unk81FC[i];
}
void sub_802CD70(struct PokemonJump2 *arg0, int multiplayerId)
{
sub_802C9BC(arg0->unk81A8[multiplayerId]);
arg0->unk81A8[multiplayerId]->callback = sub_802CDD4;
}
bool32 sub_802CD98(struct PokemonJump2 *arg0)
{
int i;
u16 numPlayers = sub_802C8AC();
for (i = 0; i < numPlayers; i++)
{
if (arg0->unk81A8[i]->callback == sub_802CDD4)
return TRUE;
}
return FALSE;
}
static void sub_802CDD4(struct Sprite *sprite)
{
switch (sprite->data[0])
{
case 0:
PlaySE(SE_JITE_PYOKO);
sprite->data[1] = 0;
sprite->data[0]++;
// fall through
case 1:
sprite->data[1] += 4;
if (sprite->data[1] > 0x7F)
sprite->data[1] = 0;
sprite->pos2.y = -(gSineTable[sprite->data[1]] >> 3);
if (sprite->data[1] == 0)
{
if (++sprite->data[2] < 2)
sprite->data[0] = 0;
else
sprite->callback = SpriteCallbackDummy;
}
break;
}
}
void sub_802CE48(struct PokemonJump2 *arg0, s16 x, s16 y, u8 multiplayerId)
{
u8 spriteId = CreateSprite(&gUnknown_082FC00C, x, y, 1);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].invisible = 1;
arg0->unk81BC[multiplayerId] = &gSprites[spriteId];
}
}
// void sub_802CE9C(struct PokemonJump2 *arg0)
// {
// int i;
// int count;
// u8 spriteId;
// count = 0;
// for (i = 0; i < 4; i++)
// {
// spriteId = CreateSprite(&gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i * 10], 2);
// arg0->unk81D0[count] = &gSprites[spriteId];
// count++;
// }
// for (i = 0; i < 4; i++)
// {
// spriteId = CreateSprite(&gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i * 10], 2);
// arg0->unk81D0[count] = &gSprites[spriteId];
// arg0->unk81D0[count]->hFlip = 1;
// count++;
// }
// }