
// Scriptable marine -------------------------------------------------------

class ScriptedMarine : Actor native
{
	Default
	{
		Health 100;
		Radius 16;
		Height 56;
		Mass 100;
		Speed 8;
		Painchance 160;
		MONSTER;
		-COUNTKILL
		Translation 0;
		Damage 100;
		DeathSound "*death";
		PainSound "*pain50";
	}
	
	native void A_M_Refire (bool ignoremissile=false);
	native void A_M_CheckAttack ();
	native void A_MarineChase ();
	native void A_MarineLook ();
	native void A_MarineNoise ();
	native void A_M_Punch (int force);
	native void A_M_SawRefire ();
	native void A_M_FirePistol (bool accurate);
	native void A_M_FireShotgun ();
	native void A_M_FireShotgun2 ();
	native void A_M_FireCGun(bool accurate);
	native void A_M_FireMissile ();
	native void A_M_FirePlasma ();
	native void A_M_FireRailgun ();
	native void A_M_BFGsound ();
	native void A_M_FireBFG ();
	
	States
	{
	Spawn:
		PLAY A 4 A_MarineLook;
		PLAY A 4 A_MarineNoise;
		Loop;
	Idle:
		PLAY A 4 A_MarineLook;
		PLAY A 4 A_MarineNoise;
		PLAY A 4 A_MarineLook;
		PLAY B 4 A_MarineNoise;
		PLAY B 4 A_MarineLook;
		PLAY B 4 A_MarineNoise;
		Loop;
	See:
		PLAY ABCD 4 A_MarineChase;
		Loop;

	Melee.Fist:		
		PLAY E 4 A_FaceTarget;
		PLAY E 4 A_M_Punch(1);
		PLAY A 9;
		PLAY A 0 A_M_Refire(1);
		Loop;
		PLAY A 5 A_FaceTarget;
		Goto See;
	Melee.Berserk:
		PLAY E 4 A_FaceTarget;
		PLAY E 4 A_M_Punch(10);
		PLAY A 9;
		PLAY A 0 A_M_Refire(1);
		Loop;
		PLAY A 5 A_FaceTarget;
		Goto See;
	Melee.Chainsaw:
		PLAY E 4 A_MarineNoise;
		PLAY E 4 A_M_Saw;
		PLAY E 0 A_M_SawRefire;
		goto Melee.Chainsaw+1;
		PLAY A 0;
		Goto See;

	Missile:
	Missile.None:
		PLAY E 12 A_FaceTarget;
		Goto Idle;
		PLAY F 6 BRIGHT;
		Loop;
	Missile.Pistol:
		PLAY E 4 A_FaceTarget;
		PLAY F 6 BRIGHT A_M_FirePistol(1);
		PLAY A 4 A_FaceTarget;
		PLAY A 0 A_M_Refire;
		PLAY A 5;
		Goto See;
	Fireloop.Pistol:
		PLAY F 6 BRIGHT A_M_FirePistol(0);
		PLAY A 4 A_FaceTarget;
		PLAY A 0 A_M_Refire;
		Goto Fireloop.Pistol;
		PLAY A 5;
		Goto See;
	Missile.Shotgun:
		PLAY E 3 A_M_CheckAttack;
		PLAY F 7 BRIGHT A_M_FireShotgun;
		Goto See;
	Missile.SSG:
		PLAY E 3 A_M_CheckAttack;
		PLAY F 7 BRIGHT A_M_FireShotgun2;
		Goto See;
	Missile.Chaingun:
		PLAY E 4 A_FaceTarget;
		PLAY FF 4 BRIGHT A_M_FireCGun(1);
		PLAY FF 4 BRIGHT A_M_FireCGun(0);
		PLAY A 0 A_M_Refire;
		Goto Missile.Chaingun+3;
		PLAY A 0;
		Goto See;
	Missile.Rocket:
		PLAY E 8;
		PLAY F 6 BRIGHT A_M_FireMissile;
		PLAY E 6;
		PLAY A 0 A_M_Refire;
		Loop;
		PLAY A 0;
		Goto See;
	Missile.Plasma:
		PLAY E 2 A_FaceTarget;
		PLAY E 0 A_FaceTarget;
		PLAY F 3 BRIGHT A_M_FirePlasma;
		PLAY A 0 A_M_Refire;
		Goto Missile.Plasma+1;
		PLAY A 0;
		Goto See;
	Missile.Railgun:
		PLAY E 4 A_M_CheckAttack;
		PLAY F 6 BRIGHT A_M_FireRailgun;
		Goto See;
	Missile.BFG:
		PLAY E 5 A_M_BFGSound;
		PLAY EEEEE 5 A_FaceTarget;
		PLAY F 6 BRIGHT A_M_FireBFG;
		PLAY A 4 A_FaceTarget;
		PLAY A 0 A_M_Refire;
		Loop;
		PLAY A 0;
		Goto See;

	SkipAttack:
		PLAY A 1;
		Goto See;
	Pain:
		PLAY G 4;
		PLAY G 4 A_Pain;
		Goto Idle;
	Death:
		PLAY H 10;
		PLAY I 10 A_Scream;
		PLAY J 10 A_NoBlocking;
		PLAY KLM 10;
		PLAY N -1;
		Stop;
	XDeath:
		PLAY O 5;
		PLAY P 5 A_XScream;
		PLAY Q 5 A_NoBlocking;
		PLAY RSTUV 5;
		PLAY W -1;
		Stop;
	Raise:
		PLAY MLKJIH 5;
		Goto See;
	}
}

//---------------------------------------------------------------------------

class MarineFist : ScriptedMarine
{
	States
	{
	Melee:		
		Goto Super::Melee.Fist;
	Missile:
		Stop;
	}
}


//---------------------------------------------------------------------------

class MarineBerserk : MarineFist
{
	States
	{
	Melee:		
		Goto Super::Melee.Berserk;
	Missile:
		Stop;
	}
}
//---------------------------------------------------------------------------

class MarineChainsaw : ScriptedMarine
{
	States
	{
	Melee:
		Goto Super::Melee.Chainsaw;
	Missile:
		Stop;
	}
}



//---------------------------------------------------------------------------

class MarinePistol : ScriptedMarine
{
	States
	{
	Missile:
		Goto Super::Missile.Pistol;
	}

}

//---------------------------------------------------------------------------

class MarineShotgun : ScriptedMarine
{
	States
	{
	Missile:
		Goto Super::Missile.Shotgun;
	}

}



//---------------------------------------------------------------------------

class MarineSSG : ScriptedMarine
{
	States
	{
	Missile:
		Goto Super::Missile.SSG;
	}
}

//---------------------------------------------------------------------------

class MarineChaingun : ScriptedMarine
{
	States
	{
	Missile:
		Goto Super::Missile.Chaingun;
	}
}


//---------------------------------------------------------------------------

class MarineRocket : MarineFist
{
	States
	{
	Missile:
		Goto Super::Missile.Rocket;
	}

}

//---------------------------------------------------------------------------

class MarinePlasma : ScriptedMarine
{
	States
	{
	Missile:
		Goto Super::Missile.Plasma;
	}

}

//---------------------------------------------------------------------------

class MarineRailgun : ScriptedMarine
{
	States
	{
	Missile:
		Goto Super::Missile.Railgun;
	}

}

//---------------------------------------------------------------------------

class MarineBFG : ScriptedMarine
{
	States
	{
	Missile:
		Goto Super::Missile.BFG;
	}
}
