///////////////////////////////Default stuff, No changes here ///////////////////////////////////
#define true 1
#define false 0

#define VSoft 0
#define VArmor 1
#define VAir 2

#define private 0
#define protected 1
#define public 2

#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define ReadAndWrite 0
#define ReadAndCreate 1
#define ReadOnly 2
#define ReadOnlyVerified 3

#define CanSeeRadar 1
#define CanSeeEye 2
#define CanSeeOptics 4
#define CanSeeEar 8
#define CanSeeCompass 16 
#define CanSeeRadarC CanSeeRadar+CanSeeCompass
#define CanSeeAll 31
/////////////////////////////// ^^ Default Stuff ^^ ///////////////////////////////

class CfgMovesBasic  {
	class DefaultDie; //Extended
	class ManActions  {
		smurfc_m2a2_driver = "smurfc_m2a2_driver";
		smurfc_m2a2_commander = "smurfc_m2a2_commander";
		smurfc_m2a2_gunner = "smurfc_m2a2_gunner";
	};
};

class CfgMovesMaleSdr  : CfgMovesBasic {
	class States  {
		class Crew; //Extended
//		class KIA_T72_Commander;
		class KIA_M113_Driver;
//		class KIA_T72_Gunner;
		class smurfc_m2a2_driver  : Crew {
			file = "\smurfc_m2a2\smurfC_ARMAM2A2_Driver2.rtm";
			interpolateTo[] = {"KIA_M113_Driver",1 };
		};
		class smurfc_m2a2_commander  : Crew {
			file = "\smurfc_m2a2\smurfC_ARMAM2A2_Commander3.rtm";
			interpolateTo[] = {"KIA_T72_Gunner",1 };
		};
		class smurfc_m2a2_gunner  : Crew {
			file = "\smurfc_m2a2\smurfC_ARMAM2A2_Gunner3.rtm";
			interpolateTo[] = {"KIA_T72_Driver",1 };
		};
	};
};

class CfgPatches
{
	class smurfc_m2a2
	{
		units[] = {"smurfc_m2a2", "smurfc_m2a2_b", "smurfc_m2a2_g", "smurfc_m2a2_stinger", "smurfc_m2a2_stinger_b", "smurfc_m2a2_stinger_g"};		
		weapons[] = {""};
		requiredVersion = 1.000000;
		requiredAddons[] = {"CATracked"};
	};
};

class CfgVehicleClasses
{
	class PirSmurfC_ERA_110_Armor
	{
		displayName = "SmurfC";
	};
};

class Turrets;
class MainTurret;
class CommanderOptics;
class ViewPilot;

class CfgVehicles
{ 
	class Tank;
	class smurfc_m2a2 : Tank
	{
		scope=public;
		side=TSideUnknown;
		vehicleClass = "";
		crew = Civilian;
		nameSound="apc";
		
		hasGunner = 1;
		hasCommander = 1; //ToDo: Still needed?
		
		typicalCargo[]={Civilian,Civilian,Civilian};
		initCargoAngleY=+90; // cargo viewing limitations
		
		soundGetIn[]={\ca\Tracked\Data\Sound\metal_door2,db-40,1};
		soundGetOut[]={\ca\Tracked\Data\Sound\metal_door2,db-40,1};
		soundEnviron[]={\ca\Tracked\Data\Sound\M1A1_treads3,db17,0.8};
		soundEngine[]={\ca\Tracked\Data\Sound\m113_loop_1a,db18,1};
		soundCrash[]={\ca\Tracked\Data\Sound\crash2,db20,1};
		soundGear[]={\ca\Tracked\Data\Sound\Gear_Trans1,db-60,1};
		class Exhausts
		{
			class Exhaust1
			{
			position = "vyfuk start";
			direction = "vyfuk konec";
			effect = "ExhaustsEffectBig";
			};
		};
		picture="\ca\tracked\Data\im2a2.paa";
		Icon="\Ca\tracked\Data\map_ico\icomap_m113_ca.paa";

		driverAction = M113_DriverOut;
		driverInAction = smurfc_m2a2_driver;
		
		transportSoldier = 6;
		cargoAction[] = {
			Stryker_Cargo01,Stryker_Cargo01,Stryker_Cargo01,Stryker_Cargo01,
			Stryker_Cargo01,Stryker_Cargo01
		};
		unloadInCombat=1;

		model = "\smurfc_m2a2\smurfc_m2a2";
		displayName = "M2 Bradley";
		
		forceHideDriver = false;
		driverForceOptics = false;
		
		transportMaxMagazines = 100;
		transportMaxWeapons = 20;
		
		type=VArmor;
		threat[] = {0.9,0.9,0.5};
		
		ejectDamageLimit = 0.90;
		// CAVS
		maxSpeed=76;
		accuracy=0.30;
		
		armor=250;
		damageResistance = 0.03249;
		cost=1500000;
		
		camouflage=4.81;
		armorstructural=2.7;	// CAVS:3
		armorHull=0.55;
		armorTurret=0.45;
		armorGun=2;
		armorEngine=2;
		armorLights=1;
		armorTracks=2;
		class HitHull   {armor = 0.97; material = 50; name = "telo";  visual = "telo";  passThrough = 1;};
		
		class HitEngine {armor = 0.82; material = 60; name = "motor"; visual = "motor"; passThrough = 1;};
		class HitLTrack {armor=0.75;material=55;name="pas_L";visual="pas_L";passThrough=0;};
		class HitRTrack {armor=0.75;material=55;name="pas_P";visual="pas_P";passThrough=0;};
		
		//armorStructural=4.0; // BIS-Compatible to BMP-2
		//class HitEngine {armor = 0.350000; material = 60; name = "NEmotor"; visual = "motor"; passThrough = 1;}; // BIS-Compatible to BMP-2
		//class HitLTrack {armor=0.150;material=55;name="pas_L";visual="pas_L";passThrough=0;}; // BIS-Compatible to BMP-2
		//class HitRTrack {armor=0.150;material=55;name="pas_P";visual="pas_P";passThrough=0;}; // BIS-Compatible to BMP-2

		class Turrets: Turrets
		{
			class MainTurret: MainTurret
			{
				lockWhenDriverOut=true;
				soundServo[]={\ca\Weapons\Data\Sound\gun_elevate2,db-60,1.0};
				gunnerOpticsModel = \ca\Tracked\optika_stryker_gunner;
				gunnerOutOpticsModel = "\ca\weapons\optika_empty";
				class ViewOptics
				{
					initAngleX=0; minAngleX=-30; maxAngleX=+30;
					initAngleY=0; minAngleY=-100; maxAngleY=+100;
					initFov=0.166; minFov=0.025; maxFov=0.333;
				};
				
				class HitTurret {armor=1;material=55;name="vez";visual="vez";passThrough=1;};
				class HitGun {armor=0.87;material=55;name="zbran";visual="zbran";passThrough=0;};
				gunnerAction = ZSU_CommanderOut;
				gunnerInAction = "smurfc_m2a2_gunner";
				gunnerForceOptics = false;
				viewGunnerInExternal = false;
				weapons[] = {2A42, M240_veh, TOWLauncher};
				magazines[] = {"250Rnd_30mmAP_2A42", "250Rnd_30mmHE_2A42", 1200Rnd_762x51_M240, 2Rnd_TOW,2Rnd_TOW,2Rnd_TOW,2Rnd_TOW};
				minElev=-4.5; maxElev=+74; initElev=0;
				//maxHorizontalRotSpeed = 0.900000;
				//maxVerticalRotSpeed = 0.900000;
				class Turrets: Turrets
				{
					class CommanderOptics: CommanderOptics
					{
						gunBeg = "gun_muzzle";
						gunEnd = "gun_chamber";
						body = "ObsTurret";
						gun = "ObsGun";
						minElev=-25; maxElev=+60; initElev=0;
						minTurn=-360; maxTurn=+360; initTurn=0;
						gunnerOpticsModel = "\ca\Tracked\optika_T72_commander";
						soundServo[]={\ca\Weapons\Data\Sound\gun_elevate2,db-70,1.0};
						outGunnerMayFire = true;
						inGunnerMayFire = true;
						startEngine=false;

						gunnerAction = ZSU_CommanderOut;
						gunnerInAction = "smurfc_m2a2_commander";
						gunnerForceOptics = false;
						viewGunnerInExternal = false;
						weapons[]={FakeWeapon};
						magazines[]={FakeWeapon};
					};
				};
			};
		};
		class ViewPilot: ViewPilot
		{
			initFov=1; minFov=0.570000; maxFov=1.400000;
			initAngleX=0; minAngleX=-10; maxAngleX=+5;
			initAngleY=0; minAngleY=-40; maxAngleY=+40;
		};
		// let only small amount of direct light go through, to avoid shadow artifacts
		viewCargoShadowDiff = 0.05;
		// reduce amount of ambient light as well
		viewCargoShadowAmb = 0.5;
		class AnimationSources {
			class smurfc_m2a2_MainGunReload {
	            source = "reload";
	            weapon = 2A42;
			};
			class smurfc_m2a2_MainGunReload_A2 {
	            source = "reload";
	            weapon = M2; // For A2 only
			};
			class smurfc_m2a2_damageTurret
			{
				animPeriod=0;
			};
			class smurfc_m2a2_damageGun
			{
				animPeriod=0;
			};
			class smurfc_m2a2_periscope_mirror
			{
				animPeriod=0;
				initPhase=0;
			};
		};
		class Damage
		{
			tex[]={};
			mat[]={
				"smurfc_m2a2\m2a2_basic.rvmat",
				"smurfc_m2a2\m2a2_basic.rvmat",
				"smurfc_m2a2\m2a2_destruct.rvmat",
				"smurfc_m2a2\m2a2_1_basic.rvmat",
				"smurfc_m2a2\m2a2_1_basic.rvmat",
				"smurfc_m2a2\m2a2_1_destruct.rvmat",
				"smurfc_m2a2\m2a2_2_basic.rvmat",
				"smurfc_m2a2\m2a2_2_basic.rvmat",
				"smurfc_m2a2\m2a2_2_destruct.rvmat",
				"smurfc_m2a2\m2a2_3_basic.rvmat",
				"smurfc_m2a2\m2a2_3_basic.rvmat",
				"smurfc_m2a2\m2a2_3_destruct.rvmat"
			};
		};
		class Library {libTextDesc = "M2A2 Bradley IFV:\nThe Bradley APC is designed to transport infantry offering at least some armored protection while providing fire cover to dismounted troops and suppressing enemy tanks and armored vehicles.\nThe M2 holds a crew of three: a commander, a gunner and a driver; as well as six fully equipped soldiers.\nThe Bradley, was named after WWII General Omar N. Bradley and the first M2A2 entered service with the U.S. Army in 1988. It was qualified to be transported by the C-17 Globemaster III.\nThe Bradley is equipped with the M242 25 mm chain gun as its main weapon. It is also armed with a M240C machine gun mounted coaxially to the M242. For engaging heavier targets (such as when acting in an anti-tank fashion), the Bradley has a TOW missile system onboard.";};
		hiddenSelections[] = {"num1_m2a2","num2_m2a2","num3_m2a2","1_co_m2a2","2_co_m2a2","3_co_m2a2","flag_m2a2"}; 
		hiddenSelectionsTextures[] = {"\smurfc_m2a2\numbers\three", "\smurfc_m2a2\numbers\six", "\smurfc_m2a2\numbers\five", "\smurfc_m2a2\m2a2_1_co.paa", "\smurfc_m2a2\m2a2_2_co.paa", "\smurfc_m2a2\m2a2_3_co.paa", "\smurfc_m2a2\west_01.paa"};
	};
	class smurfc_m2a2_b : smurfc_m2a2
	{
		side=TWest;
		vehicleClass = "PirSmurfC_ERA_110_Armor";
		crew = SoldierWCrew;
		typicalCargo[]={SoldierWCrew,SoldierWCrew,SoldierWCrew};
		hiddenSelectionsTextures[] = {"\smurfc_m2a2\numbers\six", "\smurfc_m2a2\numbers\five", "\smurfc_m2a2\numbers\three", "\smurfc_m2a2\m2a2_bfor_1_co.paa", "\smurfc_m2a2\m2a2_bfor_2_co.paa", "\smurfc_m2a2\m2a2_3_co.paa", "\ca\misc\data\usa_vlajka.paa"};
	};
	class smurfc_m2a2_g : smurfc_m2a2
	{
		side=TGuerrila;
		vehicleClass = "PirSmurfC_ERA_110_Armor";
		crew = SoldierGCrew;
		typicalCargo[]={SoldierGCrew,SoldierGCrew,SoldierGCrew};
		hiddenSelectionsTextures[] = {"\smurfc_m2a2\numbers\five", "\smurfc_m2a2\numbers\three", "\smurfc_m2a2\numbers\six", "\smurfc_m2a2\m2a2_racs_1_co.paa", "\smurfc_m2a2\m2a2_racs_2_co.paa", "\smurfc_m2a2\m2a2_racs_3_co.paa", "\ca\misc\data\jih_vlajka.paa"};
	};
	class smurfc_m2a2_stinger: smurfc_m2a2
	{
		displayName = "M6 Linebacker";
		model = "\smurfc_m2a2\smurfc_m6";
		transportSoldier = 0;
		//threat[] VSoft, VArmor, VAir
		threat[]={0.5, 0.5, 1};
		irScanRangeMin = 400;
		irScanRangeMax = 3000;
		irScanToEyeFactor = 5;
		gunnerCanSee = CanSeeRadarC+CanSeeOptics+CanSeeEar;
		class Turrets: Turrets
		{
			class MainTurret: MainTurret
			{				
				weapons[] = {2A42, M240_veh, StingerLauncher_twice};
				magazines[] = {"250Rnd_30mmAP_2A42", "250Rnd_30mmHE_2A42", 1200Rnd_762x51_M240, 2Rnd_Stinger, 2Rnd_Stinger, 2Rnd_Stinger, 2Rnd_Stinger };
			};
		};
		class Library {libTextDesc = "M6 Linebacker:\nAn air defense variant of the Bradley IFV. These vehicles are modified M2A2 ODSs with the TOW missile system replaced with a four-tube Stinger missile system to comply with the Short-range Air Defense (SHORAD) concept. The M6 are due to be retired from U.S. service.";};
		hiddenSelections[] = {"num1_m2a2","num2_m2a2","num3_m2a2","1_co_m2a2","2_co_m2a2","3_co_m2a2","flag_m2a2"}; 
		hiddenSelectionsTextures[] = {"\smurfc_m2a2\numbers\four", "\smurfc_m2a2\numbers\six", "\smurfc_m2a2\numbers\eight", "\smurfc_m2a2\m2a2_1_co.paa", "\smurfc_m2a2\m2a2_2_co.paa", "\smurfc_m2a2\m2a2_3_co.paa", "\smurfc_m2a2\west_01.paa"};
	};	
	class smurfc_m2a2_stinger_b: smurfc_m2a2_stinger
	{
		side=TWest;
		vehicleClass = "PirSmurfC_ERA_110_Armor";
		crew = SoldierWCrew;
		typicalCargo[]={SoldierWCrew,SoldierWCrew,SoldierWCrew};
		hiddenSelectionsTextures[] = {"\smurfc_m2a2\numbers\six", "\smurfc_m2a2\numbers\four", "\smurfc_m2a2\numbers\eight", "\smurfc_m2a2\m2a2_bfor_1_co.paa", "\smurfc_m2a2\m2a2_bfor_2_co.paa", "\smurfc_m2a2\m2a2_3_co.paa", "\ca\misc\data\usa_vlajka.paa"};
	};
	class smurfc_m2a2_stinger_g: smurfc_m2a2_stinger
	{
		side=TGuerrila;
		vehicleClass = "PirSmurfC_ERA_110_Armor";
		crew = SoldierGCrew;
		typicalCargo[]={SoldierGCrew,SoldierGCrew,SoldierGCrew};
		hiddenSelectionsTextures[] = {"\smurfc_m2a2\numbers\eight", "\smurfc_m2a2\numbers\four", "\smurfc_m2a2\numbers\six", "\smurfc_m2a2\m2a2_racs_1_co.paa", "\smurfc_m2a2\m2a2_racs_2_co.paa", "\smurfc_m2a2\m2a2_racs_3_co.paa", "\ca\misc\data\jih_vlajka.paa"};
	};
};