ACTOR PerkShotgun : Shotgun replaces Shotgun
{	
	decal bulletchip
	States
	{
	Spawn:
		TNT1 A 0 nodelay A_JumpIf(CallACS("skintoggler")==1, "64spawn")
		SHOT A 5
		loop
		
	Ready:
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==1, "64ready")
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==2, "BLready")
		XTSG A 1 A_WeaponReady
		loop
		
	Deselect:
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==1, "64deselect")
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==2, "BLdeselect")
		XTSG A 1 A_Lower
		Loop
		
	Select:
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==1, "64select")
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==2, "BLselect")
		XTSG A 1 A_Raise
		Loop
	
	Fire:
		TNT1 A 0 a_jumpif(callacs("BobToggle")==1, "bobfire")
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==1, "64fire")
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==2, "BLfire")

		XTSG A 3 //3 prefire tics
		
		//7 firing tics
		XTSG B 3 A_FireShotgun
		XTSG CD 2
		
		//27 tics before refire
		XTSG A 1 
		XTSG F 2
		XTSG G 2
		XTSG H 2
		XTSG I 2
		SGXT a 1 
		
		XTSG J 3 //highest weapon raise
			tnt1 a 0 A_JumpIf(CallACS("CasingToggle")==0, +2)
			tnt1 a 0 A_spawnitemex ("shellcasing", 20, 0, 30, random(2,3), random(5,6), random(5,6), 0)
		XTSG K 1
		XTSG L 3 //deepest "pump" frame
		

		XTSG M 2
		XTSG J 2
		XTSG IH 2
		XTSG GF 1
		
		XTSG A 7 A_ReFire
		Goto Ready
		
	Flash:
		TNT1 A 0 A_JumpIf(CallACS("RecoilToggle")==1, "Kickflash")
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==1, "64flash")
		SHTF A 3 Bright A_Light2
		SHTF B 3 Bright A_Light1
		SHTF C 2 Bright A_Light1
		Goto LightDone	
	64flash:
		TNT1 A 0 A_JumpIf(CallACS("RecoilToggle")==1, "64Kickflash")
		SHTG J 3 BRIGHT A_Light1
		SHTG K 2 BRIGHT A_Light2
		Goto LightDone
		
	KickFlash:
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==1, "64flash")
		SHTF A 3 Bright 
			{	
				A_Light2;
				a_zoomfactor(0.99, ZOOM_NOSCALETURNING);
				a_setpitch(pitch-1.0);
			}
		SHTF B 1 Bright  A_Light1 
			tnt1 a 0 a_setpitch(pitch+0.3)
			tnt1 a 0 a_zoomfactor(1.00)	
		SHTF B 1 Bright  A_Light1
			tnt1 a 0 a_setpitch(pitch+0.3)
		SHTF B 1 Bright  A_Light1
			tnt1 a 0 a_setpitch(pitch+0.2)
		SHTF C 2 bright A_Light1
			tnt1 a 0 a_setpitch(pitch+0.2)		
		Goto LightDone
	
	64KickFlash:
		SHTG j 3 Bright 
			{	
				A_Light2;
				a_zoomfactor(0.99, ZOOM_NOSCALETURNING);
				a_setpitch(pitch-1.0);
			}
		SHTG k 1 Bright  A_Light1 
			tnt1 a 0 a_setpitch(pitch+0.3)
			tnt1 a 0 a_zoomfactor(1.00)	
		SHTG k 1 Bright  A_Light1
			tnt1 a 0 a_setpitch(pitch+0.3)
		TNT1 a 1 Bright  A_Light1
			tnt1 a 0 a_setpitch(pitch+0.2)
		TNT1 a 2 A_Light1
			tnt1 a 0 a_setpitch(pitch+0.2)		
		Goto LightDone
	
		
/////////////
//64 STATES//
/////////////
	64Spawn:
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==0, "spawn")	
		64SG b 5
		loop
	64Ready:
		64SG A 1 a_weaponready
		loop
	64Deselect:
		64SG A 1 A_Lower
		Loop
	64Select:
		64SG A 1 A_Raise
		Loop
	64Fire:
		TNT1 A 0 a_jumpif(callacs("BobToggle")==1, "bob64fire")
		TNT1 A 0 A_JumpIf(CallACS("recoiltoggle")==1, "64recoilfire")
		64SG A 3
		SHTG Y 5 A_FireShotgun
		SHTG x 2
		64SG a 3
		SHTG BBC 1 //BBC 2... BBC 3... BBC 4...
		SHTG DE 2
		SHTG F 2
		SHTG G 2
		tnt1 a 0 A_JumpIf(CallACS("CasingToggle")==0, +2)
		TNT1 A 0 A_spawnitemex ("shellcasing", 40, 0, 25, random(0,2), random(4,6), random(3,5), 0)		
		SHTG I 4
		SHTG H 1
		SHTG FEDCB 1
		SHTG X 2
		64SG A 7 A_ReFire
		Goto Ready	
		

////////////////
//BLACK GLOVES//
////////////////
	BLReady:
		BLSG A 1 A_WeaponReady
		Loop
	BLDeselect:
		BLSG A 1 A_Lower
		Loop
	BLSelect:
		BLSG A 1 A_Raise
		Loop
	BLFire:
		TNT1 A 0 a_jumpif(callacs("BobToggle")==1, "bobblfire")
		
		BLSG A 3 //3 prefire tics
		
		//7 firing tics
		BLSG B 3 A_FireShotgun
		BLSG CD 2
		
		//27 tics before refire
		BLSG A 1 
		BLSG F 2
		BLSG G 2
		BLSG H 2
		BLSG I 2
		XLSG a 1 
		
		BLSG J 3 //highest weapon raise
			tnt1 a 0 A_JumpIf(CallACS("CasingToggle")==0, +2)
			tnt1 a 0 A_spawnitemex ("shellcasing", 20, 0, 30, random(2,3), random(5,6), random(5,6), 0)
		BLSG K 1
		BLSG L 3 //deepest "pump" frame
		

		BLSG M 2
		BLSG J 2
		BLSG IH 2
		BLSG GF 1
		
		BLSG A 7 A_ReFire
		Goto Ready
	

		
////////////////////////		
//BOB STATES////////////
////////////////////////
		
	bobFire:
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==1, "bob64fire")
		TNT1 A 0 A_JumpIf(CallACS("skintoggler")==2, "BLbobfire")
			

		
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG A 3 //3 prefire tics
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG B 3 A_FireShotgun
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG C 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG D 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)						
		XTSG A 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)						
		XTSG F 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)						
		XTSG G 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)						
		XTSG H 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)						
		XTSG I 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)						
		SGXT a 1 		
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)						
		XTSG J 3 //highest weapon raise
			tnt1 a 0 A_JumpIf(CallACS("CasingToggle")==0, +2)
			tnt1 a 0 A_spawnitemex ("shellcasing", 20, 0, 30, random(2,3), random(5,6), random(5,6), 0)
		XTSG K 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG L 3 //deepest "pump" frame
		
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG M 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)						
		XTSG J 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG I 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG H 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG G 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		XTSG F 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)				
		
		XTSG A 7 A_ReFire
		Goto Ready



	bob64Fire:
		TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)		
		64SG A 3
				TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)		
		SHTG Y 5 A_FireShotgun
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)			
		SHTG x 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)			
		64SG a 3
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)			
		SHTG B 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)	
		SHTG B 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)	
		SHTG C 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)			
		SHTG D 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)	
		SHTG E 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)			
		SHTG F 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)	
		SHTG G 2
				tnt1 a 0 A_JumpIf(CallACS("CasingToggle")==0, +2)
				TNT1 A 0 A_spawnitemex ("shellcasing", 40, 0, 25, random(0,2), random(4,6), random(3,5), 0)		
				TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)	
		SHTG I 4
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)			
		SHTG H 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)			
		SHTG F 1 
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)	
		SHTG E 1 
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)	
		SHTG D 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)	
		SHTG C 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)	
		SHTG B 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)			
		SHTG X 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)			
		64SG A 7 A_ReFire
		Goto Ready	
		
	BLbobFire:
		TNT1 A 0 A_JumpIf(CallACS("RecoilToggle")==1, "bobblRecoilFire")

			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG A 3
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)		
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG B 3 A_FireShotgun
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)		
		BLSG C 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG D 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG A 1 
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG F 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG G 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG H 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG I 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)		
		XLSG a 1 
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG J 3
			tnt1 a 0 A_JumpIf(CallACS("CasingToggle")==0, +2)
			tnt1 a 0 A_spawnitemex ("shellcasing", 20, 0, 30, random(2,3), random(5,6), random(5,6), 0)
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG K 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG L 3
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)		
		BLSG M 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG J 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG I 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG H 2
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG G 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
		BLSG F 1
			TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)		
		BLSG A 7 A_ReFire
		Goto Ready
		}
}