home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / jteam092 / client.qc next >
Encoding:
Text File  |  1996-08-16  |  34.5 KB  |  1,510 lines

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