From 8a695d62dcb9b8783918263f962b986df20310f2 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 2 Apr 2020 14:24:57 +0200 Subject: Correct dir_x dir_y sqy sqx --- src/ft_castray_loop.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ft_castray_loop.c') diff --git a/src/ft_castray_loop.c b/src/ft_castray_loop.c index 28277a7..3d12680 100644 --- a/src/ft_castray_loop.c +++ b/src/ft_castray_loop.c @@ -47,21 +47,21 @@ void pl->cam_x = 2 * i / (float)(wl->x_size) - 1; cl->rlist.x_ray_pos = pl->pos_y; cl->rlist.y_ray_pos = pl->pos_x; - cl->rlist.x_ray_dir = pl->dir_x + pl->plane_x * + cl->rlist.x_ray_dir = pl->dir_y + pl->plane_x * pl->cam_x; - cl->rlist.y_ray_dir = pl->dir_y + pl->plane_y * + cl->rlist.y_ray_dir = pl->dir_x + pl->plane_y * pl->cam_x; - cl->rlist.sqx = (int16_t)cl->rlist.x_ray_pos; - cl->rlist.sqy = (int16_t)cl->rlist.y_ray_pos; + cl->rlist.sqy = (int16_t)cl->rlist.x_ray_pos; + cl->rlist.sqx = (int16_t)cl->rlist.y_ray_pos; ft_detect(cl); if (cl->rlist.side == 0) { - cl->rlist.wall_dist = (cl->rlist.sqx - cl->rlist.x_ray_pos + + cl->rlist.wall_dist = (cl->rlist.sqy - cl->rlist.x_ray_pos + (1 - cl->mlist.x_step) / 2) / cl->rlist.x_ray_dir; } else { - cl->rlist.wall_dist = (cl->rlist.sqy - cl->rlist.y_ray_pos + + cl->rlist.wall_dist = (cl->rlist.sqx - cl->rlist.y_ray_pos + (1 - cl->mlist.y_step) / 2) / cl->rlist.y_ray_dir; } } -- cgit v1.2.3