aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_sprite_extra.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-01 17:32:44 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-01 17:32:44 +0200
commitb2f4e302d39ebfe133530d2cd41ec2f48c8bda58 (patch)
treee6f5af0083e30266805aa3f2980ab26766b2e38f /src/ft_draw_sprite_extra.c
parentNormed (diff)
download42-cub3d-b2f4e302d39ebfe133530d2cd41ec2f48c8bda58.tar.gz
42-cub3d-b2f4e302d39ebfe133530d2cd41ec2f48c8bda58.tar.bz2
42-cub3d-b2f4e302d39ebfe133530d2cd41ec2f48c8bda58.tar.xz
42-cub3d-b2f4e302d39ebfe133530d2cd41ec2f48c8bda58.tar.zst
42-cub3d-b2f4e302d39ebfe133530d2cd41ec2f48c8bda58.zip
Optimization
Diffstat (limited to '')
-rw-r--r--src/ft_draw_sprite_extra.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c
index c9b8b16..d85540d 100644
--- a/src/ft_draw_sprite_extra.c
+++ b/src/ft_draw_sprite_extra.c
@@ -52,21 +52,21 @@ void
ft_calc_sprite(t_cub *cl)
{
t_sprite sprite;
- int16_t i;
- int8_t j;
+ int8_t i;
i = -1;
- j = -1;
ft_sort_sprites(cl, -1, -1);
- while (++j < cl->big_t_val)
+ while (++i < cl->big_t_val)
{
- sprite = cl->sprites[(int8_t)cl->big_t[j][2]][(int32_t)cl->big_t[j][3]];
- sprite.current_sprite = (int8_t)cl->big_t[j][1];
- sprite.spritey = sprite.s_pos_x - (cl->plist.pos_x - 0.5);
- sprite.spritex = sprite.s_pos_y - (cl->plist.pos_y - 0.5);
- ft_init_sprite(cl, &sprite);
- ft_sprite_h_w(cl, &sprite);
- ft_draw_sprite(cl, &sprite);
- i = -1;
+ sprite = cl->sprites[(int8_t)cl->big_t[i][2]][(int32_t)cl->big_t[i][3]];
+ if (sprite.s_pos_x != 0)
+ {
+ sprite.current_sprite = (int8_t)cl->big_t[i][1];
+ sprite.spritey = sprite.s_pos_x - (cl->plist.pos_x - 0.5);
+ sprite.spritex = sprite.s_pos_y - (cl->plist.pos_y - 0.5);
+ ft_init_sprite(cl, &sprite);
+ ft_sprite_h_w(cl, &sprite);
+ ft_draw_sprite(cl, &sprite);
+ }
}
}