aboutsummaryrefslogtreecommitdiffstats
path: root/inc/cub3d.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/cub3d.h')
-rw-r--r--inc/cub3d.h189
1 files changed, 119 insertions, 70 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h
index 310e00d..615112b 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -19,80 +19,129 @@
#include <stdint.h>
/*
-** ret vals:
-** 1: no argv[1]
-** 2: failed structs init
-** 3: failed mlx init
-** 4: map error
-** 5: no map
-** 6: read error
+** ====== STRUCTS ======
*/
-int8_t ft_init_cub3d(t_cub **clist);
-t_map *ft_init_map(void);
-void ft_wall_tex_init(t_cub *clist);
-void ft_choose_tex(t_cub *clist);
-void ft_hooks_and_loops(t_win *wl, t_cub *cl);
-int ft_key_event(int keycode, t_cub *clist);
-int ft_click_close(int keycode, t_cub *clist);
-int ft_exit(uint8_t exit_code, t_cub *clist);
-void ft_draw_square(int a, int b, int rgb, t_cub *clist);
-void ft_parse_map(const char *map_path, t_cub *clist);
-int8_t ft_select_get(char **words, t_cub *clist);
-int8_t ft_get_screen_size(t_win *wlist);
-int8_t ft_get_res(char **words, t_cub *clist);
-int8_t ft_get_tex_no(char **words, t_cub *clist);
-int8_t ft_get_tex_so(char **words, t_cub *clist);
-int8_t ft_get_tex_ea(char **words, t_cub *clist);
-int8_t ft_get_tex_we(char **words, t_cub *clist);
-int8_t ft_get_sprite(char **words, t_cub *clist);
-int8_t ft_get_f_color(char **words, t_cub *clist);
-int8_t ft_get_c_color(char **words, t_cub *clist);
-int ft_get_map_first_line(char *line, t_cub *clist);
-int ft_get_map_core(int fd, t_cub *clist);
-void ft_get_player_spawn(t_player *plist, t_cub *clist);
-void ft_set_minimap_scale(t_cub *clist);
-int ft_check_missing(t_cub *clist);
-int8_t ft_check_map_line(char *line, uint8_t l, t_cub *clist);
-size_t ft_get_line_len(char *line);
-int ft_missing_error(const char *err, t_cub *clist);
-uint8_t ft_free_words(char **words);
-int ft_map_error(const char *errmsg, t_cub *clist);
-int ft_init_winlx(t_cub *clist);
-void ft_draw_scene(t_cub *clist);
-void ft_print_list(t_cub *clist);
-uint32_t ft_rgb_to_hex(t_rgb rgb);
-t_ray ft_init_s_ray(void);
-void ft_detect(t_cub *cl);
-int8_t ft_draw_verline(t_cub *cl, int32_t x,
- int32_t y1, int32_t y2);
-void ft_castray(t_cub *cl);
-void ft_draw_map(char **map, t_cub *clist);
-int ft_w_key(t_cub *clist);
-int ft_a_key(t_cub *clist);
-int ft_s_key(t_cub *clist);
-int ft_d_key(t_cub *clist);
-int ft_f1_key(t_cub *clist);
-int ft_left_key(t_cub *clist);
-int ft_right_key(t_cub *clist);
-int ft_key_release(int keycode, t_cub *clist);
-int8_t ft_check_ext(const char *filep, const char *ext);
-int32_t ft_convert_keycode(const int32_t tmp_code);
-int ft_key_loop(t_cub *cl);
-void ft_draw_circle(float a, float b,
- int32_t color, t_cub *cl);
-void ft_draw_texture(t_cub *cl, int x, int y, int tex_y);
-int8_t ft_check_not_found(const char *path);
-void ft_calc_tex(t_cub *clist);
-void ft_draw_hud(t_cub *clist);
-void ft_draw_life_bar(size_t map_w,
- const uint16_t scale,
- const int8_t life,
- t_cub *cl);
-void ft_music(t_cub *cl);
+void ft_init_funptr(t_cub *clist);
+void ft_init_ref(t_cub *clist);
+int8_t ft_init_cub3d(t_cub *clist);
+int ft_init_winlx(t_cub *clist);
+int ft_init_winptr(t_cub *clist);
+t_ray ft_init_s_ray(void);
+t_rgb ft_init_rgb(void);
+int8_t ft_init_map(t_map *mlist);
+t_bmp_file ft_init_bmp(void);
+t_bmp_info ft_init_bmp_info(void);
+
+/*
+** ====== HOOKS ======
+*/
+
+void ft_hooks_and_loops(t_win *wl, t_cub *cl);
+int ft_key_event(int keycode, t_cub *clist);
+int ft_key_release(int keycode, t_cub *clist);
+int ft_w_key(t_cub *clist);
+int ft_a_key(t_cub *clist);
+int ft_s_key(t_cub *clist);
+int ft_d_key(t_cub *clist);
+int ft_f1_key(t_cub *clist);
+int ft_left_key(t_cub *clist);
+int ft_right_key(t_cub *clist);
+int ft_click_close(int keycode, t_cub *clist);
+int ft_key_loop(t_cub *cl);
+int32_t ft_convert_keycode(const int32_t tmp_code);
+
+/*
+** ====== TEXTURES ======
+*/
+
+void ft_wall_tex_init(t_cub *clist);
+void ft_choose_tex(t_cub *clist);
+
+/*
+** ====== DRAW ======
+*/
+
+void ft_draw_square(int a, int b, int rgb, t_cub *clist);
+void ft_draw_map(char **map, t_cub *clist);
+void ft_draw_texture(t_cub *cl, int x, int y, int tex_y);
+int8_t ft_draw_hud(t_cub *clist);
+void ft_draw_scene(t_cub *clist);
+void ft_draw_scene_bmp(t_cub *clist);
+void ft_draw_circle(float a, float b,
+ int32_t color, t_cub *cl);
+int8_t ft_draw_verline(t_cub *cl, int32_t x,
+ int32_t y1, int32_t y2);
void ft_calc_sprite(t_cub *cl);
-void ft_calc_sprite_norme(t_cub *cl);
void ft_draw_sprite(t_cub *cl, t_sprite *sprite);
void ft_get_sprite_spawn(t_cub *cl);
+/*
+** ====== PARSING ======
+*/
+
+void ft_parse_map(const char *map_path, t_cub *clist);
+void ft_get_player_spawn(t_player *plist, t_cub *clist);
+void ft_get_nlvl_pos(t_map *ml);
+int8_t ft_select_get(char **words, t_cub *clist);
+int8_t ft_get_screen_size(t_win *wlist);
+int8_t ft_get_res(char **words, t_cub *clist);
+int8_t ft_get_tex_no(char **words, t_cub *clist);
+int8_t ft_get_tex_so(char **words, t_cub *clist);
+int8_t ft_get_tex_ea(char **words, t_cub *clist);
+int8_t ft_get_tex_we(char **words, t_cub *clist);
+int8_t ft_get_sprite(char **words, t_cub *clist);
+int8_t ft_get_f_color(char **words, t_cub *clist);
+int8_t ft_get_f_tex(char **words, t_cub *clist);
+int8_t ft_get_c_color(char **words, t_cub *clist);
+int8_t ft_get_c_tex(char **words, t_cub *clist);
+int8_t ft_get_darkness(char **words, t_cub *clist);
+int8_t ft_get_path_nl(char **words, t_cub *clist);
+int8_t ft_get_tex_nl(char **words, t_cub *clist);
+int8_t ft_get_music(char **words, t_cub *clist);
+size_t ft_get_map_h(char **map);
+size_t ft_get_map_w(char **map);
+int8_t ft_check_map_line(char *line, uint8_t l, t_cub *clist);
+int8_t ft_check_ext(const char *filep, const char *ext);
+int8_t ft_check_not_found(const char *path);
+int ft_get_map_first_line(char *line, t_cub *clist);
+int ft_get_map_core(int fd, t_cub *clist);
+void ft_check_map_surrounds(t_map *ml, t_cub *cl);
+int ft_check_missing(t_cub *clist);
+int ft_missing_error(const char *err, t_cub *clist);
+int ft_map_error(const char *errmsg, t_cub *clist);
+size_t ft_get_line_len(char *line);
+
+/*
+** ====== ARGS ======
+*/
+
+uint8_t ft_check_map_arg(int argc, const char *argv[]);
+uint8_t ft_use_args(int argc, const char *argv[],
+ char *const envp[], t_cub *clist);
+
+/*
+** ====== RAYCAST ======
+*/
+
+void ft_castray(t_cub *cl);
+void ft_detect(t_cub *cl);
+void ft_floor_cast(uint16_t y, t_cub *cl);
+
+/*
+** ====== OTHER ======
+*/
+
+void ft_set_minimap_scale(t_cub *clist);
+void ft_enable_music(t_cub *cl);
+void ft_music_fork(char **mcmd_words, char *const envp[]);
+int8_t ft_save_to_bmp(t_cub *cl);
+int ft_error(uint8_t retval, const char *errmsg, t_cub *clist);
+uint8_t ft_free_words(char **words);
+int8_t ft_warp_level(t_cub *cl);
+int ft_exit(uint8_t exit_code, t_cub *clist);
+uint32_t ft_rgb_to_hex(t_rgb rgb);
+t_bmp_rgb ft_hex_to_rgb(uint32_t color);
+uint32_t ft_darken(t_rgb rgb, t_cub *cl);
+
# endif