diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-22 14:20:24 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-22 14:20:24 +0100 |
commit | 93594e31acfa50fdcb93d7dad7233c71f6222471 (patch) | |
tree | 5ae547e64eba1608cfafa5e812aae8b80c9c12e6 /src/ft_check_missing.c | |
parent | Cured floating point exception (diff) | |
download | 42-cub3d-93594e31acfa50fdcb93d7dad7233c71f6222471.tar.gz 42-cub3d-93594e31acfa50fdcb93d7dad7233c71f6222471.tar.bz2 42-cub3d-93594e31acfa50fdcb93d7dad7233c71f6222471.tar.xz 42-cub3d-93594e31acfa50fdcb93d7dad7233c71f6222471.tar.zst 42-cub3d-93594e31acfa50fdcb93d7dad7233c71f6222471.zip |
Removed bloat
Diffstat (limited to 'src/ft_check_missing.c')
-rw-r--r-- | src/ft_check_missing.c | 128 |
1 files changed, 16 insertions, 112 deletions
diff --git a/src/ft_check_missing.c b/src/ft_check_missing.c index fb2da64..2b49d2e 100644 --- a/src/ft_check_missing.c +++ b/src/ft_check_missing.c @@ -12,49 +12,18 @@ #include <libft.h> #include <cub3d.h> -#include <unistd.h> static int - ft_check_missing_sfx(t_cub *clist) -{ - if (ft_check_not_found(FT_SFX_DEATH_PATH) < 0 || - ft_check_ext(FT_SFX_DEATH_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_DEATH, clist)); - if (ft_check_not_found(FT_SFX_N_LVL_PATH) < 0 || - ft_check_ext(FT_SFX_N_LVL_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_N_LVL, clist)); - if (ft_check_not_found(FT_SFX_SCR_ONE_PATH) < 0 || - ft_check_ext(FT_SFX_SCR_ONE_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_SCR_ONE, clist)); - if (ft_check_not_found(FT_SFX_SCR_TWO_PATH) < 0 || - ft_check_ext(FT_SFX_SCR_TWO_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_SCR_TWO, clist)); - if (ft_check_not_found(FT_SFX_TRAP_PATH) < 0 || - ft_check_ext(FT_SFX_TRAP_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_TRAP, clist)); - if (ft_check_not_found(FT_SFX_HEAL_PATH) < 0 || - ft_check_ext(FT_SFX_HEAL_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_HEAL, clist)); - if (ft_check_not_found(FT_SFX_W_ONE_LOAD_PATH) < 0 || - ft_check_ext(FT_SFX_W_ONE_LOAD_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_W_ONE_LOAD, clist)); - if (ft_check_not_found(FT_SFX_W_ONE_FIRE_PATH) < 0 || - ft_check_ext(FT_SFX_W_ONE_FIRE_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_W_ONE_FIRE, clist)); - if (ft_check_not_found(FT_SFX_W_TWO_LOAD_PATH) < 0 || - ft_check_ext(FT_SFX_W_TWO_LOAD_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_W_TWO_LOAD, clist)); - if (ft_check_not_found(FT_SFX_W_TWO_FIRE_PATH) < 0 || - ft_check_ext(FT_SFX_W_TWO_FIRE_PATH, ".wav") < 0) - return (ft_missing_error(FT_ERR_MISS_SFX_W_TWO_FIRE, clist)); - return (0); -} - -static int - ft_check_missing_sprites(t_cub *clist) + ft_check_missing_bonus(t_cub *clist) { int8_t i; + if (clist->mlist.isnlvl && !clist->mlist.nl_tex_path[0]) + return (ft_missing_error(FT_ERR_MISS_NLVL, clist)); + else if (clist->mlist.isnlvl && !clist->mlist.nlevel_path[0]) + return (ft_missing_error(FT_ERR_MISS_NLVL_PATH, clist)); + if (clist->mlist.istraps && !clist->mlist.traps_path[0]) + return (ft_missing_error(FT_ERR_MISS_TRAP, clist)); if (ft_check_not_found(FT_WEAPON_ONE_SPR_PATH) < 0 || ft_check_ext(FT_WEAPON_ONE_SPR_PATH, ".xpm") < 0) return (ft_missing_error(FT_ERR_MISS_W_ONE_SPR, clist)); @@ -71,79 +40,6 @@ static int return (ft_missing_error(FT_ERR_MISS_SPRITE, clist)); i++; } - return (ft_check_missing_sfx(clist)); -} - -static int - ft_check_missing_tex_defines(t_cub *clist) -{ - if (ft_check_not_found(FT_DEATH_SCREEN_PATH) < 0 || - ft_check_ext(FT_DEATH_SCREEN_PATH, ".xpm") < 0) - return (ft_missing_error(FT_ERR_MISS_DEATH_SCREEN, clist)); - if (ft_check_not_found(FT_HUD_BACK_PATH) < 0 || - ft_check_ext(FT_HUD_BACK_PATH, ".xpm") < 0) - return (ft_missing_error(FT_ERR_MISS_HUD_BACK, clist)); - if (ft_check_not_found(FT_WEAPON_ONE_PATH) < 0 || - ft_check_ext(FT_WEAPON_ONE_PATH, ".xpm") < 0) - return (ft_missing_error(FT_ERR_MISS_W_ONE, clist)); - if (ft_check_not_found(FT_WEAPON_TWO_PATH) < 0 || - ft_check_ext(FT_WEAPON_TWO_PATH, ".xpm") < 0) - return (ft_missing_error(FT_ERR_MISS_W_TWO, clist)); - if (ft_check_not_found(FT_WEAPON_ONE_FIRE_PATH) < 0 || - ft_check_ext(FT_WEAPON_ONE_FIRE_PATH, ".xpm") < 0) - return (ft_missing_error(FT_ERR_MISS_W_ONE_FIRE, clist)); - if (ft_check_not_found(FT_WEAPON_TWO_FIRE_PATH) < 0 || - ft_check_ext(FT_WEAPON_TWO_FIRE_PATH, ".xpm") < 0) - return (ft_missing_error(FT_ERR_MISS_W_TWO_FIRE, clist)); - if (ft_check_not_found(FT_ZER_PATH) < 0 || - ft_check_ext(FT_ZER_PATH, ".xpm") < 0 || - ft_check_not_found(FT_ONE_PATH) < 0 || - ft_check_ext(FT_ONE_PATH, ".xpm") < 0 || - ft_check_not_found(FT_TWO_PATH) < 0 || - ft_check_ext(FT_TWO_PATH, ".xpm") < 0 || - ft_check_not_found(FT_THR_PATH) < 0 || - ft_check_ext(FT_THR_PATH, ".xpm") < 0 || - ft_check_not_found(FT_FOU_PATH) < 0 || - ft_check_ext(FT_FOU_PATH, ".xpm") < 0 || - ft_check_not_found(FT_FIV_PATH) < 0 || - ft_check_ext(FT_FIV_PATH, ".xpm") < 0 || - ft_check_not_found(FT_SIX_PATH) < 0 || - ft_check_ext(FT_SIX_PATH, ".xpm") < 0 || - ft_check_not_found(FT_SEV_PATH) < 0 || - ft_check_ext(FT_SEV_PATH, ".xpm") < 0 || - ft_check_not_found(FT_EIG_PATH) < 0 || - ft_check_ext(FT_EIG_PATH, ".xpm") < 0 || - ft_check_not_found(FT_NIN_PATH) < 0 || - ft_check_ext(FT_NIN_PATH, ".xpm") < 0 || - ft_check_not_found(FT_PER_PATH) < 0 || - ft_check_ext(FT_PER_PATH, ".xpm") < 0) - return (ft_missing_error(FT_ERR_MISS_NUMBER, clist)); - return (ft_check_missing_sprites(clist)); -} - -static int - ft_check_missing_norme(t_cub *clist) -{ - if (!clist->mlist.isftex) - { - if (clist->f_rgb.r == -1 || clist->f_rgb.g == -1 - || clist->f_rgb.b == -1) - return (ft_missing_error(FT_ERR_MISS_FLOOR_C, clist)); - } - if (!clist->mlist.isctex) - { - if (clist->c_rgb.r == -1 || clist->c_rgb.g == -1 - || clist->c_rgb.b == -1) - return (ft_missing_error(FT_ERR_MISS_CEIL_C, clist)); - } - if (clist->plist.pos_x == 0 || clist->plist.pos_y == 0) - return (ft_missing_error(FT_ERR_MISS_PLAYER_SPAWN, clist)); - else if (clist->mlist.isnlvl && !clist->mlist.nl_tex_path[0]) - return (ft_missing_error(FT_ERR_MISS_NLVL, clist)); - else if (clist->mlist.isnlvl && !clist->mlist.nlevel_path[0]) - return (ft_missing_error(FT_ERR_MISS_NLVL_PATH, clist)); - if (clist->mlist.istraps && !clist->mlist.traps_path[0]) - return (ft_missing_error(FT_ERR_MISS_TRAP, clist)); return (ft_check_missing_tex_defines(clist)); } @@ -162,5 +58,13 @@ int return (ft_missing_error(FT_ERR_MISS_SPRITE, clist)); else if (clist->wlist.x_size == 0 || clist->wlist.y_size == 0) return (ft_missing_error(FT_ERR_MISS_RESOLUTION, clist)); - return (ft_check_missing_norme(clist)); + if (clist->plist.pos_x == 0 || clist->plist.pos_y == 0) + return (ft_missing_error(FT_ERR_MISS_PLAYER_SPAWN, clist)); + if (!clist->mlist.isftex && (clist->f_rgb.r == -1 || clist->f_rgb.g == -1 + || clist->f_rgb.b == -1)) + return (ft_missing_error(FT_ERR_MISS_FLOOR_C, clist)); + if (!clist->mlist.isctex && (clist->c_rgb.r == -1 || clist->c_rgb.g == -1 + || clist->c_rgb.b == -1)) + return (ft_missing_error(FT_ERR_MISS_CEIL_C, clist)); + return (ft_check_missing_bonus(clist)); } |