aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_draw_sprite_extra.c2
-rw-r--r--src/ft_get_sprite_spawns.c2
-rw-r--r--src/ft_sort_s_t.c23
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];