/*
CREDITS:
Fire sounds - ?? - I didn't document it back then, and I can't retrieve original author. They are from folks at FPSBanana before it had a major rehaul, so I can't find them now...
Up sound - Doom 3 (ID Software)
Rev up, Loop, Stop sounds - Serious Sam 3 & Wolfenstein 3 (Raven Software, Croteam)
Gun graphics source - Bulletstorm (People can Fly, Epic Games)
Gun graphics & sounds rip - Folks from AEoD, you save the day again, and I owe you huge thanks for that!
Gunflash - Bane
Pickup - Zrrion the Insect
Projectile and part of the pickup - Eriance

It's just even more devastating combination of Power Overwhelming and Gorynch.
Push the trigger, and see body parts flying!
*/

ACTOR Obliterator : Weapon 24533
{
   //$Category Weapons
   //$Title Obliterator
   //$Sprite FCKGX0
   Inventory.PickupSound "misc/w_pkup"
   Inventory.PickupMessage "You've got the Volga Corp. ''Obliterator'' minigun! Master Obliterator, I'm ripping your aaarms, twisting your ankles and smashing your kneeeees! (4)\n(nothing like a good lyrical recoil pun)"
   Obituary "%o didn't obey his Master, so %k obliterated poor fella."
   Weapon.UpSound "Weapons/ObliteratorUp"
   Weapon.SelectionOrder 5
   Weapon.AmmoType "Boolet"
   Weapon.AmmoGive 120
   Weapon.AmmoUse 1
   Weapon.Kickback 60
   Weapon.SlotNumber 4
   +AMMO_OPTIONAL
   +NOALERT
   States
   {
   Spawn:
      MOBG X -1
      Loop
   Ready:
      MOBG A 0 A_ZoomFactor(1)
      MOBG A 0 A_JumpIfInventory("Spinned2",1,"ReadySpinned2")
      MOBG Z 1 A_WeaponReady
      Loop
   ReadySpinned2:
      MOBG A 0 A_PlaySound("Weapons/ObliteratorLoop",5,0.75,1)
	  MOBG A 0 A_AlertMonsters
      MOBG ABCDABCDABCD 1 A_WeaponReady
      MOBG A 0 A_TakeInventory("Wedel2",1)
      MOBG A 0 A_JumpIfInventory("Spinned2",1,"ReadySpinned2")
      MOBG C 0 A_PlaySoundEx("Weapons/ObliteratorStop","SoundSlot5")
      MOBR ABCDABCD 1
      MOBR ABCDA 2
      MOBR BC 2
      MOBR D 4
      Goto Ready
   Deselect:
      MOBG Z 0 A_JumpIfInventory("Spinned2",1,"DeselectSpinned2")
      MOBG Z 0 ACS_Execute(711,0,100,0,0)
      MOBG Z 0 A_ZoomFactor(1)
      MOBG Z 0 A_StopSound(1)
      MOBG Z 0 A_StopSound(5)
      MOBG Z 0 A_StopSound(6)
      MOBG Z 1 A_Lower
      MOBG Z 0 A_Lower
      Loop
   DeselectSpinned2:
      MOBG A 0 A_PlaySound("Weapons/ObliteratorStop",5,0.75)
      MOBG A 0 ACS_Execute(711,0,100,0,0)
      MOBG A 0 A_TakeInventory("Spinned2",1)
      MOBR ABCDABCD 1
      MOBR ABCDA 2
      MOBR BC 2
      MOBR D 4
      Goto Deselect+1
   Select:
      //MOBG Z 0 A_Raise
      MOBG Z 1 A_Raise
      Loop
   Fire:
      MOBG A 0 A_JumpIfNoAmmo("Ready")
      MOBG A 0 A_JumpIfInventory("Spinned2",1,"Hold")
      MOBG A 0 A_PlaySound("Weapons/ObliteratorStart",5,0.75)
      MOBG ABCD 3
      MOBG ABCD 2
      MOBG ABCDABCDABCD 1
      MOBG A 0 A_GiveInventory("Spinned2",1)
      Goto ReadySpinned2
   Hold:
      MOBG A 0 A_JumpIfNoAmmo("HoldNoAmmo")
      goto TrueHold
   TrueHold:
      MOBG A 0 ACS_Execute(711,0,60,0,0)
      MOBG A 0 A_PlaySound("Weapons/ObliteratorFire",6,0.55,1)
      MOBG A 0 A_PlaySound("Weapons/ObliteratorFireAdd",1,0.55,1)
      Goto Fire1
   Fire1:
      MOBG A 0 A_ZoomFactor(0.8)
      MOBG A 0 A_GiveInventory("Wedel2",1)
      
      MOBG A 0 A_CheckReload
	  MOBG A 0 A_AlertMonsters
      MOBG A 0 A_GiveInventory("BooletCasing",1)
      MOBG A 0 A_GunFlash
      MOBG A 0 A_Quake(8,2,0,64,"none")
      MOBG A 0 A_Recoil(0.375)
      MOBG A 0 A_SetPitch(pitch-0.5)
      MOBG A 0 A_SetAngle(angle-0.5)
      MOBG AA 0 A_FireCustomMissile("ObliteratorBullet",0.01*random(600,-600),0,9+random(3,-3),random(1,-1),0,0.01*random(-300,300))
      MOBG A 0 A_FireCustomMissile("ObliteratorBullet",0.01*random(600,-600),1,9+random(3,-3),random(1,-1),0,0.01*random(-300,300))
      Goto Lawdy1 
   Lawdy1:
      MOBG A 0 A_Jump(255,"Fire1A","Fire1B","Fire1C")
   Fire1A:
      MOBF A 1 BRIGHT Offset(8,42)
      Goto Fire2
   Fire1B:
      MOBF A 1 BRIGHT Offset(11,44)
      Goto Fire2
   Fire1C:
      MOBF A 1 BRIGHT Offset(13,41)
      Goto Fire2
   Fire2:
      MOBG A 0 A_CheckReload
	  MOBG A 0 A_AlertMonsters
      MOBG A 0 A_GiveInventory("BooletCasing",1)
      MOBG A 0 A_GunFlash
      MOBG A 0 A_Quake(8,2,0,64,"none")
      MOBG A 0 A_Recoil(0.375)
      MOBG A 0 A_SetPitch(pitch-0.5)
      MOBG A 0 A_SetAngle(angle-0.5)
      MOBG AA 0 A_FireCustomMissile("ObliteratorBullet",0.01*random(600,-600),0,9+random(3,-3),random(1,-1),0,0.01*random(-300,300))
      MOBG A 0 A_FireCustomMissile("ObliteratorBullet",0.01*random(600,-600),1,9+random(3,-3),random(1,-1),0,0.01*random(-300,300))
      Goto Lawdy2 
   Lawdy2:
      MOBG A 0 A_Jump(255,"Fire2A","Fire2B","Fire2C")
   Fire2A:
      MOBF B 1 BRIGHT Offset(7,43)
      Goto Fire3
   Fire2B:
      MOBF B 1 BRIGHT Offset(9,40)
      Goto Fire3
   Fire2C:
      MOBF B 1 BRIGHT Offset(10,42)
      Goto Fire3
   Fire3:
      MOBG A 0 A_CheckReload
	  MOBG A 0 A_AlertMonsters
      MOBG A 0 A_GiveInventory("BooletCasing",1)
      MOBG A 0 A_GunFlash
      MOBG A 0 A_Quake(8,2,0,64,"none")
      MOBG A 0 A_Recoil(0.375)
      MOBG A 0 A_SetPitch(pitch-0.5)
      MOBG A 0 A_SetAngle(angle-0.5)
      MOBG AA 0 A_FireCustomMissile("ObliteratorBullet",0.01*random(600,-600),0,9+random(3,-3),random(1,-1),0,0.01*random(-300,300))
      MOBG A 0 A_FireCustomMissile("ObliteratorBullet",0.01*random(600,-600),1,9+random(3,-3),random(1,-1),0,0.01*random(-300,300))
      Goto Lawdy3
   Lawdy3:
      MOBG A 0 A_Jump(255,"Fire3A","Fire3B","Fire3C")
   Fire3A:
      MOBF C 1 BRIGHT Offset(8,42)
      Goto Fire4
   Fire3B:
      MOBF C 1 BRIGHT Offset(11,44)
      Goto Fire4
   Fire3C:
      MOBF C 1 BRIGHT Offset(12,41)
      Goto Fire4
   Fire4:
      MOBG A 0 A_CheckReload
	  MOBG A 0 A_AlertMonsters
      MOBG A 0 A_GiveInventory("BooletCasing",1)
      MOBG A 0 A_GunFlash
      MOBG A 0 A_Quake(8,2,0,64,"none")
      MOBG A 0 A_Recoil(0.375)
      MOBG A 0 A_SetPitch(pitch-0.5)
      MOBG A 0 A_SetAngle(angle-0.5)
      MOBG AA 0 A_FireCustomMissile("ObliteratorBullet",0.01*random(600,-600),0,9+random(3,-3),random(1,-1),0,0.01*random(-300,300))
      MOBG A 0 A_FireCustomMissile("ObliteratorBullet",0.01*random(600,-600),1,9+random(3,-3),random(1,-1),0,0.01*random(-300,300))
      Goto Lawdy4
   Lawdy4:
      MOBG A 0 A_Jump(255,"Fire4A","Fire4B","Fire4C")
   Fire4A:
      MOBF D 1 BRIGHT Offset(10,45)
      Goto Endler
   Fire4B:
      MOBF D 1 BRIGHT Offset(9,43)
      Goto Endler
   Fire4C:
      MOBF D 1 BRIGHT Offset(8,41)
      Goto Endler
   Endler:
      MOBR A 0 A_ReFire
      MOBG A 0 ACS_Execute(711,0,100,0,0)
      MOBG A 0 A_Quake(6,8,0,32,"none")
      MOBR A 0 A_StopSound(1)
      MOBR A 0 A_StopSound(6)
      MOBR A 0 A_ZoomFactor(0.82)
      MOBR A 1 Offset(7,45) //A_WeaponReady
      MOBR B 0 A_ZoomFactor(0.84)
      MOBR B 1 Offset(6,44) //A_WeaponReady
      MOBR C 0 A_ZoomFactor(0.86)
      MOBR C 1 Offset(5,42) //A_WeaponReady
      MOBR D 0 A_ZoomFactor(0.88)
      MOBR D 1 Offset(4,40) //A_WeaponReady
      MOBR A 0 A_ZoomFactor(0.9)
      MOBR A 1 Offset(3,38) //A_WeaponReady
      MOBR B 0 A_ZoomFactor(0.95)
      MOBR B 1 Offset(2,36) //A_WeaponReady
      MOBR C 0 A_ZoomFactor(0.975)
      MOBR C 1 Offset(1,34) //A_WeaponReady
      MOBR D 0 A_ZoomFactor(0.99)
      MOBR D 1 Offset(0,32) //A_WeaponReady
      MOBR D 0 A_ZoomFactor(1)
      Goto Ready
   HoldNoAmmo:
      MOBG A 0 A_JumpIfInventory("Spinned2",1,"RotateNoAmmo")
      Goto Ready
   RotateNoAmmo:
      MOBR A 0 A_JumpIfInventory("Wedel2",1,"HoldAStop")
      MOBR A 0 A_StopSound(1)
      MOBR A 0 A_StopSound(6)
	  MOBG A 0 A_AlertMonsters
      MOBR ABCDABCDABCD 1
      Goto Ready
   HoldAStop:
      MOBG A 0 ACS_Execute(711,0,100,0,0)
      MOBG A 0 A_Quake(6,8,0,32,"none")
      MOBR A 0 A_StopSound(1)
      MOBR A 0 A_StopSound(6)
      MOBR A 0 A_TakeInventory("Wedel2",1)
      MOBR A 1 Offset(7,45) A_ZoomFactor(0.82)
      MOBR B 1 Offset(6,44) A_ZoomFactor(0.84)
      MOBR C 1 Offset(5,42) A_ZoomFactor(0.86)
      MOBR D 1 Offset(4,40) A_ZoomFactor(0.88)
      MOBR A 1 Offset(3,38) A_ZoomFactor(0.9)
      MOBR B 1 Offset(2,36) A_ZoomFactor(0.95)
      MOBR C 1 Offset(1,34) A_ZoomFactor(0.975)
      MOBR D 1 Offset(0,32) A_ZoomFactor(0.99)
      MOBR A 0 A_ZoomFactor(1)
      Goto HoldNoAmmo
   AltFire:
      MOBG A 0 A_JumpIfInventory("Spinned2",1,1)
      Goto Ready
      MOBG A 0 A_TakeInventory("Spinned2",1)
      MOBG A 0 ACS_Execute(711,0,100,0,0)
      MOBG A 0 A_PlaySound("Weapons/ObliteratorStop",5,0.75)
      MOBG ABCDABCDABCD 1
      MOBG ABCD 2
      MOBG ABC 2
      MOBG D 4
      MOBG D 0 A_ClearReFire
      Goto Ready
   Flash:
      TNT1 A 4 BRIGHT A_Light1
      TNT1 A 3 BRIGHT A_Light2
      Goto LightDone
   }
}

ACTOR Spinned2 : Inventory
{
     Inventory.MaxAmount 1
}

ACTOR Wedel2 : Inventory
{
     Inventory.MaxAmount 1
}

actor ObliteratorBullet : FastProjectile
{
  Radius 6
  Height 8
  Speed 250
  Damage 5
  Projectile
  +RANDOMIZE
  +RIPPER
  +THRUGHOST
  +EXPLODEONWATER
  RenderStyle Add
  Alpha 0.99
  Scale 0.1
  DeathSound "Weapons/LarpaExp"
  MissileType "ObliteratorBulletTrailer"
  States
  {
  Spawn:
    TNT1 AA 0 ThrustThingZ(0,random(15,10),0,1)
  Looplet:
    TNT1 A 0 A_ChangeVelocity (frandom(-2.15, 2.15), frandom(-2.15, 2.15), frandom(-1.75, 1.75), 0)
    10BA A 1 Bright //ThrustThingZ(0,random(-5,-6),0,1)
    loop
  Death:
    TNT1 A 0 A_JumpIfInTargetInventory("NukerUpgrade",1,"NukerDeath")
    TNT1 A 0 A_Explode(40,64,0)
    TNT1 A 0 A_SpawnItemEx("PelletExplode",0,0,0,0,0,0,0,128,0)
    TNT1 BCD 4
    stop
  NukerDeath:
    TNT1 A 0 A_Explode(80,96,0)
    TNT1 A 0 A_SpawnItemEx("NukerPelletExplode",0,0,0,0,0,0,0,128,0)
    TNT1 BCD 4
    stop
  }
}

ACTOR ObliteratorBulletTrailer
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 //A_SpawnItemEx("ObliteratorBulletTrail",-0.1*random(15,5),0.1*random(15,5),7,0.01*random(15,10),0.01*random(15,10),0.01*random(15,10),Random(0,360),128,0)
	TNT1 A 1 A_SpawnItemEx("OverpowerTrail",-0.1*random(15,5),0.1*random(15,5),7,0.01*random(15,10),0.01*random(15,10),0.01*random(15,10),Random(0,360),128,0)
	Stop
	}
}

actor ObliteratorBulletTrail
{
  +NOINTERACTION
  +NOGRAVITY
  +CLIENTSIDEONLY
  Renderstyle Add
  Alpha 0.8
  Scale 0.1
  States
  {
  Spawn:
    10BA AA 1 A_FadeOut(0.2)
    loop
  }
}
