aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_sprite.c
diff options
context:
space:
mode:
authorsalaaad2 <arthudurant263@gmail.com>2020-02-25 18:09:57 +0100
committersalaaad2 <arthudurant263@gmail.com>2020-02-25 18:09:57 +0100
commit3f8b598e0a1b60475fdf8aa98c601b4513a24efa (patch)
treecdaee1e850e0b3a5d790ee4ccf07f33a5778d637 /src/ft_draw_sprite.c
parent??? (diff)
download42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.tar.gz
42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.tar.bz2
42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.tar.xz
42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.tar.zst
42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.zip
gee
Diffstat (limited to 'src/ft_draw_sprite.c')
-rw-r--r--src/ft_draw_sprite.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index 03d3ca7..701587f 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -21,6 +21,7 @@ void
ft_draw_sprite(t_cub *cl, t_sprite *sprite)
{
int32_t d;
+
sprite->x = sprite->drawstartx;
while (sprite->x < sprite->drawendx)
{
@@ -31,14 +32,15 @@ void
sprite->x < (int32_t)cl->wlist->x_size)
while (sprite->y < sprite->drawendy)
{
+ puts("qwe");
d = (sprite->y) * 256 - cl->wlist->y_size * 128 +
sprite->spriteheight * 128;
sprite->tex_y = ((d * cl->tlist[4].img_h) /
- sprite->spriteheight) / 256;
+ sprite->spriteheight) / 128;
if (*(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y *
cl->tlist[4].sizeline / 4))
- *(cl->img.ptr + sprite->x + sprite->y *
- cl->img.sizeline / 4) =
+ cl->img.ptr[sprite->x + sprite->y *
+ cl->img.sizeline / 4] =
*(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y * cl->tlist[4].sizeline / 4);
sprite->y++;
}