
void() flame_watercheck =
{
  local float  pc;

  pc = pointcontents (self.origin);
  if ((pc == CONTENT_WATER) || (pc == CONTENT_SLIME))
  {
    sound (self, CHAN_WEAPON, "blhiss1.wav", 1, ATTN_NORM);
    // reset inflictor so enities don't keep going for water

    // make the little grey particles
    WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
    WriteByte (MSG_BROADCAST, TE_GUNSHOT);
    WriteCoord (MSG_BROADCAST, self.origin_x);
    WriteCoord (MSG_BROADCAST, self.origin_y);
    WriteCoord (MSG_BROADCAST, self.origin_z);
    remove (self);

    return;
  }

//  self.think = blaze_watercheck;
//  self.nextthink = time;
};


/*
float(entity head) PM_InWater =
{
        if (pointcontents(head.origin) == CONTENT_WATER)  return TRUE;
        return (pointcontents(head.origin) == CONTENT_SLIME);
};

entity(entity attacker, entity victim, vector spot) PM_NewFire =
{
        local   entity  fire;

        fire = spawn();
        setmodel (fire, "progs/flame2.mdl");
        setsize (fire, '0 0 0', '0 0 0');
        setorigin (fire, spot);

        fire.solid              = SOLID_NOT;
        fire.takedamage         = DAMAGE_NO;
        fire.frame              = 0;
        fire.fireown            = attacker;
        fire.owner              = victim;
        fire.classname          = "fire";
        fire.netname            = "fire";
        //fire.attack_finished    = time; //removed by bondo

        return fire;
};
*/
/*
void() s_fire1 =[ 0, s_fire2 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire2 =[ 1, s_fire3 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire3 =[ 2, s_fire4 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire4 =[ 2, s_fire5 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire5 =[ 3, s_fire6] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire6 =[ 0, s_fire7 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire7 =[ 1, s_fire8 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire8 =[ 2, s_fire9 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire9 =[ 2, s_fire10 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire10 =[ 3, s_fire11] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire11 =[ 0, s_fire12 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire12 =[ 1, s_fire13 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire13 =[ 2, s_fire14 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire14 =[ 2, s_fire15 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire15 =[ 3, s_fire16] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire16 =[ 0, s_fire17 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire17 =[ 1, s_fire18 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire18 =[ 2, s_fire19 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire19 =[ 2, s_fire20 ] {if (PM_InWater(self)) PM_MakeSteam(self);};
void() s_fire20 =[ 3, SUB_Remove ] {};
*/

void() s_fire1 =[ 0, s_fire2 ] {flame_watercheck();};
void() s_fire2 =[ 1, s_fire3 ] {flame_watercheck();};
void() s_fire3 =[ 2, s_fire4 ] {flame_watercheck();};
void() s_fire4 =[ 2, s_fire5 ] {flame_watercheck();};
void() s_fire5 =[ 3, s_fire6] {flame_watercheck();};
void() s_fire6 =[ 0, s_fire7 ] {flame_watercheck();};
void() s_fire7 =[ 1, s_fire8 ] {flame_watercheck();};
void() s_fire8 =[ 2, s_fire9 ] {flame_watercheck();};
void() s_fire9 =[ 2, s_fire10 ] {flame_watercheck();};
void() s_fire10 =[ 3, s_fire11] {flame_watercheck();};
void() s_fire11 =[ 0, s_fire12 ] {flame_watercheck();};
void() s_fire12 =[ 1, s_fire13 ] {flame_watercheck();};
void() s_fire13 =[ 2, s_fire14 ] {flame_watercheck();};
void() s_fire14 =[ 2, s_fire15 ] {flame_watercheck();};
void() s_fire15 =[ 3, s_fire16] {flame_watercheck();};
void() s_fire16 =[ 0, s_fire17 ] {flame_watercheck();};
void() s_fire17 =[ 1, s_fire18 ] {flame_watercheck();};
void() s_fire18 =[ 2, s_fire19 ] {flame_watercheck();};
void() s_fire19 =[ 2, s_fire20 ] {flame_watercheck();};
void() s_fire20 =[ 3, SUB_Remove ] {};

void() PM_MakeFlames =
{
        local   vector  dir;

        dir = aim (self, 1000);
        dir_x = dir_x + crandom() * 0.16;
        dir_y = dir_y + crandom() * 0.16;
        dir_z = dir_z + crandom() * 0.08;

        //newmis = PM_NewFire(self, self, self.origin + '0 0 16');


        newmis = spawn();
        setorigin (newmis, self.origin + '0 0 16');
        newmis.owner = self;
        newmis.takedamage         = DAMAGE_NO;
        newmis.frame              = 0;
        newmis.movetype  = MOVETYPE_FLYMISSILE;
        newmis.solid     = SOLID_BBOX;
        newmis.effects = newmis.effects | EF_DIMLIGHT;
        setmodel (newmis, "progs/s_explod.spr");
      //newmis.touch     = PM_BurnTouch;
		//newmis.touch = FlameTouch;
        newmis.touch = blaze_touch;
        newmis.nextthink = time;
        newmis.think     = s_fire1;
		  newmis.classname = "flame";
        setsize (newmis, '0 0 0', '0 0 0');        
        newmis.velocity = dir * (random() * 600 + 600);
		  setorigin(newmis,self.origin + '0.000 0.000 16.000' );

		  /*
        if (PM_InWater(newmis))
        {       PM_MakeSteam(newmis);
                return;
        }
        */

        //newmis = PM_NewFire(self, self, self.origin + '0 0 16');



};



void() PM_FireFlamethrower =
{
	local vector	dir;
	local entity	old;

	sound (self, CHAN_WEAPON, "flstart.wav", 1, ATTN_NORM);
	self.attack_finished = time + 0.2;
        self.currentammo = self.ammo_nails = self.ammo_nails - 1.5;
        PM_MakeFlames();
        //PM_MakeFlames();
        //PM_MakeFlames();
};

