aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_find_item.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_find_item.c')
-rw-r--r--src/ft_find_item.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/ft_find_item.c b/src/ft_find_item.c
index 394e060..f9504d1 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)
@@ -68,21 +68,23 @@ static void
if (ft_ischarset(FT_CHRST_WEAPONS, map_char))
{
weap_id = 0;
- if (map_char == '@')
- weap_id = 1;
- else if (map_char == '#')
- weap_id = 2;
+ weap_id = (map_char == '@') ? (1) : (weap_id);
+ weap_id = (map_char == '#') ? (2) : (weap_id);
+ weap_id = (map_char == 'x') ? (3) : (weap_id);
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] = 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);
}
}