aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_sprite_extra.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-02 16:16:45 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-02 16:16:45 +0200
commitf922d1ed3235e3ce61c4e74420ae31354eb829d9 (patch)
treefaa1bea9c60dbbf79b91dded0ce9ef1afd552357 /src/ft_draw_sprite_extra.c
parentCorrect ray_pos (diff)
download42-cub3d-f922d1ed3235e3ce61c4e74420ae31354eb829d9.tar.gz
42-cub3d-f922d1ed3235e3ce61c4e74420ae31354eb829d9.tar.bz2
42-cub3d-f922d1ed3235e3ce61c4e74420ae31354eb829d9.tar.xz
42-cub3d-f922d1ed3235e3ce61c4e74420ae31354eb829d9.tar.zst
42-cub3d-f922d1ed3235e3ce61c4e74420ae31354eb829d9.zip
Revert this if needed, still sprites and collision to do
Diffstat (limited to 'src/ft_draw_sprite_extra.c')
-rw-r--r--src/ft_draw_sprite_extra.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c
index bb26cc2..e19fbf2 100644
--- a/src/ft_draw_sprite_extra.c
+++ b/src/ft_draw_sprite_extra.c
@@ -38,11 +38,12 @@ void
static void
ft_init_sprite(t_cub *cl, t_sprite *sprite)
{
- sprite->invdet = 1.0 / (cl->plist.plane_x * cl->plist.dir_x
- - cl->plist.dir_y * cl->plist.plane_y);
+ sprite->invdet = 1.0 /
+ (cl->plist.plane_x * cl->plist.dir_x
+ - cl->plist.dir_y * cl->plist.plane_y);
sprite->transformx = sprite->invdet * (cl->plist.dir_x * sprite->spritex
- cl->plist.dir_y * sprite->spritey);
- sprite->transformy = sprite->invdet * (-cl->plist.plane_y * sprite->spritex
+ sprite->transformy = sprite->invdet * (cl->plist.plane_y * sprite->spritex
+ cl->plist.plane_x * sprite->spritey);
sprite->spritescreenx = (int)(cl->wlist.x_size / 2) *
(1 + sprite->transformx / sprite->transformy);