From 58b408a130b2bec0d401b43d77ded34c9a8d34f9 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 25 Mar 2020 18:46:15 +0100 Subject: Fixed sprite parse --- inc/cub3d_defines.h | 1 + 1 file changed, 1 insertion(+) (limited to 'inc') diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 4ef2391..76c0fc5 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -231,6 +231,7 @@ 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_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" -- cgit v1.2.3 From 94c06bc705b8598eb9ce30514f14f583f2538de8 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 25 Mar 2020 19:27:47 +0100 Subject: Solved segfault, fuck stack --- inc/cub3d.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index 38d4e3f..92e57ce 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -87,8 +87,9 @@ 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_dist_tab(float ***dist_tab, 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); -- cgit v1.2.3 From d29165bbb95aef86aeb9d9d9668d035b4430769f Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 26 Mar 2020 14:15:26 +0100 Subject: Cool malloc --- inc/cub3d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index 92e57ce..b7f8a36 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -87,7 +87,7 @@ 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_dist_tab(float ***dist_tab, t_cub *cl); +float **ft_alloc_dist_tab(void); void ft_sort_sprites(t_cub *cl, int16_t i, int16_t j); void ft_sort_s_t(t_cub *cl, float **dist_tab); void ft_calc_sprite(t_cub *cl); -- cgit v1.2.3 From b5982b835d46ba6ae7363b60254ebfa2c3439a4d Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 26 Mar 2020 14:58:02 +0100 Subject: Solved 9th sprite problem --- inc/cub3d_structs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 1b46312..caf4964 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -202,7 +202,7 @@ typedef struct s_map size_t map_w; size_t map_h; size_t mapl_len; - int32_t sprite_nbr[4096]; + int32_t sprite_nbr[8]; uint8_t sprite_var; uint8_t weapon_var; int32_t sprite_order[8][4096]; -- cgit v1.2.3 From b626f171f26f709b27e790911b48f7a4272dc707 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 27 Mar 2020 13:55:24 +0100 Subject: In progress --- inc/cub3d.h | 4 +--- inc/cub3d_defines.h | 17 ++++++++++++----- inc/cub3d_structs.h | 9 +++------ 3 files changed, 16 insertions(+), 14 deletions(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index b7f8a36..a6a0db7 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -92,8 +92,6 @@ void ft_sort_sprites(t_cub *cl, int16_t i, int16_t j); 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); @@ -145,8 +143,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); diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 76c0fc5..7b4d1b8 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -232,11 +232,12 @@ enum # 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 ====== @@ -285,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 @@ -298,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 9 + # endif diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index caf4964..836d168 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -202,15 +202,13 @@ typedef struct s_map size_t map_w; size_t map_h; size_t mapl_len; - int32_t sprite_nbr[8]; + int32_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 sprite_order[FT_TOTAL_SPRT][4096]; + int32_t st_o[FT_TOTAL_SPRT]; 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]; size_t line_chk; @@ -275,7 +273,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]; -- cgit v1.2.3 From a713e118950f62700a43d21aa33fd2e3d7673af9 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 27 Mar 2020 15:07:32 +0100 Subject: Problem --- inc/cub3d_structs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 836d168..ce45a92 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -202,7 +202,7 @@ typedef struct s_map size_t map_w; size_t map_h; size_t mapl_len; - int32_t sprite_nbr[FT_TOTAL_SPRT]; + int16_t sprite_nbr[FT_TOTAL_SPRT]; uint8_t sprite_var; uint8_t weapon_var; int32_t sprite_order[FT_TOTAL_SPRT][4096]; -- cgit v1.2.3 From 44d5f7f4da8465f4829de1232e4cf2c6c2bf76bc Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 27 Mar 2020 16:44:30 +0100 Subject: Segv fix --- inc/cub3d_structs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index ce45a92..b3cd636 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -206,7 +206,7 @@ typedef struct s_map uint8_t sprite_var; uint8_t weapon_var; int32_t sprite_order[FT_TOTAL_SPRT][4096]; - int32_t st_o[FT_TOTAL_SPRT]; + int32_t st_o[FT_TOTAL_SPRT + 1]; int32_t heals_nbr; int32_t weaps_nbr[3]; int32_t heals_order[64]; -- cgit v1.2.3 From 96534d2121cd9097da83b69ea5947ea93b736edc Mon Sep 17 00:00:00 2001 From: salad Date: Fri, 27 Mar 2020 22:23:03 +0100 Subject: jattend que ca clique --- inc/cub3d_structs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'inc') diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index b3cd636..639710f 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; -- cgit v1.2.3 From b3aecb150f55ebc9dde7c1b09559d1566e9e92a6 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 28 Mar 2020 16:46:40 +0100 Subject: All in sprites --- inc/cub3d_defines.h | 2 +- inc/cub3d_structs.h | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'inc') diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 7b4d1b8..3cee49a 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -303,6 +303,6 @@ enum */ # define FT_PARSE_END_RET 25 -# define FT_TOTAL_SPRT 9 +# define FT_TOTAL_SPRT 13 # endif diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 639710f..5af18a4 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -205,13 +205,8 @@ typedef struct s_map size_t mapl_len; int16_t sprite_nbr[FT_TOTAL_SPRT]; uint8_t sprite_var; - uint8_t weapon_var; int32_t sprite_order[FT_TOTAL_SPRT][4096]; int32_t st_o[FT_TOTAL_SPRT + 1]; - int32_t heals_nbr; - int32_t weaps_nbr[3]; - int32_t heals_order[64]; - int32_t weaps_order[3][1]; size_t line_chk; size_t map_start; uint8_t isspawn; @@ -274,8 +269,6 @@ typedef struct s_cub struct s_img tweap[6]; struct s_img tnum[12]; struct s_sprite **sprites; - struct s_sprite heals[64]; - struct s_sprite **weaps; struct s_sfx sfx[13]; } t_cub; -- cgit v1.2.3 From 76cefdc4dc3efa6eb410574a0f5ec42188ba11bd Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 29 Mar 2020 15:42:37 +0200 Subject: Almost --- inc/cub3d.h | 12 +++++++++--- inc/cub3d_structs.h | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index a6a0db7..82808f4 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -157,11 +157,18 @@ 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 ====== */ @@ -239,7 +246,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_structs.h b/inc/cub3d_structs.h index 5af18a4..5497ae9 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -236,6 +236,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]; -- cgit v1.2.3 From 69ca60b6f989dedc94c2e25ab9927b26d63cbdf8 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 29 Mar 2020 17:34:48 +0200 Subject: Norm --- inc/cub3d.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/cub3d.h b/inc/cub3d.h index 82808f4..aa81b4c 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -87,7 +87,9 @@ 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); -float **ft_alloc_dist_tab(void); +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); void ft_calc_sprite(t_cub *cl); -- cgit v1.2.3