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


// --------------------------------------------------------------------------
//
// Super Shotgun
//
// --------------------------------------------------------------------------
ACTOR SSG : Doomweapon Replaces SuperShotgun
{
	Game Doom
	SpawnID 33
   Weapon.Kickback 50
	Weapon.SelectionOrder 400
	Weapon.AmmoGive1 4
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "Shell"
	Weapon.AmmoType2 "SSGAmmo"
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
    +WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	+WEAPON.NO_AUTO_SWITCH
	Inventory.PickupMessage "$GOTSHOTGUN2"
	Obituary "$OB_MPSSHOTGUN"
    Inventory.PickupSound "CLIPINSS"
	Scale 0.9
	States
	{
	Steady:
	TNT1 A 1
	Goto Ready
	Ready:
        TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "PuristGun")
        SHT5 ABCD 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        TNT1 AAA 0
        TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("Unloading",1,"Unload")
		
        TNT1 AAA 0
		SHT2 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")		
		Goto Ready+7
		
	Deselect:
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		SHT5 DCBA 1
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait
	Select:
		TNT1 A 0 A_Takeinventory("FistsSelected",1)
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "PuristGun")
		TNT1 A 0 A_Takeinventory("SawSelected",1)
		TNT1 A 0 A_Takeinventory("ShotgunSelected",1)
		TNT1 A 0 A_Giveinventory("SSGSelected",1)
		TNT1 A 0 A_Takeinventory("MinigunSelected",1)
		TNT1 A 0 A_Takeinventory("PlasmaGunSelected",1)
		TNT1 A 0 A_Takeinventory("RocketLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("BFGSelected",1)
		TNT1 A 0 A_Takeinventory("BFG10kSelected",1)
		TNT1 A 0 A_Takeinventory("RailGunSelected",1)
		TNT1 A 0 A_Takeinventory("SubMachineGunSelected",1)
		TNT1 A 0 A_Takeinventory("RevenantLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("LostSoulSelected",1)
		TNT1 A 0 A_Takeinventory("FlameCannonSelected",1)
		TNT1 A 0 A_Takeinventory("HasBarrel",1) 
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 AAAAAAAAAAAA 0 A_Raise
		
		SHT2 U 1 Offset(20,46)
		SHT2 V 1 Offset(1,33)
        
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
        TNT1 A 0 A_PlaySound("weapons/sshotc")
        SHT2 WX 1
		SHT2 YZ 1
		TNT1 A 0 A_PlaySound("CLIPINSS")
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
        SHO9 DE 1
		SHO9 FG 1
		Goto Ready
		
    NoAmmo:
        SHT2 A 4 A_PlaySound("weapons/empty", 2)
		TNT1 A 0 A_TakeInventory("SSGAlt",1)
		TNT1 A 0 A_JumpIfInventory("Shell", 1, "Reload")
        Goto Ready+6
	 Fire:
		TNT1 A 0 A_TakeInventory("Reloading",1)
		TNT1 A 0 A_JumpIfInventory("SSGAlt",1,"AltFire")
		TNT1 A 0 A_JumpIfInventory("SSGAmmo", 2, 1)
		Goto NoAmmo
		//TNT1 A 0 A_JumpIfInventory("SSGAmmo", 2, 1)
		//Goto AltFire
		
		TNT1 A 0 A_TakeInventory("SSGAmmo", 2)
		
		TNT1 A 0 A_Recoil(5)
		SHO9 A 0 A_FireBullets(0,0,1,40,"shotpuff",0,150)
        SHO9 A 1 BRIGHT A_playsound("SSHFIRE", 5)
		TNT1 AAAAAAAAAAA 0 A_FireCustomMissile("Tracer", random(-10,10), 0, -1, -12, 0, random(-5,5))
		
		 TNT1 AA 0 A_FireCustomMissile("YellowFlareSpawn",15,0,0,0)
		 TNT1 AA 0 A_FireCustomMissile("YellowFlareSpawn",-15,0,0,0)
		 TNT1 A 0 A_SpawnItemEx("PlayerMuzzle2",30,5,27)
			SHO9 B 1 BRIGHT
		TNT1 A 0 A_FireBullets (12, 6, 10, 7, "ShotgunPuff")
		TNT1 A 0 A_FireBullets (12, 6, 10, 7, "ShotgunPuff")
		TNT1 A 0 A_SetPitch(-16.0 + pitch)
        TNT1 A 0 A_FireCustomMissile("ShakeYourAssQuad", 0, 0, 0, 0)
        SHO9 B 1 BRIGHT A_SetPitch(+2.0 + pitch)
      SHO8 C 1 Offset(0,62)
	  TNT1 A 0 A_SetPitch(+2.0 + pitch)
      SHO8 D 1 Offset(0,61)
	  TNT1 A 0 A_SetPitch(+2.0 + pitch)
      SHO8 E 1 Offset(0,60)
	  TNT1 A 0 A_SetPitch(+2.0 + pitch)
		RIFF AA 0 A_FireCustomMissile("GunFireSmokE", 0, 0, 2, 0, 0, 0)
		RIFF AA 0 A_FireCustomMissile("GunFireSmoke", 0, 0, -2, 0, 0, 0)
      TNT1 A 0 A_TakeInventory("SSGAlt",1)
      TNT1 A 0 A_TakeInventory("Reloading",1)
      //TNT1 A 0 A_JumpIfInventory("Shell",0,"NoAmmo")
        SHO8 E 2 Offset(0,56) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		TNT1 A 0 A_SetPitch(+2.0 + pitch)
        SHO8 C 2 Offset(0,42) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		TNT1 A 0 A_SetPitch(+2.0 + pitch)
        SHT2 A 3 A_SetPitch(+2.0 + pitch)
		TNT1 A 0 A_SetPitch(+2.0 + pitch)
		Goto Reload

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

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


		TNT1 A 0 A_TakeInventory("SSGAmmo",1)
		TNT1 A 0 A_GiveInventory("SSGAlt",1)
        TNT1 A 0 A_Recoil(2)
        TNT1 A 0 A_ALertMonsters
		RIFF AA 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 2, 0, 0, 0)
        SHTA A 1 BRIGHT A_PlaySound("weapons/sg")
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        SHTA A 2 BRIGHT A_FireBullets (9, 6, 10, 7, "ShotgunPuff")
        TNT1 AAAAA 0 A_FireCustomMissile("Tracer", random(-5,5), 0, -1, -12, 0, random(-5,5))
	TNT1 A 0 A_SetPitch(-4.0 + pitch)
		//TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
		SHO8 EE 1 A_SetPitch(+1.0 + pitch)
        SHT2 AA 1 A_SetPitch(+1.0 + pitch)
        TNT1 A 0
        Goto Ready+6

AltFire2:
		TNT1 A 0 A_TakeInventory("SSGAmmo", 1)
        TNT1 A 0 A_Recoil(2)
        TNT1 A 0 A_ALertMonsters
		RIFF AA 0 A_FireCustomMissile("GunFireSmoke", 0, 0, -2, 0, 0, 0)
        SHTA B 1 BRIGHT A_PlaySound("weapons/sg")
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        SHTA B 2 BRIGHT A_FireBullets (9, 6, 10, 7, "ShotgunPuff")
        TNT1 AAAAA 0 A_FireCustomMissile("Tracer", random(-5,5), 0, -1, -12, 0, random(-5,5))
		 TNT1 A 0 A_SetPitch(-4.0 + pitch)
		//TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
        SHT2 AA 1 BRIGHT A_SetPitch(+1.0 + pitch)
		SHO8 EE 1 A_SetPitch(+1.0 + pitch)
		
		TNT1 A 0 A_TakeInventory("SSGAlt", 1)
		TNT1 A 0 A_JumpIfInventory("Shell",1,1)
		TNT1 A 0 A_GiveInventory("Reloading", 1)
		Goto Ready
        
	Reload2:
		
		TNT1 A 0 A_TakeInventory("Reloading",1)
		TNT1 A 0 A_JumpIfInventory("Shell",1,1)
		Goto NoAmmo
		TNT1 A 0 A_TakeInventory("SSGAlt",1)
		
		SHT2 B 2 Offset(20,48) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		TNT1 A 0 
	    TNT1 A 0 
        SHT2 B 2 Offset(10,36) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		TNT1 A 0 
	    TNT1 A 0 
		SHT2 BCDEF 1
		TNT1 A 0 
	    TNT1 A 0 
		SHT2 GH 1
		TNT1 A 0 
	    TNT1 A 0 
		SHT2 IJ 1
		TNT1 A 0
	    TNT1 A 0
		
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
        
        TNT1 A 0 A_PlaySound("weapons/sshotc")
		TNT1 A 0 A_FireCustomMissile("SSGCaseSpawner",0,0,-10)
        SHT2 K 2
		SHT7 L 10
		SHT7 MMNNOO 1
        TNT1 A 0 A_playsound("weapons/sshotl")
		SHT7 P 1 Offset(10,36)
		SHT7 P 1 Offset(20,46)
		SHT2 Q 1 Offset(30,56)
		SHT2 Q 1 Offset(40,66)
		SHT2 R 1 Offset(50,76)
		TNT1 A 0
		SHT2 S 2
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
        
		SHT2 T 1 Offset(30,56)
		SHT2 U 1 Offset(20,46)
		SHT2 V 1 Offset(1,33)
        
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
        TNT1 A 0 A_PlaySound("weapons/sshotc")
		TNT1 A 0 A_TakeInventory("Shell", 1)
		TNT1 A 0 A_GiveInventory("SSGAmmo", 1)
        SHT2 WX 1
		SHT2 YZ 1
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		SHO9 DE 1
		SHO9 FG 1
		TNT1 A 0 A_ReFire
		SHT2 A 2
		
	  Goto Ready+7

	Spawn:
		SGN2 A -1
		Stop
	
    DoKick:
	    TNT1 A 0
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		NULL A 0 A_JumpIf (momZ > 0, "AirKick")
		NULL A 0 A_JumpIf (momZ < 0, "AirKick")
		NULL A 0 A_JumpIf (pitch > 32, "LowKickChecker1")
		Goto InitializeNormalKick
		
		LowKickChecker1:
		TNT1 A 0
	    NULL A 0 A_JumpIf (pitch > 90, "InitializeNormalKick")
		RIFF A 0 A_FireCustomMissile("KickAttackDetectDowned", 0, 0, 0, 0)
		
		InitializeNOrmalKick:
        TNT1 A 0 A_jumpifinventory("PowerStrength",1,"BerserkerKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		SSKI BCD 1
		RIFF A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        SSKI H 5
		KICK A 0 A_Takeinventory("Kicking",1)
		SSKI I 1
		SSKI GFEDCBA 1 
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+6
    BerserkerKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		SSKI BCD 1
        RIFF A 0 A_FireCustomMissile("SuperKickAttack", 0, 0, 0, -7)
        SSKI H 5
		KICK A 0 A_Takeinventory("Kicking",1)
		SSKI I 1
		SSKI GFEDCBA 1 
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+6
	
	AirKick:
	    TNT1 A 0 A_jumpifinventory("PowerStrength",1,"SuperAirKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KICK JKLMN 1
        RIFF A 0 A_FireCustomMissile("AirKickAttack", 0, 0, 0, -31)
        KICK O 3
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+6
		
	SuperAirKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KICK JKLMN 1
        RIFF A 0 A_FireCustomMissile("SuperAirKickAttack", 0, 0, 0, -31)
        KICK O 3
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+6
	
	Taunt:
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("Taunting",1)
		TNT1 A 0 A_JumpIfInventory("RealismMode", 1, "CheckGrab")
        TNT1 A 10
		FUCK A 1
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK B 1 A_PlaySound("FUCK", 2)
        FUCK CD 1 A_AlertMonsters
		FUCK E 15 A_Takeinventory("Taunting",1)
        FUCK DCBA 1
        TNT1 A 10
		Goto Ready
	Salute:
	    TNT1 A 0 SetPlayerProperty(0,1,0)
		TNT1 A 0 A_ALertMonsters
		SALU ABCDEDCDEDCDEDCBA 4
		TNT1 A 0 A_TakeInventory("Salute1",1)
		TNT1 A 0 A_TakeInventory("Salute2",1)
		TNT1 A 0 SetPlayerProperty(0,0,0)
		Goto Ready
		
	CheckGrab:
	    TNT1 A 0 
		TNT1 A 0 A_JumpIfTargetInLOS("CheckDistanceGrab")
		Goto Ready+6
	CheckDistanceGrab:
	    TNT1 A 0 
		TNT1 A 0 A_JumpIfCloser(100, "Grab")
		Goto Ready+6
	CheckIfCanGrab:
	    TNT1 A 0 
		TNT1 A 0 A_JumpIfInTargetInventory("CanGrab", 1, "Grab")
		Goto Ready+6	
	Grab:
	    PKUP ABC 2
		TNT1 A 0 A_CustomMissile("PickupProjectile")
		PKUP DEF 2
		Goto Ready
		
	PuristGun:
		TNT1 A 1
		TNT1 A 0 A_GiveInventory("ClassicSSG", 1)
		TNT1 A 0 A_TakeInventory("SSG", 1)
		TNT1 A 10
		Goto Ready
		
	TossGrenade:	
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_JumpIfInventory("GrenadeAmmo", 1, 1)
		Goto NoGrenade
		GRTH ABCD 1
		TNT1 A 0 A_GiveInventory("FiredGrenade", 1)
		TNT1 A 0 A_PLaySound ("GRNPIN")
		GRTH EEFG 1
		TNT1 A 0 A_PLaySound ("GRNTOSS")
		GRTH HI 1
		TNT1 A 0 A_TakeInventory("GrenadeAmmo", 1)
		TNT1 A 0 A_FireCustomMissile("HandGrenade", random(-2,2), 0, 0, 0, 0, 0)
	    TNT1 A 0 A_TakeInventory("FiredGrenade", 1)
		GRTH JKLM 1
		TNT1 A 1 
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		Goto Ready	
	NoGrenade:
		TNT1 A 0
		TNT1 A 0 A_Print("No Grenades Left.")
		Goto REady+6	
		
	
	Unload:
		SHT5 A 1 A_WeaponReady
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_JumpIfInventory("SSGAmmo",1,3)
        Goto Ready
        TNT1 AAA 0
		TNT1 A 0 A_Takeinventory("Zoomed",1)
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		
	RemoveBullets:
		TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("SSGAmmo",1,3)
		Goto FinishUnload
        TNT1 AAAAAA 0
		TNT1 A 0 A_Takeinventory("SSGAmmo",1)
		TNT1 A 0 A_Giveinventory("Shell",1)
		Goto RemoveBullets
	
	FInishUnload:
		SHT2 B 2 Offset(20,48) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
        SHT2 B 2 Offset(10,36) //A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		SHT2 BCDEF 1
		SHT2 GH 1
		TNT1 A 0 A_PlaySound("weapons/sshotc")
		SHT2 IJ 1
        SHT2 K 2
		TNT1 A 20
		TNT1 A 0 A_GiveInventory("HasUnloaded", 1)
		TNT1 A 0 A_Takeinventory("Unloading",1)
		SHT2 U 1 Offset(20,46)
		SHT2 V 1 Offset(1,33)
        
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
        TNT1 A 0 A_PlaySound("weapons/sshotc")
        SHT2 WX 1
		SHT2 YZ 1
		TNT1 A 0 A_PlaySound("CLIPINSS")
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
        SHO9 DE 1
		SHO9 FG 1
		Goto Ready
		Goto Ready
	
	}
}
