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