Macros

The following macros are predefined in include\acknex.h for making life easier and code shorter:

set(obj,flag)

reset(obj,flag)

toggle(obj,flag)

Sets, resets, or toggles one or several flags in the flags parameter of the given object.

Examples:

set(mpanel,VISIBLE | TRANSLUCENT);
reset(myview,VISIBLE | AUDIBLE);
toggle(my,PASSABLE);

is(obj,flag)

Checks whether the flag is set in the flags parameter of the given object.

Example:

if (is(my,INVISIBLE)) ent_remove(me);

zero(struct)

vec_zero(vector)

Sets the given struct´or vector to zero; useful for initializing local variables in functions.  !!  Be aware that only a struct, but not a struct pointer can be set to zero!

Example:

function foo() 
{

  ANGLE my_angle;
  struct MYTYPE my_struct;
  ...
  vec_zero(my_angle);
  zero(my_struct); // don't use this for struct pointers or engine objects!
}

wait_for(function)

Waits for the completion of all instances of the given function.

Example:

function foo() 
{
  int i;
  for (i=0; i<100; i++) { wait(1); }
}
...
foo();
waitfor(foo); // wait until foo is terminated

See also:

#define, flags, proc_status ► latest version online