home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / mhfsv22 / weapons.qc < prev    next >
Encoding:
Text File  |  1996-08-25  |  62.2 KB  |  2,934 lines

  1. /*
  2. */
  3.  
  4. void (entity targ, entity inflictor, entity attacker, float damage) T_Damage;
  5. void () player_run;
  6. void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage;
  7. void(vector org, vector vel, float damage) SpawnBlood;
  8. void() SuperDamageSound;
  9. void(vector org, vector dir) launch_spike;
  10. float    modelindex_eyes, modelindex_player;
  11. void() respawn;
  12.  
  13. // called by worldspawn
  14. void() W_Precache =
  15. {
  16.     precache_sound ("weapons/r_exp3.wav");  // new rocket explosion
  17.     precache_sound ("weapons/rocket1i.wav");        // spike gun
  18.     precache_sound ("weapons/sgun1.wav");
  19.     precache_sound ("weapons/guncock.wav"); // player shotgun
  20.     precache_sound ("weapons/ric1.wav");    // ricochet (used in c code)
  21.     precache_sound ("weapons/ric2.wav");    // ricochet (used in c code)
  22.     precache_sound ("weapons/ric3.wav");    // ricochet (used in c code)
  23.     precache_sound ("weapons/spike2.wav");  // super spikes
  24.     precache_sound ("weapons/tink1.wav");   // spikes tink (used in c code)
  25.     precache_sound ("weapons/grenade.wav"); // grenade launcher
  26.     precache_sound ("weapons/bounce.wav");          // grenade bounce
  27.     precache_sound ("weapons/shotgn2.wav"); // super shotgun
  28.     precache_sound ("items/inv3.wav");
  29.     precache_model ("progs/eyes.mdl");
  30.     precache_model ("progs/player.mdl");
  31.  
  32. // Begin Pulse Cannon Precache
  33.       precache_model ("progs/laser.mdl");
  34.     precache_sound ("enforcer/enfire.wav");        // Laser Rifle
  35.     precache_sound ("enforcer/enfstop.wav");       // Laser Rifle
  36. // End Pulse Cannon Precache
  37.     precache_model ("progs/k_spike.mdl");
  38.     precache_sound ("hknight/attack1.wav");
  39. };
  40.  
  41. float() crandom =
  42. {
  43.     return 2*(random() - 0.5);
  44. };
  45.  
  46. /*
  47. ================
  48. W_FireAxe
  49. ================
  50. */
  51. void() W_FireAxe =
  52. {
  53.     local   vector  source;
  54.     local   vector  org;
  55.  
  56.     source = self.origin + '0 0 16';
  57.     traceline (source, source + v_forward*64, FALSE, self);
  58.     if (trace_fraction == 1.0)
  59.         return;
  60.     
  61.     org = trace_endpos - v_forward*4;
  62.  
  63.     if (trace_ent.takedamage)
  64.     {
  65.         trace_ent.axhitme = 1;
  66.         SpawnBlood (org, '0 0 0', 20);
  67.         T_Damage (trace_ent, self, self, 20);
  68.     }
  69.     else
  70.     {       // hit wall
  71.         sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
  72.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  73.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  74.         WriteCoord (MSG_BROADCAST, org_x);
  75.         WriteCoord (MSG_BROADCAST, org_y);
  76.         WriteCoord (MSG_BROADCAST, org_z);
  77.     }
  78. };
  79.  
  80.  
  81.  
  82.  
  83. void() W_Mario =
  84. {
  85.  
  86.     SuperDamageSound ();
  87.     T_RadiusDamage (self, self.owner, 120, self);
  88.     
  89.  
  90.  
  91. };
  92.  
  93. //============================================================================
  94.  
  95.  
  96. vector() wall_velocity =
  97. {
  98.     local vector    vel;
  99.     
  100.     vel = normalize (self.velocity);
  101.     vel = normalize(vel + v_up*(random()- 0.5) + v_right*(random()- 0.5));
  102.     vel = vel + 2*trace_plane_normal;
  103.     vel = vel * 200;
  104.     
  105.     return vel;
  106. };
  107.  
  108.  
  109. /*
  110. ================
  111. SpawnMeatSpray
  112. ================
  113. */
  114. void(vector org, vector vel) SpawnMeatSpray =
  115. {
  116.     local   entity missile, mpuff;
  117.     local   vector  org;
  118.  
  119.     missile = spawn ();
  120.     missile.owner = self;
  121.     missile.movetype = MOVETYPE_BOUNCE;
  122.     missile.solid = SOLID_NOT;
  123.  
  124.     makevectors (self.angles);
  125.  
  126.     missile.velocity = vel;
  127.     missile.velocity_z = missile.velocity_z + 250 + 50*random();
  128.  
  129.     missile.avelocity = '3000 1000 2000';
  130.     
  131. // set missile duration
  132.     missile.nextthink = time + 1;
  133.     missile.think = SUB_Remove;
  134.  
  135.     setmodel (missile, "progs/zom_gib.mdl");
  136.     setsize (missile, '0 0 0', '0 0 0');            
  137.     setorigin (missile, org);
  138. };
  139.  
  140. /*
  141. ================
  142. SpawnBlood
  143. ================
  144. */
  145. void(vector org, vector vel, float damage) SpawnBlood =
  146. {
  147.     particle (org, vel*0.1, 73, damage*2);
  148. };
  149.  
  150. /*
  151. ================
  152. spawn_touchblood
  153. ================
  154. */
  155. void(float damage) spawn_touchblood =
  156. {
  157.     local vector    vel;
  158.  
  159.     vel = wall_velocity () * 0.2;
  160.     SpawnBlood (self.origin + vel*0.01, vel, damage);
  161. };
  162.  
  163.  
  164. /*
  165. ================
  166. SpawnChunk
  167. ================
  168. */
  169. void(vector org, vector vel) SpawnChunk =
  170. {
  171.     particle (org, vel*0.02, 0, 10);
  172. };
  173.  
  174. /*
  175. ==============================================================================
  176.  
  177. MULTI-DAMAGE
  178.  
  179. Collects multiple small damages into a single damage
  180.  
  181. ==============================================================================
  182. */
  183.  
  184. entity  multi_ent;
  185. float   multi_damage;
  186.  
  187. void() ClearMultiDamage =
  188. {
  189.     multi_ent = world;
  190.     multi_damage = 0;
  191. };
  192.  
  193. void() ApplyMultiDamage =
  194. {
  195.     if (!multi_ent)
  196.         return;
  197.     T_Damage (multi_ent, self, self, multi_damage);
  198. };
  199.  
  200. void(entity hit, float damage) AddMultiDamage =
  201. {
  202.     if (!hit)
  203.         return;
  204.     
  205.     if (hit != multi_ent)
  206.     {
  207.         ApplyMultiDamage ();
  208.         multi_damage = damage;
  209.         multi_ent = hit;
  210.     }
  211.     else
  212.         multi_damage = multi_damage + damage;
  213. };
  214.  
  215. /*
  216. ==============================================================================
  217.  
  218. BULLETS
  219.  
  220. ==============================================================================
  221. */
  222.  
  223. /*
  224. ================
  225. TraceAttack
  226. ================
  227. */
  228. void(float damage, vector dir) TraceAttack =
  229. {
  230.     local   vector  vel, org;
  231.     
  232.     vel = normalize(dir + v_up*crandom() + v_right*crandom());
  233.     vel = vel + 2*trace_plane_normal;
  234.     vel = vel * 200;
  235.  
  236.     org = trace_endpos - dir*4;
  237.  
  238.     if (trace_ent.takedamage)
  239.     {
  240.         SpawnBlood (org, vel*0.2, damage);
  241.         AddMultiDamage (trace_ent, damage);
  242.     }
  243.     else
  244.     {
  245.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  246.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  247.         WriteCoord (MSG_BROADCAST, org_x);
  248.         WriteCoord (MSG_BROADCAST, org_y);
  249.         WriteCoord (MSG_BROADCAST, org_z);
  250.     }
  251. };
  252.  
  253. /*
  254. ================
  255. FireBullets
  256.  
  257. Used by shotgun, super shotgun, and enemy soldier firing
  258. Go to the trouble of combining multiple pellets into a single damage call.
  259. ================
  260. */
  261. void(float shotcount, vector dir, vector spread) FireBullets =
  262. {
  263.     local   vector direction;
  264.     local   vector  src;
  265.     
  266.     makevectors(self.v_angle);
  267.  
  268.     src = self.origin + v_forward*10;
  269.     src_z = self.absmin_z + self.size_z * 0.7;
  270.  
  271.     ClearMultiDamage ();
  272.     while (shotcount > 0)
  273.     {
  274.         direction = dir + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
  275.  
  276.         traceline (src, src + direction*2048, FALSE, self);
  277.         if (trace_fraction != 1.0)
  278.             TraceAttack (4, direction);
  279.  
  280.         shotcount = shotcount - 1;
  281.     }
  282.     ApplyMultiDamage ();
  283. };
  284.  
  285. /*
  286. ================
  287. W_FireShotgun
  288. ================
  289. */
  290. void() W_FireShotgun =
  291. {
  292.     local vector dir;
  293.  
  294.     sound (self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM); 
  295.  
  296.     self.punchangle_x = -2;
  297. //    if (self.u_ammo != 1)
  298. //        self.currentammo = self.ammo_shells = self.ammo_shells - 1;
  299.     dir = aim (self, 100000);
  300.     FireBullets (3, dir, '0.06 0.04 0');
  301. };
  302.  
  303.  
  304. /*
  305. ================
  306. W_FireSuperShotgun
  307. ================
  308. */
  309. void() W_FireSuperShotgun =
  310. {
  311.     local vector dir;
  312.  
  313. //    if (self.currentammo == 1)
  314. //    {
  315. //        W_FireShotgun ();
  316. //        return;
  317. //    }
  318.         
  319.     sound (self ,CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM); 
  320.  
  321.     self.punchangle_x = -4;
  322. //    if (self.u_ammo != 1)
  323. //        self.currentammo = self.ammo_shells = self.ammo_shells - 2;
  324.     dir = aim (self, 100000);
  325.     FireBullets (16, dir, '0.20 0.10 0');
  326. };
  327.  
  328.  
  329. /*
  330. ==============================================================================
  331.  
  332. ROCKETS
  333. Built in Rocket Functions
  334. ==============================================================================
  335. */
  336.  
  337. void()  s_explode1      =       [0,             s_explode2] {};
  338. void()  s_explode2      =       [1,             s_explode3] {};
  339. void()  s_explode3      =       [2,             s_explode4] {};
  340. void()  s_explode4      =       [3,             s_explode5] {};
  341. void()  s_explode5      =       [4,             s_explode6] {};
  342. void()  s_explode6      =       [5,             SUB_Remove] {};
  343.  
  344. void()      player_rock1;
  345. void()      player_rock2;
  346.  
  347.  
  348. void() BecomeExplosion =
  349. {
  350.     self.movetype = MOVETYPE_NONE;
  351.     self.velocity = '0 0 0';
  352.     self.touch = SUB_Null;
  353.     setmodel (self, "progs/s_explod.spr");
  354.     self.solid = SOLID_NOT;
  355.     s_explode1 ();
  356. };
  357.  
  358. void() T_RocketTouch =
  359. {
  360.     local float     damg;
  361.  
  362.     if (other == self.owner)
  363.         return;         // don't explode on owner
  364.  
  365.     if (pointcontents(self.origin) == CONTENT_SKY)
  366.     {
  367.         remove(self);
  368.         return;
  369.     }
  370.  
  371.     damg = 100 + random()*20;
  372.     
  373.     if (other.health)
  374.     {
  375.         if (other.classname == "monster_shambler")
  376.             damg = damg * 0.5;      // mostly immune
  377.         T_Damage (other, self, self.owner, damg );
  378.     }
  379.  
  380.     // don't do radius damage to the other, because all the damage
  381.     // was done in the impact
  382.     T_RadiusDamage (self, self.owner, 120, other);
  383.  
  384. //      sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  385.     self.origin = self.origin - 8*normalize(self.velocity);
  386.  
  387.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  388.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  389.     WriteCoord (MSG_BROADCAST, self.origin_x);
  390.     WriteCoord (MSG_BROADCAST, self.origin_y);
  391.     WriteCoord (MSG_BROADCAST, self.origin_z);
  392.  
  393.     BecomeExplosion ();
  394. };
  395.  
  396.  
  397.  
  398. /*
  399. ================
  400. W_FireRocket
  401. ================
  402. */
  403. void() W_FireRocket =
  404. {
  405.     local   entity missile, mpuff;
  406.     
  407.     self.currentammo = self.ammo_rockets = self.ammo_rockets - 2;
  408.     
  409.     sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
  410.  
  411.     self.punchangle_x = -2;
  412.  
  413.     missile = spawn ();
  414.     missile.owner = self;
  415.     missile.movetype = MOVETYPE_FLYMISSILE;
  416.     missile.solid = SOLID_BBOX;
  417.         
  418. // set missile speed    
  419.  
  420.     makevectors (self.v_angle);
  421.     missile.velocity = aim(self, 1000);
  422.     missile.velocity = missile.velocity * 1000;
  423.     missile.angles = vectoangles(missile.velocity);
  424.     
  425.     missile.touch = T_RocketTouch;
  426.     
  427. // set missile duration
  428.     missile.nextthink = time + 5;
  429.     missile.think = SUB_Remove;
  430.  
  431.     setmodel (missile, "progs/missile.mdl");
  432.     setsize (missile, '0 0 0', '0 0 0');            
  433.     setorigin (missile, self.origin + v_forward*8 + '0 0 16');
  434. };
  435.  
  436. void() T_RocketTouch2 =
  437. {
  438.     local float     damg;
  439.  
  440.     if (other == self.owner)
  441.         return;         // don't explode on owner
  442.  
  443.     if (pointcontents(self.origin) == CONTENT_SKY)
  444.     {
  445.         remove(self);
  446.         return;
  447.     }
  448.  
  449.     damg = 25 + random()*10;
  450.     
  451.     if (other.health)
  452.     {
  453.         if (other.classname == "monster_shambler")
  454.             damg = damg * 0.5;      // mostly immune
  455.         T_Damage (other, self, self.owner, damg );
  456.     }
  457.  
  458.     // don't do radius damage to the other, because all the damage
  459.     // was done in the impact
  460.     T_RadiusDamage (self, self.owner, 30, other);
  461.  
  462.     sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  463. //      self.origin = self.origin - 8*normalize(self.velocity);
  464.  
  465. //    WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  466. //      WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  467. //      WriteCoord (MSG_BROADCAST, self.origin_x);
  468. //      WriteCoord (MSG_BROADCAST, self.origin_y);
  469. //      WriteCoord (MSG_BROADCAST, self.origin_z);
  470.  
  471.     BecomeExplosion ();
  472. };
  473.  
  474. void() T_MissileTouch =
  475. {
  476.     local float     damg;
  477.  
  478.     if (other == self.owner)
  479.         return;         // don't explode on owner
  480.  
  481.     if (pointcontents(self.origin) == CONTENT_SKY)
  482.     {
  483.         remove(self);
  484.         return;
  485.     }
  486.  
  487. //    damg = 80 + random()*20;
  488.     damg = self.life + random()*20;
  489.     
  490.     if (other.health)
  491.     {
  492.         if (other.classname == "monster_shambler")
  493.             damg = damg * 0.5;      // mostly immune
  494.         T_Damage (other, self, self.owner, damg );
  495.     }
  496.  
  497.     // don't do radius damage to the other, because all the damage
  498.     // was done in the impact
  499.     T_RadiusDamage (self, self.owner, 40, other);
  500.  
  501. //      sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  502.     self.origin = self.origin - 8*normalize(self.velocity);
  503.  
  504.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  505.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  506.     WriteCoord (MSG_BROADCAST, self.origin_x);
  507.     WriteCoord (MSG_BROADCAST, self.origin_y);
  508.     WriteCoord (MSG_BROADCAST, self.origin_z);
  509.  
  510.     BecomeExplosion ();
  511. };
  512.  
  513.  
  514.  
  515. /*
  516. ================
  517. W_FireMissle
  518.                 Homing Missles v.005
  519.                 ~~~~~~~~~~~~~~~~~~~~
  520. Authors: Lynx (briggsj@lurch.ball.com)
  521.      Dumont (pjsmith@ix.netcom.com)       
  522.  
  523. Credits: based on Homing Missiles v.001
  524.         by Vhold <vhold@netwizards.net> 
  525.         http://netwizards.net/~vhold/
  526.  
  527.  
  528. ================
  529. */
  530. void()   HomeThink;
  531. entity() HomeFindTarget;
  532. float(entity targ) visible;
  533. float(entity targ) infront;
  534.  
  535. void() W_FireMissle =
  536. {
  537.     local   entity missile, mpuff;
  538.       if (self.ammo_rockets < 5)
  539.     {         
  540.     player_rock1();
  541.         return;
  542.     }
  543.     if (self.u_ammo != 1)
  544.         self.currentammo = self.ammo_rockets = self.ammo_rockets - 5;
  545.     
  546.     sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
  547.  
  548.     self.punchangle_x = -2;
  549.  
  550.     missile = spawn ();
  551.     missile.owner = self;
  552.     missile.movetype = MOVETYPE_FLYMISSILE;
  553.     missile.solid = SOLID_BBOX;
  554.         
  555. // set missile speed    
  556.  
  557.     makevectors (self.v_angle);
  558.     missile.velocity = aim(self, 1000);
  559.     missile.velocity = missile.velocity * 450;
  560.     missile.angles = vectoangles(missile.velocity);
  561.  
  562.     missile.life = 100;
  563.     
  564.     missile.touch = T_MissileTouch;
  565.     
  566. // set missile duration
  567. //      missile.nextthink = time + 1;
  568. //      missile.think = SUB_Remove;
  569.  
  570.     missile.nextthink = time + 0.25;
  571.     missile.think = HomeThink;
  572.     missile.enemy = world;
  573.  
  574.     setmodel (missile, "progs/missile.mdl");
  575.     setsize (missile, '0 0 0', '0 0 0');            
  576.     setorigin (missile, self.origin + v_forward*8 + '0 0 16');
  577. };
  578.  
  579. entity() HomeFindTarget = 
  580. {
  581.     local entity head, selected;
  582.     local float dist;
  583.     dist = 100000;
  584.     selected = world;
  585.     head = findradius(self.origin, 250);
  586.     while(head)
  587.     {
  588.         if( (head.health > 1) && (head != self) && (head != self.owner) )
  589.         {
  590.             traceline(self.origin,head.origin,TRUE,self);
  591.             if ( (trace_fraction >= 1) && (vlen(head.origin - self.origin) < dist) )
  592.             {
  593.                 selected = head;
  594.                 dist = vlen(head.origin - self.origin);
  595.             }
  596.         }               
  597.         head = head.chain;
  598.     }
  599.     if (selected != world)
  600.     {
  601.         sprint (self.owner,"Homing->");
  602.         if (selected.classname == "player")
  603.         {
  604.             sprint (self.owner,selected.netname);
  605.             sprint (selected,self.owner.netname);
  606.             sprint (selected," has a bogey on you!\n");
  607.         }
  608.         else
  609.         {
  610.             sprint (self.owner,selected.classname);
  611.         }
  612.         sprint (self.owner,"\n");
  613.     }
  614.     return selected;
  615. };
  616.  
  617. void() HomeThink =
  618. {
  619.     local vector dir, olddir, vtemp;
  620.     local float turnrate;
  621.  
  622.     turnrate= 0.3;
  623.     if ( !(self.enemy) || (self.enemy == world) || (self.enemy.health < 1) )
  624.         self.enemy = HomeFindTarget();
  625.  
  626.     if (self.enemy != world) // Arr.. don't be taken on da World!
  627.     {
  628.         vtemp = self.enemy.origin + '0 0 10';
  629.         olddir = normalize(self.velocity);
  630.         dir = normalize(vtemp - self.origin);
  631.         //Limits the turnrate of the rockets
  632.         if (olddir_x - dir_x > turnrate)
  633.             dir_x = olddir_x - turnrate;
  634.         if (olddir_x - dir_x < -1 * turnrate)
  635.             dir_x = olddir_x + turnrate;
  636.         if (olddir_y - dir_y > turnrate)
  637.             dir_y = olddir_y - turnrate;
  638.         if (olddir_y - dir_y < -1 * turnrate)
  639.             dir_y = olddir_y + turnrate;
  640.         if (olddir_z - dir_z > turnrate)
  641.             dir_z = olddir_z - turnrate;
  642.         if (olddir_z - dir_z < -1 * turnrate)
  643.             dir_z = olddir_z + turnrate;
  644.         self.velocity = dir * 230;
  645.         self.angles = vectoangles(self.velocity);
  646.         self.life = self.life - 2;
  647.     }
  648.  
  649.     if (self.life < 5)
  650.         {
  651.         self.enemy = world;
  652.         T_MissileTouch;
  653.         }
  654.     self.nextthink = time + 0.1;
  655.     self.think=HomeThink;
  656. };
  657.  
  658. /*
  659.  
  660. /*
  661. ===============================================================================
  662.  
  663. LIGHTNING
  664.  
  665. ===============================================================================
  666. */
  667.  
  668. /*
  669. =================
  670. LightningDamage
  671. =================
  672. */
  673. void(vector p1, vector p2, entity from, float damage) LightningDamage =
  674. {
  675.     local entity            e1, e2;
  676.     local vector            f;
  677.     
  678.     f = p2 - p1;
  679.     normalize (f);
  680.     f_x = 0 - f_y;
  681.     f_y = f_x;
  682.     f_z = 0;
  683.     f = f*16;
  684.  
  685.     e1 = e2 = world;
  686.  
  687.     traceline (p1, p2, FALSE, self);
  688.     if (trace_ent.takedamage)
  689.     {
  690.         particle (trace_endpos, '0 0 100', 225, damage*4);
  691.         T_Damage (trace_ent, from, from, damage);
  692.         if (self.classname == "player")
  693.         {
  694.             if (other.classname == "player")
  695.                 trace_ent.velocity_z = trace_ent.velocity_z + 400;
  696.         }
  697.     }
  698.     e1 = trace_ent;
  699.  
  700.     traceline (p1 + f, p2 + f, FALSE, self);
  701.     if (trace_ent != e1 && trace_ent.takedamage)
  702.     {
  703.         particle (trace_endpos, '0 0 100', 225, damage*4);
  704.         T_Damage (trace_ent, from, from, damage);
  705.     }
  706.     e2 = trace_ent;
  707.  
  708.     traceline (p1 - f, p2 - f, FALSE, self);
  709.     if (trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage)
  710.     {
  711.         particle (trace_endpos, '0 0 100', 225, damage*4);
  712.         T_Damage (trace_ent, from, from, damage);
  713.     }
  714. };
  715.  
  716.  
  717. void() W_FireLightning =
  718. {
  719.     local   vector          org;
  720.  
  721.     if (self.ammo_cells < 1)
  722.     {
  723.         self.weapon = W_BestWeapon ();
  724.         W_SetCurrentAmmo ();
  725.         return;
  726.     }
  727.  
  728. // explode if under water
  729.     if (self.waterlevel > 1)
  730.     {
  731.         T_RadiusDamage (self, self, 35*self.ammo_cells, world);
  732.         self.ammo_cells = 0;
  733.         W_SetCurrentAmmo ();
  734.         return;
  735.     }
  736.  
  737.     if (self.t_width < time)
  738.     {
  739.         sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
  740.         self.t_width = time + 0.6;
  741.     }
  742.     self.punchangle_x = -2;
  743.     if (self.u_ammo != 1)
  744.         self.currentammo = self.ammo_cells = self.ammo_cells - 1;
  745.  
  746.     org = self.origin + '0 0 16';
  747.     
  748.     traceline (org, org + v_forward*600, TRUE, self);
  749.  
  750.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  751.     WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
  752.     WriteEntity (MSG_BROADCAST, self);
  753.     WriteCoord (MSG_BROADCAST, org_x);
  754.     WriteCoord (MSG_BROADCAST, org_y);
  755.     WriteCoord (MSG_BROADCAST, org_z);
  756.     WriteCoord (MSG_BROADCAST, trace_endpos_x);
  757.     WriteCoord (MSG_BROADCAST, trace_endpos_y);
  758.     WriteCoord (MSG_BROADCAST, trace_endpos_z);
  759.  
  760.     LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
  761. };
  762.  
  763.  
  764. //=============================================================================
  765. //GRENADES
  766. //=============================================================================
  767.  
  768. void() GrenadeExplode =
  769. {
  770.     T_RadiusDamage (self, self.owner, 120, world);
  771.  
  772.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  773.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  774.     WriteCoord (MSG_BROADCAST, self.origin_x);
  775.     WriteCoord (MSG_BROADCAST, self.origin_y);
  776.     WriteCoord (MSG_BROADCAST, self.origin_z);
  777.  
  778.     BecomeExplosion ();
  779. };
  780.  
  781. void() GrenadeTouch =
  782. {
  783.     if (other == self.owner)
  784.         return;         // don't explode on owner
  785.     if (other.takedamage == DAMAGE_AIM)
  786.     {
  787.         GrenadeExplode();
  788.         return;
  789.     }
  790.     sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);  // bounce sound
  791.     if (self.velocity == '0 0 0')
  792.         self.avelocity = '0 0 0';
  793. };
  794.  
  795. /*
  796. ================
  797. W_FireGrenade
  798. ================
  799. */
  800. void() W_FireGrenade =
  801. {
  802.     local   entity missile, mpuff;
  803.     if (self.u_ammo != 1)
  804.         self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  805.     
  806.     sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  807.  
  808.     self.punchangle_x = -2;
  809.  
  810.     missile = spawn ();
  811.     missile.owner = self;
  812.     missile.movetype = MOVETYPE_BOUNCE;
  813.     missile.solid = SOLID_BBOX;
  814.     missile.classname = "grenade";
  815.         
  816. // set missile speed    
  817.  
  818.     makevectors (self.v_angle);
  819.  
  820.     if (self.v_angle_x)
  821.         missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
  822.     else
  823.     {
  824.         missile.velocity = aim(self, 10000);
  825.         missile.velocity = missile.velocity * 600;
  826.         missile.velocity_z = 200;
  827.     }
  828.  
  829.     missile.avelocity = '300 300 300';
  830.  
  831.     missile.angles = vectoangles(missile.velocity);
  832.     
  833.     missile.touch = GrenadeTouch;
  834.     
  835. // set missile duration
  836.     missile.nextthink = time + 2.5;
  837.     missile.think = GrenadeExplode;
  838.  
  839.     setmodel (missile, "progs/grenade.mdl");
  840.     setsize (missile, '0 0 0', '0 0 0');            
  841.     setorigin (missile, self.origin);
  842. };
  843.  
  844.  
  845. //=============================================================================
  846.  
  847. void() spike_touch;
  848. void() superspike_touch;
  849.  
  850.  
  851. /*
  852. ===============
  853. launch_spike
  854.  
  855. Used for both the player and the ogre
  856. ===============
  857. */
  858. void(vector org, vector dir) launch_spike =
  859. {
  860.     newmis = spawn ();
  861.     newmis.owner = self;
  862.     newmis.movetype = MOVETYPE_FLYMISSILE;
  863.     newmis.solid = SOLID_BBOX;
  864.  
  865.     newmis.angles = vectoangles(dir);
  866.     
  867.     newmis.touch = spike_touch;
  868.     newmis.classname = "spike";
  869.     newmis.think = SUB_Remove;
  870.     newmis.nextthink = time + 6;
  871.     setmodel (newmis, "progs/spike.mdl");
  872.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);               
  873.     setorigin (newmis, org);
  874.  
  875.     newmis.velocity = dir * 1200;
  876. };
  877.  
  878. void() W_FireSuperSpikes =
  879. {
  880.     local vector    dir;
  881.     local entity    old;
  882.     
  883.     sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
  884.     self.attack_finished = time + 0.2;
  885.     if (self.u_ammo != 1)
  886.         self.currentammo = self.ammo_nails = self.ammo_nails - 2;
  887.     dir = aim (self, 1000);
  888.     launch_spike (self.origin + '0 0 16', dir);
  889.     newmis.touch = superspike_touch;
  890.     setmodel (newmis, "progs/s_spike.mdl");
  891.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);               
  892.     self.punchangle_x = -2;
  893. };
  894.  
  895. void(float ox) W_FireSpikes =
  896. {
  897.     local vector    dir;
  898.     local entity    old;
  899.     
  900.     makevectors (self.v_angle);
  901.     
  902.     if (self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN)
  903.     {
  904.         W_FireSuperSpikes ();
  905.         return;
  906.     }
  907.  
  908.     if (self.ammo_nails < 1)
  909.     {
  910.         self.weapon = W_BestWeapon ();
  911.         W_SetCurrentAmmo ();
  912.         return;
  913.     }
  914.  
  915.     sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
  916.     self.attack_finished = time + 0.2;
  917.     if (self.u_ammo != 1)
  918.         self.currentammo = self.ammo_nails = self.ammo_nails - 1;
  919.     dir = aim (self, 1000);
  920.     launch_spike (self.origin + '0 0 16' + v_right*ox, dir);
  921.  
  922.     self.punchangle_x = -2;
  923. };
  924.  
  925.  
  926. .float hit_z;
  927. void() spike_touch =
  928. {
  929. local float rand;
  930.     if (other == self.owner)
  931.         return;
  932.  
  933.     if (other.solid == SOLID_TRIGGER)
  934.         return; // trigger field, do nothing
  935.  
  936.     if (pointcontents(self.origin) == CONTENT_SKY)
  937.     {
  938.         remove(self);
  939.         return;
  940.     }
  941.     
  942. // hit something that bleeds
  943.     if (other.takedamage)
  944.     {
  945.         spawn_touchblood (9);
  946.         T_Damage (other, self, self.owner, 9);
  947.     }
  948.     else
  949.     {
  950.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  951.         
  952.         if (self.classname == "wizspike")
  953.             WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
  954.         else if (self.classname == "knightspike")
  955.             WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
  956.         else
  957.             WriteByte (MSG_BROADCAST, TE_SPIKE);
  958.         WriteCoord (MSG_BROADCAST, self.origin_x);
  959.         WriteCoord (MSG_BROADCAST, self.origin_y);
  960.         WriteCoord (MSG_BROADCAST, self.origin_z);
  961.     }
  962.  
  963.     remove(self);
  964.  
  965. };
  966.  
  967. void() superspike_touch =
  968. {
  969. local float rand;
  970.     if (other == self.owner)
  971.         return;
  972.  
  973.     if (other.solid == SOLID_TRIGGER)
  974.         return; // trigger field, do nothing
  975.  
  976.     if (pointcontents(self.origin) == CONTENT_SKY)
  977.     {
  978.         remove(self);
  979.         return;
  980.     }
  981.     
  982. // hit something that bleeds
  983.     if (other.takedamage)
  984.     {
  985.         spawn_touchblood (21);
  986.         T_Damage (other, self, self.owner, 21);
  987.     }
  988.     else
  989.     {
  990.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  991.         WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
  992.         WriteCoord (MSG_BROADCAST, self.origin_x);
  993.         WriteCoord (MSG_BROADCAST, self.origin_y);
  994.         WriteCoord (MSG_BROADCAST, self.origin_z);
  995.     }
  996.  
  997.     remove(self);
  998.  
  999. };
  1000.  
  1001. /*
  1002. ==============================================================================
  1003.  
  1004. Laser
  1005.  
  1006. ==============================================================================
  1007. */
  1008.  
  1009. /*
  1010. ================
  1011. W_FirePulseCannon
  1012.  
  1013. ================
  1014. */
  1015.  
  1016. void() Laser_Touch2 =
  1017. {
  1018.     local vector org;
  1019.     
  1020.     if (other == self.owner)
  1021.         return;         // don't explode on owner
  1022.  
  1023.     if (pointcontents(self.origin) == CONTENT_SKY)
  1024.     {
  1025.         remove(self);
  1026.         return;
  1027.     }
  1028.     
  1029.     sound (self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC);
  1030.     org = self.origin - 8*normalize(self.velocity);
  1031.  
  1032.     if (other.health)
  1033.     {
  1034.         SpawnBlood (org, self.velocity*0.2, 20);
  1035.         T_Damage (other, self, self.owner, 20);
  1036.     }
  1037.     else
  1038.     {
  1039.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  1040.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  1041.         WriteCoord (MSG_BROADCAST, org_x);
  1042.         WriteCoord (MSG_BROADCAST, org_y);
  1043.         WriteCoord (MSG_BROADCAST, org_z);
  1044.     }
  1045.     
  1046.     remove(self);   
  1047. };
  1048.  
  1049. void(vector org, vector vec) LaunchLaser2 =
  1050. {
  1051.     local   vector  vec;
  1052.         
  1053.     sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
  1054.     vec = normalize(vec);
  1055.     
  1056.     newmis = spawn();
  1057.     newmis.owner = self;
  1058.     newmis.movetype = MOVETYPE_FLY;
  1059.     newmis.solid = SOLID_BBOX;
  1060.     newmis.effects = EF_DIMLIGHT;
  1061.  
  1062.     setmodel (newmis, "progs/laser.mdl");
  1063.     setsize (newmis, '0 0 0', '0 0 0');             
  1064.  
  1065.     setorigin (newmis, org);
  1066.  
  1067.       newmis.velocity = vec * 800;
  1068.     newmis.angles = vectoangles(newmis.velocity);
  1069.  
  1070.     newmis.nextthink = time + 5;
  1071.     newmis.think = SUB_Remove;
  1072.     newmis.touch = Laser_Touch2;
  1073. };
  1074.  
  1075.  
  1076.  
  1077.  
  1078. /*
  1079. ============
  1080. Start Marmot's Pulse Cannon
  1081. ============
  1082. */
  1083.  
  1084. void()      player_pulse1;
  1085. void()      player_pulse2;
  1086.  
  1087.  
  1088. void(float ox) W_FirePulse =
  1089. {
  1090.     local vector    dir;
  1091.     local entity    old;
  1092.     
  1093.     makevectors (self.v_angle);
  1094.     
  1095.     if (self.ammo_shells < 1)
  1096.     {
  1097.         self.weapon = W_BestWeapon ();
  1098.         W_SetCurrentAmmo ();
  1099.         return;
  1100.     }
  1101.  
  1102.     sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
  1103.     self.attack_finished = time + 0.2;
  1104.  
  1105.     self.punchangle_x = -2;
  1106.     
  1107.     if (self.u_ammo != 1)
  1108.         self.currentammo = self.ammo_shells = self.ammo_shells - 1;
  1109.     dir = aim (self, 100000);
  1110.     LaunchLaser2(self.origin + '0 0 16' + v_right*ox, dir);
  1111. };
  1112.  
  1113. /*
  1114. ============
  1115. End Marmot's Pulse Cannon
  1116. ============
  1117. */
  1118.  
  1119.  
  1120. // ------------------------------------------
  1121. // Pipe Bombs
  1122. //
  1123. // Modifications by AsmodeusB (28/07/96)
  1124. //
  1125. // Bill Lefler 8/1/96 - changed keys to:
  1126. //                                  "IMPULSE 22" - fire pipe bomb
  1127. //                                  "IMPULSE 23" - detonate pipe bomps
  1128. // ------------------------------------------
  1129.  
  1130. //===========================================================================
  1131. // Blow up the toys.  There is a range of 1000 units (pixels?), so you can't
  1132. // go wandering off.
  1133. //===========================================================================
  1134. void() DetPipeBombs =
  1135. {
  1136.     local entity    head;
  1137.  
  1138.     head = findradius (self.origin, 1000);
  1139.     while(head)
  1140.     {
  1141.         if((head.classname == "pipebomb") && (head.owner == self))
  1142.             head.nextthink = time;
  1143.         head = head.chain;
  1144.     }
  1145. };
  1146.  
  1147. //===========================================================================
  1148. // What happens if it touches something
  1149. //===========================================================================
  1150.  
  1151. void() PipeBombTouch =
  1152. {
  1153.  
  1154.     if (other == self.owner)
  1155.         {
  1156.         return;         // don't explode on owner
  1157.         }
  1158.     sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);  // bounce sound
  1159.     if (self.velocity == '0 0 0')
  1160.         self.avelocity = '0 0 0';
  1161. };
  1162.  
  1163.  
  1164.  
  1165.  
  1166. //===========================================================================
  1167. // Fires a pipe bomb.  Can be detonated at any time.  Doesn't need a special
  1168. // weapon selected.
  1169. //===========================================================================
  1170.  
  1171. void() W_FirePipeBomb =
  1172. {
  1173.     local   entity missile, mpuff;
  1174.  
  1175. //    if(self.ammo_rockets < 1)       // have to have ammo
  1176. //      return;
  1177.     if (self.u_ammo != 1)
  1178.         self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  1179.  
  1180.     sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  1181.  
  1182.       self.punchangle_x = -2;
  1183.  
  1184.     missile = spawn ();
  1185.     missile.owner = self;
  1186.     missile.movetype = MOVETYPE_BOUNCE;
  1187.     missile.solid = SOLID_BBOX;
  1188.     missile.classname = "pipebomb";
  1189.  
  1190. // set missile speed
  1191.  
  1192.     makevectors (self.v_angle);
  1193.  
  1194.     if (self.v_angle_x)
  1195.         missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
  1196.     else
  1197.     {
  1198.         missile.velocity = aim(self, 10000);
  1199.         missile.velocity = missile.velocity * 600;
  1200.         missile.velocity_z = 200;
  1201.     }
  1202.  
  1203.     missile.avelocity = '300 300 300';
  1204.  
  1205.     missile.angles = vectoangles(missile.velocity);
  1206.  
  1207.     missile.touch = PipeBombTouch;
  1208.     missile.think = GrenadeExplode;
  1209.  
  1210. //      missile.nextthink = time + 0.3;
  1211. //      missile.think = RichThink;
  1212.  
  1213.     setmodel (missile, "progs/grenade.mdl");
  1214.     setsize (missile, '0 0 0', '0 0 0');
  1215.     setorigin (missile, self.origin);
  1216. };
  1217.  
  1218. /*
  1219. ==================
  1220. End Pipe Bombs
  1221. ==================
  1222. */
  1223.  
  1224. /*
  1225. ================
  1226. Start Marmot's Happy Fun Rocket Pack
  1227. ================
  1228. */
  1229.  
  1230.  
  1231. void(float ox) W_FireRocket2 =
  1232. {
  1233.     local   entity missile;
  1234.     local entity old;
  1235.  
  1236.     sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
  1237.     if (self.u_ammo != 1)
  1238.         self.currentammo = self.ammo_rockets = self.ammo_rockets - 0.5;
  1239.     self.punchangle_x = -2;
  1240.  
  1241.     missile = spawn ();
  1242.     missile.owner = self;
  1243.     missile.movetype = MOVETYPE_FLYMISSILE;
  1244.     missile.solid = SOLID_BBOX;
  1245.         
  1246. // set missile speed    
  1247.  
  1248.     makevectors (self.v_angle);
  1249.     missile.velocity = aim(self, 1200);
  1250.     missile.velocity = missile.velocity * 1200;
  1251.     missile.angles = vectoangles(missile.velocity);
  1252.     
  1253.     missile.touch = T_RocketTouch2;
  1254.     
  1255. // set missile duration
  1256.     missile.nextthink = time + 5;
  1257.     missile.think = SUB_Remove;
  1258.  
  1259.     setmodel (missile, "progs/missile.mdl");
  1260.     setsize (missile, '0 0 0', '0 0 0');
  1261.            
  1262.     setorigin (missile, self.origin + v_forward*8 + v_right*ox + '0 0 8');
  1263.  
  1264. };
  1265.  
  1266. /*
  1267. ================
  1268. End Marmot's Happy Fun Rocket Pack
  1269. ================
  1270. */
  1271.  
  1272. /*
  1273. ===============================================================================
  1274.  
  1275. PLAYER WEAPON USE
  1276.  
  1277. ===============================================================================
  1278. */
  1279.  
  1280. void() W_SetCurrentAmmo =
  1281. {
  1282.     player_run ();          // get out of any weapon firing states
  1283.  
  1284.     self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
  1285.     
  1286.     if (self.weapon == IT_AXE)
  1287.     {
  1288.         self.currentammo = 0;
  1289.         self.weaponmodel = "progs/v_axe.mdl";
  1290.         self.weaponframe = 0;
  1291.     }
  1292.     else if (self.weapon == IT_SHOTGUN)
  1293.     {
  1294. //        self.currentammo = self.ammo_shells;
  1295.         self.currentammo = 0;
  1296.         self.weaponmodel = "progs/v_shot.mdl";
  1297.         self.weaponframe = 0;
  1298.         self.items = self.items;
  1299.     }
  1300.     else if (self.weapon == IT_SUPER_SHOTGUN)
  1301.     {
  1302.         self.currentammo = 0;
  1303. //        self.currentammo = self.ammo_shells;
  1304.         self.weaponmodel = "progs/v_shot2.mdl";
  1305.         self.weaponframe = 0;
  1306.         self.items = self.items;
  1307.     }
  1308.     else if (self.weapon == IT_NAILGUN)
  1309.     {
  1310.         self.currentammo = self.ammo_shells;
  1311.         self.weaponmodel = "progs/v_nail.mdl";
  1312.         self.weaponframe = 0;
  1313.         self.items = self.items | IT_SHELLS;
  1314.     }
  1315.     else if (self.weapon == IT_SUPER_NAILGUN)
  1316.     {
  1317.         self.currentammo = self.ammo_nails;
  1318.         self.weaponmodel = "progs/v_nail2.mdl";
  1319.         self.weaponframe = 0;
  1320.         self.items = self.items | IT_NAILS;
  1321.     }
  1322.     else if ((self.weapon == IT_GRENADE_LAUNCHER) || (self.weapon == IT_PIPE_BOMBS))
  1323.     {
  1324.         self.currentammo = self.ammo_rockets;
  1325.         self.weaponmodel = "progs/v_rock.mdl";
  1326.         self.weaponframe = 0;
  1327.         self.items = self.items | IT_ROCKETS;
  1328.     }
  1329.     else if ((self.weapon == IT_ROCKET_LAUNCHER) || (self.weapon == IT_MISSILE_LAUNCHER) || (self.weapon == IT_ROCKET_OLD))
  1330.     {
  1331.         self.currentammo = self.ammo_rockets;
  1332.         self.weaponmodel = "progs/v_rock2.mdl";
  1333.         self.weaponframe = 0;
  1334.         self.items = self.items | IT_ROCKETS;
  1335.     }
  1336.     else if (self.weapon == IT_LIGHTNING)
  1337.     {
  1338.         self.currentammo = self.ammo_cells;
  1339.         self.weaponmodel = "progs/v_light.mdl";
  1340.         self.weaponframe = 0;
  1341.         self.items = self.items | IT_CELLS;
  1342.     }
  1343.  
  1344.     else
  1345.     {
  1346.         self.currentammo = 0;
  1347.         self.weaponmodel = "";
  1348.         self.weaponframe = 0;
  1349.     }
  1350. };
  1351.  
  1352. float() W_BestWeapon =
  1353. {
  1354.     local   float   it;
  1355.     
  1356.     it = self.items;
  1357.  
  1358.     if(self.ammo_cells >= 1 && (it & IT_LIGHTNING) )
  1359.         return IT_LIGHTNING;
  1360.     else if(self.ammo_nails >= 1 && (it & IT_SUPER_NAILGUN) )
  1361.         return IT_SUPER_NAILGUN;
  1362.     else if(self.ammo_shells >= 1 && (it & IT_NAILGUN) )
  1363.         return IT_NAILGUN;
  1364.     else if(it & IT_SUPER_SHOTGUN) 
  1365.         return IT_SUPER_SHOTGUN;
  1366. //    else if(self.ammo_shells >= 1 && (it & IT_SHOTGUN) )
  1367. //        return IT_SHOTGUN;
  1368.         
  1369. /*
  1370.     if(self.ammo_rockets >= 1 && (it & IT_ROCKET_LAUNCHER) )
  1371.         return IT_ROCKET_LAUNCHER;
  1372.     else if(self.ammo_rockets >= 5 && (it & IT_MISSILE_LAUNCHER) )
  1373.         return IT_MISSILE_LAUNCHER;
  1374.     else if(self.ammo_rockets >= 2 && (it & IT_ROCKET_OLD) )
  1375.         return IT_ROCKET_OLD;
  1376.     else if(self.ammo_rockets >= 1 && (it & IT_GRENADE_LAUNCHER) )
  1377.         return IT_GRENADE_LAUNCHER;
  1378.     else if(self.ammo_rockets >= 1 $$ (it & IT_PIPE_BOMBS) )
  1379.         return IT_PIPE BOMBS;
  1380.  
  1381. */
  1382.  
  1383.     return IT_SHOTGUN;
  1384. };
  1385.  
  1386. float() W_CheckNoAmmo =
  1387. {
  1388.     if (self.currentammo > 0)
  1389.         return TRUE;
  1390.  
  1391.     if (self.weapon == IT_SHOTGUN)
  1392.         return TRUE;
  1393.  
  1394.     if (self.weapon == IT_SUPER_SHOTGUN)
  1395.         return TRUE;    
  1396.  
  1397.     if (self.weapon == IT_AXE)
  1398.         return TRUE;
  1399.     
  1400.     self.weapon = W_BestWeapon ();
  1401.  
  1402.     W_SetCurrentAmmo ();
  1403.     
  1404. // drop the weapon down
  1405.     return FALSE;
  1406. };
  1407.  
  1408. /*
  1409. ============
  1410. W_Attack
  1411.  
  1412. An attack impulse can be triggered now
  1413. ============
  1414. */
  1415. void()  player_axe1;
  1416. void()  player_axeb1;
  1417. void()  player_axec1;
  1418. void()  player_axed1;
  1419. void()  player_shot1;
  1420. void()  player_nail1;
  1421. void()  player_light1;
  1422. void()  player_rocket1;
  1423.  
  1424.  
  1425.  
  1426. void() W_Attack =
  1427. {
  1428.     local   float   r;
  1429.  
  1430.     if (!W_CheckNoAmmo ())
  1431.         return;
  1432.  
  1433.     if (self.observer == 1)
  1434.         return;
  1435.  
  1436.     makevectors     (self.v_angle);                 // calculate forward angle for velocity
  1437.     self.show_hostile = time + 1;   // wake monsters up
  1438.  
  1439.     if (self.weapon == IT_AXE)
  1440.     {
  1441.         sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
  1442.         r = random();
  1443.         if (r < 0.25)
  1444.             player_axe1 ();
  1445.         else if (r<0.5)
  1446.             player_axeb1 ();
  1447.         else if (r<0.75)
  1448.             player_axec1 ();
  1449.         else
  1450.             player_axed1 ();
  1451.         self.attack_finished = time + 0.5;
  1452.     }
  1453.     else if (self.weapon == IT_SHOTGUN)
  1454.     {
  1455.         player_shot1 ();        
  1456.         W_FireShotgun ();
  1457.         self.attack_finished = time + 0.2;
  1458.  
  1459.     }
  1460.     else if (self.weapon == IT_SUPER_SHOTGUN)
  1461.     {
  1462.         player_shot1 ();
  1463.         W_FireSuperShotgun ();
  1464.         self.attack_finished = time + 0.6;
  1465.     }
  1466.     else if (self.weapon == IT_NAILGUN)
  1467.     {
  1468.         player_pulse1 ();
  1469.     }
  1470.     else if (self.weapon == IT_SUPER_NAILGUN)
  1471.     {
  1472.         player_nail1 ();
  1473.     }
  1474.     else if (self.weapon == IT_GRENADE_LAUNCHER)
  1475.     {
  1476.         player_rocket1();
  1477.         W_FireGrenade();
  1478.         self.attack_finished = time + 0.5;
  1479.     }
  1480.     else if (self.weapon == IT_PIPE_BOMBS)
  1481.     {
  1482.         player_rocket1();
  1483.         W_FirePipeBomb();
  1484.         self.attack_finished = time + 0.5;
  1485.     }
  1486.     else if (self.weapon == IT_ROCKET_OLD)
  1487.     {
  1488.         player_rocket1();
  1489.         W_FireRocket();
  1490.         self.attack_finished = time + 0.8;
  1491.     }
  1492.     else if (self.weapon == IT_ROCKET_LAUNCHER)
  1493.     {
  1494.         player_rock1();
  1495.       }
  1496.       else if (self.weapon == IT_MISSILE_LAUNCHER)
  1497.     {
  1498.         player_rocket1();
  1499.         W_FireMissle();
  1500.         self.attack_finished = time + 0.8;
  1501.  
  1502.     }
  1503.     else if (self.weapon == IT_LIGHTNING)
  1504.     {
  1505.         player_light1();
  1506.         self.attack_finished = time + 0.1;
  1507.         sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
  1508.     }
  1509.  
  1510.  
  1511.  
  1512. };
  1513.  
  1514. /*
  1515. ============
  1516. W_ChangeWeapon
  1517.  
  1518. ============
  1519. */
  1520. void() W_ChangeWeapon =
  1521. {
  1522.     local   float   it, am, fl;
  1523.     
  1524.     it = self.items;
  1525.     am = 0;
  1526.     
  1527.     if (self.impulse == 1)
  1528.     {
  1529.         fl = IT_AXE;
  1530.     }
  1531.     else if (self.impulse == 2)
  1532.     {
  1533.         fl = IT_SHOTGUN;
  1534. //        if (self.ammo_shells < 1)
  1535. //            am = 1;
  1536.     }
  1537.     else if (self.impulse == 3)
  1538.     {
  1539.         fl = IT_SUPER_SHOTGUN;
  1540. //        if (self.ammo_shells < 2)
  1541. //            am = 1;
  1542.     }               
  1543.     else if (self.impulse == 4)
  1544.     {
  1545.     
  1546.         fl = IT_NAILGUN;
  1547.         if (self.ammo_shells < 1)
  1548.             am = 1;
  1549.     }
  1550.     else if (self.impulse == 5)
  1551.     {
  1552.         fl = IT_SUPER_NAILGUN;
  1553.         if (self.ammo_nails < 1)
  1554.             am = 1;
  1555.     }
  1556.     else if (self.impulse == 6)
  1557.     {
  1558.         if (self.weapon == IT_GRENADE_LAUNCHER)
  1559.         {
  1560.             self.weapon = IT_PIPE_BOMBS;
  1561.             if (self.ammo_rockets < 1)
  1562.                 am =1;
  1563.             sprint(self,"Pipe Bomb mode\n");
  1564.             return;
  1565.         }  
  1566.         sprint(self,"Grenade Launcher Mode\n");
  1567.         
  1568.         fl = IT_GRENADE_LAUNCHER;
  1569.         if (self.ammo_rockets < 1)
  1570.             am = 1;
  1571.  
  1572.     }
  1573.     else if (self.impulse == 7)
  1574.     {
  1575.  
  1576.         if (self.weapon == IT_ROCKET_LAUNCHER)
  1577.         {
  1578.             self.weapon = IT_MISSILE_LAUNCHER;
  1579.             if (self.ammo_rockets < 5)
  1580.                 am =1;
  1581.             sprint(self,"Homing Missile Mode\n");
  1582.             return;
  1583.         }
  1584.         if (self.weapon == IT_MISSILE_LAUNCHER)
  1585.         {
  1586.             self.weapon = IT_ROCKET_OLD;
  1587.             if (self.ammo_rockets < 2)
  1588.                 am =1;
  1589.             sprint(self,"Rocket Launcher Mode\n");
  1590.             return;
  1591.         }  
  1592.         sprint(self,"Rocket Pod Mode\n");
  1593.         
  1594.         fl = IT_ROCKET_LAUNCHER;
  1595.         if (self.ammo_rockets < 0.5)
  1596.             am = 1;
  1597.  
  1598.     }
  1599.     else if (self.impulse == 8)
  1600.     {
  1601.         fl = IT_LIGHTNING;
  1602.         if (self.ammo_cells < 1)
  1603.             am = 1;
  1604.     }
  1605.  
  1606.     self.impulse = 0;
  1607.     
  1608.     if (!(self.items & fl))
  1609.     {       // don't have the weapon or the ammo
  1610.         sprint (self, "no weapon.\n");
  1611.         return;
  1612.     }
  1613.     
  1614.     if (am)
  1615.     {       // don't have the ammo
  1616.         sprint (self, "not enough ammo.\n");
  1617.         return;
  1618.     }
  1619.  
  1620. //
  1621. // set weapon, set ammo
  1622. //
  1623.     self.weapon = fl;               
  1624.     W_SetCurrentAmmo ();
  1625. };
  1626.  
  1627. /*
  1628. ============
  1629. W_DropWeapon
  1630.  
  1631. ============
  1632. */
  1633. void() Drop_PulseCannon;
  1634. void() Drop_SuperShotgun;
  1635. void() Drop_SuperNailgun;
  1636. void() Drop_RocketLauncher;
  1637. void() Drop_GrenadeLauncher;
  1638. void() Drop_Thunderbolt;
  1639.  
  1640. void() W_DropWeapon =
  1641. {
  1642.     
  1643.     if (self.impulse == 3)
  1644.     {
  1645.         sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  1646.         bprint (self.netname);
  1647.           bprint (" has placed a SuperShotgun onto the level.\n");
  1648.         Drop_SuperShotgun ();
  1649.     }               
  1650.     else if (self.impulse == 4)
  1651.     {
  1652.         sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  1653.         bprint (self.netname);
  1654.           bprint (" has placed a Pulse Cannon onto the level.\n");
  1655.         Drop_PulseCannon ();
  1656.     }
  1657.     else if (self.impulse == 5)
  1658.     {
  1659.         sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  1660.         bprint (self.netname);
  1661.           bprint (" has placed a SuperNailgun onto the level.\n");
  1662.         Drop_SuperNailgun ();
  1663.     }
  1664.     else if (self.impulse == 6)
  1665.     {
  1666.         sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  1667.         bprint (self.netname);
  1668.           bprint (" has placed a Grenade Launcher onto the level.\n");
  1669.         Drop_GrenadeLauncher ();
  1670.     }
  1671.     else if (self.impulse == 7)
  1672.     {
  1673.         sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  1674.         bprint (self.netname);
  1675.           bprint (" has placed a Rocket Launcher onto the level.\n");
  1676.         Drop_RocketLauncher ();
  1677.     }
  1678.     else if (self.impulse == 8)
  1679.     {
  1680.         sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  1681.         bprint (self.netname);
  1682.           bprint (" has placed a Thunderbolt onto the level.\n");
  1683.         Drop_Thunderbolt ();
  1684.     }
  1685.     self.impulse = 0;
  1686.     self.drop = 0;
  1687.  
  1688. };
  1689.  
  1690.  
  1691. /*
  1692. ============
  1693. CheatCommand
  1694. ============
  1695. */
  1696. void() CheatCommand =
  1697. {
  1698.     if (deathmatch || coop)
  1699.     {               
  1700.             return;
  1701.     }
  1702.     else
  1703.     {
  1704.  
  1705.     self.ammo_rockets = 200;
  1706.     self.ammo_nails = 200;
  1707.     self.ammo_shells = 200;
  1708.     self.items = self.items | 
  1709.         IT_AXE |
  1710.         IT_SHOTGUN |
  1711.         IT_SUPER_SHOTGUN |
  1712.         IT_NAILGUN |
  1713.         IT_SUPER_NAILGUN |
  1714.         IT_GRENADE_LAUNCHER |
  1715.         IT_ROCKET_LAUNCHER |
  1716.         IT_KEY1 | IT_KEY2;
  1717.  
  1718.     self.ammo_cells = 200;
  1719.     self.items = self.items | IT_LIGHTNING;
  1720.  
  1721.     self.weapon = IT_ROCKET_LAUNCHER;
  1722.     self.impulse = 0;
  1723.     W_SetCurrentAmmo ();
  1724.     }
  1725. };
  1726.  
  1727. /*
  1728. ===============
  1729. CheatCommand II
  1730. ===============
  1731. */
  1732. void() CheatCommand2 =
  1733. {
  1734.     self.ammo_rockets = 100;
  1735.     self.ammo_nails = 200;
  1736.     self.ammo_shells = 100;
  1737.     self.items = self.items | 
  1738.         IT_AXE |
  1739.         IT_SHOTGUN |
  1740.         IT_SUPER_SHOTGUN |
  1741.         IT_NAILGUN |
  1742.         IT_SUPER_NAILGUN |
  1743.         IT_GRENADE_LAUNCHER |
  1744.         IT_ROCKET_LAUNCHER |
  1745.         IT_KEY1 | IT_KEY2;
  1746.  
  1747.     self.ammo_cells = 200;
  1748.     self.items = self.items | IT_LIGHTNING;
  1749.  
  1750.     self.weapon = IT_ROCKET_LAUNCHER;
  1751.     self.impulse = 0;
  1752.     W_SetCurrentAmmo ();
  1753. };
  1754.  
  1755. /*
  1756. ============
  1757. CycleWeaponCommand
  1758.  
  1759. Go to the next weapon with ammo
  1760. ============
  1761. */
  1762. void() CycleWeaponCommand =
  1763. {
  1764.     local   float   it, am;
  1765.     
  1766.     it = self.items;
  1767.     self.impulse = 0;
  1768.     
  1769.     while (1)
  1770.     {
  1771.         am = 0;
  1772.  
  1773.         if (self.weapon == IT_LIGHTNING)
  1774.         {
  1775.             self.weapon = IT_AXE;
  1776.         }
  1777.         else if (self.weapon == IT_AXE)
  1778.         {
  1779.             self.weapon = IT_SHOTGUN;
  1780. //            if (self.ammo_shells < 1)
  1781. //                am = 1;
  1782.         }
  1783.         else if (self.weapon == IT_SHOTGUN)
  1784.         {
  1785.             self.weapon = IT_SUPER_SHOTGUN;
  1786. //            if (self.ammo_shells < 2)
  1787. //                am = 1;
  1788.         }               
  1789.         else if (self.weapon == IT_SUPER_SHOTGUN)
  1790.         {
  1791.             self.weapon = IT_NAILGUN;
  1792.             if (self.ammo_shells < 1)
  1793.                 am = 1;
  1794.         }
  1795.         else if (self.weapon == IT_NAILGUN)
  1796.         {
  1797.             self.weapon = IT_SUPER_NAILGUN;
  1798.             if (self.ammo_nails < 1)
  1799.                 am = 1;
  1800.         }
  1801.         else if (self.weapon == IT_SUPER_NAILGUN)
  1802.         {
  1803.             self.weapon = IT_GRENADE_LAUNCHER;
  1804.             if (self.ammo_rockets < 1)
  1805.                 am = 1;
  1806.         }
  1807.         else if (self.weapon == IT_GRENADE_LAUNCHER)
  1808.         {
  1809.             self.weapon = IT_PIPE_BOMBS;
  1810.             if (self.ammo_rockets < 1)
  1811.                 am = 1;
  1812.         }
  1813.         else if (self.weapon == IT_PIPE_BOMBS)
  1814.         {
  1815.             self.weapon = IT_ROCKET_LAUNCHER;
  1816.             if (self.ammo_rockets < 0.5)
  1817.                 am = 1;
  1818.         }
  1819.         else if (self.weapon == IT_ROCKET_LAUNCHER)
  1820.         {
  1821.             self.weapon = IT_ROCKET_OLD;
  1822.             if (self.ammo_rockets < 2)
  1823.                 am = 1;
  1824.         }
  1825.         else if (self.weapon == IT_ROCKET_OLD)
  1826.         {
  1827.             self.weapon = IT_MISSILE_LAUNCHER;
  1828.             if (self.ammo_rockets < 5)
  1829.                 am = 1;
  1830.         }
  1831.         else if (self.weapon == IT_MISSILE_LAUNCHER)
  1832.         {
  1833.             self.weapon = IT_LIGHTNING;
  1834.             if (self.ammo_cells < 3)
  1835.                 am = 1;
  1836.         }
  1837.     
  1838.         if ( (self.items & self.weapon) && am == 0)
  1839.         {
  1840.             W_SetCurrentAmmo ();
  1841.             return;
  1842.         }
  1843.     }
  1844.  
  1845. };
  1846.  
  1847. /*
  1848. ============
  1849. ServerflagsCommand
  1850.  
  1851. Just for development
  1852. ============
  1853. */
  1854. void() ServerflagsCommand =
  1855. {
  1856.     serverflags = serverflags * 2 + 1;
  1857. };
  1858.  
  1859. void() QuadCheat =
  1860. {
  1861.     if (deathmatch || coop)
  1862.     {               
  1863.             return;
  1864.     }
  1865.     else
  1866. //              return;
  1867.     {
  1868.     self.super_time = 1;
  1869.     self.super_damage_finished = time + 30;
  1870.     self.items = self.items | IT_QUAD;
  1871. //    dprint ("quad cheat\n");
  1872.     }
  1873. };
  1874.  
  1875.  
  1876. void() Setnoammo =
  1877. {
  1878.     if ((deathmatch) && (self.admin != 3))
  1879.         return;
  1880.     if (self.sysop != 3)
  1881.         return;
  1882.     if (self.u_ammo == 1)
  1883.         {
  1884.         self.u_ammo = 0;
  1885.         sprint (self,"Limited Ammo Mode Engaged\n");
  1886.         bprint (self.netname);
  1887.           bprint (" has left unlimited ammunition mode\n");
  1888.         return;
  1889.         }
  1890.     self.u_ammo = 1;
  1891.     sprint (self,"Unlimited Ammo Mode Engaged\n");
  1892.     bprint (self.netname);
  1893.     bprint (" has entered unlimited ammunition mode\n");
  1894. };
  1895.  
  1896. void() Help =
  1897. {
  1898.         sprint (self, "Impulse Commands available are:\n");
  1899.         sprint (self, "\n");
  1900.         sprint (self, "impulse 23 - detonate pipe bombs\n"); 
  1901.         sprint (self, "impulse 200 - next skin\n");        
  1902.         sprint (self, "impulse 201 - previous skin\n");
  1903.         sprint (self, "impulse 210 - Toggle Mouse Mode\n");
  1904.         sprint (self, "impulse 211 - Toggle between Mouse and Moth modes\n");
  1905.         sprint (self, "\n");
  1906.         sprint (self, "6 and 7 cycle for more weapons\n");
  1907.  
  1908.  
  1909. };
  1910.  
  1911.  
  1912. /*
  1913. ============
  1914. TimeOverride
  1915.  
  1916. ============
  1917. */
  1918.  
  1919. void() TimeOverride =
  1920. {
  1921.     if (self.impulse == 1)
  1922.     {
  1923.         localcmd ("timelimit 10");
  1924.     }               
  1925.     else if (self.impulse == 2)
  1926.     {
  1927.         localcmd ("timelimit 20");
  1928.     }
  1929.     else if (self.impulse == 3)
  1930.     {
  1931.         localcmd ("timelimit 30");
  1932.     }
  1933.     else if (self.impulse == 4)
  1934.     {
  1935.         localcmd ("timelimit 40");
  1936.     }
  1937.     else if (self.impulse == 5)
  1938.     {
  1939.         localcmd ("timelimit 50");
  1940.     }
  1941.     else if (self.impulse == 6)
  1942.     {
  1943.         localcmd ("timelimit 60");
  1944.     }
  1945.  
  1946.     self.impulse = 0;
  1947.     self.set_timelimit = 0;
  1948. };
  1949.  
  1950. /*
  1951. ============
  1952. FragOverride
  1953.  
  1954. ============
  1955. */
  1956.  
  1957. void() FragOverride =
  1958. {
  1959.     if (self.impulse == 1)
  1960.     {
  1961.         localcmd ("fraglimit 10");
  1962.     }               
  1963.     else if (self.impulse == 2)
  1964.     {
  1965.         localcmd ("fraglimit 20");
  1966.     }
  1967.     else if (self.impulse == 3)
  1968.     {
  1969.         localcmd ("fraglimit 30");
  1970.     }
  1971.     else if (self.impulse == 4)
  1972.     {
  1973.         localcmd ("fraglimit 40");
  1974.     }
  1975.     else if (self.impulse == 5)
  1976.     {
  1977.         localcmd ("fraglimit 50");
  1978.     }
  1979.     else if (self.impulse == 6)
  1980.     {
  1981.         localcmd ("fraglimit 60");
  1982.     }
  1983.     else if (self.impulse == 7)
  1984.     {
  1985.         localcmd ("fraglimit 70");
  1986.     }
  1987.     else if (self.impulse == 8)
  1988.     {
  1989.         localcmd ("fraglimit 80");
  1990.     }
  1991.  
  1992.     self.impulse = 0;
  1993.     self.set_fraglimit = 0;
  1994. };
  1995.  
  1996.  
  1997.  
  1998. /*
  1999. ============
  2000. W_WarpEpisode1
  2001.  
  2002. ============
  2003. */
  2004.  
  2005. void() W_WarpEpisode1 =
  2006. {
  2007.     if (self.impulse == 1)
  2008.     {
  2009.         changelevel ("e1m1");
  2010.     }               
  2011.     else if (self.impulse == 2)
  2012.     {
  2013.         changelevel ("e1m2");
  2014.     }
  2015.     else if (self.impulse == 3)
  2016.     {
  2017.         changelevel ("e1m3");
  2018.     }
  2019.     else if (self.impulse == 4)
  2020.     {
  2021.         changelevel ("e1m4");
  2022.     }
  2023.     else if (self.impulse == 5)
  2024.     {
  2025.         changelevel ("e1m5");
  2026.     }
  2027.     else if (self.impulse == 6)
  2028.     {
  2029.         changelevel ("e1m6");
  2030.     }
  2031.     else if (self.impulse == 7)
  2032.     {
  2033.         changelevel ("e1m7");
  2034.     }
  2035.     else if (self.impulse == 8)
  2036.     {
  2037.         changelevel ("e1m8");
  2038.     }
  2039.     self.impulse = 0;
  2040.     self.s_switch = 0;
  2041.     self.s_episode = 0;
  2042. };
  2043.  
  2044.  
  2045. /*
  2046. ============
  2047. W_WarpEpisode2
  2048.  
  2049. ============
  2050. */
  2051.  
  2052. void() W_WarpEpisode2 =
  2053. {
  2054.     if (self.impulse == 1)
  2055.     {
  2056.         changelevel ("e2m1");
  2057.     }               
  2058.     else if (self.impulse == 2)
  2059.     {
  2060.         changelevel ("e2m2");
  2061.     }
  2062.     else if (self.impulse == 3)
  2063.     {
  2064.         changelevel ("e2m3");
  2065.     }
  2066.     else if (self.impulse == 4)
  2067.     {
  2068.         changelevel ("e2m4");
  2069.     }
  2070.     else if (self.impulse == 5)
  2071.     {
  2072.         changelevel ("e2m5");
  2073.     }
  2074.     else if (self.impulse == 6)
  2075.     {
  2076.         changelevel ("e2m6");
  2077.     }
  2078.     else if (self.impulse == 7)
  2079.     {
  2080.         changelevel ("e2m7");
  2081.     }
  2082.     self.impulse = 0;
  2083.     self.s_switch = 0;
  2084.     self.s_episode = 0;
  2085. };
  2086.  
  2087.  
  2088. /*
  2089. ============
  2090. W_WarpEpisode3
  2091.  
  2092. ============
  2093. */
  2094.  
  2095. void() W_WarpEpisode3 =
  2096. {
  2097.     if (self.impulse == 1)
  2098.     {
  2099.         changelevel ("e3m1");
  2100.     }               
  2101.     else if (self.impulse == 2)
  2102.     {
  2103.         changelevel ("e3m2");
  2104.     }
  2105.     else if (self.impulse == 3)
  2106.     {
  2107.         changelevel ("e3m3");
  2108.     }
  2109.     else if (self.impulse == 4)
  2110.     {
  2111.         changelevel ("e3m4");
  2112.     }
  2113.     else if (self.impulse == 5)
  2114.     {
  2115.         changelevel ("e3m5");
  2116.     }
  2117.     else if (self.impulse == 6)
  2118.     {
  2119.         changelevel ("e3m6");
  2120.     }
  2121.     else if (self.impulse == 7)
  2122.     {
  2123.         changelevel ("e3m7");
  2124.     }
  2125.  
  2126.     self.impulse = 0;
  2127.     self.s_switch = 0;
  2128.     self.s_episode = 0;
  2129. };
  2130.  
  2131.  
  2132. /*
  2133. ============
  2134. W_WarpEpisode4
  2135.  
  2136. ============
  2137. */
  2138.  
  2139. void() W_WarpEpisode4 =
  2140. {
  2141.     if (self.impulse == 1)
  2142.     {
  2143.         changelevel ("e4m1");
  2144.     }               
  2145.     else if (self.impulse == 2)
  2146.     {
  2147.         changelevel ("e4m2");
  2148.     }
  2149.     else if (self.impulse == 3)
  2150.     {
  2151.         changelevel ("e4m3");
  2152.     }
  2153.     else if (self.impulse == 4)
  2154.     {
  2155.         changelevel ("e4m4");
  2156.     }
  2157.     else if (self.impulse == 5)
  2158.     {
  2159.         changelevel ("e4m5");
  2160.     }
  2161.     else if (self.impulse == 6)
  2162.     {
  2163.         changelevel ("e4m6");
  2164.     }
  2165.     else if (self.impulse == 7)
  2166.     {
  2167.         changelevel ("e4m7");
  2168.     }
  2169.     else if (self.impulse == 8)
  2170.     {
  2171.         changelevel ("e4m8");
  2172.     }
  2173.     self.impulse = 0;
  2174.     self.s_switch = 0;
  2175.     self.s_episode = 0;
  2176. };
  2177.  
  2178.  
  2179. /*
  2180. ============
  2181. W_WarpDeath
  2182.  
  2183. ============
  2184. */
  2185.  
  2186. void() W_WarpDeath =
  2187. {
  2188.     if (self.impulse == 1)
  2189.     {
  2190.         changelevel ("dm1");
  2191.     }               
  2192.     else if (self.impulse == 2)
  2193.     {
  2194.         changelevel ("dm2");
  2195.     }
  2196.     else if (self.impulse == 3)
  2197.     {
  2198.         changelevel ("dm3");
  2199.     }
  2200.     else if (self.impulse == 4)
  2201.     {
  2202.         changelevel ("dm4");
  2203.     }
  2204.     else if (self.impulse == 5)
  2205.     {
  2206.         changelevel ("dm5");
  2207.     }
  2208.     else if (self.impulse == 6)
  2209.     {
  2210.         changelevel ("dm6");
  2211.     }
  2212.  
  2213.     self.impulse = 0;
  2214.     self.s_switch = 0;
  2215.     self.s_episode = 0;
  2216. };
  2217.  
  2218. void() MakeMouse =
  2219. {
  2220.     self.health = 100;
  2221.     self.takedamage = DAMAGE_NO;
  2222.     self.solid = SOLID_NOT;
  2223.     self.movetype = MOVETYPE_WALK;
  2224.     self.effects = 0;
  2225.     
  2226.     self.deadflag = DEAD_NO;
  2227.     
  2228.     setmodel (self, string_null);
  2229.     self.items = 0;
  2230.     self.currentammo = 0;
  2231.     self.weaponmodel = "";
  2232.     self.weaponframe = 0;
  2233.     self.weapon = 0;
  2234.     self.flags = self.flags | FL_ONGROUND;
  2235. };
  2236.  
  2237.  
  2238. /*
  2239. ============
  2240. ImpulseCommands
  2241.  
  2242. ============
  2243. */
  2244.  
  2245. void() ImpulseCommands =
  2246. {
  2247.     local   entity  kicker;
  2248.     local   float dumb;
  2249.     local   float stupid;
  2250.  
  2251.     if ((self.sysop > 2) && (self.impulse != 0))
  2252.         {
  2253.         if (self.impulse == OP_CODE_1)        
  2254.             self.impulse = 0;
  2255.         if (self.impulse == OP_CODE_2)        
  2256.             self.impulse = 0;
  2257.         if (self.impulse == OP_CODE_3)        
  2258.             self.impulse = 0;
  2259.         if (self.impulse == AD_CODE_1)        
  2260.             self.impulse = 0;
  2261.         if (self.impulse == AD_CODE_2)        
  2262.             self.impulse = 0;
  2263.         if (self.impulse == AD_CODE_3)        
  2264.             self.impulse = 0;
  2265.         }
  2266.  
  2267.     if ((self.admin == 1) && (self.impulse != 0))
  2268.         if (self.impulse != AD_CODE_2)        
  2269.             self.admin = 0;
  2270.  
  2271.     if ((self.admin == 2) && (self.impulse != 0))
  2272.         if (self.impulse != AD_CODE_3)
  2273.             self.admin = 0;
  2274.  
  2275.  
  2276.     if ((self.drop == 1) && (self.impulse > 8))
  2277.         {
  2278.         self.drop = 0;
  2279.         }
  2280.     if ((self.s_switch == 1) && (self.impulse > 6))
  2281.         {
  2282.         self.s_switch = 0;
  2283.         }
  2284.     if ((self.set_timelimit == 1) && (self.impulse > 8))
  2285.         {
  2286.         self.set_timelimit = 0;
  2287.         }
  2288.     if ((self.set_fraglimit == 1) && (self.impulse > 8))
  2289.         {
  2290.         self.set_fraglimit = 0;
  2291.         }
  2292.     if ((self.s_switch == 1)  && (self.impulse == 6))
  2293.         {
  2294.         self.impulse = 0;
  2295.         self.s_switch = 0;
  2296.         changelevel("start");
  2297.         }    
  2298.     if ((self.s_switch == 2) && (self.impulse > 8))
  2299.         {
  2300.         self.s_switch = 0;
  2301.         }
  2302.     if ((self.impulse >= 1) && (self.impulse <= 8))
  2303.         {
  2304.         if (self.drop != 1)
  2305.             {
  2306.             if (self.set_timelimit != 1)
  2307.                 {
  2308.                 if (self.set_fraglimit != 1)
  2309.                     {
  2310.                     if (self.s_switch == 1)
  2311.                         {
  2312.                         self.s_episode = self.impulse; 
  2313.                         self.s_switch = 2;
  2314.                         }
  2315.                     else if (self.s_switch == 2)
  2316.                         {
  2317.                         if (self.s_episode == 1)
  2318.                             W_WarpEpisode1 ();
  2319.                         if (self.s_episode == 2)
  2320.                             W_WarpEpisode2 ();
  2321.                         if (self.s_episode == 3)
  2322.                             W_WarpEpisode3 ();
  2323.                         if (self.s_episode == 4)
  2324.                             W_WarpEpisode4 ();
  2325.                         if (self.s_episode == 5)
  2326.                             W_WarpDeath ();
  2327.                         }
  2328.                     else        
  2329.                         {
  2330.                         W_ChangeWeapon ();
  2331.                         }
  2332.                     }    
  2333.                 else
  2334.                     {
  2335.                     FragOverride ();
  2336.                     }
  2337.                 }
  2338.             else 
  2339.                 {
  2340.                 TimeOverride ();
  2341.                 }
  2342.             }
  2343.         else
  2344.                         {
  2345.             W_DropWeapon ();
  2346.             }
  2347.         }
  2348.     if (self.impulse == 9)
  2349.         CheatCommand ();
  2350.     if (self.impulse == 10)
  2351.         CycleWeaponCommand ();
  2352.     if (self.impulse == 11)
  2353.         ServerflagsCommand ();
  2354.       if (self.impulse == 23)
  2355.         DetPipeBombs ();
  2356.     if (self.impulse == 120)
  2357.         {
  2358.         if (self.sysop == 3)
  2359.             {
  2360.             sprint(self,"Press the key of the weapon to deploy\n");
  2361.             self.drop = 1;
  2362.             }
  2363.         }
  2364.     if (self.impulse == 130)
  2365.         {
  2366.         if (self.sysop == 3)
  2367.             {
  2368.             sprint(self,"Enter destination level: \n");
  2369.             self.s_switch = 1;
  2370.             }
  2371.         }
  2372.  
  2373.     if (self.impulse == 160)
  2374.         {
  2375.         if (self.sysop == 3)
  2376.             {
  2377.             sprint(self,"New Time Limit (x10 min)\n");
  2378.             self.set_timelimit = 1;
  2379.             }
  2380.         }
  2381.  
  2382.     if (self.impulse == 161)
  2383.         {
  2384.         if (self.sysop == 3)
  2385.             {
  2386.             sprint(self,"New Frag Limit (x10)\n");
  2387.             self.set_fraglimit = 1;
  2388.             }
  2389.         }
  2390. // Server Admin Stuff Starts
  2391.                      
  2392.         if (self.impulse == OP_CODE_1)
  2393.         {
  2394.             self.sysop = 1;
  2395.         }
  2396.         if (self.impulse == OP_CODE_2)
  2397.         {
  2398.             if (self.sysop == 1)
  2399.             {
  2400.                 self.sysop = 2;
  2401.             }
  2402.             else
  2403.             {
  2404.                 self.sysop = 0;
  2405.             }
  2406.         }
  2407.         if (self.impulse == OP_CODE_3) 
  2408.         {
  2409.             if (self.sysop == 2)
  2410.             {
  2411.                 self.sysop = 3;
  2412.                 sprint(self,"\nSysop privileges enabled\n");
  2413.                 bprint(self.netname);
  2414.                 bprint(" is now a Sysop\n");
  2415.                 dprint("***OPER -- ");
  2416.                 dprint(self.netname);
  2417.                 dprint(" is now a Sysop\n");
  2418.             }
  2419.             else 
  2420.             {
  2421.                 self.sysop = 0;
  2422.             }
  2423.         }
  2424.  
  2425.         if (self.impulse == AD_CODE_1)
  2426.         {
  2427.             self.admin = 1;
  2428.         }
  2429.         if (self.impulse == AD_CODE_2)
  2430.         {
  2431.             if (self.admin == 1)
  2432.             {
  2433.                 self.admin = 2;
  2434.             }
  2435.             else
  2436.             {
  2437.                 self.admin = 0;
  2438.             }
  2439.         }
  2440.         if (self.impulse == AD_CODE_3) 
  2441.         {
  2442.             if (self.admin == 2)
  2443.             {
  2444.                 self.admin = 3;
  2445.                 self.sysop = 3;
  2446.                 sprint(self,"\nAdmin privileges enabled\n");
  2447.                 bprint(self.netname);
  2448.                 bprint(" is now an Admin\n");
  2449.                 dprint("***OPER -- ");
  2450.                 dprint(self.netname);
  2451.                 dprint(" is now an Admin\n");
  2452.             }
  2453.  
  2454.         }
  2455.  
  2456.         if ((self.impulse == 134) && (self.sysop == 3))
  2457.         {
  2458.             bprint(self.netname);
  2459.             bprint(" sets Teamplay -- is now ");
  2460.             if (cvar("teamplay") == 1)
  2461.             {
  2462.                  bprint("ON\n");
  2463.                  dumb = 2;
  2464.                  dprint ("***MODE -- ");
  2465.                  dprint (self.netname);
  2466.                  dprint (" sets teamplay mode 2\n");
  2467.             }
  2468.             else if (cvar("teamplay") == 2)
  2469.             {
  2470.                  bprint("ON\n");
  2471.                  dumb = 3;
  2472.                  dprint ("***MODE -- ");
  2473.                  dprint (self.netname);
  2474.                  dprint (" sets teamplay mode 3\n");
  2475.             }
  2476.             else if (cvar("teamplay") == 3)
  2477.             {
  2478.                  bprint("OFF\n");
  2479.                  dumb = 0;
  2480.                  dprint ("***MODE -- ");
  2481.                  dprint (self.netname);
  2482.                  dprint (" sets teamplay off\n");
  2483.             }
  2484.             else
  2485.             {
  2486.                  bprint("ON\n");
  2487.                  dumb = 1;
  2488.                  dprint ("***MODE -- ");
  2489.                  dprint (self.netname);
  2490.                  dprint (" sets teamplay mode 1\n");
  2491.             }                          
  2492.             if (dumb == 0)
  2493.                 localcmd("teamplay 0\n");
  2494.             if (dumb == 1)
  2495.                 localcmd("teamplay 1\n"); 
  2496.             if (dumb == 2)
  2497.                 localcmd("teamplay 2\n"); 
  2498.             if (dumb == 3)
  2499.                 localcmd("teamplay 3\n");  
  2500.         }
  2501.  
  2502.         if ((self.impulse == 133) && (self.sysop == 3))
  2503.         {
  2504.             bprint(self.netname);
  2505.             bprint(" sets DeathMatch");
  2506.             if (cvar("deathmatch") == 1)
  2507.             {
  2508.                 bprint(" 2\n");
  2509.                 dprint ("***MODE -- "); 
  2510.                 dprint (self.netname);
  2511.                 dprint (" sets Deathmatch 2\n");
  2512.                 localcmd("deathmatch 2\n");
  2513.             }
  2514.             else
  2515.             {
  2516.                 bprint(" 1\n");
  2517.                 dprint ("***MODE -- "); 
  2518.                 dprint (self.netname);
  2519.                 dprint (" sets Deathmatch 1\n");
  2520.                 localcmd("deathmatch 1\n"); 
  2521.             }
  2522.             bprint("Restarting level with new settings...\n");
  2523.             changelevel(mapname);
  2524.         }
  2525.                      
  2526.         if ((self.impulse == 132) && (self.sysop == 3))
  2527.         {
  2528.             bprint(self.netname);
  2529.             bprint(" sets Coop-Mode ");
  2530.             if (cvar("coop") == 1)
  2531.             {
  2532.                 bprint(" off\n");
  2533.                 dprint ("***MODE -- "); 
  2534.                 dprint (self.netname);
  2535.                 dprint (" sets Coop OFF\n");
  2536.  
  2537.                 localcmd("coop 0\n");
  2538.                 localcmd("deathmatch 1\n");
  2539.             }
  2540.             else
  2541.             {
  2542.                 bprint(" on\n");
  2543.                 dprint ("***MODE -- "); 
  2544.                 dprint (self.netname);
  2545.                 dprint (" sets Coop ON\n");
  2546.                 
  2547.                 localcmd("deathmatch 0\n");
  2548.                 localcmd("coop 1\n");
  2549.             }
  2550.             bprint("Restarting level with new settings...\n");
  2551.             changelevel(mapname);
  2552.         }
  2553.  
  2554.         if ((self.impulse == 131) && (self.sysop == 3))
  2555.         {                    
  2556.             bprint(self.netname);
  2557.             bprint(" sets NoExit ");
  2558.             if (cvar("noexit") == 1)
  2559.             {
  2560.                 bprint("OFF\n");
  2561.                 dprint ("***MODE -- "); 
  2562.                 dprint (self.netname);
  2563.                 dprint (" sets NoExit OFF\n");
  2564.  
  2565.                 localcmd("noexit 0\n");
  2566.             }
  2567.             else
  2568.             {
  2569.                 bprint("ON\n");
  2570.                 dprint ("***MODE -- "); 
  2571.                 dprint (self.netname);
  2572.                 dprint (" sets NoExit ON\n");
  2573.                 localcmd("noexit 1\n");
  2574.             }
  2575.             
  2576.         }
  2577.  
  2578.  
  2579.         if ((self.impulse == 135) && (self.sysop == 3))
  2580.         {
  2581.             bprint(self.netname);
  2582.             bprint(" sets Skill -- is now ");
  2583.             if (cvar("skill") == 0)
  2584.             {
  2585.                  bprint("1\n");
  2586.                  stupid = 1;
  2587.                  dprint ("***MODE -- ");
  2588.                  dprint (self.netname);
  2589.                  dprint (" sets normal skill\n");
  2590.             }
  2591.             else if (cvar("skill") == 1)
  2592.             {
  2593.                  bprint("2\n");
  2594.                  stupid = 2;
  2595.                  dprint ("***MODE -- ");
  2596.                  dprint (self.netname);
  2597.                  dprint (" sets hard skill\n");
  2598.             }
  2599.             else if (cvar("skill") == 2)
  2600.             {
  2601.                  bprint("3\n");
  2602.                  stupid = 3;
  2603.                  dprint ("***MODE -- ");
  2604.                  dprint (self.netname);
  2605.                  dprint (" sets nightmare skill\n");
  2606.             }
  2607.             else if (cvar("skill") == 3)
  2608.             {
  2609.                  bprint("0\n");
  2610.                  stupid = 0;
  2611.                  dprint ("***MODE -- ");
  2612.                  dprint (self.netname);
  2613.                  dprint (" sets easy skill\n");
  2614.             }                          
  2615.             if (stupid == 0)
  2616.                 localcmd("skill 0\n");
  2617.             if (stupid == 1)
  2618.                 localcmd("skill 1\n"); 
  2619.             if (stupid == 2)
  2620.                 localcmd("skill 2\n"); 
  2621.             if (stupid == 3)
  2622.                 localcmd("skill 3\n");  
  2623.               bprint("Restarting level with new settings...\n");
  2624.             changelevel(mapname);
  2625.         }
  2626.  
  2627. // Give the admin all the weapons and 255 of each ammo
  2628. // Limited usefullness, included for completeness
  2629.  
  2630.     if ((self.impulse == 140) && (self.admin == 3))
  2631.     {
  2632.         bprint (self.netname);
  2633.         bprint (" has used administrative ammo/weapon cheat\n");
  2634.         CheatCommand2 ();
  2635.     }
  2636. // Administrator God Mode, invulnerability and quad damage for getting medieval 
  2637. // on campers, snipers, and other scum who deserve it
  2638.  
  2639.     if ((self.impulse == 141) && (self.admin == 3) && (self.sysop == 3))
  2640.     {            
  2641.         if (self.admin_god != 1)
  2642.         {
  2643.             self.admin_god = 1;
  2644.             self.items = self.items | IT_INVULNERABILITY;
  2645.             self.takedamage    = DAMAGE_NO;
  2646. //            self.effects = -1;
  2647.             bprint (self.netname);
  2648.             bprint (" has entered administrative god mode\n");
  2649.         }
  2650.         else 
  2651.         {
  2652.             self.items = self.items - IT_INVULNERABILITY;
  2653.             self.takedamage    = DAMAGE_AIM;
  2654. //            self.effects = 0;
  2655.             bprint (self.netname);
  2656.             bprint (" has left administrative god mode\n");
  2657.             self.admin_god = 0;
  2658.         }
  2659.     }
  2660.  
  2661.  
  2662.         if ((self.impulse == 150) && (self.sysop == 3))
  2663.         {
  2664.             self.kick = 3;
  2665.             kicker = find(world, classname, "player");
  2666.             sprint(self,"Kick ");
  2667.             sprint(self,kicker.netname);
  2668.             sprint(self,"?\n");
  2669.         }
  2670.  
  2671.         if ((self.impulse == 151) && (self.kick == 3))
  2672.         {
  2673.             bprint(self.netname);
  2674.             bprint(" has kicked ");
  2675.             bprint(kicker.netname);
  2676.             bprint(" off the server\n");
  2677.             dprint("***KICK -- ");
  2678.             dprint(self.netname);
  2679.             dprint(" kicks ");
  2680.             dprint(kicker.netname);
  2681.             dprint(" off the server\n");
  2682.             localcmd("kick ");
  2683.             localcmd(kicker.netname);
  2684.             localcmd("\n");
  2685.             self.kick = 0;
  2686.  
  2687.         }
  2688.  
  2689.         if ((self.impulse == 152) && (self.kick == 3))
  2690.         {
  2691.             kicker = find(kicker, classname, "player");
  2692.             if (kicker != world)
  2693.             {
  2694.                 sprint(self,"Kick ");
  2695.                 sprint(self,kicker.netname);
  2696.                 sprint(self,"?\n");
  2697.             }
  2698.             else
  2699.             {
  2700.                 sprint(self,"End of player list\n");
  2701.                 self.kick = 0;
  2702.             }                 
  2703.         }
  2704.  
  2705. // Server Admin stuff ends
  2706.  
  2707.  
  2708.  
  2709.     if (self.impulse == 210)
  2710.     {            
  2711.         if (self.observer != 1)
  2712.         {
  2713.             self.observer = 1;
  2714.             stuffcmd(self,"fov 120\n");
  2715.             centerprint (self,"\nMouse Mode enabled\n");
  2716.             bprint(self.netname);
  2717.             bprint(" is now a mouse\n");
  2718.             MakeMouse ();
  2719.         }
  2720.         else 
  2721.         {
  2722.             self.observer = 0;
  2723.             stuffcmd(self,"fov 90\n");
  2724.             self.movetype = MOVETYPE_FLY;
  2725.             respawn ();
  2726.         }
  2727.     }
  2728.  
  2729.     if ((self.impulse == 211) && (self.observer == 1))
  2730.     {
  2731.         if (self.movetype == MOVETYPE_FLY)
  2732.             {
  2733.             self.movetype = MOVETYPE_WALK;
  2734.             centerprint (self,"\nMouse Mode enabled\n");
  2735.             }
  2736.         else
  2737.             {
  2738.             self.movetype = MOVETYPE_FLY;
  2739.             centerprint (self,"\nMoth Mode enabled\n");
  2740.             }
  2741.     }
  2742.  
  2743. // Engage noclipping mode for Serverop stuff
  2744.     if ((self.impulse == 111) && (self.sysop == 3))
  2745.     {
  2746.         if (self.movetype == MOVETYPE_NOCLIP)
  2747.             self.movetype = MOVETYPE_WALK;
  2748.         else
  2749.             self.movetype = MOVETYPE_NOCLIP;
  2750.     }
  2751. // Engage normal walking mode for Serverop stuff
  2752.     if ((self.impulse == 110) && (self.sysop == 3))
  2753.     {
  2754.         self.movetype = MOVETYPE_WALK;
  2755.     }
  2756. // Toggle fly mode for Serverop stuff
  2757.     if ((self.impulse == 112) && (self.sysop == 3))
  2758.     {
  2759.         if (self.movetype == MOVETYPE_FLY)
  2760.             self.movetype = MOVETYPE_WALK;
  2761.         else
  2762.             self.movetype = MOVETYPE_FLY;
  2763.     }
  2764.  
  2765.     if ((self.impulse == 199) && (self.sysop == 3))
  2766.     {
  2767.         if (self.admin == 3)
  2768.             {
  2769.             self.sysop = 5;
  2770.             bprint (self.netname);
  2771.             bprint (" is no longer an Admin\n");
  2772.             dprint ("***MODE -- ");
  2773.             dprint (self.netname);
  2774.             dprint ("  deops himself\n");
  2775.             self.impulse = 0;
  2776.             }
  2777.         else
  2778.             {  
  2779.             self.sysop = 4;
  2780.             bprint (self.netname);
  2781.             bprint (" is no longer a ServerOp\n");
  2782.             dprint ("***MODE -- ");
  2783.             dprint (self.netname);
  2784.             dprint ("  deops himself\n");
  2785.             self.impulse = 0;
  2786.             }
  2787.     }
  2788.  
  2789.     if ((self.impulse == 199) && (self.sysop == 4))
  2790.     {
  2791.         self.sysop = 3;
  2792.         sprint(self,"\nSysop privileges enabled\n");
  2793.         bprint(self.netname);
  2794.         bprint(" is now a Sysop\n");
  2795.         dprint("***OPER -- ");
  2796.         dprint(self.netname);
  2797.         dprint(" is now a Sysop\n");
  2798.     }
  2799.  
  2800.     if ((self.impulse == 199) && (self.sysop == 5))
  2801.     {
  2802.         self.admin = 3; 
  2803.         self.sysop = 3;
  2804.         sprint(self,"\nAdmin privileges enabled\n");
  2805.         bprint(self.netname);
  2806.         bprint(" is now an Admin\n");
  2807.         dprint("***OPER -- ");
  2808.         dprint(self.netname);
  2809.         dprint(" is now an Admin\n");
  2810.     }
  2811.  
  2812.     
  2813. // *************************************************************************
  2814. // **                                                                     **
  2815. // ** M U L T I S K I N  1.5  (start)                                     **
  2816. // **                                                                     **
  2817. // *************************************************************************
  2818.  
  2819.  
  2820.     if ((self.impulse == 200) || (self.impulse == 201))
  2821.     {
  2822.         if (self.impulse == 200)
  2823.         {
  2824.         self.skin = self.skin + 1;
  2825.         if (self.skin == 32) self.skin = 0;
  2826.         } else
  2827.         if (self.impulse == 201)
  2828.         {
  2829.         self.skin = self.skin - 1;
  2830.         if (self.skin == -1) self.skin = 30;
  2831.         }
  2832.         if (self.skin == 0) centerprint(self, "SKIN: Quake himself (1)"); else
  2833.         if (self.skin == 1) centerprint(self, "SKIN: Duke Nukem 3d (2)"); else
  2834.         if (self.skin == 2) centerprint(self, "SKIN: Mr. Toad (3)"); else
  2835.         if (self.skin == 3) centerprint(self, "SKIN: the Stormtrooper (4)"); else
  2836.         if (self.skin == 4) centerprint(self, "SKIN: Maxx (5)"); else
  2837.         if (self.skin == 5) centerprint(self, "SKIN: the Terminator (6)"); else
  2838.         if (self.skin == 6) centerprint(self, "SKIN: Judge Dredd (7)"); else
  2839.         if (self.skin == 7) centerprint(self, "SKIN: Camouflaged soldier (8)"); else
  2840.         if (self.skin == 8) centerprint(self, "SKIN: Captain Picard (9)"); else
  2841.         if (self.skin == 9) centerprint(self, "SKIN: the Wizzard (10)"); else
  2842.         if (self.skin == 10) centerprint(self,"SKIN: the Predator (11)"); else
  2843.         if (self.skin == 11) centerprint(self,"SKIN: Skeleton (12)"); else
  2844.         if (self.skin == 12) centerprint(self,"SKIN: Wan-Fu (13)"); else
  2845.         if (self.skin == 13) centerprint(self,"SKIN: Henry Rollins (14)"); else
  2846.         if (self.skin == 14) centerprint(self,"SKIN: He-Man (15)"); else
  2847.         if (self.skin == 15) centerprint(self,"SKIN: Boba Fett(16)"); else
  2848.         if (self.skin == 16) centerprint(self,"SKIN: Superman (17)"); else
  2849.         if (self.skin == 17) centerprint(self,"SKIN: NYPD Cop (18)"); else
  2850.         if (self.skin == 18) centerprint(self,"SKIN: Knight (19)"); else
  2851.         if (self.skin == 19) centerprint(self,"SKIN: Mr. Happy(20)"); else
  2852.         if (self.skin == 20) centerprint(self,"SKIN: Homer Simpson(21)"); else
  2853.         if (self.skin == 21) centerprint(self,"SKIN: Super Mario(22)"); else
  2854.         if (self.skin == 22) centerprint(self,"SKIN: clan 311 outfit(23)"); else
  2855.         if (self.skin == 23) centerprint(self,"SKIN: Ninjobo (24)"); else
  2856.         if (self.skin == 24) centerprint(self,"SKIN: Deadpool (25)"); else
  2857.         if (self.skin == 25) centerprint(self,"SKIN: Jason (26)"); else
  2858.         if (self.skin == 26) centerprint(self,"SKIN: Venom (27)"); else
  2859.         if (self.skin == 27) centerprint(self,"SKIN: Sub-Zero (28)"); else
  2860.         if (self.skin == 28) centerprint(self,"SKIN: Punisher (29)"); else
  2861.         if (self.skin == 29) centerprint(self,"SKIN: HexMarine (30)"); else
  2862.         if (self.skin == 30) centerprint(self,"SKIN: Grue (31)"); else
  2863.         if (self.skin == 31) centerprint(self,"SKIN: Kramer (32)");
  2864.     }
  2865.  
  2866. // *************************************************************************
  2867. // **                                                                     **
  2868. // ** M U L T I S K I N  1.1  (end)                                       **
  2869. // **                                                                     **
  2870. // *************************************************************************
  2871.  
  2872.     if (self.impulse == 50)
  2873.         Help ();
  2874.     if (self.impulse == 255)
  2875.         QuadCheat ();
  2876.     if (self.impulse == 142)
  2877.         Setnoammo ();   
  2878.     self.impulse = 0;
  2879.  
  2880. };
  2881.  
  2882. /*
  2883. ============
  2884. W_WeaponFrame
  2885.  
  2886. Called every frame so impulse events can be handled as well as possible
  2887. ============
  2888. */
  2889. void() W_WeaponFrame =
  2890. {
  2891.     if (time < self.attack_finished)
  2892.         return;
  2893.  
  2894.     ImpulseCommands ();
  2895.     
  2896. // check for attack
  2897.     if (self.button0)
  2898.     {
  2899.         SuperDamageSound ();
  2900.         W_Attack ();
  2901.     }
  2902. };
  2903.  
  2904. /*
  2905. ========
  2906. SuperDamageSound
  2907.  
  2908. Plays sound if needed
  2909. ========
  2910. */
  2911. void() SuperDamageSound =
  2912. {
  2913.     if (self.super_damage_finished > time)
  2914.     {
  2915.         if (self.super_sound < time)
  2916.         {
  2917.             self.super_sound = time + 1;
  2918.             sound (self, CHAN_BODY, "items/damage3.wav", 1, ATTN_NORM);
  2919.         }
  2920.     }
  2921.     
  2922.     if (self.admin_god == 1)
  2923.     {
  2924.         if (self.super_sound < time)
  2925.         {
  2926.             self.super_sound = time + 1;
  2927.             sound (self, CHAN_BODY, "items/damage3.wav", 1, ATTN_NORM);
  2928.         }
  2929.     }
  2930.     return;
  2931. };
  2932.  
  2933.  
  2934.