; hl = tile now
ret
+ ; modifies the status gfx of a tile
+ ; based on flags
+ ; inputs:
+ ; update_tile_ptr: ptr to tile
+ ; a: current gfx
+ ; returns:
+ ; a: gfx to display
+map_draw_tile_modify_status:
+ push af
+ ld a, [update_tile_ptr]
+ ld h, a
+ ld a, [update_tile_ptr+1]
+ ld l, a
+ ; a = original gfx
+ pop af
+
+ inc hl ; hl = flags
+ bit 0, [hl] ; test bit 0 (TF_INC)
+ jr nz, @inc REL
+
+ bit 1, [hl] ; test bit 1 (TF_DEC)
+ jr nz, @dec REL
+ ret
+@inc:
+ ld a, UI_TILE_PLUS
+ ret
+@dec:
+ ld a, UI_TILE_MINUS
+ ret
+
; prepares tile draw
; by writing the expected tiles
; to tile_to_draw[0] to [3]
; find tile to draw
push bc
call map_get_tile
+ ld a, h
+ ld [update_tile_ptr], a
+ ld a, l
+ ld [update_tile_ptr+1], a
+
ld bc, t_tile
add hl, bc ; hl = tile gfx
pop bc
; draw 2x2 tile
ld [hl+], a
inc a
+
+ push af
+ ; top left corner of tile
+ ; may display status effects
+ ; based on flags
+ push hl
+ call map_draw_tile_modify_status
+ pop hl
+
ld [hl+], a
+ pop af
; move down one tile row as well
#define UI_TILE_HP_2 0xCA
#define UI_TILE_HP_1 0xCB
-#define UI_TILE_PLUS 0x01
-#define UI_TILE_MINUS 0x11
+#define UI_TILE_PLUS 0x81
+#define UI_TILE_MINUS 0xA0
; inits UI
ui_init:
update_tile_to_draw: .adv 4
; ptr to vram for the next update tile
update_tile_vram: .adv 2
+
+ ; ptr to last draw_tile_prep
+update_tile_ptr: .adv 2