diff options
author | salaaad2 <arthudurant263@gmail.com> | 2020-02-26 12:19:10 +0100 |
---|---|---|
committer | salaaad2 <arthudurant263@gmail.com> | 2020-02-26 12:19:10 +0100 |
commit | 903fe03f0f6b1f70faa3139b57db24cb6c51b0a6 (patch) | |
tree | 548db2a9a7ca7a10f6e577a40ee7c4f0a8bc1561 /src/ft_raycasting.c | |
parent | gee (diff) | |
download | 42-cub3d-903fe03f0f6b1f70faa3139b57db24cb6c51b0a6.tar.gz 42-cub3d-903fe03f0f6b1f70faa3139b57db24cb6c51b0a6.tar.bz2 42-cub3d-903fe03f0f6b1f70faa3139b57db24cb6c51b0a6.tar.xz 42-cub3d-903fe03f0f6b1f70faa3139b57db24cb6c51b0a6.tar.zst 42-cub3d-903fe03f0f6b1f70faa3139b57db24cb6c51b0a6.zip |
only one floating sprite, one line / 2 correct, start and end seems flawed
Diffstat (limited to '')
-rw-r--r-- | src/ft_raycasting.c | 6 |
1 files changed, 3 insertions, 3 deletions
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) * |