aboutsummaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-29 17:38:46 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-29 17:38:46 +0200
commita07392fc219afc45000201d2f495694ad9b82763 (patch)
tree0eb3f2b9003ad7ceae4692242e46de56e55053b0 /inc
parentRemoved skybox shit (diff)
parentNorm (diff)
download42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.tar.gz
42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.tar.bz2
42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.tar.xz
42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.tar.zst
42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.zip
Merge branch 'fix-details'
Diffstat (limited to 'inc')
-rw-r--r--inc/cub3d.h21
-rw-r--r--inc/cub3d_defines.h18
-rw-r--r--inc/cub3d_structs.h19
3 files changed, 33 insertions, 25 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h
index f4f9552..84d9ea1 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -87,12 +87,13 @@ void ft_draw_circle(float a, float b,
int32_t color, t_cub *cl);
void ft_draw_verline(t_cub *cl, int32_t x, int32_t y, int32_t y2);
void ft_sprite_h_w(t_cub *cl, t_sprite *sprite);
+void ft_alloc_big_t(t_cub *cl);
+void ft_fill_big_t(float **dist_tab, t_cub *cl);
+void ft_sort_big_t(t_cub *cl);
void ft_sort_sprites(t_cub *cl, int16_t i, int16_t j);
-void ft_sort_s_t(t_cub *cl, float dist_tab[8][4096]);
+void ft_sort_s_t(t_cub *cl, float **dist_tab);
void ft_calc_sprite(t_cub *cl);
void ft_draw_sprite(t_cub *cl, t_sprite *sprite);
-void ft_calc_trap(t_cub *cl);
-void ft_draw_traps(t_cub *cl, t_sprite *sprite);
void ft_calc_heal(t_cub *cl);
void ft_draw_heals(t_cub *cl, t_sprite *sprite);
void ft_calc_weaps(t_cub *cl);
@@ -144,8 +145,8 @@ 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_get_next_sprite(t_cub *clist, int s_n, char c, size_t x);
void ft_get_sprite_spawn(t_cub *clist);
-void ft_get_trap_spawn(t_cub *clist);
void ft_get_heal_spawn(t_cub *clist);
void ft_get_weapon_spawn(t_cub *clist);
int8_t ft_check_map_line(char *line, uint8_t l, t_cub *clist);
@@ -158,12 +159,19 @@ void ft_check_map_surrounds(t_map *ml, t_cub *cl);
int ft_check_missing(t_cub *clist);
int ft_check_missing_tex_defines(t_cub *clist);
int ft_check_missing_sfx(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);
void ft_get_spawns(t_cub *cl);
/*
+** ====== ERROR ======
+*/
+
+int ft_error(uint8_t retval, const char *errmsg, t_cub *clist);
+int ft_missing_error(const char *err, t_cub *clist);
+int ft_map_error(const char *errmsg, t_cub *clist);
+int ft_alloc_error(t_cub *clist);
+
+/*
** ====== ARGS ======
*/
@@ -240,7 +248,6 @@ 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);
int8_t ft_warp_level(char *path, t_cub *cl);
uint32_t ft_rgb_to_hex(float dist, t_rgb rgb, t_cub *cl);
t_bmp_rgb ft_hex_to_rgb(uint32_t color);
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index 4ef2391..3cee49a 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -231,11 +231,13 @@ enum
# define FT_ERR_RD_MUSIC "could not find music file"
# define FT_ERR_RD_TRAP "could not find trap texture file"
# define FT_ERR_WR_BMP "could not export to bmp"
+# define FT_ERR_UNDEF_SPRITE "undefined sprite"
+# define FT_ERR_TOO_MUCH_SPRT "too much sprites, limit is 4096"
# define FT_ERR_TOO_MUCH_HEALS "too much heal packs, limit is 64"
# define FT_ERR_TOO_MUCH_TRAPS "too much traps, limit is 512"
-# define FT_ERR_TOO_MUCH_W_ONE "too much weapon one, limit is 1"
-# define FT_ERR_TOO_MUCH_W_TWO "too much weapon two, limit is 1"
-# define FT_ERR_TOO_MUCH_W_THREE "too much weapon three, limit is 1"
+# define FT_ERR_TOO_MUCH_W_ONE "too much weapon one, limit is 4"
+# define FT_ERR_TOO_MUCH_W_TWO "too much weapon two, limit is 4"
+# define FT_ERR_TOO_MUCH_W_THREE "too much weapon three, limit is 4"
/*
** ====== MISSING ERROR MSG ======
@@ -284,10 +286,9 @@ enum
# define FT_ERR_MISS_A_CAPTION "ammo caption"
/*
-** ====== OTHER ======
+** ====== GAMEPLAY ======
*/
-# define FT_PARSE_END_RET 25
# define FT_STRT_LIFE 250
# define FT_TRAP_DAMAGE_AMOUNT 45
# define FT_HEAL_PACK_AMOUNT 20
@@ -297,4 +298,11 @@ enum
# define FT_WEAP_THREE_STRT_AMMO 24
# define FT_WEAP_MAX_AMMO 1000
+/*
+** ====== OTHER ======
+*/
+
+# define FT_PARSE_END_RET 25
+# define FT_TOTAL_SPRT 13
+
# endif
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index ac87260..e2905f2 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -108,6 +108,7 @@ typedef struct s_sprite
uint64_t s_pos_y;
double spritex;
double spritey;
+ int8_t exists;
int32_t spriteheight;
int32_t spritewidth;
int32_t drawstartx;
@@ -201,17 +202,10 @@ typedef struct s_map
size_t map_w;
size_t map_h;
size_t mapl_len;
- int32_t sprite_nbr[4096];
+ int16_t sprite_nbr[FT_TOTAL_SPRT];
uint8_t sprite_var;
- uint8_t weapon_var;
- int32_t sprite_order[8][4096];
- int32_t st_o[8];
- int32_t traps_nbr;
- int32_t heals_nbr;
- int32_t weaps_nbr[3];
- int32_t traps_order[512];
- int32_t heals_order[64];
- int32_t weaps_order[3][1];
+ int32_t sprite_order[FT_TOTAL_SPRT][4096];
+ int32_t st_o[FT_TOTAL_SPRT + 1];
size_t line_chk;
size_t map_start;
uint8_t isspawn;
@@ -240,6 +234,8 @@ typedef struct s_cub
uint16_t currlvl;
uint16_t i;
uint16_t y;
+ float **big_t;
+ uint16_t big_t_val;
char errmsg[64];
int32_t key_input[5];
char fps_count[9];
@@ -273,9 +269,6 @@ typedef struct s_cub
struct s_img tweap[6];
struct s_img tnum[12];
struct s_sprite **sprites;
- struct s_sprite traps[512];
- struct s_sprite heals[64];
- struct s_sprite **weaps;
struct s_sfx sfx[13];
} t_cub;