From: Lukas Krickl Date: Thu, 21 Aug 2025 13:58:27 +0000 (+0200) Subject: mapgen: wip mapgen X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=7fdb5e24dc3274b19b9f7e46ff171cc31669b184;p=gbrg%2F.git mapgen: wip mapgen --- diff --git a/src/mapgen.s b/src/mapgen.s index a03a085..04df720 100644 --- a/src/mapgen.s +++ b/src/mapgen.s @@ -146,8 +146,8 @@ mapgen: ; avoids placing doors at the edge. ; stops after plaving at least N doors mapgen_make_doors: - ld b, 3 - ld c, 3 ; bc = y/x position + 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 @@ -159,8 +159,8 @@ mapgen_make_doors: push bc push hl call rand - add a, FLOOR_MAP_COUNT * 2 ; at least N doors - and a, (FLOOR_MAP_COUNT - 1) * 4 + add a, 12 ; at least N doors + and a, (FLOOR_MAP_COUNT - 1) pop hl pop bc @@ -186,6 +186,7 @@ mapgen_make_doors: pop af dec a jr nz, @loop REL + BREAK ret ; creates the counterpart to @@ -299,9 +300,9 @@ make_door: ld [hl], a dec b ; y-- - - ld de, -FLOOR_W & 0xFFFF - add hl, de ; hl one row up + + ; move hl up one row +.rep i, FLOOR_W, 1, dec hl pop af ret @@ -317,8 +318,8 @@ make_door: inc bc ; y++ - ld de, FLOOR_W - add hl, de ; hl one row downa + ; move hl one row down +.rep i, FLOOR_W, 1, inc hl pop af ret