Cub3D
 
Loading...
Searching...
No Matches
maze.h File Reference
#include "data_structure.h"
#include <stddef.h>
Include dependency graph for maze.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  s_posvec
 Vector implementation that stores t_pos2 objects. More...
 

Macros

#define MAZE_N   1
 
#define MAZE_S   2
 
#define MAZE_E   4
 
#define MAZE_W   8
 
#define FT_RAND_MAX   32768
 Maximum random value possible.
 
#define MAZE_MIN_SIZE   3
 Minimum maze size.
 
#define MAZE_MAX_SIZE   1000
 Maximum maze size.
 

Typedefs

typedef struct s_posvec t_posvec
 

Functions

int maze_dir_x (int dir)
 Maze direction on x axis.
 
int maze_dir_y (int dir)
 Maze direction on y axis.
 
int maze_dir_opp (int dir)
 Maze inverted direction on x and y axis.
 
t_posvecposvecnew (size_t size)
 Create a vector with an initial starting size.
 
int posvecpush (t_posvec *vec, t_pos2 data)
 Add a new element to the vector.
 
int posvecpop (t_posvec *vec, t_pos2 *pos)
 Pops the last element of the vector if not empty.
 
int posvecremove (t_posvec *vec, size_t index, t_pos2 *result)
 Removes the element at the specified index from the vector if found.
 
void posvecfree (t_posvec *vec)
 Free the vector.
 
void ft_srand (unsigned int seed)
 Sets the initial random state from the given seed.
 
unsigned int ft_rand (void)
 Generate a random unsigned int.
 
void array_shuffle (int *arr, int len)
 Shuffle an array.
 
int cub_parse_generation_arg (char *gen, size_t *width, size_t *height)
 Parse the argument for generation.
 
t_map_raoulcub_new_map_from_dimensions (char *dimensions)
 Allocates a new map with the given dimension.
 
int cub_growing_tree (t_map_raoul *map)
 Cub3D Maze Generator, uses dimensions from gen, store them in map and create a random perfect maze.
 
int cub_spawn_objects (t_map_raoul *map, int key)
 Spawns a key and a door in the maze.
 

Macro Definition Documentation

◆ FT_RAND_MAX

#define FT_RAND_MAX   32768

Maximum random value possible.

◆ MAZE_E

#define MAZE_E   4

◆ MAZE_MAX_SIZE

#define MAZE_MAX_SIZE   1000

Maximum maze size.

◆ MAZE_MIN_SIZE

#define MAZE_MIN_SIZE   3

Minimum maze size.

◆ MAZE_N

#define MAZE_N   1

◆ MAZE_S

#define MAZE_S   2

◆ MAZE_W

#define MAZE_W   8

Typedef Documentation

◆ t_posvec

typedef struct s_posvec t_posvec

Function Documentation

◆ maze_dir_opp()

int maze_dir_opp ( int dir)

Maze inverted direction on x and y axis.

Parameters
[in]dirdirection
Returns
int value considering maze MACROS

◆ maze_dir_x()

int maze_dir_x ( int dir)

Maze direction on x axis.

Parameters
[in]dirdirection
Returns
int value considering maze MACROS

◆ maze_dir_y()

int maze_dir_y ( int dir)

Maze direction on y axis.

Parameters
[in]dirdirection
Returns
int value considering maze MACROS