diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-28 13:59:29 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-28 13:59:29 +0100 |
commit | 4bcf56150b67f9e8ac21180cbe62cd64102a5f8f (patch) | |
tree | 44007b988eb756616f259fd08e11dc471b4f492d /src/ft_floor_cast_inits.c | |
parent | Five threads for compat (diff) | |
download | 42-cub3d-4bcf56150b67f9e8ac21180cbe62cd64102a5f8f.tar.gz 42-cub3d-4bcf56150b67f9e8ac21180cbe62cd64102a5f8f.tar.bz2 42-cub3d-4bcf56150b67f9e8ac21180cbe62cd64102a5f8f.tar.xz 42-cub3d-4bcf56150b67f9e8ac21180cbe62cd64102a5f8f.tar.zst 42-cub3d-4bcf56150b67f9e8ac21180cbe62cd64102a5f8f.zip |
Fixed floor segv
Diffstat (limited to '')
-rw-r--r-- | src/ft_floor_cast_inits.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ft_floor_cast_inits.c b/src/ft_floor_cast_inits.c index d1f2811..68bb0c7 100644 --- a/src/ft_floor_cast_inits.c +++ b/src/ft_floor_cast_inits.c @@ -13,6 +13,7 @@ #include <cub3d.h> #include <stdint.h> +#include <libft.h> void ft_set_fc_tex_xy(uint8_t tid, uint16_t x, uint16_t y, t_cub *cl) { @@ -23,8 +24,10 @@ void * (cl->rlist.y_floor - y_cell)); cl->tlist[tid].tex_y = (int32_t)(cl->tlist[tid].img_w * (cl->rlist.x_floor - x_cell)); - cl->rlist.fc_tex_x_tab[tid - 6][y][x] = cl->tlist[tid].tex_x; - cl->rlist.fc_tex_y_tab[tid - 6][y][x] = cl->tlist[tid].tex_y; + cl->rlist.fc_tex_x_tab[tid - 6][y][x] = (cl->tlist[tid].tex_x >= 0) ? + (cl->tlist[tid].tex_x) : (-cl->tlist[tid].tex_x); + cl->rlist.fc_tex_y_tab[tid - 6][y][x] = (cl->tlist[tid].tex_y >= 0) ? + (cl->tlist[tid].tex_y) : (-cl->tlist[tid].tex_y); } void |