home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / sgqcver2 / weapons.qc < prev    next >
Encoding:
Text File  |  1996-08-22  |  35.9 KB  |  1,344 lines

  1. /*More changes than you can shake a stick at.
  2. */
  3.  
  4. void () player_run;
  5. void() SuperDamageSound;
  6. void(vector org, vector vel, float damage) SpawnBlood;
  7. void(string gibname, float dm) ThrowGib; //For explosions
  8. void (entity targ, entity inflictor, entity attacker, float damage) T_Damage;
  9. void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage;
  10.  
  11. // called by worldspawn
  12. void() W_Precache =
  13. {
  14.         precache_sound2 ("blob/land1.wav");     // chain go splorch!
  15.         precache_sound ("plats/medplat1.wav");  // chain cranking out
  16.         precache_sound ("doors/ddoor1.wav");    // chain cranking in
  17.     precache_sound ("items/protect3.wav");
  18.     precache_sound ("items/damage3.wav");
  19.         precache_model ("progs/throwaxe.mdl");  // thrown axe model
  20.         precache_sound ("weapons/woosh.wav");  // WOOSH sound for throwing axe
  21.         precache_sound ("weapons/taxhit1.wav");  // new ax hit sound (FROM QTEST)
  22.         precache_sound ("weapons/taxhit2.wav");  // new ax hit sound (FROM QTEST)
  23.         precache_sound ("weapons/taxhit3.wav");  // new ax hit sound (FROM QTEST)
  24.         precache_sound ("weapons/arm.wav");  // ProxBomb Arming sound
  25.         precache_sound ("weapons/r_exp3.wav");  // new rocket explosion
  26.     precache_sound ("weapons/rocket1i.wav");    // spike gun
  27.     precache_sound ("weapons/sgun1.wav");
  28.     precache_sound ("weapons/shellhit.wav"); //Shell ejection
  29.     precache_sound ("weapons/guncock.wav");    // player shotgun
  30.     precache_sound ("weapons/ric1.wav");    // ricochet (used in c code)
  31.     precache_sound ("weapons/ric2.wav");    // ricochet (used in c code)
  32.     precache_sound ("weapons/ric3.wav");    // ricochet (used in c code)
  33.     precache_sound ("weapons/spike2.wav");    // super spikes
  34.     precache_sound ("weapons/tink1.wav");    // spikes tink (used in c code)
  35.     precache_sound ("weapons/grenade.wav");    // grenade launcher
  36.     precache_sound ("weapons/bounce.wav");        // grenade bounce
  37.         precache_model ("progs/h_demon.mdl");
  38.         precache_model ("progs/h_dog.mdl");
  39.         precache_sound ("items/Inv1.wav");              //used in hologram
  40.         precache_sound ("items/Itembk2.wav");              //used in hologram
  41.         precache_sound ("misc/R_tele5.wav");              //used in hologram
  42.         precache_model ("progs/laser.mdl");
  43.         precache_model ("progs/shelcase.mdl"); //Shell ejection
  44.         precache_sound ("enforcer/enfire.wav"); // player shotgun
  45.         precache_sound ("weapons/shotgn2.wav"); // super shotgun
  46.         precache_sound ("zombie/z_hit.wav");
  47. };
  48.  
  49. float() crandom =
  50. {
  51.     return 2*(random() - 0.5);
  52. };
  53.  
  54. void(entity attacker, float recoil_val) Recoil =
  55. {
  56.         local float friction,gravity;
  57.         local vector dir,friction_vec;
  58.  
  59.         dir = aim(attacker,recoil_val);
  60.         dir = normalize (dir);
  61.         recoil_val =  -10*recoil_val;
  62.         gravity = cvar ("SV_GRAVITY");
  63.         friction_vec = gravity * '0 0 1';
  64.         if (self.flags & FL_ONGROUND)
  65.         {
  66.                 friction = cvar ("SV_FRICTION");
  67.                 friction_vec = friction * dir + friction_vec;
  68.         }
  69.         attacker.velocity = recoil_val * dir + attacker.velocity + friction_vec;
  70. };
  71.  
  72. void() W_FireAxe =
  73. {
  74.     local    vector    source;
  75.     local    vector    org;
  76.  
  77.     source = self.origin + '0 0 16';
  78.     traceline (source, source + v_forward*64, FALSE, self);
  79.     if (trace_fraction == 1.0)
  80.         return;
  81.     
  82.     org = trace_endpos - v_forward*4;
  83.  
  84.     if (trace_ent.takedamage)
  85.     {
  86.         trace_ent.axhitme = 1;
  87.         SpawnBlood (org, '0 0 0', 20);
  88.         sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
  89.         T_Damage (trace_ent, self, self, 20);
  90.     }
  91.     else
  92.     {    // hit wall
  93.         sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
  94.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  95.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  96.         WriteCoord (MSG_BROADCAST, org_x);
  97.         WriteCoord (MSG_BROADCAST, org_y);
  98.         WriteCoord (MSG_BROADCAST, org_z);
  99.     }
  100. };
  101.  
  102. vector() wall_velocity =
  103. {
  104.     local vector    vel;
  105.     
  106.     vel = normalize (self.velocity);
  107.     vel = normalize(vel + v_up*(random()- 0.5) + v_right*(random()- 0.5));
  108.     vel = vel + 2*trace_plane_normal;
  109.     vel = vel * 200;
  110.     return vel;
  111. };
  112.  
  113. void(vector org, vector vel) SpawnMeatSpray =
  114. {
  115.     local    entity missile, mpuff;
  116.     local    vector    org;
  117.  
  118.     missile = spawn ();
  119.     missile.owner = self;
  120.     missile.movetype = MOVETYPE_BOUNCE;
  121.     missile.solid = SOLID_NOT;
  122.  
  123.     makevectors (self.angles);
  124.     missile.velocity = vel;
  125.     missile.velocity_z = missile.velocity_z + 250 + 50*random();
  126.     missile.avelocity = '3000 1000 2000';
  127.     missile.nextthink = time + 1;
  128.     missile.think = SUB_Remove;
  129.     setmodel (missile, "progs/zom_gib.mdl");
  130.     setsize (missile, '0 0 0', '0 0 0');        
  131.     setorigin (missile, org);
  132. };
  133.  
  134. void(vector org, vector vel, float damage) SpawnBlood =
  135. {
  136.     particle (org, vel*0.1, 73, damage*2);
  137.         particle (org, vel*0.2, 73, damage*4);
  138.         particle (org, vel*0.3, 73, damage*8);
  139.         particle (org, vel*0.4, 73, damage*16);
  140. };
  141.  
  142. void(float damage) spawn_touchblood =
  143. {
  144.     local vector    vel;
  145.  
  146.     vel = wall_velocity () * 0.2;
  147.     SpawnBlood (self.origin + vel*0.01, vel, damage);
  148.         SpawnBlood (self.origin + vel*0.04, vel, damage+15);
  149. };
  150.  
  151. void(vector org, vector vel) SpawnChunk =
  152. {
  153.     particle (org, vel*0.02, 0, 10);
  154.         particle (org, vel*0.05, 0, 40);
  155. };
  156.  
  157. entity    multi_ent;
  158. float    multi_damage;
  159.  
  160. void() ClearMultiDamage =
  161. {
  162.     multi_ent = world;
  163.     multi_damage = 0;
  164. };
  165.  
  166. void() ApplyMultiDamage =
  167. {
  168.     if (!multi_ent)
  169.         return;
  170.     T_Damage (multi_ent, self, self, multi_damage);
  171. };
  172.  
  173. void(entity hit, float damage) AddMultiDamage =
  174. {
  175.     if (!hit)
  176.         return;
  177.     
  178.     if (hit != multi_ent)
  179.     {
  180.         ApplyMultiDamage ();
  181.         multi_damage = damage;
  182.         multi_ent = hit;
  183.     }
  184.     else
  185.         multi_damage = multi_damage + damage;
  186. };
  187.  
  188. void(float damage, vector dir) TraceAttack =
  189. {
  190.     local    vector    vel, org;
  191.     
  192.     vel = normalize(dir + v_up*crandom() + v_right*crandom());
  193.     vel = vel + 2*trace_plane_normal;
  194.     vel = vel * 200;
  195.     org = trace_endpos - dir*4;
  196.     if (trace_ent.takedamage)
  197.     {
  198.         SpawnBlood (org, vel*0.2, damage);
  199.         AddMultiDamage (trace_ent, damage);
  200.     }
  201.     else
  202.     {
  203.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  204.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  205.         WriteCoord (MSG_BROADCAST, org_x);
  206.         WriteCoord (MSG_BROADCAST, org_y);
  207.         WriteCoord (MSG_BROADCAST, org_z);
  208.     }
  209. };
  210.  
  211. void(float shotcount, vector dir, vector spread) FireBullets =
  212. {
  213.     local    vector direction;
  214.     local    vector    src;
  215.     
  216.     makevectors(self.v_angle);
  217.         src = self.origin + v_forward*10;
  218.     src_z = self.absmin_z + self.size_z * 0.7;
  219.     ClearMultiDamage ();
  220.     while (shotcount > 0)
  221.     {
  222.         direction = dir + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
  223.  
  224.         traceline (src, src + direction*2048, FALSE, self);
  225.         if (trace_fraction != 1.0)
  226.             TraceAttack (4, direction);
  227.  
  228.         shotcount = shotcount - 1;
  229.     }
  230.     ApplyMultiDamage ();
  231. };
  232.  
  233. void(vector org,vector dir) eject_shell; //For shell ejection
  234. void(vector org, vector dir) Launch_Laser;
  235.  
  236. void() W_FireShotgun =
  237. {
  238.        local vector org,dir;
  239.         
  240.        self.currentammo = self.ammo_shells = self.ammo_shells - 1;
  241.        self.effects = self.effects | EF_MUZZLEFLASH;
  242.        self.attack_finished = time + 0.5;
  243.        makevectors (self.v_angle);
  244.        org = self.origin + v_forward * 7.5 + '0 0 16';
  245.        dir = aim (self, 1800);
  246.        Launch_Laser(org, dir);
  247.        self.punchangle_x = -2;
  248.        Recoil (self,3); // Not too much recoil
  249.        eject_shell (self.origin + '0 0 16' + v_forward*3,dir); //eject shell
  250. };
  251.  
  252. void() W_FireSuperShotgun =
  253. {
  254.     local vector dir;
  255.  
  256.     if (self.currentammo == 1)
  257.     {
  258.         W_FireShotgun ();
  259.         return;
  260.     }
  261.         
  262.     sound (self ,CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM);    
  263.     self.punchangle_x = -4;
  264.     self.currentammo = self.ammo_shells = self.ammo_shells - 2;
  265.     dir = aim (self, 100000);
  266.     FireBullets (14, dir, '0.14 0.08 0');
  267.         Recoil (self,10);
  268.         eject_shell (self.origin + '0 0 16' + v_forward*3,dir); //eject shell
  269.         eject_shell (self.origin + '0 0 16' + v_forward*3,dir);
  270. };
  271.  
  272. void()    s_explode1    =    [0,        s_explode2] {};
  273. void()    s_explode2    =    [1,        s_explode3] {};
  274. void()    s_explode3    =    [2,        s_explode4] {};
  275. void()    s_explode4    =    [3,        s_explode5] {};
  276. void()    s_explode5    =    [4,        s_explode6] {};
  277. void()    s_explode6    =    [5,        SUB_Remove] {};
  278.  
  279. void() BecomeExplosion =
  280. {
  281.     self.movetype = MOVETYPE_NONE;
  282.     self.solid = SOLID_NOT;
  283.         ThrowGib ("progs/zom_gib.mdl", -500);
  284.         ThrowGib ("progs/zom_gib.mdl", -250);
  285.         ThrowGib ("progs/zom_gib.mdl", -50);
  286.         ThrowGib ("progs/zom_gib.mdl", -25);
  287.         if ( !(self.velocity = '0 0 0') ) // And Blood too
  288.         {
  289.                 SpawnBlood (self.origin,self.velocity,500);
  290.                 SpawnBlood (self.origin,-1*self.velocity,500);
  291.                 self.velocity = '0 0 0';
  292.         }
  293.         else
  294.         {
  295.                 SpawnBlood (self.origin,'0 0 100',500);
  296.                 SpawnBlood (self.origin,'0 100 0',500);
  297.                 SpawnBlood (self.origin,'0 -100 0',500);
  298.                 SpawnBlood (self.origin,'-100 0 0',500);
  299.         }
  300.     self.touch = SUB_Null;
  301.     sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  302.         setmodel (self, "progs/s_explod.spr");  //A little fire goes a long way
  303.         s_explode1 ();
  304. };
  305.  
  306. void() T_MissileTouch =
  307. {
  308.     local float    damg;
  309.  
  310.     if (other == self.owner)
  311.         return;        // don't explode on owner
  312.     if (pointcontents(self.origin) == CONTENT_SKY)
  313.     {
  314.         remove(self);
  315.         return;
  316.     }
  317.     damg = 100 + random()*20;
  318.     if (other.health)
  319.     {
  320.         if (other.classname == "monster_shambler")
  321.             damg = damg * 0.5;    // mostly immune
  322.         T_Damage (other, self, self.owner, damg );
  323.     }
  324.     T_RadiusDamage (self, self.owner, 120, other);
  325.     self.origin = self.origin - 8*normalize(self.velocity);
  326.     BecomeExplosion ();
  327. };
  328.  
  329. void() W_FireRocket =
  330. {
  331.     local    entity missile, mpuff;
  332.     
  333.     self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  334.     sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
  335.         self.punchangle_x = -2;
  336.      missile = spawn ();
  337.     missile.owner = self;
  338.     missile.movetype = MOVETYPE_FLYMISSILE;
  339.     missile.solid = SOLID_BBOX;
  340.         missile.effects = EF_DIMLIGHT;
  341.     makevectors (self.v_angle);
  342.         missile.velocity = aim(self, 1500);
  343.         missile.velocity = missile.velocity * 1500;
  344.     missile.angles = vectoangles(missile.velocity);
  345.     missile.touch = T_MissileTouch;
  346.     missile.nextthink = time + 5;
  347.     missile.think = SUB_Remove;
  348.         setmodel (missile, "progs/h_demon.mdl");
  349.         setsize (missile, '0 0 0', '0 0 0');     
  350.     setorigin (missile, self.origin + v_forward*8 + '0 0 16');
  351.         Recoil (self,20);       //Now that is some kick
  352. };
  353.  
  354. void(vector p1, vector p2, entity from, float damage) LightningDamage =
  355. {
  356.     local entity        e1, e2;
  357.     local vector        f;
  358.     
  359.     f = p2 - p1;
  360.     normalize (f);
  361.     f_x = 0 - f_y;
  362.     f_y = f_x;
  363.     f_z = 0;
  364.     f = f*16;
  365.     e1 = e2 = world;
  366.     traceline (p1, p2, FALSE, self);
  367.     if (trace_ent.takedamage)
  368.     {
  369.         particle (trace_endpos, '0 0 100', 225, damage*4);
  370.         T_Damage (trace_ent, from, from, damage);
  371.         if (self.classname == "player")
  372.         {
  373.             if (other.classname == "player")
  374.                 trace_ent.velocity_z = trace_ent.velocity_z + 400;
  375.         }
  376.     }
  377.     e1 = trace_ent;
  378.     traceline (p1 + f, p2 + f, FALSE, self);
  379.     if (trace_ent != e1 && trace_ent.takedamage)
  380.     {
  381.         particle (trace_endpos, '0 0 100', 225, damage*4);
  382.         T_Damage (trace_ent, from, from, damage);
  383.     }
  384.     e2 = trace_ent;
  385.     traceline (p1 - f, p2 - f, FALSE, self);
  386.     if (trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage)
  387.     {
  388.         particle (trace_endpos, '0 0 100', 225, damage*4);
  389.         T_Damage (trace_ent, from, from, damage);
  390.     }
  391. };
  392.  
  393.  
  394. void() W_FireLightning =
  395. {
  396.     local    vector        org;
  397.  
  398.     if (self.ammo_cells < 1)
  399.     {
  400.         self.weapon = W_BestWeapon ();
  401.         W_SetCurrentAmmo ();
  402.         return;
  403.     }
  404.     if (self.waterlevel > 1)
  405.     {
  406.         T_RadiusDamage (self, self, 35*self.ammo_cells, world);
  407.         self.ammo_cells = 0;
  408.         W_SetCurrentAmmo ();
  409.         return;
  410.     }
  411.     if (self.t_width < time)
  412.     {
  413.         sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
  414.         self.t_width = time + 0.6;
  415.     }
  416.     self.punchangle_x = -2;
  417.     self.currentammo = self.ammo_cells = self.ammo_cells - 1;
  418.     org = self.origin + '0 0 16';
  419.     traceline (org, org + v_forward*600, TRUE, self);
  420.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  421.     WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
  422.     WriteEntity (MSG_BROADCAST, self);
  423.     WriteCoord (MSG_BROADCAST, org_x);
  424.     WriteCoord (MSG_BROADCAST, org_y);
  425.     WriteCoord (MSG_BROADCAST, org_z);
  426.     WriteCoord (MSG_BROADCAST, trace_endpos_x);
  427.     WriteCoord (MSG_BROADCAST, trace_endpos_y);
  428.     WriteCoord (MSG_BROADCAST, trace_endpos_z);
  429.     LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
  430. };
  431.  
  432. void() GrenadeExplode =
  433. {
  434.     T_RadiusDamage (self, self.owner, 120, world);
  435.     BecomeExplosion ();
  436. };
  437.  
  438. void() GrenadeTouch =
  439. {
  440.     if (other == self.owner)
  441.         return;        // don't explode on owner
  442.     if (other.takedamage == DAMAGE_AIM)
  443.     {
  444.         GrenadeExplode();
  445.         return;
  446.     }
  447.     sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);    // bounce sound
  448.     if (self.velocity == '0 0 0')
  449.         self.avelocity = '0 0 0';
  450. };
  451.  
  452. void() W_FireGrenade =
  453. {
  454.     local    entity missile, mpuff;
  455.     
  456.     self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  457.     sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  458.     self.punchangle_x = -2;
  459.     missile = spawn ();
  460.     missile.owner = self;
  461.     missile.movetype = MOVETYPE_BOUNCE;
  462.     missile.solid = SOLID_BBOX;
  463.     missile.classname = "grenade";
  464.     makevectors (self.v_angle);
  465.     if (self.v_angle_x)
  466.         missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
  467.     else
  468.     {
  469.         missile.velocity = aim(self, 10000);
  470.         missile.velocity = missile.velocity * 600;
  471.         missile.velocity_z = 200;
  472.     }
  473.     missile.avelocity = '300 300 300';
  474.     missile.angles = vectoangles(missile.velocity);
  475.     missile.touch = GrenadeTouch;
  476.     missile.nextthink = time + 2.5;
  477.     missile.think = GrenadeExplode;
  478.         setmodel (missile, "progs/h_dog.mdl");
  479.     setsize (missile, '0 0 0', '0 0 0');        
  480.     setorigin (missile, self.origin);
  481.         Recoil (self,12);  //Pretty nice recoil huh?
  482. };
  483.  
  484. void () ProximityTouch =
  485. {
  486.     sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
  487.     if (self.velocity == '0 0 0')
  488.         self.avelocity = '0 0 0';
  489. };
  490.  
  491. void () Proximity =
  492. {
  493.     local entity head;
  494.  
  495.         head = findradius(self.origin,150);
  496.         while(head)
  497.     {
  498.         if ( (head.health > 1) && (head.classname == "player") && !(head.items & IT_INVISIBILITY) )
  499.         {
  500.             sound (self, CHAN_WEAPON, "weapons/arm.wav", 1, ATTN_NORM);
  501.                         self.nextthink = time + 0.2;
  502.             self.think = GrenadeExplode;
  503.             return;
  504.         }
  505.         head = head.chain;
  506.     }
  507.         self.nextthink = time + 0.25;
  508. };
  509.  
  510. void() W_DropBomb =
  511. {
  512.     local entity item;
  513.  
  514.         if (self.ammo_rockets <= 2)
  515.         return;
  516.     self.ammo_rockets = self.ammo_rockets - 2;
  517.     self.flags = self.flags | FL_ATTACKED;
  518.     sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
  519.     item = spawn();
  520.     item.owner = self;
  521.     makevectors(self.v_angle);
  522.         setorigin(item,self.origin - '0 0 17');
  523.         item.velocity= '0 0 0';
  524.         item.avelocity='0 800 800';
  525.     item.flags = FL_ITEM;
  526.         item.solid = SOLID_BBOX;
  527.         item.movetype = MOVETYPE_FLY;
  528.     item.classname = "proximity";
  529.         item.health = 20;
  530.         item.th_die = GrenadeExplode;
  531.         item.takedamage = DAMAGE_AIM;
  532.     setmodel (item, "progs/grenade.mdl");
  533.         setsize (item, '-48 -48 -4', '48 48 4');            
  534.         item.nextthink = time + 3;
  535.     item.think = Proximity;
  536.     W_SetCurrentAmmo();
  537. };
  538.  
  539. .float hit_z;
  540. void() spike_touch =
  541. {
  542. local float rand;
  543.     if (other == self.owner)
  544.         return;
  545.     if (other.solid == SOLID_TRIGGER)
  546.         return;    // trigger field, do nothing
  547.     if (pointcontents(self.origin) == CONTENT_SKY)
  548.     {
  549.         remove(self);
  550.         return;
  551.     }
  552.     if (other.takedamage)
  553.     {
  554.         spawn_touchblood (9);
  555.         T_Damage (other, self, self.owner, 9);
  556.     }
  557.     else
  558.     {
  559.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  560.         if (self.classname == "wizspike")
  561.             WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
  562.         else if (self.classname == "knightspike")
  563.             WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
  564.         else
  565.             WriteByte (MSG_BROADCAST, TE_SPIKE);
  566.         WriteCoord (MSG_BROADCAST, self.origin_x);
  567.         WriteCoord (MSG_BROADCAST, self.origin_y);
  568.         WriteCoord (MSG_BROADCAST, self.origin_z);
  569.     }
  570.     remove(self);
  571. };
  572.  
  573. void() superspike_touch =
  574. {
  575. local float rand;
  576.     if (other == self.owner)
  577.         return;
  578.     if (other.solid == SOLID_TRIGGER)
  579.         return;    // trigger field, do nothing
  580.     if (pointcontents(self.origin) == CONTENT_SKY)
  581.     {
  582.         remove(self);
  583.         return;
  584.     }
  585.     if (other.takedamage)
  586.     {
  587.         spawn_touchblood (18);
  588.         T_Damage (other, self, self.owner, 18);
  589.     }
  590.     else
  591.     {
  592.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  593.         WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
  594.         WriteCoord (MSG_BROADCAST, self.origin_x);
  595.         WriteCoord (MSG_BROADCAST, self.origin_y);
  596.         WriteCoord (MSG_BROADCAST, self.origin_z);
  597.     }
  598.     remove(self);
  599. };
  600.  
  601. void(vector org, vector dir) launch_hologram;
  602.  
  603. void(float ox) W_FireHologram =      //Used to setup and launch the HOLOGRAM
  604. {
  605.  
  606.     local vector    dir;
  607.     
  608.     makevectors (self.v_angle);
  609.     self.attack_finished = time + 0.5;
  610.     dir = aim (self, 1000);
  611.         launch_hologram (self.origin + '0 0 24' + v_right*ox, dir);
  612. };
  613.  
  614. void(vector org, vector dir) launch_spike =
  615. {
  616.     newmis = spawn ();
  617.     newmis.owner = self;
  618.     newmis.movetype = MOVETYPE_FLYMISSILE;
  619.     newmis.solid = SOLID_BBOX;
  620.     newmis.angles = vectoangles(dir);
  621.     newmis.touch = spike_touch;
  622.     newmis.classname = "spike";
  623.     newmis.think = SUB_Remove;
  624.     newmis.nextthink = time + 6;
  625.     setmodel (newmis, "progs/spike.mdl");
  626.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  627.     setorigin (newmis, org);
  628.     newmis.velocity = dir * 1000;
  629. };
  630.  
  631. void() W_FireSuperSpikes =
  632. {
  633.     local vector    dir;
  634.     local entity    old;
  635.     
  636.     sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
  637.     self.attack_finished = time + 0.2;
  638.     self.currentammo = self.ammo_nails = self.ammo_nails - 2;
  639.     dir = aim (self, 1000);
  640.     launch_spike (self.origin + '0 0 16', dir);
  641.     newmis.touch = superspike_touch;
  642.     setmodel (newmis, "progs/s_spike.mdl");
  643.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  644.     self.punchangle_x = -2;
  645.         Recoil (self,5);        //Just hold that attack button down
  646. };
  647.  
  648. void(float ox) W_FireSpikes =
  649. {
  650.     local vector    dir;
  651.     local entity    old;
  652.     
  653.     makevectors (self.v_angle);
  654.     if (self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN)
  655.     {
  656.         W_FireSuperSpikes ();
  657.         return;
  658.     }
  659.     if (self.ammo_nails < 1)
  660.     {
  661.         self.weapon = W_BestWeapon ();
  662.         W_SetCurrentAmmo ();
  663.         return;
  664.     }
  665.     sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
  666.     self.attack_finished = time + 0.2;
  667.     self.currentammo = self.ammo_nails = self.ammo_nails - 1;
  668.     dir = aim (self, 1000);
  669.     launch_spike (self.origin + '0 0 16' + v_right*ox, dir);
  670.     self.punchangle_x = -2;
  671.         Recoil (self,2);   //Seems small now, go to E1M8
  672. };
  673.  
  674. void(vector org, vector dir) launch_flare;
  675.  
  676. void() W_FireFlare =
  677. {
  678.         local vector org,dir;
  679.         
  680.         self.attack_finished = time + 0.5;
  681.         makevectors (self.v_angle);
  682.         org = self.origin + v_forward * 7.5 + '0 0 16';
  683.         dir = aim (self, 1800);
  684.         launch_flare(org, dir);
  685.     self.punchangle_x = -2;
  686. };
  687.  
  688. void() DetPipeBombs =
  689. {
  690.         local entity    head;
  691.  
  692.         self.flags = self.flags | FL_ATTACKED; //says that you have attacked for teamplay
  693.         head = findradius (self.origin, 1000);
  694.         while(head)
  695.         {
  696.                 if(head.classname == "pipebomb" || head.classname == "proximity")
  697.                         if (head.owner == self)
  698.                         {
  699.                                 sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  700.                                 head.nextthink = time;
  701.                         }
  702.                 head = head.chain;
  703.         }
  704. };
  705.  
  706. void() PipeBombTouch =
  707. {
  708.     if (other == self.owner)
  709.         return;        // don't explode on owner
  710.     sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);    // bounce sound
  711.     if (self.velocity == '0 0 0')
  712.         self.avelocity = '0 0 0';
  713. };
  714.  
  715. void() W_FirePipeBomb =
  716. {
  717.     local    entity missile, mpuff;
  718.     
  719.         if(self.ammo_rockets < 4)       // have to have enough ammo
  720.       return;
  721.         self.currentammo = self.ammo_rockets = self.ammo_rockets - 4;
  722.         self.flags = self.flags | FL_ATTACKED; //says that you have attacked for teamplay
  723.         sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  724.         self.punchangle_x = -2;
  725.     missile = spawn ();
  726.     missile.owner = self;
  727.     missile.movetype = MOVETYPE_BOUNCE;
  728.     missile.solid = SOLID_BBOX;
  729.     missile.classname = "pipebomb";
  730.     makevectors (self.v_angle);
  731.     if (self.v_angle_x)
  732.         missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
  733.     else
  734.     {
  735.         missile.velocity = aim(self, 10000);
  736.         missile.velocity = missile.velocity * 600;
  737.         missile.velocity_z = 200;
  738.     }
  739.     missile.avelocity = '300 300 300';
  740.     missile.angles = vectoangles(missile.velocity);
  741.     missile.touch = PipeBombTouch;
  742.     missile.think = GrenadeExplode;
  743.     setmodel (missile, "progs/grenade.mdl");
  744.     setsize (missile, '0 0 0', '0 0 0');        
  745.     setorigin (missile, self.origin);
  746. };
  747.  
  748. void() W_SetCurrentAmmo =
  749. {
  750.  if(self.classname != "player")
  751.    return;
  752.     player_run ();        // get out of any weapon firing states
  753.  
  754.     self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
  755.     
  756.     if (self.weapon == IT_AXE)
  757.     {
  758.         self.currentammo = 0;
  759.         self.weaponmodel = "progs/v_axe.mdl";
  760.         self.weaponframe = 0;
  761.     }
  762.         else if (self.weapon == IT_THROWING_AXE)
  763.     {
  764.                 self.currentammo = self.num_axes;
  765.         self.weaponmodel = "progs/v_axe.mdl";
  766.         self.weaponframe = 0;
  767.                 
  768.     }
  769.         else if (self.weapon == IT_MORNINGSTAR)
  770.         {
  771.                 self.currentammo = 0;
  772.                 self.weaponmodel = "progs/v_star.mdl";
  773.                 self.weaponframe = 0;
  774.         }
  775.     else if (self.weapon == IT_SHOTGUN)
  776.     {
  777.         self.currentammo = self.ammo_shells;
  778.         self.weaponmodel = "progs/v_shot.mdl";
  779.         self.weaponframe = 0;
  780.         self.items = self.items | IT_SHELLS;
  781.     }
  782.     else if (self.weapon == IT_SUPER_SHOTGUN)
  783.     {
  784.         self.currentammo = self.ammo_shells;
  785.         self.weaponmodel = "progs/v_shot2.mdl";
  786.         self.weaponframe = 0;
  787.         self.items = self.items | IT_SHELLS;
  788.     }
  789.     else if (self.weapon == IT_NAILGUN)
  790.     {
  791.         self.currentammo = self.ammo_nails;
  792.         self.weaponmodel = "progs/v_nail.mdl";
  793.         self.weaponframe = 0;
  794.         self.items = self.items | IT_NAILS;
  795.     }
  796.     else if (self.weapon == IT_SUPER_NAILGUN)
  797.     {
  798.         self.currentammo = self.ammo_nails;
  799.         self.weaponmodel = "progs/v_nail2.mdl";
  800.         self.weaponframe = 0;
  801.         self.items = self.items | IT_NAILS;
  802.     }
  803.     else if (self.weapon == IT_GRENADE_LAUNCHER)
  804.     {
  805.         self.currentammo = self.ammo_rockets;
  806.         self.weaponmodel = "progs/v_rock.mdl";
  807.         self.weaponframe = 0;
  808.         self.items = self.items | IT_ROCKETS;
  809.     }
  810.     else if (self.weapon == IT_ROCKET_LAUNCHER)
  811.     {
  812.         self.currentammo = self.ammo_rockets;
  813.         self.weaponmodel = "progs/v_rock2.mdl";
  814.         self.weaponframe = 0;
  815.         self.items = self.items | IT_ROCKETS;
  816.     }
  817.     else if (self.weapon == IT_LIGHTNING)
  818.     {
  819.         self.currentammo = self.ammo_cells;
  820.         self.weaponmodel = "progs/v_light.mdl";
  821.         self.weaponframe = 0;
  822.         self.items = self.items | IT_CELLS;
  823.     }
  824.     else
  825.     {
  826.         self.currentammo = 0;
  827.         self.weaponmodel = "";
  828.         self.weaponframe = 0;
  829.     }
  830. };
  831.  
  832. float() W_BestWeapon =
  833. {
  834.     local    float    it;
  835.     
  836.     it = self.items;
  837.         if(self.ammo_cells >= 1 && (it & IT_LIGHTNING) && (self.waterlevel <= 1))
  838.         return IT_LIGHTNING;
  839.     else if(self.ammo_nails >= 2 && (it & IT_SUPER_NAILGUN) )
  840.         return IT_SUPER_NAILGUN;
  841.     else if(self.ammo_shells >= 2 && (it & IT_SUPER_SHOTGUN) )
  842.         return IT_SUPER_SHOTGUN;
  843.     else if(self.ammo_nails >= 1 && (it & IT_NAILGUN) )
  844.         return IT_NAILGUN;
  845.     else if(self.ammo_shells >= 1 && (it & IT_SHOTGUN) )
  846.         return IT_SHOTGUN;
  847.     return IT_AXE;
  848. };
  849.  
  850. float() W_CheckNoAmmo =
  851. {
  852.     if (self.currentammo > 0)
  853.         return TRUE;
  854.         if (self.weapon == IT_AXE || self.weapon == IT_MORNINGSTAR)
  855.         return TRUE;
  856.         self.weapon = W_BestWeapon ();
  857.     W_SetCurrentAmmo ();
  858.     return FALSE;
  859. };
  860.  
  861. void()    player_axe1;
  862. void()    player_axeb1;
  863. void()    player_axec1;
  864. void()    player_axed1;
  865. void()    player_shot1;
  866. void()    player_nail1;
  867. void()    player_light1;
  868. void()    player_rocket1;
  869. void()  player_tax1; //thrown axes
  870. void()    player_chain1;
  871. void()  player_chain3;
  872.  
  873. void() W_Attack =
  874. {
  875.     local    float    r;
  876.  
  877.     if (!W_CheckNoAmmo ())
  878.         return;
  879.  
  880.     makevectors    (self.v_angle);            // calculate forward angle for velocity
  881.     self.show_hostile = time + 1;    // wake monsters up
  882.         self.flags = self.flags | FL_ATTACKED; //says that you have attacked for teamplay
  883.     if (self.weapon == IT_AXE)
  884.     {
  885.         sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
  886.         r = random();
  887.         if (r < 0.25)
  888.             player_axe1 ();
  889.         else if (r<0.5)
  890.             player_axeb1 ();
  891.         else if (r<0.75)
  892.             player_axec1 ();
  893.         else
  894.             player_axed1 ();
  895.         self.attack_finished = time + 0.5;
  896.     }
  897.         else if (self.weapon == IT_THROWING_AXE)
  898.     {
  899.                 player_tax1 ();
  900.  
  901.                 self.attack_finished = time + 1;
  902.     }
  903.         else if (self.weapon == IT_MORNINGSTAR)
  904.         {
  905.                 if (!self.hook_out) {player_chain1();}
  906.                 else {player_chain3();}
  907.                 self.attack_finished = time + 0.1;
  908.         }
  909.     else if (self.weapon == IT_SHOTGUN)
  910.     {
  911.         player_shot1 ();
  912.         W_FireShotgun ();
  913.         self.attack_finished = time + 0.5;
  914.     }
  915.     else if (self.weapon == IT_SUPER_SHOTGUN)
  916.     {
  917.         player_shot1 ();
  918.         W_FireSuperShotgun ();
  919.         self.attack_finished = time + 0.7;
  920.     }
  921.     else if (self.weapon == IT_NAILGUN)
  922.     {
  923.         player_nail1 ();
  924.     }
  925.     else if (self.weapon == IT_SUPER_NAILGUN)
  926.     {
  927.         player_nail1 ();
  928.     }
  929.     else if (self.weapon == IT_GRENADE_LAUNCHER)
  930.     {
  931.         player_rocket1();
  932.         W_FireGrenade();
  933.         self.attack_finished = time + 0.6;
  934.     }
  935.     else if (self.weapon == IT_ROCKET_LAUNCHER)
  936.     {
  937.         player_rocket1();
  938.         W_FireRocket();
  939.         self.attack_finished = time + 0.8;
  940.     }
  941.     else if (self.weapon == IT_LIGHTNING)
  942.     {
  943.         player_light1();
  944.         self.attack_finished = time + 0.1;
  945.         sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
  946.     }
  947. };
  948.  
  949. void() W_ChangeWeapon =
  950. {
  951.     local    float    it, am, fl;
  952.  
  953.     it = self.items;
  954.     am = 0;
  955.     if (self.impulse == 1)
  956.     {
  957.                 if (self.weapon == IT_AXE)
  958.                 {
  959.                         sprint(self,"Throwing Axe!\n");
  960.                         fl=IT_THROWING_AXE;
  961.                         if (self.num_axes <1)
  962.                                 am = 1;
  963.                 }
  964.                 else if (self.weapon == IT_THROWING_AXE)
  965.                 {
  966.                         sprint(self,"Morning Star!\n");
  967.                         fl=IT_MORNINGSTAR;
  968.                 }
  969.                 else
  970.                 {
  971.                         sprint(self,"Normal Axe!\n");
  972.                         fl = IT_AXE;
  973.                 }                
  974.     }
  975.     else if (self.impulse == 2)
  976.     {
  977.         fl = IT_SHOTGUN;
  978.         if (self.ammo_shells < 1)
  979.             am = 1;
  980.     }
  981.     else if (self.impulse == 3)
  982.     {
  983.         fl = IT_SUPER_SHOTGUN;
  984.         if (self.ammo_shells < 2)
  985.             am = 1;
  986.     }        
  987.     else if (self.impulse == 4)
  988.     {
  989.         fl = IT_NAILGUN;
  990.         if (self.ammo_nails < 1)
  991.             am = 1;
  992.     }
  993.     else if (self.impulse == 5)
  994.     {
  995.         fl = IT_SUPER_NAILGUN;
  996.         if (self.ammo_nails < 2)
  997.             am = 1;
  998.     }
  999.     else if (self.impulse == 6)
  1000.     {
  1001.         fl = IT_GRENADE_LAUNCHER;
  1002.         if (self.ammo_rockets < 1)
  1003.             am = 1;
  1004.     }
  1005.     else if (self.impulse == 7)
  1006.     {
  1007.         fl = IT_ROCKET_LAUNCHER;
  1008.         if (self.ammo_rockets < 1)
  1009.             am = 1;
  1010.     }
  1011.     else if (self.impulse == 8)
  1012.     {
  1013.         fl = IT_LIGHTNING;
  1014.         if (self.ammo_cells < 1)
  1015.             am = 1;
  1016.     }
  1017.     self.impulse = 0;
  1018.     if (!(self.items & fl))
  1019.     {    // don't have the weapon or the ammo
  1020.         sprint (self, "no weapon.\n");
  1021.         return;
  1022.     }
  1023.     if (am)
  1024.     {    // don't have the ammo
  1025.         sprint (self, "not enough ammo.\n");
  1026.         return;
  1027.     }
  1028.     self.weapon = fl;        
  1029.     W_SetCurrentAmmo ();
  1030. };
  1031.  
  1032. void() CheatCommand =
  1033. {
  1034.     if (deathmatch || coop)
  1035.         return;
  1036.  
  1037.     self.ammo_rockets = 100;
  1038.     self.ammo_nails = 200;
  1039.     self.ammo_shells = 100;
  1040.     self.num_axes = 100;
  1041.     self.items = self.items | 
  1042.         IT_AXE |
  1043.         IT_SHOTGUN |
  1044.         IT_SUPER_SHOTGUN |
  1045.         IT_NAILGUN |
  1046.         IT_SUPER_NAILGUN |
  1047.         IT_GRENADE_LAUNCHER |
  1048.         IT_ROCKET_LAUNCHER |
  1049.         IT_KEY1 | IT_KEY2;
  1050.  
  1051.     self.ammo_cells = 200;
  1052.     self.items = self.items | IT_LIGHTNING;
  1053.     self.weapon = IT_ROCKET_LAUNCHER;
  1054.     self.impulse = 0;
  1055.     W_SetCurrentAmmo ();
  1056. };
  1057.  
  1058. void() CycleWeaponCommand =
  1059. {
  1060.     local    float    it, am;
  1061.     
  1062.     it = self.items;
  1063.     self.impulse = 0;
  1064.     while (1)
  1065.     {
  1066.         am = 0;
  1067.         if (self.weapon == IT_LIGHTNING)
  1068.         {
  1069.             self.weapon = IT_AXE;
  1070.         }
  1071.                 else if (self.weapon == IT_AXE || self.weapon == IT_THROWING_AXE || self.weapon == IT_MORNINGSTAR)
  1072.         {
  1073.             self.weapon = IT_SHOTGUN;
  1074.             if (self.ammo_shells < 1)
  1075.                 am = 1;
  1076.         }
  1077.         else if (self.weapon == IT_SHOTGUN)
  1078.         {
  1079.             self.weapon = IT_SUPER_SHOTGUN;
  1080.             if (self.ammo_shells < 2)
  1081.                 am = 1;
  1082.         }        
  1083.         else if (self.weapon == IT_SUPER_SHOTGUN)
  1084.         {
  1085.             self.weapon = IT_NAILGUN;
  1086.             if (self.ammo_nails < 1)
  1087.                 am = 1;
  1088.         }
  1089.         else if (self.weapon == IT_NAILGUN)
  1090.         {
  1091.             self.weapon = IT_SUPER_NAILGUN;
  1092.             if (self.ammo_nails < 2)
  1093.                 am = 1;
  1094.         }
  1095.         else if (self.weapon == IT_SUPER_NAILGUN)
  1096.         {
  1097.             self.weapon = IT_GRENADE_LAUNCHER;
  1098.             if (self.ammo_rockets < 1)
  1099.                 am = 1;
  1100.         }
  1101.         else if (self.weapon == IT_GRENADE_LAUNCHER)
  1102.         {
  1103.             self.weapon = IT_ROCKET_LAUNCHER;
  1104.             if (self.ammo_rockets < 1)
  1105.                 am = 1;
  1106.         }
  1107.         else if (self.weapon == IT_ROCKET_LAUNCHER)
  1108.         {
  1109.             self.weapon = IT_LIGHTNING;
  1110.             if (self.ammo_cells < 1)
  1111.                 am = 1;
  1112.         }
  1113.     
  1114.         if ( (self.items & self.weapon) && am == 0)
  1115.         {
  1116.             W_SetCurrentAmmo ();
  1117.             return;
  1118.         }
  1119.     }
  1120. };
  1121.  
  1122. void() ServerflagsCommand =
  1123. {
  1124.     serverflags = serverflags * 2 + 1;
  1125. };
  1126.  
  1127. void() QuadCheat =
  1128. {
  1129.     if (deathmatch || coop)
  1130.         return;
  1131.     self.super_time = 1;
  1132.     self.super_damage_finished = time + 30;
  1133.     self.items = self.items | IT_QUAD;
  1134. };
  1135.  
  1136. void() backpack_explode;
  1137. void() ThrowBackpack =
  1138. {
  1139.     local entity     item;
  1140.  
  1141.     if ( (self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells) == 0)
  1142.         return;
  1143.     item = spawn();
  1144.         if ( self.ammo_shells >= 20)
  1145.     {
  1146.         item.ammo_shells = 20;
  1147.         self.ammo_shells = self.ammo_shells - 20;
  1148.     }
  1149.     else
  1150.     {
  1151.         item.ammo_shells = self.ammo_shells;
  1152.         self.ammo_shells = 0;
  1153.     }
  1154.     
  1155.         if ( self.ammo_nails >= 20)
  1156.     {
  1157.         item.ammo_nails = 20;
  1158.                 self.ammo_nails = self.ammo_nails - 20;
  1159.     }
  1160.     else
  1161.     {
  1162.         item.ammo_nails = self.ammo_nails;
  1163.         self.ammo_nails = 0;
  1164.     }
  1165.  
  1166.     if ( self.ammo_rockets >= 10)
  1167.     {
  1168.         item.ammo_rockets = 10;
  1169.         self.ammo_rockets = self.ammo_rockets - 10;
  1170.     }
  1171.     else
  1172.     {
  1173.         item.ammo_rockets = self.ammo_rockets;
  1174.                 self.ammo_rockets = 0;
  1175.     }
  1176.  
  1177.     if (self.ammo_cells >= 20)
  1178.     {    
  1179.         item.ammo_cells = 20;
  1180.         self.ammo_cells = self.ammo_cells - 20;
  1181.     }
  1182.     else
  1183.     {
  1184.         item.ammo_cells = self.ammo_cells;
  1185.         self.ammo_cells = 0;
  1186.     }
  1187.     makevectors(self.v_angle);
  1188.     item.velocity = aim(self, 1000);
  1189.         item.velocity = 500 * item.velocity;
  1190.         setorigin(item, self.origin + '0 0 40');
  1191.     item.flags = FL_ITEM;
  1192.         item.solid = SOLID_SLIDEBOX;
  1193.         item.movetype = MOVETYPE_TOSS;
  1194.         setmodel (item, "progs/backpack.mdl");
  1195.         setsize(item, '-16 -16 0', '16 16 56');
  1196.     item.touch = BackpackTouch;
  1197.         if (item.ammo_rockets)
  1198.         {
  1199.                 item.health = 30;
  1200.                 item.th_die = backpack_explode;
  1201.                 item.takedamage = DAMAGE_AIM;
  1202.         }
  1203.         else
  1204.                 item.takedamage = DAMAGE_NO;
  1205.     item.nextthink = time + 120;    // remove after 2 minutes
  1206.         item.think = SUB_Remove;
  1207.     W_SetCurrentAmmo();
  1208. };
  1209.  
  1210. void() feign;   // feign death
  1211. void(entity me)     CameraOn;
  1212. void(entity me)     CameraOff;
  1213. void(entity ex) hologram_explode;
  1214.  
  1215. void() ImpulseCommands =
  1216. {
  1217.       if (self.impulse == 150)
  1218.       {
  1219.             feign ();
  1220.             self.impulse = 0;
  1221.       }
  1222.       if (self.flags & FL_ISFEIGN)
  1223.             return;
  1224.       if (self.impulse >= 1 && self.impulse <= 8)
  1225.             W_ChangeWeapon ();
  1226.       if (self.impulse == 9)
  1227.             CheatCommand ();
  1228.       if (self.impulse == 10)
  1229.             CycleWeaponCommand ();
  1230.       if (self.impulse == 11)
  1231.             ServerflagsCommand ();
  1232.       if (self.impulse == 20)
  1233.             ThrowBackpack();
  1234.       if (self.impulse == 21)
  1235.             W_DropBomb();
  1236.       if (self.impulse == 30)
  1237.             W_FireFlare ();  
  1238.       if (self.impulse == 31)  // Activate/Deactivate hologram
  1239.       {
  1240.         if (self.holo > 0)
  1241.         {
  1242.                 hologram_explode(self.myhologram);
  1243.                 sprint (self, "Hologram off...\n");
  1244.                 self.holo = 0;
  1245.         }
  1246.         else
  1247.                 W_FireHologram ();
  1248.         }
  1249.         if (self.impulse == 33)  // Use for right turning of hologram
  1250.         {
  1251.                 if (self.holo > 0)
  1252.                         hologram.angles_y = hologram.angles_y - 5;
  1253.         }
  1254.         if (self.impulse == 34)  // Use for left turning of hologram
  1255.         {
  1256.                 if (self.holo > 0)
  1257.                         hologram.angles_y = hologram.angles_y + 5;
  1258.         }
  1259.         if (self.impulse == 36)
  1260.         {
  1261.                 if (self.holo <=0)
  1262.                         sprint (self,"Hologram must be activated first...\n");
  1263.                 else if (self.camera <= 0)
  1264.                 {
  1265.                         self.camera = 1;
  1266.                         CameraOn(self);
  1267.                 }
  1268.                 else
  1269.                 {
  1270.                         self.camera = 0;
  1271.                         CameraOff(self);  //NezuCamera(self);
  1272.                 }
  1273.         }
  1274.         if(self.impulse == 61)
  1275.                 W_FirePipeBomb();
  1276.         if(self.impulse == 62)
  1277.                 DetPipeBombs();
  1278.         if ((self.impulse == 200) || (self.impulse == 201))
  1279.         {
  1280.                 if ( (self.flags & FL_ATTACKED) && (teamplay) )
  1281.                 {
  1282.                         self.classname = "skinchange";
  1283.                         T_Damage (self, self, self, 50000);
  1284.                         return;
  1285.                 }else if (self.impulse == 200)
  1286.         {
  1287.                         self.skin = self.skin + 1;
  1288.                         if (self.skin == 18) self.skin = 0;
  1289.                 } else if (self.impulse == 201)
  1290.         {
  1291.                         self.skin = self.skin - 1;
  1292.                         if (self.skin == -1) self.skin = 17;
  1293.         }
  1294.                 if (self.skin == 0) sprint(self, "SKIN: Quake himself (1)\n"); else
  1295.                 if (self.skin == 1) sprint(self,"SKIN: BioMan (2)\n"); else
  1296.                 if (self.skin == 2) sprint(self, "SKIN: Duke Nukem 3d (3)\n"); else
  1297.                 if (self.skin == 3) sprint(self,"SKIN: NYPD Cop (4)\n"); else
  1298.                 if (self.skin == 4) sprint(self,"SKIN: Mr. Rage (5)\n"); else
  1299.                 if (self.skin == 5) sprint(self,"SKIN: MoleMan (6)\n"); else
  1300.                 if (self.skin == 6) sprint(self,"SKIN: The Evil Eye (7)\n"); else
  1301.                 if (self.skin == 7) sprint(self,"SKIN: Ninja (8)\n"); else
  1302.                 if (self.skin == 8) sprint(self, "SKIN: Mr. Toad (9)\n"); else
  1303.                 if (self.skin == 9) sprint(self,"SKIN: the Predator (10)\n"); else
  1304.                 if (self.skin == 10) sprint(self, "SKIN: Judge Dredd (11)\n"); else
  1305.                 if (self.skin == 11) sprint(self, "SKIN: the Terminator (12)\n"); else
  1306.                 if (self.skin == 12) sprint(self, "SKIN: C-3PO (13)\n"); else
  1307.                 if (self.skin == 13) sprint(self, "SKIN: the Stormtrooper (14)\n"); else
  1308.                 if (self.skin == 14) sprint(self,"SKIN: Boba (15)\n"); else
  1309.                 if (self.skin == 15) sprint(self, "SKIN: Bossk (16)\n"); else
  1310.                 if (self.skin == 16) sprint(self,"SKIN: Han Solo (17)\n"); else
  1311.                 if (self.skin == 17) sprint(self,"SKIN: Crusader (18)\n"); 
  1312.     }
  1313.         if (self.impulse == 255)
  1314.                 QuadCheat ();
  1315.         self.impulse = 0;
  1316. };
  1317.  
  1318. void() W_WeaponFrame =
  1319. {
  1320.     if (time < self.attack_finished)
  1321.         return;
  1322.  
  1323.     ImpulseCommands ();
  1324.     
  1325.     if (self.button0)
  1326.     {
  1327.         SuperDamageSound ();
  1328.         W_Attack ();
  1329.     }
  1330. };
  1331.  
  1332. void() SuperDamageSound =
  1333. {
  1334.     if (self.super_damage_finished > time)
  1335.     {
  1336.         if (self.super_sound < time)
  1337.         {
  1338.             self.super_sound = time + 1;
  1339.             sound (self, CHAN_BODY, "items/damage3.wav", 1, ATTN_NORM);
  1340.         }
  1341.     }
  1342.     return;
  1343. };
  1344.