-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_tex.c
38 lines (35 loc) · 1.49 KB
/
get_tex.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_tex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ttaneski <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/21 14:02:38 by ttaneski #+# #+# */
/* Updated: 2024/02/21 14:05:09 by ttaneski ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3D.h"
int get_texture(char *line, t_map *map)
{
int val;
char **format;
if ((!ft_strncmp(line, "NO", 2) && map->north_set) || (!ft_strncmp(line,
"SO", 2) && map->south_set) || (!ft_strncmp(line, "WE", 2)
&& map->west_set) || (!ft_strncmp(line, "EA", 2) && map->east_set))
return (1);
format = malloc(sizeof(char *) * 3);
if (!format)
return (2);
if (get_texture_util(line, format))
return (3);
if (format[1])
if (check_texture_extension(format[1], format, map))
return (3);
val = get_texture_util3(format, map);
if (val == 4)
return (4);
else if (val > 0)
return (3);
return (0);
}