From: Lukas Krickl Date: Fri, 25 Jul 2025 13:23:13 +0000 (+0200) Subject: mapgen: Added seed index to maps X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=6f32cb12a867f9f62bf59422e37dec50032af780;p=gbrg%2F.git mapgen: Added seed index to maps --- diff --git a/maps/map_bc.s b/maps/map_bc.s index 25e66de..f61a90e 100644 --- a/maps/map_bc.s +++ b/maps/map_bc.s @@ -10,6 +10,7 @@ dw bank8800 dw bank8C00 dw bank9000 dw map_bc_exit_table +dw 0 map_bc_bg: diff --git a/maps/map_be.s b/maps/map_be.s index 343afce..817ac6e 100644 --- a/maps/map_be.s +++ b/maps/map_be.s @@ -10,6 +10,7 @@ dw bank8800 dw bank8C00 dw bank9000 dw map_bw_exit_table +dw 0 map_be_bg: diff --git a/maps/map_bw.s b/maps/map_bw.s index 3565538..fbcceb6 100644 --- a/maps/map_bw.s +++ b/maps/map_bw.s @@ -10,6 +10,7 @@ dw bank8800 dw bank8C00 dw bank9000 dw map_bw_exit_table +dw 0 map_bw_bg: diff --git a/maps/map_c.s b/maps/map_c.s index c12d5fd..7ca2f0b 100644 --- a/maps/map_c.s +++ b/maps/map_c.s @@ -10,6 +10,7 @@ dw bank8800 dw bank8C00 dw bank9000 dw map_c_exit_table +dw 0 map_c_bg: diff --git a/maps/map_ce.s b/maps/map_ce.s index 30ce53e..eb9d07a 100644 --- a/maps/map_ce.s +++ b/maps/map_ce.s @@ -10,6 +10,7 @@ dw bank8800 dw bank8C00 dw bank9000 dw map_ce_exit_table +dw 0 map_ce_bg: diff --git a/maps/map_cw.s b/maps/map_cw.s index 6a33766..7086460 100644 --- a/maps/map_cw.s +++ b/maps/map_cw.s @@ -10,6 +10,7 @@ dw bank8800 dw bank8C00 dw bank9000 dw map_cw_exit_table +dw 0 map_cw_bg: diff --git a/maps/map_tc.s b/maps/map_tc.s index eb649b2..7c0f1bb 100644 --- a/maps/map_tc.s +++ b/maps/map_tc.s @@ -10,6 +10,7 @@ dw bank8800 dw bank8C00 dw bank9000 dw map_tc_exit_table +dw 0 map_tc_bg: diff --git a/maps/map_te.s b/maps/map_te.s index 9192c35..253104c 100644 --- a/maps/map_te.s +++ b/maps/map_te.s @@ -10,6 +10,7 @@ dw bank8800 dw bank8C00 dw bank9000 dw map_te_exit_table +dw 0 map_te_bg: diff --git a/maps/map_tw.s b/maps/map_tw.s index 5c984a5..e5ac2d7 100644 --- a/maps/map_tw.s +++ b/maps/map_tw.s @@ -10,6 +10,7 @@ dw bank8800 dw bank8C00 dw bank9000 dw map_tw_exit_table +dw 0 map_tw_bg: diff --git a/src/defs.s b/src/defs.s index 15b72f5..cddca50 100644 --- a/src/defs.s +++ b/src/defs.s @@ -3,6 +3,8 @@ .section defs +#define FLOOR_MAP_COUNT 9 + .def int OAMDMAFN = 0xFF80 #define WRAM 0xC000 #define WRAMLEN 0xFFF @@ -251,7 +253,9 @@ ; pointer to exit table ; .de map_exit_table_ptr, 2 - + ; the seed to use for this map + ; read from [map_seeds] +.de map_seed_index, 1 ; map actor table struct diff --git a/src/mapgen.s b/src/mapgen.s index 16cd4c7..15b7ce2 100644 --- a/src/mapgen.s +++ b/src/mapgen.s @@ -1,4 +1,8 @@ - + + ; generates a new set of seeds + ; and places them into map_seeds +mapgen_seed: + ret ; places a rectangular room ; into the currently loaded map diff --git a/src/roompatterns.s b/src/roompatterns.s index 4a65f54..69c9876 100644 --- a/src/roompatterns.s +++ b/src/roompatterns.s @@ -61,6 +61,19 @@ room_pattern1: rprow RPLW, RPFL, RPFL, RPFL, RPFL, RPUW rprow RPBL, RPBW, RPBW, RPDB, RPBW, RPBR + ; translation tables for tiles +room_pattern_tile_translation: + ; walls + .db 0x6b, 0x6b, 0x6b + .db 0x6b, 0x6b, 0x6b + .db 0x6b, 0x6b + .db 0x00 ; floor + ; doors + .db 0x00, 0x00, 0x00, 0x00 + + ; translation table for flags +room_pattern_floor1_flags_translation: + ; table of 6 by 6 room patterns room_pattern_6by6: dw room_pattern1 diff --git a/src/wram.s b/src/wram.s index 0be6abb..608cb5b 100644 --- a/src/wram.s +++ b/src/wram.s @@ -139,7 +139,13 @@ player_eq_amulet: .adv 2 ; player_unit (unit 0) is reserved player_unit: .adv 0 p0_units: .adv act_size * UNITS_MAX - + + ; list of seeds used + ; for the current maps + ; fill using mapgen_seed +map_seeds: +dw FLOOR_MAP_COUNT * 2 + ; map tiles and collision data map: .adv c_size * MAP_SIZE map_end: diff --git a/tools/tms2map.py b/tools/tms2map.py index 2706b45..de0889c 100755 --- a/tools/tms2map.py +++ b/tools/tms2map.py @@ -15,6 +15,7 @@ tile_bank2 = "bank8C00" tile_bank3 = "bank9000" exit_table = "map_c_exit_table" actor_table_ptr = "map_actor_table_null" +map_seed_index = "0" map_name = "noname" NAME_LEN = 8 @@ -109,6 +110,7 @@ def print_header(name): print("dw " + tile_bank2) print("dw " + tile_bank3) print("dw " + exit_table) + print("dw " + map_seed_index) print("") def get_flag(tile): @@ -139,6 +141,7 @@ def get_map_props(root): global tile_bank3 global map_name global exit_table + global map_seed_index for child in root: if child.tag == "properties": @@ -161,6 +164,8 @@ def get_map_props(root): map_name = value elif name == 'exit_table': exit_table = value + elif name == 'seed_index': + seed_index = int(value) return