Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Vector Zero Funcs. & Improve Vector.Inc File #549

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add Vector Zero Funcs. & Improve Vector.Inc File #549

wants to merge 6 commits into from

Conversation

ClaudiuHKS
Copy link
Contributor

@ClaudiuHKS ClaudiuHKS commented Sep 4, 2018

Add bool: IsVectorZero ( const { _, Float }: Vector [ 3 ] ) to check whether a vector equals to zero.
Add SetVectorZero ( { _, Float }: Vector [ 3 ] ) to set 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.

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.
@HamletEagle
Copy link
Contributor

HamletEagle commented Sep 4, 2018

Same can be accomplished by using xs_vec_equal and xs_vec_set. This functions are a bit easier to use than xs_* but I'm not sure the difference is significant enough.

@ClaudiuHKS
Copy link
Contributor Author

ClaudiuHKS commented Sep 4, 2018

XS is a file that has lots of data inside.
My functions are strictly Vector related and they support both float and numeric parameters.

As you can see @ https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/public/mathlib/vector.h#L564
Zero is a basic Vector function and in my opinion it should be inside vector.inc file.
XS file should contain larger functions, operations and stuff like that.

Also, XS restricts all functions to use float parameters.

@Mistrick
Copy link

Mistrick commented Sep 4, 2018

Does pawn have any difference between set 0 or 0.0 to Float?

@ClaudiuHKS
Copy link
Contributor Author

ClaudiuHKS commented Sep 4, 2018

warning 213: tag mismatch via http://www.amxmodx.org/webcompiler.cgi

@Mistrick
Copy link

Mistrick commented Sep 4, 2018

I mean in memory. Warning we can bypass and if there are no difference for what we need 2 funcs for int and float?

@ClaudiuHKS
Copy link
Contributor Author

I don't understand what you mean. Show me an example so I can understand.

@Mistrick
Copy link

Mistrick commented Sep 4, 2018

We know pawn has only cell type.

new Float:a = 0;
new Float:b = 0.0;

If in pawn VM there are no difference(example, all bytes are zero for first and second variant) we can use one func for int and float.

@WPMGPRoSToTeMa
Copy link
Contributor

@Mistrick there is no difference, we can write function that accepts both _ and Float.

@WPMGPRoSToTeMa
Copy link
Contributor

WPMGPRoSToTeMa commented Sep 4, 2018

Basically we can just add ZERO_VECTOR and then use:

vec = ZERO_VECTOR;
xs_vec_equal(vec, ZERO_VECTOR);

@ClaudiuHKS
Copy link
Contributor Author

ClaudiuHKS commented Sep 11, 2018

If I add public stock const Float: ZERO_VECTOR [ 3 ] inside AmxConst.INC, it will act as Float only.
It's impossible to declare it as public stock const { _, Float }: ZERO_VECTOR [ 3 ].

Furthermore, I still don't want to use xs_* functions to check whether a Vector equals to zero.

So, do you still want me to add public stock const Float: ZERO_VECTOR [ 3 ] inside AmxConst.INC?

@WPMGPRoSToTeMa
Copy link
Contributor

@ClaudiuHKS I think integer vectors should be deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants