pokeemerald/asm/bug.s

792 lines
13 KiB
ArmAsm
Raw Normal View History

2018-10-23 04:08:38 +02:00
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_8110368
sub_8110368: @ 8110368
push {r4-r6,lr}
adds r6, r0, 0
bl IsContest
lsls r0, 24
cmp r0, 0
beq _08110394
adds r0, r6, 0
movs r1, 0x2
bl StartSpriteAffineAnim
ldr r0, =gBattleAnimArgs
ldrh r1, [r0, 0x4]
negs r1, r1
strh r1, [r0, 0x4]
ldrh r1, [r0]
negs r1, r1
strh r1, [r0]
b _081103C4
.pool
_08110394:
ldr r0, =gBattleAnimTarget
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _081103C4
adds r0, r6, 0
movs r1, 0x1
bl StartSpriteAffineAnim
ldr r1, =gBattleAnimArgs
ldrh r0, [r1, 0x2]
negs r0, r0
strh r0, [r1, 0x2]
ldrh r0, [r1, 0x4]
negs r0, r0
strh r0, [r1, 0x4]
ldrh r0, [r1, 0x6]
negs r0, r0
strh r0, [r1, 0x6]
ldrh r0, [r1]
negs r0, r0
strh r0, [r1]
_081103C4:
ldr r5, =gBattleAnimTarget
ldrb r0, [r5]
movs r1, 0x2
bl GetBattlerSpriteCoord2
lsls r0, 24
ldr r4, =gBattleAnimArgs
lsrs r0, 24
ldrh r1, [r4]
adds r0, r1
strh r0, [r6, 0x20]
ldrb r0, [r5]
movs r1, 0x3
bl GetBattlerSpriteCoord2
lsls r0, 24
lsrs r0, 24
ldrh r1, [r4, 0x2]
adds r0, r1
strh r0, [r6, 0x22]
ldrh r0, [r4, 0x8]
strh r0, [r6, 0x2E]
ldrb r0, [r5]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldrh r1, [r4, 0x4]
adds r0, r1
strh r0, [r6, 0x32]
ldrb r0, [r5]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldrh r4, [r4, 0x6]
adds r0, r4
strh r0, [r6, 0x36]
ldr r0, =sub_80A6EEC
str r0, [r6, 0x1C]
ldr r1, =DestroyAnimSprite
adds r0, r6, 0
bl StoreSpriteCallbackInData6
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8110368
thumb_func_start sub_8110438
sub_8110438: @ 8110438
push {r4-r6,lr}
adds r6, r0, 0
bl IsContest
lsls r0, 24
cmp r0, 0
beq _0811045C
ldr r1, =gBattleAnimArgs
ldrh r0, [r1]
negs r0, r0
strh r0, [r1]
adds r0, r6, 0
movs r1, 0x2
bl StartSpriteAffineAnim
b _08110478
.pool
_0811045C:
ldr r0, =gBattleAnimTarget
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _08110478
ldr r0, =gBattleAnimArgs
ldrh r1, [r0, 0x2]
negs r1, r1
strh r1, [r0, 0x2]
ldrh r1, [r0]
negs r1, r1
strh r1, [r0]
_08110478:
ldr r5, =gBattleAnimTarget
ldrb r0, [r5]
movs r1, 0x2
bl GetBattlerSpriteCoord2
lsls r0, 24
ldr r4, =gBattleAnimArgs
lsrs r0, 24
ldrh r1, [r4]
adds r0, r1
strh r0, [r6, 0x20]
ldrb r0, [r5]
movs r1, 0x3
bl GetBattlerSpriteCoord2
lsls r0, 24
lsrs r0, 24
ldrh r1, [r4, 0x2]
adds r0, r1
strh r0, [r6, 0x22]
ldrh r0, [r4, 0x4]
strh r0, [r6, 0x2E]
ldrb r0, [r5]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x32]
ldrb r0, [r5]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x36]
ldr r0, =sub_80A6EEC
str r0, [r6, 0x1C]
ldr r1, =DestroyAnimSprite
adds r0, r6, 0
bl StoreSpriteCallbackInData6
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8110438
thumb_func_start sub_81104E4
sub_81104E4: @ 81104E4
push {r4,r5,lr}
adds r5, r0, 0
bl IsContest
lsls r0, 24
cmp r0, 0
beq _08110500
ldr r0, =gBattleAnimArgs
movs r2, 0x4
ldrsh r1, [r0, r2]
lsrs r2, r1, 31
adds r1, r2
asrs r1, 1
strh r1, [r0, 0x4]
_08110500:
adds r0, r5, 0
movs r1, 0x1
bl sub_80A69CC
ldr r1, =gBattleAnimArgs
ldrh r0, [r1, 0x4]
strh r0, [r5, 0x2E]
ldrh r0, [r5, 0x20]
strh r0, [r5, 0x30]
ldrh r0, [r5, 0x22]
strh r0, [r5, 0x34]
movs r2, 0x8
ldrsh r0, [r1, r2]
cmp r0, 0
bne _08110548
ldr r4, =gBattleAnimTarget
ldrb r0, [r4]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x32]
ldrb r0, [r4]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x36]
b _0811055A
.pool
_08110548:
ldr r0, =gBattleAnimTarget
ldrb r0, [r0]
adds r2, r5, 0
adds r2, 0x32
adds r3, r5, 0
adds r3, 0x36
movs r1, 0x1
bl SetAverageBattlerPositions
_0811055A:
adds r0, r5, 0
bl sub_80A6FD4
ldr r0, =gBattleAnimArgs
ldrh r0, [r0, 0x6]
strh r0, [r5, 0x38]
ldr r0, =sub_811057C
str r0, [r5, 0x1C]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81104E4
thumb_func_start sub_811057C
sub_811057C: @ 811057C
push {r4,lr}
adds r4, r0, 0
bl TranslateAnimLinear
lsls r0, 24
cmp r0, 0
beq _08110592
adds r0, r4, 0
bl DestroyAnimSprite
b _081105AE
_08110592:
movs r1, 0x3A
ldrsh r0, [r4, r1]
movs r2, 0x38
ldrsh r1, [r4, r2]
bl Sin
ldrh r1, [r4, 0x24]
adds r0, r1
strh r0, [r4, 0x24]
ldrh r0, [r4, 0x3A]
adds r0, 0xD
movs r1, 0xFF
ands r0, r1
strh r0, [r4, 0x3A]
_081105AE:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_811057C
thumb_func_start sub_81105B4
sub_81105B4: @ 81105B4
push {r4,lr}
adds r4, r0, 0
ldr r0, =gBattleAnimTarget
ldrb r0, [r0]
adds r2, r4, 0
adds r2, 0x20
adds r3, r4, 0
adds r3, 0x22
movs r1, 0
bl SetAverageBattlerPositions
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _081105F0
ldr r0, =gBattleAnimArgs
ldrh r1, [r4, 0x20]
ldrh r2, [r0]
subs r1, r2
strh r1, [r4, 0x20]
b _081105FC
.pool
_081105F0:
ldr r1, =gBattleAnimArgs
ldrh r0, [r1]
ldrh r2, [r4, 0x20]
adds r0, r2
strh r0, [r4, 0x20]
adds r0, r1, 0
_081105FC:
ldrh r0, [r0, 0x2]
ldrh r1, [r4, 0x22]
adds r0, r1
strh r0, [r4, 0x22]
ldr r0, =gBattleAnimTarget
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _08110618
ldrh r0, [r4, 0x22]
adds r0, 0x8
strh r0, [r4, 0x22]
_08110618:
ldr r0, =sub_8110630
str r0, [r4, 0x1C]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81105B4
thumb_func_start sub_8110630
sub_8110630: @ 8110630
push {lr}
adds r3, r0, 0
ldrh r0, [r3, 0x2E]
adds r0, 0x1
strh r0, [r3, 0x2E]
lsls r0, 16
asrs r0, 16
cmp r0, 0x3
bne _08110664
movs r0, 0
strh r0, [r3, 0x2E]
movs r0, 0x3E
adds r0, r3
mov r12, r0
ldrb r2, [r0]
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
mov r1, r12
strb r0, [r1]
_08110664:
ldrh r0, [r3, 0x30]
adds r0, 0x1
strh r0, [r3, 0x30]
lsls r0, 16
asrs r0, 16
cmp r0, 0x33
bne _08110678
adds r0, r3, 0
bl DestroyAnimSprite
_08110678:
pop {r0}
bx r0
thumb_func_end sub_8110630
thumb_func_start sub_811067C
sub_811067C: @ 811067C
push {r4,lr}
adds r4, r0, 0
movs r1, 0xFD
lsls r1, 6
movs r0, 0x50
bl SetGpuReg
movs r0, 0x52
movs r1, 0x10
bl SetGpuReg
movs r0, 0x10
strh r0, [r4, 0x2E]
ldr r0, =sub_81106A4
str r0, [r4, 0x1C]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_811067C
thumb_func_start sub_81106A4
sub_81106A4: @ 81106A4
push {r4,lr}
adds r4, r0, 0
ldrh r1, [r4, 0x32]
movs r2, 0x32
ldrsh r0, [r4, r2]
cmp r0, 0x13
bgt _081106B8
adds r0, r1, 0x1
strh r0, [r4, 0x32]
b _081106F6
_081106B8:
ldrh r1, [r4, 0x30]
adds r0, r1, 0x1
strh r0, [r4, 0x30]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _081106F6
ldrh r1, [r4, 0x2E]
subs r1, 0x1
strh r1, [r4, 0x2E]
movs r0, 0x10
subs r0, r1
lsls r0, 8
orrs r1, r0
lsls r1, 16
lsrs r1, 16
movs r0, 0x52
bl SetGpuReg
movs r1, 0x2E
ldrsh r0, [r4, r1]
cmp r0, 0
bne _081106F6
adds r2, r4, 0
adds r2, 0x3E
ldrb r0, [r2]
movs r1, 0x4
orrs r0, r1
strb r0, [r2]
ldr r0, =sub_8110700
str r0, [r4, 0x1C]
_081106F6:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81106A4
thumb_func_start sub_8110700
sub_8110700: @ 8110700
push {r4,lr}
adds r4, r0, 0
movs r0, 0x50
movs r1, 0
bl SetGpuReg
movs r0, 0x52
movs r1, 0
bl SetGpuReg
adds r0, r4, 0
bl DestroyAnimSprite
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8110700
thumb_func_start sub_8110720
sub_8110720: @ 8110720
push {r4-r7,lr}
sub sp, 0x4
adds r7, r0, 0
bl IsContest
lsls r0, 24
cmp r0, 0
beq _08110740
ldr r1, =gBattleAnimArgs
ldrh r0, [r1, 0x4]
negs r0, r0
strh r0, [r1, 0x4]
b _08110762
.pool
_08110740:
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _08110762
ldr r1, =gBattleAnimArgs
ldrh r0, [r1, 0x4]
negs r0, r0
strh r0, [r1, 0x4]
ldrh r0, [r1, 0x2]
negs r0, r0
strh r0, [r1, 0x2]
ldrh r0, [r1, 0x6]
negs r0, r0
strh r0, [r1, 0x6]
_08110762:
bl IsContest
lsls r0, 24
cmp r0, 0
bne _081107B2
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
adds r4, r0, 0
ldr r5, =gBattleAnimTarget
ldrb r0, [r5]
bl GetBattlerSide
lsls r4, 24
lsls r0, 24
cmp r4, r0
bne _081107B2
ldrb r0, [r5]
bl GetBattlerPosition
lsls r0, 24
cmp r0, 0
beq _081107A0
ldrb r0, [r5]
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _081107B2
_081107A0:
ldr r0, =gBattleAnimArgs
movs r2, 0x4
ldrsh r1, [r0, r2]
negs r1, r1
strh r1, [r0, 0x4]
movs r2, 0
ldrsh r1, [r0, r2]
negs r1, r1
strh r1, [r0]
_081107B2:
adds r0, r7, 0
movs r1, 0x1
bl sub_80A69CC
ldr r5, =gBattleAnimTarget
ldrb r0, [r5]
movs r1, 0x2
bl GetBattlerSpriteCoord
adds r4, r0, 0
lsls r4, 24
ldr r6, =gBattleAnimArgs
lsrs r4, 24
ldrh r0, [r6, 0x4]
adds r4, r0
lsls r4, 16
lsrs r4, 16
ldrb r0, [r5]
movs r1, 0x3
bl GetBattlerSpriteCoord
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
ldrh r2, [r6, 0x6]
adds r1, r2
lsls r1, 16
ldrh r2, [r7, 0x20]
lsls r0, r4, 16
asrs r0, 16
subs r0, r2
lsls r0, 16
asrs r0, 16
ldrh r2, [r7, 0x22]
lsrs r5, r1, 16
asrs r1, 16
subs r1, r2
lsls r1, 16
asrs r1, 16
bl ArcTan2Neg
lsls r0, 16
movs r1, 0xC0
lsls r1, 24
adds r0, r1
lsrs r0, 16
movs r3, 0x80
lsls r3, 1
str r0, [sp]
adds r0, r7, 0
movs r1, 0
adds r2, r3, 0
bl sub_80A73E0
ldrh r0, [r6, 0x8]
strh r0, [r7, 0x2E]
strh r4, [r7, 0x32]
strh r5, [r7, 0x36]
ldr r0, =sub_80A6EEC
str r0, [r7, 0x1C]
ldr r1, =DestroyAnimSprite
adds r0, r7, 0
bl StoreSpriteCallbackInData6
add sp, 0x4
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8110720
thumb_func_start sub_8110850
sub_8110850: @ 8110850
push {r4-r6,lr}
adds r6, r0, 0
movs r1, 0x1
bl sub_80A69CC
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _08110870
ldr r1, =gBattleAnimArgs
ldrh r0, [r1, 0x4]
negs r0, r0
strh r0, [r1, 0x4]
_08110870:
ldr r4, =gBattleAnimArgs
ldrh r0, [r4, 0x8]
strh r0, [r6, 0x2E]
ldr r5, =gBattleAnimTarget
ldrb r0, [r5]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldrh r1, [r4, 0x4]
adds r0, r1
strh r0, [r6, 0x32]
ldrb r0, [r5]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldrh r1, [r4, 0x6]
adds r0, r1
strh r0, [r6, 0x36]
ldrh r0, [r4, 0xA]
strh r0, [r6, 0x38]
adds r0, r6, 0
bl sub_80A68D4
ldr r0, =sub_81108CC
str r0, [r6, 0x1C]
adds r2, r6, 0
adds r2, 0x3E
ldrb r0, [r2]
movs r1, 0x4
orrs r0, r1
strb r0, [r2]
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8110850
thumb_func_start sub_81108CC
sub_81108CC: @ 81108CC
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x14
adds r4, r0, 0
adds r2, r4, 0
adds r2, 0x3E
ldrb r0, [r2]
movs r1, 0x5
negs r1, r1
ands r1, r0
strb r1, [r2]
adds r0, r4, 0
bl TranslateAnimArc
lsls r0, 24
cmp r0, 0
beq _081108F8
adds r0, r4, 0
bl DestroyAnimSprite
b _08110988
_081108F8:
movs r0, 0x2E
adds r0, r4
mov r8, r0
ldrh r7, [r4, 0x20]
ldrh r5, [r4, 0x24]
ldrh r1, [r4, 0x22]
mov r12, r1
ldrh r6, [r4, 0x26]
mov r2, r8
add r1, sp, 0x4
movs r3, 0x7
_0811090E:
ldrh r0, [r2]
strh r0, [r1]
adds r2, 0x2
adds r1, 0x2
subs r3, 0x1
cmp r3, 0
bge _0811090E
adds r0, r7, r5
lsls r0, 16
lsrs r5, r0, 16
mov r2, r12
adds r0, r2, r6
lsls r0, 16
lsrs r6, r0, 16
adds r0, r4, 0
bl TranslateAnimArc
lsls r0, 24
cmp r0, 0
bne _08110988
ldrh r0, [r4, 0x24]
ldrh r1, [r4, 0x20]
adds r0, r1
lsls r1, r5, 16
asrs r1, 16
subs r0, r1
lsls r0, 16
asrs r0, 16
ldrh r1, [r4, 0x26]
ldrh r2, [r4, 0x22]
adds r1, r2
lsls r2, r6, 16
asrs r2, 16
subs r1, r2
lsls r1, 16
asrs r1, 16
bl ArcTan2Neg
lsls r0, 16
movs r1, 0xC0
lsls r1, 24
adds r0, r1
lsrs r0, 16
movs r3, 0x80
lsls r3, 1
str r0, [sp]
adds r0, r4, 0
movs r1, 0
adds r2, r3, 0
bl sub_80A73E0
add r2, sp, 0x4
mov r1, r8
movs r3, 0x7
_0811097A:
ldrh r0, [r2]
strh r0, [r1]
adds r2, 0x2
adds r1, 0x2
subs r3, 0x1
cmp r3, 0
bge _0811097A
_08110988:
add sp, 0x14
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_81108CC
thumb_func_start sub_8110994
sub_8110994: @ 8110994
push {r4,r5,lr}
adds r5, r0, 0
ldr r0, =gBattleAnimArgs
movs r1, 0
ldrsh r0, [r0, r1]
cmp r0, 0
bne _081109B0
ldr r4, =gBattleAnimAttacker
b _081109B2
.pool
_081109B0:
ldr r4, =gBattleAnimTarget
_081109B2:
ldrb r0, [r4]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x20]
ldrb r0, [r4]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
adds r0, 0x12
strh r0, [r5, 0x22]
ldr r1, =move_anim_8074EE0
adds r0, r5, 0
bl StoreSpriteCallbackInData6
ldr r0, =sub_80A67BC
str r0, [r5, 0x1C]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8110994
.align 2, 0