diff options
author | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-02-28 19:22:58 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-02-28 19:22:58 +0100 |
commit | 36e4ca1eeffa78d57767fced53fd16df17d75373 (patch) | |
tree | fcfc0dcfb5b39c7b026d577194f10f34fa3f3771 | |
parent | Parsed (diff) | |
download | 42-cub3d-36e4ca1eeffa78d57767fced53fd16df17d75373.tar.gz 42-cub3d-36e4ca1eeffa78d57767fced53fd16df17d75373.tar.bz2 42-cub3d-36e4ca1eeffa78d57767fced53fd16df17d75373.tar.xz 42-cub3d-36e4ca1eeffa78d57767fced53fd16df17d75373.tar.zst 42-cub3d-36e4ca1eeffa78d57767fced53fd16df17d75373.zip |
L is now crapaud and you can pass through :^)
-rw-r--r-- | inc/cub3d_structs.h | 2 | ||||
-rw-r--r-- | media/img/crapaud.xpm | 2 | ||||
-rw-r--r-- | src/ft_detect.c | 4 | ||||
-rw-r--r-- | src/ft_draw_textures.c | 21 | ||||
-rw-r--r-- | src/ft_key_loop.c | 2 | ||||
-rw-r--r-- | src/ft_tex_init.c | 4 |
6 files changed, 25 insertions, 10 deletions
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index e20252e..0ed8e63 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -141,7 +141,7 @@ typedef struct s_cub struct s_img img; struct s_rgb f_rgb; struct s_rgb c_rgb; - struct s_img tlist[5]; + struct s_img tlist[6]; struct s_sprite sp_list; } t_cub; diff --git a/media/img/crapaud.xpm b/media/img/crapaud.xpm index cbe2bad..68c580d 100644 --- a/media/img/crapaud.xpm +++ b/media/img/crapaud.xpm @@ -1,7 +1,7 @@ /* XPM */ static char *e3b8d995ecd34259c3c27ef1d0996c44[] = { /* columns rows colors chars-per-pixel */ -"1024 643 256 2 ", +"643 643 256 2 ", " c #030302", ". c #0A0403", "X c #0A0906", 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); } |