home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 3 / CD_Magazyn_EXEC_nr_3.iso / Internet / Strony_WWW / Quake / patches / Qboost4_qc.lha / Qboost4_qc / client.qc < prev    next >
Text File  |  1999-06-28  |  33KB  |  1,482 lines

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