diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-03 16:14:26 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-03 16:14:26 +0100 |
commit | ce43b1cd1caa539af687425f58a6999a20807878 (patch) | |
tree | 34631aef16b6eb1d5d650fe9e900916f9810215d /src/ft_draw_verline.c | |
parent | Makefile update (diff) | |
download | 42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.gz 42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.bz2 42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.xz 42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.tar.zst 42-cub3d-ce43b1cd1caa539af687425f58a6999a20807878.zip |
Going full stack is bav
Diffstat (limited to '')
-rw-r--r-- | src/ft_draw_verline.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 7b74d4a..d9a35cc 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -15,10 +15,10 @@ static void ft_draw_floor(t_cub *cl, int32_t y, int32_t x) { - while ((uint32_t)y < cl.wlist.y_size) + while ((uint32_t)y < cl->wlist.y_size) { - *(int*)(cl.img.ptr + - (x * 4 + (y * cl.img.sizeline))) = ft_rgb_to_hex(cl.f_rgb); + *(int*)(cl->img.ptr + + (x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(cl->f_rgb); y++; } } @@ -31,8 +31,8 @@ static void i = 0; while (i <= y) { - *(int*)(cl.img.ptr + - (x * 4 + (i * cl.img.sizeline))) = ft_rgb_to_hex(cl.c_rgb); + *(int*)(cl->img.ptr + + (x * 4 + (i * cl->img.sizeline))) = ft_rgb_to_hex(cl->c_rgb); i++; } } @@ -49,21 +49,21 @@ static void ** i = 0; ** while (i < y) ** { -** d = i * 256 - cl.wlist.y_size * 128 + cl.rlist.line_h * 128; +** d = i * 256 - cl->wlist.y_size * 128 + cl->rlist.line_h * 128; ** d = (d <= 0) ? (-d) : (d); ** ft_printf("%d\n", d); -** tex_y = ((d * cl.tlist[1].img_h) / cl.rlist.line_h) / 256; +** tex_y = ((d * cl->tlist[1].img_h) / cl->rlist.line_h) / 256; ** (tex_y <= 0) ? (tex_y = 1) : 0; -** cl.img.ptr[x * 4 + (cl.img.sizeline * i)] = -** (int8_t)cl.tlist[1].ptr[cl.tlist[1].tex_x * 4 + 4 * -** cl.tlist[1].img_h * tex_y]; -** cl.img.ptr[x * 4 + (cl.img.sizeline * i) + 1] = -** (int8_t)cl.tlist[1].ptr[cl.tlist[1].tex_x * 4 + 4 * -** cl.tlist[1].img_h * tex_y + 1]; -** cl.img.ptr[x * 4 + (cl.img.sizeline * i) + 2] = -** (int8_t)cl.tlist[1].ptr[cl.tlist[1].tex_x * 4 + 4 * -** cl.tlist[1].img_h * tex_y + 2]; -** cl.img.ptr[x * 4 + cl.wlist.x_size * i + 3] = (char)0; +** cl->img.ptr[x * 4 + (cl->img.sizeline * i)] = +** (int8_t)cl->tlist[1].ptr[cl->tlist[1].tex_x * 4 + 4 * +** cl->tlist[1].img_h * tex_y]; +** cl->img.ptr[x * 4 + (cl->img.sizeline * i) + 1] = +** (int8_t)cl->tlist[1].ptr[cl->tlist[1].tex_x * 4 + 4 * +** cl->tlist[1].img_h * tex_y + 1]; +** cl->img.ptr[x * 4 + (cl->img.sizeline * i) + 2] = +** (int8_t)cl->tlist[1].ptr[cl->tlist[1].tex_x * 4 + 4 * +** cl->tlist[1].img_h * tex_y + 2]; +** cl->img.ptr[x * 4 + cl->wlist.x_size * i + 3] = (char)0; ** i++; ** } ** } @@ -78,12 +78,12 @@ int8_t (y < 0) ? (y = 0) : 0; (y2 < 0) ? (y2 = 0) : 0; ft_draw_ceil(cl, y, x); - (cl.rlist.line_h <= 0) ? (cl.rlist.line_h = 1) : 0; + (cl->rlist.line_h <= 0) ? (cl->rlist.line_h = 1) : 0; while (y < y2) { - d = y * 256 - cl.wlist.y_size * 128 + cl.rlist.line_h * 128; + d = y * 256 - cl->wlist.y_size * 128 + cl->rlist.line_h * 128; d = (d <= 0) ? (-d) : (d); - tex_y = ((d * cl.tlist[cl.w_side].img_h) / cl.rlist.line_h) / 256; + tex_y = ((d * cl->tlist[cl->w_side].img_h) / cl->rlist.line_h) / 256; (tex_y <= 0) ? (tex_y = 1) : 0; ft_draw_texture(cl, x, y, tex_y); y++; |