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