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