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0, 0x0, 0x0, 0x0, 0x0, 0x0
+.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
; $2: left direction
; $3: right direction
; returns:
- ; d/e: left/right door state
+ ; d/e: left/right door state (MAP_NO_DOOR or MAP_NEAR_DOOR)
; a: forward door state
#macro map_full_draw_door_state
.beginscope
- ld d, 0
- ld e, 0
+ ld d, MAP_NO_DOOR
+ ld e, MAP_NO_DOOR
inc hl ; flags
ld a, [hl]
and a, $2
jp z, @no_left
- ld d, 1
+ ld d, MAP_NEAR_DOOR
@no_left:
ld a, [hl]
and a, $3
jp z, @no_right
- ld e, 1
+ ld e, MAP_NEAR_DOOR
@no_right:
ld a, [hl]
and a, $1
jp z, @no_forward
- ld a, 1
+ ld a, MAP_NEAR_DOOR
@no_forward:
dec hl ; back to tile
; $1: offset from tmp_map_forward (e.g. +2 to write to far left/right door)
; $2: forward value to set
; $3: instruction to run if forward is 1 (e.g. ret, nop)
+ ; returns:
+ ; writes MAP_NO_DOOR, MAP_NEAR_DOOR, MAP_FAR_DOOR, MAP_FURTHEST_DOOR to tmp map door table
#macro map_full_draw_write_door_state
.beginscope
push af
@north:
; write near tile
map_full_draw_door_state TF_NE, TF_WE, TF_EE
- map_full_draw_write_door_state 1, 1, ret
+ map_full_draw_write_door_state 1, MAP_NEAR_DOOR, ret
dec b ; move one tile back
_map_write_nearby_tile 2
; write far tile
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 3, MAP_FAR_DOOR, ret
dec b ; move one tile back
_map_write_nearby_tile 4
; write furthest tile
map_full_draw_door_state TF_NE, TF_WE, TF_EE
- map_full_draw_write_door_state 5, 3, ret
+ map_full_draw_write_door_state 5, MAP_FURTHEST_DOOR, ret
ret
@south:
map_full_draw_door_state TF_SE, TF_WE, TF_EE
- map_full_draw_write_door_state 1, 1, ret
+ map_full_draw_write_door_state 1, MAP_NEAR_DOOR, ret
inc b ; move one tile forward
_map_write_nearby_tile 2
pop bc
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 3, MAP_FAR_DOOR, ret
inc b ; move one tile forward
_map_write_nearby_tile 4
call map_get_tile
map_full_draw_door_state TF_SE, TF_WE, TF_EE
- map_full_draw_write_door_state 5, 3, ret
+ map_full_draw_write_door_state 5, MAP_FURTHEST_DOOR, ret
ret
@east:
map_full_draw_door_state TF_EE, TF_NE, TF_SE
- map_full_draw_write_door_state 1, 1, ret
+ map_full_draw_write_door_state 1, MAP_NEAR_DOOR, ret
inc c ; move one tile east
_map_write_nearby_tile 2
pop bc
map_full_draw_door_state TF_EE, TF_NE, TF_SE
- map_full_draw_write_door_state 3, 3, ret
+ map_full_draw_write_door_state 3, MAP_FAR_DOOR, ret
inc c ; move one tile east
_map_write_nearby_tile 4
call map_get_tile
map_full_draw_door_state TF_EE, TF_NE, TF_SE
- map_full_draw_write_door_state 5, 3, ret
+ map_full_draw_write_door_state 5, MAP_FURTHEST_DOOR, ret
ret
@west:
map_full_draw_door_state TF_WE, TF_SE, TF_NE
- map_full_draw_write_door_state 1, 1, ret
+ map_full_draw_write_door_state 1, MAP_NEAR_DOOR, ret
dec c ; move one tile west
_map_write_nearby_tile 2
pop bc
map_full_draw_door_state TF_WE, TF_SE, TF_NE
- map_full_draw_write_door_state 3, 2, ret
+ map_full_draw_write_door_state 3, MAP_FAR_DOOR, ret
dec c ; move one tile west
_map_write_nearby_tile 4
call map_get_tile
map_full_draw_door_state TF_WE, TF_SE, TF_NE
- map_full_draw_write_door_state 5, 3, ret
+ map_full_draw_write_door_state 5, MAP_FURTHEST_DOOR, ret
ret
; draws near doors
_map_full_draw_near_doors:
ld a, [tmp_map_near_left_door]
- cp a, 1
+ cp a, MAP_NEAR_DOOR
jr nz, @no_near_left REL
ld hl, render_buffer + RENDER_BUF_W * 3
ld de, near_left_door
@no_near_left:
ld a, [tmp_map_near_right_door]
- cp a, 1
+ cp a, MAP_NEAR_DOOR
jr nz, @no_near_right REL
ld hl, render_buffer + RENDER_BUF_W * 3 + 16
ld de, near_right_door
call map_full_draw_count_forward_attributes
ld a, [tmp_map_forward]
- cp a, 0
+ cp a, MAP_NO_DOOR
jp z, @short_wall
@far_wall:
; clear far back door if _forward is > 1
ld a, [tmp_map_forward]
- cp a, 2
+ cp a, MAP_FAR_DOOR
jr c, @no_far_forward_door REL
ld hl, render_buffer + RENDER_BUF_W * 5 + 8
ld de, far_center_door
@no_far_forward_door:
ld a, [tmp_map_far_left_door]
- cp a, 1
+ cp a, MAP_NEAR_DOOR
jr nz, @no_far_left_door REL
ld hl, render_buffer + RENDER_BUF_W * 4 + 4
ld de, far_left_door
@no_far_left_door:
ld a, [tmp_map_far_right_door]
- cp a, 1
+ cp a, MAP_NEAR_DOOR
jr nz, @no_far_right_door REL
ld hl, render_buffer + RENDER_BUF_W * 4 + 12
ld de, far_right_door