; 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
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
pop af
dec a
jr nz, @loop REL
+ BREAK
ret
; creates the counterpart to
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
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