ACTOR SplayerPrimary : Ammo
{
  Inventory.Amount 1
  Inventory.MaxAmount 2
  Ammo.BackpackAmount 0
  Ammo.BackpackMaxAmount 2
  Inventory.Icon "SHELA0"
  +INVENTORY.IGNORESKILL
}

ACTOR SplayerSecondary : Ammo
{
  Inventory.PickupMessage "You picked up a drum of PPSH-41 ammunition." // "Picked up a clip."
  Inventory.PickupSound "bullpup/magin"
  Inventory.Amount 1
  Inventory.MaxAmount 80
  Ammo.BackpackAmount 20
  Ammo.BackpackMaxAmount 80
  Inventory.Icon "SHELA0"
  +INVENTORY.IGNORESKILL
  States
  {
  Spawn:
    CLIP A -1
    Stop
  }
}

ACTOR SplayerMuzzleFX
{
	+NOBLOCKMAP
	+CLIENTSIDEONLY
	Speed 40
	States
	{
	Spawn:
	TNT1 A 1
	TNT1 A 0 A_Stop
	TNT1 AAAA 0 A_SpawnItemEx("QExplosionSmoke",0,random(-2,2),random(-2,2),0,random(-3,3),random(-3,3))
	TNT1 AAAAAA 0 A_SpawnItemEx("CasingSpark",0,random(-3,3),random(-3,3),0,random(-8,8),random(-8,8))
	Stop
	}
}

ACTOR "Splayer SSG" : Weapon 11509
{
  Weapon.AmmoUse 0
  Weapon.AmmoGive2 30
  Weapon.AmmoType "SplayerPrimary"
  Weapon.AmmoType2 "SplayerSecondary"
  Obituary "\cJ%k \cG> \cKSplayer SSG \cG> \cJ%o"
  Inventory.Pickupmessage "You picked up the Splayer SSG."
  Inventory.PickupSound "ppsh/pickup"
	//$Category ZT2 - Weapons
	//$Title Splayer SSG
	//$Sprite PPSHF0
  Tag "The Splayer SSG"
  Scale 0.75
  +WEAPON.NOAUTOFIRE
  States
  {
  Ready:
	PPSS A 0 A_PlaySoundEx("splayer/select","SoundSlot6")
	SLS2 ABCD 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	PPSS A 0 A_JumpIfInventory("DoBlocking",1,"QuickMelee")
	PPSS A 0 //A_JumpIfInventory("QuickGrenading",1,"ToGrenade")
	PPSS A 0 A_JumpIfInventory("IsReloading",1,"ReloadCheck")
    SLID A 1 A_WeaponReady
    Goto Ready+5
  ToGrenade:
	PPSS A 0 A_SelectWeapon("Type-97 Grenade")
	Goto Deselect
  QuickMelee:
	PPBL A 1
	PPBL B 0 A_PlaySoundEx("fist/swing","Weapon")
	PPBL BC 1
	PPBL D 0 A_CustomPunch (random(4,5),1,0,"BlockPuff")
	PPBL D 2
	PPBL E 4
	PPBL DCBA 2
	PPBL A 0 A_TakeInventory("DoBlocking",1)
	Goto Ready+5
  ToReady:
	NULL A 0
	Goto Ready+5
	NULL AAA 0
	NULL A 0 A_PlaySoundEx("dryfire/smg","SoundSlot6")
	Goto Ready+5
  Deselect:
	 SLSS DCBA 1
	 PPFI A 0 A_TakeInventory("SemiAutomatic",1)
     TNT1 AAAAAAAAAA 0 A_Lower
	 TNT1 A 1 A_Lower
     Goto Deselect+6
  Select:
	 TNT1 A 0 A_SetCrosshair(13)
     TNT1 A 0 A_Raise
     Wait
  ReloadCheck:
	 TNT1 A 0 A_TakeInventory("IsReloading",1)
	 TNT1 A 0 A_JumpIfInventory("SplayerPrimary",2,"ToReady")
	 TNT1 A 0 A_JumpIfInventory("SplayerSecondary",2,"ReloadAnim")
	 Goto ToReady
  ReloadAnim:
	 SLCK A 0 A_PlaySoundEx("splayer/cockback","SoundSlot6")
	 SLID A 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLRL ABC 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLRL D 6 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLRL EFGH 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLRL I 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLRL I 0 A_PlaySoundEx("splayer/insert","SoundSlot6")
	 SLRL I 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLRL J 3 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLRL K 2 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLRL L 3 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLCK A 0 A_PlaySoundEx("splayer/cockforward","SoundSlot6")
	 SLRL MNO 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 TNT1 A 0 A_TakeInventory("IsReloading",1)
	 TNT1 A 0 A_TakeInventory("SplayerSecondary",2)
	 TNT1 A 0 A_GiveInventory("SplayerPrimary",2)
	 Goto Ready+5
  Fire:
	 PPFI A 0 A_JumpIfInventory("SplayerPrimary",2,1)
	 Goto ToReady+2
	 PPFI A 0 A_TakeInventory("SplayerPrimary",2)
	 PPFI A 0 A_FireBullets (0, 0, 3, 17, "BP_TorsoGib",0,90)
	 PPFI A 0 A_PlaySound("splayer/fire", CHAN_WEAPON)
	 SLID A 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 PPFI A 0 A_FireCustomMissile("ShakeYourAssQuad")
	 TNT1 A 0 A_SpawnItemEx("ShooterLight",0,0,0)
	 PPFI A 0 A_fireCustomMissile("SplayerMuzzleFX",0,0,8)
	 PPFI A 0 A_FireBullets (8.2, 5.1, 20, 4, "BP_Shotgun")
	 PPFI A 0 A_Recoil(8)
	 PPFI A 0 A_SetPitch(pitch-9.5)
	 SLFI A 1 bright A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 PPFI A 0 A_SetPitch(pitch+1.0)
	 SLFI B 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 PPFI A 0 A_SetPitch(pitch+1.0)
	 SLFI C 2 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLFI D 3 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLFI E 2 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLFI FG 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 PPFI A 0 A_JumpIfInventory("SplayerSecondary",2,"Cock")
	 Goto Ready+5
  Cock:
	 SLID A 3 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLCK A 0 A_PlaySoundEx("splayer/cockback","SoundSlot6")
	 SLID A 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLCK AB 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLCK C 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 SLCK H 0 A_PlaySoundEx("splayer/cockforward","SoundSlot6")
	 SLCK H 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 TNT1 AA 0 A_FireCustomMissile("ShotCaseSpawn",-7,0,26,-3)
	 SLCK DEFG 2 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	 Goto Ready+5
  AltFire:
	 PPFI A 0 A_JumpIfInventory("SemiAutomatic",1,"ToFull")
	 Goto ToSemi
  ToFull:
	 PPFI A 0 A_TakeInventory("SemiAutomatic",1)
	 TNT1 A 0 ACS_ExecuteAlways(82,0,17,0,0)
	 PPFI A 0 A_Print("Switched to Fully Automatic mode.")
	 Goto Ready+5
  ToSemi:
	TNT1 A 0 ACS_ExecuteAlways(82,0,18,0,0)
	 PPFI A 0 A_GiveInventory("SemiAutomatic",1)
	 PPFI A 0 A_Print("Switched to Semi Automatic mode.")
	 Goto Ready+5
  Spawn:
    PPSH F -1
    Stop
  }
}