icculus quake2 doxygen  1.0 dev
p_weapon.c
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13 See the GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 */
20 // g_weapon.c
21 
22 #include "g_local.h"
23 #include "m_player.h"
24 
25 
27 static byte is_silenced;
28 
29 
30 void weapon_grenade_fire (edict_t *ent, qboolean held);
31 
32 
33 static void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
34 {
35  vec3_t _distance;
36 
37  VectorCopy (distance, _distance);
38  if (client->pers.hand == LEFT_HANDED)
39  _distance[1] *= -1;
40  else if (client->pers.hand == CENTER_HANDED)
41  _distance[1] = 0;
42  G_ProjectSource (point, _distance, forward, right, result);
43 }
44 
45 
46 /*
47 ===============
48 PlayerNoise
49 
50 Each player can have two noise objects associated with it:
51 a personal noise (jumping, pain, weapon firing), and a weapon
52 target noise (bullet wall impacts)
53 
54 Monsters that don't directly see the player can move
55 to a noise in hopes of seeing the player from there.
56 ===============
57 */
58 void PlayerNoise(edict_t *who, vec3_t where, int type)
59 {
60  edict_t *noise;
61 
62  if (type == PNOISE_WEAPON)
63  {
64  if (who->client->silencer_shots)
65  {
66  who->client->silencer_shots--;
67  return;
68  }
69  }
70 
71  if (deathmatch->value)
72  return;
73 
74  if (who->flags & FL_NOTARGET)
75  return;
76 
77 
78  if (!who->mynoise)
79  {
80  noise = G_Spawn();
81  noise->classname = "player_noise";
82  VectorSet (noise->mins, -8, -8, -8);
83  VectorSet (noise->maxs, 8, 8, 8);
84  noise->owner = who;
85  noise->svflags = SVF_NOCLIENT;
86  who->mynoise = noise;
87 
88  noise = G_Spawn();
89  noise->classname = "player_noise";
90  VectorSet (noise->mins, -8, -8, -8);
91  VectorSet (noise->maxs, 8, 8, 8);
92  noise->owner = who;
93  noise->svflags = SVF_NOCLIENT;
94  who->mynoise2 = noise;
95  }
96 
97  if (type == PNOISE_SELF || type == PNOISE_WEAPON)
98  {
99  noise = who->mynoise;
100  level.sound_entity = noise;
101  level.sound_entity_framenum = level.framenum;
102  }
103  else // type == PNOISE_IMPACT
104  {
105  noise = who->mynoise2;
106  level.sound2_entity = noise;
107  level.sound2_entity_framenum = level.framenum;
108  }
109 
110  VectorCopy (where, noise->s.origin);
111  VectorSubtract (where, noise->maxs, noise->absmin);
112  VectorAdd (where, noise->maxs, noise->absmax);
113  noise->teleport_time = level.time;
114  gi.linkentity (noise);
115 }
116 
117 
119 {
120  int index;
121  gitem_t *ammo;
122 
123  index = ITEM_INDEX(ent->item);
124 
125  if ( ( ((int)(dmflags->value) & DF_WEAPONS_STAY) || coop->value)
126  && other->client->pers.inventory[index])
127  {
128  if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM) ) )
129  return false; // leave the weapon for others to pickup
130  }
131 
132  other->client->pers.inventory[index]++;
133 
134  if (!(ent->spawnflags & DROPPED_ITEM) )
135  {
136  // give them some ammo with it
137  ammo = FindItem (ent->item->ammo);
138  if ( (int)dmflags->value & DF_INFINITE_AMMO )
139  Add_Ammo (other, ammo, 1000);
140  else
141  Add_Ammo (other, ammo, ammo->quantity);
142 
143  if (! (ent->spawnflags & DROPPED_PLAYER_ITEM) )
144  {
145  if (deathmatch->value)
146  {
147  if ((int)(dmflags->value) & DF_WEAPONS_STAY)
148  ent->flags |= FL_RESPAWN;
149  else
150  SetRespawn (ent, 30);
151  }
152  if (coop->value)
153  ent->flags |= FL_RESPAWN;
154  }
155  }
156 
157  if (other->client->pers.weapon != ent->item &&
158  (other->client->pers.inventory[index] == 1) &&
159  ( !deathmatch->value || other->client->pers.weapon == FindItem("blaster") ) )
160  other->client->newweapon = ent->item;
161 
162  return true;
163 }
164 
165 
166 /*
167 ===============
168 ChangeWeapon
169 
170 The old weapon has been dropped all the way, so make the new one
171 current
172 ===============
173 */
175 {
176  int i;
177 
178  if (ent->client->grenade_time)
179  {
180  ent->client->grenade_time = level.time;
181  ent->client->weapon_sound = 0;
182  weapon_grenade_fire (ent, false);
183  ent->client->grenade_time = 0;
184  }
185 
186  ent->client->pers.lastweapon = ent->client->pers.weapon;
187  ent->client->pers.weapon = ent->client->newweapon;
188  ent->client->newweapon = NULL;
189  ent->client->machinegun_shots = 0;
190 
191  // set visible model
192  if (ent->s.modelindex == 255) {
193  if (ent->client->pers.weapon)
194  i = ((ent->client->pers.weapon->weapmodel & 0xff) << 8);
195  else
196  i = 0;
197  ent->s.skinnum = (ent - g_edicts - 1) | i;
198  }
199 
200  if (ent->client->pers.weapon && ent->client->pers.weapon->ammo)
202  else
203  ent->client->ammo_index = 0;
204 
205  if (!ent->client->pers.weapon)
206  { // dead
207  ent->client->ps.gunindex = 0;
208  return;
209  }
210 
212  ent->client->ps.gunframe = 0;
214 
216  if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
217  {
218  ent->s.frame = FRAME_crpain1;
219  ent->client->anim_end = FRAME_crpain4;
220  }
221  else
222  {
223  ent->s.frame = FRAME_pain301;
224  ent->client->anim_end = FRAME_pain304;
225 
226  }
227 }
228 
229 /*
230 =================
231 NoAmmoWeaponChange
232 =================
233 */
235 {
236  if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("slugs"))]
237  && ent->client->pers.inventory[ITEM_INDEX(FindItem("railgun"))] )
238  {
239  ent->client->newweapon = FindItem ("railgun");
240  return;
241  }
242  if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))]
243  && ent->client->pers.inventory[ITEM_INDEX(FindItem("hyperblaster"))] )
244  {
245  ent->client->newweapon = FindItem ("hyperblaster");
246  return;
247  }
248  if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("bullets"))]
249  && ent->client->pers.inventory[ITEM_INDEX(FindItem("chaingun"))] )
250  {
251  ent->client->newweapon = FindItem ("chaingun");
252  return;
253  }
254  if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("bullets"))]
255  && ent->client->pers.inventory[ITEM_INDEX(FindItem("machinegun"))] )
256  {
257  ent->client->newweapon = FindItem ("machinegun");
258  return;
259  }
260  if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("shells"))] > 1
261  && ent->client->pers.inventory[ITEM_INDEX(FindItem("super shotgun"))] )
262  {
263  ent->client->newweapon = FindItem ("super shotgun");
264  return;
265  }
266  if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("shells"))]
267  && ent->client->pers.inventory[ITEM_INDEX(FindItem("shotgun"))] )
268  {
269  ent->client->newweapon = FindItem ("shotgun");
270  return;
271  }
272  ent->client->newweapon = FindItem ("blaster");
273 }
274 
275 /*
276 =================
277 Think_Weapon
278 
279 Called by ClientBeginServerFrame and ClientThink
280 =================
281 */
283 {
284  // if just died, put the weapon away
285  if (ent->health < 1)
286  {
287  ent->client->newweapon = NULL;
288  ChangeWeapon (ent);
289  }
290 
291  // call active weapon think routine
292  if (ent->client->pers.weapon && ent->client->pers.weapon->weaponthink)
293  {
294  is_quad = (ent->client->quad_framenum > level.framenum);
295  if (ent->client->silencer_shots)
297  else
298  is_silenced = 0;
299  ent->client->pers.weapon->weaponthink (ent);
300  }
301 }
302 
303 
304 /*
305 ================
306 Use_Weapon
307 
308 Make the weapon ready if there is ammo
309 ================
310 */
312 {
313  int ammo_index;
314  gitem_t *ammo_item;
315 
316  // see if we're already using it
317  if (item == ent->client->pers.weapon)
318  return;
319 
320  if (item->ammo && !g_select_empty->value && !(item->flags & IT_AMMO))
321  {
322  ammo_item = FindItem(item->ammo);
323  ammo_index = ITEM_INDEX(ammo_item);
324 
325  if (!ent->client->pers.inventory[ammo_index])
326  {
327  gi.cprintf (ent, PRINT_HIGH, "No %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
328  return;
329  }
330 
331  if (ent->client->pers.inventory[ammo_index] < item->quantity)
332  {
333  gi.cprintf (ent, PRINT_HIGH, "Not enough %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
334  return;
335  }
336  }
337 
338  // change to this weapon when down
339  ent->client->newweapon = item;
340 }
341 
342 
343 
344 /*
345 ================
346 Drop_Weapon
347 ================
348 */
350 {
351  int index;
352 
353  if ((int)(dmflags->value) & DF_WEAPONS_STAY)
354  return;
355 
356  index = ITEM_INDEX(item);
357  // see if we're already using it
358  if ( ((item == ent->client->pers.weapon) || (item == ent->client->newweapon))&& (ent->client->pers.inventory[index] == 1) )
359  {
360  gi.cprintf (ent, PRINT_HIGH, "Can't drop current weapon\n");
361  return;
362  }
363 
364  Drop_Item (ent, item);
365  ent->client->pers.inventory[index]--;
366 }
367 
368 
369 /*
370 ================
371 Weapon_Generic
372 
373 A generic function to handle the basics of weapon thinking
374 ================
375 */
376 #define FRAME_FIRE_FIRST (FRAME_ACTIVATE_LAST + 1)
377 #define FRAME_IDLE_FIRST (FRAME_FIRE_LAST + 1)
378 #define FRAME_DEACTIVATE_FIRST (FRAME_IDLE_LAST + 1)
379 
380 void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent))
381 {
382  int n;
383 
384  if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
385  {
386  return;
387  }
388 
389  if (ent->client->weaponstate == WEAPON_DROPPING)
390  {
391  if (ent->client->ps.gunframe == FRAME_DEACTIVATE_LAST)
392  {
393  ChangeWeapon (ent);
394  return;
395  }
396  else if ((FRAME_DEACTIVATE_LAST - ent->client->ps.gunframe) == 4)
397  {
399  if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
400  {
401  ent->s.frame = FRAME_crpain4+1;
402  ent->client->anim_end = FRAME_crpain1;
403  }
404  else
405  {
406  ent->s.frame = FRAME_pain304+1;
407  ent->client->anim_end = FRAME_pain301;
408 
409  }
410  }
411 
412  ent->client->ps.gunframe++;
413  return;
414  }
415 
416  if (ent->client->weaponstate == WEAPON_ACTIVATING)
417  {
418  if (ent->client->ps.gunframe == FRAME_ACTIVATE_LAST)
419  {
422  return;
423  }
424 
425  ent->client->ps.gunframe++;
426  return;
427  }
428 
429  if ((ent->client->newweapon) && (ent->client->weaponstate != WEAPON_FIRING))
430  {
433 
434  if ((FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) < 4)
435  {
437  if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
438  {
439  ent->s.frame = FRAME_crpain4+1;
440  ent->client->anim_end = FRAME_crpain1;
441  }
442  else
443  {
444  ent->s.frame = FRAME_pain304+1;
445  ent->client->anim_end = FRAME_pain301;
446 
447  }
448  }
449  return;
450  }
451 
452  if (ent->client->weaponstate == WEAPON_READY)
453  {
454  if ( ((ent->client->latched_buttons|ent->client->buttons) & BUTTON_ATTACK) )
455  {
457  if ((!ent->client->ammo_index) ||
458  ( ent->client->pers.inventory[ent->client->ammo_index] >= ent->client->pers.weapon->quantity))
459  {
462 
463  // start the animation
465  if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
466  {
467  ent->s.frame = FRAME_crattak1-1;
469  }
470  else
471  {
472  ent->s.frame = FRAME_attack1-1;
473  ent->client->anim_end = FRAME_attack8;
474  }
475  }
476  else
477  {
478  if (level.time >= ent->pain_debounce_time)
479  {
480  gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
481  ent->pain_debounce_time = level.time + 1;
482  }
483  NoAmmoWeaponChange (ent);
484  }
485  }
486  else
487  {
488  if (ent->client->ps.gunframe == FRAME_IDLE_LAST)
489  {
491  return;
492  }
493 
494  if (pause_frames)
495  {
496  for (n = 0; pause_frames[n]; n++)
497  {
498  if (ent->client->ps.gunframe == pause_frames[n])
499  {
500  if (rand()&15)
501  return;
502  }
503  }
504  }
505 
506  ent->client->ps.gunframe++;
507  return;
508  }
509  }
510 
511  if (ent->client->weaponstate == WEAPON_FIRING)
512  {
513  for (n = 0; fire_frames[n]; n++)
514  {
515  if (ent->client->ps.gunframe == fire_frames[n])
516  {
517  if (ent->client->quad_framenum > level.framenum)
518  gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage3.wav"), 1, ATTN_NORM, 0);
519 
520  fire (ent);
521  break;
522  }
523  }
524 
525  if (!fire_frames[n])
526  ent->client->ps.gunframe++;
527 
528  if (ent->client->ps.gunframe == FRAME_IDLE_FIRST+1)
530  }
531 }
532 
533 
534 /*
535 ======================================================================
536 
537 GRENADE
538 
539 ======================================================================
540 */
541 
542 #define GRENADE_TIMER 3.0
543 #define GRENADE_MINSPEED 400
544 #define GRENADE_MAXSPEED 800
545 
547 {
548  vec3_t offset;
550  vec3_t start;
551  int damage = 125;
552  float timer;
553  int speed;
554  float radius;
555 
556  radius = damage+40;
557  if (is_quad)
558  damage *= 4;
559 
560  VectorSet(offset, 8, 8, ent->viewheight-8);
562  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
563 
564  timer = ent->client->grenade_time - level.time;
566  fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);
567 
568  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
569  ent->client->pers.inventory[ent->client->ammo_index]--;
570 
571  ent->client->grenade_time = level.time + 1.0;
572 
573  if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
574  {
575  return;
576  }
577 
578  if (ent->health <= 0)
579  return;
580 
581  if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
582  {
584  ent->s.frame = FRAME_crattak1-1;
586  }
587  else
588  {
590  ent->s.frame = FRAME_wave08;
591  ent->client->anim_end = FRAME_wave01;
592  }
593 }
594 
596 {
597  if ((ent->client->newweapon) && (ent->client->weaponstate == WEAPON_READY))
598  {
599  ChangeWeapon (ent);
600  return;
601  }
602 
603  if (ent->client->weaponstate == WEAPON_ACTIVATING)
604  {
606  ent->client->ps.gunframe = 16;
607  return;
608  }
609 
610  if (ent->client->weaponstate == WEAPON_READY)
611  {
612  if ( ((ent->client->latched_buttons|ent->client->buttons) & BUTTON_ATTACK) )
613  {
615  if (ent->client->pers.inventory[ent->client->ammo_index])
616  {
617  ent->client->ps.gunframe = 1;
619  ent->client->grenade_time = 0;
620  }
621  else
622  {
623  if (level.time >= ent->pain_debounce_time)
624  {
625  gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
626  ent->pain_debounce_time = level.time + 1;
627  }
628  NoAmmoWeaponChange (ent);
629  }
630  return;
631  }
632 
633  if ((ent->client->ps.gunframe == 29) || (ent->client->ps.gunframe == 34) || (ent->client->ps.gunframe == 39) || (ent->client->ps.gunframe == 48))
634  {
635  if (rand()&15)
636  return;
637  }
638 
639  if (++ent->client->ps.gunframe > 48)
640  ent->client->ps.gunframe = 16;
641  return;
642  }
643 
644  if (ent->client->weaponstate == WEAPON_FIRING)
645  {
646  if (ent->client->ps.gunframe == 5)
647  gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/hgrena1b.wav"), 1, ATTN_NORM, 0);
648 
649  if (ent->client->ps.gunframe == 11)
650  {
651  if (!ent->client->grenade_time)
652  {
653  ent->client->grenade_time = level.time + GRENADE_TIMER + 0.2;
654  ent->client->weapon_sound = gi.soundindex("weapons/hgrenc1b.wav");
655  }
656 
657  // they waited too long, detonate it in their hand
658  if (!ent->client->grenade_blew_up && level.time >= ent->client->grenade_time)
659  {
660  ent->client->weapon_sound = 0;
661  weapon_grenade_fire (ent, true);
662  ent->client->grenade_blew_up = true;
663  }
664 
665  if (ent->client->buttons & BUTTON_ATTACK)
666  return;
667 
668  if (ent->client->grenade_blew_up)
669  {
670  if (level.time >= ent->client->grenade_time)
671  {
672  ent->client->ps.gunframe = 15;
673  ent->client->grenade_blew_up = false;
674  }
675  else
676  {
677  return;
678  }
679  }
680  }
681 
682  if (ent->client->ps.gunframe == 12)
683  {
684  ent->client->weapon_sound = 0;
685  weapon_grenade_fire (ent, false);
686  }
687 
688  if ((ent->client->ps.gunframe == 15) && (level.time < ent->client->grenade_time))
689  return;
690 
691  ent->client->ps.gunframe++;
692 
693  if (ent->client->ps.gunframe == 16)
694  {
695  ent->client->grenade_time = 0;
697  }
698  }
699 }
700 
701 /*
702 ======================================================================
703 
704 GRENADE LAUNCHER
705 
706 ======================================================================
707 */
708 
710 {
711  vec3_t offset;
713  vec3_t start;
714  int damage = 120;
715  float radius;
716 
717  radius = damage+40;
718  if (is_quad)
719  damage *= 4;
720 
721  VectorSet(offset, 8, 8, ent->viewheight-8);
723  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
724 
725  VectorScale (forward, -2, ent->client->kick_origin);
726  ent->client->kick_angles[0] = -1;
727 
728  fire_grenade (ent, start, forward, damage, 600, 2.5, radius);
729 
731  gi.WriteShort (ent-g_edicts);
734 
735  ent->client->ps.gunframe++;
736 
737  PlayerNoise(ent, start, PNOISE_WEAPON);
738 
739  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
740  ent->client->pers.inventory[ent->client->ammo_index]--;
741 }
742 
744 {
745  static int pause_frames[] = {34, 51, 59, 0};
746  static int fire_frames[] = {6, 0};
747 
748  Weapon_Generic (ent, 5, 16, 59, 64, pause_frames, fire_frames, weapon_grenadelauncher_fire);
749 }
750 
751 /*
752 ======================================================================
753 
754 ROCKET
755 
756 ======================================================================
757 */
758 
760 {
761  vec3_t offset, start;
763  int damage;
764  float damage_radius;
765  int radius_damage;
766 
767  damage = 100 + (int)(random() * 20.0);
768  radius_damage = 120;
769  damage_radius = 120;
770  if (is_quad)
771  {
772  damage *= 4;
773  radius_damage *= 4;
774  }
775 
777 
778  VectorScale (forward, -2, ent->client->kick_origin);
779  ent->client->kick_angles[0] = -1;
780 
781  VectorSet(offset, 8, 8, ent->viewheight-8);
782  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
783  fire_rocket (ent, start, forward, damage, 650, damage_radius, radius_damage);
784 
785  // send muzzle flash
787  gi.WriteShort (ent-g_edicts);
790 
791  ent->client->ps.gunframe++;
792 
793  PlayerNoise(ent, start, PNOISE_WEAPON);
794 
795  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
796  ent->client->pers.inventory[ent->client->ammo_index]--;
797 }
798 
800 {
801  static int pause_frames[] = {25, 33, 42, 50, 0};
802  static int fire_frames[] = {5, 0};
803 
804  Weapon_Generic (ent, 4, 12, 50, 54, pause_frames, fire_frames, Weapon_RocketLauncher_Fire);
805 }
806 
807 
808 /*
809 ======================================================================
810 
811 BLASTER / HYPERBLASTER
812 
813 ======================================================================
814 */
815 
816 void Blaster_Fire (edict_t *ent, vec3_t g_offset, int damage, qboolean hyper, int effect)
817 {
819  vec3_t start;
820  vec3_t offset;
821 
822  if (is_quad)
823  damage *= 4;
825  VectorSet(offset, 24, 8, ent->viewheight-8);
826  VectorAdd (offset, g_offset, offset);
827  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
828 
829  VectorScale (forward, -2, ent->client->kick_origin);
830  ent->client->kick_angles[0] = -1;
831 
832  fire_blaster (ent, start, forward, damage, 1000, effect, hyper);
833 
834  // send muzzle flash
836  gi.WriteShort (ent-g_edicts);
837  if (hyper)
839  else
842 
843  PlayerNoise(ent, start, PNOISE_WEAPON);
844 }
845 
846 
848 {
849  int damage;
850 
851  if (deathmatch->value)
852  damage = 15;
853  else
854  damage = 10;
855  Blaster_Fire (ent, vec3_origin, damage, false, EF_BLASTER);
856  ent->client->ps.gunframe++;
857 }
858 
860 {
861  static int pause_frames[] = {19, 32, 0};
862  static int fire_frames[] = {5, 0};
863 
864  Weapon_Generic (ent, 4, 8, 52, 55, pause_frames, fire_frames, Weapon_Blaster_Fire);
865 }
866 
867 
869 {
870  float rotation;
871  vec3_t offset;
872  int effect;
873  int damage;
874 
875  ent->client->weapon_sound = gi.soundindex("weapons/hyprbl1a.wav");
876 
877  if (!(ent->client->buttons & BUTTON_ATTACK))
878  {
879  ent->client->ps.gunframe++;
880  }
881  else
882  {
883  if (! ent->client->pers.inventory[ent->client->ammo_index] )
884  {
885  if (level.time >= ent->pain_debounce_time)
886  {
887  gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
888  ent->pain_debounce_time = level.time + 1;
889  }
890  NoAmmoWeaponChange (ent);
891  }
892  else
893  {
894  rotation = (ent->client->ps.gunframe - 5) * 2*M_PI/6;
895  offset[0] = -4 * sin(rotation);
896  offset[1] = 0;
897  offset[2] = 4 * cos(rotation);
898 
899  if ((ent->client->ps.gunframe == 6) || (ent->client->ps.gunframe == 9))
900  effect = EF_HYPERBLASTER;
901  else
902  effect = 0;
903  if (deathmatch->value)
904  damage = 15;
905  else
906  damage = 20;
907  Blaster_Fire (ent, offset, damage, true, effect);
908  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
909  ent->client->pers.inventory[ent->client->ammo_index]--;
910 
912  if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
913  {
914  ent->s.frame = FRAME_crattak1 - 1;
916  }
917  else
918  {
919  ent->s.frame = FRAME_attack1 - 1;
920  ent->client->anim_end = FRAME_attack8;
921  }
922  }
923 
924  ent->client->ps.gunframe++;
925  if (ent->client->ps.gunframe == 12 && ent->client->pers.inventory[ent->client->ammo_index])
926  ent->client->ps.gunframe = 6;
927  }
928 
929  if (ent->client->ps.gunframe == 12)
930  {
931  gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0);
932  ent->client->weapon_sound = 0;
933  }
934 
935 }
936 
938 {
939  static int pause_frames[] = {0};
940  static int fire_frames[] = {6, 7, 8, 9, 10, 11, 0};
941 
942  Weapon_Generic (ent, 5, 20, 49, 53, pause_frames, fire_frames, Weapon_HyperBlaster_Fire);
943 }
944 
945 /*
946 ======================================================================
947 
948 MACHINEGUN / CHAINGUN
949 
950 ======================================================================
951 */
952 
954 {
955  int i;
956  vec3_t start;
958  vec3_t angles;
959  int damage = 8;
960  int kick = 2;
961  vec3_t offset;
962 
963  if (!(ent->client->buttons & BUTTON_ATTACK))
964  {
965  ent->client->machinegun_shots = 0;
966  ent->client->ps.gunframe++;
967  return;
968  }
969 
970  if (ent->client->ps.gunframe == 5)
971  ent->client->ps.gunframe = 4;
972  else
973  ent->client->ps.gunframe = 5;
974 
975  if (ent->client->pers.inventory[ent->client->ammo_index] < 1)
976  {
977  ent->client->ps.gunframe = 6;
978  if (level.time >= ent->pain_debounce_time)
979  {
980  gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
981  ent->pain_debounce_time = level.time + 1;
982  }
983  NoAmmoWeaponChange (ent);
984  return;
985  }
986 
987  if (is_quad)
988  {
989  damage *= 4;
990  kick *= 4;
991  }
992 
993  for (i=1 ; i<3 ; i++)
994  {
995  ent->client->kick_origin[i] = crandom() * 0.35;
996  ent->client->kick_angles[i] = crandom() * 0.7;
997  }
998  ent->client->kick_origin[0] = crandom() * 0.35;
999  ent->client->kick_angles[0] = ent->client->machinegun_shots * -1.5;
1000 
1001  // raise the gun as it is firing
1002  if (!deathmatch->value)
1003  {
1004  ent->client->machinegun_shots++;
1005  if (ent->client->machinegun_shots > 9)
1006  ent->client->machinegun_shots = 9;
1007  }
1008 
1009  // get start / end positions
1010  VectorAdd (ent->client->v_angle, ent->client->kick_angles, angles);
1011  AngleVectors (angles, forward, right, NULL);
1012  VectorSet(offset, 0, 8, ent->viewheight-8);
1013  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
1015 
1017  gi.WriteShort (ent-g_edicts);
1019  gi.multicast (ent->s.origin, MULTICAST_PVS);
1020 
1021  PlayerNoise(ent, start, PNOISE_WEAPON);
1022 
1023  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
1024  ent->client->pers.inventory[ent->client->ammo_index]--;
1025 
1027  if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
1028  {
1029  ent->s.frame = FRAME_crattak1 - (int) (random()+0.25);
1030  ent->client->anim_end = FRAME_crattak9;
1031  }
1032  else
1033  {
1034  ent->s.frame = FRAME_attack1 - (int) (random()+0.25);
1035  ent->client->anim_end = FRAME_attack8;
1036  }
1037 }
1038 
1040 {
1041  static int pause_frames[] = {23, 45, 0};
1042  static int fire_frames[] = {4, 5, 0};
1043 
1044  Weapon_Generic (ent, 3, 5, 45, 49, pause_frames, fire_frames, Machinegun_Fire);
1045 }
1046 
1048 {
1049  int i;
1050  int shots;
1051  vec3_t start;
1052  vec3_t forward, right, up;
1053  float r, u;
1054  vec3_t offset;
1055  int damage;
1056  int kick = 2;
1057 
1058  if (deathmatch->value)
1059  damage = 6;
1060  else
1061  damage = 8;
1062 
1063  if (ent->client->ps.gunframe == 5)
1064  gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/chngnu1a.wav"), 1, ATTN_IDLE, 0);
1065 
1066  if ((ent->client->ps.gunframe == 14) && !(ent->client->buttons & BUTTON_ATTACK))
1067  {
1068  ent->client->ps.gunframe = 32;
1069  ent->client->weapon_sound = 0;
1070  return;
1071  }
1072  else if ((ent->client->ps.gunframe == 21) && (ent->client->buttons & BUTTON_ATTACK)
1073  && ent->client->pers.inventory[ent->client->ammo_index])
1074  {
1075  ent->client->ps.gunframe = 15;
1076  }
1077  else
1078  {
1079  ent->client->ps.gunframe++;
1080  }
1081 
1082  if (ent->client->ps.gunframe == 22)
1083  {
1084  ent->client->weapon_sound = 0;
1085  gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/chngnd1a.wav"), 1, ATTN_IDLE, 0);
1086  }
1087  else
1088  {
1089  ent->client->weapon_sound = gi.soundindex("weapons/chngnl1a.wav");
1090  }
1091 
1093  if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
1094  {
1095  ent->s.frame = FRAME_crattak1 - (ent->client->ps.gunframe & 1);
1096  ent->client->anim_end = FRAME_crattak9;
1097  }
1098  else
1099  {
1100  ent->s.frame = FRAME_attack1 - (ent->client->ps.gunframe & 1);
1101  ent->client->anim_end = FRAME_attack8;
1102  }
1103 
1104  if (ent->client->ps.gunframe <= 9)
1105  shots = 1;
1106  else if (ent->client->ps.gunframe <= 14)
1107  {
1108  if (ent->client->buttons & BUTTON_ATTACK)
1109  shots = 2;
1110  else
1111  shots = 1;
1112  }
1113  else
1114  shots = 3;
1115 
1116  if (ent->client->pers.inventory[ent->client->ammo_index] < shots)
1117  shots = ent->client->pers.inventory[ent->client->ammo_index];
1118 
1119  if (!shots)
1120  {
1121  if (level.time >= ent->pain_debounce_time)
1122  {
1123  gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
1124  ent->pain_debounce_time = level.time + 1;
1125  }
1126  NoAmmoWeaponChange (ent);
1127  return;
1128  }
1129 
1130  if (is_quad)
1131  {
1132  damage *= 4;
1133  kick *= 4;
1134  }
1135 
1136  for (i=0 ; i<3 ; i++)
1137  {
1138  ent->client->kick_origin[i] = crandom() * 0.35;
1139  ent->client->kick_angles[i] = crandom() * 0.7;
1140  }
1141 
1142  for (i=0 ; i<shots ; i++)
1143  {
1144  // get start / end positions
1146  r = 7 + crandom()*4;
1147  u = crandom()*4;
1148  VectorSet(offset, 0, r, u + ent->viewheight-8);
1149  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
1150 
1152  }
1153 
1154  // send muzzle flash
1156  gi.WriteShort (ent-g_edicts);
1157  gi.WriteByte ((MZ_CHAINGUN1 + shots - 1) | is_silenced);
1158  gi.multicast (ent->s.origin, MULTICAST_PVS);
1159 
1160  PlayerNoise(ent, start, PNOISE_WEAPON);
1161 
1162  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
1163  ent->client->pers.inventory[ent->client->ammo_index] -= shots;
1164 }
1165 
1166 
1168 {
1169  static int pause_frames[] = {38, 43, 51, 61, 0};
1170  static int fire_frames[] = {5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0};
1171 
1172  Weapon_Generic (ent, 4, 31, 61, 64, pause_frames, fire_frames, Chaingun_Fire);
1173 }
1174 
1175 
1176 /*
1177 ======================================================================
1178 
1179 SHOTGUN / SUPERSHOTGUN
1180 
1181 ======================================================================
1182 */
1183 
1185 {
1186  vec3_t start;
1187  vec3_t forward, right;
1188  vec3_t offset;
1189  int damage = 4;
1190  int kick = 8;
1191 
1192  if (ent->client->ps.gunframe == 9)
1193  {
1194  ent->client->ps.gunframe++;
1195  return;
1196  }
1197 
1199 
1200  VectorScale (forward, -2, ent->client->kick_origin);
1201  ent->client->kick_angles[0] = -2;
1202 
1203  VectorSet(offset, 0, 8, ent->viewheight-8);
1204  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
1205 
1206  if (is_quad)
1207  {
1208  damage *= 4;
1209  kick *= 4;
1210  }
1211 
1212  if (deathmatch->value)
1213  fire_shotgun (ent, start, forward, damage, kick, 500, 500, DEFAULT_DEATHMATCH_SHOTGUN_COUNT, MOD_SHOTGUN);
1214  else
1215  fire_shotgun (ent, start, forward, damage, kick, 500, 500, DEFAULT_SHOTGUN_COUNT, MOD_SHOTGUN);
1216 
1217  // send muzzle flash
1219  gi.WriteShort (ent-g_edicts);
1221  gi.multicast (ent->s.origin, MULTICAST_PVS);
1222 
1223  ent->client->ps.gunframe++;
1224  PlayerNoise(ent, start, PNOISE_WEAPON);
1225 
1226  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
1227  ent->client->pers.inventory[ent->client->ammo_index]--;
1228 }
1229 
1231 {
1232  static int pause_frames[] = {22, 28, 34, 0};
1233  static int fire_frames[] = {8, 9, 0};
1234 
1235  Weapon_Generic (ent, 7, 18, 36, 39, pause_frames, fire_frames, weapon_shotgun_fire);
1236 }
1237 
1238 
1240 {
1241  vec3_t start;
1242  vec3_t forward, right;
1243  vec3_t offset;
1244  vec3_t v;
1245  int damage = 6;
1246  int kick = 12;
1247 
1249 
1250  VectorScale (forward, -2, ent->client->kick_origin);
1251  ent->client->kick_angles[0] = -2;
1252 
1253  VectorSet(offset, 0, 8, ent->viewheight-8);
1254  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
1255 
1256  if (is_quad)
1257  {
1258  damage *= 4;
1259  kick *= 4;
1260  }
1261 
1262  v[PITCH] = ent->client->v_angle[PITCH];
1263  v[YAW] = ent->client->v_angle[YAW] - 5;
1264  v[ROLL] = ent->client->v_angle[ROLL];
1267  v[YAW] = ent->client->v_angle[YAW] + 5;
1270 
1271  // send muzzle flash
1273  gi.WriteShort (ent-g_edicts);
1275  gi.multicast (ent->s.origin, MULTICAST_PVS);
1276 
1277  ent->client->ps.gunframe++;
1278  PlayerNoise(ent, start, PNOISE_WEAPON);
1279 
1280  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
1281  ent->client->pers.inventory[ent->client->ammo_index] -= 2;
1282 }
1283 
1285 {
1286  static int pause_frames[] = {29, 42, 57, 0};
1287  static int fire_frames[] = {7, 0};
1288 
1289  Weapon_Generic (ent, 6, 17, 57, 61, pause_frames, fire_frames, weapon_supershotgun_fire);
1290 }
1291 
1292 
1293 
1294 /*
1295 ======================================================================
1296 
1297 RAILGUN
1298 
1299 ======================================================================
1300 */
1301 
1303 {
1304  vec3_t start;
1305  vec3_t forward, right;
1306  vec3_t offset;
1307  int damage;
1308  int kick;
1309 
1310  if (deathmatch->value)
1311  { // normal damage is too extreme in dm
1312  damage = 100;
1313  kick = 200;
1314  }
1315  else
1316  {
1317  damage = 150;
1318  kick = 250;
1319  }
1320 
1321  if (is_quad)
1322  {
1323  damage *= 4;
1324  kick *= 4;
1325  }
1326 
1328 
1329  VectorScale (forward, -3, ent->client->kick_origin);
1330  ent->client->kick_angles[0] = -3;
1331 
1332  VectorSet(offset, 0, 7, ent->viewheight-8);
1333  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
1334  fire_rail (ent, start, forward, damage, kick);
1335 
1336  // send muzzle flash
1338  gi.WriteShort (ent-g_edicts);
1340  gi.multicast (ent->s.origin, MULTICAST_PVS);
1341 
1342  ent->client->ps.gunframe++;
1343  PlayerNoise(ent, start, PNOISE_WEAPON);
1344 
1345  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
1346  ent->client->pers.inventory[ent->client->ammo_index]--;
1347 }
1348 
1349 
1351 {
1352  static int pause_frames[] = {56, 0};
1353  static int fire_frames[] = {4, 0};
1354 
1355  Weapon_Generic (ent, 3, 18, 56, 61, pause_frames, fire_frames, weapon_railgun_fire);
1356 }
1357 
1358 
1359 /*
1360 ======================================================================
1361 
1362 BFG10K
1363 
1364 ======================================================================
1365 */
1366 
1368 {
1369  vec3_t offset, start;
1370  vec3_t forward, right;
1371  int damage;
1372  float damage_radius = 1000;
1373 
1374  if (deathmatch->value)
1375  damage = 200;
1376  else
1377  damage = 500;
1378 
1379  if (ent->client->ps.gunframe == 9)
1380  {
1381  // send muzzle flash
1383  gi.WriteShort (ent-g_edicts);
1385  gi.multicast (ent->s.origin, MULTICAST_PVS);
1386 
1387  ent->client->ps.gunframe++;
1388 
1389  PlayerNoise(ent, start, PNOISE_WEAPON);
1390  return;
1391  }
1392 
1393  // cells can go down during windup (from power armor hits), so
1394  // check again and abort firing if we don't have enough now
1395  if (ent->client->pers.inventory[ent->client->ammo_index] < 50)
1396  {
1397  ent->client->ps.gunframe++;
1398  return;
1399  }
1400 
1401  if (is_quad)
1402  damage *= 4;
1403 
1405 
1406  VectorScale (forward, -2, ent->client->kick_origin);
1407 
1408  // make a big pitch kick with an inverse fall
1409  ent->client->v_dmg_pitch = -40;
1410  ent->client->v_dmg_roll = crandom()*8;
1411  ent->client->v_dmg_time = level.time + DAMAGE_TIME;
1412 
1413  VectorSet(offset, 8, 8, ent->viewheight-8);
1414  P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
1415  fire_bfg (ent, start, forward, damage, 400, damage_radius);
1416 
1417  ent->client->ps.gunframe++;
1418 
1419  PlayerNoise(ent, start, PNOISE_WEAPON);
1420 
1421  if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
1422  ent->client->pers.inventory[ent->client->ammo_index] -= 50;
1423 }
1424 
1425 void Weapon_BFG (edict_t *ent)
1426 {
1427  static int pause_frames[] = {39, 45, 50, 55, 0};
1428  static int fire_frames[] = {9, 17, 0};
1429 
1430  Weapon_Generic (ent, 8, 32, 55, 58, pause_frames, fire_frames, weapon_bfg_fire);
1431 }
1432 
1433 
1434 //======================================================================
FindItem
gitem_t * FindItem(char *pickup_name)
Definition: g_items.c:100
edict_s::mynoise2
edict_t * mynoise2
Definition: g_local.h:1079
gi
game_import_t gi
Definition: g_main.c:25
IT_AMMO
#define IT_AMMO
Definition: g_local.h:215
G_ProjectSource
void G_ProjectSource(vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
Definition: g_utils.c:25
edict_s::s
entity_state_t s
Definition: g_local.h:964
deathmatch
cvar_t * deathmatch
Definition: g_main.c:35
gclient_s::v_dmg_roll
float v_dmg_roll
Definition: g_local.h:916
YAW
#define YAW
Definition: q_shared.h:66
player_state_t::gunframe
int gunframe
Definition: q_shared.h:1212
gclient_s::v_angle
vec3_t v_angle
Definition: g_local.h:921
FRAME_pain301
#define FRAME_pain301
Definition: m_actor.h:104
DF_WEAPONS_STAY
#define DF_WEAPONS_STAY
Definition: q_shared.h:1050
G_Spawn
edict_t * G_Spawn(void)
Definition: g_utils.c:420
MZ_SILENCED
#define MZ_SILENCED
Definition: q_shared.h:676
MZ_GRENADE
#define MZ_GRENADE
Definition: q_shared.h:664
DEFAULT_BULLET_HSPREAD
#define DEFAULT_BULLET_HSPREAD
Definition: g_local.h:664
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
gclient_s::v_dmg_time
float v_dmg_time
Definition: g_local.h:916
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:156
CHAN_ITEM
#define CHAN_ITEM
Definition: q_shared.h:1010
P_ProjectSource
static void P_ProjectSource(gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
Definition: p_weapon.c:33
FRAME_crpain1
#define FRAME_crpain1
Definition: m_player.h:193
gclient_s::kick_origin
vec3_t kick_origin
Definition: g_local.h:915
svc_muzzleflash
@ svc_muzzleflash
Definition: qcommon.h:208
gclient_s::grenade_blew_up
qboolean grenade_blew_up
Definition: g_local.h:944
entity_state_s::frame
int frame
Definition: q_shared.h:1178
FRAME_attack1
#define FRAME_attack1
Definition: m_boss2.h:94
edict_s::absmax
vec3_t absmax
Definition: g_local.h:985
WEAPON_DROPPING
@ WEAPON_DROPPING
Definition: g_local.h:95
game_import_t::multicast
void(* multicast)(vec3_t origin, multicast_t to)
Definition: game.h:144
m_player.h
Think_Weapon
void Think_Weapon(edict_t *ent)
Definition: p_weapon.c:282
FRAME_crattak3
#define FRAME_crattak3
Definition: m_player.h:186
weapon_supershotgun_fire
void weapon_supershotgun_fire(edict_t *ent)
Definition: p_weapon.c:1239
PNOISE_WEAPON
#define PNOISE_WEAPON
Definition: g_local.h:181
FRAME_crattak1
#define FRAME_crattak1
Definition: m_player.h:184
gclient_s::anim_end
int anim_end
Definition: g_local.h:933
MOD_CHAINGUN
#define MOD_CHAINGUN
Definition: g_local.h:468
WEAPON_READY
@ WEAPON_READY
Definition: g_local.h:93
Add_Ammo
qboolean Add_Ammo(edict_t *ent, gitem_t *item, int count)
Definition: g_items.c:447
v
GLdouble v
Definition: qgl_win.c:143
gclient_s::buttons
int buttons
Definition: g_local.h:895
fire_rail
void fire_rail(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick)
Definition: g_weapon.c:658
Weapon_HyperBlaster
void Weapon_HyperBlaster(edict_t *ent)
Definition: p_weapon.c:937
Drop_Weapon
void Drop_Weapon(edict_t *ent, gitem_t *item)
Definition: p_weapon.c:349
entity_state_s::origin
vec3_t origin
Definition: q_shared.h:1173
SVF_NOCLIENT
#define SVF_NOCLIENT
Definition: game.h:27
FRAME_wave01
#define FRAME_wave01
Definition: m_actor.h:286
MZ_MACHINEGUN
#define MZ_MACHINEGUN
Definition: q_shared.h:657
fire_rocket
void fire_rocket(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage)
Definition: g_weapon.c:620
FRAME_pain304
#define FRAME_pain304
Definition: m_boss31.h:114
Blaster_Fire
void Blaster_Fire(edict_t *ent, vec3_t g_offset, int damage, qboolean hyper, int effect)
Definition: p_weapon.c:816
ITEM_INDEX
#define ITEM_INDEX(x)
Definition: g_local.h:610
MZ_CHAINGUN1
#define MZ_CHAINGUN1
Definition: q_shared.h:659
weapon_grenade_fire
void weapon_grenade_fire(edict_t *ent, qboolean held)
Definition: p_weapon.c:546
VectorScale
void VectorScale(vec3_t in, vec_t scale, vec3_t out)
Definition: q_shared.c:782
qboolean
qboolean
Definition: q_shared.h:56
NoAmmoWeaponChange
void NoAmmoWeaponChange(edict_t *ent)
Definition: p_weapon.c:234
fire_bfg
void fire_bfg(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius)
Definition: g_weapon.c:883
i
int i
Definition: q_shared.c:305
DF_INFINITE_AMMO
#define DF_INFINITE_AMMO
Definition: q_shared.h:1061
GRENADE_MINSPEED
#define GRENADE_MINSPEED
Definition: p_weapon.c:543
MZ_HYPERBLASTER
#define MZ_HYPERBLASTER
Definition: q_shared.h:670
Pickup_Weapon
qboolean Pickup_Weapon(edict_t *ent, edict_t *other)
Definition: p_weapon.c:118
edict_s::client
struct gclient_s * client
Definition: g_local.h:965
gclient_s::kick_angles
vec3_t kick_angles
Definition: g_local.h:914
Weapon_Chaingun
void Weapon_Chaingun(edict_t *ent)
Definition: p_weapon.c:1167
game_import_t::sound
void(* sound)(edict_t *ent, int channel, int soundindex, float volume, float attenuation, float timeofs)
Definition: game.h:109
PITCH
#define PITCH
Definition: q_shared.h:65
ATTN_IDLE
#define ATTN_IDLE
Definition: q_shared.h:1020
DEFAULT_SHOTGUN_COUNT
#define DEFAULT_SHOTGUN_COUNT
Definition: g_local.h:669
gclient_s::grenade_time
float grenade_time
Definition: g_local.h:945
FRAME_FIRE_FIRST
#define FRAME_FIRE_FIRST
Definition: p_weapon.c:376
fire_grenade
void fire_grenade(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius)
Definition: g_weapon.c:486
GRENADE_TIMER
#define GRENADE_TIMER
Definition: p_weapon.c:542
WEAPON_ACTIVATING
@ WEAPON_ACTIVATING
Definition: g_local.h:94
Weapon_HyperBlaster_Fire
void Weapon_HyperBlaster_Fire(edict_t *ent)
Definition: p_weapon.c:868
fire_grenade2
void fire_grenade2(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius, qboolean held)
Definition: g_weapon.c:519
edict_s::mins
vec3_t mins
Definition: g_local.h:984
M_PI
#define M_PI
Definition: q_shared.h:135
type
GLenum type
Definition: qgl_win.c:72
g_edicts
edict_t * g_edicts
Definition: g_main.c:33
ATTN_NORM
#define ATTN_NORM
Definition: q_shared.h:1019
FRAME_IDLE_FIRST
#define FRAME_IDLE_FIRST
Definition: p_weapon.c:377
BUTTON_ATTACK
#define BUTTON_ATTACK
Definition: q_shared.h:507
client_persistant_t::inventory
int inventory[MAX_ITEMS]
Definition: g_local.h:842
weapon_railgun_fire
void weapon_railgun_fire(edict_t *ent)
Definition: p_weapon.c:1302
gclient_s::pers
client_persistant_t pers
Definition: g_local.h:884
ANIM_PAIN
#define ANIM_PAIN
Definition: g_local.h:820
ANIM_REVERSE
#define ANIM_REVERSE
Definition: g_local.h:823
gclient_s::newweapon
gitem_t * newweapon
Definition: g_local.h:901
CHAN_AUTO
#define CHAN_AUTO
Definition: q_shared.h:1007
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: q_shared.c:93
edict_s::svflags
int svflags
Definition: g_local.h:983
CHAN_VOICE
#define CHAN_VOICE
Definition: q_shared.h:1009
edict_s::item
gitem_t * item
Definition: g_local.h:1104
DEFAULT_BULLET_VSPREAD
#define DEFAULT_BULLET_VSPREAD
Definition: g_local.h:665
edict_s::classname
char * classname
Definition: g_local.h:1005
edict_s::speed
float speed
Definition: g_local.h:1020
edict_s
Definition: g_local.h:962
DAMAGE_TIME
#define DAMAGE_TIME
Definition: g_local.h:44
Chaingun_Fire
void Chaingun_Fire(edict_t *ent)
Definition: p_weapon.c:1047
FL_RESPAWN
#define FL_RESPAWN
Definition: g_local.h:70
r
GLdouble GLdouble r
Definition: qgl_win.c:336
client_persistant_t::weapon
gitem_t * weapon
Definition: g_local.h:852
edict_s::mynoise
edict_t * mynoise
Definition: g_local.h:1078
gitem_s::ammo
char * ammo
Definition: g_local.h:252
edict_s::viewheight
int viewheight
Definition: g_local.h:1061
ROLL
#define ROLL
Definition: q_shared.h:67
DROPPED_PLAYER_ITEM
#define DROPPED_PLAYER_ITEM
Definition: g_local.h:558
MZ_SHOTGUN
#define MZ_SHOTGUN
Definition: q_shared.h:658
game_import_t::soundindex
int(* soundindex)(char *name)
Definition: game.h:122
forward
static vec3_t forward
Definition: p_view.c:29
PlayerNoise
void PlayerNoise(edict_t *who, vec3_t where, int type)
Definition: p_weapon.c:58
edict_s::spawnflags
int spawnflags
Definition: g_local.h:1006
EF_BLASTER
#define EF_BLASTER
Definition: q_shared.h:560
crandom
#define crandom()
Definition: g_local.h:510
player_state_t::pmove
pmove_state_t pmove
Definition: q_shared.h:1200
MOD_MACHINEGUN
#define MOD_MACHINEGUN
Definition: g_local.h:467
edict_s::owner
edict_t * owner
Definition: g_local.h:988
game_import_t::modelindex
int(* modelindex)(char *name)
Definition: game.h:121
edict_s::deadflag
int deadflag
Definition: g_local.h:1054
MZ_RAILGUN
#define MZ_RAILGUN
Definition: q_shared.h:662
cvar_s::value
float value
Definition: q_shared.h:324
PRINT_HIGH
#define PRINT_HIGH
Definition: q_shared.h:92
random
#define random()
Definition: g_local.h:509
WEAPON_FIRING
@ WEAPON_FIRING
Definition: g_local.h:96
Weapon_Grenade
void Weapon_Grenade(edict_t *ent)
Definition: p_weapon.c:595
FL_NOTARGET
#define FL_NOTARGET
Definition: g_local.h:62
gitem_s::pickup_name
char * pickup_name
Definition: g_local.h:248
gclient_s::ps
player_state_t ps
Definition: g_local.h:880
NULL
#define NULL
Definition: q_shared.h:60
weapon_shotgun_fire
void weapon_shotgun_fire(edict_t *ent)
Definition: p_weapon.c:1184
gclient_s::weaponstate
weaponstate_t weaponstate
Definition: g_local.h:913
SetRespawn
void SetRespawn(edict_t *ent, float delay)
Definition: g_items.c:146
is_silenced
static byte is_silenced
Definition: p_weapon.c:27
MOD_SHOTGUN
#define MOD_SHOTGUN
Definition: g_local.h:465
FRAME_wave08
#define FRAME_wave08
Definition: m_actor.h:293
FRAME_DEACTIVATE_FIRST
#define FRAME_DEACTIVATE_FIRST
Definition: p_weapon.c:378
gclient_s::machinegun_shots
int machinegun_shots
Definition: g_local.h:930
FRAME_attack8
#define FRAME_attack8
Definition: m_boss2.h:101
Weapon_Machinegun
void Weapon_Machinegun(edict_t *ent)
Definition: p_weapon.c:1039
GRENADE_MAXSPEED
#define GRENADE_MAXSPEED
Definition: p_weapon.c:544
gitem_s::quantity
int quantity
Definition: g_local.h:251
MZ_BFG
#define MZ_BFG
Definition: q_shared.h:668
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:157
Weapon_RocketLauncher_Fire
void Weapon_RocketLauncher_Fire(edict_t *ent)
Definition: p_weapon.c:759
game_import_t::WriteShort
void(* WriteShort)(int c)
Definition: game.h:148
gclient_s::quad_framenum
float quad_framenum
Definition: g_local.h:939
fire_bullet
void fire_bullet(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int mod)
Definition: g_weapon.c:277
entity_state_s::skinnum
int skinnum
Definition: q_shared.h:1179
DROPPED_ITEM
#define DROPPED_ITEM
Definition: g_local.h:557
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:158
coop
cvar_t * coop
Definition: g_main.c:36
edict_s::pain_debounce_time
float pain_debounce_time
Definition: g_local.h:1046
LEFT_HANDED
#define LEFT_HANDED
Definition: g_local.h:163
ANIM_ATTACK
#define ANIM_ATTACK
Definition: g_local.h:821
client_persistant_t::lastweapon
gitem_t * lastweapon
Definition: g_local.h:853
FRAME_crattak9
#define FRAME_crattak9
Definition: m_player.h:192
DEFAULT_DEATHMATCH_SHOTGUN_COUNT
#define DEFAULT_DEATHMATCH_SHOTGUN_COUNT
Definition: g_local.h:668
g_select_empty
cvar_t * g_select_empty
Definition: g_main.c:47
game_import_t::cprintf
void(* cprintf)(edict_t *ent, int printlevel, char *fmt,...)
Definition: game.h:107
vec3_origin
vec3_t vec3_origin
Definition: q_shared.c:24
up
static vec3_t up
Definition: p_view.c:29
PNOISE_SELF
#define PNOISE_SELF
Definition: g_local.h:180
CHAN_WEAPON
#define CHAN_WEAPON
Definition: q_shared.h:1008
Use_Weapon
void Use_Weapon(edict_t *ent, gitem_t *item)
Definition: p_weapon.c:311
game_import_t::WriteByte
void(* WriteByte)(int c)
Definition: game.h:147
DEFAULT_SHOTGUN_HSPREAD
#define DEFAULT_SHOTGUN_HSPREAD
Definition: g_local.h:666
gitem_s::weapmodel
int weapmodel
Definition: g_local.h:255
level
GLint level
Definition: qgl_win.c:116
gitem_s::weaponthink
void(* weaponthink)(struct edict_s *ent)
Definition: g_local.h:240
ChangeWeapon
void ChangeWeapon(edict_t *ent)
Definition: p_weapon.c:174
edict_s::flags
int flags
Definition: g_local.h:996
CENTER_HANDED
#define CENTER_HANDED
Definition: g_local.h:164
MZ_ROCKET
#define MZ_ROCKET
Definition: q_shared.h:663
Drop_Item
edict_t * Drop_Item(edict_t *ent, gitem_t *item)
Definition: g_items.c:843
Weapon_RocketLauncher
void Weapon_RocketLauncher(edict_t *ent)
Definition: p_weapon.c:799
weapon_grenadelauncher_fire
void weapon_grenadelauncher_fire(edict_t *ent)
Definition: p_weapon.c:709
Weapon_Blaster_Fire
void Weapon_Blaster_Fire(edict_t *ent)
Definition: p_weapon.c:847
FRAME_crpain4
#define FRAME_crpain4
Definition: m_player.h:196
edict_s::teleport_time
float teleport_time
Definition: g_local.h:1091
edict_s::maxs
vec3_t maxs
Definition: g_local.h:984
gclient_s::ammo_index
int ammo_index
Definition: g_local.h:893
gclient_s::v_dmg_pitch
float v_dmg_pitch
Definition: g_local.h:916
DEFAULT_SHOTGUN_VSPREAD
#define DEFAULT_SHOTGUN_VSPREAD
Definition: g_local.h:667
PMF_DUCKED
#define PMF_DUCKED
Definition: q_shared.h:477
entity_state_s::modelindex
int modelindex
Definition: q_shared.h:1176
is_quad
static qboolean is_quad
Definition: p_weapon.c:26
Weapon_SuperShotgun
void Weapon_SuperShotgun(edict_t *ent)
Definition: p_weapon.c:1284
fire_blaster
void fire_blaster(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int effect, qboolean hyper)
Definition: g_weapon.c:345
VectorSet
#define VectorSet(v, x, y, z)
Definition: q_shared.h:161
Weapon_Generic
void Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void(*fire)(edict_t *ent))
Definition: p_weapon.c:380
right
GLdouble right
Definition: qgl_win.c:159
dmflags
cvar_t * dmflags
Definition: g_main.c:37
client_persistant_t::hand
int hand
Definition: g_local.h:831
weapon_bfg_fire
void weapon_bfg_fire(edict_t *ent)
Definition: p_weapon.c:1367
gitem_s::view_model
char * view_model
Definition: g_local.h:244
fire_shotgun
void fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int mod)
Definition: g_weapon.c:290
Weapon_Shotgun
void Weapon_Shotgun(edict_t *ent)
Definition: p_weapon.c:1230
Weapon_BFG
void Weapon_BFG(edict_t *ent)
Definition: p_weapon.c:1425
gclient_s
Definition: g_local.h:877
Weapon_Blaster
void Weapon_Blaster(edict_t *ent)
Definition: p_weapon.c:859
game_import_t::linkentity
void(* linkentity)(edict_t *ent)
Definition: game.h:138
DEFAULT_SSHOTGUN_COUNT
#define DEFAULT_SSHOTGUN_COUNT
Definition: g_local.h:670
player_state_t::gunindex
int gunindex
Definition: q_shared.h:1211
gclient_s::latched_buttons
int latched_buttons
Definition: g_local.h:897
EF_HYPERBLASTER
#define EF_HYPERBLASTER
Definition: q_shared.h:563
Weapon_Railgun
void Weapon_Railgun(edict_t *ent)
Definition: p_weapon.c:1350
pmove_state_t::pm_flags
byte pm_flags
Definition: q_shared.h:496
gclient_s::weapon_sound
int weapon_sound
Definition: g_local.h:947
gitem_s::flags
int flags
Definition: g_local.h:253
gclient_s::anim_priority
int anim_priority
Definition: g_local.h:934
MULTICAST_PVS
@ MULTICAST_PVS
Definition: q_shared.h:111
Machinegun_Fire
void Machinegun_Fire(edict_t *ent)
Definition: p_weapon.c:953
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:127
edict_s::absmin
vec3_t absmin
Definition: g_local.h:985
Weapon_GrenadeLauncher
void Weapon_GrenadeLauncher(edict_t *ent)
Definition: p_weapon.c:743
MZ_SSHOTGUN
#define MZ_SSHOTGUN
Definition: q_shared.h:669
MOD_SSHOTGUN
#define MOD_SSHOTGUN
Definition: g_local.h:466
g_local.h
edict_s::health
int health
Definition: g_local.h:1051
gclient_s::silencer_shots
int silencer_shots
Definition: g_local.h:946
gitem_s
Definition: g_local.h:234
MZ_BLASTER
#define MZ_BLASTER
Definition: q_shared.h:656