ACTOR SSG : BrutalWeapon
{
	Game Doom
	SpawnID 33
   Weapon.Kickback 50
	Weapon.SelectionOrder 400
	Weapon.AmmoGive1 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "AmmoShell"
	Weapon.AmmoType2 "SSGAmmo"
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Inventory.PickupMessage "$GOTSHOTGUN2"
	Obituary "$OB_MPSSHOTGUN"
    Inventory.PickupSound "CLIPINSS"
	Scale 0.9
	Tag "Double-Barrel Shotgun"
	States
	{

	Spawn:
		TNT1 A 1
		TNT1 A 0 A_SpawnItemEx("SSGWeapon", 0, 0, 0, momx, momy, momz)
		Stop

    SelectAnimation:    
	Ready:
	Ready3:
	    SHTZ A 1 A_WeaponReady(WRF_ALLOWRELOAD)
        SHTZ A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SHTZ A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SHTZ A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		Loop
		
	Deselect:
		SHTZ A 0 A_Takeinventory("Zoomed",1)
        SHTZ A 0 A_ZoomFactor(1.0)
		SHTZ A 0 A_TakeInventory("TossGrenade", 1)
		SHT5 DCBA 1
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait
	Select:
		TNT1 AAAAAAAAAAAA 0 A_Raise
		SHTZ A 0 A_JumpIfInventory("SSGAmmo", 1, 1)
		Goto RaiseReloading
		SHT5 ABCD 1
		SHTZ A 0 A_PlaySound("weapons/sshotc")
		Goto Ready
		
	RaiseReloading:
		SHTZ A 0
		SHTZ A 0 A_JumpIfInventory("AmmoShell", 2, 1)
		Goto RaiseNoAmmo
		SHTZ M 1 Offset(0,38)
		SHTZ N 1 Offset(0,36)
		SHTZ O 1 Offset(0,34)
        SHTZ A 0 A_playsound("weapons/sshotl")
		SHTZ P 1 Offset(10,36)
		  SHTZ P 1 Offset(20,46)
		  SHTZ Q 1 Offset(30,56)
		  SHTZ Q 1 Offset(40,66)
		  SHTZ R 1 Offset(50,76)
		  SHTZ S 1
		  SHTZ A 0 A_GiveInventory ("Pumping", 1)
			
		SHTZ T 1 Offset(30,56)
		SHTZ U 1 Offset(20,46)
		SHTZ V 1 Offset(1,33)
			
		SHTZ A 0 A_GiveInventory ("Pumping", 1)
		SHTZ A 0 A_PlaySound("weapons/sshotc")
		SHTZ A 0 A_TakeInventory("AmmoShell", 2)
		SHTZ A 0 A_GiveInventory("SSGAmmo", 2)
			
			SHTZ WX 1
			SHTZ YZ 1
		  SHTZ A 0 A_GiveInventory ("Pumping", 1)
		  SHTZ A 0 A_TakeInventory("SSGAlt",1)
			SHO9 DE 1
			SHO9 FG 1
		  SHTZ A 0 A_ReFire
		 SHTZ A 2
        Goto Ready
		
		
	RaiseNoAmmo:	
		SHT5 ABCD 1
		SHTZ A 0 A_PlaySound("weapons/sshotc")
		Goto Ready

	NoAmmo:
		SHTZ A 0
		SHTZ A 0 A_ZoomFactor(1.0)
		SHTZ A 0 A_Takeinventory("Zoomed",1)
		SHTZ A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		NoAmmo2:
		SHTZ A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		SHTZ A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		SHTZ A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOFIRE)
		SHTZ A 0 A_JumpIfInventory("Reloading",1,"Reload")
		SHTZ A 0 A_JumpIfInventory("AmmoShell",1,"Reload")
		SHTZ A 0 A_JumpIfInventory("FiredPrimary",1,"NoAmmo2")
		Goto Ready3
		
	 Fire:
		SHTZ A 0 A_TakeInventory("Reloading",1)
		SHTZ A 0 A_JumpIfInventory("SSGAlt",1,"AltFire")
		SHTZ A 0 A_JumpIfInventory("SSGAmmo", 2, 1)
		Goto NoAmmo
		TNT1 A 0
		SHTZ A 0 A_TakeInventory("SSGAmmo", 2)
		SHTZ A 0 A_ZoomFactor(0.9)
		SHTN A 0 A_PlaySound("weapons/sg", 1)
		SHTZ A 0 A_FireCustomMissile("DistantFireSoundSSG", random(-1,1), 0, 0, -12, 0, random(-1,1))
        SHO9 A 0 BRIGHT A_playsound("SSHFIRE", 5)
		TNT1 AAAAAAAAAAA 0 A_FireCustomMissile("DecorativeTracer", random(-6,6), 0, 0, -12, 0, random(-2,2))
		TNT1 AAAAAAAAAAAAAAAAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-19,19), 0, -1, 0, 0, random(-9,9))
		TNT1 AAAAAAAAAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles2", random(-19,19), 0, -1, 0, 0, random(-9,9))
		SHTZ A 0 A_SpawnItemEx("PlayerMuzzle2",30,5,27)
		SHTZ A 0 A_FireBullets (10, 3, 12, 10, "ShotgunPuff", FBF_NORANDOM)
		SHTZ A 0 A_FireBullets (2, 2, 6, 10, "ShotgunPuff", FBF_NORANDOM)
		TNT1 A 0 A_SetPitch(pitch-3)

		SHOF A 1 BRIGHT
		SHTN A 0 A_PlaySound("weapons/sg", 7)
		SHTZ A 0 A_ZoomFactor(1.00)
        SHTZ A 0 A_TakeInventory("SSGAlt",1)
        SHTZ A 0 A_TakeInventory("Reloading",1)

		SHOF CDEFGI 1 A_SetPitch(pitch+0.5)
		SHTZ AA 1 A_WeaponReady(WRF_NOFIRE | WRF_NOBOB)
		SHTZ A 1 A_WeaponReady(WRF_NOFIRE | WRF_NOBOB)
		Goto NoAmmo2
		
		
		
		
		
	Reload:	
		SHTZ A 0
		
		SHTZ A 0 A_TakeInventory("Reloading",1)
		
		
		SHTZ A 0 A_JumpIfInventory("SSGAlt", 1, "Reload2")//Check if still has a shell on left barrel
		
		SHTZ A 0 A_JumpIfInventory("SSGAmmo", 2, "Ready")//Check if still has a shell on left barrel
		
		
		SHTZ A 0 A_JumpIfInventory("AmmoShell", 1, 1)//Check if has any ammo left to reload
		Goto Ready
		
		
		SHTZ A 0 A_JumpIfInventory("AmmoShell", 2, 1)//Check if has ammo to reload 2 shells
		Goto Reload2
		
	
		
		
		//Reload 2 barrels
		
		SHTZ B 2 Offset(20,48) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
        SHTZ B 2 Offset(10,36) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		SHTZ BCDEF 1
		SHTZ GH 1
		SHTZ IJ 1
		SHTZ A 0 A_GiveInventory ("Pumping", 1)
        
        SHTZ A 0 A_PlaySound("weapons/sshotc")
		SHTZ A 0 A_JumpIfInventory("HasUnloaded", 1, 3)
		TNT1 AA 0 A_FireCustomMissile("SSGCaseSpawner",0,0,-10, -20)
        SHTZ K 2
		SHTZ L 2
		SHTZ MNOO 1
        SHTZ A 0 A_playsound("weapons/sshotl")
		  SHTZ P 1 Offset(10,36)
		  SHTZ P 1 Offset(20,46)
		  SHTZ Q 1 Offset(30,56)
		  SHTZ Q 1 Offset(40,66)
		  SHTZ R 1 Offset(50,76)
		  SHTZ S 1
		  SHTZ A 0 A_GiveInventory ("Pumping", 1)
			
		SHTZ T 1 Offset(30,56)
		SHTZ U 1 Offset(20,46)
		SHTZ V 1 Offset(1,33)
			
		SHTZ A 0 A_GiveInventory ("Pumping", 1)
		SHTZ A 0 A_PlaySound("weapons/sshotc")
		SHTZ A 0 A_TakeInventory("AmmoShell", 2)
		SHTZ A 0 A_GiveInventory("SSGAmmo", 2)
			
			SHTZ WX 1
			SHTZ YZ 1
		  SHTZ A 0 A_GiveInventory ("Pumping", 1)
		  SHTZ A 0 A_TakeInventory("SSGAlt",1)
			SHO9 DE 1
			SHO9 FG 1
		  SHTZ A 0 A_ReFire
		 SHTZ A 2
        Goto Ready
		

AltFire:
		SHTZ A 0 A_TakeInventory("Reloading",1)
		SHTZ A 0 A_JumpIfInventory("SSGAmmo",1,3)
        Goto NoAmmo
        TNT1 AAAAA 0
		SHTZ A 0 A_ZoomFactor(0.9)
		SHTZ A 0 A_JumpIfInventory("SSGAlt",1,"AltFire2")


		SHTZ A 0 A_TakeInventory("SSGAmmo",1)
		SHTZ A 0 A_GiveInventory("SSGAlt",1)
		
        SHTZ A 0 A_ALertMonsters
		//SHTZ AA 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 2, 0, 0, 0)
		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))
        SHTU A 1 BRIGHT A_PlaySound("weapons/sg")
		SHTZ A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		SHTZ A 0 A_FireCustomMissile("DistantFireSoundShotgun", random(-1,1), 0, 0, -12, 0, random(-1,1))
        SHTU A 1 BRIGHT A_FireBullets (5, 3, 9, 10, "ShotgunPuff", FBF_NORANDOM)
		
		SHTZ A 0 A_ZoomFactor(1.00)
		SHTZ A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 3)//Tactical Mode deals extra damage
		SHTN A 0 A_FireBullets (6, 3, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
		SHTZ A 0 A_SetPitch(pitch-2)
		SHTZ A 0
		
        TNT1 AAAAA 0 A_FireCustomMissile("DecorativeTracer", random(-5,5), 0, 0, -12, 0, random(-5,5))
		SHOF EFGHI 1 A_SetPitch(+0.4 + pitch)
        SHTZ A 0
        Goto Ready

	AltFire2:
		SHTZ A 0 A_TakeInventory("SSGAmmo", 1)
        SHTZ A 0 A_ALertMonsters
		//SHTZ AA 0 A_FireCustomMissile("GunFireSmoke", 0, 0, -2, 0, 0, 0)
		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))
        SHTU B 1 BRIGHT A_PlaySound("weapons/sg")
		SHTZ A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		SHTZ A 0 A_FireCustomMissile("DistantFireSoundShotgun", random(-1,1), 0, 0, -12, 0, random(-1,1))
        SHTU B 1 BRIGHT A_FireBullets (5, 3, 9, 13, "ShotgunPuff", FBF_NORANDOM)
		
		
		SHTZ A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 3)//Tactical Mode deals extra damage
		SHTN A 0 A_FireBullets (6, 3, 5, 13, "ShotgunPuff2", FBF_NORANDOM)
		SHTZ A 0 A_SetPitch(pitch-4)
		SHTZ A 0
		
		SHTZ A 0 A_ZoomFactor(1.00)
        TNT1 AAAAA 0 A_FireCustomMissile("DecorativeTracer", random(-5,5), 0, 0, -12, 0, random(-5,5))
        SHOF EFGHI 1 A_SetPitch(+0.4 + pitch)
		
		SHTZ A 0 A_TakeInventory("SSGAlt", 1)
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo")
		Goto Reload
		TNT1 AA 0
		Goto Ready
        
	Reload2:
		SHTZ A 0 A_TakeInventory("Reloading",1)
		SHTZ A 0 A_JumpIfInventory("AmmoShell",1,1)
		Goto NoAmmo
		SHTZ A 0 A_TakeInventory("SSGAlt",1)
		
		SHTZ B 2 Offset(20,48) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		SHTZ A 0 
	    SHTZ A 0 
        SHTZ B 2 Offset(10,36) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		SHTZ A 0 
	    SHTZ A 0 
		SHTZ BCDEF 1
		SHTZ A 0 
	    SHTZ A 0 
		SHTZ GH 1
		SHTZ A 0 
	    SHTZ A 0 
		SHTZ IJ 1
		SHTZ A 0
	    SHTZ A 0
		
		SHTZ A 0 A_GiveInventory ("Pumping", 1)
        
        SHTZ A 0 A_PlaySound("weapons/sshotc")
		SHTZ A 0 A_FireCustomMissile("SSGCaseSpawner",0,0,-10, -20)
        SHTZ K 2
		SHT7 L 2
		SHT7 MNOO 1
        SHTZ A 0 A_playsound("weapons/sshotl")
		SHT7 P 1 Offset(10,36)
		SHT7 P 1 Offset(20,46)
		SHTZ Q 1 Offset(30,56)
		SHTZ Q 1 Offset(40,66)
		SHTZ R 1 Offset(50,76)
		SHTZ A 0
		SHTZ S 1
		SHTZ A 0 A_GiveInventory ("Pumping", 1)
        
		SHTZ T 1 Offset(30,56)
		SHTZ U 1 Offset(20,46)
		SHTZ V 1 Offset(1,33)
        
		SHTZ A 0 A_GiveInventory ("Pumping", 1)
        SHTZ A 0 A_PlaySound("weapons/sshotc")
		SHTZ A 0 A_TakeInventory("AmmoShell", 1)
		SHTZ A 0 A_GiveInventory("SSGAmmo", 1)
        SHTZ WX 1
		SHTZ YZ 1
		SHTZ A 0 A_GiveInventory ("Pumping", 1)
		SHO9 DE 1
		SHO9 FG 1
		SHTZ A 0 A_ReFire
		SHTZ A 2
	  Goto Ready
	}
}



ACTOR SSGAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 2
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 2
   Inventory.Icon "WAK4A0"
}