From 903fe03f0f6b1f70faa3139b57db24cb6c51b0a6 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Wed, 26 Feb 2020 12:19:10 +0100 Subject: only one floating sprite, one line / 2 correct, start and end seems flawed --- src/ft_raycasting.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ft_raycasting.c') diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index 59021d3..e7cc4ef 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -47,12 +47,12 @@ void t_sprite sprite; sprite = cl->sprites; - sprite.spritex = (sprite.spritex + 0.5) - cl->plist->pos_x; - sprite.spritey = (sprite.spritey + 0.5) - cl->plist->pos_y; + sprite.spritex = (sprite.spritex + 1) - cl->plist->pos_x; + sprite.spritey = (sprite.spritey + 1) - cl->plist->pos_y; sprite.invdet = 1.0 / (cl->plist->plane_x * cl->plist->dir_y - cl->plist->dir_x * cl->plist->plane_y); sprite.transformx = sprite.invdet * (cl->plist->dir_y * - sprite.spritex - cl->plist->dir_x * sprite.spritey); + sprite.spritey - cl->plist->dir_x * 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) * -- cgit v1.2.3