call st_update
pop hl
+
+ push hl
+ call unit_update_draw
+ pop hl
@skip:
; next actor
ld de, act_size
ret
+ ; calls unit's draw function
+ ; inputs:
+ ; hl: actor ptr
+unit_update_draw:
+ push hl
+ ld de, act_draw
+ add hl, de
+ ; hl = draw ptr
+ ld a, [hl+]
+ ld e, a
+ ld a, [hl]
+ ld d, a
+ ; de = draw function
+ push de
+ pop hl ; hl = draw function
+ pop de ; de = actor
+ call_hl
+ ret
+
unit_demo_1_init:
ldnull bc
ret
call unit_scroll_center
pop de
- push bc
- call unit_demo_1_draw
- pop bc
-
ret
- ; inputs
- ; de: actor
-unit_demo_1_idle:
- call unit_demo_1_draw
- ret
; inputs
; de: actor
ldnull bc
ret
- ; inputs:
- ; de: actor
-unit_demo_1_delay_to_active:
- jp unit_delay_to_active
-
; draws any unit
; inputs:
; de: actor
jr z, @notup REL
call unit_try_move_up
- ld bc, st_unit_demo_1_delay_to_active
+ ld bc, st_unit_delay_to_active
ret
@notup:
jr z, @notdown REL
call unit_try_move_down
- ld bc, st_unit_demo_1_delay_to_active
+ ld bc, st_unit_delay_to_active
ret
@notdown:
jr z, @notleft REL
call unit_try_move_left
- ld bc, st_unit_demo_1_delay_to_active
+ ld bc, st_unit_delay_to_active
ret
@notleft:
jr z, @notright REL
call unit_try_move_right
- ld bc, st_unit_demo_1_delay_to_active
+ ld bc, st_unit_delay_to_active
ret
@notright:
dec a
ld [hl], a
- call unit_pause_objs
-
; we need the z flag to not be set ehre
; so just do something that will always unset it
or a, 1
ldnull bc
ret
+ ; inputs
+ ; de: actor
+unit_idle:
+ ldnull bc
+ ret
+
; pauses object redraws
; until unpause is called
unit_pause_objs:
ret
unit_demo_1:
- st_def 0x00, unit_demo_1_init, st_unit_demo_1_idle
+ st_def 0x00, unit_demo_1_init, st_unit_idle
act_def ACT_T_DEMO_1, 0, 1, 2, 3, 4, 6, 2, 2, 0
- act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_demo_1_idle
+ act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_idle
+ act_def_draw unit_demo_1_draw
unit_demo_2:
- st_def 0x00, unit_demo_1_init, st_unit_demo_1_idle
+ st_def 0x00, unit_demo_1_init, st_unit_idle
act_def ACT_T_DEMO_1, 0, 1, 2, 3, 1, 5, 3, 3, 0
- act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_demo_1_idle
+ act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_idle
+ act_def_draw unit_demo_1_draw
unit_demo_3:
- st_def 0x00, unit_demo_1_init, st_unit_demo_1_idle
+ st_def 0x00, unit_demo_1_init, st_unit_idle
act_def ACT_T_DEMO_1, 0, 1, 2, 3, 0, 5, 4, 4, 0
- act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_demo_1_idle
+ act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_idle
+ act_def_draw unit_demo_1_draw
st_unit_demo_1_update:
st_def 0x00, unit_demo_1_update, st_unit_demo_1_update
-st_unit_demo_1_idle:
- st_def 0x00, unit_demo_1_idle, st_unit_demo_1_idle
+st_unit_idle:
+ st_def 0x00, unit_idle, st_unit_idle
-st_unit_demo_1_delay_to_active:
- st_def CURSOR_MOVE_TIMER, unit_demo_1_delay_to_active, st_unit_switch_to_active
+st_unit_delay_to_active:
+ st_def CURSOR_MOVE_TIMER, unit_delay_to_active, st_unit_switch_to_active
st_unit_switch_to_active:
st_def 0, unit_switch_to_active, st_unit_switch_to_active