diff options
author | salad <salad@saladesk.desktop> | 2020-03-27 22:23:03 +0100 |
---|---|---|
committer | salad <salad@saladesk.desktop> | 2020-03-27 22:23:03 +0100 |
commit | 96534d2121cd9097da83b69ea5947ea93b736edc (patch) | |
tree | 92ae970a34d4b72d47c1add1452d4fd8ec5fc0c7 /src | |
parent | Map update (diff) | |
download | 42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.tar.gz 42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.tar.bz2 42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.tar.xz 42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.tar.zst 42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.zip |
jattend que ca clique
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_draw_sprite_extra.c | 2 | ||||
-rw-r--r-- | src/ft_get_sprite_spawns.c | 2 | ||||
-rw-r--r-- | src/ft_sort_s_t.c | 23 |
3 files changed, 20 insertions, 7 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 5133231..287d46f 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -73,7 +73,7 @@ void ft_sort_sprites(cl, -1, -1); while (++j < FT_TOTAL_SPRT) { - while (++i < cl->mlist.sprite_nbr[j]) + while (++i < cl->mlist.sprite_nbr[j]) { sprite = cl->sprites[cl->mlist.st_o[j]][cl->mlist.sprite_order[ diff --git a/src/ft_get_sprite_spawns.c b/src/ft_get_sprite_spawns.c index 047523a..0dc0f7a 100644 --- a/src/ft_get_sprite_spawns.c +++ b/src/ft_get_sprite_spawns.c @@ -73,6 +73,7 @@ int8_t if (clist->mlist.map[y][x] == c) { clist->mlist.sprite_nbr[s_n]++; + clist->sprites[s_n][i].exists = 1; clist->sprites[s_n][i].s_pos_x = x; clist->sprites[s_n][i].s_pos_y = y; i++; @@ -105,6 +106,7 @@ void if (ft_ischarset("2", clist->mlist.map[y][x])) { clist->mlist.sprite_nbr[0]++; + clist->sprites[0][i].exists = 1; clist->sprites[0][i].s_pos_x = x; clist->sprites[0][i].s_pos_y = y; i++; diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index 8b70fe5..8b05f07 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -34,16 +34,28 @@ float } static void - ft_init_st(int32_t *st_o) + ft_init_st(t_cub *cl, int32_t *st_o) { int8_t i; + int8_t j; i = 0; + j = 0; while (i < FT_TOTAL_SPRT) { - st_o[i] = i; - i++; + if (cl->sprites[i][0].exists == 1) + { + st_o[j] = i; + j++; + i++; + } + else + i++; } + i = -1; + ft_printf("------------------------------\n"); + while (++i < FT_TOTAL_SPRT + 1) + ft_printf("%d\n", cl->mlist.st_o[i]); } static void @@ -64,11 +76,10 @@ void int32_t tmp; i = -1; - ft_init_st(cl->mlist.st_o); + ft_init_st(cl, cl->mlist.st_o); while (++i < FT_TOTAL_SPRT) { - if (dist_tab[i][0] - && dist_tab[i][0] < dist_tab[i + 1][0]) + if (dist_tab[i][0] < dist_tab[i + 1][0]) { tmp = cl->mlist.st_o[i]; cl->mlist.st_o[i] = cl->mlist.st_o[i + 1]; |