// --------------------------------------------------------------------------
//
// New items
//
// --------------------------------------------------------------------------

ACTOR 9mmMagazine : Ammo //Ammo for Beretta, SMG and MP40
{
	Ammo.DropAmount 15
	Inventory.Amount 15
	Inventory.MaxAmount 200
	Ammo.BackpackAmount 15
	Ammo.BackpackMaxAmount 400
	Inventory.Icon "CLIUA0"
	Inventory.PickupMessage "Picked up a magazine."
	Scale 0.7
	States
	{
	Spawn:
		CLI3 A -1
		Stop
	}
}

ACTOR RevolverBullets : Ammo //Ammo for the Revolver
{
	Inventory.Amount 30
	Inventory.MaxAmount 100
	Ammo.BackpackAmount 30
	Ammo.BackpackMaxAmount 200
	Inventory.Icon "RVICB0"
	Inventory.PickupMessage "You got a pack of revolver bullets."
	Scale 0.6
	States
	{
	Spawn:
		RVIC B -1     
	}
}

ACTOR GreenShell : Ammo //Ammo for the AutoShotgun
{
	Ammo.DropAmount 4
	Inventory.Amount 4
	Inventory.MaxAmount 50
	Ammo.BackpackAmount 12
	Ammo.BackpackMaxAmount 100
	Inventory.Icon "2SHLA0"
	Inventory.Pickupsound "SHELPK1"
	Inventory.PickupMessage "Picked up 4 green shotgun shells."
	Scale 0.9
	States
	{
	Spawn:
		2SHL A -1
		Stop
	}
}

ACTOR GreenShellBox : GreenShell //Ammo for the AutoShotgun
{
	Inventory.Amount 16
	Inventory.PickupMessage "Picked up a box of green shotgun shells."
	Inventory.Pickupsound "SHELPK2"
	Scale 0.9
	States
	{
	Spawn:
		2SHL B -1
		Stop
	}
}

ACTOR AmmoShellBox2 : AmmoShellBox
{
	Inventory.Amount 16
}

ACTOR RifleMagazine : Clip2 //Ammo for the Rifle and Machinegun
{
	Inventory.Amount 15
	Scale 0.9
	States
	{
	Spawn:
		CLIP A -1
		Stop
	}
}

ACTOR RifleBox : Clip2 //Ammo for the Rifle and Machinegun
{
	Inventory.Amount 100
	Inventory.PickupMessage "Picked up a box of rifle ammunition."
	Inventory.PickupSound "CBOXPICK"
	Scale 0.9
	States
	{
	Spawn:
		CLIP C -1
		Stop
	}
}

ACTOR MinigunAmmo : Ammo //Ammo for the Minigun
{
	Inventory.Amount 100
	Inventory.MaxAmount 400
	Ammo.BackpackAmount 50
	Ammo.BackpackMaxAmount 800
	Inventory.Icon "ABOXA0"
	Inventory.PickupMessage "Picked up a box of minigun ammunition."
	Inventory.PickupSound "CBOXPICK"
	Scale 0.6
	States
	{
	Spawn:
		ABOX D -1
		Stop
	}
}

Actor MinigunBox : CustomInventory
{
	Inventory.PickupMessage "Picked up a box of minigun ammunition."
	Inventory.PickupSound "CBOXPICK"
	Scale 0.6
    States
    {
	Spawn:
		ABOX D -1
		Stop
	Pickup:
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist",1,2)
		TNT1 A 0 A_GiveInventory("MinigunAmmo", 100)
		Stop
		TNT1 A 0 A_GiveInventory("Clip2", 100)
		Stop
	}
}

ACTOR RailCore : Ammo //Ammo for the Railgun and BFG 10000
{
	Inventory.Amount 8
	Inventory.MaxAmount 50
	Ammo.BackpackAmount 8
	Ammo.BackpackMaxAmount 100
	Inventory.Icon "RGNAA0"
	Inventory.PickupMessage "Picked up a Rail Core."
	Scale 0.8
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(256,1,2,3,4)
	Spawn1:
		RGNA ABCD 1 BRIGHT
		Loop
	}
}

ACTOR RailPack : RailCore //Ammo for the Railgun and BFG 10000
{
	Inventory.Amount 24
	Inventory.PickupMessage "Picked up a pack of three Rail Cores."
	Scale 0.8
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(256,1,2,3,4)
	Spawn1:
		RGNA EFGH 1 BRIGHT
		Loop
	}
}

ACTOR C4Ammo : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 5
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 10
	Inventory.Icon C4EWA0
	Inventory.PickupMessage "You got a C-4 Explosive!"
	Scale 0.25
	States
	{
	Spawn:
		C4EI E -1
	}
}

ACTOR Gasoline : Ammo //Ammo for the Flame Cannon
{
	Inventory.Amount 50
	Inventory.MaxAmount 500
	Ammo.BackpackAmount 50
	Ammo.BackpackMaxAmount 999
	Inventory.Icon "GSLNA0"
	Inventory.PickupMessage "You got Gasoline."
	States
	{
	Spawn:
		GSLN A -1
	}
}

ACTOR PistolFlashlight : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 1
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 1
	Inventory.Icon "FLASH5"
	Inventory.PickupMessage "You got a flashlight attachment for the Pistol."
	Scale 0.08
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_SetAngle(angle - 315)
	Idle1:
		FLAS H 5
		TNT1 A 0 A_CheckRange(1000,2)
		TNT1 A 0 A_Jump(256,2)
		FLAS H 500
		Loop
	Idle2:
		FLAS H 1 A_CustomMissile ("FlashLightBeam", 5, 0, 0, 2, 0)
		Loop
	}
}

ACTOR PistolSilencer : CustomInventory
{
	Scale 0.6
	Inventory.PickupMessage "You got a silencer attachment for the Pistol."
	States
	{
	Spawn:
		BERT B -1
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory("PistolSilencerAmmo", 1)
		TNT1 A 0 A_GiveInventory("9mmMagazine", 15)
		Stop
	}
}

ACTOR PistolSilencerAmmo : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 1
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 1
	Inventory.Icon "FLASH5"
	Inventory.PickupMessage "You got a silencer attachment for the Pistol."
	Scale 0.6
	States
	{
	Spawn:
		BERT B -1
		Stop
	}
}


// --------------------------------------------------------------------------
//
// Dropped stuff from monsters and corpses
//
// --------------------------------------------------------------------------

actor ShotgunDrop
{
	Radius 0
	Height 0
	+THRUACTORS
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(128, "Spawn2")
		Goto Spawn1
	Spawn1:	
		TNT1 A 0 A_CustomMissile ("DropedShotgun", 20, 0, 0, 2, random (30, 50))
        stop
	Spawn2:	
        TNT1 A 0 A_CustomMissile ("DropedShotgun2", 20, 0, 180, 2, random (30, 50))
        stop		
	}
}

ACTOR DropedShotgun 
{
	scale 0.9
	speed 6
	health 1
	radius 16
	height 4
	damage 0
	+THRUACTORS
	+MISSILE
	+NOTELEPORT
	+NOBLOCKMAP
	+BLOODLESSIMPACT 
	+FORCEXYBILLBOARD
	+NODAMAGETHRUST
	+MOVEWITHSECTOR
	+CORPSE
	-DONTSPLASH
	Mass 1
    States
    {
	Spawn:
		SHOD A 4
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 0)
		SHOD BCDEFGH 4
		Loop
	Death:
		TNT1 A 0 A_SpawnItem("U_ShotgunSpawner")
		Stop
	}
}

ACTOR DropedShotgun2: DropedShotgun
{
	scale 0.9
    States
    {
	Spawn:
		SHOD H 4
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 0)
		SHOD GFEDCBA 4
		Loop
	}
}

ACTOR U_DropedRifle: DropedShotgun replaces DropedRifle
{
	scale 0.8
    States
    {
	Spawn:
		TRII A 4
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 0)
		TRII BCDEFGH 4
		Loop
	Death:
		TNT1 A 0 A_SpawnItem("U_RifleSpawner")
		Stop
    }
}

ACTOR U_DropedRifle2: U_DropedRifle replaces DropedRifle2
{
	scale 0.8
	States
	{
	Spawn:
		TRII H 4
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 0)
		TRII GFEDCBA 4
		Loop
	}
}


ACTOR U_DropedMP40: DropedShotgun replaces DropedMP40
{
	scale 0.5
    States
    {
	Spawn:
		MP40 J 4
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 0)
		Loop
	Death:
		TNT1 A 0 A_SpawnItem("U_MP40Spawner")
		Stop
    }
}

ACTOR U_MP40Spawner: CustomInventory replaces MP40Spawner
{
	Scale 0.4
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "You got the MP40!"
    States
    {
	Spawn:
		MP40 J -1
		Stop
	Pickup:
		TNT1 A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "Purist")	//Is purist?
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1010,0)==1, "MP40")		//MP40 enabled?
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1001,1)==1, "9mm")		//Pistol enabled?
	    TNT1 A 0 A_GiveInventory("RifleMagazine", 10)
		Stop
	Purist:
		TNT1 A 0 A_GiveInventory("U_ClassicSMG", 1)
		Stop
	MP40:
		TNT1 A 0 A_GiveInventory("U_MP40", 1)
		Stop
	9mm:
		TNT1 A 0 A_GiveInventory("9mmMagazine", 10)
		Stop
    }
}

ACTOR DroppedAmmo
{
	Radius 0
	Height 0
	+THRUACTORS
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_Jump (26, "CellDrop") //10% chance.
		TNT1 A 0 A_Jump (92, "ShellDrop") //40% chance.
	MagDrop:
		TNT1 A 0 A_Jump (128, 2)
		TNT1 A 0 A_SpawnItemEx("RifleMagazine", 0, 0, 10, 5, 0, 7, random(0,360))
		Stop
		TNT1 A 0 A_SpawnItemEx("9mmMagazine", 0, 0, 10, 5, 0, 7, random(0,360))
		Stop
	ShellDrop:
		TNT1 A 0 A_Jump (51, 2)
		TNT1 A 0 A_SpawnItemEx("AmmoShell", 0, 0, 10, 5, 0, 7, random(0,360))
		Stop
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1010,1)==1, 3)//Assaultshotgun enabled?
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1001,3)==1, 2)//Autoshotgun enabled?
		TNT1 A 0 A_SpawnItemEx("AmmoShell", 0, 0, 10, 5, 0, 7, random(0,360))
		Stop
		TNT1 A 0 A_SpawnItemEx("GreenShell", 0, 0, 10, 5, 0, 7, random(0,360))
		Stop
	CellDrop:
		TNT1 A 0 A_Jump (38, 2)
		TNT1 A 0 A_SpawnItemEx("AmmoCell", 0, 0, 10, 5, 0, 7, random(0,360))
		Stop
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1001,5)==1, 2)//Railgun enabled?
		TNT1 A 0 A_SpawnItemEx("AmmoCell", 0, 0, 10, 5, 0, 7, random(0,360))
		Stop
		TNT1 A 0 A_SpawnItemEx("RailCore", 0, 0, 10, 5, 0, 7, random(0,360))
		Stop
	}
}

ACTOR Clips : DroppedAmmo
{
	Radius 0
	Height 0
	+THRUACTORS
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		Goto MagDrop
	}
}

ACTOR Shells : DroppedAmmo
{
	Radius 0
	Height 0
	+THRUACTORS
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		Goto ShellDrop
	}
}

ACTOR DummyDrop replaces CLIP1Drop
{
	Radius 0
	Height 0
	+THRUACTORS
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
        stop		
	}
}


// --------------------------------------------------------------------------
//
//	Updated graphics, but otherwise unmodified items
//
// --------------------------------------------------------------------------

ACTOR U_HealthBonus : Health Replaces HealthBonus
{
	Game Doom
	SpawnID 152
	+COUNTITEM
	+INVENTORY.ALWAYSPICKUP
	Inventory.Amount 2
	Inventory.MaxAmount 300
	Inventory.PickupMessage "$GOTHTHBONUS" // "Picked up a health bonus."
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 ACS_ExecuteAlways(795, 0, 0, 0, 0)//Check if advanced decorations are disabled.
		TNT1 A 0 A_Jump(256,1,2,3,4,5,6,7,8,9,10,11,12)
	Stand:
		BON1 ABCDEFGFEDCB 3 A_SpawnItem("BlueFlareSmall",0,7)
		Loop
	Vanilla:
		BON1 ABCDEFGFEDCB 3
		Loop
	}
}

Actor U_ArmorBonus : BasicArmorBonus Replaces ArmorBonus
{
	Game Doom
	SpawnID 22
	Radius 20
	Height 16
	Inventory.Pickupmessage "$GOTARMBONUS" // "Picked up an armor bonus."
	Inventory.Icon "BON2A0"
	Armor.Savepercent 33.335
	Armor.Saveamount 2
	Armor.Maxsaveamount 300
	+COUNTITEM
	+INVENTORY.ALWAYSPICKUP
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(256,1,2,3,4,5,6,7,8,9,10,11,12)
	Stand:
		BON2 AAAABCDEFGEC 3
		Loop
	}
}

ACTOR U_SoulSphere : CustomInventory Replaces SoulSphere
{
	+FLOATBOB
	+COUNTITEM
	+INVENTORY.ALWAYSPICKUP
	Inventory.PickupMessage "Picked up a soulsphere."
	Inventory.PickupSound "misc/p_pkup"
	States
	{
	Spawn:
		ZOUL ABCDEFGFEDCB 3 Bright A_SpawnItem("SoulFlare",0,20)
		Loop
	Pickup:
		TNT1 A 0 A_GiveInventory("SoulSphereHealth", 1)
		Stop
	}
}

Actor SoulFlare : Flare_General
{
	alpha 0.3
	scale 0.35
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(128,2)
		LENB A 3 bright
		stop
		TNT1 A 0
		LENB B 3 bright
		stop
	}
}

ACTOR U_Megasphere : CustomInventory Replaces Megasphere
{
	+FLOATBOB
	+COUNTITEM
	+INVENTORY.ALWAYSPICKUP
	Inventory.PickupMessage "Picked up a megasphere."
	Inventory.PickupSound "misc/p_pkup"
	States
	{
	Spawn:
		SMEG ABCDEFGFEDCB 3 BRIGHT A_SpawnItem("MegaFlare",0,25)
		Loop
	Pickup:
		TNT1 A 0 A_GiveInventory("BlueArmorForMegasphere", 1)
		TNT1 AA 0 A_GiveInventory("SoulsphereHealth", 1)
		Stop
	}
}

Actor MegaFlare : Flare_General
{
	alpha 0.45
	scale 0.4
	states
	{
	Spawn:
		LENS A 3 bright
		stop
	}
}

ACTOR U_InvulnerabilitySphere : PowerupGiver Replaces InvulnerabilitySphere
{
	+COUNTITEM
	+FLOATBOB
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+INVENTORY.BIGPOWERUP
	Inventory.MaxAmount 0
	Powerup.Type Invulnerable
	Powerup.Colormap 0.05, 0.0, 0.0, 0.9, 1.0, 0.9
	Inventory.PickupMessage "$GOTINVUL"
	States
	{
	Spawn:
		NVUL ABCDEFEDCB 3 Bright A_SpawnItem("InvulnerabilityFlare",0,20)
		Loop
	}
}

Actor InvulnerabilityFlare : Flare_General
{
	alpha 0.2
	scale 0.35
	states
	{
	Spawn:
        TNT1 A 0
	    TNT1 A 0 A_Jump(128,2)
		LENG A 3 bright
		stop
		TNT1 A 0
		LENG B 3 bright
		stop
	}
}

ACTOR U_BlurSphere : CustomInventory Replaces SuperBlurSphere
{
	+FLOATBOB
	+COUNTITEM
	+VISIBILITYPULSE
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+INVENTORY.BIGPOWERUP
	RenderStyle Translucent
	Inventory.PickupMessage "$GOTINVIS" // "Partial Invisibility"
	States
	{
	Spawn:
		NVIS ABCDEFGFEDCB 3 Bright// A_SpawnItem("RedFlare", 0, 24)
		Loop
	Pickup:
		TNT1 A 1
		TNT1 A 0 A_GiveInventory("IsInvisible", 1)
		TNT1 A 0 A_GiveInventory("Blursphere", 1)
		TNT1 A 0 ACS_ExecuteAlways(397, 0, 0, 0, 0)
		TNT1 A 1
		Stop
	}
}

ACTOR U_Infrared : CustomInventory Replaces InfraRed
{
	+COUNTITEM
	+INVENTORY.ALWAYSPICKUP
	Inventory.PickupMessage "You got the Light Amplification Visor."
	states
	{
	Spawn:
		SVIS E 7
		SVIS D 3 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		SVIS C 2 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		SVIS BAB 1 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		SVIS C 2 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		SVIS D 3 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		loop
	Pickup:
		TNT1 A 1
		TNT1 A 0 A_GiveInventory("HasInfrared", 1)
		TNT1 A 0 A_GiveInventory("U_Infrared2", 1)
		TNT1 A 0 ACS_ExecuteAlways(398, 0, 0, 0, 0)
		TNT1 A 1
		Stop
	}
}

ACTOR U_Infrared2 : PowerupGiver
{
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	Inventory.MaxAmount 0
	Powerup.Type PowerTorch
	Powerup.Duration 4200
	States
	{
	Spawn:
		SVIS E 7
		SVIS D 3 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		SVIS C 2 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		SVIS BAB 1 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		SVIS C 2 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		SVIS D 3 Bright A_SpawnItem("RedFlareVerySmall",0,10)
		Loop
	}
}

ACTOR U_RadSuit : CustomInventory Replaces RadSuit
{
	+FLOATBOB
	+COUNTITEM
	+INVENTORY.ALWAYSPICKUP
	Inventory.PickupMessage "Enviromental protection."
	Inventory.PickupSound "misc/p_pkup"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1029,2,7)==0, "Spawn2")
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1029,2,7)==1, "Spawn1")
		TNT1 A -1
		Stop
	Spawn1:
		TNT1 A 0
		RADO ABCDEFGFEDCB 3 Bright A_SpawnItem("RadFlare",0,20)
		Loop
	Spawn2:
		TNT1 A 0 A_ChangeFlag("FLOATBOB", 0)
		SUIT A -1 Bright
		Stop
	Pickup:
		TNT1 A 0 A_GiveInventory("FloorProtection", 1)
		TNT1 A 0 A_GiveInventory("FireProtection", 1)
		Stop
	}
}

Actor RadFlare : Flare_General
{
	alpha 0.2
	scale 0.35
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(128,2)
		LENY A 3 bright
		stop
		TNT1 A 0
		LENY B 3 bright
		stop
	}
}

ACTOR FloorProtection : PowerupGiver
{
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	Inventory.MaxAmount 0
	Powerup.Color Gold 0.1
	Powerup.Type IronFeet
	Powerup.Duration 2100
	States
	{
	Spawn:
		TNT1 A 1
		Loop
	}
}

ACTOR FireProtection : PowerupGiver
{
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	Inventory.MaxAmount 0
	Powerup.Type FireProt
	Powerup.Duration 2100
	States
	{
	Spawn:
		TNT1 A 1
		Loop
	}
}

ACTOR PowerFireProt : PowerProtection
{
	DamageFactor "Fire", 0.1
	DamageFactor "Burn", 0.1
	DamageFactor "Flames", 0.1
	DamageFactor "FallInLava", 0.1
	DamageFactor "GreenFire", 0.5
}