.endscope
#endmacro
- ; writes the input tiles
- ; act and prop into act_nearby and prop_nearby
- ; inputs:
- ; hl: tile
- ; preserves:
- ; all registers
-map_write_nearby_act_prop:
- push_all
-
- ld de, t_act
- add hl, de
-
- ; write act
- ld a, [hl+]
- ld [act_nearby], a
- ld a, [hl+]
- ld [act_nearby+1], a
-
- ; write prop
- ld a, [hl+]
- ld [prop_nearby], a
- ld a, [hl]
- ld [prop_nearby+1], a
- pop_all
- ret
+ ; writes the nearby tile information
+ ; for tile_near, tile_far etc
+ ; inputs:
+ ; bc: y/x coordinate
+ ; $1: offset (0 for tile_near, 2 for tile far)
+#macro _map_write_nearby_tile
+ push af
+ ld a, b
+ ld [tile_near+$1], a
+ ld a, c
+ ld [tile_near+1+$1], a
+ pop af
+#endmacro
; counts the tiles the player can move forward
; inputs:
; tmp_map_near_right_door: 0/1 door present or not
; tmp_map_far_left_door: 0/1 door present or not
; tmp_map_far_right_door 0/1 door present or not
+ ; tile_near: near tile coordinates
+ ; tile_far: far tile coordinates
map_full_draw_count_forward_attributes:
xor a, a
ld [tmp_map_forward], a
ld [tmp_map_far_left_door], a
ld [tmp_map_far_right_door], a
- ; clear nearby prop and act
- ld [act_nearby], a
- ld [act_nearby+1], a
- ld [prop_nearby], a
- ld [prop_nearby+1], a
+
+ ; clear tile_near and tile_far
+ ld a, 0xFF
+ ld [tile_near], a
+ ld [tile_near+1], a
+ ld [tile_far], a
+ ld [tile_far+1], a
ld a, [player+act_pos_y]
ld b, a
ld a, [player+act_dir]
and a, ACT_DIR_MASK
+ _map_write_nearby_tile 0
; which routine to run to find values?
cp a, SOUTH
map_full_draw_write_door_state 1, 1, ret
dec b ; move one tile back
+ _map_write_nearby_tile 2
call map_get_tile
- call map_write_nearby_act_prop
map_full_draw_door_state TF_NE, TF_WE, TF_EE
map_full_draw_write_door_state 3, 2, ret
map_full_draw_write_door_state 1, 1, ret
inc b ; move one tile forward
+ _map_write_nearby_tile 2
call map_get_tile
- call map_write_nearby_act_prop
map_full_draw_door_state TF_SE, TF_WE, TF_EE
map_full_draw_write_door_state 3, 2, ret
map_full_draw_write_door_state 1, 1, ret
inc c ; move one tile east
+ _map_write_nearby_tile 2
call map_get_tile
- call map_write_nearby_act_prop
map_full_draw_door_state TF_EE, TF_NE, TF_SE
map_full_draw_write_door_state 3, 2, ret
map_full_draw_write_door_state 1, 1, ret
dec c ; move one tile west
+ _map_write_nearby_tile 2
call map_get_tile
- call map_write_nearby_act_prop
map_full_draw_door_state TF_WE, TF_SE, TF_NE
map_full_draw_write_door_state 3, 2, ret