aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_sprite.c
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2020-02-28 13:39:36 +0100
committersalaaad2 <arthurdurant263@gmail.com>2020-02-28 13:39:36 +0100
commit1073379d9815d1f463310e661d3aabcf53c594e2 (patch)
tree99adddb9205e6e6e75862d7f40781c4036a4a2d3 /src/ft_draw_sprite.c
parenton est al (diff)
download42-cub3d-1073379d9815d1f463310e661d3aabcf53c594e2.tar.gz
42-cub3d-1073379d9815d1f463310e661d3aabcf53c594e2.tar.bz2
42-cub3d-1073379d9815d1f463310e661d3aabcf53c594e2.tar.xz
42-cub3d-1073379d9815d1f463310e661d3aabcf53c594e2.tar.zst
42-cub3d-1073379d9815d1f463310e661d3aabcf53c594e2.zip
hooooooooooooooooooooo
Diffstat (limited to 'src/ft_draw_sprite.c')
-rw-r--r--src/ft_draw_sprite.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index 45f9217..d99e1be 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -24,10 +24,6 @@ void
printf("start x : %d\nstart y : %d\nend x : %d\nend y : %d\n", sprite->drawstartx, sprite->drawstarty, sprite->drawendy, sprite->drawendy);
sprite->x = sprite->drawstartx;
- /* sprite->drawstartx = 1000; */
- /* sprite->drawstarty = 200; */
- /* sprite->drawendx = 700; */
- /* sprite->drawendy = 1000; */
while (sprite->x < sprite->drawendx)
{
sprite->tex_x = (int32_t)((sprite->x - (-sprite->spritewidth / 2 +
@@ -37,20 +33,24 @@ void
sprite->x < (int32_t)cl->wlist->x_size)
while (sprite->y < sprite->drawendy)
{
- d = (sprite->y) * 256 - cl->wlist->y_size * 128 +
+ d = sprite->y * 256 - cl->wlist->y_size * 128 +
sprite->spriteheight * 128;
sprite->tex_y = ((d * cl->tlist[4].img_h) /
sprite->spriteheight) / 128;
- if (*(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y *
- cl->tlist[4].sizeline / 4))
+ if (cl->tlist[4].ptr[sprite->tex_x * 4 + 4 * cl->tlist[4].img_h * sprite->tex_y] != 0)
{
- cl->img.ptr[sprite->x + sprite->y *
- cl->img.sizeline] =
- *(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y * cl->tlist[4].sizeline / 4);
-
+ cl->img.ptr[sprite->x * 4 + (sprite->y *
+ cl->img.sizeline)] =
+ cl->tlist[4].ptr[sprite->tex_x * 4 + 4 * cl->tlist[4].img_h * sprite->tex_y];
+ cl->img.ptr[sprite->x * 4 + (sprite->y *
+ cl->img.sizeline) + 1] =
+ cl->tlist[4].ptr[sprite->tex_x * 4 + 4 * cl->tlist[4].img_h * sprite->tex_y + 1];
+ cl->img.ptr[sprite->x * 4 + (sprite->y *
+ cl->img.sizeline) + 2] =
+ cl->tlist[4].ptr[sprite->tex_x * 4 + 4 * cl->tlist[4].img_h * sprite->tex_y + 2];
}
sprite->y++;
}
- sprite->x++;
- }
+ sprite->x++;
+ }
}