aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_sort_s_t.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-29 17:34:48 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-29 17:34:48 +0200
commit69ca60b6f989dedc94c2e25ab9927b26d63cbdf8 (patch)
tree28fb01bf9380925e60c19caaf967cb28685ca3bd /src/ft_sort_s_t.c
parentThe greatest (diff)
download42-cub3d-69ca60b6f989dedc94c2e25ab9927b26d63cbdf8.tar.gz
42-cub3d-69ca60b6f989dedc94c2e25ab9927b26d63cbdf8.tar.bz2
42-cub3d-69ca60b6f989dedc94c2e25ab9927b26d63cbdf8.tar.xz
42-cub3d-69ca60b6f989dedc94c2e25ab9927b26d63cbdf8.tar.zst
42-cub3d-69ca60b6f989dedc94c2e25ab9927b26d63cbdf8.zip
Norm
Diffstat (limited to 'src/ft_sort_s_t.c')
-rw-r--r--src/ft_sort_s_t.c110
1 files changed, 0 insertions, 110 deletions
diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c
index 433fd07..18007dd 100644
--- a/src/ft_sort_s_t.c
+++ b/src/ft_sort_s_t.c
@@ -15,116 +15,6 @@
#include <stdlib.h>
#include <stdint.h>
-float
- **ft_alloc_dist_tab(void)
-{
- uint16_t i;
- float **dist_tab;
-
- 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 *)ft_calloc(4096, sizeof(float))))
- return (NULL);
- i++;
- }
- return (dist_tab);
-}
-
-static int8_t
- ft_set_current_sprite(t_cub *cl, int8_t j)
-{
- const int8_t st_o = cl->mlist.st_o[j];
-
- if (st_o == 0)
- return (4);
- else if (st_o >= 1 && st_o <= 7)
- return (st_o + 7);
- else if (st_o == 8)
- return (15);
- else if (st_o == 9)
- return (17);
- else if (st_o >= 10)
- return (st_o + 8);
- return (0);
-}
-
-static void
- ft_alloc_big_t(t_cub *cl)
-{
- int32_t i;
-
- if (!(cl->big_t = (float**)malloc((cl->big_t_val) * sizeof(float*))))
- {
- ft_alloc_error(cl);
- }
- i = 0;
- while (i < cl->big_t_val)
- {
- if (!(cl->big_t[i] = (float*)malloc(4 * sizeof(float))))
- {
- ft_alloc_error(cl);
- }
- i++;
- }
-}
-
-static void
- ft_fill_big_t(float **dist_tab, t_cub *cl)
-{
- int32_t i;
- int32_t j;
- int32_t k;
-
- i = 0;
- j = 0;
- k = 0;
- while (i < cl->big_t_val)
- {
- if (dist_tab[j][k])
- {
- 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;
- cl->big_t[i][3] = (float)k;
- k++;
- i++;
- }
- else
- {
- k = 0;
- j++;
- }
- }
-}
-
-static void
- ft_sort_big_t(t_cub *cl)
-{
- int32_t i;
- int8_t j;
- float tmp[4];
-
- i = 0;
- while (i < cl->big_t_val - 1)
- {
- if (cl->big_t[i][0] < cl->big_t[i + 1][0])
- {
- j = -1;
- while (++j < 4)
- {
- tmp[j] = cl->big_t[i][j];
- cl->big_t[i][j] = cl->big_t[i + 1][j];
- cl->big_t[i + 1][j] = tmp[j];
- }
- i = -1;
- }
- i++;
- }
-}
-
static void
ft_init_st(int32_t *st_o)
{