diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-29 15:42:37 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-29 15:42:37 +0200 |
commit | 76cefdc4dc3efa6eb410574a0f5ec42188ba11bd (patch) | |
tree | 755a05ecf1380be7e4011277e7aa657e9a76f6e6 /src/ft_draw_sprite_extra.c | |
parent | Awesome (diff) | |
download | 42-cub3d-76cefdc4dc3efa6eb410574a0f5ec42188ba11bd.tar.gz 42-cub3d-76cefdc4dc3efa6eb410574a0f5ec42188ba11bd.tar.bz2 42-cub3d-76cefdc4dc3efa6eb410574a0f5ec42188ba11bd.tar.xz 42-cub3d-76cefdc4dc3efa6eb410574a0f5ec42188ba11bd.tar.zst 42-cub3d-76cefdc4dc3efa6eb410574a0f5ec42188ba11bd.zip |
Almost
Diffstat (limited to '')
-rw-r--r-- | src/ft_draw_sprite_extra.c | 42 |
1 files changed, 11 insertions, 31 deletions
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 <libft.h> 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; } } |