diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/cub3d.h | 12 | ||||
-rw-r--r-- | inc/cub3d_defines.h | 6 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 36 |
3 files changed, 38 insertions, 16 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h index 9c906be..042faa3 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -17,6 +17,7 @@ #include <cub3d_structs.h> #include <stddef.h> #include <stdint.h> +#include <time.h> /* ** ====== STRUCTS ====== @@ -35,6 +36,7 @@ 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); int8_t ft_init_sfx(t_sfx *sfx); +int8_t ft_init_sprites(t_sprite ***sprites); /* ** ====== HOOKS ====== @@ -150,8 +152,15 @@ void ft_floor_cast_inits(uint16_t y, t_ray *rl, t_cub *cl); */ void ft_sfx_death(t_cub *cl); -void ft_sfx_trap(t_cub *cl); +void ft_sfx_footstep(t_cub *cl); void ft_sfx_new_level(t_cub *cl); +void ft_sfx_pain(t_cub *cl); +void ft_sfx_trap(t_cub *cl); +void *ft_sfx_death_thread(void *vargp); +void *ft_sfx_footstep_thread(void *vargp); +void *ft_sfx_new_lvl_thread(void *vargp); +void *ft_sfx_pain_thread(void *vargp); +void *ft_sfx_trap_thread(void *vargp); /* ** ====== OTHER ====== @@ -171,5 +180,6 @@ uint32_t ft_rgb_to_hex(t_rgb rgb); t_bmp_rgb ft_hex_to_rgb(uint32_t color); uint32_t ft_darken(t_rgb rgb, t_cub *cl); void ft_death_screen(t_cub *cl); +void ft_get_fps_count(clock_t delta_time, t_cub *cl); # endif diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 0cd15fa..1aa380f 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -86,11 +86,14 @@ enum */ # define FT_SFX_DEATH_PATH "./media/sound/sfx/death_screen.wav" +# define FT_SFX_FS_ONE_PATH "./media/sound/sfx/footstep_one.wav" +# define FT_SFX_FS_TWO_PATH "./media/sound/sfx/footstep_two.wav" # define FT_SFX_N_LVL_PATH "./media/sound/sfx/next_lvl.wav" # define FT_SFX_SCR_ONE_PATH "./media/sound/sfx/scream_one.wav" # define FT_SFX_SCR_TWO_PATH "./media/sound/sfx/scream_two.wav" # define FT_SFX_TRAP_PATH "./media/sound/sfx/trap.wav" # define FT_DEATH_SCREEN_PATH "./media/img/death_screen.xpm" +# define FT_HUD_BACK_PATH "./media/img/plate_small.xpm" /* ** ====== SOUNDS ====== @@ -114,7 +117,7 @@ enum ** ====== COLLISION ====== */ -# define FT_COLL_MULT 0.225 +# define FT_COLL_MULT 0.3 /* ** ====== SCREEN ====== @@ -209,6 +212,7 @@ enum # define FT_ERR_MISS_SFX_SCR_TWO "missing sound effect scream two" # define FT_ERR_MISS_SFX_TRAP "missing sound effect trap" # define FT_ERR_MISS_DEATH_SCREEN "missing death screen image" +# define FT_ERR_MISS_HUD_BACK "missing HUD background image" /* ** ====== OTHER ====== diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 6db79de..66f139d 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -14,9 +14,9 @@ # define CUB3D_STRUCTS_H #include <stddef.h> -#include <stdlib.h> #include <stdint.h> #include <sys/types.h> +#include <pthread.h> typedef struct s_win { @@ -57,15 +57,23 @@ typedef struct s_bmp_info typedef struct s_sfx { - char **death; - char **new_lvl; - char **pain_one; - char **pain_two; - char **trap; - pid_t death_pid; - pid_t new_lvl_pid; - pid_t pain_pid; - pid_t trap_pid; + char *death; + char *footstep_one; + char *footstep_two; + char *new_lvl; + char *pain_one; + char *pain_two; + char *trap; + pthread_t death_tid; + pthread_t footstep_tid; + pthread_t new_lvl_tid; + pthread_t pain_tid; + pthread_t trap_tid; + pthread_mutex_t death_mutex; + pthread_mutex_t footstep_mutex; + pthread_mutex_t new_lvl_mutex; + pthread_mutex_t pain_mutex; + pthread_mutex_t trap_mutex; } t_sfx; typedef struct s_bmp_rgb @@ -189,7 +197,6 @@ typedef struct s_map char *mapl; char **sprite_path; char **map; - char **mcmd_words; int8_t x_step; int8_t y_step; size_t map_w; @@ -230,7 +237,8 @@ typedef struct s_cub char *const *envp; char errmsg[64]; int32_t key_input[5]; - pid_t mpid; + char fps_count[9]; + pthread_t mtid; int (*key_ptr[6])(struct s_cub*); int8_t (*get_ptr[14])(char**, struct s_cub*); char ref[22][3]; @@ -242,8 +250,8 @@ typedef struct s_cub struct s_img death_screen; struct s_rgb f_rgb; struct s_rgb c_rgb; - struct s_img tlist[16]; - struct s_sprite sprites[8][4096]; + struct s_img tlist[17]; + struct s_sprite **sprites; struct s_sprite traps[512]; struct s_sfx sfx; } t_cub; |