This commit is contained in:
djonker 2023-11-04 05:06:16 +01:00
parent c20a056263
commit e40b668d7e

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* 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++;