From e40b668d7ecf6c0d15a63cd28d440ced91df2b5e Mon Sep 17 00:00:00 2001 From: djonker Date: Sat, 4 Nov 2023 05:06:16 +0100 Subject: [PATCH] bedtime --- src/draw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/draw.c b/src/draw.c index 056c317..ca60e8d 100644 --- a/src/draw.c +++ b/src/draw.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 16:54:20 by houtworm #+# #+# */ -/* Updated: 2023/11/04 03:23:55 by houtworm ######## odam.nl */ +/* Updated: 2023/11/04 04:56:26 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -110,7 +110,7 @@ void ft_drawsprites(t_varlist *vl) while (x < drawendx) { texx = (int)(256 * (x - (-spritewidth / 2 + spritescreenx)) * 64 / spritewidth) / 256; - if (transformy > 0 && x > 0 && x < vl->w && transformy < vl->zbuffer[x] + 0.5) + if (transformy > 0 && x > 0 && x < vl->w && transformy < vl->zbuffer[x] + 0.7) { y = drawstarty; while (y < drawendy) @@ -118,7 +118,7 @@ void ft_drawsprites(t_varlist *vl) d = (y - vmovescreen) * 256 - vl->h * 128 + spriteheight * 128; texy = (d * 64) / spriteheight / 256; uint8_t *texel; - texel = &sprite->pixels[(sprite->width * texy + texx) * sprite->bytes_per_pixel]; + texel = &sprite->pixels[(sprite->width * texy + texx) * 4]; color = texel[0] << 24 | texel[1] << 16 | texel[2] << 8 | texel[3]; if (color != 0x980088FF) mlx_put_pixel(vl->img, x, y, color); @@ -183,7 +183,7 @@ void ft_drawline(int x, t_varlist *vl, int drawstart, int drawend) textpos += step; uint8_t *texel; uint32_t color; - texel = &vl->curtext->pixels[(vl->curtext->width * texty + textx) * vl->curtext->bytes_per_pixel]; + texel = &vl->curtext->pixels[(vl->curtext->width * texty + textx) * 4]; color = texel[0] << 24 | texel[1] << 16 | texel[2] << 8 | texel[3]; mlx_put_pixel(vl->img, x, y, color); y++;