ACTOR BrutalSMG : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "Clip1"
	Weapon.AmmoType2 "BDSMGAmmo"
	Obituary "%o was shot down by %k's SMG."
    AttackSound "None"
    Inventory.PickupSound "SMGMAGIN"
	Inventory.Pickupmessage "$GOTSMG"
    +WEAPON.NOAUTOAIM
    +WEAPON.NOAUTOFIRE
    +FORCEXYBILLBOARD
	+WEAPON.NOALERT
	Scale 0.57
	 tag "Stiletto VCR-9"
	States
	{
	
	Inspect:
		TNT1 A 0 a_takeinventory("neverfoundSMG",1)
		TNT1 A 0 A_OVERLAY(2,"INSPECTCAMERA")
		SMGJ ABCDEFGHIJKL 1 A_InspectReady
		TNT1 A 0 A_InspectReady
		SMGJ LLLLLLLLLL 1 A_InspectReady
		TNT1 A 0 A_InspectReady
		SMGJ MNOPRSTUVWXYZ 1 A_InspectReady
		TNT1 A 0 A_InspectReady
		SMGJ ZZZZZ 1 A_InspectReady
		SMGK ABCDEFGH 1 A_InspectReady
		TNT1 A 0 A_InspectReady
		SMGK HHHHH 1 A_InspectReady
		TNT1 A 0 A_playsound("BOLTBACK",1)
		SMGK IJKLMMM 1 A_InspectReady
		TNT1 A 0 A_InspectReady
		SMGK NPQRS 1 A_InspectReady
		TNT1 A 0 A_InspectReady
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,"inspectsuppressor")
		SMGS BCD 1 A_InspectReady
		TNT1 A 0 A_GIVEINVENTORY("BDSMGAMMO",20)
		GOTO READY3
	Inspectsuppressor:	
		SMGM HIJKLMNOPQRSTU 1
		TNT1 A 0 A_PLAYSOUND("SMGSUPPR",1)
		SMGM VWXWVWXYZ 3
		SMSM ABCDE 1
		SMSS ABCDE 1
		TNT1 A 0 a_STOPSOUND(1)
		GOTO READY3
	
	Ready:
	SelectAnimation:
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		TNT1 A 1
	    SMGG A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        SMGG A 0 A_PlaySound("SMGSEL")
		//Inspect check
		TNT1 A 0 a_jumpif(GetCVAR("weaponinspect") == 1,2)
		TNT1 A 0 A_JumpIfInventory("neverfoundSMG",1,"Inspect")
		//
		SMGG A 0 A_Takeinventory("StartDualWield",1)
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,5)
		SMGS ABCD 1
		Goto Ready3
		SMSS ABCDE 1
		GOTO READY3
		
	Ready3:
		SMGI A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		SMGI A 0 A_JumpIfInventory("Zoomed",1,"Ready2")
		SMGI A 0 A_JumpIfInventory("Kicking",1,"dokicksmg") 
		SMGI A 0 A_JumpIfInventory("StartDualWield",1,"SpecialAction")
		SMSI A 0 A_JumpIfInventory("Suppressormounted",1,2)
		SMGI A 0 
		"####" "#" 0
		"####" A 1 A_WeaponReadyLit
		Loop
		
	Ready2:
        SMGA F 0 A_JumpIfInventory("Kicking",1,"dokicksmg")
		SMGA F 1 A_WeaponReadyLit
				
		SMGA F 0 A_JumpIf(Getcvar("ADSMode") == 0, 2)  ///////ADS MODE CHECK
		SMGA F 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_altATTACK, "holdaim")
		goto noaim
		TNT1 A 0
		Loop	
	
	 AltFire:
        SMGG A 0
		BADF A 0 a_startsound("ADSin",250)
		SMGG A 0 A_Giveinventory("GoSpecial",1)
		SMGG A 0 A_JumpIfInventory("Zoomed",1,"NoAim")
		SMGG A 0 A_Giveinventory("Zoomed",1)
		TNT1 A 0 A_SetCrosshair(41)							 
        SMGG A 0 A_ZoomFactor(1.3)
		SMGG A 0 A_Giveinventory("ADSmode",1)
        SMGA ABCDE 1
        SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGA F 1 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK, "FIRE")
		
		BADF A 0 A_JumpIf(Getcvar("ADSMode") == 0, "Ready2")  ///////ADS MODE CHECK
		
	   HoldAim:	
	   BADF A 0 A_GiveInventory("ZoomHold",1)
		SMGA F 1 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK, "FIRE")
		BADF A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_altATTACK, "holdaim")
		
       NoAim:
		SMGG A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}						
        SMGG A 0 A_ZoomFactor(1.0)
		SMGG A 0 A_Giveinventory("GoSpecial",1)
		SMGG A 0 A_Takeinventory("ADSmode",1)
		SMGA EDCBA 1
        Goto Ready3
		
	CheckSprint:
		SMGG A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}								
        SMGG A 0 A_ZoomFactor(1.0)
		SMGG A 0 A_Giveinventory("GoSpecial",1)
		SMGG A 0 A_Takeinventory("ADSmode",1)
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,"Checksprintsuppressed")
		//SMGI A 1 A_WeaponReady(WRF_NOFIRE)
		SMGG A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		SMGG A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready
		
	StartSprint:
		SMGS DCB 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_JumpIfInventory("LARGESTAMINA", 1, 2)
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 70, "Trip")
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 1400, "Trip")
		
	Sprinting:	
		SMSP A 0 offset(-9,32) 
		SMGG A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		TNT1 A 0 A_JumpIfInventory("LARGESTAMINA", 1, 2)
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		SMGG A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 2000, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		SMGG A 0 offset(-9,32) A_JumpIfInventory("Powerstrength2", 1, 2)
		SMGG A 0 offset(-9,32) A_GiveInventory("UsedStamina", 5)
		SMGG A 0 offset(-9,32)
		SMGS P 1 offset(-9,34) A_SetPitch(pitch -0.5)
		SMGS P 1 offset(-6,36) A_SetPitch(pitch -0.5)
		SMGS P 1 offset(-3,38) A_SetPitch(pitch -0.5)
		SMGS P 1 offset(0,38) A_SetPitch(pitch -0.5)
		SMGS P 1 offset(3,36) A_SetPitch(pitch -0.5)
		SMGS P 1 offset(6,34) A_SetPitch(pitch -0.5)
		SMGS P 1 offset(9,32) A_SetPitch(pitch -0.5)
		SMGG A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"dokicksmg")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 
		SMGG A 0 offset(-9,32) A_GiveInventory("UsedStamina", 4)
		SMGG A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		SMGS P 1 offset(9,34) A_SetPitch(pitch +0.5)
		SMGS P 1 offset(6,36) A_SetPitch(pitch +0.5)
		SMGS P 1 offset(3,38) A_SetPitch(pitch +0.5)
		SMGS P 1 offset(0,38) A_SetPitch(pitch +0.5)
		SMGS P 1 offset(-3,36) A_SetPitch(pitch +0.5)
		SMGS P 1 offset(-6,34) A_SetPitch(pitch +0.5)
		SMGS P 1 offset(-9,32) A_SetPitch(pitch +0.5)
		SMGG A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		SMGG A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")		
		Goto StopSprint
		
	StopSprintTired:
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,"STOPsprintTIREDsuppressed")
		SMGS BCD 2
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		SMGG A 0 A_PlaySound("Tired", 2)
		TNT1 A 0 A_Jumpifhealthlower(25,"rupturesprint")												  
		SMGI A 25
		Goto Ready3
	StopSprint:
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,"STOPsprintsuppressed")
		SMGS BCD 1
		TNT1 A 0 A_JumpIfInventory("LARGESTAMINA", 1, 2)
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 70, "StopSprintTired")
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 1400, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready3

	Deselect:
		TNT1 A 0 A_TakeInventory("Submachinegunselected",1)
		TNT1 A 0 A_TakeInventory("flaretoken",1)
		SMGG A 0 A_TakeInventory("TossGrenade", 1)
		SMGG A 0 A_TakeInventory("Zoomed", 1)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}								
		SMGG A 0 A_TakeInventory("ADSMode", 1)
		SMGG A 0 A_ZoomFactor(1.0)
		
		TNT1 A 0 A_JumpIfInventory("weaponbroke", 1, "DeselectCONTINUE")
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,"DESELECTSUP")
		SMGS DCBA 1
	DESELECTCONTINUE:
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait	
	Deselectsup:
		SMSS EDCBA 1
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait
		
	goingtoaction:
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,6)
        SMGS DCBA 1
		SMGG A 0 A_Jump(256,6)
		
		SMSS EDCBA 1
		TNT1 A 0 A_TakeInventory("flaretoken",1)
		SMGG A 0 A_TakeInventory("TossGrenade", 1)
		SMGG A 0 A_TakeInventory("Zoomed", 1)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}								
		SMGG A 0 A_TakeInventory("ADSMode", 1)
		SMGG A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_JumpIfInventory("weargasmask", 1, "wearanimation")
		TNT1 A 0 A_JumpIfInventory("removegasmask", 1, "removeanimation")
		TNT1 A 0 A_JumpIfInventory("battledrugtoken",1,"drugshot")
		TNT1 A 0 A_JumpIfInventory("BANDAGETOKEN",1,"BANDAGE")
		goto repair
		
	Select: 
		TNT1 A 0  A_Overlay(-10,"FirstPersonLegsStand")
		TNT1 A 0 a_removelight(1)
		TNT1 A 0 A_removelight(2)	
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}		
		TNT1 A 0 SetPlayerProperty(0,0,2)
		SMGG A 0 A_Takeinventory("StartDualWield",1)
		SMGG A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 ACS_NAMEDEXECUTE("WEAPONSELECT",0)
		TNT1 A 0 A_SetRoll(0)
		TNT1 A 1
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
		WAIT
		
	
    Fire:
		"####" "#" 0 A_JumpIfInventory("JAMMEDSMG",1,"UNJAMMING")
       // "####" "#" 0 A_JumpIfInventory("BDSMGAmmo",1,2)
       // Goto Misfire
	   "####" "#" 0 { If(CountInv("BDSMGAmmo") == 0) { return state("NoAmmo"); } return state(""); }
        //TNT1 AAAA 0
		"####" "####" 0
		
		"####" "#" 0 A_JumpIfInventory("Suppressormounted",1,"fireSUPPRESSED")
		
		//DURABILITY CHECK
		"####" "#" 0 A_JumpIFInventory("FirearmsdurabilityOFF", 1, 4)
		"####" "#" 0 A_Takeinventory("SMGDurability",1)
		"####" "#" 0 A_JumpIfInventory("SMGDurability",75, 2)
		"####" "#" 0 A_Jump(30, "Misfire")
		///
		
		SMGG A 0 A_ALertMonsters
		SMGG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		SMGG A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
        SMGG A 0 A_STARTSound("SMGFIRE", 420, CHANF_OVERLAP)
		SMGG A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,0,-9)
		SMGG A 0 A_ZoomFactor(0.99)
		
		//  MUZZLEFLASH 1
		TNT1 A 0 A_Weaponoffset(random(-2,2),32+random(0,1))
		TNT1 A 0 A_JUMP(256,"FIRSTFLASH1","FIRSTFLASH2")
	FIRSTFLASH1:
		SMGF B 1 A_FireProjectile("smgtracer", frandom(-2.0,2.0), 0,0,2,0,frandom(0.3,0.3))
		GOTO FIRECONTINUE
	FIRSTFLASH2:
		SMGF C 1 A_FireProjectile("smgtracer", frandom(-2.0,2.0), 0,0,2,0,frandom(0.3,0.3))
		
		GOTO FIRECONTINUE
		
		FIRECONTINUE:	
		SMGG A 0 A_ZoomFactor(1.0)
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		
		// MUZZLEFLASH 2
		TNT1 A 0 A_JUMP(256,"SECONDFLASH1","SECONDFLASH2")
	SECONDFLASH1:
		SMGF D 1
		GOTO FIREFINISH	
	SECONDFLASH2:
		SMGF E 1
		GOTO FIREFINISH
		
		FIREFINISH:
		SMGF A 1 A_Weaponoffset(0,32)
		SMGI A 0 A_JumpIfInventory("norecoil", 1, 3)
		SMGI A 0 A_SetANGLE(ANGLE+RANDOM(-1,1))
		SMGI A 0 A_SetPitch(pitch-1.0)
		SMGI A 0
		//DURABILITY CHECK 2
		SMGI A 0 A_JumpIFInventory("FirearmsdurabilityOFF", 1, 2)
		SMGI A 0 A_JumpIfInventory("SMGDurability",1, 1)
		goto weaponbreak
		////
		SMGI A 0	
		SMGI A 0 A_ReFire
		Goto Ready3
		
	 Fire2:
		SMGG A 0 A_JumpIfInventory("JAMMEDSMG",1,"UNJAMMING")
        SMGG A 0 A_STARTSound("SMGFIRE", 420, CHANF_OVERLAP)
		SMGG A 0 A_ZoomFactor(1.25)
		
		//  MUZZLEFLASH 1
		TNT1 A 0 A_Weaponoffset(random(-2,2),32+random(0,1))
		SMGG A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,0,-9)	
		TNT1 A 0 A_JUMP(256,"ADSFIRSTFLASH1","ADSFIRSTFLASH2")
		
	ADSFIRSTFLASH1:
		SMGA G 1  A_FireProjectile("smgtracer", frandom(-1.0,1.0), 0,0,2,0,frandom(0.3,0.3))
		GOTO ADSFIRECONTINUE
	ADSFIRSTFLASH2:
		SMGA J 1  A_FireProjectile("smgtracer", frandom(-1.0,1.0), 0,0,2,0,frandom(0.3,0.3))
		GOTO ADSFIRECONTINUE
		
		ADSFIRECONTINUE:	
		RIFG A 0 A_JumpIfInventory("norecoil", 1, 3)
		RIFG A 0 A_SetANGLE(ANGLE+RANDOM(-1,1))
		RIFG A 0 A_SetPitch(pitch-0.5)
		SMGG A 0 A_ZoomFactor(1.3)
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		
		// MUZZLEFLASH 2
		TNT1 A 0 A_JUMP(256,"ADSSECONDFLASH1","ADSSECONDFLASH2")
	ADSSECONDFLASH1:
		SMGA H 1
		GOTO ADSFIREFINISH	
	ADSSECONDFLASH2:
		SMGA K 1
		GOTO ADSFIREFINISH
		
		ADSFIREFINISH:
        SMGA I 1 A_Weaponoffset(0,32)
		RIFG A 0
		
		//DURABILITY CHECK 2
		TNT1 A 0 A_JumpIFInventory("FirearmsdurabilityOFF", 1, 2)
		PIST F 0 A_JumpIfInventory("SMGDurability",1, 1)
		goto weaponbreak
		////
		TNT1 A 0
		SMGG A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK, "FIRE")
		BADF A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_altATTACK, "holdaim")
		BADF A 0 A_JumpIfInventory("ZoomHold", 1, "NoAim")
		SMGA F 1 A_WeaponReady(1)
		SMGA F 7 A_WeaponReady(1)
		Goto Ready2	
	
	
	WeaponCheckOverlay:
		TNT1 A 5
		TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, 1)
		Stop
	WeaponCheck2:
		TNT1 A 1
		"####" "#" 0 A_JumpIFInventory("FirearmsdurabilityOFF", 1, 2)
		"####" "#" 0 ACS_NAMEDEXECUTEalways("SMGDURABILITYCHECK",0)
		"####" "#" 0 ACS_NAMEDEXECUTEalways("SMGMAGCHECK",0)
		//"####" "#" 0 A_JumpIfInventory("Suppressormounted",1,2)
		"####" "#" 0 { If(countInv("Suppressormounted") == 1) { ACS_NAMEDEXECUTEalways("SUPPRESSORDURABILITYCHECK",0); }}
		"####" "#" 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "WeaponCheck2")
		stop	
	NoAmmoUnload:
	    "####" "#" 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, 1)
		goto Noammo
		"####" "#" 0 A_Overlay(98,"WeaponCheckOverlay",false)
	NoAmmo:
		SMGA F 0 A_JumpIfInventory("Zoomed",1,3)
		SMSI A 0 A_JumpIfInventory("Suppressormounted",1,2)
		SMGI A 0 
		"####" "#" 1 offset(0,34) { A_PlaySound("dryfire", 4); }
	NoAmmoHold:
		"####" "#" 1 offset(0,34)
		"####" "#" 0 offset(0,34) A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_ATTACK || GetPlayerInput(INPUT_BUTTONS) & BT_RELOAD || GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "Noammohold")
		"####" "#" 1 offset(0,33)
		"####" "#" 1 offset(0,32)
		"####" "#" 0 A_JumpIfInventory("Zoomed",1,"Ready2")
		Goto Ready3
		
	
    Reload:
		"####" "#" 0 A_JumpIfInventory("JAMMEDSMG",1,"UNJAMMING")
		"####" "#" 0 A_JumpIfInventory("REPAIRMODE",1,"KITREPAIR")
		"####" "#" 0 A_JumpIfInventory("BDSMGAmmo",40,"Ready3")
		"####" "#" 0 A_JumpIfInventory("Suppressormounted",1,"reloadsuppressed")
		"####" "#" 0 A_Takeinventory("ADSmode",1)
		"####" "#" 0 A_Takeinventory("Reloading",1)

       "####" "#" 0 A_JumpIfInventory("Clip1",1,1)
        Goto NOAMMO
        "####" "#" 0
		"####" "#" 0 A_Takeinventory("Zoomed",1)
		"####" "#" 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}								
        "####" "#" 0 A_ZoomFactor(1.0)
		"####" "#" 0 A_GiveInventory ("Pumping", 1)
		"####" "#" 0 A_Takeinventory("Reloading",1)
		"####" "#" 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		
		"####" "#" 0 A_JumpIfInventory("BDSMGammo",1,2)
		"####" "#" 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_RELOAD, "FullReloadCheck")
	
	UnloadfromReload:
		"####" "#" 0 A_PlaySound("MAGGRAB", 5)
		"####" "#" 0 A_OVERLAY(2,"RELOADCAMERA")
		SMGL ABCD 1
		
		SMGG A 0 A_JumpIfInventory("HasUnloadedSMG", 1, 6)
		BADF A 0 A_JumpIfInventory("realreloadOFF",1,2)
		PIST F 0 A_JumpIfInventory("BDSMGAmmo",2,3)
		RIFR C 0 A_SpawnItemEx("EmptyClipSMG", 5,10,32,0,-4,-4,40,SXF_NOCHECKPOSITION)
		PIST F 0 A_Jump(256,2)
		RIFR C 0 ACS_NAMEDEXECUTE("DropsmgMAG",0)
	
	Reload2:
		SMGL EFGHI 1
        SMGL JKLMNNNNNNNNNNNNNN 1
        SMGL OPQRSTUVW 1
		SMGG A 0 A_PlaySound("SMGMAGIN",5)
		SMGL XYZ 1
		SMGR ABCDEFGH 1
		BADF A 0 A_JumpIfInventory("BDSMGAmmo",1,1)
		goto boltpull
		SMGR IJKLMN 1	
		BADF A 0 A_JumpIfInventory("BDSMGAmmo",1,"InsertBullets2")//full reload
		Goto InsertBullets	
	
	Boltpull:
		SMGK SRQPNGH 1
		TNT1 A 0 A_playsound("BOLTBACK",1)
		SMGK IJKLM 1
		PIST F 0 A_PlaySound("PISTBOLT",1)
		SMGK NPQRS 1
		SMGR HIJKLMN 1
		Goto InsertBullets	
	
	TurboReload:
		SMGG A 0 A_Takeinventory("HasUnloadedSMG",1)
        SMGS BA 0
        Goto InsertBullets
		
	InsertBullets:
		TNT1 AAAA 0
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",40,"FinishReloading")
		SMGG A 0 A_JumpIfInventory("Clip1",1,1)
		Goto FinishReloading
        TNT1 A 0
		SMGG A 0 A_Giveinventory("BDSMGAmmo",1)
		SMGG A 0 A_Takeinventory("Clip1",1)
		Goto InsertBullets
		
	InsertBullets2:
		BADF A 0 A_JumpIfInventory("realreloadOFF",1,3)
		BADF A 0 A_Takeinventory("BDSMGAmmo",41)
		SMGG A 0 A_Giveinventory("BDSMGAmmo",1)
		SMGG A 0
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",41,"FinishReloading")
		SMGG A 0 A_JumpIfInventory("Clip1",1,1)
		goto FinishReloading
        TNT1 A 0
		SMGG A 0 A_Giveinventory("BDSMGAmmo",1)
		SMGG A 0 A_Takeinventory("Clip1",1)
		Goto InsertBullets2+4		
		
	FinishReloading:
		BADF A 0 A_Takeinventory("Reloading",1)
		SMGG A 0 A_Takeinventory("HasUnloadedSMG",1)
		BADF A 0 A_SetRoll(0)
		BADF A 0 A_Refire
		Goto Ready3

	FullReloadCheck:	
		"####" "#" 0 A_JumpIfInventory("Suppressormounted", 1, 3)
		SMGI A 3
		"####" "#" 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_RELOAD, 4)
		goto unloadfromreload
		"####" "#" 0
		SMSI A 3
		"####" "#" 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_RELOAD, 4)
		goto unloadfromreloadsuppressed
		"####" "#" 0 A_JumpIfInventory("Suppressormounted", 1, 3)
		SMGI A 3
		"####" "#" 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_RELOAD, 4)
		goto unloadfromreload
		"####" "#" 0
		SMSI A 3
		"####" "#" 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_RELOAD, 4)
		goto unloadfromreloadsuppressed
		"####" "#" 0 A_JumpIfInventory("Suppressormounted", 1, 3)
		SMGI A 3
		"####" "#" 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_RELOAD, 4)
		goto unloadfromreload
		"####" "#" 0
		SMSI A 3
		"####" "#" 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_RELOAD, 1)
		goto unloadfromreloadsuppressed
		"####" "#" 0 A_JumpIfInventory("JAMMEDSMG",1,"UNjamming")
		"####" "#" 0 A_JumpIfInventory("clip1",41,2)
		"####" "#" 0 A_PRINT("you need at least 41 bullets to perform a full reload")
		goto noammo
		
	FullReload:		
		BADF A 0 A_ZoomFactor(1.0)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}		
		A12S A 0 A_JumpIfInventory("Suppressormounted", 1, "FullReloadSuppressed")
		PIST F 0 A_JumpIfInventory("JAMMEDSMG",1,"UNJAMMING")
		SMGL ABCD 1
		
		PIST F 0 A_JumpIfInventory("hASUnloadedSMG",1,2)
		RIFR C 0 A_SpawnItemEx("EmptyClipSMG", 5,10,32,0,-4,-4,40,SXF_NOCHECKPOSITION)
		
		SMGL EFGHI 1
		SMGJ TUVWXYZ 1
		SMGK ABCDEFG 1
		SMGG A 0 A_STOPSound(5)
		TNT1 A 0 A_playsound("BOLTBACK",1)
		PIST F 0 A_takeInventory("clip1",1)
		SMGK HIJKLMMMM 1
		SMGK NPQRS 1
		TNT1 A 35 A_OVERLAY(3, "9MMIN")
		PIST F 0 A_PlaySound("PISTBOLT",1)
		TNT1 A 15
		TNT1 A 0 A_STARTsound("SMGSEL",120)
		SMSR H 1
		goto Reload2
	9MMIN:
		9MMZ ABCDEFFGGGGGGHHIJKLM 1
		TNT1 A 0 A_STARTsound("REVOLOAD",100)
		PIST F 0 A_giveInventory("BDSMGAmmo",1)
		stop

			
	Checkmag2:
		PIST F 0 A_JumpIfInventory("BDSMGAmmo",2,1)
		goto checkchamber
		SMGG A 0 A_GiveInventory ("Pumping", 1)
		SMGG A 0 A_Giveinventory("HasUnloadedSMG",1)
        SMGR NMLKJIHGFEDB 1
		SMGG A 0 A_PlaySound("SMGMAGOU",5)
		SMGR CA 1
		SMGL ZYXW 1
		SMGG A 0 A_STOPSound(5)
	checkmag:
		TNT1 A 0 A_ClearOverlays(2,2)
		SMGL W 5 a_weaponready(WRF_NOFIRE | WRF_NOSWITCH)
		TNT1 A 0 A_JumpIFInventory("FirearmsdurabilityOFF", 1, 2)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SMGDURABILITYCHECK",0)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SMGMAGCHECK",0)
		PISA D 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "CHECKMAG")
		
		PIST F 0 A_PlaySound("SMGMAGIN")
		SMGL XYZ 1 a_setpitch(pitch+0.88)
		SMGR ABCDEFGH 1 A_SETANGLE(ANGLE+0.1)
		TNT1 A 1
		goto SELECTANIMATION
	
	CheckChamber:
		BADF A 0 A_ZoomFactor(1.0)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}			
		PIST F 0 A_JumpIfInventory("JAMMEDSMG",1,"UNJAMMING")
		SMGS DCB 1
		SMGK SRQPNHHHH 1
		SMGG A 0 A_STOPSound(5)
		TNT1 A 0 A_playsound("BOLTBACK",1)
		SMGK HIJKL 1	
	CheckChamberHold:	
		SMGK M 5 a_weaponready(WRF_NOFIRE | WRF_NOSWITCH)
				TNT1 A 0 A_JumpIFInventory("FirearmsdurabilityOFF", 1, 2)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SMGDURABILITYCHECK",0)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SMGMAGCHECK",0)
				PISA D 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "CHECKCHAMBERHOLD")
		SMGK NPQRS 1
		TNT1 A 5
		TNT1 A 0 A_STARTsound("SMGSEL",120)
		SMGS ABCD 1 
		goto Ready3	
	
	 User4:
		"####" "#" 0 A_JumpIfInventory("JAMMEDSMG",1,"UNJAMMING")
		"####" "#" 0 A_JumpIfInventory("Suppressormounted",1,"unloadsuppressed")
		"####" "#" 5
		"####" "#" 0 A_Takeinventory("ADSmode",1)
		"####" "#" 0 A_JumpIf(CountInv("BDSMGAmmo") == 0, "NoAmmoUnload")
		TNT1 A 0 A_OVERLAY(2,"UNLOADCAMERA")
		BADF A 0 A_PlaySound("BANDAGE1", 5,0.2)
		SMGG A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}								
        SMGG A 0 A_ZoomFactor(1.0)
		
		PIST F 0 A_JumpIfInventory("BDSMGAmmo",2,1)
		goto unloadchamber
		SMGG A 0 
        SMGR NMLKJIHGFEDB 1
		SMGG A 0 A_PlaySound("SMGMAGOU",5)
		SMGR CA 1
		SMGL ZYXW 1
		SMGG A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "checkmag")
		SMGG A 0 A_Giveinventory("HasUnloadedSMG",1)
		SMGL VUTSRQPONNNMLKJHIGFEDCBA 1
		
	RemoveBullets:
		TNT1 AAAA 0
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",2,3)
		Goto Ready3
        TNT1 AAAAAA 0
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		SMGG A 0 A_Giveinventory("Clip1",1)
		Goto RemoveBullets
		
		TNT1 AAAAAAAAAA 0
		SMGG A 0 A_Takeinventory("Reloading",1)
		
		SMGG A 0 A_Refire
        Goto Ready3
		TNT1 AAAA 0
		SMGG A 0 A_Takeinventory("Reloading",1)
		
		SMGG A 0 A_Refire
        Goto Ready3
	
	UnloadChamber:
		TNT1 A 0
		PISA D 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "Checkmag2")
		BADF A 0 A_ZoomFactor(1.0)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}		
		PIST F 0 A_JumpIfInventory("JAMMEDSMG",1,"UNJAMMING")
		SMGS DCB 1
		SMGK SRQPNHHHH 1
		SMGG A 0 A_STOPSound(5)
		TNT1 A 0 A_playsound("BOLTBACK",1)
		SMGG A 0 A_FireCustomMissile("PistolCasespawnSave",5,0,5,-9)
		SMGK HIJKLMMMM 1
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		SMGG A 0 A_Giveinventory("Clip1",1)
		SMGK NPQRS 1
		TNT1 A 30 A_OVERLAY(3, "9MMOUT2")
		TNT1 A 0 A_STARTsound("SMGSEL",120)
		SMGS ABCD 1 a_setpitch(pitch+1, SPF_INTERPOLATE) 	
		goto Ready3	
	9MMOUT:
		TNT1 A 0 A_STARTsound("REVOLOAD",100)
		9MMZ MLKJIHHGGGGGFFEDCBA 1	
		stop
		
	9MMOUT2:
		TNT1 A 0 A_STARTsound("REVOLOAD",100)
		9MMZ ABCDEFFGGGGGGHHIJKLM 1	OFFSET(60,0)
		stop
	
 	Spawn:
		SMGZ A 1 a_jumpifinventory("removeingredient",1,"Disappear")
		LOOP
	Disappear:
		TNT1 A 1
		STOP
		
		
	Steady:
		TNT1 A 1
		Goto Ready3
	
	SpecialAction:
	DualWield:
		SMGG A 0 A_JumpIfInventory("JAMMEDSMG",1,"UNJAMMING")
		SMGG A 0 A_Takeinventory("StartDualWield",1)
		
	Suppressorcheck:
		SMGG A 0 A_JumpIfInventory("smgsuppressor", 1, "ATTACHSUPPRESSOR")
		SMGG A 0 A_Print("You need an SMG suppressor to do that.")
		Goto READY3
		
ATTACHSUPPRESSOR:
	 SMGG A 0 A_JumpIfInventory("suppressorMOUNTED", 1, "DETACHSUPPRESSOR")
	 TNT1 A 0 ///MOUNT ANIMATION
	 TNT1 A 0 A_PLAYSOUND("SMGSUPPR",1)
	 SMGM ABCDEFGHIJKLMNOPQRSTU 1
	 SMGM VWXWVWXYZ 3
	 SMSM ABCDE 1
	 SMSS ABCDE 1
	 TNT1 A 0 A_STOPSOUND(1)
	 TNT1 A 0 A_GIVEINVENTORY("SUPPRESSORMOUNTED",1)
	 GOTO READY3 
DETACHSUPPRESSOR:
	 TNT1 A 0 ///DETACH ANIMATION
	 SMSS EDCBA 1
	 SMSM EDCBA 1
	 TNT1 A 0 A_PLAYSOUND("SMGSUPPR",1)
	 SMGM ZYXWV 3
	 TNT1 A 0 A_STOPSOUND(1)
	 SMGM UTSRQPONMLKJIHGFEDCBA 1
	 TNT1 A 0 A_TAKEINVENTORY("SUPPRESSORMOUNTED",1)
	 GOTO READY3
	
	Misfire:
		"####" "#" 0 A_PLAYSOUND("DRYFIRE")
		SMGA F 0 A_JumpIfInventory("Zoomed",1,3)
		SMSI A 0 A_JumpIfInventory("Suppressormounted",1,2)
		SMGI A 0 
		"####" "#" 0
		"####" "#" 0 A_jumpifinventory("BDSMGAmmo",1,2)
		"####" "#" 0 A_jump(255,2)		
		"####" "#" 0 A_Jump(80,"JAMMED")
		"####" "#" 13 offset(0,34)
		"####" "#" 3 offset(0,33)
		"####" "#" 1 offset(0,32)
		"####" "#" 0 A_JumpIfInventory("Zoomed",1,"Ready2")
		GOTO READY3		
		
	JAMMED:
		"####" "#" 0 A_giveinventory("jammedsmg",1)
		"####" "#" 25
		"####" "#" 0 A_JumpIfInventory("Zoomed",1,"Ready2")
		goto ready3
		
	WEAPONBREAK:
		TNT1 A 0 a_print("your SMG has broken!")	
		SMGS DCBA 1
		TNT1 A 1
		TNT1 A 0 a_SPAWNITEM("brokensmg",0,0)
		 TNT1 A 0 a_RADIUSGIVE("hasbeendropped",90, RGF_OBJECTS | RGF_NOSIGHT, 1, "brokenSMG")
		TNT1 A 0 ACS_namedexecute("BROKENDISARM",0)
		TNT1 AAA 1 a_weaponready
		Wait	
		
	Unjamming:
		SMGG A 0 A_JumpIfInventory("adsmode",1,1)
		goto unjamming2
		SMGG A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}								
        SMGG A 0 A_ZoomFactor(1.0)
		SMGG A 0 A_Giveinventory("GoSpecial",1)
		SMGG A 0 A_Takeinventory("ADSmode",1)
		SMGA EDCBA 1
	Unjamming2:
		SMGS DCB 1
		SMGK SRQPN 1
		SMGK H 10
		TNT1 A 0 A_playsound("BOLTBACK",1,0.5)
		SMGK IJJ 3
		TNT1 A 0 A_STOPSOUND(1)
		SMGK JI 1
		SMGK H 10
		TNT1 A 0 A_playsound("BOLTBACK",1,0.5)
		SMGK IJJ 3
		TNT1 A 0 A_STOPSOUND(1)
		SMGK JI 1
		SMGK H 17
		SMGK H 1 OFFSET(0,33)
		SMGK H 1 OFFSET(0,32)
		SMGK H 1 OFFSET(0,33)
		SMGK H 1 OFFSET(0,32)
		SMGK H 1 OFFSET(0,33)
		SMGK H 1 OFFSET(0,32)
		SMGK H 1 OFFSET(0,33)
		SMGK H 1 OFFSET(0,32)
		SMGK H 1 OFFSET(0,33)
		SMGK H 1 OFFSET(0,32)
		SMGK H 1 OFFSET(0,33)
		SMGK H 1 OFFSET(0,32)
		SMGK H 1 OFFSET(0,33)
		SMGK H 1 OFFSET(0,32)
		SMGK H 1 OFFSET(0,33)
		SMGK H 1 OFFSET(0,32)
		TNT1 A 0 A_playsound("BOLTBACK",1)
		TNT1 A 0 A_QUAKE(5,5,0,200)
		SMGG A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,0,-9)
		SMGK HIJKLM 1
		TNT1 A 0 A_takeinventory("JAMMEDSMG",1)
		//EJECT CASE
		SMGK NPQRS 1
		SMGS BCD 1
		GOTO READY3
			
////SUPPRESSED SMG	

RELOADSUPPRESSED:
		SMSI A 1
		SMGG A 0 A_Takeinventory("ADSmode",1)
		SMGG A 0 A_Takeinventory("Reloading",1)
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",41,"Ready3")

        SMGG A 0 A_JumpIfInventory("Clip1",1,1)
        Goto NoAmmo
        TNT1 A 0
		
		SMGG A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}								
        SMGG A 0 A_ZoomFactor(1.0)
		SMGG A 0 A_GiveInventory ("Pumping", 1)
		SMGG A 0 A_Takeinventory("Reloading",1)
		SMGG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		
		BADF A 0 A_JumpIfInventory("BDSMGammo",1,2)
		A12S A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_RELOAD, "FullReloadCheck")
		
	UnloadfromReloadSuppressed:
		BADF A 0 A_PlaySound("MAGGRAB", 1,0.2)
		TNT1 A 0 A_OVERLAY(2,"RELOADCAMERA")
		SMSS EDCB 1
		
		SMGG A 0 A_JumpIfInventory("HasUnloadedSMG", 1, 6)	
		BADF A 0 A_JumpIfInventory("realreloadOFF",1,2)
		PIST F 0 A_JumpIfInventory("BDSMGAmmo",1,3)
		RIFR C 0 A_SpawnItemEx("EmptyClipSMG", 5,10,32,0,-4,-4,40,SXF_NOCHECKPOSITION)
		PIST F 0 A_Jump(256,2)
		RIFR C 0 ACS_NAMEDEXECUTE("DropsmgMAG",0)		
	
	Reload2suppressed:
		SMSL EFGHI 1
        SMSL JKLMNNNNNNNNNNNNNN 1
        SMSL OPQRSTUVW 1
		SMGG A 0 A_PlaySound("SMGMAGIN",1)
		SMSL XYZ 1
		SMSR ABCDEFG 1
		BADF A 0 A_JumpIfInventory("BDSMGAmmo",1,1)
		GOTO BOLTPULLSUPPRESSED
		SMSS BCDE 1	
		BADF A 0 A_JumpIfInventory("BDSMGAmmo",1,"InsertBullets2")//full reload
		Goto InsertBullets	
	
	BoltPullSuppressed:
		SMSR H 1
		SMGX ABCDE 1
		TNT1 A 0 A_playsound("BOLTBACK",1)
		SMGX LKJIHGF 1
		PIST F 0 A_PlaySound("PISTBOLT",1)
		SMGX EDCBA 1
		SMSS BCDE 1
		Goto InsertBullets	
		
	
	FullReloadSuppressed:		
		BADF A 0 A_ZoomFactor(1.0)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}			
		SMSS EDCB 1
		SMGG A 0 A_CLEAROVERLAYS(2,2)
		TNT1 A 5
		PIST F 0 A_JumpIfInventory("HASUnloadedSMG",1,1)
		goto FullReloadSuppressedUnload
	FullReloadSuppressed2:
		SMGX ABCDELK 1
		SMGG A 0 A_STOPSound(5)
		TNT1 A 0 A_playsound("BOLTBACK",1)
		SMGX JI 1
		SMGX HGFEDCBA 1
		PIST F 0 A_takeInventory("clip1",1)
		TNT1 A 35 A_OVERLAY(3, "9MMIN")
		PIST F 0 A_PlaySound("PISTBOLT",1)
		TNT1 A 15
		TNT1 A 0 A_STARTsound("SMGSEL",120)
		SMSR GH 1
		goto Reload2Suppressed
	FullReloadSuppressedUnload:
		RIFR C 0 A_SpawnItemEx("EmptyClipSMG", 5,10,32,0,-4,-4,40,SXF_NOCHECKPOSITION)
		SMSL EFGHIJJIHGFE 1
		goto FullReloadSuppressed2
		

	checkmagsuppressed2:
		PIST F 0 A_JumpIfInventory("BDSMGAmmo",2,1)
		goto CheckChambersuppressed
		SMSS EDCB 1
        SMSR GFEDBA 1
		SMGG A 0 A_PlaySound("SMGMAGOU",1)
		SMSL ZYXW 1
		SMGG A 0 A_STOPSound(5)
	checkmagSUPPRESSED:
		TNT1 A 0 A_ClearOverlays(2,2)
		SMSL W 5 a_weaponready(WRF_NOFIRE | WRF_NOSWITCH)
				TNT1 A 0 A_JumpIFInventory("FirearmsdurabilityOFF", 1, 2)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SMGDURABILITYCHECK",0)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SMGMAGCHECK",0)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SUPPRESSORDURABILITYCHECK",0)
		PISA D 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "CHECKMAGSUPPRESSED")
		PIST F 0 A_PlaySound("SMGMAGIN")
		SMSL XYZ 1 a_setpitch(pitch+0.5)
		SMSR ABCDEFGH 1 A_SETANGLE(ANGLE+0.1)
		TNT1 A 1
		goto SELECTANIMATION
		
	CheckChambersuppressed:
		BADF A 0 A_ZoomFactor(1.0)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}		
		SMSS EDCB 1
		SMGG A 0 A_CLEAROVERLAYS(2,2)
		SMGX ABCDELK 1
		SMGG A 0 A_STOPSound(5)
		TNT1 A 0 A_playsound("BOLTBACK",1)
		SMGX JIHG 1
	checkchamberHold2:
		SMGX F 5
				TNT1 A 0 A_JumpIFInventory("FirearmsdurabilityOFF", 1, 2)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SMGDURABILITYCHECK",0)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SMGMAGCHECK",0)
		TNT1 A 0 ACS_NAMEDEXECUTEalways("SUPPRESSORDURABILITYCHECK",0)
		PISA D 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "Checkchamberhold2")
		SMGX EDCBA 1
		TNT1 A 5 
		TNT1 A 0 A_STARTsound("SMGSEL",120)
		SMSS BCDE 1
		goto Ready3	

UNLOADSUPPRESSED:	
		SMSI A 5 
		SMGG A 0 A_Takeinventory("ADSmode",1)
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",1,3)
		SMSI A 10  A_PlaySound("dryfire",1)
		Goto NoAmmoUnload
        TNT1 AAA 0 
		TNT1 A 0 A_OVERLAY(2,"UNLOADCAMERA")
		BADF A 0 A_PlaySound("BANDAGE1", 1,0.2)
		SMGG A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}								
        SMGG A 0 A_ZoomFactor(1.0)
		
		SMGG A 0 A_Takeinventory("Reloading",1)
		PIST F 0 A_JumpIfInventory("BDSMGAmmo",2,1)
		goto unloadchambersuppressed
		SMSS EDCB 1
        SMSR GFEDBA 1
		SMGG A 0 A_PlaySound("SMGMAGOU",1)
		SMSL ZYXW 1
		PISA D 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "CHECKMAGSUPPRESSED")
		SMGG A 0 A_Giveinventory("HasUnloadedSMG",1)
		SMSL VUTSRQPONNNMLKJHIGFE 1
		SMSS BCDE 1
		goto removebullets
		
	UnloadChambersuppressed:
		TNT1 A 0
		PISA D 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS) & BT_USER4, "checkmagsuppressed2")
		BADF A 0 A_ZoomFactor(1.0)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}		
		SMSS EDCB 1
		SMGG A 0 A_CLEAROVERLAYS(2,2)
		SMGX ABCDELK 1
		SMGG A 0 A_STOPSound(5)
		TNT1 A 0 A_playsound("BOLTBACK",1)
		SMGX JI 1
		SMGG A 0 A_FireCustomMissile("PistolCasespawnSave",5,0,6,-9)
		SMGX HGFEDCBA 1
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		SMGG A 0 A_Giveinventory("Clip1",1)
		SMGG A 0 A_OVERLAY(3, "9MMOUT2")
		TNT1 A 20  a_setpitch(pitch-3, SPF_INTERPOLATE) 	
		TNT1 A 0 A_STARTsound("SMGSEL",120)
		SMSS BCDE 1
		goto Ready3	

FIRESUPPRESSED:
		//DURABILITY CHECK
		SMSI A 0 A_Takeinventory("SUPPRESSORDurability",1)
		SMSI A 0 A_JumpIFInventory("FirearmsdurabilityOFF", 1, 3)
		SMSI A 0 A_JumpIfInventory("SMGDurability",75, 2)
		SMSI A 0 A_Jump(30, "Misfire")
		///
		
		TNT1 A 0 A_OVERLAY(0,"SMOKE", 1)
		SMGG A 0 A_ALertMonsters(80)
		SMGG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,40)
		SMGG A 0 A_JumpIfInventory("Zoomed",1,"Fire2SUPPRESSED")
        SMGG A 0 A_PlaySound("SMSFIRE", 1,0.4)
		SMGG A 0 A_ZoomFactor(0.99)
		SMGG A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,0,-9)
		SMSF C 1  A_FireProjectile("smstracer", frandom(-0.7,0.7), 0,0,2,0,0)
		SMGG A 0 A_ZoomFactor(1.0)
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		SMSF B 1
		SMSF A 1 
		RIFG A 0 A_JumpIfInventory("norecoil", 1, 3)
		RIFG A 0 A_SetPitch(pitch-0.6)
		RIFG A 0
		
		//DURABILITY CHECK 2
		SMSI A 0 A_JumpIfInventory("SUPPRESSORDurability",1, 1)
		goto SUPPRESSORBREAK
		////
		SMSI A 0	
		SMSI A 0 A_ReFire
		SMSI A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMSI A 7 A_WeaponReady(1)
		Goto Ready3
		
	 Fire2SUPPRESSED:
		SMGG A 0 A_PlaySound("SMSFIRE", 1,0.4)
		SMGG A 0 A_ZoomFactor(1.25)
		SMGG A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,0,-9)	
		SMSA G 1  A_FireProjectile("smstracer", frandom(-0.3,0.3), 0,0,2,0,0)
		RIFG A 0 A_JumpIfInventory("norecoil", 1, 3)
		RIFG A 0 A_SetPitch(pitch-0.3)
		SMGG A 0 A_ZoomFactor(1.3)
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		SMSA H 1
		SMSA I 1
		RIFG A 0
		
		//DURABILITY CHECK 2
		SMSI A 0 A_JumpIfInventory("SUPPRESSORDurability",1, 1)
		goto SUPPRESSORbreak
		////
		TNT1 A 0
		SMSI A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMSI A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")//If still pressing alt fire, it means its holding aim
		SMSI A 0 A_ReFire
		SMGA F 1 A_WeaponReady(1)
		SMGA F 7 A_WeaponReady(1)
		Goto Ready2	
		
		SUPPRESSORBREAK:
		TNT1 A 0 a_print("your SUPPRESSOR has broken!")
		TNT1 A 0 A_takeinventory("SMGSUPPRESSOR",1)
		TNT1 A 0 A_takeinventory("SUPPRESSORMOUNTED",1)
		SMGG A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 {if(GetCVAR("bd_SmartCrosshairs") == 1){A_SetCrosshair(GetCVAR("SMGCrosshair"));}else{A_SetCrosshair(0);}}								
		SMGG A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_TakeInventory("throwtoken", 1)
		TNT1 A 0 A_TakeInventory("slashtoken", 1)
		TNT1 A 0 A_TakeInventory("flaretoken")
		SMGG A 0 A_TakeInventory("TossGrenade", 1)
		SMGG A 0 A_TakeInventory("Kicking",1)
        SMGG A 0 A_TakeInventory("Taunting",1)
        SMGG A 0 A_TakeInventory("Reloading",1)
		SMGG A 0 A_TakeInventory("Salute1", 1)
		SMGG A 0 A_TakeInventory("Salute2", 1)
        SMGG A 0 A_ZoomFactor(1.0)
		GOTO READY3
		
		Checksprintsuppressed:
		SMSI A 1 A_WeaponReady(WRF_NOFIRE)
		SMGG A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		SMGG A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprintsuppressed")
		Goto Ready
		
		StartSprintsuppressed:
		SMSS EDCB 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_JumpIfInventory("LARGESTAMINA", 1, 2)
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 70, "Trip")
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 1400, "Trip")
		
		Sprintingsuppressed:	
		SMSP A 0 offset(-9,32) 
		SMGG A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		TNT1 A 0 A_JumpIfInventory("LARGESTAMINA", 1, 2)
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTiredsuppressed")
		SMGG A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 2000, "StopSprintTiredsuppressed")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		SMGG A 0 offset(-9,32) A_JumpIfInventory("Powerstrength2", 1, 2)
		SMGG A 0 offset(-9,32) A_GiveInventory("UsedStamina", 5)
		SMGG A 0 offset(-9,32)
		SMSP R 1 offset(-9,34) A_SetPitch(pitch -0.5)
		SMSP R 1 offset(-6,36) A_SetPitch(pitch -0.5)
		SMSP R 1 offset(-3,38) A_SetPitch(pitch -0.5)
		SMSP R 1 offset(0,38) A_SetPitch(pitch -0.5)
		SMSP R 1 offset(3,36) A_SetPitch(pitch -0.5)
		SMSP R 1 offset(6,34) A_SetPitch(pitch -0.5)
		SMSP R 1 offset(9,32) A_SetPitch(pitch -0.5)
		SMGG A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"dokicksmg")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 
		SMGG A 0 offset(-9,32) A_GiveInventory("UsedStamina", 4)
		SMGG A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		SMSP R 1 offset(9,34) A_SetPitch(pitch +0.5)
		SMSP R 1 offset(6,36) A_SetPitch(pitch +0.5)
		SMSP R 1 offset(3,38) A_SetPitch(pitch +0.5)
		SMSP R 1 offset(0,38) A_SetPitch(pitch +0.5)
		SMSP R 1 offset(-3,36) A_SetPitch(pitch +0.5)
		SMSP R 1 offset(-6,34) A_SetPitch(pitch +0.5)
		SMSP R 1 offset(-9,32) A_SetPitch(pitch +0.5)
		SMGG A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		SMGG A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprintingsuppressed")
		Goto StopSprintsuppressed
		
	StopSprintTiredsuppressed:
		SMSS BCDE 2
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		SMGG A 0 A_PlaySound("Tired", 2)
		SMGG A 0 A_TakeInventory("usedstamina", 1)
		TNT1 A 0 A_Jumpifhealthlower(25,"rupturesprint")												  
		SMGG A 5 A_WeaponReady
		SMGG A 0 A_TakeInventory("usedstamina", 1)
		SMGG A 5 A_WeaponReady
		SMGG A 0 A_TakeInventory("usedstamina", 1)
		SMGG A 5 A_WeaponReady
		SMGG A 0 A_TakeInventory("usedstamina", 1)
		SMGG A 5 A_WeaponReady
		SMGG A 0 A_TakeInventory("usedstamina", 1)
		SMGG A 5 A_WeaponReady
		Goto Ready3
	StopSprintsuppressed:
		SMSS BCDE 1
		TNT1 A 0 A_JumpIfInventory("LARGESTAMINA", 1, 2)
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 70, "StopSprintTiredsuppressed")
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 1400, "StopSprintTiredsuppressed")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready3
		
		/// CAMERA STUFF
		
		RELOADCAMERA:
		TNT1 AAA 1 a_SETPITCH(PITCH+1)
		TNT1 A 1 A_SETANGLE(ANGLE-1)
		TNT1 A 1 A_SETROLL(ROLL+1.5)
		TNT1 A 1 a_SETPITCH(PITCH-1)
		TNT1 A 1 A_SETROLL(ROLL+1.5)
		TNT1 AA 1 a_SETPITCH(PITCH-1)
		TNT1 A 1 A_SETROLL(ROLL+1.5)
		TNT1 AAA 1 a_SETPITCH(PITCH+1)
		TNT1 A 14
		TNT1 AAAAAAAAAAAAAAA 1 a_SETPITCH(PITCH+0.5)
		TNT1 A 0 A_QUAKE(2,1,0,200)
		TNT1 AAAA 1 a_SETPITCH(PITCH-2.5)
		TNT1 AAA 1 A_SETROLL(ROLL-1.5)
		STOP

				
		UNLOADCAMERA:
		TNT1 AAA 1 a_SETPITCH(PITCH+1)
		TNT1 A 1 A_SETANGLE(ANGLE-1)
		TNT1 AA 1 a_SETPITCH(PITCH+1)
		TNT1 AA 1 a_SETPITCH(PITCH-1)
		TNT1 AAAA 1 a_SETPITCH(PITCH-0.6)
		TNT1 A 1 a_SETPITCH(PITCH-1.2)
		TNT1 AAAA 1 a_SETPITCH(PITCH-0.6)
		TNT1 AAAAAAAAAA 1 a_SETPITCH(PITCH+0.6)
		TNT1 AAAAAAAAA 1 a_SETPITCH(PITCH-1.0)
		TNT1 AAA 1 a_SETPITCH(PITCH+0.6)
		TNT1 AAA 1 A_SETANGLE(ANGLE+1)
		STOP
		
		INSPECTCAMERA:
		TNT1 AAAAA 1 a_SETPITCH(PITCH+1)
		TNT1 AA 1 a_SETPITCH(PITCH-2.2)
		TNT1 AA 1 A_SETANGLE(ANGLE-1.5)
		TNT1 A 10
		TNT1 AAAAAAA 1 a_SETPITCH(PITCH+0.7)
		TNT1 AAAA 1 A_SETANGLE(ANGLE-1)
		TNT1 A 10
		TNT1 AAAA 1 a_SETPITCH(PITCH+0.7)
		TNT1 AAAAA 1 a_SETPITCH(PITCH-1.2)
		TNT1 A 5
		TNT1 AAAAAAAA 1 a_SETPITCH(PITCH+0.8)
		TNT1 A 3
		TNT1 AAAA 1 A_SETANGLE(ANGLE+2)
		STOP
		
		SMOKE:
		SMOC ABBBCCCC 1
		STOP
		
	KITREPAIR:
		TNT1 A 0 A_JumpIFInventory("survivalkituses",1, 2)
		PIST F 0 A_Jump(256,"kitbroke")
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,3)
		SMGI A 5
		PIST F 0 A_Jump(256,2)
		SMSI A 5
		
		TNT1 A 0 A_JumpIFInventory("SMGDurability",250, "NoNeedRepair")
		PIST F 0 A_JumpIfInventory("scrapmetal",1, 2)
		PIST F 0 A_Jump(256,"outofmetal")
		
	KITREPAIR2:
		PIST F 0 A_GIVEinventory("SMGDurability",40)
		BADF A 0 A_Takeinventory("scrapmetal",1)
		BADF A 0 A_Takeinventory("survivalkituses",1)
		TNT1 A 0 A_playsound("WIRECUT",1)
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,"KITREPAIRSUPPRESSED")
		
		SMGS DCBA 1
		TNT1 A 23
		SMGS ABCD 1
		
		TNT1 A 0 A_JumpIFInventory("survivalkituses",1, 2)
		PIST F 0 A_Jump(256,"kitbroke")
		SMGI A 2
		goto Ready3
		
	KITREPAIRSUPPRESSED:		
		SMSS EDCBA 1
		TNT1 A 23
		SMSS ABCDE 1
		
		TNT1 A 0 A_JumpIFInventory("survivalkituses",1, 2)
		PIST F 0 A_Jump(256,"kitbroke")
		SMSI A 2
		goto Ready3
	
	Dokicksmg:
		TNT1 A 0 A_JumpIfInventory("isdoomguy", 1, 4)
		TNT1 A 0 A_JumpIfInventory("LARGESTAMINA", 1, 2)
		TNT1 A 0 A_JumpifInventory("UsedStamina",95,4)
		TNT1 A 0 A_JumpifInventory("UsedStamina",1995,3)
		TNT1 A 0 A_overlay(3,"kicksmg")
		TNT1 A 0 a_Jump(256,"Dokick")
		goto Ready3
		TNT1 A 0 A_overlay(3,"kicksmgtired")
		TNT1 A 0 a_Jump(256,"Dokick")
		goto Ready3	
	kicksmg:
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,"KICKSMGS")
		SMGM ABC 1
		SMGM D 12 
		SMGM CBA 1 
		TNT1 A 0 A_JumpIfInventory("Airkicking", 1, 2)
		TNT1 A 0 A_JumpIfInventory("isSliding", 1, 2)
		stop
		SMGM A 10
		STOP
		SMGS DCBA 1
		TNT1 A 6
		STOP	
	kicksmgtired:
		SMGG A 0 A_JumpIfInventory("Suppressormounted",1,"KICKSMGSTIRED")
		SMGM ABC 2 
		SMGM D 37 
		SMGM CBA 2 
		STOP	
		
	KICKSMGS:
		SMSS CBA 1
		TNT1 A 12 
		SMSS ABC 1 
		TNT1 A 0 A_JumpIfInventory("Airkicking", 1, 2)
		TNT1 A 0 A_JumpIfInventory("isSliding", 1, 2)
		stop
		SMSS D 10
		STOP
		SMSS EDCBA 1
		TNT1 A 5
		STOP	
		
	kicksmgStired:
		SMSS CBA 2 
		TNT1 A 37 
		SMSS ABC 2 
		STOP	
		
	}
}

ACTOR SUPPRESSORMOUNTED : INVENTORY {Inventory.MaxAmount 1}
ACTOR SMGSUPPRESSOR : INVENTORY {Inventory.MaxAmount 1}

ACTOR SMGSUPPRESSORPICKUP : CUSTOMINVENTORY
{
Inventory.Pickupsound "TURRETPK"
Inventory.PickupMessage "$GOTSUPPRESSOR"
tag "SMG suppressor"
Inventory.MaxAmount 1
+NOGRAVITY
ySCALE 0.35
XSCALE 0.3
STATES
	{
	SPAWN:
	TNT1 A 0
	SUPP A 1
	
	Stay:
  	MEDM A 0 A_checkproximity("bench","recombinerstatic",50)
	MEDM A 0 A_checkproximity("bench","recombinerstart",50)
	SUPP A 1 A_changeflag("NOGRAVITY", 0)
	SUPP A -1
	stop
	
	BENCH:
	SUPP A -1
    loop
	
	PICKUP:
	TNT1 A 0 A_GIVEINVENTORY("SUPPRESSORDURABILITY",150)
	TNT1 A 0 A_GIVEINVENTORY("SMGSUPPRESSOR",1)
	STOP
	}
}
	