ACTOR DualSMG : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "Clip1"
	Weapon.AmmoType2 "BDDualSMGAmmo"
	Obituary "%o was shot down by %k's SMG."
    AttackSound "None"
	Weapon.SelectionOrder 1800
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "You got dual SMG's! (Slot 2)"
    +WEAPON.NOAUTOAIM
    +FORCEXYBILLBOARD
	+WEAPON.NO_AUTO_SWITCH
	Scale 0.8
	Tag "Dual SMG's"
	DropItem "SMGSpawner"
	States
	{
	Ready3:
	Ready:
		SM2G A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SM2G A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		SM2G A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		SM2G A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		SM2G A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SM2G A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		SM2G A 0 A_JumpIfInventory("Unloading",1,"Unload")
		SM2G A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		SM2G A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SM2G A 0 A_JumpIfInventory("StartDualWield",1,"DualWield")
		SM2G A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Loop

	DualWield:
		SM2G A 1
		SM2G A 0 A_GiveInventory("BrutalSMG",1)
		SM2G A 0 A_Takeinventory("StartDualWield",1)
		SM2G A 0 A_SelectWEapon("BrutalSMG")
		Goto Ready

	StartSprint:
		SM2G 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:
		SM2G A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		SM2G A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		SM2G A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		SM2G A 1 offset(0,38) A_SetPitch(pitch -0.5)
		SM2G A 1 offset(3,36) A_SetPitch(pitch -0.5)
		SM2G A 1 offset(6,34) A_SetPitch(pitch -0.5)
		SM2G 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")

		SM2G A 1 offset(9,34) A_SetPitch(pitch +0.5)
		SM2G A 1 offset(6,36) A_SetPitch(pitch +0.5)
		SM2G A 1 offset(3,38) A_SetPitch(pitch +0.5)
		SM2G A 1 offset(0,38) A_SetPitch(pitch +0.5)
		SM2G A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		SM2G A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		SM2G 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:
		SM2G A 0 A_JumpIfInventory("PowerStrength", 1, 2)
		SM2G A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		SM2G A 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		Goto Ready

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

	Deselect:
        SM2S CBA 1
		TNT1 AAAAAAAAAAAA 0 A_Lower
		SM2G A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 1 A_Lower
		Wait

	Select:
		TNT1 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_GiveInventory("HasDualSMG",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)
		SM2G A 0 A_Takeinventory("HasBarrel",1)
		SM2G A 0 A_Takeinventory("BrutalSMG",1)
        SM2G A 0 A_GunFlash
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAAAA 0 A_Raise
		Goto SelectAnimation


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



    Fire:
        TNT1 A 0
		SM2G A 0 A_JumpIfInventory("BDSMGAmmo",1,1)
		Goto FireLeft
        TNT1 AAAA 0
		TNT1 A 0 A_FireCustomMissile("DistantFireSoundPistol", random(-1,1), 0, 0, -12, 0, random(-1,1))
        SM2G A 0 A_PlaySound("SMGFIRE")
		SM2G A 0 A_SpawnItemEx("PlayerMuzzle1",32,5,28)
		SM2F A 1 BRIGHT A_FireBullets (2.2, 1.8, -1, 12, "WeakPuff", FBF_NORANDOM)
		TNT1 A 0 A_ZoomFactor(0.99)
        TNT1 A 0 A_FireCustomMissile("DecorativeTracer",random(-2,2),0,8,0,0,random(-2,2))
		SM2G A 0 A_Takeinventory("BDSMGAmmo",1)
		SM2G A 0 A_Takeinventory("BDDualSMGAmmo",1)
		SM2G A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,16,-2)
		SM2G A 0 A_SetPitch(-0.2 + pitch)
		SM2F C 1
		TNT1 A 0 A_ZoomFactor(1.0)

		SM2G A 0 A_JumpIfInventory("BDDualSMGAmmo",1,1)
        Goto NoAmmo
		TNT1 A 0 A_FireCustomMissile("DistantFireSoundPistol", random(-1,1), 0, 0, -12, 0, random(-1,1))
        SM2G A 0 A_PlaySound("SMGFIRE")
		SM2G A 0 A_SpawnItemEx("PlayerMuzzle1",32,-5,28)
		SM2F B 1 BRIGHT A_FireBullets (2.2, 1.8, -1, 12, "WeakPuff", FBF_NORANDOM)
		TNT1 A 0 A_ZoomFactor(0.99)
        TNT1 A 0 A_FireCustomMissile("DecorativeTracer",random(-2,2),0,-8,0,0,random(-2,2))
		SM2G A 0 A_Takeinventory("BDDualSMGAmmo",1)
		SM2G A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,-8,-2)
		SM2G A 0 A_SetPitch(-0.2 + pitch)
		SM2F D 1
		TNT1 A 0 A_ZoomFactor(1.0)
		SM2G A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		Goto Ready3

	FireLeft:
		SM2G A 0 A_JumpIfInventory("BDDualSMGAmmo",1,1)
        Goto NoAmmo
		TNT1 A 0 A_FireCustomMissile("DistantFireSoundPistol", random(-1,1), 0, 0, -12, 0, random(-1,1))
        SM2G A 0 A_PlaySound("SMGFIRE")
		SM2G A 0 A_SpawnItemEx("PlayerMuzzle1",32,-5,28)
		SM2F B 1 BRIGHT A_FireBullets (2.2, 1.8, -1, 12, "WeakPuff", FBF_NORANDOM)
		TNT1 A 0 A_ZoomFactor(0.99)
        TNT1 A 0 A_FireCustomMissile("DecorativeTracer",random(-2,2),0,-8,0,0,random(-2,2))
		SM2G A 0 A_Takeinventory("BDDualSMGAmmo",1)
		SM2G A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,-8,-2)
		SM2G A 0 A_SetPitch(-0.2 + pitch)
		SM2F D 1
		TNT1 A 0 A_ZoomFactor(1.0)
		SM2G A 1
		SM2G A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		Goto Ready3


	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_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")
		SM2G A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOFIRE)
		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:
		SM2G A 1
		SM2G A 0 A_Takeinventory("ADSmode",1)
		SM2G A 0 A_Takeinventory("Reloading",1)
		SM2G A 0 A_Takeinventory("Zoomed",1)
        SM2G A 0 A_ZoomFactor(1.0)
		SM2G A 0 A_JumpIfInventory("BDDualSMGAmmo",82,"Ready")

        SM2G A 0 A_JumpIfInventory("Clip1",1,3)
        Goto Ready
        TNT1 AAA 0
		SM2G A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		SMGG A 0 A_JumpIfInventory("SMGUnloaded", 1, "PutMag")
        SMGR TSRQP 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SMGR O 1 A_PlaySound("RELO1")
		SMGR NML 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SMGR K 8 A_FireCustomMissile("EmptyPistolClipSpawn",0,0,10,-20)
	PutMag:
		SMGR K 8
        SMGR JIHG 1
		SMGR F 1 A_PlaySound("RELO2")
		SMGR EDCBA 1
		SMGG A 0 A_JumpIfInventory("SMGUnloaded", 1, "PutMag2")

        SM2R TSRQP 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SM2R O 1 A_PlaySound("RELO1")
		SM2R NML 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SM2R K 8 A_FireCustomMissile("EmptyPistolClipSpawn",225,0,-10,-20)
	PutMag2:
		SM2R K 8
        SM2R JIHG 1
		SM2R F 1 A_PlaySound("RELO2")
		SM2R EDCBA 1
		SM2G A 0 A_Takeinventory("SMGUnloaded",1)
		SM2G A 0 A_JumpIfInventory("BDDualSMGAmmo",1,"InsertBullets2")//80+1 effect
		Goto InsertBullets

	TurboReload:
		SM2G A 0 A_Takeinventory("SMGUnloaded",1)
        SM2S BA 0
        Goto InsertBullets2

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

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

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

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

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

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

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

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

		SM2G A 0 A_Takeinventory("Zoomed",1)
		SM2G A 0 A_Takeinventory("Reloading",1)
		SM2G A 0 A_Giveinventory("SMGUnloaded",1)
		SMGR TSRQP 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SMGR O 1 A_PlaySound("RELO1")
		SMGR NML 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SMGR K 8

		SM2R TSRQP 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SM2R O 1 A_PlaySound("RELO1")
		SM2R NML 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SM2R K 8
		Goto RemoveBullets

	UnloadLeft:
		TNT1 A 0
		SM2G A 0 A_JumpIfInventory("BDDualSMGAmmo",1,3)
		Goto Ready
        TNT1 AAA 0
		SM2G A 0 A_Takeinventory("Zoomed",1)
		SM2G A 0 A_Takeinventory("Reloading",1)
		SM2G A 0 A_Giveinventory("SMGUnloaded",1)
		SM2R TSRQP 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SM2R O 1 A_PlaySound("RELO1")
		SM2R NML 1 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SM2R K 8
		Goto RemoveBullets

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

	Spawn:
		SMGZ A -1
		Stop

	Steady:
		TNT1 A 1
		Goto Ready
	}
}

ACTOR BDDualSMGAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 82
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 82
   Inventory.Icon SMGZB0
}