diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-22 15:38:28 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-22 15:38:28 +0100 |
commit | 1363bda556bf08657bf19ff79e93319c17c22fc1 (patch) | |
tree | 9d67fd461d9dec00b65deba03aca94cda7cae0dd | |
parent | Pretty bav (diff) | |
download | 42-cub3d-1363bda556bf08657bf19ff79e93319c17c22fc1.tar.gz 42-cub3d-1363bda556bf08657bf19ff79e93319c17c22fc1.tar.bz2 42-cub3d-1363bda556bf08657bf19ff79e93319c17c22fc1.tar.xz 42-cub3d-1363bda556bf08657bf19ff79e93319c17c22fc1.tar.zst 42-cub3d-1363bda556bf08657bf19ff79e93319c17c22fc1.zip |
More norm
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | inc/cub3d.h | 1 | ||||
-rw-r--r-- | src/ft_get_player_spawn.c | 5 | ||||
-rw-r--r-- | src/ft_get_spawns.c | 26 | ||||
-rw-r--r-- | src/ft_get_sprite_spawns.c | 1 | ||||
-rw-r--r-- | src/ft_hooks_and_loops.c | 2 | ||||
-rw-r--r-- | src/ft_parse_map.c | 4 |
7 files changed, 31 insertions, 9 deletions
@@ -119,6 +119,7 @@ SRCS_NAME += ft_check_missing_sfx.c SRCS_NAME += ft_del_tex.c SRCS_NAME += ft_del_map.c SRCS_NAME += ft_del_lists.c +SRCS_NAME += ft_get_spawns.c #--------------------------------------------------------------------------------------------------# SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME}) #--------------------------------------------------------------------------------------------------# diff --git a/inc/cub3d.h b/inc/cub3d.h index b8b6681..853eb5b 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -140,6 +140,7 @@ int ft_check_missing_sfx(t_cub *clist); int ft_missing_error(const char *err, t_cub *clist); int ft_map_error(const char *errmsg, t_cub *clist); size_t ft_get_line_len(char *line); +void ft_get_spawns(t_cub *cl); /* ** ====== ARGS ====== diff --git a/src/ft_get_player_spawn.c b/src/ft_get_player_spawn.c index 0d9018a..c506775 100644 --- a/src/ft_get_player_spawn.c +++ b/src/ft_get_player_spawn.c @@ -82,11 +82,6 @@ void plist->start_x = plist->pos_x; plist->start_y = plist->pos_y; ft_get_start_side(clist->mlist.map[y][x], plist); - ft_get_sprite_spawn(clist); - ft_get_trap_spawn(clist); - ft_get_heal_spawn(clist); - if (clist->isdead == 0) - ft_get_weapon_spawn(clist); return ; } x++; diff --git a/src/ft_get_spawns.c b/src/ft_get_spawns.c new file mode 100644 index 0000000..6422785 --- /dev/null +++ b/src/ft_get_spawns.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_get_sprite_spawns.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:51 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:51 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> +#include <stdint.h> + +void + ft_get_spawns(t_cub *cl) +{ + ft_get_player_spawn(&cl->plist, cl); + ft_get_sprite_spawn(cl); + ft_get_trap_spawn(cl); + ft_get_heal_spawn(cl); + if (cl->isdead == 0) + ft_get_weapon_spawn(cl); +} diff --git a/src/ft_get_sprite_spawns.c b/src/ft_get_sprite_spawns.c index d7b6677..c24ba85 100644 --- a/src/ft_get_sprite_spawns.c +++ b/src/ft_get_sprite_spawns.c @@ -13,7 +13,6 @@ #include <libft.h> #include <cub3d.h> #include <stdint.h> -#include <stdio.h> void ft_get_next_sprite(t_cub *clist, int s_n, char c, size_t x) diff --git a/src/ft_hooks_and_loops.c b/src/ft_hooks_and_loops.c index 9293496..b8bdd36 100644 --- a/src/ft_hooks_and_loops.c +++ b/src/ft_hooks_and_loops.c @@ -15,7 +15,7 @@ #include <mlx.h> void -ft_hooks_and_loops(t_win *wl, t_cub *cl) + ft_hooks_and_loops(t_win *wl, t_cub *cl) { mlx_hook(wl->winptr, 2, (1L << 0), ft_key_event, cl); mlx_hook(wl->winptr, 3, (1L << 1), ft_key_release, cl); diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index 057b053..46fe022 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -74,7 +74,7 @@ static int8_t return (ret); } -void +static void ft_save_name(const char *map_path, t_cub *clist) { ft_memdel((void*)&clist->mlist.filename); @@ -105,7 +105,7 @@ void ft_map_error(clist->errmsg, clist); ft_check_map_last_line(clist); ft_check_map_surrounds(&clist->mlist, clist); - ft_get_player_spawn(&clist->plist, clist); + ft_get_spawns(clist); ft_get_nlvl_pos(&clist->mlist); ft_check_missing(clist); ft_set_minimap_scale(clist); |