map_full_draw_oam_clear:
; first clear nearby actors from oam
call shadow_oam_clear
- ; draw UI again
- call compass_draw
call next_vblank_wait
; dma empty oam
call OAMDMAFN
; draws a full map copy into the current map view buffer
- ; based on the current location the player is facing
- ; the map render buffer is then written to the screen
- ; draws rooms ahead of the player back to front
+ ; draws the are around the players viewport
; inputs:
; [map]
; returns:
; transferts to redraw state
map_full_draw:
@done:
- call minimap_full_draw
-
; 4) go to render state
call update_render
ret
; draws the entire UI
; only call during blank
ui_draw:
- ; draw map border
-
- ; draw minimap to ui
- ld hl, SCRN1 + 32 * 2 + 16
- ld de, 29 ; offset for next row
-
- ; row 0
- ld a, [minimap_buffer]
- ld [hl+], a
-
- ld a, [minimap_buffer+1]
- ld [hl+], a
-
- ld a, [minimap_buffer+2]
- ld [hl+], a
-
- ; row 1
- add hl, de
- ld a, [minimap_buffer+3]
- ld [hl+], a
-
- ld a, [minimap_buffer+4]
- ld [hl+], a
-
- ld a, [minimap_buffer+5]
- ld [hl+], a
-
- ; row 2
- add hl, de
- ld a, [minimap_buffer+6]
- ld [hl+], a
-
- ld a, [minimap_buffer+7]
- ld [hl+], a
-
- ld a, [minimap_buffer+8]
- ld [hl+], a
-
- ret
-
- ; draws a single minimap tile based on the player's position
- ; inputs:
- ; $1: y offset
- ; $2: x offset
- ; returns:
- ; writes into minimap_buffer at the offset
-#macro minimap_draw_tile
-.beginscope
- ld a, [player+act_pos_y]
- add a, $1 & 0xFF
- ld b, a
-
- ld a, [player+act_pos_x]
- add a, $2 & 0xFF
- ld c, a
-
- call map_get_tile
- ; hl = tile
-
- inc hl ; hl = tile flags
- ld a, [hl] ; load tile information
- add a, 0x60 ; tile offset for map tiles
-
- ; 0/0 is the center of the minimap
- ; so +4 and then offset by $1 and $2
- ld [minimap_buffer+4+($1*3)+$2], a
-.endscope
-#endmacro
-
- ; redraws the minimap
- ; into a 3x3 minimap buffer
-minimap_full_draw:
- minimap_draw_tile 0, 0
- minimap_draw_tile 0, 1
-
- minimap_draw_tile 1, 0
- minimap_draw_tile 1, 1
-
- minimap_draw_tile -1, 1
- minimap_draw_tile 1, -1
- minimap_draw_tile -1, -1
-
- minimap_draw_tile 0, -1
- minimap_draw_tile -1, 0
-
ret
-compass_tiles:
- .db TILE_SOUTH, TILE_NORTH, TILE_WEST, TILE_EAST
-
- ; draws the players current facing direction
- ; as a compass
-compass_draw:
- ld a, 1
- call oamalloc
-
- ; y
- ld a, WINDOW_Y + 40
- ld [hl+], a
-
- ; x
- ld a, WINDOW_X+137
- ld [hl+], a
-
- ; tile
- push hl
- ld a, [player+act_dir]
- and a, ACT_DIR_MASK
-
- ld d, 0
- ld e, a
- ld hl, compass_tiles
- add hl, de
- ld a, [hl] ; a = tile
- pop hl
- ld [hl+], a
-
- ; flags
- xor a, a
- ld [hl], a
-
-#ifdef DEBUG_UI
- call debug_draw_player_pos
-#endif
- ret