// Heat Seeker

ACTOR Heatseeker : IDMWeapon
{
  Weapon.SelectionOrder 400
  //Weapon.PreferredSkin "HeatSeekerMarine"
  Weapon.AmmoType "IDMRocketAmmo"
  Weapon.AmmoGive 6
  Weapon.AmmoUse 3
  Weapon.Sisterweapon "HeatSeekerLevel2"
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "Heat Seeker! (Slot 5)"
  Tag "Heat Seeker"
  +WEAPON.EXPLOSIVE
  +WEAPON.NOAUTOAIM
  +WEAPON.NOLMS
	States
	{
	Spawn:
	  HEAT A -1 Bright
	  Stop
	Ready:
	  HSKR A 1 A_WeaponReady
	  Loop
	Select:
	  TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
	Sloop:
      HSKR A 0 A_Raise
      HSKR A 0 A_Raise
      HSKR A 1 A_Raise
	  Loop
	Deselect:
	  HSKR A 0 A_Lower
	  HSKR A 0 A_Lower
	  HSKR A 1 A_Lower
	  Loop
	Fire:
	  TNT1 A 0 A_GunFlash
    Normal:
	  TNT1 A 0 A_PlaySound("weapons/heatseekerf")
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
	  HSKR A 3 Bright A_FireCustomMissile("HeatSeekerMissile",0,1)
	  Goto FireEnd
	Quad:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO,1)
	  HSKR A 3 Bright A_FireCustomMissile("ExtremeHeatSeekerMissile",0,1)
	  Goto FireEnd
	FireEnd:
	  HSKR B 8 Bright
	  HSKR B 2 Bright Offset(0,33)
	  HSKR B 1 Bright Offset(0,34) A_Playsound("weapons/heatreload",CHAN_AUTO)
	  HSKR B 1 Bright Offset(0,38)
	  HSKR B 2 Bright Offset(0,42)
	  HSKR B 11 Bright Offset(0,45)
	  HSKR B 1 Bright Offset(0,42)
	  HSKR B 2 Bright Offset(0,36)
	  HSKR B 3 Bright Offset(0,34)
	  HSKR A 4 Offset(0,34)
	  HSKR A 4 Offset(0,33)
	  TNT1 A 0 A_Refire
	  Goto Ready
	Flash:
	  HSKF A 3 bright A_Light1
	  HSKF B 3 bright
	  HSKF C 3 bright A_Light2
	  HSKF D 3 bright A_Light2
	  Goto LightDone
	}
}

ACTOR HeatSeekerLevel2 : HeatSeeker
{
	Weapon.Sisterweapon "HeatSeeker"
	//Weapon.PreferredSkin "SuperSeekerMarine"
	+POWERED_UP
	+WEAPON.CHEATNOTWEAPON
	States
	{
	Ready:
	  HSK2 A 1 A_WeaponReady
	  Loop
	Select:
	  TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
	Sloop:
	  TNT1 A 0 A_Raise
	  TNT1 A 0 A_Raise
	  HSK2 A 1 A_Raise
	  Loop
	Deselect:
	  TNT1 A 0 A_Lower
	  TNT1 A 0 A_Lower
	  HSK2 A 1 A_Lower
	  Loop
	Fire:
	  TNT1 A 0 A_GunFlash
	  TNT1 A 0 A_PlaySound("weapons/heatseekerf")
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
	  HSK2 A 3 Bright A_FireCustomMissile("HeatSeekerMissile2",0,1,-5)
	  TNT1 A 0 A_PlaySound("weapons/heatseekerf")
	  HSK2 A 3 Bright A_FireCustomMissile("HeatSeekerMissile2",0,0,5)
	  Goto FireEnd
	Quad:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO,1)
	  HSK2 A 3 Bright A_FireCustomMissile("ExtremeHeatSeekerMissile2",0,1,-5)
	  TNT1 A 0 A_PlaySound("weapons/heatseekerf")
	  HSK2 A 3 Bright A_FireCustomMissile("ExtremeHeatSeekerMissile2",0,0,5)
	FireEnd:
	  HSK2 B 5 Bright
	  HSK2 B 2 Bright Offset(0,33)
	  HSK2 B 1 Bright Offset(0,34) A_Playsound("weapons/heatreload",CHAN_AUTO)
	  HSK2 B 1 Bright Offset(0,38)
	  HSK2 B 2 Bright Offset(0,42)
	  HSK2 B 11 Bright Offset(0,45)
	  HSK2 B 1 Bright Offset(0,42)
	  HSK2 B 2 Bright Offset(0,36)
	  HSK2 B 3 Bright Offset(0,34)
	  HSK2 A 4 Offset(0,34)
	  HSK2 A 4 Offset(0,33)
	  TNT1 A 0 A_Refire
	  Goto Ready
	Flash:
	  HS2F A 3 bright A_Light1
	  HS2F B 3 bright
	  HS2F C 3 bright A_Light2
	  HS2F D 3 bright A_Light2
	  Goto LightDone
	}
}

// Heat Seeker's Missile #1

ACTOR HeatSeekerMissile : IDMRocket
{
  Health 1
  Damage (100 + (20 * random(1,10)))
  Speed 20
  +SHOOTABLE /* This has to be on so that the missile can be shot midair when
				NOBLOCKMAP goes FALSE. */
  +NOBLOOD
  -NOTELEPORT
  +SKYEXPLODE
  +SEEKERMISSILE
  +DONTSEEKINVISIBLE
  +SCREENSEEKER
  +NORADIUSDMG /* Missiles cannot receive splash damage. This is to prevent two
			   or more Seeker Missiles colliding with each other so easily. */
  SeeSound "weapons/seekermislf"
  Obituary "%o couldn't outrun %k's seeker missile."
  SelfObituary "%o followed %p own seeker missile."
  Decal Scorch
  Decal BigScorch
  States
  {
  Spawn:
	TNT1 A 0
	HMIS A 8 Bright
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	TNT1 A 0 A_ScaleVelocity(0.9)
  Solid:
	TNT1 A 0 A_ChangeFlag(NOBLOCKMAP,0)
	HMIS A 8 Bright A_SeekerMissile(21.666,65,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	HMIS A 8 Bright A_SeekerMissile(21.666,65,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 8 Bright A_SeekerMissile(21.666,65,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 8 Bright A_SeekerMissile(21.666,65,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 8 Bright A_SeekerMissile(21.666,65,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 6 Bright A_SeekerMissile(20,60,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 6 Bright A_SeekerMissile(20,60,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 6 Bright A_SeekerMissile(20,60,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 6 Bright A_SeekerMissile(20,60,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 5 Bright A_SeekerMissile(18.333,55,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 5 Bright A_SeekerMissile(18.333,55,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 5 Bright A_SeekerMissile(18.333,55,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 5 Bright A_SeekerMissile(18.333,55,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 4 Bright A_SeekerMissile(16.666,50,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 4 Bright A_SeekerMissile(16.666,50,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 4 Bright A_SeekerMissile(16.666,50,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 4 Bright A_SeekerMissile(16.666,50,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 3 Bright A_SeekerMissile(13.333,40,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 3 Bright A_SeekerMissile(13.333,40,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 3 Bright A_SeekerMissile(13.333,40,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	HMIS A 3 Bright A_SeekerMissile(13.333,40,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
  HomingLoop:
	HMIS A 2 Bright A_SeekerMissile(10,30,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,8)
	TNT1 A 0 A_Playsound("weapons/seekerprime")
	/* In the looping state, the missile will home in on a 35 degree angle on
	the first gametic every 2 tics.*/
	Loop
  Death:
	TNT1 A 0 A_SetScale(1.25)
    MISL B 6 Bright A_Explode(160,160)
    MISL C 5 Bright
	MISL D 4 Bright
    Stop
  }
}

ACTOR ExtremeHeatSeekerMissile : HeatSeekerMissile
{
  ProjectileKickBack 400
  +EXTREMEDEATH
  States
  {
  XDeath:
	TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
	Goto Death
  }
}

ACTOR HeatSeekerMissile2 : HeatSeekerMissile
{
	-SHOOTABLE
	States
	{
	Spawn:
	  TNT1 A 0
	  HMS2 A 8 Bright
	HomingLoop:
	  HMS2 A 2 Bright A_SeekerMissile(15,45,SMF_LOOK|SMF_CURSPEED|SMF_PRECISE,256,10)
	  TNT1 A 0 A_Playsound("weapons/seekerprime")
	  Loop
	}
}

ACTOR ExtremeHeatSeekerMissile2 : HeatSeekerMissile2
{
  ProjectileKickBack 400
  +EXTREMEDEATH
  States
  {
  XDeath:
	TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
	Goto Death
  }
}