// *** MODIFIED BY CHEBMASTER
// I mark most important places modified by me with //***Che -- unless I forget to.


Actor BFG10k : BrutalWeapon
{
	Radius 20
	Height 20
	Weapon.AmmoUse 5
	Weapon.AmmoGive 100
	Weapon.AmmoType "AmmoCell"
	Weapon.Kickback 100
	Weapon.SelectionOrder 3500
	Inventory.Pickupmessage "You got the BFG10000!  HELL YES!"
	Obituary "%o was blasted by %k's BFG10K"
	Decal BFGLightning
	//+WEAPON.CHEATNOTWEAPON
	
	//***Che: frakking annoying, limits you to horizontal firing 
	//   - but we have a  Quake II bfg now! (sort of)
	+WEAPON.NOAUTOAIM
	
	States
	{
		//***Che disabling player weapons for cutscenes and for the evacuation center
		HoldFire:
			BG2G O 0 offset(40,52) A_JumpIfInventory("Taunting",1,"Taunt")
			BG2G O 0 A_JumpIfInventory("Salute1", 1, "Salute")
			BG2G O 0 A_JumpIfInventory("Salute2", 1, "Salute")
			BG2G O 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			BG2G O 1 offset(40,52) A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
			BG2G O 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire")
			Goto Ready			
		Spawn:
			BFG2 A -1
			Stop
		Ready:
		Ready3:
		SteadY:
			TNT1 A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
			BG2G A 0
			BG2G A 0 A_PlaySound ("10KIDLE", 1)
			BG2G A 3 A_WeaponReady
			BG2G A 0 A_GunFlash
			BG2G A 0 A_JumpIfInventory("Kicking",1,"DoKick")
				BG2G A 0 A_JumpIfInventory("Taunting",1,"Taunt")
				BG2G A 0 A_JumpIfInventory("Salute1", 1, "Salute")
				BG2G A 0 A_JumpIfInventory("Salute2", 1, "Salute")
				BG2G A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
				BG2G A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
				
					BG2G B 3 A_WeaponReady
			BG2G A 0 A_JumpIfInventory("Kicking",1,"DoKick")
				BG2G A 0 A_JumpIfInventory("Taunting",1,"Taunt")
				BG2G A 0 A_JumpIfInventory("Salute1", 1, "Salute")
				BG2G A 0 A_JumpIfInventory("Salute2", 1, "Salute")
				BG2G A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
				BG2G A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
				
					BG2G C 3 A_WeaponReady
			BG2G A 0 A_JumpIfInventory("Kicking",1,"DoKick")
				BG2G A 0 A_JumpIfInventory("Taunting",1,"Taunt")
				BG2G A 0 A_JumpIfInventory("Salute1", 1, "Salute")
				BG2G A 0 A_JumpIfInventory("Salute2", 1, "Salute")
				BG2G A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
				BG2G A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
				
					BG2G D 3 A_WeaponReady
			BG2G A 0 A_JumpIfInventory("Kicking",1,"DoKick")
				BG2G A 0 A_JumpIfInventory("Taunting",1,"Taunt")
				BG2G A 0 A_JumpIfInventory("Salute1", 1, "Salute")
				BG2G A 0 A_JumpIfInventory("Salute2", 1, "Salute")
				BG2G A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
				BG2G A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			Loop
		Deselect:
			BG2G E 1 A_Lower
			Loop
		Select:
			BG2G A 0 A_Giveinventory("GoSpecial",1)
			BG2G A 0 A_Takeinventory("FistsSelected",1)
			BG2G A 0 A_Takeinventory("sawSelected",1)
			BG2G A 0 A_Takeinventory("ShotgunSelected",1)
			BG2G A 0 A_Takeinventory("SSGSelected",1)
			BG2G A 0 A_Takeinventory("MinigunSelected",1)
			BG2G A 0 A_Takeinventory("PlasmaGunSelected",1)
			BG2G A 0 A_Takeinventory("RocketLauncherSelected",1)
			BG2G A 0 A_Takeinventory("GrenadeLauncherSelected",1)
			BG2G A 0 A_Takeinventory("BFGSelected",1)
			BG2G A 0 A_Giveinventory("BFG10kSelected",1)
			BG2G A 0 A_Takeinventory("RailGunSelected",1)
			BG2G A 0 A_Takeinventory("SubMachineGunSelected",1)
			BG2G A 0 A_Takeinventory("RevenantLauncherSelected",1)
			
			//***Che
				"----" A 0 A_Takeinventory("UnmakerSelected",1)
				"----" A 0 A_Takeinventory("MG42Selected",1) //***Che
				"----" A 0 A_Takeinventory("AxeSelected",1) //***Che
					
					"----" A 0 A_Takeinventory("DragonslayerSelected",1) //***Che
					"----" A 0 A_Takeinventory("SniperRifleSelected",1)
					"----" A 0 A_Takeinventory("ShotolverSelected",1)
					"----" A 0 A_Takeinventory("Shotolver2Selected",1)
			
			BG2G A 0 A_Takeinventory("LostSoulSelected",1)
			BG2G A 0 A_Takeinventory("FlameCannonSelected",1)
			BG2G A 0 A_Takeinventory("HasBarrel",1)
		SelectAnimation:	
			BG2G E 1 A_Raise
			BG2G EEEEEEEE 0 A_Raise
			BG2G A 0 A_GunFlash
			BG2G A 0 A_PlaySound("BFGREADY", 3)
			BG2G E 1
			Goto Ready
		Fire:
			TNT1 A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, "HoldFire") //***Che
			"----" A 0 A_GiveInventory ("PlayerIsFighting", 150) //***Che encourages the follower NPCs to get da fug out of your line of fire
			BG2G E 20 A_PlaySound("10KSTART", 4)
			BG2G FGHIJ 2 BRIGHT
			Goto Hold
		Hold:
	
			"----" A 0 A_JumpIf(waterlevel > 2, "ShortUnderwater")
			
				"----" A 0 A_JumpIfInventory("QPowerQuadDamage", 1, 2)
				"----" A 0 A_JumpIf(true, 2)
				"----" A 0 A_PlaySound("quaddamage/echo", CHAN_7) 
				"----" A 0 A_GiveInventory ("PlayerIsFighting", 150) //***Che encourages the follower NPCs to get da fug out of your line of fire
			BG2G K 1 BRIGHT A_FireCustomMissile("GreenFlareSpawn",0,0,0,0)
			BG2G A 0 A_PlaySound("10KFIRE", 1)
			BG2G L 1 BRIGHT A_FireCustomMissile("DeflectableBFG10K_Ball",0,1,0,0)
			BG2G M 1 BRIGHT A_FireCustomMissile("GreenFlareSpawn",0,0,0,0)
			BG2G FGHIJ 1 BRIGHT
			TNT1 A 0 A_JumpIfInventory("DisablePlayerWeapons", 1, 2) //***Che
			BG2G N 0 A_ReFire
			BG2G O 35 A_PlaySound("10KSTOP", 4)
			Goto Ready
		
		
		ShortUnderwater:
			BG2G O 0 A_TakeInventory("AmmoCell", Random(10,20))
			BG2G OOOOOOOOOOOOOOOO 1 A_RadiusGive("ElectricShock", 300, RGF_MONSTERS | RGF_PLAYERS | RGF_GIVESELF)
			BG2G O 70 A_PlaySound("10KSTOP", 4)
			Goto Ready
			
	 CheckSprint:
			BG2G A 1 A_WeaponReady(WRF_NOFIRE)
			BG2G A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
			BG2G A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
			Goto Ready
			
		StartSprint:
			BG2G A 1 A_WeaponReady(WRF_NOFIRE)
			BG2G A 0 A_Takeinventory("Zoomed",1)
			BG2G A 0 A_Takeinventory("ADSmode",1)
			BG2G A 0 A_ZoomFactor(1.0)
			BG2G A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
			
		Sprinting:	
			BG2G A 0 offset(-9,32) 
			BG2G A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
			BG2G A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
			PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
			BG2G A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
			BG2G A 0 offset(-9,32) A_GiveInventory("UsedStamina", 16)
			BG2G A 0 offset(-9,32)
			BG2G A 0 A_PlaySound ("10KIDLE", 1)
			BG2G A 1 offset(-9,34) A_SetPitch(pitch -0.5)
			BG2G A 1 offset(-6,36) A_SetPitch(pitch -0.5)
			BG2G A 1 offset(-3,38) A_SetPitch(pitch -0.5)
			BG2G B 1 offset(0,38) A_SetPitch(pitch -0.5)
			BG2G B 1 offset(3,36) A_SetPitch(pitch -0.5)
			BG2G B 1 offset(6,34) A_SetPitch(pitch -0.5)
			BG2G C 1 offset(9,32) A_SetPitch(pitch -0.5)
			BG2G A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
			BG2G A 0 A_JumpIfInventory("Kicking",1,"DoKick")
			BG2G A 0 A_JumpIfInventory("Taunting",1,"Taunt")
			BG2G A 0 offset(-9,32) A_GiveInventory("UsedStamina", 16)
			BG2G A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
			BG2G C 1 offset(9,34) A_SetPitch(pitch +0.5)
			BG2G C 1 offset(6,36) A_SetPitch(pitch +0.5)
			BG2G C 1 offset(3,38) A_SetPitch(pitch +0.5)
			BG2G D 1 offset(0,38) A_SetPitch(pitch +0.5)
			BG2G D 1 offset(-3,36) A_SetPitch(pitch +0.5)
			BG2G D 1 offset(-6,34) A_SetPitch(pitch +0.5)
			BG2G D 1 offset(-9,32) A_SetPitch(pitch +0.5)
			BG2G A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
			BG2G A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
			Goto StopSprint
			
		StopSprintTired:
			BG2G A 1
			PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
			BG2G A 0 A_PlaySound("Tired", 2)
			BG2G A 0 A_TakeInventory("UsedStamina", 2)
			BG2G A 5 A_WeaponReady
			BG2G A 0 A_TakeInventory("UsedStamina", 2)
			BG2G A 5 A_WeaponReady
			BG2G A 0 A_TakeInventory("UsedStamina", 2)
			BG2G A 5 A_WeaponReady
			BG2G A 0 A_TakeInventory("UsedStamina", 2)
			BG2G A 5 A_WeaponReady
			BG2G A 0 A_TakeInventory("UsedStamina", 2)
			BG2G A 5 A_WeaponReady
			Goto Ready
		StopSprint:
			BG2G A 1
			BG2G A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
			PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
			Goto Ready
			
		Deselect:
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
			BG2G A 0 A_TakeInventory("TossGrenade", 1)
			BG2G A 1 A_Lower
			Loop	
  }
}


//ACTOR BFG10K_Ball: FastProjectile
//***Che moved to Explosives.txt to fix chaos 10k marines becoming helpless in monstersonly because this file is not included there

//ACTOR GreenExplosionFire
//***Che moved to Explosives.txt because belphegor projectiles rely on it but BFG10k.txt is excluded from monstersonly

//ACTOR GreenExplosionFireSmall: GreenExplosionFire
//***Che moved to Explosives.txt

//Actor Evil10kBall: BFG10K_Ball
//***Che moved to Explosives.txt
