.se 0
.de TT_EMPTY, 1
.de TT_OPEN, 1
+
+ ; tile p0 for TT_LOCKED
+ ; 0000nnnn: direction bits locked door (TF_SE, NE, WE, SE)
+ ; nnnn0000: lock level (0-15)
.de TT_LOCKED, 1
+.de TT_WATER, 1
+.de TT_WATER_DEEP, 1
+
+ ; tile p0 for TT_LAVA
+ ; 0000nnnn: damage level
+.de TT_LAVA, 1
+
+
; tile flags0
.se 1
; SOUTH EXIT
; EAST EXIT
.de TF_EE, 8
+
; tile struct
.se 0
.de t_type, 1
.db 0 ; terminate
l1_tile_props:
- maptpdef TT_LOCKED, 1, 0, 0, 0, 0
+ maptpdef TT_LOCKED,\
+ 1,\
+ 0,\
+ 0,\
+ 0,\
+ (1 << 4) | TF_SE
+
.db 0 ; terminate
tile_banks_default:
call OAMDMAFN
ret
+ ; gets the direction vector
+ ; for the current player direction
+ ; inputs:
+ ; player actor direction
+ ; returns:
+ ; tle_dir_vector: set for all directions
+_map_full_draw_get_dir_vector:
+ ld a, [player+act_dir]
+ and a, ACT_DIR_MASK
+
+ cp a, SOUTH
+ jp z, @south
+
+ cp a, NORTH
+ jp z, @north
+
+ cp a, WEST
+ jp z, @west
+
+ ; default case east
+@east:
+ ret
+
+@south:
+ ret
+
+@north:
+ ret
+
+@west:
+ ret
+
+
+
; draws a full map copy into the current map view buffer
; bsed on the current location the player is facing
; the map render buffer is then written to the screen
; render_buffer: new map data to be drawn
; transferts to redraw state
map_full_draw:
- ; now we can draw the map
+ ; TODO: remove this call once all references to the
+ ; wram values are removed
+ ; now we can draw the map
call map_full_draw_count_forward_attributes
+ call _map_full_draw_get_dir_vector
+
ld a, [tmp_map_forward]
cp a, MAP_NO_DOOR
jp z, @short_wall
render_buffer: .adv RENDER_BUF_TILES
minimap_buffer: .adv 9
+ ; TODO: refactor map draw to not use
+ ; these tmps or tile_near far etc
+ ; it should just use tile_direction_vector
+ ; to read tiles ahead
tmp_map_forward: .adv 1
tmp_map_near_left_door: .adv 1
tmp_map_near_right_door: .adv 1
tmp_map_furthest_left_door: .adv 1
tmp_map_furthest_right_door: .adv 1
+ ; tmeporary actor position backup
tmp_act_y: .adv 1
tmp_act_x: .adv 1
tile_far: .adv 2
tile_furthest: .adv 2
+ ; current tile direction vector
+ ; y and x direction for player
+ ; this can be used to get all tiles ahead
+ ; by moving in the direction
+ ; mainly used for player attack direction and
+ ; rendering the first person view
+tile_dir_vector_forward: .adv 2
+tile_dir_vector_back: .adv 2
+tile_dir_vector_left: .adv 2
+tile_dir_vector_right: .adv 2
+
; combat data
combat: .adv combat_size