plr start on middle of a cell, and wall height is well proportionned
This commit is contained in:
@@ -50,25 +50,20 @@ static void wall_length(t_rcast *rcast)
|
||||
len /= rcast->slope_x;
|
||||
len = rcast->screen_dist * len / rcast->slope_y;
|
||||
}
|
||||
printf("len:%i\n", len);
|
||||
rcast->ray_len = ft_abs(len);
|
||||
}
|
||||
|
||||
static void wall_height(t_rcast *rcast)
|
||||
{
|
||||
double height;
|
||||
int height;
|
||||
|
||||
// height = rcast->screen_height * (rcast->hor - rcast->ray_len) / rcast->hor;
|
||||
|
||||
height = rcast->screen_height;
|
||||
height = rcast->screen_height * rcast->cell;
|
||||
if (rcast->ray_len)
|
||||
height /= (double)((double)rcast->ray_len / 100);
|
||||
|
||||
height /= rcast->ray_len;
|
||||
if (height < 0)
|
||||
height = 0;
|
||||
if (height >= rcast->screen_height)
|
||||
if (height > rcast->screen_height)
|
||||
height = rcast->screen_height;
|
||||
|
||||
rcast->wall.start.y = rcast->screen_height / 2 + height / 2;
|
||||
rcast->wall.end.y = rcast->screen_height / 2 - height / 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user