fix: Decreased the number of barricades

This commit is contained in:
Theo Champion 2025-09-22 17:22:02 +02:00
parent c146fc1731
commit d34d4404e0
6 changed files with 14 additions and 18 deletions

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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];

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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;

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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]++;
}
}
}

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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++]);
}