aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_verline.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-08 00:56:36 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-08 00:56:36 +0100
commitd248cde2309e9aa3f14a10ce2db0019afdf9f0f1 (patch)
tree3b754dacd2e858c547f9cb95a303a797f39382c8 /src/ft_draw_verline.c
parentI gotta figure out (diff)
download42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.tar.gz
42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.tar.bz2
42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.tar.xz
42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.tar.zst
42-cub3d-d248cde2309e9aa3f14a10ce2db0019afdf9f0f1.zip
Collision fixed, still galering
Diffstat (limited to '')
-rw-r--r--src/ft_draw_verline.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c
index 6fa0d1e..d32ac38 100644
--- a/src/ft_draw_verline.c
+++ b/src/ft_draw_verline.c
@@ -33,6 +33,7 @@ static void
i = 0;
while (i <= y)
{
+ ft_floor_cast(i, cl);
*(int*)(cl->img.ptr +
(x * 4 + (i * cl->img.sizeline)))
= ft_darken_ceil(cl->c_rgb, i, cl);
@@ -40,18 +41,14 @@ static void
}
}
-#include <stdio.h>
-static void
- ft_calc_ceil_dist(int32_t y, t_ray *rl, t_cub *cl)
-{
- int16_t p;
+/* #include <stdio.h> */
+/* static void */
+/* ft_calc_ceil_dist(int32_t y, t_ray *rl, t_cub *cl) */
+/* { */
+/* int16_t p; */
- p = y - cl->wlist.y_size / 2;
- cl->plist.pos_z = 0.5 * cl->wlist.y_size;
- rl->ceil_dist = cl->plist.pos_z / p;
- rl->ceil_dist = (rl->ceil_dist > 0) ? (rl->ceil_dist) : (-rl->ceil_dist);
- printf("%f\n", rl->ceil_dist);
-}
+/* printf("%f\n", rl->ceil_dist); */
+/* } */
int8_t
ft_draw_verline(t_cub *cl, int32_t x, int32_t y, int32_t y2)
@@ -61,7 +58,6 @@ int8_t
(y < 0) ? (y = 0) : 0;
(y2 < 0) ? (y2 = 0) : 0;
- ft_calc_ceil_dist(y, &cl->rlist, cl);
ft_draw_ceil(cl, y, x);
(cl->rlist.line_h <= 0) ? (cl->rlist.line_h = 1) : 0;
while (y < y2)