aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_raycasting.c
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2020-03-09 17:50:45 +0100
committersalaaad2 <arthurdurant263@gmail.com>2020-03-09 17:50:45 +0100
commit7d50a78eed9c6cfce3288c471b9f3e6367bfe040 (patch)
treedc53123db1690b93a1b2e00c842ff16251662937 /src/ft_raycasting.c
parentsprites ont des jambes (diff)
download42-cub3d-7d50a78eed9c6cfce3288c471b9f3e6367bfe040.tar.gz
42-cub3d-7d50a78eed9c6cfce3288c471b9f3e6367bfe040.tar.bz2
42-cub3d-7d50a78eed9c6cfce3288c471b9f3e6367bfe040.tar.xz
42-cub3d-7d50a78eed9c6cfce3288c471b9f3e6367bfe040.tar.zst
42-cub3d-7d50a78eed9c6cfce3288c471b9f3e6367bfe040.zip
gang
Diffstat (limited to 'src/ft_raycasting.c')
-rw-r--r--src/ft_raycasting.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index 2c4b05c..464eb95 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -71,7 +71,12 @@ ft_castray(t_cub *cl)
{
uint16_t i;
t_win *wl;
+ float *dist_tab;
+ 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;
wl = cl->wlist;
while (i < wl->x_size)
@@ -87,7 +92,8 @@ ft_castray(t_cub *cl)
ft_choose_tex(cl);
ft_calc_tex(cl);
ft_draw_verline(cl, i, cl->rlist.wall_t, cl->rlist.wall_b);
- cl->rlist.wall_dist_tab[i] = cl->rlist.wall_dist;
+ dist_tab[i] = cl->rlist.wall_dist;
+ cl->rlist.wall_dist_tab = dist_tab;
i++;
}
}