mapgen: Fixed various small issues in door placement
authorLukas Krickl <lukas@krickl.dev>
Thu, 21 Aug 2025 15:31:13 +0000 (17:31 +0200)
committerLukas Krickl <lukas@krickl.dev>
Thu, 21 Aug 2025 15:31:13 +0000 (17:31 +0200)
src/mapgen.s

index 04df7209900a3f9fb73218e584ce6ebeedae44dd..043bdfca3320fe8179b860825885a4398fdda3d0 100644 (file)
@@ -149,11 +149,12 @@ mapgen_make_doors:
        ld b, 1 
        ld c, 1 ; bc = y/x position
        ; start current ptr at 1/1 as well
-       ld hl, map_doors_location + 1  * FLOOR_W 
+       ld hl, map_doors_location + 1 + FLOOR_W 
 
        ; set map cursor
        ld a, 1 + FLOOR_W
        ld [player_map_cursor], a
+       BREAK
        
        ; select how many doors we want
        push bc
@@ -181,6 +182,7 @@ mapgen_make_doors:
                call make_door
                cp a, 0xFF
                jp z, @loop ; try again
+               BREAK
                call make_opp_door
 
                pop af
@@ -258,7 +260,7 @@ make_door:
        ; try again...
        ld a, 0xFF
        ret
-@right: 
+@left:
        
        ; can we even place it?
        ld a, c
@@ -275,9 +277,9 @@ make_door:
 
        pop af
        ret
-@left:
+@right:
        ld a, c
-       cp a, MAP_W-1
+       cp a, FLOOR_W-1
        jp z, @try_again
 
        ld a, [hl]
@@ -309,14 +311,14 @@ make_door:
 @down:
        
        ld a, b
-       cp a, MAP_H-1
+       cp a, FLOOR_H-1
        jp z, @try_again
 
        ld a, [hl]
        or a, DIRDOWN
        ld [hl], a
 
-       inc bc ; y++
+       inc b ; y++
 
        ; move hl one row down  
 .rep i, FLOOR_W, 1, inc hl