Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
keys.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ITEM_KEY_MAX   24

Functions

string item_keys_keylist (float keylist)
 Returns a string with a comma separated list of key names, as specified in keylist.
float item_keys_usekey (entity l, entity p)
 Use keys from p on l.

Variables

string item_keys_names [ITEM_KEY_MAX]
 list of key names.

Macro Definition Documentation

◆ ITEM_KEY_MAX

#define ITEM_KEY_MAX   24

Definition at line 3 of file keys.qh.

Function Documentation

◆ item_keys_keylist()

string item_keys_keylist ( float keylist)

Returns a string with a comma separated list of key names, as specified in keylist.

Definition at line 40 of file keys.qc.

41{
42 // no keys
43 if (!keylist)
44 return "";
45
46 // one key
47 if ((keylist & (keylist-1)) == 0)
48 return strcat("the ", item_keys_names[lowestbit(keylist)]);
49
50 string n = "";
51 int base = 0;
52 while (keylist)
53 {
54 int l = lowestbit(keylist);
55 if (n)
56 n = strcat(n, ", the ", item_keys_names[base + l]);
57 else
58 n = strcat("the ", item_keys_names[base + l]);
59
60 keylist = bitshift(keylist, -(l + 1));
61 base += l + 1;
62 }
63
64 return n;
65}
ERASEABLE int lowestbit(int f)
Definition bits.qh:17
string item_keys_names[ITEM_KEY_MAX]
list of key names.
Definition keys.qh:9
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References item_keys_names, lowestbit(), and strcat().

Referenced by door_check_keys(), and trigger_keylock_touch().

◆ item_keys_usekey()

float item_keys_usekey ( entity l,
entity p )

Use keys from p on l.

Returns true if any new keys were given, false otherwise.

Definition at line 4 of file keys.qc.

5{
6 int valid = (l.itemkeys & p.itemkeys); // TODO: itemkeys isn't networked or anything!
7 l.itemkeys &= ~valid; // only some of the needed keys were given
8 return valid != 0;
9}

References entity().

Referenced by trigger_keylock_touch().

Variable Documentation

◆ item_keys_names

string item_keys_names[ITEM_KEY_MAX]

list of key names.

Definition at line 9 of file keys.qh.

Referenced by item_keys_keylist(), and spawnfunc().