mapgen: wip rework of mapgen
authorLukas Krickl <lukas@krickl.dev>
Wed, 20 Aug 2025 21:49:14 +0000 (23:49 +0200)
committerLukas Krickl <lukas@krickl.dev>
Wed, 20 Aug 2025 21:49:14 +0000 (23:49 +0200)
src/map.s
src/mapgen.s
src/update.s

index 97062746c293bf6e8dc173b27bb518a66579f1f5..a1463a2e798568d8597ca31c06caceba2851f513 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -1,18 +1,4 @@
 
-  ; initial map setup
-map_init:
-  ld hl, map_c_header 
-
-       ; inits a new floor
-       ; inputs:
-       ;               hl: map ptr
-       ;       calls map_load after but also clerars act_sg
-map_init_floor:        
-       ; clear act save data
-       push hl
-       call act_save_init
-       pop hl
-
   ; loads a new map
   ; inputs:
   ;   hl: map ptr
index 1c430db0f8e2c770dfce80b0d17117dd60527cf0..8a1bf62ffbb6ea99b825ef5fbb123df851ec5ed8 100644 (file)
@@ -1,7 +1,28 @@
   
+  ; initial map setup
+       ; seeds the floor
+       ; loads a random map from the map table 
+       ; clears act_save
+       ; also places initial door locations
+mapgen_init:
+       call act_save_init
+       call mapgen_seed
+       call mapgen_make_doors
+       call mapgen_select_map
+       call map_load
+       ret
+       
+       ; selects a map from the tables based on the current floor
+       ; and the current cursor seed
+       ; returns:
+       ;               hl: map pointer
+mapgen_select_map:
+  ld hl, map_c_header 
+       ret
+
+
   ; generates a new set of seeds
   ; and places them into map_seeds
-       ; also places initial door locations
 mapgen_seed:
   ld hl, map_seeds
   ; 2 bytes per seed
@@ -15,7 +36,6 @@ mapgen_seed:
     dec b
   jr nz, @loop REL
 
-       call mapgen_make_doors
 
   ret
 
index 39958bf92ab62938e0f10beeda51e0b3bfa81c58..5cad867d2edbc78b438c3d7e8aba43254b5b5230 100644 (file)
@@ -58,10 +58,7 @@ new_game_init:
 
   ; init initial map
   
-  ; load initial seed
-  call mapgen_seed
-
-  call map_init
+  call mapgen_init
   
   call game_init