// --------------------------------------------------------------------------
//
// BERETTA M92FS
//
// --------------------------------------------------------------------------

ACTOR Beretta : BaseWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive1 15
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "9mmMagazine"
	Weapon.AmmoType2 "BerettaAmmo"
	Weapon.SelectionOrder 15000
	Weapon.UpSound "weapons/weaponholster"
	-WEAPON.CHEATNOTWEAPON
	Inventory.PickupSound "weapons/pistolup"
	Inventory.Pickupmessage "You got the Beretta!"
	Obituary "%o was shot down by %k's Pistol"
	tag "Beretta"
	Scale 0.6
	States
	{
	Spawn:
		PIST A -1
		Stop

	Ready:
		TNT1 A 0 A_JumpIfInventory("JustStartedGame",1,"WarmUp")
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		TNT1 A 0 A_PlaySound("weapons/pistolup", 5)
	Ready1:
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,5)
		PISG EDCB 1
		Goto Ready2
		PI5G EDCB 1
		Goto Ready2
		
	Ready2:
		TNT1 A 0 A_JumpIfInventory("Zoomed",1,"ReadyZoom")
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_JumpIfInventory("Reloading", 1, "Reload")
		TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("TossGrenade", 1, "TossGrenade")
		TNT1 A 0 A_JumpIfInventory("Unloading",1, "Unload")
		TNT1 A 0 A_JumpIfInventory("WeapSpecial",1, "WeapSpecial")
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,2)
		PISG A 1 A_WeaponReady
		Goto Ready2
		PI5G A 1 A_WeaponReady
		Goto Ready2

	ReadyZoom:
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"AltFire")
		TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("Taunting",1,"AltFire")
		TNT1 A 0 A_JumpIfInventory("Salute1",1,"AltFire")
		TNT1 A 0 A_JumpIfInventory("Salute2",1,"AltFire")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"AltFire")
		TNT1 A 0 A_JumpIfInventory("Unloading",1,"AltFire")
		TNT1 A 0 A_JumpIfInventory("WeapSpecial",1, "WeapSpecial")
		PISZ D 1 A_WeaponReady
		Loop

	Select:
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "PuristGun")
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1001)==0, 2)
		TNT1 A 0 A_Jump(256,2)
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1021)==0, "PuristGun")
		TNT1 A 0 A_Takeinventory("FistsSelected",1)
		TNT1 A 0 A_Takeinventory("SawSelected",1)
		TNT1 A 0 A_Takeinventory("ShotgunSelected",1)
		TNT1 A 0 A_Takeinventory("SSGSelected",1)
		TNT1 A 0 A_Takeinventory("MinigunSelected",1)
		TNT1 A 0 A_Takeinventory("PlasmaGunSelected",1)
		TNT1 A 0 A_Takeinventory("RocketLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("BFGSelected",1)
		TNT1 A 0 A_Takeinventory("BFG10kSelected",1)
		TNT1 A 0 A_Takeinventory("RailGunSelected",1)
		TNT1 A 0 A_Takeinventory("SubMachineGunSelected",1)
		TNT1 A 0 A_Takeinventory("RevenantLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("LostSoulSelected",1)
		TNT1 A 0 A_Takeinventory("FlameCannonSelected",1)
		TNT1 A 0 A_Takeinventory("HasBarrel",1)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_Takeinventory("WeapSpecial",1)
		TNT1 A 5
		TNT1 A 0 A_Raise
		Wait
		
	Deselect:
		TNT1 A 0 A_PlaySound("weapons/changing")
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 A_Takeinventory("HasUnloaded",1)
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,7)
		PISG ABCDE 1
		TNT1 A 0 A_Jump(256,6)
		PI5G ABCDE 1
		TNT1 A 0 A_Takeinventory("PistolFlashlightON",1)
		TNT1 A 0 A_GunFlash("FlashlightTurnOFF")
		TNT1 A 0 A_Takeinventory("TossGrenade",1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		TNT1 A 0 A_Lower
		Wait
		
	PuristGun:
		TNT1 A 0 A_TakeInventory("Beretta", 1)
		Goto Deselect
		
	WarmUp:
		TNT1 A 0 A_TakeInventory("JustStartedGame", 1)
		TNT1 A 10 A_WeaponReady
		PUNS ABCD 1 A_WeaponReady
		TNT1 A 0 A_PlaySound("Knuckled")
		PUNS E 7 A_WeaponReady
		PUNS FGFE 3 A_WeaponReady
		PUNS DCB 1 A_WeaponReady
		TNT1 A 10 A_WeaponReady
		Goto Ready
		
	Fire:
        TNT1 A 0 A_JumpIfInventory("BerettaAmmo",1,1)
        Goto Reload
		TNT1 A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,"FireSilencer")
        TNT1 A 0 A_PlaySound("PISFIRE", 1)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_AlertMonsters
		PISF A 1 BRIGHT A_FireBullets (1.3, 1.3, -1, 10, "HitPuff",1)
        TNT1 A 0 A_setpitch(pitch-0.6)
		TNT1 A 0 A_FireCustomMissile("Tracer", frandom(-2,2), 0, -1, 0)
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssMinor", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("BerettaAmmo",1)
        PISF B 1 A_setpitch(pitch+0.1)
		TNT1 A 0 A_FireCustomMissile("9mmCaseSpawn",5,0,6,-6)
		PISF CDC 1 A_setpitch(pitch+0.1)
		PISG A 7 A_WeaponReady
		Goto Ready2

	FireSilencer:
        TNT1 A 0 A_PlaySound("PISFIRE", 1, 0.5)
		TNT1 A 0 A_PlaySound("SPIFIR", 5)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		PI5F A 1 BRIGHT A_FireBullets (1.3, 1.3, -1, 10, "HitPuff",1)
        TNT1 A 0 A_setpitch(pitch-0.4)
		TNT1 A 0 A_FireCustomMissile("Tracer", frandom(-2,2), 0, -1, 0)
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssMinor", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("BerettaAmmo",1)
        PI5F B 1 A_setpitch(pitch+0.1)
		TNT1 A 0 A_FireCustomMissile("9mmCaseSpawn",5,0,6,-6)
		PI5F CD 1 A_setpitch(pitch+0.1)
		PI5G A 7 A_WeaponReady
		Goto Ready2

	Fire2:
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,4)
		PISZ E 1 BRIGHT A_PlaySound("PISFIRE", 1)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Jump(256,3)
        PISZ F 1 BRIGHT A_PlaySound("PISFIRE", 1, 0.5)
		TNT1 A 0 A_PlaySound("SPIFIR", 5)
		
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_FireBullets (0.5, 0.5, -1, 10, "HitPuff",1)
		
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,3)
		TNT1 A 0 A_setpitch(pitch-0.5)
		TNT1 A 0 A_Jump(256,2)
        TNT1 A 0 A_setpitch(pitch-0.3)
		
		TNT1 A 0 A_FireCustomMissile("Tracer", frandom(-2,2), 0, -1, 0)
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssMinor", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("BerettaAmmo",1)
		TNT1 A 0 A_FireCustomMissile("9mmCaseSpawn",5,0,6,-6)
		
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,5)
        PISZ GHI 1 A_setpitch(pitch+0.1)
		TNT1 A 0 A_Jump(256,4)
		PISZ GHI 1 A_setpitch(pitch+0.1)
		
		PISZ D 7 A_WeaponReady
		Goto Ready2

	AltFire:
		TNT1 A 0 A_JumpIfInventory("Zoomed",1,8)
		TNT1 A 0 A_Giveinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.5)
		TNT1 A 0 A_Giveinventory("ADSmode",1)
        PISZ ABCD 1
        Goto ReadyZoom
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
        PISZ DCBA 1
        Goto Ready2
	
	WeapSpecial:
		TNT1 A 0 A_Takeinventory("WeapSpecial",1)
		TNT1 A 0 A_JumpIfInventory("PistolFlashlight", 1, 1)//Check if we have a flashlight.
		Goto Ready2
		TNT1 A 0 A_PlaySound("flashlight/click", 5)
		TNT1 A 0 A_JumpIfInventory("PistolFlashlightON",1,3)//Turn on or off?
		
		TNT1 A 0 A_Giveinventory("PistolFlashlightON",1)
		TNT1 A 0 A_GunFlash("FlashlightTurnON")
		Goto Ready2
		
		TNT1 A 0 A_Takeinventory("PistolFlashlightON",1)
		TNT1 A 0 A_GunFlash("FlashlightTurnOFF")
		Goto Ready2

	FlashlightTurnOFF:
		TNT1 A 0
		TNT1 A 0 A_Light0	//Zandronum
		Stop

	FlashlightTurnON:
		//TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1041)==0, "FlashlightOnSimple")	//GZDOOM
		//TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1041)==1, "FlashlightOnLQ")		//GZDOOM
		TNT1 A 0 A_Light1	//Zandronum
		Stop

	FlashlightOnHQ:
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ1", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ2", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ3", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ4", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ5", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ6", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ7", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ8", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ9", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ10", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ11", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ12", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ13", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ14", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ15", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ16", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ17", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ18", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ19", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ20", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ21", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ22", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ23", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ24", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamHQ25", 0, 0, 0, 0)
		TNT1 A 1
		Loop

	FlashlightOnLQ:
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ1", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ2", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ3", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ4", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ5", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ6", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ7", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ8", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ9", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ10", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ11", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamLQ12", 0, 0, 0, 0)
		TNT1 A 1
		Loop

	FlashlightOnSimple:
		TNT1 A 0 A_FireCustomMissile("FlashLightBeamSimple", 0, 0, 0, 0)
		TNT1 A 1
		Loop

	NoAmmo:
		TNT1 A 0 A_PlaySound("weapons/empty")
		Goto Ready2
		
	Reload:
		TNT1 A 0 A_TakeInventory("Reloading",1)
		TNT1 A 0 A_JumpIfInventory("BerettaAmmo",16,"Ready2")//Don't reload if magazine is full, and there is a bullet in the chamber.
		TNT1 A 0 A_JumpIfInventory("9mmMagazine",1,1)//Do we have any ammo to reload with?
		Goto NoAmmo
		TNT1 A 0 A_GiveInventory("Pumping", 1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_JumpIfInventory("BerettaAmmo", 1, "Reload2")//If there is a bullet in the chamber, go to Reload2.
		TNT1 A 0 A_PlaySound("PistolReload1")
		TNT1 A 0 A_JumpIfInventory("PistolFlashlight", 1, "ReloadFlashlight")//If we have a flashlight, show those sprites.
		PISR ZYWXABBCCDDEE 1
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
		TNT1 A 0 A_FireCustomMissile("EmptyMag9mm",5,0,8,-4)
		TNT1 A 0 A_TakeInventory("HasUnloaded", 1)
		PISR FFFFFFFFFFFFGG 1
		PISR HIJ 2
		PISR KKLLLLMMNNOQP 1
		TNT1 A 0 A_TakeInventory("Reloading",1)
		Goto InsertClip

	ReloadFlashlight:
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo", 1, "ReloadSilencer")//If we have a flashlight, show those sprites.
		PI4R ZYWXABBCCDDEE 1
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
		TNT1 A 0 A_FireCustomMissile("EmptyMag9mm",5,0,8,-4)
		TNT1 A 0 A_TakeInventory("HasUnloaded", 1)
		PI4R FFFFFFFFFFFFGG 1
		PI4R HIJ 2
		PI4R KKLLLLMMNNOQP 1
		TNT1 A 0 A_TakeInventory("Reloading",1)
		Goto InsertClip

	ReloadSilencer:
		PI6R ZYWXABBCCDDEE 1
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
		TNT1 A 0 A_FireCustomMissile("EmptyMag9mm",5,0,8,-4)
		TNT1 A 0 A_TakeInventory("HasUnloaded", 1)
		PI6R FFFFFFFFFFFFGG 1
		PI6R HIJ 2
		PI6R KKLLLLMMNNOQP 1
		TNT1 A 0 A_TakeInventory("Reloading",1)
		Goto InsertClip

	Reload2:
		TNT1 A 0 A_PlaySound("FASTPISR")
		TNT1 A 0 A_JumpIfInventory("PistolFlashlight", 1, "ReloadFlashlight2")//If we have a flashlight, show those sprites.
		PISR ZYWX 1
		PI2R ABBCCDDE 1
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
		TNT1 A 0 A_FireCustomMissile("EmptyMag9mm",5,0,8,-4)
		TNT1 A 0 A_TakeInventory("HasUnloaded", 1)
		PI2R FFFFFFFFFFFFGG 1
		PI2R HIJ 2
		PI2R KKL 1
		PISR MMNNOQP 1
		TNT1 A 0 A_TakeInventory("Reloading",1)
		Goto InsertClip2

	ReloadFlashlight2:
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo", 1, "ReloadSilencer2")//If we have a flashlight, show those sprites.
		PI4R ZYWX 1
		PI3R ABBCCDDE 1
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
		TNT1 A 0 A_FireCustomMissile("EmptyMag9mm",5,0,8,-4)
		TNT1 A 0 A_TakeInventory("HasUnloaded", 1)
		PI3R FFFFFFFFFFFFGG 1
		PI3R HIJ 2
		PI3R KKL 1
		PI4R MMNNOQP 1
		TNT1 A 0 A_TakeInventory("Reloading",1)
		Goto InsertClip2

	ReloadSilencer2:
		PI6R ZYWX 1
		PI5R ABBCCDDE 1
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
		TNT1 A 0 A_FireCustomMissile("EmptyMag9mm",5,0,8,-4)
		TNT1 A 0 A_TakeInventory("HasUnloaded", 1)
		PI5R FFFFFFFFFFFFGG 1
		PI5R HIJ 2
		PI5R KKL 1
		PI6R MMNNOQP 1
		TNT1 A 0 A_TakeInventory("Reloading",1)
		Goto InsertClip2

	InsertClip:
		TNT1 A 0 A_JumpIfInventory("BerettaAmmo",15,"Ready2")
		TNT1 A 0 A_JumpIfInventory("9mmMagazine",1,1)
		Goto Ready2
		TNT1 A 0 A_Giveinventory("BerettaAmmo",1)
		TNT1 A 0 A_Takeinventory("9mmMagazine",1)
		Goto InsertClip

	InsertClip2:
		TNT1 A 0 A_JumpIfInventory("BerettaAmmo",16,"Ready2")
		TNT1 A 0 A_JumpIfInventory("9mmMagazine",1,1)
		Goto Ready2
		TNT1 A 0 A_Giveinventory("BerettaAmmo",1)
		TNT1 A 0 A_Takeinventory("9mmMagazine",1)
		Goto InsertClip2
		
	Unload:
		TNT1 A 0 A_Takeinventory("Unloading",1)
        TNT1 A 0 A_JumpIfInventory("BerettaAmmo",1,1)//Check if we have any ammo to unload.
        Goto NoAmmo
		TNT1 A 0 A_PlaySound("PistolReload1")
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo", 1, "UnloadSilencer")
		TNT1 A 0 A_JumpIfInventory("PistolFlashlight", 1, "UnloadFlashlight")//If we have a flashlight, show those sprites.
		PISR PQONNMMLKK 1
		PISR JIH 2
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		
	RemoveBullets:
		TNT1 A 0 A_JumpIfInventory("BerettaAmmo",1,1)
		Goto FinishUnload
		TNT1 A 0 A_Takeinventory("BerettaAmmo",1)
		TNT1 A 0 A_Giveinventory("9mmMagazine",1)
		Goto RemoveBullets
	
	FinishUnload:
		PISR GGFFFFFFFFFFFFEEDDIIJJKKLLLLMMNNOQP 1
		TNT1 A 0 A_PlaySound("DryFire")
		TNT1 A 0 A_GiveInventory("HasUnloaded", 1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		Goto Ready2
		
	UnloadFlashlight:
		PI4R PQONNMMLKK 1
		PI4R JIH 2
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		
	RemoveBulletsFlashlight:
		TNT1 A 0 A_JumpIfInventory("BerettaAmmo",1,1)
		Goto FinishUnloadFlashlight
		TNT1 A 0 A_Takeinventory("BerettaAmmo",1)
		TNT1 A 0 A_Giveinventory("9mmMagazine",1)
		Goto RemoveBulletsFlashlight
	
	FinishUnloadFlashlight:
		PI4R GGFFFFFFFFFFFFEEDDIIJJKKLLLLMMNNOQP 1
		TNT1 A 0 A_PlaySound("DryFire")
		TNT1 A 0 A_GiveInventory("HasUnloaded", 1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		Goto Ready2

	UnloadSilencer:
		PI6R PQONNMMLKK 1
		PI6R JIH 2
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		
	RemoveBulletsSilencer:
		TNT1 A 0 A_JumpIfInventory("BerettaAmmo",1,1)
		Goto FinishUnloadSilencer
		TNT1 A 0 A_Takeinventory("BerettaAmmo",1)
		TNT1 A 0 A_Giveinventory("9mmMagazine",1)
		Goto RemoveBulletsSilencer
	
	FinishUnloadSilencer:
		PI6R GGFFFFFFFFFFFFEEDDIIJJKKLLLLMMNNOQP 1
		TNT1 A 0 A_PlaySound("DryFire")
		TNT1 A 0 A_GiveInventory("HasUnloaded", 1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		Goto Ready2

    Taunt:
		TNT1 A 0 A_JumpIfInventory("RealismMode", 1, "CheckGrab")
		PISG BCDE 1
		TNT1 A 5 A_PlaySound("FUCK", 2)
		FUCK F 1
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK GHI 1 A_AlertMonsters
		FUCK J 15 A_Takeinventory("Taunting",1)
        FUCK IHGF 1
		TNT1 A 5
		PISG EDCB 1
		TNT1 A 0 A_Jump(256,"Ready2")
		Goto Ready2

	KickFlash:
		TNT1 A 0 A_Takeinventory("PistolFlashlightON",1)
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,"KickFlashSilencer")
		PISK ABCD 1
		PISK D 8
		PISK DCBA 1
		Stop
		
	KickFlashSilencer:
		PI5K ABCD 1
		PI5K D 8
		PI5K DCBA 1
		Stop
		
	AirKickFlash:
		TNT1 A 0 A_Takeinventory("PistolFlashlightON",1)
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,"AirKickFlashSilencer")
		PISK ABCD 1
		PISK D 10
		PISK DCBA 1
		Stop
		
	AirKickFlashSilencer:
		PI5K ABCD 1
		PI5K D 10
		PI5K DCBA 1
		Stop

	GrenadeFlash:
		TNT1 A 0 A_Takeinventory("PistolFlashlightON",1)
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo",1,5)
		PISG BCDE 1
		Stop
		PI5G BCDE 1
		Stop
	}
}

ACTOR BerettaAmmo: Ammo
{
	+INVENTORY.IGNORESKILL
	Inventory.Amount 0
	Inventory.MaxAmount 16
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 16
   	Inventory.Icon "PISTI0"
	Scale 0.5
}

ACTOR PistolFlashlightON : Inventory { Inventory.MaxAmount 1 }