diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 16:06:39 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 16:06:39 +0100 |
commit | 5a2b45a9c6d8235f5027a22132920fc28f2602c8 (patch) | |
tree | 09c4ca149aba38a88d604fbee20c916dab225681 /src | |
parent | Footsteps are bav (diff) | |
download | 42-cub3d-5a2b45a9c6d8235f5027a22132920fc28f2602c8.tar.gz 42-cub3d-5a2b45a9c6d8235f5027a22132920fc28f2602c8.tar.bz2 42-cub3d-5a2b45a9c6d8235f5027a22132920fc28f2602c8.tar.xz 42-cub3d-5a2b45a9c6d8235f5027a22132920fc28f2602c8.tar.zst 42-cub3d-5a2b45a9c6d8235f5027a22132920fc28f2602c8.zip |
Edited sounds, bug fix
Diffstat (limited to '')
-rw-r--r-- | src/ft_sfx_pain.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/ft_sfx_pain.c b/src/ft_sfx_pain.c index 28bc95d..cb68108 100644 --- a/src/ft_sfx_pain.c +++ b/src/ft_sfx_pain.c @@ -28,15 +28,12 @@ void pthread_mutex_lock(&sfx->pain_mutex); while (1) { + pthread_mutex_lock(&sfx->pain_mutex); ref = (ref > 201) ? (0) : (ref + 1); - if (ref % 2) - { - pthread_mutex_lock(&sfx->pain_mutex); - if (ref % 3) - system(sfx->pain_one); - else - system(sfx->pain_two); - } + if (ref % 3) + system(sfx->pain_one); + else + system(sfx->pain_two); } return (NULL); } @@ -44,5 +41,9 @@ void void ft_sfx_pain(t_cub *cl) { - pthread_mutex_unlock(&cl->sfx.pain_mutex); + static uint8_t ref = 0; + + ref = (ref > 201) ? (0) : (ref + 1); + if (ref % 2) + pthread_mutex_unlock(&cl->sfx.pain_mutex); } |