diff options
-rw-r--r-- | inc/cub3d_defines.h | 1 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 2 | ||||
-rw-r--r-- | src/ft_check_missing_defines.c | 10 | ||||
-rw-r--r-- | src/ft_del_tex.c | 2 | ||||
-rw-r--r-- | src/ft_tex_num_init.c | 21 |
5 files changed, 33 insertions, 3 deletions
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 43da0a7..0d3b606 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -131,6 +131,7 @@ enum # define FT_EIG_PATH "./media/img/hud/eight.xpm" # define FT_NIN_PATH "./media/img/hud/nine.xpm" # define FT_PER_PATH "./media/img/hud/percent.xpm" +# define FT_INF_PATH "./media/img/hud/infinite.xpm" # define FT_CAP_HEALTH_PATH "./media/img/hud/health.xpm" # define FT_CAP_AMMO_PATH "./media/img/hud/ammo.xpm" diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 72796d3..e23d6c2 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -262,7 +262,7 @@ typedef struct s_cub struct s_rgb c_rgb; struct s_img tlist[23]; struct s_img tweap[6]; - struct s_img tnum[11]; + struct s_img tnum[12]; struct s_sprite **sprites; struct s_sprite traps[512]; struct s_sprite heals[64]; diff --git a/src/ft_check_missing_defines.c b/src/ft_check_missing_defines.c index e32d7f7..bf5bd6d 100644 --- a/src/ft_check_missing_defines.c +++ b/src/ft_check_missing_defines.c @@ -14,6 +14,14 @@ #include <cub3d.h> static int + ft_check_missing_other_number_defines(t_cub *clist) +{ + if (ft_check_not_found(FT_INF_PATH) < 0 || + ft_check_ext(FT_INF_PATH, ".xpm") < 0) + return (ft_missing_error(FT_ERR_MISS_NUMBER, clist)); + return (ft_check_missing_sfx(clist)); +} +static int ft_check_missing_number_defines(t_cub *clist) { if (ft_check_not_found(FT_ZER_PATH) < 0 || @@ -39,7 +47,7 @@ static int ft_check_not_found(FT_PER_PATH) < 0 || ft_check_ext(FT_PER_PATH, ".xpm") < 0) return (ft_missing_error(FT_ERR_MISS_NUMBER, clist)); - return (ft_check_missing_sfx(clist)); + return (ft_check_missing_other_number_defines(clist)); } static int diff --git a/src/ft_del_tex.c b/src/ft_del_tex.c index 07265fa..70f23fa 100644 --- a/src/ft_del_tex.c +++ b/src/ft_del_tex.c @@ -34,7 +34,7 @@ static void int8_t i; i = 0; - while (i < 11) + while (i < 12) { if (cl->tnum[i].img) mlx_destroy_image(cl->wlist.wlx, cl->tnum[i].img); diff --git a/src/ft_tex_num_init.c b/src/ft_tex_num_init.c index b17910a..34b5c11 100644 --- a/src/ft_tex_num_init.c +++ b/src/ft_tex_num_init.c @@ -13,6 +13,23 @@ #include <cub3d.h> #include <mlx.h> +/* +** tnum[] index summary +** --------------------- +** 0: zero +** 1: one +** 2: two +** 3: three +** 4: four +** 5: five +** 6: six +** 7: seven +** 8: eight +** 9: nine +** 10: percent +** 11: infinite +*/ + static void ft_next_num_init(t_cub *cl) { @@ -36,6 +53,10 @@ static void FT_PER_PATH, &cl->tnum[10].img_w, &cl->tnum[10].img_h); cl->tnum[10].ptr = mlx_get_data_addr(cl->tnum[10].img, &cl->tnum[10].bpp, &cl->tnum[10].sizeline, &cl->tnum[10].endian); + cl->tnum[11].img = mlx_xpm_file_to_image(cl->wlist.wlx, + FT_INF_PATH, &cl->tnum[11].img_w, &cl->tnum[11].img_h); + cl->tnum[11].ptr = mlx_get_data_addr(cl->tnum[11].img, + &cl->tnum[11].bpp, &cl->tnum[11].sizeline, &cl->tnum[11].endian); } void |