aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_floor_cast.c
diff options
context:
space:
mode:
authorsalaaad2 <arthudurant263@gmail.com>2020-03-10 16:16:08 +0100
committersalaaad2 <arthudurant263@gmail.com>2020-03-10 16:16:08 +0100
commit0d589d0038624e3123e6166f6521d1421dd69b23 (patch)
tree26db0ad344a9c730192eea0bff01bb410ba225b7 /src/ft_floor_cast.c
parentstill retard (diff)
parentok now (diff)
download42-cub3d-0d589d0038624e3123e6166f6521d1421dd69b23.tar.gz
42-cub3d-0d589d0038624e3123e6166f6521d1421dd69b23.tar.bz2
42-cub3d-0d589d0038624e3123e6166f6521d1421dd69b23.tar.xz
42-cub3d-0d589d0038624e3123e6166f6521d1421dd69b23.tar.zst
42-cub3d-0d589d0038624e3123e6166f6521d1421dd69b23.zip
merge master
Diffstat (limited to 'src/ft_floor_cast.c')
-rw-r--r--src/ft_floor_cast.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c
index 6111eca..384f699 100644
--- a/src/ft_floor_cast.c
+++ b/src/ft_floor_cast.c
@@ -16,8 +16,16 @@
static void
ft_draw_plain_horizontal(t_rgb rgb, t_cub *cl, int32_t y, int32_t x)
{
- *(int*)(cl->img.ptr +
- (x * 4 + (y * cl->img.sizeline))) = ft_darken(rgb, cl);
+ if (cl->mlist.darklvl > 0)
+ {
+ *(int*)(cl->img.ptr +
+ (x * 4 + (y * cl->img.sizeline))) = ft_darken(rgb, cl);
+ }
+ else
+ {
+ *(int*)(cl->img.ptr +
+ (x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(rgb);
+ }
}
static void
@@ -31,6 +39,7 @@ static void
calc = (dist * 0.1 * cl->mlist.darklvl);
calc = (calc >= 255) ? (255) : (calc);
calc = (calc < 1) ? (1) : (calc);
+ calc = (cl->mlist.darklvl > 0) ? (calc) : (1);
cl->img.ptr[x * 4 + (cl->img.sizeline * y)] =
(uint8_t)cl->tlist[tid].ptr[cl->tlist[tid].tex_x * 4 + 4 *
cl->tlist[tid].img_h * cl->tlist[tid].tex_y] / calc;
@@ -75,9 +84,9 @@ static void
ft_draw_extra_tex(6, y, x, cl);
else
ft_draw_plain_horizontal(cl->f_rgb, cl, y, x);
- if (cl->mlist.isctex)
+ if (cl->mlist.isctex && !cl->mlist.isskybox)
ft_draw_extra_tex(7, cl->wlist.y_size - y - 1, x, cl);
- else
+ else if (!cl->mlist.isctex && !cl->mlist.isskybox)
ft_draw_plain_horizontal(cl->c_rgb, cl, cl->wlist.y_size - y - 1, x);
}