aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-31 18:45:25 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-31 18:45:25 +0200
commitc12dc3125cda5599fcbadfe2492ef0015e8093f2 (patch)
tree90edcf38579ef621f75768c5ffecb4062a28257d
parentAlright sounds (diff)
download42-cub3d-c12dc3125cda5599fcbadfe2492ef0015e8093f2.tar.gz
42-cub3d-c12dc3125cda5599fcbadfe2492ef0015e8093f2.tar.bz2
42-cub3d-c12dc3125cda5599fcbadfe2492ef0015e8093f2.tar.xz
42-cub3d-c12dc3125cda5599fcbadfe2492ef0015e8093f2.tar.zst
42-cub3d-c12dc3125cda5599fcbadfe2492ef0015e8093f2.zip
Better sound balance, now hardgimping
-rw-r--r--inc/cub3d_defines.h4
-rw-r--r--inc/cub3d_structs.h1
-rw-r--r--media/sound/sfx/skel_death.wavbin257772 -> 233728 bytes
-rw-r--r--media/sound/sfx/skel_gun.wavbin49570 -> 49570 bytes
-rw-r--r--media/sound/sfx/skel_scream_one.wavbin132128 -> 107744 bytes
-rw-r--r--media/sound/sfx/skel_scream_two.wavbin136212 -> 113516 bytes
-rw-r--r--src/ft_bad_boy_actions.c22
-rw-r--r--src/ft_damage_bad_boy.c9
-rw-r--r--src/ft_init_bad_boys.c1
-rw-r--r--src/ft_init_sfx.c16
10 files changed, 40 insertions, 13 deletions
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index 65d60fa..a799404 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -300,7 +300,7 @@ enum
** ====== GAMEPLAY ======
*/
-# define FT_STRT_LIFE 250
+# define FT_STRT_LIFE 270
# define FT_TRAP_DAMAGE_AMOUNT 45
# define FT_HEAL_PACK_AMOUNT 20
# define FT_BOUNCE_FACTOR 4
@@ -310,7 +310,7 @@ enum
# define FT_WEAP_MAX_AMMO 1000
# define FT_ENMY_STRT_LIFE 10
# define FT_ENMY_SIGHT_RANGE 7.0
-# define FT_ENMY_DAMAGE_AMOUNT 40
+# define FT_ENMY_DAMAGE_AMOUNT 15
# define FT_W_ONE_DANAGE_AMOUNT 5
# define FT_W_TWO_DANAGE_AMOUNT 2
# define FT_W_THREE_DANAGE_AMOUNT 4
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index 7aea071..a97ff2d 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -229,6 +229,7 @@ typedef struct s_bad_boy
int8_t life;
int8_t does;
int8_t sleep;
+ int8_t isdead;
void (*act[3])(struct s_bad_boy*, struct s_sprite*, t_map*);
} t_bad_boy;
diff --git a/media/sound/sfx/skel_death.wav b/media/sound/sfx/skel_death.wav
index 011fe4f..3a7a2e2 100644
--- a/media/sound/sfx/skel_death.wav
+++ b/media/sound/sfx/skel_death.wav
Binary files differ
diff --git a/media/sound/sfx/skel_gun.wav b/media/sound/sfx/skel_gun.wav
index 7ca45fe..47a912a 100644
--- a/media/sound/sfx/skel_gun.wav
+++ b/media/sound/sfx/skel_gun.wav
Binary files differ
diff --git a/media/sound/sfx/skel_scream_one.wav b/media/sound/sfx/skel_scream_one.wav
index 19e541c..21000d2 100644
--- a/media/sound/sfx/skel_scream_one.wav
+++ b/media/sound/sfx/skel_scream_one.wav
Binary files differ
diff --git a/media/sound/sfx/skel_scream_two.wav b/media/sound/sfx/skel_scream_two.wav
index 0a58118..2ea2e86 100644
--- a/media/sound/sfx/skel_scream_two.wav
+++ b/media/sound/sfx/skel_scream_two.wav
Binary files differ
diff --git a/src/ft_bad_boy_actions.c b/src/ft_bad_boy_actions.c
index 49f5a26..92fe3fa 100644
--- a/src/ft_bad_boy_actions.c
+++ b/src/ft_bad_boy_actions.c
@@ -61,22 +61,34 @@ void
bl->does = 1;
}
+/*
+** skelton misses one random
+** shot out of four
+*/
+
void
ft_check_bad_boy_shoot(t_cub *cl)
{
int8_t i;
+ int8_t r;
i = 0;
while (i < cl->mlist.sprite_nbr[13])
{
+ if (FT_OS == 1)
+ r = rand() % 4;
+ else
+ r = random() % 4;
if (cl->bad_boy[i].does == 2 && cl->bad_boy[i].sleep == 0)
{
cl->sfx[15].sfx_play(cl->sfx);
- /* TODO: random shot */
- if (FT_OS == 1)
- ft_macos_suffer_animation(FT_ENMY_DAMAGE_AMOUNT, cl);
- else
- ft_linux_suffer_animation(FT_ENMY_DAMAGE_AMOUNT, cl);
+ if (r != 3)
+ {
+ if (FT_OS == 1)
+ ft_macos_suffer_animation(FT_ENMY_DAMAGE_AMOUNT, cl);
+ else
+ ft_linux_suffer_animation(FT_ENMY_DAMAGE_AMOUNT, cl);
+ }
}
i++;
}
diff --git a/src/ft_damage_bad_boy.c b/src/ft_damage_bad_boy.c
index 27a41ad..2d6bd58 100644
--- a/src/ft_damage_bad_boy.c
+++ b/src/ft_damage_bad_boy.c
@@ -42,7 +42,12 @@ void
cl->bad_boy[id].life -= FT_W_TWO_DANAGE_AMOUNT;
else if (cl->plist.handles_weapon == 4)
cl->bad_boy[id].life -= FT_W_THREE_DANAGE_AMOUNT;
- if (cl->bad_boy[id].does != 3)
+ if (cl->bad_boy[id].isdead == 0 &&
+ cl->bad_boy[id].life <= 0)
+ {
+ cl->sfx[13].sfx_play(cl->sfx);
+ cl->bad_boy[id].isdead = 1;
+ }
+ else if (cl->bad_boy[id].does != 3)
cl->sfx[14].sfx_play(cl->sfx);
- /* TODO: sfx enemy death */
}
diff --git a/src/ft_init_bad_boys.c b/src/ft_init_bad_boys.c
index 100411e..bf4ae67 100644
--- a/src/ft_init_bad_boys.c
+++ b/src/ft_init_bad_boys.c
@@ -38,6 +38,7 @@ int8_t
cl->bad_boy[i].life = FT_ENMY_STRT_LIFE;
cl->bad_boy[i].does = 0;
cl->bad_boy[i].sleep = 0;
+ cl->bad_boy[i].isdead = 0;
cl->bad_boy[i].act[0] = ft_bb_wait;
cl->bad_boy[i].act[1] = ft_bb_walk;
cl->bad_boy[i].act[2] = ft_bb_fire;
diff --git a/src/ft_init_sfx.c b/src/ft_init_sfx.c
index 697f3f9..1725c91 100644
--- a/src/ft_init_sfx.c
+++ b/src/ft_init_sfx.c
@@ -101,11 +101,9 @@ static void
cl->sfx[15].sfx_play = ft_sfx_bb_fire;
}
-int8_t
- ft_init_sfx(t_cub *cl)
+static int8_t
+ ft_init_sfx_cmds(t_cub *cl)
{
- uint8_t i;
-
if (ft_init_sfx_cmd(&cl->sfx[0].cmd, FT_SFX_DEATH_PATH) < 0 ||
ft_init_sfx_cmd(&cl->sfx[1].cmd, FT_SFX_FS_ONE_PATH) < 0 ||
ft_init_sfx_cmd(&cl->sfx[1].cmd_alt, FT_SFX_FS_TWO_PATH) < 0 ||
@@ -126,6 +124,16 @@ int8_t
ft_init_sfx_cmd(&cl->sfx[14].cmd_alt, FT_SFX_ENMY_SCR_TWO_PATH) < 0 ||
ft_init_sfx_cmd(&cl->sfx[15].cmd, FT_SFX_ENMY_FIRE_PATH) < 0)
return (-1);
+ return (0);
+}
+
+int8_t
+ ft_init_sfx(t_cub *cl)
+{
+ uint8_t i;
+
+ if (ft_init_sfx_cmds(cl) < 0)
+ return (-1);
i = -1;
while (++i < 16)
pthread_mutex_init(&cl->sfx[i].mutex, NULL);