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