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"
	Weapon.SelectionOrder 1800
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "$GOTSMG"
    +WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+WEAPON.NOALERT
    +FORCEXYBILLBOARD
	Scale 0.8
	Tag "Sub-MachineGun"
	DropItem "SMGSpawner"
	States
	{
	Ready3:
	Ready:
		SMGG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SMGG A 0 A_JumpIfInventory("Zoomed",1,"Ready2")
		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGG A 0 A_JumpIfInventory("Unloading",1,"Unload")
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		SMGG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		SMGG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SMGG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SMGG A 0 A_JumpIfInventory("StartDualWield",1,"DualWield")
		SMGG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Loop

	Ready2:
		TNT1 A 0
		SMGA A 1 A_WeaponReady(WRF_ALLOWRELOAD)
        SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		SMGG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		SMGG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SMGG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		SMGG A 0 A_JumpIfInventory("Unloading",1,"Unload")
		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SMGG A 0 A_JumpIfInventory("StartDualWield",1,"DualWield")
		SMGG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Loop

	 AltFire:
        SMGG A 0
		SMGG A 0 A_Giveinventory("GoSpecial",1)
		SMGG A 0 A_JumpIfInventory("Zoomed",1,"NoAim")
		SMGG A 0 A_Giveinventory("Zoomed",1)
        SMGG A 0 A_ZoomFactor(1.3)
		SMGG A 0 A_Giveinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(41)
		SMGA EF 1
        SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGA A 1
		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGA A 1
		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGA A 1
		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGA A 1
		SMGG A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")
        Goto Ready2

	   HoldAim:
	    SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGA A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGA A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGA A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SMGA A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SMGG A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")

       NoAim:
		SMGG A 0 A_Takeinventory("Zoomed",1)
        SMGG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_SetCrosshair(0)
		SMGG A 0 A_Giveinventory("GoSpecial",1)
		SMGG A 0 A_Takeinventory("ADSmode",1)
		SMGA AFE 1
        Goto Ready3

	StartSprint:
		SMGG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SHTN A 0 A_Takeinventory("Zoomed",1)
        SHTN A 0 A_ZoomFactor(1.0)
		SHTN A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(0)
		SHTN A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.

	Sprinting:
		SMSP A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		SMSP A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		SMSP A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		SMSP A 1 offset(0,38) A_SetPitch(pitch -0.5)
		SMSP A 1 offset(3,36) A_SetPitch(pitch -0.5)
		SMSP A 1 offset(6,34) A_SetPitch(pitch -0.5)
		SMSP A 1 offset(9,32) A_SetPitch(pitch -0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 1)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		SMSP A 1 offset(9,34) A_SetPitch(pitch +0.5)
		SMSP A 1 offset(6,36) A_SetPitch(pitch +0.5)
		SMSP A 1 offset(3,38) A_SetPitch(pitch +0.5)
		SMSP A 1 offset(0,38) A_SetPitch(pitch +0.5)
		SMSP A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		SMSP A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		SMSP A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 1)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		PLAY A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.
		SMGG A 0 A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint

	StopSprint:
		SMSP A 0 A_JumpIfInventory("PowerStrength", 1, 2)
		SMGG A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		SMSP A 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		Goto Ready

	StopSprintTired:
		SMSP A 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		SMGG A 0 A_PlaySound("Tired", 2)
		Goto Ready

	Deselect:
        SMGS CBA 1
		SMGG A 0 A_TakeInventory("TossGrenade", 1)
		SMGG A 0 A_TakeInventory("Zoomed", 1)
		SMGG A 0 A_TakeInventory("ADSMode", 1)
		SMGG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_SetCrosshair(0)
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait

	Select:
		SMGG A 0
		SMGG A 0 A_Takeinventory("StartDualWield",1)
		SMGG A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 A_TakeInventory("FistsSelected", 1)
		TNT1 A 0 A_TakeInventory("ShotgunSelected", 1)
		TNT1 A 0 A_TakeInventory("MinigunSelected", 1)
		TNT1 A 0 A_TakeInventory("SSGSelected", 1)
		TNT1 A 0 A_TakeInventory("RocketLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("GrenadeLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("PlasmaGunSelected", 1)
		TNT1 A 0 A_TakeInventory("RailGunSelected", 1)
		TNT1 A 0 A_TakeInventory("RevenantLauncherSelected", 1)
		TNT1 A 0 A_GiveInventory("SubMachineGunSelected", 1)
		TNT1 A 0 A_TakeInventory("BFG10KSelected", 1)
		TNT1 A 0 A_TakeInventory("BFGSelected", 1)
		TNT1 A 0 A_TakeInventory("FlameCannonSelected", 1)
		TNT1 A 0 A_TakeInventory("SawSelected", 1)
		SMGG A 0 A_Takeinventory("HasBarrel",1)
		SMGG A 0 A_TakeInventory("DualSMG",1)
        SMGG A 0 A_GunFlash
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAA 0 A_Raise
		Goto SelectAnimation


	SelectAnimation:
		TNT1 A 1
	    SMGG A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        SMGG A 0 A_PlaySound("CLIPIN")
        SMGS ABC 1
		SMGG A 0 A_Takeinventory("StartDualWield",1)
		Goto Ready


    Fire:
		TNT1 A 0
        SMGG A 0 A_JumpIfInventory("BDSMGAmmo",1,1)
        Goto NoAmmo
        TNT1 A 0
		SMGG A 0 A_ALertMonsters
		SMGG A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		SMGG A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
		TNT1 A 0 A_FireCustomMissile("DistantFireSoundPistol", random(-1,1), 0, 0, -12, 0, random(-1,1))
        SMGG A 0 A_PlaySound("SMGFIRE", 1)
		SMGG A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		SMGF A 1 BRIGHT A_FireBullets (1.2, 1.3, -1, 12, "WeakPuff", FBF_NORANDOM)
		TNT1 A 0 A_ZoomFactor(0.99)
        TNT1 A 0 A_FireCustomMissile("DecorativeTracer",random(-1,1),0,0,0,0,random(-1,1))
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		SMGG A 0 A_Takeinventory("BDDualSMGAmmo",1)
        SMGF B 1
		TNT1 A 0 A_ZoomFactor(1.0)
		SMGG A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,0,-9)
		SMGG A 0 A_JumpIfInventory("IsTacticalClass", 1, 2)//Tactical mode skips a frame, fires faster
		SMGF C 1
		RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
		RIFG A 0 A_SetPitch(pitch-0.2)
		SMGG A 1 A_JumpIfInventory("FiredPrimary",1,"Fire")
		Goto Ready3

	 Fire2:
		SMGG A 0
		TNT1 A 0 A_FireCustomMissile("DistantFireSoundPistol", random(-1,1), 0, 0, -12, 0, random(-1,1))
        SMGG A 0 A_PlaySound("SMGFIRE", 1)
		SMGG A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		SMGA B 1 BRIGHT A_FireBullets (0.7, 0.8, 1, 12, "WeakPuff", FBF_NORANDOM)
		TNT1 A 0 A_ZoomFactor(1.29)
        TNT1 A 0 A_FireCustomMissile("DecorativeTracer",random(-1,1),0,0,0,0,random(-1,1))
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		SMGG A 0 A_Takeinventory("BDDualSMGAmmo",1)
        SMGA C 1
		TNT1 A 0 A_ZoomFactor(1.3)
		SMGG A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,0,-9)
		SMGG A 0 A_JumpIfInventory("IsTacticalClass", 1, 2)//Tactical mode skips a frame, fires faster
		SMGA D 1
		RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
		RIFG A 0 A_SetPitch(pitch-0.1)
		SMGG A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")//If still pressing alt fire, it means its holding aim
		SMGA A 1 A_JumpIfInventory("FiredPrimary",1,"Fire")
		Goto Ready2

	NoAmmo:
		RIFG A 0
		RIFG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_Takeinventory("Zoomed",1)
		RIFG A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(0)
		RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		NoAmmo2:
		RIFG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
	    RIFG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		RIFG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		RIFG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SMGG A 5 A_WeaponReady(WRF_ALLOWRELOAD)
		RIFG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, 2)
		RIFG A 0 A_JumpIfInventory("Clip1",1,"Reload")
		RIFG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Goto Ready3

    Reload:
		SMGG A 1
		SMGG A 0 A_Takeinventory("ADSmode",1)
		SMGG A 0 A_Takeinventory("Reloading",1)
		SMGG A 0 A_Takeinventory("Zoomed",1)
        SMGG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_SetCrosshair(0)
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",41,"Ready")

        SMGG A 0 A_JumpIfInventory("Clip1",1,3)
        Goto Ready
        TNT1 AAA 0
		SMGG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		SMGG A 0 A_JumpIfInventory("SMGUnloaded", 1, "PutMag")
        SMGR ABCDE 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SMGR F 1 A_PlaySound("RELO1")
		SMGR GHIJ 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SMGR K 8 A_FireCustomMissile("EmptyPistolClipSpawn",0,0,0,-20)
	PutMag:
		SMGR K 8
        SMGR LMN 1
		SMGR O 1 A_PlaySound("RELO2")
		SMGR PQR 1
		TNT1 A 0 A_Takeinventory("SMGUnloaded",1)
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",1,"InsertBullets2")//40+1 effect
		Goto InsertBullets

	TurboReload:
		SMGG A 0 A_Takeinventory("SMGUnloaded",1)
        SMGS BA 0
        Goto InsertBullets2

	InsertBullets:
		TNT1 AAAA 0
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",40,15)
		SMGG A 0 A_JumpIfInventory("Clip1",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		SMGG A 0 A_Giveinventory("BDSMGAmmo",1)
		SMGG A 0 A_Giveinventory("BDDualSMGAmmo",1)
		SMGG A 0 A_Takeinventory("Clip1",1)
		Goto InsertBullets

		TNT1 AAAAAAAAAA 0
		SMGG A 1 A_Takeinventory("Reloading",1)

		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
        Goto Ready
		TNT1 AAAA 0
		SMGG A 1 A_Takeinventory("Reloading",1)

		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
        Goto Ready

	InsertBullets2:
		TNT1 AAAA 0
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",41,15)
		SMGG A 0 A_JumpIfInventory("Clip1",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		SMGG A 0 A_Giveinventory("BDSMGAmmo",1)
		SMGG A 0 A_Giveinventory("BDDualSMGAmmo",1)
		SMGG A 0 A_Takeinventory("Clip1",1)
		Goto InsertBullets2

		TNT1 AAAAAAAAAA 0
		SMGG A 1 A_Takeinventory("Reloading",1)

		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
        Goto Ready
		TNT1 AAAA 0
		SMGG A 1 A_Takeinventory("Reloading",1)

		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
        Goto Ready

	 Unload:
		SMGG A 1
		SMGG A 0 A_Takeinventory("ADSmode",1)
		SMGG A 0 A_Takeinventory("Unloading",1)
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",1,3)
		Goto Ready
        TNT1 AAA 0

		SMGG A 0 A_Takeinventory("Zoomed",1)
        SMGG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_SetCrosshair(0)
		SMGG A 0 A_GiveInventory ("Pumping", 1)
		SMGG A 0 A_Takeinventory("Reloading",1)
		SMGG A 0 A_Giveinventory("SMGUnloaded",1)
        SMGR ABCDE 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SMGR F 1 A_PlaySound("RELO1")
		SMGR GHIJ 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SMGR K 8

	RemoveBullets:
		TNT1 AAAA 0
		SMGG A 0 A_JumpIfInventory("BDSMGAmmo",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		SMGG A 0 A_Takeinventory("BDSMGAmmo",1)
		SMGG A 0 A_Takeinventory("BDDualSMGAmmo",1)
		SMGG A 0 A_Giveinventory("Clip1",1)
		Goto RemoveBullets

		TNT1 AAAAAAAAAA 0
		SMGG A 0 A_Takeinventory("Reloading",1)

		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
        Goto Ready
		TNT1 AAAA 0
		SMGG A 0 A_Takeinventory("Reloading",1)

		SMGG A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
        Goto Ready



 	Spawn:
		SMGZ A -1
		Stop


	Steady:
		TNT1 A 1
		Goto Ready


	DualWield:
		SMGG A 1
		SMGG A 0 A_Takeinventory("StartDualWield",1)
		SMGG A 0 A_JumpIfInventory("IsTacticalClass", 1, "NoDual")//Tactical mode cant dual
		SMGG A 0 A_JumpIfInventory("HasDualSMG", 1, "GetDual")
		SMGG A 0 A_Print("You must have two identical weapons to dual wield.")
		Goto Ready

	 GetDual:
		SMGG A 0 A_Takeinventory("Zoomed",1)
		SMGG A 0 A_Takeinventory("ADSmode",1)
		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("Unloading",1)
		SMGG A 0 A_TakeInventory("Salute1", 1)
		SMGG A 0 A_TakeInventory("Salute2", 1)
		SMGG A 0 A_GiveInventory("DualSMG",1)
        SMGG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_SetCrosshair(0)
		SMGG A 0 A_SelectWEapon("DualSMG")
		Goto Ready

	NoDual:
		SMGG A 1
		SMGG A 0 A_Print("You can't dual wield smgs when playing in Tactical Mode.",1)
		Goto Ready
	}
}

ACTOR BDSMGAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 41
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 41
   Inventory.Icon SMGZA0
}