From 8866ef5699150d0549096efa94fc311ff7a48dc7 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 3 Mar 2020 14:47:33 +0100 Subject: Changing stuff --- src/ft_detect.c | 64 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/ft_detect.c') diff --git a/src/ft_detect.c b/src/ft_detect.c index a8b5a6c..864b2b2 100644 --- a/src/ft_detect.c +++ b/src/ft_detect.c @@ -17,40 +17,40 @@ static 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.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->y_step = -1; - cl->rlist.y_side_dist = (cl->rlist.y_ray_pos - - cl->rlist.sqy) * cl->rlist.y_delta_dist; + cl.mlist.y_step = -1; + cl.rlist.y_side_dist = (cl.rlist.y_ray_pos - + cl.rlist.sqy) * cl.rlist.y_delta_dist; } else { - cl->mlist->y_step = 1; - cl->rlist.y_side_dist = (cl->rlist.sqy + 1.0 - - cl->rlist.y_ray_pos) * cl->rlist.y_delta_dist; + cl.mlist.y_step = 1; + cl.rlist.y_side_dist = (cl.rlist.sqy + 1.0 - + cl.rlist.y_ray_pos) * cl.rlist.y_delta_dist; } } static 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.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->x_step = -1; - cl->rlist.x_side_dist = (cl->rlist.x_ray_pos - - cl->rlist.sqx) * cl->rlist.x_delta_dist; + cl.mlist.x_step = -1; + cl.rlist.x_side_dist = (cl.rlist.x_ray_pos - + cl.rlist.sqx) * cl.rlist.x_delta_dist; } else { - cl->mlist->x_step = 1; - cl->rlist.x_side_dist = (cl->rlist.sqx + 1.0 - - cl->rlist.x_ray_pos) * cl->rlist.x_delta_dist; + cl.mlist.x_step = 1; + cl.rlist.x_side_dist = (cl.rlist.sqx + 1.0 - + cl.rlist.x_ray_pos) * cl.rlist.x_delta_dist; } } @@ -59,23 +59,23 @@ void { ft_detection_init_x(cl); ft_detection_init_y(cl); - cl->rlist.hit = 0; - while (cl->rlist.hit == 0) + cl.rlist.hit = 0; + while (cl.rlist.hit == 0) { - if (cl->rlist.x_side_dist < cl->rlist.y_side_dist) + if (cl.rlist.x_side_dist < cl.rlist.y_side_dist) { - cl->rlist.x_side_dist += cl->rlist.x_delta_dist; - cl->rlist.sqx += cl->mlist->x_step; - cl->rlist.side = 0; + cl.rlist.x_side_dist += cl.rlist.x_delta_dist; + cl.rlist.sqx += cl.mlist.x_step; + cl.rlist.side = 0; } else { - cl->rlist.y_side_dist += cl->rlist.y_delta_dist; - cl->rlist.sqy += cl->mlist->y_step; - cl->rlist.side = 1; + cl.rlist.y_side_dist += cl.rlist.y_delta_dist; + cl.rlist.sqy += cl.mlist.y_step; + cl.rlist.side = 1; } - if (cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == '1' || - cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == 'L') - cl->rlist.hit = 1; + if (cl.mlist.map[cl.rlist.sqx][cl.rlist.sqy] == '1' || + cl.mlist.map[cl.rlist.sqx][cl.rlist.sqy] == 'L') + cl.rlist.hit = 1; } } -- cgit v1.2.3 From ce43b1cd1caa539af687425f58a6999a20807878 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 3 Mar 2020 16:14:26 +0100 Subject: Going full stack is bav --- src/ft_detect.c | 64 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/ft_detect.c') diff --git a/src/ft_detect.c b/src/ft_detect.c index 864b2b2..8ab3d57 100644 --- a/src/ft_detect.c +++ b/src/ft_detect.c @@ -17,40 +17,40 @@ static 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.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.y_step = -1; - cl.rlist.y_side_dist = (cl.rlist.y_ray_pos - - cl.rlist.sqy) * cl.rlist.y_delta_dist; + cl->mlist.y_step = -1; + cl->rlist.y_side_dist = (cl->rlist.y_ray_pos - + cl->rlist.sqy) * cl->rlist.y_delta_dist; } else { - cl.mlist.y_step = 1; - cl.rlist.y_side_dist = (cl.rlist.sqy + 1.0 - - cl.rlist.y_ray_pos) * cl.rlist.y_delta_dist; + cl->mlist.y_step = 1; + cl->rlist.y_side_dist = (cl->rlist.sqy + 1.0 - + cl->rlist.y_ray_pos) * cl->rlist.y_delta_dist; } } static 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.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.x_step = -1; - cl.rlist.x_side_dist = (cl.rlist.x_ray_pos - - cl.rlist.sqx) * cl.rlist.x_delta_dist; + cl->mlist.x_step = -1; + cl->rlist.x_side_dist = (cl->rlist.x_ray_pos - + cl->rlist.sqx) * cl->rlist.x_delta_dist; } else { - cl.mlist.x_step = 1; - cl.rlist.x_side_dist = (cl.rlist.sqx + 1.0 - - cl.rlist.x_ray_pos) * cl.rlist.x_delta_dist; + cl->mlist.x_step = 1; + cl->rlist.x_side_dist = (cl->rlist.sqx + 1.0 - + cl->rlist.x_ray_pos) * cl->rlist.x_delta_dist; } } @@ -59,23 +59,23 @@ void { ft_detection_init_x(cl); ft_detection_init_y(cl); - cl.rlist.hit = 0; - while (cl.rlist.hit == 0) + cl->rlist.hit = 0; + while (cl->rlist.hit == 0) { - if (cl.rlist.x_side_dist < cl.rlist.y_side_dist) + if (cl->rlist.x_side_dist < cl->rlist.y_side_dist) { - cl.rlist.x_side_dist += cl.rlist.x_delta_dist; - cl.rlist.sqx += cl.mlist.x_step; - cl.rlist.side = 0; + cl->rlist.x_side_dist += cl->rlist.x_delta_dist; + cl->rlist.sqx += cl->mlist.x_step; + cl->rlist.side = 0; } else { - cl.rlist.y_side_dist += cl.rlist.y_delta_dist; - cl.rlist.sqy += cl.mlist.y_step; - cl.rlist.side = 1; + cl->rlist.y_side_dist += cl->rlist.y_delta_dist; + cl->rlist.sqy += cl->mlist.y_step; + cl->rlist.side = 1; } - if (cl.mlist.map[cl.rlist.sqx][cl.rlist.sqy] == '1' || - cl.mlist.map[cl.rlist.sqx][cl.rlist.sqy] == 'L') - cl.rlist.hit = 1; + if (cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] == '1' || + cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] == 'L') + cl->rlist.hit = 1; } } -- cgit v1.2.3