mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
Compare commits
No commits in common. "5da35830772774b36ba8bd71c9e5c5223da32562" and "b0ac26a7f65b0335f23b5deda0b909f0cc95dbd1" have entirely different histories.
5da3583077
...
b0ac26a7f6
4 changed files with 10 additions and 27 deletions
3
Makefile
3
Makefile
|
|
@ -69,9 +69,6 @@ fclean: clean
|
|||
bonus: CFLAGS += -D BONUS=1
|
||||
bonus: all
|
||||
|
||||
bonus-sane: CFLAGS += -D BONUS=1 $(SANITIZERS)
|
||||
bonus-sane: all
|
||||
|
||||
sane: CFLAGS += $(SANITIZERS)
|
||||
sane: all
|
||||
|
||||
|
|
|
|||
10
src/main.c
10
src/main.c
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
||||
/* Updated: 2025/09/14 16:41:00 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/10 15:34:15 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -36,10 +36,11 @@
|
|||
|
||||
void handle_shooting(t_cub3d_data *data)
|
||||
{
|
||||
if (data->keypresses.is_space_pressed)
|
||||
if (!data->keypresses.is_space_pressed)
|
||||
return ;
|
||||
else
|
||||
{
|
||||
if (!data->player.weapon.is_auto)
|
||||
data->keypresses.is_space_pressed = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +53,6 @@ int game_loop(t_cub3d_data *data)
|
|||
data->last_tick = get_milliseconds();
|
||||
reset_matrix(data);
|
||||
move_player(data);
|
||||
handle_shooting(data);
|
||||
move_sprites(data);
|
||||
raycaster(data, &ray);
|
||||
sprite_caster(data);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/31 11:55:41 by kcolin #+# #+# */
|
||||
/* Updated: 2025/09/14 17:40:53 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/09 14:07:24 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,7 +19,6 @@
|
|||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include "../map/collision.h"
|
||||
#include "../../libft/includes/libft.h"
|
||||
|
||||
void init_ray(t_ray *ray, int pos_x, t_player *player)
|
||||
{
|
||||
|
|
@ -56,23 +55,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, t_mapdata *map)
|
||||
{
|
||||
int i;
|
||||
while (true)
|
||||
{
|
||||
if (x == WIDTH / 2)
|
||||
{
|
||||
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)
|
||||
{
|
||||
ray->side_dist_x += ray->delta_dist_x;
|
||||
|
|
@ -85,7 +71,7 @@ void calculate_wall_dist(t_ray *ray, int x, t_cub3d_data *data)
|
|||
ray->map_y += ray->step_y;
|
||||
ray->side = SOUTH;
|
||||
}
|
||||
if (blocks_view(data->map, ray->map_x, ray->map_y))
|
||||
if (blocks_view(map, ray->map_x, ray->map_y))
|
||||
break ;
|
||||
}
|
||||
if (ray->side == NORTH)
|
||||
|
|
@ -121,7 +107,7 @@ void raycaster(t_cub3d_data *data, t_ray *ray)
|
|||
{
|
||||
init_ray(ray, x, &data->player);
|
||||
ray_calculate_step(ray, &data->player);
|
||||
calculate_wall_dist(ray, x, data);
|
||||
calculate_wall_dist(ray, data->map);
|
||||
calculate_wall_height(ray, &data->player);
|
||||
check_barricades(ray, data);
|
||||
render_walls(data, ray, x);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:22:57 by kcolin #+# #+# */
|
||||
/* Updated: 2025/09/14 15:57:54 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/10 15:33:38 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue