diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-11 09:17:49 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-11 09:17:49 +0100 |
commit | 79af897f235b2172ce37e6d30b829fa0928aef3a (patch) | |
tree | d585fe7f2ab852c7ebc781e553669a6cff34034d /src/ft_tex_init.c | |
parent | ft_calc_sprite in a better location, still sliding like a champ (diff) | |
download | 42-cub3d-79af897f235b2172ce37e6d30b829fa0928aef3a.tar.gz 42-cub3d-79af897f235b2172ce37e6d30b829fa0928aef3a.tar.bz2 42-cub3d-79af897f235b2172ce37e6d30b829fa0928aef3a.tar.xz 42-cub3d-79af897f235b2172ce37e6d30b829fa0928aef3a.tar.zst 42-cub3d-79af897f235b2172ce37e6d30b829fa0928aef3a.zip |
Good trap init
Diffstat (limited to 'src/ft_tex_init.c')
-rw-r--r-- | src/ft_tex_init.c | 89 |
1 files changed, 49 insertions, 40 deletions
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c index 4cbdf73..32bfb66 100644 --- a/src/ft_tex_init.c +++ b/src/ft_tex_init.c @@ -16,60 +16,69 @@ #include <mlx.h> /* -** 0 : no -** 1 : so -** 2 : ea -** 3 : we -** 4 : sprite -** 5 : new level door -** 6 : floor -** 7 : ceil +** 0 : no +** 1 : so +** 2 : ea +** 3 : we +** 4 : sprite 1 +** 5 : new level door +** 6 : floor +** 7 : ceil / skybox +** 8 : sprite 2 +** 9 : sprite 3 +** 10 : sprite 4 +** 11 : sprite 5 +** 12 : sprite 6 +** 13 : sprite 7 +** 14 : sprite 8 +** 15 : trap */ static void - ft_get_nlvl_img(t_cub *cl) + ft_wall_tex_init_norme_bis(t_cub *cl) { - cl->tlist[5].img = mlx_xpm_file_to_image(cl->wlist.wlx, - cl->mlist.nl_tex_path, &cl->tlist[5].img_w, &cl->tlist[5].img_h); - cl->tlist[5].ptr = mlx_get_data_addr(cl->tlist[5].img, - &cl->tlist[5].bpp, &cl->tlist[5].sizeline, &cl->tlist[5].endian); -} - -static void - ft_get_floor_tex(t_cub *cl) -{ - cl->tlist[6].img = mlx_xpm_file_to_image(cl->wlist.wlx, - cl->mlist.fl_tex_path, &cl->tlist[6].img_w, &cl->tlist[6].img_h); - cl->tlist[6].ptr = mlx_get_data_addr(cl->tlist[6].img, - &cl->tlist[6].bpp, &cl->tlist[6].sizeline, &cl->tlist[6].endian); -} - -static void - ft_get_ceil_tex(t_cub *cl) -{ - cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx, + 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[7].ptr = mlx_get_data_addr(cl->tlist[7].img, + &cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].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); + } + cl->walltexgood = 1; } static void ft_wall_tex_init_norme(t_cub *cl) { if (cl->mlist.isnlvl) - ft_get_nlvl_img(cl); + { + cl->tlist[5].img = mlx_xpm_file_to_image(cl->wlist.wlx, + cl->mlist.nl_tex_path, &cl->tlist[5].img_w, &cl->tlist[5].img_h); + cl->tlist[5].ptr = mlx_get_data_addr(cl->tlist[5].img, + &cl->tlist[5].bpp, &cl->tlist[5].sizeline, &cl->tlist[5].endian); + } if (cl->mlist.isftex) - ft_get_floor_tex(cl); - if (cl->mlist.isctex) - ft_get_ceil_tex(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); + cl->tlist[6].img = mlx_xpm_file_to_image(cl->wlist.wlx, + cl->mlist.fl_tex_path, &cl->tlist[6].img_w, &cl->tlist[6].img_h); + cl->tlist[6].ptr = mlx_get_data_addr(cl->tlist[6].img, + &cl->tlist[6].bpp, &cl->tlist[6].sizeline, &cl->tlist[6].endian); } - cl->walltexgood = 1; + if (cl->mlist.istrap) + { + cl->tlist[15].img = mlx_xpm_file_to_image(cl->wlist.wlx, + cl->mlist.traps_path, &cl->tlist[15].img_w, &cl->tlist[15].img_h); + cl->tlist[15].ptr = mlx_get_data_addr(cl->tlist[15].img, + &cl->tlist[15].bpp, &cl->tlist[15].sizeline, &cl->tlist[15].endian); + } + ft_wall_tex_init_norme_bis(cl); } void |