5 if (value)
return "true";
13 private proto
void SetInstance(
Class inst);
25 protected static string m_ZeroPad[
ZERO_PAD_SIZE] = {
"",
"0",
"00",
"000",
"0000",
"00000",
"000000",
"0000000"};
27 const int MAX = 2147483647;
28 const int MIN = -2147483648;
61 string str = value.ToString();
63 int l = len - str.Length();
66 return m_ZeroPad[l] + str;
84 bool InRange(
int min,
int max,
bool inclusive_min =
true,
bool inclusive_max =
true )
86 if( ( !inclusive_min && value <= min ) || value < min )
89 if( ( !inclusive_max && value >= max ) || value > max )
98 const float MIN = FLT_MIN;
99 const float MAX = FLT_MAX;
100 const float LOWEST = -FLT_MAX;
102 proto
string ToString();
107 static const vector Up =
"0 1 0";
108 static const vector Aside =
"1 0 0";
109 static const vector Forward =
"0 0 1";
110 static const vector Zero =
"0 0 0";
125 proto
string ToString(
bool beautify =
true);
140 proto
float Normalize();
143 proto
vector Normalized();
156 proto native
float Length();
169 proto native
float LengthSq();
183 proto
static native
float Distance(
vector v1,
vector v2);
197 proto
static native
float DistanceSq(
vector v1,
vector v2);
224 dir_vec[0] = p2[0] - p1[0];
225 dir_vec[1] = p2[1] - p1[1];
226 dir_vec[2] = p2[2] - p1[2];
245 return Vector(
Math.RandomFloatInclusive(-1,1),
Math.RandomFloatInclusive(-1,1),
Math.RandomFloatInclusive(-1,1)).Normalized();
260 static vector RandomDir2D()
262 return Vector(
Math.RandomFloatInclusive(-1,1),0,
Math.RandomFloatInclusive(-1,1)).Normalized();
273 return ((v1[0] * v2[0]) + (v1[1] * v2[1]) + (v1[2] * v2[2]));
288 for(
int i = 0; i < 3; i++) {
290 value[i] = value[i] - 360;
292 value[i] = value[i] + 360;
311 proto
float VectorToYaw();
325 proto native
static vector YawToVector(
float yaw);
340 proto
vector VectorToAngles();
355 proto
vector AnglesToVector();
370 proto
void RotationMatrixFromAngles(out
vector mat[3]);
452 return (vec *
Math.Cos(angle *
Math.DEG2RAD)) + ((axis * vec) *
Math.Sin(angle *
Math.DEG2RAD)) + (axis *
vector.Dot(axis, vec)) * (1 -
Math.Cos(angle *
Math.DEG2RAD));
465 return (vec *
Math.Cos(angle)) + ((axis * vec) *
Math.Sin(angle)) + (axis *
vector.Dot(axis, vec)) * (1 -
Math.Cos(angle));
477 static vector RotateAroundZero(
vector pos,
vector axis,
float cosAngle,
float sinAngle)
479 return (pos * cosAngle) + ((axis * pos) * sinAngle) + (axis *
vector.Dot(axis, pos)) * (1 - cosAngle);
493 vector offsetPos = pos - point;
494 return RotateAroundZero(offsetPos, axis, cosAngle, sinAngle) + point;
502 static vector ArrayToVec(
float arr[])
504 return Vector(arr[0], arr[1], arr[2]);
517 proto
volatile Class Spawn();
523 proto owned
string GetModule();
526 proto native owned
string ToString();
536 proto native
bool IsInherited(
typename baseType);
538 proto native
int GetVariableCount();
539 proto native owned
string GetVariableName(
int vIdx);
540 proto native
typename GetVariableType(
int vIdx);
541 proto
bool GetVariableValue(
Class var,
int vIdx, out
void val);
550 static string EnumToString(
typename e,
int enumValue)
552 int cnt = e.GetVariableCount();
555 for (
int i = 0; i < cnt; i++)
557 if (e.GetVariableType(i) ==
int && e.GetVariableValue(
null, i, val) && val == enumValue)
559 return e.GetVariableName(i);
572 static int StringToEnum(
typename e,
string enumName)
574 int count = e.GetVariableCount();
577 for (
int i = 0; i < count; i++)
579 if (e.GetVariableType(i) ==
int && e.GetVariableValue(
null, i, value) && e.GetVariableName(i) == enumName)
601 static string EnumToString(
typename e,
int enumValue)
603 return typename.EnumToString(e, enumValue);
612 static int StringToEnum(
typename e,
string enumName)
614 return typename.StringToEnum(e, enumName);
623 static int GetEnumSize(
typename e)
625 return e.GetVariableCount();
634 static int GetEnumValue(
typename e,
int idx)
637 e.GetVariableValue(
null, idx, value);
647 static int GetLastEnumValue(
typename e)
650 e.GetVariableValue(
null, e.GetVariableCount() - 1, lastValue);