
// ------------------------------------------------------------
//   Player classes
// ------------------------------------------------------------

actor HDPlayer : PlayerPawn
{
	damagefactor "BFGBallAttack", 0
	player.runhealth 999999
	player.forwardmove 0.84 0.42
	player.sidemove 0.72 0.36
	player.viewheight 48
	player.attackzoffset 21
	player.damagescreencolor "12 06 04"
	player.jumpz 0
	player.colorrange 112, 127
	maxstepheight 26
	height 52
	mass 150
	+noskin
		radius 16
		speed 1
		painchance 255
		player.displayname "Marine"
		player.crouchsprite "PLYC"
	States
	{
	Spawn:
		PLAY A 0
		PLAY A 0 A_JumpIfInventory ("WipedOut", 1, 6)
		PLAY A 0 A_ChangeFlag ("notelefrag", 0)
		PLAY A 0 A_ChangeFlag ("solid", 1)
		PLAY A 0 A_ChangeFlag ("shootable", 1)
		PLAY A 0 A_ChangeFlag ("noblockmap", 0)
		
		PLAY A 0 A_Jump (256, 5)
		
		PLAY A 0 A_ChangeFlag ("notelefrag", 1)
		PLAY A 0 A_ChangeFlag ("solid", 0)
		PLAY A 0 A_ChangeFlag ("shootable", 0)
		PLAY A 0 A_ChangeFlag ("noblockmap", 1)
		
		PLAY A 4

	Spawn2:
		PLAY E 5
		PLAY E 0 A_TakeInventory ("IsMoving", 999)
		PLAY E 0 A_TakeInventory ("IsHit", 999)
		PLAY E 0 A_TakeInventory ("IsJumping", 999)
		PLAY E 0 A_Jump (42, 2)
		PLAY E 0 A_ChangeFlag ("shadow", 0)
		PLAY E 30 ACS_Execute (551, 0, 0,0, 8)
		Loop
	See:
		PLAY A 0 A_Jump (72, 2)
		PLAY A 0 A_ChangeFlag ("shadow", 1)
		PLAY A 0 A_Jump (92, 2)
		PLAY A 0 A_ChangeFlag ("shadow", 0)

		PLAY A 0 ACS_ExecuteAlways (551, 0, 0,0, 4)

		PLAY A 0 A_JumpIf (health>40, 2)
		PLAY A 0 ThrustThing(random(0,7)*32, random(0.0,4.1), 0, 0)

		PLAY A 0 A_JumpIf (health>60, 2)
		PLAY A 0 A_Recoil (random(-2,2))

		PLAY A 0 A_JumpIfInventory ("IsSprinting", 1, 6)
		PLAY ABCD 4

		PLAY A 0 A_Jump (256, 9)
		PLAY ABCDABCD 2

		PLAY A 0
		goto Spawn
	Missile:
		RIFG A 0 A_TakeInventory("NotShot",9999)
		PLAY A 0 A_JumpIf ((health > 40), 2)
		PLAY A 0 ACS_Execute (551, 0, 0,0, 2)

		PLAY E 4
		goto Spawn2
	Melee:
		RIFG A 0 A_TakeInventory("NotShot",9999)
		PLAY A 0 A_Jump (62, 2)
		PLAY A 0 A_ChangeFlag ("shadow", 1)
		PLAY A 0 A_Jump (102, 2)
		PLAY A 0 A_ChangeFlag ("shadow", 0)

		PLAY F 3 bright
		goto Missile

	pain.nowound:
		TNT1 A 0 A_TakeInventory("JumpPower",999)
		goto painend
	pain:
	pain.smallarms0:
		TNT1 A 0 A_JumpIfInventory("GreenArmourFlag",1,"painend")
		TNT1 A 0 A_JumpIfInventory("BlueArmourFlag",1,"painend")
		TNT1 A 0 A_JumpIfInventory("BlackArmourFlag",1,"painend")
	pain0:
		TNT1 A 0 A_GiveInventory("WoundCount",random(0,2))
		goto painend
	pain.smallarms1:
		TNT1 A 0 A_JumpIfInventory("GreenArmourFlag",1,"pain4")
		TNT1 A 0 A_JumpIfInventory("BlueArmourFlag",1,"painend")
		TNT1 A 0 A_JumpIfInventory("BlackArmourFlag",1,"painend")
	pain1:
		TNT1 A 0 A_GiveInventory("WoundCount",random(0,3))
		goto painend
	pain.balefire:
		TNT1 A 0 A_JumpIfInventory("GreenArmourFlag",1,"pain0")
		TNT1 A 0 A_JumpIfInventory("BlueArmourFlag",1,"pain0")
		TNT1 A 0 A_JumpIfInventory("BlackArmourFlag",1,"pain0")
	pain1a:
		TNT1 A 0 A_GiveInventory("WoundCount",random(0,4))
		goto painend
	pain.smallarms2:
		TNT1 A 0 A_JumpIfInventory("GreenArmourFlag",1,"pain1a")
		TNT1 A 0 A_JumpIfInventory("BlueArmourFlag",1,"pain1")
		TNT1 A 0 A_JumpIfInventory("BlackArmourFlag",1,"pain0")
	pain2:
		TNT1 A 0 A_GiveInventory("WoundCount",random(1,3))
		goto painend
	pain.smallarms3:
		TNT1 A 0 A_JumpIfInventory("GreenArmourFlag",1,"pain3")
		TNT1 A 0 A_JumpIfInventory("BlueArmourFlag",1,"pain2")
		TNT1 A 0 A_JumpIfInventory("BlackArmourFlag",1,"pain1a")
	pain3:
		TNT1 A 0 A_GiveInventory("WoundCount",random(1,4))
		goto painend
	pain.thermal:
		TNT1 A 0 A_JumpIfInventory("GreenArmourFlag",1,"painend")
		TNT1 A 0 A_JumpIfInventory("BlueArmourFlag",1,"pain4")
		TNT1 A 0 A_JumpIfInventory("BlackArmourFlag",1,"pain4")
	pain4:
		TNT1 A 0 A_GiveInventory("WoundCount",random(1,3))
		TNT1 A 0 A_TakeInventory("WoundCount",random(0,2))
		goto painend
	pain.bleedout:
		TNT1 A 0 ACS_ExecuteAlways (551, 0, 0,1, 0)
		goto spawn
	painend:
		RIFG A 0 A_TakeInventory("NotShot",9999)
		PLAY G 3 ACS_ExecuteAlways (551, 0, 40)
		PLAY G 3 A_Pain
		Goto Spawn
	Death:
		TNT1 A 0 A_PlayerScream
	Death.bleedout:
		PLAY H 10 A_SpawnItemEx ("tempshield", 0,0,0, velx,vely,velz, 0,40)
		TNT1 A 0 A_SpawnItemEx ("tempshield", 0,0,0, velx,vely,velz, 0,40)
		TNT1 A 0 A_GiveInventory ("CheckLiveRound", 1)
		PLAY IJKLM 10
		TNT1 A 0 A_TakeInventory ("FragOut", 999)
		TNT1 A 0 A_TakeInventory ("FragTimer", 999)
		TNT1 A 0 A_TakeInventory ("SpoonOff", 999)
		TNT1 A 0 A_TakeInventory ("BFGCycled", 999)
		PLAY N 0 A_NoBlocking
		PLAY N 0 A_HideThing
		PLAY N 0 A_SpawnItemEx ("DeadRifleman",0,0,0,velx,vely,velz,0,41)
		PLAY N 20 A_CheckPlayerDone
		wait
	XDeath:
		PLAY O 5
		PLAY O 0 A_SpawnItem ("MegaBloodSplatter", 1, 34, 0, 0)
		PLAY P 5 A_XScream
		PLAY P 0 A_SpawnItem ("MegaBloodSplatter", 1, 34, 0, 0)
		TNT1 A 0 A_GiveInventory ("CheckLiveRound", 1)
		PLAY Q 5 A_NoBlocking
		PLAY Q 0 A_SpawnItem ("MegaBloodSplatter", 1, 34, 0, 0)
		PLAY RSTUV 5
		PLAY W 0 A_HideThing
		PLAY N 0 A_SpawnItemEx ("ReallyDeadRifleman",0,0,0,velx,vely,velz,0,41)
		PLAY W 20 A_CheckPlayerDone
		wait
	}
}


actor HDP_AR : HDPlayer
{
	player.DisplayName "Assault"
	player.startitem GreenArmour
	player.startitem GreenArmourFlag
	player.startitem ZM66GrenadeRifle
	player.startitem ZM66RifleRounds 31
	player.startitem ZM66RifleMags 5
	player.startitem RocketAmmo 24
	player.startitem ZM66RocketUnderslung
	player.startitem HDFragGrenadeAmmo 8
	player.startitem CommonLoadout
}

actor HDP_SG : HDPlayer
{
	player.DisplayName "Close Assault"
	player.startitem GreenArmour
	player.startitem GreenArmourFlag
	player.startitem Hunter
	player.startitem ShotgunTube 9
	player.startitem ShotgunQuickAmmo 24
	player.startitem Shell 36
	player.startitem HDFragGrenadeAmmo 12
	player.startitem CommonLoadout
}

actor HDP_MG : HDPlayer
{
	player.DisplayName "Support MG"
	player.startitem GreenArmour
	player.startitem GreenArmourFlag
	player.startitem Vulcanette
	player.startitem ChaingunBox 150
	player.startitem ZM66RifleMags 7
	player.startitem HDFragGrenadeAmmo 8
	player.startitem CommonLoadout
}

actor HDP_GL : HDPlayer
{
	player.DisplayName "Grenadier"
	player.startitem GreenArmour
	player.startitem GreenArmourFlag
	player.startitem RocquetteLauncher
	player.startitem RocketMag 6
	player.startitem RocketAmmo 50
	player.startitem HDFragGrenadeAmmo 12
	player.startitem CommonLoadout
}

actor HDP_PR : HDPlayer
{
	player.DisplayName "Experimental"
	player.startitem GreenArmour
	player.startitem GreenArmourFlag
	player.startitem PlazmaGun
	player.startitem PlasmaBattery 60
	player.startitem HDCellPacks 15
	player.startitem HDFragGrenadeAmmo 6
	player.startitem CommonLoadout
}

actor HDP_BF : HDPlayer
{
	player.DisplayName "Hideous Destructor"
	player.startitem GreenArmour
	player.startitem GreenArmourFlag
	player.startitem BFG9K
	player.startitem BFGChamber 60
	player.startitem HDCellPacks 15
	player.startitem HDFragGrenadeAmmo 6
	player.startitem CommonLoadout
}

actor HDP_SS : HDPlayer
{
	player.DisplayName "Contractor"
	player.startitem BlackArmour
	player.startitem BlackArmourFlag
	player.startitem Slayer
	player.startitem ShellChamber 2
	player.startitem ShotgunQuickAmmo2 24
	player.startitem Shell 36
	player.startitem HDFragGrenadeAmmo 8
	player.startitem MediAmmo 4
	player.startitem StimAmmo 8
	player.startitem CommonLoadout
}

actor HDP_BS : HDPlayer
{
	player.DisplayName "Assassin"
	player.startitem BlackArmour
	player.startitem BlackArmourFlag
	player.startitem BersAmmo 4
	player.startitem HDFragGrenadeAmmo 8
	player.startitem Ring
	player.startitem Lumberjack
	player.startitem MediAmmo 4
	player.startitem StimAmmo 8
	player.startitem CommonLoadout
}


actor CommonLoadout : ActionItem
{
	states
	{
	pickup:
		TNT1 A 0 A_GiveInventory ("JumpPower", 80)
		TNT1 A 0 A_GiveInventory ("Ring", 1)
		TNT1 A 0 A_GiveInventory ("HDFragGrenades", 1)
		TNT1 A 0 A_GiveInventory ("HDPistol", 1)
		TNT1 A 0 A_GiveInventory ("HDPistolMag", 13)
		TNT1 A 0 A_GiveInventory ("HDPistolMags", 4)
		TNT1 A 0 A_GiveInventory ("MediAmmo", 4)
		TNT1 A 0 A_GiveInventory ("FireMode", 1)
		TNT1 A 0 A_GiveInventory ("ZM66FullAuto", 1)
		TNT1 A 0 A_GiveInventory ("HDRealDoomGuy", 1)
		TNT1 A 0
		stop
	}
}
actor CheckLiveRound : ActionItem
{
	states
	{
	pickup:
		TNT1 A 0 A_JumpIfInventory ("FragOut", 1, 2)
		TNT1 A 0 A_Jump (256,2)
		TNT1 A 0 A_FireCustomMissile ("HDFragGrenade1", random(-6,6),0)

		TNT1 A 0 A_JumpIfInventory ("BFGCycled", 1, 2)
		TNT1 A 0 A_Jump (256,3)
		TNT1 A 0 A_FireCustomMissile ("BFGBallTail", 0, 1, 0, 0)
		TNT1 A 0 A_FireCustomMissile ("BFGBallExploder", 0, 1, 0, 0)

		TNT1 A 0 A_TakeInventory ("FragOut", 999)
		TNT1 A 0 A_TakeInventory ("FragTimer", 999)
		TNT1 A 0 A_TakeInventory ("SpoonOff", 999)
		TNT1 A 0 A_TakeInventory ("BFGCycled", 999)
		stop
	}
}
actor FireMode : ActionItem
{
	states
	{
	use:
		TNT1 A 0 A_JumpIfInventory("ZM66FullAuto",1,"use2")
		TNT1 A 0 A_GiveInventory("ZM66FullAuto",1)
		fail
	use2:
		TNT1 A 0 A_TakeInventory("ZM66FullAuto",999)
		fail
	}
}

actor GimmeBackup : ActionItem
{
	+invbar
	inventory.icon PLHELMA0
	states
	{
	use:
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SpawnItemEx ("TeleportFog", 52,0,0, 0,0,0, 0,0,0)
		TNT1 A 0 A_SpawnItemEx ("TeleportFog", 0,46,0, 0,0,0, 0,0,0)
		TNT1 A 0 A_SpawnItemEx ("TeleportFog", 0,-46,0, 0,0,0, 0,0,0)
		TNT1 A 0 A_SpawnItemEx ("SquadRifleman", 52,0,0, 0,0,0, 0,17,0)
		TNT1 A 0 A_SpawnItemEx ("SquadRifleman", 0,46,0, 0,0,0, 0,17,0)
		TNT1 A 0 A_SpawnItemEx ("SquadRifleman", 0,-46,0, 0,0,0, 0,17,0)
		stop
	}
}


// ------------------------------------------------------------
//   Null weapon
// ------------------------------------------------------------

actor NullWeapon : Weapon
{
	+inventory.undroppable
	+weapon.wimpy_weapon
	+weapon.cheatnotweapon
	+nointeraction
	+weapon.noalert
	+inventory.undroppable
	height 0
	radius 0
	states
	{
	spawn:
		TNT1 A 0
		stop
	select:
		TNT1 A 1 A_Raise
		TNT1 AAAAA 0 A_Raise
		loop
	deselect:
		TNT1 A 1 A_Lower
		TNT1 AAAAA 0 A_Lower
		loop
	ready:
		TNT1 A 1 A_WeaponReady
		loop
	fire:
		TNT1 A 1
		goto ready
	}
}

actor WipedOut : NullWeapon
{
	states
	{
	ready:
		TNT1 A 1
		loop
	fire:
		TNT1 A 1
		goto ready
	}
}



// ------------------------------------------------------------
//   Mantling
// ------------------------------------------------------------

actor Mantler : IdleDummy
{
	radius 1
	height 1
	-nointeraction
	+noclip
	+floorhugger
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 8 A_Recoil(-6)
		stop
	}
}
actor JumpPower : InventoryFlag
{
	inventory.maxamount 80
}

