diff options
Diffstat (limited to 'src/ft_sfx_trap.c')
-rw-r--r-- | src/ft_sfx_trap.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/ft_sfx_trap.c b/src/ft_sfx_trap.c index 32fc35a..cf5dafa 100644 --- a/src/ft_sfx_trap.c +++ b/src/ft_sfx_trap.c @@ -12,21 +12,22 @@ #include <cub3d.h> #include <unistd.h> +#include <stdint.h> static void ft_sfx_pain(t_cub *cl) { - static uint8_t ref_scr = 0; + static uint8_t ref = 0; - ref_scr += 1; - if (ref_scr > 201) - ref_scr = 0; - if (ref_scr % 2) + ref += 1; + if (ref > 201) + ref = 0; + if (ref % 2) { - cl->pain_pid = fork(); - if (cl->pain_pid == 0) + cl->sfx.pain_pid = fork(); + if (cl->sfx.pain_pid == 0) { - if (ref_scr % 3) + if (ref % 3) execve(*(cl->sfx.pain_one + 0), cl->sfx.pain_one, cl->envp); else execve(*(cl->sfx.pain_two + 0), cl->sfx.pain_two, cl->envp); @@ -37,8 +38,8 @@ static void void ft_sfx_trap(t_cub *cl) { - cl->trap_pid = fork(); - if (cl->trap_pid == 0) + cl->sfx.trap_pid = fork(); + if (cl->sfx.trap_pid == 0) execve(*(cl->sfx.trap + 0), cl->sfx.trap, cl->envp); ft_sfx_pain(cl); } |