aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_raycasting.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_raycasting.c')
-rw-r--r--src/ft_raycasting.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index bf84b9e..9657b18 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -13,6 +13,7 @@
#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -71,11 +72,16 @@ void
{
uint16_t i;
t_win *wl;
+ float *dist_tab;
wl = &cl->wlist;
i = (wl->y_size / 2) + 1;
while (++i < wl->y_size)
ft_floor_cast(i, cl);
+ if (!(dist_tab = malloc(sizeof(float) * cl->wlist.x_size)))
+ return ;
+ if (!(cl->rlist.wall_dist_tab = malloc(sizeof(float) * cl->wlist.x_size)))
+ return ;
i = 0;
while (i < wl->x_size)
{
@@ -90,6 +96,8 @@ void
ft_choose_tex(cl);
ft_calc_tex(cl);
ft_draw_verline(cl, i, cl->rlist.wall_t, cl->rlist.wall_b);
+ dist_tab[i] = cl->rlist.wall_dist;
+ cl->rlist.wall_dist_tab = dist_tab;
i++;
}
}