aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_sprite.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-03-12 18:56:59 +0100
committerRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-03-12 18:56:59 +0100
commit141fb4d33f73cac99b1b19e475f83fb755f208a2 (patch)
treee93c2d490440caee29f2c85d86c9dc9bd8512a28 /src/ft_draw_sprite.c
parentkk (diff)
download42-cub3d-141fb4d33f73cac99b1b19e475f83fb755f208a2.tar.gz
42-cub3d-141fb4d33f73cac99b1b19e475f83fb755f208a2.tar.bz2
42-cub3d-141fb4d33f73cac99b1b19e475f83fb755f208a2.tar.xz
42-cub3d-141fb4d33f73cac99b1b19e475f83fb755f208a2.tar.zst
42-cub3d-141fb4d33f73cac99b1b19e475f83fb755f208a2.zip
good
Diffstat (limited to '')
-rw-r--r--src/ft_draw_sprite.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index effaf78..73f277a 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -43,20 +43,20 @@ void
it = 0;
jt = 0;
- while (jt < cl->mlist.sprite_var)
- {
- while (it < cl->mlist.sprite_nbr)
- {
- dist_tab[it] = ((cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) *
- (cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) +
- (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y) *
- (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y));
- cl->mlist.sprite_order[it] = it;
- it++;
- }
- it = 0;
- jt++;
- }
+ while (jt < cl->mlist.sprite_var)
+ {
+ while (it < cl->mlist.sprite_nbr)
+ {
+ dist_tab[it] = ((cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) *
+ (cl->plist.pos_x - cl->sprites[jt][it].s_pos_x) +
+ (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y) *
+ (cl->plist.pos_y - cl->sprites[jt][it].s_pos_y));
+ cl->mlist.sprite_order[it] = it;
+ it++;
+ }
+ it = 0;
+ jt++;
+ }
it = 0;
while (it < cl->mlist.sprite_nbr)
{
@@ -77,13 +77,13 @@ static void
calc = (calc < 1) ? (1) : (calc);
cl->img.ptr[sprite->x * 4 + (sprite->y * cl->img.sizeline)] =
(uint8_t)cl->tlist[sprite->current_sprite].ptr[sprite->tex_x * 4 + 4 *
- cl->tlist[sprite->current_sprite].img_h * sprite->tex_y] / calc;
+ cl->tlist[sprite->current_sprite].img_h * sprite->tex_y] / calc;
cl->img.ptr[sprite->x * 4 + (sprite->y * cl->img.sizeline) + 1] =
(uint8_t)cl->tlist[sprite->current_sprite].ptr[sprite->tex_x * 4 + 4 *
- cl->tlist[sprite->current_sprite].img_h * sprite->tex_y + 1] / calc;
+ cl->tlist[sprite->current_sprite].img_h * sprite->tex_y + 1] / calc;
cl->img.ptr[sprite->x * 4 + (sprite->y * cl->img.sizeline) + 2] =
(uint8_t)cl->tlist[sprite->current_sprite].ptr[sprite->tex_x * 4 + 4 *
- cl->tlist[sprite->current_sprite].img_h * sprite->tex_y + 2] / calc;
+ cl->tlist[sprite->current_sprite].img_h * sprite->tex_y + 2] / calc;
cl->img.ptr[sprite->x * 4 + cl->wlist.x_size * sprite->y + 3] = (char)0;
}
@@ -96,7 +96,8 @@ void
while (sprite->x < sprite->drawendx)
{
sprite->tex_x = (int32_t)((sprite->x - (-sprite->spritewidth / 2 +
- sprite->spritescreenx)) * cl->tlist[sprite->current_sprite].img_w / sprite->spritewidth);
+ sprite->spritescreenx))
+ * cl->tlist[sprite->current_sprite].img_w / sprite->spritewidth);
sprite->y = sprite->drawstarty;
while (sprite->y < sprite->drawendy)
{
@@ -104,12 +105,11 @@ void
sprite->spriteheight * 128;
sprite->tex_y = ((d * cl->tlist[sprite->current_sprite].img_h / 2) /
sprite->spriteheight) / 128;
- if (sprite->transformy > 0 && cl->tlist[sprite->current_sprite].ptr[sprite->tex_x * 4 + 4 *
+ if (sprite->transformy > 0 &&
+ cl->tlist[sprite->current_sprite].ptr[sprite->tex_x * 4 + 4 *
cl->tlist[sprite->current_sprite].img_h * sprite->tex_y]
&& cl->rlist.wall_dist_tab[sprite->x] > sprite->transformy)
- {
ft_put_sprite(sprite, cl);
- }
sprite->y++;
}
sprite->x++;