pokecrystal/home/mon_stats.asm

108 lines
1.3 KiB
NASM

IsAPokemon:: ; 3741
; Return carry if species a is not a Pokemon.
and a
jr z, .NotAPokemon
cp EGG
jr z, .Pokemon
cp NUM_POKEMON + 1
jr c, .Pokemon
.NotAPokemon:
scf
ret
.Pokemon:
and a
ret
; 3750
DrawBattleHPBar:: ; 3750
; Draw an HP bar d tiles long at hl
; Fill it up to e pixels
push hl
push de
push bc
; Place 'HP:'
ld a, $60
ld [hli], a
ld a, $61
ld [hli], a
; Draw a template
push hl
ld a, $62 ; empty bar
.template
ld [hli], a
dec d
jr nz, .template
ld a, $6b ; bar end
add b
ld [hl], a
pop hl
; Safety check # pixels
ld a, e
and a
jr nz, .fill
ld a, c
and a
jr z, .done
ld e, 1
.fill
; Keep drawing tiles until pixel length is reached
ld a, e
sub TILE_WIDTH
jr c, .lastbar
ld e, a
ld a, $6a ; full bar
ld [hli], a
ld a, e
and a
jr z, .done
jr .fill
.lastbar
ld a, $62 ; empty bar
add e ; + e
ld [hl], a
.done
pop bc
pop de
pop hl
ret
; 3786
PrepMonFrontpic:: ; 3786
ld a, $1
ld [wBoxAlignment], a
_PrepMonFrontpic:: ; 378b
ld a, [wCurPartySpecies]
call IsAPokemon
jr c, .not_pokemon
push hl
ld de, vTiles2
predef GetMonFrontpic
pop hl
xor a
ld [hGraphicStartTile], a
lb bc, 7, 7
predef PlaceGraphic
xor a
ld [wBoxAlignment], a
ret
.not_pokemon
xor a
ld [wBoxAlignment], a
inc a
ld [wCurPartySpecies], a
ret
; 37b6