ACTOR BulletDebris
{
	+NOINTERACTION
	+ALLOWPARTICLES
	+RANDOMIZE
	+CLIENTSIDEONLY
	
	DamageType			MarineFire
	
	RenderStyle			Add
	Alpha				1
	Mass				5
	Scale				0.3
	
	States
	{
		Spawn:
			PUFF A 2 bright
			PUFF A 2
		Melee:
			PUFF A 2 A_FadeOut(0.2)
			goto Melee
	}
}

ACTOR BulletPuff_Standard
{
	+NOINTERACTION
	+ALLOWPARTICLES
	+RANDOMIZE
	+MTHRUSPECIES
	
	DamageType			MarineFire
	
	RenderStyle			Translucent
	Alpha				0.5
	VSpeed				1
	Mass				5
	
	States
	{
		Spawn:
			PUFF A 4 bright
			PUFF AAA 0 bright A_SpawnItemEx("BulletDebris", random(-2, 2), random(-2, 2), random(-2, 2), random(-5, 5), random(-5, 5), random(-5, 5))
			PUFF B 4 A_PlaySound("weapons/rico", CHAN_AUTO)//, 0.6, 0, 2)
			TNT1 A 50 A_Jump(256, "Melee")
			goto Melee
		Melee:
			PUFF CD 4
			stop
	}
}

ACTOR BulletPuff_Blast : BulletPuff_Standard
{
	+PUFFONACTORS
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnitemEx("ShellBlast_PelletSpawner",0,0,0,0,0,0, 0,SXF_TransferPointers)
		TNT1 A 0
		Goto Super::Spawn+1
	}
}

ACTOR BulletPuff_BlastClose : BulletPuff_Standard
{
	+PUFFONACTORS
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 AA 0 A_SpawnitemEx("ShellBlast_PelletSpawner",0,0,0,0,0,0, 0,SXF_TransferPointers)
		TNT1 A 0
		Goto Super::Spawn+1
	}
}


ACTOR BulletPuff_ExplosiveQuad
{
	+NOINTERACTION
	+ALLOWPARTICLES
	+RANDOMIZE
	+PUFFONACTORS
	+MTHRUSPECIES
	+FORCERADIUSDMG
	
	DamageType			MarineFire
	
	RenderStyle			ADD
	Alpha				0.66
	Scale				0.25
	VSpeed				0
	Mass				5
	
	var int user_scale;
	
	States
	{
		Spawn:
			SPKO E 4 bright
		Crash:
			TNT1 A 0 A_SpawnItemEx("BulletDebris", random(-2, 2), random(-2, 2), random(-2, 2), random(-5, 5), random(-5, 5), random(-5, 5))
			MISL B 2 bright A_Explode(20,48,0,1,20)
			MISL C 2 
			MISL D 2 bright A_SetScale(0.2,0.2)
			goto ImOuttaHere
		XDeath:
			TNT1 A 0 A_SpawnItemEx("BulletDebris", random(-2, 2), random(-2, 2), random(-2, 2), random(-5, 5), random(-5, 5), random(-5, 5))
			MISL B 2 bright A_Explode(20,48,0,1,20)
			MISL C 2 
			MISL D 2 bright A_SetScale(0.2,0.2)
			goto ImOuttaHere

		ImOuttaHere:
			TNT1 A 0 A_SetUserVar("user_scale",user_scale+1)
			TNT1 A 0 A_SetScale(0.25-0.06*user_scale,0.25-0.06*user_scale)
			MISL D 1 A_Fadeout(0.05)
			loop
	}
}


ACTOR BulletPuff_Explosive
{
	+NOINTERACTION
	+ALLOWPARTICLES
	+RANDOMIZE
	+PUFFONACTORS
	+PUFFGETSOWNER
	+MTHRUSPECIES
	+NODAMAGETHRUST
	
	DamageType			MarineFire
	
	RenderStyle			ADD
	Alpha				0.66
	Scale				0.35
	VSpeed				0
	Mass				5
	
	var int user_scale;
	
	States
	{
		Spawn:
			SPKO E 4 bright
		Crash:
			TNT1 A 0 A_SpawnItemEx("BulletDebris", random(-2, 2), random(-2, 2), random(-2, 2), random(-5, 5), random(-5, 5), random(-5, 5))
			SPKO E 2 bright A_Explode(5,8,0,1)
			SPKO E 2 bright A_SpawnItemEx("BulletPuff_ExplosiveRemains", 0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
			SPKO E 2 bright A_SetScale(0.3,0.3)
			goto ImOuttaHere
		XDeath:
			TNT1 A 0 A_SpawnItemEx("BulletDebris", random(-2, 2), random(-2, 2), random(-2, 2), random(-5, 5), random(-5, 5), random(-5, 5))
			SPKO E 2 bright A_Explode(5,8,0,1)
			SPKO E 2 bright A_SpawnItemEx("BulletPuff_ExplosiveRemains", 0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
			SPKO E 2 bright A_SetScale(0.3,0.3)
			goto ImOuttaHere
		ImOuttaHere:
			TNT1 A 0 A_SetUserVar("user_scale",user_scale+1)
			TNT1 A 0 A_SetScale(0.3-0.06*user_scale,0.3-0.06*user_scale)
			SPKO E 1 A_Fadeout(0.05)
			loop
	}
}

ACTOR BulletPuff_ExplosiveClose : BulletPuff_Explosive
{
	States
	{
		Spawn:
			SPKO E 4 bright
		Crash:
			TNT1 A 0 A_SpawnItemEx("BulletDebris", random(-2, 2), random(-2, 2), random(-2, 2), random(-5, 5), random(-5, 5), random(-5, 5))
			SPKO E 2 bright A_Explode(7,8,0,1)
			SPKO E 2 bright A_SetScale(0.3,0.3)
			goto ImOuttaHere
		XDeath:
			TNT1 A 0 A_SpawnItemEx("BulletDebris", random(-2, 2), random(-2, 2), random(-2, 2), random(-5, 5), random(-5, 5), random(-5, 5))
			SPKO E 2 bright A_Explode(7,8,0,1)
			SPKO E 2 bright A_SpawnItemEx("FireRemainStatic", 0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
			SPKO E 2 bright A_SetScale(0.3,0.3)
			goto ImOuttaHere
		ImOuttaHere:
			TNT1 A 0 A_SetUserVar("user_scale",user_scale+1)
			TNT1 A 0 A_SetScale(0.3-0.06*user_scale,0.3-0.06*user_scale)
			SPKO E 1 A_Fadeout(0.05)
			loop
	}
}

actor BulletPuff_ExplosiveRemains
{
  Radius 2
  Height 2
  States
  {
  Spawn:
	TNT1 A 3
	TNT1 A 0 A_SpawnItemEx("BP_Explosive_FireRemainSpawner")
    stop
  }
}

actor BP_Explosive_FireRemainSpawner : RandomSpawner
{
  //DropItem "FireRemainBig", 64
  //DropItem "FireRemainSmall", 128
  DropItem "FireRemainLong", 255, 1
  DropItem "FireRemainStandard", 255, 1
  DropItem "FireRemainShort", 255, 1
}

Actor FireRemainBase 
{
  Game Doom
  Radius 16
  Height 8
  RenderStyle Add
  Alpha 0.75
  scale 0.5
  DamageType MarineFire2
  +NODAMAGETHRUST
  +FORCERADIUSDMG
  +PAINLESS
}

Actor FireRemainStatic : FireRemainBase {
  States
  {
  Spawn:
	TNT1 A 0 nodelay A_PlaySoundEx ("vile/firecrkl",CHAN_AUTO, true, 0)
    FIRE ABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD 2 bright A_Explode(5,32,0,0,16)
	TNT1 A 1 A_StopSound (CHAN_AUTO)
	TNT1 A 0 A_Fadeout(0.25)
    Loop
  }
}

Actor FireRemainLong : FireRemainBase {
  States
  {
  Spawn:
	TNT1 A 0 nodelay A_PlaySoundEx ("vile/firecrkl",CHAN_AUTO, true, 0)
    FIRE ABCDABCDABCDEFGH 2 bright A_Explode(5,32,0,0,16)
	TNT1 A 1 A_StopSound (CHAN_AUTO)
    stop
  }
}

Actor FireRemainStandard : FireRemainBase {
  States
  {
  Spawn:
	TNT1 A 0 nodelay A_PlaySoundEx ("vile/firecrkl",CHAN_AUTO, true, 0)
    FIRE ABCDABCDEFGH 2 bright A_Explode(5,32,0,0,16)
	TNT1 A 1 A_StopSound (CHAN_AUTO)
    stop
  }
}


Actor FireRemainShort : FireRemainBase {
  States
  {
  Spawn:
	TNT1 A 0 nodelay A_PlaySoundEx ("vile/firecrkl",CHAN_AUTO, true, 0)
	FIRE ABCDEFGH 2 bright A_Explode(5,32,0,0,16)
	TNT1 A 1 A_StopSound (CHAN_AUTO)
    stop
  }
}


// compad
ACTOR BulletPuff_Player
{
	+NOINTERACTION
	+ALLOWPARTICLES
	+RANDOMIZE
	
	DamageType			MarineFire
	
	RenderStyle			Translucent
	Alpha				0.5
	VSpeed				1
	Mass				5
	
	States
	{
		Spawn:
			PUFF A 4 bright
			PUFF AAA 0 bright A_SpawnItemEx("BulletDebris", random(-2, 2), random(-2, 2), random(-2, 2), random(-5, 5), random(-5, 5), random(-5, 5))
			PUFF B 4 A_PlaySound("weapons/rico", CHAN_AUTO)//, 0.6, 0, 2)
		Melee:
			PUFF CD 4
			stop
	}
}


ACTOR NullPuff : BulletPuff
{
+NOBLOODDECALS
-BloodSplatter
+BLOODLESSIMPACT
  States
  {
  Spawn:
    TNT1 A 4 Bright
    TNT1 A 4 Bright
    // Intentional fall-through
  Melee:
    TNT1 AA 4 Bright
    Stop
  }
}