aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_raycasting.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-03-09 18:53:35 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-03-09 18:53:35 +0100
commit00f719e87a853f1c0b5dfc7085f605b452e75314 (patch)
tree1af5b195d41e26a284bec552aa9f07e4cc217db8 /src/ft_raycasting.c
parentNorme (diff)
parentgang (diff)
download42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.tar.gz
42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.tar.bz2
42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.tar.xz
42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.tar.zst
42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.zip
Merge branch 'shpritz'
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++;
}
}