From: Lukas Krickl Date: Sun, 20 Apr 2025 06:16:44 +0000 (+0200) Subject: cells: Added additional input to cells X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=092a066281d01d539b55e53896d08689faa28bb5;p=gbrg%2F.git cells: Added additional input to cells cells now also get passed the screen ptr to their tile in bc --- diff --git a/src/cells.s b/src/cells.s index fe20de1..84f8ca2 100644 --- a/src/cells.s +++ b/src/cells.s @@ -3,6 +3,7 @@ ; 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 diff --git a/src/defs.s b/src/defs.s index c2b94d4..fe813c4 100644 --- a/src/defs.s +++ b/src/defs.s @@ -64,8 +64,12 @@ ; 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 diff --git a/src/simulation.s b/src/simulation.s index eb0d470..c3a98a9 100644 --- a/src/simulation.s +++ b/src/simulation.s @@ -11,11 +11,19 @@ sim_update: ; 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 diff --git a/src/update.s b/src/update.s index 076d2d6..2e6c2d5 100644 --- a/src/update.s +++ b/src/update.s @@ -9,7 +9,6 @@ update_game: ld de, actor_player call st_update - ; call player_update ; call sim_update ldnull bc diff --git a/src/wram.s b/src/wram.s index 4376b05..e8fbee1 100644 --- a/src/wram.s +++ b/src/wram.s @@ -68,6 +68,10 @@ r_population: .adv 2 ; 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: