aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_detect.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_detect.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_detect.c')
-rw-r--r--src/ft_detect.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ft_detect.c b/src/ft_detect.c
index a944a0f..c7bdcbb 100644
--- a/src/ft_detect.c
+++ b/src/ft_detect.c
@@ -23,14 +23,14 @@ void
if (cl->rlist.x_ray_dir < 0)
{
cl->mlist.y_step = -1;
- cl->rlist.y_side_dist = (cl->rlist.y_ray_pos -
+ cl->rlist.y_side_dist = (cl->rlist.x_ray_pos -
cl->rlist.sqx) * cl->rlist.y_delta_dist;
}
else
{
cl->mlist.y_step = 1;
cl->rlist.y_side_dist = (cl->rlist.sqx + 1.0 -
- cl->rlist.y_ray_pos) * cl->rlist.y_delta_dist;
+ cl->rlist.x_ray_pos) * cl->rlist.y_delta_dist;
}
}
@@ -43,14 +43,14 @@ void
if (cl->rlist.y_ray_dir < 0)
{
cl->mlist.x_step = -1;
- cl->rlist.x_side_dist = (cl->rlist.x_ray_pos -
+ cl->rlist.x_side_dist = (cl->rlist.y_ray_pos -
cl->rlist.sqy) * cl->rlist.x_delta_dist;
}
else
{
cl->mlist.x_step = 1;
cl->rlist.x_side_dist = (cl->rlist.sqy + 1.0 -
- cl->rlist.x_ray_pos) * cl->rlist.x_delta_dist;
+ cl->rlist.y_ray_pos) * cl->rlist.x_delta_dist;
}
}