aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_draw_sprite_extra.c4
-rw-r--r--src/ft_init_map.c1
-rw-r--r--src/ft_sort_s_t.c32
3 files changed, 30 insertions, 7 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c
index 323906a..6503980 100644
--- a/src/ft_draw_sprite_extra.c
+++ b/src/ft_draw_sprite_extra.c
@@ -61,8 +61,8 @@ void
{
while (i < cl->mlist.sprite_nbr[j])
{
- sprite = cl->sprites[j][cl->mlist.sprite_order[j][i]];
- sprite.current_sprite = (j == 0) ? 4 : j + 7;
+ sprite = cl->sprites[cl->mlist.st_o[j]][cl->mlist.sprite_order[cl->mlist.st_o[j]][i]];
+ sprite.current_sprite = (cl->mlist.st_o[j] == 0) ? 4 : cl->mlist.st_o[j] + 7;
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);
diff --git a/src/ft_init_map.c b/src/ft_init_map.c
index 9ddbb47..d252f2e 100644
--- a/src/ft_init_map.c
+++ b/src/ft_init_map.c
@@ -66,6 +66,7 @@ int8_t
mlist->topsp = 0;
ft_bzero(mlist->sprite_nbr, 4096);
ft_bzero(mlist->sprite_order, 4096);
+ ft_bzero(mlist->st_o, 4096);
ft_bzero(mlist->traps_order, 512);
ft_bzero(mlist->heals_order, 64);
mlist->weaps_nbr[0] = 0;
diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c
index f015abc..702d5e6 100644
--- a/src/ft_sort_s_t.c
+++ b/src/ft_sort_s_t.c
@@ -20,18 +20,40 @@
/*clearpilled*/
void
+ft_init_st(int32_t st_o[8])
+{
+ int8_t i;
+
+ i = -1;
+ while (++i < 3)
+ st_o[i] = i;
+}
+
+void
ft_sort_s_t(t_cub *cl, float dist_tab[8][4096])
{
- uint16_t i;
+ int16_t i;
int32_t tmp;
+ float *tmp_i;
- i = 0;
- while (i < cl->mlist.sprite_var)
+ i = -1;
+ ft_init_st(cl->mlist.st_o);
+ tmp_i = ft_calloc(sizeof(int32_t), 4096);
+ while (++i < cl->mlist.sprite_var)
{
if (dist_tab[i][0] < dist_tab[i + 1][0])
{
- i = 0;
+ tmp = cl->mlist.st_o[i];
+ cl->mlist.st_o[i] = cl->mlist.st_o[i + 1];
+ cl->mlist.st_o[i + 1] = tmp;
+ ft_memcpy(tmp_i, dist_tab[i], 4096);
+ ft_memcpy(dist_tab[i], dist_tab[i + 1], 4096);
+ ft_memcpy(dist_tab[i + 1], tmp_i, 4096);
+ i = -1;
}
- i++;
}
+ i = -1;
+ while (++i < 3)
+ printf("%d\n", cl->mlist.st_o[i]);
+ puts("-------------------------");
}