Added optional vblank wait to room row draw
authorLukas Krickl <lukas@krickl.dev>
Tue, 24 Dec 2024 10:56:29 +0000 (11:56 +0100)
committerLukas Krickl <lukas@krickl.dev>
Tue, 24 Dec 2024 10:56:29 +0000 (11:56 +0100)
This allows us to load a room without turning off the screen :^)

src/map.s

index 3bddb82f176b59d9ddf492d9f1b49c0e1494d93d..fccc323a975554cbfdc7e07a362602c4e30cee9b 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -159,7 +159,7 @@ room_goto:
   ; TODO: save current tables back 
   call disableinterrutpts
   call vblank_wait
-  call lcd_off
+  ;call lcd_off
 
   ld hl, curr_room_exits ; ptr to exit table 
   ld a, [hl+]
@@ -183,7 +183,7 @@ room_goto:
   ld a, WHO_PLAYER
   ld [who], a 
   
-  call lcd_on
+  ;call lcd_on
   call enableinterrupts
 
   ret
@@ -236,6 +236,11 @@ room_load_actors:
   ;   de: next row
   ;   hl: next screen address
 room_row_draw:
+  ; wait for vlbank for every row if the screen is not off
+  ld a, [RLCD]
+  cp a, 0
+  call nz, vblank_wait
+
   ld b, ROOM_W
 
   ; we'll need 
@@ -271,7 +276,13 @@ room_row_draw:
   add hl, bc
   
   ld b, ROOM_W
-  
+
+  ; wait for vlbank for every row if the screen is not off
+  ld a, [RLCD]
+  cp a, 0
+  call nz, vblank_wait
+
   ; almost the same loop again
   ; for the second row
   ; of the meta tile