aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--map/map_one.cub8
-rw-r--r--src/ft_floor_cast.c10
-rw-r--r--src/ft_floor_cast_inits.c7
3 files changed, 16 insertions, 9 deletions
diff --git a/map/map_one.cub b/map/map_one.cub
index d86cfd2..9baf31c 100644
--- a/map/map_one.cub
+++ b/map/map_one.cub
@@ -19,15 +19,15 @@ SH 2
1111111111111111111
1000000000000000001
- 1020304050607080001
1000000000000000001
-111111111111020304050607080001
+ 1000000000000000001
+111111111111000000000000000001
+100000000000000000000000000001
100000000000000000000000000001
-100000000000020304050607080001
100000000000000000000000000001
1001000000T0000000000000000001
10110+0+0111000001110000000111
-111111111111110011 1000N0001
+111111111111110011 10000N001
1000001 100001 111111111
1001001 100001
1011001 100001
diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c
index 874a398..aae1e90 100644
--- a/src/ft_floor_cast.c
+++ b/src/ft_floor_cast.c
@@ -25,6 +25,7 @@ static void
(x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(dist, rgb, cl);
}
+#include <libft.h>
static void
ft_draw_extra_tex(uint8_t tid, uint16_t y, uint16_t x, t_cub *cl)
{
@@ -34,11 +35,14 @@ static void
if ((dist = cl->rlist.row_dist_tab[y]) <= 0)
dist = 0.0001;
rgb.b = (uint8_t)cl->tlist[tid].ptr[cl->rlist.fc_tex_x_tab[tid - 6][y][x]
- * 4 + 4 * cl->tlist[tid].img_h * cl->rlist.fc_tex_y_tab[tid - 6][y][x]];
+ * 4 + 4 * cl->tlist[tid].img_h *
+ cl->rlist.fc_tex_y_tab[tid - 6][y][x]];
rgb.g = (uint8_t)cl->tlist[tid].ptr[cl->rlist.fc_tex_x_tab[tid - 6][y][x]
- * 4 + 4 * cl->tlist[tid].img_h * cl->rlist.fc_tex_y_tab[tid - 6][y][x] + 1];
+ * 4 + 4 * cl->tlist[tid].img_h *
+ cl->rlist.fc_tex_y_tab[tid - 6][y][x] + 1];
rgb.r = (uint8_t)cl->tlist[tid].ptr[cl->rlist.fc_tex_x_tab[tid - 6][y][x]
- * 4 + 4 * cl->tlist[tid].img_h * cl->rlist.fc_tex_y_tab[tid - 6][y][x] + 2];
+ * 4 + 4 * cl->tlist[tid].img_h *
+ cl->rlist.fc_tex_y_tab[tid - 6][y][x] + 2];
*(int*)(cl->img.ptr + ((uint16_t)x * 4 +
(y * cl->img.sizeline))) = ft_rgb_to_hex(dist, rgb, cl);
}
diff --git a/src/ft_floor_cast_inits.c b/src/ft_floor_cast_inits.c
index d1f2811..68bb0c7 100644
--- a/src/ft_floor_cast_inits.c
+++ b/src/ft_floor_cast_inits.c
@@ -13,6 +13,7 @@
#include <cub3d.h>
#include <stdint.h>
+#include <libft.h>
void
ft_set_fc_tex_xy(uint8_t tid, uint16_t x, uint16_t y, t_cub *cl)
{
@@ -23,8 +24,10 @@ void
* (cl->rlist.y_floor - y_cell));
cl->tlist[tid].tex_y = (int32_t)(cl->tlist[tid].img_w
* (cl->rlist.x_floor - x_cell));
- cl->rlist.fc_tex_x_tab[tid - 6][y][x] = cl->tlist[tid].tex_x;
- cl->rlist.fc_tex_y_tab[tid - 6][y][x] = cl->tlist[tid].tex_y;
+ cl->rlist.fc_tex_x_tab[tid - 6][y][x] = (cl->tlist[tid].tex_x >= 0) ?
+ (cl->tlist[tid].tex_x) : (-cl->tlist[tid].tex_x);
+ cl->rlist.fc_tex_y_tab[tid - 6][y][x] = (cl->tlist[tid].tex_y >= 0) ?
+ (cl->tlist[tid].tex_y) : (-cl->tlist[tid].tex_y);
}
void