aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_textures.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_draw_textures.c')
-rw-r--r--src/ft_draw_textures.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ft_draw_textures.c b/src/ft_draw_textures.c
index 0724a6d..c7684f9 100644
--- a/src/ft_draw_textures.c
+++ b/src/ft_draw_textures.c
@@ -28,20 +28,20 @@ void
float dist;
t_rgb rgb;
- if ((dist = cl->rlist.wall_dist) <= 0)
+ if ((dist = cl->rlist.wall_dist_tab[x]) <= 0)
dist = 0.0001;
- rgb.b = (uint8_t)cl->tlist[cl->w_side].ptr[cl->tlist[cl->w_side].tex_x
- * 4 + 4 * cl->tlist[cl->w_side].img_h * tex_y];
- rgb.g = (uint8_t)cl->tlist[cl->w_side].ptr[cl->tlist[cl->w_side].tex_x
- * 4 + 4 * cl->tlist[cl->w_side].img_h * tex_y + 1];
- rgb.r = (uint8_t)cl->tlist[cl->w_side].ptr[cl->tlist[cl->w_side].tex_x
- * 4 + 4 * cl->tlist[cl->w_side].img_h * tex_y + 2];
+ rgb.r = (uint8_t)cl->tlist[cl->rlist.w_side_tab[x]].ptr[cl->tlist[cl->rlist.w_side_tab[x]].tex_x
+ * 4 + 4 * cl->tlist[cl->rlist.w_side_tab[x]].img_h * tex_y + 2];
+ rgb.g = (uint8_t)cl->tlist[cl->rlist.w_side_tab[x]].ptr[cl->tlist[cl->rlist.w_side_tab[x]].tex_x
+ * 4 + 4 * cl->tlist[cl->rlist.w_side_tab[x]].img_h * tex_y + 1];
+ rgb.b = (uint8_t)cl->tlist[cl->rlist.w_side_tab[x]].ptr[cl->tlist[cl->rlist.w_side_tab[x]].tex_x
+ * 4 + 4 * cl->tlist[cl->rlist.w_side_tab[x]].img_h * tex_y];
*(int*)(cl->img.ptr + ((uint16_t)x * 4 +
(y * cl->img.sizeline))) = ft_rgb_to_hex(dist, rgb, cl);
}
void
- ft_choose_tex(t_cub *clist)
+ ft_choose_tex(uint16_t x, t_cub *clist)
{
if (clist->rlist.sqy == clist->mlist.nlx
&& clist->rlist.sqx == clist->mlist.nly)
@@ -59,4 +59,5 @@ void
else
clist->w_side = 2;
}
+ clist->rlist.w_side_tab[x] = clist->w_side;
}