aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_extra_keys.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_extra_keys.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ft_extra_keys.c b/src/ft_extra_keys.c
index a78f821..097e2e2 100644
--- a/src/ft_extra_keys.c
+++ b/src/ft_extra_keys.c
@@ -71,8 +71,15 @@ int
int
ft_space_key(t_cub *clist)
{
- if (clist->plist.fire == 0)
+ uint8_t w_id;
+
+ w_id = clist->plist.handles_weapon;
+ w_id = (w_id == 2) ? (1) : (w_id);
+ w_id = (w_id == 4) ? (2) : (w_id);
+ if (clist->plist.fire == 0 &&
+ (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);
clist->plist.fire = 1;
}