; inits UI
ui_init:
- call ui_draw
+ ret
+
+ ; schedules a unit draw
+ ; inputs:
+ ; de: unit
+ui_unit_need_draw:
+ ld a, [draw_flags]
+ or a, DRAWF_UPDATE_UI
+ ld [draw_flags], a
+
+ ; store actor
+ ld hl, ui_draw_actor
+ ld a, e
+ ld [hl+], a
+ ld a, d
+ ld [hl], a
+
ret
; update the UI
; this should only be called
; during blanking
ui_draw:
+ ld a, [draw_flags]
+ xor a, DRAWF_UPDATE_UI
+ ld [draw_flags], a
+
+ ld a, [ui_draw_actor]
+ ld l, a
+ ld a, [ui_draw_actor+1]
+ ld h, a
+ ; hl = actor
+ ld de, act_moves
+ add hl, de ; hl = current moves
+ ld a, [hl] ; a = counter
+ ld d, a ; d = counter
+
+ ; draw to screen
+ ld a, UI_TILE_MOVE
+ ld hl, SCRN1+1
+@loop:
+ ld [hl+], a
+ dec d
+ jr nz, @loop REL
+
ret
ret
unit_demo_1_init:
+ call ui_unit_need_draw
ldnull bc
ret
; x position scroll
ld a, [hl]
- BREAK
; max x
cp a, 0x16
jr c, @not_max_x REL
unit_demo_1:
st_def 0x00, unit_demo_1_init, st_unit_demo_1_update
- act_def ACT_T_DEMO_1, 0, 1, 1, 1, 1, 1, 2, 2, 0
+ act_def ACT_T_DEMO_1, 0, 1, 2, 3, 4, 5, 2, 2, 0
act_st_def NULL, NULL, st_unit_demo_1_update, NULL
st_unit_demo_1_update:
bg_update_index: .adv 2
bg_update_queue: .adv bge_size * BGE_MAX
+draw_flags: .adv 1
+
+ ; ptr to actor for next UI update
+ui_draw_actor: .adv 2
+
; game state
; this region holds the entire game state
; everything thats needed for a savme game should be