diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 8 | ||||
| -rw-r--r-- | inc/cub3d_defines.h | 3 | ||||
| -rw-r--r-- | map/lvl_three.cub | 2 | ||||
| -rw-r--r-- | src/ft_check_map_surrounds.c | 10 | ||||
| -rw-r--r-- | src/ft_exit.c | 6 | ||||
| -rw-r--r-- | src/ft_parse_map.c | 2 | ||||
| -rw-r--r-- | src/ft_warp_level.c | 11 | 
7 files changed, 23 insertions, 19 deletions
| @@ -129,7 +129,7 @@ endif  ${OBJS_DIR}%.o:		${SRCS_DIR}%.c ${INCS_DIR}  	@${MKDIR} ${OBJS_DIR}  ifeq (${OS}, Darwin) -	${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${MLX_DIR} -I${INCS_DIR} -o $@ $< +	${CC} -c -pthread ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${MLX_DIR} -I${INCS_DIR} -o $@ $<  else  	${CC} -c -pthread ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${INCS_DIR} -o $@ $<  endif @@ -147,10 +147,10 @@ else  	@$(MAKE) --no-print-directory -C ${LFT_DIR} all  endif  ifeq (${OS}, Darwin) -	${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_DIR} -lft -lmlx -lm -lpthread \ +	${CC} -pthread ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_DIR} -lft -lmlx -lm -lpthread \  -framework OpenGL -framework AppKit  else -	${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -lft -lX11 -lXext -lmlx -lm -lbsd -lpthread +	${CC} -pthread ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -lft -lX11 -lXext -lmlx -lm -lbsd -lpthread  endif  #--------------------------------------------------------------------------------------------------#  all: ${NAME} @@ -170,7 +170,7 @@ fclean: clean  re: fclean all  #--------------------------------------------------------------------------------------------------#  run: all -	@./${NAME} "map/map_five.cub" +	@./${NAME} "map/lvl_one.cub"  #--------------------------------------------------------------------------------------------------#  .PHONY:	all clean clean fclean re run default  #============================================== EOF ===============================================# diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 4ce875b..fb50474 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -81,8 +81,9 @@ enum  /*  ** ====== MUSIC CMD ======  */ +  #	if FT_OS == 1 -#		define FT_MUS_CMD "" +#		define FT_MUS_CMD "afplay --volume 0.2 %s"  #	else  #		define FT_MUS_CMD "aplay -f cd -t wav -q %s"  #	endif diff --git a/map/lvl_three.cub b/map/lvl_three.cub index 6e9263f..45e51d9 100644 --- a/map/lvl_three.cub +++ b/map/lvl_three.cub @@ -12,7 +12,7 @@ F 100,160,114  LT ./media/img/crapaud.xpm  L ./map/lvl_four.cub -MU ./media/sound/DEVANT-LES-KAISSONS.wav +MU ./media/sound/TAPE-DU-PIED-ET-FRAPPE-TA-TANTE.wav  11111111111111111111111  10000000000000000000001 diff --git a/src/ft_check_map_surrounds.c b/src/ft_check_map_surrounds.c index fbe2ff8..4b3f236 100644 --- a/src/ft_check_map_surrounds.c +++ b/src/ft_check_map_surrounds.c @@ -22,18 +22,10 @@ static int8_t  		map[y - 1][x] == ' ' ||  		map[y][x + 1] == ' ' ||  		map[y][x - 1] == ' ' || -		map[y + 1][x + 1] == ' ' || -		map[y - 1][x + 1] == ' ' || -		map[y + 1][x - 1] == ' ' || -		map[y - 1][x - 1] == ' ' ||  		map[y + 1][x] == '\0' ||  		map[y - 1][x] == '\0' ||  		map[y][x + 1] == '\0' || -		map[y][x - 1] == '\0' || -		map[y + 1][x + 1] == '\0' || -		map[y - 1][x + 1] == '\0' || -		map[y + 1][x - 1] == '\0' || -		map[y - 1][x - 1] == '\0') +		map[y][x - 1] == '\0')  		return (-1);  	return (0);  } diff --git a/src/ft_exit.c b/src/ft_exit.c index 23cd466..92da2a6 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -16,6 +16,7 @@  #include <stddef.h>  #include <stdlib.h>  #include <stdint.h> +#include <signal.h>  #include <pthread.h>  static void @@ -63,7 +64,10 @@ int  	if (clist->isoldmus && clist->wlist.inited)  	{  		pthread_cancel(clist->tid); -		pthread_join(clist->tid, NULL); +		if (FT_OS == 1) +			pthread_kill(clist->tid, SIGTERM); +		else +			pthread_join(clist->tid, NULL);  	}  	ft_free_lists(clist);  	ft_printf("Exiting program\n"); diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index 6a9c5af..3c1fd9c 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -77,7 +77,7 @@ static int8_t  void  	ft_save_name(const char *map_path, t_map *mlist, t_cub *clist)  { -	ft_memdel((void**)mlist->filename); +	ft_memdel((void**)&mlist->filename);  	if (!(mlist->filename =  		(char*)malloc((ft_strlen(map_path) + 1) * sizeof(char))))  		ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, clist); diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c index b122e46..a93184c 100644 --- a/src/ft_warp_level.c +++ b/src/ft_warp_level.c @@ -16,6 +16,7 @@  #include <stddef.h>  #include <stdint.h>  #include <mlx.h> +#include <signal.h>  #include <pthread.h>  static void @@ -66,14 +67,20 @@ static void  	if (isoldmus && !cl->mlist.ismusic)  	{  		pthread_cancel(cl->tid); -		pthread_join(cl->tid, NULL); +		if (FT_OS == 1) +			pthread_kill(cl->tid, SIGTERM); +		else +			pthread_join(cl->tid, NULL);  		cl->isoldmus = 0;  	}  	else if (isoldmus && cl->mlist.ismusic  		&& ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1))  	{  		pthread_cancel(cl->tid); -		pthread_join(cl->tid, NULL); +		if (FT_OS == 1) +			pthread_kill(cl->tid, SIGTERM); +		else +			pthread_join(cl->tid, NULL);  		pthread_create(&cl->tid, NULL, ft_music_thread, cl);  	}  	else if (isoldmus && cl->mlist.ismusic | 
