tiles: tiles now call the update routine
authorLukas Krickl <lukas@krickl.dev>
Sat, 8 Nov 2025 16:32:25 +0000 (17:32 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sat, 8 Nov 2025 16:32:25 +0000 (17:32 +0100)
src/tiles.s

index c206aafab0ea3e99df0c2cde76202df7ab0e6876..0040986959e6af6d78f9f2bf229e35f78eaf67da 100644 (file)
@@ -83,13 +83,22 @@ tile_update_draw:
        ; inputs:
        ;               de: tile
 tile_update:
-       ; TODO: for now just inc t_tile
-       ld hl, t_tile
-       add hl, de
+       ld a, [de] ; load tile type 
+       add a, a ; * 2 offset into table
+
+       ld b, 0
+       ld c, a ; bc = offset
+
+       ld hl, tile_update_table
+       add hl, bc
+
+       ; load ptr
+       ld a, [hl+]
+       ld b, a
        ld a, [hl]
-       inc a
-       ld [hl], a
-       ret
+       ld h, a
+       ld l, b
+       jp hl
 
        ; table of update routines
        ; for each tile
@@ -124,6 +133,14 @@ tile_get_actor:
        ; inputs:
        ;               de: tile
 tile_update_empty:
+
+       ; TODO: for now just inc t_tile
+       ld hl, t_tile
+       add hl, de
+       ld a, [hl]
+       inc a
+       ld [hl], a
+       ret
        ret
        
        ; updates controlled tile