// --------------------------------------------------------------------------
//
// Doom weapon base class
//
// --------------------------------------------------------------------------

ACTOR DoomWeapon : Weapon
{
	Weapon.Kickback 100
}

// --------------------------------------------------------------------------
//
// Fist 
//
// --------------------------------------------------------------------------

ACTOR Fist : Weapon
{
	Weapon.SelectionOrder 3700
	Weapon.Kickback 100
	Obituary "$OB_MPFIST"
	Tag "$TAG_FIST"
	+WEAPON.WIMPY_WEAPON
	+WEAPON.MELEEWEAPON
	States
	{
	Ready:
		PUNG A 1 A_WeaponReady
		Loop
	Deselect:
		PUNG A 1 A_Lower
		Loop
	Select:
		PUNG A 1 A_Raise
		Loop
	Fire:
		PUNG B 4
		PUNG C 4 A_Punch
		PUNG D 5
		PUNG C 4
		PUNG B 5 A_ReFire
		Goto Ready
	}
}
	

// --------------------------------------------------------------------------
//
// Pistol 
//
// --------------------------------------------------------------------------

ACTOR Pistol : DoomWeapon
{
	Weapon.SelectionOrder 1900
	Weapon.AmmoUse 1
	Weapon.AmmoGive 20
	Weapon.AmmoType "Clip"
	Obituary "$OB_MPPISTOL"
	+WEAPON.WIMPY_WEAPON
	Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED"
	Tag "$TAG_PISTOL"
	States
	{
	Ready:
		PISG A 1 A_WeaponReady
		Loop
	Deselect:
		PISG A 1 A_Lower
		Loop
	Select:
		PISG A 1 A_Raise
		Loop
	Fire:
		PISG A 4
		PISG B 6 A_FirePistol
		PISG C 4
		PISG B 5 A_ReFire
		Goto Ready
	Flash:
		PISF A 7 Bright A_Light1
		Goto LightDone
		PISF A 7 Bright A_Light1
		Goto LightDone
 	Spawn:
		PIST A -1
		Stop
	}
}
		
// --------------------------------------------------------------------------
//
// Chainsaw
//
// --------------------------------------------------------------------------

ACTOR Chainsaw : Weapon
{
	Weapon.Kickback 0
	Weapon.SelectionOrder 2200
	Weapon.UpSound "weapons/sawup"
	Weapon.ReadySound "weapons/sawidle"
	Inventory.PickupMessage "$GOTCHAINSAW"
	Obituary "$OB_MPCHAINSAW"
	Tag "$TAG_CHAINSAW"
	+WEAPON.MELEEWEAPON		
	States
	{
	Ready:
		SAWG CD 4 A_WeaponReady
		Loop
	Deselect:
		SAWG C 1 A_Lower
		Loop
	Select:
		SAWG C 1 A_Raise
		Loop
	Fire:
		SAWG AB 4 A_Saw
		SAWG B 0 A_ReFire
		Goto Ready
	Spawn:
		CSAW A -1
		Stop
	}
}
	

// --------------------------------------------------------------------------
//
// Shotgun
//
// --------------------------------------------------------------------------

ACTOR Shotgun : DoomWeapon
{
	Weapon.SelectionOrder 1300
	Weapon.AmmoUse 1
	Weapon.AmmoGive 8
	Weapon.AmmoType "Shell"
	Inventory.PickupMessage "$GOTSHOTGUN"
	Obituary "$OB_MPSHOTGUN"
	Tag "$TAG_SHOTGUN"
	States
	{
	Ready:
		SHTG A 1 A_WeaponReady
		Loop
	Deselect:
		SHTG A 1 A_Lower
		Loop
	Select:
		SHTG A 1 A_Raise
		Loop
	Fire:
		SHTG A 3
		SHTG A 7 A_FireShotgun
		SHTG BC 5
		SHTG D 4
		SHTG CB 5
		SHTG A 3
		SHTG A 7 A_ReFire
		Goto Ready
	Flash:
		SHTF A 4 Bright A_Light1
		SHTF B 3 Bright A_Light2
		Goto LightDone
	Spawn:
		SHOT A -1
		Stop
	}
}	

// --------------------------------------------------------------------------
//
// Shotgun
//
// --------------------------------------------------------------------------

ACTOR SuperShotgun : DoomWeapon
{
	Weapon.SelectionOrder 400
	Weapon.AmmoUse 2
	Weapon.AmmoGive 8
	Weapon.AmmoType "Shell"
	Inventory.PickupMessage "$GOTSHOTGUN2"
	Obituary "$OB_MPSSHOTGUN"
	Tag "$TAG_SUPERSHOTGUN"
	States
	{
	Ready:
		SHT2 A 1 A_WeaponReady
		Loop
	Deselect:
		SHT2 A 1 A_Lower
		Loop
	Select:
		SHT2 A 1 A_Raise
		Loop
	Fire:
		SHT2 A 3
		SHT2 A 7 A_FireShotgun2
		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
	// unused states
		SHT2 B 7
		SHT2 A 3
		Goto Deselect
	Flash:
		SHT2 I 4 Bright A_Light1
		SHT2 J 3 Bright A_Light2
		Goto LightDone
	Spawn:
		SGN2 A -1
		Stop
	}
}

// --------------------------------------------------------------------------
//
// Chaingun
//
// --------------------------------------------------------------------------

ACTOR Chaingun : DoomWeapon
{
	Weapon.SelectionOrder 700
	Weapon.AmmoUse 1
	Weapon.AmmoGive 20
	Weapon.AmmoType "Clip"
	Inventory.PickupMessage "$GOTCHAINGUN"
	Obituary "$OB_MPCHAINGUN"
	Tag "$TAG_CHAINGUN"
	States
	{
	Ready:
		CHGG A 1 A_WeaponReady
		Loop
	Deselect:
		CHGG A 1 A_Lower
		Loop
	Select:
		CHGG A 1 A_Raise
		Loop
	Fire:
		CHGG AB 4 A_FireCGun
		CHGG B 0 A_ReFire
		Goto Ready
	Flash:
		CHGF A 5 Bright A_Light1
		Goto LightDone
		CHGF B 5 Bright A_Light2
		Goto LightDone
	Spawn:
		MGUN A -1
		Stop
	}
}

// --------------------------------------------------------------------------
//
// Rocket launcher
//
// --------------------------------------------------------------------------

ACTOR RocketLauncher : DoomWeapon
{
	Weapon.SelectionOrder 2500
	Weapon.AmmoUse 1
	Weapon.AmmoGive 2
	Weapon.AmmoType "RocketAmmo"
	+WEAPON.NOAUTOFIRE
	Inventory.PickupMessage "$GOTLAUNCHER"
	Tag "$TAG_ROCKETLAUNCHER"
	States
	{
	Ready:
		MISG A 1 A_WeaponReady
		Loop
	Deselect:
		MISG A 1 A_Lower
		Loop
	Select:
		MISG A 1 A_Raise
		Loop
	Fire:
		MISG B 8 A_GunFlash
		MISG B 12 A_FireMissile
		MISG B 0 A_ReFire
		Goto Ready
	Flash:
		MISF A 3 Bright A_Light1
		MISF B 4 Bright
		MISF CD 4 Bright A_Light2
		Goto LightDone
	Spawn:
		LAUN A -1
		Stop
	}
}

ACTOR Rocket
{
	Radius 11
	Height 8
	Speed 20
	Damage 20
	Projectile
	+RANDOMIZE
	+DEHEXPLOSION
	+ROCKETTRAIL
	SeeSound "weapons/rocklf"
	DeathSound "weapons/rocklx"
	Obituary "$OB_MPROCKET"
	States
	{
	Spawn:
		MISL A 1 Bright
		Loop
	Death:
		MISL B 8 Bright A_Explode
		MISL C 6 Bright
		MISL D 4 Bright
		Stop
	}
}

// --------------------------------------------------------------------------
//
// Grenade -- Taken and adapted from Skulltag, with MBF stuff added to it
//
// --------------------------------------------------------------------------

ACTOR Grenade
{
	Radius 8
	Height 8
	Speed 25
	Damage 20
	Projectile
	-NOGRAVITY
	+RANDOMIZE
	+DEHEXPLOSION
	+GRENADETRAIL
	BounceType "Doom"
	Gravity 0.25
	SeeSound "weapons/grenlf"
	DeathSound "weapons/grenlx"
	BounceSound "weapons/grbnce"
	Obituary "$OB_GRENADE"
	DamageType Grenade

	States
	{
	Spawn:
		SGRN A 1 Bright 
		Loop
	Death:
		MISL B 8 Bright A_Explode
		MISL C 6 Bright
		MISL D 4 Bright
		Stop
	Grenade:
		MISL A 1000 A_Die
		Wait
	Detonate:
		MISL B 4 A_Scream
		MISL C 6 A_Detonate
		MISL D 10
		Stop
	Mushroom:
		MISL B 8 A_Mushroom
		Goto Death+1
	}
}

// --------------------------------------------------------------------------
//
// Plasma rifle
//
// --------------------------------------------------------------------------

ACTOR PlasmaRifle : DoomWeapon
{
	Weapon.SelectionOrder 100
	Weapon.AmmoUse 1
	Weapon.AmmoGive 40
	Weapon.AmmoType "Cell"
	Inventory.PickupMessage "$GOTPLASMA"
	Tag "$TAG_PLASMARIFLE"
	States
	{
	Ready:
		PLSG A 1 A_WeaponReady
		Loop
	Deselect:
		PLSG A 1 A_Lower
		Loop
	Select:
		PLSG A 1 A_Raise
		Loop
	Fire:
		PLSG A 3 A_FirePlasma
		PLSG B 20 A_ReFire
		Goto Ready
	Flash:
		PLSF A 4 Bright A_Light1
		Goto LightDone
		PLSF B 4 Bright A_Light1
		Goto LightDone
	Spawn:
		PLAS A -1
		Stop
	}
}

ACTOR PlasmaBall
{
	Radius 13
	Height 8
	Speed 25
	Damage 5
	Projectile
	+RANDOMIZE
	RenderStyle Add
	Alpha 0.75
	SeeSound "weapons/plasmaf"
	DeathSound "weapons/plasmax"
	Obituary "$OB_MPPLASMARIFLE"
	States
	{
	Spawn:
		PLSS AB 6 Bright
		Loop
	Death:
		PLSE ABCDE 4 Bright
		Stop
	}
}

// --------------------------------------------------------------------------
//
// BFG 2704
//
// --------------------------------------------------------------------------

ACTOR PlasmaBall1 : PlasmaBall
{
	Damage 4
	BounceType "Classic"
	BounceFactor 1.0
	Obituary "$OB_MPBFG_MBF"
	States
	{
	Spawn:
		PLS1 AB 6 Bright
		Loop
	Death:
		PLS1 CDEFG 4 Bright
		Stop
	}
}
	
ACTOR PlasmaBall2 : PlasmaBall1
{
	States
	{
	Spawn:
		PLS2 AB 6 Bright
		Loop
	Death:
		PLS2 CDE 4 Bright
		Stop
	}
}

// --------------------------------------------------------------------------
//
// BFG 9000
//
// --------------------------------------------------------------------------

ACTOR BFG9000 : DoomWeapon
{
	Height 20
	Weapon.SelectionOrder 2800
	Weapon.AmmoUse 40
	Weapon.AmmoGive 40
	Weapon.AmmoType "Cell"
	+WEAPON.NOAUTOFIRE
	Inventory.PickupMessage "$GOTBFG9000"
	Tag "$TAG_BFG9000"
	States
	{
	Ready:
		BFGG A 1 A_WeaponReady
		Loop
	Deselect:
		BFGG A 1 A_Lower
		Loop
	Select:
		BFGG A 1 A_Raise
		Loop
	Fire:
		BFGG A 20 A_BFGsound
		BFGG B 10 A_GunFlash
		BFGG B 10 A_FireBFG
		BFGG B 20 A_ReFire
		Goto Ready
	Flash:
		BFGF A 11 Bright A_Light1
		BFGF B 6 Bright A_Light2
		Goto LightDone
	Spawn:
		BFUG A -1
		Stop
	OldFire:
		BFGG A 10 A_BFGsound
		BFGG BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 1 A_FireOldBFG
		BFGG B 0 A_Light0
		BFGG B 20 A_ReFire
		Goto Ready
	}
}


ACTOR BFGBall
{
	Radius 13
	Height 8
	Speed 25
	Damage 100
	Projectile
	+RANDOMIZE
	RenderStyle Add
	Alpha 0.75
	DeathSound "weapons/bfgx"
	Obituary "$OB_MPBFG_BOOM"
	States
	{
	Spawn:
		BFS1 AB 4 Bright
		Loop
	Death:
		BFE1 AB 8 Bright
		BFE1 C 8 Bright A_BFGSpray
		BFE1 DEF 8 Bright
		Stop
	}
}
		
ACTOR BFGExtra
{
	+NOBLOCKMAP
	+NOGRAVITY
	RenderStyle Add
	Alpha 0.75
	DamageType "BFGSplash"
	States
	{
	Spawn:
		BFE2 ABCD 8 Bright
		Stop
	}
}

