#define UI_STATUS_LINE shadow_ui+1
+#define TILES_ADJACENT_MAX 8
+
.def int OAMDMAFN = 0xFF80
#define WRAM 0xC000
#define WRAMLEN 0xFFF
; inputs:
; de: tile
tile_update:
+ push de
+ call tile_get_adjacent
+ pop de
+
ld a, [de] ; load tile type
add a, a ; * 2 offset into table
; returns:
; bc: actor
tile_get_actor:
+ ld bc, NULL
; TODO:
ret
; also counts the amount of seen types
; in tiles_adjacen_types
tile_get_adjacent:
+ ; clear adjacent tiles
+ ; stored by previous frame
+ ld hl, tiles_adjacent
+ ld bc, 2 * TILES_ADJACENT_MAX
+ ld de, 0
+ call memset
+
+ ; bc = y/x
+ ld a, [update_tile_y]
+ ld b, a
+ ld a, [update_tile_x]
+ ld c, a
+
+ ld hl, tiles_adjacent
+
+ ; now get all tiles adjacent
+
ret
; updates empty tile
; list of pointers
; to all adjacent tiles
; set to NULL if no tile is adjacent
-tiles_adjacent: .adv 2 * 8
- ; a list of adjacent types
- ; one byte for each TI_* type
-tiles_adjacent_types: .adv TI_SIZE
+tiles_adjacent: .adv 2 * TILES_ADJACENT_MAX
ui_draw_routine: .adv 2