aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalad <salad@saladesk.desktop>2020-03-25 16:38:34 +0100
committersalad <salad@saladesk.desktop>2020-03-25 16:38:34 +0100
commitfb50b38dbffc812297b1d3980a19ecff070fda4a (patch)
treed69e99b39c1aaac0ddafd8c6f61ff8940fdea4ef
parentnorme, TODO: liks (diff)
download42-cub3d-fb50b38dbffc812297b1d3980a19ecff070fda4a.tar.gz
42-cub3d-fb50b38dbffc812297b1d3980a19ecff070fda4a.tar.bz2
42-cub3d-fb50b38dbffc812297b1d3980a19ecff070fda4a.tar.xz
42-cub3d-fb50b38dbffc812297b1d3980a19ecff070fda4a.tar.zst
42-cub3d-fb50b38dbffc812297b1d3980a19ecff070fda4a.zip
pourquoi se priver de stack
-rw-r--r--src/ft_draw_sprite_extra.c18
-rw-r--r--src/ft_sort_s_t.c4
2 files changed, 10 insertions, 12 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c
index 6503980..0830d2c 100644
--- a/src/ft_draw_sprite_extra.c
+++ b/src/ft_draw_sprite_extra.c
@@ -54,23 +54,23 @@ void
int32_t i;
int32_t j;
- i = 0;
- j = 0;
+ i = -1;
+ j = -1;
ft_sort_sprites(cl, -1, -1);
- while (j < cl->mlist.sprite_var)
+ while (++j < cl->mlist.sprite_var)
{
- 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[cl->mlist.st_o[j]][i]];
- sprite.current_sprite = (cl->mlist.st_o[j] == 0) ? 4 : cl->mlist.st_o[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);
ft_sprite_h_w(cl, &sprite);
ft_draw_sprite(cl, &sprite);
- i++;
}
- i = 0;
- j++;
+ i = -1;
}
}
diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c
index c1378c7..24ed358 100644
--- a/src/ft_sort_s_t.c
+++ b/src/ft_sort_s_t.c
@@ -29,11 +29,9 @@ void
{
int16_t i;
int32_t tmp;
- float *tmp_i;
+ float tmp_i[4096];
i = -1;
- if (!(tmp_i = ft_calloc(sizeof(int32_t), 4096)))
- return ;
ft_init_st(cl->mlist.sprite_var, cl->mlist.st_o);
while (++i < cl->mlist.sprite_var)
if (dist_tab[i][0] < dist_tab[i + 1][0])