User panel stuff on forum
  4 posts on 1 page  1
Server Talk
2009-12-13, 18:09
Member
28 posts

Registered:
Nov 2009
Hi,

I was reading some QC codes and since I'm not a coder I've got a bit confused with those built in functions. My question is, in progs106 defs.qc the funcion makevectors in defined like this:

code wrote:
void(vector ang) makevectors = #1; // sets v_forward, etc globals

But in mvdsv 0.29 source there's this line:

code wrote:
PF_makevectors, // void(entity e) makevectors = #1;

So makevectors should be defined as 'void(entity e) makevectors =#1;' to work?
2009-12-14, 02:56
Member
271 posts

Registered:
Feb 2006
'//' means 'ignore this and the rest of the line'.
the actual builtin numbers are derived from the index in the builtins list (the preinitalised array in the engine).
the comments are not part of the code itself, and it can work even when the comments are completely false, as in this case.
Generally they're copy+pasted, and can be either for the wrong builtin, outdated, or just plain wrong.
This is not a bug in the released exe, only in the 'documentation' as it were. The QC code is correct.

If you want to write quakec, or even engine code, you may find inside3d.com and its forums more informative, as this site is more for actual gamers.
moo
2009-12-14, 14:06
Member
28 posts

Registered:
Nov 2009
Thank you Spike.

I understand '//' are comments and are ignored by the compiler, but I thought, in this case, they might show how the function has to be declared or something like that. I really don't know how these things work, I'll look for more information on inside3d.
2009-12-14, 14:36
Member
271 posts

Registered:
Feb 2006
The real way to tell what a builtin accepts is to go to the C function that provides that builtin and look at its use of G_FLOAT G_VECTOR G_EDICT macros. There should always be an OFS_ argument to them. Note they're stored as globals, so child function calls inside the builtin can also get them too, but that's limited to 'varg' strings (which is passed an OFS_ value anyway, I think) and movetogoal if I remember correctly.
QC globals are accessed via pr_globals->yourglobalhere, and entity fields via (edict_t*)->v.yourfieldhere
moo
  4 posts on 1 page  1