video: rectangles now despawn if the top corner is off-screen
authorLukas Krickl <lukas@krickl.dev>
Tue, 7 Oct 2025 04:00:29 +0000 (06:00 +0200)
committerLukas Krickl <lukas@krickl.dev>
Tue, 7 Oct 2025 04:00:29 +0000 (06:00 +0200)
src/video.s

index 3975e712476d4e01be4f0eec02d7b005cfa940ee..33f3bc4380037447a2a40dc263367b45c7a50685 100644 (file)
@@ -142,7 +142,8 @@ scroll_up_adjust:
 
                ld a, [hl]
                add a, SCROLL_ADJUST_STEP
-               ld [hl], a
+               ld [hl+], a
+               ; hl = r_pos_x
        
                ; check if off-screen
                cp a, -16 & 0xFF ; do not despawn if -16
@@ -150,6 +151,11 @@ scroll_up_adjust:
 
                pop de
                push de
+               ; go to r_h
+               inc hl ; hl = r_h
+               sub a, [hl]
+               capunderflow
+               ; despawn if *top* corner is far off-screen
                cp a, 0xA0 
                call nc, rect_despawn