1 void W_UpdateAmmo (void)
3 self.items = self.items - (self.items & (IT_NAILS | IT_SHELLS | IT_ROCKETS | IT_CELLS));
5 if (self.weapon == IT_LASER)
7 else if (self.weapon == IT_UZI)
9 self.currentammo = self.ammo_nails;
10 self.items = self.items | IT_NAILS;
12 else if (self.weapon == IT_SHOTGUN)
14 self.currentammo = self.ammo_shells;
15 self.items = self.items | IT_SHELLS;
17 else if (self.weapon == IT_GRENADE_LAUNCHER || self.weapon == IT_HAGAR || self.weapon == IT_ROCKET_LAUNCHER)
19 self.currentammo = self.ammo_rockets;
20 self.items = self.items | IT_ROCKETS;
22 else if (self.weapon == IT_ELECTRO || self.weapon == IT_NEX || self.weapon == IT_CRYLINK)
24 self.currentammo = self.ammo_cells;
25 self.items = self.items | IT_CELLS;
29 void W_UpdateWeapon (void)
31 if (self.weapon == IT_LASER)
32 self.weaponmodel = "models/weapons/w_lazer.zym";
33 else if (self.weapon == IT_UZI)
34 self.weaponmodel = "models/weapons/w_uzi.md3";
35 else if (self.weapon == IT_SHOTGUN)
36 self.weaponmodel = "models/weapons/w_shotgun.md3";
37 else if (self.weapon == IT_GRENADE_LAUNCHER)
38 self.weaponmodel = "models/weapons/w_gl.md3";
39 else if (self.weapon == IT_ELECTRO)
40 self.weaponmodel = "models/weapons/w_electro.md3";
41 else if (self.weapon == IT_CRYLINK)
42 self.weaponmodel = "models/weapons/w_crylink.md3";
43 else if (self.weapon == IT_NEX)
44 self.weaponmodel = "models/weapons/w_nex.md3";
45 else if (self.weapon == IT_HAGAR)
46 self.weaponmodel = "models/weapons/w_hagar.md3";
47 else if (self.weapon == IT_ROCKET_LAUNCHER)
48 self.weaponmodel = "models/weapons/w_rl.md3";
50 objerror ("Illegal weapon - please register your guns please!");
53 float W_GetBestWeapon (void)
55 if ((self.items & IT_ROCKET_LAUNCHER) && self.ammo_rockets)
56 return IT_ROCKET_LAUNCHER;
57 else if ((self.items & IT_HAGAR) && self.ammo_rockets)
59 else if ((self.items & IT_NEX) && self.ammo_cells)
61 else if ((self.items & IT_CRYLINK) && self.ammo_cells)
63 else if ((self.items & IT_ELECTRO) && self.ammo_cells)
65 else if ((self.items & IT_GRENADE_LAUNCHER) && self.ammo_rockets)
66 return IT_GRENADE_LAUNCHER;
67 else if ((self.items & IT_SHOTGUN) && self.ammo_shells)
69 else if ((self.items & IT_UZI) && self.ammo_nails)
75 void W_GiveWeapon (entity e, float wep) // FIXME - make it 'smarter'
84 e.items = e.items | wep;
97 void W_SwitchWeapon (float wep)
100 var float noammo = FALSE;
107 if (!self.ammo_nails)
112 nextwep = IT_SHOTGUN;
113 if (!self.ammo_shells)
118 nextwep = IT_GRENADE_LAUNCHER;
119 if (!self.ammo_rockets)
124 nextwep = IT_ELECTRO;
125 if (!self.ammo_cells)
130 nextwep = IT_CRYLINK;
131 if (!self.ammo_cells)
137 if (!self.ammo_cells)
143 if (!self.ammo_rockets)
148 nextwep = IT_ROCKET_LAUNCHER;
149 if (!self.ammo_rockets)
154 if (!(self.items & nextwep))
156 sprint (self, "You don't own that weapon\n");
161 sprint (self, "You don't have any ammo for that weapon\n");
165 self.weapon = nextwep;
168 self.attack_finished = time + 0.2;
169 if (self.viewzoom != 1)
173 void W_NextWeapon (void)
181 if (self.weapon == IT_CRYLINK)
182 self.weapon = IT_LASER;
183 else if (self.weapon == IT_LASER)
185 self.weapon = IT_UZI;
186 if (!self.ammo_nails)
189 else if (self.weapon == IT_UZI)
191 self.weapon = IT_SHOTGUN;
192 if (!self.ammo_shells)
195 else if (self.weapon == IT_SHOTGUN)
197 self.weapon = IT_GRENADE_LAUNCHER;
198 if (!self.ammo_rockets)
201 else if (self.weapon == IT_GRENADE_LAUNCHER)
203 self.weapon = IT_ELECTRO;
204 if (!self.ammo_cells)
207 else if (self.weapon == IT_ELECTRO)
209 self.weapon = IT_CRYLINK;
210 if (!self.ammo_cells)
213 else if (self.weapon == IT_CRYLINK)
215 self.weapon = IT_NEX;
216 if (!self.ammo_cells)
219 else if (self.weapon == IT_NEX)
221 self.weapon = IT_HAGAR;
222 if (!self.ammo_rockets)
225 else if (self.weapon == IT_HAGAR)
227 self.weapon = IT_ROCKET_LAUNCHER;
228 if (!self.ammo_rockets)
232 if ((self.items & self.weapon) && !noammo)
241 void W_PreviousWeapon (void)
249 if (self.weapon == IT_UZI)
250 self.weapon = IT_LASER;
251 else if (self.weapon == IT_SHOTGUN)
253 self.weapon = IT_UZI;
254 if (!self.ammo_nails)
257 else if (self.weapon == IT_GRENADE_LAUNCHER)
259 self.weapon = IT_SHOTGUN;
260 if (!self.ammo_shells)
263 else if (self.weapon == IT_ELECTRO)
265 self.weapon = IT_GRENADE_LAUNCHER;
266 if (!self.ammo_rockets)
269 else if (self.weapon == IT_CRYLINK)
271 self.weapon = IT_ELECTRO;
272 if (!self.ammo_cells)
275 else if (self.weapon == IT_NEX)
277 self.weapon = IT_CRYLINK;
278 if (!self.ammo_cells)
281 else if (self.weapon == IT_HAGAR)
283 self.weapon = IT_NEX;
284 if (!self.ammo_cells)
287 else if (self.weapon == IT_ROCKET_LAUNCHER)
289 self.weapon = IT_HAGAR;
290 if (!self.ammo_rockets)
293 else if (self.weapon == IT_LASER)
295 self.weapon = IT_ROCKET_LAUNCHER;
296 if (!self.ammo_rockets)
300 if ((self.items & self.weapon) && !noammo)
309 float W_CheckAmmo (void)
312 if (self.weapon == IT_LASER)
314 else if (self.currentammo)
317 self.weapon = W_GetBestWeapon ();
323 void(vector src, float bdamage, vector dir) FireRailgunBullet =
325 local vector v, lastpos;
326 local entity saveself, last;
336 traceline (lastpos + dir * 2, lastpos + dir*8192, FALSE, last);
338 lastpos = trace_endpos;
339 if (trace_fraction != 1.0)
341 if (pointcontents(trace_endpos - dir*4) == CONTENT_SKY)
344 if (trace_ent.takedamage)
346 Damage (self, trace_endpos, trace_ent, 0, bdamage);
349 if (last.solid == SOLID_BSP)
354 void fireBullet (vector dir, float spread, float damage, float dtype)
358 makevectors (self.v_angle);
360 // use traceline_hitcorpse to make sure it can hit gibs and corpses too
361 org = self.origin + self.view_ofs;
362 traceline_hitcorpse (self, org, org + v_forward * 4096 + v_right * crandom () * spread + v_up * crandom () * spread, FALSE, self);
364 // FIXME - causes excessive 'tinking'. Hopefully remove "tink1.wav" from the ricochets with csqc
365 if ((trace_fraction != 1.0) && (trace_ent != self) && (pointcontents (trace_endpos) != CONTENT_SKY))
367 if (trace_ent == world)
368 te_spike (trace_endpos);
369 else if (trace_ent.classname == "player" || trace_ent.classname == "corpse" || trace_ent.classname == "gib")
371 Damage (self, trace_endpos, trace_ent, 0, damage);
373 sound (trace_ent, CHAN_IMPACT, "misc/BodyImpact1.wav", 1, ATTN_NORM);
375 sound (trace_ent, CHAN_IMPACT, "misc/BodyImpact2.wav", 1, ATTN_NORM);
380 void W_Laser_Touch (void)
384 if (other == self.owner)
386 else if (pointcontents (self.origin) == CONTENT_SKY)
392 dir = normalize (self.owner.origin - self.origin);
394 sound (self, CHAN_BODY, "weapons/NexImpact.wav", 1, ATTN_NORM);
396 WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
397 WriteByte (MSG_BROADCAST, 79);
398 WriteCoord (MSG_BROADCAST, self.origin_x);
399 WriteCoord (MSG_BROADCAST, self.origin_y);
400 WriteCoord (MSG_BROADCAST, self.origin_z);
401 WriteCoord (MSG_BROADCAST, dir_x);
402 WriteCoord (MSG_BROADCAST, dir_y);
403 WriteCoord (MSG_BROADCAST, dir_z);
404 WriteByte (MSG_BROADCAST, 155);
409 void W_Laser_Attack (void)
413 sound (self, CHAN_WEAPON, "weapons/Electro_fire.wav", 1, ATTN_NORM);
416 missile.owner = self;
417 missile.classname = "laser";
419 missile.movetype = MOVETYPE_FLY;
420 missile.solid = SOLID_BBOX;
422 setmodel (missile, "models/bullet.mdl");
423 setsize (missile, '-4 -4 -4', '4 4 4');
424 setorigin (missile, self.origin + self.view_ofs);
426 makevectors (self.v_angle);
427 missile.velocity = v_forward * 2000;
428 missile.angles = vectoangles (missile.velocity);
429 missile.glow_color = 250; // 244, 250
430 missile.glow_size = 1020;
431 missile.glow_trail = 1; // ??? 256
432 missile.touch = W_Laser_Touch;
433 missile.think = SUB_Remove;
434 missile.nextthink = time + 2;
436 self.punchangle_x = random () - 0.5;
437 self.punchangle_y = random () - 0.5;
438 self.punchangle_z = random () - 0.5;
440 self.attack_finished = time + 0.3;
443 void W_Laser_Attack2 (void)
448 void W_Uzi_Attack (void)
450 sound (self, CHAN_WEAPON, "weapons/Uzi_Fire.wav", 1, ATTN_NORM);
452 fireBullet (v_forward, 300, 8, IT_SHOTGUN);
454 self.punchangle_x = random () * -2;
455 self.punchangle_y = crandom () * 0.5;
456 self.punchangle_z = crandom () * 0.5;
458 self.attack_finished = time + 0.075;
459 self.ammo_nails = self.ammo_nails - 1;
461 vector org; // casing code
462 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 1) + (v_forward * 20);
463 SpawnCasing (org, v_forward, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 + 10) * v_up), 2);
465 self.effects = self.effects | EF_MUZZLEFLASH;
468 void W_Uzi_Attack2 (void)
470 sound (self, CHAN_WEAPON, "weapons/Uzi_Fire.wav", 1, ATTN_NORM);
472 fireBullet (v_forward, 3, 10, IT_SHOTGUN);
474 self.punchangle = '-0.5 0 0';
476 self.attack_finished = time + 0.3;
477 self.ammo_nails = self.ammo_nails - 1;
480 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 1) + (v_forward * 20);
481 SpawnCasing (org, v_forward, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 + 10) * v_up), 2);
484 void W_Shotgun_Attack (void)
486 sound (self, CHAN_WEAPON, "weapons/Shotgun_fire.wav", 1, ATTN_NORM);
492 fireBullet (v_forward, 300, 8, IT_SHOTGUN);
496 self.punchangle_x = -2;
498 self.ammo_shells = self.ammo_shells - 1;
499 self.attack_finished = time + 0.8;
501 vector org; // casing code
502 org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 4) + (v_forward * 15);
503 SpawnCasing (org, v_forward, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 + 10) * v_up), 1);
506 void W_Shotgun_Attack2 (void)
511 void W_Grenade_Explode (entity ignore)
513 ImpactEffect (self, IT_GRENADE_LAUNCHER);
515 RadiusDamage (self.owner, self, 0, 100, world);
520 void W_Grenade_FuseExplode (void)
522 W_Grenade_Explode (world);
525 void W_Grenade_Touch (void)
527 if (other.classname == "player" || other.classname == "corpse")
529 Damage (self.owner, self.origin, other, 0, 100);
530 W_Grenade_Explode (other);
533 sound (self, CHAN_BODY, "weapons/Grenade_Bounce.wav", 1, ATTN_NORM);
536 void W_Grenade_Attack (void)
540 sound (self, CHAN_WEAPON, "weapons/Grenade_fire.wav", 1, ATTN_NORM);
542 self.punchangle_x = -4;
546 gren.classname = "grenade";
548 gren.movetype = MOVETYPE_BOUNCE;
549 gren.solid = SOLID_BBOX;
551 gren.takedamage = DAMAGE_YES;
553 gren.event_hurt = W_Grenade_Explode;
555 setmodel (gren, "models/grenademodel.md3");
556 setsize (gren, '0 0 0', '0 0 0');
558 makevectors (self.v_angle);
559 setorigin (gren, self.origin + self.view_ofs + v_forward * 18 + v_right * 5 + v_up * -12);
561 gren.velocity = v_forward * 900 + v_up * 200;
562 gren.angles = vectoangles (gren.velocity);
563 gren.avelocity = '150 1500 150';
565 gren.touch = W_Grenade_Touch;
566 gren.think = W_Grenade_FuseExplode;
567 gren.nextthink = time + 2;
569 self.attack_finished = time + 1;
570 self.ammo_rockets = self.ammo_rockets - 1;
573 void W_Grenade_Attack2 (void)
577 sound (self, CHAN_WEAPON, "weapons/Grenade_fire.wav", 1, ATTN_NORM);
579 self.punchangle_x = -4;
583 gren.classname = "grenade";
585 gren.movetype = MOVETYPE_TOSS;
586 gren.solid = SOLID_BBOX;
588 gren.takedamage = DAMAGE_YES;
590 gren.event_hurt = W_Grenade_Explode;
592 setmodel (gren, "models/grenademodel.md3");
593 setsize (gren, '0 0 0', '0 0 0');
595 makevectors (self.v_angle);
596 setorigin (gren, self.origin + self.view_ofs + v_forward * 18 + v_right * 5 + v_up * -12);
598 gren.velocity = v_forward * 1400 + v_up * 100;
599 gren.angles = vectoangles (gren.velocity);
600 gren.avelocity = '150 1500 150';
602 gren.touch = W_Grenade_Explode;
603 gren.think = W_Grenade_FuseExplode;
604 gren.nextthink = time + 5;
606 self.attack_finished = time + 1;
607 self.ammo_rockets = self.ammo_rockets - 1;
610 void W_Electro_Touch (void)
612 WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
613 WriteByte (MSG_BROADCAST, 79);
614 WriteCoord (MSG_BROADCAST, self.origin_x);
615 WriteCoord (MSG_BROADCAST, self.origin_y);
616 WriteCoord (MSG_BROADCAST, self.origin_z);
617 WriteCoord (MSG_BROADCAST, 0); // SeienAbunae: groan... Useless clutter
618 WriteCoord (MSG_BROADCAST, 0);
619 WriteCoord (MSG_BROADCAST, 0);
620 WriteByte (MSG_BROADCAST, 155);
622 if (other.classname == "player" || other.classname == "corpse" || other.classname == "gib")
624 Damage (self.owner, self.origin, other, 0, 40);
625 // SeienAbunae: the impact sound doesn't seem to play when the victim dies instead of being hurt
626 // Maybe it's not that big of a deal
628 sound (other, CHAN_IMPACT, "misc/BodyImpact1.wav", 1, ATTN_NORM);
630 sound (other, CHAN_IMPACT, "misc/BodyImpact2.wav", 1, ATTN_NORM);
636 void W_Electro_Attack (void)
640 sound (self, CHAN_WEAPON, "weapons/Electro_fire.wav", 1, ATTN_NORM);
644 proj.classname = "elec";
646 proj.movetype = MOVETYPE_FLY;
647 proj.solid = SOLID_BBOX;
650 makevectors (self.v_angle);
652 setmodel (proj, "models/bullet.mdl");
653 setsize (proj, '0 0 0', '0 0 0');
654 setorigin (proj, self.origin + self.view_ofs + v_forward * 18 + v_right * 5 + v_up * -12);
656 proj.velocity = v_forward * 3000;
657 proj.touch = W_Electro_Touch;
658 proj.think = SUB_Remove;
659 proj.nextthink = time + 3;
661 self.attack_finished = time + 0.6;
662 self.ammo_cells = self.ammo_cells - 1;
665 void W_Plasma_Touch (void)
667 if (other.classname == "player" || other.classname == "corpse" || other.classname == "gib")
668 Damage (self.owner, self.origin, other, 0, 15);
670 ImpactEffect (self, IT_ELECTRO);
675 void W_Electro_Attack2 (void)
679 sound (self, CHAN_WEAPON, "weapons/LazerGun_Fire.wav", 1, ATTN_NORM);
683 proj.classname = "plasma";
685 proj.movetype = MOVETYPE_FLY;
686 proj.solid = SOLID_BBOX;
687 proj.effects = EF_DIMLIGHT;
689 makevectors (self.v_angle);
691 setmodel (proj, "models/sprites/plasmashot.spr32");
692 setsize (proj, '0 0 0', '0 0 0');
693 setorigin (proj, self.origin + self.view_ofs + v_forward * 5 + v_right * 5 + v_up * -12);
695 proj.velocity = v_forward * 5000;
696 proj.touch = W_Plasma_Touch;
697 proj.think = SUB_Remove;
698 proj.nextthink = time + 1.5;
700 self.attack_finished = time + 0.175;
701 self.ammo_cells = self.ammo_cells - 1;
704 void W_Crylink_Attack (void)
708 sound (self, CHAN_WEAPON, "weapons/crylink.wav", 1, ATTN_NORM);
709 org = self.origin + self.view_ofs + v_forward * 18 + v_right * 7 + v_up * -9;
710 makevectors (self.v_angle);
712 // FIXME: make it accurate!
714 FireRailgunBullet (org, 25, v_forward);
716 traceline (org, self.origin + self.view_ofs + (v_forward * 4096), FALSE, self);
718 WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
719 WriteByte (MSG_BROADCAST, 76);
720 WriteCoord (MSG_BROADCAST, org_x);
721 WriteCoord (MSG_BROADCAST, org_y);
722 WriteCoord (MSG_BROADCAST, org_z);
723 WriteCoord (MSG_BROADCAST, trace_endpos_x);
724 WriteCoord (MSG_BROADCAST, trace_endpos_y);
725 WriteCoord (MSG_BROADCAST, trace_endpos_z);
726 WriteCoord (MSG_BROADCAST, self.v_angle_x);
727 WriteCoord (MSG_BROADCAST, self.v_angle_y);
728 WriteCoord (MSG_BROADCAST, self.v_angle_z);
730 te_spike (trace_endpos);
732 self.ammo_cells = self.ammo_cells - 0.25;
733 self.attack_finished = time + 0.165;
736 void W_Crylink_Attack2 (void)
741 makevectors (self.v_angle);
743 org = self.origin + self.view_ofs + v_forward * 19 + v_right * 5 + v_up * -7;
745 traceline (org, self.origin + self.view_ofs + v_forward * 4096 + v_right * (random () * 100 - 50) + v_up * (random () * 100 - 50), FALSE, self);
747 Damage (self, trace_endpos, trace_ent, 0, 20);
749 te_lightning1 (self, org, trace_endpos);
751 self.ammo_cells = self.ammo_cells - 0.25;
752 self.attack_finished = time + 0.075;
755 void W_Nex_Attack (void)
760 sound (self, CHAN_WEAPON, "weapons/NexFire.wav", 1, ATTN_NORM);
761 //self.effects = EF_MUZZLEFLASH;
762 self.punchangle_x = -4;
764 makevectors (self.v_angle);
766 org = self.origin + self.view_ofs + v_forward * 18 + v_right * 8 + v_up * -5;
768 // FIXME: iterate to hit multiple guys
769 // FIXME: make it accurate!
771 traceline (org, self.origin + self.view_ofs + (v_forward * 4096), FALSE, self);
773 FireRailgunBullet (org, 90, v_forward);
775 WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
776 WriteByte (MSG_BROADCAST, 76);
777 WriteCoord (MSG_BROADCAST, org_x);
778 WriteCoord (MSG_BROADCAST, org_y);
779 WriteCoord (MSG_BROADCAST, org_z);
780 WriteCoord (MSG_BROADCAST, trace_endpos_x);
781 WriteCoord (MSG_BROADCAST, trace_endpos_y);
782 WriteCoord (MSG_BROADCAST, trace_endpos_z);
783 WriteCoord (MSG_BROADCAST, self.v_angle_x);
784 WriteCoord (MSG_BROADCAST, self.v_angle_y);
785 WriteCoord (MSG_BROADCAST, self.v_angle_z);
787 te_plasmaburn (trace_endpos);
789 dir = trace_plane_normal * 100;
790 WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
791 WriteByte (MSG_BROADCAST, TE_FLAMEJET);
792 WriteCoord (MSG_BROADCAST, trace_endpos_x);
793 WriteCoord (MSG_BROADCAST, trace_endpos_y);
794 WriteCoord (MSG_BROADCAST, trace_endpos_z);
795 WriteCoord (MSG_BROADCAST, dir_x);
796 WriteCoord (MSG_BROADCAST, dir_y);
797 WriteCoord (MSG_BROADCAST, dir_z);
798 WriteByte (MSG_BROADCAST, 255);
800 PointSound (trace_endpos, "weapons/NexImpact.wav", 1, ATTN_NORM);
802 self.attack_finished = time + 1;
803 self.ammo_cells = self.ammo_cells - 1;
806 void W_Nex_Attack2 (void)
811 void W_Hagar_Explode (void)
813 ImpactEffect (self, IT_HAGAR);
815 RadiusDamage (self.owner, self, 0, 100, world);
820 void W_Hagar_Touch (void)
822 if (other == self.owner)
824 else if (pointcontents (self.origin) == CONTENT_SKY)
833 void W_Hagar_Attack (void)
838 sound (self, CHAN_WEAPON, "weapons/Hagar_Fire.wav", 1, ATTN_NORM);
841 missile.owner = self;
842 missile.classname = "rocket";
844 missile.takedamage = DAMAGE_YES;
846 missile.event_hurt = W_Hagar_Explode;
848 missile.movetype = MOVETYPE_FLY;
849 missile.solid = SOLID_BBOX;
850 setmodel (missile, "models/hagarmissile.mdl");
851 setsize (missile, '0 0 0', '0 0 0');
853 makevectors (self.v_angle);
855 org = self.origin + self.view_ofs + v_forward * 20 + v_right * 4 + v_up * -15;
857 setorigin (missile, org);
858 missile.velocity = v_forward * 2000;
859 missile.angles = vectoangles (missile.velocity);
861 missile.touch = W_Hagar_Touch;
862 missile.think = SUB_Remove;
863 missile.nextthink = time + 1;
865 self.attack_finished = time + 0.2;
866 self.ammo_rockets = self.ammo_rockets - 0.25;
869 void W_Hagar_Attack2 (void)
874 sound (self, CHAN_WEAPON, "weapons/Hagar_Fire.wav", 1, ATTN_NORM);
877 missile.owner = self;
878 missile.classname = "rocket";
880 missile.takedamage = DAMAGE_YES;
882 missile.event_hurt = W_Hagar_Explode;
884 missile.movetype = MOVETYPE_FLY;
885 missile.solid = SOLID_BBOX;
886 setmodel (missile, "models/hagarmissile.mdl");
887 setsize (missile, '0 0 0', '0 0 0');
889 makevectors (self.v_angle);
891 org = self.origin + self.view_ofs + v_forward * 20 + v_right * 4 + v_up * -15;
893 setorigin (missile, org);
894 missile.velocity = v_forward * 15000;
895 missile.angles = vectoangles (missile.velocity);
897 missile.touch = W_Hagar_Touch;
898 missile.think = SUB_Remove;
899 missile.nextthink = time + 1;
901 self.attack_finished = time + 0.7;
902 self.ammo_rockets = self.ammo_rockets - 0.25;
905 void W_Rocket_Explode (entity ignore)
907 ImpactEffect (self, IT_ROCKET_LAUNCHER);
909 RadiusDamage (self.owner, self, 0, 100, ignore);
914 void W_Rocket_Touch (void)
916 if (other == self.owner)
918 else if (pointcontents (self.origin) == CONTENT_SKY)
923 else if (other.classname == "player" || other.classname == "corpse")
925 Damage (self.owner, self.origin, other, 0, 100);
926 W_Rocket_Explode (other);
929 W_Rocket_Explode (world);
932 void W_Rocket_Attack (void)
937 sound (self, CHAN_WEAPON, "weapons/Rocket_Fire.wav", 1, ATTN_NORM);
940 missile.owner = self;
941 missile.classname = "rocket";
943 missile.takedamage = DAMAGE_YES;
945 missile.event_hurt = W_Rocket_Explode;
947 missile.movetype = MOVETYPE_FLY;
948 missile.solid = SOLID_BBOX;
949 setmodel (missile, "models/rocketmissile.mdl");
950 setsize (missile, '0 0 0', '0 0 0');
952 makevectors (self.v_angle);
954 org = self.origin + self.view_ofs + v_forward * 20 + v_right * 4 + v_up * -15;
956 setorigin (missile, org);
957 missile.velocity = v_forward * 2500;
958 missile.angles = vectoangles (missile.velocity);
960 missile.touch = W_Rocket_Touch;
961 missile.think = SUB_Remove;
962 missile.nextthink = time + 1;
964 self.attack_finished = time + 0.5;
965 self.ammo_rockets = self.ammo_rockets - 1;
969 void W_Rocket_Attack2 (void)
976 if (self.deadflag != DEAD_NO)
978 if (self.death_time < time)
987 if (self.weapon == IT_LASER)
989 else if (self.weapon == IT_UZI)
991 else if (self.weapon == IT_SHOTGUN)
993 else if (self.weapon == IT_GRENADE_LAUNCHER)
995 else if (self.weapon == IT_ELECTRO)
997 else if (self.weapon == IT_CRYLINK)
999 else if (self.weapon == IT_NEX)
1001 else if (self.weapon == IT_HAGAR)
1003 else if (self.weapon == IT_ROCKET_LAUNCHER)
1009 void W_SecondaryAttack (void)
1011 if (self.deadflag != DEAD_NO)
1013 if (self.death_time < time)
1014 PutClientInServer();
1019 if (!W_CheckAmmo ())
1022 if (self.weapon == IT_LASER)
1024 else if (self.weapon == IT_UZI)
1026 else if (self.weapon == IT_SHOTGUN)
1027 W_Shotgun_Attack2 ();
1028 else if (self.weapon == IT_GRENADE_LAUNCHER)
1029 W_Grenade_Attack2 ();
1030 else if (self.weapon == IT_ELECTRO)
1031 W_Electro_Attack2 ();
1032 else if (self.weapon == IT_CRYLINK)
1033 W_Crylink_Attack2 ();
1034 else if (self.weapon == IT_NEX)
1036 else if (self.weapon == IT_HAGAR)
1038 else if (self.weapon == IT_ROCKET_LAUNCHER)
1039 W_Rocket_Attack2 ();