Compare commits
No commits in common. "7d7de10b7aa5dd7d43e0d89c0ff587c2f76647f1" and "b66f8d6f5a940890e09e26177144f773071dd865" have entirely different histories.
7d7de10b7a
...
b66f8d6f5a
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/12/13 15:49:23 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/16 18:46:55 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/16 12:52:30 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -28,7 +28,7 @@ static void *ft_char2img(t_data *data, char c)
|
||||
return (data->assets[data->nb_swaps + 3 % NB_COLORS]);
|
||||
if (c == 'P')
|
||||
return (data->assets[data->nb_swaps + 4 % NB_COLORS]);
|
||||
if (c == 'B')
|
||||
if (c == 'B' && BONUS)
|
||||
return (data->assets[data->nb_swaps + 5 % NB_COLORS]);
|
||||
return (NULL);
|
||||
}
|
||||
@ -37,6 +37,8 @@ static void ft_draw_foots(t_data *data)
|
||||
{
|
||||
char *foots;
|
||||
|
||||
if (BONUS)
|
||||
{
|
||||
data->nb_foots++;
|
||||
foots = ft_itoa(data->nb_foots);
|
||||
if (foots == NULL)
|
||||
@ -47,6 +49,7 @@ static void ft_draw_foots(t_data *data)
|
||||
mlx_string_put(data->mlx, data->window, 10, 10, 255, foots);
|
||||
ft_printf("\r%s", foots);
|
||||
free(foots);
|
||||
}
|
||||
}
|
||||
|
||||
int ft_draw_map(t_data *data)
|
||||
@ -56,6 +59,7 @@ int ft_draw_map(t_data *data)
|
||||
void *img;
|
||||
|
||||
ft_fill_pos(data->map);
|
||||
if (BONUS)
|
||||
data->nb_swaps = ++data->nb_swaps % NB_COLORS;
|
||||
patern = ft_get_player_map(*data->map);
|
||||
if (patern == NULL)
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/12/12 17:20:17 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/16 18:47:20 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/13 18:50:00 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -29,6 +29,8 @@ int ft_initialised(char *path, t_data *data)
|
||||
data->map = map;
|
||||
data->window = mlx_new_window(data->mlx, WINDOW_SIZE, WINDOW_SIZE, "long");
|
||||
data->nb_foots = 0;
|
||||
data->nb_swaps = 35;
|
||||
if (BONUS)
|
||||
data->nb_swaps = ft_random_generator(0, NB_COLORS);
|
||||
ft_draw_map(data);
|
||||
mlx_hook(data->window, 17, (0L), ft_exit, data);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/01/05 20:14:44 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/16 18:48:43 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/13 15:47:42 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -43,7 +43,9 @@ int ft_test_map_content1(t_map *map)
|
||||
x = 0;
|
||||
while (x < map->x_len)
|
||||
{
|
||||
if (ft_is_in("01CEPB", map->patern[y][x]) == 0)
|
||||
if (!BONUS && ft_is_in("01CEP", map->patern[y][x]) == 0)
|
||||
return (0);
|
||||
if (BONUS && ft_is_in("01CEPB", map->patern[y][x]) == 0)
|
||||
return (0);
|
||||
if (map->patern[y][x] == 'C')
|
||||
nb_collectable++;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/01/12 16:17:20 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/16 18:48:20 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/13 16:28:34 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,8 +14,14 @@
|
||||
|
||||
static void ft_collector(char **patern, size_t x, size_t y)
|
||||
{
|
||||
if (BONUS)
|
||||
{
|
||||
if (ft_is_in("1B", patern[y][x]))
|
||||
return ;
|
||||
}
|
||||
else
|
||||
if (patern[y][x] == '1')
|
||||
return ;
|
||||
patern[y][x] = '1';
|
||||
ft_collector(patern, x, y - 1);
|
||||
ft_collector(patern, x + 1, y);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/01/04 16:20:03 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/16 18:47:59 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/16 18:36:10 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -64,5 +64,4 @@ int ft_draw_map(t_data *data);
|
||||
char *name_generator(t_square square);
|
||||
int ft_color_changer(t_data *data);
|
||||
void ft_draw_img(t_data *data, void *img, size_t x, size_t y);
|
||||
int ft_map_is_correct(t_map *map);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user