ACTOR CasingSmoke
{
	+CLIENTSIDEONLY
	+MISSILE
	-NOGRAVITY
	-LOWGRAVITY
	+FORCEXYBILLBOARD
	+THRUACTORS
	-SOLID
	Speed 2
	Scale 0.2
	Renderstyle Add
	Alpha 0.2
	Gravity 0.7
	States
	{
	Spawn:
	SMOK A 0
	SMOK ABCDEFGHIJKLMNOPQR 1 bright A_FadeOut(0.03)
	Stop
	}
}

ACTOR CasingSpark
{
	+CLIENTSIDEONLY
	+MISSILE
	-NOGRAVITY
	-LOWGRAVITY
	+FORCEXYBILLBOARD
	+THRUACTORS
	-SOLID
	Speed 3
	Scale 0.02
	Renderstyle Add
	Alpha 1.0
	Gravity 0.3
	States
	{
	Spawn:
	SPRK A 0
	SPRK AAAAA 1 bright A_ScaleVelocity(0.95)
	SPRK AAAAAAAAAA 1 bright A_FadeOut(0.1)
	Stop
	}
}

ACTOR RifleCaseSpawn
{
	Speed 20
	PROJECTILE
	+NOCLIP
	+CLIENTSIDEONLY
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 0 A_CustomMissile("EmptyBrass",-5,0,random(-80,-100),2,random(45,80))
		TNT1 AAAA 0 A_CustomMissile("CasingSpark",5,0,random(-80,-100),2,random(-10,65))
		TNT1 AAA 0 A_CustomMissile("CasingSmoke",5,0,random(-80,-100),2,random(-10,65))
		TNT1 A 1
		TNT1 A 1
		Stop
	}
}

ACTOR ExplosiveCaseSpawn
{
	Speed 20
	PROJECTILE
	+NOCLIP
	+CLIENTSIDEONLY
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 0 A_CustomMissile("EmptyExplosive",-5,0,random(-80,-100),2,random(45,80))
		TNT1 AAAA 0 A_CustomMissile("CasingSpark",5,0,random(-80,-100),2,random(-10,65))
		TNT1 AAA 0 A_CustomMissile("CasingSmoke",5,0,random(-80,-100),2,random(-10,65))
		TNT1 A 1
		TNT1 A 1
		Stop
	}
}

ACTOR M1ClipShooter
{
	Speed 20
	PROJECTILE
	+NOCLIP
	+CLIENTSIDEONLY
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 0 A_CustomMissile("M1Clip",-5,0,random(-80,-100),2,random(45,80))
		TNT1 A 1
		TNT1 A 1
		Stop
	}
}

ACTOR LongRifleCaseSpawn
{
	Speed 20
	PROJECTILE
	+NOCLIP
	+CLIENTSIDEONLY
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 0 A_CustomMissile("EmptyRifle",-5,0,random(-80,-100),2,random(45,80))
		TNT1 AAAA 0 A_CustomMissile("CasingSpark",5,0,random(-80,-100),2,random(-10,65))
		TNT1 AAA 0 A_CustomMissile("CasingSmoke",5,0,random(-80,-100),2,random(-10,65))
		TNT1 A 1
		TNT1 A 1
		Stop
	}
}

ACTOR M1Clip
{
   Height 2
   Radius 2
   Speed 6
Scale 0.1
   BounceType "Doom"
   - NOGRAVITY
   +WINDTHRUST
   +CLIENTSIDEONLY
   +MOVEWITHSECTOR
   +MISSILE
   +NOBLOCKMAP
   -DROPOFF
   +NOTELEPORT
   +FORCEXYBILLBOARD
   +NOTDMATCH
   +GHOST
   BounceSound "m1garand/ping"
   States
   {
   Spawn:
      CAS3 A 0
      CAS3 A 0 A_JumpIf(waterlevel == 2, "Underwater")
      M1CL ABCDEFGHIJKLMNOPQR 1
      Loop

   Underwater:
      M1CL ABCDEFGHIJKLMNOPQR 1 A_FadeOut(0.1)
	  Stop

   Death:
    Rest1:
      M1CL A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
     Vanish:
     TNT1 A 0
     Stop
   }
}

ACTOR EmptyRifle
{
   Height 2
   Radius 2
   Speed 6
   Scale 0.0625
   BounceType "Doom"
   - NOGRAVITY
   +WINDTHRUST
   +CLIENTSIDEONLY
   +MOVEWITHSECTOR
   +MISSILE
   +NOBLOCKMAP
   -DROPOFF
   +NOTELEPORT
   +FORCEXYBILLBOARD
   +NOTDMATCH
   +GHOST
   BounceSound "weapons/casing"
   States
   {
   Spawn:
	  CAS3 A 0
      CAS3 A 0 A_JumpIf(waterlevel == 2, "Underwater")
      CAS3 ABCDEFGH 2
      Loop

   Underwater:
      CAS2 ABCDEFGHAB 3 A_FadeOut(0.1)
	  Stop

   Death:
      LCPJ A 0 A_Jump(256,"Rest1","Rest2","Rest3","Rest4","Rest5","Rest6","Rest7","Rest8")
      Goto Rest1
    Rest1:
      CAS3 A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
	Loop
    Rest2:
      CAS3 E 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest3:
      CAS3 A 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest4:
      CAS3 E 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest5:
      CAS3 A 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest6:
      CAS3 E 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest7:
      CAS3 A 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest8:
      CAS3 E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
     Vanish:
     TNT1 A 0
     Stop
   }
}

ACTOR EmptyExplosive : EmptyRifle
{
   States
   {
   Spawn:
	  CAS5 A 0
      CAS5 A 0 A_JumpIf(waterlevel == 2, "Underwater")
      CAS5 ABCDEFGH 2
      Loop

   Underwater:
      CAS5 ABCDEFGHAB 3 A_FadeOut(0.1)
	  Stop

   Death:
      LCPJ A 0 A_Jump(256,"Rest1","Rest2","Rest3","Rest4","Rest5","Rest6","Rest7","Rest8")
      Goto Rest1
    Rest1:
      CAS5 A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
	Loop
    Rest2:
      CAS5 E 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest3:
      CAS5 A 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest4:
      CAS5 E 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest5:
      CAS5 A 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest6:
      CAS5 E 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest7:
      CAS5 A 250
      CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest8:
      CAS5 E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
   }
}

ACTOR ShotCaseSpawn : RifleCaseSpawn
{
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 1 A_CustomMissile("ShotgunCasing",0,0,random(-80,-100),2,random(40,60))
		Stop
	}
}

ACTOR BlackLinkSpawn : RifleCaseSpawn
{
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 1 A_CustomMissile("BlackLink",0,0,random(-80,-100),2,random(40,60))
		Stop
	}
}

ACTOR IntactShotCaseSpawn : RifleCaseSpawn
{
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 1 A_CustomMissile("IntactShotgunCasing",0,0,random(-80,-100),2,random(40,60))
		Stop
	}
}

ACTOR DragonCaseSpawn : RifleCaseSpawn
{
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 1 A_CustomMissile("DragonCasing",0,0,random(-80,-100),2,random(40,60))
		Stop
	}
}

// Blown-open Shotgun Casing
ACTOR ShotgunCasing
{
   Height 12
   Radius 9
   Speed 6
   Scale 0.15
   +DOOMBOUNCE
   - NOGRAVITY
   +WINDTHRUST
   +CLIENTSIDEONLY
   +MOVEWITHSECTOR
   +MISSILE
   +NOBLOCKMAP
   -DROPOFF
   +NOTELEPORT
   +FORCEXYBILLBOARD
   +NOTDMATCH
   +GHOST
   Bouncefactor 0.75
   BounceSound "weapons/shell"
   BounceType "Doom"
   States
   {
    Spawn:
	  CAS2 A 0
	  CAS2 A 0 A_Jump(255,"Spawn1", "Spawn2")
	Spawn1:
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
      RSHL ABCD 3
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSHL EFGH 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSHL IJKL 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSHL MNOP 3
      Loop
   Spawn2:
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
      RSHL PONM 3
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSHL LKJI 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSHL HGFE 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSHL DCBA 3
      Loop
   Underwater:
      RSHL ABCDEFGHIJ 3 A_FadeOut(0.1)
	  Stop
   Death:
   Death:
      LCPJ A 0 A_Jump(256,"Rest1","Rest2","Rest3","Rest4","Rest5","Rest6","Rest7","Rest8")
      Goto Rest1
    Rest1:
      RSHL A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest2:
      RSHL E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest3:
      RSHL M 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest4:
      RSHL A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest5:
      RSHL E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest6:
      RSHL M 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest7:
      RSHL E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest8:
      RSHL M 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
     Vanish:
     TNT1 A 0
     Stop

   }
}

ACTOR IntactShotgunCasing : ShotgunCasing
{
   States
   {
	Spawn1:
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
      RSH2 ABCD 3
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSH2 EFGH 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSH2 IJKL 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSH2 MNOP 3
      Loop
   Spawn2:
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
      RSH2 PONM 3
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSH2 LKJI 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSH2 HGFE 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  RSH2 DCBA 3
      Loop
   Underwater:
      RSH2 ABCDEFGHIJ 3 A_FadeOut(0.1)
	  Stop
   Death:
   Death:
      LCPJ A 0 A_Jump(256,"Rest1","Rest2","Rest3","Rest4","Rest5","Rest6","Rest7","Rest8")
      Goto Rest1
    Rest1:
      RSH2 A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest2:
      RSH2 E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest3:
      RSH2 M 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest4:
      RSH2 A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest5:
      RSH2 E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest6:
      RSH2 M 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest7:
      RSH2 E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest8:
      RSH2 M 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
     Vanish:
     TNT1 A 0
     Stop

   }
}

ACTOR DragonCasing : ShotgunCasing
{
   States
   {
	Spawn1:
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
      DSHL ABCD 3
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  DSHL EFGH 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  DSHL IJKL 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  DSHL MNOP 3
      Loop
   Spawn2:
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
      DSHL PONM 3
      CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  DSHL LKJI 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  DSHL HGFE 3
	  CAS2 A 0 A_JumpIf(waterlevel >= 2, "Underwater")
	  DSHL DCBA 3
      Loop
   Underwater:
      DSHL ABCDEFGHIJ 3 A_FadeOut(0.1)
	  Stop
   Death:
   Death:
      LCPJ A 0 A_Jump(256,"Rest1","Rest2","Rest3","Rest4","Rest5","Rest6","Rest7","Rest8")
      Goto Rest1
    Rest1:
      DSHL A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest2:
      DSHL E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest3:
      DSHL M 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest4:
      DSHL A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest5:
      DSHL E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest6:
      DSHL M 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest7:
      DSHL E 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest8:
      DSHL M 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
     Vanish:
     TNT1 A 0
     Stop

   }
}

// -- DESTRUCT LINK ----------------------------------------
ACTOR BlackLink : EmptyRifle
{
   Speed 8
   Scale 0.2
   BounceSound ""
   States
   {
   Spawn:
	  LINK A 0
      LINK A 0 A_JumpIf(waterlevel == 2, "Underwater")
      LINK ABCDEFGH 2
      Loop

   Underwater:
      LINK ABCDEFGH 3 A_FadeOut(0.1)
	  Stop

   Death:
      LCPJ A 0 A_Jump(256,"Rest1","Rest2","Rest3","Rest4","Rest5","Rest6","Rest7","Rest8")
      Goto Rest1
    Rest1:
      LINK A 250
	  LINK A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
	Loop
    Rest2:
      LINK A 250
      LINK A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest3:
      LINK A 250
      LINK A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest4:
      LINK A 250
      LINK A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest5:
      LINK A 250
      LINK A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest6:
      LINK A 250
      LINK A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest7:
      LINK A 250
      LINK A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
    Rest8:
      LINK A 250
	  CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
    Loop
   }
}

//=====================================================================
// M60 BULLET BELTS
//=====================================================================

ACTOR M60Shooter11
{
	Speed 5
	PROJECTILE
	+NOCLIP
	+CLIENTSIDEONLY
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 0 A_CustomMissile("M60Belt11",-5,0,0,2,90)
		TNT1 A 1
		Stop
	}
}

ACTOR M60Shooter6 : M60Shooter11
{
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 0 A_CustomMissile("M60Belt6",-5,0,0,2,90)
		TNT1 A 1
		Stop
	}
}

ACTOR M60Shooter3 : M60Shooter11
{
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 0 A_CustomMissile("M60Belt3",-5,0,0,2,90)
		TNT1 A 1
		Stop
	}
}

// 11 bullets
ACTOR M60Belt11
{
	Radius 4
	Height 4
	+MOVEWITHSECTOR
	+CLIENTSIDEONLY
	+THRUACTORS
	Scale 0.5
	States
	{
		Spawn:
			TNT1 A 0
			M60B A 1 A_CheckFloor("Land")
			Loop
		Land:
			M60B D 0 // Play sound here
			Goto OnFloor
		OnFloor:
			M60B D 250
			CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
			Loop
		Vanish:
			M60B DDDDDDDDDD 1 A_FadeOut(0.1)
			Stop
	}
}

// 6 bullets
ACTOR M60Belt6 : M60Belt11
{
	States
	{
		Spawn:
			M60B B 0
			M60B B 1 A_CheckFloor("Land")
			Loop
	}
}

// 3 bullets
ACTOR M60Belt3 : M60Belt11
{
	States
	{
		Spawn:
			TNT1 A 0
			M60B C 1 A_CheckFloor("Land")
			Loop
		Land:
			M60B D 0 // Play sound here
			Goto OnFloor
		OnFloor:
			M60B E 250
			CAS2 A 0 A_JumpIf(0 == (ACS_ExecuteWithResult(823,0,0,0)), "Vanish")
			Loop
		Vanish:
			M60B EEEEEEEEEE 1 A_FadeOut(0.1)
			Stop
	}
}