-
Notifications
You must be signed in to change notification settings - Fork 1
/
info_player.c
59 lines (54 loc) · 1.93 KB
/
info_player.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* info_player.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mbousbaa <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/01 04:09:56 by wzakkabi #+# #+# */
/* Updated: 2023/12/04 22:11:48 by mbousbaa ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void info_player_helper(t_map *m)
{
char postion;
postion = m->map_s[(int)m->plr->y
/ m->size_wall_y_x][(int)m->plr->x / m->size_wall_y_x];
m->plr->direction = 0;
m->plr->move_up_down = 0;
m->plr->move_right_or_left = 0;
m->plr->radius = m->size_wall_y_x * 0.3;
m->plr->speedmv = 10;
m->plr->retactionsspeed = 5 * (M_PI / 180);
m->plr->fovue_angle = 60 * (M_PI / 180);
m->plr->num_arys = m->xwindows_width;
if (postion == 'E')
m->plr->retactionangle = (3 * M_PI) / 2;
else if (postion == 'W')
m->plr->retactionangle = M_PI / 2;
else if (postion == 'N')
m->plr->retactionangle = 0;
else if (postion == 'S')
m->plr->retactionangle = M_PI;
}
void info_player(t_plr *p, t_map *m)
{
int x;
int y;
y = -1;
while (m->map_s[++y])
{
x = -1;
while (m->map_s[y][++x])
{
if (m->map_s[y][x] == 'E' || m->map_s[y][x] == 'W'
|| m->map_s[y][x] == 'N' || m->map_s[y][x] == 'S')
{
p->x = (x * m->size_wall_y_x) + m->size_wall_y_x / 2;
p->y = (y * m->size_wall_y_x) + m->size_wall_y_x / 2;
}
}
}
info_player_helper(m);
}