aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_draw_sprite.c1
-rw-r--r--src/ft_draw_sprite_extra.c24
2 files changed, 12 insertions, 13 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index 655a6e4..a17ab98 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -86,7 +86,6 @@ void
int32_t d;
sprite->x = sprite->drawstartx;
- ft_printf("current: %d\n", sprite->current_sprite);
while (sprite->x < sprite->drawendx)
{
sprite->tex_x = (int32_t)((sprite->x - (-sprite->spritewidth / 2 +
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);
+ }
}
}