diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_draw_sprite.c | 5 | ||||
-rw-r--r-- | src/ft_sort_s_t.c | 37 |
2 files changed, 40 insertions, 2 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c index b381957..5c0fe41 100644 --- a/src/ft_draw_sprite.c +++ b/src/ft_draw_sprite.c @@ -41,9 +41,9 @@ void { float dist_tab[8][4096]; - while (++jt <= cl->mlist.sprite_var) + while (++jt < cl->mlist.sprite_var) { - while (++it <= cl->mlist.sprite_nbr[jt]) + while (++it < cl->mlist.sprite_nbr[jt]) { dist_tab[jt][it] = ((cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) * @@ -62,6 +62,7 @@ void ft_sort_sprites_norme(dist_tab[jt], &it, jt, cl); it = -1; } + ft_sort_s_t(cl, dist_tab); } static void diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c new file mode 100644 index 0000000..f015abc --- /dev/null +++ b/src/ft_sort_s_t.c @@ -0,0 +1,37 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_sort_s_t.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/24 20:22:45 by rbousset #+# #+# */ +/* Updated: 2020/03/09 18:56:01 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +/*clearpilled*/ + +void + ft_sort_s_t(t_cub *cl, float dist_tab[8][4096]) +{ + uint16_t i; + int32_t tmp; + + i = 0; + while (i < cl->mlist.sprite_var) + { + if (dist_tab[i][0] < dist_tab[i + 1][0]) + { + i = 0; + } + i++; + } +} |