2018-06-24 14:09:41 +00:00
|
|
|
ReinitBattleAnimFrameset:
|
2015-12-24 19:07:33 +00:00
|
|
|
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ld hl, BATTLEANIMSTRUCT_DURATION
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], 0
|
|
|
|
ld hl, BATTLEANIMSTRUCT_FRAME
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], -1
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetBattleAnimFrame:
|
2015-12-24 19:07:33 +00:00
|
|
|
.loop
|
|
|
|
ld hl, BATTLEANIMSTRUCT_DURATION
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .next_frame
|
|
|
|
dec [hl]
|
|
|
|
call .GetPointer
|
|
|
|
ld a, [hli]
|
|
|
|
push af
|
|
|
|
jr .okay
|
|
|
|
|
|
|
|
.next_frame
|
|
|
|
ld hl, BATTLEANIMSTRUCT_FRAME
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
call .GetPointer
|
|
|
|
ld a, [hli]
|
2022-06-23 01:07:46 +00:00
|
|
|
cp oamrestart_command
|
2015-12-24 19:07:33 +00:00
|
|
|
jr z, .restart
|
2022-06-23 01:07:46 +00:00
|
|
|
cp oamend_command
|
2015-12-24 19:07:33 +00:00
|
|
|
jr z, .repeat_last
|
2017-12-27 00:27:56 +00:00
|
|
|
|
2015-12-24 19:07:33 +00:00
|
|
|
push af
|
|
|
|
ld a, [hl]
|
|
|
|
push hl
|
2021-11-24 01:37:18 +00:00
|
|
|
and ~(Y_FLIP << 1 | X_FLIP << 1)
|
2015-12-24 19:07:33 +00:00
|
|
|
ld hl, BATTLEANIMSTRUCT_DURATION
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
|
|
|
.okay
|
|
|
|
ld a, [hl]
|
2022-06-23 01:07:46 +00:00
|
|
|
and Y_FLIP << 1 | X_FLIP << 1 ; The << 1 is compensated in the "oamframe" macro
|
2015-12-24 19:07:33 +00:00
|
|
|
srl a
|
2019-02-15 01:56:24 +00:00
|
|
|
ld [wBattleAnimTempFrameOAMFlags], a
|
2015-12-24 19:07:33 +00:00
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
|
|
|
|
.repeat_last
|
|
|
|
xor a
|
|
|
|
ld hl, BATTLEANIMSTRUCT_DURATION
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
2019-02-16 18:08:34 +00:00
|
|
|
|
2015-12-24 19:07:33 +00:00
|
|
|
ld hl, BATTLEANIMSTRUCT_FRAME
|
|
|
|
add hl, bc
|
|
|
|
dec [hl]
|
|
|
|
dec [hl]
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.restart
|
|
|
|
xor a
|
|
|
|
ld hl, BATTLEANIMSTRUCT_DURATION
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
2020-10-30 21:32:09 +00:00
|
|
|
|
2015-12-24 19:07:33 +00:00
|
|
|
dec a
|
|
|
|
ld hl, BATTLEANIMSTRUCT_FRAME
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
jr .loop
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.GetPointer:
|
2015-12-24 19:07:33 +00:00
|
|
|
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
|
|
|
|
add hl, bc
|
|
|
|
ld e, [hl]
|
|
|
|
ld d, 0
|
|
|
|
ld hl, BattleAnimFrameData
|
|
|
|
add hl, de
|
|
|
|
add hl, de
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
ld hl, BATTLEANIMSTRUCT_FRAME
|
|
|
|
add hl, bc
|
|
|
|
ld l, [hl]
|
2020-10-30 21:32:09 +00:00
|
|
|
ld h, 0
|
2015-12-24 19:07:33 +00:00
|
|
|
add hl, hl
|
|
|
|
add hl, de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetBattleAnimOAMPointer:
|
2015-12-24 19:07:33 +00:00
|
|
|
ld l, a
|
|
|
|
ld h, 0
|
|
|
|
ld de, BattleAnimOAMData
|
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
|
|
|
add hl, de
|
|
|
|
ret
|
|
|
|
|
2018-11-25 22:57:38 +00:00
|
|
|
LoadBattleAnimGFX:
|
2015-12-24 19:07:33 +00:00
|
|
|
push hl
|
|
|
|
ld l, a
|
|
|
|
ld h, 0
|
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
|
|
|
ld de, AnimObjGFX
|
|
|
|
add hl, de
|
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
pop de
|
|
|
|
push bc
|
|
|
|
call DecompressRequest2bpp
|
|
|
|
pop bc
|
|
|
|
ret
|
2020-10-30 21:32:09 +00:00
|
|
|
|
|
|
|
INCLUDE "data/battle_anims/framesets.asm"
|
|
|
|
|
|
|
|
INCLUDE "data/battle_anims/oam.asm"
|
|
|
|
|
|
|
|
INCLUDE "data/battle_anims/object_gfx.asm"
|