
final class TurokBow : TurokWeapon
{
	TurokBow( kWeapon@ a )
	{
		super( a );
		BobDamping = 0.975f;
	}

	void AnimProperties( int&out first, int&out last, float&out rate, bool&out bLoop )
	{
		rate = 60; bLoop = false;
		switch ( PlayingID() )
		{
			case anim_weaponSwapIn:      first =   0; last =  34; break;
			case anim_weaponSwapOut:     first = 201; last = 214; break;
			case anim_weaponFire:                                 rate *= 40/30.0f; // 40/25.0f;
			case anim_weaponFireCharged: first =  34; last =  74; break;
			default: /* idle */          first =  74; last = 200; bLoop = true; break;
		}
	}

	bool Refire()
	{
		switch ( PlayingID() )
		{
			case anim_weaponFire: case anim_weaponFireCharged:
				return true;
		}
		return false;
	}

	void OnTick()
	{
		TurokWeapon::OnTick();
		switch ( PlayingID() )
		{
			case anim_weaponFire: case anim_weaponFireCharged: break;
			default: return;
		}
		if ( PlayTime() > 0.5f ) return;
		float f = 1 - PlayTime() / 0.5f;
		float g = f*f*f;
		OwnerP().RecoilPitch() = Math::Sin( Math::pi * g );
		OwnerP().RecoilPitch() *= OwnerP().RecoilPitch() * -0.015;
		g *= f*f*f;
		OwnerP().Roll() = Math::Sin( Math::pi * g );
		OwnerP().Roll() = float( OwnerP().Roll() ) * OwnerP().Roll() * -0.01f;
	}

	void OnBeginFire()
	{
		kVec3 v( 6, 30, -5 );
		kStr proj = "UT/fx/Ripper/Blade";
		if ( bFire1 )
		{
			PlayAnim( anim_weaponFire );
			self.PlaySound( "U1/sounds/Razorjack/Fire.ksnd" );
			if ( !bTurokPlusInstalled ) proj += "_Minus";
		}
		else
		{
			PlayAnim( anim_weaponFireCharged );
			self.PlaySound( "UT/sounds/Ripper/Fire_Alt.ksnd" );
			proj += "_Alt";
		}
		if ( UDamage() ) proj += "_Amp";
		self.FireProjectile( proj + ".kfx", v.x, v.y, v.z );
		OwnerP().LoudNoiseAlert();
		UseAmmo( 1 );
	}
}
