mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
norme: Fixed norme errors
This commit is contained in:
parent
5da3583077
commit
27af850525
6 changed files with 65 additions and 18 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/09/08 17:27:12 by tchampio #+# #+# */
|
/* Created: 2025/09/08 17:27:12 by tchampio #+# #+# */
|
||||||
/* Updated: 2025/09/10 15:59:15 by tchampio ### ########.fr */
|
/* Updated: 2025/09/15 13:06:07 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -84,5 +84,6 @@ void create_hud(t_cub3d_data *data)
|
||||||
draw_points(data);
|
draw_points(data);
|
||||||
draw_perks(data);
|
draw_perks(data);
|
||||||
draw_round(data);
|
draw_round(data);
|
||||||
matrix_image_put(data, data->player.weapon.texture, WIDTH / 2, HEIGHT - 175);
|
matrix_image_put(data, data->player.weapon.texture,
|
||||||
|
WIDTH / 2, HEIGHT - 175);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,12 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/07/31 11:55:41 by kcolin #+# #+# */
|
/* Created: 2025/07/31 11:55:41 by kcolin #+# #+# */
|
||||||
/* Updated: 2025/09/14 17:40:53 by tchampio ### ########.fr */
|
/* Updated: 2025/09/15 13:11:37 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "ray.h"
|
#include "ray.h"
|
||||||
|
#include "zombie_checker.h"
|
||||||
#include "barricades.h"
|
#include "barricades.h"
|
||||||
#include "raycaster.h"
|
#include "raycaster.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
|
@ -58,21 +59,10 @@ void ray_calculate_step(t_ray *ray, t_player *player)
|
||||||
|
|
||||||
void calculate_wall_dist(t_ray *ray, int x, t_cub3d_data *data)
|
void calculate_wall_dist(t_ray *ray, int x, t_cub3d_data *data)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (x == WIDTH / 2)
|
if (x == WIDTH / 2)
|
||||||
{
|
check_for_zombies(ray, data);
|
||||||
i = 0;
|
|
||||||
while (i < data->sprite_counter)
|
|
||||||
{
|
|
||||||
if (data->sprite_list[i]->sprite_type == ZOMBIE && ray->map_x == (int)data->sprite_list[i]->x && ray->map_y == (int)data->sprite_list[i]->y)
|
|
||||||
{
|
|
||||||
ft_printf("Zombie found\n");
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ray->side_dist_x < ray->side_dist_y)
|
if (ray->side_dist_x < ray->side_dist_y)
|
||||||
{
|
{
|
||||||
ray->side_dist_x += ray->delta_dist_x;
|
ray->side_dist_x += ray->delta_dist_x;
|
||||||
|
|
|
||||||
34
src/raycast/zombie_checker.c
Normal file
34
src/raycast/zombie_checker.c
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* zombie_checker.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2025/09/15 13:08:48 by tchampio #+# #+# */
|
||||||
|
/* Updated: 2025/09/15 13:09:38 by tchampio ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "ray.h"
|
||||||
|
#include "../cub3d_data.h"
|
||||||
|
#include "../../libft/includes/libft.h"
|
||||||
|
|
||||||
|
void check_for_zombies(t_ray *ray, t_cub3d_data *data)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < data->sprite_counter)
|
||||||
|
{
|
||||||
|
if (data->sprite_list[i]->sprite_type == ZOMBIE
|
||||||
|
&& ray->map_x == (int)data->sprite_list[i]->x
|
||||||
|
&& ray->map_y == (int)data->sprite_list[i]->y)
|
||||||
|
{
|
||||||
|
ft_printf("Zombie found %p\n", data->sprite_list[i]);
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
21
src/raycast/zombie_checker.h
Normal file
21
src/raycast/zombie_checker.h
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* zombie_checker.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2025/09/15 13:09:54 by tchampio #+# #+# */
|
||||||
|
/* Updated: 2025/09/15 13:10:44 by tchampio ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef ZOMBIE_CHECKER_H
|
||||||
|
# define ZOMBIE_CHECKER_H
|
||||||
|
|
||||||
|
# include "ray.h"
|
||||||
|
# include "../cub3d_data.h"
|
||||||
|
|
||||||
|
void check_for_zombies(t_ray *ray, t_cub3d_data *data);
|
||||||
|
|
||||||
|
#endif // ZOMBIE_CHECKER_H
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/08/18 13:05:31 by kcolin #+# #+# */
|
/* Created: 2025/08/18 13:05:31 by kcolin #+# #+# */
|
||||||
/* Updated: 2025/09/10 16:00:47 by tchampio ### ########.fr */
|
/* Updated: 2025/09/15 13:05:37 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -26,6 +26,7 @@ void destroy_texture(t_cub3d_data *data, t_img_data *data_img)
|
||||||
void destroy_textures(t_cub3d_data *data)
|
void destroy_textures(t_cub3d_data *data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (data->no_texture)
|
if (data->no_texture)
|
||||||
mlx_destroy_image(data->mlx, data->no_texture->img);
|
mlx_destroy_image(data->mlx, data->no_texture->img);
|
||||||
free(data->no_texture);
|
free(data->no_texture);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/07/31 13:28:47 by tchampio #+# #+# */
|
/* Created: 2025/07/31 13:28:47 by tchampio #+# #+# */
|
||||||
/* Updated: 2025/09/10 15:51:42 by tchampio ### ########.fr */
|
/* Updated: 2025/09/15 13:05:14 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue