mapgen: Added seed index to maps
authorLukas Krickl <lukas@krickl.dev>
Fri, 25 Jul 2025 13:23:13 +0000 (15:23 +0200)
committerLukas Krickl <lukas@krickl.dev>
Fri, 25 Jul 2025 13:23:13 +0000 (15:23 +0200)
14 files changed:
maps/map_bc.s
maps/map_be.s
maps/map_bw.s
maps/map_c.s
maps/map_ce.s
maps/map_cw.s
maps/map_tc.s
maps/map_te.s
maps/map_tw.s
src/defs.s
src/mapgen.s
src/roompatterns.s
src/wram.s
tools/tms2map.py

index 25e66de262e21c534a0b3689605819abcc2fd1a2..f61a90e66e69c954f19cf4566aa6cce2bb147353 100644 (file)
@@ -10,6 +10,7 @@ dw bank8800
 dw bank8C00
 dw bank9000
 dw map_bc_exit_table
+dw 0
 
 map_bc_bg:
 
index 343afce6d52f7d0b577b6e9a46451bbcde1b5bea..817ac6e92e96a4df347d864069577a746130b2e1 100644 (file)
@@ -10,6 +10,7 @@ dw bank8800
 dw bank8C00
 dw bank9000
 dw map_bw_exit_table
+dw 0
 
 map_be_bg:
 
index 3565538117dc7a6193a32a96d053004f2919319a..fbcceb6a7624b64f2906bd2452204fd4c2c1cc80 100644 (file)
@@ -10,6 +10,7 @@ dw bank8800
 dw bank8C00
 dw bank9000
 dw map_bw_exit_table
+dw 0
 
 map_bw_bg:
 
index c12d5fd78b1d9983f590b7799cc16b6e23e56bd2..7ca2f0b5b82f648535beecfa6bdc85ad85dcb51c 100644 (file)
@@ -10,6 +10,7 @@ dw bank8800
 dw bank8C00
 dw bank9000
 dw map_c_exit_table
+dw 0
 
 map_c_bg:
 
index 30ce53e4fc0c396fdf95b9bf467164cc6b65bea7..eb9d07ae2116d496cde6caa27d5536db4fd1232d 100644 (file)
@@ -10,6 +10,7 @@ dw bank8800
 dw bank8C00
 dw bank9000
 dw map_ce_exit_table
+dw 0
 
 map_ce_bg:
 
index 6a33766002e2f24124d5bdb2f0e6d59597c01f10..7086460e5b63c3054b3abb2ca7f167117f754d19 100644 (file)
@@ -10,6 +10,7 @@ dw bank8800
 dw bank8C00
 dw bank9000
 dw map_cw_exit_table
+dw 0
 
 map_cw_bg:
 
index eb649b2735078d1f7171468eb7b3e17f3a48ecfa..7c0f1bb311ae6ea0cac1b5dc11a8013eb15c646f 100644 (file)
@@ -10,6 +10,7 @@ dw bank8800
 dw bank8C00
 dw bank9000
 dw map_tc_exit_table
+dw 0
 
 map_tc_bg:
 
index 9192c35dc5a1e29e772e1c29d7dcbc160b8da216..253104cba32e58a8f871b671b113500dccee89d1 100644 (file)
@@ -10,6 +10,7 @@ dw bank8800
 dw bank8C00
 dw bank9000
 dw map_te_exit_table
+dw 0
 
 map_te_bg:
 
index 5c984a5828eb82baefa55d4bee1ac03a93a178fe..e5ac2d7aca6d49914a7b83db2ea8e019b1758424 100644 (file)
@@ -10,6 +10,7 @@ dw bank8800
 dw bank8C00
 dw bank9000
 dw map_tw_exit_table
+dw 0
 
 map_tw_bg:
 
index 15b72f5621b2b737c3a337e6cc86a6088c86958d..cddca504aa8e70dd8593e2b572fec5c0d18457d0 100644 (file)
@@ -3,6 +3,8 @@
 
 .section defs
 
+#define FLOOR_MAP_COUNT 9
+
 .def int OAMDMAFN = 0xFF80 
 #define WRAM 0xC000
 #define WRAMLEN 0xFFF
   ; 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
index 16cd4c770f524b9fc69c0e7b1569955a2cd04792..15b7ce2f97540907d6df3855663df1ae7f425116 100644 (file)
@@ -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
index 4a65f544d39d3d55d7299f20399a1cda0cb3f0e2..69c9876eb321b420970befeca216f33a3cfbb91b 100644 (file)
@@ -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
index 0be6abbe8c24c3518705688b8e7a100e38a38ab0..608cb5b5867a2d78bf1829dcc10745aee25ec416 100644 (file)
@@ -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:
index 2706b4581bfb33d2817048aa48d7cbc0bd8221be..de0889cc189a8738c8352912bb4b2ee359740710 100755 (executable)
@@ -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