aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_sprite.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-29 17:07:09 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-29 17:07:09 +0200
commit1d0be73de37e2b60ecc7babbbdf385e24e86dfee (patch)
treec6808d08c59fe574aa66b21a3c9d6439e94516f4 /src/ft_draw_sprite.c
parentI must be close (diff)
download42-cub3d-1d0be73de37e2b60ecc7babbbdf385e24e86dfee.tar.gz
42-cub3d-1d0be73de37e2b60ecc7babbbdf385e24e86dfee.tar.bz2
42-cub3d-1d0be73de37e2b60ecc7babbbdf385e24e86dfee.tar.xz
42-cub3d-1d0be73de37e2b60ecc7babbbdf385e24e86dfee.tar.zst
42-cub3d-1d0be73de37e2b60ecc7babbbdf385e24e86dfee.zip
litteral god
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) */