ACTOR PPSH : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	YScale 0.6
	XScale 0.8
	Weapon.SelectionOrder 2500
	Weapon.AmmoType1 "762x25"
	Weapon.AmmoType2 "PPSHAmmo"
	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 "PPSH-41 SMG"
    Scale 0.8
	States
	{
 	Spawn:
		WAK4 A 1
		TNT1 A 0 A_SpawnItemEx("PPSHWeapon", 0, 0, 0, momx, momy, momz)
		Stop	
	
	Ready:
	Ready3:
		PPSG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		PPSG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        PPSG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		PPSG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"----" # 0 A_JumpIfInventory("UsedBandage", 1, "UseBandages")
		Loop
	
		
	Deselect:
		PPSG A 0
		PPSG A 0 A_TakeInventory("TossGrenade", 1)
        PPSG A 0 A_TakeInventory("Reloading",1)
		PPSG A 0 A_TakeInventory("Unloading",1)
        PPSG A 0 A_ZoomFactor(1.0)
		PPSG 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:
		PPSG A 0
		PPSG AAAAA 1 A_Raise
		TNT1 AAAAAAAAA 0 A_Raise
		Goto Ready3
	
    Fire:
        PPSG A 0 A_JumpIfInventory("PPSHAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		PPSG A 0 A_AlertMonsters
		PPSG A 0 A_PlaySound("PISFIRE", 1)
		
		PPSF A 1 A_FireBullets (3.0, 3.0, -1, 10, "HitPuff", FBF_NORANDOM)
		PPSG A 0 A_ZoomFactor(0.98)
		PPSF B 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		PPSG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        PPSF A 0 A_FireCustomMissile("Tracer", random(-3,3), 0, 0, 0, 0, random(-3,3))
		PPSG A 0 A_SetPitch(pitch-0.5)
		PPSG A 0 A_Takeinventory("PPSHAmmo",1)
		PPSF C 0 A_FireCustomMissile("PistolCaseSpawn",5,0,6,-14)
		PPSG A 0 A_SetPitch(pitch-0.5)
		PPSG A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetANgle(angle+random(-1, 1))

		PPSG A 0 A_JumpIfInventory("PPSHAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		PPSG A 0 A_AlertMonsters
		PPSG A 0 A_PlaySound("PISFIRE", 5)
		PPSF C 1 A_FireBullets (3.0, 3.0, -1, 10, "HitPuff", FBF_NORANDOM)
		PPSG A 0 A_ZoomFactor(0.99)
		PPSF D 1 A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		PPSG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        PPSF A 0 A_FireCustomMissile("Tracer", random(-4,4), 0, 0, 0, 0, random(-4,4))
		PPSG A 0 A_SetPitch(pitch-0.5)
		PPSG A 0 A_Takeinventory("PPSHAmmo",1)
		PPSF C 0 A_FireCustomMissile("PistolCaseSpawn",5,0,6,-14)
		PPSG A 0 A_SetPitch(pitch-0.5)
		PPSG A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetANgle(angle+random(-1, 1))
	
		PPSG A 0 A_Refire
		Goto Ready3
	
     
	NoAmmo:
		PPSG A 0
		PPSG A 0 A_ZoomFactor(1.0)
		PPSG A 0 A_Takeinventory("Zoomed",1)
		PPSG A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		TNT1 A 0 A_giveinventory("MAT49FiredUntilEmpty", 1)
	NoAmmo2:
		PPSG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        PPSG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		PPSG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		PPSG A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
		PPSG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		PPSG A 0 A_JumpIfInventory("762x25",1,"Reload")
		Goto Ready3
	
    Reload:
		PPSG A 1 A_WeaponReady
		PPSG A 0 A_ZoomFactor(1.0)
		PPSG A 0 A_Takeinventory("Reloading",1)
		PPSG A 0 A_Takeinventory("ADSmode",1)
		PPSG A 0 A_Takeinventory("Zoomed",1)
		PPSG A 0 A_JumpIfInventory("PPSHAmmo",71,"FinishReload")
        PPSG A 0 A_JumpIfInventory("762x25",1,3)
        Goto FinishReload
        TNT1 AAA 0
		PPSG A 0 A_Takeinventory("Zoomed",1)
		PPSG A 0 A_GiveInventory ("Pumping", 1)
		PPSG A 0 A_Takeinventory("Reloading",1)
		
		PPSR A 0
        PPSR ABCDDDD 1  A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_PLaySound("RELO1", 3)
		PPSR EFGHI 1
		TNT1 A 0 A_FireCustomMissile("EmptyClipSpawn",-5,0,8,-4)
		PPSR J 20
        PPSR I 1
		TNT1 A 0 A_PLaySound("RELO2", 4)
		PPSR HGFED 1
		PPSR D 8
		Goto InsertBullets
		
		
	InsertBullets:
		TNT1 AAAA 0
		PPSG A 0 A_JumpIfInventory("PPSHAmmo",71,"FinishReload")
		PPSG A 0 A_JumpIfInventory("762x25",1,3)
		Goto FinishReload
        TNT1 AAAAAA 0
		PPSG A 0 A_Giveinventory("PPSHAmmo",1)
		PPSG A 0 A_Takeinventory("762x25",1)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		PPSG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload	
		TNT1 AAAA 0
		PPSG A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload
		
	FinishReload:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("MAT49FiredUntilEmpty", 1, "Cook")
		PPSR CBA 1
		PPSG A 1
		PPSR A 0 A_Takeinventory("HasUnloaded",1)
		Goto Ready3
	Cook:
		PPSR CBA 1
		PPSR KLMMMM 1
		TNT1 A 0 A_PlaySound("RELO4", 1)
		PPSR NOOONMM 1
		PPSR M 4
		PPSR A 0 A_Takeinventory("MAT49FiredUntilEmpty",1)
		PPSR LK 1
		Goto Ready3
	}
}

ACTOR PPSHAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 71
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 71
   Inventory.Icon "WAK4A0"
}