From 5d024b3f922d8e4a8957da76b9e754ab40c0e3cd Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 15 Dec 2024 10:28:54 +0100 Subject: [PATCH] WIP: exit table for rooms --- TODO.md | 8 +++++++- src/wram.s | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index befbea1..25a1624 100644 --- a/TODO.md +++ b/TODO.md @@ -15,5 +15,11 @@ - 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 diff --git a/src/wram.s b/src/wram.s index b5a148d..7292eb8 100644 --- a/src/wram.s +++ b/src/wram.s @@ -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 -- 2.30.2