2013-12-17 20:54:25 -08:00
|
|
|
; Battle animation command interpreter.
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlayBattleAnim:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, BANK(wActiveAnimObjects)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
call _PlayBattleAnim
|
|
|
|
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
_PlayBattleAnim:
|
2013-12-17 20:54:25 -08:00
|
|
|
ld c, 6
|
|
|
|
.wait
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
dec c
|
|
|
|
jr nz, .wait
|
|
|
|
|
|
|
|
call BattleAnimAssignPals
|
|
|
|
call BattleAnimRequestPals
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
|
|
|
|
ld c, 1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rKEY1]
|
2013-12-17 20:54:25 -08:00
|
|
|
bit 7, a
|
|
|
|
jr nz, .asm_cc0ff
|
|
|
|
ld c, 3
|
|
|
|
|
|
|
|
.asm_cc0ff
|
2015-01-19 21:31:29 -08:00
|
|
|
ld hl, hVBlank
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
|
|
|
|
ld [hl], c
|
2015-11-09 13:41:09 -08:00
|
|
|
call BattleAnimRunScript
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hVBlank], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, 1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call WaitSFX
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimRunScript:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wFXAnimID + 1]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
2015-11-09 13:41:09 -08:00
|
|
|
jr nz, .hi_byte
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall CheckBattleScene
|
2015-11-09 13:41:09 -08:00
|
|
|
jr c, .disabled
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
call BattleAnimClearHud
|
2015-11-09 13:41:09 -08:00
|
|
|
call RunBattleAnimScript
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
call BattleAnimAssignPals
|
|
|
|
call BattleAnimRequestPals
|
|
|
|
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hSCX], a
|
|
|
|
ldh [hSCY], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call BattleAnimRestoreHuds
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.disabled
|
2015-12-23 11:00:29 -08:00
|
|
|
ld a, [wNumHits]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
2015-11-09 13:41:09 -08:00
|
|
|
jr z, .done
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
ld l, a
|
|
|
|
ld h, 0
|
2015-11-09 13:41:09 -08:00
|
|
|
ld de, ANIM_MISS
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, l
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wFXAnimID], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, h
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wFXAnimID + 1], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.hi_byte
|
2013-12-17 20:54:25 -08:00
|
|
|
call WaitSFX
|
2015-12-23 11:00:29 -08:00
|
|
|
call PlayHitSound
|
2015-11-09 13:41:09 -08:00
|
|
|
call RunBattleAnimScript
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.done
|
2015-12-23 17:46:23 -08:00
|
|
|
call BattleAnim_RevertPals
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RunBattleAnimScript:
|
2015-12-23 17:46:23 -08:00
|
|
|
call ClearBattleAnims
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
.playframe
|
2015-12-23 14:10:50 -08:00
|
|
|
call RunBattleAnimCommand
|
2015-12-04 11:33:29 -08:00
|
|
|
call _ExecuteBGEffects
|
2015-12-23 14:10:50 -08:00
|
|
|
call BattleAnim_UpdateOAM_All
|
2016-05-10 09:31:49 -07:00
|
|
|
call PushLYOverrides
|
2013-12-17 20:54:25 -08:00
|
|
|
call BattleAnimRequestPals
|
|
|
|
|
|
|
|
; Speed up Rollout's animation.
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wFXAnimID + 1]
|
2013-12-17 20:54:25 -08:00
|
|
|
or a
|
2015-12-23 17:46:23 -08:00
|
|
|
jr nz, .not_rollout
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wFXAnimID]
|
2013-12-17 20:54:25 -08:00
|
|
|
cp ROLLOUT
|
2015-12-23 17:46:23 -08:00
|
|
|
jr nz, .not_rollout
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2019-02-15 16:33:40 -08:00
|
|
|
ld a, ANIM_BG_2E
|
|
|
|
ld b, NUM_BG_EFFECTS
|
|
|
|
ld de, BG_EFFECT_STRUCT_LENGTH
|
|
|
|
ld hl, wBGEffect1Function
|
2015-12-23 17:46:23 -08:00
|
|
|
.find
|
2013-12-17 20:54:25 -08:00
|
|
|
cp [hl]
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .done
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, de
|
|
|
|
dec b
|
2015-12-23 17:46:23 -08:00
|
|
|
jr nz, .find
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
.not_rollout
|
2013-12-17 20:54:25 -08:00
|
|
|
call BattleAnimDelayFrame
|
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
.done
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleAnimFlags]
|
2019-02-16 03:55:15 -08:00
|
|
|
bit BATTLEANIM_STOP_F, a
|
2013-12-17 20:54:25 -08:00
|
|
|
jr z, .playframe
|
|
|
|
|
2019-02-16 03:55:15 -08:00
|
|
|
call BattleAnim_ClearOAM
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimClearHud:
|
2013-12-17 20:54:25 -08:00
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call WaitTop
|
|
|
|
call ClearActorHud
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call WaitTop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimRestoreHuds:
|
2013-12-17 20:54:25 -08:00
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call WaitTop
|
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2020-02-28 08:51:42 -08:00
|
|
|
ld a, BANK(wCurBattleMon) ; aka BANK(wTempMon), BANK(wPartyMon1), and several others
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2020-06-16 16:32:36 -07:00
|
|
|
; this block should just be "call UpdateBattleHuds"
|
2013-12-17 20:54:25 -08:00
|
|
|
ld hl, UpdateBattleHuds
|
2018-01-16 11:30:10 -08:00
|
|
|
ld a, BANK(UpdatePlayerHUD)
|
2020-06-16 16:32:36 -07:00
|
|
|
rst FarCall
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
call WaitTop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimRequestPals:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hCGB]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rBGP]
|
2013-12-17 20:54:25 -08:00
|
|
|
ld b, a
|
2015-12-23 11:00:29 -08:00
|
|
|
ld a, [wBGP]
|
2013-12-17 20:54:25 -08:00
|
|
|
cp b
|
2015-12-23 17:46:23 -08:00
|
|
|
call nz, BattleAnim_SetBGPals
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rOBP0]
|
2013-12-17 20:54:25 -08:00
|
|
|
ld b, a
|
2015-12-23 11:00:29 -08:00
|
|
|
ld a, [wOBP0]
|
2013-12-17 20:54:25 -08:00
|
|
|
cp b
|
2015-12-23 17:46:23 -08:00
|
|
|
call nz, BattleAnim_SetOBPals
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimDelayFrame:
|
2013-12-17 20:54:25 -08:00
|
|
|
; Like DelayFrame but wastes battery life.
|
|
|
|
|
|
|
|
ld a, 1
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wVBlankOccurred], a
|
2013-12-17 20:54:25 -08:00
|
|
|
.wait
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wVBlankOccurred]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr nz, .wait
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ClearActorHud:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr z, .player
|
|
|
|
|
|
|
|
hlcoord 1, 0
|
|
|
|
lb bc, 4, 10
|
|
|
|
call ClearBox
|
|
|
|
ret
|
|
|
|
|
|
|
|
.player
|
|
|
|
hlcoord 9, 7
|
|
|
|
lb bc, 5, 11
|
|
|
|
call ClearBox
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Unreferenced_Functioncc220:
|
2014-05-05 13:27:48 -07:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2017-12-28 04:32:33 -08:00
|
|
|
ld a, LOW(vBGMap0 tile $28)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapAddress], a
|
2017-12-28 04:32:33 -08:00
|
|
|
ld a, HIGH(vBGMap0 tile $28)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapAddress + 1], a
|
2015-12-11 13:59:40 -08:00
|
|
|
call WaitBGMap2
|
2014-05-05 13:27:48 -07:00
|
|
|
ld a, $60
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hWY], a
|
2017-12-28 04:32:33 -08:00
|
|
|
xor a ; LOW(vBGMap0)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapAddress], a
|
2017-12-28 04:32:33 -08:00
|
|
|
ld a, HIGH(vBGMap0)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapAddress + 1], a
|
2014-05-05 13:27:48 -07:00
|
|
|
call BattleAnimDelayFrame
|
|
|
|
ret
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2019-02-16 03:55:15 -08:00
|
|
|
BattleAnim_ClearOAM:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleAnimFlags]
|
2019-02-16 03:55:15 -08:00
|
|
|
bit BATTLEANIM_KEEPSPRITES_F, a
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .delete
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2020-03-21 10:07:18 -07:00
|
|
|
; Instead of deleting the sprites, make them all use PAL_BATTLE_OB_ENEMY
|
2018-01-30 11:52:46 -08:00
|
|
|
ld hl, wVirtualOAMSprite00Attributes
|
2018-01-10 10:47:57 -08:00
|
|
|
ld c, NUM_SPRITE_OAM_STRUCTS
|
2015-11-09 13:41:09 -08:00
|
|
|
.loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, [hl]
|
2020-03-21 10:07:18 -07:00
|
|
|
and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; PAL_BATTLE_OB_ENEMY (0)
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hli], a
|
2020-03-21 11:01:05 -07:00
|
|
|
rept SPRITEOAMSTRUCT_LENGTH - 1
|
2013-12-17 20:54:25 -08:00
|
|
|
inc hl
|
2018-01-10 10:47:57 -08:00
|
|
|
endr
|
2013-12-17 20:54:25 -08:00
|
|
|
dec c
|
2015-11-09 13:41:09 -08:00
|
|
|
jr nz, .loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
.delete
|
2018-01-23 13:45:34 -08:00
|
|
|
ld hl, wVirtualOAM
|
2018-01-30 11:55:20 -08:00
|
|
|
ld c, wVirtualOAMEnd - wVirtualOAM
|
2013-12-17 20:54:25 -08:00
|
|
|
xor a
|
2015-11-09 13:41:09 -08:00
|
|
|
.loop2
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-11-09 13:41:09 -08:00
|
|
|
jr nz, .loop2
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RunBattleAnimCommand:
|
2015-11-09 13:41:09 -08:00
|
|
|
call .CheckTimer
|
2013-12-17 20:54:25 -08:00
|
|
|
ret nc
|
2015-11-09 13:41:09 -08:00
|
|
|
call .RunScript
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CheckTimer:
|
2019-02-14 17:56:24 -08:00
|
|
|
ld a, [wBattleAnimDelay]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
2015-11-09 13:41:09 -08:00
|
|
|
jr z, .done
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
dec a
|
2019-02-14 17:56:24 -08:00
|
|
|
ld [wBattleAnimDelay], a
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.done
|
2013-12-17 20:54:25 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.RunScript:
|
2015-11-09 13:41:09 -08:00
|
|
|
.loop
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
|
|
|
|
2018-07-15 02:56:57 -07:00
|
|
|
cp anim_ret_command
|
2015-11-09 13:41:09 -08:00
|
|
|
jr nz, .not_done_with_anim
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
; Return from a subroutine.
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimFlags
|
2019-02-16 03:55:15 -08:00
|
|
|
bit BATTLEANIM_IN_SUBROUTINE_F, [hl]
|
2015-11-09 13:41:09 -08:00
|
|
|
jr nz, .do_anim
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2019-02-16 03:55:15 -08:00
|
|
|
set BATTLEANIM_STOP_F, [hl]
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.not_done_with_anim
|
2019-02-14 17:56:24 -08:00
|
|
|
cp anim_obj_command
|
2015-11-09 13:41:09 -08:00
|
|
|
jr nc, .do_anim
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2019-02-14 17:56:24 -08:00
|
|
|
ld [wBattleAnimDelay], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.do_anim
|
|
|
|
call .DoCommand
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
jr .loop
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.DoCommand:
|
2018-01-23 14:39:09 -08:00
|
|
|
; Execute battle animation command in [wBattleAnimByte].
|
|
|
|
ld a, [wBattleAnimByte]
|
2019-02-14 17:56:24 -08:00
|
|
|
sub anim_obj_command
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, BattleAnimCommands
|
|
|
|
add hl, de
|
2015-12-23 17:46:23 -08:00
|
|
|
add hl, de
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCommands::
|
2017-12-26 15:45:04 -08:00
|
|
|
; entries correspond to macros/scripts/battle_anims.asm enumeration
|
2015-11-10 13:53:37 -08:00
|
|
|
dw BattleAnimCmd_Obj
|
|
|
|
dw BattleAnimCmd_1GFX
|
|
|
|
dw BattleAnimCmd_2GFX
|
|
|
|
dw BattleAnimCmd_3GFX
|
|
|
|
dw BattleAnimCmd_4GFX
|
|
|
|
dw BattleAnimCmd_5GFX
|
|
|
|
dw BattleAnimCmd_IncObj
|
|
|
|
dw BattleAnimCmd_SetObj
|
|
|
|
dw BattleAnimCmd_IncBGEffect
|
2018-11-25 14:57:38 -08:00
|
|
|
dw BattleAnimCmd_BattlerGFX_1Row
|
|
|
|
dw BattleAnimCmd_BattlerGFX_2Row
|
2015-11-10 13:53:37 -08:00
|
|
|
dw BattleAnimCmd_CheckPokeball
|
|
|
|
dw BattleAnimCmd_Transform
|
|
|
|
dw BattleAnimCmd_RaiseSub
|
|
|
|
dw BattleAnimCmd_DropSub
|
|
|
|
dw BattleAnimCmd_ResetObp0
|
|
|
|
dw BattleAnimCmd_Sound
|
|
|
|
dw BattleAnimCmd_Cry
|
|
|
|
dw BattleAnimCmd_MinimizeOpp
|
|
|
|
dw BattleAnimCmd_OAMOn
|
|
|
|
dw BattleAnimCmd_OAMOff
|
|
|
|
dw BattleAnimCmd_ClearObjs
|
|
|
|
dw BattleAnimCmd_BeatUp
|
2013-12-17 20:54:25 -08:00
|
|
|
dw BattleAnimCmd_E7
|
2015-11-10 13:53:37 -08:00
|
|
|
dw BattleAnimCmd_UpdateActorPic
|
|
|
|
dw BattleAnimCmd_Minimize
|
|
|
|
dw BattleAnimCmd_EA ; dummy
|
|
|
|
dw BattleAnimCmd_EB ; dummy
|
|
|
|
dw BattleAnimCmd_EC ; dummy
|
|
|
|
dw BattleAnimCmd_ED ; dummy
|
2016-05-05 12:07:37 -07:00
|
|
|
dw BattleAnimCmd_IfParamAnd
|
2015-11-10 13:53:37 -08:00
|
|
|
dw BattleAnimCmd_JumpUntil
|
|
|
|
dw BattleAnimCmd_BGEffect
|
|
|
|
dw BattleAnimCmd_BGP
|
|
|
|
dw BattleAnimCmd_OBP0
|
|
|
|
dw BattleAnimCmd_OBP1
|
2019-02-16 03:55:15 -08:00
|
|
|
dw BattleAnimCmd_KeepSprites
|
2013-12-17 20:54:25 -08:00
|
|
|
dw BattleAnimCmd_F5
|
|
|
|
dw BattleAnimCmd_F6
|
|
|
|
dw BattleAnimCmd_F7
|
2016-05-05 12:07:37 -07:00
|
|
|
dw BattleAnimCmd_IfParamEqual
|
2015-11-10 13:53:37 -08:00
|
|
|
dw BattleAnimCmd_SetVar
|
|
|
|
dw BattleAnimCmd_IncVar
|
2016-05-05 12:07:37 -07:00
|
|
|
dw BattleAnimCmd_IfVarEqual
|
2015-11-10 13:53:37 -08:00
|
|
|
dw BattleAnimCmd_Jump
|
|
|
|
dw BattleAnimCmd_Loop
|
|
|
|
dw BattleAnimCmd_Call
|
|
|
|
dw BattleAnimCmd_Ret
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
BattleAnimCmd_EA:
|
|
|
|
BattleAnimCmd_EB:
|
|
|
|
BattleAnimCmd_EC:
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_ED:
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_Ret:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimFlags
|
2019-02-16 03:55:15 -08:00
|
|
|
res BATTLEANIM_IN_SUBROUTINE_F, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimParent
|
2013-12-17 20:54:25 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_Call:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld d, a
|
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimParent
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
|
|
|
pop de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimFlags
|
2019-02-16 03:55:15 -08:00
|
|
|
set BATTLEANIM_IN_SUBROUTINE_F, [hl]
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_Jump:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld d, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_Loop:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimFlags
|
2019-02-16 03:55:15 -08:00
|
|
|
bit BATTLEANIM_IN_LOOP_F, [hl]
|
2015-12-23 17:46:23 -08:00
|
|
|
jr nz, .continue_loop
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .perpetual
|
2013-12-17 20:54:25 -08:00
|
|
|
dec a
|
2019-02-16 03:55:15 -08:00
|
|
|
set BATTLEANIM_IN_LOOP_F, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBattleAnimLoops], a
|
2015-12-23 17:46:23 -08:00
|
|
|
.continue_loop
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimLoops
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .return_from_loop
|
2013-12-17 20:54:25 -08:00
|
|
|
dec [hl]
|
2015-12-23 17:46:23 -08:00
|
|
|
.perpetual
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld d, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
|
|
|
ret
|
2015-12-23 17:46:23 -08:00
|
|
|
|
|
|
|
.return_from_loop
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimFlags
|
2019-02-16 03:55:15 -08:00
|
|
|
res BATTLEANIM_IN_LOOP_F, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
inc de
|
2015-12-23 17:46:23 -08:00
|
|
|
inc de
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], d
|
|
|
|
dec hl
|
|
|
|
ld [hl], e
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_JumpUntil:
|
2015-12-23 17:46:23 -08:00
|
|
|
ld hl, wBattleAnimParam
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .dont_jump
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
dec [hl]
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld d, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
|
|
|
ret
|
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
.dont_jump
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
inc de
|
2015-12-23 17:46:23 -08:00
|
|
|
inc de
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], d
|
|
|
|
dec hl
|
|
|
|
ld [hl], e
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_SetVar:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBattleAnimVar], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_IncVar:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimVar
|
2013-12-17 20:54:25 -08:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_IfVarEqual:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimVar
|
2013-12-17 20:54:25 -08:00
|
|
|
cp [hl]
|
|
|
|
jr z, .jump
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
inc de
|
2015-12-23 17:46:23 -08:00
|
|
|
inc de
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], d
|
|
|
|
dec hl
|
|
|
|
ld [hl], e
|
|
|
|
ret
|
|
|
|
|
|
|
|
.jump
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld d, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_IfParamEqual:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2015-12-23 17:46:23 -08:00
|
|
|
ld hl, wBattleAnimParam
|
2013-12-17 20:54:25 -08:00
|
|
|
cp [hl]
|
|
|
|
jr z, .jump
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
inc de
|
2015-12-23 17:46:23 -08:00
|
|
|
inc de
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], d
|
|
|
|
dec hl
|
|
|
|
ld [hl], e
|
|
|
|
ret
|
|
|
|
|
|
|
|
.jump
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld d, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_IfParamAnd:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
2015-12-23 17:46:23 -08:00
|
|
|
ld a, [wBattleAnimParam]
|
2013-12-17 20:54:25 -08:00
|
|
|
and e
|
|
|
|
jr nz, .jump
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
inc de
|
2015-12-23 17:46:23 -08:00
|
|
|
inc de
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], d
|
|
|
|
dec hl
|
|
|
|
ld [hl], e
|
|
|
|
ret
|
2016-05-05 12:07:37 -07:00
|
|
|
|
2013-12-17 20:54:25 -08:00
|
|
|
.jump
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld d, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimAddress
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_Obj:
|
2015-12-23 19:51:50 -08:00
|
|
|
; index, x, y, param
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2018-11-22 03:32:24 -08:00
|
|
|
ld [wBattleObjectTempID], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2018-11-22 03:32:24 -08:00
|
|
|
ld [wBattleObjectTempXCoord], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2018-11-22 03:32:24 -08:00
|
|
|
ld [wBattleObjectTempYCoord], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2019-02-05 23:07:11 -08:00
|
|
|
ld [wBattleObjectTempParam], a
|
2015-12-04 11:33:29 -08:00
|
|
|
call QueueBattleAnimation
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_BGEffect:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp0], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp1], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp2], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp3], a
|
2015-12-04 11:33:29 -08:00
|
|
|
call _QueueBGEffect
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_BGP:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wBGP], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_OBP0:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wOBP0], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_OBP1:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wOBP1], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_ResetObp0:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hSGB]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
ld a, $e0
|
2015-12-04 11:33:29 -08:00
|
|
|
jr z, .not_sgb
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, $f0
|
2015-12-04 11:33:29 -08:00
|
|
|
.not_sgb
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wOBP0], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_ClearObjs:
|
2019-02-16 10:31:23 -08:00
|
|
|
; BUG: This function only clears the first 6â…” objects
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wActiveAnimObjects
|
2019-02-16 10:31:23 -08:00
|
|
|
ld a, $a0 ; should be NUM_ANIM_OBJECTS * BATTLEANIMSTRUCT_LENGTH
|
2015-12-04 11:33:29 -08:00
|
|
|
.loop
|
2019-02-15 16:33:40 -08:00
|
|
|
ld [hl], 0
|
2013-12-17 20:54:25 -08:00
|
|
|
inc hl
|
|
|
|
dec a
|
2015-12-04 11:33:29 -08:00
|
|
|
jr nz, .loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2015-11-10 13:53:37 -08:00
|
|
|
BattleAnimCmd_1GFX:
|
|
|
|
BattleAnimCmd_2GFX:
|
|
|
|
BattleAnimCmd_3GFX:
|
|
|
|
BattleAnimCmd_4GFX:
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_5GFX:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleAnimByte]
|
2013-12-17 20:54:25 -08:00
|
|
|
and $f
|
|
|
|
ld c, a
|
2015-12-23 11:00:29 -08:00
|
|
|
ld hl, wBattleAnimTileDict
|
2013-12-17 20:54:25 -08:00
|
|
|
xor a
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp0], a
|
2015-12-23 11:00:29 -08:00
|
|
|
.loop
|
2015-12-23 19:51:50 -08:00
|
|
|
ld a, [wBattleAnimTemp0]
|
2018-11-21 14:44:31 -08:00
|
|
|
cp (vTiles1 - vTiles0) / LEN_2BPP_TILE - BATTLEANIM_BASE_TILE
|
2013-12-17 20:54:25 -08:00
|
|
|
ret nc
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld [hli], a
|
2015-12-23 19:51:50 -08:00
|
|
|
ld a, [wBattleAnimTemp0]
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hli], a
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
ld l, a
|
|
|
|
ld h, $0
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 4
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2018-11-21 14:44:31 -08:00
|
|
|
ld de, vTiles0 tile BATTLEANIM_BASE_TILE
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleAnimByte]
|
2018-11-25 14:57:38 -08:00
|
|
|
call LoadBattleAnimGFX
|
2015-12-23 19:51:50 -08:00
|
|
|
ld a, [wBattleAnimTemp0]
|
2013-12-17 20:54:25 -08:00
|
|
|
add c
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp0], a
|
2013-12-17 20:54:25 -08:00
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
dec c
|
2015-12-23 11:00:29 -08:00
|
|
|
jr nz, .loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_IncObj:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2019-02-15 16:33:40 -08:00
|
|
|
ld e, NUM_ANIM_OBJECTS
|
2018-01-23 14:39:09 -08:00
|
|
|
ld bc, wActiveAnimObjects
|
2015-12-23 14:10:50 -08:00
|
|
|
.loop
|
|
|
|
ld hl, BATTLEANIMSTRUCT_INDEX
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
ld d, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleAnimByte]
|
2013-12-17 20:54:25 -08:00
|
|
|
cp d
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .found
|
2015-12-23 14:10:50 -08:00
|
|
|
ld hl, BATTLEANIMSTRUCT_LENGTH
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
ld c, l
|
|
|
|
ld b, h
|
|
|
|
dec e
|
2015-12-23 14:10:50 -08:00
|
|
|
jr nz, .loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
2015-12-23 14:10:50 -08:00
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
.found
|
2015-12-23 14:10:50 -08:00
|
|
|
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_IncBGEffect:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2019-02-15 16:33:40 -08:00
|
|
|
ld e, NUM_BG_EFFECTS
|
|
|
|
ld bc, wBGEffect1Function
|
2015-12-23 17:46:23 -08:00
|
|
|
.loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ld hl, $0
|
|
|
|
add hl, bc
|
|
|
|
ld d, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleAnimByte]
|
2013-12-17 20:54:25 -08:00
|
|
|
cp d
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .found
|
|
|
|
ld hl, 4
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
ld c, l
|
|
|
|
ld b, h
|
|
|
|
dec e
|
2015-12-23 17:46:23 -08:00
|
|
|
jr nz, .loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
2015-12-23 17:46:23 -08:00
|
|
|
|
|
|
|
.found
|
|
|
|
ld hl, BG_EFFECT_STRUCT_JT_INDEX
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_SetObj:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2019-02-15 16:33:40 -08:00
|
|
|
ld e, NUM_ANIM_OBJECTS
|
2018-01-23 14:39:09 -08:00
|
|
|
ld bc, wActiveAnimObjects
|
2015-12-23 17:46:23 -08:00
|
|
|
.loop
|
|
|
|
ld hl, BATTLEANIMSTRUCT_INDEX
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
ld d, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleAnimByte]
|
2013-12-17 20:54:25 -08:00
|
|
|
cp d
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .found
|
|
|
|
ld hl, BATTLEANIMSTRUCT_LENGTH
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
ld c, l
|
|
|
|
ld b, h
|
|
|
|
dec e
|
2015-12-23 17:46:23 -08:00
|
|
|
jr nz, .loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
2015-12-23 17:46:23 -08:00
|
|
|
|
|
|
|
.found
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2015-12-23 17:46:23 -08:00
|
|
|
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-11-25 14:57:38 -08:00
|
|
|
BattleAnimCmd_BattlerGFX_1Row:
|
2015-12-23 11:00:29 -08:00
|
|
|
ld hl, wBattleAnimTileDict
|
2015-12-23 17:46:23 -08:00
|
|
|
.loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .okay
|
2013-12-17 20:54:25 -08:00
|
|
|
inc hl
|
2015-12-23 17:46:23 -08:00
|
|
|
inc hl
|
|
|
|
jr .loop
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
.okay
|
2018-11-25 14:57:38 -08:00
|
|
|
ld a, ANIM_GFX_PLAYERHEAD
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hli], a
|
2018-11-21 14:44:31 -08:00
|
|
|
ld a, ($80 - 6 - 7) - BATTLEANIM_BASE_TILE
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hli], a
|
2018-11-25 14:57:38 -08:00
|
|
|
ld a, ANIM_GFX_ENEMYFEET
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hli], a
|
2018-11-21 14:44:31 -08:00
|
|
|
ld a, ($80 - 6) - BATTLEANIM_BASE_TILE
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], a
|
|
|
|
|
2018-11-21 14:44:31 -08:00
|
|
|
ld hl, vTiles0 tile ($80 - 6 - 7)
|
|
|
|
ld de, vTiles2 tile $06 ; Enemy feet start tile
|
|
|
|
ld a, 7 tiles ; Enemy pic height
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp0], a
|
2018-11-21 14:44:31 -08:00
|
|
|
ld a, 7 ; Copy 7x1 tiles
|
|
|
|
call .LoadFeet
|
|
|
|
ld de, vTiles2 tile $31 ; Player head start tile
|
|
|
|
ld a, 6 tiles ; Player pic height
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp0], a
|
2018-11-21 14:44:31 -08:00
|
|
|
ld a, 6 ; Copy 6x1 tiles
|
|
|
|
call .LoadFeet
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-11-21 14:44:31 -08:00
|
|
|
.LoadFeet:
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
|
|
|
push hl
|
|
|
|
push de
|
2018-11-21 14:44:31 -08:00
|
|
|
lb bc, BANK(@), 1
|
2013-12-17 20:54:25 -08:00
|
|
|
call Request2bpp
|
|
|
|
pop de
|
2015-12-23 19:51:50 -08:00
|
|
|
ld a, [wBattleAnimTemp0]
|
2013-12-17 20:54:25 -08:00
|
|
|
ld l, a
|
2015-12-23 17:46:23 -08:00
|
|
|
ld h, 0
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, de
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
pop hl
|
2015-12-23 17:46:23 -08:00
|
|
|
ld bc, 1 tiles
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
pop af
|
|
|
|
dec a
|
2018-11-21 14:44:31 -08:00
|
|
|
jr nz, .LoadFeet
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-11-25 14:57:38 -08:00
|
|
|
BattleAnimCmd_BattlerGFX_2Row:
|
2015-12-23 11:00:29 -08:00
|
|
|
ld hl, wBattleAnimTileDict
|
2015-12-23 17:46:23 -08:00
|
|
|
.loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-23 17:46:23 -08:00
|
|
|
jr z, .okay
|
2013-12-17 20:54:25 -08:00
|
|
|
inc hl
|
2015-12-23 17:46:23 -08:00
|
|
|
inc hl
|
|
|
|
jr .loop
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
.okay
|
2018-11-25 14:57:38 -08:00
|
|
|
ld a, ANIM_GFX_PLAYERHEAD
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hli], a
|
2018-11-21 14:44:31 -08:00
|
|
|
ld a, ($80 - 6 * 2 - 7 * 2) - BATTLEANIM_BASE_TILE
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hli], a
|
2018-11-25 14:57:38 -08:00
|
|
|
ld a, ANIM_GFX_ENEMYFEET
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hli], a
|
2018-11-21 14:44:31 -08:00
|
|
|
ld a, ($80 - 6 * 2) - BATTLEANIM_BASE_TILE
|
2013-12-17 20:54:25 -08:00
|
|
|
ld [hl], a
|
|
|
|
|
2018-11-21 14:44:31 -08:00
|
|
|
ld hl, vTiles0 tile ($80 - 6 * 2 - 7 * 2)
|
|
|
|
ld de, vTiles2 tile $05 ; Enemy feet start tile
|
|
|
|
ld a, 7 tiles ; Enemy pic height
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp0], a
|
2018-11-21 14:44:31 -08:00
|
|
|
ld a, 7 ; Copy 7x2 tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .LoadHead
|
2018-11-21 14:44:31 -08:00
|
|
|
ld de, vTiles2 tile $31 ; Player head start tile
|
|
|
|
ld a, 6 tiles ; Player pic height
|
2015-12-23 19:51:50 -08:00
|
|
|
ld [wBattleAnimTemp0], a
|
2018-11-21 14:44:31 -08:00
|
|
|
ld a, 6 ; Copy 6x2 tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .LoadHead
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.LoadHead:
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
|
|
|
push hl
|
|
|
|
push de
|
2018-11-21 14:44:31 -08:00
|
|
|
lb bc, BANK(@), 2
|
2013-12-17 20:54:25 -08:00
|
|
|
call Request2bpp
|
|
|
|
pop de
|
2015-12-23 19:51:50 -08:00
|
|
|
ld a, [wBattleAnimTemp0]
|
2013-12-17 20:54:25 -08:00
|
|
|
ld l, a
|
2015-12-23 17:46:23 -08:00
|
|
|
ld h, 0
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, de
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
pop hl
|
2015-12-23 17:46:23 -08:00
|
|
|
ld bc, 2 tiles
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
pop af
|
|
|
|
dec a
|
2015-12-23 17:46:23 -08:00
|
|
|
jr nz, .LoadHead
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_CheckPokeball:
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar GetPokeBallWobble
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, c
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBattleAnimVar], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_E7:
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_Transform:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, BANK(wCurPartySpecies)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2020-06-16 16:32:36 -07:00
|
|
|
|
|
|
|
ld a, [wCurPartySpecies]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr z, .player
|
|
|
|
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, [wTempBattleMonSpecies]
|
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld hl, wBattleMonDVs
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetUnownLetter
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles0 tile $00
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetMonFrontpic
|
2013-12-17 20:54:25 -08:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.player
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, [wTempEnemyMonSpecies]
|
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld hl, wEnemyMonDVs
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetUnownLetter
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles0 tile $00
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetMonBackpic
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
.done
|
|
|
|
pop af
|
2020-06-16 16:32:36 -07:00
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
|
2013-12-17 20:54:25 -08:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_UpdateActorPic:
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles0 tile $00
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr z, .player
|
|
|
|
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $00
|
2013-12-17 20:54:25 -08:00
|
|
|
ld b, 0
|
2018-11-21 14:44:31 -08:00
|
|
|
ld c, 7 * 7
|
2013-12-17 20:54:25 -08:00
|
|
|
call Request2bpp
|
|
|
|
ret
|
|
|
|
|
|
|
|
.player
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $31
|
2013-12-17 20:54:25 -08:00
|
|
|
ld b, 0
|
2018-11-21 14:44:31 -08:00
|
|
|
ld c, 6 * 6
|
2013-12-17 20:54:25 -08:00
|
|
|
call Request2bpp
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_RaiseSub:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, 1 ; unnecessary bankswitch?
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2020-06-16 16:32:36 -07:00
|
|
|
|
|
|
|
xor a ; BANK(sScratch)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-06-12 20:29:15 -07:00
|
|
|
GetSubstitutePic: ; used only for BANK(GetSubstitutePic)
|
2015-08-19 21:51:04 -07:00
|
|
|
ld hl, sScratch
|
2016-03-27 09:47:28 -07:00
|
|
|
ld bc, (7 * 7) tiles
|
2013-12-17 20:54:25 -08:00
|
|
|
.loop
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
dec bc
|
|
|
|
ld a, c
|
|
|
|
or b
|
|
|
|
jr nz, .loop
|
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr z, .player
|
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
ld hl, MonsterSpriteGFX + 0 tiles
|
2016-03-27 09:47:28 -07:00
|
|
|
ld de, sScratch + (2 * 7 + 5) tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .CopyTile
|
|
|
|
ld hl, MonsterSpriteGFX + 1 tiles
|
2016-03-27 09:47:28 -07:00
|
|
|
ld de, sScratch + (3 * 7 + 5) tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .CopyTile
|
|
|
|
ld hl, MonsterSpriteGFX + 2 tiles
|
2016-03-27 09:47:28 -07:00
|
|
|
ld de, sScratch + (2 * 7 + 6) tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .CopyTile
|
|
|
|
ld hl, MonsterSpriteGFX + 3 tiles
|
2016-03-27 09:47:28 -07:00
|
|
|
ld de, sScratch + (3 * 7 + 6) tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .CopyTile
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $00
|
2015-08-19 21:51:04 -07:00
|
|
|
ld de, sScratch
|
2013-12-17 20:54:25 -08:00
|
|
|
lb bc, BANK(GetSubstitutePic), 7 * 7
|
|
|
|
call Request2bpp
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
.player
|
2015-12-23 17:46:23 -08:00
|
|
|
ld hl, MonsterSpriteGFX + 4 tiles
|
2016-03-27 09:47:28 -07:00
|
|
|
ld de, sScratch + (2 * 6 + 4) tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .CopyTile
|
|
|
|
ld hl, MonsterSpriteGFX + 5 tiles
|
2016-03-27 09:47:28 -07:00
|
|
|
ld de, sScratch + (3 * 6 + 4) tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .CopyTile
|
|
|
|
ld hl, MonsterSpriteGFX + 6 tiles
|
2016-03-27 09:47:28 -07:00
|
|
|
ld de, sScratch + (2 * 6 + 5) tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .CopyTile
|
|
|
|
ld hl, MonsterSpriteGFX + 7 tiles
|
2016-03-27 09:47:28 -07:00
|
|
|
ld de, sScratch + (3 * 6 + 5) tiles
|
2015-12-23 17:46:23 -08:00
|
|
|
call .CopyTile
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $31
|
2015-08-19 21:51:04 -07:00
|
|
|
ld de, sScratch
|
2013-12-17 20:54:25 -08:00
|
|
|
lb bc, BANK(GetSubstitutePic), 6 * 6
|
|
|
|
call Request2bpp
|
|
|
|
|
|
|
|
.done
|
|
|
|
call CloseSRAM
|
2020-06-16 16:32:36 -07:00
|
|
|
|
2013-12-17 20:54:25 -08:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CopyTile:
|
2015-12-23 17:46:23 -08:00
|
|
|
ld bc, 1 tiles
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, BANK(MonsterSpriteGFX)
|
|
|
|
call FarCopyBytes
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_MinimizeOpp:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, 1 ; unnecessary bankswitch?
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2020-06-16 16:32:36 -07:00
|
|
|
|
|
|
|
xor a ; BANK(sScratch)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetMinimizePic
|
|
|
|
call Request2bpp
|
|
|
|
call CloseSRAM
|
2020-06-16 16:32:36 -07:00
|
|
|
|
2013-12-17 20:54:25 -08:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetMinimizePic:
|
2015-08-19 21:51:04 -07:00
|
|
|
ld hl, sScratch
|
2018-11-21 14:44:31 -08:00
|
|
|
ld bc, (7 * 7) tiles
|
2013-12-17 20:54:25 -08:00
|
|
|
.loop
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
dec bc
|
|
|
|
ld a, c
|
|
|
|
or b
|
|
|
|
jr nz, .loop
|
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr z, .player
|
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
ld de, sScratch + $1a tiles
|
2013-12-17 20:54:25 -08:00
|
|
|
call CopyMinimizePic
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $00
|
2015-08-19 21:51:04 -07:00
|
|
|
ld de, sScratch
|
2018-01-14 16:43:35 -08:00
|
|
|
lb bc, BANK(GetMinimizePic), 7 * 7
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
|
|
|
.player
|
2015-08-20 23:00:59 -07:00
|
|
|
ld de, sScratch + $160
|
2013-12-17 20:54:25 -08:00
|
|
|
call CopyMinimizePic
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $31
|
2015-08-19 21:51:04 -07:00
|
|
|
ld de, sScratch
|
2018-01-14 16:43:35 -08:00
|
|
|
lb bc, BANK(GetMinimizePic), 6 * 6
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CopyMinimizePic:
|
2013-12-17 20:54:25 -08:00
|
|
|
ld hl, MinimizePic
|
|
|
|
ld bc, $10
|
|
|
|
ld a, BANK(MinimizePic)
|
|
|
|
call FarCopyBytes
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MinimizePic:
|
2013-12-17 20:54:25 -08:00
|
|
|
INCBIN "gfx/battle/minimize.2bpp"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_Minimize:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, 1 ; unnecessary bankswitch?
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2020-06-16 16:32:36 -07:00
|
|
|
|
|
|
|
xor a ; BANK(sScratch)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetMinimizePic
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles0 tile $00
|
2013-12-17 20:54:25 -08:00
|
|
|
call Request2bpp
|
|
|
|
call CloseSRAM
|
2020-06-16 16:32:36 -07:00
|
|
|
|
2013-12-17 20:54:25 -08:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_DropSub:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, BANK(wCurPartySpecies)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, [wCurPartySpecies]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr z, .player
|
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar DropEnemySub
|
2013-12-17 20:54:25 -08:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.player
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar DropPlayerSub
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
.done
|
|
|
|
pop af
|
2020-06-16 16:32:36 -07:00
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
|
2013-12-17 20:54:25 -08:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_BeatUp:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, BANK(wCurPartySpecies)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2020-06-16 16:32:36 -07:00
|
|
|
|
|
|
|
ld a, [wCurPartySpecies]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
|
|
|
|
2015-12-23 17:46:23 -08:00
|
|
|
ld a, [wBattleAnimParam]
|
2020-06-16 16:32:36 -07:00
|
|
|
ld [wCurPartySpecies], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr z, .player
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleMonDVs
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetUnownLetter
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2 tile $00
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetMonFrontpic
|
2013-12-17 20:54:25 -08:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.player
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEnemyMonDVs
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetUnownLetter
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2 tile $31
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetMonBackpic
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
.done
|
|
|
|
pop af
|
2020-06-16 16:32:36 -07:00
|
|
|
ld [wCurPartySpecies], a
|
2015-12-28 07:57:04 -08:00
|
|
|
ld b, SCGB_BATTLE_COLORS
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetSGBLayout
|
2020-06-16 16:32:36 -07:00
|
|
|
|
2013-12-17 20:54:25 -08:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_OAMOn:
|
2013-12-17 20:54:25 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hOAMUpdate], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_OAMOff:
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hOAMUpdate], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2019-02-16 03:55:15 -08:00
|
|
|
BattleAnimCmd_KeepSprites:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleAnimFlags
|
2019-02-16 03:55:15 -08:00
|
|
|
set BATTLEANIM_KEEPSPRITES_F, [hl]
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_F5:
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_F6:
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_F7:
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_Sound:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
|
|
|
srl a
|
|
|
|
srl a
|
2015-12-23 14:10:50 -08:00
|
|
|
ld [wSFXDuration], a
|
|
|
|
call .GetCryTrack
|
2018-01-16 14:27:50 -08:00
|
|
|
maskbits NUM_NOISE_CHANS
|
2020-06-16 16:32:36 -07:00
|
|
|
ld [wCryTracks], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-23 14:10:50 -08:00
|
|
|
ld hl, .GetPanning
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
2015-12-23 14:10:50 -08:00
|
|
|
ld [wStereoPanningMask], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
call GetBattleAnimByte
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar PlayStereoSFX
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.GetPanning:
|
2013-12-17 20:54:25 -08:00
|
|
|
db $f0, $0f, $f0, $0f
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.GetCryTrack:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr nz, .enemy
|
|
|
|
|
|
|
|
ld a, e
|
|
|
|
ret
|
|
|
|
|
|
|
|
.enemy
|
|
|
|
ld a, e
|
|
|
|
xor 1
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimCmd_Cry:
|
2013-12-17 20:54:25 -08:00
|
|
|
call GetBattleAnimByte
|
2018-01-16 14:27:50 -08:00
|
|
|
maskbits NUM_NOISE_CHANS
|
2013-12-17 20:54:25 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-23 11:00:29 -08:00
|
|
|
ld hl, .CryData
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 4
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, de
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2020-06-16 16:32:36 -07:00
|
|
|
ld a, BANK(wEnemyMon) ; wBattleMon is in WRAM0, but wEnemyMon is in WRAMX
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
jr nz, .enemy
|
|
|
|
|
|
|
|
ld a, $f0
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCryTracks], a
|
|
|
|
ld a, [wBattleMonSpecies]
|
2015-12-23 11:00:29 -08:00
|
|
|
jr .done_cry_tracks
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
.enemy
|
|
|
|
ld a, $0f
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCryTracks], a
|
|
|
|
ld a, [wEnemyMonSpecies]
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-12-23 11:00:29 -08:00
|
|
|
.done_cry_tracks
|
2013-12-17 20:54:25 -08:00
|
|
|
push hl
|
2018-01-16 20:47:45 -08:00
|
|
|
call LoadCry
|
2013-12-17 20:54:25 -08:00
|
|
|
pop hl
|
|
|
|
jr c, .done
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld c, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
|
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wCryPitch
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, l
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCryPitch], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, h
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCryPitch + 1], a
|
2013-12-17 20:54:25 -08:00
|
|
|
pop hl
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld c, a
|
|
|
|
ld b, [hl]
|
2020-06-16 16:32:36 -07:00
|
|
|
ld hl, wCryLength
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
add hl, bc
|
|
|
|
|
|
|
|
ld a, l
|
2020-06-16 16:32:36 -07:00
|
|
|
ld [wCryLength], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, h
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCryLength + 1], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, 1
|
2015-12-23 14:10:50 -08:00
|
|
|
ld [wStereoPanningMask], a
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-01-16 20:47:45 -08:00
|
|
|
callfar _PlayCry
|
2013-12-17 20:54:25 -08:00
|
|
|
|
|
|
|
.done
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CryData:
|
2014-07-18 09:50:31 -07:00
|
|
|
; +pitch, +length
|
2015-12-23 11:00:29 -08:00
|
|
|
dw $0000, $00c0
|
|
|
|
dw $0000, $0040
|
|
|
|
dw $0000, $0000
|
|
|
|
dw $0000, $0000
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlayHitSound:
|
2015-12-23 11:00:29 -08:00
|
|
|
ld a, [wNumHits]
|
2013-12-17 20:54:25 -08:00
|
|
|
cp $1
|
2015-11-09 13:41:09 -08:00
|
|
|
jr z, .okay
|
2013-12-17 20:54:25 -08:00
|
|
|
cp $4
|
|
|
|
ret nz
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.okay
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTypeModifier]
|
2013-12-17 20:54:25 -08:00
|
|
|
and $7f
|
|
|
|
ret z
|
|
|
|
|
2018-03-09 13:09:03 -08:00
|
|
|
cp EFFECTIVE
|
2013-12-17 20:54:25 -08:00
|
|
|
ld de, SFX_DAMAGE
|
|
|
|
jr z, .play
|
|
|
|
|
|
|
|
ld de, SFX_SUPER_EFFECTIVE
|
|
|
|
jr nc, .play
|
|
|
|
|
|
|
|
ld de, SFX_NOT_VERY_EFFECTIVE
|
|
|
|
|
|
|
|
.play
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnimAssignPals:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hCGB]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
2015-11-09 13:41:09 -08:00
|
|
|
jr nz, .cgb
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hSGB]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
2015-11-09 13:41:09 -08:00
|
|
|
ld a, %11100000
|
|
|
|
jr z, .sgb
|
|
|
|
ld a, %11110000
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.sgb
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wOBP0], a
|
2015-11-09 13:41:09 -08:00
|
|
|
ld a, %11100100
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wBGP], a
|
|
|
|
ld [wOBP1], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
.cgb
|
|
|
|
ld a, %11100100
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wBGP], a
|
|
|
|
ld [wOBP0], a
|
|
|
|
ld [wOBP1], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call DmgToCgbBGPals
|
2015-11-09 13:41:09 -08:00
|
|
|
lb de, %11100100, %11100100
|
2013-12-17 20:54:25 -08:00
|
|
|
call DmgToCgbObjPals
|
|
|
|
ret
|
|
|
|
|
2018-12-25 09:49:54 -08:00
|
|
|
ClearBattleAnims::
|
2015-11-09 13:41:09 -08:00
|
|
|
; Clear animation block
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wLYOverrides
|
|
|
|
ld bc, wBattleAnimEnd - wLYOverrides
|
2015-11-09 13:41:09 -08:00
|
|
|
.loop
|
2020-06-16 16:32:36 -07:00
|
|
|
ld [hl], 0
|
2013-12-17 20:54:25 -08:00
|
|
|
inc hl
|
|
|
|
dec bc
|
|
|
|
ld a, c
|
|
|
|
or b
|
2015-11-09 13:41:09 -08:00
|
|
|
jr nz, .loop
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wFXAnimID
|
2013-12-17 20:54:25 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2014-01-05 04:28:55 -08:00
|
|
|
ld hl, BattleAnimations
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, de
|
2015-12-23 17:46:23 -08:00
|
|
|
add hl, de
|
2015-11-09 13:41:09 -08:00
|
|
|
call GetBattleAnimPointer
|
2013-12-17 20:54:25 -08:00
|
|
|
call BattleAnimAssignPals
|
|
|
|
call BattleAnimDelayFrame
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnim_RevertPals:
|
2013-12-17 20:54:25 -08:00
|
|
|
call WaitTop
|
2015-11-09 13:41:09 -08:00
|
|
|
ld a, %11100100
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wBGP], a
|
|
|
|
ld [wOBP0], a
|
|
|
|
ld [wOBP1], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call DmgToCgbBGPals
|
2015-11-09 13:41:09 -08:00
|
|
|
lb de, %11100100, %11100100
|
2013-12-17 20:54:25 -08:00
|
|
|
call DmgToCgbObjPals
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hSCX], a
|
|
|
|
ldh [hSCY], a
|
2013-12-17 20:54:25 -08:00
|
|
|
call BattleAnimDelayFrame
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnim_SetBGPals:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rBGP], a
|
|
|
|
ldh a, [hCGB]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
ret z
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, BANK(wBGPals1)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2018-01-01 06:08:21 -08:00
|
|
|
ld hl, wBGPals2
|
|
|
|
ld de, wBGPals1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rBGP]
|
2013-12-17 20:54:25 -08:00
|
|
|
ld b, a
|
2017-12-10 17:50:08 -08:00
|
|
|
ld c, 7
|
2013-12-17 20:54:25 -08:00
|
|
|
call CopyPals
|
2018-01-01 06:08:21 -08:00
|
|
|
ld hl, wOBPals2
|
|
|
|
ld de, wOBPals1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rBGP]
|
2013-12-17 20:54:25 -08:00
|
|
|
ld b, a
|
2017-12-10 17:50:08 -08:00
|
|
|
ld c, 2
|
2013-12-17 20:54:25 -08:00
|
|
|
call CopyPals
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hCGBPalUpdate], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnim_SetOBPals:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rOBP0], a
|
|
|
|
ldh a, [hCGB]
|
2013-12-17 20:54:25 -08:00
|
|
|
and a
|
|
|
|
ret z
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSVBK]
|
2013-12-17 20:54:25 -08:00
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, BANK(wOBPals1)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2018-01-01 06:08:21 -08:00
|
|
|
ld hl, wOBPals2 palette PAL_BATTLE_OB_GRAY
|
|
|
|
ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rOBP0]
|
2013-12-17 20:54:25 -08:00
|
|
|
ld b, a
|
2017-12-10 17:50:08 -08:00
|
|
|
ld c, 2
|
2013-12-17 20:54:25 -08:00
|
|
|
call CopyPals
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rSVBK], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hCGBPalUpdate], a
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleAnim_UpdateOAM_All:
|
2019-02-15 16:33:40 -08:00
|
|
|
ld a, 0
|
2015-12-23 17:46:23 -08:00
|
|
|
ld [wBattleAnimOAMPointerLo], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wActiveAnimObjects
|
2019-02-15 16:33:40 -08:00
|
|
|
ld e, NUM_ANIM_OBJECTS
|
2015-12-04 11:33:29 -08:00
|
|
|
.loop
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-04 11:33:29 -08:00
|
|
|
jr z, .next
|
2013-12-17 20:54:25 -08:00
|
|
|
ld c, l
|
|
|
|
ld b, h
|
|
|
|
push hl
|
|
|
|
push de
|
2015-12-23 14:10:50 -08:00
|
|
|
call DoBattleAnimFrame
|
|
|
|
call BattleAnimOAMUpdate
|
2013-12-17 20:54:25 -08:00
|
|
|
pop de
|
|
|
|
pop hl
|
2015-12-04 11:33:29 -08:00
|
|
|
jr c, .done
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-12-04 11:33:29 -08:00
|
|
|
.next
|
2015-12-23 14:10:50 -08:00
|
|
|
ld bc, BATTLEANIMSTRUCT_LENGTH
|
2013-12-17 20:54:25 -08:00
|
|
|
add hl, bc
|
|
|
|
dec e
|
2015-12-04 11:33:29 -08:00
|
|
|
jr nz, .loop
|
2015-12-23 17:46:23 -08:00
|
|
|
ld a, [wBattleAnimOAMPointerLo]
|
2013-12-17 20:54:25 -08:00
|
|
|
ld l, a
|
2018-01-23 13:45:34 -08:00
|
|
|
ld h, HIGH(wVirtualOAM)
|
2015-12-04 11:33:29 -08:00
|
|
|
.loop2
|
2013-12-17 20:54:25 -08:00
|
|
|
ld a, l
|
2018-01-30 11:55:20 -08:00
|
|
|
cp LOW(wVirtualOAMEnd)
|
2015-12-04 11:33:29 -08:00
|
|
|
jr nc, .done
|
2013-12-17 20:54:25 -08:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
2015-12-04 11:33:29 -08:00
|
|
|
jr .loop2
|
2013-12-17 20:54:25 -08:00
|
|
|
|
2015-12-04 11:33:29 -08:00
|
|
|
.done
|
2013-12-17 20:54:25 -08:00
|
|
|
ret
|