home *** CD-ROM | disk | FTP | other *** search
/ Qu-ake / Qu-ake.iso / qu_ke / monster / 005 / CLIENT.QC < prev    next >
Encoding:
Text File  |  1996-11-26  |  33.9 KB  |  1,495 lines

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