aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_select_bad_boy_action.c
blob: 34e0efe0023689d2e42bdabd15042443a3b9c05b (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_select_bad_boy_actions.c                        :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:28:51 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:28:51 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <libft.h>
#include <cub3d.h>
#include <stdlib.h>

void
	ft_select_bad_boy_action(t_cub *cl)
{
	int8_t	i;
	int8_t	r;

	i = 0;
	while (i < cl->mlist.sprite_nbr[13])
	{
		if (cl->bad_boy[i].sleep == 0 && cl->bad_boy[i].life > 0)
		{
			if (FT_OS == 2)
				r = random() % 2;
			else
				r = rand() % 2;
			cl->bad_boy[i].act[r](&cl->bad_boy[i],
								&cl->sprites[13][i], &cl->mlist);
			cl->bad_boy[i].sleep = 1;
		}
		i++;
	}
}