actor BFGEffectSpawner
{
  +NOGRAVITY
  Radius 1
  Height 1
  Speed 0
  //ExplosionDamage 256
  Renderstyle NONE
  -RANDOMIZE
  +NOCLIP
  -SOLID
  -SHOOTABLE
  +NOBLOCKMAP
  States
  {
  Spawn:
    BFE1 A 2 bright
    BFE1 BBBBBBBB 0 bright A_CustomMissile("BFGEffect3",0,0,random(-180,180),2,random(-90,90))
    BFE1 A 6 bright
    BFE1 BBBBBBBB 1 bright A_CustomMissile("BFGEffect2",0,0,random(-180,180),2,random(-90,90))
    BFE1 BBBBDDDD 2 bright A_CustomMissile("BFGEffect",0,0,random(-180,180),2,random(-90,90))
    BFE1 EF 8 bright
    stop
  }
}
actor BelphEffectSpawner : BFGEffectSpawner
{

  States
  {
  Spawn:
    BFE1 A 0
    BFE1 AAAAAA 0 bright A_CustomMissile("BFGEffect",0,0,random(-180,180),2,random(-90,90))
    stop
  }
}

actor SSTBFGBall //: BFGBall replaces BFGBall
{
  Game Doom
  SpawnID 128
  Radius 13
  Height 8
  Speed 25
  Damage 125
  +EXTREMEDEATH
  Renderstyle Add
  Alpha 0.75
  seesound "weapons/bfgball"
  DeathSound "weapons/bfgx"
  Projectile
  -RANDOMIZE
	+FORCEXYBILLBOARD
  damagetype "Plasma"
  Obituary "%o was vaporized by %k's BFG9000."
  States
  {
  Spawn:
    BFS1 A 0 bright
    TNT1 A 0 bright A_SpawnItemEx("bfgflare2", 0,0,0, 0,0,0, 0, 160)
    BFS1 AA 1 bright
	NULL A 0 A_SpawnItemEx ("GreenParticleSphere", 0,0,0, 0,0,0, 0, 160) 
    BFS1 BB 1 bright
	NULL A 0 A_SpawnItemEx ("GreenParticleSphere", 0,0,0, 0,0,0, 0, 160) 
  Hurr:
    BFS1 AAAABBBB 1 bright A_SpawnItemEx ("BFGTrail", 0,random(-2,2),random(-8,-4), 0, 0, 0, 0, 160) 
    loop
  Death:
    TNT1 A 0 bright A_SpawnItemEx("bfgflare", 0,0,0, 0,0,0, 0, 160)
    BFE1 A 0 A_SpawnItemEx ("BFGEffectSpawner", 0, 0, 0, 0, 0, 0, 0, 160)
    BFE1 A 0 bright A_Explode(100, 512, 0)
    BFE1 A 0 bright A_Explode(random(30,60), 384, 0)
    BFE1 A 0 bright A_Explode(25, 352, 0)
    BFE1 A 0 bright A_Explode(20, 320, 0)
    BFE1 A 0 bright A_Explode(15, 288, 0)
    BFE1 A 2 bright A_Explode(random(5,25), 256, 0)
    BFE1 A 0 A_BFGSpray("BFGExtra", 40, random(5,6)) // the last parameter, damage, was 5 in v1 of SST
    BFE1 A 2 bright A_Explode(random(5,25), 256, 0)
    BFE1 A 0 A_BFGSpray("BFGExtra", 40, random(5,6))
	NULL A 0 Radius_Quake (4.0, 16, 0, 12, 0)
    BFE1 A 2 bright A_Explode(10, 224, 0)
    BFE1 A 0 A_BFGSpray("BFGExtra", 40, random(5,6))
    BFE1 A 2 bright A_Explode(10, 224, 0)
    BFE1 BB 2 bright A_Explode(random(30,75), 192, 0)
    BFE1 BB 2 bright A_Explode(20, 160, 0)
    BFE1 CC 2 bright A_Explode(random(25,40), 128, 0)
	NULL A 0 Radius_Quake (2.0, 12, 0, 12, 0)
    BFE1 CC 2 bright A_Explode(30, 96, 0)
    BFE1 DD 2 bright A_Explode(35, 64, 0)
    BFE1 DD 2 bright A_Explode(40, 32, 0)
	NULL A 0 Radius_Quake (1.0, 16, 0, 12, 0)
    BFE1 EF 8 bright
    stop
  }
}

ACTOR BFGEffect
{
   Radius 1
   Height 1
   Speed 3
   Damage 0
   PROJECTILE
   RENDERSTYLE ADD
	+FORCEXYBILLBOARD
   ALPHA 0.475
   Scale 0.75
   States
   {
   Spawn:
    TNT1 A 0
   	TNT1 A 0 Thing_ChangeTID (0, 1330) 
      PSNE HHHIIIJJJKKKLLLMMM 1 Bright A_Fadeout(0.02)
      Stop
   }
}

ACTOR BFGEffect2 : BFGEffect
{
   Speed 4
   Scale 1
}

ACTOR BFGEffect3 : BFGEffect
{
   RENDERSTYLE Translucent
   ALPHA 0.3
   Speed 5
   Scale 1
}
actor BFGTrail
{
  Radius 1
  Height 1
  Speed 0
  Damage 0
  Projectile
	+FORCEXYBILLBOARD
  -RANDOMIZE
  +NOCLIP
  RenderStyle Add
  Alpha 0.46
  scale 0.8
  States
  {
  Spawn:
    TFOG A 0
    TFOG A 0 Thing_ChangeTID (0, 1330) 
    TFOG AAAABBBBCCCCDDDDEEEEFF 1 bright
    TFOG FFFFGGGGGGGGHHHHHHHHIIIIIIIIJJJJJJJJJJJJJJJJ 1 bright A_FadeOut(0.01)
    stop
  }
}

actor SSTBFG9000 : BFG9000 22089//replaces BFG9000
{
 //$Category Weapons
  Game Doom
  Height 20
  SpawnID 31
  Weapon.SelectionOrder 2799
  Weapon.AmmoUse 40
  Weapon.AmmoGive 40
  Weapon.AmmoType "Cell"
  +WEAPON.NOAUTOFIRE
  +NOALERT
	+FORCEXYBILLBOARD
  Inventory.PickupMessage "$GOTBFG9000" // "You got the BFG9000!  Oh, yes."
  Weapon.preferredSkin "9kSkin"
  States
  {
  Ready:
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "ActualReady")
    BFGN EDCB 2
  ActualReady:
    BFGN A 1 A_WeaponReady
    loop
  Deselect:
    TNT1 A 0 ACS_ExecuteAlways(779,0, 2,0,0)
    TNT1 A 0 A_ZoomFactor(1)
    BFGN A 1 A_Lower
    Goto DeSelect+2
  Select:
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "ActualReady")
    TNT1 A 0 ACS_ExecuteAlways(779,0, 7,0,0)
    TNT1 A 0
    BFGN E 1 A_Raise
    Goto Select+3
  Fire:
		TNT1 A 0
		TNT1 A 0 A_BFGSound
		BFGN ABCDE 4
		BFGF AB 1 BRIGHT A_Light1
		BFGF CD 1 BRIGHT A_Light2
		TNT1 A 0 A_ZoomFactor(0.6)
		BFGF E 1 BRIGHT A_LightInverse
		TNT1 A 0 Radius_Quake(1,20,0,2,0)
		BFGF F 0 bright A_firecustommissile("SSTBFGBall",0,1)
		BFGF F 1 bright A_ZoomFactor(0.7)
		BFGF F 1 bright A_ZoomFactor(0.8)
		BFGF F 1 bright A_ZoomFactor(0.9)
		RLGG E 0 A_AlertMonsters
    	TNT1 A 0 A_ZoomFactor(1)
		TNT1 A 0 A_SetPitch(pitch-6)
		BFGF E 2 A_Light0
		BFGF E 0 A_GunFlash
		//TNT1 A 0 ACS_ExecuteAlways(925,0, 600,0,0)
		BFGF D 2 //A_SetPitch(pitch+1)
		BFGF C 2 //A_SetPitch(pitch+2)
		BFGF B 2 //A_SetPitch(pitch+3)
		BFGF A 2 //A_SetPitch(pitch+4)
		TNT1 A 0 A_ReFire
		BFGN EEEEDDDDCCCCBBBBAAAA 1 A_WeaponReady
		goto ActualReady
		
  Flash:
		TNT1 A 1 
		TNT1 AAAA 1 A_SetPitch(pitch+0.25)
		TNT1 AAAA 1 A_SetPitch(pitch+0.5)
		TNT1 AA 1 A_SetPitch(pitch+0.75)
		TNT1 AA 1 A_SetPitch(pitch+0.25)
		Stop
		
  Spawn:
    BFUK A -1
    stop
  }
}

actor SSTBFGExtra : BFGExtra replaces BFGExtra
{
  +NOBLOCKMAP
  +NOGRAVITY
  RenderStyle Add
  Alpha 0.75
  damagetype "plasma"
  States
  {
  Spawn:
	BFE2 A 0
	NULL AAAAAAAA 0 A_SpawnItemEx ("PlasmaBallCrackleSpawner", 0,0,0, 0,0,0, 0, 160) 
    BFE2 AABBCCDD 3 bright A_Playsound("bfg9k/Zap")
    stop
  }
}
