scroll: fixed scrolling triggering too frequently
authorLukas Krickl <lukas@krickl.dev>
Sat, 20 Sep 2025 16:15:22 +0000 (18:15 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 20 Sep 2025 16:15:22 +0000 (18:15 +0200)
src/actor.s
src/player.s
src/video.s

index 29632a39a7f10224695340ed5e03ed938a951282..d7a2a6433f8f1480bd09ad91188d8950c0f63379 100644 (file)
@@ -122,3 +122,11 @@ actor_load_test:
        ld [actors+act_pos_x], a
 
        ret
+       
+       ; despawns an actor
+       ; inputs:
+       ;               de: actor ptr
+actor_despawn:
+       xor a, a
+       ld [de], a
+       ret
index 5949dcd7feebc94788b2db2806f89a38b24c5471..b8946617569a5858736d892591b9fb5b6d4c9852 100644 (file)
@@ -66,6 +66,11 @@ player_update:
        ; inputs:
        ;               player setp up counter
 player_try_scroll_up:
+       ; do not scroll if the scroll timer is enabled
+       ld a, [scroll_timer]
+       cp a, 0
+       ret nz
+
        ld a, [game_flags]
        and a, GPF_NO_SCROLL
        ret nz ; no scroll allowed for now
index 657c927e8083f853946c286ee860b41a367f0854..fc61a842fda4ada05f3ac3a41fc805fc2b24b95e 100644 (file)
@@ -58,7 +58,6 @@ video_map_adjust_scroll:
        dec a
        ld [scroll_timer], a
 
-
        ld a, [scroll_y]
        dec a
        ld [scroll_y], a
@@ -80,7 +79,7 @@ scroll_up_adjust:
        ld a, [hl]
        add a, 1
        ld [hl+], a ; hl = page y pos hi
-
+       
        ld a, [hl]
        adc a, 0
        ld [hl], a
@@ -92,6 +91,7 @@ scroll_up_adjust:
        add hl, de
        jr nz, @act_loop REL
 
+
        ; adjust player
 
        ld a, [player+act_pos_y]