Raised This Month: $51 Target: $400
 12% 

[SNIPPET] Updated (Custom) Vector functions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nergal
Veteran Member
Join Date: Apr 2012
Old 10-07-2016 , 19:30   [SNIPPET] Updated (Custom) Vector functions
Reply With Quote #1

PHP Code:
stock float[] Vec_SubtractVectors(const float vec1[3], const float vec2[3])
{
    
float result[3]; SubtractVectors(vec1vec2result);
    return 
result;
}
stock float[] Vec_AddVectors(const float vec1[3], const float vec2[3])
{
    
float result[3]; AddVectors(vec1vec2result);
    return 
result;
}
stock float[] Vec_ScaleVector(const float vec[3], const float scale)
{
    
float result[3];
    
result[0] = vec[0] * scale;
    
result[1] = vec[1] * scale;
    
result[2] = vec[2] * scale;
    return 
result;
}
stock float[] Vec_NegateVector(const float vec[3])
{
    
float result[3];
    
result[0] = -vec[0];
    
result[1] = -vec[1];
    
result[2] = -vec[2];
    return 
result;
}
stock float[] Vec_GetVectorAngles(const float vec[3])
{
    
float angResult[3]; GetVectorAngles(vecangResult);
    return 
angResult;
}
stock float[] Vec_GetVectorCrossProduct(const float vec1[3], const float vec2[3])
{
    
float result[3]; GetVectorCrossProduct(vec1vec2result);
    return 
result;
}
stock float[] Vec_MakeVectorFromPoints(const float pt1[3], const float pt2[3])
{
    
float output[3]; MakeVectorFromPoints(pt1pt2output);
    return 
output;
}
stock float[] Vec_GetEntPropVector(int entityPropType type, const char[] propint element)
{
    
float output[3]; GetEntPropVector(entitytypepropoutputelement);
    return 
output;
}
stock float[] Vec_NormalizeVector(const float vec[3])
{
    
float output[3]; NormalizeVector(vecoutput);
    return 
output;
}
stock float[] Vec_GetAngleVecForward(const float angle[3])
{
    
float output[3]; GetAngleVectors(angleoutputNULL_VECTORNULL_VECTOR);
    return 
output;
}
stock float[] Vec_GetAngleVecRight(const float angle[3])
{
    
float output[3]; GetAngleVectors(angleNULL_VECTORoutputNULL_VECTOR);
    return 
output;
}
stock float[] Vec_GetAngleVecUp(const float angle[3])
{
    
float output[3]; GetAngleVectors(angleNULL_VECTORNULL_VECTORoutput);
    return 
output;

__________________
nergal is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 10-08-2016 , 03:14   Re: [SNIPPET] Updated (Custom) Vector functions
Reply With Quote #2

AFAIK you cannot return arrays in SourcePawn though, did something change?
Edit: Oh, it's apparently only for public functions.
__________________
retired

Last edited by shavit; 10-08-2016 at 03:16.
shavit is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 10-09-2016 , 12:02   Re: [SNIPPET] Updated (Custom) Vector functions
Reply With Quote #3

Quote:
Originally Posted by shavit View Post
AFAIK you cannot return arrays in SourcePawn though, did something change?
Edit: Oh, it's apparently only for public functions.
it's a recent update, you can return arbitrary sized arrays.
__________________
nergal is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 10-11-2016 , 19:15   Re: [SNIPPET] Updated (Custom) Vector functions
Reply With Quote #4

You've always been able to return arrays in stock functions.
__________________
Neuro Toxin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode