2018-06-24 07:09:41 -07:00
|
|
|
IsAPokemon::
|
2018-04-04 21:35:14 -07:00
|
|
|
; 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
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DrawBattleHPBar::
|
2018-04-04 21:35:14 -07:00
|
|
|
; 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
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PrepMonFrontpic::
|
2018-04-04 21:35:14 -07:00
|
|
|
ld a, $1
|
|
|
|
ld [wBoxAlignment], a
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
_PrepMonFrontpic::
|
2018-04-04 21:35:14 -07:00
|
|
|
ld a, [wCurPartySpecies]
|
|
|
|
call IsAPokemon
|
|
|
|
jr c, .not_pokemon
|
|
|
|
|
|
|
|
push hl
|
|
|
|
ld de, vTiles2
|
|
|
|
predef GetMonFrontpic
|
|
|
|
pop hl
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hGraphicStartTile], a
|
2018-04-04 21:35:14 -07:00
|
|
|
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
|