; TODO:
ret
+ ; stores an adjacent tile
+ ; inputs:
+ ; $1: skip if x position equal
+ ; $2: tile offset based on bc
+ ; bc: current tile ptr
+ ; de: destination
+ ; returns:
+ ; de: next destination
+#macro tile_adjacent_store
+.beginscope
+ ; check if x is 0
+ ; if so skip left tile
+ ld a, [update_tile_x]
+ cp a, $1
+ jr z, @skip REL
+
+ ; store left tile
+ ld hl, $2
+ add hl, bc
+ ; move to new position
+
+ ; store tile
+ ld a, h
+ ld [de], a
+ inc de
+ ld a, l
+ ld [de], a
+ inc de
+
+@skip:
+.endscope
+#endmacro
+
; stores pointers to
; all adjacent tiles
; stores NULL if adjacent tile is out
ld b, a
ld a, [update_tile_x]
ld c, a
+ call map_get_tile
- ld hl, tiles_adjacent
+ ; hl = current tile
+ push hl
+ pop bc ; bc = current tile
+
+ ; de = destination
+ ld de, tiles_adjacent
; now get all tiles adjacent
+ ; 1) get tiles above (up to 3 tiles)
+
+ ; check if y is already 0, if so skip
+ ld a, [update_tile_y]
+ cp a, 0
+ jp z, @skip_above
+ ; up/center tile
+ tile_adjacent_store 0xFF, (-1 * (t_size * MAP_W)) & 0xFFFF
+ ; up/left tile
+ tile_adjacent_store 0, (-1 * (t_size * (MAP_W+1))) & 0xFFFF
+ ; up/right tile
+ tile_adjacent_store (MAP_W-1), (-1 * (t_size * (MAP_W-1))) & 0xFFFF
+
+@skip_above:
+
+ ; 2) get tiles left and right (up to 2 tiles)
+
+ ; 3) get tiles below (up to 3 tiles)
+
+
ret
; updates empty tile