aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_raycasting.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p1.le-101.fr>2020-03-08 18:35:05 +0100
committerRudy Bousset <rbousset@z2r4p1.le-101.fr>2020-03-08 18:35:05 +0100
commitbd93fcfe2968be72114c8b7a2a2b76b27a071925 (patch)
treefe1d85e4b6fbc0791b679aaf49c02583db8e3dfc /src/ft_raycasting.c
parentWe close (diff)
download42-cub3d-bd93fcfe2968be72114c8b7a2a2b76b27a071925.tar.gz
42-cub3d-bd93fcfe2968be72114c8b7a2a2b76b27a071925.tar.bz2
42-cub3d-bd93fcfe2968be72114c8b7a2a2b76b27a071925.tar.xz
42-cub3d-bd93fcfe2968be72114c8b7a2a2b76b27a071925.tar.zst
42-cub3d-bd93fcfe2968be72114c8b7a2a2b76b27a071925.zip
Jimi Hendrix would be proud
Diffstat (limited to '')
-rw-r--r--src/ft_raycasting.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index 0a4b8b5..121e132 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -74,6 +74,12 @@ void
else if (clist->rlist.side == 1 && clist->rlist.y_ray_dir < 0)
clist->tlist[clist->w_side].tex_x = clist->tlist[clist->w_side].img_w
- clist->tlist[clist->w_side].tex_x - 1;
+ if (clist->rlist.side == 0)
+ clist->rlist.perp_wall_dist = ((uint32_t)clist->plist.pos_x
+ - clist->plist.pos_x + (1 - clist->mlist.x_step) / 2) / clist->rlist.x_ray_dir;
+ else
+ clist->rlist.perp_wall_dist = ((uint32_t)clist->plist.pos_y
+ - clist->plist.pos_y + (1 - clist->mlist.y_step) / 2) / clist->rlist.y_ray_dir;
}
static void