pokeemerald/asm/battle_4.s
2017-09-27 23:43:45 +02:00

1924 lines
30 KiB
ArmAsm

.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start atkE6_castform_change_animation
atkE6_castform_change_animation: @ 8055DFC
push {r4,lr}
ldr r4, =gActiveBank
ldr r0, =gBattleScripting
ldrb r0, [r0, 0x17]
strb r0, [r4]
ldr r1, =gBattleMons
ldrb r2, [r4]
movs r0, 0x58
muls r0, r2
adds r1, 0x50
adds r0, r1
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
ands r0, r1
ldr r3, =gBattleStruct
cmp r0, 0
beq _08055E2C
ldr r0, [r3]
adds r0, 0x7F
ldrb r1, [r0]
movs r2, 0x80
orrs r1, r2
strb r1, [r0]
_08055E2C:
ldr r0, [r3]
adds r0, 0x7F
ldrb r2, [r0]
movs r0, 0
movs r1, 0
bl EmitBattleAnimation
ldrb r0, [r4]
bl MarkBufferBankForExecution
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x1
str r0, [r1]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end atkE6_castform_change_animation
thumb_func_start atkE7_castform_data_change
atkE7_castform_data_change: @ 8055E64
push {r4,lr}
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x1
str r0, [r1]
ldr r0, =gBattleScripting
ldrb r0, [r0, 0x17]
bl CastformDataTypeChange
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0
beq _08055E8E
ldr r0, =BattleScript_CastformChange
bl b_push_move_exec
ldr r0, =gBattleStruct
ldr r0, [r0]
adds r0, 0x7F
subs r1, r4, 0x1
strb r1, [r0]
_08055E8E:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end atkE7_castform_data_change
thumb_func_start atkE8_settypebasedhalvers
atkE8_settypebasedhalvers: @ 8055EA4
push {r4,lr}
movs r4, 0
ldr r2, =gBattleMoves
ldr r0, =gCurrentMove
ldrh r1, [r0]
lsls r0, r1, 1
adds r0, r1
lsls r0, 2
adds r0, r2
ldrb r0, [r0]
cmp r0, 0xC9
bne _08055EF4
ldr r1, =gStatuses3
ldr r0, =gBankAttacker
ldrb r0, [r0]
lsls r0, 2
adds r2, r0, r1
ldr r1, [r2]
movs r3, 0x80
lsls r3, 9
adds r0, r1, 0
ands r0, r3
cmp r0, 0
bne _08055F18
orrs r1, r3
str r1, [r2]
ldr r0, =gBattleCommunication
strb r4, [r0, 0x5]
b _08055F1C
.pool
_08055EF4:
ldr r1, =gStatuses3
ldr r0, =gBankAttacker
ldrb r0, [r0]
lsls r0, 2
adds r2, r0, r1
ldr r1, [r2]
movs r3, 0x80
lsls r3, 10
adds r0, r1, 0
ands r0, r3
cmp r0, 0
bne _08055F18
orrs r1, r3
str r1, [r2]
ldr r1, =gBattleCommunication
movs r0, 0x1
strb r0, [r1, 0x5]
movs r4, 0x1
_08055F18:
cmp r4, 0
beq _08055F38
_08055F1C:
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x5
str r0, [r1]
b _08055F52
.pool
_08055F38:
ldr r3, =gBattlescriptCurrInstr
ldr r2, [r3]
ldrb r1, [r2, 0x1]
ldrb r0, [r2, 0x2]
lsls r0, 8
orrs r1, r0
ldrb r0, [r2, 0x3]
lsls r0, 16
orrs r1, r0
ldrb r0, [r2, 0x4]
lsls r0, 24
orrs r1, r0
str r1, [r3]
_08055F52:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end atkE8_settypebasedhalvers
thumb_func_start atkE9_setweatherballtype
atkE9_setweatherballtype: @ 8055F5C
push {lr}
sub sp, 0x4
movs r0, 0
str r0, [sp]
movs r0, 0x13
movs r1, 0
movs r2, 0xD
movs r3, 0
bl AbilityBattleEffects
lsls r0, 24
lsrs r0, 24
cmp r0, 0
bne _08055FFC
str r0, [sp]
movs r0, 0x13
movs r1, 0
movs r2, 0x4D
movs r3, 0
bl AbilityBattleEffects
lsls r0, 24
cmp r0, 0
bne _08055FFC
ldr r2, =gBattleWeather
ldrb r0, [r2]
cmp r0, 0
beq _08055F9A
ldr r1, =gBattleScripting
movs r0, 0x2
strb r0, [r1, 0xE]
_08055F9A:
ldrh r1, [r2]
movs r0, 0x7
ands r0, r1
cmp r0, 0
beq _08055FB8
ldr r0, =gBattleStruct
ldr r1, [r0]
movs r0, 0x8B
b _08055FFA
.pool
_08055FB8:
movs r0, 0x18
ands r0, r1
cmp r0, 0
beq _08055FCC
ldr r0, =gBattleStruct
ldr r1, [r0]
movs r0, 0x85
b _08055FFA
.pool
_08055FCC:
movs r0, 0x60
ands r0, r1
cmp r0, 0
beq _08055FE0
ldr r0, =gBattleStruct
ldr r1, [r0]
movs r0, 0x8A
b _08055FFA
.pool
_08055FE0:
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _08055FF4
ldr r0, =gBattleStruct
ldr r1, [r0]
movs r0, 0x8F
b _08055FFA
.pool
_08055FF4:
ldr r0, =gBattleStruct
ldr r1, [r0]
movs r0, 0x80
_08055FFA:
strb r0, [r1, 0x13]
_08055FFC:
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x1
str r0, [r1]
add sp, 0x4
pop {r0}
bx r0
.pool
thumb_func_end atkE9_setweatherballtype
thumb_func_start atkEA_recycleitem
atkEA_recycleitem: @ 8056014
push {r4-r7,lr}
sub sp, 0x4
ldr r7, =gActiveBank
ldr r0, =gBankAttacker
ldrb r0, [r0]
strb r0, [r7]
ldr r1, =gBattleStruct
ldrb r2, [r7]
lsls r0, r2, 1
adds r0, 0xB8
ldr r1, [r1]
adds r6, r1, r0
ldrh r5, [r6]
cmp r5, 0
beq _08056094
ldr r4, =gBattleMons
movs r3, 0x58
adds r0, r2, 0
muls r0, r3
adds r0, r4
ldrh r0, [r0, 0x2E]
cmp r0, 0
bne _08056094
ldr r1, =gLastUsedItem
strh r5, [r1]
strh r0, [r6]
ldrb r0, [r7]
muls r0, r3
adds r0, r4
ldrh r1, [r1]
strh r1, [r0, 0x2E]
ldrb r0, [r7]
muls r0, r3
adds r1, r4, 0
adds r1, 0x2E
adds r0, r1
str r0, [sp]
movs r0, 0
movs r1, 0x2
movs r2, 0
movs r3, 0x2
bl EmitSetMonData
ldrb r0, [r7]
bl MarkBufferBankForExecution
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x5
str r0, [r1]
b _080560AE
.pool
_08056094:
ldr r3, =gBattlescriptCurrInstr
ldr r2, [r3]
ldrb r1, [r2, 0x1]
ldrb r0, [r2, 0x2]
lsls r0, 8
orrs r1, r0
ldrb r0, [r2, 0x3]
lsls r0, 16
orrs r1, r0
ldrb r0, [r2, 0x4]
lsls r0, 24
orrs r1, r0
str r1, [r3]
_080560AE:
add sp, 0x4
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end atkEA_recycleitem
thumb_func_start atkEB_settypetoterrain
atkEB_settypetoterrain: @ 80560BC
push {r4-r7,lr}
mov r7, r8
push {r7}
ldr r0, =gBattleMons
mov r8, r0
ldr r7, =gBankAttacker
ldrb r0, [r7]
movs r6, 0x58
muls r0, r6
mov r1, r8
adds r3, r0, r1
movs r0, 0x21
adds r0, r3
mov r12, r0
ldr r5, =sTerrainToType
ldr r4, =gBattleTerrain
ldrb r0, [r4]
adds r0, r5
ldrb r2, [r0]
mov r1, r12
ldrb r0, [r1]
adds r1, r2, 0
cmp r0, r1
beq _08056144
adds r0, r3, 0
adds r0, 0x22
ldrb r0, [r0]
cmp r0, r1
beq _08056144
mov r0, r12
strb r2, [r0]
ldrb r0, [r7]
adds r1, r0, 0
muls r1, r6
add r1, r8
ldrb r0, [r4]
adds r0, r5
ldrb r0, [r0]
adds r1, 0x22
strb r0, [r1]
ldr r1, =gBattleTextBuff1
movs r0, 0xFD
strb r0, [r1]
movs r0, 0x3
strb r0, [r1, 0x1]
ldrb r0, [r4]
adds r0, r5
ldrb r0, [r0]
strb r0, [r1, 0x2]
movs r0, 0xFF
strb r0, [r1, 0x3]
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x5
str r0, [r1]
b _0805615E
.pool
_08056144:
ldr r3, =gBattlescriptCurrInstr
ldr r2, [r3]
ldrb r1, [r2, 0x1]
ldrb r0, [r2, 0x2]
lsls r0, 8
orrs r1, r0
ldrb r0, [r2, 0x3]
lsls r0, 16
orrs r1, r0
ldrb r0, [r2, 0x4]
lsls r0, 24
orrs r1, r0
str r1, [r3]
_0805615E:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end atkEB_settypetoterrain
thumb_func_start atkEC_pursuit_sth
atkEC_pursuit_sth: @ 805616C
push {r4-r6,lr}
ldr r5, =gBankAttacker
ldrb r0, [r5]
bl GetBankIdentity
movs r1, 0x2
eors r0, r1
lsls r0, 24
lsrs r0, 24
bl GetBankByIdentity
ldr r4, =gActiveBank
strb r0, [r4]
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r6, 0x1
ands r0, r6
cmp r0, 0
beq _0805620C
ldr r0, =gAbsentBankFlags
ldrb r1, [r0]
ldr r2, =gBitTable
ldrb r3, [r4]
lsls r0, r3, 2
adds r0, r2
ldr r0, [r0]
ands r1, r0
cmp r1, 0
bne _0805620C
ldr r0, =gActionForBanks
adds r0, r3, r0
ldrb r0, [r0]
cmp r0, 0
bne _0805620C
ldr r1, =gChosenMovesByBanks
lsls r0, r3, 1
adds r0, r1
ldrh r2, [r0]
cmp r2, 0xE4
bne _0805620C
ldr r0, =gUnknown_0202407A
adds r0, r3, r0
movs r1, 0xB
strb r1, [r0]
ldr r0, =gCurrentMove
strh r2, [r0]
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x5
str r0, [r1]
ldr r0, =gBattleScripting
strb r6, [r0, 0x18]
ldrb r1, [r5]
adds r0, 0x20
strb r1, [r0]
ldrb r0, [r4]
strb r0, [r5]
b _08056226
.pool
_0805620C:
ldr r3, =gBattlescriptCurrInstr
ldr r2, [r3]
ldrb r1, [r2, 0x1]
ldrb r0, [r2, 0x2]
lsls r0, 8
orrs r1, r0
ldrb r0, [r2, 0x3]
lsls r0, 16
orrs r1, r0
ldrb r0, [r2, 0x4]
lsls r0, 24
orrs r1, r0
str r1, [r3]
_08056226:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end atkEC_pursuit_sth
thumb_func_start atkED_802B4B4
atkED_802B4B4: @ 8056230
push {r4,lr}
ldr r1, =gEffectBank
ldr r3, =gBankAttacker
ldrb r0, [r3]
strb r0, [r1]
ldr r2, =gBankTarget
lsls r0, 24
lsrs r0, 24
adds r4, r1, 0
ldrb r1, [r2]
cmp r0, r1
bne _08056264
ldr r1, =gBattleScripting
ldrb r0, [r1, 0x17]
strb r0, [r2]
strb r0, [r3]
b _0805626A
.pool
_08056264:
ldr r1, =gBattleScripting
ldrb r0, [r1, 0x17]
strb r0, [r2]
_0805626A:
ldrb r0, [r4]
strb r0, [r1, 0x17]
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x1
str r0, [r1]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end atkED_802B4B4
thumb_func_start atkEE_removelightscreenreflect
atkEE_removelightscreenreflect: @ 8056284
push {r4,lr}
ldr r0, =gBankAttacker
ldrb r0, [r0]
bl GetBankSide
movs r1, 0x1
eors r0, r1
lsls r0, 24
lsrs r0, 24
ldr r1, =gSideTimers
lsls r3, r0, 1
adds r0, r3, r0
lsls r0, 2
adds r4, r0, r1
ldrb r0, [r4]
cmp r0, 0
bne _080562AC
ldrb r1, [r4, 0x2]
cmp r1, 0
beq _080562E4
_080562AC:
ldr r2, =gSideAffecting
adds r2, r3, r2
ldrh r1, [r2]
ldr r0, =0x0000fffe
ands r0, r1
movs r3, 0
ldr r1, =0x0000fffd
ands r0, r1
strh r0, [r2]
strb r3, [r4]
strb r3, [r4, 0x2]
ldr r1, =gBattleScripting
movs r0, 0x1
strb r0, [r1, 0x18]
strb r0, [r1, 0x19]
b _080562EA
.pool
_080562E4:
ldr r0, =gBattleScripting
strb r1, [r0, 0x18]
strb r1, [r0, 0x19]
_080562EA:
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x1
str r0, [r1]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end atkEE_removelightscreenreflect
thumb_func_start atkEF_pokeball_catch_calculation
atkEF_pokeball_catch_calculation: @ 8056300
push {r4-r6,lr}
movs r4, 0
ldr r0, =gBattleExecBuffer
ldr r0, [r0]
cmp r0, 0
beq _0805630E
b _08056696
_0805630E:
ldr r5, =gActiveBank
ldr r0, =gBankAttacker
ldrb r0, [r0]
strb r0, [r5]
ldr r6, =gBankTarget
movs r1, 0x1
eors r0, r1
strb r0, [r6]
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x8
ands r0, r1
cmp r0, 0
beq _0805635C
movs r0, 0
movs r1, 0x5
bl dp01_build_cmdbuf_x0D_a
ldrb r0, [r5]
bl MarkBufferBankForExecution
ldr r1, =gBattlescriptCurrInstr
ldr r0, =gUnknown_082DBE02
b _08056694
.pool
_0805635C:
movs r0, 0x80
lsls r0, 2
ands r1, r0
cmp r1, 0
beq _08056384
movs r0, 0
movs r1, 0x4
bl dp01_build_cmdbuf_x0D_a
ldrb r0, [r5]
bl MarkBufferBankForExecution
ldr r1, =gBattlescriptCurrInstr
ldr r0, =gUnknown_082DBDCA
b _08056694
.pool
_08056384:
ldr r0, =gLastUsedItem
ldrh r0, [r0]
cmp r0, 0x5
bne _080563B0
ldr r0, =gBattleStruct
ldr r0, [r0]
adds r0, 0x7C
ldrb r0, [r0]
lsls r1, r0, 2
adds r1, r0
lsls r0, r1, 8
subs r0, r1
movs r1, 0x64
bl __divsi3
lsls r0, 24
lsrs r5, r0, 24
b _080563C8
.pool
_080563B0:
ldr r3, =gBaseStats
ldr r2, =gBattleMons
ldrb r1, [r6]
movs r0, 0x58
muls r0, r1
adds r0, r2
ldrh r1, [r0]
lsls r0, r1, 3
subs r0, r1
lsls r0, 2
adds r0, r3
ldrb r5, [r0, 0x8]
_080563C8:
ldr r2, =gLastUsedItem
ldrh r0, [r2]
cmp r0, 0x5
bhi _080563D2
b _080564C8
_080563D2:
subs r0, 0x6
cmp r0, 0x6
bls _080563DA
b _080564D2
_080563DA:
lsls r0, 2
ldr r1, =_080563F4
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_080563F4:
.4byte _08056410
.4byte _08056440
.4byte _08056452
.4byte _08056480
.4byte _080564B0
.4byte _08056472
.4byte _08056472
_08056410:
ldr r2, =gBattleMons
ldr r0, =gBankTarget
ldrb r1, [r0]
movs r0, 0x58
muls r0, r1
adds r0, r2
adds r1, r0, 0
adds r1, 0x21
ldrb r1, [r1]
cmp r1, 0xB
beq _080564A4
adds r0, 0x22
ldrb r0, [r0]
cmp r0, 0xB
beq _080564A4
cmp r1, 0x6
beq _080564A4
cmp r0, 0x6
beq _080564A4
b _08056472
.pool
_08056440:
bl sav1_map_get_light_level
lsls r0, 24
lsrs r0, 24
movs r4, 0xA
cmp r0, 0x5
bne _080564D2
movs r4, 0x23
b _080564D2
_08056452:
ldr r2, =gBattleMons
ldr r0, =gBankTarget
ldrb r1, [r0]
movs r0, 0x58
muls r0, r1
adds r0, r2
adds r0, 0x2A
ldrb r1, [r0]
cmp r1, 0x27
bhi _08056472
movs r0, 0x28
subs r0, r1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x9
bhi _080564D2
_08056472:
movs r4, 0xA
b _080564D2
.pool
_08056480:
ldr r2, =gBattleMons
ldr r0, =gBankTarget
ldrb r1, [r0]
movs r0, 0x58
muls r0, r1
adds r0, r2
ldrh r0, [r0]
bl SpeciesToNationalPokedexNum
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl GetSetPokedexFlag
lsls r0, 24
movs r4, 0xA
cmp r0, 0
beq _080564D2
_080564A4:
movs r4, 0x1E
b _080564D2
.pool
_080564B0:
ldr r0, =gBattleResults
ldrb r0, [r0, 0x13]
adds r0, 0xA
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x28
bls _080564D2
movs r4, 0x28
b _080564D2
.pool
_080564C8:
ldr r1, =sBallCatchBonuses
ldrh r0, [r2]
subs r0, 0x2
adds r0, r1
ldrb r4, [r0]
_080564D2:
adds r0, r5, 0
muls r0, r4
movs r1, 0xA
bl __divsi3
ldr r5, =gBattleMons
ldr r1, =gBankTarget
ldrb r2, [r1]
movs r1, 0x58
adds r4, r2, 0
muls r4, r1
adds r3, r4, r5
ldrh r2, [r3, 0x2C]
lsls r1, r2, 1
adds r1, r2
ldrh r2, [r3, 0x28]
lsls r2, 1
subs r2, r1, r2
muls r0, r2
bl __divsi3
adds r6, r0, 0
adds r5, 0x4C
adds r4, r5
ldr r4, [r4]
movs r0, 0x27
ands r0, r4
cmp r0, 0
beq _0805650E
lsls r6, 1
_0805650E:
movs r0, 0xD8
ands r4, r0
cmp r4, 0
beq _08056522
lsls r0, r6, 4
subs r0, r6
movs r1, 0xA
bl __udivsi3
adds r6, r0, 0
_08056522:
ldr r1, =gLastUsedItem
ldrh r0, [r1]
cmp r0, 0x5
beq _08056564
cmp r0, 0x1
bne _08056550
ldr r0, =gBattleResults
ldrb r1, [r0, 0x5]
movs r2, 0x2
orrs r1, r2
strb r1, [r0, 0x5]
b _08056564
.pool
_08056550:
ldr r0, =gBattleResults
ldrh r1, [r1]
adds r0, r1
adds r1, r0, 0
adds r1, 0x34
ldrb r0, [r1]
cmp r0, 0xFE
bhi _08056564
adds r0, 0x1
strb r0, [r1]
_08056564:
cmp r6, 0xFE
bls _080565C8
movs r0, 0
movs r1, 0x4
bl dp01_build_cmdbuf_x0D_a
ldr r0, =gActiveBank
ldrb r0, [r0]
bl MarkBufferBankForExecution
ldr r1, =gBattlescriptCurrInstr
ldr r0, =gUnknown_082DBD84
str r0, [r1]
ldr r1, =gBattlePartyID
ldr r0, =gBankTarget
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
ldrh r1, [r0]
movs r0, 0x64
muls r0, r1
ldr r1, =gEnemyParty
adds r0, r1
ldr r2, =gLastUsedItem
movs r1, 0x26
bl SetMonData
bl CalculatePlayerPartyCount
lsls r0, 24
lsrs r0, 24
cmp r0, 0x6
beq _08056656
b _08056680
.pool
_080565C8:
movs r0, 0xFF
lsls r0, 16
adds r1, r6, 0
bl __udivsi3
bl Sqrt
lsls r0, 16
lsrs r0, 16
bl Sqrt
lsls r0, 16
lsrs r6, r0, 16
ldr r0, =0x000ffff0
adds r1, r6, 0
bl __udivsi3
adds r6, r0, 0
movs r4, 0
b _080565FA
.pool
_080565F4:
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
_080565FA:
cmp r4, 0x3
bhi _0805660A
bl Random
lsls r0, 16
lsrs r0, 16
cmp r0, r6
bcc _080565F4
_0805660A:
ldr r5, =gLastUsedItem
ldrh r0, [r5]
cmp r0, 0x1
bne _08056614
movs r4, 0x4
_08056614:
movs r0, 0
adds r1, r4, 0
bl dp01_build_cmdbuf_x0D_a
ldr r0, =gActiveBank
ldrb r0, [r0]
bl MarkBufferBankForExecution
cmp r4, 0x4
bne _0805668C
ldr r1, =gBattlescriptCurrInstr
ldr r0, =gUnknown_082DBD84
str r0, [r1]
ldr r1, =gBattlePartyID
ldr r0, =gBankTarget
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
ldrh r1, [r0]
movs r0, 0x64
muls r0, r1
ldr r1, =gEnemyParty
adds r0, r1
movs r1, 0x26
adds r2, r5, 0
bl SetMonData
bl CalculatePlayerPartyCount
lsls r0, 24
lsrs r0, 24
cmp r0, 0x6
bne _08056680
_08056656:
ldr r1, =gBattleCommunication
movs r0, 0
strb r0, [r1, 0x5]
b _08056696
.pool
_08056680:
ldr r1, =gBattleCommunication
movs r0, 0x1
strb r0, [r1, 0x5]
b _08056696
.pool
_0805668C:
ldr r0, =gBattleCommunication
strb r4, [r0, 0x5]
ldr r1, =gBattlescriptCurrInstr
ldr r0, =gUnknown_082DBDD4
_08056694:
str r0, [r1]
_08056696:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end atkEF_pokeball_catch_calculation
thumb_func_start atkF0_copy_caught_poke
atkF0_copy_caught_poke: @ 80566A8
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r0, =gBattlePartyID
mov r9, r0
ldr r5, =gBankAttacker
ldrb r0, [r5]
movs r6, 0x1
eors r0, r6
lsls r0, 1
add r0, r9
ldrh r0, [r0]
movs r7, 0x64
muls r0, r7
ldr r1, =gEnemyParty
mov r8, r1
add r0, r8
bl GiveMonToPlayer
lsls r0, 24
cmp r0, 0
beq _08056792
bl sub_813B21C
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0
bne _08056734
ldr r0, =gBattleCommunication
strb r1, [r0, 0x5]
ldr r4, =gStringVar1
ldr r0, =0x00004036
bl VarGet
lsls r0, 24
lsrs r0, 24
bl sav3_get_box_name
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy
ldrb r0, [r5]
eors r0, r6
lsls r0, 1
add r0, r9
ldrh r0, [r0]
muls r0, r7
add r0, r8
ldr r2, =gStringVar2
movs r1, 0x2
bl GetMonData
b _0805677E
.pool
_08056734:
ldr r4, =gStringVar1
ldr r0, =0x00004036
bl VarGet
lsls r0, 24
lsrs r0, 24
bl sav3_get_box_name
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy
ldrb r0, [r5]
eors r0, r6
lsls r0, 1
add r0, r9
ldrh r0, [r0]
muls r0, r7
add r0, r8
ldr r2, =gStringVar2
movs r1, 0x2
bl GetMonData
ldr r4, =gStringVar3
bl get_unknown_box_id
lsls r0, 24
lsrs r0, 24
bl sav3_get_box_name
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy
ldr r1, =gBattleCommunication
movs r0, 0x2
strb r0, [r1, 0x5]
_0805677E:
ldr r0, =0x000008ab
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _08056792
ldr r1, =gBattleCommunication
ldrb r0, [r1, 0x5]
adds r0, 0x1
strb r0, [r1, 0x5]
_08056792:
ldr r0, =gBattlePartyID
mov r10, r0
ldr r1, =gBankAttacker
mov r9, r1
ldrb r0, [r1]
movs r4, 0x1
eors r0, r4
lsls r0, 1
add r0, r10
ldrh r0, [r0]
movs r1, 0x64
mov r8, r1
mov r1, r8
muls r1, r0
adds r0, r1, 0
ldr r6, =gEnemyParty
adds r0, r6
movs r1, 0xB
movs r2, 0
bl GetMonData
ldr r5, =gBattleResults
strh r0, [r5, 0x28]
mov r1, r9
ldrb r0, [r1]
eors r0, r4
lsls r0, 1
add r0, r10
ldrh r0, [r0]
mov r1, r8
muls r1, r0
adds r0, r1, 0
adds r0, r6
adds r2, r5, 0
adds r2, 0x2A
movs r1, 0x2
bl GetMonData
mov r1, r9
ldrb r0, [r1]
eors r4, r0
lsls r4, 1
add r4, r10
ldrh r0, [r4]
mov r1, r8
muls r1, r0
adds r0, r1, 0
adds r0, r6
movs r1, 0x26
movs r2, 0
bl GetMonData
movs r1, 0xF
ands r0, r1
lsls r0, 2
ldrb r2, [r5, 0x5]
movs r1, 0x3D
negs r1, r1
ands r1, r2
orrs r1, r0
strb r1, [r5, 0x5]
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x1
str r0, [r1]
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end atkF0_copy_caught_poke
thumb_func_start atkF1_setpoke_as_caught
atkF1_setpoke_as_caught: @ 8056850
push {r4,r5,lr}
ldr r4, =gEnemyParty
adds r0, r4, 0
movs r1, 0xB
movs r2, 0
bl GetMonData
lsls r0, 16
lsrs r5, r0, 16
adds r0, r4, 0
movs r1, 0
movs r2, 0
bl GetMonData
adds r4, r0, 0
adds r0, r5, 0
bl SpeciesToNationalPokedexNum
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080568A8
ldr r3, =gBattlescriptCurrInstr
ldr r2, [r3]
ldrb r1, [r2, 0x1]
ldrb r0, [r2, 0x2]
lsls r0, 8
orrs r1, r0
ldrb r0, [r2, 0x3]
lsls r0, 16
orrs r1, r0
ldrb r0, [r2, 0x4]
lsls r0, 24
orrs r1, r0
str r1, [r3]
b _080568C2
.pool
_080568A8:
adds r0, r5, 0
bl SpeciesToNationalPokedexNum
lsls r0, 16
lsrs r0, 16
movs r1, 0x3
adds r2, r4, 0
bl HandleSetPokedexFlag
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x5
str r0, [r1]
_080568C2:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end atkF1_setpoke_as_caught
thumb_func_start atkF2_display_dex_info
atkF2_display_dex_info: @ 80568CC
push {r4,lr}
sub sp, 0x4
ldr r0, =gEnemyParty
movs r1, 0xB
movs r2, 0
bl GetMonData
lsls r0, 16
lsrs r4, r0, 16
ldr r0, =gBattleCommunication
ldrb r0, [r0]
cmp r0, 0x5
bls _080568E8
b _08056A2C
_080568E8:
lsls r0, 2
ldr r1, =_08056900
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_08056900:
.4byte _08056918
.4byte _0805692A
.4byte _08056978
.4byte _080569C8
.4byte _080569E0
.4byte _08056A18
_08056918:
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
b _08056A06
_0805692A:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _08056938
b _08056A2C
_08056938:
bl FreeAllWindowBuffers
adds r0, r4, 0
bl SpeciesToNationalPokedexNum
lsls r0, 16
lsrs r0, 16
ldr r3, =gBattleMons
ldr r1, =gBankTarget
ldrb r2, [r1]
movs r1, 0x58
muls r2, r1
adds r1, r3, 0
adds r1, 0x54
adds r1, r2, r1
ldr r1, [r1]
adds r3, 0x48
adds r2, r3
ldr r2, [r2]
bl sub_80BFDF4
ldr r1, =gBattleCommunication
strb r0, [r1, 0x1]
b _08056A08
.pool
_08056978:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _08056A2C
ldr r0, =gMain
ldr r1, [r0, 0x4]
ldr r0, =BattleMainCB2
cmp r1, r0
bne _08056A2C
ldr r2, =gTasks
ldr r4, =gBattleCommunication
ldrb r1, [r4, 0x1]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
ldrb r0, [r0, 0x4]
cmp r0, 0
bne _08056A2C
ldr r0, =vblank_cb_08078BB4
bl SetVBlankCallback
ldrb r0, [r4]
adds r0, 0x1
strb r0, [r4]
b _08056A2C
.pool
_080569C8:
bl c2_berry_program_update_menu
bl sub_8035AA4
ldr r1, =gUnknown_02022E20
movs r2, 0x80
lsls r2, 1
adds r0, r2, 0
strh r0, [r1]
b _08056A06
.pool
_080569E0:
bl IsDma3ManagerBusyWithBgCopy
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0
bne _08056A2C
ldr r0, =0x0000ffff
str r1, [sp]
movs r1, 0
movs r2, 0x10
movs r3, 0
bl BeginNormalPaletteFade
movs r0, 0
bl ShowBg
movs r0, 0x3
bl ShowBg
_08056A06:
ldr r1, =gBattleCommunication
_08056A08:
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _08056A2C
.pool
_08056A18:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _08056A2C
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x1
str r0, [r1]
_08056A2C:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end atkF2_display_dex_info
thumb_func_start sub_8056A3C
sub_8056A3C: @ 8056A3C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x20
ldr r4, [sp, 0x40]
lsls r0, 24
lsrs r0, 24
mov r8, r0
lsls r1, 24
lsrs r1, 24
str r1, [sp, 0x10]
lsls r2, 24
lsrs r2, 24
str r2, [sp, 0x1C]
lsls r3, 24
lsrs r3, 24
str r3, [sp, 0x14]
lsls r4, 24
lsrs r4, 24
mov r10, r4
movs r1, 0
add r0, sp, 0xC
strh r1, [r0]
ldr r6, [sp, 0x10]
cmp r6, r3
ble _08056A76
b _08056B62
_08056A76:
mov r4, r8
adds r0, r6, 0x1
str r0, [sp, 0x18]
ldr r2, [sp, 0x1C]
cmp r4, r2
bgt _08056B58
add r5, sp, 0xC
lsls r7, r6, 24
mov r9, r7
_08056A88:
ldr r0, [sp, 0x10]
cmp r6, r0
bne _08056AB4
cmp r4, r8
bne _08056A9C
ldr r0, =0x00001022
b _08056AFE
.pool
_08056A9C:
ldr r2, [sp, 0x1C]
cmp r4, r2
bne _08056AAC
ldr r0, =0x00001024
b _08056AFE
.pool
_08056AAC:
ldr r0, =0x00001023
b _08056AFE
.pool
_08056AB4:
ldr r7, [sp, 0x14]
cmp r6, r7
bne _08056AE0
cmp r4, r8
bne _08056AC8
ldr r0, =0x00001028
b _08056AFE
.pool
_08056AC8:
ldr r0, [sp, 0x1C]
cmp r4, r0
bne _08056AD8
ldr r0, =0x0000102a
b _08056AFE
.pool
_08056AD8:
ldr r0, =0x00001029
b _08056AFE
.pool
_08056AE0:
cmp r4, r8
bne _08056AEC
ldr r0, =0x00001025
b _08056AFE
.pool
_08056AEC:
ldr r2, [sp, 0x1C]
cmp r4, r2
bne _08056AFC
ldr r0, =0x00001027
b _08056AFE
.pool
_08056AFC:
ldr r0, =0x00001026
_08056AFE:
strh r0, [r5]
movs r1, 0x1
mov r0, r10
ands r0, r1
cmp r0, 0
beq _08056B0E
movs r0, 0
strh r0, [r5]
_08056B0E:
movs r0, 0x80
mov r7, r10
ands r0, r7
cmp r0, 0
beq _08056B38
lsls r2, r4, 24
lsrs r2, 24
str r1, [sp]
str r1, [sp, 0x4]
movs r0, 0x11
str r0, [sp, 0x8]
movs r0, 0x1
add r1, sp, 0xC
mov r7, r9
lsrs r3, r7, 24
bl CopyToBgTilemapBufferRect_ChangePalette
b _08056B50
.pool
_08056B38:
lsls r2, r4, 24
lsrs r2, 24
str r1, [sp]
str r1, [sp, 0x4]
movs r0, 0x11
str r0, [sp, 0x8]
movs r0, 0
add r1, sp, 0xC
mov r7, r9
lsrs r3, r7, 24
bl CopyToBgTilemapBufferRect_ChangePalette
_08056B50:
adds r4, 0x1
ldr r0, [sp, 0x1C]
cmp r4, r0
ble _08056A88
_08056B58:
ldr r6, [sp, 0x18]
ldr r2, [sp, 0x14]
cmp r6, r2
bgt _08056B62
b _08056A76
_08056B62:
add sp, 0x20
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8056A3C
thumb_func_start BattleCreateCursorAt
BattleCreateCursorAt: @ 8056B74
push {lr}
sub sp, 0x10
adds r3, r0, 0
add r0, sp, 0xC
movs r2, 0x1
strh r2, [r0]
movs r1, 0x2
strh r1, [r0, 0x2]
lsls r3, 25
movs r0, 0x90
lsls r0, 20
adds r3, r0
lsrs r3, 24
str r2, [sp]
str r1, [sp, 0x4]
movs r0, 0x11
str r0, [sp, 0x8]
movs r0, 0
add r1, sp, 0xC
movs r2, 0x19
bl CopyToBgTilemapBufferRect_ChangePalette
movs r0, 0
bl CopyBgTilemapBufferToVram
add sp, 0x10
pop {r0}
bx r0
thumb_func_end BattleCreateCursorAt
thumb_func_start BattleDestroyCursorAt
BattleDestroyCursorAt: @ 8056BAC
push {lr}
sub sp, 0x10
adds r3, r0, 0
add r0, sp, 0xC
ldr r1, =0x00001016
strh r1, [r0]
strh r1, [r0, 0x2]
lsls r3, 25
movs r0, 0x90
lsls r0, 20
adds r3, r0
lsrs r3, 24
movs r0, 0x1
str r0, [sp]
movs r0, 0x2
str r0, [sp, 0x4]
movs r0, 0x11
str r0, [sp, 0x8]
movs r0, 0
add r1, sp, 0xC
movs r2, 0x19
bl CopyToBgTilemapBufferRect_ChangePalette
movs r0, 0
bl CopyBgTilemapBufferToVram
add sp, 0x10
pop {r0}
bx r0
.pool
thumb_func_end BattleDestroyCursorAt
thumb_func_start atkF3_nickname_caught_poke
atkF3_nickname_caught_poke: @ 8056BEC
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
ldr r0, =gBattleCommunication
ldrb r1, [r0]
adds r4, r0, 0
cmp r1, 0x4
bls _08056C04
b _08056E62
_08056C04:
lsls r0, r1, 2
ldr r1, =_08056C18
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_08056C18:
.4byte _08056C2C
.4byte _08056C60
.4byte _08056CFC
.4byte _08056DD4
.4byte _08056E2C
_08056C2C:
movs r4, 0
str r4, [sp]
movs r0, 0x18
movs r1, 0x8
movs r2, 0x1D
movs r3, 0xD
bl sub_8056A3C
ldr r0, =gText_BattleYesNoChoice
movs r1, 0xC
bl sub_814F9EC
ldr r1, =gBattleCommunication
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
strb r4, [r1, 0x1]
movs r0, 0
bl BattleCreateCursorAt
b _08056E62
.pool
_08056C60:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x40
ands r0, r1
cmp r0, 0
beq _08056C86
ldrb r0, [r4, 0x1]
cmp r0, 0
beq _08056C86
movs r0, 0x5
bl PlaySE
ldrb r0, [r4, 0x1]
bl BattleDestroyCursorAt
movs r0, 0
strb r0, [r4, 0x1]
bl BattleCreateCursorAt
_08056C86:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _08056CAE
ldr r4, =gBattleCommunication
ldrb r0, [r4, 0x1]
cmp r0, 0
bne _08056CAE
movs r0, 0x5
bl PlaySE
ldrb r0, [r4, 0x1]
bl BattleDestroyCursorAt
movs r0, 0x1
strb r0, [r4, 0x1]
bl BattleCreateCursorAt
_08056CAE:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _08056CE0
movs r0, 0x5
bl PlaySE
ldr r1, =gBattleCommunication
ldrb r0, [r1, 0x1]
cmp r0, 0
bne _08056CF2
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
movs r0, 0x3
bl BeginFastPaletteFade
b _08056E62
.pool
_08056CE0:
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _08056CEA
b _08056E62
_08056CEA:
movs r0, 0x5
bl PlaySE
ldr r1, =gBattleCommunication
_08056CF2:
movs r0, 0x4
strb r0, [r1]
b _08056E62
.pool
_08056CFC:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _08056D0A
b _08056E62
_08056D0A:
ldr r7, =gBattlePartyID
ldr r0, =gBankAttacker
mov r10, r0
ldrb r0, [r0]
movs r4, 0x1
eors r0, r4
lsls r0, 1
adds r0, r7
ldrh r0, [r0]
movs r1, 0x64
mov r9, r1
mov r2, r9
muls r2, r0
adds r0, r2, 0
ldr r1, =gEnemyParty
mov r8, r1
add r0, r8
ldr r1, =gBattleStruct
ldr r2, [r1]
adds r2, 0x6D
movs r1, 0x2
bl GetMonData
bl FreeAllWindowBuffers
mov r2, r10
ldrb r0, [r2]
eors r0, r4
lsls r0, 1
adds r0, r7
ldrh r0, [r0]
mov r1, r9
muls r1, r0
adds r0, r1, 0
add r0, r8
movs r1, 0xB
bl GetMonData
adds r6, r0, 0
lsls r6, 16
lsrs r6, 16
mov r2, r10
ldrb r0, [r2]
eors r0, r4
lsls r0, 1
adds r0, r7
ldrh r0, [r0]
mov r1, r9
muls r1, r0
adds r0, r1, 0
add r0, r8
bl GetMonGender
adds r5, r0, 0
lsls r5, 24
lsrs r5, 24
mov r2, r10
ldrb r0, [r2]
eors r4, r0
lsls r4, 1
adds r4, r7
ldrh r0, [r4]
mov r1, r9
muls r1, r0
adds r0, r1, 0
add r0, r8
movs r1, 0
movs r2, 0
bl GetMonData
ldr r2, =gBattleStruct
ldr r1, [r2]
adds r1, 0x6D
str r0, [sp]
ldr r0, =BattleMainCB2
str r0, [sp, 0x4]
movs r0, 0x2
adds r2, r6, 0
adds r3, r5, 0
bl DoNamingScreen
ldr r1, =gBattleCommunication
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _08056E62
.pool
_08056DD4:
ldr r0, =gMain
ldr r1, [r0, 0x4]
ldr r0, =BattleMainCB2
cmp r1, r0
bne _08056E62
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _08056E62
ldr r2, =gBattlePartyID
ldr r0, =gBankAttacker
ldrb r1, [r0]
movs r0, 0x1
eors r0, r1
lsls r0, 1
adds r0, r2
ldrh r1, [r0]
movs r0, 0x64
muls r0, r1
ldr r1, =gEnemyParty
adds r0, r1
ldr r1, =gBattleStruct
ldr r2, [r1]
adds r2, 0x6D
movs r1, 0x2
bl SetMonData
b _08056E48
.pool
_08056E2C:
bl CalculatePlayerPartyCount
lsls r0, 24
lsrs r0, 24
cmp r0, 0x6
bne _08056E48
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x5
str r0, [r1]
b _08056E62
.pool
_08056E48:
ldr r3, =gBattlescriptCurrInstr
ldr r2, [r3]
ldrb r1, [r2, 0x1]
ldrb r0, [r2, 0x2]
lsls r0, 8
orrs r1, r0
ldrb r0, [r2, 0x3]
lsls r0, 16
orrs r1, r0
ldrb r0, [r2, 0x4]
lsls r0, 24
orrs r1, r0
str r1, [r3]
_08056E62:
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end atkF3_nickname_caught_poke
thumb_func_start atkF4_802BEF0
atkF4_802BEF0: @ 8056E78
ldr r2, =gBattleMons
ldr r0, =gBankAttacker
ldrb r1, [r0]
movs r0, 0x58
muls r1, r0
adds r1, r2
ldr r0, =gBattleMoveDamage
ldr r2, [r0]
ldrh r0, [r1, 0x28]
subs r0, r2
strh r0, [r1, 0x28]
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x1
str r0, [r1]
bx lr
.pool
thumb_func_end atkF4_802BEF0
thumb_func_start atkF5_removeattackerstatus1
atkF5_removeattackerstatus1: @ 8056EA8
ldr r1, =gBattleMons
ldr r0, =gBankAttacker
ldrb r2, [r0]
movs r0, 0x58
muls r0, r2
adds r1, 0x4C
adds r0, r1
movs r1, 0
str r1, [r0]
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x1
str r0, [r1]
bx lr
.pool
thumb_func_end atkF5_removeattackerstatus1
thumb_func_start atkF6_802BF48
atkF6_802BF48: @ 8056ED0
ldr r1, =gFightStateTracker
movs r0, 0xC
strb r0, [r1]
bx lr
.pool
thumb_func_end atkF6_802BF48
thumb_func_start atkF7_802BF54
atkF7_802BF54: @ 8056EDC
ldr r1, =gFightStateTracker
movs r0, 0xC
strb r0, [r1]
ldr r1, =gCurrentMoveTurn
ldr r0, =gNoOfAllBanks
ldrb r0, [r0]
strb r0, [r1]
bx lr
.pool
thumb_func_end atkF7_802BF54
thumb_func_start sub_8056EF8
sub_8056EF8: @ 8056EF8
push {r4,r5,lr}
ldr r5, =gBattlescriptCurrInstr
ldr r0, [r5]
ldrb r0, [r0, 0x1]
bl GetBankByIdentity
ldr r4, =gActiveBank
strb r0, [r4]
movs r0, 0
bl dp01_build_cmdbuf_x09_9_9_9
ldrb r0, [r4]
bl MarkBufferBankForExecution
ldr r0, [r5]
adds r0, 0x2
str r0, [r5]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8056EF8
.align 2, 0 @ Don't pad with nop.