//=============================================================================
// Arrow.
//=============================================================================
class Arrow expands Projectile;

#exec MESH IMPORT MESH=Arrow ANIVFILE=MODELS\arrow_a.3D DATAFILE=MODELS\arrow_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=Arrow X=0 Y=0 Z=0 YAW=-64
#exec MESH SEQUENCE MESH=Arrow SEQ=All  STARTFRAME=0  NUMFRAMES=1
#exec MESH SEQUENCE MESH=Arrow SEQ=Still  STARTFRAME=0   NUMFRAMES=1 
#exec TEXTURE IMPORT NAME=JArrow1 FILE=MODELS\arrow.PCX GROUP=Skins
#exec MESHMAP SCALE MESHMAP=Arrow X=0.04 Y=0.04 Z=0.08
#exec MESHMAP SETTEXTURE MESHMAP=Arrow NUM=1 TEXTURE=JArrow1

#exec AUDIO IMPORT FILE="Sounds\general\ArrowSpawn.wav" NAME="ArrowSpawn" GROUP="General"
#exec AUDIO IMPORT FILE="Sounds\Razor\bladehit.wav" NAME="BladeHit" GROUP="RazorJack"

	function PreBeginPlay()
	{
		local rotation RandRot;

		CallParent.PreBeginPlay();
		Velocity = Vector(Rotation) * Speed;      // velocity
		RandRot.Pitch = FRand() * 200 - 100;
		RandRot.Yaw = FRand() * 200 - 100;
		RandRot.Roll = FRand() * 200 - 100;
		Velocity = Velocity >> RandRot;
		PlaySound(SpawnSound, SLOT_Misc, 2.0);		
	}

	function ProcessTouch( Actor Other, Vector HitLocation )
	{
		local int hitdamage;

		if (Arrow(Other) == none)
		{
			Other.Damage(damage, instigator,HitLocation,
				(MomentumTransfer * Normal(Velocity)), 'shot');
			Explode(HitLocation, vect(0,0,0));
		}
	}

	function HitWall( vector HitNormal, actor Wall )
	{
		CallParent.HitWall(HitNormal, Wall);	
		PlaySound(ImpactSound, SLOT_Misc, 0.5);
	}

	function Explode(vector HitLocation, vector HitNormal)
	{
		local Burst b;
	
		SetPhysics(PHYS_None); 
		MakeNoise(0.3);
  		b = Spawn(Class'Burst');
  		b.Skin = Texture'JArrow1';
  		Destroy();
	}

