diff options
Diffstat (limited to 'src/ft_tex_init.c')
-rw-r--r-- | src/ft_tex_init.c | 106 |
1 files changed, 31 insertions, 75 deletions
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c index 5e445ce..89a4d77 100644 --- a/src/ft_tex_init.c +++ b/src/ft_tex_init.c @@ -41,55 +41,6 @@ */ static void - ft_init_numbers(t_cub *cl) -{ - cl->tnum[0].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_ZER_PATH, &cl->tnum[0].img_w, &cl->tnum[0].img_h); - cl->tnum[0].ptr = mlx_get_data_addr(cl->tnum[0].img, - &cl->tnum[0].bpp, &cl->tnum[0].sizeline, &cl->tnum[0].endian); - cl->tnum[1].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_ONE_PATH, &cl->tnum[1].img_w, &cl->tnum[1].img_h); - cl->tnum[1].ptr = mlx_get_data_addr(cl->tnum[1].img, - &cl->tnum[1].bpp, &cl->tnum[1].sizeline, &cl->tnum[1].endian); - cl->tnum[2].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_TWO_PATH, &cl->tnum[2].img_w, &cl->tnum[2].img_h); - cl->tnum[2].ptr = mlx_get_data_addr(cl->tnum[2].img, - &cl->tnum[2].bpp, &cl->tnum[2].sizeline, &cl->tnum[2].endian); - cl->tnum[3].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_THR_PATH, &cl->tnum[3].img_w, &cl->tnum[3].img_h); - cl->tnum[3].ptr = mlx_get_data_addr(cl->tnum[3].img, - &cl->tnum[3].bpp, &cl->tnum[3].sizeline, &cl->tnum[3].endian); - cl->tnum[4].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_FOU_PATH, &cl->tnum[4].img_w, &cl->tnum[4].img_h); - cl->tnum[4].ptr = mlx_get_data_addr(cl->tnum[4].img, - &cl->tnum[4].bpp, &cl->tnum[4].sizeline, &cl->tnum[4].endian); - cl->tnum[5].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_FIV_PATH, &cl->tnum[5].img_w, &cl->tnum[5].img_h); - cl->tnum[5].ptr = mlx_get_data_addr(cl->tnum[5].img, - &cl->tnum[5].bpp, &cl->tnum[5].sizeline, &cl->tnum[5].endian); - cl->tnum[6].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_SIX_PATH, &cl->tnum[6].img_w, &cl->tnum[6].img_h); - cl->tnum[6].ptr = mlx_get_data_addr(cl->tnum[6].img, - &cl->tnum[6].bpp, &cl->tnum[6].sizeline, &cl->tnum[6].endian); - cl->tnum[7].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_SEV_PATH, &cl->tnum[7].img_w, &cl->tnum[7].img_h); - cl->tnum[7].ptr = mlx_get_data_addr(cl->tnum[7].img, - &cl->tnum[7].bpp, &cl->tnum[7].sizeline, &cl->tnum[7].endian); - cl->tnum[8].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_EIG_PATH, &cl->tnum[8].img_w, &cl->tnum[8].img_h); - cl->tnum[8].ptr = mlx_get_data_addr(cl->tnum[8].img, - &cl->tnum[8].bpp, &cl->tnum[8].sizeline, &cl->tnum[8].endian); - cl->tnum[9].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_NIN_PATH, &cl->tnum[9].img_w, &cl->tnum[9].img_h); - cl->tnum[9].ptr = mlx_get_data_addr(cl->tnum[9].img, - &cl->tnum[9].bpp, &cl->tnum[9].sizeline, &cl->tnum[9].endian); - cl->tnum[10].img = mlx_xpm_file_to_image(cl->wlist.wlx, - 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); -} - -static void ft_next_sprite_init(t_cub *cl) { uint8_t i; @@ -108,22 +59,8 @@ static void } static void - ft_wall_tex_init_norme_bis(t_cub *cl) + ft_wall_tex_init_more_bonus(t_cub *cl) { - if (cl->mlist.isskybox) - { - cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx, - cl->mlist.skybox_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h); - cl->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img, - &cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian); - } - else if (cl->mlist.isctex) - { - cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx, - cl->mlist.ce_tex_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h); - cl->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img, - &cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian); - } cl->tlist[16].img = mlx_xpm_file_to_image(cl->wlist.wlx, FT_HUD_BACK_PATH, &cl->tlist[16].img_w, &cl->tlist[16].img_h); cl->tlist[16].ptr = mlx_get_data_addr(cl->tlist[16].img, @@ -136,14 +73,40 @@ static void FT_WEAPON_TWO_SPR_PATH, &cl->tlist[19].img_w, &cl->tlist[19].img_h); cl->tlist[19].ptr = mlx_get_data_addr(cl->tlist[19].img, &cl->tlist[19].bpp, &cl->tlist[19].sizeline, &cl->tlist[19].endian); - ft_init_numbers(cl); cl->walltexgood = 1; if (cl->mlist.sprite_var > 1) ft_next_sprite_init(cl); } static void - ft_wall_tex_init_norme(t_cub *cl) + ft_wall_tex_init_next_bonus(t_cub *cl) +{ + if (cl->mlist.isheals) + { + cl->tlist[17].img = mlx_xpm_file_to_image(cl->wlist.wlx, + FT_HEAL_PACK_PATH, &cl->tlist[17].img_w, &cl->tlist[17].img_h); + cl->tlist[17].ptr = mlx_get_data_addr(cl->tlist[17].img, + &cl->tlist[17].bpp, &cl->tlist[17].sizeline, &cl->tlist[17].endian); + } + if (cl->mlist.isskybox) + { + cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx, + cl->mlist.skybox_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h); + cl->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img, + &cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian); + } + else if (cl->mlist.isctex) + { + cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx, + cl->mlist.ce_tex_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h); + cl->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img, + &cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian); + } + ft_wall_tex_init_more_bonus(cl); +} + +static void + ft_wall_tex_init_bonus(t_cub *cl) { if (cl->mlist.isnlvl) { @@ -166,14 +129,7 @@ static void cl->tlist[15].ptr = mlx_get_data_addr(cl->tlist[15].img, &cl->tlist[15].bpp, &cl->tlist[15].sizeline, &cl->tlist[15].endian); } - if (cl->mlist.isheals) - { - cl->tlist[17].img = mlx_xpm_file_to_image(cl->wlist.wlx, - FT_HEAL_PACK_PATH, &cl->tlist[17].img_w, &cl->tlist[17].img_h); - cl->tlist[17].ptr = mlx_get_data_addr(cl->tlist[17].img, - &cl->tlist[17].bpp, &cl->tlist[17].sizeline, &cl->tlist[17].endian); - } - ft_wall_tex_init_norme_bis(cl); + ft_wall_tex_init_next_bonus(cl); } void @@ -199,5 +155,5 @@ void cl->mlist.sprite_path[0], &cl->tlist[4].img_w, &cl->tlist[4].img_h); cl->tlist[4].ptr = mlx_get_data_addr(cl->tlist[4].img, &cl->tlist[4].bpp, &cl->tlist[4].sizeline, &cl->tlist[4].endian); - ft_wall_tex_init_norme(cl); + ft_wall_tex_init_bonus(cl); } |