From 1d0be73de37e2b60ecc7babbbdf385e24e86dfee Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 29 Mar 2020 17:07:09 +0200 Subject: litteral god --- src/ft_draw_sprite.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/ft_draw_sprite.c') diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c index fcc2a8b..41daec4 100644 --- a/src/ft_draw_sprite.c +++ b/src/ft_draw_sprite.c @@ -45,16 +45,21 @@ void ft_alloc_error(cl); while (++jt < FT_TOTAL_SPRT) { - while (++it < cl->mlist.sprite_nbr[jt]) + if (cl->mlist.sprite_nbr[jt] == 0) + dist_tab[jt][0] = 0; + else { - dist_tab[jt][it] = - ((cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) * - (cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) + - (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y) * - (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y)); - /* cl->mlist.sprite_order[jt][it] = it; */ + while (++it < cl->mlist.sprite_nbr[jt]) + { + dist_tab[jt][it] = + ((cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) * + (cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) + + (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y) * + (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y)); + /* cl->mlist.sprite_order[jt][it] = it; */ + } + it = -1; } - it = -1; } /* jt = -1; */ /* while (++jt < FT_TOTAL_SPRT) */ -- cgit v1.2.3