mapgen: fixed hl being corruped when setting actor positions.
authorLukas Krickl <lukas@krickl.dev>
Tue, 16 Sep 2025 10:07:09 +0000 (12:07 +0200)
committerLukas Krickl <lukas@krickl.dev>
Tue, 16 Sep 2025 10:07:09 +0000 (12:07 +0200)
src/debug.s
src/mapgen.s
src/unit.s

index 57fe9b8b3f0c585b58f1b2531ffdc9254ef13d1d..4ada5bba2ee3fa5fa23f6fd1fedaa719e776b9b2 100644 (file)
@@ -92,9 +92,9 @@ debug_menu_init:
        ;       returns:
        ;               bc: new state
 debug_fn_new_game:
-       ld a, 15
-       ld [srand], a
-       ld [srand+1], a
+       ld a, 15
+       ld [srand], a
+       ld [srand+1], a
 
        call new_game_init
        ld bc, st_update_game
index 8b745846c86628d8a5a4f2135605e41018bdcd35..7bad57e113038f4f0c38791cdd104a8dfb7a7cec 100644 (file)
@@ -556,9 +556,9 @@ mapgen_place_actors:
        ; preserves all registers
 mapgen_unit_randomize_position:
        push_all
-@retry:
        ld hl, act_pos_y
        add hl, de ; hl = y pos
+@retry:
        
        ; select position
        push hl
@@ -590,6 +590,7 @@ mapgen_unit_randomize_position:
        cp a, 0
        jr nz, @retry REL
        
+       BREAK
        ; write y and x positions
        ld a, b
        ld [hl+], a
index 3235c8b82f4d77970480a26b4f12365a3db8d41c..95d3c7b41f159b4f2eb41107ae0ae4872234c913 100644 (file)
@@ -602,7 +602,7 @@ unit_find_at:
                ld de, act_pos_y
                add hl, de 
                ; hl = y pos
-
+               
                ; check if positions match      
                ld a, [hl+]
                cp a, b ; does y match?