26# include "type_cub3d.h"
27# include "error_cub3d.h"
32# include "get_next_line.h"
33# include "ft_printf.h"
36# include "debug_cub3d.h"
41# define WIN_WIDTH 1024
42# define WIN_HEIGHT 512
44# define IMG_3D_WIDTH 1024
45# define IMG_3D_HEIGHT WIN_HEIGHT
46# define IMG_2D_WIDTH 512
47# define IMG_2D_HEIGHT WIN_HEIGHT
48# define DISABLE_2D_MAP 0
55# define COLOR_GREY 0xAAAAAA
56# define COLOR_WHITE 0xFFFFFF
57# define COLOR_RED 0xFF0000
64# define KEY_LEFT 65361
65# define KEY_RIGHT 65363
70# define START_POINT -1
71# define ON_VERTICAL_LINE 0
72# define ON_HORIZONTAL_LINE 1
82int init_game(
t_game *game,
int argc,
char *argv[]);
84void render_frame(
t_game *game);
85int handle_key_press(
int keycode,
t_game *game);
86int handle_mouse(
int button,
int x,
int y,
t_game *game);
94int init_mlx_window(
t_game *game);
95int init_mlx_image(
t_game *game);
96int init_cub_contents(
t_game *game,
char *filename);
97int parse_cubfile(
t_parse *parse,
t_game *game,
const char *element);
102char *ft_strjoin_nullable(
char *s1,
char *s2);
109const char *find_next_element(
const char *line);
110t_type_elem get_type_element(
const char *line);
111typedef int (*t_parse_elem)(
const char *,
t_parse *);
112int parse_tex(
const char *line,
t_parse *parse);
113int parse_fc(
const char *line,
t_parse *parse);
114int parse_map(
const char *line,
t_parse *parse);
117char *find_next_line(
const char *contents);
118const char *find_next_word(
const char *s);
119bool is_key_line(
const char *line,
const char *key);
120char *strdup_trimmed_line(
const char *str);
121int print_until_nl(
int fd,
const char *str);
122int print_until_ch(
int fd,
const char *str,
int c);
123int check_for_not_matching_bit(
int variable,
int flags_to_check);
124int check_duplicate_info(
125 int value,
int flag_to_check,
const char *line);
128void put_error_msg(
const char *entry,
const char *msg);
131int create_texture_image(
132 const char *line,
t_parse *parse, t_type_wall type);
137int get_fc_color(
const char *first_word,
int *color);
145typedef int (*t_parse_map)(
const char *,
t_parse *parse);
146int check_last_map(
const char *line,
t_parse *parse);
147int check_range_map(
const char *line,
t_parse *parse);
148int get_map_data(
const char *line,
t_parse *parse);
149char **split_lines(
const char *str);
150int get_player_info(
const char *line,
t_parse *parse);
151int check_enclosed_by_walls(
const char *line,
t_parse *parse);
159int find_player_and_set(
161void set_direction(
char direction,
t_player *player);
164t_bool flood_fill(
t_map *map,
int start_x,
int start_y,
bool **visited);
166# define DFLT_STACK_SIZE 100
169# define BIT_NORTH 0x01
170# define BIT_WEST 0x02
171# define BIT_EAST 0x04
172# define BIT_SOUTH 0x08
175# define BIT_PLAYER 0x40
177# define BIT_INIT_TEX 0x100
178# define BIT_INIT_FC 0x200
179# define BIT_INIT_MAP 0x400
189void init_ray(
t_frame *frame,
int x);
190void perform_dda(
t_frame *frame,
int x);
191void set_wall_slice(
t_frame *frame,
int x);
192void set_texture_x_coordinate(
t_frame *frame,
int x);
193void draw_vertical_line(
t_frame *frame,
int x);
194typedef void (*t_draw_3d_process)(
t_frame *, int);
198int get_texture_y_coordinate(
t_frame *frame,
int y);
201t_type_wall get_texture_direction(
202 int type_of_grid_line,
t_vector ray_dir);
218void init_color(
t_clr *color,
int start_color,
int end_color);
226void destroy_texture_image(
void *mlx,
t_texture *texture,
int n);
227void *ft_free(
void *ptr);
228void free_double_pointer(
char **array);
229void free_double_pointer_n(
char **array,
int n);
237void my_mlx_pixel_put(
t_img *img,
int x,
int y,
int color);
246void quit_game(
int keycode,
t_game *game);
247void set_move_forward_flag(
int keycode,
t_game *game);
248void set_move_backward_flag(
int keycode,
t_game *game);
249void set_strafe_left_flag(
int keycode,
t_game *game);
250void set_strafe_right_flag(
int keycode,
t_game *game);
251void set_rotate_left_flag(
int keycode,
t_game *game);
252void set_rotate_right_flag(
int keycode,
t_game *game);
253void invalid_key(
int keycode,
t_game *game);
254typedef void (*t_handle_key_press)(int,
t_game *);
263# define MOVE_SPEED 0.1
264# define ROTATE_SPEED 0.05
265# define BIT_MOVE_FORWARD 0x01
266# define BIT_MOVE_BACKWARD 0x02
267# define BIT_STRAFE_LEFT 0x04
268# define BIT_STRAFE_RIGHT 0x08
269# define BIT_ROTATE_LEFT 0x10
270# define BIT_ROTATE_RIGHT 0x20
279bool is_hit_flag(
int flag,
int bit);
280bool is_collision_detection_x(
281 char **data,
t_vector view_point,
double move_amount);
282bool is_collision_detection_y(
283 char **data,
t_vector view_point,
double move_amount);
single still image for render_frame
3D or 2D or Texture image