wip: map rendering
authorLukas Krickl <lukas@krickl.dev>
Sun, 11 Jan 2026 11:12:29 +0000 (12:12 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sun, 11 Jan 2026 11:12:29 +0000 (12:12 +0100)
TODO.md
src/debug.s
src/map.s
src/player.s
src/ui.s
src/update.s
src/wram.s

diff --git a/TODO.md b/TODO.md
index d8cd3c7324cc3625415bc11d2e597f8c9eccc580..415a83e1d11f39937fd19f12826dbead482a0ee1 100644 (file)
--- a/TODO.md
+++ b/TODO.md
 
 # Combat
 
+# Magic
+
+- scrolls can be found
+- scrolls are single use
+- if enough in is available the player can learn the spell
+- there are 5 spell slots
+
 # Equipment
 
 # UI
index d0e630981d72b3e6165a360f554a09d8feff19a3..822b0a87e71ca4a7be8f8e8c5b3356976689836e 100644 (file)
@@ -1,49 +1,2 @@
 #define DEBUG_FONT_START 0xD0
 
-debug_draw_player_pos:
-       ld a, 2
-       call oamalloc
-
-       ld de, player+act_pos_y
-       
-       ; draw y
-
-       ; y pos
-       ld a, 128
-       ld [hl+], a
-       
-       ; x pos
-       ld a, 32
-       ld [hl+], a
-
-       ; tile
-       ld a, [de]
-       add a, DEBUG_FONT_START
-       ld [hl+], a
-
-       ; flags
-       xor a, a
-       ld [hl+], a
-
-       ; draw x
-       
-       ; y pos
-       ld a, 128
-       ld [hl+], a
-
-       ; x pos
-       ld a, 40
-       ld [hl+], a
-
-       ; tile
-       inc de
-       ld a, [de]
-       add a, DEBUG_FONT_START
-       ld [hl+], a
-
-       ; flags
-       xor a, a
-       ld [hl+], a
-
-
-       ret
index 95727bb7ef73c903899b286350055700c187ef14..b2eb76ec5b60629f04028cf911d37ac598fcb40c 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -253,8 +253,6 @@ map_get_tile:
 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
@@ -264,9 +262,7 @@ map_full_draw_oam_clear:
 
        
        ; 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:
@@ -274,8 +270,6 @@ map_full_draw_oam_clear:
        ; transferts to redraw state
 map_full_draw:
 @done:
-       call minimap_full_draw
-
        ; 4) go to render state
        call update_render
        ret
index a004581fdd3e8458c8d6729edcf0249cada4926a..40757289c64cbe6f04459b71818709a5b7cb83ce 100644 (file)
@@ -67,6 +67,10 @@ player_init:
        ld hl, player_attr
        ld bc, attr_size
        call memset
+
+       ; set default view
+       ld a, 5
+       ld [player_viewport], a
        
        ret
        
index 697c7a65696a2c24acb3c88111368b9fa904ce3d..c3fcb3e6d0cb692836d2e7546a169b5c2ca9efac 100644 (file)
--- a/src/ui.s
+++ b/src/ui.s
@@ -33,129 +33,6 @@ ui_update:
        ; 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
index 44204c37d5b84af0e5c03d1788f2feb40f56fb04..112cb7ea067340a5313391020226b86f1c5ce273 100644 (file)
@@ -8,7 +8,6 @@ update_game:
        
        ; player should update even in debug mode
        call player_update
-       call compass_draw
 
   ; tick rng every frame
        call rand
index 110f82208796aa8518d38428c833ec5a43da3895..82e08cba5ae02caec4bb7d954801a8cfc8be21aa 100644 (file)
@@ -76,6 +76,7 @@ srand: .adv 2
 player_attr: .adv attr_size
 player_exp: .adv 2
 player_level: .adv 1
+player_viewport: .adv 1
 
 actors:
 player: .adv act_size