/*
CREDITS:
Sprites - Marty Kirra
Pickup - WildWeasel

Up - Mashup, part by Croteam (Serious Sam:SE)
Fire - Croteam (Serious Sam 2)
Add Fire - It's a mashup, sigh... but I think part is by Valve (Half-Life 2)
Holster - Raven (Wolfenstein 3)
*/

ACTOR LeviathanPickup : CustomInventory 24516 //Pickup
{
	//$Category Weapons
	//$Title Leviathan
	//$Sprite LEVGX0
	Inventory.PickupSound "misc/w_pkup"
	Inventory.PickupMessage "You got the ''Leviathan'' handcannon! God bless the Marty for this thing! (3)"
	Scale 0.8
	States
	{
		Spawn:
		LEVG X -1
		Stop
		Pickup:
		TNT1 A 0 A_JumpIfInventory("LeviathanPickupCounter",2,"CheckAmmo")
		Goto GiveItNevertheless
		CheckAmmo:
		TNT1 A 0 A_JumpIfInventory("ErasusAmmo",0,"Bailure")
		GiveItNevertheless:
		TNT1 A 0 A_GiveInventory("Leviathan")
		TNT1 A 0 A_GiveInventory("LeviathanPickupCounter")
		Stop
		Bailure:
		LEVG X 1
		Fail
	}
}

actor Leviathan : DoomWeapon
{
  Inventory.PickupSound "misc/w_pkup"
  inventory.pickupmessage "You got the ''Leviathan'' handcannon! Because sometimes two barrels simply don't do the laundry. I mean, justice. (3)"
  Obituary "%k did the laundr... I mean, killed %o. With a towel!...\noh come on, there is no freaking bathing reference in the freaking beast name! Come on... okay, I get it.\nIt emerges from the water. Nice one, all hail the master of witty puns."
  Weapon.UpSound "Weapons/LeviathanUp"
  Weapon.SelectionOrder 5
  Weapon.AmmoType "ErasusAmmo"
  Weapon.AmmoGive 10
  Weapon.AmmoUse 3
  Weapon.Kickback 35
  Weapon.SlotNumber 6
  AttackSound "Weapons/LeviathanFire"
  +NOAUTOFIRE
  +NOALERT
  Scale 0.8
  states
  {
  Spawn:
   LEVG X -1
   stop
  Ready:
   LEVG A 0 A_JumpIfInventory("LeviathanPickupCounter",2,"DualReady")
   LEVG A 0 A_JumpIfInventory("LeviathanAltCounter",1,"SightReady")
   LEVG A 1 A_WeaponReady
   Loop
  Select:
   LEVG A 0 A_JumpIfInventory("LeviathanPickupCounter",2,"DualSelect")
   LEVG A 0 A_Raise
   LEVG A 1 A_Raise
   loop
  Deselect:
   LEVG A 0 A_ZoomFactor(1)
   LEVG A 0 A_JumpIfInventory("LeviathanPickupCounter",2,"DualDeselect")
   LEVG A 0 A_JumpIfInventory("LeviathanAltCounter",1,"SightDeselect")
   LEVG A 0 A_Lower
   LEVG A 1 A_Lower
   loop
  Fire:
   LEVG A 0 A_JumpIfInventory("LeviathanPickupCounter",2,"DualFire")
   LEVG A 0 A_JumpIfInventory("LeviathanAltCounter",1,"SightFire")

   TNT1 A 0 A_AlertMonsters
   TNT1 A 0 A_GunFlash
   TNT1 A 0 A_Recoil(7)
   TNT1 A 0 A_GiveInventory("ErasusCasing",3)
   TNT1 A 0 Radius_Quake(3,2,0,16,0)
   TNT1 A 0 ACS_Execute(851,0,100+random(-20,0),75+random(-10,0),0)
   TNT1 A 0 A_PlaySound("Weapons/LeviathanAddFire",5,0.5)
   TNT1 A 0 A_JumpIfInventory("QuadUpgrade",1,"QuadFire")
   TNT1 A 0 A_FireBullets(17.5, 3.75, 45, 18, "ErasusPuff")
   Goto CthulhuEatsVirgins
 QuadFire:
   TNT1 A 0 A_SetBlend("Blue",0.075,16)
   TNT1 A 0 A_PlaySound("Weapons/QuadShot",6,0.7)
   TNT1 A 0 A_FireBullets(17.5, 3.75, 45, 36, "QuadPuff")
 CthulhuEatsVirgins:
   LEVF A 1 bright A_ZoomFactor(0.95)
   LEVF B 1 bright A_ZoomFactor(0.97)
   LEVF C 1 A_ZoomFactor(0.98)
   LEVF D 1 A_ZoomFactor(0.99)
   LEVF E 1 A_ZoomFactor(0.995)
   LEVF F 1 A_ZoomFactor(1)
   LEVF GHIJKLM 1
   LEVG A 9
   goto Ready

 AltFire:
   LEVG A 0 A_JumpIfInventory("LeviathanPickupCounter",2,"DualSight")
   LEVG A 0 A_JumpIfInventory("LeviathanAltCounter",1,"DeSight")
   LEVG A 0 A_GiveInventory("LeviathanAltCounter",1)

   LEIS A 0 A_PlaySound("Weapons/LeviathanHolster")
   LEIS A 0 ACS_Execute(711,0,125,0,0)
   LEIS A 1 A_ZoomFactor(1.1)
   LEIS B 1 A_ZoomFactor(1.125)
   LEIS C 1 A_ZoomFactor(1.15)
   LEIS D 1 A_ZoomFactor(1.2)
   LEIS E 1 A_ZoomFactor(1.3)
   LEIS F 1 A_ZoomFactor(1.4)
   LEIG A 1 A_ZoomFactor(1.5)
   Goto SightReady
 SightReady:
   LEIG A 1 A_WeaponReady
   Loop
 DeSight:
   LEIG A 0 A_PlaySound("Weapons/LeviathanHolster")
   LEIG A 0 A_TakeInventory("LeviathanAltCounter",1)
   LEIG A 0 ACS_Execute(711,0,100,0,0)
   LEIG A 1 A_ZoomFactor(1.5)
   LEIS F 1 A_ZoomFactor(1.4)
   LEIS E 1 A_ZoomFactor(1.3)
   LEIS D 1 A_ZoomFactor(1.2)
   LEIS C 1 A_ZoomFactor(1.15)
   LEIS B 1 A_ZoomFactor(1.125)
   LEIS A 1 A_ZoomFactor(1)
   Goto Ready
 SightDeselect:
   LEIS A 0 A_PlaySound("Weapons/LeviathanHolster")
   LEIS A 0 A_TakeInventory("LeviathanAltCounter",1)
   LEIS A 0 ACS_Execute(711,0,100,0,0)
   LEIS A 1 A_ZoomFactor(1.5)
   LEIS F 1 A_ZoomFactor(1.4)
   LEIS E 1 A_ZoomFactor(1.3)
   LEIS D 1 A_ZoomFactor(1.2)
   LEIS C 1 A_ZoomFactor(1.15)
   LEIS B 1 A_ZoomFactor(1.125)
   LEIS A 1 A_ZoomFactor(1)
   Goto Deselect
 SightFire:
   TNT1 A 0 A_AlertMonsters
   TNT1 A 0 A_GunFlash
   TNT1 A 0 A_Recoil(3)
   TNT1 A 0 A_GiveInventory("ErasusCasing",3)
   TNT1 A 0 Radius_Quake(4,2,0,12,0)
   TNT1 A 0 ACS_Execute(851,0,50+random(-10,-10),random(-10,10),0)
    TNT1 A 0 A_PlaySound("Weapons/LeviathanAddFire",5,0.55)
   TNT1 A 0 A_JumpIfInventory("QuadUpgrade",1,"QuadSightFire")
   TNT1 A 0 A_FireBullets(4.5, 1.15, 45, 18, "ErasusPuff")
   Goto PotatoShushKebabMixer
 QuadSightFire:
   TNT1 A 0 A_SetBlend("Blue",0.075,16)
   TNT1 A 0 A_PlaySound("Weapons/QuadShot",6,0.75)
   TNT1 A 0 A_FireBullets(4.5, 1.15, 45, 36, "QuadPuff")
 PotatoShushKebabMixer:
   LEIF A 1 bright A_ZoomFactor(1.05)
   LEIF B 1 bright A_ZoomFactor(1.25)
   LEIF C 1 A_ZoomFactor(1.35)
   LEIF D 1 A_ZoomFactor(1.45)
   LEIF E 1 A_ZoomFactor(1.5)
   LEIF F 1
   LEIF G 1
   LEIG A 7
   goto Ready

  DualReady:
   LV2G A 0 A_JumpIfInventory("LeviathanAltCounter",1,"DualSightReady")
   LV2G A 1 A_WeaponReady
   Loop
  DualSelect:
   LV2G A 0 A_Raise
   LV2G A 1 A_Raise
   loop
  DualDeselect:
   LV2G A 0 A_JumpIfInventory("LeviathanAltCounter",1,"DualSightDeselect")
   LV2G A 0 A_Lower
   LV2G A 1 A_Lower
   loop
  DualFire:
   LEVG A 0 A_JumpIfInventory("LeviathanAltCounter",1,"DualSightFire")
   TNT1 A 0 A_JumpIfInventory("LeviathanFireCounter",1,"FireLeft")
  FireRight:
   TNT1 A 0 A_GiveInventory("LeviathanFireCounter",1)
   
   TNT1 A 0 A_AlertMonsters
   TNT1 A 0 A_GunFlash
   TNT1 A 0 A_Recoil(7)
   TNT1 A 0 A_GiveInventory("ErasusCasing",3)
   TNT1 A 0 Radius_Quake(3,2,0,16,0)
   TNT1 A 0 ACS_Execute(851,0,100+random(-20,0),75+random(-10,0),0)
   TNT1 A 0 A_PlaySound("Weapons/LeviathanAddFire",5,0.5)
   TNT1 A 0 A_JumpIfInventory("QuadUpgrade",1,"QuadFireRight")
   TNT1 A 0 A_FireBullets(17.5, 3.75, 45, 18, "ErasusPuff")
   Goto MictantecutliEatsDeadPeople
 QuadFireRight:
   TNT1 A 0 A_SetBlend("Blue",0.075,16)
   TNT1 A 0 A_PlaySound("Weapons/QuadShot",6,0.7)
   TNT1 A 0 A_FireBullets(17.5, 3.75, 45, 36, "QuadPuff")
 MictantecutliEatsDeadPeople:
   LEVR A 1 bright A_ZoomFactor(0.95)
   LEVR B 1 bright A_ZoomFactor(0.97)
   LEVR C 1 A_ZoomFactor(0.98)
   LEVR D 1 A_ZoomFactor(0.99)
   LEVR E 1 A_ZoomFactor(0.995)
   LEVR F 1 A_ZoomFactor(1)
   LEVR GHIJKL 1 //M
   LEVR M 0 A_ReFire
   //LV2G A 9 A_ReFire
   Goto Ready
   
  FireLeft:
   TNT1 A 0 A_TakeInventory("LeviathanFireCounter",1)
   
   TNT1 A 0 A_AlertMonsters
   TNT1 A 0 A_GunFlash
   TNT1 A 0 A_Recoil(7)
   TNT1 A 0 A_GiveInventory("ErasusCasing",3)
   TNT1 A 0 Radius_Quake(3,2,0,16,0)
   TNT1 A 0 ACS_Execute(851,0,100+random(+20,0),-75+random(-10,0),0)
   TNT1 A 0 A_PlaySound("Weapons/LeviathanAddFire",5,0.5)
   TNT1 A 0 A_JumpIfInventory("QuadUpgrade",1,"QuadFireLeft")
   TNT1 A 0 A_FireBullets(17.5, 3.75, 45, 18, "ErasusPuff")
   Goto TezcatlipocaLollery
 QuadFireLeft:
   TNT1 A 0 A_SetBlend("Blue",0.075,16)
   TNT1 A 0 A_PlaySound("Weapons/QuadShot",6,0.7)
   TNT1 A 0 A_FireBullets(17.5, 3.75, 45, 36, "QuadPuff")
 TezcatlipocaLollery:
   LEVL A 1 bright A_ZoomFactor(0.95)
   LEVL B 1 bright A_ZoomFactor(0.97)
   LEVL C 1 A_ZoomFactor(0.98)
   LEVL D 1 A_ZoomFactor(0.99)
   LEVL E 1 A_ZoomFactor(0.995)
   LEVL F 1 A_ZoomFactor(1)
   LEVL GHIJKL 1 //M
   LEVL M 0 A_ReFire
   //LV2G A 9 A_ReFire
   Goto Ready
   
 DualSight:
   LI2S A 0 A_PlaySound("Weapons/LeviathanHolster")
   LI2S A 0 A_JumpIfInventory("LeviathanAltCounter",1,"DualDeSight")
   LI2S A 0 A_GiveInventory("LeviathanAltCounter",1)
   LI2S A 0 ACS_Execute(711,0,125,0,0)
   LI2S M 1 A_ZoomFactor(1.025)
   LI2S L 1 A_ZoomFactor(1.05)
   LI2S K 1 A_ZoomFactor(1.075)
   LI2S J 1 A_ZoomFactor(1.1)
   LI2S I 1 A_ZoomFactor(1.15)
   LI2S H 1 A_ZoomFactor(1.2)
   LI2S G 1 A_ZoomFactor(1.25)
   LI2S F 1 A_ZoomFactor(1.3)
   LI2S E 1 A_ZoomFactor(1.35)
   LI2S D 1 A_ZoomFactor(1.4)
   LI2S C 1 A_ZoomFactor(1.45)
   LI2S B 1 A_ZoomFactor(1.475)
   LI2S A 1 A_ZoomFactor(1.5)
   Goto DualSightReady
 DualSightReady:
   LI2G A 1 A_WeaponReady
   Loop
 DualDeSight:
   LI2S A 0 A_TakeInventory("LeviathanAltCounter",1)
   LI2S A 0 ACS_Execute(711,0,100,0,0)
   LI2S A 1 A_ZoomFactor(1.5)
   LI2S B 1 A_ZoomFactor(1.475)
   LI2S C 1 A_ZoomFactor(1.45)
   LI2S D 1 A_ZoomFactor(1.4)
   LI2S E 1 A_ZoomFactor(1.35)
   LI2S F 1 A_ZoomFactor(1.3)
   LI2S G 1 A_ZoomFactor(1.25)
   LI2S H 1 A_ZoomFactor(1.2)
   LI2S I 1 A_ZoomFactor(1.15)
   LI2S J 1 A_ZoomFactor(1.1)
   LI2S K 1 A_ZoomFactor(1.075)
   LI2S L 1 A_ZoomFactor(1.05)
   LI2S M 1 A_ZoomFactor(1.025)
   LV2G A 1 A_ZoomFactor(1)
   Goto Ready
 DualSightDeselect:
   LI2S A 0 A_PlaySound("Weapons/LeviathanHolster")
   LI2S A 0 A_TakeInventory("LeviathanAltCounter",1)
   LI2S A 0 ACS_Execute(711,0,100,0,0)
   LI2S A 1 A_ZoomFactor(1.5)
   LI2S B 1 A_ZoomFactor(1.475)
   LI2S C 1 A_ZoomFactor(1.45)
   LI2S D 1 A_ZoomFactor(1.4)
   LI2S E 1 A_ZoomFactor(1.35)
   LI2S F 1 A_ZoomFactor(1.3)
   LI2S G 1 A_ZoomFactor(1.25)
   LI2S H 1 A_ZoomFactor(1.2)
   LI2S I 1 A_ZoomFactor(1.15)
   LI2S J 1 A_ZoomFactor(1.1)
   LI2S K 1 A_ZoomFactor(1.075)
   LI2S L 1 A_ZoomFactor(1.05)
   LI2S M 1 A_ZoomFactor(1.025)
   LV2G A 1 A_ZoomFactor(1)
   Goto Deselect
 DualSightFire:
   TNT1 A 0 A_JumpIfInventory("LeviathanFireCounter",1,"SightFireLeft")
 SightFireRight:
   TNT1 A 0 A_GiveInventory("LeviathanFireCounter",1)
   TNT1 A 0 A_AlertMonsters
   TNT1 A 0 A_GunFlash
   TNT1 A 0 A_Recoil(3)
   TNT1 A 0 A_GiveInventory("ErasusCasing",3)
   TNT1 A 0 Radius_Quake(4,2,0,12,0)
   TNT1 A 0 ACS_Execute(851,0,50+random(-10,-10),random(-10,10),0)
   TNT1 A 0 A_PlaySound("Weapons/LeviathanAddFire",5,0.55)
   TNT1 A 0 A_JumpIfInventory("QuadUpgrade",1,"QuadSightFireRight")
   TNT1 A 0 A_FireBullets(4.5, 1.15, 45, 18, "ErasusPuff")
   Goto WololoYouAreRed
 QuadSightFireRight:
   TNT1 A 0 A_SetBlend("Blue",0.075,16)
   TNT1 A 0 A_PlaySound("Weapons/QuadShot",6,0.75)
   TNT1 A 0 A_FireBullets(4.5, 1.15, 45, 36, "QuadPuff")
 WololoYouAreRed:
   LIRF A 1 bright A_ZoomFactor(1.05)
   LIRF B 1 bright A_ZoomFactor(1.25)
   LIRF C 1 A_ZoomFactor(1.35)
   LIRF D 1 A_ZoomFactor(1.45)
   LIRF E 1 A_ZoomFactor(1.5)
   LIRF F 1
   LI2G A 3
   LI2G A 0 A_ReFire
   goto Ready
   
 SightFireLeft:
   TNT1 A 0 A_TakeInventory("LeviathanFireCounter",1)
   TNT1 A 0 A_AlertMonsters
   TNT1 A 0 A_GunFlash
   TNT1 A 0 A_Recoil(3)
   TNT1 A 0 A_GiveInventory("ErasusCasing",3)
   TNT1 A 0 Radius_Quake(4,2,0,12,0)
   TNT1 A 0 ACS_Execute(851,0,50+random(-10,-10),random(-10,10),0)
   TNT1 A 0 A_PlaySound("Weapons/LeviathanAddFire",5,0.55)
   TNT1 A 0 A_JumpIfInventory("QuadUpgrade",1,"QuadSightFireLeft")
   TNT1 A 0 A_FireBullets(4.5, 1.15, 45, 18, "ErasusPuff")
   Goto WololoYouAreBlue
 QuadSightFireLeft:
   TNT1 A 0 A_SetBlend("Blue",0.075,16)
   TNT1 A 0 A_PlaySound("Weapons/QuadShot",6,0.75)
   TNT1 A 0 A_FireBullets(4.5, 1.15, 45, 36, "QuadPuff")
 WololoYouAreBlue:
   LILF A 1 bright A_ZoomFactor(1.05)
   LILF B 1 bright A_ZoomFactor(1.25)
   LILF C 1 A_ZoomFactor(1.35)
   LILF D 1 A_ZoomFactor(1.45)
   LILF E 1 A_ZoomFactor(1.5)
   LILF F 1
   LI2G A 3
   LI2G A 0 A_ReFire
   goto Ready
  Flash:
   TNT1 A 4 Bright A_Light1
   TNT1 A 2 Bright A_Light2
   Goto LightDone
  }
}

actor LeviathanFireCounter : Inventory
{
  inventory.maxamount 1
}

actor LeviathanPickupCounter : Inventory
{
  inventory.maxamount 2
  inventory.icon "TNT1A0"
}

actor LeviathanAltCounter : Inventory
{
  inventory.maxamount 1
}
