diff options
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | inc/cub3d_defines.h | 12 | ||||
-rw-r--r-- | src/ft_bad_boy_actions.c | 6 | ||||
-rw-r--r-- | src/ft_draw_scene.c | 4 | ||||
-rw-r--r-- | src/ft_sfx_weapon_one.c | 1 |
5 files changed, 22 insertions, 7 deletions
@@ -178,6 +178,7 @@ CFLAGS += -Wall CFLAGS += -Wextra CFLAGS += -Werror CFLAGS += -pedantic +CFLAGS += -pthread #--------------------------------------------------------------------------------------------------# ifdef DEBUG CFLAGS += ${DBG} @@ -192,8 +193,10 @@ CDEFS = -D_DEFAULT_SOURCE CDEFS += -DFT_SCR_SIZE=\"${SCR_SZE}\" ifeq (${OS}, Darwin) CDEFS += -DFT_OS=1 -else +else ifeq (${OS}, Linux) CDEFS += -DFT_OS=2 +else + CDEFS += -DFT_OS=3 endif #--------------------------------------------------------------------------------------------------# NAME = Cub3D @@ -257,6 +260,7 @@ ifeq (${OS}, FreeBSD) endif ${RM} ${NAME} ${RM} ${NAME}.dSYM + ${RM} ${NAME}.core #--------------------------------------------------------------------------------------------------# re: fclean all #--------------------------------------------------------------------------------------------------# diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 1fa2da0..d1cddbb 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -48,6 +48,7 @@ enum ** ** 1: Darwin ** 2: Linux +** 3: FreeBSD */ # ifndef FT_OS @@ -155,10 +156,19 @@ enum # if FT_OS == 1 # define FT_SND_CMD "/usr/bin/afplay --volume 0.2 %s" -# else +# endif +# if FT_OS == 2 # define FT_SND_CMD "/usr/bin/aplay -f cd -t wav -q %s" # endif +# if FT_OS == 3 +# define FT_SND_CMD "/usr/local/bin/waveplay -s %s >/dev/null 2>&1" +# endif +# if FT_OS == 1 # define FT_SND_TERM_CMD "pkill -SIGTERM afplay" +# endif +# if FT_OS == 3 +# define FT_SND_TERM_CMD "pkill -SIGTERM waveplay" +# endif /* ** ====== MOVE SPEED ====== diff --git a/src/ft_bad_boy_actions.c b/src/ft_bad_boy_actions.c index 26d294b..fb2cdb7 100644 --- a/src/ft_bad_boy_actions.c +++ b/src/ft_bad_boy_actions.c @@ -73,10 +73,10 @@ void i = 0; while (i < cl->mlist.sprite_nbr[13]) { - if (FT_OS == 1) - r = rand() % 4; - else + if (FT_OS == 2) r = random() % 4; + else + r = rand() % 4; if (cl->bad_boy[i].does == 2 && cl->bad_boy[i].sleep == 0) { cl->sfx[15].sfx_play(cl->sfx); diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 36cdf4f..ad6b373 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -52,7 +52,7 @@ static int8_t void ft_draw_scene(t_cub *clist) { - if (FT_OS == 2) + if (FT_OS == 2 || FT_OS == 3) { clist->img.img = mlx_new_image(clist->wlist.wlx, clist->wlist.x_size, clist->wlist.y_size); @@ -67,7 +67,7 @@ void ft_draw_hud(clist); mlx_put_image_to_window(clist->wlist.wlx, clist->wlist.winptr, clist->img.img, 0, 0); - if (FT_OS == 2) + if (FT_OS == 2 || FT_OS == 3) mlx_destroy_image(clist->wlist.wlx, clist->img.img); if (clist->ishud) { diff --git a/src/ft_sfx_weapon_one.c b/src/ft_sfx_weapon_one.c index 2cc8dcc..6cecc4e 100644 --- a/src/ft_sfx_weapon_one.c +++ b/src/ft_sfx_weapon_one.c @@ -14,6 +14,7 @@ #include <stdlib.h> #include <pthread.h> +#include <libft.h> void *ft_sfx_w_one_load_thread(void *vargp) { |