void () player_pain;

void () player_stand1;

void (vector org) spawn_tfog;

void (vector org, entity death_owner) spawn_tdeath;
float modelindex_eyes /* = 0.000 */;
float modelindex_player /* = 0.000 */;

void() MOTD;

void () info_intermission = {


};

void () SetChangeParms = {

   if ( (self.health <= FALSE) ) {

      SetNewParms ();
      return ;

   }
   self.items = (self.items - (self.items & (((((IT_KEY1 | IT_KEY2) | IT_INVISIBILITY) | IT_INVULNERABILITY) | IT_SUIT) | IT_QUAD)));
   if ( (self.health > 200.000) ) {

      self.health = 200.000;

   }
   if ( (self.health < 100.000) ) {

      self.health = 100.000;

   }
   parm1 = self.items;
   parm2 = self.health;
   parm3 = self.armorvalue;
   if ( (self.ammo_shells < 25.000) ) {

      parm4 = 25.000;

   } else {

      parm4 = self.ammo_shells;

   }
   parm5 = self.ammo_nails;
   parm6 = self.ammo_rockets;
   parm7 = self.ammo_cells;
   parm8 = self.weapon;
   parm9 = (self.armortype * 100.000);


	// Rob's chasecam
	// holds current state of cam and targeter between levels
	parm16 = self.dest2_x; // bit flags
	parm14 = self.dest2_y; // cam distance
	parm15 = self.dest2_z; // cam height
	
};

void () SetNewParms = {
   


	
	if (deathmatch)
	{
   parm1 = ((IT_SHOTGUN | IT_AXE) | IT_ARMOR2);
   parm2 = 100.000;
   parm3 = 200;
   parm4 = 50.000;
   parm5 = FALSE;
   parm6 = FALSE;
   parm7 = FALSE;
   parm8 = TRUE;
   parm9 = 70;
	}
	else
	{
   parm1 = (((IT_SHOTGUN | IT_AXE) | IT_NAILGUN) | IT_ARMOR1);
   parm2 = 100.000;
   parm3 = 100;
   parm4 = 50.000;
   parm5 = 50;
   parm6 = 25;
   parm7 = FALSE;
   parm8 = TRUE;
   parm9 = 30;
	}


	if (world.model == "maps/e4m1.bsp")
	{
   parm1 = ((((IT_SHOTGUN | IT_AXE) | IT_SUPER_SHOTGUN) | IT_NAILGUN) | IT_ARMOR3);
   parm2 = 100.000;
   parm3 = 100;
   parm4 = 100.000;
   parm5 = 200.0;
   parm6 = FALSE;
   parm7 = FALSE;
   parm8 = IT_SUPER_SHOTGUN;
   parm9 = 100;
	}
	// Rob's chasecam mod
	// only reset if zeroed  (so DM/COOP respawns don't reset)
	if (! parm14) parm14 = 100; // dist - cam distance
	if (! parm15) parm15 = 0.22; //zmult - cam height offset
	if (! parm16)
		parm16 = cvar("temp1") & (CHSCAM_ON | LASERTARG_ON | LASERTARG_LIT);

};


void () DecodeLevelParms = {

   if ( serverflags ) {

      if ( (world.model == "maps/start.bsp") ) {

         SetNewParms ();

      }

   }

   self.items = parm1;
   self.health = parm2;
   self.armorvalue = parm3;
   self.ammo_shells = parm4;
   self.ammo_nails = parm5;
   self.ammo_rockets = parm6;
   self.ammo_cells = parm7;
   self.weapon = parm8;
   self.armortype = (parm9 * 0.010);

        self.deathtype = "";

	//rob's chasecam
	if (! self.dest2_x) self.dest2_x = parm16;
	if (! self.dest2_y) self.dest2_y = parm14;
	if (! self.dest2_z) self.dest2_z = parm15;

};

entity () FindIntermission = {

   local entity spot;
   local float cyc;

   spot = find (world,classname,"info_intermission");
   if ( spot ) {

      cyc = (random () * MOVETYPE_STEP);
      while ( (cyc > TRUE) ) {

         spot = find (spot,classname,"info_intermission");
         if ( !spot ) {

            spot = find (spot,classname,"info_intermission");

         }
         cyc = (cyc - TRUE);

      }
      return ( spot );

   }
   spot = find (world,classname,"info_player_start");
   if ( spot ) {

      return ( spot );

   }
   spot = find (world,classname,"testplayerstart");
   if ( spot ) {

      return ( spot );

   }
   objerror ("FindIntermission: no spot");

};
string nextmap /* = "" */;

void () GotoNextMap = {

   if ( cvar ("samelevel") ) {

      changelevel (mapname);

   } else {

   changelevel (nextmap);

   }
   
};

void () ExitIntermission = {

   if ( deathmatch ) {

      GotoNextMap ();
      return ;

   }
   intermission_exittime = (time + TRUE);
   intermission_running = (intermission_running + TRUE);
   if ( (intermission_running == FL_SWIM) )
   {

      if ( (world.model == "maps/e1m7.bsp") )
      {

         WriteByte (MSG_ALL,SVC_CDTRACK);
         WriteByte (MSG_ALL,FL_SWIM);
         WriteByte (MSG_ALL,MOVETYPE_WALK);
         if ( !cvar ("registered") )
         {

            WriteByte (MSG_ALL,SVC_FINALE);
            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...");

         }
         else
         {

            WriteByte (MSG_ALL,SVC_FINALE);
            //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...");
            WriteString (MSG_ALL,"You rock! You killed the beast Chthon!\nTake the rune of Earth Magic and go kick\nsome more mutant ass!\nDeath to all who oppose you!...");

         }
         return ;

      }
      else
      {

         if ( (world.model == "maps/e2m6.bsp") ) {

            WriteByte (MSG_ALL,SVC_CDTRACK);
            WriteByte (MSG_ALL,FL_SWIM);
            WriteByte (MSG_ALL,MOVETYPE_WALK);
            WriteByte (MSG_ALL,SVC_FINALE);
            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...");
            return ;

         }
         else if ( (world.model == "maps/e3m6.bsp") ) {

               WriteByte (MSG_ALL,SVC_CDTRACK);
               WriteByte (MSG_ALL,FL_SWIM);
               WriteByte (MSG_ALL,MOVETYPE_WALK);
               WriteByte (MSG_ALL,SVC_FINALE);
               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 ...");
               return ;
			}

         else if ( (world.model == "maps/e4m7.bsp") ) {

                  WriteByte (MSG_ALL,SVC_CDTRACK);
                  WriteByte (MSG_ALL,FL_SWIM);
                  WriteByte (MSG_ALL,MOVETYPE_WALK);
                  WriteByte (MSG_ALL,SVC_FINALE);
                  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...");
                  return ;
         }
         else if (world.model == "maps/sm55_czg.bsp") { //bondo intermission message
                  WriteByte (MSG_ALL,SVC_CDTRACK);
                  WriteByte (MSG_ALL,FL_SWIM);
                  WriteByte (MSG_ALL,MOVETYPE_WALK);
                  WriteByte (MSG_ALL,SVC_FINALE);
                  WriteString (MSG_ALL,"You are king of all you survey...\nBut wait, Gandalf the Grey calls to you\n'Nerd, go forth and conquer\nfor further destruction awaits...'");
                  return ;
         }

      }

      }
      GotoNextMap ();

   if ( (intermission_running == MOVETYPE_WALK) ) {

      if ( !cvar ("registered") ) {

         WriteByte (MSG_ALL,SVC_SELLSCREEN);
         return ;

      }
      if ( ((serverflags & 15.000) == 15.000) ) {

         WriteByte (MSG_ALL,SVC_FINALE);
         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 he...");
         return ;

      }

   }
   GotoNextMap ();

};

void () IntermissionThink = {

   if ( (time < intermission_exittime) ) {

      return ;

   }
   if ( ((!self.button0 && !self.button1) && !self.button2) ) {

      return ;

   }
   ExitIntermission ();

};

void () execute_changelevel = {

   local entity pos;

   intermission_running = TRUE;
   if ( deathmatch ) {

      intermission_exittime = (time + MOVETYPE_FLY);

   } else {

      intermission_exittime = (time + FL_SWIM);

   }
   WriteByte (MSG_ALL,SVC_CDTRACK);
   WriteByte (MSG_ALL,MOVETYPE_WALK);
   WriteByte (MSG_ALL,MOVETYPE_WALK);
   pos = FindIntermission ();
   other = find (world,classname,"player");
   while ( (other != world) ) {

      other.view_ofs = VEC_ORIGIN;
      other.v_angle = pos.mangle;
      other.angles = pos.mangle;
      other.fixangle = TRUE;
      other.nextthink = (time + 0.500);
      other.takedamage = DAMAGE_NO;
      other.solid = SOLID_NOT;
      other.movetype = MOVETYPE_NONE;
      other.modelindex = FALSE;
      setorigin (other,pos.origin);
      other = find (other,classname,"player");

   }
   WriteByte (MSG_ALL,SVC_INTERMISSION);

};

void () changelevel_touch = {

   local entity pos;

   if ( (other.classname != "player") ) {

      return ;

   }
   if ( ((cvar ("noexit") == TRUE) || ((cvar ("noexit") == FL_SWIM) && (mapname != "start"))) )
   {

      T_Damage (other,self,self,50000.000);
      return ;

   }
   if ( (coop || deathmatch) ) {

      bprint (other.netname);
      bprint (" exited the level\n");

   }
   nextmap = self.map;
   SUB_UseTargets ();
   if ( ((self.spawnflags & TRUE) && (deathmatch == FALSE)) ) {

      GotoNextMap ();
      return ;

   }
   self.touch = SUB_Null;
   self.think = execute_changelevel;
   self.nextthink = (time + 0.100);

};

void () trigger_changelevel = {

   if ( !self.map ) {

      objerror ("change level trigger doesn't have map");

   }
   InitTrigger ();
   self.touch = changelevel_touch;

};

void () set_suicide_frame;

void () respawn = {

   if ( coop ) {

      CopyToBodyQue (self);
      setspawnparms (self);
      PutClientInServer ();

   } else {

      if ( deathmatch ) {

         CopyToBodyQue (self);
         SetNewParms ();
         PutClientInServer ();

      } else {

         localcmd ("restart\n");

      }

   }

};

void () ClientKill = {

   bprint (self.netname);
   bprint (" suicides\n");
   set_suicide_frame ();
   self.modelindex = modelindex_player;
   self.frags = (self.frags - FL_SWIM);
   respawn ();

};
float (vector v) CheckSpawnPoint = {

   return ( FALSE );

};
entity () SelectSpawnPoint = {

   local entity spot;
   local entity thing;
   local float pcount;

   spot = find (world,classname,"testplayerstart");
   if ( spot ) {

      return ( spot );

   }
   if ( coop ) {

      lastspawn = find (lastspawn,classname,"info_player_coop");
      if ( (lastspawn == world) ) {

         lastspawn = find (lastspawn,classname,"info_player_start");

      }
      if ( (lastspawn != world) ) {

         return ( lastspawn );

      }

   } else {

      if ( deathmatch ) {

         spot = lastspawn;
         while ( TRUE ) {

            spot = find (spot,classname,"info_player_deathmatch");
            if ( (spot != world) ) {

               if ( (spot == lastspawn) ) {

                  return ( lastspawn );

               }
               pcount = FALSE;
               thing = findradius (spot.origin,FL_MONSTER);
               while ( thing ) {

                  if ( (thing.classname == "player") ) {

                     pcount = (pcount + TRUE);

                  }
                  thing = thing.chain;

               }
               if ( (pcount == FALSE) ) {

                  lastspawn = spot;
                  return ( spot );

               }

            }

         }

      }

   }
   if ( serverflags ) {

      spot = find (world,classname,"info_player_start2");
      if ( spot ) {

         return ( spot );

      }

   }
   spot = find (world,classname,"info_player_start");
   if ( !spot ) {

      error ("PutClientInServer: no info_player_start on level");

   }
   return ( spot );

};

void () PlayerDie;

void () PutClientInServer = {

   local entity spot;

   
   spot = SelectSpawnPoint ();
   self.classname = "player";

/*
   self.clone = spawn();
   self.clone.owner = self;
   self.clone.classname = "clone";
*/
   self.health = 100.000;
   self.takedamage = DAMAGE_AIM;
   self.solid = SOLID_SLIDEBOX;
   self.movetype = MOVETYPE_WALK;
   self.show_hostile = FALSE;

	self.max_health = 100.000;	
		
   self.flags = FL_CLIENT;
   self.air_finished = (time + 12.000);
   self.dmg = FL_SWIM;
   self.super_damage_finished = FALSE;
   self.radsuit_finished = FALSE;
   self.invisible_finished = FALSE;
   self.invincible_finished = FALSE;
   self.effects = FALSE;
   self.invincible_time = FALSE;
   self.bondoflag = FALSE;


   //self.touch = SUB_Null;
   self.bondotime = time;

	
   DecodeLevelParms ();
   W_SetCurrentAmmo ();
   self.attack_finished = time;
   self.th_pain = player_pain;
   self.th_die = PlayerDie;
   self.deadflag = DEAD_NO;
   self.pausetime = FALSE;
   self.origin = (spot.origin + '0.000 0.000 1.000');
   self.angles = spot.angles;
   self.fixangle = TRUE;
   setmodel (self,"progs/eyes.mdl");
   modelindex_eyes = self.modelindex;
   setmodel (self,"progs/player.mdl");
   modelindex_player = self.modelindex;
   setsize (self,VEC_HULL_MIN,VEC_HULL_MAX);
   self.view_ofs = '0.000 0.000 22.000';
   player_stand1 ();
   if ( (deathmatch || coop) ) {

      makevectors (self.angles);
      spawn_tfog ((self.origin + (v_forward * 20.000)));

   }
   spawn_tdeath (self.origin,self);

	// Rob's chasecam
	// reset view and targeter according to what was set in parm16
	Chase_cam_level_start();

};

void () dmsp_countdown = {

   local string ticker;
   local entity sucker;

   if ( (self.cnt < FALSE) ) {

      self.nextthink = (time + TRUE);
      self.think = SUB_Remove;

   }
   sucker = find (world,classname,"player");
   if ( (sucker != world) ) {

      ticker = ftos (self.cnt);
      
      if (self.cnt > 3)
      	centerprint(sucker,"Sυπεςδυπες DMSP Beta 2\n\nby BΟNΔO\n and Aardappel\nE-mail: hondobondo@yahoo.com\n\n");
      else if ( (self.cnt > FALSE) )
         centerprint (sucker,ticker);
         

      if ( (self.cnt == MOVETYPE_WALK) ) {

         sound (sucker,CHAN_AUTO,"ra/3.wav",TRUE,ATTN_NONE);

      } else {

         if ( (self.cnt == FL_SWIM) ) {

            sound (sucker,CHAN_AUTO,"ra/2.wav",TRUE,ATTN_NONE);

         } else {

            if ( (self.cnt == TRUE) ) {

               sound (sucker,CHAN_AUTO,"ra/1.wav",TRUE,ATTN_NONE);

            } else {

               if ( (self.cnt == FALSE) ) {

                  sound (sucker,CHAN_AUTO,"ra/fight.wav",TRUE,ATTN_NONE);

               }

            }

         }

      }

   }
   self.cnt = (self.cnt - TRUE);
   self.nextthink = (time + TRUE);
   self.think = dmsp_countdown;
   return ;

};



void () info_player_start = {



};

void () info_player_start2 = {


};

void () testplayerstart = {


};

void () info_player_deathmatch = {


   local vector source;
   local vector org;

   self.cnt = FALSE;
   source = self.origin;
   org = (source + '48.000 0.000 0.000');
   traceline (source,org,TRUE,self);
   if ( (trace_fraction < TRUE) ) {

      return ;

   }
   org = (source + '-48.000 0.000 0.000');
   traceline (source,org,TRUE,self);
   if ( (trace_fraction < TRUE) ) {

      return ;

   }
   org = (source + '0.000 48.000 0.000');
   traceline (source,org,TRUE,self);
   if ( (trace_fraction < TRUE) ) {

      return ;

   }
   org = (source + '0.000 -48.000 0.000');
   traceline (source,org,TRUE,self);
   if ( (trace_fraction < TRUE) ) {

      return ;

   }
   dprint ("Fat spawn detected!\n");
   self.cnt = TRUE;



};

void () info_player_coop = {


};

void () NextLevel = {

   local entity o;

   if ( (mapname == "start") ) {

      if ( !cvar ("registered") ) {

         mapname = "e1m1";

      } else {

         if ( !(serverflags & TRUE) ) {

            mapname = "e1m1";
            serverflags = (serverflags | TRUE);

         } else {

            if ( !(serverflags & FL_SWIM) ) {

               mapname = "e2m1";
               serverflags = (serverflags | FL_SWIM);

            } else {

               if ( !(serverflags & MOVETYPE_STEP) ) {

                  mapname = "e3m1";
                  serverflags = (serverflags | MOVETYPE_STEP);

               } else {

                  if ( !(serverflags & FL_CLIENT) ) {

                     mapname = "e4m1";
                     serverflags = (serverflags - MOVETYPE_PUSH);

                  }

               }

            }

         }

      }
      o = spawn ();
      o.map = mapname;

   } else {

      o = find (world,classname,"trigger_changelevel");
      if ( !o ) {

         mapname = "start"; //comment this out to use BondoMaps(mapname);
         o = spawn ();
         o.map = mapname; //"o.map = BondoMaps(mapname);" to use BondoMaps()
         //o.map = BondoMaps(mapname);

      }

   }
   nextmap = o.map;
   gameover = TRUE;

   //bondo: If noexit is 3, level selection is TOTALLY random.
   if (cvar("noexit") == 3)
      nextmap = RandMap();


   if ( (o.nextthink < time) ) {

      o.think = execute_changelevel;
      o.nextthink = (time + 0.100);

   }

};

void () CheckRules = {

   local float timelimit;
   local float fraglimit;

   if ( gameover ) {

      return ;

   }
   timelimit = (cvar ("timelimit") * 60.000);
   fraglimit = cvar ("fraglimit");
   if ( (timelimit && (time >= timelimit)) ) {

      NextLevel ();
      return ;

   }
   if ( (fraglimit && (self.frags >= fraglimit)) ) {

      NextLevel ();
      return ;

   }

};

void () PlayerDeathThink = {

   local entity old_self;
   local float forward;

   if ( (self.flags & FL_ONGROUND) ) {

      forward = vlen (self.velocity);
      forward = (forward - 20.000);
      if ( (forward <= FALSE) ) {

         self.velocity = VEC_ORIGIN;

      } else {

         self.velocity = (forward * normalize (self.velocity));

      }

   }
   if ( (self.deadflag == DEAD_DEAD) ) {

      if ( ((self.button2 || self.button1) || self.button0) ) {

         return ;

      }
      self.deadflag = DEAD_RESPAWNABLE;
      return ;

   }
   if ( ((!self.button2 && !self.button1) && !self.button0) ) {

      return ;

   }
   self.button0 = FALSE;
   self.button1 = FALSE;
   self.button2 = FALSE;
   respawn ();

};

void () PlayerJump = {


   local vector start;
   local vector end;

   if ( (self.flags & FL_WATERJUMP) ) {

      return ;

   }
   if ( (self.waterlevel >= FL_SWIM) ) {

      if ( (self.watertype == CONTENT_WATER) ) {

         self.velocity_z = 100.000;

      } else {

         if ( (self.watertype == CONTENT_SLIME) ) {

            self.velocity_z = 80.000;

         } else {

            self.velocity_z = 50.000;

         }

      }
      if ( (self.swim_flag < time) ) {

         self.swim_flag = (time + TRUE);
         if ( (random () < 0.500) ) {

            sound (self,CHAN_BODY,"misc/water1.wav",TRUE,ATTN_NORM);

         } else {

            sound (self,CHAN_BODY,"misc/water2.wav",TRUE,ATTN_NORM);

         }

      }
      return ;

   }

   if ( !(self.flags & FL_ONGROUND) ) {

      return ;

   }
   if ( !(self.flags & FL_JUMPRELEASED) ) {

      return ;

   }
   self.flags = (self.flags - (self.flags & FL_JUMPRELEASED));
   self.flags = (self.flags - FL_ONGROUND);
   self.button2 = FALSE;
      sound (self,CHAN_BODY,"player/plyrjmp8.wav",TRUE,ATTN_NORM);

	self.velocity_z = self.velocity_z + 270;
 
};
.float dmgtime;

void (entity fuel) blaze_spread;

void () WaterMove = {

   if ( (self.movetype == MOVETYPE_NOCLIP) ) {

      return ;

   }

   if (self.health <= FALSE)	//<= changed from <
      return ;

   if ( (self.waterlevel != 3) )
   {
				if (self.air_finished < time)
					sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
				else if (self.air_finished < time + 9)
					sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);

      self.air_finished = (time + 12.000);
      self.dmg = FL_SWIM;

   } else {

		if (self.invincible_time)
			return;
		else
		{
	      if ( (self.air_finished < time) )
   	   {
				{
   	      	if ( (self.pain_finished < time) )
      	   	{
	      	      self.dmg = (self.dmg + FL_SWIM);
   	      	   if ( (self.dmg > 15.000) )
   	         	{
	               	self.dmg = MOVETYPE_BOUNCE;
		            }
   		         T_Damage (self,world,world,self.dmg);
      		      self.pain_finished = (time + TRUE);
	      	   }
				}
   	   }
   	}

   }
   if ( !self.waterlevel ) {

      if ( (self.flags & FL_INWATER) ) {

         sound (self,CHAN_BODY,"misc/outwater.wav",TRUE,ATTN_NORM);
         self.flags = (self.flags - FL_INWATER);

      }
      return ;

   }
   if ( (self.watertype == CONTENT_LAVA) ) {

      if ( (self.dmgtime < time) ) {

         if ( (self.radsuit_finished > time) ) {

            self.dmgtime = (time + TRUE);

         } else {

            self.dmgtime = (time + 0.200);

         }
			if (self.invincible_time)
				return;
			else
			{
				T_Damage (self, world, world, 10*self.waterlevel);
				blaze_spread(self);
			}

      }

   } else {

      if ( (self.watertype == CONTENT_SLIME) ) {

         if ( ((self.dmgtime < time) && (self.radsuit_finished < time)) ) {

            self.dmgtime = (time + TRUE);
				if (self.invincible_time)
					return;
				else
            	T_Damage (self,world,world,(MOVETYPE_STEP * self.waterlevel));

         }

      }

   }
   if ( !(self.flags & FL_INWATER) ) {

		if (self.watertype == CONTENT_LAVA)
			sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
		if (self.watertype == CONTENT_WATER)
			sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
		if (self.watertype == CONTENT_SLIME)
			sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);

      self.flags = (self.flags + FL_INWATER);
      self.dmgtime = FALSE;

   }
   if ( !(self.flags & FL_WATERJUMP) ) {

      self.velocity = (self.velocity - (((0.800 * self.waterlevel) * frametime) * self.velocity));

   }

};

void () CheckWaterJump = {

   local vector start;
   local vector end;

   makevectors (self.angles);
   start = self.origin;
   start_z = (start_z + FL_CLIENT);
   v_forward_z = FALSE;
   normalize (v_forward);
   end = (start + (v_forward * 24.000));
   traceline (start,end,TRUE,self);
   if ( (trace_fraction < TRUE) ) {

      start_z = ((start_z + self.maxs_z) - FL_CLIENT);
      end = (start + (v_forward * 24.000));
      self.movedir = (trace_plane_normal * -50.000);
      traceline (start,end,TRUE,self);
      if ( (trace_fraction == TRUE) ) {

         self.flags = (self.flags | FL_WATERJUMP);
         self.velocity_z = 225.000;
         self.flags = (self.flags - (self.flags & FL_JUMPRELEASED));
         self.teleport_time = (time + FL_SWIM);
         return ;

      }

   }

};

void() Regen =
{
   if (self.bondotime > time) return;

   self.bondotime = time + 1;

   if (self.armorvalue < 200)
   {

		if (self.armortype == 0) {
			self.armortype = 0.30;
			self.items = self.items | IT_ARMOR1;
		}

		self.armorvalue = self.armorvalue + 3;

      if (self.armorvalue > 200)
      	self.armorvalue = 200;
   }


   if (self.health < self.max_health)
   {
	      self.health = self.health + 2;
	      
      //sound (self, CHAN_AUTO, "items/r_item1.wav", 1, ATTN_NORM);
      if (self.health > self.max_health)
      	self.health = self.max_health;
   }
   
};

void () PlayerPreThink = {

if (BotPreFrame()) // FrikBot
	return;

   local float mspeed;
   local float aspeed;
   local float r;

	

   if ( intermission_running ) {

      IntermissionThink ();
      return ;

   }
   if ( (self.view_ofs == VEC_ORIGIN) ) {

      return ;

   }
   makevectors (self.v_angle);
   CheckRules ();
   WaterMove ();

   if ( (self.waterlevel == FL_SWIM) ) {

      CheckWaterJump ();

   }
   if ( (self.deadflag >= DEAD_DEAD) ) {

      PlayerDeathThink ();
      return ;

   }
   if ( (self.deadflag == DEAD_DYING) ) {

      return ;

   }

	Regen();

   if ( self.button2 )
		PlayerJump ();
	else
      self.flags = (self.flags | FL_JUMPRELEASED);

        if (self.motd_time)
           if (self.motd_time < time) MOTD();

   if ( (time < self.pausetime) ) {

      self.velocity = VEC_ORIGIN;

   }
   if ( (((time > self.attack_finished) && (self.currentammo == FALSE)) && (self.weapon != IT_AXE)) ) {

      self.weapon = W_BestWeapon ();
      W_SetCurrentAmmo ();

   }

};

void () CheckPowerups = {

   if ( (self.health <= FALSE) ) {

      return ;

   }
   if ( self.invisible_finished ) {

      if ( (self.invisible_sound < time) ) {

         sound (self,CHAN_AUTO,"items/inv3.wav",0.500,ATTN_IDLE);
         self.invisible_sound = (time + ((random () * MOVETYPE_WALK) + TRUE));

      }
      if ( (self.invisible_finished < (time + MOVETYPE_WALK)) ) {

         if ( (self.invisible_time == TRUE) ) {

            sprint (self,"Ring of Shadows magic is fading\n");
            stuffcmd (self,"bf\n");
               sound (self,CHAN_AUTO,"items/inv2.wav",TRUE,ATTN_NORM);
            self.invisible_time = (time + TRUE);

         }
         if ( (self.invisible_time < time) ) {

            self.invisible_time = (time + TRUE);
            stuffcmd (self,"bf\n");

         }

      }
      if ( (self.invisible_finished < time) ) {

         self.items = (self.items - IT_INVISIBILITY);
         self.invisible_finished = FALSE;
         self.invisible_time = FALSE;

      }
      self.frame = FALSE;
      self.modelindex = modelindex_eyes;

   } else 
   

      self.modelindex = modelindex_player;

   if ( self.invincible_finished ) {

      if ( (self.invincible_finished < (time + MOVETYPE_WALK)) ) {

         if ( (self.invincible_time == TRUE) ) {

            sprint (self,"Protection is almost burned out\n");
            stuffcmd (self,"bf\n");
               sound (self,CHAN_AUTO,"items/protect2.wav",TRUE,ATTN_NORM);
            self.invincible_time = (time + TRUE);

         }
         if ( (self.invincible_time < time) ) {

            self.invincible_time = (time + TRUE);
            stuffcmd (self,"bf\n");

         }

      }
      if ( (self.invincible_finished < time) ) {

         self.items = (self.items - IT_INVULNERABILITY);
         self.invincible_time = FALSE;
         self.invincible_finished = FALSE;

      }
      if ( (self.invincible_finished > time) ) {

         self.effects = (self.effects | EF_DIMLIGHT);

      } else {

         self.effects = (self.effects - (self.effects & EF_DIMLIGHT));

      }

   }

   if ( self.super_damage_finished ) {

      if ( (self.super_damage_finished < (time + MOVETYPE_WALK)) ) {

         if ( (self.super_time == TRUE) ) {

            sprint (self,"Quad Damage is wearing off\n");
            stuffcmd (self,"bf\n");
               sound (self,CHAN_AUTO,"items/damage2.wav",TRUE,ATTN_NORM);
            self.super_time = (time + TRUE);

         }
         if ( (self.super_time < time) ) {

            self.super_time = (time + TRUE);
            stuffcmd (self,"bf\n");

         }

      }
      if ( (self.super_damage_finished < time) ) {

         self.items = (self.items - IT_QUAD);
         self.super_damage_finished = FALSE;
         self.super_time = FALSE;

      }
      if ( (self.super_damage_finished > time) ) {

         self.effects = (self.effects | EF_DIMLIGHT);

      } else {

         self.effects = (self.effects - (self.effects & EF_DIMLIGHT));

      }

   }
   if ( self.radsuit_finished ) {

      self.air_finished = (time + 12.000);
      if ( (self.radsuit_finished < (time + MOVETYPE_WALK)) ) {

         if ( (self.rad_time == TRUE) ) {

            sprint (self,"Air supply in Biosuit expiring\n");
            stuffcmd (self,"bf\n");
               sound (self,CHAN_AUTO,"items/suit2.wav",TRUE,ATTN_NORM);
            self.rad_time = (time + TRUE);

         }
         if ( (self.rad_time < time) ) {

            self.rad_time = (time + TRUE);
            stuffcmd (self,"bf\n");

         }

      }
      if ( (self.radsuit_finished < time) ) {

         self.items = (self.items - IT_SUIT);
         self.rad_time = FALSE;
         self.radsuit_finished = FALSE;

      }

   }

};

void () PlayerPostThink = {

if (BotPostFrame()) // FrikBot
	return;

   local float mspeed;
   local float aspeed;
   local float r;




	if (self.view_ofs == '0 0 0')
	{				
	return;		// intermission or finale
	}

   if (self.deadflag)
      return ;
   W_WeaponFrame ();

   if ( (((self.jump_flag < -300.000) && (self.flags & FL_ONGROUND)) && (self.health > FALSE)) )
   {
	   if ( (self.watertype == CONTENT_WATER) )
         sound (self,CHAN_BODY,"player/h2ojump.wav",TRUE,ATTN_NORM);
	   else
	      {
	         if (self.jump_flag < -650.000)
	         {

            		T_Damage (self,world,world,MOVETYPE_FLY);
            		   sound (self,CHAN_VOICE,"player/land2.wav",TRUE,ATTN_NORM);
		            self.deathtype = "falling";

	         }
	         else
	         {

      			      sound (self,CHAN_VOICE,"player/land.wav",TRUE,ATTN_NORM);

	         }
	      }
      self.jump_flag = FALSE;
   }

   if ( !(self.flags & FL_ONGROUND) )
      self.jump_flag = self.velocity_z;

   CheckPowerups ();

};

void(entity guy) ServerMsg;

void () ClientConnect = {

ClientInRankings(); // FrikBot

	   bprint (self.netname);
   	bprint (" entered the game\n");

        self.motd_time = time + 3;
	self.motd_count = 0;
        ServerMsg(self);

   if ( intermission_running ) {

      ExitIntermission ();

   }

};

void () ClientDisconnect = {

ClientDisconnected(); // FrikBot


   if ( gameover ) {

      return ;

   }

	   bprint (self.netname);
   	bprint (" left the game with ");
   	bprint (ftos (self.frags));
	   bprint (" frags\n");
		if (random() < 0.7)
	   	sound (self,CHAN_BODY,"canigo.wav",TRUE,ATTN_NONE);
		else
		   sound (self,CHAN_BODY,"player/tornoff2.wav",TRUE,ATTN_NONE);
	   set_suicide_frame ();

};

void (entity targ, entity attacker) ClientObituary = {

   local float rnum;
   local string deathstring;
   local string deathstring2;


   rnum = random ();
   if ( (targ.classname == "player") ) {

//removed death waves from DMSP 

/*
      if ( (rnum < 0.250) ) {

         sound (targ,CHAN_AUTO,"bishop/rot.wav",TRUE,ATTN_NONE);

      } else {

         if ( (rnum < 0.500) ) {

            sound (targ,CHAN_AUTO,"bishop/skull.wav",TRUE,ATTN_NONE);

         } else {

            if ( (rnum < 0.750) ) {

               sound (targ,CHAN_AUTO,"bishop/rip.wav",TRUE,ATTN_NONE);

            } else {

               sound (targ,CHAN_AUTO,"bishop/journey.wav",TRUE,ATTN_NONE);

            }

         }

      }
*/

      if ( (attacker.classname == "teledeath") ) {

         bprint (targ.netname);
         bprint (" was telefragged by ");
         bprint (attacker.owner.netname);
         bprint ("\n");
         attacker.owner.frags = (attacker.owner.frags + TRUE);
         return ;

      }
      if ( (attacker.classname == "teledeath2") ) {

         bprint ("Satan's power deflects ");
         bprint (targ.netname);
         bprint ("'s telefrag\n");
         targ.frags = (targ.frags - TRUE);
         return ;

      }

	
      if ( (attacker.classname == "player") ) {

	
         if ( (targ == attacker) ) {

	attacker.frags = attacker.frags - 1;	//lose only one frag in deathmatch 3

//bondo suicides
	if (targ.deathtype == "man")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" stood by his man\n");
      return;
	}
	if (targ.deathtype == "volta")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" was atomized by his own voltaloydz\n");
      return;
	}
	if (targ.deathtype == "meat")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" got a taste of his own bad meat\n");
      return;
	}
	if (targ.deathtype == "holo")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" turns off the hologram safety settings\n");
      return;
	}
	if (targ.deathtype == "vortex")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" got sucked into his own vortex\n");
      return;
	}
	if (targ.deathtype == "explo")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" nuked himself\n");
      return;
	}
	if (targ.deathtype == "blaze")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" roasted himself\n");
      return;
	}
	if (targ.deathtype == "vxgas")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" died from his own gas\n");
      return;
	}
	if (targ.deathtype == "proxmine")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" found his lost proximity mine\n");
      return;
	}
	if (targ.deathtype == "posibeam")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" is destroyed by his own positron beam\n");
      return;
	}
	if (targ.deathtype == "headbomb")
	{
		targ.deathtype = "";
		bprint(targ.netname);
      bprint(" is eliminated by his own head\n");
      return;
	}
//end bondo suicides

            bprint (targ.netname);
            if ( ((targ.weapon == FL_GODMODE) && (targ.waterlevel > TRUE)) ) {

               bprint (" discharges into the water.\n");
               return ;

            }

            if ( (targ.weapon == IT_GRENADE_LAUNCHER) )
            {
            	if (targ.grenadetype == 0)
            	{
            		bprint (" tries to put the pin back in\n");
            	}
            	else if (targ.grenadetype == 2)
            	{
            		bprint (" devastates himself\n");
            	}

            } else {

               bprint (" becomes bored with life\n");

            }
            return ;

         } else {

            if ( (((teamplay == 2) && (targ.team > FALSE)) && (targ.team == attacker.team)) ) {

               if ( (rnum < 0.250) ) {

                  deathstring = " mows down a teammate\n";

               } else {

                  if ( (rnum < 0.500) ) {

                     deathstring = " checks his glasses\n";

                  } else {

                     if ( (rnum < 0.750) ) {

                        deathstring = " gets a frag for the other team\n";

                     } else {

                        deathstring = " loses another friend\n";

                     }

                  }

               }
               bprint (attacker.netname);
               bprint (deathstring);
               attacker.frags = (attacker.frags - TRUE);
               return ;

            } else {

			attacker.frags = (attacker.frags + TRUE);


//bondo deaths
										if (targ.deathtype == "super_laser")
										{
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" outwitted by ");
                                 bprint (attacker.netname);
                                 bprint ("'s smartgun\n");
                                 return;
										}
										if (targ.deathtype == "hmissile")
										{
                                 targ.deathtype = "";
                                 bprint (attacker.netname);
                                 bprint ("'s missile homed in on ");
                                 bprint (targ.netname);
                                 bprint ("\n");
                                 return;
										}
										if (targ.deathtype == "rpod")
										{
                                 targ.deathtype = "";
                                 bprint (attacker.netname);
                                 bprint (" pounded ");
                                 bprint (targ.netname);
                                 bprint (" with his rocket pods\n");
                                 return;
										}
										if (targ.deathtype == "dmissile")
										{
                                 targ.deathtype = "";
                                 bprint (attacker.netname);
                                 bprint (" plastered ");
                                 bprint (targ.netname);
                                 bprint (" with his drunk missiles\n");
                                 return;
										}
										if (targ.deathtype == "firebomb")
										{
                                 targ.deathtype = "";
                                 bprint (attacker.netname);
                                 bprint (" crushed ");
                                 bprint (targ.netname);
                                 bprint (" with his firebomb\n");
                                 return;
										}
										if (targ.deathtype == "throwaxe")
										{
                                 targ.deathtype = "";
                                 bprint (attacker.netname);
                                 bprint (" hit ");
                                 bprint (targ.netname);
                                 bprint (" with his throwing axe\n");
                                 return;
										}
										if (targ.deathtype == "blendernail")
										{
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" was blended by ");
                                 bprint (attacker.netname);
                                 bprint ("\n");
                                 return;
										}
										if (targ.deathtype == "volta")
										{
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" was atomized by ");
                                 bprint (attacker.netname);
                                 bprint ("'s voltaloydz\n");
                                 return;
										}
										if (targ.deathtype == "godfire")
										{
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" was judged unworthy by ");
                                 bprint (attacker.netname);
                                 bprint (" and incinerated\n");
                                 return;
										}
										if (targ.deathtype == "lightmine")
										{
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is zapped by ");
                                 bprint (attacker.netname);
                                 bprint ("'s lightning mine\n");
                                 return;
										}
                              if (targ.deathtype == "man")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is man-handled by ");
                                 bprint (attacker.netname);
                                 bprint ("\n");
                                 return;
                              }
                              if (targ.deathtype == "headbomb")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is decapitated by ");
                                 bprint (attacker.netname);
                                 bprint ("'s head\n");
                                 return;
                              }
                              if (targ.deathtype == "vxgas")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" gets a whiff of ");
                                 bprint (attacker.netname);
                                 bprint ("'s gas\n");
                                 return;
                              }
                              if (targ.deathtype == "proxmine")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" finds ");
                                 bprint (attacker.netname);
                                 bprint ("'s proximity mine\n");
                                 return;
                              }
                              if (targ.deathtype == "holo")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is mangled by ");
                                 bprint (attacker.netname);
                                 bprint ("'s hologram\n");
                                 return;
                              }
                              if (targ.deathtype == "meat")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" gets a taste of ");
                                 bprint (attacker.netname);
                                 bprint ("'s meat\n");
                                 return;
                              }
                              if (targ.deathtype == "blaze")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 if (random() < 0.5)
                                 	bprint (" is roasted by ");
                                 else
                                 	bprint (" is broiled by ");
                                 bprint (attacker.netname);
                                 bprint ("\n");
                                 return;
                              }
                              if (targ.deathtype == "vortex")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is sucked into ");
                                 bprint (attacker.netname);
                                 bprint ("'s vortex\n");
                                 return;
                              }
                              if (targ.deathtype == "flame")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is flamed by ");
                                 bprint (attacker.netname);
                                 bprint ("\n");
                                 return;
                              }
                              if (targ.deathtype == "posibeam")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is eradicated by ");
                                 bprint (attacker.netname);
                                 bprint ("'s positron beam\n");
                                 return;
                              }
                              if (targ.deathtype == "protonstorm")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is atomized by ");
                                 bprint (attacker.netname);
                                 bprint ("'s proton storm\n");
                                 return;
                              }
                              if (targ.deathtype == "explo")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is nuked by ");
                                 bprint (attacker.netname);
                                 bprint ("\n");
                                 return;
                              }
                              if (targ.deathtype == "pds")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is nailed by ");
                                 bprint (attacker.netname);
                                 bprint ("'s point defense system\n");
                                 return;
                              }
                              if (targ.deathtype == "laser")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
  	                              bprint (" was zapped by ");
     	                           bprint (attacker.netname);
        	                        bprint ("\n");
           	                     return;
                              }
                              if (targ.deathtype == "railbubble")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
  	                              bprint (" rides ");
     	                           bprint (attacker.netname);
        	                        bprint ("'s rail\n");
           	                     return;
                              }
                              if (targ.deathtype == "missile")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is disemboweled by ");
                                 bprint (attacker.netname);
                                 bprint ("'s dual rockets\n");
                                 return;
                              }
                              if (targ.deathtype == "plasma")
                              {
                                 targ.deathtype = "";
                                 bprint (targ.netname);
                                 bprint (" is vaporized by ");
                                 bprint (attacker.netname);
                                 bprint ("'s plasma cannon\n");
                                 return;
                              }
//end bondo deaths

               rnum = attacker.weapon;
               if ( (rnum == IT_AXE)) 
               {
                  	if (random() < 0.5)
                  	{
	                  	deathstring = " was axe murdered by ";
		                  deathstring2 = "\n";
                  	}
                  	else
                  	{
	                  	deathstring = " was dismembered by ";
		                  deathstring2 = "\n";
                  	}
               }
               if ( (rnum == IT_SHOTGUN) ) {
               		deathstring = " chewed on ";
	                  deathstring2 = "'s boomstick\n";

               }
               if ( (rnum == IT_SUPER_SHOTGUN)) 
					{
						if (attacker.supershotguntype == 0)
						{
                  	deathstring = " was blasted by ";
	                  deathstring2 = "'s superduper shotgun\n";
						}
						else
						{
                  	deathstring = " ate 2 loads of";
	                  deathstring2 = "'s buckshot\n";
						}
						
					}
					
               if ( (rnum == IT_NAILGUN) )
               {
						if (attacker.nailguntype == 4)
						{
							deathstring = " was nailed by ";
   	               deathstring2 = "\n";
   	            }
   	            else if (attacker.nailguntype == 0)
   	            {
							deathstring = " was gunned down by ";
							deathstring = "\n";
   	            }

               }
               if ( (rnum == IT_SUPER_NAILGUN))
					{
						if  (attacker.supernailguntype == 0)
						{
						deathstring =" was shredded by ";
						deathstring2 = "'s heavychaingun\n";
						}
						else
						{
						deathstring = " was punctured by ";
                  deathstring2 = "\n";
                  }
               }
               if ( (rnum == IT_GRENADE_LAUNCHER)) 
               {
                  if (attacker.grenadetype == 2)
                  {
							deathstring = " is devastated by";
                  	deathstring2 = "\n";
                  }
                  else
                  {
							deathstring = " eats ";
                  	deathstring2 = "'s pineapple\n";
                  }

                  /*
                  if ( (targ.health < -40.000) )
                  {
							deathstring = " was gibbed by ";
                     deathstring2 = "'s grenade\n";
						}
						*/
               }

               if ( (rnum == IT_ROCKET_LAUNCHER) )
               {
                  if (attacker.rockettype == 4)
						{
							deathstring = " rides ";
	                  deathstring2 = "'s rocket\n";
	               }
                  /*
                  if ( (targ.health < -40.000) ) {

                     deathstring = " was gibbed by ";
                     deathstring2 = "'s rocket\n";

                  }*/
               }

               if ( (rnum == IT_LIGHTNING))
					{
						if (attacker.cellguntype == 5)
						{
	                  deathstring = " accepts ";
   	               if ( (attacker.waterlevel > TRUE) )
      	            {
								deathstring2 = "'s discharge\n";
            	      } 
               	   else 
                  	{
								deathstring2 = "'s shaft\n";
							}
						}
						
						if (attacker.cellguntype == 2)
						{
							if (random() < 0.33)
							{
                     	deathstring = " was vaporized by ";
	                     deathstring2 = "'s proton storm\n";
	                  }
	                  else if (random() < 0.67)
	                  {
                     	deathstring = " was raped by ";
	                     deathstring2 = "'s huge blue shaft\n";
	                  }
	                  else
	                  {
                     	deathstring = " was gibbed into 5 pieces by ";
	                     deathstring2 = "'s awesome blue storm of death\n";
	                  }
	                    
						}
					}


               bprint (targ.netname);
               bprint (deathstring);
               bprint (attacker.netname);
               bprint (deathstring2);

            }

         }
         return ;

      } else {

         targ.frags = (targ.frags - TRUE);
         bprint (targ.netname);
         if ( (attacker.flags & FL_MONSTER) ) {

            if ( (attacker.classname == "monster_army") ) {

	            if (targ.deathtype == "railbubble")
	            	bprint(" was railed by an Grunt\n");
	            else
	               bprint (" was shot by a Grunt\n");

            }
            if ( (attacker.classname == "drone") ) {

               bprint (" was eviscerated by an alien\n");

            }
            if ( (attacker.classname == "monster_dog") ) {

               bprint (" was mauled by a Rottweiler\n");

            }
            if ( (attacker.classname == "monster_dragon") ) {

               bprint (" was fried by a Dragon\n");

            }
            if ( (attacker.classname == "monster_enforcer") ) {
            
	            if (targ.deathtype == "laser")
	            	bprint(" was zapped by an Enforcer\n");
	            else if (targ.deathtype == "plasma")
	            	bprint(" was vaporized by an Enforcer\n");
	            else
	               bprint (" was shafted by an Enforcer\n");

            }
            if ( (attacker.classname == "monster_fish") ) {

               bprint (" was fed to the Rotfish\n");

            }
            if ( (attacker.classname == "monster_hell_knight") ) {

               bprint (" was slain by a Death Knight\n");

            }
            if ( (attacker.classname == "monster_knight") ) {

               bprint (" was slashed by a Knight\n");

            }
            if ( (attacker.classname == "warrior") ) {

               bprint (" was eaten by a xenomorph\n");

            }
            if ( (attacker.classname == "monster_oldone") ) {

               bprint (" became one with Shub-Niggurath\n");

            }
            if ( (attacker.classname == "monster_shalrath") ) {

               bprint (" was exploded by a Vore\n");

            }
            if ( (attacker.classname == "warrior") ) {


	            	bprint(" was brained by an alien\n");

            }
            if ( (attacker.classname == "monster_tarbaby") ) {

               bprint (" was slimed by a Spawn\n");

            }
            if ( (attacker.classname == "monster_vomit") ) {

               bprint (" was vomited on by a Vomitus\n");

            }
            if ( (attacker.classname == "monster_wizard") ) {

               bprint (" was scragged by a Scrag\n");

            }
            if ( (attacker.classname == "facehugger") ) {

               bprint (" was implanted by a facehugger\n");

            }
            return ;

         }
         if ( (attacker.classname == "explo_box") ) {

            bprint (" blew up\n");
            return ;

         }
         if ( ((attacker.solid == SOLID_BSP) && (attacker != world)) ) {

            bprint (" was squished\n");
            return ;

         }
         if ( ((attacker.classname == "trap_shooter") || (attacker.classname == "trap_spikeshooter")) ) {

            bprint (" was spiked\n");
            return ;

         }
         if ( (attacker.classname == "fireball") ) {

            bprint (" ate a lavaball\n");
            return ;

         }
         if ( (attacker.classname == "trigger_changelevel") ) {

            bprint (" tried to leave\n");
            return ;

         }
         rnum = targ.watertype;
         if ( (rnum == CONTENT_WATER) ) {

            if ( (random () < 0.500) ) {

               bprint (" sleeps with the fishes\n");

            } else {

               bprint (" sucks it down\n");

            }
            return ;

         } else {

            if ( (rnum == CONTENT_SLIME) ) {

               if ( (random () < 0.500) ) {

                  bprint (" gulped a load of slime\n");

               } else {

                  bprint (" can't exist on slime alone\n");

               }
               return ;

            } else {

               if ( (rnum == CONTENT_LAVA) ) {

                  if ( (targ.health < -15.000) ) {

                     bprint (" burst into flames\n");
                     return ;

                  }
                  if ( (random () < 0.500) ) {

                     bprint (" turned into hot slag\n");

                  } else {

                     bprint (" sacrifices himself to the Volcano God\n");

                  }
                  return ;

               }

            }

         }
         if ( (targ.deathtype == "falling") ) {

            targ.deathtype = "";
            bprint (" fell to his death\n");
            return ;

         }
         bprint (" died\n");

      }

   }
};
