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

794 lines
13 KiB
ArmAsm

.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_8113064
sub_8113064: @ 8113064
push {r4,r5,lr}
adds r5, r0, 0
ldr r4, =gBattleAnimAttacker
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
strh r0, [r5, 0x22]
ldrb r0, [r4]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _081130B4
ldr r2, =gBattleAnimArgs
ldrh r0, [r5, 0x20]
ldrh r1, [r2]
subs r0, r1
strh r0, [r5, 0x20]
ldrh r0, [r2, 0x6]
negs r0, r0
strh r0, [r2, 0x6]
ldrh r0, [r2, 0x8]
negs r0, r0
strh r0, [r2, 0x8]
adds r1, r2, 0
b _081130BE
.pool
_081130B4:
ldr r1, =gBattleAnimArgs
ldrh r0, [r1]
ldrh r2, [r5, 0x20]
adds r0, r2
strh r0, [r5, 0x20]
_081130BE:
ldrh r0, [r1, 0x2]
ldrh r2, [r5, 0x22]
adds r0, r2
strh r0, [r5, 0x22]
ldrh r0, [r1, 0x4]
strh r0, [r5, 0x2E]
ldrh r0, [r1, 0x6]
strh r0, [r5, 0x30]
ldrh r0, [r1, 0x8]
strh r0, [r5, 0x34]
ldrh r0, [r1, 0xA]
strh r0, [r5, 0x38]
adds r2, r5, 0
adds r2, 0x3E
ldrb r0, [r2]
movs r1, 0x4
orrs r0, r1
strb r0, [r2]
ldr r1, =move_anim_8074EE0
adds r0, r5, 0
bl StoreSpriteCallbackInData6
ldr r0, =sub_80A66DC
str r0, [r5, 0x1C]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8113064
thumb_func_start sub_8113100
sub_8113100: @ 8113100
push {r4,r5,lr}
adds r5, r0, 0
bl sub_80A6838
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]
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _08113164
ldr r2, =gBattleAnimArgs
ldrh r0, [r5, 0x20]
ldrh r1, [r2, 0x2]
subs r0, r1
strh r0, [r5, 0x20]
ldrh r0, [r5, 0x22]
adds r1, r0
strh r1, [r5, 0x22]
ldrh r0, [r5, 0x32]
ldrh r1, [r2, 0x4]
subs r0, r1
strh r0, [r5, 0x32]
ldrh r0, [r2, 0x6]
ldrh r1, [r5, 0x36]
adds r0, r1
strh r0, [r5, 0x36]
b _0811318E
.pool
_08113164:
ldr r1, =gBattleAnimArgs
ldrh r0, [r1]
ldrh r2, [r5, 0x20]
adds r0, r2
strh r0, [r5, 0x20]
ldrh r0, [r1, 0x2]
ldrh r2, [r5, 0x22]
adds r0, r2
strh r0, [r5, 0x22]
ldrh r0, [r1, 0x4]
ldrh r2, [r5, 0x32]
adds r0, r2
strh r0, [r5, 0x32]
ldrh r0, [r1, 0x6]
ldrh r1, [r5, 0x36]
adds r0, r1
strh r0, [r5, 0x36]
adds r0, r5, 0
movs r1, 0x1
bl StartSpriteAnim
_0811318E:
ldr r0, =gBattleAnimArgs
ldrh r0, [r0, 0x8]
strh r0, [r5, 0x2E]
ldr r0, =sub_80A6EEC
str r0, [r5, 0x1C]
ldr r1, =move_anim_8074EE0
adds r0, r5, 0
bl StoreSpriteCallbackInData6
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8113100
thumb_func_start sub_81131B4
sub_81131B4: @ 81131B4
push {r4,r5,lr}
adds r5, r0, 0
ldr r0, =gBattleAnimArgs
movs r1, 0
ldrsh r0, [r0, r1]
cmp r0, 0
bne _081131D0
ldr r4, =gBattleAnimAttacker
b _081131D2
.pool
_081131D0:
ldr r4, =gBattleAnimTarget
_081131D2:
ldrb r0, [r4]
movs r1, 0
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x20]
ldrb r0, [r4]
movs r1, 0x1
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x22]
ldr r4, =gBattleAnimArgs
movs r0, 0x2
ldrsh r1, [r4, r0]
adds r0, r5, 0
bl sub_80A6864
ldrh r0, [r4, 0x4]
ldrh r1, [r5, 0x22]
adds r0, r1
strh r0, [r5, 0x22]
ldr r0, =sub_80A67D8
str r0, [r5, 0x1C]
ldr r1, =move_anim_8074EE0
adds r0, r5, 0
bl StoreSpriteCallbackInData6
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81131B4
thumb_func_start sub_8113224
sub_8113224: @ 8113224
push {r4,lr}
adds r4, r0, 0
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0811323E
adds r0, r4, 0
movs r1, 0x1
bl StartSpriteAffineAnim
_0811323E:
adds r0, r4, 0
bl sub_8113100
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8113224
thumb_func_start sub_8113250
sub_8113250: @ 8113250
push {r4-r7,lr}
adds r6, r0, 0
ldr r4, =gBattleAnimAttacker
ldrb r0, [r4]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
movs r5, 0
strh r0, [r6, 0x20]
ldrb r0, [r4]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r6, 0x22]
strh r5, [r6, 0x36]
movs r0, 0x1
strh r0, [r6, 0x38]
ldr r0, =gBattleAnimArgs
ldrh r0, [r0]
strh r0, [r6, 0x3A]
ldr r4, =gBattlerAttacker
ldrb r0, [r4]
movs r1, 0
bl sub_80A861C
lsls r7, r0, 16
lsrs r5, r7, 16
ldrb r0, [r4]
movs r1, 0x1
bl sub_80A861C
lsls r1, r0, 16
lsrs r0, r1, 16
cmp r5, r0
bls _081132B0
lsrs r0, r7, 17
b _081132B2
.pool
_081132B0:
lsrs r0, r1, 17
_081132B2:
strh r0, [r6, 0x3C]
movs r1, 0x3A
ldrsh r0, [r6, r1]
movs r2, 0x3C
ldrsh r1, [r6, r2]
bl Cos
strh r0, [r6, 0x24]
movs r1, 0x3A
ldrsh r0, [r6, r1]
movs r2, 0x3C
ldrsh r1, [r6, r2]
bl Sin
strh r0, [r6, 0x26]
ldr r0, =sub_81132E0
str r0, [r6, 0x1C]
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8113250
thumb_func_start sub_81132E0
sub_81132E0: @ 81132E0
push {r4,r5,lr}
adds r4, r0, 0
movs r0, 0x2E
ldrsh r5, [r4, r0]
cmp r5, 0
beq _081132F2
cmp r5, 0x1
beq _0811335E
b _081133E2
_081132F2:
ldrh r0, [r4, 0x3A]
ldrh r1, [r4, 0x38]
subs r0, r1
movs r1, 0xFF
ands r0, r1
strh r0, [r4, 0x3A]
movs r1, 0x3A
ldrsh r0, [r4, r1]
movs r2, 0x3C
ldrsh r1, [r4, r2]
bl Cos
strh r0, [r4, 0x24]
movs r1, 0x3A
ldrsh r0, [r4, r1]
movs r2, 0x3C
ldrsh r1, [r4, r2]
bl Sin
strh r0, [r4, 0x26]
ldrh r0, [r4, 0x36]
adds r0, 0x1
strh r0, [r4, 0x36]
lsls r0, 16
asrs r0, 16
cmp r0, 0x5
ble _08113344
strh r5, [r4, 0x36]
ldrh r1, [r4, 0x38]
movs r2, 0x38
ldrsh r0, [r4, r2]
cmp r0, 0xF
bgt _08113344
adds r0, r1, 0x1
strh r0, [r4, 0x38]
lsls r0, 16
asrs r0, 16
cmp r0, 0xF
ble _08113344
movs r0, 0x10
strh r0, [r4, 0x38]
_08113344:
ldrh r0, [r4, 0x34]
adds r0, 0x1
strh r0, [r4, 0x34]
lsls r0, 16
asrs r0, 16
cmp r0, 0x3C
ble _081133E2
movs r0, 0
strh r0, [r4, 0x34]
ldrh r0, [r4, 0x2E]
adds r0, 0x1
strh r0, [r4, 0x2E]
b _081133E2
_0811335E:
ldrh r0, [r4, 0x3A]
ldrh r1, [r4, 0x38]
subs r0, r1
movs r1, 0xFF
ands r0, r1
strh r0, [r4, 0x3A]
ldrh r1, [r4, 0x3C]
movs r2, 0x3C
ldrsh r0, [r4, r2]
cmp r0, 0x95
bgt _08113386
adds r0, r1, 0
adds r0, 0x8
strh r0, [r4, 0x3C]
lsls r0, 16
asrs r0, 16
cmp r0, 0x95
ble _08113386
movs r0, 0x96
strh r0, [r4, 0x3C]
_08113386:
movs r1, 0x3A
ldrsh r0, [r4, r1]
movs r2, 0x3C
ldrsh r1, [r4, r2]
bl Cos
strh r0, [r4, 0x24]
movs r1, 0x3A
ldrsh r0, [r4, r1]
movs r2, 0x3C
ldrsh r1, [r4, r2]
bl Sin
strh r0, [r4, 0x26]
ldrh r0, [r4, 0x36]
adds r0, 0x1
strh r0, [r4, 0x36]
lsls r0, 16
asrs r0, 16
cmp r0, 0x5
ble _081133CE
movs r0, 0
strh r0, [r4, 0x36]
ldrh r1, [r4, 0x38]
movs r2, 0x38
ldrsh r0, [r4, r2]
cmp r0, 0xF
bgt _081133CE
adds r0, r1, 0x1
strh r0, [r4, 0x38]
lsls r0, 16
asrs r0, 16
cmp r0, 0xF
ble _081133CE
movs r0, 0x10
strh r0, [r4, 0x38]
_081133CE:
ldrh r0, [r4, 0x34]
adds r0, 0x1
strh r0, [r4, 0x34]
lsls r0, 16
asrs r0, 16
cmp r0, 0x14
ble _081133E2
adds r0, r4, 0
bl DestroyAnimSprite
_081133E2:
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81132E0
thumb_func_start sub_81133E8
sub_81133E8: @ 81133E8
push {r4-r6,lr}
sub sp, 0xC
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks
adds r4, r1, r0
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl sub_80A8364
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _08113424
ldr r0, =0x04000014
str r0, [sp]
ldr r0, =gBattle_BG1_X
b _0811342A
.pool
_08113424:
ldr r0, =0x04000018
str r0, [sp]
ldr r0, =gBattle_BG2_X
_0811342A:
ldrh r0, [r0]
strh r0, [r4, 0xC]
ldr r0, =0xa2600001
str r0, [sp, 0x4]
mov r1, sp
movs r5, 0
movs r0, 0x1
strb r0, [r1, 0x8]
mov r0, sp
strb r5, [r0, 0x9]
ldr r0, =gBattleAnimAttacker
ldrb r0, [r0]
bl GetBattlerYCoordWithElevation
lsls r0, 24
lsrs r0, 24
adds r1, r0, 0
subs r1, 0x20
strh r1, [r4, 0xE]
adds r0, 0x20
strh r0, [r4, 0x10]
cmp r1, 0
bge _0811345A
strh r5, [r4, 0xE]
_0811345A:
ldrh r3, [r4, 0xE]
movs r1, 0x10
ldrsh r0, [r4, r1]
cmp r3, r0
bgt _08113488
ldr r5, =gScanlineEffectRegBuffers
movs r0, 0xF0
lsls r0, 3
adds r6, r5, r0
_0811346C:
lsls r1, r3, 1
adds r2, r1, r5
ldrh r0, [r4, 0xC]
strh r0, [r2]
adds r1, r6
ldrh r0, [r4, 0xC]
strh r0, [r1]
adds r0, r3, 0x1
lsls r0, 16
lsrs r3, r0, 16
movs r1, 0x10
ldrsh r0, [r4, r1]
cmp r3, r0
ble _0811346C
_08113488:
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
bl ScanlineEffect_SetParams
ldr r0, =sub_81134B8
str r0, [r4]
add sp, 0xC
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_81133E8
thumb_func_start sub_81134B8
sub_81134B8: @ 81134B8
push {lr}
lsls r0, 24
lsrs r3, r0, 24
lsls r0, r3, 2
adds r0, r3
lsls r0, 3
ldr r1, =gTasks
adds r2, r0, r1
movs r1, 0x8
ldrsh r0, [r2, r1]
cmp r0, 0x4
bhi _0811356E
lsls r0, 2
ldr r1, =_081134E4
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081134E4:
.4byte _081134F8
.4byte _0811351A
.4byte _0811352A
.4byte _08113556
.4byte _08113568
_081134F8:
ldrh r0, [r2, 0x16]
adds r0, 0x1
strh r0, [r2, 0x16]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
ble _0811354E
movs r0, 0
strh r0, [r2, 0x16]
ldrh r0, [r2, 0x14]
adds r0, 0x1
strh r0, [r2, 0x14]
lsls r0, 16
asrs r0, 16
cmp r0, 0x3
bne _0811354E
b _08113548
_0811351A:
ldrh r0, [r2, 0xA]
adds r0, 0x1
strh r0, [r2, 0xA]
lsls r0, 16
asrs r0, 16
cmp r0, 0x3C
ble _0811354E
b _08113548
_0811352A:
ldrh r0, [r2, 0x16]
adds r0, 0x1
strh r0, [r2, 0x16]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
ble _0811354E
movs r0, 0
strh r0, [r2, 0x16]
ldrh r0, [r2, 0x14]
subs r0, 0x1
strh r0, [r2, 0x14]
lsls r0, 16
cmp r0, 0
bne _0811354E
_08113548:
ldrh r0, [r2, 0x8]
adds r0, 0x1
strh r0, [r2, 0x8]
_0811354E:
adds r0, r2, 0
bl sub_8113574
b _0811356E
_08113556:
ldr r1, =gScanlineEffect
movs r0, 0x3
strb r0, [r1, 0x15]
ldrh r0, [r2, 0x8]
adds r0, 0x1
strh r0, [r2, 0x8]
b _0811356E
.pool
_08113568:
adds r0, r3, 0
bl DestroyAnimVisualTask
_0811356E:
pop {r0}
bx r0
thumb_func_end sub_81134B8
thumb_func_start sub_8113574
sub_8113574: @ 8113574
push {r4-r7,lr}
mov r7, r8
push {r7}
adds r5, r0, 0
ldrh r3, [r5, 0x12]
ldrh r4, [r5, 0xE]
movs r1, 0x10
ldrsh r0, [r5, r1]
cmp r4, r0
bgt _081135CA
ldr r7, =gScanlineEffectRegBuffers
mov r12, r7
ldr r0, =gSineTable
mov r8, r0
ldr r6, =gScanlineEffect
_08113592:
lsls r2, r4, 1
ldrb r1, [r6, 0x14]
lsls r0, r1, 4
subs r0, r1
lsls r0, 7
adds r2, r0
add r2, r12
lsls r0, r3, 1
add r0, r8
movs r7, 0
ldrsh r1, [r0, r7]
movs r7, 0x14
ldrsh r0, [r5, r7]
muls r0, r1
asrs r0, 7
ldrh r1, [r5, 0xC]
adds r0, r1
strh r0, [r2]
adds r3, 0x8
movs r0, 0xFF
ands r3, r0
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
movs r7, 0x10
ldrsh r0, [r5, r7]
cmp r4, r0
ble _08113592
_081135CA:
ldrh r0, [r5, 0x12]
adds r0, 0x9
movs r1, 0xFF
ands r0, r1
strh r0, [r5, 0x12]
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8113574
thumb_func_start sub_81135EC
sub_81135EC: @ 81135EC
push {r4-r6,lr}
mov r6, r8
push {r6}
adds r4, r0, 0
ldr r5, =gBattleAnimArgs
movs r0, 0x4
ldrsh r1, [r5, r0]
lsls r0, r1, 1
adds r0, r1
movs r1, 0x5
bl __divsi3
adds r6, r0, 0
ldr r1, =gBattleAnimAttacker
mov r8, r1
ldrb r0, [r1]
movs r1, 0x2
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
strh r0, [r4, 0x20]
mov r2, r8
ldrb r0, [r2]
movs r1, 0x3
bl GetBattlerSpriteCoord
lsls r0, 24
lsrs r0, 24
ldrh r3, [r5, 0x8]
adds r0, r3
strh r0, [r4, 0x22]
movs r1, 0x2
ldrsh r0, [r5, r1]
movs r2, 0x4
ldrsh r1, [r5, r2]
bl Cos
strh r0, [r4, 0x30]
movs r3, 0x2
ldrsh r0, [r5, r3]
lsls r6, 16
asrs r6, 16
adds r1, r6, 0
bl Sin
strh r0, [r4, 0x32]
ldrh r1, [r4, 0x30]
ldrh r2, [r5]
adds r3, r2, 0
muls r3, r1
adds r1, r3, 0
ldrh r3, [r4, 0x20]
adds r1, r3
strh r1, [r4, 0x20]
adds r1, r2, 0
muls r1, r0
adds r0, r1, 0
ldrh r2, [r4, 0x22]
adds r0, r2
strh r0, [r4, 0x22]
ldrh r0, [r5, 0x6]
strh r0, [r4, 0x34]
ldr r0, =sub_811369C
str r0, [r4, 0x1C]
adds r4, 0x2E
ldr r2, =gUnknown_0203A100
movs r1, 0x6
_08113674:
ldrh r0, [r4]
strh r0, [r2]
adds r4, 0x2
adds r2, 0x2
subs r1, 0x1
cmp r1, 0
bge _08113674
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_81135EC
thumb_func_start sub_811369C
sub_811369C: @ 811369C
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x30]
ldrh r1, [r4, 0x36]
adds r0, r1
strh r0, [r4, 0x36]
ldrh r0, [r4, 0x32]
ldrh r2, [r4, 0x38]
adds r0, r2
strh r0, [r4, 0x38]
movs r1, 0x36
ldrsh r0, [r4, r1]
movs r1, 0xA
bl __divsi3
strh r0, [r4, 0x24]
movs r2, 0x38
ldrsh r0, [r4, r2]
movs r1, 0xA
bl __divsi3
strh r0, [r4, 0x26]
ldrh r0, [r4, 0x2E]
adds r0, 0x1
strh r0, [r4, 0x2E]
lsls r0, 16
asrs r0, 16
movs r2, 0x34
ldrsh r1, [r4, r2]
cmp r0, r1
ble _081136E0
adds r0, r4, 0
bl DestroyAnimSprite
_081136E0:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_811369C
.align 2, 0