diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/cub3d.h | 12 | ||||
-rw-r--r-- | inc/cub3d_defines.h | 7 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 17 |
3 files changed, 27 insertions, 9 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h index 7de1df7..016677a 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -27,11 +27,13 @@ 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); 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 ====== @@ -76,8 +78,10 @@ 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_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); /* ** ====== PARSING ====== @@ -101,10 +105,13 @@ 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); 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); @@ -130,7 +137,8 @@ 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); +void ft_floor_cast_inits(uint16_t y, t_ray *rl, t_cub *cl); /* ** ====== OTHER ====== diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index b348a1c..6ab05c2 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -114,10 +114,10 @@ enum ** ====== CHARSET ====== */ -# define FT_CHRST_VALID_PARSE "RNSEWFCLM" -# define FT_CHRST_MAP_ENTRY "01234NSEWL " +# 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_MAP_NON_WALL "02NESWLT" # define FT_CHRST_COLLISION "12 " # 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 1aaa1d5..8fba623 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -121,6 +121,7 @@ typedef struct s_player float cam_x; float plane_x; float plane_y; + int8_t life; } t_player; typedef struct s_ray @@ -138,6 +139,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; @@ -169,6 +171,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; @@ -182,6 +185,8 @@ typedef struct s_map int32_t sprite_nbr; uint8_t sprite_var; int32_t sprite_order[4096]; + int32_t traps_nbr; + int32_t traps_order[512]; size_t line_chk; size_t map_start; uint8_t isspawn; @@ -190,6 +195,7 @@ typedef struct s_map uint8_t isftex; uint8_t isctex; uint8_t isskybox; + uint8_t istraps; uint8_t darklvl; uint8_t scale; uint32_t nlx; @@ -204,6 +210,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; @@ -211,17 +218,19 @@ 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; 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[12]; - struct s_sprite sprites[12][12]; + struct s_img tlist[16]; + struct s_sprite sprites[8][4096]; + struct s_sprite traps[512]; } t_cub; # endif |