blob: 54dcab1fc3f884de88f07418f57e1b9664774959 (
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
46
47
48
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_init_bad_boys.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: joelecle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/14 17:28:51 by joelecle #+# #+# */
/* Updated: 2020/02/14 17:28:51 by joelecle ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
#include <stdlib.h>
/*
** bad_boy[].does list
** -------------------
** 0: waiting
** 1: walking
** 2: firing
** 3: be dead
*/
int8_t
ft_init_bad_boys(t_cub *cl)
{
int8_t i;
if (!(cl->bad_boy = (t_bad_boy*)malloc(cl->mlist.sprite_nbr[13]
* sizeof(t_bad_boy))))
return (ft_alloc_error(cl));
i = 0;
while (i < cl->mlist.sprite_nbr[13])
{
cl->bad_boy[i].life = FT_ENMY_STRT_LIFE;
cl->bad_boy[i].does = 0;
cl->bad_boy[i].sleep = 0;
cl->bad_boy[i].isdead = 0;
cl->bad_boy[i].act[0] = ft_bb_wait;
cl->bad_boy[i].act[1] = ft_bb_walk;
cl->bad_boy[i].act[2] = ft_bb_fire;
i++;
}
return (0);
}
|