Generate the map and populate it with keys, enemies, and the exit.
317 {
318
319 unsigned int seed = (unsigned int) time(NULL);
320
321 int stack_var;
322 seed ^= (uintptr_t) &stack_var;
323 srand(seed);
324
325
327
328 int start_x = 0;
329 int start_y = 0;
330 int start_edge = 0;
331 if (!exit_x && !exit_y) {
332
333
334
335 start_edge = rand() % 4;
337 } else {
339 }
340
342
344
346
348}
void initialize_map()
Initialize the map with walls.
void place_exit(int start_edge)
Place the exit on a random edge of the map, ensuring there's a path to it.
void make_exit_into_start(int *start_edge, int *start_x, int *start_y)
Set the start position on the map based on the previous exit position.
void generate_maze(int start_x, int start_y)
Generate a new maze using recursive backtracking.
void set_start_position(int start_edge, int *start_x, int *start_y)
Set the start position on the map.
void set_player_start_pos(const int player_x, const int player_y)
Sets the starting position of the player.
void populate_map()
@breif Populates the map with a key, enemies, and fountains