Exemplo n.º 1
0
int			ft_is_opp(char c, int player)
{
	if (player == 1)
		return (ft_is_mine(c, 2));
	else
		return (ft_is_mine(c, 1));
}
Exemplo n.º 2
0
t_dim		*find_up_spot(char **map, t_dim *size, int player)
{
	t_dim	*pt;

	pt = (t_dim *)malloc(sizeof(t_dim));
	pt->line = 0;
	while (map[pt->line])
	{
		pt->col = 0;
		while (map[pt->line][pt->col])
		{
			if (ft_is_mine(map[pt->line][pt->col], player))
			{
				pt->col = (pt->col >= size->col ? pt->col - size->col : 0);
				pt->line = (pt->line >= size->line ? pt->line - size->line : 0);
				return (pt);
			}
			pt->col++;
		}
		pt->line++;
	}
	pt->line = 0;
	pt->col = 0;
	return (pt);
}
Exemplo n.º 3
0
int			ft_try_spot(char **map, t_dim *pt, char **piece, int player)
{
	int		x;
	int		y;
	int		sup;

	sup = 0;
	x = 0;
	while (piece[x])
	{
		y = 0;
		while (piece[x][y])
		{
			if (piece[x][y] == '.' && map[x + pt->line][y + pt->col] != '.')
				return (0);
			if (piece[x][y] == '*')
			{
				if (ft_is_opp(map[x + pt->line][y + pt->col], player))
					return (0);
				if (ft_is_mine(map[x + pt->line][y + pt->col], player))
					sup++;
			}
			y++;
		}
		x++;
	}
	return (sup);
}
Exemplo n.º 4
0
void		ft_music_start(t_dvm *vm, int off)
{
	if (!data()->mlx.sound)
		return ;
	else if (!off && data()->mlx.sound == 1 && ft_init_music(vm, 0))
		vm->son = Mix_LoadMUS("./music/halo.mp3");
	else if (!off && data()->mlx.sound == 2 && ft_init_music(vm, 0))
		vm->son = Mix_LoadMUS("./music/ff7_prelude.mp3");
	else if (off == 1 && data()->mlx.sound == 1 && ft_init_music(vm, 1))
		vm->son = Mix_LoadMUS("./music/paranoid.mp3");
	else if (off == 1 && data()->mlx.sound == 2 && ft_is_mine(vm)
	&& ft_init_music(vm, 1))
		vm->son = Mix_LoadMUS("./music/ff7_boss.mp3");
	else if (off == 1 && data()->mlx.sound == 2 && !ft_is_mine(vm)
	&& ft_init_music(vm, 1))
		vm->son = Mix_LoadMUS("./music/ff7_fighting.mp3");
	else if (off == 2 && data()->mlx.sound == 1 && ft_init_music(vm, 1))
		vm->son = Mix_LoadMUS("./music/sail.mp3");
	else if (off == 2 && data()->mlx.sound == 2 && ft_init_music(vm, 1))
		vm->son = Mix_LoadMUS("./music/ff7_victory.mp3");
	Mix_PlayMusic(vm->son, -1);
}