home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / jsqcmod1 / client.qc next >
Encoding:
Text File  |  1996-07-30  |  35.1 KB  |  1,487 lines

  1. /*
  2.     Mods:
  3.         No players receive kills for telefrags.
  4.         Enhanced teamplay options.
  5.  
  6.     Detail:
  7.         * Enhanced Teamplay -- teamplay 0 and 1 are the same as
  8.         originally.  teamplay negative penalizes players who kill their
  9.         teammates by the amount of teamplay.  Teamplay 100 will cause
  10.         players who kill their teammates to gib.  Teamplay -100 will gib
  11.         teammate killers AND deduct a frag.
  12.  
  13.     Mods by
  14.         John Spickes jspickes@eng.umd.edu
  15.         Josh Spickes spickesj@wam.umd.edu
  16.         Allen Seger
  17. */
  18.  
  19. // prototypes
  20. void () W_WeaponFrame;
  21. void() W_SetCurrentAmmo;
  22. void() player_pain;
  23. void() player_stand1;
  24. void (vector org) spawn_tfog;
  25. void (vector org, entity death_owner) spawn_tdeath;
  26.  
  27. float    modelindex_eyes, modelindex_player;
  28.  
  29. /*
  30. =============================================================================
  31.  
  32.                 LEVEL CHANGING / INTERMISSION
  33.  
  34. =============================================================================
  35. */
  36.  
  37. float    intermission_running;
  38. float    intermission_exittime;
  39.  
  40. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  41. This is the camera point for the intermission.
  42. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  43. */
  44. void() info_intermission =
  45. {
  46. };
  47.  
  48.  
  49.  
  50. void() SetChangeParms =
  51. {
  52. // remove items
  53.     self.items = self.items - (self.items & 
  54.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  55.     
  56. // cap super health
  57.     if (self.health > 100)
  58.         self.health = 100;
  59.     if (self.health < 50)
  60.         self.health = 50;
  61.     parm1 = self.items;
  62.     parm2 = self.health;
  63.     parm3 = self.armorvalue;
  64.     if (self.ammo_shells < 25)
  65.         parm4 = 25;
  66.     else
  67.         parm4 = self.ammo_shells;
  68.     parm5 = self.ammo_nails;
  69.     parm6 = self.ammo_rockets;
  70.     parm7 = self.ammo_cells;
  71.     parm8 = self.weapon;
  72.     parm9 = self.armortype * 100;
  73. };
  74.  
  75. void() SetNewParms =
  76. {
  77.     parm1 = IT_SHOTGUN | IT_AXE;
  78.     parm2 = 100;
  79.     parm3 = 0;
  80.     parm4 = 25;
  81.     parm5 = 0;
  82.     parm6 = 0;
  83.     parm6 = 0;
  84.     parm8 = 1;
  85.     parm9 = 0;
  86. };
  87.  
  88. void() DecodeLevelParms =
  89. {
  90.     if (serverflags)
  91.     {
  92.         if (world.model == "maps/start.bsp")
  93.             SetNewParms ();        // take away all stuff on starting new episode
  94.     }
  95.     
  96.     self.items = parm1;
  97.     self.health = parm2;
  98.     self.armorvalue = parm3;
  99.     self.ammo_shells = parm4;
  100.     self.ammo_nails = parm5;
  101.     self.ammo_rockets = parm6;
  102.     self.ammo_cells = parm7;
  103.     self.weapon = parm8;
  104.     self.armortype = parm9 * 0.01;
  105. };
  106.  
  107. /*
  108. ============
  109. FindIntermission
  110.  
  111. Returns the entity to view from
  112. ============
  113. */
  114. entity() FindIntermission =
  115. {
  116.     local    entity spot;
  117.     local    float cyc;
  118.  
  119. // look for info_intermission first
  120.     spot = find (world, classname, "info_intermission");
  121.     if (spot)
  122.     {    // pick a random one
  123.         cyc = random() * 4;
  124.         while (cyc > 1)
  125.         {
  126.             spot = find (spot, classname, "info_intermission");
  127.             if (!spot)
  128.                 spot = find (spot, classname, "info_intermission");
  129.             cyc = cyc - 1;
  130.         }
  131.         return spot;
  132.     }
  133.  
  134. // then look for the start position
  135.     spot = find (world, classname, "info_player_start");
  136.     if (spot)
  137.         return spot;
  138.     
  139. // testinfo_player_start is only found in regioned levels
  140.     spot = find (world, classname, "testplayerstart");
  141.     if (spot)
  142.         return spot;
  143.     
  144.     objerror ("FindIntermission: no spot");
  145. };
  146.  
  147.  
  148. string nextmap;
  149. void() GotoNextMap =
  150. {
  151.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  152.         changelevel (mapname);
  153.     else
  154.         changelevel (nextmap);
  155. };
  156.  
  157.  
  158. void() ExitIntermission =
  159. {
  160. // skip any text in deathmatch
  161.     if (deathmatch)
  162.     {
  163.         GotoNextMap ();
  164.         return;
  165.     }
  166.     
  167.     intermission_exittime = time + 1;
  168.     intermission_running = intermission_running + 1;
  169.  
  170. //
  171. // run some text if at the end of an episode
  172. //
  173.     if (intermission_running == 2)
  174.     {
  175.         if (world.model == "maps/e1m7.bsp")
  176.         {
  177.             WriteByte (MSG_ALL, SVC_CDTRACK);
  178.             WriteByte (MSG_ALL, 2);
  179.             WriteByte (MSG_ALL, 3);
  180.             if (!cvar("registered"))
  181.             {
  182.                 WriteByte (MSG_ALL, SVC_FINALE);
  183.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  184.             }
  185.             else
  186.             {
  187.                 WriteByte (MSG_ALL, SVC_FINALE);
  188.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  189.             }
  190.             return;
  191.         }
  192.         else if (world.model == "maps/e2m6.bsp")
  193.         {
  194.             WriteByte (MSG_ALL, SVC_CDTRACK);
  195.             WriteByte (MSG_ALL, 2);
  196.             WriteByte (MSG_ALL, 3);
  197.  
  198.             WriteByte (MSG_ALL, SVC_FINALE);
  199.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  200.             return;
  201.         }
  202.         else if (world.model == "maps/e3m6.bsp")
  203.         {
  204.             WriteByte (MSG_ALL, SVC_CDTRACK);
  205.             WriteByte (MSG_ALL, 2);
  206.             WriteByte (MSG_ALL, 3);
  207.  
  208.             WriteByte (MSG_ALL, SVC_FINALE);
  209.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  210.             return;
  211.         }
  212.         else if (world.model == "maps/e4m7.bsp")
  213.         {
  214.             WriteByte (MSG_ALL, SVC_CDTRACK);
  215.             WriteByte (MSG_ALL, 2);
  216.             WriteByte (MSG_ALL, 3);
  217.  
  218.             WriteByte (MSG_ALL, SVC_FINALE);
  219.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  220.             return;
  221.         }
  222.  
  223.         GotoNextMap();
  224.     }
  225.     
  226.     if (intermission_running == 3)
  227.     {
  228.         if (!cvar("registered"))
  229.         {    // shareware episode has been completed, go to sell screen
  230.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  231.             return;
  232.         }
  233.         
  234.         if ( (serverflags&15) == 15)
  235.         {
  236.             WriteByte (MSG_ALL, SVC_FINALE);
  237.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  238.             return;
  239.         }
  240.         
  241.     }
  242.  
  243.     GotoNextMap();
  244. };
  245.  
  246. /*
  247. ============
  248. IntermissionThink
  249.  
  250. When the player presses attack or jump, change to the next level
  251. ============
  252. */
  253. void() IntermissionThink =
  254. {
  255.     if (time < intermission_exittime)
  256.         return;
  257.  
  258.     if (!self.button0 && !self.button1 && !self.button2)
  259.         return;
  260.     
  261.     ExitIntermission ();
  262. };
  263.  
  264. void() execute_changelevel =
  265. {
  266.     local entity    pos;
  267.  
  268.     intermission_running = 1;
  269.     
  270. // enforce a wait time before allowing changelevel
  271.     if (deathmatch)
  272.         intermission_exittime = time + 5;
  273.     else
  274.         intermission_exittime = time + 2;
  275.  
  276.     WriteByte (MSG_ALL, SVC_CDTRACK);
  277.     WriteByte (MSG_ALL, 3);
  278.     WriteByte (MSG_ALL, 3);
  279.     
  280.     pos = FindIntermission ();
  281.  
  282.     other = find (world, classname, "player");
  283.     while (other != world)
  284.     {
  285.         other.view_ofs = '0 0 0';
  286.         other.angles = other.v_angle = pos.mangle;
  287.         other.fixangle = TRUE;        // turn this way immediately
  288.         other.nextthink = time + 0.5;
  289.         other.takedamage = DAMAGE_NO;
  290.         other.solid = SOLID_NOT;
  291.         other.movetype = MOVETYPE_NONE;
  292.         other.modelindex = 0;
  293.         setorigin (other, pos.origin);
  294.         other = find (other, classname, "player");
  295.     }    
  296.  
  297.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  298. };
  299.  
  300.  
  301. void() changelevel_touch =
  302. {
  303.     local entity    pos;
  304.  
  305.     if (other.classname != "player")
  306.         return;
  307.  
  308.     if (cvar("noexit"))
  309.     {
  310.         T_Damage (other, self, self, 50000);
  311.         return;
  312.     }
  313.     bprint (other.netname);
  314.     bprint (" exited the level\n");
  315.     
  316.     nextmap = self.map;
  317.  
  318.     SUB_UseTargets ();
  319.  
  320.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  321.     {    // NO_INTERMISSION
  322.         GotoNextMap();
  323.         return;
  324.     }
  325.     
  326.     self.touch = SUB_Null;
  327.  
  328. // we can't move people right now, because touch functions are called
  329. // in the middle of C movement code, so set a think time to do it
  330.     self.think = execute_changelevel;
  331.     self.nextthink = time + 0.1;
  332. };
  333.  
  334. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  335. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  336. */
  337. void() trigger_changelevel =
  338. {
  339.     if (!self.map)
  340.         objerror ("chagnelevel trigger doesn't have map");
  341.     
  342.     InitTrigger ();
  343.     self.touch = changelevel_touch;
  344. };
  345.  
  346.  
  347. /*
  348. =============================================================================
  349.  
  350.                 PLAYER GAME EDGE FUNCTIONS
  351.  
  352. =============================================================================
  353. */
  354.  
  355. void() set_suicide_frame;
  356.  
  357. // called by ClientKill and DeadThink
  358. void() respawn =
  359. {
  360.     if (coop)
  361.     {
  362.         // make a copy of the dead body for appearances sake
  363.         CopyToBodyQue (self);
  364.         // get the spawn parms as they were at level start
  365.         setspawnparms (self);
  366.         // respawn        
  367.         PutClientInServer ();
  368.     }
  369.     else if (deathmatch)
  370.     {
  371.         // make a copy of the dead body for appearances sake
  372.         CopyToBodyQue (self);
  373.         // set default spawn parms
  374.         SetNewParms ();
  375.         // respawn        
  376.         PutClientInServer ();
  377.     }
  378.     else
  379.     {    // restart the entire server
  380.         localcmd ("restart\n");
  381.     }
  382. };
  383.  
  384.  
  385. /*
  386. ============
  387. ClientKill
  388.  
  389. Player entered the suicide command
  390. ============
  391. */
  392. void() ClientKill =
  393. {
  394.     bprint (self.netname);
  395.     bprint (" suicides\n");
  396.     set_suicide_frame ();
  397.     self.modelindex = modelindex_player;
  398.     self.frags = self.frags - 2;    // extra penalty
  399.     respawn ();
  400. };
  401.  
  402. float(vector v) CheckSpawnPoint =
  403. {
  404.     return FALSE;
  405. };
  406.  
  407. /*
  408. ============
  409. SelectSpawnPoint
  410.  
  411. Returns the entity to spawn at
  412. ============
  413. */
  414. entity() SelectSpawnPoint =
  415. {
  416.     local    entity spot;
  417.     
  418. // testinfo_player_start is only found in regioned levels
  419.     spot = find (world, classname, "testplayerstart");
  420.     if (spot)
  421.         return spot;
  422.         
  423. // choose a info_player_deathmatch point
  424.     if (coop)
  425.     {
  426.         lastspawn = find(lastspawn, classname, "info_player_coop");
  427.         if (lastspawn == world)
  428.             lastspawn = find (lastspawn, classname, "info_player_start");
  429.         if (lastspawn != world)
  430.             return lastspawn;
  431.     }
  432.     else if (deathmatch)
  433.     {
  434.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  435.         if (lastspawn == world)
  436.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  437.         if (lastspawn != world)
  438.             return lastspawn;
  439.     }
  440.  
  441.     if (serverflags)
  442.     {    // return with a rune to start
  443.         spot = find (world, classname, "info_player_start2");
  444.         if (spot)
  445.             return spot;
  446.     }
  447.     
  448.     spot = find (world, classname, "info_player_start");
  449.     if (!spot)
  450.         error ("PutClientInServer: no info_player_start on level");
  451.     
  452.     return spot;
  453. };
  454.  
  455. /*
  456. ===========
  457. PutClientInServer
  458.  
  459. called each time a player is spawned
  460. ============
  461. */
  462. void() DecodeLevelParms;
  463. void() PlayerDie;
  464.  
  465.  
  466. void() PutClientInServer =
  467. {
  468.     local    entity spot;
  469.  
  470.     self.classname = "player";
  471.     self.health = 100;
  472.     self.takedamage = DAMAGE_AIM;
  473.     self.solid = SOLID_SLIDEBOX;
  474.     self.movetype = MOVETYPE_WALK;
  475.     self.show_hostile = 0;
  476.     self.max_health = 100;
  477.     self.flags = FL_CLIENT;
  478.     self.air_finished = time + 12;
  479.     self.dmg = 2;           // initial water damage
  480.     self.super_damage_finished = 0;
  481.     self.radsuit_finished = 0;
  482.     self.invisible_finished = 0;
  483.     self.invincible_finished = 0;
  484.     self.effects = 0;
  485.     self.invincible_time = 0;
  486.  
  487.     DecodeLevelParms ();
  488.     
  489.     W_SetCurrentAmmo ();
  490.  
  491.     self.attack_finished = time;
  492.     self.th_pain = player_pain;
  493.     self.th_die = PlayerDie;
  494.     
  495.     self.deadflag = DEAD_NO;
  496. // paustime is set by teleporters to keep the player from moving a while
  497.     self.pausetime = 0;
  498.     
  499.     spot = SelectSpawnPoint ();
  500.  
  501.     self.origin = spot.origin + '0 0 1';
  502.     self.angles = spot.angles;
  503.     self.fixangle = TRUE;        // turn this way immediately
  504.  
  505. // oh, this is a hack!
  506.     setmodel (self, "progs/eyes.mdl");
  507.     modelindex_eyes = self.modelindex;
  508.  
  509.     setmodel (self, "progs/player.mdl");
  510.     modelindex_player = self.modelindex;
  511.  
  512.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  513.     
  514.     self.view_ofs = '0 0 22';
  515.  
  516.     player_stand1 ();
  517.     
  518.     if (deathmatch || coop)
  519.     {
  520.         makevectors(self.angles);
  521.         spawn_tfog (self.origin + v_forward*20);
  522.     }
  523.  
  524.     spawn_tdeath (self.origin, self);
  525. };
  526.  
  527.  
  528. /*
  529. =============================================================================
  530.  
  531.                 QUAKED FUNCTIONS
  532.  
  533. =============================================================================
  534. */
  535.  
  536.  
  537. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  538. The normal starting point for a level.
  539. */
  540. void() info_player_start =
  541. {
  542. };
  543.  
  544.  
  545. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  546. Only used on start map for the return point from an episode.
  547. */
  548. void() info_player_start2 =
  549. {
  550. };
  551.  
  552.  
  553. /*
  554. saved out by quaked in region mode
  555. */
  556. void() testplayerstart =
  557. {
  558. };
  559.  
  560. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  561. potential spawning position for deathmatch games
  562. */
  563. void() info_player_deathmatch =
  564. {
  565. };
  566.  
  567. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  568. potential spawning position for coop games
  569. */
  570. void() info_player_coop =
  571. {
  572. };
  573.  
  574. /*
  575. ===============================================================================
  576.  
  577. RULES
  578.  
  579. ===============================================================================
  580. */
  581.  
  582. void(entity c) PrintClientScore =
  583. {
  584.     if (c.frags > -10 && c.frags < 0)
  585.         bprint (" ");
  586.     else if (c.frags >= 0)
  587.     {
  588.         if (c.frags < 100)
  589.             bprint (" ");
  590.         if (c.frags < 10)
  591.             bprint (" ");
  592.     }
  593.     bprint (ftos(c.frags));
  594.     bprint (" ");
  595.     bprint (c.netname);
  596.     bprint ("\n");
  597. };
  598.  
  599. void() DumpScore =
  600. {
  601.     local entity    e, sort, walk;
  602.  
  603.     if (world.chain)
  604.         error ("DumpScore: world.chain is set");
  605.  
  606. // build a sorted lis
  607.     e = find(world, classname, "player");
  608.     sort = world;
  609.     while (e)
  610.     {
  611.         if (!sort)
  612.         {
  613.             sort = e;
  614.             e.chain = world;
  615.         }
  616.         else
  617.         {
  618.             if (e.frags > sort.frags)
  619.             {
  620.                 e.chain = sort;
  621.                 sort = e;
  622.             }
  623.             else
  624.             {
  625.                 walk = sort;
  626.                 do
  627.                 {
  628.                     if (!walk.chain)
  629.                     {
  630.                         e.chain = world;
  631.                         walk.chain = e;
  632.                     }
  633.                     else if (walk.chain.frags < e.frags)
  634.                     {
  635.                         e.chain = walk.chain;
  636.                         walk.chain = e;
  637.                     }
  638.                     else
  639.                         walk = walk.chain;
  640.                 } while (walk.chain != e);
  641.             }
  642.         }
  643.         
  644.         e = find(e, classname, "player");
  645.     }
  646.  
  647. // print the list
  648.     
  649.     bprint ("\n");    
  650.     while (sort)
  651.     {
  652.         PrintClientScore (sort);
  653.         sort = sort.chain;
  654.     }
  655.     bprint ("\n");
  656. };
  657.  
  658. /*
  659. go to the next level for deathmatch
  660. */
  661. void() NextLevel =
  662. {
  663.     local entity o;
  664.  
  665. // find a trigger changelevel
  666.     o = find(world, classname, "trigger_changelevel");
  667.     if (!o || mapname == "start")
  668.     {    // go back to same map if no trigger_changelevel
  669.         o = spawn();
  670.         o.map = mapname;
  671.     }
  672.  
  673.     nextmap = o.map;
  674.     
  675.     if (o.nextthink < time)
  676.     {
  677.         o.think = execute_changelevel;
  678.         o.nextthink = time + 0.1;
  679.     }
  680. };
  681.  
  682. /*
  683. ============
  684. CheckRules
  685.  
  686. Exit deathmatch games upon conditions
  687. ============
  688. */
  689. void() CheckRules =
  690. {
  691.     local    float        timelimit;
  692.     local    float        fraglimit;
  693.     
  694.     if (gameover)    // someone else quit the game already
  695.         return;
  696.         
  697.     timelimit = cvar("timelimit") * 60;
  698.     fraglimit = cvar("fraglimit");
  699.     
  700.     if (timelimit && time >= timelimit)
  701.     {
  702. NextLevel ();
  703. /*
  704.         gameover = TRUE;
  705.         bprint ("\n\n\n==============================\n");
  706.         bprint ("game exited after ");
  707.         bprint (ftos(timelimit/60));
  708.         bprint (" minutes\n");
  709.         DumpScore ();
  710.         localcmd ("killserver\n");
  711. */
  712.         return;
  713.     }
  714.     
  715.     if (fraglimit && self.frags >= fraglimit)
  716.     {
  717. NextLevel ();
  718. /*
  719.         gameover = TRUE;
  720.         bprint ("\n\n\n==============================\n");
  721.         bprint ("game exited after ");
  722.         bprint (ftos(self.frags));
  723.         bprint (" frags\n");
  724.         DumpScore ();
  725.         localcmd ("killserver\n");
  726. */
  727.         return;
  728.     }    
  729. };
  730.  
  731. //============================================================================
  732.  
  733. void() PlayerDeathThink =
  734. {
  735.     local entity    old_self;
  736.     local float        forward;
  737.  
  738.     if ((self.flags & FL_ONGROUND))
  739.     {
  740.         forward = vlen (self.velocity);
  741.         forward = forward - 20;
  742.         if (forward <= 0)
  743.             self.velocity = '0 0 0';
  744.         else    
  745.             self.velocity = forward * normalize(self.velocity);
  746.     }
  747.  
  748. // wait for all buttons released
  749.     if (self.deadflag == DEAD_DEAD)
  750.     {
  751.         if (self.button2 || self.button1 || self.button0)
  752.             return;
  753.         self.deadflag = DEAD_RESPAWNABLE;
  754.         return;
  755.     }
  756.  
  757. // wait for any button down
  758.     if (!self.button2 && !self.button1 && !self.button0)
  759.         return;
  760.  
  761.     self.button0 = 0;
  762.     self.button1 = 0;
  763.     self.button2 = 0;
  764.     respawn();
  765. };
  766.  
  767.  
  768. void() PlayerJump =
  769. {
  770.     local vector start, end;
  771.     
  772.     if (self.flags & FL_WATERJUMP)
  773.         return;
  774.     
  775.     if (self.waterlevel >= 2)
  776.     {
  777.         if (self.watertype == CONTENT_WATER)
  778.             self.velocity_z = 100;
  779.         else if (self.watertype == CONTENT_SLIME)
  780.             self.velocity_z = 80;
  781.         else
  782.             self.velocity_z = 50;
  783.  
  784. // play swiming sound
  785.         if (self.swim_flag < time)
  786.         {
  787.             self.swim_flag = time + 1;
  788.             if (random() < 0.5)
  789.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  790.             else
  791.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  792.         }
  793.  
  794.         return;
  795.     }
  796.  
  797.     if (!(self.flags & FL_ONGROUND))
  798.         return;
  799.  
  800.     if ( !(self.flags & FL_JUMPRELEASED) )
  801.         return;        // don't pogo stick
  802.  
  803.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  804.  
  805.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  806.     
  807.     self.button2 = 0;
  808. // player jumping sound
  809.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  810.     self.velocity_z = self.velocity_z + 270;
  811. };
  812.  
  813.  
  814. /*
  815. ===========
  816. WaterMove
  817.  
  818. ============
  819. */
  820. .float    dmgtime;
  821.  
  822. void() WaterMove =
  823. {
  824. //dprint (ftos(self.waterlevel));
  825.     if (self.movetype == MOVETYPE_NOCLIP)
  826.         return;
  827.     if (self.health < 0)
  828.         return;
  829.  
  830.     if (self.waterlevel != 3)
  831.     {
  832.         if (self.air_finished < time)
  833.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  834.         else if (self.air_finished < time + 9)
  835.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  836.         self.air_finished = time + 12;
  837.         self.dmg = 2;
  838.     }
  839.     else if (self.air_finished < time)
  840.     {    // drown!
  841.         if (self.pain_finished < time)
  842.         {
  843.             self.dmg = self.dmg + 2;
  844.             if (self.dmg > 15)
  845.                 self.dmg = 10;
  846.             T_Damage (self, world, world, self.dmg);
  847.             self.pain_finished = time + 1;
  848.         }
  849.     }
  850.     
  851.     if (!self.waterlevel)
  852.     {
  853.         if (self.flags & FL_INWATER)
  854.         {    
  855.             // play leave water sound
  856.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  857.             self.flags = self.flags - FL_INWATER;
  858.         }
  859.         return;
  860.     }
  861.  
  862.     if (self.watertype == CONTENT_LAVA)
  863.     {    // do damage
  864.         if (self.dmgtime < time)
  865.         {
  866.             if (self.radsuit_finished > time)
  867.                 self.dmgtime = time + 1;
  868.             else
  869.                 self.dmgtime = time + 0.2;
  870.  
  871.             T_Damage (self, world, world, 10*self.waterlevel);
  872.         }
  873.     }
  874.     else if (self.watertype == CONTENT_SLIME)
  875.     {    // do damage
  876.         if (self.dmgtime < time && self.radsuit_finished < time)
  877.         {
  878.             self.dmgtime = time + 1;
  879.             T_Damage (self, world, world, 4*self.waterlevel);
  880.         }
  881.     }
  882.     
  883.     if ( !(self.flags & FL_INWATER) )
  884.     {    
  885.  
  886. // player enter water sound
  887.  
  888.         if (self.watertype == CONTENT_LAVA)
  889.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  890.         if (self.watertype == CONTENT_WATER)
  891.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  892.         if (self.watertype == CONTENT_SLIME)
  893.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  894.  
  895.         self.flags = self.flags + FL_INWATER;
  896.         self.dmgtime = 0;
  897.     }
  898.     
  899.     if (! (self.flags & FL_WATERJUMP) )
  900.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  901. };
  902.  
  903. void() CheckWaterJump =
  904. {
  905.     local vector start, end;
  906.  
  907. // check for a jump-out-of-water
  908.     makevectors (self.angles);
  909.     start = self.origin;
  910.     start_z = start_z + 8; 
  911.     v_forward_z = 0;
  912.     normalize(v_forward);
  913.     end = start + v_forward*24;
  914.     traceline (start, end, TRUE, self);
  915.     if (trace_fraction < 1)
  916.     {    // solid at waist
  917.         start_z = start_z + self.maxs_z - 8;
  918.         end = start + v_forward*24;
  919.         self.movedir = trace_plane_normal * -50;
  920.         traceline (start, end, TRUE, self);
  921.         if (trace_fraction == 1)
  922.         {    // open at eye level
  923.             self.flags = self.flags | FL_WATERJUMP;
  924.             self.velocity_z = 225;
  925.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  926.             self.teleport_time = time + 2;    // safety net
  927.             return;
  928.         }
  929.     }
  930. };
  931.  
  932.  
  933. /*
  934. ================
  935. PlayerPreThink
  936.  
  937. Called every frame before physics are run
  938. ================
  939. */
  940. void() PlayerPreThink =
  941. {
  942.     local    float    mspeed, aspeed;
  943.     local    float    r;
  944.  
  945.     if (intermission_running)
  946.     {
  947.         IntermissionThink ();    // otherwise a button could be missed between
  948.         return;                    // the think tics
  949.     }
  950.  
  951.     if (self.view_ofs == '0 0 0')
  952.         return;        // intermission or finale
  953.  
  954.     makevectors (self.v_angle);        // is this still used
  955.  
  956.     CheckRules ();
  957.     WaterMove ();
  958.  
  959.     if (self.waterlevel == 2)
  960.         CheckWaterJump ();
  961.  
  962.     if (self.deadflag >= DEAD_DEAD)
  963.     {
  964.         PlayerDeathThink ();
  965.         return;
  966.     }
  967.     
  968.     if (self.deadflag == DEAD_DYING)
  969.         return;    // dying, so do nothing
  970.  
  971.     if (self.button2)
  972.     {
  973.         PlayerJump ();
  974.     }
  975.     else
  976.         self.flags = self.flags | FL_JUMPRELEASED;
  977.  
  978. // teleporters can force a non-moving pause time    
  979.     if (time < self.pausetime)
  980.         self.velocity = '0 0 0';
  981. };
  982.     
  983. /*
  984. ================
  985. CheckPowerups
  986.  
  987. Check for turning off powerups
  988. ================
  989. */
  990. void() CheckPowerups =
  991. {
  992.     if (self.health <= 0)
  993.         return;
  994.  
  995. // invisibility
  996.     if (self.invisible_finished)
  997.     {
  998. // sound and screen flash when items starts to run out
  999.         if (self.invisible_sound < time)
  1000.         {
  1001.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  1002.             self.invisible_sound = time + ((random() * 3) + 1);
  1003.         }
  1004.  
  1005.  
  1006.         if (self.invisible_finished < time + 3)
  1007.         {
  1008.             if (self.invisible_time == 1)
  1009.             {
  1010.                 sprint (self, "Ring of Shadows magic is fading\n");
  1011.                 stuffcmd (self, "bf\n");
  1012.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  1013.                 self.invisible_time = time + 1;
  1014.             }
  1015.             
  1016.             if (self.invisible_time < time)
  1017.             {
  1018.                 self.invisible_time = time + 1;
  1019.                 stuffcmd (self, "bf\n");
  1020.             }
  1021.         }
  1022.  
  1023.         if (self.invisible_finished < time)
  1024.         {    // just stopped
  1025.             self.items = self.items - IT_INVISIBILITY;
  1026.             self.invisible_finished = 0;
  1027.             self.invisible_time = 0;
  1028.         }
  1029.         
  1030.     // use the eyes
  1031.         self.frame = 0;
  1032.         self.modelindex = modelindex_eyes;
  1033.     }
  1034.     else
  1035.         self.modelindex = modelindex_player;    // don't use eyes
  1036.  
  1037. // invincibility
  1038.     if (self.invincible_finished)
  1039.     {
  1040. // sound and screen flash when items starts to run out
  1041.         if (self.invincible_finished < time + 3)
  1042.         {
  1043.             if (self.invincible_time == 1)
  1044.             {
  1045.                 sprint (self, "Protection is almost burned out\n");
  1046.                 stuffcmd (self, "bf\n");
  1047.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1048.                 self.invincible_time = time + 1;
  1049.             }
  1050.             
  1051.             if (self.invincible_time < time)
  1052.             {
  1053.                 self.invincible_time = time + 1;
  1054.                 stuffcmd (self, "bf\n");
  1055.             }
  1056.         }
  1057.         
  1058.         if (self.invincible_finished < time)
  1059.         {    // just stopped
  1060.             self.items = self.items - IT_INVULNERABILITY;
  1061.             self.invincible_time = 0;
  1062.             self.invincible_finished = 0;
  1063.         }
  1064.         if (self.invincible_finished > time)
  1065.             self.effects = self.effects | EF_DIMLIGHT;
  1066.         else
  1067.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1068.     }
  1069.  
  1070. // super damage
  1071.     if (self.super_damage_finished)
  1072.     {
  1073.  
  1074. // sound and screen flash when items starts to run out
  1075.  
  1076.         if (self.super_damage_finished < time + 3)
  1077.         {
  1078.             if (self.super_time == 1)
  1079.             {
  1080.                 sprint (self, "Quad Damage is wearing off\n");
  1081.                 stuffcmd (self, "bf\n");
  1082.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1083.                 self.super_time = time + 1;
  1084.             }      
  1085.             
  1086.             if (self.super_time < time)
  1087.             {
  1088.                 self.super_time = time + 1;
  1089.                 stuffcmd (self, "bf\n");
  1090.             }
  1091.         }
  1092.  
  1093.         if (self.super_damage_finished < time)
  1094.         {    // just stopped
  1095.             self.items = self.items - IT_QUAD;
  1096.             self.super_damage_finished = 0;
  1097.             self.super_time = 0;
  1098.         }
  1099.         if (self.super_damage_finished > time)
  1100.             self.effects = self.effects | EF_DIMLIGHT;
  1101.         else
  1102.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1103.     }    
  1104.  
  1105. // suit    
  1106.     if (self.radsuit_finished)
  1107.     {
  1108.         self.air_finished = time + 12;        // don't drown
  1109.  
  1110. // sound and screen flash when items starts to run out
  1111.         if (self.radsuit_finished < time + 3)
  1112.         {
  1113.             if (self.rad_time == 1)
  1114.             {
  1115.                 sprint (self, "Air supply in Biosuit expiring\n");
  1116.                 stuffcmd (self, "bf\n");
  1117.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1118.                 self.rad_time = time + 1;
  1119.             }
  1120.             
  1121.             if (self.rad_time < time)
  1122.             {
  1123.                 self.rad_time = time + 1;
  1124.                 stuffcmd (self, "bf\n");
  1125.             }
  1126.         }
  1127.  
  1128.         if (self.radsuit_finished < time)
  1129.         {    // just stopped
  1130.             self.items = self.items - IT_SUIT;
  1131.             self.rad_time = 0;
  1132.             self.radsuit_finished = 0;
  1133.         }
  1134.     }    
  1135.  
  1136. };
  1137.  
  1138.  
  1139. /*
  1140. ================
  1141. PlayerPostThink
  1142.  
  1143. Called every frame after physics are run
  1144. ================
  1145. */
  1146. void() PlayerPostThink =
  1147. {
  1148.     local    float    mspeed, aspeed;
  1149.     local    float    r;
  1150.  
  1151.     if (self.view_ofs == '0 0 0')
  1152.         return;        // intermission or finale
  1153.     if (self.deadflag)
  1154.         return;
  1155.         
  1156. // do weapon stuff
  1157.  
  1158.     W_WeaponFrame ();
  1159.  
  1160. // check to see if player landed and play landing sound    
  1161.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1162.     {
  1163.         if (self.watertype == CONTENT_WATER)
  1164.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1165.         else if (self.jump_flag < -650)
  1166.         {
  1167.             T_Damage (self, world, world, 5); 
  1168.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1169.             self.deathtype = "falling";
  1170.         }
  1171.         else
  1172.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1173.  
  1174.         self.jump_flag = 0;
  1175.     }
  1176.  
  1177.     if (!(self.flags & FL_ONGROUND))
  1178.         self.jump_flag = self.velocity_z;
  1179.  
  1180.     CheckPowerups ();
  1181. };
  1182.  
  1183.  
  1184. /*
  1185. ===========
  1186. ClientConnect
  1187.  
  1188. called when a player connects to a server
  1189. ============
  1190. */
  1191. void() ClientConnect =
  1192. {
  1193.     bprint (self.netname);
  1194.     bprint (" entered the game\n");
  1195.     
  1196. // a client connecting during an intermission can cause problems
  1197.     if (intermission_running)
  1198.         ExitIntermission ();
  1199. };
  1200.  
  1201.  
  1202. /*
  1203. ===========
  1204. ClientDisconnect
  1205.  
  1206. called when a player disconnects from a server
  1207. ============
  1208. */
  1209. void() ClientDisconnect =
  1210. {
  1211.     if (gameover)
  1212.         return;
  1213.     // if the level end trigger has been activated, just return
  1214.     // since they aren't *really* leaving
  1215.  
  1216.     // let everyone else know
  1217.     bprint (self.netname);
  1218.     bprint (" left the game with ");
  1219.     bprint (ftos(self.frags));
  1220.     bprint (" frags\n");
  1221.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1222.     set_suicide_frame ();
  1223. };
  1224.  
  1225. /*
  1226. ===========
  1227. ClientObituary
  1228.  
  1229. called when a player dies
  1230. ============
  1231. */
  1232. void(entity targ, entity attacker) ClientObituary =
  1233. {
  1234.     local    float rnum;
  1235.     local    string deathstring, deathstring2;
  1236.     rnum = random();
  1237.  
  1238.     if (targ.classname == "player")
  1239.     {
  1240.         if (attacker.classname == "teledeath")
  1241.         {
  1242.             bprint (targ.netname);
  1243.             bprint (" was telefragged by ");
  1244.             bprint (attacker.owner.netname);
  1245.             bprint ("\n");
  1246.  
  1247. // No kills for telefrags! {JDS}
  1248. //                      attacker.owner.frags = attacker.owner.frags + 1;
  1249.             return;
  1250.         }
  1251.  
  1252.         if (attacker.classname == "teledeath2")
  1253.         {
  1254.             bprint ("Satan's power deflects ");
  1255.             bprint (targ.netname);
  1256.             bprint ("'s telefrag\n");
  1257.  
  1258. // {JDS}                targ.frags = targ.frags - 1;
  1259.             return;
  1260.         }
  1261.  
  1262.         if (attacker.classname == "player")
  1263.         {
  1264.             if (targ == attacker)
  1265.             {
  1266.                 // killed self
  1267.                 attacker.frags = attacker.frags - 1;
  1268.                 bprint (targ.netname);
  1269.                 
  1270.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1271.                 {
  1272.                     bprint (" discharges into the water.\n");
  1273.                     return;
  1274.                 }
  1275.                 if (targ.weapon == 16)
  1276.                     bprint (" tries to put the pin back in\n");
  1277.                 else if (rnum)
  1278.                                         bprint (" becomes bored with life\n");
  1279.                 else
  1280.                     bprint (" checks if his weapon is loaded\n");
  1281.                 return;
  1282.             }
  1283.             else
  1284.             {
  1285. // {JDS}  If teamplay is negative and you kill a teammate, add teamplay frags.
  1286. // (That is, lose frags since teamplay is negative.)  This allows a variable penalty for
  1287. // killing your teammates.  
  1288. // If teamplay is 100, and you kill a teammate, Take 1000 damage from yourself.
  1289. // (GIB!)  And gain a frag which you will lose in a sec when you gib.
  1290. // If teamplay is -100 and you kill a teammate, GIB and lose a frag.
  1291.                                 if((teamplay == 100) && (attacker.team == targ.team))
  1292.                                 {
  1293.                                         T_Damage(attacker, attacker, attacker, 1000);
  1294.                     bprint(attacker.netname);
  1295.                     bprint(" killed his teammate, ");
  1296.                     bprint(targ.netname);
  1297.                     bprint("!\n");
  1298.                                 }
  1299.                                 if((teamplay < 0) && (attacker.team == targ.team))
  1300.                                 {
  1301.                                         if(teamplay == -100)
  1302.                                                 T_Damage(attacker, attacker, attacker, 1000);
  1303.                         // Will take penalty for killing yourself.
  1304.                                         else attacker.frags = attacker.frags + teamplay;
  1305.                     bprint(attacker.netname);
  1306.                     bprint(" killed his teammate, ");
  1307.                     bprint(targ.netname);
  1308.                     bprint("!\n");
  1309.                                 
  1310.                                 }
  1311.                                 else attacker.frags = attacker.frags + 1;
  1312.                                 // If teamplay is 100, you'll lose this frag in a second
  1313.                                 // for killing yourself.
  1314.                 
  1315. // {JDS}
  1316.                 rnum = attacker.weapon;
  1317.                 if (rnum == IT_AXE)
  1318.                 {
  1319.                     deathstring = " was ax-murdered by ";
  1320.                     deathstring2 = "\n";
  1321.                 }
  1322.                 if (rnum == IT_SHOTGUN)
  1323.                 {
  1324.                     deathstring = " chewed on ";
  1325.                     deathstring2 = "'s boomstick\n";
  1326.                 }
  1327.                 if (rnum == IT_SUPER_SHOTGUN)
  1328.                 {
  1329.                     deathstring = " ate 2 loads of ";
  1330.                     deathstring2 = "'s buckshot\n";
  1331.                 }
  1332.                 if (rnum == IT_NAILGUN)
  1333.                 {
  1334.                     deathstring = " was nailed by ";
  1335.                     deathstring2 = "\n";
  1336.                 }
  1337.                 if (rnum == IT_SUPER_NAILGUN)
  1338.                 {
  1339.                     deathstring = " was punctured by ";
  1340.                     deathstring2 = "\n";
  1341.                 }
  1342.                 if (rnum == IT_GRENADE_LAUNCHER)
  1343.                 {
  1344.                     deathstring = " eats ";
  1345.                     deathstring2 = "'s pineapple\n";
  1346.                     if (targ.health < -40)
  1347.                     {
  1348.                         deathstring = " was gibbed by ";
  1349.                         deathstring2 = "'s grenade\n";
  1350.                     }
  1351.                 }
  1352.                 if (rnum == IT_ROCKET_LAUNCHER)
  1353.                 {
  1354.                     deathstring = " rides ";
  1355.                     deathstring2 = "'s rocket\n";
  1356.                     if (targ.health < -40)
  1357.                     {
  1358.                         deathstring = " was gibbed by ";
  1359.                         deathstring2 = "'s rocket\n" ;
  1360.                     }
  1361.                 }
  1362.                 if (rnum == IT_LIGHTNING)
  1363.                 {
  1364.                     deathstring = " accepts ";
  1365.                     if (attacker.waterlevel > 1)
  1366.                         deathstring2 = "'s discharge\n";
  1367.                     else
  1368.                         deathstring2 = "'s shaft\n";
  1369.                 }
  1370.                 bprint (targ.netname);
  1371.                 bprint (deathstring);
  1372.                 bprint (attacker.netname);
  1373.                 bprint (deathstring2);
  1374.             }
  1375.             return;
  1376.         }
  1377.         else
  1378.         {
  1379.             targ.frags = targ.frags - 1;        // killed self
  1380.             rnum = targ.watertype;
  1381.  
  1382.             bprint (targ.netname);
  1383.             if (rnum == -3)
  1384.             {
  1385.                 if (random() < 0.5)
  1386.                     bprint (" sleeps with the fishes\n");
  1387.                 else
  1388.                     bprint (" sucks it down\n");
  1389.                 return;
  1390.             }
  1391.             else if (rnum == -4)
  1392.             {
  1393.                 if (random() < 0.5)
  1394.                     bprint (" gulped a load of slime\n");
  1395.                 else
  1396.                     bprint (" can't exist on slime alone\n");
  1397.                 return;
  1398.             }
  1399.             else if (rnum == -5)
  1400.             {
  1401.                 if (targ.health < -15)
  1402.                 {
  1403.                     bprint (" burst into flames\n");
  1404.                     return;
  1405.                 }
  1406.                 if (random() < 0.5)
  1407.                     bprint (" turned into hot slag\n");
  1408.                 else
  1409.                     bprint (" visits the Volcano God\n");
  1410.                 return;
  1411.             }
  1412.  
  1413.             if (attacker.flags & FL_MONSTER)
  1414.             {
  1415.                 if (attacker.classname == "monster_army")
  1416.                     bprint (" was shot by a Grunt\n");
  1417.                 if (attacker.classname == "monster_demon1")
  1418.                     bprint (" was eviscerated by a Fiend\n");
  1419.                 if (attacker.classname == "monster_dog")
  1420.                     bprint (" was mauled by a Rottweiler\n");
  1421.                 if (attacker.classname == "monster_dragon")
  1422.                     bprint (" was fried by a Dragon\n");
  1423.                 if (attacker.classname == "monster_enforcer")
  1424.                     bprint (" was blasted by an Enforcer\n");
  1425.                 if (attacker.classname == "monster_fish")
  1426.                     bprint (" was fed to the Rotfish\n");
  1427.                 if (attacker.classname == "monster_hell_knight")
  1428.                     bprint (" was slain by a Death Knight\n");
  1429.                 if (attacker.classname == "monster_knight")
  1430.                     bprint (" was slashed by a Knight\n");
  1431.                 if (attacker.classname == "monster_ogre")
  1432.                     bprint (" was destroyed by an Ogre\n");
  1433.                 if (attacker.classname == "monster_oldone")
  1434.                     bprint (" became one with Shub-Niggurath\n");
  1435.                 if (attacker.classname == "monster_shalrath")
  1436.                     bprint (" was exploded by a Vore\n");
  1437.                 if (attacker.classname == "monster_shambler")
  1438.                     bprint (" was smashed by a Shambler\n");
  1439.                 if (attacker.classname == "monster_tarbaby")
  1440.                     bprint (" was slimed by a Spawn\n");
  1441.                 if (attacker.classname == "monster_vomit")
  1442.                     bprint (" was vomited on by a Vomitus\n");
  1443.                 if (attacker.classname == "monster_wizard")
  1444.                     bprint (" was scragged by a Scrag\n");
  1445.                 if (attacker.classname == "monster_zombie")
  1446.                     bprint (" joins the Zombies\n");
  1447.  
  1448.                 return;
  1449.             }
  1450.             if (attacker.classname == "explo_box")
  1451.             {
  1452.                 bprint (" blew up\n");
  1453.                 return;
  1454.             }
  1455.             if (attacker.solid == SOLID_BSP && attacker != world)
  1456.             {    
  1457.                 bprint (" was squished\n");
  1458.                 return;
  1459.             }
  1460.             if (targ.deathtype == "falling")
  1461.             {
  1462.                 targ.deathtype = "";
  1463.                 bprint (" fell to his death\n");
  1464.                 return;
  1465.             }
  1466.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1467.             {
  1468.                 bprint (" was spiked\n");
  1469.                 return;
  1470.             }
  1471.             if (attacker.classname == "fireball")
  1472.             {
  1473.                 bprint (" ate a lavaball\n");
  1474.                 return;
  1475.             }
  1476.             if (attacker.classname == "trigger_changelevel")
  1477.             {
  1478.                 bprint (" tried to leave\n");
  1479.                 return;
  1480.             }
  1481.  
  1482.             bprint (" died\n");
  1483.         }
  1484.     }
  1485. };
  1486.                                                         
  1487.