diff options
author | salad <salad@saladesk.desktop> | 2020-03-28 15:50:34 +0100 |
---|---|---|
committer | salad <salad@saladesk.desktop> | 2020-03-28 15:50:34 +0100 |
commit | 8fa58fb7a2a363534468ddbb0f0dafe6f577b3fd (patch) | |
tree | f0bcd656114d72f0a422c7e9411fad24bf561f3b /src | |
parent | 8 still doesnt swap but its cool (diff) | |
download | 42-cub3d-8fa58fb7a2a363534468ddbb0f0dafe6f577b3fd.tar.gz 42-cub3d-8fa58fb7a2a363534468ddbb0f0dafe6f577b3fd.tar.bz2 42-cub3d-8fa58fb7a2a363534468ddbb0f0dafe6f577b3fd.tar.xz 42-cub3d-8fa58fb7a2a363534468ddbb0f0dafe6f577b3fd.tar.zst 42-cub3d-8fa58fb7a2a363534468ddbb0f0dafe6f577b3fd.zip |
ez
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_draw_sprite_extra.c | 6 | ||||
-rw-r--r-- | src/ft_sort_s_t.c | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index da7a37b..4599ff4 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -12,6 +12,7 @@ #include <cub3d.h> #include <stdint.h> +#include <stdio.h> #include <stdlib.h> void @@ -71,10 +72,11 @@ void i = -1; j = -1; ft_sort_sprites(cl, -1, -1); - while (++j < FT_TOTAL_SPRT) + while (++j < 9) { - while (cl->mlist.st_o[j] != -1 && ++i < cl->mlist.sprite_nbr[j]) + while (++i < cl->mlist.sprite_nbr[cl->mlist.st_o[j]] && cl->mlist.st_o[j] != -1 ) { + /* printf("j : %d tab : [%d]\n", j, cl->mlist.st_o[j]); */ sprite = cl->sprites[cl->mlist.st_o[j]][cl->mlist.sprite_order[ cl->mlist.st_o[j]][i]]; diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index 6ce1ff3..0f87e9f 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -34,7 +34,7 @@ float } static void - ft_init_st(t_cub *cl, int32_t *st_o) +ft_init_st(t_cub *cl, int32_t *st_o, float **dist_tab) { int8_t i; int8_t j; @@ -45,17 +45,15 @@ static void { st_o[i] = -1; } - i = 0; - while (i < FT_TOTAL_SPRT) + i = -1; + while (++i < FT_TOTAL_SPRT) { - if (cl->sprites[i]->exists == 1) + if (cl->sprites[i][0].exists == 1) { st_o[j] = i; + ft_memcpy(dist_tab[j], dist_tab[i], 4096); j++; - i++; } - else - i++; } } @@ -77,7 +75,7 @@ void int32_t tmp; i = -1; - ft_init_st(cl, cl->mlist.st_o); + ft_init_st(cl, cl->mlist.st_o, dist_tab); while (++i < FT_TOTAL_SPRT) { if (cl->mlist.st_o[i] != -1 && dist_tab[i][0] < dist_tab[i + 1][0]) |