-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoor.c
62 lines (57 loc) · 1.44 KB
/
door.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* door.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bmerchin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/02/23 10:02:34 by bmerchin #+# #+# */
/* Updated: 2021/02/23 10:02:50 by bmerchin ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void close_door(t_data *data)
{
int i;
int j;
i = 0;
if (!BONUS)
return ;
data->door_closed = 400;
while (i < data->x_map)
{
j = 0;
while (j < data->y_map)
{
if (data->map[j][i] == '4')
{
data->map[j][i] = '5';
}
j++;
}
i++;
}
}
void open_door(t_data *data)
{
int i;
int j;
i = 0;
j = 0;
data->door_closed--;
if (data->door_closed != 0)
return ;
if (!BONUS)
return ;
while (i < data->x_map)
{
j = 0;
while (j < data->y_map)
{
if (data->map[j][i] == '5')
data->map[j][i] = '4';
j++;
}
i++;
}
}