From 7d50a78eed9c6cfce3288c471b9f3e6367bfe040 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Mon, 9 Mar 2020 17:50:45 +0100 Subject: gang --- src/ft_raycasting.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ft_raycasting.c') 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++; } } -- cgit v1.2.3