mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
Compare commits
No commits in common. "351e4bb679c79fb32e752c2f3406b661c3e6c9dc" and "b606159ac3b60847987cb65026f744b0b5f01d99" have entirely different histories.
351e4bb679
...
b606159ac3
10 changed files with 12 additions and 77 deletions
1
Makefile
1
Makefile
|
|
@ -31,7 +31,6 @@ SOURCEFILES = \
|
|||
src/player/move_step.c \
|
||||
src/player/register_weapons.c \
|
||||
src/player/weapons.c \
|
||||
src/player/pay.c \
|
||||
src/raycast/barricades.c \
|
||||
src/raycast/ray.c \
|
||||
src/raycast/walls.c \
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */
|
||||
/* Updated: 2025/10/01 13:50:59 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/30 17:32:50 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/09/03 17:02:08 by tchampio #+# #+# */
|
||||
/* Updated: 2025/10/01 13:51:03 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/30 17:35:31 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/08/06 11:25:05 by kcolin #+# #+# */
|
||||
/* Updated: 2025/10/01 14:11:11 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/30 17:43:36 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ bool blocks_movement(t_mapdata *data, int x, int y)
|
|||
|
||||
bool blocks_view(t_mapdata *data, int x, int y)
|
||||
{
|
||||
if (out_of_bounds(data, x, y) || ft_strchr("12345678dP", data->map[y][x]))
|
||||
if (out_of_bounds(data, x, y) || ft_strchr("12345678d", data->map[y][x]))
|
||||
return (true);
|
||||
return (false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:18:13 by kcolin #+# #+# */
|
||||
/* Updated: 2025/10/01 14:08:45 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/30 17:23:06 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -24,11 +24,10 @@
|
|||
* z - beware of zombies
|
||||
* d - closed door
|
||||
* i - open dooro
|
||||
* P - payable door
|
||||
*/
|
||||
bool has_forbidden_characters(char *line)
|
||||
{
|
||||
static const char *allowedchars = " 10234567NSEWMQJDzdiP\n";
|
||||
static const char *allowedchars = " 10234567NSEWMQJDzdi\n";
|
||||
size_t strsize;
|
||||
int i;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* door.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/10/01 13:59:11 by tchampio #+# #+# */
|
||||
/* Updated: 2025/10/01 14:05:57 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../cub3d_data.h"
|
||||
#include "../../libft/includes/libft.h"
|
||||
|
||||
int door_amount(void)
|
||||
{
|
||||
static int amount = 500;
|
||||
|
||||
amount += 250;
|
||||
return (amount);
|
||||
}
|
||||
|
||||
bool pay(t_cub3d_data *data, int amount)
|
||||
{
|
||||
if (data->player.points < amount)
|
||||
{
|
||||
ft_printf("Not enough points :(\n");
|
||||
return (false);
|
||||
}
|
||||
data->player.points -= amount;
|
||||
return (true);
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* pay.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/10/01 14:05:08 by tchampio #+# #+# */
|
||||
/* Updated: 2025/10/01 14:06:19 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PAY_H
|
||||
# define PAY_H
|
||||
|
||||
# include "../cub3d_data.h"
|
||||
|
||||
int door_amount(void);
|
||||
bool pay(t_cub3d_data *data, int amount);
|
||||
|
||||
#endif // PAY_H
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/31 11:55:41 by kcolin #+# #+# */
|
||||
/* Updated: 2025/10/01 14:10:46 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/30 23:05:11 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,7 +21,6 @@
|
|||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include "../map/collision.h"
|
||||
#include "../player/pay.h"
|
||||
#include "../../libft/includes/libft.h"
|
||||
|
||||
void init_ray(t_ray *ray, int pos_x, t_player *player)
|
||||
|
|
@ -61,7 +60,7 @@ void ray_calculate_step(t_ray *ray, t_player *player)
|
|||
|
||||
void handle_door_ray(t_ray *ray, t_cub3d_data *data)
|
||||
{
|
||||
if ((data->map->map[ray->map_y][ray->map_x] == 'd' || data->map->map[ray->map_y][ray->map_x] == 'i' || data->map->map[ray->map_y][ray->map_x] == 'P') && ray->wall_dist < 1.5)
|
||||
if (data->map->map[ray->map_y][ray->map_x] == 'd' && ray->wall_dist < 1.5)
|
||||
{
|
||||
ft_printf("map[%d][%d] = door reachable\n", ray->map_y, ray->map_x);
|
||||
data->player.closest_door[0] = ray->map_x;
|
||||
|
|
@ -70,12 +69,7 @@ void handle_door_ray(t_ray *ray, t_cub3d_data *data)
|
|||
if (data->keypresses.is_f_pressed)
|
||||
{
|
||||
data->keypresses.is_f_pressed = false;
|
||||
if (data->map->map[ray->map_y][ray->map_x] == 'd')
|
||||
data->map->map[ray->map_y][ray->map_x] = 'i';
|
||||
else if (data->map->map[ray->map_y][ray->map_x] == 'P' && pay(data, door_amount()))
|
||||
data->map->map[ray->map_y][ray->map_x] = '0';
|
||||
else if (data->map->map[ray->map_y][ray->map_x] == 'i')
|
||||
data->map->map[ray->map_y][ray->map_x] = 'd';
|
||||
data->map->map[ray->map_y][ray->map_x] = 'i';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -92,8 +86,6 @@ void calculate_wall_dist(t_ray *ray, int x, t_cub3d_data *data)
|
|||
{
|
||||
if (x == WIDTH / 2)
|
||||
check_for_zombies(ray, data);
|
||||
if (!blocks_view(data->map, ray->map_x, ray->map_y) && data->map->map[ray->map_y][ray->map_x] == 'i')
|
||||
handle_door_ray(ray, data);
|
||||
if (ray->side_dist_x < ray->side_dist_y)
|
||||
{
|
||||
ray->side_dist_x += ray->delta_dist_x;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/31 13:17:39 by kcolin #+# #+# */
|
||||
/* Updated: 2025/10/01 14:12:44 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/30 17:41:52 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ static int get_color(t_cub3d_data *data, t_ray *ray, int tex_y)
|
|||
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 (data->map->map[ray->map_y][ray->map_x] == 'd' || data->map->map[ray->map_y][ray->map_x] == 'P')
|
||||
if (data->map->map[ray->map_y][ray->map_x] == 'd')
|
||||
return (my_mlx_pixel_get(data->door_texture, tex_x, tex_y));
|
||||
if (dir == NORTH)
|
||||
texture = data->no_texture;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/08/18 13:05:31 by kcolin #+# #+# */
|
||||
/* Updated: 2025/10/01 13:57:48 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/09/22 17:18:55 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -43,7 +43,6 @@ void destroy_textures(t_cub3d_data *data)
|
|||
i = 0;
|
||||
while (i < 6)
|
||||
destroy_texture(data, data->barricades_texture[i++]);
|
||||
destroy_texture(data, data->door_texture);
|
||||
}
|
||||
|
||||
void destroy_sprites(t_cub3d_data *data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue