From 76cefdc4dc3efa6eb410574a0f5ec42188ba11bd Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 29 Mar 2020 15:42:37 +0200 Subject: Almost --- src/ft_draw_sprite_extra.c | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) (limited to 'src/ft_draw_sprite_extra.c') diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index c64d2c1..598f637 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -47,24 +47,7 @@ static void (1 + sprite->transformx / sprite->transformy); } -static int8_t - ft_set_current_sprite(t_cub *cl, int8_t j) -{ - const int8_t st_o = cl->mlist.st_o[j]; - - if (st_o == 0) - return (4); - else if (st_o >= 1 && st_o <= 7) - return (st_o + 7); - else if (st_o == 8) - return (15); - else if (st_o == 9) - return (17); - else if (st_o >= 10) - return (st_o + 8); - return (0); -} - +#include void ft_calc_sprite(t_cub *cl) { @@ -75,20 +58,17 @@ void i = -1; j = -1; ft_sort_sprites(cl, -1, -1); - while (++j < FT_TOTAL_SPRT) + while (++j < cl->big_t_val) { - while (++i < cl->mlist.sprite_nbr[cl->mlist.st_o[j]] && cl->mlist.st_o[j] != -1 ) - { - sprite = - cl->sprites[cl->mlist.st_o[j]][cl->mlist.sprite_order[ - cl->mlist.st_o[j]][i]]; - sprite.current_sprite = ft_set_current_sprite(cl, j); - 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); - } + sprite = + cl->sprites[(int8_t)cl->big_t[j][2]] + [(int16_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; } } -- cgit v1.2.3