start working on pokeball

This commit is contained in:
DizzyEggg 2017-12-02 19:39:07 +01:00
parent 0250aefb73
commit c27f7a8131
26 changed files with 1256 additions and 2270 deletions

View File

@ -5,8 +5,8 @@
.text
thumb_func_start sub_80A5C6C
sub_80A5C6C: @ 80A5C6C
thumb_func_start GetBankPosition
GetBankPosition: @ 80A5C6C
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
@ -154,7 +154,7 @@ _080A5DB0:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_80A5C6C
thumb_func_end GetBankPosition
thumb_func_start sub_80A5DB8
sub_80A5DB8: @ 80A5DB8
@ -577,7 +577,7 @@ _080A611C:
_080A6126:
adds r0, r4, 0
adds r1, r5, 0
bl sub_80A5C6C
bl GetBankPosition
_080A612E:
lsls r0, 24
lsrs r0, 24
@ -592,7 +592,7 @@ GetBankSpriteDefault_Y: @ 80A6138
lsls r0, 24
lsrs r0, 24
movs r1, 0x4
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
pop {r1}
@ -611,7 +611,7 @@ GetSubstituteSpriteDefault_Y: @ 80A614C
beq _080A6170
adds r0, r4, 0
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 8
movs r1, 0x80
@ -620,7 +620,7 @@ GetSubstituteSpriteDefault_Y: @ 80A614C
_080A6170:
adds r0, r4, 0
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 8
movs r1, 0x88
@ -642,7 +642,7 @@ sub_80A6190: @ 80A6190
lsrs r5, r0, 24
adds r0, r5, 0
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r6, r0, 24
bl IsContest
@ -1245,13 +1245,13 @@ sub_80A65EC: @ 80A65EC
ldr r5, =gAnimBankTarget
ldrb r0, [r5]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x32]
ldrb r0, [r5]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x36]
@ -1442,13 +1442,13 @@ sub_80A6760: @ 80A6760
ldr r5, =gAnimBankAttacker
ldrb r0, [r5]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x32]
ldrb r0, [r5]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x36]
@ -1550,13 +1550,13 @@ sub_80A6838: @ 80A6838
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x20]
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x22]
@ -1578,13 +1578,13 @@ sub_80A6864: @ 80A6864
ldr r7, =gAnimBankAttacker
ldrb r0, [r7]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r6, r0, 24
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
cmp r6, r0
@ -1646,8 +1646,8 @@ sub_80A68D4: @ 80A68D4
bx r0
thumb_func_end sub_80A68D4
thumb_func_start sub_80A6900
sub_80A6900: @ 80A6900
thumb_func_start AnimateBallThrow
AnimateBallThrow: @ 80A6900
push {r4,lr}
adds r4, r0, 0
bl sub_80A6F3C
@ -1674,7 +1674,7 @@ _080A692E:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_80A6900
thumb_func_end AnimateBallThrow
thumb_func_start sub_80A6934
sub_80A6934: @ 80A6934
@ -3685,7 +3685,7 @@ _080A785C:
ldr r4, =gAnimBankTarget
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r1, [r6, 0x4]
@ -3693,7 +3693,7 @@ _080A785C:
strh r0, [r5, 0x32]
ldrb r0, [r4]
adds r1, r7, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r6, [r6, 0x6]
@ -3733,7 +3733,7 @@ _080A78CC:
ldr r5, =gAnimBankTarget
ldrb r0, [r5]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r1, [r4, 0x4]
@ -3741,7 +3741,7 @@ _080A78CC:
strh r0, [r6, 0x32]
ldrb r0, [r5]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r1, [r4, 0x6]
@ -3763,7 +3763,7 @@ _080A78CC:
sub_80A791C: @ 80A791C
push {r4,lr}
adds r4, r0, 0
bl sub_80A6900
bl AnimateBallThrow
lsls r0, 24
cmp r0, 0
beq _080A7930
@ -3828,7 +3828,7 @@ _080A798E:
strh r0, [r5, 0x2E]
adds r0, r6, 0
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r2, [r4, 0x4]
@ -3836,7 +3836,7 @@ _080A798E:
strh r0, [r5, 0x32]
adds r0, r6, 0
adds r1, r7, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r4, [r4, 0x6]
@ -5713,7 +5713,7 @@ _080A88A6:
_080A88AE:
mov r0, r8
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrb r1, [r4]
@ -5722,7 +5722,7 @@ _080A88AE:
_080A88C0:
mov r0, r8
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrb r1, [r4]
@ -5731,7 +5731,7 @@ _080A88C0:
_080A88D2:
mov r0, r8
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrb r2, [r4]
@ -5744,7 +5744,7 @@ _080A88E4:
_080A88EA:
mov r0, r8
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrb r2, [r4]
@ -5757,7 +5757,7 @@ _080A88FC:
_080A8902:
mov r0, r8
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r0, 0x1F
@ -5798,13 +5798,13 @@ _080A8942:
_080A8946:
adds r0, r4, 0
adds r1, r5, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
mov r8, r0
adds r0, r4, 0
adds r1, r6, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r7, r0, 24
bl IsDoubleBattle
@ -5819,12 +5819,12 @@ _080A8946:
eors r4, r0
adds r0, r4, 0
adds r1, r5, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r5, r0, 24
adds r0, r4, 0
adds r1, r6, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r3, r0, 24
mov r0, r8
@ -6392,13 +6392,13 @@ sub_80A8E30: @ 80A8E30
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x20]
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x22]

View File

@ -334,7 +334,7 @@ sub_80A9EF4: @ 80A9EF4
ldr r4, =gAnimBankTarget
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 8
ldr r1, =0xffe00000
@ -342,7 +342,7 @@ sub_80A9EF4: @ 80A9EF4
lsrs r5, r0, 16
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 8
ldr r1, =0xffdc0000

File diff suppressed because it is too large Load Diff

View File

@ -90,7 +90,7 @@ sub_815A160: @ 815A160
ldr r6, =gAnimBankTarget
ldrb r0, [r6]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
adds r4, r0, 0
lsls r4, 24
lsrs r4, 8
@ -100,7 +100,7 @@ sub_815A160: @ 815A160
asrs r4, 16
ldrb r0, [r6]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
adds r1, r0, 0
lsls r1, 24
lsrs r1, 8
@ -210,13 +210,13 @@ sub_815A254: @ 815A254
ldr r4, =gAnimBankTarget
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r7, r0, 0
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r6, r0, 0
@ -816,7 +816,7 @@ _0815A6F8:
sub_815A73C: @ 815A73C
push {r4,lr}
adds r4, r0, 0
bl sub_80A6900
bl AnimateBallThrow
lsls r0, 24
cmp r0, 0
beq _0815A75E
@ -1254,13 +1254,13 @@ sub_815AAA4: @ 815AAA4
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x20]
ldrb r0, [r4]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x22]
@ -1510,7 +1510,7 @@ _0815ACEC:
_0815ACEE:
ldrb r0, [r4]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r6, [r6, 0x2]
@ -1518,7 +1518,7 @@ _0815ACEE:
strh r0, [r5, 0x20]
ldrb r0, [r4]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x22]
@ -1906,13 +1906,13 @@ sub_815AFF0: @ 815AFF0
ldr r6, =gAnimBankAttacker
ldrb r0, [r6]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0xC]
ldrb r0, [r6]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0xE]
@ -2281,13 +2281,13 @@ _0815B2D8:
ldr r4, =gAnimBankTarget
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x32]
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x36]
@ -2373,13 +2373,13 @@ _0815B3BE:
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x20]
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x22]
@ -2817,7 +2817,7 @@ _0815B71E:
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x32]
@ -3624,14 +3624,14 @@ _0815BE2E:
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r0, r5
strh r0, [r7, 0x20]
ldrb r0, [r4]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r0, 0x20
@ -4994,13 +4994,13 @@ sub_815C95C: @ 815C95C
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x20]
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x22]
@ -5531,13 +5531,13 @@ sub_815CDB4: @ 815CDB4
ldr r5, =gAnimBankAttacker
ldrb r0, [r5]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x20]
ldrb r0, [r5]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x22]
@ -5842,13 +5842,13 @@ _0815D05A:
ldr r5, =gAnimBankAttacker
ldrb r0, [r5]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldrb r0, [r5]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
mov r2, r10
lsls r1, r2, 16
@ -6840,7 +6840,7 @@ _0815D896:
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r1, [r6, 0x2]
@ -6848,7 +6848,7 @@ _0815D896:
strh r0, [r5, 0x20]
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r6, [r6, 0x4]
@ -7382,13 +7382,13 @@ _0815DCEA:
ldrb r4, [r0]
adds r0, r4, 0
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x10]
adds r0, r4, 0
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x12]
@ -7789,7 +7789,7 @@ sub_815E01C: @ 815E01C
_0815E038:
ldrb r0, [r6]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
ldr r4, =gBattleAnimArgs
lsrs r0, 24
@ -7798,7 +7798,7 @@ _0815E038:
strh r0, [r5, 0x20]
ldrb r0, [r6]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r1, [r4, 0x2]
@ -7931,7 +7931,7 @@ _0815E14E:
bne _0815E188
ldrb r0, [r5]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
adds r4, r0, 0
ldrb r0, [r5]
movs r1, 0
@ -7951,7 +7951,7 @@ _0815E17C:
_0815E188:
ldrb r0, [r5]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
adds r4, r0, 0
ldrb r0, [r5]
movs r1, 0
@ -7971,7 +7971,7 @@ _0815E1AC:
ldr r5, =gAnimBankAttacker
ldrb r0, [r5]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
adds r4, r0, 0
ldrb r0, [r5]
movs r1, 0
@ -7990,13 +7990,13 @@ _0815E1D0:
ldr r4, =gAnimBankTarget
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x22]
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x24]
@ -8349,14 +8349,14 @@ sub_815E47C: @ 815E47C
mov r10, r0
ldrb r0, [r0]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r7, 0x1E]
mov r1, r10
ldrb r0, [r1]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r7, 0x20]
@ -8364,14 +8364,14 @@ sub_815E47C: @ 815E47C
mov r8, r0
ldrb r0, [r0]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r7, 0x22]
mov r1, r8
ldrb r0, [r1]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
adds r4, r0, 0
mov r1, r8
ldrb r0, [r1]
@ -8524,7 +8524,7 @@ _0815E5FE:
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
bl sub_80A6900
bl AnimateBallThrow
ldrh r0, [r4, 0xC]
adds r0, 0x1
strh r0, [r4, 0xC]
@ -8542,7 +8542,7 @@ _0815E634:
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
bl sub_80A6900
bl AnimateBallThrow
lsls r0, 24
cmp r0, 0
beq _0815E6D2
@ -8659,7 +8659,7 @@ _0815E724:
strh r1, [r4, 0x3C]
adds r0, r5, 0
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x22]
@ -8950,7 +8950,7 @@ _0815E970:
_0815E972:
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x20]
@ -9342,7 +9342,7 @@ sub_815EC48: @ 815EC48
ldr r5, =gAnimBankAttacker
ldrb r0, [r5]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
@ -9350,7 +9350,7 @@ sub_815EC48: @ 815EC48
movs r0, 0x2
eors r0, r1
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
cmp r4, r0
@ -9771,14 +9771,14 @@ _0815EFEC:
lsls r0, 24
lsrs r0, 24
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r5, r0, 24
ldrh r0, [r4, 0x3C]
lsls r0, 24
lsrs r0, 24
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r1, r0, 24
_0815F00C:
@ -9994,10 +9994,10 @@ sub_815F18C: @ 815F18C
ldr r4, =gAnimBankTarget
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
ldrb r0, [r4]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
ldrb r0, [r4]
bl GetBankSide
lsls r0, 24
@ -10387,7 +10387,7 @@ _0815F4C8:
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
movs r1, 0x3
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x22]
@ -11180,7 +11180,7 @@ _0815FB50:
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
lsls r3, r5, 16
@ -11318,7 +11318,7 @@ _0815FC56:
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
cmp r4, r0
@ -11331,7 +11331,7 @@ _0815FCB4:
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
cmp r4, r0
@ -11469,7 +11469,7 @@ _0815FD8C:
mov r1, r10
ldrb r0, [r1]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r3, r5, 0
@ -11499,7 +11499,7 @@ _0815FE0C:
mov r2, r10
ldrb r0, [r2]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r3, r5, 0
@ -11566,7 +11566,7 @@ _0815FE92:
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r0, 0x10
@ -11724,14 +11724,14 @@ _08160008:
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r5, r0, 0
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
adds r2, r0, 0
@ -12169,7 +12169,7 @@ sub_81603A8: @ 81603A8
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
movs r1, 0x2
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x20]

View File

@ -886,7 +886,7 @@ _08170C08:
bl GetMonData
lsls r0, 16
lsrs r0, 16
bl ball_number_to_ball_processing_index
bl ItemIdToBallId
lsls r0, 24
lsrs r0, 24
mov r8, r0
@ -907,13 +907,13 @@ _08170C44:
ldr r5, =gAnimBankAttacker
ldrb r0, [r5]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldrb r0, [r5]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
adds r1, r0, 0
lsls r1, 24
ldr r2, =gSprites
@ -934,7 +934,7 @@ _08170C44:
mov r0, r8
str r0, [sp]
adds r0, r4, 0
bl sub_8171D98
bl LaunchBallStarsTask
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x1C]
@ -950,7 +950,7 @@ _08170C44:
ldrb r1, [r5]
movs r0, 0
mov r3, r8
bl sub_81729E8
bl LaunchBallFadeMonTask
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x1E]
@ -998,10 +998,10 @@ sub_8170CFC: @ 8170CFC
lsrs r4, 24
ldr r0, =gLastUsedItem
ldrh r0, [r0]
bl ball_number_to_ball_processing_index
bl ItemIdToBallId
lsls r0, 24
lsrs r0, 24
bl sub_8076A78
bl LoadBallGfx
adds r0, r4, 0
bl DestroyAnimVisualTask
pop {r4}
@ -1018,10 +1018,10 @@ sub_8170D24: @ 8170D24
lsrs r4, 24
ldr r0, =gLastUsedItem
ldrh r0, [r0]
bl ball_number_to_ball_processing_index
bl ItemIdToBallId
lsls r0, 24
lsrs r0, 24
bl sub_8076AE8
bl FreeBallGfx
adds r0, r4, 0
bl DestroyAnimVisualTask
pop {r4}
@ -1057,8 +1057,8 @@ _08170D74:
.pool
thumb_func_end sub_8170D4C
thumb_func_start ball_number_to_ball_processing_index
ball_number_to_ball_processing_index: @ 8170D84
thumb_func_start ItemIdToBallId
ItemIdToBallId: @ 8170D84
push {lr}
lsls r0, 16
lsrs r0, 16
@ -1123,7 +1123,7 @@ _08170DFC:
_08170DFE:
pop {r1}
bx r1
thumb_func_end ball_number_to_ball_processing_index
thumb_func_end ItemIdToBallId
thumb_func_start sub_8170E04
sub_8170E04: @ 8170E04
@ -1138,14 +1138,14 @@ sub_8170E04: @ 8170E04
mov r10, r0
ldr r0, =gLastUsedItem
ldrh r0, [r0]
bl ball_number_to_ball_processing_index
bl ItemIdToBallId
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
ldr r1, =gUnknown_0832C588
ldr r1, =gBallSpriteTemplates
adds r0, r1
movs r1, 0x20
movs r2, 0x50
@ -1166,14 +1166,14 @@ sub_8170E04: @ 8170E04
mov r8, r2
ldrb r0, [r2]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x30]
mov r1, r8
ldrb r0, [r1]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
subs r0, 0x10
@ -1278,7 +1278,7 @@ _08170F50:
_08170F54:
ldr r0, =gLastUsedItem
ldrh r0, [r0]
bl ball_number_to_ball_processing_index
bl ItemIdToBallId
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
@ -1294,7 +1294,7 @@ _08170F54:
lsls r0, r4, 1
adds r0, r4
lsls r0, 3
ldr r1, =gUnknown_0832C588
ldr r1, =gBallSpriteTemplates
adds r0, r1
adds r1, r6, 0
adds r1, 0x20
@ -1317,14 +1317,14 @@ _08170F54:
mov r8, r1
ldrb r0, [r1]
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x30]
mov r1, r8
ldrb r0, [r1]
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
subs r0, 0x10
@ -1487,7 +1487,7 @@ sub_8171134: @ 8171134
push {r4,r5,lr}
sub sp, 0x4
adds r4, r0, 0
bl sub_80A6900
bl AnimateBallThrow
lsls r0, 24
cmp r0, 0
beq _081711D2
@ -1532,7 +1532,7 @@ _08171188:
str r0, [r4, 0x1C]
ldr r0, =gLastUsedItem
ldrh r0, [r0]
bl ball_number_to_ball_processing_index
bl ItemIdToBallId
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0xB
@ -1549,13 +1549,13 @@ _08171188:
str r5, [sp]
movs r2, 0x1
movs r3, 0x1C
bl sub_8171D98
bl LaunchBallStarsTask
ldr r0, =gAnimBankTarget
ldrb r1, [r0]
movs r0, 0
movs r2, 0xE
adds r3, r5, 0
bl sub_81729E8
bl LaunchBallFadeMonTask
_081711D2:
add sp, 0x4
pop {r4,r5}
@ -2671,7 +2671,7 @@ sub_8171AAC: @ 8171AAC
orrs r0, r1
strb r0, [r3]
adds r0, r4, 0
bl sub_80A6900
bl AnimateBallThrow
lsls r0, 24
cmp r0, 0
beq _08171ADC
@ -2697,7 +2697,7 @@ sub_8171AE4: @ 8171AE4
str r0, [r4, 0x1C]
ldr r0, =gLastUsedItem
ldrh r0, [r0]
bl ball_number_to_ball_processing_index
bl ItemIdToBallId
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0xB
@ -2714,13 +2714,13 @@ sub_8171AE4: @ 8171AE4
str r5, [sp]
movs r2, 0x1
movs r3, 0x1C
bl sub_8171D98
bl LaunchBallStarsTask
ldr r0, =gAnimBankTarget
ldrb r1, [r0]
movs r0, 0x1
movs r2, 0xE
adds r3, r5, 0
bl sub_81729E8
bl LaunchBallFadeMonTask
_08171B36:
ldr r6, =gSprites
ldr r5, =gBankSpriteIds
@ -3007,8 +3007,8 @@ _08171D86:
.pool
thumb_func_end sub_8171D60
thumb_func_start sub_8171D98
sub_8171D98: @ 8171D98
thumb_func_start LaunchBallStarsTask
LaunchBallStarsTask: @ 8171D98
push {r4-r6,lr}
mov r6, r10
mov r5, r9
@ -3070,7 +3070,7 @@ sub_8171D98: @ 8171D98
pop {r1}
bx r1
.pool
thumb_func_end sub_8171D98
thumb_func_end LaunchBallStarsTask
thumb_func_start sub_8171E20
sub_8171E20: @ 8171E20
@ -4476,8 +4476,8 @@ _081729E2:
bx r0
thumb_func_end sub_8172944
thumb_func_start sub_81729E8
sub_81729E8: @ 81729E8
thumb_func_start LaunchBallFadeMonTask
LaunchBallFadeMonTask: @ 81729E8
push {r4-r7,lr}
mov r7, r9
mov r6, r8
@ -4563,7 +4563,7 @@ _08172A7E:
pop {r1}
bx r1
.pool
thumb_func_end sub_81729E8
thumb_func_end LaunchBallFadeMonTask
thumb_func_start sub_8172AB0
sub_8172AB0: @ 8172AB0
@ -5234,12 +5234,12 @@ _0817303A:
ldrb r0, [r4, 0x8]
mov r8, r0
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r5, r0, 24
mov r0, r8
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r2, r0, 24
movs r1, 0x1E
@ -5579,7 +5579,7 @@ sub_817330C: @ 817330C
lsls r0, 24
lsrs r0, 24
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
ldr r5, =gBattleAnimArgs
lsrs r0, 24
@ -5591,7 +5591,7 @@ sub_817330C: @ 817330C
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
ldrh r5, [r5, 0x6]
@ -5652,7 +5652,7 @@ _081733C0:
sub_81733D4: @ 81733D4
push {r4,lr}
adds r4, r0, 0
bl sub_80A6900
bl AnimateBallThrow
lsls r0, 24
cmp r0, 0
beq _081733F6

View File

@ -13829,13 +13829,13 @@ sub_80DEA5C: @ 80DEA5C
strh r0, [r4, 0x26]
movs r0, 0x3
movs r1, 0
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x20]
movs r0, 0x3
movs r1, 0x1
bl sub_80A5C6C
bl GetBankPosition
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x22]

File diff suppressed because it is too large Load Diff

View File

@ -1424,16 +1424,16 @@ sub_81C4A08: @ 81C4A08
bl GetMonData
lsls r0, 16
lsrs r0, 16
bl ball_number_to_ball_processing_index
bl ItemIdToBallId
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
adds r0, r4, 0
bl sub_8076A78
bl LoadBallGfx
lsls r0, r4, 1
adds r0, r4
lsls r0, 3
ldr r1, =gUnknown_0832C588
ldr r1, =gBallSpriteTemplates
adds r0, r1
movs r1, 0x10
movs r2, 0x88

View File

@ -10,5 +10,5 @@ gUnknown_0832C400:: @ 832C400
gUnknown_0832C460:: @ 832C460
.incbin "baserom.gba", 0x32c460, 0x128
gUnknown_0832C588:: @ 832C588
gBallSpriteTemplates:: @ 832C588
.incbin "baserom.gba", 0x32c588, 0x138

View File

@ -933,7 +933,7 @@ struct BattleHealthboxInfo
u8 flag_x1 : 1;
u8 flag_x2 : 1;
u8 flag_x4 : 1;
u8 flag_x8 : 1;
u8 ballAnimActive : 1; // 0x8
u8 statusAnimActive : 1; // x10
u8 animFromTableActive : 1; // x20
u8 specialAnimActive : 1; //x40

View File

@ -79,11 +79,21 @@ void HandleIntroSlide(u8 terrainId);
// battle_anim_80A5C6C.s
void sub_80A6EEC(struct Sprite *sprite);
void sub_80A68D4(struct Sprite *sprite);
void sub_80A8278(void);
void sub_80A6B30(struct UnknownAnimStruct2*);
void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1);
u8 sub_80A82E4(u8 bank);
u8 sub_80A5C6C(u8 bank, u8 attributeId);
bool8 AnimateBallThrow(struct Sprite *sprite);
enum
{
BANK_X_POS,
BANK_Y_POS,
};
u8 GetBankPosition(u8 bank, u8 attributeId);
bool8 IsBankSpritePresent(u8 bank);
void sub_80A6C68(u8 arg0);
u8 GetAnimBankSpriteId(u8 wantedBank);
@ -99,4 +109,9 @@ u8 GetSubstituteSpriteDefault_Y(u8 bank);
// battle_anim_80A9C70.s
void LaunchStatusAnimation(u8 bank, u8 statusAnimId);
// battle_anim_8170478.s
u8 ItemIdToBallId(u16 itemId);
u8 LaunchBallStarsTask(u8 x, u8 y, u8 kindOfStars, u8 arg3, u8 ballId);
u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 bank, u8 arg2, u8 ballId);
#endif // GUARD_BATTLE_ANIM_H

View File

@ -1,7 +1,14 @@
#ifndef GUARD_POKEBALL_H
#define GUARD_POKEBALL_H
u8 sub_80753E8(u16, u8);
#define POKEBALL_COUNT 12
#define POKEBALL_PLAYER_SENDOUT 0xFF
#define POKEBALL_OPPONENT_SENDOUT 0xFE
u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow);
void LoadBallGfx(u8 ballId);
void FreeBallGfx(u8 ballId);
void sub_8076918(u8 bank);
void DoHitAnimHealthboxEffect(u8 bank);

View File

@ -195,14 +195,7 @@ struct Sprite
/*0x2D*/ u8 animLoopCounter;
// general purpose data fields
/*0x2E*/ s16 data0;
/*0x30*/ s16 data1;
/*0x32*/ s16 data2;
/*0x34*/ s16 data3;
/*0x36*/ s16 data4;
/*0x38*/ s16 data5;
/*0x3A*/ s16 data6;
/*0x3C*/ s16 data7;
/*0x2E*/ s16 data[8];
/*0x3E*/ u16 inUse:1; //1
u16 coordOffsetEnabled:1; //2

View File

@ -81,6 +81,7 @@ SECTIONS {
src/egg_hatch.o(.text);
src/battle_interface.o(.text);
asm/smokescreen.o(.text);
src/pokeball.o(.text);
asm/pokeball.o(.text);
src/load_save.o(.text);
asm/trade.o(.text);

View File

@ -423,7 +423,7 @@ static void ScriptCmd_createsprite(void)
if (subpriority < 3)
subpriority = 3;
CreateSpriteAndAnimate(template, sub_80A5C6C(gAnimBankTarget, 2), sub_80A5C6C(gAnimBankTarget, 3), subpriority);
CreateSpriteAndAnimate(template, GetBankPosition(gAnimBankTarget, 2), GetBankPosition(gAnimBankTarget, 3), subpriority);
gAnimVisualTaskCount++;
}

View File

@ -310,14 +310,14 @@ static void sub_8064734(void)
{
bool32 r10 = FALSE;
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1)
{
sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]);
}
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1)
{
@ -325,7 +325,7 @@ static void sub_8064734(void)
}
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80)
{
@ -527,14 +527,14 @@ static void sub_8064E50(void)
static void sub_8064F40(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80)
{
sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]);
}
if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]);
SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES));
@ -1163,7 +1163,7 @@ static void LinkOpponentHandleLoadMonSprite(void)
sub_806A068(species, GetBankIdentity(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
GetBankPosition(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
@ -1197,7 +1197,7 @@ static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
GetBankPosition(bank, 2),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
@ -1213,7 +1213,7 @@ static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit)
gSprites[gBankSpriteIds[bank]].invisible = TRUE;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE);
gSprites[gUnknown_03005D7C[bank]].data0 = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
}
static void LinkOpponentHandleReturnMonToBall(void)

View File

@ -267,8 +267,8 @@ static void sub_814B004(void)
static void sub_814B0E8(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive
&& gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy
&& ++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 != 1)
@ -412,13 +412,13 @@ static void sub_814B5A8(void)
static void sub_814B69C(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]);
}
if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]);
gBattleBankFunc[gActiveBank] = sub_814B5A8;
@ -1049,7 +1049,7 @@ static void LinkPartnerHandleLoadMonSprite(void)
sub_806A068(species, GetBankIdentity(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
GetBankPosition(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
@ -1080,7 +1080,7 @@ static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
GetBankPosition(bank, 2),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
@ -1096,7 +1096,7 @@ static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit)
gSprites[gBankSpriteIds[bank]].invisible = TRUE;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF);
gSprites[gUnknown_03005D7C[bank]].data0 = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
}
static void LinkPartnerHandleReturnMonToBall(void)

View File

@ -318,11 +318,11 @@ static void sub_805F560(void)
bool32 sp = FALSE;
bool32 r10 = FALSE;
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1)
sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]);
if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI) && IsDoubleBattle() && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1)
if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI) && IsDoubleBattle() && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1)
sub_8172EF0(gActiveBank ^ BIT_MON, &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80)
{
@ -509,11 +509,11 @@ static void sub_805FD00(void)
static void sub_805FDF0(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]);
if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]);
SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES));
@ -1151,7 +1151,7 @@ static void OpponentHandleLoadMonSprite(void)
sub_806A068(species, GetBankIdentity(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
GetBankPosition(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
@ -1186,7 +1186,7 @@ static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit)
sub_806A068(species, GetBankIdentity(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
GetBankPosition(bank, 2),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
@ -1203,7 +1203,7 @@ static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit)
gSprites[gBankSpriteIds[bank]].invisible = TRUE;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE);
gSprites[gUnknown_03005D7C[bank]].data0 = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
}
static void OpponentHandleReturnMonToBall(void)

View File

@ -1023,12 +1023,12 @@ static void sub_8058B40(void)
bool32 r9 = FALSE;
bool32 r8 = FALSE;
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
sub_8172EF0(gActiveBank ^ BIT_MON, &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80)
{
@ -1127,13 +1127,13 @@ static void sub_8058FC0(void)
static void sub_805902C(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]);
}
if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL);
@ -2237,7 +2237,7 @@ static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
GetBankPosition(bank, 2),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
@ -2253,7 +2253,7 @@ static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit)
gSprites[gBankSpriteIds[bank]].invisible = TRUE;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF);
gSprites[gUnknown_03005D7C[bank]].data0 = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
}
static void PlayerHandleReturnMonToBall(void)

View File

@ -282,8 +282,8 @@ static void sub_81BAF48(void)
static void sub_81BB02C(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive
&& gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy
&& ++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 != 1)
@ -599,13 +599,13 @@ static void sub_81BB9F4(void)
static void sub_81BBAE8(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]);
}
if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]);
gBattleBankFunc[gActiveBank] = sub_81BB9F4;
@ -1236,7 +1236,7 @@ static void PlayerPartnerHandleLoadMonSprite(void)
sub_806A068(species, GetBankIdentity(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
GetBankPosition(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
@ -1267,7 +1267,7 @@ static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
GetBankPosition(bank, 2),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
@ -1283,7 +1283,7 @@ static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit)
gSprites[gBankSpriteIds[bank]].invisible = TRUE;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF);
gSprites[gUnknown_03005D7C[bank]].data0 = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
}
static void PlayerPartnerHandleReturnMonToBall(void)

View File

@ -298,12 +298,12 @@ static void sub_818686C(void)
bool32 r9 = FALSE;
bool32 r8 = FALSE;
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
sub_8172EF0(gActiveBank ^ BIT_MON, &gEnemyParty[gBattlePartyID[gActiveBank ^ BIT_MON]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80)
{
@ -512,14 +512,14 @@ static void sub_8186F94(void)
static void sub_8187084(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80)
{
sub_8172EF0(gActiveBank, &gEnemyParty[gBattlePartyID[gActiveBank]]);
}
if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]);
SetBankEnemyShadowSpriteCallback(gActiveBank, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES));
@ -1148,7 +1148,7 @@ static void RecordedOpponentHandleLoadMonSprite(void)
sub_806A068(species, GetBankIdentity(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
GetBankPosition(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
@ -1183,7 +1183,7 @@ static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit)
sub_806A068(species, GetBankIdentity(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
GetBankPosition(bank, 2),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
@ -1199,7 +1199,7 @@ static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit)
gSprites[gBankSpriteIds[bank]].invisible = TRUE;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFE);
gSprites[gUnknown_03005D7C[bank]].data0 = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
}
static void RecordedOpponentHandleReturnMonToBall(void)

View File

@ -314,19 +314,19 @@ static void sub_8189D40(void)
if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]);
}
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
{
sub_8172EF0(gActiveBank ^ BIT_MON, &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]]);
}
}
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x80)
{
@ -497,13 +497,13 @@ static void sub_818A37C(void)
static void sub_818A470(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]);
}
if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
{
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]);
gBattleBankFunc[gActiveBank] = sub_818A37C;
@ -1134,7 +1134,7 @@ static void RecordedPlayerHandleLoadMonSprite(void)
sub_806A068(species, GetBankIdentity(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(gActiveBank, 2),
GetBankPosition(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
@ -1165,7 +1165,7 @@ static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit)
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
GetBankPosition(bank, 2),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
@ -1181,7 +1181,7 @@ static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit)
gSprites[gBankSpriteIds[bank]].invisible = TRUE;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF);
gSprites[gUnknown_03005D7C[bank]].data0 = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
}
static void RecordedPlayerHandleReturnMonToBall(void)

View File

@ -321,13 +321,13 @@ static void CompleteOnChosenItem(void)
static void sub_816864C(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
sub_8172EF0(gActiveBank ^ BIT_MON, &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x8
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x8
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive
&& gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy)
{
@ -1495,7 +1495,7 @@ static void sub_816AA80(u8 bank)
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBankIdentity(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
sub_80A5C6C(bank, 2),
GetBankPosition(bank, 2),
GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank));
@ -1509,7 +1509,7 @@ static void sub_816AA80(u8 bank)
StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]);
gSprites[gBankSpriteIds[bank]].invisible = TRUE;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gUnknown_03005D7C[bank]].data0 = sub_80753E8(0, 0xFF);
gSprites[gUnknown_03005D7C[bank]].data0 = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
}
static void sub_816AC04(u8 taskId)

View File

@ -1143,13 +1143,13 @@ void LoadAndCreateEnemyShadowSprites(void)
LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow);
bank = GetBankByIdentity(IDENTITY_OPPONENT_MON1);
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, sub_80A5C6C(bank, 0), sub_80A5C6C(bank, 1) + 29, 0xC8);
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankPosition(bank, 0), GetBankPosition(bank, 1) + 29, 0xC8);
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data0 = bank;
if (IsDoubleBattle())
{
bank = GetBankByIdentity(IDENTITY_OPPONENT_MON2);
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, sub_80A5C6C(bank, 0), sub_80A5C6C(bank, 1) + 29, 0xC8);
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankPosition(bank, 0), GetBankPosition(bank, 1) + 29, 0xC8);
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data0 = bank;
}
}

637
src/pokeball.c Normal file
View File

@ -0,0 +1,637 @@
#include "global.h"
#include "sprite.h"
#include "pokeball.h"
#include "battle.h"
#include "battle_anim.h"
#include "task.h"
#include "sound.h"
#include "songs.h"
#include "trig.h"
#include "main.h"
#include "m4a.h"
extern bool8 gDoingBattleAnim;
extern u8 gActiveBank;
extern u8 gBankTarget;
extern u16 gBattlePartyID[];
extern u8 gBankSpriteIds[];
extern struct MusicPlayerInfo gMPlay_BGM;
// this file's functions
void Task_DoPokeballSendOutAnim(u8 taskId);
void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite);
void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite);
void SpriteCB_OpponentMonSendOut(struct Sprite *sprite);
void sub_80756D4(struct Sprite *sprite);
void sub_80756E0(struct Sprite *sprite);
void sub_807574C(struct Sprite *sprite);
void sub_80757E4(struct Sprite *sprite);
void sub_8075838(struct Sprite *sprite);
void sub_8075930(struct Sprite *sprite);
void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite);
void sub_8075970(struct Sprite *sprite);
void HandleBallAnimEnd(struct Sprite *sprite);
void sub_8075FB4(struct Sprite *sprite);
void sub_80760F8(struct Sprite *sprite);
u16 GetBankPokeballItemId(u8 bank);
extern const struct SpriteTemplate gBallSpriteTemplates[];
#define tFrames data[0]
#define tPan data[1]
#define tThrowId data[2]
#define tBank data[3]
#define tOpponentBank data[4]
u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow)
{
u8 taskId;
gDoingBattleAnim = TRUE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive = 1;
taskId = CreateTask(Task_DoPokeballSendOutAnim, 5);
gTasks[taskId].tPan = pan;
gTasks[taskId].tThrowId = kindOfThrow;
gTasks[taskId].tBank = gActiveBank;
return 0;
}
#define sData0 data[0]
#define sData1 data[1]
#define sData2 data[2]
#define sData3 data[3]
#define sData4 data[4]
#define sData5 data[5]
#define sBank data[6]
void Task_DoPokeballSendOutAnim(u8 taskId)
{
u16 throwCaseId;
u8 bank;
u16 itemId, ballId;
u8 ballSpriteId;
bool8 notSendOut = FALSE;
if (gTasks[taskId].tFrames == 0)
{
gTasks[taskId].tFrames++;
return;
}
throwCaseId = gTasks[taskId].tThrowId;
bank = gTasks[taskId].tBank;
if (GetBankSide(bank) != SIDE_PLAYER)
itemId = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_POKEBALL);
else
itemId = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_POKEBALL);
ballId = ItemIdToBallId(itemId);
LoadBallGfx(ballId);
ballSpriteId = CreateSprite(&gBallSpriteTemplates[ballId], 32, 80, 29);
gSprites[ballSpriteId].data[0] = 0x80;
gSprites[ballSpriteId].data[1] = 0;
gSprites[ballSpriteId].data[7] = throwCaseId;
switch (throwCaseId)
{
case POKEBALL_PLAYER_SENDOUT:
gBankTarget = bank;
gSprites[ballSpriteId].pos1.x = 24;
gSprites[ballSpriteId].pos1.y = 68;
gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1;
break;
case POKEBALL_OPPONENT_SENDOUT:
gSprites[ballSpriteId].pos1.x = GetBankPosition(bank, BANK_X_POS);
gSprites[ballSpriteId].pos1.y = GetBankPosition(bank, BANK_Y_POS) + 24;
gBankTarget = bank;
gSprites[ballSpriteId].sData0 = 0;
gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut;
break;
default:
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON1);
notSendOut = TRUE;
break;
}
gSprites[ballSpriteId].sBank = gBankTarget;
if (!notSendOut)
{
DestroyTask(taskId);
return;
}
// this will perform an unused ball throw animation
gSprites[ballSpriteId].sData0 = 0x22;
gSprites[ballSpriteId].sData2 = GetBankPosition(gBankTarget, BANK_X_POS);
gSprites[ballSpriteId].sData4 = GetBankPosition(gBankTarget, BANK_Y_POS) - 16;
gSprites[ballSpriteId].sData5 = -40;
sub_80A68D4(&gSprites[ballSpriteId]);
gSprites[ballSpriteId].oam.affineParam = taskId;
gTasks[taskId].tOpponentBank = gBankTarget;
gTasks[taskId].func = TaskDummy;
PlaySE(SE_NAGERU);
}
void SpriteCB_TestBallThrow(struct Sprite *sprite)
{
if (AnimateBallThrow(sprite))
{
u16 ballId;
u8 taskId = sprite->oam.affineParam;
u8 opponentBank = gTasks[taskId].tOpponentBank;
u8 noOfShakes = gTasks[taskId].tThrowId;
StartSpriteAnim(sprite, 1);
sprite->affineAnimPaused = 1;
sprite->pos1.x += sprite->pos2.x;
sprite->pos1.y += sprite->pos2.y;
sprite->pos2.x = 0;
sprite->pos2.y = 0;
sprite->sData5 = 0;
ballId = ItemIdToBallId(GetBankPokeballItemId(opponentBank));
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
sprite->sData0 = LaunchBallFadeMonTask(FALSE, opponentBank, 14, ballId);
sprite->sBank = opponentBank;
sprite->data[7] = noOfShakes;
DestroyTask(taskId);
sprite->callback = sub_80756D4;
}
}
#undef tFrames
#undef tPan
#undef tThrowId
#undef tBank
#undef tOpponentBank
void sub_80756D4(struct Sprite *sprite)
{
sprite->callback = sub_80756E0;
}
void sub_80756E0(struct Sprite *sprite)
{
if (++sprite->sData5 == 10)
{
sprite->sData5 = 0;
sprite->callback = sub_807574C;
StartSpriteAffineAnim(&gSprites[gBankSpriteIds[sprite->sBank]], 2);
AnimateSprite(&gSprites[gBankSpriteIds[sprite->sBank]]);
gSprites[gBankSpriteIds[sprite->sBank]].data[1] = 0;
}
}
void sub_807574C(struct Sprite *sprite)
{
sprite->data[5]++;
if (sprite->data[5] == 11)
PlaySE(SE_SUIKOMU);
if (gSprites[gBankSpriteIds[sprite->data[6]]].affineAnimEnded)
{
StartSpriteAnim(sprite, 2);
gSprites[gBankSpriteIds[sprite->data[6]]].invisible = TRUE;
sprite->data[5] = 0;
sprite->callback = sub_80757E4;
}
else
{
gSprites[gBankSpriteIds[sprite->data[6]]].data[1] += 0x60;
gSprites[gBankSpriteIds[sprite->data[6]]].pos2.y = -gSprites[gBankSpriteIds[sprite->data[6]]].data[1] >> 8;
}
}
void sub_80757E4(struct Sprite *sprite)
{
if (sprite->animEnded)
{
sprite->data[5]++;
if (sprite->data[5] == 1)
{
sprite->data[3] = 0;
sprite->data[4] = 32;
sprite->data[5] = 0;
sprite->pos1.y += Cos(0, 32);
sprite->pos2.y = -Cos(0, sprite->data[4]);
sprite->callback = sub_8075838;
}
}
}
void sub_8075838(struct Sprite *sprite)
{
bool8 r5 = FALSE;
switch (sprite->data[3] & 0xFF)
{
case 0:
sprite->pos2.y = -Cos(sprite->data[5], sprite->data[4]);
sprite->data[5] += 4 + (sprite->data[3] >> 8);
if (sprite->data[5] >= 64)
{
sprite->data[4] -= 10;
sprite->data[3] += 0x101;
if (sprite->data[3] >> 8 == 4)
r5 = TRUE;
switch (sprite->data[3] >> 8)
{
case 1:
PlaySE(SE_KON);
break;
case 2:
PlaySE(SE_KON2);
break;
case 3:
PlaySE(SE_KON3);
break;
default:
PlaySE(SE_KON4);
break;
}
}
break;
case 1:
sprite->pos2.y = -Cos(sprite->data[5], sprite->data[4]);
sprite->data[5] -= 4 + (sprite->data[3] >> 8);
if (sprite->data[5] <= 0)
{
sprite->data[5] = 0;
sprite->data[3] &= 0xFF00;
}
break;
}
if (r5)
{
sprite->data[3] = 0;
sprite->pos1.y += Cos(64, 32);
sprite->pos2.y = 0;
if (sprite->data[7] == 0)
{
sprite->callback = SpriteCB_ReleaseMonFromBall;
}
else
{
sprite->callback = sub_8075930;
sprite->data[4] = 1;
sprite->data[5] = 0;
}
}
}
void sub_8075930(struct Sprite *sprite)
{
sprite->data[3]++;
if (sprite->data[3] == 31)
{
sprite->data[3] = 0;
sprite->affineAnimPaused = TRUE;
StartSpriteAffineAnim(sprite, 1);
sprite->callback = sub_8075970;
PlaySE(SE_BOWA);
}
}
void sub_8075970(struct Sprite *sprite)
{
switch (sprite->data[3] & 0xFF)
{
case 0:
case 2:
sprite->pos2.x += sprite->data[4];
sprite->data[5] += sprite->data[4];
sprite->affineAnimPaused = FALSE;
if (sprite->data[5] > 3 || sprite->data[5] < -3)
{
sprite->data[3]++;
sprite->data[5] = 0;
}
break;
case 1:
sprite->data[5]++;
if (sprite->data[5] == 1)
{
sprite->data[5] = 0;
sprite->data[4] = -sprite->data[4];
sprite->data[3]++;
sprite->affineAnimPaused = FALSE;
if (sprite->data[4] < 0)
ChangeSpriteAffineAnim(sprite, 2);
else
ChangeSpriteAffineAnim(sprite, 1);
}
else
{
sprite->affineAnimPaused = TRUE;
}
break;
case 3:
sprite->data[3] += 0x100;
if (sprite->data[3] >> 8 == sprite->data[7])
{
sprite->callback = SpriteCB_ReleaseMonFromBall;
}
else
{
if (sprite->data[7] == 4 && sprite->data[3] >> 8 == 3)
{
sprite->callback = sub_8075FB4;
sprite->affineAnimPaused = TRUE;
}
else
{
sprite->data[3]++;
sprite->affineAnimPaused = TRUE;
}
}
break;
case 4:
default:
sprite->data[5]++;
if (sprite->data[5] == 31)
{
sprite->data[5] = 0;
sprite->data[3] &= 0xFF00;
StartSpriteAffineAnim(sprite, 3);
if (sprite->data[4] < 0)
StartSpriteAffineAnim(sprite, 2);
else
StartSpriteAffineAnim(sprite, 1);
PlaySE(SE_BOWA);
}
break;
}
}
#define tCryTaskSpecies data[0]
#define tCryTaskPan data[1]
#define tCryTaskWantedCry data[2]
#define tCryTaskBank data[3]
#define tCryTaskMonSpriteId data[4]
#define tCryTaskMonPtr1 data[5]
#define tCryTaskMonPtr2 data[6]
#define tCryTaskFrames data[10]
#define tCryTaskState data[15]
void Task_PlayCryWhenReleasedFromBall(u8 taskId)
{
u8 wantedCry = gTasks[taskId].tCryTaskWantedCry;
s8 pan = gTasks[taskId].tCryTaskPan;
u16 species = gTasks[taskId].tCryTaskSpecies;
u8 bank = gTasks[taskId].tCryTaskBank;
u8 monSpriteId = gTasks[taskId].tCryTaskMonSpriteId;
struct Pokemon *mon = (void*)(u32)((gTasks[taskId].tCryTaskMonPtr1 << 0x10) | (u16)(gTasks[taskId].tCryTaskMonPtr2));
switch (gTasks[taskId].tCryTaskState)
{
case 0:
default:
if (gSprites[monSpriteId].affineAnimEnded)
gTasks[taskId].tCryTaskState = wantedCry + 1;
break;
case 1:
if (ShouldPlayNormalPokeCry(mon) == TRUE)
PlayCry3(species, pan, 0);
else
PlayCry3(species, pan, 11);
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 0;
DestroyTask(taskId);
break;
case 2:
StopCryAndClearCrySongs();
gTasks[taskId].tCryTaskFrames = 3;
gTasks[taskId].tCryTaskState = 20;
break;
case 20:
if (gTasks[taskId].tCryTaskFrames == 0)
{
if (ShouldPlayNormalPokeCry(mon) == TRUE)
PlayCry4(species, pan, 1);
else
PlayCry4(species, pan, 12);
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 0;
DestroyTask(taskId);
}
else
{
gTasks[taskId].tCryTaskFrames--;
}
break;
case 3:
gTasks[taskId].tCryTaskFrames = 6;
gTasks[taskId].tCryTaskState = 30;
break;
case 30:
if (gTasks[taskId].tCryTaskFrames != 0)
{
gTasks[taskId].tCryTaskFrames--;
break;
}
gTasks[taskId].tCryTaskState++;
// fall through
case 31:
if (!IsCryPlayingOrClearCrySongs())
{
StopCryAndClearCrySongs();
gTasks[taskId].tCryTaskFrames = 3;
gTasks[taskId].tCryTaskState++;
}
break;
case 32:
if (gTasks[taskId].tCryTaskFrames != 0)
{
gTasks[taskId].tCryTaskFrames--;
break;
}
if (ShouldPlayNormalPokeCry(mon) == TRUE)
PlayCry4(species, pan, 0);
else
PlayCry4(species, pan, 11);
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 0;
DestroyTask(taskId);
break;
}
}
void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
{
u8 bank = sprite->sBank;
u32 ballId;
StartSpriteAnim(sprite, 1);
ballId = ItemIdToBallId(GetBankPokeballItemId(bank));
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
sprite->sData0 = LaunchBallFadeMonTask(1, sprite->sBank, 14, ballId);
sprite->callback = HandleBallAnimEnd;
if (gMain.inBattle)
{
struct Pokemon *mon;
u16 species;
s8 pan;
u16 wantedCryCase;
u8 taskId;
if (GetBankSide(bank) != SIDE_PLAYER)
{
mon = &gEnemyParty[gBattlePartyID[bank]];
pan = 25;
}
else
{
mon = &gPlayerParty[gBattlePartyID[bank]];
pan = -25;
}
species = GetMonData(mon, MON_DATA_SPECIES);
if ((bank == GetBankByIdentity(IDENTITY_PLAYER_MON1) || bank == GetBankByIdentity(IDENTITY_OPPONENT_MON1))
&& IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1)
{
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
{
if (IsBGMPlaying())
m4aMPlayStop(&gMPlay_BGM);
}
else
{
m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 128);
}
}
if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->field_9_x1)
wantedCryCase = 0;
else if (bank == GetBankByIdentity(IDENTITY_PLAYER_MON1) || bank == GetBankByIdentity(IDENTITY_OPPONENT_MON1))
wantedCryCase = 1;
else
wantedCryCase = 2;
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 1;
taskId = CreateTask(Task_PlayCryWhenReleasedFromBall, 3);
gTasks[taskId].tCryTaskSpecies = species;
gTasks[taskId].tCryTaskPan = pan;
gTasks[taskId].tCryTaskWantedCry = wantedCryCase;
gTasks[taskId].tCryTaskBank = bank;
gTasks[taskId].tCryTaskMonSpriteId = gBankSpriteIds[sprite->sBank];
gTasks[taskId].tCryTaskMonPtr1 = (u32)(mon) >> 0x10;
gTasks[taskId].tCryTaskMonPtr2 = (u32)(mon);
gTasks[taskId].tCryTaskState = 0;
}
StartSpriteAffineAnim(&gSprites[gBankSpriteIds[sprite->sBank]], 1);
if (GetBankSide(sprite->sBank) == SIDE_OPPONENT)
gSprites[gBankSpriteIds[sprite->sBank]].callback = sub_8039B58;
else
gSprites[gBankSpriteIds[sprite->sBank]].callback = sub_8039E44;
AnimateSprite(&gSprites[gBankSpriteIds[sprite->sBank]]);
gSprites[gBankSpriteIds[sprite->sBank]].data[1] = 0x1000;
}
#undef tCryTaskSpecies
#undef tCryTaskPan
#undef tCryTaskWantedCry
#undef tCryTaskBank
#undef tCryTaskMonSpriteId
#undef tCryTaskMonPtr1
#undef tCryTaskMonPtr2
#undef tCryTaskFrames
#undef tCryTaskState
void sub_8075FB4(struct Sprite *sprite)
{
sprite->animPaused = TRUE;
sprite->callback = sub_80760F8;
sprite->data[3] = 0;
sprite->data[4] = 0;
sprite->data[5] = 0;
}
void HandleBallAnimEnd(struct Sprite *sprite)
{
bool8 affineAnimEnded = FALSE;
u8 bank = sprite->sBank;
gSprites[gBankSpriteIds[bank]].invisible = FALSE;
if (sprite->animEnded)
sprite->invisible = TRUE;
if (gSprites[gBankSpriteIds[bank]].affineAnimEnded)
{
StartSpriteAffineAnim(&gSprites[gBankSpriteIds[bank]], 0);
affineAnimEnded = TRUE;
}
else
{
gSprites[gBankSpriteIds[bank]].data[1] -= 288;
gSprites[gBankSpriteIds[bank]].pos2.y = gSprites[gBankSpriteIds[bank]].data[1] >> 8;
}
if (sprite->animEnded && affineAnimEnded)
{
s32 i, doneBanks;
gSprites[gBankSpriteIds[bank]].pos2.y = 0;
gDoingBattleAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[bank].ballAnimActive = 0;
FreeSpriteOamMatrix(sprite);
DestroySprite(sprite);
for (doneBanks = 0, i = 0; i < BATTLE_BANKS_COUNT; i++)
{
if (gBattleSpritesDataPtr->healthBoxesData[i].ballAnimActive == 0)
doneBanks++;
}
if (doneBanks == BATTLE_BANKS_COUNT)
{
for (i = 0; i < POKEBALL_COUNT; i++)
FreeBallGfx(i);
}
}
}
void sub_80760F8(struct Sprite *sprite)
{
u8 bank = sprite->sBank;
sprite->data[4]++;
if (sprite->data[4] == 40)
{
return;
}
else if (sprite->data[4] == 95)
{
gDoingBattleAnim = FALSE;
m4aMPlayAllStop();
PlaySE(BGM_FANFA5);
}
else if (sprite->data[4] == 315)
{
FreeOamMatrix(gSprites[gBankSpriteIds[sprite->sBank]].oam.matrixNum);
DestroySprite(&gSprites[gBankSpriteIds[sprite->sBank]]);
DestroySpriteAndFreeResources(sprite);
if (gMain.inBattle)
gBattleSpritesDataPtr->healthBoxesData[bank].ballAnimActive = 0;
}
}
void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite)
{
sprite->data[0] = 25;
sprite->data[2] = GetBankPosition(sprite->sBank, 2);
sprite->data[4] = GetBankPosition(sprite->sBank, 3) + 24;
sprite->data[5] = -30;
sprite->oam.affineParam = sprite->sBank;
sub_80A68D4(sprite);
sprite->callback = SpriteCB_PlayerMonSendOut_2;
}
#undef sData0
#undef sData1
#undef sData2
#undef sData3
#undef sData4
#undef sData5
#undef sBank

View File

@ -42,7 +42,7 @@ extern u8 GetBankSpriteDefault_Y(u8 bank);
extern u8 sub_80A82E4(u8 bank);
extern void sub_806A068(u16 species, u8 bankIdentity);
extern void sub_806A12C(u16 backPicId, u8 bankIdentity);
extern u8 sub_80A5C6C(u8 bank, u8 caseId);
extern u8 GetBankPosition(u8 bank, u8 caseId);
// this file's functions
static void CB2_ReshowBattleScreenAfterMenu(void);
@ -260,7 +260,7 @@ static void CreateBankSprite(u8 bank)
return;
sub_806A068(GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBankIdentity(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(bank, 2), posY, sub_80A82E4(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankPosition(bank, 2), posY, sub_80A82E4(bank));
gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gBankSpriteIds[bank]].data0 = bank;
@ -296,7 +296,7 @@ static void CreateBankSprite(u8 bank)
return;
sub_806A068(GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBankIdentity(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, sub_80A5C6C(bank, 2), posY, sub_80A82E4(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankPosition(bank, 2), posY, sub_80A82E4(bank));
gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gBankSpriteIds[bank]].data0 = bank;