ACTOR AK47 : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	YScale 0.6
	XScale 0.8
	Weapon.SelectionOrder 2500
	Weapon.AmmoType1 "762"
	Weapon.AmmoType2 "AKMAmmo"
	Obituary "%o was shot down by %k's assault AKM."
    AttackSound "None"
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "You got an AK-47!"
    +WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Tag "AK-47 Rifle"
    Scale 0.8
	States
	{
 	Spawn:
		WAK4 A 1
		TNT1 A 0 A_SpawnItemEx("AK47Weapon", 0, 0, 0, momx, momy, momz)
		Stop	
	
	Ready:
	Ready3:
		AKMG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		AKMG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        AKMG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		AKMG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"----" # 0 A_JumpIfInventory("UsedBandage", 1, "UseBandages")
		Loop
	
		
	Deselect:
		AKMG A 0
		AKMG A 0 A_TakeInventory("TossGrenade", 1)
        AKMG A 0 A_TakeInventory("Reloading",1)
		AKMG A 0 A_TakeInventory("Unloading",1)
        AKMG A 0 A_ZoomFactor(1.0)
		AKMG AAAAA 1 A_Lower
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait

	Drop:
		RIFF A 0
		TNT1 A 0 A_TakeInventory("DropWeapon", 1)
		RIFF A 0 A_SpawnItemEx("AK47Weapon", 0, 0, 30, 10, 0, 2)
		TNT1 A 0 A_TakeInventory("AK47", 1)
		TNT1 A 0 A_TakeInventory("Slot2Weapon", 1)
		Goto Ready
		
	Select:
		AKMG A 0
		AKMG AAAAA 1 A_Raise
		TNT1 AAAAAAAAA 0 A_Raise
		Goto Ready3
	
    Fire:
        AKMG A 0 A_JumpIfInventory("AKMAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		AKMG A 0 A_AlertMonsters
		AKMG A 0 A_PlaySound("AKMFIRE", 1)
		SMGG A 0 A_PlaySound("FARAKM", 6)
		TNT1 A 0 A_JumpIFInventory("AKMSingleSHot", 1, "Fire2")
		
		AKMF A 1 A_FireBullets (1.0, 1.0, -1, 17, "HitPuff", FBF_NORANDOM)
		AKMF B 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		AKMG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        AKMF A 0 A_FireCustomMissile("AK47Tracer", random(-1,1), 0, 0, 0, 0, random(-1,1))
		AKMG A 0 A_ZoomFactor(0.98)
		AKMG A 0 A_SetPitch(pitch-0.6)
		AKMG A 0 A_SetANgle(angle-0.2)
		AKMG A 0 A_Takeinventory("AKMAmmo",1)
		AKMF C 1 A_FireCustomMissile("RifleCaseSpawn",5,0,6,-14)
		AKMG A 0 A_SetPitch(pitch-0.4)
		AKMG A 0 A_SetANgle(angle-0.1)
		AKMG A 0 A_ZoomFactor(1.0)
		AKMF D 1
	
		
		
		AKMG A 0 A_Refire
		Goto Ready3
	
     Fire2:
		AKMF A 1 A_FireBullets (0.5, 0.5, -1, 17, "AKMPuff", FBF_NORANDOM)
		AKMF B 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		AKMG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        AKMF A 0 A_FireCustomMissile("AK47Tracer", 0, 0, 0, 0, 0, 0)
		AKMG A 0 A_ZoomFactor(0.98)
		AKMG A 0 A_SetPitch(pitch-0.6)
		AKMG A 0 A_SetANgle(angle-0.2)
		AKMG A 0 A_Takeinventory("AKMAmmo",1)
		AKMF C 1 A_FireCustomMissile("RifleCaseSpawn",5,0,6,-14)
		AKMG A 0 A_SetPitch(pitch-0.4)
		AKMG A 0 A_SetANgle(angle-0.1)
		AKMG A 0 A_ZoomFactor(1.0)
		AKMG A 1 A_WeaponReady
		AKMG A 0 A_SetPitch(pitch+0.2)
		AKMG A 0 A_SetANgle(angle+0.1)
		AKMG A 1 A_WeaponReady
		AKMG A 0 A_SetPitch(pitch+0.2)
		AKMG A 0 A_SetANgle(angle+0.1)
		AKMG A 1 A_WeaponReady
		AKMG A 0 A_SetPitch(pitch+0.2)
		AKMG A 0 A_SetANgle(angle+0.1)
		AKMG A 1 A_WeaponReady
		AKMG A 0 A_SetPitch(pitch+0.2)
		AKMG A 1 A_WeaponReady
		AKMG A 0 A_SetPitch(pitch+0.2)
		AKMG A 0
		Goto Ready3
		
    AltFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIFInventory("AKMSingleSHot", 1, "StopAlt")
		TNT1 A 0 A_GiveInventory("AKMSingleSHot", 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("AKMSingleSHot", 1)
		TNT1 A 0 A_Print("Full-Auto")
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		Goto Ready3
			
		
	NoAmmo:
		AKMG A 0
		AKMG A 0 A_ZoomFactor(1.0)
		AKMG A 0 A_Takeinventory("Zoomed",1)
		AKMG A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
	NoAmmo2:
		AKMG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        AKMG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		AKMG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		AKMG A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
		AKMG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		AKMG A 0 A_JumpIfInventory("762",1,"Reload")
		Goto Ready3
	
    Reload:
		AKMG A 1 A_WeaponReady
		AKMG A 0 A_ZoomFactor(1.0)
		AKMG A 0 A_Takeinventory("Reloading",1)
		AKMG A 0 A_Takeinventory("ADSmode",1)
		AKMG A 0 A_Takeinventory("Zoomed",1)
		AKMG A 0 A_JumpIfInventory("AKMAmmo",31,76)
        AKMG A 0 A_JumpIfInventory("762",1,3)
        Goto FinishReloading
        TNT1 AAA 0
		AKMG A 0 A_Takeinventory("Zoomed",1)
		AKMG A 0 A_GiveInventory ("Pumping", 1)
		AKMG A 0 A_Takeinventory("Reloading",1)
		
		AKMG A 0
        AKRL ABCDDDD 1  A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_PLaySound("RELO1", 3)
		AKRL EFGH 1
		TNT1 A 0 A_FireCustomMissile("EmptyClipSpawn",-5,0,8,-4)
		AKRL I 15
        AKRL JKL 1
		TNT1 A 0 A_PLaySound("RELO2", 4)
		AKRL D 8
		AKMG A 0 A_JumpIfInventory("AKMAmmo",1,"InsertBullets2")
		Goto InsertBullets
		
		
	InsertBullets:
		TNT1 AAAA 0
		AKMG A 0 A_JumpIfInventory("AKMAmmo",30,15)
		AKMG A 0 A_JumpIfInventory("762",1,3)
		Goto FinishReload3
        TNT1 AAAAAA 0
		AKMG A 0 A_Giveinventory("AKMAmmo",1)
		AKMG A 0 A_Giveinventory("DoubleAKMAmmo",1)
		AKMG A 0 A_Takeinventory("762",1)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		AKMG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload3	
		TNT1 AAAA 0
		AKMG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload3	
		
	InsertBullets2:
		TNT1 AAAA 0
		AKMG A 0 A_JumpIfInventory("AKMAmmo",31,15)
		AKMG A 0 A_JumpIfInventory("762",1,3)
		Goto FinishReload2	
        TNT1 AAAAAA 0
		AKMG A 0 A_Giveinventory("AKMAmmo",1)
		AKMG A 0 A_Giveinventory("DoubleAKMAmmo",1)
		AKMG A 0 A_Takeinventory("762",1)
		Goto InsertBullets2
		
		TNT1 AAAAAAAAAA 0
		AKMG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload2	
		TNT1 AAAA 0
		AKMG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload2	
		
	FinishReloading:
		AKMG A 0
		AKMG A 0 A_Refire
		Goto Ready3
		
		

		
	FinishReload2:
		AKRL DCBAM 1
		AKMR A 0 A_Takeinventory("HasUnloaded",1)
		Goto Ready3
		

	FinishReload3:
		AKRL DCBAM 1
		AKRL M 10
		AKRL MNOPQ 1
		AKRL Q 8
		TNT1 A 0 A_PLaySound("RELO4", 1)
		AKRL RSTTTSR 1
		AKRL Q 4
		AKRL PONM 1
		AKMR A 0 A_Takeinventory("HasUnloaded",1)
		Goto Ready3		
	
	}
}

ACTOR AKMAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 31
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 31
   Inventory.Icon "WAK4A0"
}