ACTOR M14 : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	YScale 0.6
	XScale 0.8
	Weapon.SelectionOrder 2500
	Weapon.AmmoType1 "762NATO"
	Weapon.AmmoType2 "M14Ammo"
	Obituary "%o was shot down by %k's assault M14."
    AttackSound "None"
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "$GOTM14"
    +WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Tag "M-14 Rifle"
    Scale 0.8
	States
	{
 	Spawn:
		WM14 A 1
		TNT1 A 0 A_SpawnItemEx("M14Weapon", 0, 0, 0, momx, momy, momz)
		Stop
	
	Ready:
	Ready3:
		M14G A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		M14G A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        M14G A 0 A_JumpIfInventory("Reloading",1,"Reload")
		M14G A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"----" # 0 A_JumpIfInventory("UsedBandage", 1, "UseBandages")
		Loop
	
		
	Deselect:
		M14G A 0
		M14G A 0 A_TakeInventory("TossGrenade", 1)
        M14G A 0 A_TakeInventory("Reloading",1)
		M14G A 0 A_TakeInventory("Unloading",1)
        M14G A 0 A_ZoomFactor(1.0)
		M14G AAAAA 1 A_Lower
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait

	
	Select:
		M14G A 0
		M14G AAAAA 1 A_Raise
		TNT1 AAAAAAAAA 0 A_Raise
		Goto Ready3
	
    Fire:
        M14G A 0 A_JumpIfInventory("M14Ammo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		M14G A 0 A_AlertMonsters
		M14G A 0 A_PlaySound("M14FIRE", 1)
		//SMGG A 0 A_PlaySound("FARM14", 6)
		TNT1 A 0 A_JumpIFInventory("M14SingleSHot", 1, "Fire2")
		
		M14F A 1 BRIGHT A_FireBullets (1.0, 1.0, 1, 26, "M14Puff", FBF_NORANDOM)
		M14F B 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		M14G A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        M14F A 0 A_FireCustomMissile("m14Tracer", random(-1,1), 0, 0, 0, 0, random(-1,1))
		M14G A 0 A_ZoomFactor(0.96)
		M14G A 0 A_SetPitch(pitch-0.9)
		M14G A 0 A_SetANgle(angle-0.4)
		M14G A 0 A_Takeinventory("M14Ammo",1)
		M14F C 1 A_FireCustomMissile("RifleCaseSpawn",5,0,6,-14)
		M14G A 0 A_SetPitch(pitch-0.6)
		M14G A 0 A_SetANgle(angle-0.2)
		M14G A 0 A_ZoomFactor(1.0)
		
	
		
		
		M14G A 0 A_Refire
		Goto Ready3
	
     Fire2:
		M14F A 1 BRIGHT A_FireBullets (0.5, 0.5, 1, 26, "M14Puff", FBF_NORANDOM)
		M14F B 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		M14G A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        M14F A 0 A_FireCustomMissile("m14Tracer", 0, 0, 0, 0, 0, 0)
		M14G A 0 A_ZoomFactor(0.96)
		M14G A 0 A_SetPitch(pitch-2.6)
		M14G A 0 A_SetANgle(angle-1.4)
		M14G A 0 A_Takeinventory("M14Ammo",1)
		M14F C 1 A_FireCustomMissile("RifleCaseSpawn",5,0,6,-14)
		M14G A 0 A_ZoomFactor(1.0)
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 0 A_SetPitch(pitch+0.2)
		M14G A 0 A_SetANgle(angle+0.1)
		M14G A 1 A_WeaponReady
		M14G A 5 A_WeaponReady
		M14G A 0 A_Refire
		Goto Ready3
		
    AltFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIFInventory("M14SingleSHot", 1, "StopAlt")
		TNT1 A 0 A_GiveInventory("M14SingleSHot", 1)
		TNT1 A 0 A_Print("Semi-Auto")
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		Goto Ready3
		
	StopAlt:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("M14SingleSHot", 1)
		TNT1 A 0 A_Print("Full-Auto")
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		Goto Ready3
			
		
	NoAmmo:
		M14G A 0
		M14G A 0 A_ZoomFactor(1.0)
		M14G A 0 A_Takeinventory("Zoomed",1)
		M14G A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
	NoAmmo2:
		M14G A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        M14G A 0 A_JumpIfInventory("Reloading",1,"Reload")
		M14G A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		M14G A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
		M14G A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		M14G A 0 A_JumpIfInventory("762NATO",1,"Reload")
		Goto Ready3
	
    Reload:
		M14G A 1 A_WeaponReady
		M14G A 0 A_ZoomFactor(1.0)
		M14G A 0 A_Takeinventory("Reloading",1)
		M14G A 0 A_Takeinventory("ADSmode",1)
		M14G A 0 A_Takeinventory("Zoomed",1)
		M14G A 0 A_JumpIfInventory("M14Ammo",21,76)
        M14G A 0 A_JumpIfInventory("762NATO",1,3)
        Goto FinishReloading
        TNT1 AAA 0
		M14G A 0 A_Takeinventory("Zoomed",1)
		M14G A 0 A_GiveInventory ("Pumping", 1)
		M14G A 0 A_Takeinventory("Reloading",1)
		
		M14G A 0
        M14R ABCDEEEE 1  A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_PLaySound("RELO1", 3)
		M14R FGH 1
		TNT1 A 0 A_FireCustomMissile("EmptyClipSpawn",-5,0,8,-4)
		M14R I 15
        M14R JKL 1
		TNT1 A 0 A_PLaySound("RELO2", 4)
		M14R M 2
		M14G A 0 A_JumpIfInventory("M14Ammo",1,"InsertBullets2")
		Goto InsertBullets
		
		
	InsertBullets:
		TNT1 AAAA 0
		M14G A 0 A_JumpIfInventory("M14Ammo",20,15)
		M14G A 0 A_JumpIfInventory("762NATO",1,3)
		Goto FinishReload3
        TNT1 AAAAAA 0
		M14G A 0 A_Giveinventory("M14Ammo",1)
		M14G A 0 A_Giveinventory("DoubleM14Ammo",1)
		M14G A 0 A_Takeinventory("762NATO",1)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		M14G A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload3	
		TNT1 AAAA 0
		M14G A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload3	
		
	InsertBullets2:
		TNT1 AAAA 0
		M14G A 0 A_JumpIfInventory("M14Ammo",21,15)
		M14G A 0 A_JumpIfInventory("762NATO",1,3)
		Goto FinishReload2	
        TNT1 AAAAAA 0
		M14G A 0 A_Giveinventory("M14Ammo",1)
		M14G A 0 A_Giveinventory("DoubleM14Ammo",1)
		M14G A 0 A_Takeinventory("762NATO",1)
		Goto InsertBullets2
		
		TNT1 AAAAAAAAAA 0
		M14G A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload2	
		TNT1 AAAA 0
		M14G A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload2	
		
	FinishReloading:
		M14G A 0
		M14G A 0 A_Refire
		Goto Ready3
		
		

		
	FinishReload2:
		M14R M 8
		M14R DCBA 1
		M14R A 0 A_Takeinventory("HasUnloaded",1)
		Goto Ready3
		

	FinishReload3:
		M14R M 6
		M14R DCBA 1
		M14R N 6
		M14R OPQR 1
		M14R R 6
		TNT1 A 0 A_PLaySound("RELO4", 1)
		M14R STUVVV 1
		M14R XYZ 1
		M14R R 6
		M14R QPO 1
		M14R A 0 A_Takeinventory("HasUnloaded",1)
		Goto Ready3		
		
		
	DoKick:
		M14M AB 1
		TNT1 A 2
	DoKick2:	
		M14M CDE 1
		TNT1 A 0 A_PlaySound("KICK")
		KNIF A 0 A_FireCustomMissile("KnifeAttack2", 0, 0, 0, 0, 0, 0)
		KNIF A 0 A_ZoomFactor(0.97)
		M14M F 1
		TNT1 A 0 A_TakeInventory("Kicking", 1)
		M72G A 0 A_ZoomFactor(1.0)
		M14M F 6
		M14M EDC 1
		SHTN A 0 A_JumpIfInventory("Kicking",1,"DoKick2")
		TNT1 A 2
		SHTN A 0 A_JumpIfInventory("Kicking",1,"DoKick2")
		M14M BA 1
		TNT1 A 0 A_TakeInventory("Kicking", 1)
		Goto Ready3	
	
	}
}

ACTOR M14Ammo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 21
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 21
   Inventory.Icon "WM14A0"
}