// ------------------------------------------------------------
//   Shotgun
// ------------------------------------------------------------

ACTOR Hunter : HDWeapon
{
	Decal "BulletScratchSmall"
	Weapon.SelectionOrder 202
	weapon.ammotype ShotgunTube
	weapon.ammotype2 ShotgunQuickAmmo
	weapon.kickback 30
	Obituary "%o was brutally pumped full of %k's hot, manly lead."
	States
	{
	Select:
		SHTG A 1 A_Raise
		SHTG A 0 A_Raise
		loop
	Deselect:
		SHTG A 0 A_TakeInventory ("Reloading", 999)
		SHTG A 1 A_Lower
		SHTG A 0 A_Lower
		goto Deselect+1
	Ready:
		SHTG A 1 A_WeaponReady(16)
		TNT1 A 0 A_TakeInventory("IsInterrupting",999)
		TNT1 A 0 A_JumpIfInventory("NotShot",140,"FillMag")
		TNT1 A 0 A_GiveInventory("NotShot",1)
		SHTG A 0 A_JumpIfInventory ("NoChamberedShotgun", 1, 1)
		goto Ready
		SHTG A 0 A_JumpIfInventory ("ShotgunTube", 1, "Chamber")
		goto Ready
	FillMag:
		RIFG A 0 A_TakeInventory("NotShot",50)
		RIFG A 0 A_JumpIfInventory("ShotgunQuickAmmo",0,"Ready")
		RIFG A 0 A_JumpIfInventory("Shell",1,1)
		goto Ready
		RIFG A 0 A_GiveInventory("ShotgunQuickAmmo",1)
		RIFG A 0 A_TakeInventory("Shell",1)
		goto Ready
	AltFire:
	AltHold:
	Fire:
	Hold:
		SHTG A 0 A_JumpIfInventory ("Reloading", 1, "Interrupt")
		TNT1 A 0 A_JumpIfInventory("IsInterrupting",1,1)
		goto Shoot
		SHTG E 4
		SHTG A 0 A_Refire
		goto Ready
	Interrupt:
		SHTG D 0 A_TakeInventory("ShotgunHand",999)
		SHTG D 0 A_GiveInventory("IsInterrupting",1)
		SHTG D 1 offset(0,34) A_PlayWeaponSound ("weapons/huntopen")
		SHTG D 1 offset(0,36)
		SHTG D 1 offset(0,34)
		SHTG CB 3
		SHTG A 3 A_TakeInventory ("Reloading", 999)
		goto Ready

	Shoot:
		SHTG A 3 A_JumpIfInventory ("NoChamberedShotgun", 1, "Chamber")
		SHTG A 0 A_GunFlash
		TNT1 AAAAA 0 A_FireBullets (1.7, 1.7, -1, 5, "BulletPuffSmall", 0, 48*40+random(-256,256))
		TNT1 AAA 0 A_FireBullets (1.5, 1.5, -1, 7, "BulletPuffSmall", 0, 48*60+random(-256,256))
		SHTG A 4 A_PlayWeaponSound ("weapons/hunter")
		SHTG E 2 ACS_Execute (553, 0, 64, ((random(0, 1)*2-1)*24), 0)
		SHTG A 0 A_JumpIfInventory ("ShotgunTube", 1, "Chamber")
		goto Ready
	Chamber:
		SHTG A 0 A_TakeInventory ("Reloading", 999)
		SHTG A 0 A_JumpIfInventory ("ShotgunTube", 1, 1)
		goto Ready
		SHTG AE 2
		SHTG E 1 A_PlaySound ("weapons/shotgr")
	ChamberFillEmpty:
		SHTG F 0 A_TakeInventory ("NoChamberedShotgun", 999)
		SHTG F 0 A_JumpIfInventory("HunterSpentShell",1,"ChamberEject")
		goto ChamberEnd
	ChamberEject:
		SHTG F 0 A_FireCustomMissile("HDSpentShellEjectorPump")
		SHTG F 0 A_TakeInventory ("HunterSpentShell", 999)
	ChamberEnd:
		SHTG F 3
		SHTG EA 2
		SHTG A 3 A_ReFire
		goto Ready
	Flash:
		SHTF A 2 bright A_Light1
		SHTF A 0 A_ZoomFactor(0.98,ZOOM_INSTANT|ZOOM_NOSCALETURNING)
		TNT1 A 0 A_SpawnItem ("DistantShotgun", 1, 1, 0, 0)
		SHTF B 2 bright A_Light2
		SHTF B 0 A_ZoomFactor(1.0,ZOOM_INSTANT|ZOOM_NOSCALETURNING)
		SHTF B 0 A_AlertMonsters
		SHTF B 0 bright A_Light0
		SHTF B 0 A_TakeInventory ("ShotgunTube", 1)
		SHTF B 0 A_GiveInventory ("NoChamberedShotgun", 1)
		SHTF B 0 A_GiveInventory ("HunterSpentShell", 1)
		Stop
	Reload:
		SHTG A 0 A_JumpIfInventory ("ShotgunTube", 0, 2)
		SHTG A 0 A_Jump (256, 2)
		SHTG A 0 A_TakeInventory ("Reloading", 999)
		goto Ready

		SHTG A 1
		SHTG A 0 A_JumpIfInventory("ShotgunQuickAmmo", 1, 3)
		SHTG A 0 A_JumpIfInventory("Shell", 1, 2)
		SHTG A 1 A_TakeInventory ("Reloading", 999)
		goto Ready
		SHTG BC 4
		SHTG D 1 A_GiveInventory ("Reloading", 1)
		SHTG D 0 A_PlayWeaponSound ("weapons/huntopen")
	Reload1:
		SHTG D 1 offset(0,34)
		SHTG D 1 offset(0,36)
		SHTG D 1 offset(0,38)
		SHTG D 10 offset (0,40) //A_PlaySound ("weapons/pocket")
		SHTG D 0 A_JumpIfInventory("ShotgunQuickAmmo",1,3)
		SHTG D 8 offset (0,42) A_PlaySound ("weapons/pocket")
		SHTG D 20 offset (0,41) A_PlaySound ("weapons/pocket")

		SHTG E 0 A_JumpifHealthLower(40,"FastLoad1")
		SHTG E 0 A_JumpifInventory("ShotgunTube",7,"FastLoad1")
		SHTG E 0 A_JumpifInventory("ShotgunQuickAmmo",1,1)
		goto FastLoad1
		SHTG E 0 A_JumpifHealthLower(60,"FastLoad2")
		SHTG E 0 A_JumpifInventory("ShotgunTube",6,"FastLoad2")
		goto FastLoad3
	FastLoad1:
		SHTG D 2 offset (0,40) A_GiveInventory("ShotgunHand", 1)
		goto Reload1end
	FastLoad2:
		SHTG D 2 offset (0,40) A_GiveInventory("ShotgunHand", 2)
		goto Reload1end
	FastLoad3:
		SHTG E 0 A_JumpifInventory("ShotgunQuickAmmo",3,2)
		SHTG E 0 A_JumpifInventory("ShotgunQuickAmmo",2,"FastLoad2")
		goto FastLoad1
		SHTG D 2 offset (0,40) A_GiveInventory("ShotgunHand", 3)
		goto Reload1end
	Reload1end:
		SHTG D 3 offset(0,35)

	Reload2:
		SHTG E 0 A_JumpIfInventory ("ShotgunQuickAmmo", 1, 2)
		SHTG E 0 A_JumpIfInventory ("Shell", 1, 1)
		goto Reload3
		SHTG E 0 A_JumpIfInventory("ShotgunHand", 1,1)
		goto Reload1

		SHTG E 0 A_JumpIfInventory ("ShotgunTube", 0, "Reload3")
		SHTG E 0 A_JumpIfInventory ("ShotgunTube", 1, 1)
		goto ReloadChamber
	Reload2a:
		SHTG E 0 A_PlayWeaponSound ("weapons/huntreload")
		SHTG D 0 A_TakeInventory("ShotgunHand",1)
		SHTG D 2 offset(0,36)
		TNT1 A 0 A_JumpIfInventory("ShotgunQuickAmmo",1,2)
		TNT1 A 0 A_Jump(256,3)
		TNT1 A 0 A_TakeInventory("ShotgunQuickAmmo",1)
		TNT1 A 0 A_Jump(256,2)
		TNT1 A 0 A_TakeInventory("Shell",1)
		SHTG D 4 offset(0,34) A_GiveInventory("ShotgunTube",1)//ACS_Execute (554, 0, 1, 1, 0)

		SHTG DDDDDD 1 offset(0,33) A_WeaponReady//(WRF_NOBOB)
		SHTG E 0 A_JumpIfInventory ("Reloading", 1, 1)
		goto Reload3
		SHTG E 0 A_JumpIfInventory("ShotgunHand",1,"Reload2")
		TNT1 A 0 A_JumpIfInventory("ShotgunTube",0,"Reload3")
		goto Reload1
	Reload3:
		SHTG D 0 A_TakeInventory("ShotgunHand",999)
		SHTG D 6 offset(0,34) A_TakeInventory ("Reloading", 999)
		SHTG D 2 offset(0,34) A_PlayWeaponSound ("weapons/huntopen")
		SHTG D 1 offset(0,36)
		SHTG D 1 offset(0,34)
		SHTG CB 4
		goto Ready
	ReloadChamber:
		SHTG F 0 A_TakeInventory ("NoChamberedShotgun", 999)
		SHTG F 0 A_JumpIfInventory("HunterSpentShell",1,1)
		goto Reload2a
		SHTG C 6 A_FireCustomMissile("HDSpentShellEjectorPump")
		SHTG F 0 A_TakeInventory ("HunterSpentShell", 999)
		goto Reload2a
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("ShotgunPickupDropped", 0,0,0,velx,vely,velz,0,32,0)
		stop
		HUNT A -1
		stop
	}
}
ACTOR ShotgunHand : Ammo
{
	+inventory.ignoreskill
	+inventory.undroppable
	inventory.maxamount 3
	ammo.backpackmaxamount 3
	ammo.backpackamount 0
}
ACTOR ShotgunTube : Ammo
{
	+inventory.ignoreskill
	+inventory.undroppable
	inventory.maxamount 8
	ammo.backpackmaxamount 8
	ammo.backpackamount 0
}
ACTOR ShotgunQuickAmmo : Ammo
{
	+inventory.ignoreskill
	+inventory.undroppable
	inventory.maxamount 12
	ammo.backpackmaxamount 12
	ammo.backpackamount 0
}
ACTOR ShotgunQuickAmmo2 : Ammo
{
	+inventory.ignoreskill
	+inventory.undroppable
	inventory.maxamount 12
	ammo.backpackmaxamount 12
	ammo.backpackamount 0
}

actor HunterSpentShell : InventoryFlag {}
actor SlayerSpentShell : InventoryFlag
{
	inventory.maxamount 2
}
actor HDSpentShell
{
	+missile
	+doombounce
	+bounceonactors
	+noteleport
	+forcexybillboard
	scale 0.6
	height 1
	radius 1
	states
	{
	spawn:
		ESHL ABCDEFGH 2
		loop
	death:
		TNT1 A 0 A_ChangeFlag("missile",0)
		TNT1 A 0 A_ChangeFlag("doombounce",0)
		TNT1 A 0 A_Jump (256, 1,1,1,1,2,2,2,2,3,3,4)
		ESHL A 500
		stop
		ESHL E 500
		stop
		ESHL C 500
		stop
		ESHL G 500
		stop
	}
}
actor HDUnSpentShell : HDSpentShell
{
	scale 0.6
	states
	{
	spawn:
		ESHL ABCDE 2
		TNT1 A 0 A_GiveToTarget("Shell",1)
		stop
	}
}
actor HDFumblingShell : HDSpentShell
{
	scale 0.6
	states
	{
	spawn:
		ESHL ABCDEFGH 2
		loop
	death:
		TNT1 A 0 A_SpawnItemEx("HDFumbledShell",0,0,0,velx,vely,velz,0,SXF_ABSOLUTEMOMENTUM|SXF_NOCHECKPOSITION)
		stop
	}
}
actor HDFumbledShell : HDPickup
{
	scale 0.6
	inventory.pickupmessage "Found a stray shotgun shell."
	states
	{
	spawn:
		TNT1 A 0 A_Jump (256, 1,1,1,1,2,2,2,2,3,3,4)
		ESHL A 500
		stop
		ESHL E 500
		stop
		ESHL C 500
		stop
		ESHL G 500
		stop
	pickup:
		TNT1 A 0 A_JumpIfInventory ("CanPickUpItems", 1, 1)
		fail
		TNT1 A 0 A_GiveInventory ("Shell", 1)
		stop
	}
}
actor HDSpentShellEjectorPump : IdleDummy
{
	+missile
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("HDSpentShell", 12,1,-1, random(-2,-4),random(6,12),random(-2,2), 0,160)
		stop
	}
}
actor HDSpentShellEjectorSide : HDSpentShellEjectorPump
{
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("HDSpentShell", 8,-2,-1, random(1,-2),random(-1,-3),random(-1,4), 0,160)
		stop
	}
}
actor HDUnSpentShellEjectorSide : HDSpentShellEjectorPump
{
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("HDUnSpentShell", 4,-2,-1, random(0,-2),random(0,-3),random(0,4), 0,160)
		stop
	}
}
actor HDFumblingShellEjectorSide : HDSpentShellEjectorPump
{
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("HDFumblingShell", 4,-2,-1, random(0,-2),random(0,-3),random(0,4), 0,160)
		stop
	}
}

actor ShotgunPickup : HDWeaponPickup replaces Shotgun
{
	scale 0.6
	inventory.pickupmessage "You got the pump-action shotgun!"
	states
	{
	spawn:
		HUNT A -1
		stop
	Pickup:
		TNT1 A 0 A_JumpIfInventory ("CanPickUpItems", 1, 1)
		fail
		HUNT A 0 A_JumpIfInventory ("Hunter", 1, 1)
		goto Pickup0
		HUNT A 0 A_JumpIfInventory ("Shell", 0, 1)
		goto Pickup0
		HUNT A 0
		fail
	Pickup0:
		HUNT A 0 A_GiveInventory ("ShotgunPickupRounds", random(8,9))
	Pickup0a:
		HUNT A 0 A_JumpIfInventory ("Hunter", 1, 2)
		HUNT A 0 A_GiveInventory ("Hunter", 1)
		goto Pickup2
	Pickup1:
		HUNT A 0 A_GiveInventory ("Shell", 1)
		HUNT A 0 A_TakeInventory ("ShotgunPickupRounds", 1)
		HUNT A 0 A_JumpIfInventory ("ShotgunPickupRounds", 1, 1)
		stop
		HUNT A 0
		loop
	Pickup2:
		HUNT A 0 A_JumpifInventory("ShotgunPickupRounds",9,"Pickup2a")
		HUNT A 0 A_Jump (192, 2)
		HUNT A 0 A_GiveInventory("NoChamberedShotgun",1)
	Pickup2a:
		HUNT A 0 A_GiveInventory ("ShotgunTube", 1)
		HUNT A 0 A_TakeInventory ("ShotgunPickupRounds", 1)
		HUNT A 0 A_JumpIfInventory ("ShotgunPickupRounds", 1, 1)
		stop
		HUNT A 0
		loop
	}
}
actor ShotgunPickupRounds : Ammo
{
	+inventory.undroppable
	inventory.maxamount 9
	ammo.backpackmaxamount 9
	ammo.backpackamount 0
}
actor ShotgunPickupDropped : ShotgunPickup //replaces Hunter
{
	states
	{
	Pickup:
		TNT1 A 0 A_JumpIfInventory ("CanPickUpItems", 1, 1)
		fail
		HUNT A 0 A_JumpIfInventory ("Hunter", 1, 1)
		goto Pickup0
		HUNT A 0 A_JumpIfInventory ("Shell", 0, 1)
		goto Pickup0
		HUNT A 0
		fail
	Pickup0:
		HUNT A 0 A_GiveInventory ("ShotgunPickupRounds", random(1,random(4,9)))
		goto Pickup0a
	}
}

// ------------------------------------------------------------
//   Super Shotgun
// ------------------------------------------------------------

ACTOR Slayer : HDWeapon
{
	weapon.selectionorder 203
	weapon.ammotype "ShellChamber"
	weapon.ammotype2 "ShotgunQuickAmmo2"
	weapon.kickback 35
	Decal "BulletScratchSmall"
	Obituary "%o was brutally pumped full of %k's hot, manly lead."
	States
	{
	Ready:
		SHT2 A 1 A_WeaponReady(16)
		SHT2 A 0 A_JumpIfInventory ("Reloading", 1, "Reload")
		TNT1 A 0 A_JumpIfInventory("NotShot",140,"FillMag")
		TNT1 A 0 A_GiveInventory("NotShot",1)
		loop
	FillMag:
		RIFG A 0 A_TakeInventory("NotShot",50)
		RIFG A 0 A_JumpIfInventory("ShotgunQuickAmmo2",0,"Ready")
		RIFG A 0 A_JumpIfInventory("Shell",1,1)
		goto Ready
		RIFG A 0 A_GiveInventory("ShotgunQuickAmmo2",1)
		RIFG A 0 A_TakeInventory("Shell",1)
		goto Ready
	Select:
		SHT2 A 1 A_Raise
		SHT2 AAA 0 A_Raise
		loop
	Deselect:
		TNT1 A 0 A_TakeInventory ("Reloading", 999)
		SHT2 A 1 A_Lower
		SHT2 AAA 0 A_Lower
		goto Deselect+1
	AltFire:
	AltHold:
		TNT1 A 0 A_JumpIfInventory ("ShellChamber", 1, 3)
		SHT2 K 4
		SHT2 A 0 A_Refire
		goto Ready
		TNT1 A 0 A_JumpIfInventory ("ShellChamber", 2, 1)
		goto Fire

		SHT2 A 4
		SHT2 A 0 A_GunFlash
		TNT1 AAAAAAAAA 0 A_FireBullets (1.8, 1.6, -1, 7, "BulletPuffSmall", 0, 48*50+random(-256,256))
		TNT1 AAAAAAA 0 A_FireBullets (1.6, 1.4, -1, 8, "BulletPuffSmall", 0, 48*65+random(-256,256))
		SHT2 A 3

		SHT2 K 2 ACS_Execute (553, 0, 84, ((random(0, 1)*2-1)*24), 0)
		SHT2 A 4
		SHT2 A 0 A_Refire
		goto Ready
	AltFlash:
		TNT1 A 0 A_JumpIfInventory ("ShellChamber", 2, 1)
		goto Flash
		SHT2 I 0 A_TakeInventory ("ShellChamber", 2)
		TNT1 A 0 A_GiveInventory("SlayerSpentShell",2)
		SHT2 I 2 BRIGHT A_Light2
		SHT2 I 0 A_ZoomFactor(0.97,ZOOM_INSTANT|ZOOM_NOSCALETURNING)
		SHT2 I 0 A_PlayWeaponSound ("weapons/slayerdouble")
		TNT1 AA 0 A_SpawnItem ("DistantShotgun", 1, 1, 0, 0)
		SHT2 I 0 A_AlertMonsters
		SHT2 J 2 BRIGHT A_Light1
		SHT2 J 0 A_ZoomFactor(1.0,ZOOM_INSTANT|ZOOM_NOSCALETURNING)
		SHT2 J 0 BRIGHT A_Light0
		Stop

	Fire:
		TNT1 A 0 A_TakeInventory("SSGDoubleClickSafety",999)
	Hold:
		TNT1 A 0 A_JumpIfInventory ("ShellChamber", 1, 3)
		SHT2 K 4
		SHT2 A 0 A_Refire
		goto Ready
		TNT1 A 0 A_JumpIfInventory ("ShellChamber", 2, "FirstFire")	//skip this nonsense for the first shot
		TNT1 A 0 A_JumpIfInventory ("SSGDoubleClickSafety", 1, 1)	//countdown between shots while holding
		goto ReallyFire
		SHT2 A 8 A_TakeInventory("SSGDoubleClickSafety",999)	//this is how long the auto-shot delay is
		SHT2 A 0 A_Refire
		goto Ready

	FirstFire:
		TNT1 A 0 A_GiveInventory("SSGDoubleClickSafety",1)
		goto ReallyFire

	ReallyFire:
		SHT2 A 2
		SHT2 A 0 A_GunFlash
		SHT2 AAAA 0 A_FireBullets (1.6, 1.6, -1, 6, "BulletPuffSmall", 0, 48*50+random(-256,256))
		SHT2 AAAA 0 A_FireBullets (1.4, 1.4, -1, 8, "BulletPuffSmall", 0, 48*65+random(-256,256))
		SHT2 A 2

		SHT2 K 0 A_JumpIfInventory ("ShellChamber", 1, 3)
		SHT2 K 1 ACS_Execute (553, 0, 78, 32, 0)
		SHT2 K 0 A_Jump (256, 2)
		SHT2 K 1 ACS_Execute (553, 0, 78, -32, 0)
		SHT2 A 0 A_Refire
		goto Ready
	Flash:
		TNT1 A 0 A_ZoomFactor(0.98,ZOOM_INSTANT|ZOOM_NOSCALETURNING)

		TNT1 A 0 A_JumpIfInventory ("ShellChamber", 2, 3)
		SHT1 M 1 BRIGHT A_Light2
		TNT1 A 0 A_Jump (256, 2)
		SHT1 I 1 BRIGHT A_Light2

		TNT1 A 0 A_JumpIfInventory ("ShellChamber", 2, 3)
		TNT1 A 0 A_PlaySoundEx ("weapons/slayersingle","SoundSlot5")
		TNT1 A 0 A_Jump (256, 2)
		TNT1 A 0 A_PlaySoundEx ("weapons/slayersingle","SoundSlot6")

		TNT1 A 0 A_SpawnItem ("DistantShotgun", 1, 1, 0, 0)
		TNT1 A 0 A_AlertMonsters

		TNT1 A 0 A_JumpIfInventory ("ShellChamber", 2, 3)
		SHT1 N 1 BRIGHT A_Light1
		TNT1 A 0 A_Jump (256, 2)
		SHT1 J 1 BRIGHT A_Light1

	FlashEnd:
		TNT1 A 0 A_ZoomFactor(1.0,ZOOM_INSTANT|ZOOM_NOSCALETURNING)
		TNT1 A 0 A_TakeInventory ("ShellChamber", 1)
		TNT1 A 0 A_GiveInventory("SlayerSpentShell",1)
		TNT1 A 0 BRIGHT A_Light0
		Stop

	Reload:
		SHT2 A 0 A_JumpIfInventory ("ShellChamber", 2, 2)
		TNT1 A 0 A_Jump (256, 2)
		SHT2 A 0 A_TakeInventory("Reloading",999)
		goto Ready
		SHT2 A 0 A_JumpIfInventory ("ShotgunQuickAmmo2", 1, 3)
		SHT2 A 0 A_JumpIfInventory ("Shell", 1, 2)
		SHT2 A 0 A_TakeInventory("Reloading",999)
		goto Ready

		SHT2 K 2 offset(0,34)
		SHT2 K 2 offset(0,40)
		SHT2 K 12 offset(0,46) A_PlaySound ("weapons/sshoto")

	EjectEmpty:
		SHT2 K 0 A_FireCustomMissile("HDSpentShellEjectorSide")
		SHT2 K 0 A_TakeInventory ("SlayerSpentShell", 1)
		TNT1 A 0 A_JumpIfInventory ("SlayerSpentShell", 1, "EjectEmpty")
		TNT1 A 0 A_JumpIfInventory ("ShellChamber", 1, "ReloadHalfFull")
		goto ReloadEmpty

	ReloadHalfFull:
		SHT2 K 0 A_TakeInventory ("ShellChamber", 1)
		SHT2 K 0 A_JumpIfInventory("IsMoving",1,"ReloadHalfFullFumble")
		SHT2 K 0 A_JumpIfInventory("Backpack",1,2)
		SHT2 K 0 A_JumpIfInventory("Shell",35,"ReloadHalfFullFumble")
		SHT2 K 0 A_JumpIfInventory("Shell",71,"ReloadHalfFullFumble")
		SHT2 K 0 A_JumpIfHealthLower(66,2)
		SHT2 K 0 A_FireCustomMissile("HDUnSpentShellEjectorSide")
		goto ReloadEmpty
	ReloadHalfFullFumble:
		SHT2 K 0 A_FireCustomMissile("HDFumblingShellEjectorSide")
		goto ReloadEmpty

	ReloadEmpty:
		SHT2 L 3 offset(0,36)
		SHT2 L 6 offset(0,34) //A_PlaySound ("weapons/pocket")
		TNT1 A 0 A_JumpIfInventory("ShotgunQuickAmmo2",2,3)
		SHT2 L 10 offset(0,36) A_PlaySound ("weapons/pocket")
		SHT2 L 14 offset(0,35) A_PlaySound ("weapons/pocket")
		SHT2 L 12 offset(0,34)
		SHT2 E 8
		SHT2 F 7 A_PlayWeaponSound ("weapons/sshotl")
		goto ReloadEnd

	ReloadEnd:
		TNT1 A 0 A_JumpIfInventory("ShotgunQuickAmmo2",1,2)
		TNT1 A 0 A_Jump(256,3)
		TNT1 A 0 A_TakeInventory("ShotgunQuickAmmo2",1)
		TNT1 A 0 A_Jump(256,2)
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_GiveInventory("ShellChamber",1)
	ReloadEnd2:
		TNT1 A 0 A_JumpIfInventory("ShotgunQuickAmmo2",1,2)
		TNT1 A 0 A_Jump(256,3)
		TNT1 A 0 A_TakeInventory("ShotgunQuickAmmo2",1)
		TNT1 A 0 A_Jump(256,4)
		TNT1 A 0 A_JumpIfInventory("Shell",1,2)
		TNT1 A 0 A_Jump(256,3)
		TNT1 A 0 A_TakeInventory("Shell",1)
		TNT1 A 0 A_GiveInventory("ShellChamber",1) //ACS_ExecuteAlways(554, 0, 6, 2)
		SHT2 G 6 A_TakeInventory ("Reloading", 999)
		SHT2 H 0 A_PlayWeaponSound ("weapons/sshotc")
		SHT2 HA 5
		Goto Ready
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("SuperShotgunPickup", 0,0,0,velx,vely,velz,0,32,0)
		stop
		SLAY A -1
		stop
	}
}
ACTOR ShellChamber : Ammo
{
	+inventory.ignoreskill
	+inventory.undroppable
	inventory.maxamount 2
	ammo.backpackmaxamount 2
	ammo.backpackamount 0
}
actor SSGDoubleClickSafety : InventoryFlag {}

actor SuperShotgunPickup : HDWeaponPickup replaces SuperShotgun
{
	scale 0.6
	inventory.pickupmessage "You got the double-barreled shotgun!"
	inventory.pickupsound "misc/w_pkup"
	states
	{
	spawn:
		TNT1 A 0
		SLAY A -1 A_SpawnItem ("Shell", random(20, -20))
		stop
	Pickup:
		TNT1 A 0 A_JumpIfInventory ("CanPickUpItems", 1, 1)
		fail
		SLAY A 0 A_JumpIfInventory ("Slayer", 1, 2)
		SLAY A 0 A_Jump (256, 4)
		SLAY A 0 A_JumpIfInventory ("Shell", 0, 2)
		SLAY A 0 A_Jump (256, 2)
		SLAY A 0
		fail
		SLAY A 0 A_Jump(12, 3)
		SLAY A 0 A_JumpIfInventory ("ShotgunPickupRounds", 2, 2)
		SLAY A 0 A_GiveInventory ("ShotgunPickupRounds", 1)
		loop
		SLAY A 0 A_JumpIfInventory ("Slayer", 1, "Pickup1")
		SLAY A 0 A_GiveInventory ("Slayer", 1)
		goto Pickup2
	Pickup1:
		SLAY A 0 A_GiveInventory ("Shell", 1)
		SLAY A 0 A_TakeInventory ("ShotgunPickupRounds", 1)
		SLAY A 0 A_JumpIfInventory ("ShotgunPickupRounds", 1, 1)
		stop
		SLAY A 0
		loop
	Pickup2:
		SLAY A 0 A_Jump (128, 2)
		SLAY A 0 A_GiveInventory ("ShellChamber", 1)
		SLAY A 0 A_GiveInventory ("ShellChamber", 1)
		SLAY A 0 A_TakeInventory ("ShotgunPickupRounds", 999)
		stop
	}
}

