aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_check_missing_defines.c
blob: 71a0486affccab9c580ad879e06d596570cd9fed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_check_missing_defines.c                         :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: joelecle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:28:42 by joelecle          #+#    #+#             */
/*   Updated: 2020/02/14 17:28:42 by joelecle         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <libft.h>
#include <cub3d.h>

static int
	ft_check_missing_other_number_defines(t_cub *clist)
{
	if (ft_check_not_found(FT_INF_PATH) < 0 ||
		ft_check_ext(FT_INF_PATH, ".xpm") < 0)
		return (ft_missing_error(FT_ERR_MISS_NUMBER, clist));
	if (ft_check_not_found(FT_CAP_HEALTH_PATH) < 0 ||
		ft_check_ext(FT_CAP_HEALTH_PATH, ".xpm") < 0)
		return (ft_missing_error(FT_ERR_MISS_H_CAPTION, clist));
	if (ft_check_not_found(FT_CAP_AMMO_PATH) < 0 ||
		ft_check_ext(FT_CAP_AMMO_PATH, ".xpm") < 0)
		return (ft_missing_error(FT_ERR_MISS_A_CAPTION, clist));
	if (clist->mlist.enemy == 1)
	{
		if (ft_check_not_found(FT_HEAL_PACK_PATH) < 0 ||
			ft_check_ext(FT_HEAL_PACK_PATH, ".xpm") < 0)
			return (ft_missing_error(FT_ERR_MISS_HEAL_PACK, clist));
	}
	else
	{
		if (ft_check_not_found(FT_HEAL_PACK_PATH) < 0 ||
			ft_check_ext(FT_HEAL_PACK_PATH, ".xpm") < 0)
			return (ft_missing_error(FT_ERR_MISS_HEAL_PACK, clist));
	}
	return (ft_check_missing_sfx(clist));
}

static int
	ft_check_missing_number_defines(t_cub *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_other_number_defines(clist));
}

static int
	ft_check_missing_more_tex_defines(t_cub *clist)
{
	if (clist->mlist.enemy == 1)
	{
		if (ft_check_not_found(FT_ENMY_WAIT_PATH) < 0 ||
			ft_check_ext(FT_ENMY_WAIT_PATH, ".xpm") < 0 ||
			ft_check_not_found(FT_ENMY_WALK_PATH) < 0 ||
			ft_check_ext(FT_ENMY_WALK_PATH, ".xpm") < 0 ||
			ft_check_not_found(FT_ENMY_FIRE_PATH) < 0 ||
			ft_check_ext(FT_ENMY_FIRE_PATH, ".xpm") < 0 ||
			ft_check_not_found(FT_ENMY_DEAD_PATH) < 0 ||
			ft_check_ext(FT_ENMY_DEAD_PATH, ".xpm") < 0)
			return (ft_missing_error(FT_ERR_MISS_ENMY, clist));
	}
	else
	{
		if (ft_check_not_found(FT_CB_WAIT_PATH) < 0 ||
			ft_check_ext(FT_CB_WAIT_PATH, ".xpm") < 0 ||
			ft_check_not_found(FT_ENMY_WALK_PATH) < 0 ||
			ft_check_ext(FT_CB_WALK_PATH, ".xpm") < 0 ||
			ft_check_not_found(FT_CB_FIRE_PATH) < 0 ||
			ft_check_ext(FT_CB_FIRE_PATH, ".xpm") < 0 ||
			ft_check_not_found(FT_CB_DEAD_PATH) < 0 ||
			ft_check_ext(FT_CB_DEAD_PATH, ".xpm") < 0)
			return (ft_missing_error(FT_ERR_MISS_ENMY, clist));
	}
	return (ft_check_missing_number_defines(clist));
}

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_THREE_PATH) < 0 ||
		ft_check_ext(FT_WEAPON_THREE_PATH, ".xpm") < 0)
		return (ft_missing_error(FT_ERR_MISS_W_THREE, 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_WEAPON_THREE_FIRE_PATH) < 0 ||
		ft_check_ext(FT_WEAPON_THREE_FIRE_PATH, ".xpm") < 0)
		return (ft_missing_error(FT_ERR_MISS_W_THREE_FIRE, clist));
	return (ft_check_missing_more_tex_defines(clist));
}