diff options
author | salad <salad@saladesk.desktop> | 2020-03-28 14:50:36 +0100 |
---|---|---|
committer | salad <salad@saladesk.desktop> | 2020-03-28 14:50:36 +0100 |
commit | 5f0d3fb28218ce5ce079683ddf3202d741dd210b (patch) | |
tree | 91ec8fb3f04c0668f9108a7df19a6ff2fc45b682 | |
parent | jattend que ca clique (diff) | |
download | 42-cub3d-5f0d3fb28218ce5ce079683ddf3202d741dd210b.tar.gz 42-cub3d-5f0d3fb28218ce5ce079683ddf3202d741dd210b.tar.bz2 42-cub3d-5f0d3fb28218ce5ce079683ddf3202d741dd210b.tar.xz 42-cub3d-5f0d3fb28218ce5ce079683ddf3202d741dd210b.tar.zst 42-cub3d-5f0d3fb28218ce5ce079683ddf3202d741dd210b.zip |
8 still doesnt swap but its cool
Diffstat (limited to '')
-rw-r--r-- | src/ft_draw_sprite_extra.c | 24 | ||||
-rw-r--r-- | src/ft_sort_s_t.c | 19 |
2 files changed, 24 insertions, 19 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 287d46f..da7a37b 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -72,18 +72,18 @@ void j = -1; ft_sort_sprites(cl, -1, -1); while (++j < FT_TOTAL_SPRT) - { - while (++i < cl->mlist.sprite_nbr[j]) - { - 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); + { + while (cl->mlist.st_o[j] != -1 && ++i < cl->mlist.sprite_nbr[j]) + { + 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); } i = -1; } diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index 8b05f07..6ce1ff3 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -39,11 +39,16 @@ static void int8_t i; int8_t j; - i = 0; j = 0; + i = -1; + while (++i < FT_TOTAL_SPRT) + { + st_o[i] = -1; + } + i = 0; while (i < FT_TOTAL_SPRT) { - if (cl->sprites[i][0].exists == 1) + if (cl->sprites[i]->exists == 1) { st_o[j] = i; j++; @@ -52,10 +57,6 @@ static void else i++; } - i = -1; - ft_printf("------------------------------\n"); - while (++i < FT_TOTAL_SPRT + 1) - ft_printf("%d\n", cl->mlist.st_o[i]); } static void @@ -79,7 +80,7 @@ void ft_init_st(cl, cl->mlist.st_o); while (++i < FT_TOTAL_SPRT) { - if (dist_tab[i][0] < dist_tab[i + 1][0]) + if (cl->mlist.st_o[i] != -1 && 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]; @@ -89,6 +90,10 @@ void } } i = -1; + ft_printf("------------------------------\n"); + while (++i < FT_TOTAL_SPRT + 1) + ft_printf("%d\n", cl->mlist.st_o[i]); + i = -1; while (++i < FT_TOTAL_SPRT + 1) ft_memdel((void*)&dist_tab[i]); ft_memdel((void*)&dist_tab); |