aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_find_item.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_find_item.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/ft_find_item.c b/src/ft_find_item.c
index 394e060..6d795c3 100644
--- a/src/ft_find_item.c
+++ b/src/ft_find_item.c
@@ -36,7 +36,7 @@ static uint16_t
uint16_t id;
id = 0;
- while (id <= 64)
+ while (id <= 32)
{
if (cl->sprites[10 + weap_id][id].s_pos_y == pos_y &&
cl->sprites[10 + weap_id][id].s_pos_x == pos_x)
@@ -72,17 +72,22 @@ static void
weap_id = 1;
else if (map_char == '#')
weap_id = 2;
+ else if (map_char == 'x')
+ weap_id = 3;
cl->mlist.map[(uint64_t)pl->pos_y][(uint64_t)pl->pos_x] = '0';
- that_id = ft_fetch_weaps_id(weap_id, (uint64_t)pl->pos_y,
+ if (weap_id != 3)
+ {
+ that_id = ft_fetch_weaps_id(weap_id, (uint64_t)pl->pos_y,
(uint64_t)pl->pos_x, cl);
- cl->sprites[10 + weap_id][that_id].s_pos_x = 0;
- cl->sprites[10 + weap_id][that_id].s_pos_y = 0;
- pl->has_weapon[weap_id] = 1;
+ cl->sprites[10 + weap_id][that_id].s_pos_x = 0;
+ cl->sprites[10 + weap_id][that_id].s_pos_y = 0;
+ }
+ pl->has_weapon[(weap_id == 3) ? (2) : (weap_id)] = 1;
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);
- cl->sfx[6 + (weap_id * 2)].sfx_play(cl->sfx);
+ ft_set_ammo((weap_id == 3) ? (2) : (weap_id), pl);
+ cl->sfx[6 + (((weap_id == 3) ? (2) : (weap_id)) * 2)].sfx_play(cl->sfx);
}
}