home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / qplus10 / client.qc < prev    next >
Encoding:
Text File  |  1996-08-17  |  34.8 KB  |  1,497 lines

  1. // prototypes
  2. void () W_WeaponFrame;
  3. void() W_SetCurrentAmmo;
  4. void(entity e, float f) player_pain;    //ws
  5. void() player_stand1;
  6. void() PlayerTouch;        //ws
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float modelindex_eyes, modelindex_player;
  11. float oldcolor;            //ws
  12. float newcolor;            //ws
  13.  
  14. /*
  15. =============================================================================
  16.  
  17.                 LEVEL CHANGING / INTERMISSION
  18.  
  19. =============================================================================
  20. */
  21.  
  22. float    intermission_running;
  23. float    intermission_exittime;
  24.  
  25. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  26. This is the camera point for the intermission.
  27. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  28. */
  29. void() info_intermission =
  30. {
  31. };
  32.  
  33. void() SetChangeParms =
  34. {
  35. // remove items
  36.     self.items = self.items - (self.items & 
  37.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  38.     
  39. // cap super health
  40.     if (self.health > 100)
  41.         self.health = 100;
  42.     if (self.health < 50)
  43.         self.health = 50;
  44.     parm1 = self.items;
  45.     parm2 = self.health;
  46.     parm3 = self.armorvalue;
  47.     if (self.ammo_shells < 25)
  48.         parm4 = 25;
  49.     else
  50.         parm4 = self.ammo_shells;
  51.     parm5 = self.ammo_nails;
  52.     parm6 = self.ammo_rockets;
  53.     parm7 = self.ammo_cells;
  54.     parm8 = self.weapon;
  55.     parm9 = self.armortype * 100;
  56. };
  57.  
  58. void() SetNewParms =
  59. {
  60.     parm1 = IT_SHOTGUN | IT_AXE;
  61.     parm2 = 100;
  62.     parm3 = 0;
  63.     parm4 = 25;
  64.     parm5 = 0;
  65.     parm6 = 0;
  66.     parm6 = 0;
  67.     parm8 = 1;
  68.     parm9 = 0;
  69. };
  70.  
  71. void() DecodeLevelParms =
  72. {
  73.     if (serverflags)
  74.     {
  75.         if (world.model == "maps/start.bsp")
  76.             SetNewParms ();        // take away all stuff on starting new episode
  77.     }
  78.     
  79.     self.items = parm1;
  80.     self.health = parm2;
  81.     self.armorvalue = parm3;
  82.     self.ammo_shells = parm4;
  83.     self.ammo_nails = parm5;
  84.     self.ammo_rockets = parm6;
  85.     self.ammo_cells = parm7;
  86.     self.weapon = parm8;
  87.     self.armortype = parm9 * 0.01;
  88. };
  89.  
  90. /*
  91. ============
  92. FindIntermission
  93.  
  94. Returns the entity to view from
  95. ============
  96. */
  97. entity() FindIntermission =
  98. {
  99.     local    entity spot;
  100.     local    float cyc;
  101.  
  102. // look for info_intermission first
  103.     spot = find (world, classname, "info_intermission");
  104.     if (spot)
  105.     {    // pick a random one
  106.         cyc = random() * 4;
  107.         while (cyc > 1)
  108.         {
  109.             spot = find (spot, classname, "info_intermission");
  110.             if (!spot)
  111.                 spot = find (spot, classname, "info_intermission");
  112.             cyc = cyc - 1;
  113.         }
  114.         return spot;
  115.     }
  116.  
  117. // then look for the start position
  118.     spot = find (world, classname, "info_player_start");
  119.     if (spot)
  120.         return spot;
  121.     
  122. // testinfo_player_start is only found in regioned levels
  123.     spot = find (world, classname, "testplayerstart");
  124.     if (spot)
  125.         return spot;
  126.     
  127.     objerror ("FindIntermission: no spot");
  128. };
  129.  
  130.  
  131. string nextmap;
  132. void() GotoNextMap =
  133. {
  134.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  135.         changelevel (mapname);
  136.     else
  137.         changelevel (nextmap);
  138. };
  139.  
  140.  
  141. void() ExitIntermission =
  142. {
  143. // skip any text in deathmatch
  144.     if (deathmatch)
  145.     {
  146.         GotoNextMap ();
  147.         return;
  148.     }
  149.     
  150.     intermission_exittime = time + 1;
  151.     intermission_running = intermission_running + 1;
  152.  
  153. //
  154. // run some text if at the end of an episode
  155. //
  156.     if (intermission_running == 2)
  157.     {
  158.         if (world.model == "maps/e1m7.bsp")
  159.         {
  160.             WriteByte (MSG_ALL, SVC_CDTRACK);
  161.             WriteByte (MSG_ALL, 2);
  162.             WriteByte (MSG_ALL, 3);
  163.             if (!cvar("registered"))
  164.             {
  165.                 WriteByte (MSG_ALL, SVC_FINALE);
  166.                 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!");
  167.             }
  168.             else
  169.             {
  170.                 WriteByte (MSG_ALL, SVC_FINALE);
  171.                 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!");
  172.             }
  173.             return;
  174.         }
  175.         else if (world.model == "maps/e2m6.bsp")
  176.         {
  177.             WriteByte (MSG_ALL, SVC_CDTRACK);
  178.             WriteByte (MSG_ALL, 2);
  179.             WriteByte (MSG_ALL, 3);
  180.  
  181.             WriteByte (MSG_ALL, SVC_FINALE);
  182.             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.");
  183.             return;
  184.         }
  185.         else if (world.model == "maps/e3m6.bsp")
  186.         {
  187.             WriteByte (MSG_ALL, SVC_CDTRACK);
  188.             WriteByte (MSG_ALL, 2);
  189.             WriteByte (MSG_ALL, 3);
  190.  
  191.             WriteByte (MSG_ALL, SVC_FINALE);
  192.             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.");
  193.             return;
  194.         }
  195.         else if (world.model == "maps/e4m7.bsp")
  196.         {
  197.             WriteByte (MSG_ALL, SVC_CDTRACK);
  198.             WriteByte (MSG_ALL, 2);
  199.             WriteByte (MSG_ALL, 3);
  200.  
  201.             WriteByte (MSG_ALL, SVC_FINALE);
  202.             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.");
  203.             return;
  204.         }
  205.  
  206.         GotoNextMap();
  207.     }
  208.     
  209.     if (intermission_running == 3)
  210.     {
  211.         if (!cvar("registered"))
  212.         {    // shareware episode has been completed, go to sell screen
  213.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  214.             return;
  215.         }
  216.         
  217.         if ( (serverflags&15) == 15)
  218.         {
  219.             WriteByte (MSG_ALL, SVC_FINALE);
  220.             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.");
  221.             return;
  222.         }
  223.         
  224.     }
  225.  
  226.     GotoNextMap();
  227. };
  228.  
  229. /*
  230. ============
  231. IntermissionThink
  232.  
  233. When the player presses attack or jump, change to the next level
  234. ============
  235. */
  236. void() IntermissionThink =
  237. {
  238.     if (time < intermission_exittime)
  239.         return;
  240.  
  241.     if (!self.button0 && !self.button1 && !self.button2)
  242.         return;
  243.     
  244.     ExitIntermission ();
  245. };
  246.  
  247. void() execute_changelevel =
  248. {
  249.     local entity    pos;
  250.  
  251.     intermission_running = 1;
  252.     
  253. // enforce a wait time before allowing changelevel
  254.     if (deathmatch)
  255.         intermission_exittime = time + 5;
  256.     else
  257.         intermission_exittime = time + 2;
  258.  
  259.     WriteByte (MSG_ALL, SVC_CDTRACK);
  260.     WriteByte (MSG_ALL, 3);
  261.     WriteByte (MSG_ALL, 3);
  262.     
  263.     pos = FindIntermission ();
  264.  
  265.     other = find (world, classname, "player");
  266.     while (other != world)
  267.     {
  268.         other.view_ofs = '0 0 0';
  269.         other.angles = other.v_angle = pos.mangle;
  270.         other.fixangle = TRUE;        // turn this way immediately
  271.         other.nextthink = time + 0.5;
  272.         other.takedamage = DAMAGE_NO;
  273.         other.solid = SOLID_NOT;
  274.         other.movetype = MOVETYPE_NONE;
  275.         other.modelindex = 0;
  276.         setorigin (other, pos.origin);
  277.         other = find (other, classname, "player");
  278.     }    
  279.  
  280.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  281. };
  282.  
  283.  
  284. void() changelevel_touch =
  285. {
  286.     local entity    pos;
  287.  
  288.     if (other.classname != "player")
  289.         return;
  290.  
  291.     if (cvar("noexit"))
  292.     {
  293.         T_Damage (other, self, self, 50000);
  294.         return;
  295.     }
  296.     bprint (other.netname);
  297.     bprint (" exited the level\n");
  298.     
  299.     nextmap = self.map;
  300.  
  301.     SUB_UseTargets ();
  302.  
  303.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  304.     {    // NO_INTERMISSION
  305.         GotoNextMap();
  306.         return;
  307.     }
  308.     
  309.     self.touch = SUB_Null;
  310.  
  311. // we can't move people right now, because touch functions are called
  312. // in the middle of C movement code, so set a think time to do it
  313.     self.think = execute_changelevel;
  314.     self.nextthink = time + 0.1;
  315. };
  316.  
  317. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  318. 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.
  319. */
  320. void() trigger_changelevel =
  321. {
  322.     if (!self.map)
  323.         objerror ("chagnelevel trigger doesn't have map");
  324.     
  325.     InitTrigger ();
  326.     self.touch = changelevel_touch;
  327. };
  328.  
  329.  
  330. /*
  331. =============================================================================
  332.  
  333.                 PLAYER GAME EDGE FUNCTIONS
  334.  
  335. =============================================================================
  336. */
  337.  
  338. void() set_suicide_frame;
  339.  
  340. // called by ClientKill and DeadThink
  341. void() respawn =
  342. {
  343.     if (coop)
  344.     {
  345.         // make a copy of the dead body for appearances sake
  346.         CopyToBodyQue (self);
  347.         // get the spawn parms as they were at level start
  348.         setspawnparms (self);
  349.         // respawn        
  350.         PutClientInServer ();
  351.     }
  352.     else if (deathmatch)
  353.     {
  354.         // make a copy of the dead body for appearances sake
  355.         CopyToBodyQue (self);
  356.         // set default spawn parms
  357.         SetNewParms ();
  358.         // respawn        
  359.         PutClientInServer ();
  360.     }
  361.     else
  362.     {    // restart the entire server
  363.         localcmd ("restart\n");
  364.     }
  365. };
  366.  
  367.  
  368. /*
  369. ============
  370. ClientKill
  371.  
  372. Player entered the suicide command
  373. ============
  374. */
  375. void() ClientKill =
  376. {
  377.     bprint (self.netname);
  378.     bprint (" suicides\n");
  379.     set_suicide_frame ();
  380.     self.modelindex = modelindex_player;
  381.     self.frags = self.frags - 2;    // extra penalty
  382.     respawn ();
  383. };
  384.  
  385. float(vector v) CheckSpawnPoint =
  386. {
  387.     return FALSE;
  388. };
  389.  
  390. /*
  391. ============
  392. SelectSpawnPoint
  393.  
  394. Returns the entity to spawn at
  395. ============
  396. */
  397. entity() SelectSpawnPoint =
  398. {
  399.     local    entity spot;
  400.     
  401. // testinfo_player_start is only found in regioned levels
  402.     spot = find (world, classname, "testplayerstart");
  403.     if (spot)
  404.         return spot;
  405.         
  406. // choose a info_player_deathmatch point
  407.     if (coop)
  408.     {
  409.         lastspawn = find(lastspawn, classname, "info_player_coop");
  410.         if (lastspawn == world)
  411.             lastspawn = find (lastspawn, classname, "info_player_start");
  412.         if (lastspawn != world)
  413.             return lastspawn;
  414.     }
  415.     else if (deathmatch)
  416.     {
  417.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  418.         if (lastspawn == world)
  419.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  420.         if (lastspawn != world)
  421.             return lastspawn;
  422.     }
  423.  
  424.     if (serverflags)
  425.     {    // return with a rune to start
  426.         spot = find (world, classname, "info_player_start2");
  427.         if (spot)
  428.             return spot;
  429.     }
  430.     
  431.     spot = find (world, classname, "info_player_start");
  432.     if (!spot)
  433.         error ("PutClientInServer: no info_player_start on level");
  434.     
  435.     return spot;
  436. };
  437.  
  438. /*
  439. ===========
  440. PutClientInServer
  441.  
  442. called each time a player is spawned
  443. ============
  444. */
  445. void() DecodeLevelParms;
  446. void() PlayerDie;
  447.  
  448.  
  449. void() PutClientInServer =
  450. {
  451.     local    entity spot;
  452.  
  453.     self.classname = "player";
  454.     self.health = 100;
  455.     self.takedamage = DAMAGE_AIM;
  456.     self.solid = SOLID_SLIDEBOX;
  457.     self.movetype = MOVETYPE_WALK;
  458.     self.show_hostile = 0;
  459.     self.max_health = 100;
  460.     self.flags = FL_CLIENT;
  461.     self.air_finished = time + 12;
  462.     self.dmg = 2;           // initial water damage
  463.     self.super_damage_finished = 0;
  464.     self.radsuit_finished = 0;
  465.     self.invisible_finished = 0;
  466.     self.invincible_finished = 0;
  467.     self.effects = 0;
  468.     self.invincible_time = 0;
  469.     self.touch = PlayerTouch;        //ws kicking
  470.  
  471.     DecodeLevelParms ();
  472.     
  473.     W_SetCurrentAmmo ();
  474.  
  475.     self.attack_finished = time;
  476.     self.th_pain = player_pain;
  477.     self.th_die = PlayerDie;
  478.     
  479.     self.deadflag = DEAD_NO;
  480. // paustime is set by teleporters to keep the player from moving a while
  481.     self.pausetime = 0;
  482.     
  483.     spot = SelectSpawnPoint ();
  484.  
  485.     self.origin = spot.origin + '0 0 1';
  486.     self.angles = spot.angles;
  487.     self.fixangle = TRUE;        // turn this way immediately
  488.  
  489. // oh, this is a hack!
  490.     setmodel (self, "progs/eyes.mdl");
  491.     modelindex_eyes = self.modelindex;
  492.  
  493.     setmodel (self, "progs/player.mdl");
  494.     modelindex_player = self.modelindex;
  495.  
  496.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  497.     
  498.     self.view_ofs = '0 0 22';
  499.  
  500.     player_stand1 ();
  501.     
  502.     if (deathmatch || coop)
  503.     {
  504.         makevectors(self.angles);
  505.         spawn_tfog (self.origin + v_forward*20);
  506.         newcolor = cvar("_cl_color");        //ws
  507.         if (newcolor != oldcolor)            //
  508.             {
  509.             newcolor = oldcolor;
  510.             bprint (self.netname);
  511.             bprint (" changed his color\n");    //
  512.             }                //ws
  513.     }
  514.  
  515.     spawn_tdeath (self.origin, self);
  516. };
  517.  
  518.  
  519. /*
  520. =============================================================================
  521.  
  522.                 QUAKED FUNCTIONS
  523.  
  524. =============================================================================
  525. */
  526.  
  527.  
  528. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  529. The normal starting point for a level.
  530. */
  531. void() info_player_start =
  532. {
  533. };
  534.  
  535.  
  536. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  537. Only used on start map for the return point from an episode.
  538. */
  539. void() info_player_start2 =
  540. {
  541. };
  542.  
  543.  
  544. /*
  545. saved out by quaked in region mode
  546. */
  547. void() testplayerstart =
  548. {
  549. };
  550.  
  551. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  552. potential spawning position for deathmatch games
  553. */
  554. void() info_player_deathmatch =
  555. {
  556. };
  557.  
  558. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  559. potential spawning position for coop games
  560. */
  561. void() info_player_coop =
  562. {
  563. };
  564.  
  565. /*
  566. ===============================================================================
  567.  
  568. RULES
  569.  
  570. ===============================================================================
  571. */
  572.  
  573. void(entity c) PrintClientScore =
  574. {
  575.     if (c.frags > -10 && c.frags < 0)
  576.         bprint (" ");
  577.     else if (c.frags >= 0)
  578.     {
  579.         if (c.frags < 100)
  580.             bprint (" ");
  581.         if (c.frags < 10)
  582.             bprint (" ");
  583.     }
  584.     bprint (ftos(c.frags));
  585.     bprint (" ");
  586.     bprint (c.netname);
  587.     bprint ("\n");
  588. };
  589.  
  590. void() DumpScore =
  591. {
  592.     local entity    e, sort, walk;
  593.  
  594.     if (world.chain)
  595.         error ("DumpScore: world.chain is set");
  596.  
  597. // build a sorted lis
  598.     e = find(world, classname, "player");
  599.     sort = world;
  600.     while (e)
  601.     {
  602.         if (!sort)
  603.         {
  604.             sort = e;
  605.             e.chain = world;
  606.         }
  607.         else
  608.         {
  609.             if (e.frags > sort.frags)
  610.             {
  611.                 e.chain = sort;
  612.                 sort = e;
  613.             }
  614.             else
  615.             {
  616.                 walk = sort;
  617.                 do
  618.                 {
  619.                     if (!walk.chain)
  620.                     {
  621.                         e.chain = world;
  622.                         walk.chain = e;
  623.                     }
  624.                     else if (walk.chain.frags < e.frags)
  625.                     {
  626.                         e.chain = walk.chain;
  627.                         walk.chain = e;
  628.                     }
  629.                     else
  630.                         walk = walk.chain;
  631.                 } while (walk.chain != e);
  632.             }
  633.         }
  634.         
  635.         e = find(e, classname, "player");
  636.     }
  637.  
  638. // print the list
  639.     
  640.     bprint ("\n");    
  641.     while (sort)
  642.     {
  643.         PrintClientScore (sort);
  644.         sort = sort.chain;
  645.     }
  646.     bprint ("\n");
  647. };
  648.  
  649. /*
  650. go to the next level for deathmatch
  651. */
  652. void() NextLevel =
  653. {
  654.     local entity o;
  655.  
  656. // find a trigger changelevel
  657.     o = find(world, classname, "trigger_changelevel");
  658.     if (!o || mapname == "start")
  659.     {    // go back to same map if no trigger_changelevel
  660.         o = spawn();
  661.         o.map = mapname;
  662.     }
  663.  
  664.     nextmap = o.map;
  665.     
  666.     if (o.nextthink < time)
  667.     {
  668.         o.think = execute_changelevel;
  669.         o.nextthink = time + 0.1;
  670.     }
  671. };
  672.  
  673. /*
  674. ============
  675. CheckRules
  676.  
  677. Exit deathmatch games upon conditions
  678. ============
  679. */
  680. void() CheckRules =
  681. {
  682.     local    float        timelimit;
  683.     local    float        fraglimit;
  684.     
  685.     if (gameover)    // someone else quit the game already
  686.         return;
  687.         
  688.     timelimit = cvar("timelimit") * 60;
  689.     fraglimit = cvar("fraglimit");
  690.     
  691.     if (timelimit && time >= timelimit)
  692.     {
  693. NextLevel ();
  694. /*
  695.         gameover = TRUE;
  696.         bprint ("\n\n\n==============================\n");
  697.         bprint ("game exited after ");
  698.         bprint (ftos(timelimit/60));
  699.         bprint (" minutes\n");
  700.         DumpScore ();
  701.         localcmd ("killserver\n");
  702. */
  703.         return;
  704.     }
  705.     
  706.     if (fraglimit && self.frags >= fraglimit)
  707.     {
  708. NextLevel ();
  709. /*
  710.         gameover = TRUE;
  711.         bprint ("\n\n\n==============================\n");
  712.         bprint ("game exited after ");
  713.         bprint (ftos(self.frags));
  714.         bprint (" frags\n");
  715.         DumpScore ();
  716.         localcmd ("killserver\n");
  717. */
  718.         return;
  719.     }    
  720. };
  721.  
  722. //============================================================================
  723.  
  724. void() PlayerDeathThink =
  725. {
  726.     local entity    old_self;
  727.     local float        forward;
  728.  
  729.     if ((self.flags & FL_ONGROUND))
  730.     {
  731.         forward = vlen (self.velocity);
  732.         forward = forward - 20;
  733.         if (forward <= 0)
  734.             self.velocity = '0 0 0';
  735.         else    
  736.             self.velocity = forward * normalize(self.velocity);
  737.     }
  738.  
  739. // wait for all buttons released
  740.     if (self.deadflag == DEAD_DEAD)
  741.     {
  742.         if (self.button2 || self.button1 || self.button0)
  743.             return;
  744.         self.deadflag = DEAD_RESPAWNABLE;
  745.         return;
  746.     }
  747.  
  748. // wait for any button down
  749.     if (!self.button2 && !self.button1 && !self.button0)
  750.         return;
  751.  
  752.     self.button0 = 0;
  753.     self.button1 = 0;
  754.     self.button2 = 0;
  755.     respawn();
  756. };
  757.  
  758. void() PlayerTouch =            //ws...
  759. {
  760.  if(other.takedamage != DAMAGE_AIM)
  761.    return;
  762.  if(self.impulse != 14)
  763.    return;
  764.  useget = 1;
  765.  
  766.  if(other.classname == "player")    // only advertise player kicking
  767.  {
  768.   bprint(self.netname);
  769.   bprint(" gives ");
  770.   bprint(other.netname);
  771.   bprint(" the boot\n");
  772.  }
  773.  other.velocity_x = other.velocity_x + self.velocity_x;
  774.  other.velocity_y = other.velocity_y + self.velocity_y;
  775.  other.velocity_z = other.velocity_z + 100;    // add lift
  776.  
  777.  if(other.flags & FL_ONGROUND)
  778.    other.flags = other.flags - FL_ONGROUND;
  779. };                        //...ws
  780.  
  781. void() PlayerJump =
  782. {
  783.     local vector start, end;
  784.     
  785.     if (self.flags & FL_WATERJUMP)
  786.         return;
  787.     
  788.     if (self.waterlevel >= 2)
  789.     {
  790.         if (self.watertype == CONTENT_WATER)
  791.             self.velocity_z = 100;
  792.         else if (self.watertype == CONTENT_SLIME)
  793.             self.velocity_z = 80;
  794.         else
  795.             self.velocity_z = 50;
  796.  
  797. // play swiming sound
  798.         if (self.swim_flag < time)
  799.         {
  800.             self.swim_flag = time + 1;
  801.             if (random() < 0.5)
  802.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  803.             else
  804.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  805.         }
  806.  
  807.         return;
  808.     }
  809.  
  810.     if (!(self.flags & FL_ONGROUND))
  811.         return;
  812.  
  813.     if ( !(self.flags & FL_JUMPRELEASED) )
  814.         return;        // don't pogo stick
  815.  
  816.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  817.  
  818.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  819.     
  820.     self.button2 = 0;
  821. // player jumping sound
  822.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  823.     self.velocity_z = self.velocity_z + 270;
  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.     local       string       n;    //ws
  1163.     
  1164.     if (self.view_ofs == '0 0 0')
  1165.         return;        // intermission or finale
  1166.     if (self.deadflag)
  1167.         return;
  1168.  
  1169.     if (deathmatch || coop)                    //ws
  1170.     {                            //
  1171.         if ((cvar("_cl_color") != newcolor))
  1172.         {
  1173.         n = ftos (newcolor);
  1174.         stuffcmd(self, "color ");
  1175.         stuffcmd(self, n);
  1176.         stuffcmd(self, "\n");
  1177.         sprint (self, "You can only change colors while you're dead\n");
  1178.         }                        //        
  1179.     }                            //ws
  1180.  
  1181. // do weapon stuff
  1182.  
  1183.     W_WeaponFrame ();
  1184.  
  1185. // check to see if player landed and play landing sound    
  1186.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1187.     {
  1188.         if (self.watertype == CONTENT_WATER)
  1189.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1190.         else if (self.jump_flag < -650)
  1191.         {
  1192.             T_Damage (self, world, world, 5); 
  1193.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1194.             self.deathtype = "falling";
  1195.         }
  1196.         else
  1197.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1198.  
  1199.         self.jump_flag = 0;
  1200.     }
  1201.  
  1202.     if (!(self.flags & FL_ONGROUND))
  1203.         self.jump_flag = self.velocity_z;
  1204.  
  1205.     CheckPowerups ();
  1206. };
  1207.  
  1208.  
  1209. /*
  1210. ===========
  1211. ClientConnect
  1212.  
  1213. called when a player connects to a server
  1214. ============
  1215. */
  1216. void() ClientConnect =
  1217. {
  1218.     bprint (self.netname);
  1219.     bprint (" entered the game\n");
  1220.     oldcolor = cvar("_cl_color");        //ws
  1221.     
  1222. // a client connecting during an intermission can cause problems
  1223.     if (intermission_running)
  1224.         ExitIntermission ();
  1225. };
  1226.  
  1227.  
  1228. /*
  1229. ===========
  1230. ClientDisconnect
  1231.  
  1232. called when a player disconnects from a server
  1233. ============
  1234. */
  1235. void() ClientDisconnect =
  1236. {
  1237.     if (gameover)
  1238.         return;
  1239.     // if the level end trigger has been activated, just return
  1240.     // since they aren't *really* leaving
  1241.  
  1242.     // let everyone else know
  1243.     bprint (self.netname);
  1244.     bprint (" left the game with ");
  1245.     bprint (ftos(self.frags));
  1246.     bprint (" frags\n");
  1247.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1248.     set_suicide_frame ();
  1249. };
  1250.  
  1251. /*
  1252. ===========
  1253. ClientObituary
  1254.  
  1255. called when a player dies
  1256. ============
  1257. */
  1258. void(entity targ, entity attacker) ClientObituary =
  1259. {
  1260.     local    float rnum;
  1261.     local    string deathstring, deathstring2;
  1262.     rnum = random();
  1263.  
  1264.     if (targ.classname == "player")
  1265.     {
  1266.         if (attacker.classname == "teledeath")
  1267.         {
  1268.             bprint (targ.netname);
  1269.             bprint (" was telefragged by ");
  1270.             bprint (attacker.owner.netname);
  1271.             bprint ("\n");
  1272.  
  1273. // No kills for telefrags! {JDS}
  1274. //                      attacker.owner.frags = attacker.owner.frags + 1;
  1275.             return;
  1276.         }
  1277.  
  1278.         if (attacker.classname == "teledeath2")
  1279.         {
  1280.             bprint ("Satan's power deflects ");
  1281.             bprint (targ.netname);
  1282.             bprint ("'s telefrag\n");
  1283.  
  1284. // {JDS}                targ.frags = targ.frags - 1;
  1285.             return;
  1286.         }
  1287.  
  1288.         if (attacker.classname == "player")
  1289.         {
  1290.             if (targ == attacker)
  1291.             {
  1292.                 // killed self
  1293.                 attacker.frags = attacker.frags - 1;
  1294.                 bprint (targ.netname);
  1295.                 
  1296.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1297.                 {
  1298.                     bprint (" discharges into the water.\n");
  1299.                     return;
  1300.                 }
  1301.                 if (targ.weapon == 16)
  1302.                     bprint (" tries to put the pin back in\n");
  1303.                 else if (rnum)
  1304.                                         bprint (" becomes bored with life\n");
  1305.                 else
  1306.                     bprint (" checks if his weapon is loaded\n");
  1307.                 return;
  1308.             }
  1309.             else
  1310.             {
  1311. // {JDS}  Penalty for killing your teammates are -3 frags, reaching -10 frags gibs you.  
  1312.                                 if(attacker.team == targ.team)            //ws
  1313.                                 {                        //                
  1314.                                   attacker.frags = attacker.frags - 3;
  1315.                 bprint(attacker.netname);
  1316.                 bprint(" killed his teammate, ");
  1317.                 bprint(targ.netname);
  1318.                 bprint("!\n");
  1319.                                  if(attacker.frags  < -10)
  1320.                                                 T_Damage(attacker, attacker, attacker, 1000);
  1321.  
  1322.                                 }                        //
  1323.                                 else attacker.frags = attacker.frags + 1;        //ws
  1324.                                                 
  1325. // {JDS}
  1326.                 rnum = attacker.weapon;
  1327.                 if (rnum == IT_AXE)
  1328.                 {
  1329.                     deathstring = " was ax-murdered by ";
  1330.                     deathstring2 = "\n";
  1331.                 }
  1332.                 if (rnum == IT_SHOTGUN)
  1333.                 {
  1334.                     deathstring = " chewed on ";
  1335.                     deathstring2 = "'s boomstick\n";
  1336.                 }
  1337.                 if (rnum == IT_SUPER_SHOTGUN)
  1338.                 {
  1339.                     deathstring = " ate 2 loads of ";
  1340.                     deathstring2 = "'s buckshot\n";
  1341.                 }
  1342.                 if (rnum == IT_NAILGUN)
  1343.                 {
  1344.                     deathstring = " was nailed by ";
  1345.                     deathstring2 = "\n";
  1346.                 }
  1347.                 if (rnum == IT_SUPER_NAILGUN)
  1348.                 {
  1349.                     deathstring = " was punctured by ";
  1350.                     deathstring2 = "\n";
  1351.                 }
  1352.                 if (rnum == IT_GRENADE_LAUNCHER)
  1353.                 {
  1354.                     deathstring = " eats ";
  1355.                     deathstring2 = "'s pineapple\n";
  1356.                     if (targ.health < -40)
  1357.                     {
  1358.                         deathstring = " was gibbed by ";
  1359.                         deathstring2 = "'s grenade\n";
  1360.                     }
  1361.                 }
  1362.                 if (rnum == IT_ROCKET_LAUNCHER)
  1363.                 {
  1364.                     deathstring = " rides ";
  1365.                     deathstring2 = "'s rocket\n";
  1366.                     if (targ.health < -40)
  1367.                     {
  1368.                         deathstring = " was gibbed by ";
  1369.                         deathstring2 = "'s rocket\n" ;
  1370.                     }
  1371.                 }
  1372.                 if (rnum == IT_LIGHTNING)
  1373.                 {
  1374.                     deathstring = " accepts ";
  1375.                     if (attacker.waterlevel > 1)
  1376.                         deathstring2 = "'s discharge\n";
  1377.                     else
  1378.                         deathstring2 = "'s shaft\n";
  1379.                 }
  1380.                 bprint (targ.netname);
  1381.                 bprint (deathstring);
  1382.                 bprint (attacker.netname);
  1383.                 bprint (deathstring2);
  1384.             }
  1385.             return;
  1386.         }
  1387.         else
  1388.         {
  1389.             targ.frags = targ.frags - 1;        // killed self
  1390.             rnum = targ.watertype;
  1391.  
  1392.             bprint (targ.netname);
  1393.             if (rnum == -3)
  1394.             {
  1395.                 if (random() < 0.5)
  1396.                     bprint (" sleeps with the fishes\n");
  1397.                 else
  1398.                     bprint (" sucks it down\n");
  1399.                 return;
  1400.             }
  1401.             else if (rnum == -4)
  1402.             {
  1403.                 if (random() < 0.5)
  1404.                     bprint (" gulped a load of slime\n");
  1405.                 else
  1406.                     bprint (" can't exist on slime alone\n");
  1407.                 return;
  1408.             }
  1409.             else if (rnum == -5)
  1410.             {
  1411.                 if (targ.health < -15)
  1412.                 {
  1413.                     bprint (" burst into flames\n");
  1414.                     return;
  1415.                 }
  1416.                 if (random() < 0.5)
  1417.                     bprint (" turned into hot slag\n");
  1418.                 else
  1419.                     bprint (" visits the Volcano God\n");
  1420.                 return;
  1421.             }
  1422.  
  1423.             if (attacker.flags & FL_MONSTER)
  1424.             {
  1425.                 if (attacker.classname == "monster_army")
  1426.                     bprint (" was shot by a Grunt\n");
  1427.                 if (attacker.classname == "monster_demon1")
  1428.                     bprint (" was eviscerated by a Fiend\n");
  1429.                 if (attacker.classname == "monster_dog")
  1430.                     bprint (" was mauled by a Rottweiler\n");
  1431.                 if (attacker.classname == "monster_dragon")
  1432.                     bprint (" was fried by a Dragon\n");
  1433.                 if (attacker.classname == "monster_enforcer")
  1434.                     bprint (" was blasted by an Enforcer\n");
  1435.                 if (attacker.classname == "monster_fish")
  1436.                     bprint (" was fed to the Rotfish\n");
  1437.                 if (attacker.classname == "monster_hell_knight")
  1438.                     bprint (" was slain by a Death Knight\n");
  1439.                 if (attacker.classname == "monster_knight")
  1440.                     bprint (" was slashed by a Knight\n");
  1441.                 if (attacker.classname == "monster_ogre")
  1442.                     bprint (" was destroyed by an Ogre\n");
  1443.                 if (attacker.classname == "monster_oldone")
  1444.                     bprint (" became one with Shub-Niggurath\n");
  1445.                 if (attacker.classname == "monster_shalrath")
  1446.                     bprint (" was exploded by a Vore\n");
  1447.                 if (attacker.classname == "monster_shambler")
  1448.                     bprint (" was smashed by a Shambler\n");
  1449.                 if (attacker.classname == "monster_tarbaby")
  1450.                     bprint (" was slimed by a Spawn\n");
  1451.                 if (attacker.classname == "monster_vomit")
  1452.                     bprint (" was vomited on by a Vomitus\n");
  1453.                 if (attacker.classname == "monster_wizard")
  1454.                     bprint (" was scragged by a Scrag\n");
  1455.                 if (attacker.classname == "monster_zombie")
  1456.                     bprint (" joins the Zombies\n");
  1457.  
  1458.                 return;
  1459.             }
  1460.             if (attacker.classname == "explo_box")
  1461.             {
  1462.                 bprint (" blew up\n");
  1463.                 return;
  1464.             }
  1465.             if (attacker.solid == SOLID_BSP && attacker != world)
  1466.             {    
  1467.                 bprint (" was squished\n");
  1468.                 return;
  1469.             }
  1470.             if (targ.deathtype == "falling")
  1471.             {
  1472.                 targ.deathtype = "";
  1473.                 bprint (" fell to his death\n");
  1474.                 return;
  1475.             }
  1476.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1477.             {
  1478.                 bprint (" was spiked\n");
  1479.                 return;
  1480.             }
  1481.             if (attacker.classname == "fireball")
  1482.             {
  1483.                 bprint (" ate a lavaball\n");
  1484.                 return;
  1485.             }
  1486.             if (attacker.classname == "trigger_changelevel")
  1487.             {
  1488.                 bprint (" tried to leave\n");
  1489.                 return;
  1490.             }
  1491.  
  1492.             bprint (" died\n");
  1493.         }
  1494.     }
  1495. };
  1496.                                                         
  1497.