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, 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++;
}
}