ACTOR Bullet : FastProjectile
{
	+BLOODSPLATTER
	Projectile
	Decal Bullet
	Radius 2
	Height 2
	RenderStyle Add
	Speed 70
	Scale 0.5
	States
	{
	Spawn:
		PUFF A 1 BRIGHT
		Loop
	Death:
		PUFF A 4 Bright
		PUFF B 4
	Crash:
		PUFF CD 4
		Stop
	XDeath:
		TNT1 A 0
		Stop
	}
}

// Different bullets for each weapon
ACTOR PistolBullet : Bullet { Damage 5 }
ACTOR ShotgunBullet : Bullet { Damage 5 }
ACTOR ChaingunBullet : Bullet { Damage 5 }
ACTOR SuperShotgunBullet : Bullet { Damage 5 }

// Create new weapon actors, based on the older ones
ACTOR NewPistol : Pistol replaces Pistol
{
	States
	{
	Fire:
		PISG A 4
		TNT1 A 0 A_FireCustomMissile("PistolBullet", FRandom(-5.6, 5.6))
		TNT1 A 0 A_PlaySound("weapons/pistol", CHAN_WEAPON)
		PISG B 6 A_GunFlash
		PISG C 4
		PISG B 5 A_ReFire
		Goto Ready
	Flash:
		PISF A 7 Bright A_Light1
		Stop
	}
}

ACTOR NewShotgun : Shotgun replaces Shotgun
{
	States
	{
	Fire:
		SHTG A 3
		// The first bullet should use ammo, the remaining 6 shouldn't
		SHTG A 0 A_FireCustomMissile("ShotgunBullet", FRandom(-5.6, 5.6))
		SHTG AAAAAA 0 A_FireCustomMissile("ShotgunBullet", FRandom(-5.6, 5.6), false)
		SHTG A 0 A_PlaySound("weapons/shotgf", CHAN_WEAPON)
		SHTG A 7 A_GunFlash
		SHTG BC 5
		SHTG D 4
		SHTG CB 5
		SHTG A 3
		SHTG A 7 A_ReFire
		Goto Ready
	}
}

ACTOR NewChaingun : Chaingun replaces Chaingun
{
	States
	{
	Fire:
		CHGG A 0 A_PlaySound("weapons/chngun", CHAN_WEAPON)
		CHGG A 0 A_FireCustomMissile("ChaingunBullet", FRandom(-5.6, 5.6))
		CHGG A 4 A_GunFlash("Flash1")
		CHGG B 0 A_PlaySound("weapons/chngun", CHAN_WEAPON)
		CHGG B 0 A_FireCustomMissile("ChaingunBullet", FRandom(-5.6, 5.6))
		CHGG B 4 A_GunFlash("Flash2")
		CHGG B 0 A_ReFire
		Goto Ready
	Flash1:
		CHGF A 5 Bright A_Light1
		Stop
	Flash2:
		CHGF B 5 Bright A_Light2
		Stop
	}
}

ACTOR NewSuperShotgun : SuperShotgun replaces SuperShotgun
{
	States
	{
	Ready:
		SHT2 A 1 A_WeaponReady
		Loop
	Fire:
		SHT2 A 3
		// The first bullet should use ammo, the remaining 19 shouldn't
		SHT2 A 0 A_FireCustomMissile("SuperShotgunBullet", FRandom(-11.2, 11.2), true, 0, 0, 0, FRandom(-7.1, 7.1))
		SHT2 AAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("SuperShotgunBullet", FRandom(-11.2, 11.2), false, 0, 0, 0, FRandom(-7.1, 7.1))
		SHT2 A 0 A_PlaySound("weapons/sshotf", CHAN_WEAPON)
		SHT2 A 7 A_GunFlash
		SHT2 B 7
		SHT2 C 7 A_CheckReload
		SHT2 D 7 A_OpenShotgun2
		SHT2 E 7
		SHT2 F 7 A_LoadShotgun2
		SHT2 G 6
		SHT2 H 6 A_CloseShotgun2
		SHT2 A 5 A_ReFire
		Goto Ready
	}
}

// Custom player to use these guns
ACTOR NewDoomPlayer : DoomPlayer replaces DoomPlayer
{
	Player.StartItem "NewPistol"
	Player.StartItem "Fist"
	Player.StartItem "Clip", 50
	
	Player.WeaponSlot 1, Fist, Chainsaw
	Player.WeaponSlot 2, NewPistol
	Player.WeaponSlot 3, NewShotgun, NewSuperShotgun
	Player.WeaponSlot 4, NewChaingun
	Player.WeaponSlot 5, RocketLauncher
	Player.WeaponSlot 6, PlasmaRifle
	Player.WeaponSlot 7, BFG9000
}