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 /src/ft_init_sfx.c | |
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
Diffstat (limited to 'src/ft_init_sfx.c')
-rw-r--r-- | src/ft_init_sfx.c | 32 |
1 files changed, 21 insertions, 11 deletions
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); |