
void () dog2_leap1;

void () dog2_run1;

void () dog2_bite = {

   local vector delta;
   local float ldmg;

   if ( !self.enemy ) {

      return ;

   }
   ai_charge (MOVETYPE_BOUNCE);
   if ( !CanDamage (self.enemy,self) ) {

      return ;

   }
   delta = (self.enemy.origin - self.origin);
   if ( (vlen (delta) > 100.000) ) {

      return ;

   }
   ldmg = (((random () + random ()) + random ()) * FL_CLIENT);
   T_Damage (self.enemy,self,self,ldmg);

};

void () Dog2_JumpTouch = {

   local float ldmg;

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

      return ;

   }
   if ( other.takedamage ) {

      if ( (vlen (self.velocity) > 300.000) ) {

         ldmg = (100.000 + (MOVETYPE_BOUNCE * random ()));
         T_Damage (other,self,self,ldmg);

      }

   }
   if ( !checkbottom (self) ) {

      if ( (self.flags & FL_ONGROUND) ) {

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

      }
      return ;

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

};

void () dog2_stand1 = [ 0.000, dog2_stand2 ] {

   ai_stand ();

};

void () dog2_stand2 = [ 1.000, dog2_stand3 ] {

   ai_stand ();

};

void () dog2_stand3 = [ 2.000, dog2_stand4 ] {

   ai_stand ();

};

void () dog2_stand4 = [ 3.000, dog2_stand5 ] {

   ai_stand ();

};

void () dog2_stand5 = [ 4.000, dog2_stand6 ] {

   ai_stand ();

};

void () dog2_stand6 = [ 5.000, dog2_stand7 ] {

   ai_stand ();

};

void () dog2_stand7 = [ 6.000, dog2_stand8 ] {

   ai_stand ();

};

void () dog2_stand8 = [ 7.000, dog2_stand9 ] {

   ai_stand ();

};

void () dog2_stand9 = [ 8.000, dog2_stand1 ] {

   ai_stand ();

};

void () dog2_walk1 = [ 0.000, dog2_walk2 ] {

   if ( (random () < 0.200) ) {

      sound (self,CHAN_VOICE,"face/facew.wav",TRUE,ATTN_IDLE);

   }
   ai_walk (FL_CLIENT);

};

void () dog2_walk2 = [ 1.000, dog2_walk3 ] {

   ai_walk (FL_CLIENT);

};

void () dog2_walk3 = [ 2.000, dog2_walk4 ] {

   ai_walk (FL_CLIENT);

};

void () dog2_walk4 = [ 3.000, dog2_walk5 ] {

   ai_walk (FL_CLIENT);

};

void () dog2_walk5 = [ 4.000, dog2_walk6 ] {

   ai_walk (FL_CLIENT);

};

void () dog2_walk6 = [ 5.000, dog2_walk7 ] {

   ai_walk (FL_CLIENT);

};

void () dog2_walk7 = [ 6.000, dog2_walk8 ] {

   ai_walk (FL_CLIENT);

};

void () dog2_walk8 = [ 7.000, dog2_walk1 ] {

   ai_walk (FL_CLIENT);

};

void () dog2_run1 = [ 0.000, dog2_run2 ] {

   if ( (random () < 0.200) ) {

      sound (self,CHAN_VOICE,"face/facew.wav",TRUE,ATTN_IDLE);

   }
   ai_run (FL_INWATER);

};

void () dog2_run2 = [ 1.000, dog2_run3 ] {

   ai_run (FL_MONSTER);

};

void () dog2_run3 = [ 2.000, dog2_run4 ] {

   ai_run (FL_MONSTER);

};

void () dog2_run4 = [ 3.000, dog2_run5 ] {

   ai_run (20.000);

};

void () dog2_run5 = [ 4.000, dog2_run6 ] {

   ai_run (FL_GODMODE);

};

void () dog2_run6 = [ 5.000, dog2_run7 ] {

   ai_run (FL_MONSTER);

};

void () dog2_run7 = [ 6.000, dog2_run8 ] {

   ai_run (FL_INWATER);

};

void () dog2_run8 = [ 7.000, dog2_run9 ] {

   ai_run (FL_MONSTER);

};

void () dog2_run9 = [ 8.000, dog2_run10 ] {

   ai_run (FL_MONSTER);

};

void () dog2_run10 = [ 9.000, dog2_run11 ] {

   ai_run (20.000);

};

void () dog2_run11 = [ 10.000, dog2_run12 ] {

   ai_run (FL_GODMODE);

};

void () dog2_run12 = [ 11.000, dog2_run1 ] {

   ai_run (FL_MONSTER);

};

void () dog2_atta1 = [ 0.000, dog2_atta2 ] {

   ai_charge (MOVETYPE_BOUNCE);

};

void () dog2_atta2 = [ 1.000, dog2_atta3 ] {

   ai_charge (MOVETYPE_BOUNCE);

};

void () dog2_atta3 = [ 2.000, dog2_atta4 ] {

   ai_charge (MOVETYPE_BOUNCE);

};

void () dog2_atta4 = [ 3.000, dog2_atta5 ] {

   sound (self,CHAN_VOICE,"face/facew.wav",TRUE,ATTN_NORM);
   dog2_bite ();

};

void () dog2_atta5 = [ 4.000, dog2_atta6 ] {

   ai_charge (MOVETYPE_BOUNCE);

};

void () dog2_atta6 = [ 5.000, dog2_atta7 ] {

   ai_charge (MOVETYPE_BOUNCE);

};

void () dog2_atta7 = [ 6.000, dog2_atta8 ] {

   ai_charge (MOVETYPE_BOUNCE);

};

void () dog2_atta8 = [ 7.000, dog2_run1 ] {

   ai_charge (MOVETYPE_BOUNCE);

};

void () dog2_leap1 = [ 0.000, dog2_leap2 ] {

   ai_face ();

};

void () dog2_leap2 = [ 1.000, dog2_leap3 ] {

   ai_face ();
   self.touch = Dog2_JumpTouch;
   makevectors (self.angles);
   self.origin_z = (self.origin_z + TRUE);
   self.velocity = ((v_forward * 300.000) + '0.000 0.000 200.000');
   if ( (self.flags & FL_ONGROUND) ) {

      self.flags = (self.flags - FL_ONGROUND);

   }

};

void () dog2_leap3 = [ 2.000, dog2_leap4 ] {


};

void () dog2_leap4 = [ 3.000, dog2_leap5 ] {


};

void () dog2_leap5 = [ 4.000, dog2_leap6 ] {


};

void () dog2_leap6 = [ 5.000, dog2_leap7 ] {


};

void () dog2_leap7 = [ 6.000, dog2_leap8 ] {


};

void () dog2_leap8 = [ 7.000, dog2_leap9 ] {


};

void () dog2_leap9 = [ 8.000, dog2_leap9 ] {


};

void () dog2_pain1 = [ 0.000, dog2_pain2 ] {


};

void () dog2_pain2 = [ 1.000, dog2_pain3 ] {


};

void () dog2_pain3 = [ 2.000, dog2_pain4 ] {


};

void () dog2_pain4 = [ 3.000, dog2_pain5 ] {


};

void () dog2_pain5 = [ 4.000, dog2_pain6 ] {


};

void () dog2_pain6 = [ 5.000, dog2_run1 ] {


};

void () dog2_painb1 = [ 0.000, dog2_painb2 ] {


};

void () dog2_painb2 = [ 1.000, dog2_painb3 ] {


};

void () dog2_painb3 = [ 2.000, dog2_painb4 ] {

   ai_pain (MOVETYPE_STEP);

};

void () dog2_painb4 = [ 3.000, dog2_painb5 ] {

   ai_pain (12.000);

};

void () dog2_painb5 = [ 4.000, dog2_painb6 ] {

   ai_pain (12.000);

};

void () dog2_painb6 = [ 5.000, dog2_painb7 ] {

   ai_pain (FL_SWIM);

};

void () dog2_painb7 = [ 6.000, dog2_painb8 ] {


};

void () dog2_painb8 = [ 7.000, dog2_painb9 ] {

   ai_pain (MOVETYPE_STEP);

};

void () dog2_painb9 = [ 8.000, dog2_painb10 ] {


};

void () dog2_painb10 = [ 9.000, dog2_painb11 ] {

   ai_pain (MOVETYPE_BOUNCE);

};

void () dog2_painb11 = [ 10.000, dog2_painb12 ] {


};

void () dog2_painb12 = [ 11.000, dog2_painb13 ] {


};

void () dog2_painb13 = [ 12.000, dog2_painb14 ] {


};

void () dog2_painb14 = [ 13.000, dog2_painb15 ] {


};

void () dog2_painb15 = [ 14.000, dog2_painb16 ] {


};

void () dog2_painb16 = [ 15.000, dog2_run1 ] {


};

void () dog2_pain = {

   sound (self,CHAN_VOICE,"face/facep.wav",TRUE,ATTN_NORM);
   if ( (random () > 0.500) ) {

      dog2_pain1 ();

   } else {

      dog2_painb1 ();

   }

};
/*
void () dog2_die1 = [ 0.000, dog2_die2 ] {


};

void () dog2_die2 = [ 1.000, dog2_die3 ] {


};

void () dog2_die3 = [ 2.000, dog2_die4 ] {


};

void () dog2_die4 = [ 3.000, dog2_die5 ] {


};

void () dog2_die5 = [ 4.000, dog2_die6 ] {


};

void () dog2_die6 = [ 5.000, dog2_die7 ] {


};

void () dog2_die7 = [ 6.000, dog2_die8 ] {


};

void () dog2_die8 = [ 7.000, dog2_die9 ] {


};

void () dog2_die9 = [ 8.000, dog2_die9 ] {


};

void () dog2_dieb1 = [ 0.000, dog2_dieb2 ] {


};

void () dog2_dieb2 = [ 1.000, dog2_dieb3 ] {


};

void () dog2_dieb3 = [ 2.000, dog2_dieb4 ] {


};

void () dog2_dieb4 = [ 3.000, dog2_dieb5 ] {


};

void () dog2_dieb5 = [ 4.000, dog2_dieb6 ] {


};

void () dog2_dieb6 = [ 5.000, dog2_dieb7 ] {


};

void () dog2_dieb7 = [ 6.000, dog2_dieb8 ] {


};

void () dog2_dieb8 = [ 7.000, dog2_dieb9 ] {


};

void () dog2_dieb9 = [ 8.000, dog2_dieb9 ] {


};
*/
void () dog2_die = {

   if ( (self.health < TRUE) ) {

      sound (self,CHAN_VOICE,"player/udeath.wav",TRUE,ATTN_NORM);
      ThrowHead ("progs/leg.mdl",self.health);
      ThrowGib ("progs/leg.mdl",self.health);
      ThrowGib ("progs/leg.mdl",self.health);
      ThrowGib ("progs/leg.mdl",self.health);
      ThrowGib ("progs/leg.mdl",self.health);
      ThrowGib ("progs/leg.mdl",self.health);
      ThrowGib ("progs/giba.mdl",self.health);
      ThrowGib ("progs/tail.mdl",self.health);
      return ;

   }
   sound (self,CHAN_VOICE,"face/facep.wav",TRUE,ATTN_NORM);
   self.solid = SOLID_NOT;

/*   if ( (random () > 0.500) ) {

      dog2_die1 ();

   } else {

      dog2_dieb1 ();

   }
*/
};
float () CheckDog2Melee = {

   if ( (enemy_range == RANGE_MELEE) ) {

      self.attack_state = AS_MELEE;
      return ( TRUE );

   }
   return ( FALSE );

};
float () CheckDog2Jump = {

   local vector dist;
   local float d;

   if ( ((self.origin_z + self.mins_z) > ((self.enemy.origin_z + self.enemy.mins_z) + (0.750 * self.enemy.size_z))) ) {

      return ( FALSE );

   }
   if ( ((self.origin_z + self.maxs_z) < ((self.enemy.origin_z + self.enemy.mins_z) + (0.250 * self.enemy.size_z))) ) {

      return ( FALSE );

   }
   dist = (self.enemy.origin - self.origin);
   dist_z = FALSE;
   d = vlen (dist);
   if ( (d < 80.000) ) {

      return ( FALSE );

   }
   if ( (d > 150.000) ) {

      return ( FALSE );

   }
   return ( TRUE );

};
float () Dog2CheckAttack = {

   local vector vec;

   if ( CheckDog2Melee () ) {

      self.attack_state = AS_MELEE;
      return ( TRUE );

   }
   if ( CheckDog2Jump () ) {

      self.attack_state = AS_MISSILE;
      return ( TRUE );

   }
   return ( FALSE );

};

void () monster_dog = {

   self.solid = SOLID_SLIDEBOX;
   self.movetype = MOVETYPE_STEP;
   setmodel (self,"progs/face.mdl");
   setsize (self,VEC_HULL_MIN,'16.000 16.000 8.000');
   self.health = 50.000;
   self.classname = "facehugger";
   self.th_stand = dog2_stand1;
   self.th_walk = dog2_walk1;
   self.th_run = dog2_run1;
   self.th_pain = dog2_pain;
   self.th_die = dog2_die;
   self.th_melee = dog2_atta1;
   self.th_missile = dog2_leap1;
   walkmonster_start ();

};
