diff options
Diffstat (limited to 'src/ft_sort_s_t.c')
-rw-r--r-- | src/ft_sort_s_t.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index f91804b..270c974 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -13,24 +13,32 @@ #include <libft.h> #include <cub3d.h> #include <stdint.h> +#include <stdio.h> #include <stdlib.h> #include <math.h> void - ft_sort_s_t(cl, t_sprite *s[4096]) + ft_sort_s_t(t_cub *cl, float dist_tab[8][4096]) { uint16_t i; - uint16_t j; - t_sprite tmp_s; + int32_t tmp; + t_sprite *tmp_s; i = 0; - j = 0; - while (i < cl->sprite_var) + tmp_s = ft_calloc(sizeof(t_sprite), 4096); + while (i < cl->mlist.sprite_var) { - if (s[i][0].) - { - + if (dist_tab[i][0] < dist_tab[i + 1][0]) + { + ft_memcpy(tmp_s, cl->sprites[i], 4096); + ft_memcpy(cl->sprites[i], cl->sprites[i + 1], 4096); + ft_memcpy(cl->sprites[i + 1], tmp_s, 4096); + tmp = dist_tab[i][0]; + dist_tab[i][0] = dist_tab[i + 1][0]; + dist_tab[i + 1][0] = tmp; + i = 0; } i++; + printf("qwe%d\n", i); } } |