aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_detect.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z3r8p1.le-101.fr>2020-02-13 19:42:05 +0100
committerRudy Bousset <rbousset@z3r8p1.le-101.fr>2020-02-13 19:42:05 +0100
commite29dd2fa3688e1e96a25af3b651da574af08aa90 (patch)
treecb6486fc91f1b93e61e4dcda25d359095e6aa108 /src/ft_detect.c
parentBetter code structure (diff)
download42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.gz
42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.bz2
42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.xz
42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.zst
42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.zip
Splited structs
Diffstat (limited to 'src/ft_detect.c')
-rw-r--r--src/ft_detect.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ft_detect.c b/src/ft_detect.c
index b83c9f1..3dafd67 100644
--- a/src/ft_detect.c
+++ b/src/ft_detect.c
@@ -9,13 +9,13 @@ ft_detection_init_y(t_cub *cl)
cl->rlist.y_ray_dir));
if (cl->rlist.y_ray_dir < 0)
{
- cl->y_step = -1;
+ 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->y_step = 1;
+ 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;
}
@@ -29,13 +29,13 @@ ft_detection_init_x(t_cub *cl)
cl->rlist.x_ray_dir));
if (cl->rlist.x_ray_dir < 0)
{
- cl->x_step = -1;
+ 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->x_step = 1;
+ 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;
}
@@ -52,16 +52,16 @@ ft_detect(t_cub *cl)
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->x_step;
+ 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->y_step;
+ cl->rlist.sqy += cl->mlist->y_step;
cl->rlist.side = 1;
}
- if (cl->map[cl->rlist.sqx][cl->rlist.sqy] == '1')
+ if (cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == '1')
cl->rlist.hit = 1;
}
}