Xonotic
all.qc File Reference
#include "all.qh"
+ Include dependency graph for all.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WEAPONS_ALL_C
 

Functions

WepSet _WepSet_FromWeapon (int a)
 
entity GetAmmoItem (Resource ammotype)
 
string GetAmmoName (Resource ammotype)
 
string GetAmmoPicture (Resource ammotype)
 
string W_FixWeaponOrder (string order, float complete)
 
string W_FixWeaponOrder_AllowIncomplete (entity this, string order)
 
string W_FixWeaponOrder_BuildImpulseList (string o)
 
float W_FixWeaponOrder_BuildImpulseList_cmp (int i, int j, entity pass)
 
void W_FixWeaponOrder_BuildImpulseList_swap (int i, int j, entity pass)
 
string W_FixWeaponOrder_ForceComplete (string order)
 
string W_Model (string w_mdl)
 
string W_NameWeaponOrder (string order)
 
string W_NameWeaponOrder_MapFunc (string s)
 
string W_NumberWeaponOrder (string order)
 
string W_NumberWeaponOrder_MapFunc (string s)
 
WepSet W_RandomWeapons (entity e, WepSet remaining, int n)
 
string W_Sound (string w_snd)
 
string W_UndeprecateName (string s)
 

Variables

float W_FixWeaponOrder_BuildImpulseList_buf [REGISTRY_MAX(Weapons)]
 
string W_FixWeaponOrder_BuildImpulseList_order
 

Macro Definition Documentation

◆ WEAPONS_ALL_C

#define WEAPONS_ALL_C

Definition at line 3 of file all.qc.

Function Documentation

◆ _WepSet_FromWeapon()

WepSet _WepSet_FromWeapon ( int  a)

Definition at line 53 of file all.qc.

References BIT, REGISTRY_MAX, and WEP_FIRST.

Referenced by STATIC_INIT().

54 {
55  a -= WEP_FIRST;
56  if (REGISTRY_MAX(Weapons) > 24)
57  if (a >= 24)
58  {
59  a -= 24;
60  if (REGISTRY_MAX(Weapons) > 48)
61  if (a >= 24)
62  {
63  a -= 24;
64  return '0 0 1' * BIT(a);
65  }
66  return '0 1 0' * BIT(a);
67  }
68  return '1 0 0' * BIT(a);
69 }
const int WEP_FIRST
Definition: all.qh:304
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
#define REGISTRY_MAX(id)
Definition: registry.qh:17
+ Here is the caller graph for this function:

◆ GetAmmoItem()

entity GetAmmoItem ( Resource  ammotype)

Definition at line 234 of file all.qc.

References LOG_WARNF, NULL, STAT_CELLS, STAT_NAILS, STAT_ROCKETS, and STAT_SHELLS.

235 {
236  switch (ammotype)
237  {
238  case RES_SHELLS: return ITEM_Shells;
239  case RES_BULLETS: return ITEM_Bullets;
240  case RES_ROCKETS: return ITEM_Rockets;
241  case RES_CELLS: return ITEM_Cells;
242  case RES_PLASMA: return ITEM_Plasma;
243  case RES_FUEL: return ITEM_JetpackFuel;
244  }
245  LOG_WARNF("Invalid ammo type %d ", ammotype.m_id);
246  return NULL;
247  // WEAPONTODO: use this generic func to reduce duplication ?
248  // GetAmmoPicture GetAmmoName notif_arg_item_wepammo ammo_pickupevalfunc ?
249 }
#define LOG_WARNF(...)
Definition: log.qh:67
#define NULL
Definition: post.qh:17

◆ GetAmmoName()

string GetAmmoName ( Resource  ammotype)

Definition at line 220 of file all.qc.

Referenced by formatmessage().

221 {
222  switch (ammotype)
223  {
224  case RES_SHELLS: return ITEM_Shells.m_name;
225  case RES_BULLETS: return ITEM_Bullets.m_name;
226  case RES_ROCKETS: return ITEM_Rockets.m_name;
227  case RES_CELLS: return ITEM_Cells.m_name;
228  case RES_PLASMA: return ITEM_Plasma.m_name;
229  case RES_FUEL: return ITEM_JetpackFuel.m_name;
230  default: return "batteries";
231  }
232 }
+ Here is the caller graph for this function:

◆ GetAmmoPicture()

string GetAmmoPicture ( Resource  ammotype)

Definition at line 206 of file all.qc.

Referenced by DrawAmmoItem(), and W_DecreaseAmmo().

207 {
208  switch (ammotype)
209  {
210  case RES_SHELLS: return ITEM_Shells.m_icon;
211  case RES_BULLETS: return ITEM_Bullets.m_icon;
212  case RES_ROCKETS: return ITEM_Rockets.m_icon;
213  case RES_CELLS: return ITEM_Cells.m_icon;
214  case RES_PLASMA: return ITEM_Plasma.m_icon;
215  case RES_FUEL: return ITEM_JetpackFuel.m_icon;
216  default: return ""; // wtf, no ammo type?
217  }
218 }
+ Here is the caller graph for this function:

◆ W_FixWeaponOrder()

string W_FixWeaponOrder ( string  order,
float  complete 
)

Definition at line 95 of file all.qc.

References fixPriorityList(), WEP_FIRST, WEP_IMPULSE_BEGIN, and WEP_LAST.

Referenced by LocalCommand_sendcvar(), W_FixWeaponOrder_AllowIncomplete(), W_FixWeaponOrder_ForceComplete(), and XonoticWeaponsList_draw().

96 {
97  return fixPriorityList(order, WEP_FIRST, WEP_LAST, WEP_IMPULSE_BEGIN - WEP_FIRST, complete);
98 }
const int WEP_FIRST
Definition: all.qh:304
#define WEP_IMPULSE_BEGIN
Definition: all.qh:315
#define WEP_LAST
Definition: all.qh:305
string fixPriorityList(string order, float from, float to, float subtract, float complete)
Definition: util.qc:485
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_FixWeaponOrder_AllowIncomplete()

string W_FixWeaponOrder_AllowIncomplete ( entity  this,
string  order 
)

Definition at line 177 of file all.qc.

References W_FixWeaponOrder().

Referenced by STATIC_INIT(), and W_Model().

178 {
179  return W_FixWeaponOrder(order, 0);
180 }
string W_FixWeaponOrder(string order, float complete)
Definition: all.qc:95
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_FixWeaponOrder_BuildImpulseList()

string W_FixWeaponOrder_BuildImpulseList ( string  o)

Definition at line 162 of file all.qc.

References ftos(), heapsort(), NULL, strcat(), string_null, substring(), W_FixWeaponOrder_BuildImpulseList_buf, W_FixWeaponOrder_BuildImpulseList_cmp(), W_FixWeaponOrder_BuildImpulseList_order, W_FixWeaponOrder_BuildImpulseList_swap(), WEP_FIRST, and WEP_LAST.

Referenced by HUD_Weapons(), and W_Model().

163 {
164  int i;
166  for (i = WEP_FIRST; i <= WEP_LAST; ++i)
169  NULL);
170  o = "";
171  for (i = WEP_FIRST; i <= WEP_LAST; ++i)
174  return substring(o, 1, -1);
175 }
string string_null
Definition: nil.qh:9
const int WEP_FIRST
Definition: all.qh:304
ERASEABLE void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
Definition: sort.qh:9
#define WEP_LAST
Definition: all.qh:305
float W_FixWeaponOrder_BuildImpulseList_buf[REGISTRY_MAX(Weapons)]
Definition: all.qc:141
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define NULL
Definition: post.qh:17
string W_FixWeaponOrder_BuildImpulseList_order
Definition: all.qc:142
void W_FixWeaponOrder_BuildImpulseList_swap(int i, int j, entity pass)
Definition: all.qc:143
float W_FixWeaponOrder_BuildImpulseList_cmp(int i, int j, entity pass)
Definition: all.qc:150
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_FixWeaponOrder_BuildImpulseList_cmp()

float W_FixWeaponOrder_BuildImpulseList_cmp ( int  i,
int  j,
entity  pass 
)

Definition at line 150 of file all.qc.

References Weapon::impulse, REGISTRY_GET, strcat(), strstrofs, W_FixWeaponOrder_BuildImpulseList_buf, and W_FixWeaponOrder_BuildImpulseList_order.

Referenced by W_FixWeaponOrder_BuildImpulseList().

151 {
153  Weapon e1 = REGISTRY_GET(Weapons, si);
155  Weapon e2 = REGISTRY_GET(Weapons, sj);
156  int d = (e1.impulse + 9) % 10 - (e2.impulse + 9) % 10;
157  if (d != 0) return -d; // high impulse first!
158  string s = strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " ");
159  return strstrofs(s, sprintf(" %d ", si), 0)
160  - strstrofs(s, sprintf(" %d ", sj), 0); // low char index first!
161 }
#define REGISTRY_GET(id, i)
Definition: registry.qh:43
float W_FixWeaponOrder_BuildImpulseList_buf[REGISTRY_MAX(Weapons)]
Definition: all.qc:141
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
int impulse
M: impulse : weapon impulse.
Definition: weapon.qh:50
#define strstrofs
Definition: dpextensions.qh:42
string W_FixWeaponOrder_BuildImpulseList_order
Definition: all.qc:142
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition: weapon.qh:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_FixWeaponOrder_BuildImpulseList_swap()

void W_FixWeaponOrder_BuildImpulseList_swap ( int  i,
int  j,
entity  pass 
)

Definition at line 143 of file all.qc.

References W_FixWeaponOrder_BuildImpulseList_buf.

Referenced by W_FixWeaponOrder_BuildImpulseList().

144 {
145  float h;
149 }
float W_FixWeaponOrder_BuildImpulseList_buf[REGISTRY_MAX(Weapons)]
Definition: all.qc:141
+ Here is the caller graph for this function:

◆ W_FixWeaponOrder_ForceComplete()

string W_FixWeaponOrder_ForceComplete ( string  order)

Definition at line 182 of file all.qc.

References cvar_defstring(), W_FixWeaponOrder(), and W_NumberWeaponOrder().

Referenced by HUD_Weapons(), and W_Model().

183 {
184  if (order == "") order = W_NumberWeaponOrder(cvar_defstring("cl_weaponpriority"));
185  return W_FixWeaponOrder(order, 1);
186 }
string W_FixWeaponOrder(string order, float complete)
Definition: all.qc:95
string W_NumberWeaponOrder(string order)
Definition: all.qc:136
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_Model()

string W_Model ( string  w_mdl)

Definition at line 288 of file all.qc.

References alpha, angles, anim_set(), argv(), autocvar_chase_active, autocvar_r_drawviewmodel, CLIENT_COMMAND, CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, compressShotOrigin(), CS_CVAR, CSQCModel_server2csqc(), csqcplayer, decompressShotOrigin(), EF_ADDITIVE, EF_FULLBRIGHT, entity(), FOREACH, FOREACH_CLIENT, frame, gettagindex, gettaginfo, IS_REAL_CLIENT, IS_SPEC, LOG_HELP, LOG_INFOF, LOG_WARNF, M_ARGV, MASK_NORMAL, maxs, mins, model, movedir, msg_entity, MSG_ONE, MUTATOR_CALLHOOK, name, NET_HANDLE, nextthink, NULL, oldorigin, owner, player_localentnum, pointparticles, random(), ReadRegistered, realowner, REGISTER_NET_C2S, REGISTER_NET_TEMP, REGISTRY_GET, renderflags, REPLICATE(), RF_VIEWMODEL, scale, setanim, setmodel, setorigin(), setthink, shotdir, shotorg, spawn(), stov(), strcat(), strcpy, time, v, vector(), VF_CL_VIEWANGLES, view_ofs, viewmodelforclient, viewmodels, W_FixWeaponOrder_AllowIncomplete(), W_FixWeaponOrder_BuildImpulseList(), W_FixWeaponOrder_ForceComplete(), W_GunAlign(), W_Model(), Weapon_whereis(), weaponorder_byimpulse, weaponslot(), WriteByte(), WriteRegistered, WS_DROP, and WS_RAISE.

Referenced by CL_ExteriorWeaponentity_Think(), MDL_GIB_ROBO_RANDOM(), and W_Model().

289 {
290  string output = strcat("models/weapons/", w_mdl);
291  MUTATOR_CALLHOOK(WeaponModel, w_mdl, output);
292  return M_ARGV(1, string);
293 }
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define M_ARGV(x, type)
Definition: events.qh:17
#define MUTATOR_CALLHOOK(id,...)
Definition: base.qh:140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_NameWeaponOrder()

string W_NameWeaponOrder ( string  order)

Definition at line 125 of file all.qc.

References mapPriorityList(), and W_NameWeaponOrder_MapFunc().

Referenced by XonoticWeaponsList_draw().

126 {
128 }
string mapPriorityList(string order, string(string) mapfunc)
Definition: util.qc:527
string W_NameWeaponOrder_MapFunc(string s)
Definition: all.qc:99
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_NameWeaponOrder_MapFunc()

string W_NameWeaponOrder_MapFunc ( string  s)

Definition at line 99 of file all.qc.

References entity(), REGISTRY_GET, and stof().

Referenced by W_NameWeaponOrder().

100 {
101  int i = stof(s);
102  if (s == "0" || i)
103  {
104  entity wi = REGISTRY_GET(Weapons, i);
105  if (wi != WEP_Null) return wi.netname;
106  }
107  return s;
108 }
entity() spawn
#define REGISTRY_GET(id, i)
Definition: registry.qh:43
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_NumberWeaponOrder()

string W_NumberWeaponOrder ( string  order)

Definition at line 136 of file all.qc.

References mapPriorityList(), and W_NumberWeaponOrder_MapFunc().

Referenced by HUD_Weapons(), LocalCommand_sendcvar(), W_FixWeaponOrder_ForceComplete(), XonoticWeaponsList_draw(), and XonoticWeaponsList_toString().

137 {
139 }
string mapPriorityList(string order, string(string) mapfunc)
Definition: util.qc:527
string W_NumberWeaponOrder_MapFunc(string s)
Definition: all.qc:129
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_NumberWeaponOrder_MapFunc()

string W_NumberWeaponOrder_MapFunc ( string  s)

Definition at line 129 of file all.qc.

References FOREACH, ftos(), stof(), and W_UndeprecateName().

Referenced by W_NumberWeaponOrder().

130 {
131  if (s == "0" || stof(s)) return s;
132  s = W_UndeprecateName(s);
133  FOREACH(Weapons, it != WEP_Null && it.netname == s, return ftos(i));
134  return s;
135 }
string W_UndeprecateName(string s)
Definition: all.qc:110
#define FOREACH(list, cond, body)
Definition: iter.qh:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_RandomWeapons()

WepSet W_RandomWeapons ( entity  e,
WepSet  remaining,
int  n 
)

Definition at line 188 of file all.qc.

References FOREACH, RandomSelection_AddEnt, RandomSelection_chosen_ent, RandomSelection_Init(), result, and WepSet_FromWeapon.

Referenced by MUTATOR_HOOKFUNCTION().

189 {
190  WepSet result = '0 0 0';
191  for (int j = 0; j < n; ++j)
192  {
194  FOREACH(Weapons, it != WEP_Null, {
195  if (remaining & (it.m_wepset))
196  RandomSelection_AddEnt(it, 1, 1);
197  });
199  result |= WepSet_FromWeapon(w);
200  remaining &= ~WepSet_FromWeapon(w);
201  }
202  return result;
203 }
vector WepSet
Definition: weapon.qh:11
ERASEABLE void RandomSelection_Init()
Definition: random.qc:4
entity result
Definition: promise.qc:43
#define RandomSelection_AddEnt(e, weight, priority)
Definition: random.qh:14
entity RandomSelection_chosen_ent
Definition: random.qh:5
#define WepSet_FromWeapon(it)
Definition: all.qh:38
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition: weapon.qh:41
#define FOREACH(list, cond, body)
Definition: iter.qh:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_Sound()

string W_Sound ( string  w_snd)

Definition at line 281 of file all.qc.

References M_ARGV, MUTATOR_CALLHOOK, and strcat().

Referenced by SND_GRENADE_BOUNCE_RANDOM(), SND_HAGEXP_RANDOM(), SND_NEXWHOOSH_RANDOM(), and SND_RIC_RANDOM().

282 {
283  string output = strcat("weapons/", w_snd);
284  MUTATOR_CALLHOOK(WeaponSound, w_snd, output);
285  return M_ARGV(1, string);
286 }
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define M_ARGV(x, type)
Definition: events.qh:17
#define MUTATOR_CALLHOOK(id,...)
Definition: base.qh:140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_UndeprecateName()

string W_UndeprecateName ( string  s)

Definition at line 110 of file all.qc.

Referenced by GiveItems(), spawnfunc(), and W_NumberWeaponOrder_MapFunc().

111 {
112  switch (s)
113  {
114  case "nex": return "vortex";
115  case "rocketlauncher": return "devastator";
116  case "laser": return "blaster";
117  case "minstanex": return "vaporizer";
118  case "grenadelauncher": return "mortar";
119  case "uzi": return "machinegun";
120  case "hmg": return "okhmg";
121  case "rpc": return "okrpc";
122  default: return s;
123  }
124 }
+ Here is the caller graph for this function:

Variable Documentation

◆ W_FixWeaponOrder_BuildImpulseList_buf

float W_FixWeaponOrder_BuildImpulseList_buf[REGISTRY_MAX(Weapons)]

◆ W_FixWeaponOrder_BuildImpulseList_order

string W_FixWeaponOrder_BuildImpulseList_order