diff options
Diffstat (limited to 'src/ft_raycasting.c')
-rw-r--r-- | src/ft_raycasting.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index baa71af..5c57044 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -76,24 +76,25 @@ static void if (cl->rlist.wall_t < 0) cl->rlist.wall_t = 0; cl->rlist.wall_b = cl->rlist.line_h / 2 + wl->y_size / 2; - if (cl->rlist.wall_b >= (float)wl->y_size) + if (cl->rlist.wall_b >= (int16_t)wl->y_size) cl->rlist.wall_b = wl->y_size - 1; + cl->rlist.wall_bz[i] = cl->rlist.wall_b; } void ft_castray(t_cub *cl) { - uint16_t i; - t_win *wl; + uint16_t i; + t_win *wl; ft_memdel((void**)&cl->rlist.wall_dist_tab); wl = &cl->wlist; - i = (wl->y_size / 2) + 1; - while (++i < wl->y_size) - ft_floor_cast(i, cl); if (!(cl->rlist.wall_dist_tab = (float*)malloc(sizeof(float) * cl->wlist.x_size))) return ; + if (!(cl->rlist.wall_bz = + (int16_t*)malloc(cl->wlist.x_size * sizeof(int16_t)))) + return ; i = 0; while (i < wl->x_size) { @@ -104,4 +105,7 @@ void cl->rlist.wall_dist_tab[i] = cl->rlist.wall_dist; i++; } + ft_floor_cast(cl); + i = 0; + ft_memdel((void**)&cl->rlist.wall_bz); } |