//=============================================================================
// Boulder1.
//=============================================================================
class Boulder1 expands BigRock;

#exec MESH IMPORT MESH=boulder1 ANIVFILE=MODELS\rock_a.3D DATAFILE=MODELS\rock_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=boulder1 X=0 Y=0 Z=0 YAW=64
#exec MESH SEQUENCE MESH=boulder1 SEQ=All  STARTFRAME=0  NUMFRAMES=4
#exec MESH SEQUENCE MESH=boulder1 SEQ=Pos1  STARTFRAME=0   NUMFRAMES=1
#exec MESH SEQUENCE MESH=boulder1 SEQ=Pos2  STARTFRAME=1   NUMFRAMES=1
#exec MESH SEQUENCE MESH=boulder1 SEQ=Pos3  STARTFRAME=2   NUMFRAMES=1
#exec MESH SEQUENCE MESH=boulder1 SEQ=Pos4  STARTFRAME=3   NUMFRAMES=1
#exec TEXTURE IMPORT NAME=Jboulder1 FILE=MODELS\rock.PCX GROUP=Skins
#exec MESHMAP SCALE MESHMAP=boulder1 X=0.005 Y=0.005 Z=0.01
#exec MESHMAP SETTEXTURE MESHMAP=boulder1 NUM=1 TEXTURE=Jboulder1

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

		PlaySound(ImpactSound, SLOT_Misc, 0.5);	
		if ( (Other != instigator) && (BigRock(Other) == none) && (Size(Velocity) > 100) )
			{
			hitdamage = Damage; //FIXME - scale by velocity
			Other.Damage(hitdamage, instigator,HitLocation,
				(35000.0 * Normal(Velocity)), 'crushed' );
			HitWall(Other.Location - HitLocation, Other);
			}
	}

	function HitWall (vector HitNormal, actor Wall)
	{
		Velocity = 0.75 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal));
		SetRotation(Rotation(HitNormal));
		DrawScale *= 0.7;
		SpawnChunks(8);
		Destroy();
	}
}

