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++;