blob: c8a04fa9a6c7f4c17082d49fc7055aec30df025c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_damage_bad_boy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/14 17:22:32 by rbousset #+# #+# */
/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <libft.h>
#include <cub3d.h>
static uint8_t
ft_get_bad_boy_id(t_cub *cl)
{
uint8_t i;
i = 0;
while (i < cl->mlist.sprite_nbr[13])
{
if (cl->sprites[13][i].s_pos_x == cl->rlist.sqy &&
cl->sprites[13][i].s_pos_y == cl->rlist.sqx)
return (i);
i++;
}
return (0);
}
void
ft_damage_bad_boy(t_cub *cl)
{
uint8_t id;
id = ft_get_bad_boy_id(cl);
if (cl->plist.handles_weapon == 0)
cl->bad_boy[id].life -= FT_W_ONE_DANAGE_AMOUNT;
else if (cl->plist.handles_weapon == 1)
cl->bad_boy[id].life -= FT_W_TWO_DANAGE_AMOUNT;
else if (cl->plist.handles_weapon == 2)
cl->bad_boy[id].life -= FT_W_THREE_DANAGE_AMOUNT;
/* TODO: sfx enemy scream and death */
}
|