home *** CD-ROM | disk | FTP | other *** search
/ Superpower (Alt) / SUPERPOWER.iso / q / patch / mbq761 / client.qc next >
Encoding:
Text File  |  1996-07-28  |  34.3 KB  |  1,500 lines

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