mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-04-15 22:12:34 +03:00
Add Vector Zero Funcs. & Improve Vector.Inc File
Add **bool: IsVectorZero ( Float: Vector [ 3 ] )** to check whether a vector equals to zero. Add **SetVectorZero ( Float: Vector [ 3 ] )** to assign a vector to zero. Remove redundant tabs at some lines. Fix spelling @ **get_distance_f**. This PR intends to complete AMXX's Vector library adding new stuff to it. Also, the new two functions listed above will help plugins using this kind of stuff look more readable.
This commit is contained in:
parent
582df637ce
commit
39cabb5e79
@ -41,7 +41,7 @@ native get_distance(const origin1[3], const origin2[3]);
|
||||
*
|
||||
* @return The distance between two input vectors
|
||||
*/
|
||||
native Float:get_distance_f(const Float:Origin1[3], const Float:Origin2[3]);
|
||||
native Float:get_distance_f(const Float:origin1[3], const Float:origin2[3]);
|
||||
|
||||
/**
|
||||
* Calculates velocity in the direction player is looking.
|
||||
@ -129,3 +129,27 @@ stock FVecIVec(const Float:FVec[3], IVec[3])
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a vector is zero.
|
||||
*
|
||||
* @param Vector The input vector
|
||||
*
|
||||
* @return True if the vector is zero, false otherwise
|
||||
*/
|
||||
stock bool:IsVectorZero(const Float:Vector[3])
|
||||
{
|
||||
return (Vector[0] == 0.0 && Vector[1] == 0.0 && Vector[2] == 0.0) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a vector to zero
|
||||
*
|
||||
* @param Vector Vector
|
||||
*
|
||||
* @noreturn
|
||||
*/
|
||||
stock SetVectorZero(Float:Vector[3])
|
||||
{
|
||||
Vector[0] = Vector[1] = Vector[2] = 0.0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user