feat: advancement on map parse

This commit is contained in:
B.Goulard 2024-11-18 17:25:27 +01:00
parent 7321db26d9
commit d586acba8f
11 changed files with 257 additions and 123 deletions

View file

@ -6,14 +6,15 @@
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/11 14:41:07 by bgoulard #+# #+# */
/* Updated: 2024/11/11 17:43:12 by bgoulard ### ########.fr */
/* Updated: 2024/11/18 11:32:00 by bgoulard ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef CUB3D_PARSING_H
# define CUB3D_PARSING_H
#include <stdbool.h>
# include <stdbool.h>
# define C3D_PRS_PLS "SO"
# define C3D_PRS_PLW "WE"
# define C3D_PRS_PLN "NO"
@ -23,7 +24,8 @@
# define C3D_PRS_WLL '1'
# define C3D_PRS_EMP '0'
enum e_tile_m {
enum e_tile_m
{
EMPTY,
DOOR_OPEN,
DOOR_ANIM,
@ -36,42 +38,16 @@ enum e_tile_m {
PLAYER_W
};
typedef struct s_map_truth {
typedef struct s_map_truth
{
enum e_tile_m tile;
char chr[2];
} t_map_truth;
} t_map_truth;
typedef struct s_tile {
typedef struct s_tile
{
enum e_tile_m tile;
bool visited;
} t_tile;
extern const t_map_truth g_map_table[];
/*
= {
{EMPTY, C3D_PRS_EMP},
{WALL_TRAIL, C3D_PRS_WLL_TRAIL},
{WALL, C3D_PRS_WLL},
{PLAYER_N, C3D_PRS_PLN},
{PLAYER_S, C3D_PRS_PLS},
{PLAYER_E, C3D_PRS_PLE},
{PLAYER_W, C3D_PRS_PLW},
};
*/
enum e_identifiers {
UNKNOWN = 0,
TEXTURE_N,
TEXTURE_S,
TEXTURE_E,
TEXTURE_W,
FLOOR,
CEILING,
};
typedef struct s_identifiers {
enum e_identifiers id;
char *path;
} t_identifiers;
} t_tile;
#endif /* CUB3D_PARSING_H */

View file

@ -6,7 +6,7 @@
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/08 23:55:29 by bgoulard #+# #+# */
/* Updated: 2024/11/13 07:15:14 by bgoulard ### ########.fr */
/* Updated: 2024/11/18 17:07:15 by bgoulard ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,6 +18,8 @@
# define FILE_EXTENSION ".cub"
# define FILE_EXTENSION_LEN 4
# define BG_CLG 0
# define BG_FLR 1
// -- graphic utils
@ -109,6 +111,7 @@ typedef enum e_error
ERROR_PARSE,
ERROR_CLI,
ERROR_MLX,
ERROR_TEXTURE_FORMAT,
ERROR_IMPLEM,
} t_error;