From 3ebd8ba2bd2302327932d877ef8b797793a67542 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 23 Mar 2020 00:16:36 +0100 Subject: Cool --- src/ft_extra_keys.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/ft_extra_keys.c') 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; } -- cgit v1.2.3