aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_floor_cast.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-03-10 06:11:15 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-03-10 06:11:15 +0100
commit6cbdde3ec081e2bdaf36974af11baff8e6753d7e (patch)
tree5db231b8304c414b802c4b7adde4718814c833ac /src/ft_floor_cast.c
parentupdated larry world (diff)
download42-cub3d-6cbdde3ec081e2bdaf36974af11baff8e6753d7e.tar.gz
42-cub3d-6cbdde3ec081e2bdaf36974af11baff8e6753d7e.tar.bz2
42-cub3d-6cbdde3ec081e2bdaf36974af11baff8e6753d7e.tar.xz
42-cub3d-6cbdde3ec081e2bdaf36974af11baff8e6753d7e.tar.zst
42-cub3d-6cbdde3ec081e2bdaf36974af11baff8e6753d7e.zip
ok
Diffstat (limited to 'src/ft_floor_cast.c')
-rw-r--r--src/ft_floor_cast.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c
index 104fb49..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;