aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p6.le-101.fr>2020-03-09 17:16:31 +0100
committerRudy Bousset <rbousset@z2r5p6.le-101.fr>2020-03-09 17:16:31 +0100
commitff1301afc3808887b4cf8fde9a4d24638120c6c5 (patch)
treeda99874501bd4bf6b9bb993b74a9355620b0286b /src
parentGood lvl five (diff)
download42-cub3d-ff1301afc3808887b4cf8fde9a4d24638120c6c5.tar.gz
42-cub3d-ff1301afc3808887b4cf8fde9a4d24638120c6c5.tar.bz2
42-cub3d-ff1301afc3808887b4cf8fde9a4d24638120c6c5.tar.xz
42-cub3d-ff1301afc3808887b4cf8fde9a4d24638120c6c5.tar.zst
42-cub3d-ff1301afc3808887b4cf8fde9a4d24638120c6c5.zip
Perf
Diffstat (limited to 'src')
-rw-r--r--src/ft_darken_rgb.c2
-rw-r--r--src/ft_draw_textures.c2
-rw-r--r--src/ft_floor_cast.c6
-rw-r--r--src/ft_get_darkness.c2
4 files changed, 8 insertions, 4 deletions
diff --git a/src/ft_darken_rgb.c b/src/ft_darken_rgb.c
index 4c571cf..223a540 100644
--- a/src/ft_darken_rgb.c
+++ b/src/ft_darken_rgb.c
@@ -22,7 +22,7 @@ uint32_t
if ((dist = cl->rlist.row_dist) <= 0)
dist = 0.0001;
- calc = (dist * 0.4);
+ calc = (dist * 0.1 * cl->mlist.darklvl);
calc = (calc >= 255) ? (255) : (calc);
calc = (calc < 1) ? (1) : (calc);
darker = rgb;
diff --git a/src/ft_draw_textures.c b/src/ft_draw_textures.c
index e19d014..5fc3bdd 100644
--- a/src/ft_draw_textures.c
+++ b/src/ft_draw_textures.c
@@ -29,7 +29,7 @@ void ft_draw_texture(t_cub *cl, int x, int y, int tex_y)
if ((dist = cl->rlist.wall_dist) <= 0)
dist = 0.0001;
- calc = (dist * 0.4);
+ calc = (dist * 0.1 * cl->mlist.darklvl);
calc = (calc >= 255) ? (255) : (calc);
calc = (calc < 1) ? (1) : (calc);
cl->img.ptr[x * 4 + (cl->img.sizeline * y)] =
diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c
index de53666..715eacc 100644
--- a/src/ft_floor_cast.c
+++ b/src/ft_floor_cast.c
@@ -29,7 +29,7 @@ static void
if ((dist = cl->rlist.row_dist) <= 0)
dist = 0.0001;
- calc = (dist * 0.4);
+ calc = (dist * 0.1 * cl->mlist.darklvl);
calc = (calc >= 255) ? (255) : (calc);
calc = (calc < 1) ? (1) : (calc);
cl->img.ptr[x * 4 + (cl->img.sizeline * y)] =
@@ -51,6 +51,10 @@ static void
* (rl->x_floor - rl->x_cell)) % (cl->tlist[tid].img_w);
cl->tlist[tid].tex_x = (int32_t)(cl->tlist[tid].img_h
* (rl->y_floor - rl->y_cell)) % (cl->tlist[tid].img_h);
+ cl->tlist[tid].tex_x = (cl->tlist[tid].tex_x > 0)
+ ? (cl->tlist[tid].tex_x) : (-cl->tlist[tid].tex_x);
+ cl->tlist[tid].tex_y = (cl->tlist[tid].tex_y > 0)
+ ? (cl->tlist[tid].tex_y) : (-cl->tlist[tid].tex_y);
}
static void
diff --git a/src/ft_get_darkness.c b/src/ft_get_darkness.c
index 7f1bc00..14a9f00 100644
--- a/src/ft_get_darkness.c
+++ b/src/ft_get_darkness.c
@@ -39,7 +39,7 @@ int8_t
}
if (ft_checkdigit(words[1], clist))
return (-1);
- if (ft_atoi(words[1]) < 0 || ft_atoi(words[1]) > 10)
+ if (ft_atoi(words[1]) < 0 || ft_atoi(words[1]) > 20)
{
ft_sprintf(clist->errmsg, FT_ERR_SH_RANGE);
return (-1);