Define ANIM_GFX for PLAYER and ENEMY

These are used where the head or the feet of the player/enemy have to be
moved in an animation, and shouldn't overlap. These aren't actual GFX
and should be loaded with the proper commands, and they're always loaded
at the end of the VRAM area.

Furthermore, I've defined BATTLEANIM_BASE_TILE, which is the tile from
which battle animation graphics may start to load. This value was picked
to make sure at least an entire pokemon pic fits in the area before it,
even though it doesn't seem very used...
This commit is contained in:
mid-kid 2018-11-21 23:44:31 +01:00
parent 32833adef3
commit 2746288030
4 changed files with 43 additions and 38 deletions

View File

@ -26,6 +26,9 @@
const BATTLEANIMSTRUCT_17 const BATTLEANIMSTRUCT_17
BATTLEANIMSTRUCT_LENGTH EQU const_value BATTLEANIMSTRUCT_LENGTH EQU const_value
; Start tile for battle animation graphics
BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture
; BattleAnimObjects indexes (see data/battle_anims/objects.asm) ; BattleAnimObjects indexes (see data/battle_anims/objects.asm)
const_def const_def
const ANIM_OBJ_00 const ANIM_OBJ_00
@ -804,6 +807,8 @@ BATTLEANIMSTRUCT_LENGTH EQU const_value
const ANIM_GFX_ANGELS const ANIM_GFX_ANGELS
const ANIM_GFX_WAVE const ANIM_GFX_WAVE
const ANIM_GFX_AEROBLAST const ANIM_GFX_AEROBLAST
const ANIM_GFX_PLAYER
const ANIM_GFX_ENEMY
; battle_bg_effect struct members (see macros/wram.asm) ; battle_bg_effect struct members (see macros/wram.asm)
const_def const_def

View File

@ -202,7 +202,7 @@ BattleAnimObjects:
battleanimobj RELATIVE_X | X_FLIP, $ff, BATTLEANIMFRAMESET_19, BATTLEANIMFUNC_4E, PAL_BATTLE_OB_BROWN, ANIM_GFX_ROCKS ; ANIM_OBJ_ROCK_SMASH battleanimobj RELATIVE_X | X_FLIP, $ff, BATTLEANIMFRAMESET_19, BATTLEANIMFUNC_4E, PAL_BATTLE_OB_BROWN, ANIM_GFX_ROCKS ; ANIM_OBJ_ROCK_SMASH
battleanimobj RELATIVE_X, $90, BATTLEANIMFRAMESET_73, BATTLEANIMFUNC_08, PAL_BATTLE_OB_RED, ANIM_GFX_FLOWER ; ANIM_OBJ_FLOWER battleanimobj RELATIVE_X, $90, BATTLEANIMFRAMESET_73, BATTLEANIMFUNC_08, PAL_BATTLE_OB_RED, ANIM_GFX_FLOWER ; ANIM_OBJ_FLOWER
battleanimobj RELATIVE_X, $ff, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_4F, PAL_BATTLE_OB_RED, ANIM_GFX_MISC ; ANIM_OBJ_COTTON battleanimobj RELATIVE_X, $ff, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_4F, PAL_BATTLE_OB_RED, ANIM_GFX_MISC ; ANIM_OBJ_COTTON
battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B5, BATTLEANIMFUNC_00, PAL_BATTLE_OB_ENEMY, $28 ; ANIM_OBJ_PLAYERFEETFOLLOW battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B5, BATTLEANIMFUNC_00, PAL_BATTLE_OB_ENEMY, ANIM_GFX_PLAYER ; ANIM_OBJ_PLAYERFEETFOLLOW
battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B6, BATTLEANIMFUNC_00, PAL_BATTLE_OB_PLAYER, $29 ; ANIM_OBJ_ENEMYFEETFOLLOW battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B6, BATTLEANIMFUNC_00, PAL_BATTLE_OB_PLAYER, ANIM_GFX_ENEMY ; ANIM_OBJ_ENEMYFEETFOLLOW
battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B7, BATTLEANIMFUNC_00, PAL_BATTLE_OB_ENEMY, $28 ; ANIM_OBJ_PLAYERHEADFOLLOW battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B7, BATTLEANIMFUNC_00, PAL_BATTLE_OB_ENEMY, ANIM_GFX_PLAYER ; ANIM_OBJ_PLAYERHEADFOLLOW
battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B8, BATTLEANIMFUNC_00, PAL_BATTLE_OB_PLAYER, $29 ; ANIM_OBJ_ENEMYHEADFOLLOW battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B8, BATTLEANIMFUNC_00, PAL_BATTLE_OB_PLAYER, ANIM_GFX_ENEMY ; ANIM_OBJ_ENEMYHEADFOLLOW

View File

@ -665,7 +665,7 @@ BattleAnimCmd_5GFX:
ld [wBattleAnimTemp0], a ld [wBattleAnimTemp0], a
.loop .loop
ld a, [wBattleAnimTemp0] ld a, [wBattleAnimTemp0]
cp (vTiles1 - vTiles0) / $10 - $31 cp (vTiles1 - vTiles0) / LEN_2BPP_TILE - BATTLEANIM_BASE_TILE
ret nc ret nc
call GetBattleAnimByte call GetBattleAnimByte
ld [hli], a ld [hli], a
@ -678,7 +678,7 @@ BattleAnimCmd_5GFX:
rept 4 rept 4
add hl, hl add hl, hl
endr endr
ld de, vTiles0 tile $31 ld de, vTiles0 tile BATTLEANIM_BASE_TILE
add hl, de add hl, de
ld a, [wBattleAnimByte] ld a, [wBattleAnimByte]
call LoadBattleAnimObj call LoadBattleAnimObj
@ -778,33 +778,33 @@ BattleAnimCmd_EnemyFeetObj:
jr .loop jr .loop
.okay .okay
ld a, $28 ld a, ANIM_GFX_PLAYER
ld [hli], a ld [hli], a
ld a, $42 ld a, ($80 - 6 - 7) - BATTLEANIM_BASE_TILE
ld [hli], a ld [hli], a
ld a, $29 ld a, ANIM_GFX_ENEMY
ld [hli], a ld [hli], a
ld a, $49 ld a, ($80 - 6) - BATTLEANIM_BASE_TILE
ld [hl], a ld [hl], a
ld hl, vTiles0 tile $73 ld hl, vTiles0 tile ($80 - 6 - 7)
ld de, vTiles2 tile $06 ld de, vTiles2 tile $06 ; Enemy feet start tile
ld a, $70 ld a, 7 tiles ; Enemy pic height
ld [wBattleAnimTemp0], a ld [wBattleAnimTemp0], a
ld a, $7 ld a, 7 ; Copy 7x1 tiles
call .LoadFootprint call .LoadFeet
ld de, vTiles2 tile $31 ld de, vTiles2 tile $31 ; Player head start tile
ld a, $60 ld a, 6 tiles ; Player pic height
ld [wBattleAnimTemp0], a ld [wBattleAnimTemp0], a
ld a, $6 ld a, 6 ; Copy 6x1 tiles
call .LoadFootprint call .LoadFeet
ret ret
.LoadFootprint: .LoadFeet:
push af push af
push hl push hl
push de push de
lb bc, BANK(BattleAnimCmd_EnemyFeetObj), 1 lb bc, BANK(@), 1
call Request2bpp call Request2bpp
pop de pop de
ld a, [wBattleAnimTemp0] ld a, [wBattleAnimTemp0]
@ -818,7 +818,7 @@ BattleAnimCmd_EnemyFeetObj:
add hl, bc add hl, bc
pop af pop af
dec a dec a
jr nz, .LoadFootprint jr nz, .LoadFeet
ret ret
BattleAnimCmd_PlayerHeadObj: BattleAnimCmd_PlayerHeadObj:
@ -832,25 +832,25 @@ BattleAnimCmd_PlayerHeadObj:
jr .loop jr .loop
.okay .okay
ld a, $28 ld a, ANIM_GFX_PLAYER
ld [hli], a ld [hli], a
ld a, $35 ld a, ($80 - 6 * 2 - 7 * 2) - BATTLEANIM_BASE_TILE
ld [hli], a ld [hli], a
ld a, $29 ld a, ANIM_GFX_ENEMY
ld [hli], a ld [hli], a
ld a, $43 ld a, ($80 - 6 * 2) - BATTLEANIM_BASE_TILE
ld [hl], a ld [hl], a
ld hl, vTiles0 tile $66 ld hl, vTiles0 tile ($80 - 6 * 2 - 7 * 2)
ld de, vTiles2 tile $05 ld de, vTiles2 tile $05 ; Enemy feet start tile
ld a, $70 ld a, 7 tiles ; Enemy pic height
ld [wBattleAnimTemp0], a ld [wBattleAnimTemp0], a
ld a, $7 ld a, 7 ; Copy 7x2 tiles
call .LoadHead call .LoadHead
ld de, vTiles2 tile $31 ld de, vTiles2 tile $31 ; Player head start tile
ld a, $60 ld a, 6 tiles ; Player pic height
ld [wBattleAnimTemp0], a ld [wBattleAnimTemp0], a
ld a, $6 ld a, 6 ; Copy 6x2 tiles
call .LoadHead call .LoadHead
ret ret
@ -858,7 +858,7 @@ BattleAnimCmd_PlayerHeadObj:
push af push af
push hl push hl
push de push de
lb bc, BANK(BattleAnimCmd_EnemyFeetObj), 2 lb bc, BANK(@), 2
call Request2bpp call Request2bpp
pop de pop de
ld a, [wBattleAnimTemp0] ld a, [wBattleAnimTemp0]
@ -927,14 +927,14 @@ BattleAnimCmd_UpdateActorPic:
ld hl, vTiles2 tile $00 ld hl, vTiles2 tile $00
ld b, 0 ld b, 0
ld c, $31 ld c, 7 * 7
call Request2bpp call Request2bpp
ret ret
.player .player
ld hl, vTiles2 tile $31 ld hl, vTiles2 tile $31
ld b, 0 ld b, 0
ld c, $24 ld c, 6 * 6
call Request2bpp call Request2bpp
ret ret
@ -1028,7 +1028,7 @@ BattleAnimCmd_MinimizeOpp:
GetMinimizePic: GetMinimizePic:
ld hl, sScratch ld hl, sScratch
ld bc, $31 tiles ld bc, (7 * 7) tiles
.loop .loop
xor a xor a
ld [hli], a ld [hli], a

View File

@ -147,7 +147,7 @@ BattleAnimOAMUpdate:
inc hl inc hl
inc de inc de
ld a, [wBattleAnimTempTileID] ld a, [wBattleAnimTempTileID]
add $31 add BATTLEANIM_BASE_TILE
add [hl] add [hl]
ld [de], a ld [de], a
inc hl inc hl