From fbc52949004a067a5c2cfefae1ff3415dbe04a96 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Sat, 15 Feb 2020 18:51:30 +0100 Subject: In progress --- inc/cub3d.h | 4 ++-- inc/cub3d_defines.h | 18 ++++++++++++++++++ inc/cub3d_structs.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index 386f658..55c7a97 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -25,7 +25,6 @@ ** 3: failed mlx init ** 4: map error ** 5: no map -** 6: not a .cub */ int8_t ft_init_cub3d(t_cub **clist); @@ -55,7 +54,7 @@ int8_t ft_check_map_line(char *line, uint8_t l, t_cub *clist); size_t ft_get_line_len(char *line); int ft_missing_error(const char *err, t_cub *clist); uint8_t ft_free_words(char **words); -int ft_map_error(t_cub *clist); +int ft_map_error(const char *errmsg, t_cub *clist); int ft_init_winlx(t_cub *clist); void ft_draw_scene(t_cub *clist); void ft_print_list(t_cub *clist); @@ -73,5 +72,6 @@ int ft_d_key(t_cub *clist); int ft_f1_key(t_cub *clist); int ft_left_key(t_cub *clist); int ft_right_key(t_cub *clist); +int8_t ft_check_ext(const char *filep, const char *ext); # endif diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index e6c98c5..6f8de65 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* cub3d_defines.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/15 15:40:25 by rbousset #+# #+# */ +/* Updated: 2020/02/15 15:40:27 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + # ifndef CUB3D_DEFINES_H # define CUB3D_DEFINES_H @@ -45,6 +57,12 @@ ** ====== ERROR MSG ====== */ +# define FT_ERR_NOT_A_CUB "given map is not a .cub" +# define FT_ERR_MAP_L_L "last line is invalid or contains illegal char" +# define FT_ERR_UNFINISHED "unexpected file end" +# define FT_ERR_READ "read error" +# define FT_ERR_ILL_ENTRY "illegal map entry" +# define FT_ERR_ALR_SET "duplicate entry" # define FT_ERR_MISS_ELEMENT "Missing element:" # define FT_ERR_MISS_NORTH "north side texture" # define FT_ERR_MISS_SOUTH "south side texture" diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 1bf2bca..fce155e 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -109,6 +109,7 @@ typedef struct s_map typedef struct s_cub { uint8_t minimap; + char *errmsg; struct s_win *wlist; struct s_player *plist; struct s_map *mlist; -- cgit v1.2.3 From 030fe8c3316d1e1f5f3dea81c3fffd8e00c16afa Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Sat, 15 Feb 2020 20:29:21 +0100 Subject: Work in progress, res now --- inc/cub3d_defines.h | 19 +++++++++++++++---- inc/cub3d_structs.h | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 6f8de65..14ec61a 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -54,15 +54,26 @@ # endif /* -** ====== ERROR MSG ====== +** ====== MAP ERROR MSG ====== */ # define FT_ERR_NOT_A_CUB "given map is not a .cub" -# define FT_ERR_MAP_L_L "last line is invalid or contains illegal char" -# define FT_ERR_UNFINISHED "unexpected file end" +# define FT_ERR_ARGS "too many arguments" +# define FT_ERR_RES_SMALL "resolution is too small" +# define FT_ERR_RES_ALPHA "resolution should be digits only" +# define FT_ERR_MAP_L_L "last line is invalid" +# define FT_ERR_UNFINISHED "no map" # define FT_ERR_READ "read error" # define FT_ERR_ILL_ENTRY "illegal map entry" # define FT_ERR_ALR_SET "duplicate entry" +# define FT_ERR_ALLOCATE "allocation error" +# define FT_ERR_ILL_MAP "map contains illegal char" +# define FT_ERR_MULT_SPAWN "multiple spawn points" + +/* +** ====== MISSING ERROR MSG ====== +*/ + # define FT_ERR_MISS_ELEMENT "Missing element:" # define FT_ERR_MISS_NORTH "north side texture" # define FT_ERR_MISS_SOUTH "south side texture" @@ -71,7 +82,7 @@ # define FT_ERR_MISS_SPRITE "sprite texture" # define FT_ERR_MISS_RESOLUTION "resolution" # define FT_ERR_MISS_FLOOR_C "floor color" -# define FT_ERR_MISS_CEIL_C "floor color" +# define FT_ERR_MISS_CEIL_C "ceiling color" # define FT_ERR_MISS_PLAYER_SPAWN "player spawn" # endif diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index fce155e..13225af 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -109,7 +109,7 @@ typedef struct s_map typedef struct s_cub { uint8_t minimap; - char *errmsg; + char errmsg[40]; struct s_win *wlist; struct s_player *plist; struct s_map *mlist; -- cgit v1.2.3 From 2fd013d7583e0388d50ff9895c5e474e2d76f79f Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Mon, 17 Feb 2020 15:31:11 +0100 Subject: Better parse for textures and colors --- inc/cub3d_defines.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 14ec61a..e9a9a7d 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -57,18 +57,22 @@ ** ====== MAP ERROR MSG ====== */ +# define FT_ERR_ALLOCATE "allocation error" +# define FT_ERR_READ "read error" # define FT_ERR_NOT_A_CUB "given map is not a .cub" -# define FT_ERR_ARGS "too many arguments" +# define FT_ERR_ARGS "too many or to few arguments" # define FT_ERR_RES_SMALL "resolution is too small" # define FT_ERR_RES_ALPHA "resolution should be digits only" -# define FT_ERR_MAP_L_L "last line is invalid" -# define FT_ERR_UNFINISHED "no map" -# define FT_ERR_READ "read error" +# define FT_ERR_NOT_A_XPM "given texture is not a .xpm" +# define FT_ERR_COLOR_ALPHA "colors should be digits only" +# define FT_ERR_COLOR_MAX "colors should be maximum 255" +# define FT_ERR_COLOR_ARGS "colors three numbers separated by commas" # define FT_ERR_ILL_ENTRY "illegal map entry" +# define FT_ERR_UNFINISHED "no map" # define FT_ERR_ALR_SET "duplicate entry" -# define FT_ERR_ALLOCATE "allocation error" # define FT_ERR_ILL_MAP "map contains illegal char" # define FT_ERR_MULT_SPAWN "multiple spawn points" +# define FT_ERR_MAP_L_L "last line is invalid" /* ** ====== MISSING ERROR MSG ====== -- cgit v1.2.3 From ac87f799abf2edbd95243f2343eda41faf30cca6 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Mon, 17 Feb 2020 15:57:18 +0100 Subject: Better parse --- inc/cub3d_defines.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index e9a9a7d..0c9a294 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -67,8 +67,9 @@ # define FT_ERR_COLOR_ALPHA "colors should be digits only" # define FT_ERR_COLOR_MAX "colors should be maximum 255" # define FT_ERR_COLOR_ARGS "colors three numbers separated by commas" -# define FT_ERR_ILL_ENTRY "illegal map entry" # define FT_ERR_UNFINISHED "no map" +# define FT_ERR_MAP_LEN "map length inconsistency" +# define FT_ERR_ILL_ENTRY "illegal map entry" # define FT_ERR_ALR_SET "duplicate entry" # define FT_ERR_ILL_MAP "map contains illegal char" # define FT_ERR_MULT_SPAWN "multiple spawn points" -- cgit v1.2.3 From 9af56266c16eaffe9375ba3edb3465c33f015b9f Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Mon, 17 Feb 2020 16:24:04 +0100 Subject: ready to merge --- inc/cub3d_structs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 13225af..2f032e0 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -23,8 +23,8 @@ typedef struct s_win uint8_t inited; uint16_t x_max_size; uint16_t y_max_size; - uint16_t x_size; - uint16_t y_size; + uint32_t x_size; + uint32_t y_size; } t_win; typedef struct s_img -- cgit v1.2.3