Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
machinegun.qc
Go to the documentation of this file.
1#include "machinegun.qh"
2
3#ifdef SVQC
4
7
9void MachineGun_Update_Spread(entity actor, .entity weaponentity)
10{
11 float spread_accum = actor.(weaponentity).machinegun_spread_accumulation;
12
13 // time based spread decay
14 if (WEP_CVAR(WEP_MACHINEGUN, spread_decay))
15 {
16 float spreadSpectrumDistance = fabs(WEP_CVAR(WEP_MACHINEGUN, spread_max) - WEP_CVAR(WEP_MACHINEGUN, spread_min));
17 float timediff = time - actor.(weaponentity).spreadUpdateTime;
18 spread_accum = bound(0,
19 spread_accum - (timediff * WEP_CVAR(WEP_MACHINEGUN, spread_decay)),
20 spreadSpectrumDistance);
21 }
22 else // legacy behavior for Nexuiz weapon balance
23 {
24 spread_accum = bound(WEP_CVAR(WEP_MACHINEGUN, spread_min),
25 (WEP_CVAR(WEP_MACHINEGUN, spread_add) * actor.(weaponentity).misc_bulletcounter),
26 WEP_CVAR(WEP_MACHINEGUN, spread_max));
27 }
28
29 actor.(weaponentity).machinegun_spread_accumulation = spread_accum;
30 actor.(weaponentity).spreadUpdateTime = time;
31}
32
34float MachineGun_Heat(float spread_accum)
35{
36 // function for reducing mg's damage with no spread and adding damage with
37 // heated up barrel or vice versa depending on the values of exposed cvars
38 float heatMultiplierApplicationPercent = 0.5;
39 float coldMultiplierApplicationPercent = 0.5;
40
41 float spreadSpectrumDistance = fabs(WEP_CVAR(WEP_MACHINEGUN, spread_max) - WEP_CVAR(WEP_MACHINEGUN, spread_min));
42
43 if (spreadSpectrumDistance > 0) // avoid division by 0, can never be < 0 either due to how it is set when defined
44 {
45 heatMultiplierApplicationPercent = spread_accum / spreadSpectrumDistance;
46 coldMultiplierApplicationPercent = 1 - heatMultiplierApplicationPercent;
47 }
48
49 // example where low end has halved damage and high end has tripled damage:
50 // with 50% spread accumulation: heat = (0.5 * 0.5) + (0.5 * 3) = 0.25 + 1.5 = 1.75 damage multiplier
51 // with 90% spread accumulation: heat = (0.1 * 0.5) + (0.9 * 3) = 0.05 + 2.7 = 2.75 damage multiplier
52 // NOTE: multipliers do not apply when unset for compatibility
53 float cold_multiplier = WEP_CVAR(WEP_MACHINEGUN, spread_cold_damagemultiplier);
54 float heat_multiplier = WEP_CVAR(WEP_MACHINEGUN, spread_heat_damagemultiplier);
55 return (cold_multiplier ? coldMultiplierApplicationPercent * cold_multiplier : coldMultiplierApplicationPercent)
56 + (heat_multiplier ? heatMultiplierApplicationPercent * heat_multiplier : heatMultiplierApplicationPercent);
57}
58
59void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity weaponentity)
60{
61 W_SetupShot(actor, weaponentity, true, 0, SND_MACHINEGUN_FIRE, CH_WEAPON_A, ((actor.(weaponentity).misc_bulletcounter == 1) ? WEP_CVAR(WEP_MACHINEGUN, first_damage) : WEP_CVAR(WEP_MACHINEGUN, sustained_damage)), deathtype);
62
64 {
65 actor.punchangle_x = random() - 0.5;
66 actor.punchangle_y = random() - 0.5;
67 }
68
69 // this attack_finished just enforces a cooldown at the end of a burst
70 ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(WEP_MACHINEGUN, first_refire) * W_WeaponRateFactor(actor);
71
72 float spread_accuracy = (IS_DUCKED(actor) && IS_ONGROUND(actor))
73 ? WEP_CVAR(WEP_MACHINEGUN, spread_crouchmod)
74 : 1;
75
76 if(actor.(weaponentity).misc_bulletcounter == 1)
77 fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir,
78 WEP_CVAR(WEP_MACHINEGUN, first_spread) * spread_accuracy,
79 WEP_CVAR(WEP_MACHINEGUN, solidpenetration),
80 WEP_CVAR(WEP_MACHINEGUN, first_damage),
81 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_halflife),
82 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_mindist),
83 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_maxdist),
84 0,
85 WEP_CVAR(WEP_MACHINEGUN, first_force),
86 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_forcehalflife),
87 deathtype, EFFECT_BULLET, true);
88 else
89 fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir,
90 WEP_CVAR(WEP_MACHINEGUN, sustained_spread) * spread_accuracy,
91 WEP_CVAR(WEP_MACHINEGUN, solidpenetration),
92 WEP_CVAR(WEP_MACHINEGUN, sustained_damage),
93 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_halflife),
94 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_mindist),
95 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_maxdist),
96 0,
97 WEP_CVAR(WEP_MACHINEGUN, sustained_force),
98 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_forcehalflife),
99 deathtype, EFFECT_BULLET, true);
100
101 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
102
103 // casing code
104 if(autocvar_g_casings >= 2)
105 {
106 makevectors(actor.v_angle); // for some reason, this is lost
107 SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), vectoangles(v_forward), 3, actor, weaponentity);
108 }
109
110 if(actor.(weaponentity).misc_bulletcounter == 1)
111 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_MACHINEGUN, first_ammo), weaponentity);
112 else
113 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), weaponentity);
114}
115
116// weapon frames
117void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int fire)
118{
119 if(actor.(weaponentity).m_weapon != actor.(weaponentity).m_switchweapon || !weapon_prepareattack_check(thiswep, actor, weaponentity, (fire & 2), -1)) // abort immediately if switching
120 {
121 w_ready(thiswep, actor, weaponentity, fire);
122 return;
123 }
124 if(PHYS_INPUT_BUTTON_ATCK(actor))
125 {
126 if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity))
127 if(!(actor.items & IT_UNLIMITED_AMMO))
128 {
129 W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
130 w_ready(thiswep, actor, weaponentity, fire);
131 return;
132 }
133 ++actor.(weaponentity).misc_bulletcounter;
134 W_MachineGun_Attack(thiswep, thiswep.m_id, actor, weaponentity);
135 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_MACHINEGUN, sustained_refire), W_MachineGun_Attack_Frame);
136 }
137 else
138 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_MACHINEGUN, sustained_refire), w_ready);
139}
140
141
142void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
143{
144 if(!(fire & 1) || !weapon_prepareattack_check(thiswep, actor, weaponentity, false, -1))
145 {
146 w_ready(thiswep, actor, weaponentity, fire);
147 return;
148 }
149
150 if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity))
151 if(!(actor.items & IT_UNLIMITED_AMMO))
152 {
153 W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
154 w_ready(thiswep, actor, weaponentity, fire);
155 return;
156 }
157
158 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), weaponentity);
159
160 W_SetupShot(actor, weaponentity, true, 0, SND_MACHINEGUN_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_MACHINEGUN, sustained_damage), thiswep.m_id);
162 {
163 actor.punchangle_x = random() - 0.5;
164 actor.punchangle_y = random() - 0.5;
165 }
166
167 MachineGun_Update_Spread(actor, weaponentity);
168
169 float spread_accum = actor.(weaponentity).machinegun_spread_accumulation;
170
171 float heat = MachineGun_Heat(spread_accum);
172
173 float spread_accuracy;
174 if (WEP_CVAR(WEP_MACHINEGUN, spread_min) < WEP_CVAR(WEP_MACHINEGUN, spread_max))
175 spread_accuracy = WEP_CVAR(WEP_MACHINEGUN, spread_min) + spread_accum;
176 else // inverted
177 spread_accuracy = WEP_CVAR(WEP_MACHINEGUN, spread_min) - spread_accum;
178
179 if (IS_DUCKED(actor) && IS_ONGROUND(actor))
180 spread_accuracy *= WEP_CVAR(WEP_MACHINEGUN, spread_crouchmod);
181
182 fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir,
183 spread_accuracy,
184 WEP_CVAR(WEP_MACHINEGUN, solidpenetration),
185 WEP_CVAR(WEP_MACHINEGUN, sustained_damage) * heat,
186 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_halflife),
187 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_mindist),
188 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_maxdist),
189 0,
190 WEP_CVAR(WEP_MACHINEGUN, sustained_force),
191 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_forcehalflife),
192 thiswep.m_id, EFFECT_BULLET, true);
193
194 ++actor.(weaponentity).misc_bulletcounter;
195
196 spread_accum += WEP_CVAR(WEP_MACHINEGUN, spread_add);
197
198 actor.(weaponentity).machinegun_spread_accumulation = spread_accum;
199
200 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
201
202 if(autocvar_g_casings >= 2) // casing code
203 {
204 makevectors(actor.v_angle); // for some reason, this is lost
205 SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), vectoangles(v_forward), 3, actor, weaponentity);
206 }
207
208 ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(WEP_MACHINEGUN, first_refire) * W_WeaponRateFactor(actor);
209 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_MACHINEGUN, sustained_refire), W_MachineGun_Attack_Auto);
210}
211
212void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentity, int fire)
213{
214 W_SetupShot(actor, weaponentity, true, 0, SND_MACHINEGUN_FIRE, CH_WEAPON_A, WEP_CVAR(WEP_MACHINEGUN, sustained_damage), thiswep.m_id);
216 {
217 actor.punchangle_x = random() - 0.5;
218 actor.punchangle_y = random() - 0.5;
219 }
220
221 MachineGun_Update_Spread(actor, weaponentity);
222
223 float spread_accum = actor.(weaponentity).machinegun_spread_accumulation;
224
225 float heat = MachineGun_Heat(spread_accum);
226
227 float spread_accuracy = WEP_CVAR(WEP_MACHINEGUN, burst_spread);
228 if (IS_DUCKED(actor) && IS_ONGROUND(actor))
229 spread_accuracy *= WEP_CVAR(WEP_MACHINEGUN, spread_crouchmod);
230
231 fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir,
232 spread_accuracy,
233 WEP_CVAR(WEP_MACHINEGUN, solidpenetration),
234 WEP_CVAR(WEP_MACHINEGUN, sustained_damage) * heat,
235 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_halflife),
236 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_mindist),
237 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_maxdist),
238 0,
239 WEP_CVAR(WEP_MACHINEGUN, sustained_force),
240 WEP_CVAR(WEP_MACHINEGUN, damagefalloff_forcehalflife),
241 thiswep.m_id, EFFECT_BULLET, true);
242
243 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
244
245 if(autocvar_g_casings >= 2) // casing code
246 {
247 makevectors(actor.v_angle); // for some reason, this is lost
248 SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), vectoangles(v_forward), 3, actor, weaponentity);
249 }
250
251 spread_accum += WEP_CVAR(WEP_MACHINEGUN, spread_add);
252
253 actor.(weaponentity).machinegun_spread_accumulation = spread_accum;
254
255 ++actor.(weaponentity).misc_bulletcounter;
256 if(actor.(weaponentity).misc_bulletcounter == 0)
257 {
258 ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(WEP_MACHINEGUN, burst_refire2) * W_WeaponRateFactor(actor);
259 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_MACHINEGUN, burst_animtime), w_ready);
260 }
261 else
262 {
263 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_MACHINEGUN, burst_refire), W_MachineGun_Attack_Burst);
264 }
265
266}
267
268METHOD(MachineGun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
269{
270 if(vdist(actor.origin - actor.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
271 PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, true);
272 else
273 PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, true);
274}
275
276METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
277{
278 // forced reload - wait until the bulletcounter is 0 so a burst loop can finish
279 if (WEP_CVAR(WEP_MACHINEGUN, reload_ammo)
280 && actor.(weaponentity).clip_load < min(max(WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), WEP_CVAR(WEP_MACHINEGUN, first_ammo)), WEP_CVAR(WEP_MACHINEGUN, burst_ammo))
281 && actor.(weaponentity).misc_bulletcounter >= 0)
282 {
283 thiswep.wr_reload(thiswep, actor, weaponentity);
284 }
285 else if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1)
286 {
287 if(fire & 1)
288 if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
289 {
290 actor.(weaponentity).misc_bulletcounter = 0;
291 W_MachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
292 }
293
294 // You can "shoot" more rounds than what's "used", and vice versa.
295 if(fire & 2)
296 if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
297 {
298 if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity))
299 if(!(actor.items & IT_UNLIMITED_AMMO))
300 {
301 W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
302 w_ready(thiswep, actor, weaponentity, fire);
303 return;
304 }
305
306 float ammo_available;
307 if (WEP_CVAR(WEP_MACHINEGUN, reload_ammo) > 0)
308 {
309 ammo_available = actor.(weaponentity).clip_load;
310 }
311 else
312 {
313 ammo_available = GetResource(actor, thiswep.ammo_type);
314 }
315
316 int to_shoot = WEP_CVAR(WEP_MACHINEGUN, burst);
317 if(!(actor.items & IT_UNLIMITED_AMMO))
318 {
319 // We don't want to shoot 3 rounds if there's 2 left in the mag, so we'll use a fraction.
320 // Also keep the fraction <= 1 otherwise we'd mag dump in one burst.
321 float burst_fraction = min(1, ammo_available / WEP_CVAR(WEP_MACHINEGUN, burst_ammo));
322 to_shoot = floor(to_shoot * burst_fraction);
323
324 // We also don't want to use 3 rounds if there's only 2 left.
325 int to_use = min(WEP_CVAR(WEP_MACHINEGUN, burst_ammo), ammo_available);
326 W_DecreaseAmmo(thiswep, actor, to_use, weaponentity);
327 }
328
329 // Bursting counts up to 0 from a negative.
330 actor.(weaponentity).misc_bulletcounter = -to_shoot;
331 W_MachineGun_Attack_Burst(thiswep, actor, weaponentity, fire);
332 }
333 }
334 else
335 {
336
337 if(fire & 1)
338 if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
339 {
340 actor.(weaponentity).misc_bulletcounter = 1;
341 W_MachineGun_Attack(thiswep, thiswep.m_id, actor, weaponentity); // sets attack_finished
342 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(WEP_MACHINEGUN, sustained_refire), W_MachineGun_Attack_Frame);
343 }
344
345 if((fire & 2) && WEP_CVAR(WEP_MACHINEGUN, first))
346 if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
347 {
348 actor.(weaponentity).misc_bulletcounter = 1;
349 W_MachineGun_Attack(thiswep, thiswep.m_id | HITTYPE_SECONDARY, actor, weaponentity); // sets attack_finished
350 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(WEP_MACHINEGUN, first_refire), w_ready);
351 }
352 }
353}
354
355METHOD(MachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
356{
357 float ammo_amount;
358 if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1)
359 ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_MACHINEGUN, sustained_ammo);
360 else
361 ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_MACHINEGUN, first_ammo);
362
363 if(WEP_CVAR(WEP_MACHINEGUN, reload_ammo))
364 {
365 if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1)
366 ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_MACHINEGUN, sustained_ammo);
367 else
368 ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_MACHINEGUN, first_ammo);
369 }
370
371 return ammo_amount;
372}
373
374METHOD(MachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
375{
376 float ammo_amount;
377 float burst_ammo_per_shot = WEP_CVAR(WEP_MACHINEGUN, burst_ammo) / WEP_CVAR(WEP_MACHINEGUN, burst);
378
379 if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1)
380 ammo_amount = GetResource(actor, thiswep.ammo_type) >= burst_ammo_per_shot;
381 else
382 ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_MACHINEGUN, first_ammo);
383
384 if(WEP_CVAR(WEP_MACHINEGUN, reload_ammo))
385 {
386 if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1)
387 ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= burst_ammo_per_shot;
388 else
389 ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(WEP_MACHINEGUN, first_ammo);
390 }
391
392 return ammo_amount;
393}
394
395METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
396{
397 if(actor.(weaponentity).misc_bulletcounter < 0)
398 return;
399 W_Reload(actor, weaponentity, min(max(WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), WEP_CVAR(WEP_MACHINEGUN, first_ammo)), WEP_CVAR(WEP_MACHINEGUN, burst_ammo)), SND_RELOAD);
400}
401
402METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep))
403{
404 return WEAPON_THINKING_WITH_PORTALS;
405}
406
407METHOD(MachineGun, wr_killmessage, Notification(entity thiswep))
408{
410 return WEAPON_MACHINEGUN_MURDER_SNIPE;
411 else
412 return WEAPON_MACHINEGUN_MURDER_SPRAY;
413}
414
415#endif
416#ifdef CSQC
417
418METHOD(MachineGun, wr_impacteffect, void(entity thiswep, entity actor))
419{
420 vector org2 = w_org + w_backoff * 2;
421 pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
422 if(!w_issilent)
424}
425
426#endif
427#ifdef MENUQC
429
430METHOD(MachineGun, describe, string(MachineGun this))
431{
432 TC(MachineGun, this);
434 PAR(_("The %s quickly fires bullets with a small degree of spread."), COLORED_NAME(this));
435 PAR(_("The secondary fire fires a quick burst of bullets faster than the primary fire and with no spread, but there's a short delay until it can be used again."));
436 PAR(_("It consumes %s ammo for each bullet shot, until the whole magazine is emptied."), COLORED_NAME(ITEM_Bullets));
437 PAR(_("The %s can be used in a lot of situations, and it works particularly well at long ranges since the bullets pierce the sky instantaneously. "
438 "Since the secondary fire has no spread, it's the better option when firing over a long range."), COLORED_NAME(this));
439 PAR(W_Guide_Keybinds(this));
440 PAR(W_Guide_DPS_secondaryMultishot(this.netname, "sustained", "burst", "burst", "burst_refire2", false));
441 return PAGE_TEXT;
442}
443
444#endif
float skill
Definition api.qh:35
bool bot_aim(entity this,.entity weaponentity, float shotspeed, float shotspeedupward, float maxshottime, float applygravity, bool shot_accurate)
void SpawnCasing(vector vel, vector ang, int casingtype, entity casingowner,.entity weaponentity)
Definition casings.qc:17
int autocvar_g_casings
Definition casings.qh:17
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:44
int m_id
Definition weapon.qh:45
virtual void wr_checkammo2()
(SERVER) checks ammo for weapon second
Definition weapon.qh:94
virtual void wr_checkammo1()
(SERVER) checks ammo for weapon primary
Definition weapon.qh:92
string netname
Definition powerups.qc:20
#define COLORED_NAME(this)
Definition color.qh:195
const int IT_UNLIMITED_AMMO
Definition item.qh:23
#define IS_DUCKED(s)
Definition player.qh:210
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition player.qh:150
#define PHYS_INPUT_BUTTON_ATCK2(s)
Definition player.qh:152
float W_WeaponRateFactor(entity this)
vector v_up
float time
vector v_right
vector v_forward
const float ATTN_NORM
void W_SwitchWeapon_Force(Player this, Weapon w,.entity weaponentity)
Definition selection.qc:246
vector w_org
int w_deathtype
vector w_backoff
float w_issilent
const int HITTYPE_SECONDARY
Definition all.qh:29
#define pointparticles(effect, org, vel, howmany)
Definition effect.qh:7
#define ERASEABLE
Definition _all.inc:37
#define TC(T, sym)
Definition _all.inc:82
float bound(float min, float value, float max)
float random(void)
vector vectoangles(vector v)
float min(float f,...)
float fabs(float f)
float floor(float f)
float max(float f,...)
#define IS_ONGROUND(s)
Definition movetypes.qh:16
entity Notification
always last
Definition all.qh:81
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define makevectors
Definition post.qh:21
#define w_getbestweapon(ent, wepent)
Definition selection.qh:23
vector
Definition self.qh:92
float misc_bulletcounter
Definition common.qh:19
const float VOL_BASE
Definition sound.qh:36
const int CH_SHOTS
Definition sound.qh:14
const int CH_WEAPON_A
Definition sound.qh:7
#define sound(e, c, s, v, a)
Definition sound.qh:52
Sound SND_RIC_RANDOM()
Definition all.inc:33
#define PAGE_TEXT
Definition string.qh:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642
void fireBullet_falloff(entity this,.entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float falloff_halflife, float falloff_mindist, float falloff_maxdist, float headshot_multiplier, float force, float falloff_forcehalflife, float dtype, entity tracer_effect, bool do_antilag)
Definition tracing.qc:364
bool autocvar_g_norecoil
Definition tracing.qh:16
vector w_shotdir
Definition tracing.qh:20
vector w_shotorg
Definition tracing.qh:19
#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype)
Definition tracing.qh:34
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8
string W_Guide_Keybinds(Weapon wep)
Definition all.qc:836
string W_Guide_DPS_secondaryMultishot(string name, string pri, string sec, string shots, string refire2, bool sec_variable)
Definition all.qc:967
void W_MuzzleFlash(Weapon thiswep, entity actor,.entity weaponentity, vector shotorg, vector shotdir)
Definition all.qc:728
#define WEP_CVAR(wep, name)
Definition all.qh:321
void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor,.entity weaponentity)
Definition machinegun.qc:59
ERASEABLE float MachineGun_Heat(float spread_accum)
Definition machinegun.qc:34
float spreadUpdateTime
Definition machinegun.qc:6
void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor,.entity weaponentity, int fire)
ERASEABLE void MachineGun_Update_Spread(entity actor,.entity weaponentity)
Definition machinegun.qc:9
void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor,.entity weaponentity, int fire)
float machinegun_spread_accumulation
Definition machinegun.qc:5
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use,.entity weaponentity)
void W_Reload(entity actor,.entity weaponentity, float sent_ammo_min, Sound sent_sound)
void weapon_thinkf(entity actor,.entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,.entity weaponentity, int fire) func)
bool weapon_prepareattack(Weapon thiswep, entity actor,.entity weaponentity, bool secondary, float attacktime)
void w_ready(Weapon thiswep, entity actor,.entity weaponentity, int fire)
bool weapon_prepareattack_check(Weapon thiswep, entity actor,.entity weaponentity, bool secondary, float attacktime)
#define ATTACK_FINISHED(ent, w)
float weapon_load[REGISTRY_MAX(Weapons)]
int clip_load
Definition wepent.qh:14