diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-06 15:31:58 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-06 15:31:58 +0200 |
commit | 7359ab92230a7b4f05855de50f36aa4880901f3b (patch) | |
tree | c5de0e375f3f49d308950b24e199591dd8a2c1a8 | |
parent | Tweak (diff) | |
download | 42-cub3d-7359ab92230a7b4f05855de50f36aa4880901f3b.tar.gz 42-cub3d-7359ab92230a7b4f05855de50f36aa4880901f3b.tar.bz2 42-cub3d-7359ab92230a7b4f05855de50f36aa4880901f3b.tar.xz 42-cub3d-7359ab92230a7b4f05855de50f36aa4880901f3b.tar.zst 42-cub3d-7359ab92230a7b4f05855de50f36aa4880901f3b.zip |
Better sound handling, few changes
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | inc/cub3d.h | 12 | ||||
-rw-r--r-- | inc/cub3d_defines.h | 4 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 2 | ||||
-rw-r--r-- | map/lvl_five.cub | 2 | ||||
-rw-r--r-- | map/lvl_four.cub | 4 | ||||
-rw-r--r-- | src/ft_exit.c | 2 | ||||
-rw-r--r-- | src/ft_extra_keys.c | 15 | ||||
-rw-r--r-- | src/ft_find_item.c | 5 | ||||
-rw-r--r-- | src/ft_init_sfx.c | 32 | ||||
-rw-r--r-- | src/ft_sfx_bb_death.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_bb_fire.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_bb_scream.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_death.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_footstep.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_heal.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_new_level.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_ooa.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_pain.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_trap.c | 1 | ||||
-rw-r--r-- | src/ft_sfx_weapon_one.c | 6 | ||||
-rw-r--r-- | src/ft_sfx_weapon_three.c | 2 | ||||
-rw-r--r-- | src/ft_sfx_weapon_two.c | 6 | ||||
-rw-r--r-- | src/ft_sfx_weapon_two_alt.c | 65 |
24 files changed, 126 insertions, 42 deletions
@@ -93,6 +93,7 @@ SRCS_NAME += ft_sfx_trap.c SRCS_NAME += ft_sfx_heal.c SRCS_NAME += ft_sfx_weapon_one.c SRCS_NAME += ft_sfx_weapon_two.c +SRCS_NAME += ft_sfx_weapon_two_alt.c SRCS_NAME += ft_sfx_weapon_three.c SRCS_NAME += ft_sfx_ooa.c SRCS_NAME += ft_death_screen.c diff --git a/inc/cub3d.h b/inc/cub3d.h index 15d9ef0..5ae96c4 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -214,6 +214,8 @@ void ft_sfx_weapon_one_load(t_sfx *sfx); void ft_sfx_weapon_one_fire(t_sfx *sfx); void ft_sfx_weapon_two_load(t_sfx *sfx); void ft_sfx_weapon_two_fire(t_sfx *sfx); +void ft_sfx_weapon_two_fire_alt(t_sfx *sfx); +void ft_sfx_weapon_two_fire_alt_alt(t_sfx *sfx); void ft_sfx_weapon_three_load(t_sfx *sfx); void ft_sfx_weapon_three_fire(t_sfx *sfx); void ft_sfx_ooa(t_sfx *sfx); @@ -226,10 +228,12 @@ void *ft_sfx_new_lvl_thread(void *vargp); void *ft_sfx_pain_thread(void *vargp); void *ft_sfx_trap_thread(void *vargp); void *ft_sfx_heal_thread(void *vargp); -void *ft_sfx_weapon_one_load_thread(void *vargp); -void *ft_sfx_weapon_one_fire_thread(void *vargp); -void *ft_sfx_weapon_two_load_thread(void *vargp); -void *ft_sfx_weapon_two_fire_thread(void *vargp); +void *ft_sfx_w_one_load_thread(void *vargp); +void *ft_sfx_w_one_fire_thread(void *vargp); +void *ft_sfx_w_two_load_thread(void *vargp); +void *ft_sfx_w_two_fire_thread(void *vargp); +void *ft_sfx_weapon_two_fire_thread_alt(void *vargp); +void *ft_sfx_weapon_two_fire_thread_alt_alt(void *vargp); void *ft_sfx_weapon_three_load_thread(void *vargp); void *ft_sfx_weapon_three_fire_thread(void *vargp); void *ft_sfx_ooa_thread(void *vargp); diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 1f1134b..be48fbe 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -312,12 +312,13 @@ enum # define FT_WEAP_ONE_STRT_AMMO -4 # define FT_WEAP_TWO_STRT_AMMO 30 # define FT_WEAP_THREE_STRT_AMMO 10 +# define FT_AMMO_PACK 6 # define FT_WEAP_MAX_AMMO 1000 # define FT_ENMY_STRT_LIFE 10 # define FT_ENMY_SIGHT_RANGE 8.5 # define FT_ENMY_DAMAGE_AMOUNT 14 # define FT_WEAP_ONE_VEL 900.0 -# define FT_WEAP_TWO_VEL 400.0 +# define FT_WEAP_TWO_VEL 450.0 # define FT_WEAP_THREE_VEL 1400.0 # define FT_W_ONE_DANAGE_AMOUNT 5 # define FT_W_TWO_DANAGE_AMOUNT 3 @@ -329,5 +330,6 @@ enum # define FT_PARSE_END_RET 25 # define FT_TOTAL_SPRT 14 +# define FT_TOTAL_SFX 18 # endif diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 4666cf9..de2c51c 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -274,7 +274,7 @@ typedef struct s_cub struct s_img tweap[6]; struct s_img tnum[12]; struct s_sprite **sprites; - struct s_sfx sfx[16]; + struct s_sfx sfx[FT_TOTAL_SFX]; struct s_bad_boy *bad_boy; } t_cub; diff --git a/map/lvl_five.cub b/map/lvl_five.cub index ca0dcdd..cbf4ff1 100644 --- a/map/lvl_five.cub +++ b/map/lvl_five.cub @@ -21,7 +21,7 @@ MU ./media/sound/BITURE-ET-MELANCOLIE.wav 11111101111110110111111110111111 1111101 101T01 10000++1 1000001 11101101 1111110111111 - 1101101 1+0#0001 1T0000e000001 + 1101101 1+0@0001 1T0000e000001 101101 111111101 1111111111101 111101 101 101 1000001 101 1e11101 101 1011101 101 diff --git a/map/lvl_four.cub b/map/lvl_four.cub index b787415..726afa3 100644 --- a/map/lvl_four.cub +++ b/map/lvl_four.cub @@ -25,12 +25,12 @@ L ./map/lvl_five.cub 101 1L1 101 11T11 10111111111111111e111 - 1000e0000#11111000TT11 + 1000e000#011111000TT11 10111111111111101111111 101 1e000000000+1 101 111110111111011 101 11111111111T10111 - 101 11+000000000000@++1 + 101 11+++0000000000@001 101 111111111110111111111 101 1E0000000000000000000T1 101 1111111111111111111110111 diff --git a/src/ft_exit.c b/src/ft_exit.c index 85c812f..6d93f8e 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -49,7 +49,7 @@ static void pthread_join(clist->mtid, NULL); } i = -1; - while (++i < 16) + while (++i < FT_TOTAL_SFX) { pthread_mutex_unlock(&clist->sfx[i].mutex); pthread_cancel(clist->sfx[i].tid); diff --git a/src/ft_extra_keys.c b/src/ft_extra_keys.c index c1ea721..e4d0853 100644 --- a/src/ft_extra_keys.c +++ b/src/ft_extra_keys.c @@ -73,6 +73,7 @@ int ft_space_key(t_cub *clist) { uint8_t w_id; + static uint8_t ref = 0; w_id = clist->plist.handles_weapon; w_id = (w_id == 2) ? (1) : (w_id); @@ -81,7 +82,19 @@ int (clist->plist.ammo[w_id] > 0 || clist->plist.ammo[w_id] == -4)) { clist->plist.ammo[w_id] -= w_id; - clist->sfx[clist->plist.handles_weapon + 7].sfx_play(clist->sfx); + if (clist->plist.handles_weapon != 2) + clist->sfx[clist->plist.handles_weapon + 7].sfx_play(clist->sfx); + else + { + if (ref % 3 == 0) + clist->sfx[9].sfx_play(clist->sfx); + else if (ref % 3 == 2) + clist->sfx[16].sfx_play(clist->sfx); + else if (ref % 3 == 1) + clist->sfx[17].sfx_play(clist->sfx); + ref += 2; + ref = (ref > 200) ? (0) : (ref); + } clist->plist.fire = 1; ft_shoot(clist); return (0); diff --git a/src/ft_find_item.c b/src/ft_find_item.c index f9504d1..1de7613 100644 --- a/src/ft_find_item.c +++ b/src/ft_find_item.c @@ -55,6 +55,11 @@ static void pl->ammo[1] += FT_WEAP_TWO_STRT_AMMO; else if (weap_id == 2) pl->ammo[2] += FT_WEAP_THREE_STRT_AMMO; + else if (weap_id == 3) + { + pl->ammo[2] += FT_AMMO_PACK; + weap_id = 2; + } if (pl->ammo[weap_id] > FT_WEAP_MAX_AMMO) pl->ammo[weap_id] = FT_WEAP_MAX_AMMO; } diff --git a/src/ft_init_sfx.c b/src/ft_init_sfx.c index 1725c91..2e0b268 100644 --- a/src/ft_init_sfx.c +++ b/src/ft_init_sfx.c @@ -38,6 +38,8 @@ ** 13: enemy death ** 14: enemy scream | double ** 15: enemy fire +** 16: weapon two fire overdub +** 17: weapon two fire overdub x2 */ static int8_t @@ -62,14 +64,10 @@ static void pthread_create(&cl->sfx[3].tid, NULL, ft_sfx_pain_thread, &cl->sfx); pthread_create(&cl->sfx[4].tid, NULL, ft_sfx_trap_thread, &cl->sfx); pthread_create(&cl->sfx[5].tid, NULL, ft_sfx_heal_thread, &cl->sfx); - pthread_create(&cl->sfx[6].tid, NULL, - ft_sfx_weapon_one_load_thread, &cl->sfx); - pthread_create(&cl->sfx[7].tid, NULL, - ft_sfx_weapon_one_fire_thread, &cl->sfx); - pthread_create(&cl->sfx[8].tid, NULL, - ft_sfx_weapon_two_load_thread, &cl->sfx); - pthread_create(&cl->sfx[9].tid, NULL, - ft_sfx_weapon_two_fire_thread, &cl->sfx); + pthread_create(&cl->sfx[6].tid, NULL, ft_sfx_w_one_load_thread, &cl->sfx); + pthread_create(&cl->sfx[7].tid, NULL, ft_sfx_w_one_fire_thread, &cl->sfx); + pthread_create(&cl->sfx[8].tid, NULL, ft_sfx_w_two_load_thread, &cl->sfx); + pthread_create(&cl->sfx[9].tid, NULL, ft_sfx_w_two_fire_thread, &cl->sfx); pthread_create(&cl->sfx[10].tid, NULL, ft_sfx_weapon_three_load_thread, &cl->sfx); pthread_create(&cl->sfx[11].tid, NULL, @@ -78,6 +76,10 @@ static void pthread_create(&cl->sfx[13].tid, NULL, ft_sfx_bb_death_thread, &cl->sfx); pthread_create(&cl->sfx[14].tid, NULL, ft_sfx_bb_scream_thread, &cl->sfx); pthread_create(&cl->sfx[15].tid, NULL, ft_sfx_bb_fire_thread, &cl->sfx); + pthread_create(&cl->sfx[16].tid, NULL, + ft_sfx_weapon_two_fire_thread_alt, &cl->sfx); + pthread_create(&cl->sfx[17].tid, NULL, + ft_sfx_weapon_two_fire_thread_alt_alt, &cl->sfx); } static void @@ -99,6 +101,8 @@ static void cl->sfx[13].sfx_play = ft_sfx_bb_death; cl->sfx[14].sfx_play = ft_sfx_bb_scream; cl->sfx[15].sfx_play = ft_sfx_bb_fire; + cl->sfx[16].sfx_play = ft_sfx_weapon_two_fire_alt; + cl->sfx[17].sfx_play = ft_sfx_weapon_two_fire_alt_alt; } static int8_t @@ -122,7 +126,9 @@ static int8_t ft_init_sfx_cmd(&cl->sfx[13].cmd, FT_SFX_ENMY_DEATH_PATH) < 0 || ft_init_sfx_cmd(&cl->sfx[14].cmd, FT_SFX_ENMY_SCR_ONE_PATH) < 0 || ft_init_sfx_cmd(&cl->sfx[14].cmd_alt, FT_SFX_ENMY_SCR_TWO_PATH) < 0 || - ft_init_sfx_cmd(&cl->sfx[15].cmd, FT_SFX_ENMY_FIRE_PATH) < 0) + ft_init_sfx_cmd(&cl->sfx[15].cmd, FT_SFX_ENMY_FIRE_PATH) < 0 || + ft_init_sfx_cmd(&cl->sfx[16].cmd, FT_SFX_W_TWO_FIRE_PATH) < 0 || + ft_init_sfx_cmd(&cl->sfx[17].cmd, FT_SFX_W_TWO_FIRE_PATH) < 0) return (-1); return (0); } @@ -134,9 +140,13 @@ int8_t if (ft_init_sfx_cmds(cl) < 0) return (-1); - i = -1; - while (++i < 16) + i = 0; + while (i < FT_TOTAL_SFX) + { pthread_mutex_init(&cl->sfx[i].mutex, NULL); + pthread_mutex_lock(&cl->sfx[i].mutex); + i++; + } ft_init_sfx_pthreads(cl); ft_init_sfx_funptr(cl); return (0); diff --git a/src/ft_sfx_bb_death.c b/src/ft_sfx_bb_death.c index ce86c82..23a96d8 100644 --- a/src/ft_sfx_bb_death.c +++ b/src/ft_sfx_bb_death.c @@ -25,7 +25,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[13].mutex); while (1) { pthread_mutex_lock(&sfx[13].mutex); diff --git a/src/ft_sfx_bb_fire.c b/src/ft_sfx_bb_fire.c index 8ebeb6d..df89544 100644 --- a/src/ft_sfx_bb_fire.c +++ b/src/ft_sfx_bb_fire.c @@ -25,7 +25,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[15].mutex); while (1) { pthread_mutex_lock(&sfx[15].mutex); diff --git a/src/ft_sfx_bb_scream.c b/src/ft_sfx_bb_scream.c index da93bdc..7c68c53 100644 --- a/src/ft_sfx_bb_scream.c +++ b/src/ft_sfx_bb_scream.c @@ -25,7 +25,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[14].mutex); while (1) { pthread_mutex_lock(&sfx[14].mutex); diff --git a/src/ft_sfx_death.c b/src/ft_sfx_death.c index 23dd26f..76a98cd 100644 --- a/src/ft_sfx_death.c +++ b/src/ft_sfx_death.c @@ -24,7 +24,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[0].mutex); while (1) { pthread_mutex_lock(&sfx[0].mutex); diff --git a/src/ft_sfx_footstep.c b/src/ft_sfx_footstep.c index a940852..628660b 100644 --- a/src/ft_sfx_footstep.c +++ b/src/ft_sfx_footstep.c @@ -25,7 +25,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[1].mutex); while (1) { ref = (ref > 201) ? (0) : (ref + 1); diff --git a/src/ft_sfx_heal.c b/src/ft_sfx_heal.c index 81704ee..b95fc2c 100644 --- a/src/ft_sfx_heal.c +++ b/src/ft_sfx_heal.c @@ -24,7 +24,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[5].mutex); while (1) { pthread_mutex_lock(&sfx[5].mutex); diff --git a/src/ft_sfx_new_level.c b/src/ft_sfx_new_level.c index 6dfe564..e4f3bff 100644 --- a/src/ft_sfx_new_level.c +++ b/src/ft_sfx_new_level.c @@ -24,7 +24,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[2].mutex); while (1) { pthread_mutex_lock(&sfx[2].mutex); diff --git a/src/ft_sfx_ooa.c b/src/ft_sfx_ooa.c index 880aea5..5950d2e 100644 --- a/src/ft_sfx_ooa.c +++ b/src/ft_sfx_ooa.c @@ -24,7 +24,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[12].mutex); while (1) { pthread_mutex_lock(&sfx[12].mutex); diff --git a/src/ft_sfx_pain.c b/src/ft_sfx_pain.c index 2670b99..d55c01c 100644 --- a/src/ft_sfx_pain.c +++ b/src/ft_sfx_pain.c @@ -25,7 +25,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[3].mutex); while (1) { pthread_mutex_lock(&sfx[3].mutex); diff --git a/src/ft_sfx_trap.c b/src/ft_sfx_trap.c index 98f210b..5ae39f0 100644 --- a/src/ft_sfx_trap.c +++ b/src/ft_sfx_trap.c @@ -24,7 +24,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[4].mutex); while (1) { pthread_mutex_lock(&sfx[4].mutex); diff --git a/src/ft_sfx_weapon_one.c b/src/ft_sfx_weapon_one.c index fca86f5..2cc8dcc 100644 --- a/src/ft_sfx_weapon_one.c +++ b/src/ft_sfx_weapon_one.c @@ -15,7 +15,7 @@ #include <pthread.h> void - *ft_sfx_weapon_one_load_thread(void *vargp) + *ft_sfx_w_one_load_thread(void *vargp) { t_sfx *sfx; @@ -24,7 +24,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[6].mutex); while (1) { pthread_mutex_lock(&sfx[6].mutex); @@ -41,7 +40,7 @@ void } void - *ft_sfx_weapon_one_fire_thread(void *vargp) + *ft_sfx_w_one_fire_thread(void *vargp) { t_sfx *sfx; @@ -50,7 +49,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[7].mutex); while (1) { pthread_mutex_lock(&sfx[7].mutex); diff --git a/src/ft_sfx_weapon_three.c b/src/ft_sfx_weapon_three.c index a737230..65c6903 100644 --- a/src/ft_sfx_weapon_three.c +++ b/src/ft_sfx_weapon_three.c @@ -24,7 +24,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[10].mutex); while (1) { pthread_mutex_lock(&sfx[10].mutex); @@ -50,7 +49,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[11].mutex); while (1) { pthread_mutex_lock(&sfx[11].mutex); diff --git a/src/ft_sfx_weapon_two.c b/src/ft_sfx_weapon_two.c index 1afc933..6d8e4a7 100644 --- a/src/ft_sfx_weapon_two.c +++ b/src/ft_sfx_weapon_two.c @@ -15,7 +15,7 @@ #include <pthread.h> void - *ft_sfx_weapon_two_load_thread(void *vargp) + *ft_sfx_w_two_load_thread(void *vargp) { t_sfx *sfx; @@ -24,7 +24,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[8].mutex); while (1) { pthread_mutex_lock(&sfx[8].mutex); @@ -41,7 +40,7 @@ void } void - *ft_sfx_weapon_two_fire_thread(void *vargp) + *ft_sfx_w_two_fire_thread(void *vargp) { t_sfx *sfx; @@ -50,7 +49,6 @@ void else pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); sfx = (t_sfx *)vargp; - pthread_mutex_lock(&sfx[9].mutex); while (1) { pthread_mutex_lock(&sfx[9].mutex); diff --git a/src/ft_sfx_weapon_two_alt.c b/src/ft_sfx_weapon_two_alt.c new file mode 100644 index 0000000..7702fce --- /dev/null +++ b/src/ft_sfx_weapon_two_alt.c @@ -0,0 +1,65 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_sfx_weapon_two_alt.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/24 17:17:54 by rbousset #+# #+# */ +/* Updated: 2020/02/24 17:17:56 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <cub3d.h> +#include <stdlib.h> +#include <pthread.h> + +void + *ft_sfx_weapon_two_fire_thread_alt(void *vargp) +{ + t_sfx *sfx; + + if (FT_OS == 1) + pthread_setcancelstate(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + else + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + sfx = (t_sfx *)vargp; + while (1) + { + pthread_mutex_lock(&sfx[16].mutex); + if (system(sfx[16].cmd)) + pthread_exit(NULL); + } + return (NULL); +} + +void + ft_sfx_weapon_two_fire_alt(t_sfx *sfx) +{ + pthread_mutex_unlock(&sfx[16].mutex); +} + +void + *ft_sfx_weapon_two_fire_thread_alt_alt(void *vargp) +{ + t_sfx *sfx; + + if (FT_OS == 1) + pthread_setcancelstate(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + else + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + sfx = (t_sfx *)vargp; + while (1) + { + pthread_mutex_lock(&sfx[17].mutex); + if (system(sfx[17].cmd)) + pthread_exit(NULL); + } + return (NULL); +} + +void + ft_sfx_weapon_two_fire_alt_alt(t_sfx *sfx) +{ + pthread_mutex_unlock(&sfx[17].mutex); +} |