From 25247ca1f3ffc9485b02686f616c41a52f8eb82a Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 11 Mar 2020 00:00:07 +0100 Subject: Pas trop ecole opti memoire mais ok --- inc/cub3d.h | 2 +- inc/cub3d_structs.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index 7de1df7..2a9d66e 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -130,7 +130,7 @@ uint8_t ft_use_args(int argc, const char *argv[], void ft_castray(t_cub *cl); void ft_detect(t_cub *cl); -void ft_floor_cast(uint16_t y, t_cub *cl); +void ft_floor_cast(t_cub *cl); /* ** ====== OTHER ====== diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index f1dfdfc..144de6f 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -137,6 +137,7 @@ typedef struct s_ray float y_delta_dist; int16_t wall_t; int16_t wall_b; + int16_t *wall_bz; uint8_t side; size_t sqx; size_t sqy; -- cgit v1.2.3 From 154ccbc0546018554982f9170d32b7858a8c33aa Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 11 Mar 2020 01:17:41 +0100 Subject: Norme --- inc/cub3d.h | 1 + 1 file changed, 1 insertion(+) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index 2a9d66e..a7b649d 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -131,6 +131,7 @@ uint8_t ft_use_args(int argc, const char *argv[], void ft_castray(t_cub *cl); void ft_detect(t_cub *cl); void ft_floor_cast(t_cub *cl); +void ft_floor_cast_inits(uint16_t y, t_ray *rl, t_cub *cl); /* ** ====== OTHER ====== -- cgit v1.2.3 From 79af897f235b2172ce37e6d30b829fa0928aef3a Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 11 Mar 2020 09:17:49 +0100 Subject: Good trap init --- inc/cub3d_structs.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 144de6f..9f48975 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -169,6 +169,7 @@ typedef struct s_map char *ce_tex_path; char *nlevel_path; char *skybox_path; + char *traps_path; char *music_path; char *music_cmd; char *mapl; @@ -181,6 +182,8 @@ typedef struct s_map size_t mapl_len; int32_t sprite_nbr; int32_t sprite_order[12]; + int32_t traps_nbr; + int32_t traps_order[12]; size_t line_chk; size_t map_start; uint8_t isspawn; @@ -189,6 +192,7 @@ typedef struct s_map uint8_t isftex; uint8_t isctex; uint8_t isskybox; + uint8_t istrap; uint8_t darklvl; uint8_t scale; uint32_t nlx; @@ -219,8 +223,9 @@ typedef struct s_cub struct s_img img; struct s_rgb f_rgb; struct s_rgb c_rgb; - struct s_img tlist[8]; + struct s_img tlist[16]; struct s_sprite sprites[4096]; + struct s_sprite traps[4096]; } t_cub; # endif -- cgit v1.2.3 From bfa1f4e6e61152ba3ff555d1508f43f0a5ab2754 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 11 Mar 2020 09:50:36 +0100 Subject: Secured collision segv --- inc/cub3d.h | 1 + 1 file changed, 1 insertion(+) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index a7b649d..e351fa9 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -27,6 +27,7 @@ void ft_init_ref(t_cub *clist); int8_t ft_init_cub3d(t_cub *clist); int ft_init_winlx(t_cub *clist); int ft_init_winptr(t_cub *clist); +t_player ft_init_player(void); t_ray ft_init_s_ray(void); t_rgb ft_init_rgb(void); int8_t ft_init_map(t_map *mlist); -- cgit v1.2.3 From c1d1d76e0c88fbbbe4b1e0611a13a6a4df6cb424 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 11 Mar 2020 09:59:17 +0100 Subject: Parsed traps --- inc/cub3d.h | 1 + inc/cub3d_defines.h | 9 +++++---- inc/cub3d_structs.h | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index e351fa9..bb30122 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -102,6 +102,7 @@ int8_t ft_get_c_tex(char **words, t_cub *clist); int8_t ft_get_darkness(char **words, t_cub *clist); int8_t ft_get_path_nl(char **words, t_cub *clist); int8_t ft_get_skybox(char **words, t_cub *clist); +int8_t ft_get_traps(char **words, t_cub *clist); int8_t ft_get_tex_nl(char **words, t_cub *clist); int8_t ft_get_music(char **words, t_cub *clist); size_t ft_get_map_h(char **map); diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index edc3dec..6453e73 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -114,11 +114,11 @@ enum ** ====== CHARSET ====== */ -# define FT_CHRST_VALID_PARSE "RNSEWFCLM" -# define FT_CHRST_MAP_ENTRY "012NSEWL " +# define FT_CHRST_VALID_PARSE "RNSEWFCLMT" +# define FT_CHRST_MAP_ENTRY "012NSEWLT " # define FT_CHRST_SPAWN "NSEW" -# define FT_CHRST_MAP_NON_WALL "02NESWL" -# define FT_CHRST_COLLISION "12 " +# define FT_CHRST_MAP_NON_WALL "02NESWLT" +# define FT_CHRST_COLLISION "12T " # define FT_CHRST_DETECT "1L" /* @@ -166,6 +166,7 @@ enum # define FT_ERR_RD_NL_TEX "could not find next level texture file" # define FT_ERR_RD_NL_MAP "could not find next level map file" # define FT_ERR_RD_MUSIC "could not find music file" +# define FT_ERR_RD_TRAP "could not find trap texture file" # define FT_ERR_WR_BMP "could not export to bmp" /* diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 9f48975..89e531a 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -214,8 +214,8 @@ typedef struct s_cub int32_t key_input[5]; pid_t mpid; int (*key_ptr[6])(struct s_cub*); - int8_t (*get_ptr[13])(char**, struct s_cub*); - char ref[14][3]; + int8_t (*get_ptr[14])(char**, struct s_cub*); + char ref[15][3]; struct s_win wlist; struct s_player plist; struct s_map mlist; @@ -225,7 +225,7 @@ typedef struct s_cub struct s_rgb c_rgb; struct s_img tlist[16]; struct s_sprite sprites[4096]; - struct s_sprite traps[4096]; + struct s_sprite traps[512]; } t_cub; # endif -- cgit v1.2.3 From c581c7e3543058f015bddf96d76ac2d771ea40a0 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 11 Mar 2020 10:16:48 +0100 Subject: Nice parse --- inc/cub3d.h | 3 ++- inc/cub3d_structs.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index bb30122..9487883 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -77,7 +77,6 @@ void ft_sprite_width(t_cub *cl, t_sprite *sprite); void ft_sprite_height(t_cub *cl, t_sprite *sprite); void ft_calc_sprite(t_cub *cl); void ft_draw_sprite(t_cub *cl, t_sprite *sprite); -void ft_get_sprite_spawn(t_cub *cl); void ft_draw_skybox(t_cub *cl); /* @@ -107,6 +106,8 @@ int8_t ft_get_tex_nl(char **words, t_cub *clist); int8_t ft_get_music(char **words, t_cub *clist); size_t ft_get_map_h(char **map); size_t ft_get_map_w(char **map); +void ft_get_sprite_spawn(t_cub *clist); +void ft_get_trap_spawn(t_cub *clist); int8_t ft_check_map_line(char *line, uint8_t l, t_cub *clist); int8_t ft_check_ext(const char *filep, const char *ext); int8_t ft_check_not_found(const char *path); diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 89e531a..5ba3b38 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -192,7 +192,7 @@ typedef struct s_map uint8_t isftex; uint8_t isctex; uint8_t isskybox; - uint8_t istrap; + uint8_t istraps; uint8_t darklvl; uint8_t scale; uint32_t nlx; -- cgit v1.2.3 From 8df5ba15b4b54511ade9c875bf84ac2696630aa7 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 11 Mar 2020 10:28:33 +0100 Subject: Perfect collision on them traps --- inc/cub3d_defines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 6453e73..6ab05c2 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -118,7 +118,7 @@ enum # define FT_CHRST_MAP_ENTRY "012NSEWLT " # define FT_CHRST_SPAWN "NSEW" # define FT_CHRST_MAP_NON_WALL "02NESWLT" -# define FT_CHRST_COLLISION "12T " +# define FT_CHRST_COLLISION "12 " # define FT_CHRST_DETECT "1L" /* -- cgit v1.2.3 From b236416db21d03f7749e1c80d5b7abee70ea07d5 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 11 Mar 2020 12:38:21 +0100 Subject: Pretty cool animation --- inc/cub3d.h | 1 + inc/cub3d_structs.h | 1 + 2 files changed, 2 insertions(+) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index 9487883..4172c9d 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -78,6 +78,7 @@ void ft_sprite_height(t_cub *cl, t_sprite *sprite); void ft_calc_sprite(t_cub *cl); void ft_draw_sprite(t_cub *cl, t_sprite *sprite); void ft_draw_skybox(t_cub *cl); +void ft_suffer_animation(t_cub *cl); /* ** ====== PARSING ====== diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 5ba3b38..7665e96 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -120,6 +120,7 @@ typedef struct s_player float cam_x; float plane_x; float plane_y; + int8_t life; } t_player; typedef struct s_ray -- cgit v1.2.3 From 17906f353bb6e87528f552891d7d4c91bb3ac789 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Wed, 11 Mar 2020 14:38:52 +0100 Subject: why macos --- inc/cub3d_structs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'inc') diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 7665e96..310ba90 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -222,6 +222,7 @@ typedef struct s_cub struct s_map mlist; struct s_ray rlist; struct s_img img; + struct s_img red_scr; struct s_rgb f_rgb; struct s_rgb c_rgb; struct s_img tlist[16]; -- cgit v1.2.3 From 7f77c9bc922fb608f689385d642304956afe0492 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Wed, 11 Mar 2020 16:07:29 +0100 Subject: Performance --- inc/cub3d.h | 1 + inc/cub3d_structs.h | 1 + 2 files changed, 2 insertions(+) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index 4172c9d..ae353ae 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -33,6 +33,7 @@ t_rgb ft_init_rgb(void); int8_t ft_init_map(t_map *mlist); t_bmp_file ft_init_bmp(void); t_bmp_info ft_init_bmp_info(void); +t_rgb ft_hex_to_og_rgb(uint32_t color); /* ** ====== HOOKS ====== diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 310ba90..957d154 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -208,6 +208,7 @@ typedef struct s_cub uint8_t ishud; uint8_t walltexgood; uint8_t isoldmus; + uint8_t doicast; uint16_t currlvl; uint16_t i; char *const *envp; -- cgit v1.2.3 From 7b61072321c71c1612a7b33d2e8d722a49c5bc99 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Wed, 11 Mar 2020 18:06:17 +0100 Subject: ca tue --- inc/cub3d.h | 2 ++ inc/cub3d_structs.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index ae353ae..016677a 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -78,6 +78,8 @@ void ft_sprite_width(t_cub *cl, t_sprite *sprite); void ft_sprite_height(t_cub *cl, t_sprite *sprite); void ft_calc_sprite(t_cub *cl); void ft_draw_sprite(t_cub *cl, t_sprite *sprite); +void ft_calc_trap(t_cub *cl); +void ft_draw_traps(t_cub *cl, t_sprite *sprite); void ft_draw_skybox(t_cub *cl); void ft_suffer_animation(t_cub *cl); diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 957d154..7a30d09 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -182,9 +182,9 @@ typedef struct s_map size_t map_h; size_t mapl_len; int32_t sprite_nbr; - int32_t sprite_order[12]; + int32_t sprite_order[4096]; int32_t traps_nbr; - int32_t traps_order[12]; + int32_t traps_order[512]; size_t line_chk; size_t map_start; uint8_t isspawn; -- cgit v1.2.3