This commit is contained in:
kinou-p 2022-06-15 17:45:28 +02:00
parent c496582e57
commit b3c5638d6e
3 changed files with 30 additions and 30 deletions

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/13 16:30:59 by apommier #+# #+# */ /* Created: 2022/02/13 16:30:59 by apommier #+# #+# */
/* Updated: 2022/06/15 17:28:47 by sadjigui ### ########.fr */ /* Updated: 2022/06/15 17:44:44 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -41,34 +41,34 @@ typedef struct ray_info{
int pixel; int pixel;
char texture_type; char texture_type;
} ray; } t_ray;
typedef struct all_wall_texture{ typedef struct all_wall_texture{
unsigned char *north; unsigned char *north;
unsigned char *east; unsigned char *east;
unsigned char *west; unsigned char *west;
unsigned char *south; unsigned char *south;
} sprite; } t_sprite;
typedef struct s_color{ typedef struct s_color{
unsigned char r; unsigned char r;
unsigned char g; unsigned char g;
unsigned char b; unsigned char b;
int set; int set;
} color; } t_color;
typedef struct map_information{ typedef struct map_information{
char **map; char **map;
sprite texture; t_sprite texture;
color floor; t_color floor;
color sky; t_color sky;
char *simple_map; char *simple_map;
int size; int size;
int x; int x;
int y; int y;
int max; int max;
int error; int error;
} map_info; } t_map_info;
typedef struct player_position typedef struct player_position
{ {
@ -81,7 +81,7 @@ typedef struct player_position
int side; int side;
int angle_side; int angle_side;
int shift; int shift;
} player; } t_player;
typedef struct need_to_be_free typedef struct need_to_be_free
{ {
@ -90,7 +90,7 @@ typedef struct need_to_be_free
unsigned char *str; unsigned char *str;
char *string; char *string;
int fd; int fd;
} to_free; } t_to_free;
typedef struct s_data { typedef struct s_data {
void *mlx; void *mlx;
@ -102,9 +102,9 @@ typedef struct s_data {
char *buffer; char *buffer;
void *mlx_win_test; void *mlx_win_test;
char **double_map; char **double_map;
map_info map; t_map_info map;
player player; t_player player;
to_free to_be_free; t_to_free to_be_free;
int err; int err;
} t_data; } t_data;
@ -123,8 +123,8 @@ void print_ray(t_data *img);
int key_press(int code, t_data *img); int key_press(int code, t_data *img);
int quit_game(t_data *img); int quit_game(t_data *img);
void ft_error(char *error_msg); void ft_error(char *error_msg);
void print_player(player player, t_data *img); void print_player(t_player player, t_data *img);
void print_map(map_info map, t_data *img); void print_map(t_map_info map, t_data *img);
void check_dir(char *path, t_data *img); void check_dir(char *path, t_data *img);
#endif #endif

View File

@ -91,7 +91,7 @@ void set_pixel(t_data *img, int color, int x, int y)
} }
} }
void draw_ray3d(t_data *img, ray ray) void draw_ray3d(t_data *img, t_ray ray)
{ {
double line_height; double line_height;
double line_offset; double line_offset;
@ -290,7 +290,7 @@ void draw_ray(t_data *img)
} //check next horizontal } //check next horizontal
} }
int wall_type; int wall_type;
ray ray_info; t_ray ray_info;
wall_type = 0; wall_type = 0;
ray_info.texture_type = 0; ray_info.texture_type = 0;

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/11 01:00:17 by apommier #+# #+# */ /* Created: 2022/06/11 01:00:17 by apommier #+# #+# */
/* Updated: 2022/06/15 17:24:06 by apommier ### ########.fr */ /* Updated: 2022/06/15 17:42:02 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -99,7 +99,7 @@ void check_value(char **tab, t_data *img)
} }
} }
void set_color_utils(char **tab, color *rgb, t_data *img) void set_color_utils(char **tab, t_color *rgb, t_data *img)
{ {
if (ft_strlen(tab[0]) > 3 || !(ft_atoi(tab[0]) >= 0 && ft_atoi(tab[0]) <= 255)) if (ft_strlen(tab[0]) > 3 || !(ft_atoi(tab[0]) >= 0 && ft_atoi(tab[0]) <= 255))
ft_exit("Error\nBad parameter in map file identifier(RGB)\n", img); ft_exit("Error\nBad parameter in map file identifier(RGB)\n", img);