aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_sprite.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_draw_sprite.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index ceea280..5fc28d3 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -18,7 +18,7 @@
#include <math.h>
static void
- ft_sort_sprites_norme(float *dist_tab, uint16_t *i, uint16_t j, t_cub *cl)
+ ft_sort_sprites_norme(float *dist_tab, int16_t *i, uint16_t j, t_cub *cl)
{
uint32_t tmp;
uint32_t it;
@@ -33,22 +33,18 @@ static void
tmp = cl->mlist.sprite_order[j][it];
cl->mlist.sprite_order[j][it] = cl->mlist.sprite_order[j][it + 1];
cl->mlist.sprite_order[j][it + 1] = tmp;
- it = 0;
+ *i = -1;
}
}
void
- ft_sort_sprites(t_cub *cl)
+ ft_sort_sprites(t_cub *cl, int16_t it, int16_t jt)
{
float dist_tab[8][4096];
- uint16_t it;
- uint16_t jt;
- it = -1;
- jt = -1;
- while (++jt < cl->mlist.sprite_var)
+ while (++jt <= cl->mlist.sprite_var)
{
- while (++it < cl->mlist.sprite_nbr)
+ while (++it <= cl->mlist.sprite_nbr[jt])
{
dist_tab[jt][it] =
((cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) *
@@ -62,8 +58,11 @@ void
it = -1;
jt = -1;
while (++jt < cl->mlist.sprite_var)
- while (++it < cl->mlist.sprite_nbr)
+ {
+ while (++it < cl->mlist.sprite_nbr[jt] - 1)
ft_sort_sprites_norme(dist_tab[jt], &it, jt, cl);
+ it = -1;
+ }
}
static void