-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.c
83 lines (74 loc) · 1.89 KB
/
utils.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
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mehtel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/23 21:15:35 by mehtel #+# #+# */
/* Updated: 2021/03/23 21:16:08 by mehtel ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void fill_half_screen(t_vars *vars, int which_half, int color)
{
int x;
int y;
int fill_to;
x = 0;
y = -1;
fill_to = vars->map->resolution_hight / 2;
if (which_half)
{
y = fill_to - 1;
fill_to = vars->map->resolution_hight;
}
while (++y < fill_to)
{
while (++x < vars->map->resolution_width)
pixel_put(vars, x, y, color);
x = -1;
}
}
int only_symbols(char *symbols, char *line)
{
while (*line)
{
if (!ft_strchr(symbols, *line++))
return (0);
}
return (1);
}
/*
** count number of chars in string
*/
int strchrs(char *str, char c)
{
int counter;
counter = 0;
while (*str)
{
if (*str == c)
counter++;
str++;
}
return (counter);
}
void wtf_it_must_be_done_that_way(char **tex_ids)
{
tex_ids[NO] = "NO";
tex_ids[SO] = "SO";
tex_ids[WE] = "WE";
tex_ids[EA] = "EA";
tex_ids[S] = "S ";
tex_ids[F] = "F ";
tex_ids[C] = "C ";
tex_ids[R] = "R ";
}
int check_respawn(t_map *map)
{
if (!map->respawns)
return (0);
map->invalid |= ERR_RSPWN;
return (1);
}