aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_find_item.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-23 00:16:36 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-23 00:16:36 +0100
commit3ebd8ba2bd2302327932d877ef8b797793a67542 (patch)
tree0a45b7f6bf98eab0895d71ac85b29413ab707be3 /src/ft_find_item.c
parentI think we good (diff)
download42-cub3d-3ebd8ba2bd2302327932d877ef8b797793a67542.tar.gz
42-cub3d-3ebd8ba2bd2302327932d877ef8b797793a67542.tar.bz2
42-cub3d-3ebd8ba2bd2302327932d877ef8b797793a67542.tar.xz
42-cub3d-3ebd8ba2bd2302327932d877ef8b797793a67542.tar.zst
42-cub3d-3ebd8ba2bd2302327932d877ef8b797793a67542.zip
Cool
Diffstat (limited to 'src/ft_find_item.c')
-rw-r--r--src/ft_find_item.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ft_find_item.c b/src/ft_find_item.c
index caeb3f4..cea05fa 100644
--- a/src/ft_find_item.c
+++ b/src/ft_find_item.c
@@ -30,6 +30,17 @@ static uint16_t
}
static void
+ ft_set_ammo(uint8_t weap_id, t_player *pl)
+{
+ if (weap_id == 0)
+ pl->ammo[0] = FT_WEAP_ONE_STRT_AMMO;
+ else if (weap_id == 1)
+ pl->ammo[1] = FT_WEAP_TWO_STRT_AMMO;
+ else if (weap_id == 2)
+ pl->ammo[2] = FT_WEAP_THREE_STRT_AMMO;
+}
+
+static void
ft_weapon_check(const char map_char, t_player *pl, t_cub *cl)
{
uint8_t weap_id;
@@ -48,6 +59,7 @@ static void
pl->handles_weapon = (weap_id == 0) ? (0) : (pl->handles_weapon);
pl->handles_weapon = (weap_id == 1) ? (2) : (pl->handles_weapon);
pl->handles_weapon = (weap_id == 2) ? (4) : (pl->handles_weapon);
+ ft_set_ammo(weap_id, pl);
if (weap_id == 0)
cl->sfx[6].sfx_play(cl->sfx);
else if (weap_id == 1)