This commit is contained in:
Camille Chauvet 2023-01-13 18:59:48 +01:00
parent 6312ed4cdc
commit 1331231004
10 changed files with 8 additions and 8 deletions

BIN
asset.o

Binary file not shown.

6
draw.c
View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/13 15:49:23 by cchauvet #+# #+# */ /* Created: 2022/12/13 15:49:23 by cchauvet #+# #+# */
/* Updated: 2023/01/13 18:34:28 by cchauvet ### ########.fr */ /* Updated: 2023/01/13 18:58:18 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]); return (data->assets[data->nb_swaps + 3 % NB_COLORS]);
if (c == 'P') if (c == 'P')
return (data->assets[data->nb_swaps + 4 % NB_COLORS]); 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 (data->assets[data->nb_swaps + 5 % NB_COLORS]);
return (NULL); return (NULL);
} }
@ -59,7 +59,7 @@ int ft_draw_map(t_data *data)
ft_fill_pos(data->map); ft_fill_pos(data->map);
if (BONUS) if (BONUS)
data->nb_swaps++; data->nb_swaps = ++data->nb_swaps % NB_COLORS;
patern = ft_get_player_map(*data->map); patern = ft_get_player_map(*data->map);
if (patern == NULL) if (patern == NULL)
return (1); return (1);

BIN
draw.o

Binary file not shown.

BIN
key.o

Binary file not shown.

4
main.c
View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/12 17:20:17 by cchauvet #+# #+# */ /* Created: 2022/12/12 17:20:17 by cchauvet #+# #+# */
/* Updated: 2023/01/13 18:35:20 by cchauvet ### ########.fr */ /* Updated: 2023/01/13 18:50:00 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -31,7 +31,7 @@ int ft_initialised(char *path, t_data *data)
data->nb_foots = 0; data->nb_foots = 0;
data->nb_swaps = 35; data->nb_swaps = 35;
if (BONUS) if (BONUS)
data->nb_swaps = ft_random_generator(0, 100); data->nb_swaps = ft_random_generator(0, NB_COLORS);
ft_draw_map(data); ft_draw_map(data);
mlx_hook(data->window, 17, (0L), ft_exit, data); mlx_hook(data->window, 17, (0L), ft_exit, data);
mlx_hook(data->window, 2, (1L << 0), ft_key, data); mlx_hook(data->window, 2, (1L << 0), ft_key, data);

BIN
main.o

Binary file not shown.

BIN
parsing.o

Binary file not shown.

Binary file not shown.

BIN
so_long

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 16:20:03 by cchauvet #+# #+# */ /* Created: 2023/01/04 16:20:03 by cchauvet #+# #+# */
/* Updated: 2023/01/13 18:37:03 by cchauvet ### ########.fr */ /* Updated: 2023/01/13 18:56:12 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -20,11 +20,11 @@
# define CASE_SIZE 64 # define CASE_SIZE 64
# define XPM_HEADER "\nstatic char * XFACE[] = {\"" # define XPM_HEADER "\nstatic char * XFACE[] = {\""
# define COLORS "silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|aqua|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen" # define COLORS "silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|aqua|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen"
# define NB_COLORS 99 # define NB_COLORS 93
# define RENDER_DISTANCE 5 # define RENDER_DISTANCE 5
# define WINDOW_SIZE (RENDER_DISTANCE * 2 + 1) * CASE_SIZE # define WINDOW_SIZE (RENDER_DISTANCE * 2 + 1) * CASE_SIZE
# define ABS(Value) (Value * ((Value > 0) - (Value < 0))) # define ABS(Value) (Value * ((Value > 0) - (Value < 0)))
# define BONUS 0 # define BONUS 1
typedef struct s_square typedef struct s_square
{ {