diff --git a/headers/cube3d_macro.h b/headers/cube3d_macro.h index 63831fd..516f984 100644 --- a/headers/cube3d_macro.h +++ b/headers/cube3d_macro.h @@ -6,7 +6,7 @@ */ /* nbr pixel player move */ -# define PLR_MV 2 +# define PLR_MV 5 /* degree of rotation of the player per press */ # define PLR_ROT 2 /* nbr key you can press at the same time */ @@ -20,7 +20,7 @@ /* screen focal (in degree) */ # define SCREEN_FOCAL 70 /* size of a cell on the map */ -# define CELL 20 +# define CELL 40 /* * keys macro diff --git a/srcs/draw/raycast.c b/srcs/draw/raycast.c index 9bb5ca5..5fc2a14 100644 --- a/srcs/draw/raycast.c +++ b/srcs/draw/raycast.c @@ -42,8 +42,8 @@ static void fill_wall_vector(t_rcast *rcast, int height) static void calcul_wall(t_rcast *rcast) { - int height; - int delta; + long int height; + int delta; rcast->wall.start.x = rcast->ray_nb; rcast->wall.end.x = rcast->ray_nb; @@ -51,13 +51,17 @@ static void calcul_wall(t_rcast *rcast) delta = rcast->next_x - rcast->ray_step_x; else if (rcast->is_x == 0) delta = rcast->next_y - rcast->ray_step_y; +if (rcast->ray_nb % 10) printf("delta:%i ", delta); height = rcast->screen_height * rcast->cell; if (rcast->slope_x) height *= rcast->slope_x; +if (rcast->ray_nb % 10) printf("height:%li ", height); if (rcast->slope_y) height *= rcast->slope_y; +if (rcast->ray_nb % 10) printf("height:%li ", height); if (delta && rcast->screen_dist) height /= (delta * rcast->screen_dist); +if (rcast->ray_nb % 10) printf("height:%li\n", height); height = ft_abs(height); fill_wall_vector(rcast, height); } @@ -67,6 +71,7 @@ void raycast(t_game *game, t_rcast *rcast) t_vec ray; rcast->ray_nb = 0; +printf("\n"); while (rcast->ray_nb <= rcast->screen_width) { ray_intersect(game, rcast, &ray);