aboutsummaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-16 19:41:26 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-16 19:41:26 +0100
commita8c9c04ec24a71f076891bdc1c26860db7c5c9c3 (patch)
treea5dc6905f6987c4d5fcd27276f7fc338f2af8f0b /inc
parentCleaner memdels (diff)
parentMerge branch 'master' into back-to-pthread (diff)
download42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.tar.gz
42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.tar.bz2
42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.tar.xz
42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.tar.zst
42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.zip
Merge branch 'back-to-pthread'
Diffstat (limited to 'inc')
-rw-r--r--inc/cub3d.h9
-rw-r--r--inc/cub3d_defines.h4
-rw-r--r--inc/cub3d_structs.h31
3 files changed, 30 insertions, 14 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h
index 6ca6f8b..5371305 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -151,8 +151,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 ======
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index 0cd15fa..e52eb7a 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -86,6 +86,8 @@ 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"
@@ -114,7 +116,7 @@ enum
** ====== COLLISION ======
*/
-# define FT_COLL_MULT 0.225
+# define FT_COLL_MULT 0.3
/*
** ====== SCREEN ======
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index 9ea3d08..92d928d 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,7 @@ typedef struct s_cub
char *const *envp;
char errmsg[64];
int32_t key_input[5];
- pid_t mpid;
+ pthread_t mtid;
int (*key_ptr[6])(struct s_cub*);
int8_t (*get_ptr[14])(char**, struct s_cub*);
char ref[22][3];