aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_detect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_detect.c')
-rw-r--r--src/ft_detect.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/ft_detect.c b/src/ft_detect.c
index 0ef8831..c7bdcbb 100644
--- a/src/ft_detect.c
+++ b/src/ft_detect.c
@@ -17,40 +17,40 @@
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 -
- cl->rlist.sqy) * cl->rlist.y_delta_dist;
+ 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.sqy + 1.0 -
- cl->rlist.y_ray_pos) * cl->rlist.y_delta_dist;
+ cl->rlist.y_side_dist = (cl->rlist.sqx + 1.0 -
+ cl->rlist.x_ray_pos) * cl->rlist.y_delta_dist;
}
}
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 -
- cl->rlist.sqx) * cl->rlist.x_delta_dist;
+ 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.sqx + 1.0 -
- cl->rlist.x_ray_pos) * cl->rlist.x_delta_dist;
+ cl->rlist.x_side_dist = (cl->rlist.sqy + 1.0 -
+ cl->rlist.y_ray_pos) * cl->rlist.x_delta_dist;
}
}
@@ -65,17 +65,17 @@ void
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.sqy += 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.sqx += cl->mlist.y_step;
cl->rlist.side = 1;
}
if (ft_ischarset(FT_CHRST_DETECT,
- cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy]))
+ cl->mlist.map[cl->rlist.sqy][cl->rlist.sqx]))
cl->rlist.hit = 1;
}
}