diff --git a/headers/cube3d_macro.h b/headers/cube3d_macro.h index 477cce1..1e95774 100644 --- a/headers/cube3d_macro.h +++ b/headers/cube3d_macro.h @@ -18,7 +18,7 @@ /* size of a cell on the map */ # define CELL 20 /* height of a wall without perpectiv */ -# define WALL_HEIGHT 300 +# define WALL_HEIGHT 200 /* * keys macro diff --git a/srcs/draw/raycast.c b/srcs/draw/raycast.c index 26b0472..c0d0ea1 100644 --- a/srcs/draw/raycast.c +++ b/srcs/draw/raycast.c @@ -38,9 +38,18 @@ static void calcul_wall(t_rcast *rcast) rcast->wall.start.x = rcast->ray_nb; rcast->wall.end.x = rcast->ray_nb; if (rcast->is_x == 1 && rcast->slope_y != 0) + { length = (rcast->next_x - rcast->ray_step_x) / ft_abs(rcast->slope_y); + length = (double)length * (double)rcast->screen_dist.end.y / (double)rcast->slope_x; +// length = (rcast->next_x - rcast->ray_step_x) / ft_abs(rcast->slope_y); + } if (rcast->is_x == 0 && rcast->slope_x != 0) + { length = (rcast->next_y - rcast->ray_step_y) / ft_abs(rcast->slope_x); + length = (double)length * (double)rcast->screen_dist.end.y / (double)rcast->slope_y; +// length = (rcast->next_y - rcast->ray_step_y) / ft_abs(rcast->slope_x); + } + length = ft_abs(length); height = rcast->wall_height - length; if (height < 0) height = 0;