ld [srand+1], a
ret
+ ; makes a room at a sector offset
+ ; the room is placed randomly within the sector
+ ; and then drawn.
+ ; inputs:
+ ; $1: sector y
+ ; $2: sector x
+#macro _mapgen_make_room_section
+.beginscope
+ ld hl, mapgen_tiles + MAP_SECTION_SIZE * MAP_SECTION_PER_ROW * MAP_SECTION_SIZE \
+ * $1 + MAP_SECTION_SIZE * $2
+ ld bc, 0x0808 ; 8x8 fill the entire sector for now
+ call mapgen_make_room
+.endscope
+#endmacro
+
; generates all rooms
; for each section of the map
; the map is split into MAP_SECTION_SIZExMAP_SECTION_SIZE
; sections (e.g. 4x4 sections of 8x8 tiles)
; rooms are placed in each section and then linked up using hallways
mapgen_make_rooms:
- ; TODO: this is a test room
- ld hl, mapgen_tiles+1+MAP_W
- ld bc, 0x0505 ; 5x5
- call mapgen_make_room
+ _mapgen_make_room_section 0, 0
+ _mapgen_make_room_section 0, 1
+ _mapgen_make_room_section 0, 2
+ _mapgen_make_room_section 0, 3
+
+ _mapgen_make_room_section 1, 0
+ _mapgen_make_room_section 1, 1
+ _mapgen_make_room_section 1, 2
+ _mapgen_make_room_section 1, 3
ret
; generates a single rectanglular room