actor ShotgunAmmo : Ammo replaces Shell 19332
{
  inventory.pickupmessage "$D3D_SHOTGUNAMMO"
  inventory.amount 10
  inventory.maxamount 50
  inventory.icon "TNT1A0"
  ammo.backpackamount 10
  ammo.backpackmaxamount 100
  scale 0.6
  +INVENTORY.IGNORESKILL
  states
  {
  Spawn:
    SHTP B -1
    stop
  }
}

ACTOR ShotgunShell : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 8
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 8
  +INVENTORY.IGNORESKILL
}

Actor ShotgunHoldFire : Inventory
{
inventory.maxamount 1
}

Actor ShotgunHoldAltFire : Inventory
{
inventory.maxamount 1
}

ACTOR PigCopShotgun : ZCustomInventoryWeapon 19333
{
  Inventory.PickupMessage "$D3D_SHOTGUN"
  Inventory.MaxAmount 10
  Inventory.Amount 1
  +INVENTORY.AUTOACTIVATE 
  scale 0.55
  Inventory.PickupSound "misc/backpack"
  States
  {
  Spawn:
    SHTP A -1
    Stop
  Pickup:
    SHTP A 0 ACS_ExecuteWithResult(506,1)
    TNT1 A 1
    stop
  Use:
    SHTP A 0
    SHTP A 0 ACS_ExecuteAlways(506,0,2,0,0)
    TNT1 A 1
    Stop
  }
}

actor "Shotgun " : DefaultDukeWeapon replaces Shotgun 19334
{
  Weapon.SelectionOrder 19
  Weapon.AmmoUse1 0
  Weapon.AmmoGive1 8
  Weapon.AmmoType1 "ShotgunAmmo"
  Weapon.AmmoUse2 1
  Weapon.AmmoGive2 0
  Weapon.AmmoType2 "ShotgunShell"
  Obituary "%o was smacked down by %k's shotgun."
  Inventory.Pickupmessage "$D3D_SHOTGUN"
  Inventory.PickupSound "misc/backpack"
  weapon.upsound "shotgun/pump"
  scale 0.55
//  decal bulletchip
  +NOALERT
  Tag " "
  States
  {
  RReady2:
    TNT1 A 0 A_JumpIfInventory("ShotgunShell",1,1)
    Goto Reload
    SHTG A 0 A_WeaponReady
    TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
    SHTG A 1 A_WeaponReady
    goto RReady
  NoAmmo:
    SHTG A 5 A_WeaponReady(WRF_NOFIRE)
    SHTG A 5 A_WeaponReady
    TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
    TNT1 A 0 A_JumpIfInventory("ShotgunShell",1,"RReady")
    TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,"Reload")
    Loop
  Deselect:
    SHTG A 0
    goto Super::Deselect
  Select:
    SHTG A 0
    goto Super::Select
  Fire:
    TNT1 A 0
    TNT1 A 0 A_JumpIfInventory("ShotgunShell",1,2)
    SHTG A 10 A_PlaySound("DRYFIRE", 1)
    Goto Reload
    TNT1 A 0 A_TakeInventory("ShotgunShell", 1)
    TNT1 AA 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 3, 2, 0, 0)
    SHTF E 0 A_FireCustomMissile("MuzzleFlashMedium",0,0,0)
    SHTF E 1 A_PlayWeaponSound("shotgun/shoot")
    TNT1 A 0 A_FireBullets (3.6, 3.6, 7, 6, "Shotgunpuff")
    TNT1 AAAAA 0 A_FireCustomMissile("DecorativeTracer", random[RIDFX](-3,3), 0, 11, -12, 0, random[RIDFX](-3,3))
    TNT1 A 0 A_ZoomFactorD3D("d3d_rshotgun",0.95)
    SHTF B 1 BRIGHT A_FireCustomMissile("MonsterAlert",0,0,0)
    SHTF B 1 BRIGHT
    TNT1 A 0 A_ZoomFactor(1.0)
    SHTF C 2 A_SetPitchD3D ("d3d_rshotgun",-2)
    SHTF D 1 A_SetPitchD3D ("d3d_rshotgun",0.8)
    SHTF D 1 A_SetPitchD3D ("d3d_rshotgun",0.6)
    SHTG B 1 offset(-4,31) A_SetPitchD3D ("d3d_rshotgun",0.4)
    SHTG B 1 offset(-4,31) A_SetPitchD3D ("d3d_rshotgun",0.2)
    SHTG B 1 offset(-4,31)
    SHTG CD 3
    TNT1 A 0 A_TakeInventory("Waiting",10)
    TNT1 A 0 A_PlaySound("shotgun/pump",6)
    TNT1 A 0 A_FireCustomMissile("ShotCaseSpawn",0,0,16,-6)
    SHTG E 4
    SHTG D 3
    SHTG C 3
    SHTG B 3
    TNT1 A 0 A_JumpIfInventory("ShotgunShell", 1,2)
    TNT1 A 0 ACS_ExecuteAlways(614,0,0,0,0)
    Goto Reload
    TNT1 AAAAA 0
    TNT1 A 0 A_Refire
    Goto RReady
  AltFire:
    TNT1 A 0
    TNT1 A 0 A_JumpIfInventory("ShotgunShell",1,2)
    SHTG A 10 A_PlaySound("DRYFIRE", 1)
    Goto Reload
    TNT1 A 0 A_JumpIfTotalAmmo("ShotgunAmmo","ShotgunShell",5,2)
    SHTG A 10 A_PlaySound("DRYFIRE", 1)
    Goto NoAmmo
    TNT1 A 0 A_TakeCombinedAmmo("ShotgunAmmo","ShotgunShell",5,1)
    TNT1 AA 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 3, 2, 0, 0)
    SHTF E 1 A_FireCustomMissile("MuzzleFlashMedium",0,0,0)
    SHTF E 1 A_PlayWeaponSound("shotgun/power")
    TNT1 A 0 A_FireBullets (6, 5, 7, 6, "ExplosiveShotgunpuff", 0)
    TNT1 AAAAA 0 A_FireCustomMissile("DecorativeTracer", random[RIDFX](-3,3), 0, 11, -12, 0, random[RIDFX](-3,3))
    TNT1 A 0 A_ZoomFactorD3D("d3d_rshotgun",0.90)
    SHTF B 2 BRIGHT A_FireCustomMissile("MonsterAlert",0,0,0)
    SHTF B 1 BRIGHT
    TNT1 A 0 A_ZoomFactor(1.0)
    SHTF C 3 A_SetPitchD3D ("d3d_rshotgun",-2)
    SHTF D 2 A_SetPitchD3D ("d3d_rshotgun",0.8)
    SHTF D 1 A_SetPitchD3D ("d3d_rshotgun",0.6)
    SHTG B 1 offset(-4,31) A_SetPitchD3D ("d3d_rshotgun",0.4)
    SHTG B 1 offset(-4,31) A_SetPitchD3D ("d3d_rshotgun",0.2)
    SHTG B 1 offset(-4,31)
    SHTG CD 3
    TNT1 A 0 A_TakeInventory("Waiting",10)
    TNT1 A 0 A_PlaySound("shotgun/pump")
    TNT1 A 0 A_FireCustomMissile("ShotCaseSpawn",0,0,16,-6)
    SHTG E 4 
    SHTG DCB 4
    TNT1 A 0 A_JumpIfInventory("ShotgunShell", 1,2)
    TNT1 A 0 ACS_ExecuteAlways(615,0,0,0,0)
    Goto Reload
    TNT1 AAAAA 0
    TNT1 A 0 A_Refire
    Goto RReady
  Spawn:
    SHTP A -1
    Stop
  Reload:
    TNT1 A 0
    TNT1 A 0 A_Takeinventory("Reloading",1)
    TNT1 A 0 A_JumpIfInventory("ShotgunShell",8,50)
    TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,3)
    Goto NoAmmo
    TNT1 AAA 0
    TNT1 A 0 A_Takeinventory("Reloading",1)
    TNT1 A 0 A_JumpIf(d3d_shotgunreload==1,9)
    WP03 AYIKL 1
    WP03 MO 1
    WP03 P 1
    TNT1 A 0
  InsertBullets:
    TNT1 AAAA 0
    TNT1 A 0 A_JumpIfInventory("ShotgunShell",8,"FinishReload")
    TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,3)
    Goto RReady
    TNT1 AAAAA 0
    TNT1 A 0 A_Giveinventory("ShotgunShell",1)
    TNT1 A 0 A_Takeinventory("ShotgunAmmo",1)
    TNT1 A 0 A_JumpIfInventory("ShotgunShell",8,5)
    TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,2)
    TNT1 A 0 A_Jump(256,3)
    TNT1 A 0 A_Giveinventory("ShotgunShell",1)
    TNT1 A 0 A_Takeinventory("ShotgunAmmo",1)
    TNT1 A 0 A_JumpIf(d3d_shotgunreload==1,5)
    WP03 Q 2
    WP03 R 1
    WP03 S 2 A_PlaySound("inshell")
    WP03 P 2
    TNT1 A 0
    TNT1 A 0 A_Takeinventory("Reloading",1)
    TNT1 A 0 A_JumpIf(d3d_shotgunreload==1,4)
    TNT1 A 0 A_JumpIfInventory("ShotgunHoldFire",1,3)
    TNT1 A 0 A_JumpIfInventory("ShotgunHoldAltFire",1,2)
    TNT1 A 0 A_ForceReFire
    TNT1 A 0
    Goto InsertBullets
    TNT1 AAAAAAAAAA 0
    TNT1 A 0 A_Takeinventory("Reloading",1)
    TNT1 A 0 A_Refire
    Goto RReady
  FinishReload:
    TNT1 A 0 A_JumpIf(d3d_shotgunreload==1,5)
    WP03 P 1
    WP03 KI 2
    WP03 A 3
    TNT1 A 0
    Goto RReady	
  }
}