aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_castray_loop.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-02 14:38:20 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-02 14:38:20 +0200
commitaf3d4799702da402d224d2d22697b30790e1639d (patch)
treec0aeb7d17100b958ab23c123fd5adc3a5ffa9eb1 /src/ft_castray_loop.c
parentCorrect ray dir (diff)
download42-cub3d-af3d4799702da402d224d2d22697b30790e1639d.tar.gz
42-cub3d-af3d4799702da402d224d2d22697b30790e1639d.tar.bz2
42-cub3d-af3d4799702da402d224d2d22697b30790e1639d.tar.xz
42-cub3d-af3d4799702da402d224d2d22697b30790e1639d.tar.zst
42-cub3d-af3d4799702da402d224d2d22697b30790e1639d.zip
Correct ray_pos
Diffstat (limited to 'src/ft_castray_loop.c')
-rw-r--r--src/ft_castray_loop.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ft_castray_loop.c b/src/ft_castray_loop.c
index e10a48b..167ee1d 100644
--- a/src/ft_castray_loop.c
+++ b/src/ft_castray_loop.c
@@ -45,23 +45,23 @@ void
wl = &cl->wlist;
pl = &cl->plist;
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.y_ray_pos = pl->pos_y;
+ cl->rlist.x_ray_pos = pl->pos_x;
cl->rlist.y_ray_dir = pl->dir_y + pl->plane_x *
pl->cam_x;
cl->rlist.x_ray_dir = pl->dir_x + pl->plane_y *
pl->cam_x;
- cl->rlist.sqy = (int16_t)cl->rlist.x_ray_pos;
- cl->rlist.sqx = (int16_t)cl->rlist.y_ray_pos;
+ cl->rlist.sqy = (int16_t)cl->rlist.y_ray_pos;
+ cl->rlist.sqx = (int16_t)cl->rlist.x_ray_pos;
ft_detect(cl);
if (cl->rlist.side == 0)
{
- cl->rlist.wall_dist = (cl->rlist.sqy - cl->rlist.x_ray_pos +
+ cl->rlist.wall_dist = (cl->rlist.sqy - cl->rlist.y_ray_pos +
(1 - cl->mlist.x_step) / 2) / cl->rlist.y_ray_dir;
}
else
{
- cl->rlist.wall_dist = (cl->rlist.sqx - cl->rlist.y_ray_pos +
+ cl->rlist.wall_dist = (cl->rlist.sqx - cl->rlist.x_ray_pos +
(1 - cl->mlist.y_step) / 2) / cl->rlist.x_ray_dir;
}
}