diff options
author | salaaad2 <arthudurant263@gmail.com> | 2020-03-18 18:59:59 +0100 |
---|---|---|
committer | salaaad2 <arthudurant263@gmail.com> | 2020-03-18 18:59:59 +0100 |
commit | 0036fe1e23be842e8baa48162bcdb3bf632b02de (patch) | |
tree | 3e457822a4905ef2021d141d3ec7f30b29a8d57a /src/ft_draw_sprite_extra.c | |
parent | bunchoshit (diff) | |
download | 42-cub3d-0036fe1e23be842e8baa48162bcdb3bf632b02de.tar.gz 42-cub3d-0036fe1e23be842e8baa48162bcdb3bf632b02de.tar.bz2 42-cub3d-0036fe1e23be842e8baa48162bcdb3bf632b02de.tar.xz 42-cub3d-0036fe1e23be842e8baa48162bcdb3bf632b02de.tar.zst 42-cub3d-0036fe1e23be842e8baa48162bcdb3bf632b02de.zip |
gng
Diffstat (limited to '')
-rw-r--r-- | src/ft_draw_sprite_extra.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 6096522..9198e8d 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -17,7 +17,7 @@ #include <math.h> void - ft_sprite_height(t_cub *cl, t_sprite *sprite) + ft_sprite_h_w(t_cub *cl, t_sprite *sprite) { sprite->spriteheight = abs((int)(cl->wlist.y_size / (sprite->transformy))); sprite->drawstarty = -sprite->spriteheight / 2 + cl->wlist.y_size / 2; @@ -26,11 +26,6 @@ void sprite->drawendy = sprite->spriteheight / 2 + cl->wlist.y_size / 2; if (sprite->drawendy >= (int)cl->wlist.y_size) sprite->drawendy = cl->wlist.y_size - 1; -} - -void - ft_sprite_width(t_cub *cl, t_sprite *sprite) -{ sprite->spritewidth = abs((int)(cl->wlist.x_size / (sprite->transformy))); sprite->drawstartx = -sprite->spritewidth / 2 + sprite->spritescreenx; if (sprite->drawstartx < 0) @@ -40,6 +35,7 @@ void sprite->drawendx = cl->wlist.x_size - 1; } + static void ft_init_sprite(t_cub *cl, t_sprite *sprite) { @@ -63,7 +59,6 @@ void i = 0; j = 0; ft_sort_sprites(cl); - ft_sort_s_t(cl, cl->sprites); while (j < cl->mlist.sprite_var) { while (i < cl->mlist.sprite_nbr) @@ -73,8 +68,7 @@ void sprite.spritey = sprite.s_pos_x - (cl->plist.pos_x - 0.5); sprite.spritex = sprite.s_pos_y - (cl->plist.pos_y - 0.5); ft_init_sprite(cl, &sprite); - ft_sprite_height(cl, &sprite); - ft_sprite_width(cl, &sprite); + ft_sprite_h_w(cl, &sprite); ft_draw_sprite(cl, &sprite); i++; } |