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

  1. void (entity targ, entity inflictor, entity attacker, float damage) T_Damage;
  2. void () player_run;
  3. void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage;
  4. void(vector org, vector vel, float damage) SpawnBlood;
  5. void() SuperDamageSound;
  6.  
  7.  
  8. /*
  9. ================
  10. HomeFindTarget by Vhold
  11. returns the closest entity to itself that is killable, not a team member on 
  12. self's team, ect ect....
  13. ================
  14. */
  15. entity() HomeFindTarget =
  16. {
  17.         local entity head, selected;
  18.         local float dist;
  19.         dist = 100000;
  20.         selected = world;
  21.         head = findradius(self.origin, 100000);
  22.         while(head)
  23.         {
  24.           if( (head.health > 1) && (head != self) && (head != self.owner) && !( (teamplay == 1) && (head.team > 0)&&(head.team == self.owner.team) ) && (head.classname != "door") && (head.classname != "misc_explobox") && !(head.items & IT_INVISIBILITY) )
  25.              {
  26.  
  27.                         traceline(self.origin,head.origin,TRUE,self);
  28.                         if ( (trace_fraction >= 1) && (vlen(head.origin - self.origin) < dist) )
  29.                         {
  30.                                 selected = head;
  31.                                 dist = vlen(head.origin - self.origin);
  32.                         }
  33.                 }
  34.                 head = head.chain;
  35.         }
  36.  
  37.         if (selected != world)   // All of this is stuff you can comment out
  38.         {
  39.                 sprint (self.owner,"Homing->");
  40.                 if (selected.classname == "player")
  41.                 {
  42.                         sprint (self.owner,selected.netname);
  43.                         sprint (selected,"WARNING! Incoming Missile!\n");
  44.                 }
  45.                 else
  46.                         sprint (self.owner,selected.classname);
  47.                 sprint (self.owner,"\n");
  48.         }
  49.  
  50.         return selected;
  51. };
  52. /* 
  53. ===============
  54. HomeThink by Vhold
  55. The Think function for the Homing Missile
  56. ===============
  57. */
  58. void() HomeThink =
  59. {
  60.         local vector needdir, currdir;
  61.     local float needspeed, maxspeed, acceleration;
  62.     local vector temp;
  63.  
  64.     traceline(self.origin,self.enemy.origin,TRUE,self);
  65.  
  66.         if ( (trace_fraction < 1) || !(self.enemy) || (self.enemy == world) || (self.enemy.health < 1) )
  67.                 self.enemy = HomeFindTarget();
  68.  
  69.         if (self.enemy != world) // Arr.. don't be taken on da World!
  70.         {
  71.         temp = normalize(self.velocity) * 100;
  72.         traceline(self.origin,self.origin+temp,TRUE,self);
  73.         if(trace_fraction < 1)
  74.         {
  75.             maxspeed = 200;
  76.             acceleration = 300;
  77.         }
  78.         else
  79.         {
  80.             maxspeed = 400;
  81.             acceleration = 150;
  82.         }
  83.                 needdir = normalize((self.enemy.origin + '0 0 10') - self.origin);
  84.                 currdir = normalize(self.velocity);
  85.                 self.angles = vectoangles(needdir);
  86.  
  87.                 needspeed = vlen(needdir - currdir) * acceleration;
  88.  
  89.                 self.movedir = needdir * needspeed;
  90.                 self.velocity = self.velocity + self.movedir;
  91.  
  92.                 if ( vlen(self.velocity) > maxspeed )
  93.                         self.velocity = normalize(self.velocity) * maxspeed;
  94.         self.nextthink = time + 0.1;
  95.  
  96.         }
  97.     else
  98.             self.nextthink = time + 0.5;
  99.         
  100.     self.think=HomeThink;
  101. };
  102.  
  103. /*
  104. ==============
  105. FireHomingMissile
  106. Fires a Vhold brand homing missile
  107. ==============
  108. */
  109. void() FireHomingMissile =
  110. {
  111.     local    entity missile, mpuff;
  112.         
  113.     if ((self.ammo_rockets < 5) || !(self.items & IT_ROCKET_LAUNCHER) )
  114.     {
  115.         sprint(self,"Homing Missile Needs 5 Rockets\n");
  116.         return;
  117.     }
  118.     self.currentammo = self.ammo_rockets = self.ammo_rockets - 5;
  119.     
  120.     sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
  121.  
  122.     self.punchangle_x = -2;
  123.  
  124.     missile = spawn ();
  125.     missile.owner = self;
  126.     missile.movetype = MOVETYPE_FLYMISSILE;
  127.     missile.solid = SOLID_BBOX;
  128.     missile.classname = "arocket";
  129.     missile.health = 1;
  130.         
  131. // set missile speed    
  132.  
  133.     makevectors (self.v_angle);
  134.     missile.velocity = aim(self, 1000);
  135.     missile.velocity = missile.velocity * 400;
  136.     missile.angles = vectoangles(missile.velocity);
  137.     
  138.     missile.touch = T_MissileTouch;
  139.     
  140. // set missile duration
  141.     missile.nextthink = time + 0.5;
  142.     missile.think = HomeThink;
  143.     missile.enemy = world;
  144.  
  145.     setmodel (missile, "progs/missile.mdl");
  146.     setsize (missile, '0 0 0', '0 0 0');        
  147.     setorigin (missile, self.origin + v_forward*8 + '0 0 16');
  148.  
  149.     W_SetCurrentAmmo();
  150. };
  151.  
  152. /*
  153. ==========================
  154. VholdBackpackTouch
  155. This simply makes sure you don't pick up your backpack immediately
  156. after throwing it
  157. ==========================
  158. */
  159.  
  160. void() BackpackTouch;
  161.  
  162. void() VholdBackpackTouch =
  163. {
  164.     if ( (self.owner == other) && ((self.nextthink - time) > 119 )) 
  165.         return;
  166.  
  167.     BackpackTouch();        
  168. };
  169.  
  170. /*
  171. =======================
  172. ThrowBackpack by Vhold
  173. =======================
  174. */
  175. void() ThrowBackpack =
  176. {
  177.         local entity    item;
  178.  
  179.         if ( (self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells) == 0)
  180.                 return;
  181.  
  182.         item = spawn();
  183.  
  184.         if ( self.ammo_shells >= 20)
  185.         {
  186.                 item.ammo_shells = 20;
  187.                 self.ammo_shells = self.ammo_shells - 20;
  188.         }
  189.         else
  190.         {
  191.                 item.ammo_shells = self.ammo_shells;
  192.                 self.ammo_shells = 0;
  193.         }
  194.  
  195.         if ( self.ammo_nails >= 20)
  196.         {
  197.                 item.ammo_nails = 20;
  198.                 self.ammo_nails = self.ammo_nails - 20;
  199.         }
  200.         else
  201.         {
  202.                 item.ammo_nails = self.ammo_nails;
  203.                 self.ammo_nails = 0;
  204.         }
  205.  
  206.         if ( self.ammo_rockets >= 10)
  207.         {
  208.                 item.ammo_rockets = 10;
  209.                 self.ammo_rockets = self.ammo_rockets - 10;
  210.         }
  211.         else
  212.         {
  213.                 item.ammo_rockets = self.ammo_rockets;
  214.                 self.ammo_rockets = 0;
  215.         }
  216.  
  217.         if (self.ammo_cells >= 20)
  218.         {
  219.                 item.ammo_cells = 20;
  220.                 self.ammo_cells = self.ammo_cells - 20;
  221.         }
  222.         else
  223.         {
  224.                 item.ammo_cells = self.ammo_cells;
  225.                 self.ammo_cells = 0;
  226.         }
  227.  
  228.         item.owner = self;
  229.         makevectors(self.v_angle);
  230.         setorigin(item, self.origin + '0 0 16');
  231.         item.velocity = aim(self, 1000);
  232.         item.velocity = item.velocity * 500;
  233.         item.flags = FL_ITEM;
  234.         item.solid = SOLID_TRIGGER;
  235.         item.movetype = MOVETYPE_BOUNCE;
  236.  
  237.         setmodel (item, "progs/backpack.mdl");
  238.         setsize(item, '-16 -16 0', '16 16 56');
  239.         item.touch = VholdBackpackTouch;
  240.         item.nextthink = time + 180;    // remove after 3 minutes
  241.         item.think = SUB_Remove;
  242.  
  243.         W_SetCurrentAmmo();
  244. }; 
  245.  
  246. // called by worldspawn
  247. void() W_Precache =
  248. {
  249.         precache_model ("progs/h_zombie.mdl");
  250.         precache_sound ("weapons/lhit.wav");
  251.         precache_model ("progs/lavaball.mdl");
  252.         precache_sound ("items/protect2.wav");
  253.         precache_sound ("demon/djump.wav");
  254.         precache_sound ("demon/dhit2.wav");
  255.         precache_model ("progs/demon.mdl");
  256.         precache_sound ("misc/power.wav");
  257.         precache_sound ("enforcer/enfire.wav");
  258.         precache_sound ("zombie/z_miss.wav");  // axe splat
  259.     precache_sound ("weapons/r_exp3.wav");    // new rocket explosion
  260.     precache_sound ("weapons/rocket1i.wav");    // spike gun
  261.     precache_sound ("weapons/sgun1.wav");
  262.     precache_sound ("weapons/guncock.wav");    // player shotgun
  263.     precache_sound ("weapons/ric1.wav");    // ricochet (used in c code)
  264.     precache_sound ("weapons/ric2.wav");    // ricochet (used in c code)
  265.     precache_sound ("weapons/ric3.wav");    // ricochet (used in c code)
  266.     precache_sound ("weapons/spike2.wav");    // super spikes
  267.     precache_sound ("weapons/tink1.wav");    // spikes tink (used in c code)
  268.     precache_sound ("weapons/grenade.wav");    // grenade launcher
  269.     precache_sound ("weapons/bounce.wav");        // grenade bounce
  270.     precache_sound ("weapons/shotgn2.wav");    // super shotgun
  271.         precache_sound ("player/tornoff2.wav");
  272.         precache_sound ("player/slimbrn2.wav");
  273.         precache_model ("progs/laser.mdl");
  274.  
  275. };
  276.  
  277. float() crandom =
  278. {
  279.     return 2*(random() - 0.5);
  280. };
  281.  
  282. /*
  283. ================
  284. W_FireAxe       
  285. ================
  286. */
  287. void() W_FireAxe =
  288. {
  289.     local    vector    source;
  290.     local    vector    org;
  291.  
  292.     source = self.origin + '0 0 16';
  293.     traceline (source, source + v_forward*64, FALSE, self);
  294.     if (trace_fraction == 1.0)
  295.         return;
  296.     
  297.     org = trace_endpos - v_forward*4;
  298.  
  299.     if (trace_ent.takedamage)
  300.     {
  301.               if (self.ammo_cells > 0)
  302.               {
  303.                 if ((self.waterlevel > 2) && (self.ammo_cells > 4))
  304.                 {
  305.                  trace_ent.axhitme = 1;
  306.                  SpawnBlood(org, '0 0 0', 10*self.ammo_cells);
  307.                  T_Damage (trace_ent, self, self, 10*self.ammo_cells);
  308.                  self.ammo_cells = 0;
  309.                  sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
  310.                                                }
  311.                  else
  312.                  {
  313.                trace_ent.axhitme = 1;
  314.                SpawnBlood (org, '0 0 0', 45);
  315.                T_Damage (trace_ent, self, self, 45);
  316.                self.ammo_cells = self.ammo_cells - 1;
  317.                                                 }
  318.                                      }
  319.                else
  320.                {
  321.         trace_ent.axhitme = 1;
  322.         SpawnBlood (org, '0 0 0', 20);
  323.                 T_Damage (trace_ent, self, self, 20);
  324.                                       }
  325.     }
  326.     else
  327.     {    // hit wall
  328.         sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
  329.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  330.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  331.         WriteCoord (MSG_BROADCAST, org_x);
  332.         WriteCoord (MSG_BROADCAST, org_y);
  333.         WriteCoord (MSG_BROADCAST, org_z);
  334.     }
  335. };
  336.  
  337.  
  338. //============================================================================
  339.  
  340.  
  341. vector() wall_velocity =
  342. {
  343.     local vector    vel;
  344.     
  345.     vel = normalize (self.velocity);
  346.     vel = normalize(vel + v_up*(random()- 0.5) + v_right*(random()- 0.5));
  347.     vel = vel + 2*trace_plane_normal;
  348.     vel = vel * 200;
  349.     
  350.     return vel;
  351. };
  352.  
  353. /*
  354. ================
  355. SpawnMeatSpray
  356. ================
  357. */
  358. void(vector org, vector vel) SpawnMeatSpray =
  359. {
  360.     local    entity missile, mpuff;
  361.     local    vector    org;
  362.  
  363.     missile = spawn ();
  364.     missile.owner = self;
  365.     missile.movetype = MOVETYPE_BOUNCE;
  366.     missile.solid = SOLID_NOT;
  367.  
  368.     makevectors (self.angles);
  369.  
  370.     missile.velocity = vel;
  371.     missile.velocity_z = missile.velocity_z + 250 + 50*random();
  372.  
  373.     missile.avelocity = '3000 1000 2000';
  374.     
  375. // set missile duration
  376.     missile.nextthink = time + 1;
  377.     missile.think = SUB_Remove;
  378.  
  379.     setmodel (missile, "progs/zom_gib.mdl");
  380.     setsize (missile, '0 0 0', '0 0 0');        
  381.     setorigin (missile, org);
  382. };
  383.  
  384. /*
  385. ================
  386. SpawnBlood
  387. ================
  388. */
  389. void(vector org, vector vel, float damage) SpawnBlood =
  390. {
  391.     particle (org, vel*0.1, 73, damage*2);
  392. };
  393.  
  394. /*
  395. ================
  396. spawn_touchblood
  397. ================
  398. */
  399. void(float damage) spawn_touchblood =
  400. {
  401.     local vector    vel;
  402.  
  403.     vel = wall_velocity () * 0.2;
  404.     SpawnBlood (self.origin + vel*0.01, vel, damage);
  405. };
  406.  
  407.  
  408. /*
  409. ================
  410. SpawnChunk
  411. ================
  412. */
  413. void(vector org, vector vel) SpawnChunk =
  414. {
  415.     particle (org, vel*0.02, 0, 10);
  416. };
  417.  
  418. /*
  419. ==============================================================================
  420.  
  421. MULTI-DAMAGE
  422.  
  423. Collects multiple small damages into a single damage
  424.  
  425. ==============================================================================
  426. */
  427.  
  428. entity    multi_ent;
  429. float    multi_damage;
  430.  
  431. void() ClearMultiDamage =
  432. {
  433.     multi_ent = world;
  434.     multi_damage = 0;
  435. };
  436.  
  437. void() ApplyMultiDamage =
  438. {
  439.     if (!multi_ent)
  440.         return;
  441.     T_Damage (multi_ent, self, self, multi_damage);
  442. };
  443.  
  444. void(entity hit, float damage) AddMultiDamage =
  445. {
  446.     if (!hit)
  447.         return;
  448.     
  449.     if (hit != multi_ent)
  450.     {
  451.         ApplyMultiDamage ();
  452.         multi_damage = damage;
  453.         multi_ent = hit;
  454.     }
  455.     else
  456.         multi_damage = multi_damage + damage;
  457. };
  458.  
  459. /*
  460. ==============================================================================
  461.  
  462. BULLETS
  463.  
  464. ==============================================================================
  465. */
  466.  
  467. /*
  468. ================
  469. TraceAttack
  470. ================
  471. */
  472. void(float damage, vector dir) TraceAttack =
  473. {
  474.     local    vector    vel, org;
  475.     
  476.     vel = normalize(dir + v_up*crandom() + v_right*crandom());
  477.     vel = vel + 2*trace_plane_normal;
  478.     vel = vel * 200;
  479.  
  480.     org = trace_endpos - dir*4;
  481.  
  482.     if (trace_ent.takedamage)
  483.     {
  484.         SpawnBlood (org, vel*0.2, damage);
  485.         AddMultiDamage (trace_ent, damage);
  486.     }
  487.     else
  488.     {
  489.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  490.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  491.         WriteCoord (MSG_BROADCAST, org_x);
  492.         WriteCoord (MSG_BROADCAST, org_y);
  493.         WriteCoord (MSG_BROADCAST, org_z);
  494.     }
  495. };
  496.  
  497. /*
  498. ================
  499. FireBullets
  500.  
  501. Used by shotgun, super shotgun, and enemy soldier firing
  502. Go to the trouble of combining multiple pellets into a single damage call.
  503. ================
  504. */
  505. void(float shotcount, vector dir, vector spread) FireBullets =
  506. {
  507.     local    vector direction;
  508.     local    vector    src;
  509.     
  510.     makevectors(self.v_angle);
  511.  
  512.     src = self.origin + v_forward*10;
  513.     src_z = self.absmin_z + self.size_z * 0.7;
  514.  
  515.     ClearMultiDamage ();
  516.     while (shotcount > 0)
  517.     {
  518.         direction = dir + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
  519.  
  520.         traceline (src, src + direction*2048, FALSE, self);
  521.         if (trace_fraction != 1.0)
  522.             TraceAttack (4, direction);
  523.  
  524.         shotcount = shotcount - 1;
  525.     }
  526.     ApplyMultiDamage ();
  527. };
  528.  
  529. /*
  530. ================
  531. W_FireShotgun
  532. ================
  533. */
  534. void() W_FireShotgun =
  535. {
  536.     local vector dir;
  537.  
  538.     sound (self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM);    
  539.  
  540.     self.punchangle_x = -2;
  541.     
  542.     self.currentammo = self.ammo_shells = self.ammo_shells - 1;
  543.     dir = aim (self, 100000);
  544.         FireBullets (9, dir, '0.04 0.04 0');
  545. };
  546.  
  547. /*
  548. ================
  549. W_FireSuperShotgun
  550. ================
  551. */
  552. void() W_FireSuperShotgun =
  553. {
  554.     local vector dir;
  555.  
  556.     if (self.currentammo == 1)
  557.     {
  558.         W_FireShotgun ();
  559.         return;
  560.     }
  561.         
  562.     sound (self ,CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM);    
  563.  
  564.     self.punchangle_x = -4;
  565.     
  566.     self.currentammo = self.ammo_shells = self.ammo_shells - 2;
  567.     dir = aim (self, 100000);
  568.         FireBullets (18, dir, '0.14 0.08 0');
  569. };
  570.  
  571. /*
  572. ================
  573. FireSniper
  574. ================
  575. */
  576. void() FireSniper =
  577. {
  578.     local vector dir;
  579.  
  580.         if (self.currentammo < 4)
  581.     {
  582.                 sprint(self,"Requires 4 shells\n");
  583.                 return;
  584.     }
  585.  
  586.         sound (self ,CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM); 
  587.  
  588.         self.punchangle_x = -6;
  589.     
  590.         self.currentammo = self.ammo_shells = self.ammo_shells - 4;
  591.     dir = aim (self, 100000);
  592.         FireBullets (24, dir, '0 0 0');
  593. };
  594.  
  595.  
  596. void() spike_touch;
  597. void() superspike_touch;
  598.  
  599.  
  600. /*
  601. ===============
  602. launch_spike
  603.  
  604. Used for both the player and the ogre
  605. ===============
  606. */
  607. void(vector org, vector dir) launch_spike =
  608. {
  609.     newmis = spawn ();
  610.     newmis.owner = self;
  611.     newmis.movetype = MOVETYPE_FLYMISSILE;
  612.     newmis.solid = SOLID_BBOX;
  613.  
  614.     newmis.angles = vectoangles(dir);
  615.     
  616.     newmis.touch = spike_touch;
  617.     newmis.classname = "spike";
  618.     newmis.think = SUB_Remove;
  619.     newmis.nextthink = time + 6;
  620.     setmodel (newmis, "progs/spike.mdl");
  621.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  622.     setorigin (newmis, org);
  623.  
  624.     newmis.velocity = dir * 1000;
  625. };
  626.  
  627. void() W_FireSuperSpikes =
  628. {
  629.     local vector    dir;
  630.     local entity    old;
  631.     
  632.     sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
  633.     self.attack_finished = time + 0.2;
  634.     self.currentammo = self.ammo_nails = self.ammo_nails - 2;
  635.     dir = aim (self, 1000);
  636.     launch_spike (self.origin + '0 0 16', dir);
  637.     newmis.touch = superspike_touch;
  638.     setmodel (newmis, "progs/s_spike.mdl");
  639.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  640.     self.punchangle_x = -2;
  641. };
  642.  
  643. void(float ox) W_FireSpikes =
  644. {
  645.     local vector    dir;
  646.     local entity    old;
  647.     
  648.     makevectors (self.v_angle);
  649.     
  650.     if (self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN)
  651.     {
  652.         W_FireSuperSpikes ();
  653.         return;
  654.     }
  655.  
  656.     if (self.ammo_nails < 1)
  657.     {
  658.         self.weapon = W_BestWeapon ();
  659.         W_SetCurrentAmmo ();
  660.         return;
  661.     }
  662.  
  663.     sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
  664.     self.attack_finished = time + 0.2;
  665.     self.currentammo = self.ammo_nails = self.ammo_nails - 1;
  666.     dir = aim (self, 1000);
  667.     launch_spike (self.origin + '0 0 16' + v_right*ox, dir);
  668.  
  669.     self.punchangle_x = -2;
  670. };
  671.  
  672.  
  673.  
  674. .float hit_z;
  675. void() spike_touch =
  676. {
  677. local float rand;
  678.     if (other == self.owner)
  679.         return;
  680.  
  681.     if (other.solid == SOLID_TRIGGER)
  682.         return;    // trigger field, do nothing
  683.  
  684.     if (pointcontents(self.origin) == CONTENT_SKY)
  685.     {
  686.         remove(self);
  687.         return;
  688.     }
  689.     
  690. // hit something that bleeds
  691.     if (other.takedamage)
  692.     {
  693.         spawn_touchblood (9);
  694.         T_Damage (other, self, self.owner, 9);
  695.     }
  696.     else
  697.     {
  698.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  699.         
  700.         if (self.classname == "wizspike")
  701.             WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
  702.         else if (self.classname == "knightspike")
  703.             WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
  704.         else
  705.             WriteByte (MSG_BROADCAST, TE_SPIKE);
  706.         WriteCoord (MSG_BROADCAST, self.origin_x);
  707.         WriteCoord (MSG_BROADCAST, self.origin_y);
  708.         WriteCoord (MSG_BROADCAST, self.origin_z);
  709.     }
  710.  
  711.     remove(self);
  712.  
  713. };
  714.  
  715. void() superspike_touch =
  716. {
  717. local float rand;
  718.     if (other == self.owner)
  719.         return;
  720.  
  721.     if (other.solid == SOLID_TRIGGER)
  722.         return;    // trigger field, do nothing
  723.  
  724.     if (pointcontents(self.origin) == CONTENT_SKY)
  725.     {
  726.         remove(self);
  727.         return;
  728.     }
  729.     
  730. // hit something that bleeds
  731.     if (other.takedamage)
  732.     {
  733.         spawn_touchblood (18);
  734.         T_Damage (other, self, self.owner, 18);
  735.     }
  736.     else
  737.     {
  738.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  739.         WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
  740.         WriteCoord (MSG_BROADCAST, self.origin_x);
  741.         WriteCoord (MSG_BROADCAST, self.origin_y);
  742.         WriteCoord (MSG_BROADCAST, self.origin_z);
  743.     }
  744.  
  745.     remove(self);
  746.  
  747. };
  748.  
  749. void() flare_touch;
  750. void() flare_bright;
  751. void() flare_dim;
  752.  
  753.  
  754. /*
  755. ================================
  756. launch_flare
  757. */
  758. void(vector org, vector dir) launch_flare =
  759. {
  760.     local   entity  missile;
  761.  
  762.     missile = spawn ();
  763.     missile.owner = self;
  764.     missile.movetype = MOVETYPE_FLYMISSILE;
  765.     missile.solid = SOLID_BBOX;
  766.  
  767.     missile.angles = vectoangles(dir);
  768.         missile.touch = flare_touch;
  769.     missile.classname = "spike";
  770.     missile.think = flare_bright;
  771.         missile.nextthink = time + 2;
  772.  
  773.     setmodel (missile, "progs/laser.mdl");
  774.     setsize (missile, VEC_ORIGIN, VEC_ORIGIN);               
  775.     setorigin (missile, org);
  776.         missile.velocity = dir * 800;
  777.  
  778. // Make the flare dim. (.effects is an 8-bit register)
  779.     missile.effects=8;
  780.  
  781. };
  782.  
  783. void() FlarePlayerTouch =  
  784. {
  785.         
  786.         self.origin = self.enemy.origin + '0 0 16';
  787.     if (self.velocity == '0 0 0')
  788.         self.avelocity = '0 0 0';
  789. };
  790.  
  791. /*
  792. ============================
  793. flare_touch
  794.  
  795. */
  796. void() flare_touch =
  797. {
  798. local float rand;
  799.     if (other == self.owner)
  800.         return;
  801.  
  802.     if (other.solid == SOLID_TRIGGER)
  803.         return; // trigger field, do nothing
  804.  
  805.     if (pointcontents(self.origin) == CONTENT_SKY)
  806.     {
  807.         remove(self);
  808.         return;
  809.     }
  810.     
  811. // has the flare hit something that bleeds?
  812.     if(other.takedamage == DAMAGE_AIM)
  813.     {
  814.                 spawn_touchblood (2);
  815.                 self.enemy = other;
  816.                 self.origin = self.enemy.origin + '0 0 8';
  817.         if (self.effects != EF_DIMLIGHT)
  818.         {
  819.                         sprint (self.owner, "You lit up ");
  820.             if (self.enemy.classname == "player")
  821.             {
  822.                 sprint (self.owner, self.enemy.netname);
  823.                 sprint (self.owner, "!\n");
  824.             
  825.                                 sprint (self.enemy, "You are lit up!");
  826.             }
  827.             else
  828.             {
  829.                 sprint (self.owner, "a ");
  830.                 sprint (self.owner, self.enemy.classname);
  831.                 sprint (self.owner, "!\n");
  832.             }
  833.             self.effects = EF_DIMLIGHT;
  834.                         self.touch = FlarePlayerTouch;
  835.         }
  836.  
  837.     }
  838.        else
  839.        {
  840.     self.movetype = MOVETYPE_NONE;
  841.     self.velocity = '0 0 0';
  842.     self.touch = SUB_Null;
  843.        }
  844. };
  845.  
  846.  
  847. /*
  848. ==============================
  849. flare_bright()
  850.  
  851. This function makes the flare
  852. emit brighter light
  853. ==============================
  854. */
  855.  
  856. void() flare_bright =
  857. {
  858.     local vector    vel;
  859.         self.effects=6;
  860.         self.nextthink = time + 15;
  861.     self.think = flare_dim;
  862.     sound (self, CHAN_WEAPON, "misc/power.wav", 1, ATTN_NORM);
  863.  
  864.     vel = '0 0 150';
  865.     particle (self.origin+vel*0.01,vel,111,150);
  866.         vel = '0 0 120';
  867.     particle (self.origin+vel*0.01,vel,73,200);
  868.  
  869.  
  870.  
  871. /*
  872. ==============================
  873. flare_dim()
  874.  
  875. This function makes the flare
  876. go dim again
  877. ==============================
  878. */
  879. };
  880.  
  881. void() flare_dim =
  882. {
  883.     self.effects=8;
  884.         self.nextthink = time + 10;
  885.     self.think = SUB_Remove;
  886. };
  887.  
  888. void(float ox) W_FireFlare =
  889. {
  890.     local vector    dir;
  891.         local entity    cold;
  892.     
  893.  
  894.         if (self.currentammo < 3)
  895.     {
  896.                 sprint(self,"A flare requires 3 nails\n");
  897.                 return;
  898.     }
  899.  
  900.     makevectors (self.v_angle);
  901.     
  902.         sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
  903.     self.attack_finished = time + 0.5;
  904.     dir = aim (self, 1000);
  905.         launch_flare (self.origin + '0 0 16' + v_right*ox, dir);
  906.         self.currentammo = self.ammo_nails = self.ammo_nails - 3;
  907.  
  908.     self.punchangle_x = -2;
  909. };
  910.  
  911.  
  912. /*
  913. ==============================================================================
  914.  
  915. ROCKETS
  916.  
  917. ==============================================================================
  918. */
  919.  
  920. void()    s_explode1    =    [0,        s_explode2] {};
  921. void()    s_explode2    =    [1,        s_explode3] {};
  922. void()    s_explode3    =    [2,        s_explode4] {};
  923. void()    s_explode4    =    [3,        s_explode5] {};
  924. void()    s_explode5    =    [4,        s_explode6] {};
  925. void()    s_explode6    =    [5,        SUB_Remove] {};
  926.  
  927. /*
  928. ===============
  929. launch_frag
  930.  
  931. Modified from launch_spike
  932. ===============
  933. */
  934. void(vector org, vector dir) launch_frag =
  935. {
  936.     newmis = spawn ();
  937.     newmis.owner = self;
  938.     newmis.movetype = MOVETYPE_FLYMISSILE;
  939.     newmis.solid = SOLID_BBOX;
  940.  
  941.     newmis.angles = vectoangles(dir);
  942.     
  943.         newmis.touch = superspike_touch;
  944.         newmis.classname = "spike";
  945.     newmis.think = SUB_Remove;
  946.     newmis.nextthink = time + 6;
  947.         setmodel (newmis, "progs/s_spike.mdl");
  948.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  949.     setorigin (newmis, org);
  950.  
  951.         newmis.velocity = dir * 1400;
  952. };
  953.  
  954.  
  955. void()BecomeExplosion =
  956. {
  957.  
  958.         self.movetype = MOVETYPE_NONE;
  959.     self.velocity = '0 0 0';
  960.     self.touch = SUB_Null;
  961.     setmodel (self, "progs/s_explod.spr");
  962.     self.solid = SOLID_NOT;
  963.     s_explode1 ();
  964. };
  965.  
  966. void() BecomeFragExplosion =
  967. {
  968.  
  969.         self.movetype = MOVETYPE_NONE;
  970.     self.velocity = '0 0 0';
  971.     self.touch = SUB_Null;
  972.     setmodel (self, "progs/s_explod.spr");
  973.     self.solid = SOLID_NOT;
  974.     s_explode1 ();
  975.  
  976.         launch_frag (self.origin + '0 0 8', '1 1 0');
  977.         launch_frag (self.origin + '0 0 8', '1 -1 0');
  978.         launch_frag (self.origin + '0 0 8', '-1 -1 0');
  979.         launch_frag (self.origin + '0 0 8', '-1 1 0');
  980.  
  981.         launch_frag (self.origin + '0 0 8', '1 0 45');
  982.         launch_frag (self.origin + '0 0 8', '-1 -1 45');
  983.         launch_frag (self.origin + '0 0 8', '-1 1 45');
  984.  
  985.         launch_frag (self.origin + '0 0 8', '1 1 70');
  986.         launch_frag (self.origin + '0 0 8', '-1 -1 70');
  987.  
  988. };
  989.  
  990. void() T_MissileTouch =
  991. {
  992.     local float    damg;
  993.  
  994.     if (other == self.owner)
  995.         return;        // don't explode on owner
  996.  
  997.     if (pointcontents(self.origin) == CONTENT_SKY)
  998.     {
  999.         remove(self);
  1000.         return;
  1001.     }
  1002.  
  1003.     damg = 100 + random()*20;
  1004.     
  1005.     if (other.health)
  1006.     {
  1007.         if (other.classname == "monster_shambler")
  1008.             damg = damg * 0.5;    // mostly immune
  1009.         T_Damage (other, self, self.owner, damg );
  1010.     }
  1011.  
  1012.     // don't do radius damage to the other, because all the damage
  1013.     // was done in the impact
  1014.     T_RadiusDamage (self, self.owner, 120, other);
  1015.  
  1016. //    sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  1017.     self.origin = self.origin - 8*normalize(self.velocity);
  1018.  
  1019.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  1020.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  1021.     WriteCoord (MSG_BROADCAST, self.origin_x);
  1022.     WriteCoord (MSG_BROADCAST, self.origin_y);
  1023.     WriteCoord (MSG_BROADCAST, self.origin_z);
  1024.  
  1025.     BecomeExplosion ();
  1026. };
  1027.  
  1028.  
  1029.  
  1030. /*
  1031. ================
  1032. W_FireRocket
  1033. ================
  1034. */
  1035. void() W_FireRocket =
  1036. {
  1037.     local    entity missile, mpuff;
  1038.     
  1039.     self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  1040.     
  1041.     sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
  1042.  
  1043.     self.punchangle_x = -2;
  1044.  
  1045.     missile = spawn ();
  1046.     missile.owner = self;
  1047.     missile.movetype = MOVETYPE_FLYMISSILE;
  1048.     missile.solid = SOLID_BBOX;
  1049.         
  1050. // set missile speed    
  1051.  
  1052.     makevectors (self.v_angle);
  1053.     missile.velocity = aim(self, 1000);
  1054.     missile.velocity = missile.velocity * 1000;
  1055.     missile.angles = vectoangles(missile.velocity);
  1056.     
  1057.     missile.touch = T_MissileTouch;
  1058.     
  1059. // set missile duration
  1060.     missile.nextthink = time + 5;
  1061.     missile.think = SUB_Remove;
  1062.  
  1063.     setmodel (missile, "progs/missile.mdl");
  1064.     setsize (missile, '0 0 0', '0 0 0');        
  1065.     setorigin (missile, self.origin + v_forward*8 + '0 0 16');
  1066. };
  1067.  
  1068. /*
  1069. ===============================================================================
  1070.  
  1071. LIGHTNING
  1072.  
  1073. ===============================================================================
  1074. */
  1075.  
  1076. /*
  1077. =================
  1078. LightningDamage
  1079. =================
  1080. */
  1081. void(vector p1, vector p2, entity from, float damage) LightningDamage =
  1082. {
  1083.     local entity        e1, e2;
  1084.     local vector        f;
  1085.     
  1086.     f = p2 - p1;
  1087.     normalize (f);
  1088.     f_x = 0 - f_y;
  1089.     f_y = f_x;
  1090.     f_z = 0;
  1091.     f = f*16;
  1092.  
  1093.     e1 = e2 = world;
  1094.  
  1095.     traceline (p1, p2, FALSE, self);
  1096.     if (trace_ent.takedamage)
  1097.     {
  1098.         particle (trace_endpos, '0 0 100', 225, damage*4);
  1099.         T_Damage (trace_ent, from, from, damage);
  1100.         if (self.classname == "player")
  1101.         {
  1102.             if (other.classname == "player")
  1103.                 trace_ent.velocity_z = trace_ent.velocity_z + 400;
  1104.         }
  1105.     }
  1106.     e1 = trace_ent;
  1107.  
  1108.     traceline (p1 + f, p2 + f, FALSE, self);
  1109.     if (trace_ent != e1 && trace_ent.takedamage)
  1110.     {
  1111.         particle (trace_endpos, '0 0 100', 225, damage*4);
  1112.         T_Damage (trace_ent, from, from, damage);
  1113.     }
  1114.     e2 = trace_ent;
  1115.  
  1116.     traceline (p1 - f, p2 - f, FALSE, self);
  1117.     if (trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage)
  1118.     {
  1119.         particle (trace_endpos, '0 0 100', 225, damage*4);
  1120.         T_Damage (trace_ent, from, from, damage);
  1121.     }
  1122. };
  1123.  
  1124.  
  1125. void() W_FireLightning =
  1126. {
  1127.     local    vector        org;
  1128.  
  1129.     if (self.ammo_cells < 1)
  1130.     {
  1131.         self.weapon = W_BestWeapon ();
  1132.         W_SetCurrentAmmo ();
  1133.         return;
  1134.     }
  1135.  
  1136. // explode if under water
  1137.     if (self.waterlevel > 1)
  1138.     {
  1139.         T_RadiusDamage (self, self, 35*self.ammo_cells, world);
  1140.         self.ammo_cells = 0;
  1141.         W_SetCurrentAmmo ();
  1142.         return;
  1143.     }
  1144.  
  1145.     if (self.t_width < time)
  1146.     {
  1147.         sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
  1148.         self.t_width = time + 0.6;
  1149.     }
  1150.     self.punchangle_x = -2;
  1151.  
  1152.     self.currentammo = self.ammo_cells = self.ammo_cells - 1;
  1153.  
  1154.     org = self.origin + '0 0 16';
  1155.     
  1156.     traceline (org, org + v_forward*600, TRUE, self);
  1157.  
  1158.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  1159.     WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
  1160.     WriteEntity (MSG_BROADCAST, self);
  1161.     WriteCoord (MSG_BROADCAST, org_x);
  1162.     WriteCoord (MSG_BROADCAST, org_y);
  1163.     WriteCoord (MSG_BROADCAST, org_z);
  1164.     WriteCoord (MSG_BROADCAST, trace_endpos_x);
  1165.     WriteCoord (MSG_BROADCAST, trace_endpos_y);
  1166.     WriteCoord (MSG_BROADCAST, trace_endpos_z);
  1167.  
  1168.     LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
  1169. };
  1170.  
  1171. //=============================================================================
  1172.  
  1173. /*
  1174. ==================
  1175. ProxThink // Modified by DaScott (combines proxmine, gibgun, and a frag explosion)
  1176. ==================
  1177. */
  1178. void() GibGrenadeExplode;
  1179.  
  1180. void() ProxThink = 
  1181. {
  1182.         local entity head;
  1183.  
  1184.     if (time >= self.wait)
  1185.                 GibGrenadeExplode();
  1186.  
  1187.         head = findradius(self.origin,160);
  1188.         while(head)
  1189.         {
  1190.                 if( (head.classname != "door") && (head.health > 1) && (head.classname != "misc_explobox") &&
  1191. (head != self) && (head != self.owner) && !(head.items & IT_INVISIBILITY) )
  1192.                 {
  1193.                         GibGrenadeExplode();
  1194.                         return;
  1195.                 }
  1196.                 head = head.chain;
  1197.         }
  1198.         self.nextthink = time + 0.25;
  1199. };
  1200.  
  1201. void() GibGrenadeTouch =
  1202. {
  1203.     if (other == self.owner)
  1204.         return;        // don't explode on owner
  1205.     if (other.takedamage == DAMAGE_AIM)
  1206.     {
  1207.                 GibGrenadeExplode();
  1208.         return;
  1209.     }
  1210.     if (self.velocity == '0 0 0')
  1211.         self.avelocity = '0 0 0';
  1212. };
  1213.  
  1214.  
  1215. /*
  1216. =================
  1217. FireGibGrenade
  1218. =================
  1219. */
  1220. float() crandom;
  1221.  
  1222. void() FireGibGrenade =
  1223. {
  1224.         local   entity missile, mpuff;
  1225.         local   float das_gibgun;
  1226.  
  1227.         if (self.currentammo < 5)
  1228.     {
  1229.         sprint(self,"Requires 5 grenades\n");
  1230.                 return;
  1231.     }
  1232.         self.currentammo = self.ammo_rockets = self.ammo_rockets - 5;
  1233.     
  1234.         sound (self, CHAN_WEAPON, "player/tornoff2.wav", 1, ATTN_NORM);
  1235.  
  1236.     self.punchangle_x = -2;
  1237.  
  1238.     missile = spawn ();
  1239.     missile.owner = self;
  1240.         missile.movetype = MOVETYPE_TOSS;
  1241.     missile.solid = SOLID_BBOX;
  1242.         missile.classname = "grenade";
  1243.         
  1244. // set missile speed    
  1245.  
  1246.     makevectors (self.v_angle);
  1247.  
  1248.     if (self.v_angle_x)
  1249.                 missile.velocity = v_forward*400 + v_up * 150 + crandom()*v_right*10 + crandom()*v_up*10;
  1250.     else
  1251.     {
  1252.         missile.velocity = aim(self, 10000);
  1253.                 missile.velocity = missile.velocity * 400;
  1254.         missile.velocity_z = 200;
  1255.     }
  1256.  
  1257.     missile.avelocity = '300 300 300';
  1258.  
  1259.     missile.angles = vectoangles(missile.velocity);
  1260.     
  1261. //      missile.touch = GibGrenadeTouch;
  1262.     
  1263. // set missile duration
  1264.     missile.nextthink = time + 0.75;
  1265.     missile.think = ProxThink;
  1266.  
  1267.         missile.wait = time + 120;
  1268.  
  1269.         das_gibgun = random();
  1270.  
  1271.        if (das_gibgun  < 0.3)
  1272.          setmodel (missile, "progs/h_player.mdl");
  1273.         else if (das_gibgun < 0.7)
  1274.          setmodel (missile, "progs/gib1.mdl");
  1275.         else
  1276.          setmodel (missile, "progs/gib3.mdl");
  1277.     setsize (missile, '0 0 0', '0 0 0');        
  1278.     setorigin (missile, self.origin);
  1279. };
  1280.  
  1281. void() GrenadeExplode =
  1282. {
  1283.     T_RadiusDamage (self, self.owner, 120, world);
  1284.  
  1285.           sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  1286.           BecomeFragExplosion ();
  1287. };
  1288.  
  1289.  
  1290. void() GrenadeTouch =
  1291. {
  1292.     if (other == self.owner)
  1293.         return;        // don't explode on owner
  1294.     if (other.takedamage == DAMAGE_AIM)
  1295.     {
  1296.         GrenadeExplode();
  1297.         return;
  1298.     }
  1299.     sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);    // bounce sound
  1300.     if (self.velocity == '0 0 0')
  1301.         self.avelocity = '0 0 0';
  1302. };
  1303.  
  1304.  
  1305. /*
  1306. ***********
  1307. Gib prox mine explosion by DaScott
  1308. ************
  1309. */
  1310.  
  1311. void() GibGrenadeExplode =
  1312. {
  1313.         T_RadiusDamage (self, self.owner, 180, world);
  1314.  
  1315.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  1316.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  1317.     WriteCoord (MSG_BROADCAST, self.origin_x);
  1318.     WriteCoord (MSG_BROADCAST, self.origin_y);
  1319.     WriteCoord (MSG_BROADCAST, self.origin_z);
  1320.  
  1321.         SpawnMeatSpray(self.origin, '350 250 450');
  1322.         SpawnMeatSpray(self.origin, '-100 350 200');
  1323.         SpawnMeatSpray(self.origin, '200 -300 250');
  1324.  
  1325.         launch_frag (self.origin + '0 0 16', '0 1 0');
  1326.         launch_frag (self.origin + '0 0 16', '1 1 0');
  1327.         launch_frag (self.origin + '0 0 16', '1 0 0');
  1328.         launch_frag (self.origin + '0 0 16', '1 -1 0');
  1329.         launch_frag (self.origin + '0 0 16', '0 -1 0');
  1330.         launch_frag (self.origin + '0 0 16', '-1 -1 0');
  1331.         launch_frag (self.origin + '0 0 16', '-1 0 0');
  1332.         launch_frag (self.origin + '0 0 16', '-1 1 0');
  1333.  
  1334.         BecomeExplosion();
  1335. };
  1336.  
  1337.  
  1338.  
  1339. /*
  1340. ================
  1341. W_FireGrenade
  1342. ================
  1343. */
  1344. void() W_FireGrenade =
  1345. {
  1346.     local    entity missile, mpuff;
  1347.     
  1348.     self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  1349.     
  1350.     sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  1351.  
  1352.     self.punchangle_x = -2;
  1353.  
  1354.     missile = spawn ();
  1355.     missile.owner = self;
  1356.     missile.movetype = MOVETYPE_BOUNCE;
  1357.     missile.solid = SOLID_BBOX;
  1358.     missile.classname = "grenade";
  1359.         
  1360. // set missile speed    
  1361.  
  1362.     makevectors (self.v_angle);
  1363.  
  1364.     if (self.v_angle_x)
  1365.         missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
  1366.     else
  1367.     {
  1368.         missile.velocity = aim(self, 10000);
  1369.         missile.velocity = missile.velocity * 600;
  1370.         missile.velocity_z = 200;
  1371.     }
  1372.  
  1373.     missile.avelocity = '300 300 300';
  1374.  
  1375.     missile.angles = vectoangles(missile.velocity);
  1376.     
  1377.     missile.touch = GrenadeTouch;
  1378.     
  1379. // set missile duration
  1380.     missile.nextthink = time + 2.5;
  1381.     missile.think = GrenadeExplode;
  1382.  
  1383.     setmodel (missile, "progs/grenade.mdl");
  1384.     setsize (missile, '0 0 0', '0 0 0');        
  1385.     setorigin (missile, self.origin);
  1386. };
  1387.  
  1388. void() FireDamage =
  1389. {
  1390.     local entity loser;
  1391.     self.wait = self.wait - 1;
  1392.     loser = self.trigger_field;
  1393.  
  1394.         if (loser.waterlevel > 2)
  1395.          remove(self);
  1396.  
  1397.         if ((self.wait == 35) || (self.wait == 25) || (self.wait == 15)) sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
  1398.  
  1399.         if ((!self.wait) || (loser.health<=0))
  1400.         remove(self);
  1401.  
  1402.         T_Damage (loser, self, self.owner, 3);
  1403.         spawn_touchblood (20);
  1404.  
  1405.     self.origin = loser.origin + '0 0 12';
  1406.     self.nextthink = time + 0.05;
  1407.         self.think = FireDamage;
  1408.         
  1409. };
  1410.  
  1411. void() FireTouch =
  1412. {
  1413.     local float     damg;
  1414.  
  1415.     if (other == self.owner)
  1416.         return;         // don't explode on owner
  1417.  
  1418.     if (pointcontents(self.origin) == CONTENT_SKY)
  1419.     {
  1420.         remove(self);
  1421.         return;
  1422.     }
  1423.  
  1424.  
  1425.         if (other.takedamage)
  1426.     {
  1427.         sound (self, CHAN_WEAPON, "player/tornoff2.wav", 1, ATTN_NORM);    
  1428.         self.trigger_field = other;
  1429.         self.origin = other.origin + '0 0 12';
  1430.         self.wait = 40;
  1431.  
  1432.         self.nextthink = time + 0.05;
  1433.                 self.think = FireDamage;
  1434.         self.movetype = MOVETYPE_NOCLIP;
  1435.         self.velocity = '0 0 0' ;
  1436.         self.avelocity = '0 0 1000';
  1437.                 if ((other.waterlevel < 2) && (other.classname == "player"))
  1438.                 sprint(other, "You're burning up!\n");
  1439.         return;
  1440.     }
  1441.         T_RadiusDamage (self, self.owner, 75, other);
  1442.  
  1443.     self.origin = self.origin - 8*normalize(self.velocity);
  1444.  
  1445.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  1446.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  1447.     WriteCoord (MSG_BROADCAST, self.origin_x);
  1448.     WriteCoord (MSG_BROADCAST, self.origin_y);
  1449.     WriteCoord (MSG_BROADCAST, self.origin_z);
  1450.  
  1451.     BecomeExplosion ();
  1452.  
  1453. };
  1454.  
  1455. /*
  1456. ================
  1457. FireBall  
  1458. ================
  1459. */
  1460. void() FireBall =
  1461. {
  1462.     local   entity missile, mpuff;
  1463.     
  1464.         if (self.currentammo < 5)
  1465.     {
  1466.                 sprint(self,"A fireball requires 5 nails\n");
  1467.                 return;
  1468.     }
  1469.         if (self.waterlevel > 2)
  1470.         {
  1471.                 sound (self, CHAN_WEAPON, "player/slimbrn2.wav", 1, ATTN_NORM);
  1472.                 sprint(self,"Fireball fizzled underwater\n");
  1473.                 self.currentammo = self.ammo_nails = self.ammo_nails - 5;
  1474.                 return;
  1475.         }
  1476.  
  1477.         self.currentammo = self.ammo_nails = self.ammo_nails - 5;
  1478.     
  1479.         sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
  1480.  
  1481.         self.punchangle_x = -6;
  1482.  
  1483.     missile = spawn ();
  1484.     missile.owner = self;
  1485.     missile.movetype = MOVETYPE_FLYMISSILE;
  1486.     missile.solid = SOLID_BBOX;
  1487.         missile.effects = 8;
  1488.         
  1489. // set missile speed    
  1490.  
  1491.     makevectors (self.v_angle);
  1492.     missile.velocity = aim(self, 1000);
  1493.     missile.velocity = missile.velocity * 1000;
  1494.     missile.angles = vectoangles(missile.velocity);
  1495.     
  1496.         missile.touch = FireTouch;
  1497.     
  1498. // set missile duration
  1499.     missile.nextthink = time + 5;
  1500.     missile.think = SUB_Remove;
  1501.         setmodel (missile, "progs/lavaball.mdl");
  1502.     setsize (missile, '0 0 0', '0 0 0');            
  1503.     setorigin (missile, self.origin + v_forward*8 + '0 0 16');
  1504. };
  1505.  
  1506.  
  1507.  
  1508. /*
  1509. ===============================================================================
  1510.  
  1511. PLAYER WEAPON USE
  1512.  
  1513. ===============================================================================
  1514. */
  1515.  
  1516. void() W_SetCurrentAmmo =
  1517. {
  1518.     player_run ();        // get out of any weapon firing states
  1519.  
  1520.     //OBSERVER ADDON *************************
  1521.     if (self.impulse >= 1  && self.flags >= FL_OBSERVER)
  1522.         return;
  1523.     //****************************************
  1524.  
  1525.     self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
  1526.  
  1527.         if (self.invincible_time)
  1528.         {
  1529.         self.currentammo = 0;
  1530.                 self.weaponmodel = "";
  1531.         self.weaponframe = 0;
  1532.         }                
  1533.         else if (self.weapon == IT_AXE)
  1534.     {
  1535.         self.currentammo = 0;
  1536.         self.weaponmodel = "progs/v_axe.mdl";
  1537.         self.weaponframe = 0;
  1538.     }
  1539.     else if (self.weapon == IT_SHOTGUN)
  1540.     {
  1541.         self.currentammo = self.ammo_shells;
  1542.         self.weaponmodel = "progs/v_shot.mdl";
  1543.         self.weaponframe = 0;
  1544.         self.items = self.items | IT_SHELLS;
  1545.     }
  1546.     else if (self.weapon == IT_SUPER_SHOTGUN)
  1547.     {
  1548.         self.currentammo = self.ammo_shells;
  1549.         self.weaponmodel = "progs/v_shot2.mdl";
  1550.         self.weaponframe = 0;
  1551.         self.items = self.items | IT_SHELLS;
  1552.     }
  1553.     else if (self.weapon == IT_NAILGUN)
  1554.     {
  1555.         self.currentammo = self.ammo_nails;
  1556.         self.weaponmodel = "progs/v_nail.mdl";
  1557.         self.weaponframe = 0;
  1558.         self.items = self.items | IT_NAILS;
  1559.     }
  1560.     else if (self.weapon == IT_SUPER_NAILGUN)
  1561.     {
  1562.         self.currentammo = self.ammo_nails;
  1563.         self.weaponmodel = "progs/v_nail2.mdl";
  1564.         self.weaponframe = 0;
  1565.         self.items = self.items | IT_NAILS;
  1566.     }
  1567.     else if (self.weapon == IT_GRENADE_LAUNCHER)
  1568.     {
  1569.         self.currentammo = self.ammo_rockets;
  1570.         self.weaponmodel = "progs/v_rock.mdl";
  1571.         self.weaponframe = 0;
  1572.         self.items = self.items | IT_ROCKETS;
  1573.     }
  1574.     else if (self.weapon == IT_ROCKET_LAUNCHER)
  1575.     {
  1576.         self.currentammo = self.ammo_rockets;
  1577.         self.weaponmodel = "progs/v_rock2.mdl";
  1578.         self.weaponframe = 0;
  1579.         self.items = self.items | IT_ROCKETS;
  1580.     }
  1581.     else if (self.weapon == IT_LIGHTNING)
  1582.     {
  1583.         self.currentammo = self.ammo_cells;
  1584.         self.weaponmodel = "progs/v_light.mdl";
  1585.         self.weaponframe = 0;
  1586.         self.items = self.items | IT_CELLS;
  1587.     }
  1588.     else
  1589.     {
  1590.         self.currentammo = 0;
  1591.         self.weaponmodel = "";
  1592.         self.weaponframe = 0;
  1593.     }
  1594. };
  1595.  
  1596. float() W_BestWeapon =
  1597. {
  1598.     local    float    it;
  1599.     
  1600.     it = self.items;
  1601.  
  1602.     //OBSERVER ADDON *************************
  1603.     if (self.impulse >= 1  && self.flags >= FL_OBSERVER)
  1604.         return;
  1605.     //****************************************
  1606.  
  1607.     if(self.ammo_cells >= 1 && (it & IT_LIGHTNING) )
  1608.         return IT_LIGHTNING;
  1609.     else if(self.ammo_nails >= 2 && (it & IT_SUPER_NAILGUN) )
  1610.         return IT_SUPER_NAILGUN;
  1611.     else if(self.ammo_shells >= 2 && (it & IT_SUPER_SHOTGUN) )
  1612.         return IT_SUPER_SHOTGUN;
  1613.     else if(self.ammo_nails >= 1 && (it & IT_NAILGUN) )
  1614.         return IT_NAILGUN;
  1615.     else if(self.ammo_shells >= 1 && (it & IT_SHOTGUN) )
  1616.         return IT_SHOTGUN;
  1617.         
  1618. /*
  1619.     if(self.ammo_rockets >= 1 && (it & IT_ROCKET_LAUNCHER) )
  1620.         return IT_ROCKET_LAUNCHER;
  1621.     else if(self.ammo_rockets >= 1 && (it & IT_GRENADE_LAUNCHER) )
  1622.         return IT_GRENADE_LAUNCHER;
  1623.  
  1624. */
  1625.  
  1626.     return IT_AXE;
  1627. };
  1628.  
  1629. float() W_CheckNoAmmo =
  1630. {
  1631.  
  1632.     //OBSERVER ADDON *************************
  1633.     if (self.impulse >= 1  && self.flags >= FL_OBSERVER)
  1634.         return;
  1635.     //****************************************
  1636.  
  1637.     if (self.currentammo > 0)
  1638.         return TRUE;
  1639.  
  1640.         if (self.invincible_time)
  1641.                 return TRUE;
  1642.  
  1643.     if (self.weapon == IT_AXE)
  1644.         return TRUE;
  1645.     
  1646.     self.weapon = W_BestWeapon ();
  1647.  
  1648.     W_SetCurrentAmmo ();
  1649.     
  1650. // drop the weapon down
  1651.     return FALSE;
  1652. };
  1653.  
  1654. /*
  1655. ============
  1656. W_Attack
  1657.  
  1658. An attack impulse can be triggered now
  1659. ============
  1660. */
  1661. void()    player_axe1;
  1662. void()    player_axeb1;
  1663. void()    player_axec1;
  1664. void()    player_axed1;
  1665. void()    player_shot1;
  1666. void()    player_nail1;
  1667. void()    player_light1;
  1668. void()    player_rocket1;
  1669. void()  player_dattack;
  1670.  
  1671. void() W_Attack =
  1672. {
  1673.     local    float    r;
  1674.  
  1675.     if (!W_CheckNoAmmo ())
  1676.         return;
  1677.  
  1678.         if (self.flags >= FL_OBSERVER)
  1679.         return;
  1680.  
  1681.  
  1682.     makevectors    (self.v_angle);            // calculate forward angle for velocity
  1683.     self.show_hostile = time + 1;    // wake monsters up
  1684.  
  1685.         if (self.invincible_time)
  1686.         {
  1687.                 self.attack_finished = time + 1;
  1688.                 player_dattack();
  1689.         }
  1690.         else if (self.weapon == IT_AXE)
  1691.     {
  1692.                 if (self.ammo_cells > 0)
  1693.                 {
  1694.                 sound (self, CHAN_AUTO, "weapons/lhit.wav", 1, ATTN_NORM);
  1695.                 }
  1696.                 else
  1697.         sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
  1698.  
  1699.         r = random();
  1700.         if (r < 0.25)
  1701.             player_axe1 ();
  1702.         else if (r<0.5)
  1703.             player_axeb1 ();
  1704.         else if (r<0.75)
  1705.             player_axec1 ();
  1706.         else
  1707.             player_axed1 ();
  1708.         self.attack_finished = time + 0.5;
  1709.     }
  1710.     else if (self.weapon == IT_SHOTGUN)
  1711.     {
  1712.         player_shot1 ();
  1713.         W_FireShotgun ();
  1714.         self.attack_finished = time + 0.5;
  1715.     }
  1716.     else if (self.weapon == IT_SUPER_SHOTGUN)
  1717.     {
  1718.         player_shot1 ();
  1719.         W_FireSuperShotgun ();
  1720.         self.attack_finished = time + 0.7;
  1721.     }
  1722.     else if (self.weapon == IT_NAILGUN)
  1723.     {
  1724.         player_nail1 ();
  1725.     }
  1726.     else if (self.weapon == IT_SUPER_NAILGUN)
  1727.     {
  1728.         player_nail1 ();
  1729.     }
  1730.     else if (self.weapon == IT_GRENADE_LAUNCHER)
  1731.     {
  1732.         player_rocket1();
  1733.         W_FireGrenade();
  1734.         self.attack_finished = time + 0.6;
  1735.     }
  1736.     else if (self.weapon == IT_ROCKET_LAUNCHER)
  1737.     {
  1738.         player_rocket1();
  1739.         W_FireRocket();
  1740.         self.attack_finished = time + 0.8;
  1741.     }
  1742.     else if (self.weapon == IT_LIGHTNING)
  1743.     {
  1744.         player_light1();
  1745.         self.attack_finished = time + 0.1;
  1746.         sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
  1747.     }
  1748. };
  1749.  
  1750. /*
  1751. ============
  1752. W_ChangeWeapon
  1753.  
  1754. ============
  1755. */
  1756. void() W_ChangeWeapon =
  1757. {
  1758.     local    float    it, am, fl;
  1759.     
  1760.     it = self.items;
  1761.     am = 0;
  1762.     
  1763.     //OBSERVER ADDON *************************
  1764.     if (self.impulse >= 1  && self.flags >= FL_OBSERVER)
  1765.         return;
  1766.     //****************************************
  1767.  
  1768.     if (self.impulse == 1)
  1769.     {
  1770.         fl = IT_AXE;
  1771.     }
  1772.     else if (self.impulse == 2)
  1773.     {
  1774.         fl = IT_SHOTGUN;
  1775.         if (self.ammo_shells < 1)
  1776.             am = 1;
  1777.     }
  1778.     else if (self.impulse == 3)
  1779.     {
  1780.         fl = IT_SUPER_SHOTGUN;
  1781.         if (self.ammo_shells < 2)
  1782.             am = 1;
  1783.     }        
  1784.     else if (self.impulse == 4)
  1785.     {
  1786.         fl = IT_NAILGUN;
  1787.         if (self.ammo_nails < 1)
  1788.             am = 1;
  1789.     }
  1790.     else if (self.impulse == 5)
  1791.     {
  1792.         fl = IT_SUPER_NAILGUN;
  1793.         if (self.ammo_nails < 2)
  1794.             am = 1;
  1795.     }
  1796.     else if (self.impulse == 6)
  1797.     {
  1798.         fl = IT_GRENADE_LAUNCHER;
  1799.         if (self.ammo_rockets < 1)
  1800.             am = 1;
  1801.     }
  1802.     else if (self.impulse == 7)
  1803.     {
  1804.         fl = IT_ROCKET_LAUNCHER;
  1805.         if (self.ammo_rockets < 1)
  1806.             am = 1;
  1807.     }
  1808.     else if (self.impulse == 8)
  1809.     {
  1810.         fl = IT_LIGHTNING;
  1811.         if (self.ammo_cells < 1)
  1812.             am = 1;
  1813.     }
  1814.  
  1815.     self.impulse = 0;
  1816.     
  1817.     if (!(self.items & fl))
  1818.     {    // don't have the weapon or the ammo
  1819.         sprint (self, "no weapon.\n");
  1820.         return;
  1821.     }
  1822.     
  1823.     if (am)
  1824.     {    // don't have the ammo
  1825.         sprint (self, "not enough ammo.\n");
  1826.         return;
  1827.     }
  1828.  
  1829. //
  1830. // set weapon, set ammo
  1831. //
  1832.     self.weapon = fl;        
  1833.     W_SetCurrentAmmo ();
  1834. };
  1835.  
  1836. /*
  1837. ============
  1838. CheatCommand
  1839. ============
  1840. */
  1841. void() CheatCommand =
  1842. {
  1843.     if (deathmatch || coop)
  1844.         return;
  1845.  
  1846.     self.ammo_rockets = 100;
  1847.     self.ammo_nails = 200;
  1848.         self.ammo_shells = 200;
  1849.     self.items = self.items | 
  1850.         IT_AXE |
  1851.         IT_SHOTGUN |
  1852.         IT_SUPER_SHOTGUN |
  1853.         IT_NAILGUN |
  1854.         IT_SUPER_NAILGUN |
  1855.         IT_GRENADE_LAUNCHER |
  1856.         IT_ROCKET_LAUNCHER |
  1857.         IT_KEY1 | IT_KEY2;
  1858.  
  1859.     self.ammo_cells = 200;
  1860.     self.items = self.items | IT_LIGHTNING;
  1861.  
  1862.     self.weapon = IT_ROCKET_LAUNCHER;
  1863.     self.impulse = 0;
  1864.     W_SetCurrentAmmo ();
  1865. };
  1866.  
  1867. /*
  1868. ============
  1869. CycleWeaponCommand
  1870.  
  1871. Go to the next weapon with ammo
  1872. ============
  1873. */
  1874. void() CycleWeaponCommand =
  1875. {
  1876.     local    float    it, am;
  1877.     
  1878.     it = self.items;
  1879.     //OBSERVER ADDON *************************
  1880.     if (self.impulse >= 1  && self.flags >= FL_OBSERVER)
  1881.         return;
  1882.     //****************************************
  1883.  
  1884.  
  1885.     self.impulse = 0;
  1886.  
  1887.     while (1)
  1888.     {
  1889.         am = 0;
  1890.  
  1891.         if (self.weapon == IT_LIGHTNING)
  1892.         {
  1893.             self.weapon = IT_AXE;
  1894.         }
  1895.         else if (self.weapon == IT_AXE)
  1896.         {
  1897.             self.weapon = IT_SHOTGUN;
  1898.             if (self.ammo_shells < 1)
  1899.                 am = 1;
  1900.         }
  1901.         else if (self.weapon == IT_SHOTGUN)
  1902.         {
  1903.             self.weapon = IT_SUPER_SHOTGUN;
  1904.             if (self.ammo_shells < 2)
  1905.                 am = 1;
  1906.         }        
  1907.         else if (self.weapon == IT_SUPER_SHOTGUN)
  1908.         {
  1909.             self.weapon = IT_NAILGUN;
  1910.             if (self.ammo_nails < 1)
  1911.                 am = 1;
  1912.         }
  1913.         else if (self.weapon == IT_NAILGUN)
  1914.         {
  1915.             self.weapon = IT_SUPER_NAILGUN;
  1916.             if (self.ammo_nails < 2)
  1917.                 am = 1;
  1918.         }
  1919.         else if (self.weapon == IT_SUPER_NAILGUN)
  1920.         {
  1921.             self.weapon = IT_GRENADE_LAUNCHER;
  1922.             if (self.ammo_rockets < 1)
  1923.                 am = 1;
  1924.         }
  1925.         else if (self.weapon == IT_GRENADE_LAUNCHER)
  1926.         {
  1927.             self.weapon = IT_ROCKET_LAUNCHER;
  1928.             if (self.ammo_rockets < 1)
  1929.                 am = 1;
  1930.         }
  1931.         else if (self.weapon == IT_ROCKET_LAUNCHER)
  1932.         {
  1933.             self.weapon = IT_LIGHTNING;
  1934.             if (self.ammo_cells < 1)
  1935.                 am = 1;
  1936.         }
  1937.     
  1938.         if ( (self.items & self.weapon) && am == 0)
  1939.         {
  1940.             W_SetCurrentAmmo ();
  1941.             return;
  1942.         }
  1943.     }
  1944.  
  1945. };
  1946.  
  1947. /*
  1948. ============
  1949. ServerflagsCommand
  1950.  
  1951. Just for development
  1952. ============
  1953. */
  1954. void() ServerflagsCommand =
  1955. {
  1956.     serverflags = serverflags * 2 + 1;
  1957. };
  1958.  
  1959. void() QuadCheat =
  1960. {
  1961.     if (deathmatch || coop)
  1962.         return;
  1963.     self.super_time = 1;
  1964.     self.super_damage_finished = time + 30;
  1965.     self.items = self.items | IT_QUAD;
  1966.     dprint ("quad cheat\n");
  1967. };
  1968.  
  1969. void() FiendCheat =
  1970. {
  1971.         // No Cheating during net games.
  1972.         if (deathmatch || coop)
  1973.                 return;
  1974.         self.invincible_time = 1;
  1975.         self.invincible_finished = time + 120;
  1976.         self.weaponmodel = "";
  1977.         self.view_ofs = '0 0 4';
  1978.         self.items = self.items | IT_INVULNERABILITY;
  1979.         dprint ("You fiend!\n");
  1980. };
  1981.  
  1982. /*
  1983. ==================
  1984. FireAlternate
  1985. ==================
  1986. */
  1987. void() FireAlternate =
  1988. {
  1989.         if (self.invincible_time || self.flags >= FL_OBSERVER)
  1990.           return;
  1991.         if(self.weapon == IT_ROCKET_LAUNCHER)
  1992.     {
  1993.         FireHomingMissile();
  1994.         self.attack_finished = time + 1.0;        
  1995.     }
  1996.         if(self.weapon == IT_GRENADE_LAUNCHER)
  1997.         {
  1998.                 FireGibGrenade();
  1999.                 self.attack_finished = time + 0.8;
  2000.         }
  2001.         if(self.weapon == IT_SUPER_SHOTGUN)
  2002.         {
  2003.                 FireSniper ();
  2004.                 self.attack_finished = time + 1.2;
  2005.         }
  2006.         if(self.weapon == IT_NAILGUN)
  2007.         {
  2008.                 W_FireFlare ();
  2009.                 self.attack_finished = time + 0.8;
  2010.         }
  2011.         if(self.weapon == IT_SUPER_NAILGUN)
  2012.         {
  2013.                 FireBall();
  2014.                 self.attack_finished = time + 1.0;
  2015.         }
  2016. };     
  2017.  
  2018. void() Observer =
  2019. {
  2020. //*********************************************************     
  2021.     // BEGIN OBSERVER CODE
  2022. //**********************************************************
  2023.  
  2024.     // Change player to  different model
  2025.  
  2026.         setmodel (self, "progs/h_zombie.mdl");
  2027.     self.invisible_time = 1;
  2028.     self.invisible_finished = time + 10000;
  2029.     
  2030.  
  2031. self.items = self.items | IT_INVISIBILITY;   
  2032. // GOD MODE
  2033.     
  2034.     self.weapon = 0;
  2035.     self.frags = 0;        // REMOVE FRAGS
  2036.     self.solid = SOLID_NOT;
  2037.  
  2038.          centerprint(self,"OBSERVER MODE: Impulse 211 for help"); 
  2039.      bprint(self.netname); 
  2040.          bprint(" IS NOW AN OBSERVER\n");   
  2041.  
  2042. // Don't allow player to return to normal until next level game
  2043.  
  2044.         
  2045.  
  2046.  
  2047. };              // END OBSERVER FUNCTION
  2048.  
  2049. void() ID =
  2050. {
  2051. };
  2052.  
  2053. void () ShowHelp;
  2054. void () ShowSettings;
  2055. void () ObserverHelp;
  2056.  
  2057. /*
  2058. ============
  2059. ImpulseCommands
  2060.  
  2061. ============
  2062. */
  2063. void() ImpulseCommands =
  2064. {
  2065.         if (self.impulse == 211)
  2066.              ObserverHelp();
  2067.  
  2068.         if (self.impulse == 30)
  2069.              ShowHelp();
  2070.  
  2071.         if (self.impulse == 35)
  2072.              ShowSettings();
  2073.  
  2074.     if (self.impulse >= 1 && self.flags >= FL_OBSERVER)
  2075.         return;
  2076.  
  2077.     if (self.impulse >= 1 && self.impulse <= 8)
  2078.         W_ChangeWeapon ();
  2079.  
  2080.     if (self.impulse == 9)
  2081.         CheatCommand ();
  2082.     if (self.impulse == 10)
  2083.         CycleWeaponCommand ();
  2084.     if (self.impulse == 11)
  2085.         ServerflagsCommand ();
  2086.  
  2087.         if (self.impulse == 20)
  2088.                 FireAlternate();
  2089.         if (self.impulse == 21)
  2090.                 ThrowBackpack();
  2091.  
  2092.         if (self.impulse == 254)
  2093.                 FiendCheat ();
  2094.  
  2095.     if (self.impulse == 255)
  2096.         QuadCheat ();
  2097.         
  2098. // *************************************************************************
  2099. // **                                          **
  2100. // ** M U L T I S K I N  1.1  (start)                                     **
  2101. // **                                      **
  2102. // *************************************************************************
  2103.  
  2104.  
  2105.     if ((self.impulse == 200) || (self.impulse == 201))
  2106.     {
  2107.         if (self.impulse == 200)
  2108.         {
  2109.         self.skin = self.skin + 1;
  2110.         if (self.skin == 19) self.skin = 0;
  2111.         } else
  2112.         if (self.impulse == 201)
  2113.         {
  2114.         self.skin = self.skin - 1;
  2115.         if (self.skin == -1) self.skin = 18;
  2116.         }
  2117.         if (self.skin == 0) centerprint(self, "SKIN: Default Player (1)"); else
  2118.                 if (self.skin == 1) centerprint(self, "SKIN: Duke Nukem, really 3D (2)"); else
  2119.         if (self.skin == 2) centerprint(self, "SKIN: Mr. Toad (3)"); else
  2120.                 if (self.skin == 3) centerprint(self, "SKIN: Stormtrooper (4)"); else
  2121.         if (self.skin == 4) centerprint(self, "SKIN: Max (5)"); else
  2122.                 if (self.skin == 5) centerprint(self, "SKIN: Terminator (6)"); else
  2123.         if (self.skin == 6) centerprint(self, "SKIN: Judge Dredd (7)"); else
  2124.                 if (self.skin == 7) centerprint(self, "SKIN: Recon Marine (8)"); else
  2125.         if (self.skin == 8) centerprint(self, "SKIN: Captain Picard (9)"); else
  2126.                 if (self.skin == 9) centerprint(self, "SKIN: Wizard (10)"); else
  2127.                 if (self.skin == 10) centerprint(self,"SKIN: Predator (11)"); else
  2128.         if (self.skin == 11) centerprint(self,"SKIN: Skeleton (12)"); else
  2129.         if (self.skin == 12) centerprint(self,"SKIN: Wan-Fu (13)"); else
  2130.         if (self.skin == 13) centerprint(self,"SKIN: Henry Rollins (14)"); else
  2131.         if (self.skin == 14) centerprint(self,"SKIN: He-Man (15)"); else
  2132.                 if (self.skin == 15) centerprint(self,"SKIN: Boba Fett(16)"); else
  2133.         if (self.skin == 16) centerprint(self,"SKIN: Superman (17)"); else
  2134.         if (self.skin == 17) centerprint(self,"SKIN: NYPD Cop (18)"); else
  2135.         if (self.skin == 18) centerprint(self,"SKIN: The Avatar (19)");
  2136.     }
  2137.  
  2138. // *************************************************************************
  2139. // **                                          **
  2140. // ** M U L T I S K I N  1.1  (end)                                       **
  2141. // **                                      **
  2142. // *************************************************************************
  2143.  
  2144.     if (self.impulse == 210)
  2145.         {
  2146.         Observer();    // RUN OBSERVER FUNCTION
  2147.         self.flags = self.flags + FL_OBSERVER;   // SET OBSERVER FLAG
  2148.         self.flags = self.flags + FL_FLY;   
  2149.         self.movetype = MOVETYPE_NOCLIP;   
  2150.         }
  2151.  
  2152.  
  2153.     self.impulse = 0;
  2154. };
  2155.  
  2156. /*
  2157. ============
  2158. W_WeaponFrame
  2159.  
  2160. Called every frame so impulse events can be handled as well as possible
  2161. ============
  2162. */
  2163. void() W_WeaponFrame =
  2164. {
  2165.     if (time < self.attack_finished)
  2166.         return;
  2167.  
  2168.     ImpulseCommands ();
  2169.     
  2170. // check for attack
  2171.     if (self.button0)
  2172.     {
  2173.         SuperDamageSound ();
  2174.         W_Attack ();
  2175.     }
  2176. };
  2177.  
  2178. /*
  2179. ========
  2180. SuperDamageSound
  2181.  
  2182. Plays sound if needed
  2183. ========
  2184. */
  2185. void() SuperDamageSound =
  2186. {
  2187.     if (self.super_damage_finished > time)
  2188.     {
  2189.         if (self.super_sound < time)
  2190.         {
  2191.             self.super_sound = time + 1;
  2192.             sound (self, CHAN_BODY, "items/damage3.wav", 1, ATTN_NORM);
  2193.         }
  2194.     }
  2195.     return;
  2196. };
  2197.  
  2198.  
  2199.