diff options
Diffstat (limited to 'src/ft_floor_cast_inits.c')
-rw-r--r-- | src/ft_floor_cast_inits.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ft_floor_cast_inits.c b/src/ft_floor_cast_inits.c index d1f2811..92b660b 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 @@ -58,7 +61,7 @@ void { if (cl->mlist.isftex) ft_set_fc_tex_xy(6, x, y, cl); - if (cl->mlist.isctex && !cl->mlist.isskybox) + if (cl->mlist.isctex) ft_set_fc_tex_xy(7, x, cl->wlist.y_size - y - 1, cl); } cl->rlist.x_floor += cl->mlist.x_floor_step; |