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
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)
const_def
const ANIM_OBJ_00
@ -804,6 +807,8 @@ BATTLEANIMSTRUCT_LENGTH EQU const_value
const ANIM_GFX_ANGELS
const ANIM_GFX_WAVE
const ANIM_GFX_AEROBLAST
const ANIM_GFX_PLAYER
const ANIM_GFX_ENEMY
; battle_bg_effect struct members (see macros/wram.asm)
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, $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 ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B5, BATTLEANIMFUNC_00, PAL_BATTLE_OB_ENEMY, $28 ; ANIM_OBJ_PLAYERFEETFOLLOW
battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B6, BATTLEANIMFUNC_00, PAL_BATTLE_OB_PLAYER, $29 ; ANIM_OBJ_ENEMYFEETFOLLOW
battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B7, BATTLEANIMFUNC_00, PAL_BATTLE_OB_ENEMY, $28 ; ANIM_OBJ_PLAYERHEADFOLLOW
battleanimobj ABSOLUTE_X, $00, BATTLEANIMFRAMESET_B8, BATTLEANIMFUNC_00, PAL_BATTLE_OB_PLAYER, $29 ; ANIM_OBJ_ENEMYHEADFOLLOW
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, ANIM_GFX_ENEMY ; ANIM_OBJ_ENEMYFEETFOLLOW
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, ANIM_GFX_ENEMY ; ANIM_OBJ_ENEMYHEADFOLLOW

View File

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

View File

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