diff options
-rw-r--r-- | src/ft_castray_loop.c | 16 | ||||
-rw-r--r-- | src/ft_detect.c | 16 | ||||
-rw-r--r-- | src/ft_draw_textures.c | 6 | ||||
-rw-r--r-- | src/ft_init_s_ray.c | 2 | ||||
-rw-r--r-- | src/ft_select_bad_boy_action.c | 4 | ||||
-rw-r--r-- | src/ft_shoot.c | 4 |
6 files changed, 24 insertions, 24 deletions
diff --git a/src/ft_castray_loop.c b/src/ft_castray_loop.c index 3d12680..e10a48b 100644 --- a/src/ft_castray_loop.c +++ b/src/ft_castray_loop.c @@ -21,17 +21,17 @@ void { if (cl->rlist.side == 0) cl->rlist.wall_hit_x = (cl->plist.pos_x) + - cl->rlist.wall_dist * cl->rlist.y_ray_dir; + cl->rlist.wall_dist * cl->rlist.x_ray_dir; else cl->rlist.wall_hit_x = (cl->plist.pos_y) + - cl->rlist.wall_dist * cl->rlist.x_ray_dir; + cl->rlist.wall_dist * cl->rlist.y_ray_dir; cl->rlist.wall_hit_x -= floor(cl->rlist.wall_hit_x); cl->tlist[cl->w_side].tex_x = (int)(cl->rlist.wall_hit_x * (double)cl->tlist[cl->w_side].img_w); - if (cl->rlist.side == 0 && cl->rlist.x_ray_dir > 0) + if (cl->rlist.side == 0 && cl->rlist.y_ray_dir > 0) cl->tlist[cl->w_side].tex_x = cl->tlist[cl->w_side].img_w - cl->tlist[cl->w_side].tex_x - 1; - else if (cl->rlist.side == 1 && cl->rlist.y_ray_dir < 0) + else if (cl->rlist.side == 1 && cl->rlist.x_ray_dir < 0) cl->tlist[cl->w_side].tex_x = cl->tlist[cl->w_side].img_w - cl->tlist[cl->w_side].tex_x - 1; } @@ -47,9 +47,9 @@ void pl->cam_x = 2 * i / (float)(wl->x_size) - 1; cl->rlist.x_ray_pos = pl->pos_y; cl->rlist.y_ray_pos = pl->pos_x; - cl->rlist.x_ray_dir = pl->dir_y + pl->plane_x * + cl->rlist.y_ray_dir = pl->dir_y + pl->plane_x * pl->cam_x; - cl->rlist.y_ray_dir = pl->dir_x + pl->plane_y * + cl->rlist.x_ray_dir = pl->dir_x + pl->plane_y * pl->cam_x; cl->rlist.sqy = (int16_t)cl->rlist.x_ray_pos; cl->rlist.sqx = (int16_t)cl->rlist.y_ray_pos; @@ -57,12 +57,12 @@ void if (cl->rlist.side == 0) { cl->rlist.wall_dist = (cl->rlist.sqy - cl->rlist.x_ray_pos + - (1 - cl->mlist.x_step) / 2) / cl->rlist.x_ray_dir; + (1 - cl->mlist.x_step) / 2) / cl->rlist.y_ray_dir; } else { cl->rlist.wall_dist = (cl->rlist.sqx - cl->rlist.y_ray_pos + - (1 - cl->mlist.y_step) / 2) / cl->rlist.y_ray_dir; + (1 - cl->mlist.y_step) / 2) / cl->rlist.x_ray_dir; } } diff --git a/src/ft_detect.c b/src/ft_detect.c index 44e5bb2..a944a0f 100644 --- a/src/ft_detect.c +++ b/src/ft_detect.c @@ -17,10 +17,10 @@ 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 - @@ -37,10 +37,10 @@ void 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 - diff --git a/src/ft_draw_textures.c b/src/ft_draw_textures.c index 0f8bc43..533564d 100644 --- a/src/ft_draw_textures.c +++ b/src/ft_draw_textures.c @@ -53,11 +53,11 @@ void } else { - if (clist->rlist.side == 0 && clist->rlist.x_ray_dir < 0) + if (clist->rlist.side == 0 && clist->rlist.y_ray_dir < 0) clist->w_side = 1; - else if (clist->rlist.side == 0 && clist->rlist.x_ray_dir > 0) + else if (clist->rlist.side == 0 && clist->rlist.y_ray_dir > 0) clist->w_side = 0; - else if (clist->rlist.side == 1 && clist->rlist.y_ray_dir > 0) + else if (clist->rlist.side == 1 && clist->rlist.x_ray_dir > 0) clist->w_side = 3; else clist->w_side = 2; diff --git a/src/ft_init_s_ray.c b/src/ft_init_s_ray.c index d13f17d..a79ec10 100644 --- a/src/ft_init_s_ray.c +++ b/src/ft_init_s_ray.c @@ -25,8 +25,8 @@ t_ray rl.wall_b = 0; rl.x_ray_pos = 0; rl.y_ray_pos = 0; - rl.x_ray_dir = 0; rl.y_ray_dir = 0; + rl.x_ray_dir = 0; rl.x_side_dist = 0; rl.y_side_dist = 0; rl.x_delta_dist = 0; diff --git a/src/ft_select_bad_boy_action.c b/src/ft_select_bad_boy_action.c index f0ce7e7..8fb38c6 100644 --- a/src/ft_select_bad_boy_action.c +++ b/src/ft_select_bad_boy_action.c @@ -93,8 +93,8 @@ int8_t hit = 0; cl->rlist.x_ray_pos = cl->plist.pos_y; cl->rlist.y_ray_pos = cl->plist.pos_x; - cl->rlist.x_ray_dir = pl->dir_y; - cl->rlist.y_ray_dir = pl->dir_x; + cl->rlist.y_ray_dir = pl->dir_y; + cl->rlist.x_ray_dir = pl->dir_x; cl->rlist.sqy = (uint64_t)cl->rlist.x_ray_pos; cl->rlist.sqx = (uint64_t)cl->rlist.y_ray_pos; ft_detection_init_x(cl); diff --git a/src/ft_shoot.c b/src/ft_shoot.c index 248ea6e..29f5066 100644 --- a/src/ft_shoot.c +++ b/src/ft_shoot.c @@ -104,8 +104,8 @@ void pl = &cl->plist; cl->rlist.x_ray_pos = pl->pos_y; cl->rlist.y_ray_pos = pl->pos_x; - cl->rlist.x_ray_dir = pl->dir_y; - cl->rlist.y_ray_dir = pl->dir_x; + cl->rlist.y_ray_dir = pl->dir_y; + cl->rlist.x_ray_dir = pl->dir_x; cl->rlist.sqy = (uint64_t)cl->rlist.x_ray_pos; cl->rlist.sqx = (uint64_t)cl->rlist.y_ray_pos; ft_detection_init_x(cl); |