aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_detect.c4
-rw-r--r--src/ft_draw_textures.c21
-rw-r--r--src/ft_key_loop.c2
-rw-r--r--src/ft_tex_init.c4
4 files changed, 23 insertions, 8 deletions
diff --git a/src/ft_detect.c b/src/ft_detect.c
index 10d7147..a59896a 100644
--- a/src/ft_detect.c
+++ b/src/ft_detect.c
@@ -74,7 +74,9 @@ void
cl->rlist.sqy += cl->mlist->y_step;
cl->rlist.side = 1;
}
- if (cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == '1')
+ if (cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == '1' ||
+ cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == 'L')
cl->rlist.hit = 1;
+
}
}
diff --git a/src/ft_draw_textures.c b/src/ft_draw_textures.c
index 598fd91..d632182 100644
--- a/src/ft_draw_textures.c
+++ b/src/ft_draw_textures.c
@@ -38,12 +38,19 @@ void ft_draw_texture(t_cub *cl, int x, int y, int tex_y)
void ft_choose_tex(t_cub *clist)
{
- if (clist->rlist.side == 0 && clist->rlist.x_ray_dir < 0)
- clist->w_side = 1;
- else if (clist->rlist.side == 0 && clist->rlist.x_ray_dir > 0)
- clist->w_side = 0;
- else if (clist->rlist.side == 1 && clist->rlist.y_ray_dir > 0)
- clist->w_side = 3;
+ if (clist->rlist.sqy == clist->mlist->nlx && clist->rlist.sqx == clist->mlist->nly )
+ {
+ clist->w_side = 5;
+ }
else
- clist->w_side = 2;
+ {
+ if (clist->rlist.side == 0 && clist->rlist.x_ray_dir < 0)
+ clist->w_side = 1;
+ else if (clist->rlist.side == 0 && clist->rlist.x_ray_dir > 0)
+ clist->w_side = 0;
+ else if (clist->rlist.side == 1 && clist->rlist.y_ray_dir > 0)
+ clist->w_side = 3;
+ else
+ clist->w_side = 2;
+ }
}
diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c
index a6c1690..bc7f932 100644
--- a/src/ft_key_loop.c
+++ b/src/ft_key_loop.c
@@ -40,6 +40,8 @@ int
{
cl->key_ptr[cl->key_input[i]](cl);
ft_collision(old_y, old_x, cl->plist, cl->mlist);
+ /* if (cl->mlist->isnlvl) */
+ /* ft_change_level(cl); */
i++;
}
if (cl->key_input[0] != -1)
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c
index 40e39e5..b60e405 100644
--- a/src/ft_tex_init.c
+++ b/src/ft_tex_init.c
@@ -45,4 +45,8 @@ void ft_wall_tex_init(t_cub *cl)
cl->mlist->sprite_path, &cl->tlist[4].img_w, &cl->tlist[4].img_h);
cl->tlist[4].ptr = mlx_get_data_addr(cl->tlist[4].img,
&cl->tlist[4].bpp, &cl->tlist[4].sizeline, &cl->tlist[4].endian);
+ cl->tlist[5].img = mlx_xpm_file_to_image(cl->wlist->wlx,
+ cl->mlist->nl_tex_path, &cl->tlist[5].img_w, &cl->tlist[5].img_h);
+ cl->tlist[5].ptr = mlx_get_data_addr(cl->tlist[5].img,
+ &cl->tlist[5].bpp, &cl->tlist[5].sizeline, &cl->tlist[5].endian);
}