WIP: exit table for rooms
authorLukas Krickl <lukas@krickl.dev>
Sun, 15 Dec 2024 09:28:54 +0000 (10:28 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sun, 15 Dec 2024 09:28:54 +0000 (10:28 +0100)
TODO.md
src/wram.s

diff --git a/TODO.md b/TODO.md
index befbea1ec236461f1015f4d4734169a4735afcde..25a16247be10da3fe94d156e04dcda3dba67e6a0 100644 (file)
--- a/TODO.md
+++ b/TODO.md
 
 - Generate a map of rooms 
 - Maps are stored in sram
-- No backtracking 
 - Rooms are taken from a set of base rooms in rom
+- Each room has 4 possible exit pointers which are set to 0000 by default
+- When a room is made the next direction will be picked
+- The generator then sets the exit pointer accordingly
+- Low chance to backtrack in either direction.
+- If direction is already taken, try again
+- If it fails after 4 tries advance to a new room and try again
+- Do this until all rooms are filled
index b5a148d3b946ccdcdc104d017ebecaf012d086b9..7292eb8d9363815013d9100c5f67f3de20a410ae 100644 (file)
@@ -73,6 +73,11 @@ damage_anim: .adv 1
 
 ; map region 
 
+#define NORTH 0
+#define EAST 1
+#define SOUTH 2
+#define WEST 3
+
 #define MAP_W 10
 #define MAP_H 10
 #define MAP_TOTAL_ROOMS MAP_W * MAP_H
@@ -80,6 +85,7 @@ damage_anim: .adv 1
   ; rooms are 9x9 meta tiles 
 #define ROOM_W 10
 #define ROOM_H 8
+#define ROOM_EXITS_MAX 4
 
 ; struct room
 ; FIXME: thse ptrs are currently in big endian...
@@ -87,6 +93,7 @@ damage_anim: .adv 1
 .de room_tiles, 2 ; be ptr to tiles
 .de room_flags, 2 ; be ptr to flags
 .de room_actor_table, 2 ; be ptr of actor table to be used
+.de room_exit_table, 2 ; list of ptrs to new rooms 
 .de room_size, 0
 
 ; room flags
@@ -120,6 +127,9 @@ curr_room_flags: .adv 2
   ;   bytes 1-n: n bytes of actor data to be copied to actor table
 curr_room_init_act: .adv 2
 
+  ; ptr to exits
+curr_room_exits: .adv 2
+
   ; drawing related flags
 
   ; UI flags