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