aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_raycasting.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-08 02:47:01 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-08 02:47:01 +0100
commitde7d432e18f4363e73b11f23885d7afd002a99f0 (patch)
treeb2321f6c77d19147892541b2de619681372beeb0 /src/ft_raycasting.c
parentNot great (diff)
download42-cub3d-de7d432e18f4363e73b11f23885d7afd002a99f0.tar.gz
42-cub3d-de7d432e18f4363e73b11f23885d7afd002a99f0.tar.bz2
42-cub3d-de7d432e18f4363e73b11f23885d7afd002a99f0.tar.xz
42-cub3d-de7d432e18f4363e73b11f23885d7afd002a99f0.tar.zst
42-cub3d-de7d432e18f4363e73b11f23885d7afd002a99f0.zip
I'm close af
Diffstat (limited to 'src/ft_raycasting.c')
-rw-r--r--src/ft_raycasting.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index 50bdbf9..0a4b8b5 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -77,7 +77,7 @@ void
}
static void
- ft_initray(t_cub *cl, uint16_t i)
+ ft_initray(uint16_t i, t_cub *cl)
{
t_win *wl;
t_player *pl;
@@ -100,8 +100,10 @@ static void
(1 - cl->mlist.x_step) / 2) / cl->rlist.x_ray_dir;
}
else
+ {
cl->rlist.wall_dist = (cl->rlist.sqy - cl->rlist.y_ray_pos +
(1 - cl->mlist.y_step) / 2) / cl->rlist.y_ray_dir;
+ }
}
void
@@ -114,7 +116,8 @@ void
wl = &cl->wlist;
while (i < wl->x_size)
{
- ft_initray(cl, i);
+ ft_initray(i, cl);
+ ft_floor_cast(cl);
cl->rlist.line_h = (int16_t)(wl->y_size / cl->rlist.wall_dist);
cl->rlist.wall_t = -cl->rlist.line_h / 2 + wl->y_size / 2;
if (cl->rlist.wall_t < 0)