From 669934088af0fbafe900f71ba25afed03cfbe355 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 16 Sep 2025 12:07:09 +0200 Subject: [PATCH] mapgen: fixed hl being corruped when setting actor positions. --- src/debug.s | 6 +++--- src/mapgen.s | 3 ++- src/unit.s | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/debug.s b/src/debug.s index 57fe9b8..4ada5bb 100644 --- a/src/debug.s +++ b/src/debug.s @@ -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 diff --git a/src/mapgen.s b/src/mapgen.s index 8b74584..7bad57e 100644 --- a/src/mapgen.s +++ b/src/mapgen.s @@ -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 diff --git a/src/unit.s b/src/unit.s index 3235c8b..95d3c7b 100644 --- a/src/unit.s +++ b/src/unit.s @@ -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? -- 2.30.2