pokecrystal-board/engine/battle_anims/functions.asm

4154 lines
62 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
DoBattleAnimFrame:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_FUNCTION
add hl, bc
ld e, [hl]
ld d, 0
ld hl, .Jumptable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
2015-12-23 14:10:50 -08:00
.Jumptable:
; entries correspond to BATTLEANIMFUNC_* constants
2016-05-05 12:07:37 -07:00
dw BattleAnimFunction_Null ; 00
2015-12-23 14:10:50 -08:00
dw BattleAnimFunction_01 ; 01
dw BattleAnimFunction_02 ; 02
dw BattleAnimFunction_03 ; 03
dw BattleAnimFunction_04 ; 04
2016-05-05 12:07:37 -07:00
dw BattleAnimFunction_ThrowFromPlayerToEnemy ; 05
dw BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear ; 06
2015-12-23 14:10:50 -08:00
dw BattleAnimFunction_07 ; 07
dw BattleAnimFunction_08 ; 08
dw BattleAnimFunction_09 ; 09
dw BattleAnimFunction_0A ; 0a
2016-05-05 12:07:37 -07:00
dw BattleAnimFunction_RazorLeaf ; 0b
2015-12-23 14:10:50 -08:00
dw BattleAnimFunction_0C ; 0c
dw BattleAnimFunction_0D ; 0d
dw BattleAnimFunction_0E ; 0e
dw BattleAnimFunction_0F ; 0f
dw BattleAnimFunction_10 ; 10
dw BattleAnimFunction_11 ; 11
2016-05-05 12:07:37 -07:00
dw BattleAnimFunction_PokeBall ; 12
dw BattleAnimFunction_PokeBallBlocked ; 13
2015-12-23 14:10:50 -08:00
dw BattleAnimFunction_14 ; 14
dw BattleAnimFunction_15 ; 15
dw BattleAnimFunction_16 ; 16
dw BattleAnimFunction_17 ; 17
dw BattleAnimFunction_18 ; 18
dw BattleAnimFunction_19 ; 19
dw BattleAnimFunction_1A ; 1a
dw BattleAnimFunction_1B ; 1b
dw BattleAnimFunction_1C ; 1c
dw BattleAnimFunction_1D ; 1d
dw BattleAnimFunction_1E ; 1e
dw BattleAnimFunction_1F ; 1f
2016-05-05 12:07:37 -07:00
dw BattleAnimFunction_LeechSeed ; 20
2015-12-23 14:10:50 -08:00
dw BattleAnimFunction_21 ; 21
dw BattleAnimFunction_22 ; 22
dw BattleAnimFunction_23 ; 23
dw BattleAnimFunction_24 ; 24
dw BattleAnimFunction_25 ; 25
dw BattleAnimFunction_26 ; 26
dw BattleAnimFunction_27 ; 27
dw BattleAnimFunction_28 ; 28
2016-05-05 12:07:37 -07:00
dw BattleAnimFunction_SpiralDescent ; 29
dw BattleAnimFunction_PoisonGas ; 2a
dw BattleAnimFunction_Horn ; 2b
2015-12-23 14:10:50 -08:00
dw BattleAnimFunction_2C ; 2c
dw BattleAnimFunction_2D ; 2d
dw BattleAnimFunction_2E ; 2e
dw BattleAnimFunction_2F ; 2f
dw BattleAnimFunction_30 ; 30
dw BattleAnimFunction_31 ; 31
dw BattleAnimFunction_32 ; 32
dw BattleAnimFunction_33 ; 33
dw BattleAnimFunction_34 ; 34
dw BattleAnimFunction_35 ; 35
dw BattleAnimFunction_36 ; 36
dw BattleAnimFunction_37 ; 37
dw BattleAnimFunction_38 ; 38
dw BattleAnimFunction_39 ; 39
dw BattleAnimFunction_3A ; 3a
dw BattleAnimFunction_3B ; 3b
dw BattleAnimFunction_3C ; 3c
dw BattleAnimFunction_3D ; 3d
dw BattleAnimFunction_3E ; 3e
dw BattleAnimFunction_3F ; 3f
dw BattleAnimFunction_40 ; 40
dw BattleAnimFunction_41 ; 41
dw BattleAnimFunction_42 ; 42
dw BattleAnimFunction_43 ; 43
dw BattleAnimFunction_44 ; 44
dw BattleAnimFunction_45 ; 45
dw BattleAnimFunction_46 ; 46
dw BattleAnimFunction_47 ; 47
dw BattleAnimFunction_48 ; 48
dw BattleAnimFunction_49 ; 49
dw BattleAnimFunction_4A ; 4a
dw BattleAnimFunction_4B ; 4b
dw BattleAnimFunction_4C ; 4c
dw BattleAnimFunction_4D ; 4d
dw BattleAnimFunction_4E ; 4e
dw BattleAnimFunction_4F ; 4f
2018-06-24 07:09:41 -07:00
BattleAnimFunction_Null:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw .zero
dw .one
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear:
2016-05-05 12:07:37 -07:00
call BattleAnimFunction_ThrowFromPlayerToEnemy
2015-12-23 14:10:50 -08:00
ret c
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_ThrowFromPlayerToEnemy:
2016-05-05 12:07:37 -07:00
; If x coord at $88 or beyond, abort.
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $88
ret nc
2016-05-05 12:07:37 -07:00
; Move right 2 pixels
2015-12-23 14:10:50 -08:00
add $2
ld [hl], a
2016-05-05 12:07:37 -07:00
; Move down 1 pixel
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
2016-05-05 12:07:37 -07:00
; Decrease ??? and hold onto its previous value (argument of the sine function)
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
2016-05-05 12:07:37 -07:00
; Get ???, which is the amplitude of the sine function
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld d, [hl]
call BattleAnim_Sine
2016-05-05 12:07:37 -07:00
; Store the result in the Y offset
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
2016-05-05 12:07:37 -07:00
; Carry flag denotes success
2015-12-23 14:10:50 -08:00
scf
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_04:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $88
jr c, .asm_cd0b3
call DeinitBattleAnimation
ret
.asm_cd0b3
add $2
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
2016-05-05 12:07:37 -07:00
inc [hl]
inc [hl]
inc [hl]
2015-12-23 14:10:50 -08:00
ld d, $10
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
sra a
sra a
sra a
sra a
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_03:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw .zero
dw .one
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
bit 7, [hl]
ld a, $0
jr z, .asm_cd0f9
ld a, $20
.asm_cd0f9
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $7f
ld [hl], a
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld d, [hl]
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_01:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw .zero
dw .one
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $84
ret nc
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
call Functionce70a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_02:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $84
jr nc, .asm_cd158
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
call Functionce70a
ret
.asm_cd158
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_PokeBall:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw .zero
dw .one
dw .two
dw .three
dw .four
dw .five
dw .six
dw .seven
dw .eight
dw .nine
dw .ten
dw .eleven
2016-05-05 12:07:37 -07:00
.zero ; init
2016-01-27 09:25:12 -08:00
call GetBallAnimPal
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ret
2015-12-24 10:33:54 -08:00
.one
2016-05-05 12:07:37 -07:00
call BattleAnimFunction_ThrowFromPlayerToEnemy
2015-12-23 14:10:50 -08:00
ret c
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
add [hl]
ld [hl], a
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_0B
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
2015-12-24 10:33:54 -08:00
.three
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_09
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
inc hl
ld [hl], $10
2015-12-24 10:33:54 -08:00
.four
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec a
ld [hl], a
and $1f
ret nz
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
sub $4
ld [hl], a
ret nz
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_0C
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
2015-12-24 10:33:54 -08:00
.six
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_0D
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
dec [hl]
.two
.five
.nine
ret
2015-12-24 10:33:54 -08:00
.seven
2016-01-27 09:25:12 -08:00
call GetBallAnimPal
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_0A
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], $20
.eight
.ten
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec a
ld [hl], a
and $1f
jr z, .eleven
and $f
ret nz
call BattleAnim_IncAnonJumptableIndex
ret
2015-12-24 10:33:54 -08:00
.eleven
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_PokeBallBlocked:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw .zero
dw .one
dw .two
2015-12-24 10:33:54 -08:00
.zero
2016-01-27 09:25:12 -08:00
call GetBallAnimPal
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ret
2015-12-24 10:33:54 -08:00
.one
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $70
jr nc, .next
2016-05-05 12:07:37 -07:00
call BattleAnimFunction_ThrowFromPlayerToEnemy
2015-12-23 14:10:50 -08:00
ret
.next
call BattleAnim_IncAnonJumptableIndex
2015-12-24 10:33:54 -08:00
.two
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $80
jr nc, .done
add $4
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
dec [hl]
ret
.done
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
GetBallAnimPal:
2017-12-11 14:11:30 -08:00
ld hl, BallColors
ldh a, [rSVBK]
2015-12-23 14:10:50 -08:00
push af
2018-01-23 14:39:09 -08:00
ld a, BANK(wCurItem)
ldh [rSVBK], a
2018-01-23 14:39:09 -08:00
ld a, [wCurItem]
2015-12-23 14:10:50 -08:00
ld e, a
pop af
ldh [rSVBK], a
.IsInArray:
2015-12-23 14:10:50 -08:00
ld a, [hli]
cp -1
jr z, .load
cp e
jr z, .load
inc hl
jr .IsInArray
.load
ld a, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_PALETTE
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
2017-12-11 14:11:30 -08:00
INCLUDE "data/battle_anims/ball_colors.asm"
2017-12-11 14:11:30 -08:00
2018-06-24 07:09:41 -07:00
BattleAnimFunction_10:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 19:51:50 -08:00
dw .zero
dw .one
dw .two
dw .three
dw .four
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
swap a
and $f
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
ret
2015-12-24 10:33:54 -08:00
.one
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $88
ret nc
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
call Functionce70a
ret
2015-12-24 10:33:54 -08:00
.two
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2015-12-24 10:33:54 -08:00
.three
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_0F
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2015-12-24 10:33:54 -08:00
.four
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_07:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 19:51:50 -08:00
dw .zero
dw .one
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $30
inc hl
ld [hl], $48
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $3f
ret nz
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $20
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
sub [hl]
2015-12-23 19:51:50 -08:00
jr z, .done
jr c, .done
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], a
ret
2015-12-23 19:51:50 -08:00
.done
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_08:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 19:51:50 -08:00
dw .zero
dw .one
dw .two
dw .three
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $80
2015-12-23 19:51:50 -08:00
jr nc, .next
call .SetCoords
2015-12-23 14:10:50 -08:00
ret
2015-12-23 19:51:50 -08:00
.next
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
2015-12-24 10:33:54 -08:00
.two
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $40
2015-12-23 19:51:50 -08:00
jr nc, .loop_back
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $18
call BattleAnim_Cosine
sub $18
sra a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $18
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
add [hl]
ld [hl], a
ret
2015-12-23 19:51:50 -08:00
.loop_back
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f0
2015-12-23 19:51:50 -08:00
jr z, .finish
2015-12-23 14:10:50 -08:00
sub $10
ld d, a
ld a, [hl]
and $f
or d
ld [hl], a
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
dec [hl]
ret
2015-12-23 19:51:50 -08:00
.finish
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2015-12-24 10:33:54 -08:00
.three
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $b0
2015-12-23 19:51:50 -08:00
jr c, .retain
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2015-12-23 19:51:50 -08:00
.retain
call .SetCoords
2015-12-23 14:10:50 -08:00
ret
.SetCoords:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
add [hl]
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f
ld e, a
srl e
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
2015-12-23 19:51:50 -08:00
.loop
2015-12-23 14:10:50 -08:00
dec [hl]
dec e
2015-12-23 19:51:50 -08:00
jr nz, .loop
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_09:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 19:51:50 -08:00
dw .zero
dw .one
dw .two
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
2015-12-23 19:51:50 -08:00
jr z, .done_one
2015-12-23 14:10:50 -08:00
dec [hl]
ret
2015-12-23 19:51:50 -08:00
.done_one
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
swap a
and $f
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
xor $ff
inc a
ld [hl], a
ret
2015-12-24 10:33:54 -08:00
.two
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_0A:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 19:51:50 -08:00
dw .zero
dw .one
dw .two
dw .three
dw .four
dw .five
dw .six
dw .seven
dw .eight
dw .nine
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
cp $7
2015-12-23 19:51:50 -08:00
jr z, .seven
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_11
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
ret
2015-12-24 10:33:54 -08:00
.seven
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $88
2015-12-23 19:51:50 -08:00
jr nc, .set_up_eight
2015-12-23 14:10:50 -08:00
add $2
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
2015-12-23 19:51:50 -08:00
.set_up_eight
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_10
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2015-12-24 10:33:54 -08:00
.eight
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $10
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ret
2015-12-24 10:33:54 -08:00
.nine
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2015-12-24 10:33:54 -08:00
.one
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
2015-12-24 10:33:54 -08:00
.four
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
2015-12-24 10:33:54 -08:00
.two
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
2015-12-24 10:33:54 -08:00
.five
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
2015-12-24 10:33:54 -08:00
.three
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
2015-12-24 10:33:54 -08:00
.six
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_RazorLeaf:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 19:51:50 -08:00
dw .zero
dw .one
dw .two
dw .three
dw .four
dw .five
dw .six
dw .seven
dw .eight
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $40
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $30
2015-12-23 19:51:50 -08:00
jr nc, .sine_cosine
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
xor a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hli], a
ld [hl], a
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_17
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
bit 6, [hl]
ret z
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
ld [hl], $5
ret
2015-12-23 19:51:50 -08:00
.sine_cosine
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $3f
ld d, a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
call Functioncd557
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], e
ret
2015-12-24 10:33:54 -08:00
.two
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $20
2015-12-23 19:51:50 -08:00
jr nz, .sine_cosine_2
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2015-12-23 19:51:50 -08:00
.sine_cosine_2
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
bit 6, [hl]
2015-12-23 19:51:50 -08:00
jr nz, .decrease
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
2015-12-23 19:51:50 -08:00
jr .finish
2015-12-23 14:10:50 -08:00
2015-12-23 19:51:50 -08:00
.decrease
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
dec [hl]
2015-12-23 19:51:50 -08:00
.finish
2015-12-23 14:10:50 -08:00
ld de, $80
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], e
ret
2015-12-24 10:33:54 -08:00
.three
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_16
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
res 5, [hl]
2015-12-23 19:51:50 -08:00
.four
.five
.six
.seven
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ret
2015-12-24 10:33:54 -08:00
.eight
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $c0
ret nc
ld a, $8
call Functionce70a
ret
2018-06-24 07:09:41 -07:00
Functioncd557:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
bit 7, a
jr nz, .negative
cp $20
jr nc, .plus_256
cp $18
jr nc, .plus_384
ld de, $200
ret
.plus_384
ld de, $180
ret
.plus_256
ld de, $100
ret
.negative
and $3f
cp $20
jr nc, .minus_256
cp $18
jr nc, .minus_384
ld de, -$200
ret
.minus_384
ld de, -$180
ret
.minus_256
ld de, -$100
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_4E:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 19:51:50 -08:00
dw .zero
dw .one
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $40
rlca
rlca
add $19
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld [hl], a
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $40
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $30
2015-12-23 19:51:50 -08:00
jr nc, .sine_cosine
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2015-12-23 19:51:50 -08:00
.sine_cosine
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $3f
ld d, a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
call Functioncd557
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], e
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_0C:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 19:51:50 -08:00
dw .zero
dw .one
dw .two
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $c
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
2015-12-23 19:51:50 -08:00
jr z, .next
2015-12-23 14:10:50 -08:00
dec [hl]
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
call Functionce70a
ret
2015-12-23 19:51:50 -08:00
.next
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_22
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2015-12-24 10:33:54 -08:00
.two
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $98
2015-12-23 19:51:50 -08:00
jr nc, .okay
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld h, [hl]
ld l, a
ld de, $60
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
2015-12-23 19:51:50 -08:00
.okay
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $20
ret c
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f0
ld e, a
ld d, $ff
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], e
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_0D:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 19:51:50 -08:00
dw .zero
dw .one
dw .two
dw .three
dw .four
2015-12-24 10:33:54 -08:00
.zero
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2018-08-25 11:34:25 -07:00
ld a, LOW(rSCY)
ldh [hLCDCPointer], a
2015-12-23 14:10:50 -08:00
ld a, $58
ldh [hLYOverrideStart], a
2015-12-23 14:10:50 -08:00
ld a, $5e
ldh [hLYOverrideEnd], a
2015-12-23 14:10:50 -08:00
ret
2015-12-24 10:33:54 -08:00
.one
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld e, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp e
jr nc, .asm_cd69b
call BattleAnim_IncAnonJumptableIndex
xor a
ldh [hLYOverrideStart], a
2015-12-23 14:10:50 -08:00
ret
.asm_cd69b
dec a
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
add [hl]
sub $10
ret c
ldh [hLYOverrideStart], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
inc a
and $7
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
inc [hl]
2015-12-24 10:33:54 -08:00
.two
2015-12-23 14:10:50 -08:00
ret
2015-12-24 10:33:54 -08:00
.three
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $70
jr c, asm_cd6da
xor a
ldh [hLCDCPointer], a
ldh [hLYOverrideStart], a
ldh [hLYOverrideEnd], a
2015-12-24 10:33:54 -08:00
.four
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
asm_cd6da:
2015-12-23 14:10:50 -08:00
inc a
inc a
ld [hl], a
sub $10
ret c
ldh [hLYOverrideStart], a
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_0E:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncd6ea
dw Functioncd6f7
2018-06-24 07:09:41 -07:00
Functioncd6ea:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_24
add [hl] ; offset
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2018-06-24 07:09:41 -07:00
Functioncd6f7:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $b8
jr c, .asm_cd704
call DeinitBattleAnimation
ret
.asm_cd704
ld a, $2
call Functionce70a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
ld d, $8
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_0F:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncd725
dw Functioncd728
dw Functioncd763
dw Functioncd776
2018-06-24 07:09:41 -07:00
Functioncd725:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2018-06-24 07:09:41 -07:00
Functioncd728:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_cd747
ld a, $2
call Functionce70a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
ld d, $8
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
.asm_cd747
call BattleAnim_IncAnonJumptableIndex
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_28
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], $0
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], $30
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
ld a, [hl]
and $1
ld [hl], a
2018-06-24 07:09:41 -07:00
Functioncd763:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $18
jr nc, .asm_cd76e
inc [hl]
ret
.asm_cd76e
call BattleAnim_IncAnonJumptableIndex
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_29
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2018-06-24 07:09:41 -07:00
Functioncd776:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_11:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $38
jr c, .asm_cd784
call DeinitBattleAnimation
ret
.asm_cd784
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld l, [hl]
ld h, a
ld de, $80
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
xor $10
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_14:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncd7ab
dw Functioncd7d2
2018-06-24 07:09:41 -07:00
Functioncd7ab:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f0
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f
sla a
sla a
sla a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld [hl], $1
2018-06-24 07:09:41 -07:00
Functioncd7d2:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
and a
jr nz, .asm_cd7de
call DeinitBattleAnimation
ret
.asm_cd7de
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld d, [hl]
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
xor $1
ld [hl], a
ret z
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
dec [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_15:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncd81f
dw Functioncd817
dw Functioncd81f
dw Functioncd820
2018-06-24 07:09:41 -07:00
Functioncd817:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_35
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2018-06-24 07:09:41 -07:00
Functioncd81f:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
Functioncd820:
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_16:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncd835
dw Functioncd860
dw Functioncd88f
dw Functioncd88f
dw Functioncd88f
dw Functioncd88f
dw Functioncd893
2018-06-24 07:09:41 -07:00
Functioncd835:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
bit 7, [hl]
jr nz, .asm_cd852
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $10
jr .asm_cd858
.asm_cd852
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $30
.asm_cd858
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $7f
ld [hl], a
2018-06-24 07:09:41 -07:00
Functioncd860:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld d, [hl]
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
bit 7, a
2016-05-05 12:07:37 -07:00
jr nz, .load_no_inc
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
inc a
2016-05-05 12:07:37 -07:00
jr .reinit
2015-12-23 14:10:50 -08:00
2016-05-05 12:07:37 -07:00
.load_no_inc
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
2016-05-05 12:07:37 -07:00
.reinit
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $1f
ret nz
2018-06-24 07:09:41 -07:00
Functioncd88f:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ret
2018-06-24 07:09:41 -07:00
Functioncd893:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], $1
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_17:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncd8ab
dw Functioncd8cc
dw Functioncd8f5
dw Functioncd8f5
dw Functioncd8f5
dw Functioncd8f5
dw Functioncd8f9
2018-06-24 07:09:41 -07:00
Functioncd8ab:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
bit 7, [hl]
jr nz, .asm_cd8be
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $10
jr .asm_cd8c4
.asm_cd8be
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $30
.asm_cd8c4
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $7f
ld [hl], a
2018-06-24 07:09:41 -07:00
Functioncd8cc:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld d, [hl]
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
bit 7, a
jr nz, .asm_cd8e6
ld a, $3d
jr .asm_cd8e8
.asm_cd8e6
ld a, $3c
.asm_cd8e8
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
inc [hl]
ld a, [hl]
and $1f
ret nz
2018-06-24 07:09:41 -07:00
Functioncd8f5:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ret
2018-06-24 07:09:41 -07:00
Functioncd8f9:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], $1
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_18:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncd907
dw Functioncd913
2018-06-24 07:09:41 -07:00
Functioncd907:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $28
inc hl
ld [hl], $0
2018-06-24 07:09:41 -07:00
Functioncd913:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld d, [hl]
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_cd950
ld d, a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld e, [hl]
ld hl, -$80
2015-12-23 14:10:50 -08:00
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], e
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], d
ret
.asm_cd950
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_19:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncd961
dw Functioncd96a
dw Functioncd96e
dw Functioncd96a
dw Functioncd97b
2018-06-24 07:09:41 -07:00
Functioncd961:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld [hl], $0
2018-06-24 07:09:41 -07:00
Functioncd96a:
2015-12-23 14:10:50 -08:00
call Functioncd99a
ret
2018-06-24 07:09:41 -07:00
Functioncd96e:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $88
jr c, asm_cd988
call BattleAnim_IncAnonJumptableIndex
ret
2018-06-24 07:09:41 -07:00
Functioncd97b:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $b8
jr c, asm_cd988
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
asm_cd988:
2015-12-23 14:10:50 -08:00
call Functioncd99a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
ld a, [hl]
and $1
ret nz
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
2018-06-24 07:09:41 -07:00
Functioncd99a:
2015-12-23 14:10:50 -08:00
call Functioncd9f4
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
add [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
sub $8
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and a
jr z, .asm_cd9d7
cp $c2
jr c, .asm_cd9e2
.asm_cd9d7
dec a
ld [hl], a
and $7
ret nz
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
inc [hl]
ret
.asm_cd9e2
xor a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hli], a
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functioncd9f4:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld e, [hl]
ld d, 0
ld hl, Unknown_cda01
add hl, de
ld d, [hl]
ret
2018-06-24 07:09:41 -07:00
Unknown_cda01:
2015-12-23 14:10:50 -08:00
db 8, 6, 5, 4, 5, 6, 8, 12, 16
2018-01-25 18:34:42 -08:00
2018-06-24 07:09:41 -07:00
BattleAnimFunction_1C:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $30
jr nc, .asm_cda17
call DeinitBattleAnimation
ret
.asm_cda17
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f
ld e, a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
sub e
ld [hl], a
srl e
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
.asm_cda2c
inc [hl]
dec e
jr nz, .asm_cda2c
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_1F:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncda4c
dw Functioncda3a
dw Functioncda4c
2018-06-24 07:09:41 -07:00
Functioncda3a:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld a, [hl]
inc a
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $8
2018-06-24 07:09:41 -07:00
Functioncda4c:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_LeechSeed:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2016-05-05 12:07:37 -07:00
dw .zero
dw .one
dw .two
dw .three
2018-06-24 07:09:41 -07:00
.zero:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], $40
ret
2018-06-24 07:09:41 -07:00
.one:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
cp $20
2016-05-05 12:07:37 -07:00
jr c, .sprout
2015-12-23 14:10:50 -08:00
call Functioncda8d
ret
2016-05-05 12:07:37 -07:00
.sprout
2015-12-23 14:10:50 -08:00
ld [hl], $40
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_57
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
2018-06-24 07:09:41 -07:00
.two:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
and a
2016-05-05 12:07:37 -07:00
jr z, .flutter
2015-12-23 14:10:50 -08:00
dec [hl]
ret
2016-05-05 12:07:37 -07:00
.flutter
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_58
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2018-06-24 07:09:41 -07:00
.three:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
Functioncda8d:
2015-12-23 14:10:50 -08:00
dec [hl]
ld d, $20
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_02
add hl, bc
ld a, [hl]
add $2
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld h, [hl]
ld a, h
and $f
swap a
ld l, a
ld a, h
and $f0
swap a
ld h, a
add hl, de
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
and $1
ret nz
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_3F:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncdadf
dw Functioncdae9
dw Functioncdaf9
2018-06-24 07:09:41 -07:00
Functioncdadf:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], $40
ret
2018-06-24 07:09:41 -07:00
Functioncdae9:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
cp $20
jr c, .asm_cdaf6
call Functioncda8d
ret
.asm_cdaf6
call BattleAnim_IncAnonJumptableIndex
2018-06-24 07:09:41 -07:00
Functioncdaf9:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_1A:
2015-12-23 14:10:50 -08:00
call BattleAnimFunction_03
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
add $f
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_1B:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncdb13
dw Functioncdb14
dw Functioncdb28
dw Functioncdb50
dw Functioncdb65
2018-06-24 07:09:41 -07:00
Functioncdb13:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
Functioncdb14:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_cdb24
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], $0
ret
.asm_cdb24
add $4
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functioncdb28:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $98
ret nc
inc [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
set 0, [hl]
ld hl, BATTLEANIMSTRUCT_02
add hl, bc
ld [hl], $90
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
ld [hl], $0
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], $2
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
2018-06-24 07:09:41 -07:00
Functioncdb50:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $2c
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
ld [hl], $0
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], $80
2018-06-24 07:09:41 -07:00
Functioncdb65:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $98
ret nc
inc [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
ld d, $8
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_1D:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncdb9f
dw Functioncdbb3
dw Functioncdbcf
dw Functioncdbeb
dw Functioncdc74
dw Functioncdc1a
dw Functioncdbc1
dw Functioncdc1e
dw Functioncdc27
dw Functioncdc39
dw Functioncdc74
dw Functioncdc48
dw Functioncdc57
dw Functioncdc74
2018-06-24 07:09:41 -07:00
Functioncdb9f:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $28
inc hl
ld [hl], $10
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functioncdbb3:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $40
jr nc, .asm_cdbbd
inc [hl]
.asm_cdbbd
call Functioncdc75
ret
2018-06-24 07:09:41 -07:00
Functioncdbc1:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $4b
jr nc, .asm_cdbcb
inc [hl]
.asm_cdbcb
call Functioncdc75
ret
2018-06-24 07:09:41 -07:00
Functioncdbcf:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $88
jr nc, .asm_cdbe6
and $f
jr nz, asm_cdbfa
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], $10
call BattleAnim_IncAnonJumptableIndex
ret
.asm_cdbe6
call BattleAnim_IncAnonJumptableIndex
inc [hl]
ret
2018-06-24 07:09:41 -07:00
Functioncdbeb:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
and a
jr z, .asm_cdbf5
dec [hl]
ret
.asm_cdbf5
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
dec [hl]
2018-06-24 07:09:41 -07:00
asm_cdbfa:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
ld hl, -$80
2015-12-23 14:10:50 -08:00
add hl, de
ld e, l
ld d, h
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
ret
2018-06-24 07:09:41 -07:00
Functioncdc1a:
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
Functioncdc1e:
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_4E
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
2018-06-24 07:09:41 -07:00
Functioncdc27:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
ld d, $2
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functioncdc39:
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_50
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], $4
call BattleAnim_IncAnonJumptableIndex
ret
2018-06-24 07:09:41 -07:00
Functioncdc48:
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_4F
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $40
ret
2018-06-24 07:09:41 -07:00
Functioncdc57:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $20
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_cdc71
dec [hl]
ret
.asm_cdc71
call BattleAnim_IncAnonJumptableIndex
2018-06-24 07:09:41 -07:00
Functioncdc74:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
Functioncdc75:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $3f
ret nz
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $20
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
sub $8
ld [hl], a
ret nz
xor a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hli], a
ld [hl], a
call BattleAnim_IncAnonJumptableIndex
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_1E:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
and a
jr z, .asm_cdcb6
cp $d8
jr nc, .asm_cdcb6
call DeinitBattleAnimation
ret
.asm_cdcb6
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld d, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
sub d
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_21:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncdcca
dw Functioncdced
2018-06-24 07:09:41 -07:00
Functioncdcca:
ldh a, [hBattleTurn]
2015-12-23 14:10:50 -08:00
and a
jr z, .asm_cdcd9
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
xor $ff
add $3
ld [hl], a
.asm_cdcd9
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $8
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_59
2015-12-23 14:10:50 -08:00
add [hl]
call ReinitBattleAnimFrameset
ret
2018-06-24 07:09:41 -07:00
Functioncdced:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_cdcfa
dec [hl]
call Functioncdcfe
ret
.asm_cdcfa
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
Functioncdcfe:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
inc [hl]
inc [hl]
ld d, $10
call BattleAnim_Sine
ld d, a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and a
jr z, .asm_cdd20
dec a
ret z
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ret
.asm_cdd20
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, d
xor $ff
inc a
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_22:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncdd31
dw Functioncdd4f
2018-06-24 07:09:41 -07:00
Functioncdd31:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $3f
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $80
rlca
ld [hl], a
2016-05-05 12:07:37 -07:00
add BATTLEANIMFRAMESET_5D
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
ret
2018-06-24 07:09:41 -07:00
Functioncdd4f:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
swap a
ld d, a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
inc [hl]
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $80
ret nc
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
and $3
jr nz, .asm_cdd87
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
.asm_cdd87
and $1
ret nz
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_23:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncdd97
dw Functioncddbc
2018-06-24 07:09:41 -07:00
Functioncdd97:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $80
rlca
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
add [hl]
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $7f
ld [hl], a
2018-06-24 07:09:41 -07:00
Functioncddbc:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld d, $10
push af
push de
call BattleAnim_Sine
sra a
sra a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
inc [hl]
and $3f
jr z, .asm_cddf0
and $1f
ret nz
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc a
jr .asm_cddf5
.asm_cddf0
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
.asm_cddf5
call ReinitBattleAnimFrameset
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_24:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncde02
dw Functioncde20
dw Functioncde21
2018-06-24 07:09:41 -07:00
Functioncde02:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
2016-05-05 12:07:37 -07:00
add BATTLEANIMFRAMESET_63
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Unknown_cde25
add hl, de
ld a, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
2018-06-24 07:09:41 -07:00
Functioncde20:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
Functioncde21:
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
Unknown_cde25:
2015-12-23 14:10:50 -08:00
db $ec, $f8, $00
2018-01-25 18:34:42 -08:00
2018-06-24 07:09:41 -07:00
BattleAnimFunction_25:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
ld d, $4
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld e, [hl]
ld hl, $ffa0
add hl, de
ld e, l
ld d, h
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], e
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_26:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
dec [hl]
ld d, $10
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_27:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncde72
dw Functioncde88
2018-06-24 07:09:41 -07:00
Functioncde72:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and a
jr nz, .asm_cde83
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
set 6, [hl]
.asm_cde83
2016-05-05 12:07:37 -07:00
add BATTLEANIMFRAMESET_6A
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2018-06-24 07:09:41 -07:00
Functioncde88:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_28:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncde90
dw Functioncdebf
2018-06-24 07:09:41 -07:00
Functioncde90:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld e, [hl]
ld a, e
and $70
swap a
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, e
and $80
jr nz, .asm_cdeb2
ld a, e
and $f
ld [hl], a
ret
.asm_cdeb2
ld a, e
and $f
xor $ff
inc a
ld [hl], a
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_6E
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
ret
2018-06-24 07:09:41 -07:00
Functioncdebf:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_cdec9
dec [hl]
ret
.asm_cdec9
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
xor $ff
inc a
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_SpiralDescent:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
add [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $7
ret nz
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
cp $28
2016-05-05 12:07:37 -07:00
jr nc, .delete
2015-12-23 14:10:50 -08:00
inc [hl]
ret
2016-05-05 12:07:37 -07:00
.delete
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_2D:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
add [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $3
ret nz
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
cp $28
jr nc, .asm_cdf55
inc [hl]
ret
.asm_cdf55
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_PoisonGas:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functioncdf60
2016-05-05 12:07:37 -07:00
dw BattleAnimFunction_SpiralDescent
2018-06-24 07:09:41 -07:00
Functioncdf60:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $84
2016-05-05 12:07:37 -07:00
jr nc, .next
2015-12-23 14:10:50 -08:00
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
ld d, $18
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
and $1
ret nz
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
2016-05-05 12:07:37 -07:00
.next
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_34:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
add [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
inc [hl]
inc [hl]
ld a, [hl]
and $7
ret nz
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
cp $e8
jr z, .asm_cdfc7
dec [hl]
ret
.asm_cdfc7
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_3C:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
add [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
inc [hl]
inc [hl]
ld a, [hl]
and $3
ret nz
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
cp $d0
jr z, .asm_ce007
dec [hl]
dec [hl]
ret
.asm_ce007
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_35:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce014
dw Functionce023
dw Functionce05f
2018-06-24 07:09:41 -07:00
Functionce014:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $34
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], $10
2018-06-24 07:09:41 -07:00
Functionce023:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $6c
jr c, .asm_ce02d
ret
.asm_ce02d
ld a, $2
call Functionce70a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld d, [hl]
call BattleAnim_Sine
bit 7, a
jr nz, .asm_ce046
xor $ff
inc a
.asm_ce046
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
sub $4
ld [hl], a
and $1f
cp $20
ret nz
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
srl [hl]
ret
2018-06-24 07:09:41 -07:00
Functionce05f:
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_Horn:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2016-05-05 12:07:37 -07:00
dw .zero
dw .one
dw .two
2015-12-23 14:10:50 -08:00
dw Functionce09e
2018-06-24 07:09:41 -07:00
.zero:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
.one:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $58
ret nc
ld a, $2
call Functionce70a
ret
2018-06-24 07:09:41 -07:00
.two:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
cp $20
jr c, Functionce09e
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
Functionce09e:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
ld d, $8
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
sra a
xor $ff
inc a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
add [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
add $8
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_2C:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce0ce
dw Functionce0f8
dw Functionce0dd
2018-06-24 07:09:41 -07:00
Functionce0ce:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f0
swap a
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functionce0dd:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
bit 7, a
jr z, .asm_ce0f0
ld [hl], a
.asm_ce0f0
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
sub $4
ld [hl], a
2018-06-24 07:09:41 -07:00
Functionce0f8:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $84
jr c, .asm_ce105
call DeinitBattleAnimation
ret
.asm_ce105
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
call Functionce70a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_2E:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce115
dw Functionce12a
2018-06-24 07:09:41 -07:00
Functionce115:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $28
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
sub $28
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], a
2018-06-24 07:09:41 -07:00
Functionce12a:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hli]
ld d, [hl]
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
and [hl]
jr nz, .asm_ce149
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
.asm_ce149
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
inc [hl]
ld a, [hl]
and $3f
ret nz
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $20
inc hl
srl [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_2F:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld d, [hl]
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
inc [hl]
ld a, [hl]
and $1
jr nz, .asm_ce189
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
.asm_ce189
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $3
jr nz, .asm_ce197
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
.asm_ce197
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
cp $5a
jr nc, .asm_ce1aa
ld a, [hl]
and a
jr z, .asm_ce1ac
dec [hl]
ret
.asm_ce1aa
inc [hl]
ret
.asm_ce1ac
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_42:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld d, [hl]
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
cp $40
jr nc, .asm_ce1df
inc [hl]
ret
.asm_ce1df
ld a, [hl]
dec [hl]
and a
ret nz
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_30:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce1ee
dw Functionce1fb
2018-06-24 07:09:41 -07:00
Functionce1ee:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], a
2018-06-24 07:09:41 -07:00
Functionce1fb:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld d, $30
call BattleAnim_Sine
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
add [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
add $8
ld d, $30
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
inc [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_31:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce22d
dw Functionce254
2018-06-24 07:09:41 -07:00
Functionce22d:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld d, $10
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld [hl], $f
2018-06-24 07:09:41 -07:00
Functionce254:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_32:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce260
dw Functionce274
dw Functionce278
dw Functionce289
2018-06-24 07:09:41 -07:00
Functionce260:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ldh a, [hBattleTurn]
2015-12-23 14:10:50 -08:00
and a
jr nz, .asm_ce26c
ld a, $f0
jr .asm_ce26e
.asm_ce26c
ld a, $cc
.asm_ce26e
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functionce274:
2015-12-23 14:10:50 -08:00
call Functionce29f
ret
2018-06-24 07:09:41 -07:00
Functionce278:
2015-12-23 14:10:50 -08:00
call Functionce29f
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $84
ret nc
ld a, $4
call Functionce70a
ret
2018-06-24 07:09:41 -07:00
Functionce289:
2015-12-23 14:10:50 -08:00
call Functionce29f
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $d0
jr nc, .asm_ce29b
ld a, $4
call Functionce70a
ret
.asm_ce29b
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
Functionce29f:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
and $7
inc [hl]
srl a
ld e, a
ld d, $0
ldh a, [hSGB]
2015-12-23 14:10:50 -08:00
and a
jr nz, .asm_ce2b6
ld hl, Unknown_ce2c4
jr .asm_ce2b9
.asm_ce2b6
ld hl, Unknown_ce2c8
.asm_ce2b9
add hl, de
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
and [hl]
ld [wOBP0], a
ret
2018-06-24 07:09:41 -07:00
Unknown_ce2c4:
2015-12-23 14:10:50 -08:00
db $ff, $aa, $55, $aa
2018-06-24 07:09:41 -07:00
Unknown_ce2c8:
2015-12-23 14:10:50 -08:00
db $ff, $ff, $00, $00
2018-01-25 18:34:42 -08:00
2018-06-24 07:09:41 -07:00
BattleAnimFunction_33:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld d, $18
call BattleAnim_Sine
sra a
sra a
sra a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
add [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
inc [hl]
ld d, $18
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
dec [hl]
dec [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_36:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce306
dw Functionce330
dw Functionce34c
2018-06-24 07:09:41 -07:00
Functionce306:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $e0
jr nz, .asm_ce319
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $2
ret
.asm_ce319
ld d, a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
ld hl, -$80
2015-12-23 14:10:50 -08:00
add hl, de
ld e, l
ld d, h
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
ret
2018-06-24 07:09:41 -07:00
Functionce330:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
and a
jr z, .asm_ce33a
dec [hl]
ret
.asm_ce33a
ld [hl], $4
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
xor $ff
inc a
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
add [hl]
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functionce34c:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $84
jr nc, .asm_ce35b
ld a, $4
call Functionce70a
ret
.asm_ce35b
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_37:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce366
dw Functionce375
2018-06-24 07:09:41 -07:00
Functionce366:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $7f
2016-05-05 12:07:37 -07:00
add BATTLEANIMFRAMESET_81
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2018-06-24 07:09:41 -07:00
Functionce375:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
bit 7, [hl]
jr nz, .asm_ce383
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
ret
.asm_ce383
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_38:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce392
dw Functionce39c
dw Functionce3ae
2018-06-24 07:09:41 -07:00
Functionce392:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $c
ret
2018-06-24 07:09:41 -07:00
Functionce39c:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_ce3a6
dec [hl]
ret
.asm_ce3a6
call BattleAnim_IncAnonJumptableIndex
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_20
2015-12-23 14:10:50 -08:00
call ReinitBattleAnimFrameset
2018-06-24 07:09:41 -07:00
Functionce3ae:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_39:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
push af
ld d, $2
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop af
ld d, $8
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_3A:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $20
jr c, .asm_ce3df
call DeinitBattleAnimation
ret
.asm_ce3df
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld d, $8
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
add $2
ld [hl], a
and $7
ret nz
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_3B:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce406
dw Functionce412
2018-06-24 07:09:41 -07:00
Functionce406:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
add [hl]
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functionce412:
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_3D:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld d, $18
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
sra a
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
inc [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_3E:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce443
dw Functionce465
dw Functionce490
2018-06-24 07:09:41 -07:00
Functionce443:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $28
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
add [hl]
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and $f0
or $8
ld [hl], a
2018-06-24 07:09:41 -07:00
Functionce465:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and a
jr z, .asm_ce48b
dec [hl]
add $8
ld d, a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
.asm_ce48b
ld [hl], $10
call BattleAnim_IncAnonJumptableIndex
2018-06-24 07:09:41 -07:00
Functionce490:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
and a
ret nz
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_40:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce4a3
dw Functionce4b0
2018-06-24 07:09:41 -07:00
Functionce4a3:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
2016-05-05 12:07:37 -07:00
ld a, BATTLEANIMFRAMESET_24
2015-12-23 14:10:50 -08:00
add [hl]
call ReinitBattleAnimFrameset
2018-06-24 07:09:41 -07:00
Functionce4b0:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $38
jr nc, .asm_ce4d8
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
ld d, $18
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
and $1
ret nz
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
ret
.asm_ce4d8
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_41:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and a
ret z
ld d, a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
inc [hl]
call BattleAnim_Sine
bit 7, a
jr nz, .asm_ce4f4
xor $ff
inc a
.asm_ce4f4
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
and $1f
ret nz
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
srl [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_43:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $10
jr nc, .asm_ce52e
inc [hl]
inc [hl]
ld d, a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
.asm_ce52e
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_44:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld e, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld d, [hl]
ld a, e
and $c0
rlca
rlca
add [hl]
ld [hl], a
ld a, e
and $3f
push af
push de
call BattleAnim_Sine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_45:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce564
dw Functionce56e
dw Functionce577
2018-06-24 07:09:41 -07:00
Functionce564:
2015-12-23 14:10:50 -08:00
ld d, $18
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
inc [hl]
jr asm_ce58f
2018-06-24 07:09:41 -07:00
Functionce56e:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $18
2018-06-24 07:09:41 -07:00
Functionce577:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $80
jr nc, .asm_ce58b
ld d, a
add $8
ld [hl], a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
jr asm_ce58f
.asm_ce58b
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
asm_ce58f:
2015-12-23 14:10:50 -08:00
call Functionce6f1
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_46:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce5b3
dw Functionce59a
2018-06-24 07:09:41 -07:00
Functionce59a:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_ce5b0
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
dec [hl]
dec [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
inc [hl]
ret
.asm_ce5b0
call DeinitBattleAnimation
2018-06-24 07:09:41 -07:00
Functionce5b3:
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_47:
2015-12-23 14:10:50 -08:00
ld d, $50
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
push af
push de
call BattleAnim_Sine
sra a
sra a
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
add [hl]
inc [hl]
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_48:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $d0
2016-05-05 12:07:37 -07:00
jr z, .disappear
dec [hl]
dec [hl]
dec [hl]
2015-12-23 14:10:50 -08:00
dec [hl]
ret
2016-05-05 12:07:37 -07:00
.disappear
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_49:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce5f9
dw Functionce60a
dw Functionce622
dw Functionce618
2018-06-24 07:09:41 -07:00
Functionce5f9:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
and a
jr nz, asm_ce61c
call BattleAnim_IncAnonJumptableIndex
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], $ec
2018-06-24 07:09:41 -07:00
Functionce60a:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $4
jr z, Functionce618
inc [hl]
2016-05-05 12:07:37 -07:00
inc [hl]
inc [hl]
inc [hl]
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
Functionce618:
2015-12-23 14:10:50 -08:00
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
asm_ce61c:
2015-12-23 14:10:50 -08:00
call BattleAnim_IncAnonJumptableIndex
call BattleAnim_IncAnonJumptableIndex
2018-06-24 07:09:41 -07:00
Functionce622:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
cp $d8
ret z
dec [hl]
2016-05-05 12:07:37 -07:00
dec [hl]
dec [hl]
dec [hl]
2015-12-23 14:10:50 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_4A:
2015-12-23 14:10:50 -08:00
call BattleAnim_AnonJumptable
2015-12-26 18:59:03 -08:00
.anon_dw
2015-12-23 14:10:50 -08:00
dw Functionce63a
dw Functionce648
dw Functionce65c
dw Functionce672
2018-06-24 07:09:41 -07:00
Functionce63a:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld [hl], a
call BattleAnim_IncAnonJumptableIndex
ret
2018-06-24 07:09:41 -07:00
Functionce648:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
add $4
cp $70
jr c, .asm_ce654
xor a
.asm_ce654
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
inc [hl]
inc [hl]
ret
2018-06-24 07:09:41 -07:00
Functionce65c:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
add $4
cp $70
jr c, .asm_ce668
xor a
.asm_ce668
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
add $8
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functionce672:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
add $4
cp $70
jr c, .asm_ce67e
xor a
.asm_ce67e
ld [hl], a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld a, [hl]
add $4
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_4B:
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
ld l, a
and $f0
ld h, a
swap a
or h
ld h, a
ld a, l
and $f
swap a
ld l, a
add hl, de
ld e, l
ld d, h
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], d
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], e
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_4C:
2015-12-23 14:10:50 -08:00
ld d, $18
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
inc [hl]
call Functionce6f1
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_4F:
2015-12-23 14:10:50 -08:00
ld d, $18
ld hl, BATTLEANIMSTRUCT_10
2015-12-23 19:51:50 -08:00
add hl, bc
2015-12-23 14:10:50 -08:00
ld a, [hl]
inc [hl]
srl a
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
add [hl]
call Functionce6f1
ret
2018-06-24 07:09:41 -07:00
BattleAnimFunction_4D:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
cp $20
jr nc, .asm_ce6ed
inc [hl]
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld d, [hl]
call BattleAnim_Sine
xor $ff
inc a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
.asm_ce6ed
call DeinitBattleAnimation
ret
2018-06-24 07:09:41 -07:00
Functionce6f1:
2015-12-23 14:10:50 -08:00
push af
push de
call BattleAnim_Sine
sra a
sra a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
pop de
pop af
call BattleAnim_Cosine
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XOFFSET
2015-12-23 14:10:50 -08:00
add hl, bc
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Functionce70a:
2015-12-23 14:10:50 -08:00
and $f
ld e, a
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_XCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
add [hl]
ld [hl], a
srl e
2015-12-23 19:51:50 -08:00
ld hl, BATTLEANIMSTRUCT_YCOORD
2015-12-23 14:10:50 -08:00
add hl, bc
.asm_ce719
dec [hl]
dec e
jr nz, .asm_ce719
ret
2018-06-24 07:09:41 -07:00
BattleAnim_AnonJumptable:
2015-12-23 14:10:50 -08:00
pop de
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
ld l, [hl]
ld h, $0
add hl, hl
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
2015-12-23 14:10:50 -08:00
2018-06-24 07:09:41 -07:00
BattleAnim_IncAnonJumptableIndex:
2015-12-23 14:10:50 -08:00
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
inc [hl]
ret
2018-06-24 07:09:41 -07:00
BattleAnim_Cosine:
2018-01-09 13:39:36 -08:00
; a = d * cos(a * pi/32)
add %010000 ; cos(x) = sin(x + pi/2)
; fallthrough
2018-06-24 07:09:41 -07:00
BattleAnim_Sine:
2018-01-09 13:39:36 -08:00
; a = d * sin(a * pi/32)
calc_sine_wave BattleAnimSineWave
2015-12-23 14:10:50 -08:00
2018-06-24 07:09:41 -07:00
BattleAnim_Sine_e:
2015-12-23 14:10:50 -08:00
ld a, e
call BattleAnim_Sine
ld e, a
ret
2018-06-24 07:09:41 -07:00
BattleAnim_Cosine_e:
2015-12-23 14:10:50 -08:00
ld a, e
call BattleAnim_Cosine
ld e, a
ret
2018-06-24 07:09:41 -07:00
BattleAnim_AbsSinePrecise:
2015-12-23 14:10:50 -08:00
ld a, e
call BattleAnim_Sine
ld e, l
ld d, h
ret
2018-06-24 07:09:41 -07:00
BattleAnim_AbsCosinePrecise:
2015-12-23 14:10:50 -08:00
ld a, e
call BattleAnim_Cosine
ld e, l
ld d, h
ret
2018-06-24 07:09:41 -07:00
BattleAnimSineWave:
sine_table 32