-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathvec.c
69 lines (50 loc) · 1.81 KB
/
vec.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
66
67
68
69
#include <vec.h>
#include <util.h>
void SetVectorCylind(VECTOR *pvec, float rad, float sXY, float sZ)
{
float gSin;
float gCos;
CalculateSinCos(rad, &gSin, &gCos);
pvec->z = sZ;
pvec->x = gCos * sXY;
pvec->y = gSin * sXY;
}
void SetVectorSphere(VECTOR *pvec, float radPan, float radTilt, float s)
{
float gSinPan;
float gCosPan;
float gSinTilt;
float gCosTilt;
CalculateSinCos(radPan,&gSinPan, &gCosPan);
CalculateSinCos(radTilt, &gSinTilt, &gCosTilt);
pvec->z = gSinTilt * s;
pvec->x = gCosTilt * gCosPan * s;
pvec->y = gCosTilt * gSinPan * s;
}
INCLUDE_ASM(const s32, "P2/vec", SProjectVector);
INCLUDE_ASM(const s32, "P2/vec", GetNormalVectors);
INCLUDE_ASM(const s32, "P2/vec", GetNormalVector);
INCLUDE_ASM(const s32, "P2/vec", func_001ED900);
INCLUDE_ASM(const s32, "P2/vec", RadBetweenVectors);
INCLUDE_ASM(const s32, "P2/vec", FindClosestPointBetweenLines);
INCLUDE_ASM(const s32, "P2/vec", FindClosestPointBetweenLineSegments);
INCLUDE_ASM(const s32, "P2/vec", CalculateVectorPanTilt);
void ConvertDeulToW(VECTOR *peul, VECTOR *pdeul, VECTOR *pw)
{
float ySin;
float yCos;
float zSin;
float zCos;
CalculateSinCos(peul->y, &ySin, &yCos);
CalculateSinCos(peul->z, &zSin, &zCos);
pw->x = yCos * zCos * pdeul->x - zSin * pdeul->y;
pw->y = yCos * zSin * pdeul->x + zCos * pdeul->y;
pw->z = -ySin * pdeul->x + pdeul->z;
}
INCLUDE_ASM(const s32, "P2/vec", FCalculateMuzzleVelocity__FP6VECTORT0fT0P2SO);
INCLUDE_ASM(const s32, "P2/vec", FCalculateMuzzleVelocity1);
int FCalculateMuzzleVelocityAngle(VECTOR *pposLaunch,VECTOR *pposTarget,float radTilt,VECTOR *pvecMuzzle,SO *psoLaunch)
{
return FCalculateMuzzleVelocity(pposLaunch, pposTarget, radTilt, pvecMuzzle, psoLaunch);
}
INCLUDE_ASM(const s32, "P2/vec", LimitVectorLength);