1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_del_tex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: joelecle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/14 17:28:46 by joelecle #+# #+# */
/* Updated: 2020/02/14 17:28:46 by joelecle ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <cub3d.h>
#include <mlx.h>
#include <stdint.h>
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);
}
}
|