diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-02 14:35:55 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-02 14:35:55 +0200 |
commit | 20e9cfd5bf432b0e68b4e2fd3b721f1fcea8c839 (patch) | |
tree | afea14915414c45325b9f0e4d8f64ee35935d101 /src/ft_detect.c | |
parent | Correct dir_x dir_y sqy sqx (diff) | |
download | 42-cub3d-20e9cfd5bf432b0e68b4e2fd3b721f1fcea8c839.tar.gz 42-cub3d-20e9cfd5bf432b0e68b4e2fd3b721f1fcea8c839.tar.bz2 42-cub3d-20e9cfd5bf432b0e68b4e2fd3b721f1fcea8c839.tar.xz 42-cub3d-20e9cfd5bf432b0e68b4e2fd3b721f1fcea8c839.tar.zst 42-cub3d-20e9cfd5bf432b0e68b4e2fd3b721f1fcea8c839.zip |
Correct ray dir
Diffstat (limited to 'src/ft_detect.c')
-rw-r--r-- | src/ft_detect.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ft_detect.c b/src/ft_detect.c index 44e5bb2..a944a0f 100644 --- a/src/ft_detect.c +++ b/src/ft_detect.c @@ -17,10 +17,10 @@ void ft_detection_init_y(t_cub *cl) { - cl->rlist.y_delta_dist = sqrt(1 + (cl->rlist.x_ray_dir * - cl->rlist.x_ray_dir) / (cl->rlist.y_ray_dir * - cl->rlist.y_ray_dir)); - if (cl->rlist.y_ray_dir < 0) + cl->rlist.y_delta_dist = sqrt(1 + (cl->rlist.y_ray_dir * + cl->rlist.y_ray_dir) / (cl->rlist.x_ray_dir * + cl->rlist.x_ray_dir)); + if (cl->rlist.x_ray_dir < 0) { cl->mlist.y_step = -1; cl->rlist.y_side_dist = (cl->rlist.y_ray_pos - @@ -37,10 +37,10 @@ void void ft_detection_init_x(t_cub *cl) { - cl->rlist.x_delta_dist = sqrt(1 + (cl->rlist.y_ray_dir * - cl->rlist.y_ray_dir) / (cl->rlist.x_ray_dir * - cl->rlist.x_ray_dir)); - if (cl->rlist.x_ray_dir < 0) + cl->rlist.x_delta_dist = sqrt(1 + (cl->rlist.x_ray_dir * + cl->rlist.x_ray_dir) / (cl->rlist.y_ray_dir * + cl->rlist.y_ray_dir)); + if (cl->rlist.y_ray_dir < 0) { cl->mlist.x_step = -1; cl->rlist.x_side_dist = (cl->rlist.x_ray_pos - |