cells now also get passed the screen ptr to their tile in bc
; does not call c_st_routine if c_head_offset != 0
; inputs:
; de: cell ptr
+ ; bc: screen ptr
cell_update:
inc de ; de = flags
ld a, [de] ; a = head offset
; if a c_st_rotuine returns a non-zero value in bc
; the rotuine pointed to will be used during the next
; cell update
+ ; additionally bc will point to the current screen
+ ; pointer for the cell
+ ; inputs:
+ ; de: cell ptr
+ ; bc: screen ptr
.de c_st_routine, 2
-
.de c_size, 0
; cell type enum
; cells in a single go
; later we want a limit
ld de, state_cells
+ ld bc, SCRN0
@loop:
; advance to next cell
.rep i, c_size, 1, inc de
-
+ inc bc
+
+ push de
+ push bc
+ call cell_update
+ pop bc
+ pop de
+
; check if we need to exit
ld a, state_cells_end LO
cp a, e
ld de, actor_player
call st_update
- ; call player_update
; call sim_update
ldnull bc
; for cell update loop
; big endian
cell_ptr: .adv 2
+
+ ; cell screen ptr
+ ; points to tile that this cell owns
+cell_screen_ptr: .adv 2
state_cells: .adv c_size * MAP_SIZE
state_cells_end: