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.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index 1a12c46..3429f20 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -71,13 +71,16 @@ static void
{
ft_initray(i, cl);
cl->rlist.line_h = (int16_t)(wl->y_size / cl->rlist.wall_dist);
+ cl->rlist.line_h_tab[i] = cl->rlist.line_h;
cl->rlist.wall_t = -cl->rlist.line_h / 2 + wl->y_size / 2;
if (cl->rlist.wall_t < 0)
cl->rlist.wall_t = 0;
+ cl->rlist.wall_t_tab[i] = cl->rlist.wall_t;
cl->rlist.wall_b = cl->rlist.line_h / 2 + wl->y_size / 2;
if (cl->rlist.wall_b >= (int16_t)wl->y_size)
cl->rlist.wall_b = wl->y_size - 1;
- ft_choose_tex(cl);
+ cl->rlist.wall_b_tab[i] = cl->rlist.wall_b;
+ ft_choose_tex(i, cl);
ft_calc_tex(cl);
cl->rlist.wall_bz[i] = cl->rlist.wall_b;
cl->rlist.wall_dist_tab[i] = cl->rlist.wall_dist;
@@ -94,11 +97,20 @@ void
if (!(cl->rlist.wall_bz =
(int16_t*)malloc(cl->wlist.x_size * sizeof(int16_t))))
return ;
+ cl->rlist.w_side_tab = (uint8_t*)ft_calloc(cl->wlist.x_size, sizeof(uint8_t));
+ cl->rlist.line_h_tab = (uint16_t*)ft_calloc(cl->wlist.x_size, sizeof(uint16_t));
+ cl->rlist.wall_t_tab = (int16_t*)ft_calloc(cl->wlist.x_size, sizeof(int16_t));
+ cl->rlist.wall_b_tab = (int16_t*)ft_calloc(cl->wlist.x_size, sizeof(int16_t));
i = 0;
while (i < cl->wlist.x_size)
{
ft_castray_loop(i, &cl->wlist, cl);
- ft_draw_verline(cl, i, cl->rlist.wall_t, cl->rlist.wall_b);
+ i++;
+ }
+ i = 0;
+ while (i < cl->wlist.x_size)
+ {
+ ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_b_tab[i]);
i++;
}
ft_floor_cast(cl);
@@ -108,6 +120,10 @@ void
ft_calc_weaps(cl);
if (cl->plist.handles_weapon > -1)
ft_draw_handweap(cl);
+ ft_memdel((void*)&cl->rlist.wall_t_tab);
+ ft_memdel((void*)&cl->rlist.wall_b_tab);
+ ft_memdel((void*)&cl->rlist.w_side_tab);
+ ft_memdel((void*)&cl->rlist.line_h_tab);
ft_memdel((void*)&cl->rlist.wall_dist_tab);
ft_memdel((void*)&cl->rlist.wall_bz);
}