pokeemerald/asm/water.s
2018-10-22 22:08:38 -04:00

3608 lines
56 KiB
ArmAsm

.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start AnimTask_CreateRaindrops
AnimTask_CreateRaindrops: @ 8107188
push {r4-r6,lr}
lsls r0, 24
lsrs r0, 24
adds r6, r0, 0
ldr r1, =gTasks
lsls r0, r6, 2
adds r0, r6
lsls r0, 3
adds r5, r0, r1
movs r1, 0x8
ldrsh r0, [r5, r1]
cmp r0, 0
bne _081071B0
ldr r1, =gBattleAnimArgs
ldrh r0, [r1]
strh r0, [r5, 0xA]
ldrh r0, [r1, 0x2]
strh r0, [r5, 0xC]
ldrh r0, [r1, 0x4]
strh r0, [r5, 0xE]
_081071B0:
ldrh r0, [r5, 0x8]
adds r0, 0x1
strh r0, [r5, 0x8]
movs r2, 0x8
ldrsh r0, [r5, r2]
movs r2, 0xC
ldrsh r1, [r5, r2]
bl __modsi3
cmp r0, 0x1
bne _081071F8
bl Random2
lsls r0, 16
lsrs r0, 16
movs r1, 0xF0
bl __umodsi3
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl Random2
lsls r0, 16
lsrs r0, 16
movs r1, 0x50
bl __umodsi3
adds r2, r0, 0
lsls r2, 24
lsrs r2, 24
ldr r0, =gUnknown_08595020
adds r1, r4, 0
movs r3, 0x4
bl CreateSprite
_081071F8:
movs r0, 0x8
ldrsh r1, [r5, r0]
movs r2, 0xE
ldrsh r0, [r5, r2]
cmp r1, r0
bne _0810720A
adds r0, r6, 0
bl DestroyAnimVisualTask
_0810720A:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end AnimTask_CreateRaindrops
thumb_func_start sub_810721C
sub_810721C: @ 810721C
ldr r1, =sub_8107228
str r1, [r0, 0x1C]
bx lr
.pool
thumb_func_end sub_810721C
thumb_func_start sub_8107228
sub_8107228: @ 8107228
push {lr}
adds r2, r0, 0
ldrh r0, [r2, 0x2E]
adds r0, 0x1
strh r0, [r2, 0x2E]
lsls r0, 16
asrs r0, 16
cmp r0, 0xD
bgt _08107246
ldrh r0, [r2, 0x24]
adds r0, 0x1
strh r0, [r2, 0x24]
ldrh r0, [r2, 0x26]
adds r0, 0x4
strh r0, [r2, 0x26]
_08107246:
adds r0, r2, 0
adds r0, 0x3F
ldrb r1, [r0]
movs r0, 0x10
ands r0, r1
cmp r0, 0
beq _0810725A
adds r0, r2, 0
bl DestroySprite
_0810725A:
pop {r0}
bx r0
thumb_func_end sub_8107228
thumb_func_start sub_8107260
sub_8107260: @ 8107260
push {r4-r6,lr}
adds r6, r0, 0
ldr r5, =gBattleAnimAttacker
ldrb r0, [r5]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _08107290
ldrb r0, [r5]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldr r4, =gBattleAnimArgs
ldrh r1, [r4]
subs r0, r1
b _081072A2
.pool
_08107290:
ldrb r0, [r5]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
ldr r4, =gBattleAnimArgs
lsrs r0, 24
ldrh r1, [r4]
adds r0, r1
_081072A2:
strh r0, [r6, 0x20]
ldrb r0, [r5]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldrh r4, [r4, 0x2]
adds r0, r4
strh r0, [r6, 0x22]
adds r2, r6, 0
adds r2, 0x2C
ldrb r0, [r2]
movs r1, 0x40
orrs r0, r1
strb r0, [r2]
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _081072D8
ldr r1, =gBattleAnimArgs
ldrh r0, [r1, 0x4]
negs r0, r0
strh r0, [r1, 0x4]
_081072D8:
ldr r5, =gBattleAnimArgs
ldrh r0, [r5, 0xC]
strh r0, [r6, 0x2E]
ldrh r0, [r6, 0x20]
strh r0, [r6, 0x30]
ldr r4, =gBattleAnimTarget
ldrb r0, [r4]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x32]
ldrh r0, [r6, 0x22]
strh r0, [r6, 0x34]
ldrb r0, [r4]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x36]
adds r0, r6, 0
bl InitAnimLinearTranslation
ldr r0, =SpriteCallbackDummy
bl CreateInvisibleSpriteWithCallback
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
strh r4, [r6, 0x38]
ldrb r0, [r5, 0x8]
movs r2, 0x4
ldrsh r1, [r5, r2]
bl Sin
ldrh r1, [r6, 0x20]
subs r1, r0
strh r1, [r6, 0x20]
ldrb r0, [r5, 0x8]
movs r2, 0x6
ldrsh r1, [r5, r2]
bl Cos
ldrh r1, [r6, 0x22]
subs r1, r0
strh r1, [r6, 0x22]
ldr r0, =gSprites
lsls r1, r4, 4
adds r1, r4
lsls r1, 2
adds r1, r0
ldrh r0, [r5, 0x4]
strh r0, [r1, 0x2E]
ldrh r0, [r5, 0x6]
strh r0, [r1, 0x30]
ldrh r0, [r5, 0xA]
strh r0, [r1, 0x32]
ldrb r0, [r5, 0x8]
lsls r0, 8
strh r0, [r1, 0x34]
ldrh r0, [r5, 0xC]
strh r0, [r1, 0x36]
ldr r1, =sub_8107380
str r1, [r6, 0x1C]
adds r0, r6, 0
bl _call_via_r1
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8107260
thumb_func_start sub_8107380
sub_8107380: @ 8107380
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x4
adds r5, r0, 0
ldrh r1, [r5, 0x38]
lsls r1, 24
lsrs r1, 24
ldr r2, =gSprites
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r7, r0, r2
ldrh r4, [r7, 0x36]
lsls r4, 24
lsrs r4, 24
ldrh r0, [r7, 0x34]
mov r8, r0
movs r0, 0x1
strh r0, [r5, 0x2E]
adds r0, r5, 0
bl TranslateAnimLinear
mov r1, r8
lsrs r6, r1, 8
movs r0, 0x2E
ldrsh r1, [r7, r0]
adds r0, r6, 0
bl Sin
ldrh r1, [r5, 0x24]
adds r0, r1
strh r0, [r5, 0x24]
movs r0, 0x30
ldrsh r1, [r7, r0]
adds r0, r6, 0
bl Cos
ldrh r1, [r5, 0x26]
adds r0, r1
strh r0, [r5, 0x26]
ldrh r0, [r7, 0x32]
mov r1, r8
adds r1, r0
strh r1, [r7, 0x34]
subs r4, 0x1
lsls r4, 24
lsrs r4, 24
cmp r4, 0
beq _081073EC
strh r4, [r7, 0x36]
b _081073F6
.pool
_081073EC:
ldr r0, =sub_8107408
str r0, [r5, 0x1C]
adds r0, r7, 0
bl DestroySprite
_081073F6:
add sp, 0x4
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8107380
thumb_func_start sub_8107408
sub_8107408: @ 8107408
push {lr}
adds r3, r0, 0
adds r3, 0x2C
ldrb r2, [r3]
movs r1, 0x41
negs r1, r1
ands r1, r2
strb r1, [r3]
ldr r1, =sub_80A67D8
str r1, [r0, 0x1C]
ldr r1, =sub_8107430
bl StoreSpriteCallbackInData6
pop {r0}
bx r0
.pool
thumb_func_end sub_8107408
thumb_func_start sub_8107430
sub_8107430: @ 8107430
push {lr}
movs r1, 0xA
strh r1, [r0, 0x2E]
ldr r1, =sub_80A64B0
str r1, [r0, 0x1C]
ldr r1, =move_anim_8074EE0
bl StoreSpriteCallbackInData6
pop {r0}
bx r0
.pool
thumb_func_end sub_8107430
thumb_func_start sub_810744C
sub_810744C: @ 810744C
push {r4-r7,lr}
adds r5, r0, 0
movs r1, 0x1
bl sub_80A69CC
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0810747C
ldr r1, =gBattleAnimArgs
ldrh r0, [r1, 0x4]
negs r0, r0
lsls r0, 16
lsrs r6, r0, 16
adds r7, r1, 0
b _08107482
.pool
_0810747C:
ldr r0, =gBattleAnimArgs
ldrh r6, [r0, 0x4]
adds r7, r0, 0
_08107482:
ldrh r0, [r7, 0x8]
strh r0, [r5, 0x2E]
ldrh r0, [r5, 0x20]
strh r0, [r5, 0x30]
ldr r4, =gBattleAnimTarget
ldrb r0, [r4]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
adds r0, r6
strh r0, [r5, 0x32]
ldrh r0, [r5, 0x22]
strh r0, [r5, 0x34]
ldrb r0, [r4]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldrh r7, [r7, 0x6]
adds r0, r7
strh r0, [r5, 0x36]
adds r0, r5, 0
bl InitAnimLinearTranslation
ldr r0, =sub_81074E4
str r0, [r5, 0x1C]
adds r2, r5, 0
adds r2, 0x2C
ldrb r0, [r2]
movs r1, 0x80
orrs r0, r1
strb r0, [r2]
ldr r1, [r5, 0x1C]
adds r0, r5, 0
bl _call_via_r1
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_810744C
thumb_func_start sub_81074E4
sub_81074E4: @ 81074E4
push {r4,lr}
adds r4, r0, 0
ldr r0, =gBattleAnimArgs
ldrh r1, [r0, 0xE]
ldr r0, =0x0000ffff
cmp r1, r0
bne _08107506
adds r0, r4, 0
movs r1, 0x1
bl StartSpriteAnim
adds r2, r4, 0
adds r2, 0x2C
ldrb r1, [r2]
movs r0, 0x7F
ands r0, r1
strb r0, [r2]
_08107506:
adds r0, r4, 0
bl TranslateAnimLinear
lsls r0, 24
cmp r0, 0
beq _08107518
adds r0, r4, 0
bl DestroyAnimSprite
_08107518:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81074E4
thumb_func_start sub_8107528
sub_8107528: @ 8107528
push {r4,lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gTasks
lsls r4, r0, 2
adds r4, r0
lsls r4, 3
adds r4, r1
ldr r0, =gBattleAnimArgs
ldrh r0, [r0]
strh r0, [r4, 0x8]
ldr r0, =0x0000279c
bl IndexOfSpritePaletteTag
lsls r0, 24
lsrs r0, 20
movs r1, 0x80
lsls r1, 1
adds r0, r1
strh r0, [r4, 0xC]
ldr r0, =sub_810756C
str r0, [r4]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8107528
thumb_func_start sub_810756C
sub_810756C: @ 810756C
push {r4-r7,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r2, r0, r1
ldrh r0, [r2, 0x1C]
adds r0, 0x1
strh r0, [r2, 0x1C]
lsls r0, 16
asrs r0, 16
mov r12, r1
cmp r0, 0x3
bne _081075BE
movs r0, 0
strh r0, [r2, 0x1C]
ldrh r0, [r2, 0xC]
adds r0, 0x1
lsls r0, 16
lsrs r5, r0, 16
ldr r1, =gPlttBufferFaded
lsls r0, r5, 1
adds r0, r1
ldrh r6, [r0]
adds r7, r1, 0
adds r3, r0, 0x2
movs r1, 0x6
adds r2, r0, 0
_081075A8:
ldrh r0, [r3]
strh r0, [r2]
adds r3, 0x2
adds r2, 0x2
subs r1, 0x1
cmp r1, 0
bge _081075A8
adds r0, r5, 0x7
lsls r0, 1
adds r0, r7
strh r6, [r0]
_081075BE:
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
add r0, r12
ldrh r1, [r0, 0x1E]
adds r1, 0x1
strh r1, [r0, 0x1E]
lsls r1, 16
asrs r1, 16
movs r2, 0x8
ldrsh r0, [r0, r2]
cmp r1, r0
bne _081075DE
adds r0, r4, 0
bl DestroyAnimVisualTask
_081075DE:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_810756C
thumb_func_start sub_81075EC
sub_81075EC: @ 81075EC
push {r4,r5,lr}
adds r5, r0, 0
movs r1, 0x1
bl sub_80A69CC
movs r0, 0x1E
strh r0, [r5, 0x2E]
ldrh r0, [r5, 0x20]
strh r0, [r5, 0x30]
ldr r4, =gBattleAnimTarget
ldrb r0, [r4]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x32]
ldrh r0, [r5, 0x22]
strh r0, [r5, 0x34]
ldrb r0, [r4]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x36]
adds r0, r5, 0
bl InitAnimLinearTranslation
movs r0, 0x2E
ldrsh r1, [r5, r0]
movs r0, 0xD2
lsls r0, 8
bl __divsi3
strh r0, [r5, 0x38]
ldr r0, =gBattleAnimArgs
ldrh r2, [r0, 0x6]
strh r2, [r5, 0x3C]
ldrh r1, [r0, 0xE]
movs r3, 0xE
ldrsh r0, [r0, r3]
cmp r0, 0x7F
ble _0810765C
adds r0, r1, 0
subs r0, 0x7F
lsls r0, 8
strh r0, [r5, 0x3A]
negs r0, r2
strh r0, [r5, 0x3C]
b _08107660
.pool
_0810765C:
lsls r0, r1, 8
strh r0, [r5, 0x3A]
_08107660:
ldr r1, =sub_8107674
str r1, [r5, 0x1C]
adds r0, r5, 0
bl _call_via_r1
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81075EC
thumb_func_start sub_8107674
sub_8107674: @ 8107674
push {r4,lr}
adds r4, r0, 0
bl TranslateAnimLinear
lsls r0, 24
cmp r0, 0
beq _08107688
adds r0, r4, 0
bl DestroyAnimSprite
_08107688:
ldrh r0, [r4, 0x3A]
lsls r0, 16
asrs r0, 24
movs r2, 0x3C
ldrsh r1, [r4, r2]
bl Sin
ldrh r1, [r4, 0x26]
adds r0, r1
strh r0, [r4, 0x26]
movs r2, 0x3A
ldrsh r0, [r4, r2]
movs r2, 0x38
ldrsh r1, [r4, r2]
adds r0, r1
asrs r0, 8
cmp r0, 0x7F
ble _081076B8
movs r0, 0
strh r0, [r4, 0x3A]
ldrh r0, [r4, 0x3C]
negs r0, r0
strh r0, [r4, 0x3C]
b _081076C0
_081076B8:
ldrh r0, [r4, 0x38]
ldrh r1, [r4, 0x3A]
adds r0, r1
strh r0, [r4, 0x3A]
_081076C0:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8107674
thumb_func_start sub_81076C8
sub_81076C8: @ 81076C8
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldr r3, =gBattleAnimArgs
ldrh r0, [r3]
movs r2, 0
strh r0, [r1, 0x8]
strh r2, [r3, 0xE]
ldr r0, =sub_81076F4
str r0, [r1]
bx lr
.pool
thumb_func_end sub_81076C8
thumb_func_start sub_81076F4
sub_81076F4: @ 81076F4
push {lr}
lsls r0, 24
lsrs r3, r0, 24
ldr r2, =gBattleAnimArgs
ldrh r0, [r2, 0xE]
adds r0, 0x3
movs r1, 0xFF
ands r0, r1
strh r0, [r2, 0xE]
ldr r1, =gTasks
lsls r0, r3, 2
adds r0, r3
lsls r0, 3
adds r0, r1
ldrh r1, [r0, 0x8]
subs r1, 0x1
strh r1, [r0, 0x8]
lsls r1, 16
cmp r1, 0
bne _08107722
adds r0, r3, 0
bl DestroyAnimVisualTask
_08107722:
pop {r0}
bx r0
.pool
thumb_func_end sub_81076F4
thumb_func_start sub_8107730
sub_8107730: @ 8107730
push {r4-r7,lr}
adds r4, r0, 0
ldr r7, =gBattleAnimAttacker
ldrb r0, [r7]
movs r1, 0
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x20]
ldrb r0, [r7]
movs r1, 0x1
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x22]
ldr r6, =0x0000fff6
strh r6, [r4, 0x26]
ldrb r0, [r7]
bl sub_80A82E4
lsls r0, 24
lsrs r5, r0, 24
bl IsContest
lsls r0, 24
cmp r0, 0
bne _0810778A
ldrb r0, [r7]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _08107784
movs r0, 0xA
strh r0, [r4, 0x24]
b _0810778C
.pool
_08107784:
strh r6, [r4, 0x24]
subs r0, r5, 0x2
b _0810778E
_0810778A:
strh r6, [r4, 0x24]
_0810778C:
adds r0, r5, 0x2
_0810778E:
adds r1, r4, 0
adds r1, 0x43
strb r0, [r1]
ldr r0, =sub_81077A4
str r0, [r4, 0x1C]
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8107730
thumb_func_start sub_81077A4
sub_81077A4: @ 81077A4
push {lr}
adds r2, r0, 0
adds r0, 0x3F
ldrb r1, [r0]
movs r0, 0x20
ands r0, r1
cmp r0, 0
beq _081077BA
adds r0, r2, 0
bl DestroyAnimSprite
_081077BA:
pop {r0}
bx r0
thumb_func_end sub_81077A4
thumb_func_start sub_81077C0
sub_81077C0: @ 81077C0
push {r4-r7,lr}
adds r6, r0, 0
ldr r5, =gBattleAnimAttacker
ldrb r0, [r5]
bl GetBattlerSide
adds r4, r0, 0
ldr r0, =gBattleAnimTarget
ldrb r0, [r0]
bl GetBattlerSide
lsls r4, 24
lsls r0, 24
cmp r4, r0
bne _0810780A
ldr r4, =gBattleAnimArgs
movs r1, 0
ldrsh r0, [r4, r1]
negs r0, r0
strh r0, [r4]
ldrb r0, [r5]
bl GetBattlerPosition
lsls r0, 24
cmp r0, 0
beq _08107802
ldrb r0, [r5]
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _0810780A
_08107802:
movs r1, 0
ldrsh r0, [r4, r1]
negs r0, r0
strh r0, [r4]
_0810780A:
ldr r5, =gBattleAnimArgs
movs r1, 0xA
ldrsh r0, [r5, r1]
movs r1, 0xFF
lsls r1, 8
ands r0, r1
movs r1, 0
cmp r0, 0
bne _0810781E
movs r1, 0x1
_0810781E:
ldrb r0, [r5, 0xA]
movs r7, 0x1
cmp r0, 0
bne _08107828
movs r7, 0x3
_08107828:
adds r0, r6, 0
bl sub_80A69CC
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _08107842
ldrh r0, [r5, 0x4]
negs r0, r0
strh r0, [r5, 0x4]
_08107842:
ldrh r0, [r5, 0x8]
strh r0, [r6, 0x2E]
ldr r4, =gBattleAnimTarget
ldrb r0, [r4]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldrh r1, [r5, 0x4]
adds r0, r1
strh r0, [r6, 0x32]
ldrb r0, [r4]
adds r1, r7, 0
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldrh r5, [r5, 0x6]
adds r0, r5
strh r0, [r6, 0x36]
ldr r0, =sub_80A6EEC
str r0, [r6, 0x1C]
ldr r1, =DestroyAnimSprite
adds r0, r6, 0
bl StoreSpriteCallbackInData6
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81077C0
thumb_func_start sub_8107894
sub_8107894: @ 8107894
push {r4,lr}
adds r4, r0, 0
movs r1, 0x1
bl sub_80A6980
ldr r0, =gBattleAnimArgs
ldrh r1, [r0, 0x8]
strh r1, [r4, 0x2E]
ldrh r0, [r0, 0x4]
ldrh r2, [r4, 0x20]
adds r0, r2
strh r0, [r4, 0x32]
ldrh r0, [r4, 0x22]
adds r1, r0
strh r1, [r4, 0x36]
ldr r0, =sub_80A6EEC
str r0, [r4, 0x1C]
ldr r1, =DestroyAnimSprite
adds r0, r4, 0
bl StoreSpriteCallbackInData6
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8107894
thumb_func_start sub_81078D0
sub_81078D0: @ 81078D0
push {r4,lr}
adds r4, r0, 0
ldr r0, =gBattleAnimArgs
movs r1, 0x6
ldrsh r0, [r0, r1]
cmp r0, 0
beq _081078EC
adds r0, r4, 0
movs r1, 0x1
bl sub_80A6980
b _081078F4
.pool
_081078EC:
adds r0, r4, 0
movs r1, 0x1
bl sub_80A69CC
_081078F4:
ldr r0, =gBattleAnimArgs
ldrh r0, [r0, 0x4]
strh r0, [r4, 0x3C]
ldr r0, =sub_810790C
str r0, [r4, 0x1C]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81078D0
thumb_func_start sub_810790C
sub_810790C: @ 810790C
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x2E]
adds r0, 0xB
movs r1, 0xFF
ands r0, r1
strh r0, [r4, 0x2E]
movs r1, 0x2E
ldrsh r0, [r4, r1]
movs r1, 0x4
bl Sin
strh r0, [r4, 0x24]
ldrh r0, [r4, 0x30]
adds r0, 0x30
strh r0, [r4, 0x30]
lsls r0, 16
asrs r0, 24
negs r0, r0
strh r0, [r4, 0x26]
ldrh r0, [r4, 0x3C]
subs r0, 0x1
strh r0, [r4, 0x3C]
lsls r0, 16
asrs r0, 16
movs r1, 0x1
negs r1, r1
cmp r0, r1
bne _0810794C
adds r0, r4, 0
bl DestroyAnimSprite
_0810794C:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_810790C
thumb_func_start AnimTask_CreateSurfWave
AnimTask_CreateSurfWave: @ 8107954
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x10
lsls r0, 24
lsrs r0, 24
mov r10, r0
ldr r1, =0x00003f42
movs r0, 0x50
bl SetGpuReg
movs r1, 0x80
lsls r1, 5
movs r0, 0x52
bl SetGpuReg
movs r0, 0x1
movs r1, 0x4
movs r2, 0x1
bl SetAnimBgAttribute
movs r0, 0x1
movs r1, 0
movs r2, 0x1
bl SetAnimBgAttribute
mov r0, sp
bl sub_80A6B30
bl IsContest
lsls r0, 24
cmp r0, 0
bne _081079E0
movs r0, 0x1
movs r1, 0x3
movs r2, 0x1
bl SetAnimBgAttribute
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _081079D0
mov r0, sp
ldrb r0, [r0, 0x9]
ldr r1, =gUnknown_08D95E00
bl sub_80A6D48
b _081079EA
.pool
_081079D0:
mov r0, sp
ldrb r0, [r0, 0x9]
ldr r1, =gUnknown_08D960D0
bl sub_80A6D48
b _081079EA
.pool
_081079E0:
ldr r1, =gUnknown_08D963A4
mov r0, sp
movs r2, 0x1
bl sub_80A6D60
_081079EA:
mov r0, sp
ldrb r0, [r0, 0x9]
ldr r1, =gBattleAnimBackgroundImage_Surf
mov r2, sp
ldrh r2, [r2, 0xA]
bl sub_80A6CC0
ldr r0, =gBattleAnimArgs
movs r1, 0
ldrsh r0, [r0, r1]
cmp r0, 0
bne _08107A24
ldr r0, =gBattleAnimBackgroundPalette_Surf
mov r1, sp
ldrb r1, [r1, 0x8]
lsls r1, 4
movs r2, 0x20
bl LoadCompressedPalette
b _08107A32
.pool
_08107A24:
ldr r0, =gBattleAnimBackgroundImageMuddyWater_Pal
mov r1, sp
ldrb r1, [r1, 0x8]
lsls r1, 4
movs r2, 0x20
bl LoadCompressedPalette
_08107A32:
ldr r0, =sub_8107D58
ldr r4, =gTasks
mov r2, r10
lsls r5, r2, 2
adds r1, r5, r2
lsls r1, 3
adds r6, r1, r4
ldrb r1, [r6, 0x7]
adds r1, 0x1
lsls r1, 24
lsrs r1, 24
bl CreateTask
lsls r0, 24
lsrs r0, 24
mov r8, r0
movs r0, 0
mov r9, r0
mov r1, r8
strh r1, [r6, 0x26]
mov r2, r8
lsls r0, r2, 2
add r0, r8
lsls r0, 3
adds r7, r0, r4
mov r0, r9
strh r0, [r7, 0x8]
movs r0, 0x80
lsls r0, 5
strh r0, [r7, 0xA]
strh r0, [r7, 0xC]
bl IsContest
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0
beq _08107AB4
ldr r1, =0x0000ffb0
adds r0, r1, 0
ldr r2, =gBattle_BG1_X
strh r0, [r2]
adds r1, 0x20
adds r0, r1, 0
ldr r2, =gBattle_BG1_Y
strh r0, [r2]
movs r0, 0x2
strh r0, [r6, 0x8]
movs r0, 0x1
strh r0, [r6, 0xA]
mov r0, r9
strh r0, [r7, 0xE]
b _08107B0E
.pool
_08107AB4:
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x1
bne _08107AF8
ldr r2, =0x0000ff20
adds r0, r2, 0
ldr r2, =gBattle_BG1_X
strh r0, [r2]
movs r2, 0x80
lsls r2, 1
adds r0, r2, 0
ldr r2, =gBattle_BG1_Y
strh r0, [r2]
movs r0, 0x2
strh r0, [r6, 0x8]
ldr r0, =0x0000ffff
strh r0, [r6, 0xA]
strh r1, [r7, 0xE]
b _08107B0E
.pool
_08107AF8:
ldr r0, =gBattle_BG1_X
strh r4, [r0]
ldr r1, =0x0000ffd0
adds r0, r1, 0
ldr r2, =gBattle_BG1_Y
strh r0, [r2]
ldr r0, =0x0000fffe
strh r0, [r6, 0x8]
movs r0, 0x1
strh r0, [r6, 0xA]
strh r4, [r7, 0xE]
_08107B0E:
ldr r0, =gBattle_BG1_X
ldrh r1, [r0]
movs r0, 0x14
bl SetGpuReg
ldr r2, =gBattle_BG1_Y
ldrh r1, [r2]
movs r0, 0x16
bl SetGpuReg
ldr r1, =gTasks
mov r2, r8
lsls r0, r2, 2
add r0, r8
lsls r0, 3
adds r1, r0, r1
movs r2, 0xE
ldrsh r0, [r1, r2]
cmp r0, 0
bne _08107B54
movs r0, 0x30
strh r0, [r1, 0x10]
movs r0, 0x70
b _08107B58
.pool
_08107B54:
movs r0, 0
strh r0, [r1, 0x10]
_08107B58:
strh r0, [r1, 0x12]
ldr r1, =gTasks
mov r2, r10
adds r0, r5, r2
lsls r0, 3
adds r0, r1
movs r1, 0x1
strh r1, [r0, 0x14]
ldr r1, =sub_8107B84
str r1, [r0]
add sp, 0x10
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end AnimTask_CreateSurfWave
thumb_func_start sub_8107B84
sub_8107B84: @ 8107B84
push {r4-r7,lr}
sub sp, 0x10
lsls r0, 24
lsrs r5, r0, 24
ldr r1, =gBattle_BG1_X
ldr r2, =gBattle_BG1_Y
ldr r0, =gTasks
lsls r4, r5, 2
adds r4, r5
lsls r4, 3
adds r4, r0
ldrh r0, [r4, 0x8]
ldrh r3, [r1]
adds r0, r3
strh r0, [r1]
ldrh r0, [r4, 0xA]
ldrh r1, [r2]
adds r0, r1
strh r0, [r2]
mov r0, sp
bl sub_80A6B30
ldrh r0, [r4, 0xA]
ldrh r3, [r4, 0xC]
adds r0, r3
strh r0, [r4, 0xC]
ldrh r0, [r4, 0x12]
adds r0, 0x1
strh r0, [r4, 0x12]
lsls r0, 16
asrs r0, 16
cmp r0, 0x4
bne _08107C18
ldr r1, =gPlttBufferFaded
mov r0, sp
ldrb r0, [r0, 0x8]
lsls r0, 4
adds r0, 0x7
lsls r0, 1
adds r0, r1
ldrh r6, [r0]
movs r2, 0x6
adds r7, r1, 0
adds r3, r7, 0
mov r4, sp
_08107BDE:
ldrb r0, [r4, 0x8]
lsls r0, 4
adds r1, r2, 0x1
adds r0, r1
lsls r1, r0, 1
adds r1, r3
subs r0, 0x1
lsls r0, 1
adds r0, r3
ldrh r0, [r0]
strh r0, [r1]
subs r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0
bne _08107BDE
mov r0, sp
ldrb r0, [r0, 0x8]
lsls r0, 4
adds r0, 0x1
lsls r0, 1
adds r0, r7
strh r6, [r0]
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
strh r2, [r0, 0x12]
_08107C18:
ldr r1, =gTasks
lsls r2, r5, 2
adds r0, r2, r5
lsls r0, 3
adds r3, r0, r1
ldrh r0, [r3, 0x14]
adds r0, 0x1
strh r0, [r3, 0x14]
lsls r0, 16
asrs r0, 16
adds r4, r1, 0
adds r6, r2, 0
cmp r0, 0x1
ble _08107C86
movs r0, 0
strh r0, [r3, 0x14]
ldrh r0, [r3, 0xE]
adds r2, r0, 0x1
strh r2, [r3, 0xE]
lsls r0, r2, 16
asrs r0, 16
cmp r0, 0xD
bgt _08107C62
movs r1, 0x26
ldrsh r0, [r3, r1]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r4
movs r0, 0x10
subs r0, r2
lsls r0, 8
orrs r2, r0
strh r2, [r1, 0xA]
ldrh r0, [r3, 0x10]
adds r0, 0x1
strh r0, [r3, 0x10]
_08107C62:
movs r1, 0xE
ldrsh r0, [r3, r1]
cmp r0, 0x36
ble _08107C86
ldrh r2, [r3, 0x10]
subs r2, 0x1
strh r2, [r3, 0x10]
movs r1, 0x26
ldrsh r0, [r3, r1]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r4
movs r0, 0x10
subs r0, r2
lsls r0, 8
orrs r2, r0
strh r2, [r1, 0xA]
_08107C86:
adds r0, r6, r5
lsls r0, 3
adds r2, r0, r4
movs r3, 0x26
ldrsh r1, [r2, r3]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r4
ldrh r0, [r0, 0xA]
movs r3, 0x1F
ands r3, r0
cmp r3, 0
bne _08107CA8
strh r3, [r2, 0x8]
ldr r0, =sub_8107CC4
str r0, [r2]
_08107CA8:
add sp, 0x10
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8107B84
thumb_func_start sub_8107CC4
sub_8107CC4: @ 8107CC4
push {r4-r7,lr}
mov r7, r8
push {r7}
lsls r0, 24
lsrs r0, 24
adds r5, r0, 0
ldr r7, =gBattle_BG1_X
ldr r0, =gBattle_BG1_Y
mov r8, r0
ldr r6, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r4, r0, r6
movs r1, 0x8
ldrsh r0, [r4, r1]
cmp r0, 0
bne _08107D08
movs r0, 0x1
bl sub_80A6C68
movs r0, 0x2
bl sub_80A6C68
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
b _08107D4A
.pool
_08107D08:
bl IsContest
lsls r0, 24
cmp r0, 0
bne _08107D1C
movs r0, 0x1
movs r1, 0x3
movs r2, 0
bl SetAnimBgAttribute
_08107D1C:
movs r0, 0
strh r0, [r7]
mov r1, r8
strh r0, [r1]
movs r0, 0x50
movs r1, 0
bl SetGpuReg
movs r0, 0x52
movs r1, 0
bl SetGpuReg
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r6
ldr r1, =0x0000ffff
strh r1, [r0, 0x26]
adds r0, r5, 0
bl DestroyAnimVisualTask
_08107D4A:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8107CC4
thumb_func_start sub_8107D58
sub_8107D58: @ 8107D58
push {r4-r7,lr}
sub sp, 0xC
lsls r0, 24
lsrs r7, r0, 24
lsls r0, r7, 2
adds r0, r7
lsls r0, 3
ldr r1, =gTasks
adds r4, r0, r1
movs r1, 0x8
ldrsh r0, [r4, r1]
cmp r0, 0x1
bne _08107D74
b _08107EAC
_08107D74:
cmp r0, 0x1
bgt _08107D84
cmp r0, 0
beq _08107D8C
b _08108022
.pool
_08107D84:
cmp r0, 0x2
bne _08107D8A
b _08107F78
_08107D8A:
b _08108022
_08107D8C:
movs r3, 0
movs r2, 0x10
ldrsh r0, [r4, r2]
ldr r1, =gScanlineEffectRegBuffers
mov r12, r1
cmp r3, r0
bge _08107DCA
mov r7, r12
movs r5, 0xF0
lsls r5, 3
add r5, r12
ldr r6, =0x0000ffff
_08107DA4:
lsls r2, r3, 16
asrs r2, 16
lsls r1, r2, 1
adds r3, r1, r7
adds r1, r5
ldrh r0, [r4, 0xC]
strh r0, [r1]
ldrh r1, [r4, 0xC]
adds r0, r6, 0
ands r0, r1
strh r0, [r3]
adds r2, 0x1
lsls r2, 16
lsrs r3, r2, 16
asrs r2, 16
movs r1, 0x10
ldrsh r0, [r4, r1]
cmp r2, r0
blt _08107DA4
_08107DCA:
ldrh r3, [r4, 0x10]
lsls r2, r3, 16
asrs r1, r2, 16
movs r3, 0x12
ldrsh r0, [r4, r3]
cmp r1, r0
bge _08107E04
ldr r5, =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r5, r0
ldr r7, =0x0000ffff
_08107DE2:
asrs r2, 16
lsls r1, r2, 1
adds r3, r1, r5
adds r1, r6
ldrh r0, [r4, 0xA]
strh r0, [r1]
ldrh r1, [r4, 0xA]
adds r0, r7, 0
ands r0, r1
strh r0, [r3]
adds r2, 0x1
lsls r2, 16
asrs r1, r2, 16
movs r3, 0x12
ldrsh r0, [r4, r3]
cmp r1, r0
blt _08107DE2
_08107E04:
ldrh r3, [r4, 0x12]
lsls r2, r3, 16
asrs r0, r2, 16
cmp r0, 0x9F
bgt _08107E3A
ldr r5, =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r5, r0
ldr r7, =0x0000ffff
_08107E18:
asrs r2, 16
lsls r1, r2, 1
adds r3, r1, r5
adds r1, r6
ldrh r0, [r4, 0xC]
strh r0, [r1]
ldrh r1, [r4, 0xC]
adds r0, r7, 0
ands r0, r1
strh r0, [r3]
adds r2, 0x1
lsls r2, 16
lsrs r3, r2, 16
lsls r2, r3, 16
asrs r0, r2, 16
cmp r0, 0x9F
ble _08107E18
_08107E3A:
movs r1, 0x10
ldrsh r0, [r4, r1]
cmp r0, 0
bne _08107E64
lsls r0, r3, 16
asrs r0, 15
mov r3, r12
adds r2, r0, r3
movs r1, 0xF0
lsls r1, 3
add r1, r12
adds r0, r1
ldrh r1, [r4, 0xA]
strh r1, [r0]
ldrh r0, [r4, 0xA]
b _08107E7A
.pool
_08107E64:
lsls r0, r3, 16
asrs r0, 15
mov r1, r12
adds r2, r0, r1
movs r1, 0xF0
lsls r1, 3
add r1, r12
adds r0, r1
ldrh r1, [r4, 0xC]
strh r1, [r0]
ldrh r0, [r4, 0xC]
_08107E7A:
strh r0, [r2]
ldr r0, =0x04000052
str r0, [sp]
ldr r0, =0xa2600001
str r0, [sp, 0x4]
mov r1, sp
movs r2, 0
movs r0, 0x1
strb r0, [r1, 0x8]
mov r0, sp
strb r2, [r0, 0x9]
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
bl ScanlineEffect_SetParams
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
b _08108022
.pool
_08107EAC:
movs r2, 0xE
ldrsh r1, [r4, r2]
cmp r1, 0
bne _08107EC4
ldrh r0, [r4, 0x10]
subs r0, 0x1
strh r0, [r4, 0x10]
lsls r0, 16
cmp r0, 0
bgt _08107ED8
strh r1, [r4, 0x10]
b _08107ED2
_08107EC4:
ldrh r0, [r4, 0x12]
adds r0, 0x1
strh r0, [r4, 0x12]
lsls r0, 16
asrs r0, 16
cmp r0, 0x6F
ble _08107ED8
_08107ED2:
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
_08107ED8:
movs r3, 0
movs r1, 0x10
ldrsh r0, [r4, r1]
cmp r3, r0
bge _08107F0C
ldr r6, =gScanlineEffectRegBuffers
ldr r5, =gScanlineEffect
_08107EE6:
lsls r1, r3, 16
asrs r1, 16
lsls r3, r1, 1
ldrb r2, [r5, 0x14]
lsls r0, r2, 4
subs r0, r2
lsls r0, 7
adds r3, r0
adds r3, r6
ldrh r0, [r4, 0xC]
strh r0, [r3]
adds r1, 0x1
lsls r1, 16
lsrs r3, r1, 16
asrs r1, 16
movs r2, 0x10
ldrsh r0, [r4, r2]
cmp r1, r0
blt _08107EE6
_08107F0C:
ldrh r3, [r4, 0x10]
lsls r2, r3, 16
asrs r1, r2, 16
movs r3, 0x12
ldrsh r0, [r4, r3]
cmp r1, r0
bge _08107F40
ldr r6, =gScanlineEffectRegBuffers
ldr r5, =gScanlineEffect
_08107F1E:
asrs r3, r2, 16
lsls r2, r3, 1
ldrb r1, [r5, 0x14]
lsls r0, r1, 4
subs r0, r1
lsls r0, 7
adds r2, r0
adds r2, r6
ldrh r0, [r4, 0xA]
strh r0, [r2]
adds r3, 0x1
lsls r2, r3, 16
asrs r1, r2, 16
movs r3, 0x12
ldrsh r0, [r4, r3]
cmp r1, r0
blt _08107F1E
_08107F40:
ldrh r3, [r4, 0x12]
lsls r1, r3, 16
asrs r0, r1, 16
cmp r0, 0x9F
bgt _08108022
ldr r6, =gScanlineEffectRegBuffers
ldr r5, =gScanlineEffect
_08107F4E:
asrs r3, r1, 16
lsls r2, r3, 1
ldrb r1, [r5, 0x14]
lsls r0, r1, 4
subs r0, r1
lsls r0, 7
adds r2, r0
adds r2, r6
ldrh r0, [r4, 0xC]
strh r0, [r2]
adds r3, 0x1
lsls r1, r3, 16
asrs r0, r1, 16
cmp r0, 0x9F
ble _08107F4E
b _08108022
.pool
_08107F78:
movs r3, 0
movs r1, 0x10
ldrsh r0, [r4, r1]
cmp r3, r0
bge _08107FAC
ldr r6, =gScanlineEffectRegBuffers
ldr r5, =gScanlineEffect
_08107F86:
lsls r1, r3, 16
asrs r1, 16
lsls r3, r1, 1
ldrb r2, [r5, 0x14]
lsls r0, r2, 4
subs r0, r2
lsls r0, 7
adds r3, r0
adds r3, r6
ldrh r0, [r4, 0xC]
strh r0, [r3]
adds r1, 0x1
lsls r1, 16
lsrs r3, r1, 16
asrs r1, 16
movs r2, 0x10
ldrsh r0, [r4, r2]
cmp r1, r0
blt _08107F86
_08107FAC:
ldrh r3, [r4, 0x10]
lsls r2, r3, 16
asrs r1, r2, 16
movs r3, 0x12
ldrsh r0, [r4, r3]
cmp r1, r0
bge _08107FE0
ldr r6, =gScanlineEffectRegBuffers
ldr r5, =gScanlineEffect
_08107FBE:
asrs r3, r2, 16
lsls r2, r3, 1
ldrb r1, [r5, 0x14]
lsls r0, r1, 4
subs r0, r1
lsls r0, 7
adds r2, r0
adds r2, r6
ldrh r0, [r4, 0xA]
strh r0, [r2]
adds r3, 0x1
lsls r2, r3, 16
asrs r1, r2, 16
movs r3, 0x12
ldrsh r0, [r4, r3]
cmp r1, r0
blt _08107FBE
_08107FE0:
ldrh r3, [r4, 0x12]
lsls r1, r3, 16
asrs r0, r1, 16
cmp r0, 0x9F
bgt _0810800C
ldr r6, =gScanlineEffectRegBuffers
ldr r5, =gScanlineEffect
_08107FEE:
asrs r3, r1, 16
lsls r2, r3, 1
ldrb r1, [r5, 0x14]
lsls r0, r1, 4
subs r0, r1
lsls r0, 7
adds r2, r0
adds r2, r6
ldrh r0, [r4, 0xC]
strh r0, [r2]
adds r3, 0x1
lsls r1, r3, 16
asrs r0, r1, 16
cmp r0, 0x9F
ble _08107FEE
_0810800C:
movs r0, 0x26
ldrsh r1, [r4, r0]
movs r0, 0x1
negs r0, r0
cmp r1, r0
bne _08108022
bl ScanlineEffect_Stop
adds r0, r7, 0
bl DestroyTask
_08108022:
add sp, 0xC
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8107D58
thumb_func_start sub_8108034
sub_8108034: @ 8108034
push {r4-r6,lr}
adds r4, r0, 0
ldrh r2, [r4, 0x4]
lsls r1, r2, 22
lsrs r1, 22
adds r1, 0x8
ldr r3, =0x000003ff
adds r0, r3, 0
ands r1, r0
ldr r0, =0xfffffc00
ands r0, r2
orrs r0, r1
strh r0, [r4, 0x4]
adds r0, r4, 0
movs r1, 0x1
bl sub_80A6980
bl Random2
movs r5, 0xFF
ands r5, r0
movs r0, 0x80
lsls r0, 1
adds r6, r0, 0
orrs r5, r6
bl Random2
ldr r1, =0x000001ff
ands r1, r0
adds r0, r1, 0
cmp r0, 0xFF
ble _0810807A
subs r0, r6, r0
lsls r0, 16
lsrs r1, r0, 16
_0810807A:
strh r5, [r4, 0x30]
strh r1, [r4, 0x32]
ldr r0, =sub_8108098
str r0, [r4, 0x1C]
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8108034
thumb_func_start sub_8108098
sub_8108098: @ 8108098
push {r4,lr}
adds r2, r0, 0
ldrh r0, [r2, 0x30]
ldrh r1, [r2, 0x34]
adds r3, r0, r1
strh r3, [r2, 0x34]
ldrh r1, [r2, 0x32]
ldrh r4, [r2, 0x36]
adds r1, r4
strh r1, [r2, 0x36]
movs r1, 0x1
ands r1, r0
cmp r1, 0
beq _081080BC
lsls r0, r3, 16
asrs r0, 24
negs r0, r0
b _081080C0
_081080BC:
lsls r0, r3, 16
asrs r0, 24
_081080C0:
strh r0, [r2, 0x24]
ldrh r0, [r2, 0x36]
lsls r0, 16
asrs r0, 24
strh r0, [r2, 0x26]
ldrh r0, [r2, 0x2E]
adds r0, 0x1
strh r0, [r2, 0x2E]
lsls r0, 16
asrs r0, 16
cmp r0, 0x15
bne _081080DE
adds r0, r2, 0
bl DestroyAnimSprite
_081080DE:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8108098
thumb_func_start sub_81080E4
sub_81080E4: @ 81080E4
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r4, r0, 2
adds r4, r0
lsls r4, 3
ldr r0, =gTasks
adds r4, r0
movs r0, 0
bl GetAnimBattlerSpriteId
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x26]
ldr r2, =gSprites
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
ldrh r0, [r0, 0x22]
strh r0, [r4, 0x12]
bl sub_8108384
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0xA]
ldrh r0, [r4, 0x26]
lsls r0, 24
lsrs r0, 24
movs r1, 0
bl sub_80A7270
ldr r0, =sub_8108140
str r0, [r4]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81080E4
thumb_func_start sub_8108140
sub_8108140: @ 8108140
push {r4-r6,lr}
sub sp, 0xC
lsls r0, 24
lsrs r2, r0, 24
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
ldr r1, =gTasks
adds r4, r0, r1
movs r1, 0x8
ldrsh r0, [r4, r1]
cmp r0, 0x7
bls _0810815C
b _0810837A
_0810815C:
lsls r0, 2
ldr r1, =_08108170
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_08108170:
.4byte _08108190
.4byte _081081B6
.4byte _08108248
.4byte _0810827E
.4byte _08108292
.4byte _081082A0
.4byte _08108320
.4byte _0810836C
_08108190:
ldrh r1, [r4, 0x26]
lsls r1, 24
lsrs r1, 24
movs r3, 0x80
lsls r3, 1
movs r0, 0xE0
str r0, [sp]
movs r0, 0x80
lsls r0, 2
str r0, [sp, 0x4]
movs r0, 0x20
str r0, [sp, 0x8]
adds r0, r4, 0
adds r2, r3, 0
bl sub_80A805C
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
_081081B6:
ldrh r0, [r4, 0xE]
adds r0, 0x1
strh r0, [r4, 0xE]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
ble _08108212
movs r0, 0
strh r0, [r4, 0xE]
ldrh r0, [r4, 0x10]
adds r0, 0x1
strh r0, [r4, 0x10]
movs r1, 0x1
ands r0, r1
cmp r0, 0
beq _08108200
ldr r2, =gSprites
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
movs r1, 0x3
strh r1, [r0, 0x24]
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
ldrh r1, [r0, 0x22]
adds r1, 0x1
strh r1, [r0, 0x22]
b _08108212
.pool
_08108200:
ldr r2, =gSprites
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
ldr r1, =0x0000fffd
strh r1, [r0, 0x24]
_08108212:
adds r0, r4, 0
bl sub_80A80C8
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0
beq _08108222
b _0810837A
_08108222:
ldrh r0, [r4, 0x26]
lsls r0, 24
lsrs r0, 24
bl sub_80A7E6C
ldr r2, =gSprites
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
strh r5, [r0, 0x24]
strh r5, [r4, 0xE]
b _0810835C
.pool
_08108248:
ldrh r0, [r4, 0xE]
adds r0, 0x1
strh r0, [r4, 0xE]
lsls r0, 16
asrs r0, 16
cmp r0, 0x4
bgt _08108258
b _0810837A
_08108258:
ldrh r1, [r4, 0x26]
lsls r1, 24
lsrs r1, 24
movs r3, 0x80
lsls r3, 2
movs r0, 0xC0
lsls r0, 1
str r0, [sp]
movs r0, 0xE0
str r0, [sp, 0x4]
movs r0, 0x8
str r0, [sp, 0x8]
adds r0, r4, 0
movs r2, 0xE0
bl sub_80A805C
movs r0, 0
strh r0, [r4, 0xE]
b _0810835E
_0810827E:
adds r0, r4, 0
bl sub_80A80C8
lsls r0, 24
lsrs r0, 24
cmp r0, 0
bne _0810837A
strh r0, [r4, 0xE]
strh r0, [r4, 0x10]
b _0810835E
_08108292:
adds r0, r4, 0
adds r1, r2, 0
bl sub_8108408
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
_081082A0:
ldrh r0, [r4, 0xE]
adds r0, 0x1
strh r0, [r4, 0xE]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
ble _0810837A
movs r0, 0
strh r0, [r4, 0xE]
ldrh r0, [r4, 0x10]
adds r0, 0x1
strh r0, [r4, 0x10]
movs r1, 0x1
ands r0, r1
cmp r0, 0
beq _081082D8
ldr r2, =gSprites
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
ldrh r1, [r0, 0x26]
adds r1, 0x2
b _081082EA
.pool
_081082D8:
ldr r2, =gSprites
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
ldrh r1, [r0, 0x26]
subs r1, 0x2
_081082EA:
strh r1, [r0, 0x26]
movs r1, 0x10
ldrsh r0, [r4, r1]
cmp r0, 0xA
bne _0810837A
ldrh r1, [r4, 0x26]
lsls r1, 24
lsrs r1, 24
movs r2, 0xC0
lsls r2, 1
movs r0, 0x80
lsls r0, 1
str r0, [sp]
str r0, [sp, 0x4]
movs r0, 0x8
str r0, [sp, 0x8]
adds r0, r4, 0
movs r3, 0xE0
bl sub_80A805C
movs r0, 0
strh r0, [r4, 0xE]
strh r0, [r4, 0x10]
b _0810835E
.pool
_08108320:
ldr r6, =gSprites
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r6
ldrh r1, [r0, 0x22]
subs r1, 0x1
strh r1, [r0, 0x22]
adds r0, r4, 0
bl sub_80A80C8
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0
bne _0810837A
ldrh r0, [r4, 0x26]
lsls r0, 24
lsrs r0, 24
bl sub_80A7344
movs r0, 0x26
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r6
ldrh r1, [r4, 0x12]
strh r1, [r0, 0x22]
_0810835C:
strh r5, [r4, 0x10]
_0810835E:
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
b _0810837A
.pool
_0810836C:
movs r1, 0xC
ldrsh r0, [r4, r1]
cmp r0, 0
bne _0810837A
adds r0, r2, 0
bl DestroyAnimVisualTask
_0810837A:
add sp, 0xC
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_8108140
thumb_func_start sub_8108384
sub_8108384: @ 8108384
push {r4,r5,lr}
ldr r4, =gBattleAnimAttacker
ldrb r0, [r4]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _081083B8
ldr r1, =gBattlerPartyIndexes
ldrb r0, [r4]
lsls r0, 1
adds r0, r1
ldrh r1, [r0]
movs r0, 0x64
muls r1, r0
ldr r0, =gPlayerParty
b _081083C8
.pool
_081083B4:
adds r0, r2, 0
b _081083FA
_081083B8:
ldr r1, =gBattlerPartyIndexes
ldrb r0, [r4]
lsls r0, 1
adds r0, r1
ldrh r1, [r0]
movs r0, 0x64
muls r1, r0
ldr r0, =gEnemyParty
_081083C8:
adds r5, r1, r0
adds r0, r5, 0
movs r1, 0x3A
bl GetMonData
adds r4, r0, 0
lsls r4, 16
adds r0, r5, 0
movs r1, 0x39
bl GetMonData
lsls r0, 16
lsrs r3, r0, 16
lsrs r4, 18
movs r2, 0
_081083E6:
adds r1, r2, 0x1
adds r0, r4, 0
muls r0, r1
cmp r3, r0
blt _081083B4
lsls r0, r1, 24
lsrs r2, r0, 24
cmp r2, 0x2
bls _081083E6
movs r0, 0x3
_081083FA:
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_8108384
thumb_func_start sub_8108408
sub_8108408: @ 8108408
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x14
adds r7, r0, 0
lsls r1, 24
lsrs r1, 24
str r1, [sp]
ldr r4, =gBattleAnimAttacker
ldrb r0, [r4]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
mov r8, r0
ldrb r0, [r4]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r6, r0, 24
movs r5, 0xAC
ldrb r0, [r4]
bl sub_80A82E4
subs r0, 0x1
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x8]
ldrh r1, [r7, 0xA]
movs r0, 0x4
subs r0, r1
lsls r0, 16
lsrs r1, r0, 16
cmp r0, 0
bgt _08108458
movs r1, 0x1
_08108458:
movs r0, 0
str r0, [sp, 0x4]
lsls r0, r1, 16
mov r10, r8
mov r9, r6
mov r1, r10
lsls r1, 4
str r1, [sp, 0xC]
mov r1, r9
lsls r1, 4
str r1, [sp, 0x10]
asrs r0, 16
mov r8, r0
_08108472:
ldr r0, =gUnknown_08595268
mov r1, r10
mov r2, r9
ldr r3, [sp, 0x8]
bl CreateSprite
lsls r0, 24
lsrs r2, r0, 24
lsls r6, r5, 16
cmp r2, 0x40
beq _081084DA
ldr r1, =gSprites
lsls r0, r2, 4
adds r0, r2
lsls r0, 2
adds r5, r0, r1
mov r0, sp
ldrh r0, [r0, 0x4]
strh r0, [r5, 0x30]
mov r1, sp
ldrh r1, [r1, 0xC]
strh r1, [r5, 0x32]
mov r0, sp
ldrh r0, [r0, 0x10]
strh r0, [r5, 0x34]
asrs r4, r6, 16
adds r0, r4, 0
movs r1, 0x40
bl Cos
strh r0, [r5, 0x36]
adds r0, r4, 0
movs r1, 0x40
bl Sin
strh r0, [r5, 0x38]
mov r1, sp
ldrh r1, [r1]
strh r1, [r5, 0x3A]
movs r0, 0x2
strh r0, [r5, 0x3C]
ldrh r1, [r7, 0xC]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _081084D4
adds r0, r5, 0
bl sub_810851C
_081084D4:
ldrh r0, [r7, 0xC]
adds r0, 0x1
strh r0, [r7, 0xC]
_081084DA:
mov r1, r8
lsls r0, r1, 1
asrs r1, r6, 16
adds r1, r0
lsls r1, 16
movs r0, 0xFF
lsls r0, 16
ands r0, r1
lsrs r5, r0, 16
ldr r1, [sp, 0x4]
lsls r0, r1, 16
asrs r0, 16
add r0, r8
lsls r0, 16
lsrs r1, r0, 16
str r1, [sp, 0x4]
asrs r0, 16
cmp r0, 0x13
ble _08108472
add sp, 0x14
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8108408
thumb_func_start sub_810851C
sub_810851C: @ 810851C
push {r4,lr}
adds r4, r0, 0
movs r1, 0x2E
ldrsh r0, [r4, r1]
cmp r0, 0
beq _0810852E
cmp r0, 0x1
beq _08108564
b _081085BE
_0810852E:
movs r2, 0x30
ldrsh r0, [r4, r2]
movs r1, 0x6
bl __modsi3
lsls r0, 16
asrs r0, 16
lsls r1, r0, 1
adds r1, r0
ldrh r0, [r4, 0x36]
adds r1, r0
strh r1, [r4, 0x36]
movs r1, 0x30
ldrsh r0, [r4, r1]
movs r1, 0x3
bl __modsi3
lsls r0, 16
asrs r0, 16
lsls r1, r0, 1
adds r1, r0
ldrh r2, [r4, 0x38]
adds r1, r2
strh r1, [r4, 0x38]
ldrh r0, [r4, 0x2E]
adds r0, 0x1
strh r0, [r4, 0x2E]
_08108564:
ldrh r0, [r4, 0x36]
ldrh r1, [r4, 0x32]
adds r0, r1
strh r0, [r4, 0x32]
ldrh r1, [r4, 0x38]
ldrh r2, [r4, 0x34]
adds r1, r2
strh r1, [r4, 0x34]
lsls r0, 16
asrs r0, 20
strh r0, [r4, 0x20]
lsls r1, 16
asrs r2, r1, 20
strh r2, [r4, 0x22]
adds r0, 0x8
lsls r0, 16
movs r1, 0x80
lsls r1, 17
cmp r0, r1
bhi _0810859A
adds r1, r2, 0
movs r0, 0x8
negs r0, r0
cmp r1, r0
blt _0810859A
cmp r1, 0x78
ble _081085BE
_0810859A:
ldr r3, =gTasks
movs r0, 0x3C
ldrsh r1, [r4, r0]
lsls r1, 1
movs r0, 0x3A
ldrsh r2, [r4, r0]
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
adds r1, r0
adds r3, 0x8
adds r1, r3
ldrh r0, [r1]
subs r0, 0x1
strh r0, [r1]
adds r0, r4, 0
bl DestroySprite
_081085BE:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_810851C
thumb_func_start sub_81085C8
sub_81085C8: @ 81085C8
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks
adds r4, r1, r0
bl sub_8108384
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0xA]
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _08108600
movs r0, 0x88
strh r0, [r4, 0x10]
movs r0, 0x28
b _08108606
.pool
_08108600:
movs r0, 0x10
strh r0, [r4, 0x10]
movs r0, 0x50
_08108606:
strh r0, [r4, 0x14]
movs r0, 0x62
strh r0, [r4, 0x12]
ldrh r0, [r4, 0x10]
adds r0, 0x31
strh r0, [r4, 0x16]
movs r0, 0xA
ldrsh r1, [r4, r0]
lsls r0, r1, 2
adds r0, r1
adds r0, 0x5
strh r0, [r4, 0x20]
ldr r0, =sub_810862C
str r0, [r4]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81085C8
thumb_func_start sub_810862C
sub_810862C: @ 810862C
push {r4-r7,lr}
mov r7, r8
push {r7}
lsls r0, 24
lsrs r1, r0, 24
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
ldr r7, =gTasks
adds r4, r0, r7
movs r0, 0x8
ldrsh r2, [r4, r0]
cmp r2, 0
beq _08108654
cmp r2, 0x1
beq _08108704
b _08108712
.pool
_08108654:
ldrh r0, [r4, 0xC]
adds r0, 0x1
strh r0, [r4, 0xC]
lsls r0, 16
asrs r0, 16
cmp r0, 0x2
ble _0810866A
strh r2, [r4, 0xC]
adds r0, r4, 0
bl sub_810871C
_0810866A:
movs r1, 0x1C
ldrsh r0, [r4, r1]
cmp r0, 0
beq _081086E4
movs r2, 0x22
ldrsh r0, [r4, r2]
cmp r0, 0
bne _081086E4
ldr r5, =gBattleAnimArgs
movs r1, 0x1
mov r8, r1
mov r2, r8
strh r2, [r5]
strh r0, [r5, 0x2]
movs r0, 0xC
strh r0, [r5, 0x4]
ldr r6, =sub_81152DC
adds r0, r6, 0
movs r1, 0x50
bl CreateTask
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0xFF
beq _081086B4
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
adds r0, r7
ldr r1, [r0]
adds r0, r2, 0
bl _call_via_r1
ldr r1, =gAnimVisualTaskCount
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
_081086B4:
movs r0, 0x3
strh r0, [r5]
adds r0, r6, 0
movs r1, 0x50
bl CreateTask
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0xFF
beq _081086E0
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
adds r0, r7
ldr r1, [r0]
adds r0, r2, 0
bl _call_via_r1
ldr r1, =gAnimVisualTaskCount
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
_081086E0:
mov r0, r8
strh r0, [r4, 0x22]
_081086E4:
movs r2, 0x1E
ldrsh r1, [r4, r2]
movs r2, 0x20
ldrsh r0, [r4, r2]
cmp r1, r0
blt _08108712
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
b _08108712
.pool
_08108704:
movs r2, 0x1A
ldrsh r0, [r4, r2]
cmp r0, 0
bne _08108712
adds r0, r1, 0
bl DestroyAnimVisualTask
_08108712:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_810862C
thumb_func_start sub_810871C
sub_810871C: @ 810871C
push {r4-r6,lr}
adds r4, r0, 0
lsls r1, 24
lsrs r6, r1, 24
ldr r1, =gSineTable
movs r2, 0x18
ldrsh r0, [r4, r2]
lsls r0, 1
adds r0, r1
movs r1, 0
ldrsh r0, [r0, r1]
adds r0, 0x3
asrs r0, 4
ldrh r2, [r4, 0x14]
adds r0, r2
lsls r0, 16
lsrs r5, r0, 16
ldr r0, =gUnknown_08595268
movs r2, 0x16
ldrsh r1, [r4, r2]
movs r2, 0
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x40
beq _08108776
ldr r3, =gSprites
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r1, r3, 0
adds r1, 0x1C
adds r1, r0, r1
ldr r2, =sub_81087C0
str r2, [r1]
adds r0, r3
strh r5, [r0, 0x38]
strh r6, [r0, 0x3A]
movs r1, 0x9
strh r1, [r0, 0x3C]
ldrh r0, [r4, 0x1A]
adds r0, 0x1
strh r0, [r4, 0x1A]
_08108776:
ldrh r0, [r4, 0x1E]
adds r0, 0x1
strh r0, [r4, 0x1E]
ldrh r0, [r4, 0x18]
adds r0, 0x27
movs r1, 0xFF
ands r0, r1
strh r0, [r4, 0x18]
movs r0, 0x16
ldrsh r1, [r4, r0]
ldr r0, =0x41c64e6d
muls r0, r1
ldr r1, =0x00003039
adds r0, r1
movs r2, 0x12
ldrsh r1, [r4, r2]
bl __modsi3
ldrh r1, [r4, 0x10]
adds r1, r0
strh r1, [r4, 0x16]
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_810871C
thumb_func_start sub_81087C0
sub_81087C0: @ 81087C0
push {r4,r5,lr}
adds r5, r0, 0
movs r1, 0x2E
ldrsh r0, [r5, r1]
cmp r0, 0
bne _08108856
ldrh r0, [r5, 0x22]
adds r0, 0x8
strh r0, [r5, 0x22]
lsls r0, 16
asrs r0, 16
movs r2, 0x38
ldrsh r1, [r5, r2]
cmp r0, r1
blt _08108856
ldr r2, =gTasks
movs r3, 0x3A
ldrsh r1, [r5, r3]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
movs r1, 0x1
strh r1, [r0, 0x1C]
ldr r0, =gUnknown_08597388
movs r2, 0x20
ldrsh r1, [r5, r2]
movs r3, 0x22
ldrsh r2, [r5, r3]
movs r3, 0x1
bl CreateSprite
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x30]
cmp r0, 0x40
beq _08108850
movs r0, 0x30
ldrsh r1, [r5, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r4, =gSprites
adds r0, r4
movs r1, 0x3
bl StartSpriteAffineAnim
movs r2, 0x30
ldrsh r1, [r5, r2]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r4
ldrh r1, [r5, 0x3A]
strh r1, [r0, 0x3A]
movs r3, 0x30
ldrsh r1, [r5, r3]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r4
ldrh r1, [r5, 0x3C]
strh r1, [r0, 0x3C]
movs r0, 0x30
ldrsh r1, [r5, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r4, 0x1C
adds r0, r4
ldr r1, =sub_810886C
str r1, [r0]
_08108850:
adds r0, r5, 0
bl DestroySprite
_08108856:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81087C0
thumb_func_start sub_810886C
sub_810886C: @ 810886C
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x30]
adds r0, 0x1
strh r0, [r4, 0x30]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
ble _081088D8
movs r0, 0
strh r0, [r4, 0x30]
adds r3, r4, 0
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]
ldrh r0, [r4, 0x32]
adds r0, 0x1
strh r0, [r4, 0x32]
lsls r0, 16
asrs r0, 16
cmp r0, 0xC
bne _081088D8
ldr r3, =gTasks
movs r0, 0x3C
ldrsh r1, [r4, r0]
lsls r1, 1
movs r0, 0x3A
ldrsh r2, [r4, r0]
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
adds r1, r0
adds r3, 0x8
adds r1, r3
ldrh r0, [r1]
subs r0, 0x1
strh r0, [r1]
ldrb r0, [r4, 0x3]
lsls r0, 26
lsrs r0, 27
bl FreeOamMatrix
adds r0, r4, 0
bl DestroySprite
_081088D8:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_810886C
thumb_func_start sub_81088E4
sub_81088E4: @ 81088E4
push {r4-r6,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks
adds r5, r1, r0
ldr r4, =gBattleAnimAttacker
ldrb r0, [r4]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
movs r6, 0
strh r0, [r5, 0xE]
ldrb r0, [r4]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x10]
ldrb r0, [r4]
bl GetBattlerSide
lsls r0, 24
movs r2, 0x1
negs r2, r2
adds r1, r2, 0
cmp r0, 0
bne _08108928
movs r1, 0x1
_08108928:
strh r1, [r5, 0x16]
bl IsContest
lsls r0, 24
cmp r0, 0
beq _0810893C
movs r1, 0x16
ldrsh r0, [r5, r1]
negs r0, r0
strh r0, [r5, 0x16]
_0810893C:
movs r2, 0x16
ldrsh r0, [r5, r2]
lsls r0, 3
ldrh r1, [r5, 0xE]
adds r0, r1
strh r0, [r5, 0x12]
movs r2, 0x16
ldrsh r1, [r5, r2]
lsls r1, 3
ldrh r0, [r5, 0x10]
subs r0, r1
strh r0, [r5, 0x14]
ldr r0, =0x0000ffe0
strh r0, [r5, 0x1A]
strh r6, [r5, 0xA]
strh r6, [r5, 0x8]
ldr r0, =sub_8108978
str r0, [r5]
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_81088E4
thumb_func_start sub_8108978
sub_8108978: @ 8108978
push {r4,lr}
lsls r0, 24
lsrs r2, r0, 24
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
ldr r1, =gTasks
adds r4, r0, r1
movs r1, 0x8
ldrsh r0, [r4, r1]
cmp r0, 0x6
bls _08108992
b _08108AB2
_08108992:
lsls r0, 2
ldr r1, =_081089A4
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081089A4:
.4byte _081089C0
.4byte _081089D0
.4byte _081089EA
.4byte _08108A2C
.4byte _08108A4E
.4byte _08108A7C
.4byte _08108AA2
_081089C0:
adds r0, r4, 0
bl sub_8108AC0
movs r1, 0x1C
ldrsh r0, [r4, r1]
cmp r0, 0
beq _08108AB8
b _08108AAA
_081089D0:
adds r0, r4, 0
bl sub_8108AC0
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
lsls r0, 16
asrs r0, 16
cmp r0, 0x10
ble _08108AB8
movs r0, 0
strh r0, [r4, 0xA]
b _08108AAA
_081089EA:
adds r0, r4, 0
bl sub_8108AC0
movs r1, 0x16
ldrsh r0, [r4, r1]
lsls r1, r0, 1
adds r1, r0
lsls r1, 1
ldrh r0, [r4, 0x12]
adds r1, r0
movs r2, 0
strh r1, [r4, 0x12]
adds r1, 0x10
lsls r1, 16
movs r0, 0x88
lsls r0, 17
cmp r1, r0
bls _08108AB8
ldrh r0, [r4, 0x20]
adds r0, 0x1
strh r0, [r4, 0x20]
lsls r0, 16
asrs r0, 16
cmp r0, 0x2
ble _08108A28
movs r0, 0x1
strh r0, [r4, 0x22]
movs r0, 0x6
strh r0, [r4, 0x8]
strh r2, [r4, 0xA]
b _08108AB8
_08108A28:
strh r2, [r4, 0xA]
b _08108AAA
_08108A2C:
adds r0, r4, 0
bl sub_8108AC0
movs r0, 0x16
ldrsh r1, [r4, r0]
lsls r1, 1
ldrh r0, [r4, 0x14]
subs r0, r1
strh r0, [r4, 0x14]
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
lsls r0, 16
asrs r0, 16
cmp r0, 0x7
ble _08108AB8
b _08108AAA
_08108A4E:
adds r0, r4, 0
bl sub_8108AC0
movs r1, 0x16
ldrsh r0, [r4, r1]
lsls r1, r0, 1
adds r1, r0
lsls r1, 1
ldrh r0, [r4, 0x12]
subs r0, r1
strh r0, [r4, 0x12]
adds r0, 0x10
lsls r0, 16
movs r1, 0x88
lsls r1, 17
cmp r0, r1
bls _08108AB8
ldrh r0, [r4, 0x20]
adds r0, 0x1
strh r0, [r4, 0x20]
movs r0, 0
strh r0, [r4, 0xA]
b _08108AAA
_08108A7C:
adds r0, r4, 0
bl sub_8108AC0
movs r0, 0x16
ldrsh r1, [r4, r0]
lsls r1, 1
ldrh r0, [r4, 0x14]
subs r0, r1
strh r0, [r4, 0x14]
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
lsls r0, 16
asrs r0, 16
cmp r0, 0x7
ble _08108AB8
movs r0, 0x2
strh r0, [r4, 0x8]
b _08108AB8
_08108AA2:
movs r1, 0x18
ldrsh r0, [r4, r1]
cmp r0, 0
bne _08108AB8
_08108AAA:
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
b _08108AB8
_08108AB2:
adds r0, r2, 0
bl DestroyAnimVisualTask
_08108AB8:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8108978
thumb_func_start sub_8108AC0
sub_8108AC0: @ 8108AC0
push {r4-r6,lr}
adds r6, r0, 0
ldrh r0, [r6, 0xC]
adds r0, 0x1
strh r0, [r6, 0xC]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
ble _08108B1A
movs r0, 0
strh r0, [r6, 0xC]
ldr r0, =gUnknown_08595268
movs r2, 0xE
ldrsh r1, [r6, r2]
movs r3, 0x10
ldrsh r2, [r6, r3]
movs r3, 0xA
bl CreateSprite
lsls r0, 24
lsrs r0, 24
cmp r0, 0x40
beq _08108B1A
ldr r5, =gSprites
lsls r4, r0, 4
adds r4, r0
lsls r4, 2
adds r0, r4, r5
movs r1, 0x10
strh r1, [r0, 0x2E]
ldrh r1, [r6, 0x12]
strh r1, [r0, 0x32]
ldrh r1, [r6, 0x14]
strh r1, [r0, 0x36]
ldrh r1, [r6, 0x1A]
strh r1, [r0, 0x38]
bl sub_80A68D4
adds r5, 0x1C
adds r4, r5
ldr r0, =sub_8108B2C
str r0, [r4]
ldrh r0, [r6, 0x18]
adds r0, 0x1
strh r0, [r6, 0x18]
_08108B1A:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8108AC0
thumb_func_start sub_8108B2C
sub_8108B2C: @ 8108B2C
push {r4-r6,lr}
adds r6, r0, 0
bl TranslateAnimArc
lsls r0, 24
cmp r0, 0
beq _08108B86
ldrh r0, [r6, 0x24]
ldrh r1, [r6, 0x20]
adds r0, r1
strh r0, [r6, 0x20]
ldrh r0, [r6, 0x26]
ldrh r1, [r6, 0x22]
adds r0, r1
strh r0, [r6, 0x22]
movs r0, 0x6
strh r0, [r6, 0x2E]
bl Random2
movs r4, 0x1F
adds r1, r4, 0
ands r1, r0
ldr r5, =0x0000fff0
adds r1, r5
ldrh r0, [r6, 0x20]
adds r1, r0
strh r1, [r6, 0x32]
bl Random2
ands r4, r0
adds r4, r5
ldrh r1, [r6, 0x22]
adds r4, r1
strh r4, [r6, 0x36]
bl Random2
movs r1, 0x7
ands r1, r0
mvns r1, r1
strh r1, [r6, 0x38]
adds r0, r6, 0
bl sub_80A68D4
ldr r0, =sub_8108B94
str r0, [r6, 0x1C]
_08108B86:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8108B2C
thumb_func_start sub_8108B94
sub_8108B94: @ 8108B94
push {r4-r6,lr}
adds r5, r0, 0
bl TranslateAnimArc
lsls r0, 24
cmp r0, 0
beq _08108BD0
movs r4, 0
ldr r6, =gTasks
_08108BA6:
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r2, r0, r6
ldr r1, [r2]
ldr r0, =sub_8108978
cmp r1, r0
bne _08108BC6
movs r0, 0x1
strh r0, [r2, 0x1C]
ldrh r0, [r2, 0x18]
subs r0, 0x1
strh r0, [r2, 0x18]
adds r0, r5, 0
bl DestroySprite
_08108BC6:
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0xF
bls _08108BA6
_08108BD0:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8108B94
thumb_func_start sub_8108BE0
sub_8108BE0: @ 8108BE0
ldr r2, =gBattleAnimArgs
ldrh r1, [r2]
strh r1, [r0, 0x20]
ldrh r1, [r2, 0x2]
strh r1, [r0, 0x22]
ldrh r1, [r2, 0x4]
strh r1, [r0, 0x2E]
ldrh r1, [r2, 0x6]
strh r1, [r0, 0x30]
ldrh r1, [r2, 0x8]
strh r1, [r0, 0x32]
ldrh r1, [r2, 0xA]
strh r1, [r0, 0x34]
ldr r1, =sub_8108C08
str r1, [r0, 0x1C]
bx lr
.pool
thumb_func_end sub_8108BE0
thumb_func_start sub_8108C08
sub_8108C08: @ 8108C08
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x36]
ldrh r1, [r4, 0x2E]
subs r0, r1
strh r0, [r4, 0x36]
movs r1, 0x36
ldrsh r0, [r4, r1]
movs r1, 0xA
bl __divsi3
strh r0, [r4, 0x26]
ldrh r0, [r4, 0x30]
ldrh r2, [r4, 0x38]
adds r0, r2
movs r1, 0xFF
ands r0, r1
strh r0, [r4, 0x38]
movs r1, 0x38
ldrsh r0, [r4, r1]
movs r2, 0x32
ldrsh r1, [r4, r2]
bl Sin
strh r0, [r4, 0x24]
ldrh r0, [r4, 0x34]
subs r0, 0x1
strh r0, [r4, 0x34]
lsls r0, 16
cmp r0, 0
bne _08108C4C
adds r0, r4, 0
bl DestroyAnimSprite
_08108C4C:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8108C08
thumb_func_start sub_8108C54
sub_8108C54: @ 8108C54
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x30]
ldrh r1, [r4, 0x34]
adds r0, r1
strh r0, [r4, 0x34]
ldrh r1, [r4, 0x32]
ldrh r2, [r4, 0x36]
adds r1, r2
strh r1, [r4, 0x36]
lsls r0, 16
asrs r0, 23
strh r0, [r4, 0x24]
lsls r1, 16
asrs r1, 23
strh r1, [r4, 0x26]
ldrh r0, [r4, 0x2E]
subs r0, 0x1
strh r0, [r4, 0x2E]
lsls r0, 16
cmp r0, 0
bne _08108C8C
adds r0, r4, 0
bl FreeSpriteOamMatrix
adds r0, r4, 0
bl DestroySprite
_08108C8C:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8108C54
thumb_func_start sub_8108C94
sub_8108C94: @ 8108C94
push {r4,r5,lr}
adds r4, r0, 0
movs r1, 0x1
bl sub_80A69CC
ldr r5, =gBattleAnimTarget
ldrb r0, [r5]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x30]
ldrb r0, [r5]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x32]
ldr r1, =gBattleAnimArgs
ldrh r0, [r1, 0x4]
strh r0, [r4, 0x34]
ldrh r0, [r1, 0x6]
strh r0, [r4, 0x36]
ldr r0, =sub_8108CDC
str r0, [r4, 0x1C]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8108C94
thumb_func_start sub_8108CDC
sub_8108CDC: @ 8108CDC
push {r4-r6,lr}
adds r4, r0, 0
movs r0, 0x30
ldrsh r1, [r4, r0]
movs r2, 0x20
ldrsh r0, [r4, r2]
subs r6, r1, r0
movs r0, 0x32
ldrsh r1, [r4, r0]
movs r2, 0x22
ldrsh r0, [r4, r2]
subs r5, r1, r0
movs r1, 0x2E
ldrsh r0, [r4, r1]
muls r0, r6
movs r2, 0x34
ldrsh r1, [r4, r2]
bl __divsi3
strh r0, [r4, 0x24]
movs r1, 0x2E
ldrsh r0, [r4, r1]
muls r0, r5
movs r2, 0x34
ldrsh r1, [r4, r2]
bl __divsi3
strh r0, [r4, 0x26]
ldrh r0, [r4, 0x38]
adds r0, 0x1
strh r0, [r4, 0x38]
lsls r0, 16
asrs r0, 16
movs r2, 0x36
ldrsh r1, [r4, r2]
cmp r0, r1
bne _08108D34
movs r0, 0
strh r0, [r4, 0x38]
adds r0, r4, 0
adds r1, r6, 0
adds r2, r5, 0
bl sub_8108D54
_08108D34:
movs r0, 0x34
ldrsh r1, [r4, r0]
movs r2, 0x2E
ldrsh r0, [r4, r2]
cmp r1, r0
bne _08108D46
adds r0, r4, 0
bl DestroyAnimSprite
_08108D46:
ldrh r0, [r4, 0x2E]
adds r0, 0x1
strh r0, [r4, 0x2E]
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_8108CDC
thumb_func_start sub_8108D54
sub_8108D54: @ 8108D54
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x18
adds r4, r1, 0
adds r5, r2, 0
movs r2, 0x2E
ldrsh r1, [r0, r2]
lsrs r2, r1, 31
adds r1, r2
lsls r1, 15
lsrs r1, 16
str r1, [sp]
ldrh r1, [r0, 0x24]
ldrh r3, [r0, 0x20]
adds r1, r3
lsls r1, 16
lsrs r1, 16
mov r8, r1
ldrh r1, [r0, 0x26]
ldrh r0, [r0, 0x22]
adds r1, r0
lsls r1, 16
lsrs r1, 16
mov r10, r1
bl Random2
lsls r0, 16
lsrs r0, 16
movs r1, 0xA
bl __umodsi3
adds r0, r5, r0
subs r0, 0x5
lsls r0, 16
lsrs r0, 16
mov r9, r0
bl Random2
negs r4, r4
lsls r0, 16
lsrs r0, 16
movs r1, 0xA
bl __umodsi3
adds r4, r0
subs r4, 0x5
lsls r4, 16
lsrs r7, r4, 16
movs r6, 0
mov r0, r8
lsls r0, 16
mov r8, r0
mov r1, r10
lsls r1, 16
str r1, [sp, 0xC]
ldr r2, [sp]
lsls r2, 16
str r2, [sp, 0x10]
asrs r1, 16
lsls r0, r7, 16
asrs r5, r0, 16
str r0, [sp, 0x14]
negs r3, r5
str r3, [sp, 0x4]
asrs r0, r2, 16
adds r1, r0
lsls r1, 16
mov r10, r1
_08108DE2:
ldr r0, =gUnknown_08595310
mov r2, r8
asrs r1, r2, 16
mov r3, r10
asrs r2, r3, 16
movs r3, 0x82
bl CreateSprite
lsls r0, 24
lsrs r2, r0, 24
ldr r1, =gSprites
lsls r0, r2, 4
adds r0, r2
lsls r0, 2
adds r4, r0, r1
movs r0, 0x14
strh r0, [r4, 0x2E]
mov r0, r9
strh r0, [r4, 0x30]
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl sub_80A82E4
subs r0, 0x1
adds r1, r4, 0
adds r1, 0x43
strb r0, [r1]
cmp r5, 0
bge _08108E30
mov r1, sp
ldrh r1, [r1, 0x4]
strh r1, [r4, 0x32]
b _08108E32
.pool
_08108E30:
strh r7, [r4, 0x32]
_08108E32:
lsls r0, r6, 16
movs r2, 0x80
lsls r2, 9
adds r0, r2
lsrs r6, r0, 16
cmp r0, 0
ble _08108DE2
movs r6, 0
ldr r3, [sp, 0xC]
asrs r1, r3, 16
ldr r0, [sp, 0x14]
asrs r5, r0, 16
negs r2, r5
str r2, [sp, 0x8]
ldr r3, [sp, 0x10]
asrs r0, r3, 16
subs r1, r0
lsls r1, 16
mov r10, r1
_08108E58:
ldr r0, =gUnknown_08595310
mov r2, r8
asrs r1, r2, 16
mov r3, r10
asrs r2, r3, 16
movs r3, 0x82
bl CreateSprite
lsls r0, 24
lsrs r2, r0, 24
ldr r1, =gSprites
lsls r0, r2, 4
adds r0, r2
lsls r0, 2
adds r4, r0, r1
movs r0, 0x14
strh r0, [r4, 0x2E]
mov r0, r9
strh r0, [r4, 0x30]
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl sub_80A82E4
subs r0, 0x1
adds r1, r4, 0
adds r1, 0x43
strb r0, [r1]
cmp r5, 0
ble _08108EA8
mov r1, sp
ldrh r1, [r1, 0x8]
strh r1, [r4, 0x32]
b _08108EAA
.pool
_08108EA8:
strh r7, [r4, 0x32]
_08108EAA:
lsls r0, r6, 16
movs r2, 0x80
lsls r2, 9
adds r0, r2
lsrs r6, r0, 16
cmp r0, 0
ble _08108E58
add sp, 0x18
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8108D54
.align 2, 0