aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_sprite.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_draw_sprite.c')
-rw-r--r--src/ft_draw_sprite.c21
1 files changed, 13 insertions, 8 deletions
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) */