From d34d4404e0c4e6c80215b438c86de932f8d99748 Mon Sep 17 00:00:00 2001 From: Theo Champion Date: Mon, 22 Sep 2025 17:22:02 +0200 Subject: [PATCH] fix: Decreased the number of barricades --- src/cub3d_data.h | 4 ++-- src/hud/load_texture.c | 4 +--- src/map/forbidden_characters.c | 4 ++-- src/raycast/barricades.c | 10 +++++----- src/raycast/walls.c | 6 ++---- src/utils/destroy_utils.c | 4 ++-- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/cub3d_data.h b/src/cub3d_data.h index 0e6b7a7..405b9b7 100644 --- a/src/cub3d_data.h +++ b/src/cub3d_data.h @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */ -/* Updated: 2025/09/18 12:51:43 by tchampio ### ########.fr */ +/* Updated: 2025/09/22 17:17:23 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,7 +30,7 @@ typedef struct s_cub3d_data t_img_data *so_texture; t_img_data *we_texture; t_img_data *ea_texture; - t_img_data *barricades_texture[7]; + t_img_data *barricades_texture[6]; t_img_data *img_data; t_img_data *point_figures[10]; t_img_data *perk_logos[3]; diff --git a/src/hud/load_texture.c b/src/hud/load_texture.c index 7ee1f4f..24397ea 100644 --- a/src/hud/load_texture.c +++ b/src/hud/load_texture.c @@ -6,7 +6,7 @@ /* By: tchampio +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/09/03 17:02:08 by tchampio #+# #+# */ -/* Updated: 2025/09/10 15:59:34 by tchampio ### ########.fr */ +/* Updated: 2025/09/22 17:17:34 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -109,8 +109,6 @@ void load_textures(t_cub3d_data *data) "ressources/barricades_6.xpm"); data->barricades_texture[5] = load_single_texture(data, "ressources/barricades_7.xpm"); - data->barricades_texture[6] = load_single_texture(data, - "ressources/barricades_8.xpm"); load_points_textures(data); load_perk_logos(data); load_round_indicators(data); diff --git a/src/map/forbidden_characters.c b/src/map/forbidden_characters.c index 5bf0e2e..68d9662 100644 --- a/src/map/forbidden_characters.c +++ b/src/map/forbidden_characters.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:18:13 by kcolin #+# #+# */ -/* Updated: 2025/09/08 17:51:38 by tchampio ### ########.fr */ +/* Updated: 2025/09/22 17:16:41 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,7 +25,7 @@ */ bool has_forbidden_characters(char *line) { - static const char *allowedchars = " 102345678NSEWMQJDz\n"; + static const char *allowedchars = " 10234567NSEWMQJDz\n"; size_t strsize; int i; diff --git a/src/raycast/barricades.c b/src/raycast/barricades.c index 1e0febe..2513f62 100644 --- a/src/raycast/barricades.c +++ b/src/raycast/barricades.c @@ -6,7 +6,7 @@ /* By: tchampio +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/09/09 14:00:36 by tchampio #+# #+# */ -/* Updated: 2025/09/09 14:04:01 by tchampio ### ########.fr */ +/* Updated: 2025/09/22 17:16:07 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,7 @@ void check_barricades(t_ray *ray, t_cub3d_data *data) static int remaining_ticks = BARRICADE_TICK; if (data->map->map[ray->map_y][ray->map_x] >= '2' - && data->map->map[ray->map_y][ray->map_x] <= '8') + && data->map->map[ray->map_y][ray->map_x] <= '7') { if (last_barricade_x != ray->map_x || last_barricade_y != ray->map_y) { @@ -33,10 +33,10 @@ void check_barricades(t_ray *ray, t_cub3d_data *data) if (remaining_ticks <= 0) { remaining_ticks = BARRICADE_TICK; - if (data->map->map[last_barricade_y][last_barricade_x] < '8') - data->map->map[last_barricade_y][last_barricade_x]++; - if (data->map->map[last_barricade_y][last_barricade_x] == '8') + if (data->map->map[last_barricade_y][last_barricade_x] == '7') create_zombie(data, last_barricade_x, last_barricade_y); + if (data->map->map[last_barricade_y][last_barricade_x] < '7') + data->map->map[last_barricade_y][last_barricade_x]++; } } } diff --git a/src/raycast/walls.c b/src/raycast/walls.c index a2bd51b..676239d 100644 --- a/src/raycast/walls.c +++ b/src/raycast/walls.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/31 13:17:39 by kcolin #+# #+# */ -/* Updated: 2025/09/10 15:03:17 by tchampio ### ########.fr */ +/* Updated: 2025/09/22 17:17:54 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -49,8 +49,6 @@ t_img_data *get_right_barricade(t_cub3d_data *data, char c) return (data->barricades_texture[4]); if (c == '7') return (data->barricades_texture[5]); - if (c == '8') - return (data->barricades_texture[6]); return (data->so_texture); } @@ -65,7 +63,7 @@ static int get_color(t_cub3d_data *data, t_ray *ray, int tex_y) || (ray->side == SOUTH && ray->dir_y > 0)) tex_x = TEXTURE_SIZE - tex_x - 1; dir = get_cardinal(ray); - if (ft_strchr("2345678", data->map->map[ray->map_y][ray->map_x])) + if (ft_strchr("234567", data->map->map[ray->map_y][ray->map_x])) return (my_mlx_pixel_get(get_right_barricade(data, data->map->map[ray->map_y][ray->map_x]), tex_x, tex_y)); if (dir == NORTH) diff --git a/src/utils/destroy_utils.c b/src/utils/destroy_utils.c index 3cdbdf4..f2ae913 100644 --- a/src/utils/destroy_utils.c +++ b/src/utils/destroy_utils.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/08/18 13:05:31 by kcolin #+# #+# */ -/* Updated: 2025/09/18 12:23:05 by tchampio ### ########.fr */ +/* Updated: 2025/09/22 17:18:55 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -41,7 +41,7 @@ void destroy_textures(t_cub3d_data *data) mlx_destroy_image(data->mlx, data->we_texture->img); free(data->we_texture); i = 0; - while (i < 7) + while (i < 6) destroy_texture(data, data->barricades_texture[i++]); }