ACTOR Marine
{
    Radius 16
    Height 56
	MONSTER
	-SHOOTABLE
	-COUNTKILL
	-FRIENDLY
	+THRUACTORS
	States
    {
    Spawn:
	    PLAY A 10
		PLAY A 1 A_CheckSight("DontSpawn")
		TNT1 A 0 A_Chase
		TNT1 A 0 A_Look
	See:
		TNT1 A 0 ACS_NamedExecute("AddMarine")
		TNT1 A 0 A_SpawnItemEx ("Marine_Rifle",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	DontSpawn:
	    PLAY A 1
		Goto Spawn
    }
}

ACTOR RandomMarine: RedTorch
{
    Radius 16
    Height 56
	-SHOOTABLE
	States
    {
    Spawn:
	    PLAY A 1
		PLAY A 1 A_CheckSight("DontSpawn")
		TNT1 A 0 A_Chase
		TNT1 A 0 A_Look
	See:
		TNT1 A 0
		TNT1 A 0 A_Jump(1,"See15")
		TNT1 A 0 A_Jump(2,"See14")
		TNT1 A 0 A_Jump(4,"See12","See13")
		TNT1 A 0 A_Jump(8,"See10","See11")
		TNT1 A 0 A_Jump(16,"See8","See9")
		TNT1 A 0 A_Jump(32,"See6","See7")
		TNT1 A 0 A_Jump(64,"See4","See5")
		TNT1 A 0 A_Jump(128,"See3")
		TNT1 A 0 A_Jump(255,"See1","See2")

	See1:
		TNT1 A 0 A_SpawnItemEx ("Marine_Fist",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See2:
		TNT1 A 0 A_SpawnItemEx ("Marine_Saw",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See3:
		TNT1 A 0 A_SpawnItemEx ("Marine_SMG",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See4:
		TNT1 A 0 A_SpawnItemEx ("Marine_Shotgun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See5:
		TNT1 A 0 A_SpawnItemEx ("Marine_SSG",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See6:
		TNT1 A 0 A_SpawnItemEx ("Marine_Rifle",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See7:
		TNT1 A 0 A_SpawnItemEx ("Marine_Minigun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See8:
		TNT1 A 0 A_SpawnItemEx ("Marine_Grenade",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See9:
		TNT1 A 0 A_SpawnItemEx ("Marine_Rocket",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See10:
		TNT1 A 0 A_SpawnItemEx ("Marine_Plasmagun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See11:
		TNT1 A 0 A_SpawnItemEx ("Marine_Railgun",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See12:
		TNT1 A 0 A_SpawnItemEx ("Marine_BFG",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See13:
		TNT1 A 0 A_SpawnItemEx ("Marine_BFG10K",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See14:
		TNT1 A 0 A_SpawnItemEx ("Marine_HML",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	See15:
		TNT1 A 0 A_SpawnItemEx ("Marine_Flame",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        Stop

	DontSpawn:
	    PLAY A 1
		Goto Spawn
    }
}

ACTOR Marine_Rifle: SwitchableDecoration
{
	Game Doom
	Health 160
	PainChance 255
	Monster
	Speed 12
	FastSpeed 25
	Species "Marines"
	Activation THINGSPEC_Activate | THINGSPEC_NODEATHSPECIAL
	Radius 16
	Height 56
	Mass 100
	MaxStepHeight 24
	MaxDropOffHeight 128
	ActiveSound "none"
	AttackSound "none"
	DeathSound "DSMADTH"
	PainSound "*pain"
	SeeSound "None"
	Scale 1.0
	Translation  "112:127=[220,0,0]:[0,0,0]"
	BloodType "Player_Blood", "Player_BloodSaw", "Player_Blood"
	Obituary "%o has been gunned down by a Marine."
	DropItem "RifleDrop"
	+FLOORCLIP
	+QUICKTORETALIATE
    +FIXMAPTHINGPOS
	+LOOKALLAROUND
	+SLIDESONWALLS
	-COUNTKILL
	-NORADIUSDMG
	+USESPECIAL
	+THRUSPECIES
	+DONTHARMSPECIES
	+NOTAUTOAIMED
	+NOBLOCKMONST
	+DROPOFF
	+SHOOTABLE
	+DONTGIB
	+NOTELEFRAG
	+CANNOTPUSH
	-ACTIVATEMCROSS
	+FRIENDLY
	Damagefactor "Avoid", 1.0	Damagefactor "BHFTOnBarrel", 0.0	Damagefactor "Blood", 0.0
	DamageFactor "Bullet", 0.0	Damagefactor "CancelTeleportFog", 0.0	Damagefactor "CauseWaterSplash", 0.0
	Damagefactor "Cut", 0.0	Damagefactor "Extremepunches", 0.05
	Damagefactor "Fatality", 0.0	Damagefactor "FriendBullet", 0.0	Damagefactor "GibRemoving", 0.0
	Damagefactor "HangingHook", 0.0	Damagefactor "Head", 0.0
	Damagefactor "HeadKick", 0.0	Damagefactor "HelperMarineFatallity", 0.0	DamageFactor "Kick", 0.1
	Damagefactor "KillMe", 0.0	Damagefactor "Leg", 0.0	Damagefactor "Slide", 0.0
	DamageFactor "Melee", 0.0	DamageFactor "Minigun", 0.0	DamageFactor "Minor", 0.0
	Damagefactor "MonsterKnocked", 0.0	Damagefactor "PussyGrab", 0.0	DamageFactor "Railgun", 0.0
	Damagefactor "Repair", 0.0	Damagefactor "RevenantHitStomach", 0.0	Damagefactor "Saw", 0.0
	DamageFactor "Shotgun", 0.0	DamageFactor "Shrapnel", 0.0	Damagefactor "Slide", 0.0
	Damagefactor "SpawnMarine", 0.0	DamageFactor "SSG", 0.0	Damagefactor "Stealth", 0.0
	Damagefactor "Taunt", 0.0	DamageFactor "TeleportRemover", 0.0	DamageFactor "Trample", 0.0
	Damagefactor "Use", 0.0	DamageFactor "TankWeakSpot", 0.0 DamageFactor "Explosive", 0.0
	DamageFactor "Desintegrate", 0.0 DamageFactor "HeavyImpact", 0.0	Damagefactor "Falling", 0.0

	PainChance "Avoid", 128
	States
	{
	Active:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile ("OrderTitle2", 50, 0, 0, 2, 90)
		TNT1 A 0 A_PlaySound("MarineGuard", 2)
		TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
		MR7S A 30
		TNT1 A 0 A_SpawnItemEx ("RifleMarineGuarding",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 Thing_Remove(0)
		Stop

	Spawn:
		TNT1 A 0
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ChangeFlag("SOLID", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
		TNT1 A 0 A_GiveInventory("TargetIsAMarine")
		MARN D 4 A_Look
		Goto FindPlayer

	ForgetTarget:
		TNT1 A 0
		TNT1 A 0 //A_LOG("FORGET")
		TNT1 A 0 A_ClearTarget
		Goto Spawn

	See:
		TNT1 A 0
		TNT1 A 0 //A_LOG("SEE")
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ChangeFlag("SOLID", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPlayer")
		PLAY AAA 1 A_Chase

		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPlayer")
		PLAY BBB 1 A_Chase
		TNT1 A 0 A_JumpIfInventory("evmarinenoway", 1, "CheckIfCanJumpSee")

		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPlayer")
		PLAY CCC 1 A_Chase
		TNT1 A 0 A_CustomMissile("EvilMarineCheckFront", 28, 0, 0, 2, 0)

		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPlayer")
		PLAY BBB 1 A_Chase
		TNT1 A 0 A_CustomMissile("EvilMarineCheckJump", 64, 0, 0, CMF_AIMDIRECTION, 45)

		TNT1 A 0 A_CheckSight("ForgetTarget")
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("SOLID", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 0)

		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY AAA 1 A_Chase("","")
		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY BBA 1 A_Chase("","")

		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")

		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY CCC 1 A_Chase("","")
		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY BBB 1 A_Chase("","")

		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")

		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY AAA 1 A_Chase("","")
		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY BBB 1 A_Chase("","")
		TNT1 A 0 A_JumpIfInventory("evmarinenoway", 1, "CheckIfCanJumpFollow")

		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")

		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY CCC 1 A_Chase("","")
		TNT1 A 0 A_CustomMissile("EvilMarineCheckFront", 28, 0, 0, 2, 0)
		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY BBB 1 A_Chase("","")
		TNT1 A 0 A_CustomMissile("EvilMarineCheckJump", 64, 0, 0, CMF_AIMDIRECTION, 45)

		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")
		Loop

	CheckIfCanJumpSee:
		TNT1 A 0
		MARN D 2 A_FaceTarget
		TNT1 A 0 A_TakeInventory("evmarinenoway", 1)
		TNT1 A 0 A_JumpIfInventory("evmarinecanjump", 1, "Jump")
		Goto See

	CheckIfCanJumpFollow:
		TNT1 A 0
		MARN D 2 A_FaceTarget
		TNT1 A 0 A_TakeInventory("evmarinenoway", 1)
		TNT1 A 0 A_JumpIfInventory("evmarinecanjump", 1, "Jump")
		Goto FollowPlayer

	FindPlayer:
		TNT1 A 0
		TNT1 A 0 //A_LOG("FINDPLAYER")
	    TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("SOLID", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 0)
		MARN D 12 A_LookEx(0,0,0,0,360,"FollowPlayer")
		PLAY AAA 1 A_Wander
		PLAY BBB 1 A_Wander
		PLAY CCC 1 A_Wander
		PLAY BBB 1 A_Wander

		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ChangeFlag("SOLID", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
		TNT1 A 0 A_GiveInventory("TargetIsAMarine")
		MARN D 12 A_Look
		PLAY AAA 1 A_Wander
		PLAY BBB 1 A_Wander
		PLAY CCC 1 A_Wander
		PLAY BBB 1 A_Wander
		Loop

	FollowPlayer:
		TNT1 A 0
		TNT1 A 0 //A_LOG("FOLLOWPLAYER")
		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY AAA 1 A_Chase("","")
		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY BBA 1 A_Chase("","")

		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")

		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY CCC 1 A_Chase("","")
		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY BBB 1 A_Chase("","")

		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")

		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY AAA 1 A_Chase("","")
		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY BBB 1 A_Chase("","")
		TNT1 A 0 A_JumpIfInventory("evmarinenoway", 1, "CheckIfCanJumpFollow")

		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")

		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY CCC 1 A_Chase("","")
		TNT1 A 0 A_CustomMissile("EvilMarineCheckFront", 28, 0, 0, 2, 0)
		TNT1 A 0 A_JumpIfCloser(256, "Waits")
		PLAY BBB 1 A_Chase("","")
		TNT1 A 0 A_CustomMissile("EvilMarineCheckJump", 64, 0, 0, CMF_AIMDIRECTION, 45)

		TNT1 A 0 A_CheckSight("CheckIfPlayerSee")
		Goto FollowPlayer

	CheckIfPlayerSee:
		TNT1 A 0
		TNT1 A 0 //A_LOG("CHECKPLAYERSEE")
		TNT1 A 0 A_JumpIfCloser(256, 1)
		Goto Pathfind
		TNT1 AAA 0
		Goto FollowPlayer

	Pathfind:
		TNT1 A 0
		TNT1 A 0 //A_LOG("PATHFIND")
		TNT1 A 0 A_JumpIFInTargetInventory("IsPLayer", 1, 1)
		Goto FindPlayer
		TNT1 AAA 0
		TNT1 A 0 A_SpawnItemEx ("Marine_RiflePathfinder",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		Stop

	Waits:
		MARN D 0
		TNT1 A 0 //A_LOG("WAITS")
		MARN D 8 A_FaceTarget
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, 1)
		Goto ForgetTarget
		TNT1 A 0 A_Jump(32, "Waits2", "Waits3")
		MARN D 8 A_Facetarget
		TNT1 A 0 A_ClearTarget
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
		MARN DD 16 A_Look
		TNT1 A 0 A_JumpIfHealthLower(160,"Heal")
		TNT1 A 0 A_ClearTarget
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 0)
		TNT1 A 0 A_CheckSight("FollowPlayer")
		MARN D 8 A_LookEx(0,0,0,0,360,"FollowPlayer")
		Goto FindPlayer

	Waits2:
		MARN D 0
		TNT1 A 0 //A_LOG("WAITS2")
		TNT1 A 0 A_PlaySound("MRNWT", 2)
		MARN D 8 A_SetAngle(90 + angle)
		TNT1 A 0 A_ClearTarget
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
		MARN DD 16 A_Look
		TNT1 A 0 A_JumpIfHealthLower(160,"Heal")
		TNT1 A 0 A_ClearTarget
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 0)
		TNT1 A 0 A_CheckSight("FollowPlayer")
		MARN D 8 A_LookEx(0,0,0,0,360,"FollowPlayer")
		Goto FindPlayer

	Waits3:
		MARN D 0
		TNT1 A 0 //A_LOG("WAITS3")
		TNT1 A 0 A_JumpIfInTargetInventory("Clip2", 30, 1)
		Goto GiveAmmo
		TNT1 A 0 A_PlaySound("MRNWC", 2)
		MARN D 8 A_SetAngle(-90 + angle)
		TNT1 A 0 A_ClearTarget
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
		MARN DD 16 A_Look
		TNT1 A 0 A_JumpIfHealthLower(160,"Heal")
		TNT1 A 0 A_ClearTarget
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 0)
		TNT1 A 0 A_CheckSight("FollowPlayer")
		MARN D 8 A_LookEx(0,0,0,0,360,"FollowPlayer")
		Goto FindPlayer

	Heal:
		TNT1 A 0
		TNT1 A 0 //A_LOG("HEAL")
		TNT1 A 0 HealThing(1)
		TNT1 A 0 A_CustomMissile ("OrderTitle4", 50, 0, 0, 2, 90)
		TNT1 A 0 A_ClearTarget
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEMORE", 0)
		TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 0)
		MARN D 8 A_LookEx(0,0,0,0,360,"FollowPlayer")
		Goto FindPlayer

	GiveAmmo:
		TNT1 A 0
		MR7S A 10 A_FaceTarget
		TNT1 A 0 A_PlaySound("MRNGI1")
		MR7S A 15 A_FaceTarget
		PLA1 H 1 A_FaceTarget
		PLA1 E 4 A_SpawnItemEx("Clip2Spawner",16,0,32,5)
		PLA1 H 1 A_FaceTarget
		MR7S A 9 A_FaceTarget
		Goto Waits

	Missile:
		TNT1 A 0
		TNT1 A 0 //A_LOG("MISSILE")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsABaronOfHell", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMancubus", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPlayer")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "FollowPlayer")
		TNT1 A 0 A_PlaySound("MRNAT", 2)

		TNT1 A 0 A_Jump(128, "MissileLeft", "MissileRight")

		MAR2 A 3 A_FaceTarget
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")
		TNT1 A 0 A_MonsterRefire(0,"ForgetTarget")
		Goto Missile

	MissileLeft:
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPlayer")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "FollowPlayer")
		MAR2 A 3 A_FaceTarget
		TNT1 A 0 ThrustThing(angle*256/360+192, 3, 0, 0)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")
		TNT1 A 0 A_MonsterRefire(0,"ForgetTarget")
		Goto Missile

	MissileRight:
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPlayer")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "FollowPlayer")
		MAR2 A 3 A_FaceTarget
		TNT1 A 0 ThrustThing(angle*256/360+64, 3, 0, 0)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")
		TNT1 A 0 A_MonsterRefire(0,"ForgetTarget")
		Goto Missile

	Reload:
		MWAV I 10 A_FaceTarget
		TNT1 A 0 A_PlaySound("Reload")
		TNT1 A 0 A_CustomMissile("EmptyClipSpawn", 30, 0, random(-11, 11), 0)
		MWAV J 10 A_TakeInventory("RifleAmmo", 30)
		MWAV K 10 A_FaceTarget
		TNT1 A 0 A_PlaySound("CLIPIN")
		MWAV J 10 A_FaceTarget
		MWAV I 10 A_FaceTarget
		Goto See

	CheckRetreat:
		TNT1 A 0
		TNT1 A 0 //A_LOG("CHECKRETREAT")
		TNT1 A 0 A_JumpIfCloser(256, "Retreat")
		TNT1 A 0 A_Jump(255, "MissileRight", "MissileLeft")
		Goto MissileRight

	Retreat:
		TNT1 A 0 //A_LOG("RETREAT")
		MAR2 A 3 A_FaceTarget
		TNT1 A 0 A_Recoil(5)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")

        MAR2 A 3 A_FaceTarget
		TNT1 A 0 A_Recoil(5)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")

		MAR2 A 3 A_FaceTarget
		TNT1 A 0 A_Recoil(5)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")

		MAR2 A 3 A_FaceTarget
		TNT1 A 0 A_Recoil(5)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")
		Goto Pain.Avoid

	Melee:
		TNT1 A 0 //A_LOG("MELEE")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsABaronOfHell", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMancubus", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "FollowPlayer")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "FollowPlayer")
		TNT1 A 0 A_PlaySound("MRNAT", 2)

		PLAY E 3 A_FaceTarget
		PLAM A 3 A_FastChase
		PLAM B 3 A_CustomMissile("MarineKick",32,0,0,0)
		PLAM A 3 A_FastChase
		PLAY E 3 A_FaceTarget
		Goto See

	Jump:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("evmarinecanjump", 1)
		TNT1 A 0 ThrustThingZ(0, 32, 0, 1)
		TNT1 A 0 A_Recoil(-6)
		MARJ A 3
		TNT1 A 0 A_CheckSight("WaitforLand")
		MARJ A 1
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "WaitForLand")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "WaitForLand")
		TNT1 A 0 A_JumpIfTargetInLOS(1)
		Goto FollowPlayer
		TNT1 AAA 0
		TNT1 A 0 A_JumpIfCloser(128, "JumpKick")
		Goto Missile

	WaitforLand:
		TNT1 A 0
		MARJ AAAAAAAAAAA 3 A_Checkfloor("See")
		Goto See

	JumpBack:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("evmarinecanjump", 1)
		TNT1 A 0 ThrustThingZ(0, 32, 0, 1)
		TNT1 A 0 A_Recoil(6)
		MARJ A 3
		TNT1 A 0 A_CheckSight("WaitforLand")
		MARJ A 1
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "WaitForLand")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "WaitForLand")
		TNT1 A 0 A_JumpIfTargetInLOS(1)
		Goto WaitForLand
		TNT1 AAA 0
		TNT1 A 0 A_JumpIfCloser(128, "JumpKick")
		Goto WaitForLand

	JumpKick:
		TNT1 A 0
		PKIK ABC 2 A_Facetarget
		TNT1 A 0 A_Recoil(-6)
		AKIK A 2 A_CustomMissile("MarineAirKick",28,0,0,0)
		PKIK CBA 2 A_Facetarget
		Goto WaitforLand

	Pain:
	    PLAY G 3
		TNT1 A 0 A_Jump(128,"Pain.Avoid")
		PLAY G 3 A_Pain
		Goto FollowPlayer

	Pain.Kick:
	Pain.ExtremePunches:
		PLAY G 3 A_Pain
		Goto See

	Pain.Avoid:
		TNT1 A 0
		TNT1 A 0 A_Jump(192, "RollLeft", "RollRight")
		Goto JumpBack

	RollLeft:
		TNT1 A 0
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 ThrustThing(angle*256/360+192, 10, 0, 0)
		PROL EDCBA 3
		Goto See

	RollRight:
		TNT1 A 0
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 ThrustThing(angle*256/360+64, 10, 0, 0)
		PROL ABCDE 3
		Goto See

	Death:
	Death.Bullet:
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		PLAY H 10 A_PlayerScream

		PLAY I 10 A_NoBlocking
		PLAY J 10
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
		PLAY KLM 10
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
		PLAY N -1
		Stop

    Death.Eat:
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
        TNT1 A 0 A_GiveToTarget("EatMe",1)
		TNT1 A 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath4", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        XPL1 A 10 A_XScream
        XPL1 B 20 A_NoBlocking
        XPL1 CDE 10
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL1 E -1
        Stop

    Death.Cut:
	Death.Saw:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath2", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath3", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath4", 1, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("RipGuts", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("XDeathHalfMarine", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 A 10 A_XScream
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 B 20 A_NoBlocking
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 C 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 DE 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL2 E -1
        Stop

    Death.Slime:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_PlaySound("BIGSCREA")
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        PMET ABCDEFGHI 10 A_CustomMissile ("PlasmaSmoke", 25, 0, random (0, 180), 2, random (0, 180))
        PMET JJJKKKLLL 3 A_CustomMissile ("PlasmaSmoke", 25, 0, random (0, 180), 2, random (0, 180))
        NULL A 0 A_NoBlocking
        PMET M -1
        Stop

    Death.Minigun:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_Jump (128, 3)
        Goto Death
        TNT1 AAA 0
		TNT1 A 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath2", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath3", 1, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("XDeath4", 1, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("RipGuts", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("XDeathHalfMarine", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 A 10 A_XScream
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 B 20 A_NoBlocking
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 C 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL2 DE 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL2 E -1
        Stop

    Death.Rip:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
        TNT1 AAAAAAAAAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 A 10 A_XScream
        TNT1 AAAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 B 20 A_NoBlocking
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 C 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 D 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 E 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 F 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL3 F 10 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL3 F -1
        Stop
	Death.Massacre:
	Death.Explosive:
	XDeath:
		TNT1 A 0 ThrustThingZ(0,60,0,1)
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_CustomMissile ("MarineXDeath", 0, 0, random (0, 360), 2, random (0, 160))
		PPOD A 0 A_SpawnItemEx("BasicMarineGib1", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
		PPOD A 0 A_SpawnItemEx("BasicMarineGib2", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
		PPOD A 0 A_SpawnItemEx("BasicMarineGib3", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
		PPOD A 0 A_SpawnItemEx("BasicMarineGib4", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        MHEA A 7 A_XScream
        MHEA B 7 A_NoBlocking
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        MHEA CD 7
        MHEA E -1
		Stop

	 Death.Stomp:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
	    TNT1 AAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail8", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAAAA 0 bright A_CustomMissile ("SuperGoreSpawner", 5, 0, random (0, 360), 2, random (30, 180))
		TNT1 AAAAAA 0 bright A_CustomMissile ("XDeath1", 5, 0, random (0, 360), 2, random (30, 180))
		TNT1 AA 0 bright A_CustomMissile ("XDeath2", 55, 0, random (0, 360), 2, random (30, 180))
		TNT1 AA 0 bright A_CustomMissile ("XDeath3", 55, 0, random (0, 360), 2, random (30, 180))
		TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
		TNT1 A 0 A_SpawnItem ("CrushedRemains")
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
		TNT1 A 1
		TNT1 A 1 A_XScream
		TNT1 A 1 A_NoBlocking
		Stop

	Death.SuperPunch:
	Death.SSG:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
	    PLAY O 2 A_FaceTarget
        TNT1 AAAA 0 A_CustomMissile ("XDeath1", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBlood", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), 2, random (0, 40))
		TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), 2, random (0, 40))
		TNT1 A 0 A_CustomMissile ("XDeathArm1", 32, 0, random (170, 190), 2, random (0, 40))
        TNT1 A 0 A_XScream
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        PLAY OPQRSTUV 8
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        PLAY W -1
        Stop

    Death.Rape:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 AAAAAAAAAAAAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		XPL4 A 20 A_XScream
		 TNT1 A 0 A_CustomMissile ("XDeath1", 1, 0, random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath2", 1, 0, random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath3", 1, 0, random (0, 360), 2, random (0, 160))
		 TNT1 A 0 A_CustomMissile ("XDeath4", 1, 0, random (0, 360), 2, random (0, 160))
        TNT1 AAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 B 20 A_NoBlocking
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        TNT1 AAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 C 20
        TNT1 AAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 D 20
        TNT1 AAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 E 20
        TNT1 AAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
        XPL4 F 20
        TNT1 AAAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
        XPL4 F -1
        Stop

    Death.plasma:
        TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_XScream
        TNT1 A 0 A_NoBlocking
        TNT1 AAA 0 A_CustomMissile ("Brutal_FlyingBlood", 50, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), 2, random (0, 160))
		EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
        TNT1 A 1
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        TNT1 A -1
        Stop

	Death.GreenFire:
        TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
        TNT1 A 0 A_XScream
        TNT1 A 0 A_NoBlocking
        TNT1 AAAA 0 A_CustomMissile ("Brutal_Blood", 30, 0, random (0, 360), 2, random (0, 160))

	    TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), 2, random (0, 160))

		EXPL AAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("GreenFlameTrails", 50, 0, random (0, 360), 2, random (0, 360))
		XBRN AAAA 2 BRIGHT A_SpawnItem("GreenFlare",0,43)
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        Stop

	Death.burn:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		PBUR A 1
		PBUR A 1 A_Scream
		PBUR A 1 A_NoBlocking
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
		PBUR AAAABBBBCCCC 2 A_CustomMissile ("SmallFlameTrails", 32, 0, random (0, 180), 2, random (0, 180))
		PBUR DDDDEEEE 2 A_CustomMissile ("SmallFlameTrails", 16, 0, random (0, 180), 2, random (0, 180))
		PBUR EEEEE 4 A_CustomMissile ("SmallFlameTrails", 8, 0, random (0, 180), 2, random (0, 180))
		PBUR EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 6 A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
		PBUR E -1
		Stop

	Death.Fire:
	Death.Flames:
	Death.Burn:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_PlaySound("BIGSCREA")
		BURN W 6 A_Scream
		BURN X 6 A_NoBlocking
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
		BUR2 ABCD 6 BRIGHT A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
		BURN FGHIJKL 6 BRIGHT A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
		BURN MNOPQRSTUV 6 BRIGHT A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
		BURN VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 6 A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
		BURN V -1
		Stop

	Death.ExplosiveImpact:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		NULL A 0 ThrustThingZ(0,30,0,1)
		NULL AAAA 0 A_CustomMissile ("Brains1", 50, 0, random (0, 360), 2, random (0, 160))
		NULL A 0 A_CustomMissile ("Brains2", 50, 0, random (0, 360), 2, random (0, 160))
		NULL A 0 A_CustomMissile ("Brains3", 50, 0, random (0, 360), 2, random (0, 160))
		NULL A 0 A_CustomMissile ("Brains4", 50, 0, random (0, 360), 2, random (0, 160))
		NULL A 0 A_CustomMissile ("Brains5", 50, 0, random (0, 360), 2, random (0, 160))
		NULL AAAA 0 A_CustomMissile ("SmallBrainPiece", random (45, 55), random (5, -5), random (170, 190), 2, random (0, 40))
		NULL AAAA 0 A_CustomMissile ("SmallBrainPiece", 50, 0, random (0, 360), 2, random (0, 160))
		NULL AA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), 2, random (0, 40))
        NULL AAAAAAAAAAA 0 A_CustomMissile ("BrainBlood", 50, 0, random (0, 360), 2, random (0, 160))
	    NULL A 0 A_CustomMissile ("XDeathArm1", 35, 0, random (0, 360), 2, random (0, 160))
	    NULL A 0 A_CustomMissile ("XDeath3", 40, 0, random (0, 360), 2, random (0, 160))
	    PPOD A 0 A_SpawnItemEx("BasicMarineGib1", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
        NULL AAAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), 2, random (0, 160))
		NULL A 0 A_XScream
        XPL6 A 5
		NULL A 0 A_NoBlocking
        XPL6 BCDE 5
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        XPL6 F -1
        Stop

    Crush:
        TNT1 A 0 A_PlaySound("misc/xdeath4")
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)

        CRS1 A 5
        CRS1 A -1
        Stop

    Death.HKFT:
	Death.BHFT:
	Death.RVFT:
		TNT1 A 1 A_Scream
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 1 A_NoBlocking
        TNT1 A 0 A_GiveToTarget("Curbstomp_Marine",1)
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 5
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
		TNT1 A -1
        Stop

    Death.FatalityMarine:
		TNT1 A 1 A_PlayerScream
		TNT1 A 0 A_GiveToTarget("GoFatality", 1)
		TNT1 A 1 A_NoBlocking
		TNT1 A 0 ACS_NamedExecute("RemoveMarine")
        TNT1 A 0 A_GiveToTarget("Fatality_Marine",1)
		TNT1 A -1
        Stop
	}
}

ACTOR RifleMarineGuarding: Marine_Rifle
{
	Speed 0
	FastSpeed 0
	MaxStepHeight 0
	+NODROPOFF
	+MISSILEMORE
	+MISSILEEVENMORE
	States
	{
	Active:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile ("OrderTitle1", 50, 0, 0, 2, 90)
		TNT1 A 0 A_PlaySound("MarineFollow", 2)
		TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
		MR7S A 30
		TNT1 A 0 A_SpawnItemEx ("Marine_Rifle",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 Thing_Remove(0)
		Stop

	Spawn:
		TNT1 A 0
		TNT1 A 0 A_ChangeFLag("FRIENDLY", 1)
		TNT1 A 0 A_ChangeFlag("SOLID", 0)
		TNT1 A 0 A_GiveInventory("TargetIsAMarine")
		MARN DDDDDDDD 4 A_Look
		TNT1 A 0 A_JumpIfHealthLower(160,"Heal")
		Loop

	ForgetTarget:
		TNT1 A 0
		TNT1 A 0 A_ClearTarget
		Goto Spawn

	Heal:
		TNT1 A 0
		TNT1 A 0 HealThing(1)
		TNT1 A 0 A_CustomMissile ("OrderTitle4", 50, 0, 0, 2, 90)
		Goto Spawn

	FollowPlayer:
	See:
		MARN DDDDDDDDDDDD 1 A_Chase
		TNT1 A 0 A_ClearTarget
		Goto Spawn

	Missile:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsABaronOfHell", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMancubus", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "Spawn")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "Spawn")
		TNT1 A 0 A_PlaySound("MRNAT", 2)

		TNT1 A 0 A_Jump(128, "MissileLeft", "MissileRight")

		MAR2 A 3 A_FaceTarget
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")
		TNT1 A 0 A_MonsterRefire(0,"ForgetTarget")
		Goto Missile

	MissileLeft:
		MAR2 A 3 A_FaceTarget
		TNT1 A 0 ThrustThing(angle*256/360+192, 3, 0, 0)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")
		TNT1 A 0 A_MonsterRefire(0,"ForgetTarget")
		Goto Missile

	MissileRight:
		MAR2 A 3 A_FaceTarget
		TNT1 A 0 ThrustThing(angle*256/360+64, 3, 0, 0)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")
		TNT1 A 0 A_MonsterRefire(0,"ForgetTarget")
		Goto Missile

	Reload:
		MWAV I 10 A_FaceTarget
		TNT1 A 0 A_PlaySound("Reload")
		TNT1 A 0 A_CustomMissile("EmptyClipSpawn", 30, 0, random(-11, 11), 0)
		MWAV J 10 A_TakeInventory("RifleAmmo", 30)
		MWAV K 10 A_FaceTarget
		TNT1 A 0 A_PlaySound("CLIPIN")
		MWAV J 10 A_FaceTarget
		MWAV I 10 A_FaceTarget
		Goto See

	CheckRetreat:
		TNT1 A 0
		TNT1 A 0 A_JumpIfCloser(256, "Retreat")
		TNT1 A 0 A_Jump(255, "MissileRight", "MissileLeft")
		Goto MissileRight

	Retreat:
		MAR2 A 3 A_FaceTarget
		TNT1 A 0 A_Recoil(5)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")

        MAR2 A 3 A_FaceTarget
		TNT1 A 0 A_Recoil(5)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")

		MAR2 A 3 A_FaceTarget
		TNT1 A 0 A_Recoil(5)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")

		MAR2 A 3 A_FaceTarget
		TNT1 A 0 A_Recoil(5)
		MAR2 D 2 BRIGHT A_CustomMissile("MarineMuzzle1", 48)
		TNT1 A 0 A_AlertMonsters(0, AMF_TARGETEMITTER)
		TNT1 A 0 A_PlaySound("weapons/rifle")
		TNT1 A 0 A_CustomMissile("DistantFireSoundRifle", 48, 0, 0, 1, 0)
		TNT1 A 0 A_GiveInventory("RifleAmmo",1)
		TNT1 A 0 A_CustomMissile("MarineTracer", 48, 0, random(-1, 1), CMF_OFFSETPITCH, random(-1, 1))
		TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 48,0)

		TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "Reload")
		Goto Pain.Avoid

	Melee:
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsACyberdemon", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMastermind", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsABaronOfHell", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMancubus", 1, "CheckRetreat")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "Spawn")
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "Spawn")
		TNT1 A 0 A_PlaySound("MRNAT", 2)

		PLAY E 3 A_FaceTarget
		PLAM A 3 A_FastChase
		PLAM B 3 A_CustomMissile("MarineKick",32,0,0,0)
		PLAM A 3 A_FastChase
		PLAY E 3 A_FaceTarget
		Goto See

	WaitforLand:
		TNT1 A 0
		MARJ AAAAAAAAAAA 3 A_Checkfloor("See")
		Goto See

	JumpBack:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("evmarinecanjump", 1)
		TNT1 A 0 ThrustThingZ(0, 32, 0, 1)
		TNT1 A 0 A_Recoil(6)
		MARJ A 3
		TNT1 A 0 A_CheckSight("WaitforLand")
		MARJ A 1
		TNT1 A 0 A_JumpIfInTargetInventory("TargetIsAMarine", 1, "WaitForLand")
		TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, "WaitForLand")
		TNT1 A 0 A_JumpIfTargetInLOS(1)
		Goto WaitForLand
		TNT1 AAA 0
		TNT1 A 0 A_JumpIfCloser(128, "JumpKick")
		Goto WaitForLand

	JumpKick:
		TNT1 A 0
		PKIK ABC 2 A_Facetarget
		TNT1 A 0 A_Recoil(-6)
		AKIK A 2 A_CustomMissile("MarineAirKick",28,0,0,0)
		PKIK CBA 2 A_Facetarget
		Goto WaitforLand

	Pain:
	    PLAY G 3
		TNT1 A 0 A_Jump(128,"Pain.Avoid")
		PLAY G 3 A_Pain
		Goto See

	Pain.Kick:
	Pain.ExtremePunches:
		PLAY G 3 A_Pain
		Goto See

	Pain.Avoid:
		TNT1 A 0
		TNT1 A 0 A_Jump(192, "RollLeft", "RollRight")
		Goto JumpBack

	RollLeft:
		TNT1 A 0
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 ThrustThing(angle*256/360+192, 10, 0, 0)
		PROL EDCBA 3
		Goto See

	RollRight:
		TNT1 A 0
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 ThrustThing(angle*256/360+64, 10, 0, 0)
		PROL ABCDE 3
		Goto See
	}
}

ACTOR Ally: RandomMarine
{
	Game Doom
}

ACTOR Marine_RiflePathfinder
{
	Radius 16
	Height 56
	Speed 50
	PainChance 255
	Monster
	damagefactor "SpawnMarine", 8000.0
	-COUNTKILL
	+NODROPOFF
	+NOTARGET
	+THRUACTORS
	+MISSILEMORE
	+MISSILEEVENMORE
    +DONTSPLASH
	-SHOOTABLE
	-FRIENDLY
	+NOCLIP
	+LOOKALLAROUND
	+NOINFIGHTING
	+FIXMAPTHINGPOS
	States
	{
	Spawn:
		TNT1 A 0 A_GiveInventory("TargetIsAMarine", 1)
		TNT1 A 4 A_LookEx(0,0,0,0,360,"See")
		Loop

    See:
		TNT1 A 0 A_ChangeFlag("NOCLIP", 1)
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
		Goto Spawn

	Melee:
	Missile:
		TNT1 A 1 A_FaceTarget
		TNT1 A 0 A_ChangeFlag("NOCLIP", 0)
		TNT1 A 0 A_Recoil(4)
		TNT1 A 4 A_FaceTarget
		TNT1 A 0 A_JumpIf(((VelY == 0)&&(VelX == 0)), "CheckAgain")
	SpawnMarine:
		TNT1 A 0
		TNT1 A 2 A_NoBlocking
		TNT1 A 0 A_SpawnItemEx("Marine_Rifle",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_SpawnItem("FriendlymarineTFog")
		Stop
	CheckAgain:
		TNT1 A 0
		TNT1 A 1 A_FaceTarget
		TNT1 A 0 A_JumpIf(((VelY == 0)&&(VelX == 0)), "See")
		Goto SpawnMarine
	}
}