Grow maze size with level (7x7 -> 17x17, +2 per level)
The maze side length is now a runtime global 'map_size' (MAP_SIZE=7 at level 1, +2 per level, capped at MAX_MAP_SIZE=17), while the maze array is allocated with the MAX_MAP_SIZE bound. All modules (maze DFS, fog rendering, player/enemy bounds, hatch and enemy-spawn placement) now use map_size at runtime. - globals: maze[MAX_MAP_SIZE][MAX_MAP_SIZE], map_size global, MAX_MAP_SIZE=17. - maze.c: DFS on map_size; stack/valid arrays made static (WRAM) and sized for the max maze to avoid hardware-stack overflow; hatch min distance scales with map_size/2. - engine.c: sets map_size from level before generate_maze; enemy spawn min distance scales with map_size/2. - render.c: flush the full 32x32 background map (the old rows 2-17 optimization broke for large mazes where the 5x5 fog window wraps outside that range); dynamic bounds; signed/unsigned casts. - player_logic/enemy_logic: dynamic map_size bounds. Verified via PyBoy: sizes 7,9,11,13,15,17,17 across levels 1-7, each with a hatch; rendering and movement intact at 17x17 and at 7x7.
This commit is contained in:
+2
-1
@@ -4,7 +4,8 @@
|
||||
volatile uint8_t game_over = 0;
|
||||
volatile uint8_t game_over_timer = 0;
|
||||
|
||||
uint8_t maze[MAP_SIZE][MAP_SIZE];
|
||||
uint8_t map_size = MAP_SIZE;
|
||||
uint8_t maze[MAX_MAP_SIZE][MAX_MAP_SIZE];
|
||||
uint8_t map_buffer[32 * 32];
|
||||
|
||||
uint8_t player_lx = 1;
|
||||
|
||||
Reference in New Issue
Block a user