diff options
-rw-r--r-- | inc/cub3d.h | 2 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 1 | ||||
-rw-r--r-- | src/ft_darken_rgb.c | 9 | ||||
-rw-r--r-- | src/ft_draw_verline.c | 4 |
4 files changed, 6 insertions, 10 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h index da57cb7..7b57942 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -128,7 +128,7 @@ uint8_t ft_free_words(char **words); int8_t ft_warp_level(t_cub *cl); int ft_exit(uint8_t exit_code, t_cub *clist); uint32_t ft_rgb_to_hex(t_rgb rgb); -uint32_t ft_darken_rgb(t_rgb rgb, t_cub *cl); +uint32_t ft_darken_rgb(t_rgb rgb, int32_t y, t_cub *cl); t_bmp_rgb ft_hex_to_rgb(uint32_t color); # endif diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 620e8fc..c74a9e0 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -120,7 +120,6 @@ typedef struct s_ray { uint16_t line_h; float wall_dist; - float ceil_dist; float x_ray_pos; float y_ray_pos; float x_ray_dir; diff --git a/src/ft_darken_rgb.c b/src/ft_darken_rgb.c index 6993891..97d0c0e 100644 --- a/src/ft_darken_rgb.c +++ b/src/ft_darken_rgb.c @@ -15,15 +15,12 @@ #include <stdio.h> uint32_t - ft_darken_rgb(t_rgb rgb, t_cub *cl) + ft_darken_rgb(t_rgb rgb, int32_t y, t_cub *cl) { t_rgb darker; - float dist; - float calc; + uint8_t calc; - if ((dist = cl->rlist.ceil_dist) <= 0) - dist = 0.0001; - calc = (dist * 0.4); + calc = (((cl->wlist.y_size / 2) + y)), calc = (calc >= 255) ? (255) : (calc); calc = (calc < 1) ? (1) : (calc); darker = rgb; diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index f01ddc8..eeccc42 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -20,7 +20,7 @@ static void { *(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) - = ft_darken_rgb(cl->f_rgb, cl); + = ft_darken_rgb(cl->f_rgb, y, cl); y++; } } @@ -35,7 +35,7 @@ static void { *(int*)(cl->img.ptr + (x * 4 + (i * cl->img.sizeline))) - = ft_darken_rgb(cl->c_rgb, cl); + = ft_darken_rgb(cl->c_rgb, i, cl); i++; } } |