ACTOR BIG_FUCKING_GUN : BrutalWeapon
{
	Game Doom
	Height 20
	SpawnID 31
	Weapon.SelectionOrder 2800
	Weapon.AmmoUse 0
	Weapon.AmmoGive 50
	Weapon.AmmoType "AmmoCell"
    Inventory.PickupSound "BFGREADY"
	+FORCEXYBILLBOARD
	+WEAPON.BFG
	+WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+WEAPON.EXPLOSIVE
	Tag "BFG 9000"
    Inventory.PickupMessage "$GOTBFG9000"
	Scale 0.8
	DropItem "BFG9000Spawner"
	States
	{
	Ready3:
	Ready:
	Reload:
		BFGN A 1 A_WeaponReady
        BFGN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        BFGN A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		BFGN A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		BFGN A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		BFGN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		BFGN A 0 A_JumpIfInventory("IsRunning",1,"StartSprint")
		Loop

	NoAmmo:
		BFGN A 1
		BFGN A 2 A_PlaySound("weapons/empty", 4)
		Goto Ready3

	StartSprint:
		BFGN A 1 A_WeaponReady
		SHTN A 0 A_Takeinventory("Zoomed",1)
        SHTN A 0 A_ZoomFactor(1.0)
		SHTN A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_SetCrosshair(0)
		SHTN A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.

	Sprinting:
		BFSP A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		BFSP A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		BFSP A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		BFSP A 1 offset(0,38) A_SetPitch(pitch -0.5)
		BFSP A 1 offset(3,36) A_SetPitch(pitch -0.5)
		BFSP A 1 offset(6,34) A_SetPitch(pitch -0.5)
		BFSP A 1 offset(9,32) A_SetPitch(pitch -0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		BFSP A 1 offset(9,34) A_SetPitch(pitch +0.5)
		BFSP A 1 offset(6,36) A_SetPitch(pitch +0.5)
		BFSP A 1 offset(3,38) A_SetPitch(pitch +0.5)
		BFSP A 1 offset(0,38) A_SetPitch(pitch +0.5)
		BFSP A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		BFSP A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		BFSP A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		TNT1 A 0 A_GiveInventory("UsedStamina", 3)
		SMGG A 0 A_WeaponReady(WRF_NOBOB)
		SMGG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        SMGG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        SMGG A 0 A_JumpIfInventory("Reloading",1,"Reload")

		PLAY A 0 ACS_NamedExecuteAlways("BDSprint", 0, 0, 0, 0)//Makes player faster.
		SMGG A 0 A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint

	StopSprint:
		BFSP A 0 A_JumpIfInventory("PowerStrength", 1, 2)
		BFGN A 0 A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		BFSP A 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		Goto Ready

	StopSprintTired:
		BFSP A 1 ACS_NamedExecuteAlways("BDTacticalSpeed", 0, 0, 0, 0)//Makes player slower.
		BFGN A 0 A_PlaySound("Tired", 2)
		Goto Ready

	Deselect:
		BFGN A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_TakeInventory("Unloading", 1)
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		TNT1 A 0 A_TakeInventory("StartDualWield",1)
		TNT1 AAAAAAAAAAAA 0 A_Lower
		BFGS EDCBA 1 A_Lower
		Wait

	Select:
		TNT1 A 0
		BFGN A 0 A_Giveinventory("GoSpecial",1)
		TNT1 A 0 A_TakeInventory("FistsSelected", 1)
		TNT1 A 0 A_TakeInventory("ShotgunSelected", 1)
		TNT1 A 0 A_TakeInventory("MinigunSelected", 1)
		TNT1 A 0 A_TakeInventory("SSGSelected", 1)
		TNT1 A 0 A_TakeInventory("RocketLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("GrenadeLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("PlasmaGunSelected", 1)
		TNT1 A 0 A_TakeInventory("RailGunSelected", 1)
		TNT1 A 0 A_TakeInventory("RevenantLauncherSelected", 1)
		TNT1 A 0 A_TakeInventory("SubMachineGunSelected", 1)
		TNT1 A 0 A_TakeInventory("BFG10KSelected", 1)
		TNT1 A 0 A_GiveInventory("BFGSelected", 1)
		TNT1 A 0 A_TakeInventory("FlameCannonSelected", 1)
		TNT1 A 0 A_TakeInventory("SawSelected", 1)
		BFGN A 0 A_Takeinventory("HasBarrel",1)
		BFGN A 0 A_TakeInventory("TossGrenade", 1)
		BFGN A 0 A_GunFlash
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAAAA 0 A_Raise
        BFGN A 0 A_PlaySound("BFGREADY")
		SelectAnimation:
		BFGS ABCDE 1 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready


	Fire:
		BFGN A 0
		BFGN A 0 A_JumpIfInventory("AmmoCell",50,2)
        Goto NoAmmo
		BFGN A 0
		BFGN A 0 A_TakeInventory("AmmoCell", 50)
        BFGN A 0 A_PlaySound("BFGCHARGE")
		BFGC ABCDABCDABCDABCDABCDABCDABCD 1 BRIGHT A_FireCustomMissile("GreenFlareSpawn", 0, 0, 0, 0)
        BFGA A 2 BRIGHT A_FireCustomMissile("GreenFlareSpawn", 0, 0, 0, 0)
        BFGN A 0 A_PlaySound("BFGFIRE")
		BFGA B 0 A_ZoomFactor(0.95)
        BFGN A 0 A_Recoil(4)

        BFGN A 0 BRIGHT A_FireCustomMissile("Alerter",0,0)
		BFGN A 0 BRIGHT A_FireCustomMissile("SuperBFGBall")
		BFGN A 0
		Goto RecoilFire

	RecoilFire:
		BFGN A 0
		BFGA B 2 BRIGHT
		TNT1 A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
		RIFG A 0 A_SetPitch(-4 + pitch)
		RIFG A 0 A_SetPitch(-4 + pitch)
		BFGA CDCBA 2 BRIGHT A_SetPitch(pitch+0.8)
		BFGN A 8
        BFGN A 0 A_Refire
		Goto Ready3

	Spawn:
		BFUG A -1
		Stop
	}
}

Actor SuperBFGBall : BFGBall
{
	Damage (random(800, 800))
	Decal BFGLightning
	DeathSound "BFGEXPLO"
	DamageType Desintegrate
	Species "Marines"
	+THRUSPECIES
	+EXTREMEDEATH
  States
  {
 Spawn:
    BFGN A 0 A_SpawnItemEx("BFGFOG", 0, 0)
    BFS1 AB 1 BRIGHT A_SpawnItemEx("BFGTrailParticle", Random(-13, 13), Random(-13, 13), Random(0, 18), Random(1, 3), 0, (0.1)*Random(-10, 10), Random(-20, 20), 128)
    Loop

 Death:
    BFGN A 0
    BFGN A 0 Radius_Quake(4,35,0,10,0)
	TNT1 A 0 A_CustomMissile("ExplosionSplashSpawner")
	BFGN A 0 A_SpawnItemEx ("UnderwaterExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
    TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterNoFire",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	BFGN A 0 A_SpawnItemEx ("DetectCeilCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	TNT1 A 0 A_PlaySOund("BFGEXPL2", 1)
	BFGN A 0 Bright A_SpawnItem("GreenShockWave",0,0,0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 0, 0, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 50, 0, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", -50, 0, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 0, 50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 0, -50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 50, 50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 50, -50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", -50, 50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", -50, -50, 0)
	EXPL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BFGDeathParticleFast", 0, 0, random (0, 360), 2, random (0, 360))
	EXPL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BFGDeathParticleSuperFast", 0, 0, random (0, 360), 2, random (0, 360))
	EXPL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BFGDeathParticleFast", 0, 0, random (0, 360), 2, random (0, 360))
	EXPL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BFGDeathParticleFast", 0, 0, random (0, 360), 2, random (0, 360))

	BFGB A 2 BRIGHT A_Explode(700,350,0)
    BFGB F 0 Bright A_BFGSpray("SuperBFGExtra", 50)
	BFGB BCDEFG 2 Bright
	BFGN A 0 A_SPawnItem("SuperBFGExtraGiant")
    TNT1 A 12
    Stop
  }
}

Actor FriendlyBFGBAll : SuperBFGBall
{
    Damagetype "FriendBullet"
	States
	{
	Death:
    BFGN A 0
    BFGN A 0 Radius_Quake(4,35,0,10,0)
	TNT1 A 0 A_CustomMissile("ExplosionSplashSpawner")
	BFGN A 0 A_SpawnItemEx ("UnderwaterExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
    TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterNoFire",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	BFGN A 0 A_SpawnItemEx ("DetectCeilCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	TNT1 A 0 A_PlaySOund("BFGEXPL2", 1)
	BFGN A 0 Bright A_SpawnItem("GreenShockWave",0,0,0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 0, 0, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 50, 0, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", -50, 0, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 0, 50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 0, -50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 50, 50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", 50, -50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", -50, 50, 0)
	EXPL A 0 A_SpawnItemEx("BFGBigFlare", -50, -50, 0)
	EXPL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BFGDeathParticleFast", 0, 0, random (0, 360), 2, random (0, 360))
	EXPL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BFGDeathParticleSuperFast", 0, 0, random (0, 360), 2, random (0, 360))
	EXPL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BFGDeathParticleFast", 0, 0, random (0, 360), 2, random (0, 360))
	EXPL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("BFGDeathParticleFast", 0, 0, random (0, 360), 2, random (0, 360))

	BFGB A 2 BRIGHT A_Explode(700,350,0)
    BFGB F 0 Bright A_BFGSpray("MarineBFGExtra", 50)
	BFGB BCDEFG 2 Bright
	BFGN A 0 A_SPawnItem("MarineBFGExtraGiant")
    TNT1 A 12
    Stop
	}
}

Actor BFGTrailParticle
{
  Height 0
  Radius 0
  Mass 0
  Speed 3
  +Missile
  +NoBlockMap
  +NoGravity
  +DontSplash
  RenderStyle Add
  Scale 0.05
  States
  {
  Spawn:
    SPKG A 2 Bright A_FadeOut(0.02)
    Loop
  }
}

Actor BFGDeathParticle
{
  Height 0
  Radius 0
  Mass 0
  +Missile
  +NoBlockMap
  -NoGravity
  +LowGravity
  +DontSplash
  +DoomBounce
  BounceFactor 0.5
  RenderStyle Add
  Scale 0.04
  States
  {
  Spawn:
  Death:
    SPKG A 2 Bright A_FadeOut(0.02)
    Loop
  }
}

Actor BFGDeathParticleFast: BFGDeathParticle
{
  Speed 10
  Scale 0.1
  States
  {
  Spawn:
  Death:
	SPKG A 11 BRIGHT
    SPKG AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2 Bright A_FadeOut(0.06)
    Stop
  }
}

Actor BFGDeathParticleSuperFast: BFGDeathParticleFast
{
  Speed 20
}

Actor SuperBFGExtra : BFGExtra Replaces BFGExtra
{
  +NoBlockMap
  +NoGravity
  RenderStyle Add
  +FORCERADIUSDMG
  +THRUGHOST
  +MTHRUSPECIES
  Alpha 0.75
  Scale 0.6
  States
  {
  Spawn:
    BFE2 A 0
    TNT1 AAAAA 0 A_SpawnItemEx("BFGExtraParticle", 0, 0, 14, (0.1)*Random(10, 40), 0, (0.1)*Random(-40, 40), Random(0, 360), 128)
    TNT1 AAAAA 0 A_SpawnItemEx("BFGExtraParticle", 0, 0, 14, (0.1)*Random(10, 40), 0, (0.1)*Random(-40, 40), Random(0, 360), 128)
    TNT1 AAAAA 0 A_SpawnItemEx("BFGExtraParticle", 0, 0, 14, (0.1)*Random(10, 40), 0, (0.1)*Random(-40, 40), Random(0, 360), 128)
	BFGB ABCDEFG 2 Bright A_SpawnItem("GreenFlareMedium",0,0)
    stop
  }
}

Actor MarineBFGExtra : SuperBFGExtra
{
	DamageType "FriendBullet"
}

Actor SuperBFGExtraGiant : SuperBFGExtra
{
	Scale 2.9
	States
	{
	Spawn:
	BFE2 A 0
	BFGB ABCDEFG 2 Bright A_SpawnItem("GreenFlare",0,0)
	Stop
	}
}

Actor MarineBFGExtraGiant : MarineBFGExtra
{
	Scale 2.9
	States
	{
	Spawn:
	BFE2 A 0
	BFGB ABCDEFG 2 Bright A_SpawnItem("GreenFlare",0,0)
	Stop
	}
}

Actor BFGExtraParticle
{
  Height 0
  Radius 0
  Mass 0
  +Missile
  +NoBlockMap
  +DontSplash
  +NoInteraction
  RenderStyle Add
  Scale 0.035
  States
  {
  Spawn:
  Death:
    SPKG A 2 Bright A_FadeOut(0.1)
    Loop
  }
}

ACTOR GreenShockWave
{
   Speed 0
   Height 64
   Radius 32
   Scale 2.25
   RenderStyle add
   Alpha 0.9
   +DROPOFF
   +NOBLOCKMAP
   +NOGRAVITY
   +CLIENTSIDEONLY
   +NONETID
   States
   {
   Spawn:
      SHOK ABCDEFGHIJKLMNOPQR 1 BRIGHT A_FadeOut(0.05)
      Stop
   }
}

ACTOR WhiteShockWave: GreenShockwave
{
Scale 2.0
Alpha 0.05
   States
   {
   Spawn:
      SHWK A 1
      SHWK CEGIKMOQ 1 A_FadeOut(0.01)
      Stop
   }
}

ACTOR WhiteShockWaveBig: WhiteShockWave
{
Scale 3.0
}

ACTOR WhiteShockWaveSmall: WhiteShockWave
{
Scale 1.0
}

ACTOR BFGFOG
{
    Radius 1
    Height 1
	Alpha 0.7
	RenderStyle Add
	Scale 0.4
	Speed 8
	Gravity 0
    +NOBLOCKMAP
    +NOTELEPORT
    +DONTSPLASH
	+MISSILE
	+FORCEXYBILLBOARD
    +CLIENTSIDEONLY
    States
    {
    Spawn:
		TNT1 A 2
        BFOG ABCDEF 1 BRIGHT
		Stop
    }
}

ACTOR BFGBIGFOG: BFGFOG
{
	Scale 0.8
}

ACTOR SmallGreenFog: BFGFOG
{
	Speed 3
	Scale 0.5
}