aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_check_missing_sfx.c
blob: 5248cba619affa662a36883186a00629a718c848 (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_check_missing_sfx.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_enemy_sfx(t_cub *clist)
{
	if (ft_check_not_found(FT_SFX_ENMY_DEATH_PATH) < 0 ||
			ft_check_ext(FT_SFX_ENMY_DEATH_PATH, ".wav") < 0 ||
		ft_check_not_found(FT_SFX_ENMY_SCR_ONE_PATH) < 0 ||
			ft_check_ext(FT_SFX_ENMY_SCR_ONE_PATH, ".wav") < 0 ||
		ft_check_not_found(FT_SFX_ENMY_SCR_TWO_PATH) < 0 ||
			ft_check_ext(FT_SFX_ENMY_SCR_TWO_PATH, ".wav") < 0 ||
		ft_check_not_found(FT_SFX_ENMY_FIRE_PATH) < 0 ||
			ft_check_ext(FT_SFX_ENMY_FIRE_PATH, ".wav") < 0)
		return (ft_missing_error(FT_ERR_MISS_SFX_ENMY, clist));
	return (0);
}

static int
	ft_check_missing_weapon_sfx(t_cub *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));
	if (ft_check_not_found(FT_SFX_W_THREE_LOAD_PATH) < 0 ||
		ft_check_ext(FT_SFX_W_THREE_LOAD_PATH, ".wav") < 0)
		return (ft_missing_error(FT_ERR_MISS_SFX_W_THREE_LOAD, clist));
	if (ft_check_not_found(FT_SFX_W_THREE_FIRE_PATH) < 0 ||
		ft_check_ext(FT_SFX_W_THREE_FIRE_PATH, ".wav") < 0)
		return (ft_missing_error(FT_ERR_MISS_SFX_W_THREE_FIRE, clist));
	if (ft_check_not_found(FT_SFX_OOA_PATH) < 0 ||
		ft_check_ext(FT_SFX_OOA_PATH, ".wav") < 0)
		return (ft_missing_error(FT_ERR_MISS_SFX_OOA, clist));
	return (ft_check_missing_enemy_sfx(clist));
}

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));
	return (ft_check_missing_weapon_sfx(clist));
}