/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_del_tex.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:28:46 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:28:46 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include static void ft_del_extra_sprites(t_cub *cl) { uint8_t i; i = 1; while (cl->mlist.sprite_path[i][0]) { if (cl->tlist[i + 7].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[i + 7].img); i++; } } static void ft_del_tnum(t_cub *cl) { int8_t i; i = 0; while (i < 12) { if (cl->tnum[i].img) mlx_destroy_image(cl->wlist.wlx, cl->tnum[i].img); i++; } } static void ft_del_tweap(t_cub *cl) { int8_t i; i = 0; while (i < 6) { if (cl->tweap[i].img) mlx_destroy_image(cl->wlist.wlx, cl->tweap[i].img); i++; } i = 23; while (i < 27) { if (cl->tlist[i].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[i].img); i++; } } static void ft_del_bonus_tex(t_cub *cl) { if (cl->mlist.isnlvl && cl->tlist[5].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[5].img); if (cl->mlist.isftex && cl->tlist[6].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[6].img); if (cl->mlist.isctex && cl->tlist[7].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[7].img); if (cl->mlist.istraps && cl->tlist[15].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[15].img); if (cl->tlist[16].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[16].img); if (cl->mlist.isheals && cl->tlist[17].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[17].img); if (cl->tlist[18].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[18].img); if (cl->tlist[19].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[19].img); if (cl->tlist[20].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[20].img); if (cl->tlist[21].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[21].img); if (cl->tlist[22].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[22].img); } void ft_del_tex(t_cub *cl) { if (cl->walltexgood == 1) { if (cl->tlist[0].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[0].img); if (cl->tlist[1].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[1].img); if (cl->tlist[2].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[2].img); if (cl->tlist[3].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[3].img); if (cl->tlist[4].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[4].img); ft_del_bonus_tex(cl); ft_del_tweap(cl); ft_del_tnum(cl); ft_del_extra_sprites(cl); } }