// --------------------------------------------------------------------------
//
//	Player
//
// --------------------------------------------------------------------------

ACTOR Doomer2 : Doomer Replaces Doomer
{
	//Startstuff
	Player.StartItem "IsPlayer", 1
	Player.StartItem "JustStartedGame", 1
	Player.StartItem "NeverSelectedShotgun", 1
	Player.StartItem "StartingWeaponChecker", 1
	//Startstuff
	Player.StartItem "Melee_Attacks"
	Player.StartItem "U_HandGrenades", 1
	Player.StartItem "BerettaAmmo", 15
	Player.StartItem "RifleAmmo", 31
	Player.StartItem "DoubleRifleAmmo", 31
	Player.StartItem "LeftRifleAmmo", 31
	Player.StartItem "MP40Ammo", 32
	Player.StartItem "ShotgunAmmo", 8
	Player.StartItem "SSGAmmo", 2
	Player.StartItem "M1014Ammo", 8
	Player.StartItem "RevolverAmmo", 6
	Player.StartItem "SniperAmmo", 5
	Player.StartItem "RocketRounds", 6
	Player.StartItem "PlasmaAmmo", 50
	Player.StartItem "RailAmmo", 8
	Player.StartItem "GrenadeAmmo", 1
	//Bullets in the revolver
	Player.StartItem "RevolverCylinderSlot1", 1
	Player.StartItem "RevolverCylinderSlot2", 1
	Player.StartItem "RevolverCylinderSlot3", 1
	Player.StartItem "RevolverCylinderSlot4", 1
	Player.StartItem "RevolverCylinderSlot5", 1
	Player.StartItem "RevolverCylinderSlot6", 1
}

Actor StartingWeaponChecker : BaseWeapon
{
	Inventory.PickupMessage ""
	Obituary ""
	tag ""
	AttackSound ""
	States
	{
	Ready:
		TNT1 A 1
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1021)==0, "None")
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1021)==1, "KnifeStart")
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1021)==2, "PistolStart")
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1021)==3, "RifleStart")
	None:
		TNT1 A 0 A_SelectWeapon("Melee_Attacks")
		TNT1 A 0 A_TakeInventory("StartingWeaponChecker", 1)
		Goto Ready
	KnifeStart:
		TNT1 A 0 A_GiveInventory("Knife", 1)
		TNT1 A 0 A_SelectWeapon("Knife")
		TNT1 A 0 A_TakeInventory("StartingWeaponChecker", 1)
		Goto Ready
	PistolStart:
		TNT1 A 0 A_GiveInventory("Beretta", 1)
		TNT1 A 0 A_GiveInventory("9mmMagazine", 45)
		TNT1 A 0 A_SelectWeapon("Beretta")
		TNT1 A 0 A_TakeInventory("StartingWeaponChecker", 1)
		Goto Ready
	RifleStart:
		TNT1 A 0 A_GiveInventory("Rifle", 1)
		TNT1 A 0 A_GiveInventory("Clip2", 50)
		TNT1 A 0 A_SelectWeapon("Rifle")
		TNT1 A 0 A_TakeInventory("StartingWeaponChecker", 1)
		Goto Ready
	}
}


// --------------------------------------------------------------------------
//
//	Tokens
//
// --------------------------------------------------------------------------

ACTOR FireSeq : Inventory { inventory.maxamount 2 }
ACTOR WeapSpecial : Inventory { inventory.maxamount 1 }
ACTOR MonsterHaveSeenPlayer : Inventory { Inventory.MaxAmount 1 }
ACTOR ChainsawCrueltyBonus : Inventory { Inventory.MaxAmount 150 }


// --------------------------------------------------------------------------
//
//	Other random stuffs
//
// --------------------------------------------------------------------------

ACTOR SpawnShot2 replaces SpawnShot
{
	Radius 6
	Height 32
	Speed 10
	Damage 3
	Projectile
	+NOCLIP
	-ACTIVATEPCROSS
	+RANDOMIZE
	SeeSound "brain/spit"
	DeathSound "brain/cubeboom"
	States
	{
	Spawn:
		ORBB A 2 BRIGHT A_SpawnSound
		ORBB BCDEF 2 BRIGHT
		Loop
	}
}

ACTOR U_DetectCeilBrain replaces DetectCeilBrain
{
	game Doom
	scale 0.4
	speed 0
	health 1
	radius 2
	height 2
	Gravity 0.0
	damage 0
	Renderstyle Translucent
	Alpha 0.95
	DamageType Blood
	+MISSILE
	+CLIENTSIDEONLY
	+NOTELEPORT
	+NOBLOCKMAP
	+FORCEXYBILLBOARD
	+NODAMAGETHRUST
	-DONTSPLASH
	+NOGRAVITY
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 ThrustThingZ(0,35,0,1)
		XDB5 A 1
		TNT1 A 0 A_SpawnItem("SmearingBrain")
		Stop
	Death:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile ("SmallBrainPiece", -15, 0, 90, 2, 90)
		Stop
	}
}

actor U_SawBlood : Blood Replaces SawBlood
{
	Decal BrutalBloodSplat
	game Doom
	+FORCEXYBILLBOARD
	+GHOST
	+NOBLOCKMAP
	+NOGRAVITY
	+NOCLIP
	-DONTSPLASH
	-ALLOWPARTICLES 
	MONSTER
	-FRIENDLY
	+NOTARGET
	-COUNTKILL
	Speed 0
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1 A_Look
	See:		
		TNT1 A 0 Radius_Quake (4, 4, 0, 2, 0)
		TNT1 A 0 A_PlaySOund("misc/xdeath4", 1)
		TNT1 A 0 A_GiveToTarget("PowerBloodOnVisor", 1)
		TNT1 A 0 A_GiveToTarget("ChainsawCrueltyBonus", 4)
		TNT1 A 0 A_CustomMissile ("BloodMist", 0, 0, random (0, 360), 2, random (30, 90))
		TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
		TNT1 A 1 A_Chase("Melee","Melee")
		Stop
	Melee:	
		TNT1 A 0 A_GiveToTarget("BloodSplasherz", 1)
		TNT1 A 10
		stop
	Splash:
		BLOD A 0
		TNT1 AAA 0 A_CustomMissile ("Underblood1", 7, 0, random (0, 360), 2, random (30, 150))
		stop
	}
}


// --------------------------------------------------------------------------
//
//	Dead stuff
//	This adds some variety to the pre-placed dead enemies.
//
// --------------------------------------------------------------------------

ACTOR New_DeadCacodemon : DeadCacodemon replaces DeadCacodemon
{
	Radius 0
	Height 0
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(256, "Spawn1", "Spawn2", "Spawn3", "Spawn4")
	Spawn1:
		TNT1 AAAAAA 0 A_CustomMissile ("Blue_FlyingBlood", 15, 0, random (150, 210), 2, random (10, 70))
		TNT1 A 0 A_SpawnItem ("DeadCacoDemon4", 1)
		Stop
	Spawn2:
		TNT1 AAAAAA 0 A_CustomMissile ("Blue_FlyingBlood", 15, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("DeadCacoDemon3", 1)
		Stop
	Spawn3:
		TNT1 AAAAAA 0 A_CustomMissile ("Blue_FlyingBlood", 15, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("DeadCacoDemon2", 1)
		Stop
	Spawn4:
		TNT1 AAAAAA 0 A_CustomMissile ("Blue_FlyingBlood", 15, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("DeadCacoDemon1", 1)
		Stop
	}
}

Actor U_VeryDeadMarine: DeadMarine Replaces DeadMarine
{
	damagefactor "Avoid", 0.0
	damagefactor "Blood", 0.0
	damagefactor "GreenBlood", 0.0
	damagefactor "BlueBlood", 0.0
	damagefactor "Taunt", 0.0
	damagefactor "KillMe", 0.0
	damagefactor "Shrapnel", 100.0
	damagefactor "GibRemoving", 990.0
	+CLIENTSIDEONLY
	+FLOORCLIP
	Radius 0
	Game Doom
	States
	{
    Spawn:
		TNT1 A 0
		TNT1 AAAAA 0 A_CustomMissile ("SuperWallRedBlood", 10, 0, random (0, 360), 2, random (5, 40))
		TNT1 AAAAAA 0 A_SpawnItemEx("Brutal_BloodSpot",random(64, -64),random(64, -64))
		TNT1 A 1 A_SpawnItem("MediumBloodSpot")

		TNT1 A 0 A_Jump(128,"Spawn2")								//50% chance to skip to next corpse.
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1001)==0, "Spawn2")	//Is pistol enabled?
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(1042)==1, "Spawn2")	//Only spawn one thing per level.
		//Drop pistol
		TNT1 A 0 A_JumpIfInventory("Beretta", 1, 3, AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItem ("Beretta",30)
		TNT1 A 0 A_Jump(256,"Spawn2")
		//Drop flashlight
		TNT1 A 0 A_JumpIfInventory("PistolFlashlight", 1, 3, AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItem ("PistolFlashlight",30)
		TNT1 A 0 A_Jump(256,"Spawn2")
		//Drop silencer
		TNT1 A 0 A_JumpIfInventory("PistolSilencerAmmo", 1, 2, AAPTR_PLAYER1)
		TNT1 A 0 A_SpawnItem ("PistolSilencer",30)
		
		
	Spawn2:
		TNT1 A 0 A_Jump(256,1,2,3,4,5,6)
		TNT1 A 1 A_SpawnItem("CurbstompedMarine")
		Stop
		TNT1 A 1 A_SpawnItem("AteMarine")
		Stop
		TNT1 A 1 A_SpawnItem("DeadRippedOffMarine")
		Stop
		TNT1 A 1 A_SpawnItem("FuckedMarine")
		Stop
		TNT1 A 1 A_SpawnItem("ADoomedSpaceMarine")
		Stop
		TNT1 A 1 A_SpawnItem("ADoomedSpaceMarine2")
		Stop
	}
}
