home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / qnitems / client.qc next >
Encoding:
Text File  |  1996-08-01  |  33.5 KB  |  1,466 lines

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