From: Lukas Krickl Date: Wed, 20 Aug 2025 21:49:14 +0000 (+0200) Subject: mapgen: wip rework of mapgen X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=6a4c0f753065370c12f92f6bfbb7f5d3de586db2;p=gbrg%2F.git mapgen: wip rework of mapgen --- diff --git a/src/map.s b/src/map.s index 9706274..a1463a2 100644 --- 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 diff --git a/src/mapgen.s b/src/mapgen.s index 1c430db..8a1bf62 100644 --- a/src/mapgen.s +++ b/src/mapgen.s @@ -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 diff --git a/src/update.s b/src/update.s index 39958bf..5cad867 100644 --- a/src/update.s +++ b/src/update.s @@ -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