aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_extra_keys.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_extra_keys.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ft_extra_keys.c b/src/ft_extra_keys.c
index c1ea721..e4d0853 100644
--- a/src/ft_extra_keys.c
+++ b/src/ft_extra_keys.c
@@ -73,6 +73,7 @@ int
ft_space_key(t_cub *clist)
{
uint8_t w_id;
+ static uint8_t ref = 0;
w_id = clist->plist.handles_weapon;
w_id = (w_id == 2) ? (1) : (w_id);
@@ -81,7 +82,19 @@ int
(clist->plist.ammo[w_id] > 0 || clist->plist.ammo[w_id] == -4))
{
clist->plist.ammo[w_id] -= w_id;
- clist->sfx[clist->plist.handles_weapon + 7].sfx_play(clist->sfx);
+ if (clist->plist.handles_weapon != 2)
+ clist->sfx[clist->plist.handles_weapon + 7].sfx_play(clist->sfx);
+ else
+ {
+ if (ref % 3 == 0)
+ clist->sfx[9].sfx_play(clist->sfx);
+ else if (ref % 3 == 2)
+ clist->sfx[16].sfx_play(clist->sfx);
+ else if (ref % 3 == 1)
+ clist->sfx[17].sfx_play(clist->sfx);
+ ref += 2;
+ ref = (ref > 200) ? (0) : (ref);
+ }
clist->plist.fire = 1;
ft_shoot(clist);
return (0);