From a25845a1e0c96111f42e96c9c87d33f0c42180bc Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Tue, 18 Feb 2020 16:18:09 +0100 Subject: hmmmmmmmmmmm --- src/ft_draw_verline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ft_draw_verline.c') diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 0fad33a..0b97cc5 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -60,7 +60,8 @@ int8_t ft_choose_tex(cl); while (y <= y2) { - *(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = (cl->rlist.side) ? 0x0000eeaa : 0x0000ffaa; + cl->rlist.step_tex_v = 1.0 * cl->tlist[clist->w_side].img_w - cl->rlist.line_h; + /**(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = (cl->rlist.side) ? 0x2200ffaa : 0x0000ffaa;*/ y++; } ft_draw_floor(cl, y, x); -- cgit v1.2.3 From f8cd383a3ed07be0fb3ad78ad25a0c053c53ae3d Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Tue, 18 Feb 2020 18:18:01 +0100 Subject: pas loin --- src/ft_draw_verline.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/ft_draw_verline.c') diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 0b97cc5..5f93ce2 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -42,6 +42,7 @@ int8_t { int32_t y; int32_t t; + int32_t d; if (y1 < 0) y1 = 0; @@ -60,8 +61,11 @@ int8_t ft_choose_tex(cl); while (y <= y2) { - cl->rlist.step_tex_v = 1.0 * cl->tlist[clist->w_side].img_w - cl->rlist.line_h; - /**(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = (cl->rlist.side) ? 0x2200ffaa : 0x0000ffaa;*/ + d = y * 256 - cl->wlist->y_size * 128 + cl->rlist.line_h * 128; + cl->tlist[cl->w_side].tex_y = ((d * cl->tlist[cl->w_side].img_w) + / cl->rlist.line_h) / 256; + ft_draw_texture(cl, x, y, cl->tlist[cl->w_side].tex_y); + /**(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = (cl->rlist.side) ? 0x2200ffaa : 0x0000ffaa;*/ y++; } ft_draw_floor(cl, y, x); -- cgit v1.2.3 From cbf73a5e2d4f1fda6e6267854954b78417678540 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Tue, 18 Feb 2020 18:57:45 +0100 Subject: gang --- src/ft_draw_verline.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/ft_draw_verline.c') diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 5f93ce2..7d24301 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -11,6 +11,7 @@ /* ************************************************************************** */ #include +#include static void ft_draw_floor(t_cub *cl, int32_t y, int32_t x) @@ -59,14 +60,16 @@ int8_t y = y1; ft_draw_ceil(cl, y, x); ft_choose_tex(cl); - while (y <= y2) + while (y1 < y2) { d = y * 256 - cl->wlist->y_size * 128 + cl->rlist.line_h * 128; + printf(" y : %d\ny_size : %d\nd : %d\nline_h : %d\n", y, cl->wlist->y_size, d, cl->rlist.line_h); cl->tlist[cl->w_side].tex_y = ((d * cl->tlist[cl->w_side].img_w) / cl->rlist.line_h) / 256; + /*printf("w_side : %d\nd : %d\ntex_y : %d\n", cl->w_side, d, cl->tlist[cl->w_side].tex_y);*/ ft_draw_texture(cl, x, y, cl->tlist[cl->w_side].tex_y); /**(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = (cl->rlist.side) ? 0x2200ffaa : 0x0000ffaa;*/ - y++; + y1++; } ft_draw_floor(cl, y, x); return (0); -- cgit v1.2.3 From 2a25aa55bdf6fcca6a9b7dd51542950fdab2e707 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Tue, 18 Feb 2020 20:05:42 +0100 Subject: okok --- src/ft_draw_verline.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ft_draw_verline.c') diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 7d24301..65958ca 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -60,16 +60,16 @@ int8_t y = y1; ft_draw_ceil(cl, y, x); ft_choose_tex(cl); - while (y1 < y2) + while (y < y2) { d = y * 256 - cl->wlist->y_size * 128 + cl->rlist.line_h * 128; - printf(" y : %d\ny_size : %d\nd : %d\nline_h : %d\n", y, cl->wlist->y_size, d, cl->rlist.line_h); - cl->tlist[cl->w_side].tex_y = ((d * cl->tlist[cl->w_side].img_w) - / cl->rlist.line_h) / 256; + (d <= 0) ? (d = 1) : 0; + /* printf("y : %d\ny_size : %d\nd : %d\nline_h : %d\n", y1, cl->wlist->y_size, d, cl->rlist.line_h); */ + cl->tlist[cl->w_side].tex_y = ((d * cl->tlist[cl->w_side].img_w) / cl->rlist.line_h) / 256; /*printf("w_side : %d\nd : %d\ntex_y : %d\n", cl->w_side, d, cl->tlist[cl->w_side].tex_y);*/ ft_draw_texture(cl, x, y, cl->tlist[cl->w_side].tex_y); - /**(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = (cl->rlist.side) ? 0x2200ffaa : 0x0000ffaa;*/ - y1++; + /* (int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = (cl->rlist.side) ? 0x2200ffaa : 0x0000ffaa; */ + y++; } ft_draw_floor(cl, y, x); return (0); -- cgit v1.2.3 From 01ce065c54d205b1d8432eebfa350f57e6f6c3a8 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Wed, 19 Feb 2020 16:34:13 +0100 Subject: yes :^) ! --- src/ft_draw_verline.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'src/ft_draw_verline.c') diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 65958ca..6cbdc00 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -39,36 +39,21 @@ static void } int8_t - ft_draw_verline(t_cub *cl, int32_t x, int32_t y1, int32_t y2) + ft_draw_verline(t_cub *cl, int32_t x, int32_t y, int32_t y2) { - int32_t y; - int32_t t; int32_t d; + int32_t tex_y; - if (y1 < 0) - y1 = 0; - if (y2 < 0) - y2 = 0; - if ((uint32_t)y2 >= cl->wlist->y_size) - y2 = cl->wlist->x_size - 1; - if (y1 > y2) - { - t = y1; - y1 = y2; - y2 = t; - } - y = y1; + (y < 0) ? (y = 0) : 0; + (y2 < 0) ? (y2 = 0) : 0; ft_draw_ceil(cl, y, x); - ft_choose_tex(cl); while (y < y2) { d = y * 256 - cl->wlist->y_size * 128 + cl->rlist.line_h * 128; - (d <= 0) ? (d = 1) : 0; - /* printf("y : %d\ny_size : %d\nd : %d\nline_h : %d\n", y1, cl->wlist->y_size, d, cl->rlist.line_h); */ - cl->tlist[cl->w_side].tex_y = ((d * cl->tlist[cl->w_side].img_w) / cl->rlist.line_h) / 256; - /*printf("w_side : %d\nd : %d\ntex_y : %d\n", cl->w_side, d, cl->tlist[cl->w_side].tex_y);*/ - ft_draw_texture(cl, x, y, cl->tlist[cl->w_side].tex_y); - /* (int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = (cl->rlist.side) ? 0x2200ffaa : 0x0000ffaa; */ + d = (d <= 0) ? (-d) : (d); + tex_y = ((d * cl->tlist[cl->w_side].img_h) / cl->rlist.line_h) / 256; + (tex_y < 0) ? (tex_y = 0) : 0; + ft_draw_texture(cl, x, y, tex_y); y++; } ft_draw_floor(cl, y, x); -- cgit v1.2.3