forked from Bad-Scientists/AF-Script-Packet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgebra.d
105 lines (81 loc) · 2.89 KB
/
algebra.d
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* zVEC3_NormalizeSafe
*/
func int zVEC3_NormalizeSafe (var int vecPtr) {
//0x004AC6C0 public: class zVEC3 & __thiscall zVEC3::NormalizeSafe(void)
const int zVEC3__NormalizeSafe_G1 = 4900544;
//0x00498A20 public: class zVEC3 & __thiscall zVEC3::NormalizeSafe(void)
const int zVEC3__NormalizeSafe_G2 = 4819488;
if (!vecPtr) { return FLOATNULL; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PutRetValTo(_@ (retVal));
CALL__thiscall (_@ (vecPtr), MEMINT_SwitchG1G2 (zVEC3__NormalizeSafe_G1, zVEC3__NormalizeSafe_G2));
call = CALL_End();
};
return +retVal;
};
/*
* zVEC3_LengthApprox // float
*/
func int zVEC3_LengthApprox (var int vecPtr) {
//0x00488FD0 public: float __thiscall zVEC3::LengthApprox(void)const
const int zVEC3__LengthApprox_G1 = 4755408;
//0x00490E10 public: float __thiscall zVEC3::LengthApprox(void)const
const int zVEC3__LengthApprox_G2 = 4787728;
if (!vecPtr) { return FLOATNULL; };
var int retVal;
const int call = 0;
if (CALL_Begin(call)) {
CALL_RetValIsFloat ();
CALL_PutRetValTo(_@ (retVal));
CALL__thiscall (_@ (vecPtr), MEMINT_SwitchG1G2 (zVEC3__LengthApprox_G1, zVEC3__LengthApprox_G2));
call = CALL_End();
};
return +retVal;
};
/*
* zMAT4_Mul_zVEC3
*/
func void zMAT4_Mul_zVEC3 (var int ptrzMAT4, var int ptrzVEC3, var int targetPtr) {
//0x00472D40 class zVEC3 __cdecl operator*(class zMAT4 const &,class zVEC3 const &)
const int zMAT4_Mul_zVEC3_G1 = 4664640;
//0x00474370 class zVEC3 __cdecl operator*(class zMAT4 const &,class zVEC3 const &)
const int zMAT4_Mul_zVEC3_G2 = 4670320;
if ((!ptrzMAT4) || (!ptrzVEC3) || (!targetPtr)) { return; };
//CALL_RetValIsStruct only supported in disposable calls
CALL_RetValIsStruct (12);
CALL_PtrParam (ptrzVEC3);
CALL_PtrParam (ptrzMAT4);
CALL__cdecl (MEMINT_SwitchG1G2 (zMAT4_Mul_zVEC3_G1, zMAT4_Mul_zVEC3_G2));
var int posPtr; posPtr = CALL_RetValAsPtr ();
MEM_CopyBytes (posPtr, targetPtr, 12);
MEM_Free (posPtr);
};
/*
* zVEC3_Sub_zVEC3
*/
func void zVEC3_Sub_zVEC3 (var int ptrzVEC3_1, var int ptrzVEC3_2, var int targetPtr) {
//0x00481010 class zVEC3 __cdecl operator-(class zVEC3 const &,class zVEC3 const &)
const int zVEC3_Sub_zVEC3_G1 = 4722704;
//0x004889F0 class zVEC3 __cdecl operator-(class zVEC3 const &,class zVEC3 const &)
const int zVEC3_Sub_zVEC3_G2 = 4753904;
if ((!ptrzVEC3_1) || (!ptrzVEC3_2) || (!targetPtr)) { return; };
//CALL_RetValIsStruct only supported in disposable calls
CALL_RetValIsStruct (12);
CALL_PtrParam (ptrzVEC3_2);
CALL_PtrParam (ptrzVEC3_1);
CALL__cdecl (MEMINT_SwitchG1G2 (zVEC3_Sub_zVEC3_G1, zVEC3_Sub_zVEC3_G2));
var int posPtr; posPtr = CALL_RetValAsPtr ();
MEM_CopyBytes (posPtr, targetPtr, 12);
MEM_Free (posPtr);
};
/*
* Pos_GetDistToPos // float
*/
func int Pos_GetDistToPos (var int posPtr1, var int posPtr2) {
var int dir[3];
zVEC3_Sub_zVEC3 (posPtr1, posPtr2, _@ (dir));
return + zVEC3_LengthApprox (_@ (dir));
};