ACTOR Shot_Gun : BrutalWeapon
{
	Game Doom
	SpawnID 27
	Weapon.SelectionOrder 1300
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive1 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "AmmoShell"
	Weapon.AmmoType2 "ShotgunAmmo"
	Inventory.PickupMessage "$GOTSHOTGUN"
    Inventory.PickupSound "weapons/sgpump"
	Obituary "$OB_MPSHOTGUN"
    AttackSound "None"
    +WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+WEAPON.NOALERT
	+FORCEXYBILLBOARD
	Scale 0.8
	Tag "Shotgun"
	DropItem "ShotgunSpawner"
	States
	{
    Spawn:
		SHTC A -1
		Stop

	Select:
		SHTN A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 A_TakeInventory("FistsSelected", 1)
		TNT1 A 0 A_GiveInventory("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_TakeInventory("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)
		SHTN A 0 A_Takeinventory("HasBarrel",1)
		SHTN A 0 A_TakeInventory("TossGrenade", 1)
		SHTN A 0 A_TakeInventory("Shot_Gun2", 1)
		A12G A 0 A_GunFlash
		TNT1 AAAAAAAAA 0 A_Raise
		TNT1 AAAA 1 A_Raise

	SelectAnimation:
        TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        SHSS ABCD 1 BRIGHT A_JumpIfInventory("ShotgunChangeAmmo",1,"Reload")
		SHTN A 0 A_PlaySound("weapons/sgpump")

	Ready3:
	Ready:
		TNT1 A 0
		SHTN A 0 A_JumpIfInventory("Zoomed",1,"Ready2")
		SHTN A 1 BRIGHT A_WeaponReady(WRF_ALLOWRELOAD)
        SHTN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SHTN A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SHTN A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SHTN A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		SHTN A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		SHTN A 0 A_JumpIfInventory("Unloading",1,"Unload")
		SHTN A 0 A_JumpIfInventory("StartDualWield",1,"ChangeShell")
		SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
	OkToFire:
		SHTN A 1 BRIGHT A_WeaponReady(WRF_ALLOWRELOAD)
		SHTN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		SHTN A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
        Goto Ready

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

	Deselect:
		SHTN A 0
		SHTN A 0 A_Takeinventory("Zoomed",1)
		SHTN A 0 A_TakeInventory("TossGrenade", 1)
		SHTN A 0 A_Takeinventory("ADSmode",1)
		SHTN A 0 A_Takeinventory("UseShotgunStrap",1)
        SHTN A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_SetCrosshair(0)
		SHSS DCBA 1 BRIGHT
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait

    Fire:
        SHTN A 0 A_Takeinventory("Reloading",1)
		SHTN A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
        SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,2)
        Goto NoAmmo
        TNT1 AAAA 0
		SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "Pump2")
        SHTN A 0 A_AlertMonsters
        SHTN A 0 A_PlaySound("weapons/sg", 1)
		RIFF A 0 A_FireCustomMissile("DistantFireSoundShotgun", random(-1,1), 0, 0, -12, 0, random(-1,1))
        SHTN A 0
		SHTN A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		TNT1 AAAAAAAAAAAAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-12,12), 0, -1, 0, 0, random(-9,9))
		TNT1 AAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles2", random(-12,12), 0, -1, 0, 0, random(-9,9))
		TNT1 AAAAA 0 A_FireCustomMissile("DecorativeTracer", random(-3,3), 0, 0, 0, 0, random(-3,3))
		SHTN A 0 A_Takeinventory("ShotgunAmmo",1)
		SHTA A 1
		SHTN A 0 A_FireBullets (2.7, 2.8, 4, 13, "ShotgunPuff", FBF_NORANDOM)
		SHTN A 0 A_FireBullets (2.7, 2.8, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
		SHTN A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 3)//Tactical Mode deals extra damage and recoil
		SHTN A 0 A_FireBullets (2.7, 2.8, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
		SHTN A 0 A_SetPitch(pitch-1.8)
		SHTN A 0 A_SetPitch(pitch-1.8)
		TNT1 A 0 A_ZoomFactor(0.98)
		SHTA B 1 BRIGHT
		TNT1 A 0 A_ZoomFactor(1.0)
		SHTA C 1 BRIGHT A_SetPitch(0.6 + pitch)
		SHTA DE 1 BRIGHT A_SetPitch(0.6 + pitch)
		SHTN A 1 BRIGHT
		Goto Pump1

   Pump1:
	   SHTN A 0
	   SHTN A 0 A_GiveInventory ("Pumping", 1)
	   SHTN A 0 A_GiveInventory ("GoSpecial", 1)

	   SHTN BCDEFG 1
	   SHTN A 0 A_FireCustomMissile("ShotCaseSpawn",40,0,14,0)
	   SHTN A 0 A_WeaponReady(WRF_NOFIRE| WRF_NOBOB)//Allows quick switch
	   SHTN H 1 A_PlaySound("weapons/sgpump", 3)
	   SHTN A 0 A_JumpIfInventory("TurboReload", 1, "PumpNoReload")//Tactical Mode is slower to pump
	   SHTN IJ 1 A_JumpIfInventory("Reloading",1,"InsertingShells")
	   SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,5)
	   SHTN A 0 A_JumpIfInventory("TurboReload", 1, 4)
	   SHTN A 0 A_Giveinventory("ShotgunWasEmpty",1)
	   SHTN A 0 A_JumpIfInventory("NoAutoReload", 1, 2)
	   Goto InsertingShells
	   TNT1 AA 0
	   SHTN KL 1 A_JumpIfInventory("Reloading",1,"InsertingShells")
	   SHTN KJIH 1 A_JumpIfInventory("Reloading",1,"InsertingShells")
	   SHTN A 0 A_Takeinventory("ShotgunWasEmpty",1)
	   SHTN GFEDC 1 A_JumpIfInventory("Kicking",1,"DoKick")
	   SHTN A 0 A_JumpIfInventory("Reloading",1,"InsertingShells")
	   SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,2)
	   SHTN A 0 A_JumpIfInventory("TurboReload", 1, "TurboReload")
	   SHTN A 0
	   Goto ReadyToFireAgain

   Pump2:
	   SHTN A 0
	   SHTN A 0 A_GiveInventory ("Pumping", 1)
	   SHTN A 0 A_GiveInventory ("GoSpecial", 1)
	   SHTN A 0 A_TakeInventory("Reloading", 1)
	   SHTN A 0 A_Takeinventory("Zoomed",1)
	   SHTN A 0 A_ZoomFactor(1.0)
	   RIFG A 0 A_SetCrosshair(0)
	   SHTN FG 1
	   SHTN H 1 A_PlaySound("weapons/sgpump", 3)
	   SHTN IJ 1
	   SHTN KL 1
	   SHTN KJIH 1
	   SHTN A 0 A_Takeinventory("ShotgunWasEmpty",1)
	   SHTN GFEDC 1 A_JumpIfInventory("Kicking",1,"DoKick")
	   Goto ReadyToFireAgain

	ReadyToFireAgain:
		//SHTN A 6 <-- Old frame
        SHTN A 1 BRIGHT Offset(10,36) // <-- New frames
        SHTN A 1 BRIGHT Offset(9,40) //
        SHTN A 1 BRIGHT Offset(4,40) //
        SHTN A 1 BRIGHT Offset(0,32) //
        SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		Goto Ready3

	Fire2:
		SHTN A 0 A_Takeinventory("Reloading",1)
        SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,1)
        Goto NoAmmo
		SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "Pump2")
        SHTN A 0 A_AlertMonsters
        SHTN A 0 A_PlaySound("weapons/sg", 1)
		SHTN A 0 A_SpawnItemEx("PlayerMuzzle1",32,0,28)
		SHT8 F 1 BRIGHT
		SHTN A 0 A_FireBullets (2.2, 2.3, 4, 13, "ShotgunPuff", FBF_NORANDOM)
		SHTN A 0 A_FireBullets (2.2, 2.3, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
		SHTN A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 3)//Tactical Mode deals extra damage and recoil
		SHTN A 0 A_FireBullets (2.2, 2.3, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
		SHTN A 0 A_SetPitch(pitch-0.9)
		SHTN A 0 A_SetPitch(pitch-0.9)
		SHTN A 0
		RIFF A 0 A_FireCustomMissile("DistantFireSoundShotgun", random(-1,1), 0, 0, -12, 0, random(-1,1))
		TNT1 AAAAA 0 A_FireCustomMissile("DecorativeTracer", random(-2,2), 0, 0, 0, 0, random(-2,2))
		SHTN A 0 A_Takeinventory("ShotgunAmmo",1)
		TNT1 A 0 A_ZoomFactor(1.29)
		SHT8 G 1 BRIGHT
		TNT1 A 0 A_ZoomFactor(1.3)
		SHT8 HIA 1 BRIGHT A_SetPitch(0.3 + pitch)
   Pump3:
		SHT8 A 2 BRIGHT
		SHTN A 0 A_JumpIfInventory("ShotgunAmmo", 1, 1)
		Goto NoAmmo3
		SHTN A 0 A_GiveInventory ("Pumping", 1)
		SHTN A 0 A_PlaySound("weapons/sgpump", 5)
		SHT8 JKLL 1 BRIGHT
		SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, 1)
		SHTN A 0 A_FireCustomMissile("ShotCaseSpawn",40,0,14,0)
		SHTN A 0 A_TakeInventory("ShotgunWasEmpty", 1)
		SHT8 LKJ 1 BRIGHT
		SHT8 A 1 BRIGHT
		SHTN A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")//If still pressing alt fire, it means its holding aim
		SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		Goto Ready2

	PumpNoReload:
	   SHTN IJ 1
	   SHTN KL 1
	   SHTN KJIH 1
	   SHTN A 0 A_Takeinventory("ShotgunWasEmpty",1)
	   SHTN GFEDC 1 A_JumpIfInventory("Kicking",1,"DoKick")
	   SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,2)
	   SHTN A 0 A_JumpIfInventory("TurboReload", 1, "TurboReload")
	   SHTN A 0
	   Goto ReadyToFireAgain

	AltFire:
        SHTN A 0
		SHTN A 0 A_Giveinventory("GoSpecial",1)
		SHTN A 0 A_JumpIfInventory("Zoomed",1,"NoAim")
		SHTN A 0 A_Giveinventory("Zoomed",1)
        SHTN A 0 A_ZoomFactor(1.3)
		SHTN A 0 A_Giveinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(41)
        SHT8 ED 1 BRIGHT
		SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "Pump3")
        SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SHT8 A 1 BRIGHT
		SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SHT8 A 1 BRIGHT
		SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SHT8 A 1 BRIGHT
		SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SHT8 A 1 BRIGHT
		SHTN A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")
        Goto Ready2

	   HoldAim:
	    SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SHT8 A 1 BRIGHT A_WeaponReady(WRF_ALLOWRELOAD)
		SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SHT8 A 1 BRIGHT A_WeaponReady(WRF_ALLOWRELOAD)
		SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SHT8 A 1 BRIGHT A_WeaponReady(WRF_ALLOWRELOAD)
		SHTN A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SHT8 A 1 BRIGHT A_WeaponReady(WRF_ALLOWRELOAD)
		SHTN A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")

	NoAim:
        TNT1 AAAAAA 0
		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)
		SHT8 DE 1 BRIGHT
        Goto Ready

	StartSprint:
		SHTN A 1 BRIGHT 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:
		STRN A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		STRN A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		STRN A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		STRN A 1 offset(0,38) A_SetPitch(pitch -0.5)
		STRN A 1 offset(3,36) A_SetPitch(pitch -0.5)
		STRN A 1 offset(6,34) A_SetPitch(pitch -0.5)
		STRN A 1 offset(9,32) A_SetPitch(pitch -0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 2)
		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")

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

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

    ReloadWithNoAmmoLeft:
    Reload:
	    SHTN A 0
		SHTN A 0 A_TakeInventory("Reloading", 1)
		SHTN A 0 A_JumpIfInventory("AmmoShell", 1, 2)
		Goto Ready
		SHTN A 0
	    SHTN A 0 A_Takeinventory("Zoomed",1)
        SHTN A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_SetCrosshair(0)
		SHTN A 1 BRIGHT A_WeaponReady
		SHTN A 0 A_JumpIfInventory("ShotgunAmmo",9,"OkToFire")
		SHTN A 0 A_JumpIfInventory("ShotgunAmmo", 1, "ReloadNormally")//Check if there is a shell in the chamber
		SHTN A 0 A_GiveInventory("ShotgunWasEmpty", 1)//This means there is no shell in the chamber

	ReloadNormally:
        SHTN A 0 A_JumpIfInventory("AmmoShell",1,1)//If there is no reserve ammo, don't reload, go back to Ready
        Goto Ready
		SHTN A 0 A_Takeinventory("ShotgunUnloaded",1)
		SHTN A 0 A_JumpIfInventory("TurboReload", 1, "TurboReload")//Check if reloads are disabled.
		SHTN B 1 A_GiveInventory ("Pumping", 1)
		SHTN CDE 1 A_WeaponReady(WRF_NOBOB)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")

	 InsertingShells:
		SHTN A 0
		SHTN A 0 A_JumpIfInventory("AmmoShell",1,1)//if there are no more reserve shells, finish reload.
        Goto FinishedInsertingShells
		SHTN A 0
		SHTN A 0 A_GiveInventory ("Pumping", 1)
		SSHR A 0 A_TakeInventory("Reloading", 1)
        SHTN A 0 A_JumpIfInventory("ShotgunAmmo",8,"CheckIfFinishReload")
        SHTN A 0 A_Giveinventory("ShotgunAmmo",1)
		SHTN A 0 A_Takeinventory("AmmoShell",1)

	InsertShellAnimation:
		SHTN A 0
		SSHR AABC 1 A_WeaponReady(WRF_NOBOB)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SSHR A 0 A_PlaySound("insertshell")
		SSHR DEFH 1 A_WeaponReady(WRF_NOBOB)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SHTN A 0 A_JumpIfInventory("ShotgunAmmo",9,"FinishedInsertingShells")//If there are 8+1 shells, stop it immediately
        Goto InsertingShells

	CheckIfFinishReload:
		SSHR A 1
		SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "FinishedInsertingShells")//If shotgun was empty,
		//Play the insert shell animation again, and insert the 9th shell
		SHTN A 0 A_JumpIfInventory("AmmoShell",1,1)//if there are no more reserve shells, finish reload.
        Goto Pump2
		SHTN A 0 A_Giveinventory("ShotgunAmmo",1)
		SHTN A 0 A_Takeinventory("AmmoShell",1)
        Goto InsertShellAnimation

	FinishedInsertingShells:
		SHTN A 0 A_Takeinventory("Reloading",1)
		SHTN A 0 A_JumpIfInventory("ShotgunWasEmpty", 1, "Pump2")
		SHTN EDCBA 1
		TNT1 A 0 A_TakeInventory("ShotgunChangeAmmo",1)
		SHTN A 1 A_Takeinventory("Reloading",1)
		Goto Ready

	ChangeShell:
		SHTN A 1 BRIGHT
		TNT1 A 0 A_TakeInventory("StartDualWield", 1)
		TNT1 A 0 A_GiveInventory("ShotgunChangeAmmo", 1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(0)
		TNT1 A 0 A_JumpIfInventory("AmmoSlug", 1, "Unload")
		Goto NoSlugs

	NoSlugs:
		TNT1 A 0 A_Print("You are out of shotgun slugs.", 2)
		SHTN A 0 A_TakeInventory("ShotgunChangeAmmo",1)
		SHTN A 3 BRIGHT
		Goto Ready

	 TurboReload:
		SHTN A 0
	TurboInsertShells:
		SHTN A 0 A_JumpIfInventory("AmmoShell",1,2)//if there are no more reserve shells, finish reload.
        Goto FinishTurboReload
		SHTN A 0
		SHTN A 0 A_GiveInventory ("Pumping", 1)
		SSHR A 0 A_TakeInventory("Reloading", 1)
        SHTN A 0 A_JumpIfInventory("ShotgunAmmo",9,"FinishTurboReload")
        SHTN A 0 A_Giveinventory("ShotgunAmmo",1)
		SHTN A 0 A_Takeinventory("AmmoShell",1)
		Goto TurboInsertShells
	FinishTurboReload:
		SHTN A 0 A_Takeinventory("Reloading",1)
		SHTN A 1 A_JumpIfInventory("ShotgunWasEmpty", 1, "Pump2")
		Goto Ready

	Unload:
		SHTN A 1 BRIGHT
		SHTN A 0 A_ZoomFactor(1.0)
		SHTN A 0 A_Takeinventory("Unloading",1)
		SHTN A 0 A_Takeinventory("ADSmode",1)
		SHTN A 0 A_Takeinventory("Zoomed",1)
		RIFG A 0 A_SetCrosshair(0)
        SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,2)
		TNT1 A 0 A_JumpIfInventory("ShotgunChangeAmmo", 1, "FinishUnload")
        Goto Ready
        TNT1 AAA 0
		SHTN A 0 A_Takeinventory("Zoomed",1)
		SHTN A 0 A_GiveInventory ("Pumping", 1)
		SHTN A 0 A_Takeinventory("Unloading",1)
		SHTN ABCDEF 1 A_WeaponReady(WRF_NOBOB)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")

	RemoveBullets:
		TNT1 AAAA 0
		SHTN A 0 A_JumpIfInventory("ShotgunAmmo",1,3)
		Goto FinishUnload
        TNT1 AAAAAA 0
		SHTN A 0 A_Takeinventory("ShotgunAmmo",1)
		SHTN A 0 A_Giveinventory("AmmoShell",1)
		SHTN G 1
		SHTN H 1 A_PlaySound("weapons/sgpump", 3)
		SHTN IJKLKJIHGF 1 A_WeaponReady(WRF_NOBOB)
		A12R A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		Goto RemoveBullets

	FInishUnload:
		SHTN EDCBA 1
		SHTN A 0 A_Takeinventory("Unloading",1)
		SHTN A 0 A_GiveInventory("ShotgunUnloaded",1)
		SHTN A 0 A_Giveinventory("ShotgunWasEmpty",1)
		TNT1 A 0 A_JumpIfInventory("ShotgunChangeAmmo", 1, "ChangeAmmo")
		Goto OkToFire

	ChangeAmmo:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory("Shot_Gun2")
		TNT1 A 0 A_GiveInventory("Reloading",1)
		TNT1 A 0 A_SelectWeapon("Shot_Gun2")
		Goto Ready3

	DoKickReloading:
		NULL A 0 A_JumpIf (momZ > 0, "AirKick")
		NULL A 0 A_JumpIf (momZ < 0, "AirKick")
        SHTN A 0 A_PlaySound("KICK")
		SHTN A 0 SetPlayerProperty(0,1,0)
		KICK BCD 1
		RIFF A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        KICK H 3
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK I 1
		KICK GFEDCBA 1
		RIBA A 0 A_Takeinventory("Kicking",1)
		SHTN A 0 SetPlayerProperty(0,0,0)
		Goto FinishedInsertingShells

	Steady:
		TNT1 A 1
		Goto Ready

	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")
		SHTN A 5 BRIGHT 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("AmmoShell",1,"Reload")
		RIFG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Goto Ready3

	NoAmmo3:
		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")
		SHT8 A 4 BRIGHT A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
		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("AmmoShell",1,"Reload")
		RIFG A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Goto Ready2
	}
}

ACTOR ShotgunAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 9
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 9
   Inventory.Icon "SHTCA0"
}