actor CamShotgun : Weapon
{
  obituary "%o was blown by %k's shotty."
  radius 20
  height 16
  attacksound "weapons/camshotgf"
  inventory.pickupmessage "You got the shotgun!"
  weapon.selectionorder 1300
  weapon.kickback 100
  Weapon.AmmoType1 "CamShotgunMagazine"
  Weapon.AmmoType2 "CamShell"
  Weapon.AmmoGive1 0
  Weapon.AmmoGive2 8
  Weapon.AmmoUse 1
  Inventory.RestrictedTo "CameronClass"
  Tag "SPAS-12"
  Inventory.Icon "CSHWA0"
  Decal "BulletChip"
  +AMMO_OPTIONAL
  +WEAPON.NOALERT
  states
  {
  Ready:
    CSHT A 1 A_WeaponReady (WRF_ALLOWRELOAD)
    loop
  Deselect: 
    CSHT A 1 A_Lower
	TNT1 A 0 A_Lower
	TNT1 A 0 A_Lower
    loop
  Select:
    CSHT A 1 A_Raise
	TNT1 A 0 A_Raise
	TNT1 A 0 A_Raise
    loop
  Fire:
	TNT1 A 0 A_JumpIfNoAmmo("Empty")  
    CSHT A 3
    CSHT A 0 A_AlertMonsters 
    CSHT A 0 A_FireBullets (6, 6, 12, 7, "CameronAcidicBulletPuff")
    CSHT B 7 A_GunFlash
    CSHT A 4
	CSHT A 0 A_JumpIfNoAmmo("Ready")
    CSHT C 3 A_PlaySound("weapons/camshotgr")
    CSHT D 5
	CSHT E 8
    CSHT D 4
    CSHT C 4
    CSHT A 6 A_ReFire
    Goto Ready  
  Empty:
    CSHT A 0
	Goto Reload 
  Reload:
	CSHT A 0 A_JumpIfInventory("CamShotgunMagazine", 8, "Ready") //Have full ammo? Go to ready!
	CSHT A 0 A_JumpIfInventory("CamShell", 1, "ReloadStart")
	CSHT A 1 A_WeaponReady(WRF_NOFIRE)
	Goto Ready
  ReloadStart:
    CSHT A 2 A_PlayWeaponSound("Weapons/camshotopn")
    CSHT C 3
    CSHT FGHI 3
	TNT1 A 0 A_JumpIfInventory("CamShell", 1, "ReloadWork")
	Goto ReloadWork2
  ReloadWork: 
	TNT1 A 0 A_JumpIfInventory("CamShotgunMagazine",8,"ReloadWork2")
    CSHT JKL 3
	CSHT M 0 A_PlayWeaponSound("Weapons/camshotload")
	CSHT M 0 A_TakeInventory("CamShell",1) 
    CSHT M 0 A_GiveInventory("CamShotgunMagazine",1) 
	TNT1 A 0 A_WeaponReady (WRF_NOBOB)
	CSHT NOP 3
	CSHT P 0 A_JumpIfInventory("CamShotgunMagazine",8,"ReloadFinish") //Is your mag full? Finish the animation!
	TNT1 A 0 A_JumpIfInventory("CamShell", 1, "ReloadWork")
	TNT1 A 0 A_JumpIfInventory("CamShell", 1, "ReloadWork2")
	Goto ReloadFinish
  ReloadWork2:
	TNT1 A 0 A_JumpIfInventory("CamShell", 0, "ReloadFinish")
    CSHT JKL 3
	CSHT M 0 A_PlayWeaponSound("Weapons/camshotload")
	CSHT M 0 A_TakeInventory("CamShell",1) 
    CSHT M 0 A_GiveInventory("CamShotgunMagazine",1) 
	CSHT NOP 3
	Goto ReloadFinish
  ReloadFinish:
    CSHT H 3 A_PlayWeaponSound("Weapons/camshotcls")
	CSHT G 3
    CSHT F 3 A_PlaySound("weapons/camshotgr")
    CSHT D 4
	CSHT E 6
    CSHT D 4
    CSHT C 4
	Goto Ready
  Flash:
    CSHF A 4 bright A_Light1
    TNT1 A 3 bright A_Light2
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    CSHW A -1
    stop
  }
}

actor CamShotgunMagazine : Ammo
{
	+IGNORESKILL
     Inventory.MaxAmount 8
}

ACTOR CamShell : Ammo
{
  Inventory.PickupMessage "$GOTSHELLS"
  Inventory.Amount 4
  Inventory.MaxAmount 50
  Ammo.BackpackAmount 4
  Ammo.BackpackMaxAmount 100
  Inventory.Icon "SHELA0"
  States
  {
  Spawn:
    SHEL A -1
    Stop
  }
}