map: turning now causes oam to be cleared
authorLukas Krickl <lukas@krickl.dev>
Fri, 19 Dec 2025 15:02:28 +0000 (16:02 +0100)
committerLukas Krickl <lukas@krickl.dev>
Fri, 19 Dec 2025 15:02:28 +0000 (16:02 +0100)
This prevents actors from drawing on top of a wall when turning

src/map.s
src/player.s
src/update.s

index 811811e57509c25f62f1978e3c1cbb39dab9219c..d38df5a848718a89ef209a3c7969493288695497 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -523,6 +523,19 @@ _map_full_draw_near_doors:
 @no_near_right:
        ret
        
+       ; optional: 
+       ; clear oam and redraw only UI
+       ; should be run when the actor turns
+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
+       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
@@ -536,6 +549,7 @@ _map_full_draw_near_doors:
        ;               render_buffer: new map data to be drawn
        ; transferts to redraw state
 map_full_draw:
+       ; now we can draw the map
        call map_full_draw_count_forward_attributes
 
        ld a, [tmp_map_forward]
index 46af4c057609eb46fc42a669aace322310475f9e..1d2815f1dcc441db64a48bfb63d40df20b625aef 100644 (file)
@@ -55,6 +55,8 @@ player_handle_move:
                and a, ~ACT_DIR_MASK & 0xFF
                or a, b
                ld [player+act_dir], a
+
+               call map_full_draw_oam_clear
                call map_full_draw
 @not_left:
 
@@ -73,6 +75,8 @@ player_handle_move:
                and a, ~ACT_DIR_MASK & 0xFF
                or a, b
                ld [player+act_dir], a
+
+               call map_full_draw_oam_clear
                call map_full_draw
 @not_right:
 
index 97cf88569307f5d0ac079fdbd8c33be6d402bb70..619a100296d17b3988337db207798447c562d925 100644 (file)
@@ -50,6 +50,10 @@ update_game:
 
        call ui_update
 
+       
+       ; draws visible act and props
+       ; for the current frame
+update_game_draw_act_and_prop:
        ; TODO: update map routine
        _update_game_draw_act near
        _update_game_draw_act far