map: Added map enable scroll if all enemis are defeated check
authorLukas Krickl <lukas@krickl.dev>
Sun, 5 Oct 2025 10:07:05 +0000 (12:07 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 5 Oct 2025 10:07:05 +0000 (12:07 +0200)
src/map.s

index 14be49379970b40f9d64fb3bef7d0e1e890f3c94..5803601c9d1cc4fa4a48361b42a829369d5e87ec 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -255,11 +255,33 @@ map_r_nop:
        ; checks if all enemies are defeated
        ; and re-enables scroll
 map_r_enable_scroll_all_enemies_defeated:
+       ; check if all enemies are NULL actors
+       ld hl, actors_enemy
+       ld de, act_size
+       ld b, ACTS_ENEMY
+       
+       xor a, a
+@check_loop:
+               ; or type into a
+               or a, [hl]
+               ret nz ; one type is not 0
+               add hl, de ; next actor 
+               dec b
+       jr nz, @check_loop REL
+
        ld a, [map_anim_timer]
        cp a, 0
        jp z, @no_animation
-       ; TODO
        call map_arrow_indicator
+
+       ld a, [map_anim_timer]
+       cp a, 0
+       ret nz ; if timer is not 0 do not set scroll
+       
+       ; re-enable scroll
+       ld a, [game_flags]
+       and a, ~GPF_NO_SCROLL & 0xFF
+       ld [game_flags], a
        ret
 
 @no_animation: