summaryrefslogtreecommitdiff
path: root/home/mon_stats.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/mon_stats.asm')
-rwxr-xr-xhome/mon_stats.asm91
1 files changed, 91 insertions, 0 deletions
diff --git a/home/mon_stats.asm b/home/mon_stats.asm
new file mode 100755
index 00000000..180ea533
--- /dev/null
+++ b/home/mon_stats.asm
@@ -0,0 +1,91 @@
+DrawBattleHPBar::
+; 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
+
+PrepMonFrontpic::
+ ld a, $1
+ ld [wcf3b], a
+
+_PrepMonFrontpic::
+ ld a, [wCurPartySpecies]
+ and a
+ jr z, .not_pokemon
+ cp EGG
+ jr z, .egg
+ cp NUM_POKEMON + 1
+ jr nc, .not_pokemon
+.egg
+ push hl
+ ld de, vTiles2
+ predef GetMonFrontpic
+ pop hl
+ xor a
+ ldh [hGraphicStartTile], a
+ lb bc, 7, 7
+ predef PlaceGraphic
+ xor a
+ ld [wcf3b], a
+ ret
+
+.not_pokemon
+ xor a
+ ld [wcf3b], a
+ inc a
+ ld [wCurPartySpecies], a
+ ret \ No newline at end of file