call cells_draw_all
+ ; TOOD: remove demo unit load
+ call map_load_demo_actors
+
ret
; loads a tile map into cells
ret
-
+ ; sets up some actors for debug purposes
+map_load_demo_actors:
+ ret
#include "default_map.s"
; updates a unit table
; runs state for each unit
+ ; does not update if actor is ACT_T_NULL
; inputs:
; hl: unit table (p0/p1)
units_update:
+ ; loop counter
+ ld a, UNITS_MAX
+
+@loop:
+ push af ; store loop counter
+
+ push hl
+ ld de, act_type
+ add hl, de ; hl = act_type
+
+ ; a = type
+ ld a, [hl]
+ pop hl ; restore hl
+ cp a, ACT_T_NULL ; do not update type NULL
+ jr z, @skip REL
+
+ ; save hl again
+ ; hl = act_state state machine
+ push hl
+ push hl
+ pop de ; need hl in de for parameter
+ call st_update
+
+@skip:
+ ; next actor
+ ld de, act_size
+ add hl, de
+
+ ; a--
+ pop af
+ dec a
+ jr nz, @loop REL
+
ret