Decompile dragon.c

This commit is contained in:
Marcus Huderle 2018-11-26 09:31:03 -06:00
parent 9b1f2ccf5e
commit 839c629d5b
4 changed files with 270 additions and 800 deletions

View File

@ -1,793 +0,0 @@
.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, =StartAnimLinearTranslation
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

View File

@ -89,6 +89,12 @@ void sub_80A6FD4(struct Sprite *sprite);
u16 ArcTan2Neg(s16 a, s16 b);
void sub_80A73E0(struct Sprite *sprite, bool8 a2, s16 xScale, s16 yScale, u16 rotation);
void sub_80A67BC(struct Sprite *sprite);
void sub_80A66DC(struct Sprite *sprite);
void sub_80A6838(struct Sprite *sprite);
void sub_80A67D8(struct Sprite *sprite);
void sub_80A6864(struct Sprite *sprite, s16 a2);
s16 sub_80A861C(u8 battlerId, u8 a2);
u8 GetBattlerYCoordWithElevation(u8 battlerId);
void sub_80A8278(void);
void sub_80A6B30(struct UnknownAnimStruct2*);
void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1);

View File

@ -169,7 +169,7 @@ SECTIONS {
src/bug.o(.text);
src/rock.o(.text);
asm/ghost.o(.text);
asm/dragon.o(.text);
src/dragon.o(.text);
asm/dark.o(.text);
asm/ground.o(.text);
asm/normal.o(.text);

View File

@ -1,13 +1,21 @@
#include "global.h"
#include "battle_anim.h"
#include "scanline_effect.h"
#include "task.h"
#include "trig.h"
#include "constants/rgb.h"
extern void sub_8113064(struct Sprite *);
extern void sub_8113224(struct Sprite *);
extern void sub_81131B4(struct Sprite *);
extern void sub_8113224(struct Sprite *);
extern void sub_8113250(struct Sprite *);
extern void sub_81135EC(struct Sprite *);
extern u16 gUnknown_0203A100[];
void sub_8113064(struct Sprite *);
void sub_81131B4(struct Sprite *);
void sub_8113224(struct Sprite *);
void sub_8113250(struct Sprite *);
void sub_81135EC(struct Sprite *);
static void sub_81132E0(struct Sprite *);
static void sub_81134B8(u8);
static void sub_8113574(struct Task *);
static void sub_811369C(struct Sprite *);
const union AnimCmd gUnknown_08596E60[] =
{
@ -178,3 +186,252 @@ const struct SpriteTemplate gUnknown_08596FB0 =
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_81135EC,
};
void sub_8113064(struct Sprite *sprite)
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{
sprite->pos1.x -= gBattleAnimArgs[0];
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
gBattleAnimArgs[4] = -gBattleAnimArgs[4];
}
else
{
sprite->pos1.x += gBattleAnimArgs[0];
}
sprite->pos1.y += gBattleAnimArgs[1];
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[3] = gBattleAnimArgs[4];
sprite->data[5] = gBattleAnimArgs[5];
sprite->invisible = 1;
StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
sprite->callback = sub_80A66DC;
}
static void sub_8113100(struct Sprite *sprite)
{
sub_80A6838(sprite);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{
sprite->pos1.x -= gBattleAnimArgs[1];
sprite->pos1.y += gBattleAnimArgs[1];
sprite->data[2] -= gBattleAnimArgs[2];
sprite->data[4] += gBattleAnimArgs[3];
}
else
{
sprite->pos1.x += gBattleAnimArgs[0];
sprite->pos1.y += gBattleAnimArgs[1];
sprite->data[2] += gBattleAnimArgs[2];
sprite->data[4] += gBattleAnimArgs[3];
StartSpriteAnim(sprite, 1);
}
sprite->data[0] = gBattleAnimArgs[4];
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
}
void sub_81131B4(struct Sprite *sprite)
{
if (gBattleAnimArgs[0] == 0)
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
}
else
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
}
sub_80A6864(sprite, gBattleAnimArgs[1]);
sprite->pos1.y += gBattleAnimArgs[2];
sprite->callback = sub_80A67D8;
StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
}
void sub_8113224(struct Sprite *sprite)
{
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
StartSpriteAffineAnim(sprite, 1);
sub_8113100(sprite);
}
void sub_8113250(struct Sprite *sprite)
{
u16 r5;
u16 r0;
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
sprite->data[4] = 0;
sprite->data[5] = 1;
sprite->data[6] = gBattleAnimArgs[0];
r5 = sub_80A861C(gBattlerAttacker, 0);
r0 = sub_80A861C(gBattlerAttacker, 1);
if (r5 > r0)
sprite->data[7] = r5 / 2;
else
sprite->data[7] = r0 / 2;
sprite->pos2.x = Cos(sprite->data[6], sprite->data[7]);
sprite->pos2.y = Sin(sprite->data[6], sprite->data[7]);
sprite->callback = sub_81132E0;
}
static void sub_81132E0(struct Sprite *sprite)
{
switch (sprite->data[0])
{
case 0:
sprite->data[6] = (sprite->data[6] - sprite->data[5]) & 0xFF;
sprite->pos2.x = Cos(sprite->data[6], sprite->data[7]);
sprite->pos2.y = Sin(sprite->data[6], sprite->data[7]);
if (++sprite->data[4] > 5)
{
sprite->data[4] = 0;
if (sprite->data[5] <= 15 && ++sprite->data[5] > 15)
sprite->data[5] = 16;
}
if (++sprite->data[3] > 0x3C)
{
sprite->data[3] = 0;
sprite->data[0]++;
}
break;
case 1:
sprite->data[6] = (sprite->data[6] - sprite->data[5]) & 0xFF;
if (sprite->data[7] <= 0x95 && (sprite->data[7] += 8) > 0x95)
sprite->data[7] = 0x96;
sprite->pos2.x = Cos(sprite->data[6], sprite->data[7]);
sprite->pos2.y = Sin(sprite->data[6], sprite->data[7]);
if (++sprite->data[4] > 5)
{
sprite->data[4] = 0;
if (sprite->data[5] <= 15 && ++sprite->data[5] > 15)
sprite->data[5] = 16;
}
if (++sprite->data[3] > 20)
DestroyAnimSprite(sprite);
break;
}
}
void sub_81133E8(u8 taskId)
{
struct ScanlineEffectParams sp;
struct Task *task = &gTasks[taskId];
u16 i;
u8 r1;
if (sub_80A8364(gBattleAnimAttacker) == 1)
{
sp.dmaDest = &REG_BG1HOFS;
task->data[2] = gBattle_BG1_X;
}
else
{
sp.dmaDest = &REG_BG2HOFS;
task->data[2] = gBattle_BG2_X;
}
sp.dmaControl = 0xA2600001;
sp.initState = 1;
sp.unused9 = 0;
r1 = GetBattlerYCoordWithElevation(gBattleAnimAttacker);
task->data[3] = r1 - 32;
task->data[4] = r1 + 32;
if (task->data[3] < 0)
task->data[3] = 0;
for (i = task->data[3]; i <= task->data[4]; i++)
{
gScanlineEffectRegBuffers[0][i] = task->data[2];
gScanlineEffectRegBuffers[1][i] = task->data[2];
}
ScanlineEffect_SetParams(sp);
task->func = sub_81134B8;
}
static void sub_81134B8(u8 taskId)
{
struct Task *task = &gTasks[taskId];
switch (task->data[0])
{
case 0:
if (++task->data[7] > 1)
{
task->data[7] = 0;
if (++task->data[6] == 3)
task->data[0]++;
}
sub_8113574(task);
break;
case 1:
if (++task->data[1] > 0x3C)
task->data[0]++;
sub_8113574(task);
break;
case 2:
if (++task->data[7] > 1)
{
task->data[7] = 0;
if (--task->data[6] == 0)
task->data[0]++;
}
sub_8113574(task);
break;
case 3:
gScanlineEffect.state = 3;
task->data[0]++;
break;
case 4:
DestroyAnimVisualTask(taskId);
break;
}
}
static void sub_8113574(struct Task *task)
{
u16 r3 = task->data[5];
u16 i;
for (i = task->data[3]; i <= task->data[4]; i++)
{
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = ((gSineTable[r3] * task->data[6]) >> 7) + task->data[2];
r3 = (r3 + 8) & 0xFF;
}
task->data[5] = (task->data[5] + 9) & 0xFF;
}
void sub_81135EC(struct Sprite *sprite)
{
int r6 = (gBattleAnimArgs[2] * 3) / 5;
int i;
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[4];
sprite->data[1] = Cos(gBattleAnimArgs[1], gBattleAnimArgs[2]);
sprite->data[2] = Sin(gBattleAnimArgs[1], r6);
sprite->pos1.x += sprite->data[1] * gBattleAnimArgs[0];
sprite->pos1.y += sprite->data[2] * gBattleAnimArgs[0];
sprite->data[3] = gBattleAnimArgs[3];
sprite->callback = sub_811369C;
for (i = 0; i < 7; i++)
gUnknown_0203A100[i] = sprite->data[i];
}
static void sub_811369C(struct Sprite *sprite)
{
sprite->data[4] += sprite->data[1];
sprite->data[5] += sprite->data[2];
sprite->pos2.x = sprite->data[4] / 10;
sprite->pos2.y = sprite->data[5] / 10;
if (++sprite->data[0] > sprite->data[3])
DestroyAnimSprite(sprite);
}