From 2f819c87685e6ad60bcde0df7944e92f4694f2d2 Mon Sep 17 00:00:00 2001
From: salaaad2 <arthurdurant263@gmail.com>
Date: Sat, 15 Feb 2020 20:29:43 +0100
Subject: pepere :^) !

---
 inc/cub3d_structs.h    |  1 +
 src/ft_draw_textures.c | 17 +++++++++--------
 src/ft_draw_verline.c  |  1 +
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index 1bf2bca..b25f473 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -38,6 +38,7 @@ typedef struct		s_img
 	int				img_h;
 	int				tex_x;
 	int				tex_y;
+	int				w_side;
 
 }					t_img;
 
diff --git a/src/ft_draw_textures.c b/src/ft_draw_textures.c
index 36cc832..321fd18 100644
--- a/src/ft_draw_textures.c
+++ b/src/ft_draw_textures.c
@@ -13,13 +13,14 @@
 #include <cub3d.h>
 #include <stdint.h>
 
-void	ft_draw_wall(t_cub *clist, int x, int draw_start, int draw_end)
+void	ft_choose_tex(t_cub *clist)
 {
-	clist->img.ptr[/*calcul a la con*/x];
-	/*
-	 * faire calcul wola
-	 *
-	 *
-	 *
-	 */
+	if (clist->rlist.side == 0 && clist->rlist.x_ray_direction > 0)
+		clist->w_side = 0;
+	else if (clist->rlist.side == 0 && clist->rlist.x_ray_direction < 0)
+		clist->w_side = 3;
+	else if (clist->rlist.side == 1 && clist->rlist.y_ray_direction > 0)
+		clist->w_side = 1;
+	else (clist->rlist.side == 1 && clist->rlist.y_ray_direction < 0)
+		clist->w_side = 2;
 }
diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c
index d7ebe34..8156473 100644
--- a/src/ft_draw_verline.c
+++ b/src/ft_draw_verline.c
@@ -57,6 +57,7 @@ int8_t
 	}
 	y = y1;
 	ft_draw_ceil(cl, y, x);
+	ft_choose_tex(cl);
 	while (y <= y2)
 	{
 		*(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = 0x0000ffaa;
-- 
cgit v1.2.3