aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_sprite.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-27 16:44:30 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-27 16:44:30 +0100
commit44d5f7f4da8465f4829de1232e4cf2c6c2bf76bc (patch)
tree0926de3e4bebc9015b7806bcdeb99818d84af9ae /src/ft_draw_sprite.c
parentProblem (diff)
download42-cub3d-44d5f7f4da8465f4829de1232e4cf2c6c2bf76bc.tar.gz
42-cub3d-44d5f7f4da8465f4829de1232e4cf2c6c2bf76bc.tar.bz2
42-cub3d-44d5f7f4da8465f4829de1232e4cf2c6c2bf76bc.tar.xz
42-cub3d-44d5f7f4da8465f4829de1232e4cf2c6c2bf76bc.tar.zst
42-cub3d-44d5f7f4da8465f4829de1232e4cf2c6c2bf76bc.zip
Segv fix
Diffstat (limited to 'src/ft_draw_sprite.c')
-rw-r--r--src/ft_draw_sprite.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index 2aa1b43..1b3f912 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -76,11 +76,11 @@ static void
+ powf(cl->plist.pos_y - sprite->s_pos_y, 2))) <= 0)
dist = 0.0001;
rgb.r = (uint8_t)cl->tlist[sprite->current_sprite].ptr[sprite->tex_x
- * 4 + 4 * cl->tlist[sprite->current_sprite].img_h * sprite->tex_y + 2];
+ * 4 + 4 * cl->tlist[sprite->current_sprite].img_w * sprite->tex_y + 2];
rgb.g = (uint8_t)cl->tlist[sprite->current_sprite].ptr[sprite->tex_x
- * 4 + 4 * cl->tlist[sprite->current_sprite].img_h * sprite->tex_y + 1];
+ * 4 + 4 * cl->tlist[sprite->current_sprite].img_w * sprite->tex_y + 1];
rgb.b = (uint8_t)cl->tlist[sprite->current_sprite].ptr[sprite->tex_x
- * 4 + 4 * cl->tlist[sprite->current_sprite].img_h * sprite->tex_y];
+ * 4 + 4 * cl->tlist[sprite->current_sprite].img_w * sprite->tex_y];
*(int*)(cl->img.ptr + ((uint16_t)sprite->x * 4 +
(sprite->y * cl->img.sizeline))) = ft_rgb_to_hex(dist, rgb, cl);
}
@@ -105,7 +105,7 @@ void
sprite->spriteheight) / 128;
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->tlist[sprite->current_sprite].img_w * sprite->tex_y]
&& cl->rlist.wall_dist_tab[sprite->x] > sprite->transformy)
ft_put_sprite(sprite, cl);
sprite->y++;