blob: 9e5f08eb9f1e609a8ea7d3a74adddbccbfa611b9 (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_s_t.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: joelecle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/24 20:22:45 by joelecle #+# #+# */
/* Updated: 2020/03/09 18:56:01 by joelecle ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <libft.h>
#include <cub3d.h>
#include <stdlib.h>
#include <stdint.h>
static void
ft_init_st(int32_t *st_o)
{
int8_t i;
i = 0;
while (i < FT_TOTAL_SPRT)
{
st_o[i] = i;
i++;
}
}
void
ft_sort_s_t(t_cub *cl, float **dist_tab)
{
int32_t i;
ft_init_st(cl->mlist.st_o);
i = -1;
while (++i < cl->big_t_val)
ft_memdel((void*)&cl->big_t[i]);
ft_memdel((void*)&cl->big_t);
i = -1;
cl->big_t_val = 0;
while (++i < FT_TOTAL_SPRT)
cl->big_t_val += cl->mlist.sprite_nbr[i];
ft_alloc_big_t(cl);
ft_fill_big_t(dist_tab, cl);
ft_sort_big_t(cl);
i = -1;
while (++i < FT_TOTAL_SPRT + 1)
ft_memdel((void*)&dist_tab[i]);
ft_memdel((void*)&dist_tab);
}
|