ACTOR Coachgun : Weapon replaces SuperShotgun
{
	Weapon.SelectionOrder 700
	Weapon.SlotNumber 3
	Weapon.AmmoType1 "Shell"
	Weapon.AmmoGive 2
	Weapon.AmmoUse 1
	Weapon.AmmoType2 "LoadedShells"
	Weapon.AmmoUse2 1
	Inventory.PickupMessage "You got the coach gun!"
	Inventory.PickupSound "weapons/fist/swing"
	Obituary "%o couldn't argue with %k's coach gun"
	+WEAPON.NOALERT
	+WEAPON.AMMO_CHECKBOTH
	Tag "Coach Gun"
	Weapon.BobStyle "Smooth"
	Weapon.BobSpeed 2.0
	Weapon.BobRangeX 0.15
	Weapon.BobRangeY 0.40
	Scale 1.2
	States
	{
	Ready:
		PKS2 O 2 Offset(40,60)
		PKS2 P 2 Offset(30,65)
		PKS2 Q 2 Offset(20,50)
		TNT1 A 0 A_PlayWeaponSound("weapons/shellslinger/close")
		PKS2 R 2 Offset(10,45)
		PKS2 S 2 Offset(8,42)
		PKS2 U 1 Offset(6,40)
		PKS2 U 1 Offset(4,39)
		TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("CoachGunReload")==0, "FreeAmmoCheck")
		Goto ReadyII
	FreeAmmoCheck:
		TNT1 A 0 A_JumpIfInventory("LoadedShells",1,3)
		TNT1 A 0 A_GiveInventory("LoadedShells",2)
		TNT1 A 0 A_TakeInventory("Shell",2)
		Goto ReadyII
	ReadyII:
		TNT1 A 0 A_JumpIfInventory("LoadedShells",0,2)
		TNT1 A 0 A_JumpIfInventory("Shell",1,2)
		CCHG A 1 Offset(0,32)A_WeaponReady
		Loop
		CCHG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
	Deselect:
		CCHG A 1 Offset(15,40)
		CCHG A 1 Offset(30,55)
		CCHG A 1 Offset(45,75)
		CCHG A 1 Offset(60,100)
		CCHG A 1 Offset(75,130)
		TNT1 A 0 A_Lower
		Wait
	Select:
		SHT2 A 0 A_Raise
		Loop
	Fire:
		TNT1 A 0 A_JumpIfInventory("LoadedShells", 2, "FireRight")
		TNT1 A 0 A_JumpIfInventory("LoadedShells",1,1)
	Goto Reload
		TNT1 A 0 A_TakeInventory("LoadedShells",1,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_PlaySound("weapons/singleL", 5)
		TNT1 A 0 A_Light2
		LFTF A 1 Bright A_FireBullets (6, 5, 9, 6, "AltPuff", 0)
		TNT1 A 0 A_Light1
		TNT1 A 0 A_SetPitch (pitch+0.1)
		TNT1 A 0 A_ZoomFactor(0.99)
		TNT1 A 0 Offset(0,34)
		LFTF B 1 Bright A_AlertMonsters
		TNT1 A 0 A_SetPitch (pitch-0.1)
		TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,-2,0)
		TNT1 AAAA 0 A_FireCustomMissile("GunSmokeSpawner",0,0,0,5)
		TNT1 A 0 A_ZoomFactor(0.995)
		CCHG A 1 Offset(0,33)
		TNT1 A 0 A_ZoomFactor(1.0)
		CCHG B 1 Offset(0,32) A_Light0
		CCHG A 3
		TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("CoachGunReload")==0, "ReloadCheck")
		Goto ReadyII
	FireRight:
		TNT1 A 0 A_JumpIfInventory("LoadedShells",1,1)
		Goto Reload
		TNT1 A 0 A_TakeInventory("LoadedShells",1,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_PlaySound("weapons/singleR", 6)
		TNT1 A 0 A_Light2
		RHTF A 1 Bright A_FireBullets (6, 5, 9, 6, "AltPuff", 0)
		TNT1 A 0 A_Light1
		TNT1 A 0 A_SetPitch (pitch+0.2)
		TNT1 A 0 A_ZoomFactor(0.99)
		TNT1 A 0 Offset(0,34)
		RHTF B 1 Bright A_AlertMonsters
		TNT1 A 0 A_SetPitch (pitch-0.2)
		TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,1,0)
		TNT1 AAAA 0 A_FireCustomMissile("GunSmokeSpawner",0,0,0,5)
		TNT1 A 0 A_ZoomFactor(0.995)
		CCHG A 1 Offset(0,33) A_Light0
		TNT1 A 0 A_ZoomFactor(1.0)
		CCHG B 1 Offset(0,32)
		CCHG A 6
		Goto ReadyII
	AltFire:
		TNT1 A 0 A_JumpIfInventory("LoadedShells", 2, "FireDouble")
		TNT1 A 0 A_JumpIfInventory("LoadedShells", 1, "Fire")
	FireDouble:
		TNT1 A 0 A_JumpIfInventory("LoadedShells",1,1)
		Goto Reload
		TNT1 A 0 A_TakeInventory("LoadedShells",2,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_PlaySound("weapons/kapow", 5)
		CCHG A 1 A_FireBullets (11, 8, 20, 6, "ShotPuff", 0)
		TNT1 A 0 Offset(0,36)
		CCHG A 1 Bright A_ZoomFactor(0.99)
		TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,-2,0)
		TNT1 A 0 A_SetPitch (pitch+0.4)
		TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,1,0)
		TNT1 AAAA 0 A_FireCustomMissile("GunSmokeSpawner",0,0,0,5)
		TNT1 A 0 A_ZoomFactor(0.985)
		CCHG A 1 Offset(0,34) A_AlertMonsters
		TNT1 A 0 A_SetPitch (pitch-0.4)
		TNT1 A 0 A_ZoomFactor(0.994)
		CCHG B 1 A_ZoomFactor(0.998)
		TNT1 A 0 A_ZoomFactor(1.0)
		CCHG A 3 Offset(0,32)
		TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("CoachGunReload")==0, "ReloadCheck")
		Goto ReadyII
	ReloadCheck:
		TNT1 A 0 A_JumpIfInventory("Shell",1,"Reload")
		Goto ReadyII
	Reload:
		TNT1 A 0 A_JumpIfInventory("LoadedShells", 1, "ReloadSingle")
		PKS2 B 1
		PKS2 B 1 Offset(-2,34)
		PKS2 C 1 Offset(-3,36)
		PKS2 V 1
		PKS2 D 3
		PKS2 E 5
		CCHG D 4 A_PlaySound("weapons/shellslinger/open",7)
		TNT1 A 0 A_JumpIfInventory("LoadedShells", 0, "ReloadDouble")
	ReloadDouble:
		TNT1 A 0 A_FireCustomMissile("SSGCasingSpawner",0,0,-10,-6)
		TNT1 A 0 A_FireCustomMissile("SSGCasingSpawner",0,0,-8,-6)
		TNT1 A 0 A_FireCustomMissile("GunSmokeSpawner",0,0,-8,0)
		PKS2 HI 2
		PKS2 JK 2
		Goto ReloadWork
	ReloadSingle:
		PKS2 UUSSTTT 1
		CCHG D 4 A_PlaySound("weapons/shellslinger/open", 7)
		PKS2 G 2
		TNT1 A 0 A_FireCustomMissile("SSGCasingSpawner",0,0,-8,-6)
		TNT1 A 0 A_FireCustomMissile("GunSmokeSpawner",0,0,-8,0)
		SH2R ABC 2
		Goto ReloadWork
	ReloadWork:
		TNT1 A 0 A_GiveInventory("LoadedShells")
		TNT1 A 0 A_TakeInventory("Shell",1,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_JumpIfInventory("LoadedShells",0,"ReloadEnd")
		TNT1 A 0 A_JumpIfInventory("Shell",1,"ReloadWork")
		Goto ReloadEnd
	ReloadEnd:
		PKS2 L 4 A_PlaySound("weapons/shellslinger/load", CHAN_AUTO)
		PKS2 M 2
		PKS2 NOPQ 2 
		PKS2 R 2 A_PlayWeaponSound("weapons/shellslinger/close")
		PKS2 S 1 Offset(8,38)
		PKS2 S 1 Offset(6,37)
		PKS2 U 1 Offset(4,35)
		PKS2 U 1 A_ReFire
		Goto ReadyII
	AltFlash:
		DBLS A 1 Bright A_Light1
		DBLS B 1 Bright A_Light2
		Goto LightDone
	Spawn:
		DBBL A -1
	Stop
	}
}

ACTOR LoadedShells : Ammo
{
   +IGNORESKILL
   Inventory.MaxAmount 2
}