-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_info.c
65 lines (60 loc) · 1.21 KB
/
init_info.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
#include "cub3d.h"
void init_rgb(t_info *info)
{
info->r = 0;
info->g = 0;
info->b = 0;
info->r2 = 0;
info->g2 = 0;
info->b2 = 0;
info->counter = 0;
}
void ft_init_info(t_info *info)
{
info->sprites.sprites_buff = ft_calloc(info->width, sizeof(double *));
info->moveSpeed = 0.03;
info->rotSpeed = 0.03;
info->rgb_f = create_rgb(info->flagF[0], info->flagF[1], info->flagF[2]);
info->rgb_c = create_rgb(info->flagC[0], info->flagC[1], info->flagC[2]);
}
void init_play_pos(t_info *info)
{
if (info->direction == 'N' || info->direction == 'S')
init_south_north(info);
else if (info->direction == 'W' || info->direction == 'E')
init_west_east(info);
}
void init_south_north(t_info *info)
{
if (info->direction == 'N')
{
info->dirX = -1;
info->dirY = 0.0;
info->planeX = 0.0;
info->planeY = 0.66;
}
else if (info->direction == 'S')
{
info->dirX = 1;
info->dirY = 0.0;
info->planeX = 0.0;
info->planeY = -0.66;
}
}
void init_west_east(t_info *info)
{
if (info->direction == 'W')
{
info->dirX = 0.0;
info->dirY = -1;
info->planeX = -0.66;
info->planeY = 0.0;
}
else if (info->direction == 'E')
{
info->dirX = 0.0;
info->dirY = 1;
info->planeX = 0.66;
info->planeY = 0.0;
}
}