-
Notifications
You must be signed in to change notification settings - Fork 0
/
greater.c
30 lines (27 loc) · 1.28 KB
/
greater.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* greater.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mlegendr <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/06 10:52:11 by mlegendr #+# #+# */
/* Updated: 2014/12/08 16:59:52 by mlegendr ### ########.fr */
/* */
/* ************************************************************************** */
#include "wolf3d.h"
#include <math.h>
t_inter greater(double angle, t_player player, t_map_info info)
{
t_inter hor;
t_inter ver;
hor = check_horizontal(angle, player, info);
ver = check_vertical(angle, player, info);
if (ver.dist == -1 || (ver.dist >= hor.dist && hor.dist != -1))
{
hor.dist *= cos(fabs(player.angle - angle));
return (hor);
}
ver.dist *= cos(fabs(player.angle - angle));
return (ver);
}