diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-14 01:06:59 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-14 01:06:59 +0100 |
commit | a383bde7d29293919eb635aeb14760a7a55e12b3 (patch) | |
tree | 76000460117d1ab1348d98a03e2c92215755fde8 | |
parent | Fuck threads and forks (diff) | |
download | 42-cub3d-a383bde7d29293919eb635aeb14760a7a55e12b3.tar.gz 42-cub3d-a383bde7d29293919eb635aeb14760a7a55e12b3.tar.bz2 42-cub3d-a383bde7d29293919eb635aeb14760a7a55e12b3.tar.xz 42-cub3d-a383bde7d29293919eb635aeb14760a7a55e12b3.tar.zst 42-cub3d-a383bde7d29293919eb635aeb14760a7a55e12b3.zip |
Removed footsteps, in progress
Diffstat (limited to '')
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | inc/cub3d.h | 4 | ||||
-rw-r--r-- | inc/cub3d_defines.h | 4 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 3 | ||||
-rw-r--r-- | map/lvl_one.cub | 4 | ||||
-rw-r--r-- | map/lvl_two.cub | 5 | ||||
-rw-r--r-- | map/map_four.cub | 3 | ||||
-rw-r--r-- | media/sound/sfx/footstep_one.wav | bin | 44892 -> 0 bytes | |||
-rw-r--r-- | media/sound/sfx/footstep_two.wav | bin | 42954 -> 0 bytes | |||
-rw-r--r-- | src/ft_check_missing.c | 6 | ||||
-rw-r--r-- | src/ft_exit.c | 3 | ||||
-rw-r--r-- | src/ft_init_sfx.c | 2 | ||||
-rw-r--r-- | src/ft_key_loop.c | 4 | ||||
-rw-r--r-- | src/ft_sfx_new_level.c (renamed from src/ft_sfx_footstep.c) | 22 | ||||
-rw-r--r-- | src/ft_suffer_animation.c | 10 |
15 files changed, 25 insertions, 49 deletions
@@ -91,9 +91,9 @@ SRCS_NAME += ft_draw_traps_extra.c SRCS_NAME += ft_draw_life_bar.c SRCS_NAME += ft_del_extra_sprites.c SRCS_NAME += ft_init_sfx.c -SRCS_NAME += ft_sfx_trap.c SRCS_NAME += ft_sfx_death.c -SRCS_NAME += ft_sfx_footstep.c +SRCS_NAME += ft_sfx_trap.c +SRCS_NAME += ft_sfx_new_level.c #--------------------------------------------------------------------------------------------------# SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME}) #--------------------------------------------------------------------------------------------------# diff --git a/inc/cub3d.h b/inc/cub3d.h index 8148561..278b2e1 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -145,12 +145,12 @@ void ft_floor_cast(t_cub *cl); void ft_floor_cast_inits(uint16_t y, t_ray *rl, t_cub *cl); /* -** ====== ARGS ====== +** ====== SFX ====== */ void ft_sfx_death(t_cub *cl); -void ft_sfx_footstep(t_cub *cl); void ft_sfx_trap(t_cub *cl); +void ft_sfx_new_level(t_cub *cl); /* ** ====== OTHER ====== diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 7257108..1e00aa2 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -89,8 +89,6 @@ enum # define FT_SND_CMD "/usr/bin/aplay -f cd -t wav -q %s" # endif # define FT_SFX_DEATH_PATH "./media/sound/sfx/death_screen.wav" -# define FT_SFX_FS_ONE_PATH "./media/sound/sfx/footstep_one.wav" -# define FT_SFX_FS_TWO_PATH "./media/sound/sfx/footstep_two.wav" # define FT_SFX_N_LVL_PATH "./media/sound/sfx/next_lvl.wav" # define FT_SFX_SCR_ONE_PATH "./media/sound/sfx/scream_one.wav" # define FT_SFX_SCR_TWO_PATH "./media/sound/sfx/scream_two.wav" @@ -198,8 +196,6 @@ enum # define FT_ERR_MISS_PLAYER_SPAWN "player spawn" # define FT_ERR_MISS_TRAP "traps" # define FT_ERR_MISS_SFX_DEATH "missing sound effect death" -# define FT_ERR_MISS_SFX_FS_ONE "missing sound effect footstep one" -# define FT_ERR_MISS_SFX_FS_TWO "missing sound effect footstep two" # define FT_ERR_MISS_SFX_N_LVL "missing sound effect new level" # define FT_ERR_MISS_SFX_SCR_ONE "missing sound effect scream one" # define FT_ERR_MISS_SFX_SCR_TWO "missing sound effect scream two" diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 04ee59c..96ed172 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -58,14 +58,11 @@ typedef struct s_bmp_info typedef struct s_sfx { char **death; - char **footstep_one; - char **footstep_two; char **new_lvl; char **pain_one; char **pain_two; char **trap; pid_t death_pid; - pid_t footstep_pid; pid_t new_lvl_pid; pid_t pain_pid; pid_t trap_pid; diff --git a/map/lvl_one.cub b/map/lvl_one.cub index 04e805d..93d9e2e 100644 --- a/map/lvl_one.cub +++ b/map/lvl_one.cub @@ -18,7 +18,7 @@ MU ./media/sound/BITURE-ET-MELANCOLIE.wav 1111111 111111111111L00001 -112121212121111101 +120002000211111101 1E0000000000000001 -112121212101T12111 +120002000211T10011 111111111111111111 diff --git a/map/lvl_two.cub b/map/lvl_two.cub index 10e2808..a2cafeb 100644 --- a/map/lvl_two.cub +++ b/map/lvl_two.cub @@ -1,10 +1,10 @@ R 500 500 NO ./media/img/BRIQUASSE_3.xpm -SO ./media/img/linus.xpm +SO ./media/img/BRIQUASSE_3.xpm EA ./media/img/BRIQUASSE_3.xpm WE ./media/img/BRIQUASSE_3.xpm -S ./media/img/pillar.xpm +S ./media/img/linus.xpm C ./media/img/BRIQUASSE_3.xpm F ./media/img/BRIQUASSE_3.xpm @@ -17,6 +17,7 @@ LT ./media/img/crapaud.xpm MU ./media/sound/BITURE-ET-MELANCOLIE.wav 111 +121 101 1N1 101 diff --git a/map/map_four.cub b/map/map_four.cub index 8dcd6fe..2c9a894 100644 --- a/map/map_four.cub +++ b/map/map_four.cub @@ -9,6 +9,9 @@ S ./media/img/larry.xpm C 26,165,204 F 24,170,25 + +MU ./media/sound/BITURE-ET-MELANCOLIE.wav + 11111111111111111111111 10000000000000000000001 10000000000000000000001 diff --git a/media/sound/sfx/footstep_one.wav b/media/sound/sfx/footstep_one.wav Binary files differdeleted file mode 100644 index f8f4577..0000000 --- a/media/sound/sfx/footstep_one.wav +++ /dev/null diff --git a/media/sound/sfx/footstep_two.wav b/media/sound/sfx/footstep_two.wav Binary files differdeleted file mode 100644 index 4186e35..0000000 --- a/media/sound/sfx/footstep_two.wav +++ /dev/null diff --git a/src/ft_check_missing.c b/src/ft_check_missing.c index f9df88f..617e8f5 100644 --- a/src/ft_check_missing.c +++ b/src/ft_check_missing.c @@ -29,12 +29,6 @@ static int if (ft_check_not_found(FT_SFX_DEATH_PATH) < 0 || ft_check_ext(FT_SFX_DEATH_PATH, ".wav") < 0) return (ft_missing_error(FT_ERR_MISS_SFX_DEATH, clist)); - if (ft_check_not_found(FT_SFX_FS_ONE_PATH) < 0 || - ft_check_ext(FT_SFX_FS_ONE_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_FS_ONE, clist)); - if (ft_check_not_found(FT_SFX_FS_TWO_PATH) < 0 || - ft_check_ext(FT_SFX_FS_TWO_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_FS_TWO, clist)); if (ft_check_not_found(FT_SFX_N_LVL_PATH) < 0 || ft_check_ext(FT_SFX_N_LVL_PATH, ".wav") < 0) return (ft_missing_error(FT_ERR_MISS_SFX_N_LVL, clist)); diff --git a/src/ft_exit.c b/src/ft_exit.c index 6a92dac..e7b344e 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -82,9 +82,6 @@ static void if (!(tmp = waitpid(clist->sfx.death_pid, NULL, WNOHANG))) kill(clist->sfx.death_pid, SIGTERM); wait(&clist->sfx.death_pid); - if (!(tmp = waitpid(clist->sfx.footstep_pid, NULL, WNOHANG))) - kill(clist->sfx.footstep_pid, SIGTERM); - wait(&clist->sfx.footstep_pid); if (!(tmp = waitpid(clist->sfx.new_lvl_pid, NULL, WNOHANG))) kill(clist->sfx.new_lvl_pid, SIGTERM); wait(&clist->sfx.new_lvl_pid); diff --git a/src/ft_init_sfx.c b/src/ft_init_sfx.c index 84032d7..728e410 100644 --- a/src/ft_init_sfx.c +++ b/src/ft_init_sfx.c @@ -42,8 +42,6 @@ int8_t ft_init_sfx(t_sfx *sfx) { if (ft_split_sfx(&sfx->death, FT_SFX_DEATH_PATH) < 0 || - ft_split_sfx(&sfx->footstep_one, FT_SFX_FS_ONE_PATH) < 0 || - ft_split_sfx(&sfx->footstep_two, FT_SFX_FS_TWO_PATH) < 0 || ft_split_sfx(&sfx->new_lvl, FT_SFX_N_LVL_PATH) < 0 || ft_split_sfx(&sfx->pain_one, FT_SFX_SCR_ONE_PATH) < 0 || ft_split_sfx(&sfx->pain_two, FT_SFX_SCR_TWO_PATH) < 0 || diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c index 647b887..dc3a65d 100644 --- a/src/ft_key_loop.c +++ b/src/ft_key_loop.c @@ -83,19 +83,19 @@ int { cl->key_ptr[cl->key_input[i]](cl); ft_collision(old_y, old_x, cl->key_input[i], cl); - if (cl->key_input[i] >= 0 && cl->key_input[i] <= 3) - ft_sfx_footstep(cl); if (cl->mlist.isnlvl && !cl->plist.isdead) { if ((uint32_t)cl->plist.pos_x == cl->mlist.nlx && (uint32_t)cl->plist.pos_y == cl->mlist.nly) { + ft_sfx_new_level(cl); return ((ft_warp_level(cl->mlist.nlevel_path, cl) < 0) ? (ft_exit(FT_RET_FAILED_STRUCTS, cl)) : (0)); } } i++; } + ft_printf("%hhu\n", cl->plist.isdead); if (cl->key_input[0] != -1) ft_draw_scene(cl); return (0); diff --git a/src/ft_sfx_footstep.c b/src/ft_sfx_new_level.c index e629a7b..05e9059 100644 --- a/src/ft_sfx_footstep.c +++ b/src/ft_sfx_new_level.c @@ -1,7 +1,7 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* ft_sfx_trap.c :+: :+: :+: */ +/* ft_sfx_new_level.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ @@ -12,25 +12,13 @@ #include <cub3d.h> #include <unistd.h> -#include <stdint.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> void - ft_sfx_footstep(t_cub *cl) + ft_sfx_new_level(t_cub *cl) { - static uint8_t ref = 0; - - cl->sfx.footstep_pid = fork(); - if (cl->sfx.footstep_pid == 0) + cl->sfx.new_lvl_pid = fork(); + if (cl->sfx.new_lvl_pid == 0) { - ref = (ref > 201) ? (0) : (ref + 1); - if (ref % 2) - execve(*(cl->sfx.footstep_one + 0), - cl->sfx.footstep_one, cl->envp); - else - execve(*(cl->sfx.footstep_two + 0), - cl->sfx.footstep_two, cl->envp); + execve(*(cl->sfx.new_lvl + 0), cl->sfx.new_lvl, cl->envp); } } diff --git a/src/ft_suffer_animation.c b/src/ft_suffer_animation.c index 651f4dd..6933f56 100644 --- a/src/ft_suffer_animation.c +++ b/src/ft_suffer_animation.c @@ -31,10 +31,8 @@ void { x = -1; while (++x < (int32_t)cl->wlist.x_size) - { *(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = 0x00880404; - } } mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr, cl->img.img, 0, 0); @@ -47,7 +45,8 @@ void ft_sfx_death(cl); /* TODO death screen here */ } - ft_sfx_trap(cl); + else + ft_sfx_trap(cl); } void @@ -77,7 +76,10 @@ void { cl->plist.isdead = 1; ft_warp_level(cl->mlist.filename, cl); + ft_sfx_death(cl); + /* TODO death screen here */ } - /* TODO death screen here */ + else + ft_sfx_trap(cl); cl->doicast = 0; } |