diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_check_map_line.c | 2 | ||||
-rw-r--r-- | src/ft_exit.c | 2 | ||||
-rw-r--r-- | src/ft_get_traps.c | 28 | ||||
-rw-r--r-- | src/ft_init_funptr.c | 2 | ||||
-rw-r--r-- | src/ft_init_map.c | 4 | ||||
-rw-r--r-- | src/ft_select_get.c | 4 | ||||
-rw-r--r-- | src/ft_tex_init.c | 2 | ||||
-rw-r--r-- | src/ft_warp_level.c | 2 |
8 files changed, 41 insertions, 5 deletions
diff --git a/src/ft_check_map_line.c b/src/ft_check_map_line.c index 7fa68b7..c88e1f5 100644 --- a/src/ft_check_map_line.c +++ b/src/ft_check_map_line.c @@ -37,6 +37,8 @@ static int8_t ft_sprintf(clist->errmsg, FT_ERR_MULT_NLVL); return (-1); } + if (line[i] == 'T') + clist->mlist.istraps = 1; return (0); } diff --git a/src/ft_exit.c b/src/ft_exit.c index 4125567..4a131c8 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -62,7 +62,7 @@ static void mlx_destroy_image(clist->wlist.wlx, clist->tlist[6].img); if (clist->mlist.isctex && clist->tlist[7].img) mlx_destroy_image(clist->wlist.wlx, clist->tlist[7].img); - if (clist->mlist.istrap && clist->tlist[15].img) + if (clist->mlist.istraps && clist->tlist[15].img) mlx_destroy_image(clist->wlist.wlx, clist->tlist[15].img); } diff --git a/src/ft_get_traps.c b/src/ft_get_traps.c index cdc05de..0235bb5 100644 --- a/src/ft_get_traps.c +++ b/src/ft_get_traps.c @@ -14,6 +14,34 @@ #include <cub3d.h> #include <stdint.h> +void + ft_get_trap_spawn(t_cub *clist) +{ + size_t x; + size_t y; + uint8_t i; + + x = 1; + y = 1; + i = 0; + while (clist->mlist.map[y]) + { + while (clist->mlist.map[y][x]) + { + if (clist->mlist.map[y][x] == 'T') + { + clist->mlist.traps_nbr++; + clist->traps[i].s_pos_x = x; + clist->traps[i].s_pos_y = y; + i++; + } + x++; + } + x = 1; + y++; + } +} + int8_t ft_get_traps(char **words, t_cub *clist) { diff --git a/src/ft_init_funptr.c b/src/ft_init_funptr.c index c74b2c8..c299336 100644 --- a/src/ft_init_funptr.c +++ b/src/ft_init_funptr.c @@ -55,5 +55,5 @@ void clist->get_ptr[10] = ft_get_music; clist->get_ptr[11] = ft_get_darkness; clist->get_ptr[12] = ft_get_skybox; - clist->get_ptr[14] = ft_get_traps; + clist->get_ptr[13] = ft_get_traps; } diff --git a/src/ft_init_map.c b/src/ft_init_map.c index f2b0726..867a5b0 100644 --- a/src/ft_init_map.c +++ b/src/ft_init_map.c @@ -61,7 +61,9 @@ int8_t mlist->isnlvl = 0; mlist->ismusic = 0; mlist->isskybox = 0; - mlist->istrap = 0; + mlist->istraps = 0; + mlist->sprite_nbr = 0; + mlist->traps_nbr = 0; mlist->darklvl = 0; mlist->scale = 0; mlist->nlx = 0; diff --git a/src/ft_select_get.c b/src/ft_select_get.c index 2a95309..f748721 100644 --- a/src/ft_select_get.c +++ b/src/ft_select_get.c @@ -53,6 +53,10 @@ static int8_t return (-1); if (ret == 10 && (clist->mlist.music_path[0])) return (-1); + if (ret == 12 && (clist->mlist.skybox_path[0])) + return (-1); + if (ret == 13 && (clist->mlist.traps_path[0])) + return (-1); return (ret); } diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c index 32bfb66..30b738e 100644 --- a/src/ft_tex_init.c +++ b/src/ft_tex_init.c @@ -71,7 +71,7 @@ static void cl->tlist[6].ptr = mlx_get_data_addr(cl->tlist[6].img, &cl->tlist[6].bpp, &cl->tlist[6].sizeline, &cl->tlist[6].endian); } - if (cl->mlist.istrap) + if (cl->mlist.istraps) { cl->tlist[15].img = mlx_xpm_file_to_image(cl->wlist.wlx, cl->mlist.traps_path, &cl->tlist[15].img_w, &cl->tlist[15].img_h); diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c index a4f705b..faaf322 100644 --- a/src/ft_warp_level.c +++ b/src/ft_warp_level.c @@ -61,7 +61,7 @@ static void mlx_destroy_image(cl->wlist.wlx, cl->tlist[6].img); if (cl->mlist.isctex && cl->tlist[7].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[7].img); - if (cl->mlist.istrap && cl->tlist[15].img) + if (cl->mlist.istraps && cl->tlist[15].img) mlx_destroy_image(cl->wlist.wlx, cl->tlist[15].img); } |