diff options
Diffstat (limited to '')
-rw-r--r-- | inc/cub3d_structs.h | 5 | ||||
-rw-r--r-- | src/ft_floor_cast.c | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index cf8b6fa..aff5663 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -138,6 +138,11 @@ typedef struct s_ray uint8_t hit; double wall_hit_x; double step_tex_v; + float x_f_ray_dir; + float y_f_ray_dir; + float x_f_ray_dir_bis; + float y_f_ray_dir_bis; + uint16_t p; } t_ray; typedef struct s_map diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c index a0321d0..1d98e03 100644 --- a/src/ft_floor_cast.c +++ b/src/ft_floor_cast.c @@ -16,6 +16,13 @@ void ft_floor_cast(uint16_t y, t_cub *cl) { - (void)y; - (void)cl; + t_ray *rl; + + rl = &cl->rlist; + rl->x_f_ray_dir = cl->plist.dir_x - cl->plist.plane_x; + rl->y_f_ray_dir = cl->plist.dir_y - cl->plist.plane_y; + rl->x_f_ray_dir_bis = cl->plist.dir_x + cl->plist.plane_x; + rl->y_f_ray_dir_bis = cl->plist.dir_y + cl->plist.plane_y; + rl->p = y - cl->wlist.y_size / 2; + cl->plist.pos_z = 0.5 * cl->wlist.y_size; } |