aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-13 01:44:22 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-13 01:44:22 +0100
commitb744a677218df528502b5eb769a52ef294ebbac6 (patch)
tree9e3f733698197d975c26e838e73e4283b02a87c8
parentReduced musics volume (diff)
download42-cub3d-b744a677218df528502b5eb769a52ef294ebbac6.tar.gz
42-cub3d-b744a677218df528502b5eb769a52ef294ebbac6.tar.bz2
42-cub3d-b744a677218df528502b5eb769a52ef294ebbac6.tar.xz
42-cub3d-b744a677218df528502b5eb769a52ef294ebbac6.tar.zst
42-cub3d-b744a677218df528502b5eb769a52ef294ebbac6.zip
Added sound effects files
-rw-r--r--inc/cub3d_defines.h34
-rw-r--r--inc/cub3d_structs.h11
-rw-r--r--map/lvl_five.cub2
-rw-r--r--map/lvl_four.cub2
-rw-r--r--map/lvl_one.cub2
-rw-r--r--map/lvl_three.cub2
-rw-r--r--map/lvl_two.cub2
-rw-r--r--media/sound/sfx/death_screen.wavbin0 -> 1459980 bytes
-rw-r--r--media/sound/sfx/footstep_one.wavbin0 -> 44892 bytes
-rw-r--r--media/sound/sfx/footstep_two.wavbin0 -> 42954 bytes
-rw-r--r--media/sound/sfx/next_lvl.wavbin0 -> 792004 bytes
-rw-r--r--media/sound/sfx/scream_one.wavbin0 -> 26392 bytes
-rw-r--r--media/sound/sfx/scream_two.wavbin0 -> 34140 bytes
-rw-r--r--media/sound/sfx/trap.wavbin0 -> 108532 bytes
-rw-r--r--src/ft_check_missing.c22
-rw-r--r--src/ft_get_music.c4
16 files changed, 70 insertions, 11 deletions
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index 1c2c39c..588670d 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -80,13 +80,34 @@ enum
# endif
/*
-** ====== MUSIC CMD ======
+** ====== SOUNDS ======
*/
+# 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"
+# define FT_SFX_SCR_TRAP_PATH "./media/sound/sfx/trap.wav"
# if FT_OS == 1
-# define FT_SND_CMD "/usr/bin/afplay --volume 0.2 %s"
+# define FT_MUS_CMD "/usr/bin/afplay --volume 0.2 %s"
+# define FT_SFX_DEATH "/usr/bin/afplay --volume 0.2 ./media/sound/sfx/death_screen.wav"
+# define FT_SFX_FS_ONE "/usr/bin/afplay --volume 0.2 ./media/sound/sfx/footstep_one.wav"
+# define FT_SFX_FS_TWO "/usr/bin/afplay --volume 0.2 ./media/sound/sfx/footstep_two.wav"
+# define FT_SFX_N_LVL "/usr/bin/afplay --volume 0.2 ./media/sound/sfx/next_lvl.wav"
+# define FT_SFX_PAIN_ONE "/usr/bin/afplay --volume 0.2 ./media/sound/sfx/scream_one.wav"
+# define FT_SFX_PAIN_TWO "/usr/bin/afplay --volume 0.2 ./media/sound/sfx/scream_two.wav"
+# define FT_SFX_TRAP "/usr/bin/afplay --volume 0.2 ./media/sound/sfx/trap.wav"
# else
-# define FT_SND_CMD "/usr/bin/aplay -f cd -t wav -q %s"
+# define FT_MUS_CMD "/usr/bin/aplay -f cd -t wav -q %s"
+# define FT_SFX_DEATH "/usr/bin/aplay -f cd -t wav -q ./media/sound/sfx/death_screen.wav"
+# define FT_SFX_FS_ONE "/usr/bin/aplay -f cd -t wav -q ./media/sound/sfx/footstep_one.wav"
+# define FT_SFX_FS_TWO "/usr/bin/aplay -f cd -t wav -q ./media/sound/sfx/footstep_two.wav"
+# define FT_SFX_N_LVL "/usr/bin/aplay -f cd -t wav -q ./media/sound/sfx/next_lvl.wav"
+# define FT_SFX_PAIN_ONE "/usr/bin/aplay -f cd -t wav -q ./media/sound/sfx/scream_one.wav"
+# define FT_SFX_PAIN_TWO "/usr/bin/aplay -f cd -t wav -q ./media/sound/sfx/scream_two.wav"
+# define FT_SFX_TRAP "/usr/bin/aplay -f cd -t wav -q ./media/sound/sfx/trap.wav"
# endif
/*
@@ -190,6 +211,13 @@ enum
# define FT_ERR_MISS_CEIL_C "ceiling color"
# 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"
+# define FT_ERR_MISS_SFX_TRAP "missing sound effect trap"
/*
** ====== OTHER ======
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index dd652ee..e1ca235 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -55,6 +55,17 @@ typedef struct s_bmp_info
uint32_t colors_important;
} t_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;
+} t_sfx;
+
typedef struct s_bmp_rgb
{
uint8_t r;
diff --git a/map/lvl_five.cub b/map/lvl_five.cub
index e94d9f2..f88bde8 100644
--- a/map/lvl_five.cub
+++ b/map/lvl_five.cub
@@ -14,7 +14,7 @@ L ./map/map_four.cub
T ./media/img/spikes.xpm
SH 16
-MU ./media/sound/TAPE-DU-PIED-ET-FRAPPE-TA-TANTE.wav
+MU ./media/sound/BITURE-ET-MELANCOLIE.wav
111111111111111111111111111111
1T0000000000000000000000000001
diff --git a/map/lvl_four.cub b/map/lvl_four.cub
index 543d477..a1ec7bf 100644
--- a/map/lvl_four.cub
+++ b/map/lvl_four.cub
@@ -8,7 +8,7 @@ S ./media/img/pillar.xpm
C ./media/img/left_arrow.xpm
F ./media/img/arrow5.xpm
-MU ./media/sound/TAPE-DU-PIED-ET-FRAPPE-TA-TANTE.wav
+MU ./media/sound/BITURE-ET-MELANCOLIE.wav
SH 8
diff --git a/map/lvl_one.cub b/map/lvl_one.cub
index 5a73e65..04e805d 100644
--- a/map/lvl_one.cub
+++ b/map/lvl_one.cub
@@ -14,7 +14,7 @@ SH 4
L ./map/lvl_two.cub
LT ./media/img/crapaud.xpm
-MU ./media/sound/TAPE-DU-PIED-ET-FRAPPE-TA-TANTE.wav
+MU ./media/sound/BITURE-ET-MELANCOLIE.wav
1111111
111111111111L00001
diff --git a/map/lvl_three.cub b/map/lvl_three.cub
index e63e23c..b0a9aec 100644
--- a/map/lvl_three.cub
+++ b/map/lvl_three.cub
@@ -15,7 +15,7 @@ T ./media/img/spikes.xpm
LT ./media/img/crapaud.xpm
L ./map/lvl_four.cub
-MU ./media/sound/TAPE-DU-PIED-ET-FRAPPE-TA-TANTE.wav
+MU ./media/sound/BITURE-ET-MELANCOLIE.wav
11111111111111111111111
10000000000000000000001
diff --git a/map/lvl_two.cub b/map/lvl_two.cub
index 2e12e19..10e2808 100644
--- a/map/lvl_two.cub
+++ b/map/lvl_two.cub
@@ -14,7 +14,7 @@ SH 4
L ./map/lvl_three.cub
LT ./media/img/crapaud.xpm
-MU ./media/sound/TAPE-DU-PIED-ET-FRAPPE-TA-TANTE.wav
+MU ./media/sound/BITURE-ET-MELANCOLIE.wav
111
101
diff --git a/media/sound/sfx/death_screen.wav b/media/sound/sfx/death_screen.wav
new file mode 100644
index 0000000..61cf33d
--- /dev/null
+++ b/media/sound/sfx/death_screen.wav
Binary files differ
diff --git a/media/sound/sfx/footstep_one.wav b/media/sound/sfx/footstep_one.wav
new file mode 100644
index 0000000..f8f4577
--- /dev/null
+++ b/media/sound/sfx/footstep_one.wav
Binary files differ
diff --git a/media/sound/sfx/footstep_two.wav b/media/sound/sfx/footstep_two.wav
new file mode 100644
index 0000000..4186e35
--- /dev/null
+++ b/media/sound/sfx/footstep_two.wav
Binary files differ
diff --git a/media/sound/sfx/next_lvl.wav b/media/sound/sfx/next_lvl.wav
new file mode 100644
index 0000000..64cbc31
--- /dev/null
+++ b/media/sound/sfx/next_lvl.wav
Binary files differ
diff --git a/media/sound/sfx/scream_one.wav b/media/sound/sfx/scream_one.wav
new file mode 100644
index 0000000..df9fc78
--- /dev/null
+++ b/media/sound/sfx/scream_one.wav
Binary files differ
diff --git a/media/sound/sfx/scream_two.wav b/media/sound/sfx/scream_two.wav
new file mode 100644
index 0000000..1d4ff78
--- /dev/null
+++ b/media/sound/sfx/scream_two.wav
Binary files differ
diff --git a/media/sound/sfx/trap.wav b/media/sound/sfx/trap.wav
new file mode 100644
index 0000000..7d237e5
--- /dev/null
+++ b/media/sound/sfx/trap.wav
Binary files differ
diff --git a/src/ft_check_missing.c b/src/ft_check_missing.c
index d01a77f..e349d05 100644
--- a/src/ft_check_missing.c
+++ b/src/ft_check_missing.c
@@ -24,6 +24,26 @@ int
}
static int
+ ft_check_missing_sfx(t_cub *clist)
+{
+ if (ft_check_not_found(FT_SFX_DEATH_PATH) < 0)
+ return (ft_missing_error(FT_MISS_SFX_DEATH, clist));
+ if (ft_check_not_found(FT_SFX_FS_ONE_PATH) < 0)
+ return (ft_missing_error(FT_ERR_MISS_SFX_FS_ONE, clist));
+ if (ft_check_not_found(FT_SFX_FS_TWO_PATH) < 0)
+ return (ft_missing_error(FT_ERR_MISS_SFX_FS_TWO, clist));
+ if (ft_check_not_found(FT_SFX_N_LVL_PATH) < 0)
+ return (ft_missing_error(FT_ERR_MISS_SFX_N_LVL, clist));
+ if (ft_check_not_found(FT_SFX_SCR_ONE_PATH) < 0)
+ return (ft_missing_error(FT_ERR_MISS_SFX_SCR_ONE, clist));
+ if (ft_check_not_found(FT_SFX_SCR_TWO_PATH) < 0)
+ return (ft_missing_error(FT_ERR_MISS_SFX_SCR_TWO, clist));
+ if (ft_check_not_found(FT_SFX_TRAP_PATH) < 0)
+ return (ft_missing_error(FT_ERR_MISS_SFX_TRAP, clist));
+ return (0);
+}
+
+static int
ft_check_missing_sprites(t_cub *clist)
{
int8_t i;
@@ -35,7 +55,7 @@ static int
return (ft_missing_error(FT_ERR_MISS_SPRITE, clist));
i++;
}
- return (0);
+ return (ft_check_missing_sfx(clist));
}
static int
diff --git a/src/ft_get_music.c b/src/ft_get_music.c
index 7a8d36f..2383e0a 100644
--- a/src/ft_get_music.c
+++ b/src/ft_get_music.c
@@ -21,11 +21,11 @@ static int8_t
uint8_t len;
len = ft_strlen(mlist->music_path);
- len += ft_strlen(FT_SND_CMD) - 2;
+ len += ft_strlen(FT_MUS_CMD) - 2;
ft_memdel((void**)&mlist->music_cmd);
if (!(mlist->music_cmd = (char *)malloc((len + 1) * sizeof(char))))
return (-1);
- ft_sprintf(mlist->music_cmd, FT_SND_CMD,
+ ft_sprintf(mlist->music_cmd, FT_MUS_CMD,
mlist->music_path);
ft_free_words(mlist->mcmd_words);
if (!(mlist->mcmd_words = ft_split(mlist->music_cmd, ' ')))