diff options
-rw-r--r-- | src/ft_draw_sprite.c | 52 | ||||
-rw-r--r-- | src/ft_sort_s_t.c | 9 |
2 files changed, 31 insertions, 30 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c index dc6f54f..fcc2a8b 100644 --- a/src/ft_draw_sprite.c +++ b/src/ft_draw_sprite.c @@ -16,25 +16,25 @@ #include <stdlib.h> #include <math.h> -static void - ft_sort_sprites_norme(float *dist_tab, int16_t *i, uint16_t j, t_cub *cl) -{ - uint32_t tmp; - uint32_t it; +/* static void */ +/* ft_sort_sprites_norme(float *dist_tab, int16_t *i, uint16_t j, t_cub *cl) */ +/* { */ +/* uint32_t tmp; */ +/* uint32_t it; */ - it = *i; - tmp = 0; - if (dist_tab[it] < dist_tab[it + 1]) - { - tmp = dist_tab[it]; - dist_tab[it] = dist_tab[it + 1]; - dist_tab[it + 1] = tmp; - tmp = cl->mlist.sprite_order[j][it]; - cl->mlist.sprite_order[j][it] = cl->mlist.sprite_order[j][it + 1]; - cl->mlist.sprite_order[j][it + 1] = tmp; - *i = -1; - } -} +/* it = *i; */ +/* tmp = 0; */ +/* if (dist_tab[it] < dist_tab[it + 1]) */ +/* { */ +/* tmp = dist_tab[it]; */ +/* dist_tab[it] = dist_tab[it + 1]; */ +/* dist_tab[it + 1] = tmp; */ +/* tmp = cl->mlist.sprite_order[j][it]; */ +/* cl->mlist.sprite_order[j][it] = cl->mlist.sprite_order[j][it + 1]; */ +/* cl->mlist.sprite_order[j][it + 1] = tmp; */ +/* *i = -1; */ +/* } */ +/* } */ void ft_sort_sprites(t_cub *cl, int16_t it, int16_t jt) @@ -52,17 +52,17 @@ void (cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) + (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y) * (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y)); - cl->mlist.sprite_order[jt][it] = it; + /* cl->mlist.sprite_order[jt][it] = it; */ } it = -1; } - jt = -1; - while (++jt < FT_TOTAL_SPRT) - { - it = -1; - while (++it < cl->mlist.sprite_nbr[jt] - 1) - ft_sort_sprites_norme(dist_tab[jt], &it, jt, cl); - } + /* jt = -1; */ + /* while (++jt < FT_TOTAL_SPRT) */ + /* { */ + /* it = -1; */ + /* while (++it < cl->mlist.sprite_nbr[jt] - 1) */ + /* ft_sort_sprites_norme(dist_tab[jt], &it, jt, cl); */ + /* } */ ft_sort_s_t(cl, dist_tab); } diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index bcf033f..f51437e 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -21,12 +21,12 @@ float uint16_t i; float **dist_tab; - if (!(dist_tab = (float **)malloc((FT_TOTAL_SPRT + 1) * sizeof(float*)))) + if (!(dist_tab = (float **)ft_calloc((FT_TOTAL_SPRT + 1), sizeof(float*)))) return (NULL); i = 0; while (i < FT_TOTAL_SPRT + 1) { - if (!(dist_tab[i] = (float *)malloc(4096 * sizeof(float)))) + if (!(dist_tab[i] = (float *)ft_calloc(4096, sizeof(float)))) return (NULL); i++; } @@ -67,11 +67,11 @@ static void i = 0; j = 0; k = 0; + ft_printf("%d %d %d %d %d %d %d %d\n", (int32_t)dist_tab[8][0], (int32_t)dist_tab[8][1], (int32_t)dist_tab[8][2], (int32_t)dist_tab[8][3], (int32_t)dist_tab[8][4], (int32_t)dist_tab[8][5], (int32_t)dist_tab[8][6], (int32_t)dist_tab[8][7]); while (i < cl->big_t_val) { if (dist_tab[j][k]) { - ft_printf("%d\n", j); cl->big_t[i][0] = dist_tab[j][k]; cl->big_t[i][1] = (float)ft_set_current_sprite(cl, j); cl->big_t[i][2] = (float)j; @@ -95,6 +95,7 @@ static void j = -1; i = -1; + (void)dist_tab; while (++i < FT_TOTAL_SPRT) st_o[i] = -1; i = -1; @@ -103,7 +104,7 @@ static void if (cl->mlist.sprite_nbr[i] > 0) { st_o[++j] = i; - ft_memcpy(dist_tab[j], dist_tab[i], 4096 * sizeof(float)); + /* ft_memcpy(dist_tab[j], dist_tab[i], 4096 * sizeof(float)); */ } } } |