From d83f4258e2c2956173d14b26493a10cd5ec78b65 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 11 Nov 2025 18:19:35 +0100 Subject: [PATCH] tiles: adjacent tiles are now stored in an array --- src/tiles.s | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/tiles.s b/src/tiles.s index a1534bf..86c4a19 100644 --- a/src/tiles.s +++ b/src/tiles.s @@ -216,8 +216,25 @@ tile_get_adjacent: ; 2) get tiles left and right (up to 2 tiles) + ; left + tile_adjacent_store 0, (-1 * t_size) & 0xFFFF + ; right + tile_adjacent_store (MAP_W-1), t_size + ; 3) get tiles below (up to 3 tiles) + ; check if y is already MAP_H-1 if so skip + ld a, [update_tile_y] + cp a, MAP_H-1 + jp z, @skip_below + + ; down/center tile + tile_adjacent_store 0xFF, (t_size * MAP_W) + ; down/left tile + tile_adjacent_store 0, (t_size * (MAP_W+1)) + ; down/right tile + tile_adjacent_store (MAP_W-1), (t_size * (MAP_W-1)) +@skip_below: ret -- 2.30.2