-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMiscUtil.java
More file actions
executable file
·49 lines (43 loc) · 1.01 KB
/
Copy pathMiscUtil.java
File metadata and controls
executable file
·49 lines (43 loc) · 1.01 KB
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
/**
* Write a description of class MiscUtil here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MiscUtil
{
public static double Maximum(double a, double b)
{
if(a > b)
{
return a;
}
return b;
}
public static boolean TestWall(double WallX,
double RelX,
double RelY,
double PlayerDeltaX,
double PlayerDeltaY,
wrappedDouble tMin,
double MinY,
double MaxY)
{
boolean Hit = false;
double tEpsilon = 0.001f;
if(PlayerDeltaX != 0.0f)
{
double tResult = (WallX - RelX)/PlayerDeltaX;
double Y = RelY + tResult*PlayerDeltaY;
if((tResult >= 0.0f) && (tMin.val > tResult))
{
if((Y >= MinY) && (Y <= MaxY))
{
tMin.val = Maximum(0.0f,tResult - tEpsilon);
Hit = true;
}
}
}
return(Hit);
}
}