/*
CREDITS:
Kronos - Original Doom 2.5 sprites
Pisstepank - reload frames
Alt-fire sound - ??
Projectile bounce sound - Epic games
ID Software - original weapon graphic model, every other sound, projectile graphics
Eriance - Graphics that I used to make pickup
Ammo pickups - Zrrion the Insect

I recolored it, made the thingy on the left, the exhaust port
of some kind to have animation like the original gun from ID.
Also, made the pickup. Just sayin'!
*/

ACTOR Petrovec : DoomWeapon 24538
{
   //$Category Weapons
   //$Title Petrovec
   //$Sprite TKGGX0
   Inventory.PickupSound "misc/w_pkup"
   Inventory.PickupMessage "You've got the ''Petrovec'' serbian XT-500 vearetelium rifle! This gun is imbued with the wisdom of the falcon! (7)"
   Obituary "%o was blasted by %k's ''Petrovec'' vearetelium rifle! %k removed %h like a kebab."
   Weapon.UpSound "Petrovec/Up"
   Weapon.SelectionOrder 2
   Weapon.AmmoType "PetrovecClip"
   Weapon.AmmoGive 0
   Weapon.AmmoUse 1
   Weapon.AmmoType2 "VearAmmo"
   Weapon.AmmoGive2 30
   Weapon.AmmoUse2 0
   Weapon.Kickback 65
   Weapon.SlotNumber 7
   Scale 0.85
   +AMMO_OPTIONAL
   +ALT_AMMO_OPTIONAL
   +NOAUTOFIRE
   +NOALERT
   States
   {
   Spawn:
      TKGG X -1
      Loop
   Ready:
      TKGG Y 0 A_JumpIfInventory("VearAmmo",1,1)
      Goto EmptyReady
      TKGU A 0 A_PlaySound("Petrovec/Start",5,1.0,1)
      TKGG Z 2
      TKGU ABC 2
      TKGG A 0 A_PlaySound("Petrovec/Loop",5,1.0,1)
      TKGG ABC 2
   ReadyMain:
      TKGG Y 0 A_JumpIfInventory("TwasEmpty",1,"IsNewAmmoCheck")
      TKGG Y 0 A_JumpIfInventory("VearAmmo",1,1)
      Goto EmptyReady
      TKGG ABC 3 A_WeaponReady
	  TNT1 A 0 A_JumpIfInventory("RO_GotoReload", 1, "Reload")
      Loop
   EmptyReady:
      TKGG Y 0 A_GiveInventory("TwasEmpty",1)
      TKGG Y 3 A_WeaponReady
	  TNT1 A 0 A_JumpIfInventory("RO_GotoReload", 1, "Reload")
      Goto ReadyMain 
   IsNewAmmoCheck:
      TKGG A 0 A_JumpIfInventory("VearAmmo",1,"Wheee")
	  TKGG A 0 A_TakeInventory("TwasEmpty",1)
	  Goto ReadyMain
   Wheee:
	  TKGG A 0 A_TakeInventory("TwasEmpty",1)
	  Goto Ready
   Deselect:
      TKGU C 0 A_ZoomFactor(1)
      TKGG Z 0 A_JumpIfInventory("VearAmmo",1,1)
      Goto DeselectNoAmmo
      TKGU C 0 A_PlaySound("Petrovec/End",5)
      TKGU C 1 A_Lower
      TKGU C 0 A_Lower
      TKGU B 1 A_Lower
      TKGU B 0 A_Lower
      TKGU A 1 A_Lower
      TKGU A 0 A_Lower
      Goto Looplet
   DeselectNoAmmo:
      TKGG Y 0 A_StopSoundEx("SoundSlot5")
      Goto Looplet
   Looplet:
      TKGG Y 1 A_Lower
      TKGG Y 0 A_Lower
      Loop
   Select:
      TKGG Y 0 A_JumpIfInventory("VearAmmo",1,"Dorp")
      Goto Hnnng
   Dorp:
	  TKGG A 0 A_TakeInventory("TwasEmpty",1)
      TKGU A 0 A_PlaySound("Petrovec/Start",5,1.0,1)
   Hnnng:
      TKGG Y 1 A_Raise
      TKGG Y 0 A_Raise
      Loop
   Fire:
      TKGG Z 0 A_JumpIfInventory("VearAmmo",1,1)
      Goto Nope
      TKGG Z 0 A_TakeInventory("VearAmmo",1,1)
      TKGF A 0 A_StopSoundEx("SoundSlot5")
      TKGF A 0 A_AlertMonsters
      TKGF A 0 A_Recoil(3)
      TKGF A 0 A_GiveInventory("PetrovecTrigger",1)
      TKGF A 0 A_PlaySound("Petrovec/Fire",1)
      TKGF A 0 A_PlaySound("Petrovec/AddFire",6)
      TKGF A 0 A_PlaySound("Petrovec/Ambient",5)
      TKGF A 0 A_FireCustomMissile("PetrovecBolt",frandom(0.5,-0.5),0,5,0,0,frandom(0.5,-0.5))

      TKGF A 0 ACS_Execute(851,0,40+random(15,-10),30+random(12,-7))
      TKGF A 1 Bright A_ZoomFactor(0.95)
      TKGF A 0 ACS_Execute(851,0,30+random(10,-10),30+random(10,-5))
      TKGF B 1 Bright A_ZoomFactor(0.955)
      TKGF C 1 A_ZoomFactor(0.95)
      TKGF D 1 A_ZoomFactor(0.96)
      TKGF E 1 A_ZoomFactor(0.97)
      TKGG Z 0 A_ReFire
      TKGG Z 0 A_TakeInventory("PetrovecTrigger",1)
      TKGF F 1 A_ZoomFactor(0.975)
      TKGG Z 1 A_ZoomFactor(0.985)
      TKGG Z 1 A_ZoomFactor(0.995)
      TKGG Z 2 A_ZoomFactor(1)
      Goto Ready
   AltFire:
      TKGF A 0 A_JumpIfInventory("PetrovecClip",1,1)
	  Goto Nope2
	  TKGF A 0 A_TakeInventory("PetrovecClip",1,TIF_NOTAKEINFINITE)
      TKGF A 0 A_StopSoundEx("SoundSlot5")
      TKGF A 0 A_AlertMonsters
      TKGF A 0 A_Recoil(3)
      TKGF A 0 A_SetBlend("Yellow",0.2,15)
      TKGF A 0 A_GiveInventory("PetrovecTrigger",1)
      TKGF A 0 A_PlaySound("Petrovec/AltFire",1)
      TKGF A 0 A_PlaySound("Petrovec/Ambient",6)
      TKGF A 0 A_PlaySound("Petrovec/AltFire",5)
      TKGF A 0 A_FireCustomMissile("PetrovecBolt2",frandom(0.5,-0.5),1,5,0,0,frandom(0.5,-0.5))

      TKGF A 0 ACS_Execute(851,0,70+random(15,-10),40+random(12,-7))
      TKGF A 1 Bright A_ZoomFactor(0.95)
      TKGF A 0 ACS_Execute(851,0,30+random(10,-10),30+random(10,-5))
      TKGF B 1 Bright A_ZoomFactor(0.955)
      TKGF C 1 A_ZoomFactor(0.95)
      TKGF D 1 A_ZoomFactor(0.96)
      TKGF E 1 A_ZoomFactor(0.97)
      TKGF F 1 A_ZoomFactor(0.975)
      TKGG Z 1 A_ZoomFactor(0.985)
      TKGG Z 0 A_ReFire
      TKGG Z 0 A_TakeInventory("PetrovecTrigger",1)
      TKGG Z 1 A_ZoomFactor(0.995)
      TKGG Z 2 A_ZoomFactor(1)
      Goto Ready
   ReadyReload:
      TNT1 A 0 A_JumpIfInventory("VearAmmo",1,2)
	  TKGG Y 3 A_WeaponReady
	  Goto ReadyMain
      TKGG ABC 3 A_WeaponReady
      Goto ReadyMain
   Reload:
      TNT1 A 0 A_JumpIfInventory("PetrovecClip",0,"ReadyReload")
      TNT1 A 0 A_JumpIfInventory("VearAmmo",1,1)
      Goto ReadyReload
   ReloadMain:
      TKGF A 0 A_JumpIfInventory("VearAmmo",1,"Unload")
      TKGR ABCD 2
      TKGR D 0 A_PlaySound("Petrovec/Out")
      TKGR FKG 2
      TKGR H 12
      TKGR IJLMNO 1
   ReloadWorking:
      TNT1 A 0 A_TakeInventory("VearAmmo",2,TIF_NOTAKEINFINITE)
      TNT1 A 0 A_GiveInventory("PetrovecClip",1)
      TNT1 A 0 A_JumpIfInventory("PetrovecClip",0,2)
      TNT1 A 0 A_JumpIfInventory("VearAmmo",2,2)
      TNT1 A 0
      Goto ReloadFinish
      TNT1 A 0
      Goto ReloadWorking
   ReloadFinish:
      TKGR S 0 A_PlaySound("Petrovec/In",6)
      TKGR PQQRSTU 2
      TKGG Z 6
      Goto Ready
   Unload:
      TKGU C 0 A_PlaySound("Petrovec/End",5)
      TKGU CBA 2
      TKGG Z 8
      Goto ReloadMain+2
   Nope2:
      TKGF A 0 A_JumpIfInventory("PetrovecTrigger",1,"DoctorNope")
      TKGN A 0 A_JumpIfInventory("VearAmmo",1,1)
	  Goto Nope
      TKGG A 0 A_PlaySound("Petrovec/Nope")
      TKGU C 0 A_PlaySound("Petrovec/End",5)
      TKGU CBA 2
      TKGG Z 8
      Goto Ready
   DoctorNope:
      TLGG A 0 A_TakeInventory("PetrovecTrigger",1)
      TKGG A 0 A_PlaySound("Petrovec/Nope")
      TKGG A 1 Offset(4,36)
      TKGG A 1 Offset(2,34)
      TKGG B 1 Offset(1,33)
      TKGG B 1 Offset(0,32)
      TKGG C 2
      TKGG ABC 2
      Goto Ready
   Nope:
      TKGN A 0 A_ZoomFactor(1)
      TKGN A 0 A_JumpIfInventory("PetrovecTrigger",1,"NopeAfterFire")
      TKGN A 0 A_PlaySound("Petrovec/Nope")
      TKGN AB 2
      TKGG Y 6
      Goto ReadyMain
   NopeAfterFire:
      TKGU C 0 A_TakeInventory("PetrovecTrigger",1)
      TKGU C 0 A_PlaySound("Petrovec/End",5)
      TKGU CBA 2
      TKGG Y 2
      Goto ReadyMain
   Flash:
      TNT1 A 2 Bright A_Light2
      TNT1 A 4 Bright A_Light1
      Goto LightDone
   }
}

ACTOR PetrovecClip : Ammo
{
   Inventory.MaxAmount 20
   Inventory.Icon TKGGX0
}

ACTOR PetrovecTrigger : Inventory
{
   Inventory.MaxAmount 1
}

ACTOR TwasEmpty : Inventory
{
   Inventory.MaxAmount 1
}

ACTOR PetrovecBolt
{
	Radius 7
	Height 3
	Speed 20
	Damage 125
	PROJECTILE
	+SEEKERMISSILE
	+SCREENSEEKER
	+DONTBLAST
	Renderstyle Add
	Alpha 0.99
	Scale 0.9
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("Petrovec/Fly",5,1.0,1)
		NPSB A 0 A_Jump(255,"SpawnA","SpawnB","SpawnC","SpawnD","SpawnE","SpawnF","SpawnG","SpawnH","SpawnI","SpawnJ","SpawnK","SpawnL")
	SpawnA:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB A 1 Bright
		Loop
	SpawnB:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB B 1 Bright
		Loop
	SpawnC:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB C 1 Bright
		Loop
	SpawnD:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB D 1 Bright
		Loop
	SpawnE:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB E 1 Bright
		Loop
	SpawnF:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB F 1 Bright
		Loop
	SpawnG:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB G 1 Bright
		Loop
	SpawnH:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB H 1 Bright
		Loop
	SpawnI:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB I 1 Bright
		Loop
	SpawnJ:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB J 1 Bright
		Loop
	SpawnK:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB K 1 Bright
		Loop
	SpawnL:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(2,2,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB L 1 Bright
		Loop
	Death:
		TNT1 A 0
		TNT1 A 0 A_StopSound(5)
		TNT1 A 0 A_PlaySound("Petrovec/Hit")
		TNT1 A 0 A_PlaySoundEx("Petrovec/Explode","SoundSlot6")
		TNT1 A 0 A_Explode(175,128,0,0)
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingExp")
		TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx("PetrovecBoltParticleExp",random(11,-11),frandom(11,-11),frandom(9,-9),frandom(1,2),frandom(1,2),frandom(2,-2),random(0,359))
		TNT1 AAAAAA 0 A_SpawnItemEx("PetrovecBoltExplode",random(19,-19),random(19,-19),random(12,-12),frandom(1,-1),frandom(1,-1),frandom(1,-1),random(0,359))
		TNT1 A 10
		TNT1 AAAAAAAAAAAA 0 A_SpawnItemEx("PetrovecBoltSmokeExp",random(12,-12),random(12,-12),random(7,-7),frandom(1,-1),frandom(1,-1),frandom(1,-1),random(0,359))
		stop
	}
}

ACTOR PetrovecBolt2 : PetrovecBolt
{
    PROJECTILE
    +BOUNCEONACTORS
	+DONTBLAST
    BounceType Hexen
    BounceCount 10
    BounceFactor 1.0
    WallBounceFactor 1.0
	ReactionTime 210
    BounceSound "Petrovec/Bounce"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("Petrovec/Fly",5,1.0,1)
		NPSB A 0 A_Jump(255,"SpawnA","SpawnB","SpawnC","SpawnD","SpawnE","SpawnF","SpawnG","SpawnH","SpawnI","SpawnJ","SpawnK","SpawnL")
	SpawnA:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB A 1 Bright A_Countdown
		Loop
	SpawnB:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB B 1 Bright A_Countdown
		Loop
	SpawnC:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB C 1 Bright A_Countdown
		Loop
	SpawnD:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB D 1 Bright A_Countdown
		Loop
	SpawnE:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB E 1 Bright A_Countdown
		Loop
	SpawnF:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB F 1 Bright A_Countdown
		Loop
	SpawnG:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB G 1 Bright A_Countdown
		Loop
	SpawnH:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB H 1 Bright A_Countdown
		Loop
	SpawnI:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB I 1 Bright A_Countdown
		Loop
	SpawnJ:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB J 1 Bright A_Countdown
		Loop
	SpawnK:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB K 1 Bright A_Countdown
		Loop
	SpawnL:
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltParticleTrail",frandom(3,-3),frandom(3,-3),frandom(3,-3))
		TNT1 A 0 A_SpawnItemEx("PetrovecBoltRingTrail",frandom(2,-2),frandom(2,-2),frandom(2,-2))
		TNT1 AA 0 A_SpawnItemEx("PetrovecBoltSmokeTrail",-4+random(4,-4),random(4,-4),random(4,-4))
		TNT1 A 0 A_SeekerMissile(5,10,SMF_LOOK|SMF_PRECISE,256,1)
                NPSB L 1 Bright A_Countdown
		Loop
	}
}

ACTOR PetrovecBoltSmokeTrail
{
	Scale 0.35
	Alpha 0.95
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			NPSS A 0
			NPSS BDMKHFEDCBAA 1 Bright A_FadeOut(0.04)
			Stop
	}
}

ACTOR PetrovecBoltRingTrail
{
	Scale 0.15
	Alpha 0.1
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			NPSR A 0
			NPSR A 0 //A_SetScale(ScaleX +0.075, ScaleY +0.075)
			NPSR A 1 Bright A_FadeIn(0.025)
			NPSR A 0 //A_SetScale(ScaleX +0.075, ScaleY +0.075)
			NPSR A 1 Bright A_FadeIn(0.025)
			NPSR A 0 //A_SetScale(ScaleX +0.075, ScaleY +0.05)
			NPSR A 1 Bright A_FadeIn(0.025)
			NPSR A 0 //A_SetScale(ScaleX +0.075, ScaleY +0.05)
			NPSR A 1 Bright A_FadeIn(0.025)
			NPSR A 0 //A_SetScale(ScaleX +0.075, ScaleY +0.025)
			NPSR A 1 Bright A_FadeIn(0.025)

			NPSR A 0 //A_SetScale(ScaleX -0.075, ScaleY -0.025)
			NPSR A 1 Bright A_FadeOut(0.025)
			NPSR A 0 //A_SetScale(ScaleX -0.075, ScaleY -0.05)
			NPSR A 1 Bright A_FadeOut(0.025)
			NPSR A 0 //A_SetScale(ScaleX -0.075, ScaleY -0.05)
			NPSR A 1 Bright A_FadeOut(0.025)
			NPSR A 0 //A_SetScale(ScaleX -0.075, ScaleY -0.075)
			NPSR A 1 Bright A_FadeOut(0.025)
			NPSR A 0 //A_SetScale(ScaleX -0.075, ScaleY -0.075)
			NPSR A 1 Bright A_FadeOut(0.025)
			Stop
	}
}

ACTOR PetrovecBoltParticleTrail
{
	Scale 0.04
	Alpha 0.99
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			NPSB A 0
			NPSB A 0 A_Jump(255,"SpawnA","SpawnB","SpawnC","SpawnD","SpawnE","SpawnF","SpawnG","SpawnH","SpawnI","SpawnJ","SpawnK","SpawnL")
		SpawnA:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB A 1 Bright A_FadeOut(0.04+random(0.0075,-0.0075))
			Loop
		SpawnB:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB B 1 Bright A_FadeOut(0.05+random(0.0075,-0.0075))
			Loop
		SpawnC:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB C 1 Bright A_FadeOut(0.04+random(0.0075,-0.0075))
			Loop
		SpawnD:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB D 1 Bright A_FadeOut(0.04+random(0.0075,-0.0075))
			Loop
		SpawnE:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB E 1 Bright A_FadeOut(0.04+random(0.0075,-0.0075))
			Loop
		SpawnF:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB F 1 Bright A_FadeOut(0.04+random(0.0075,-0.0075))
			Loop
		SpawnG:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB G 1 Bright A_FadeOut(0.04+random(0.0075,-0.0075))
			Loop
		SpawnH:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB H 1 Bright A_FadeOut(0.04+random(0.0075,-0.0075))
			Loop
		SpawnI:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB I 1 Bright A_FadeOut(0.04+random(0.0075,-0.0075))
			Loop
		SpawnJ:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB J 1 Bright A_FadeOut(0.05+random(0.0075,-0.0075))
			Loop
		SpawnK:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB K 1 Bright A_FadeOut(0.05+random(0.0075,-0.0075))
			Loop
		SpawnL:
   			NPSB A 0 A_ChangeVelocity (frandom(0.2, -0.2),frandom(0.2, -0.2), frandom(0.2, -0.2), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB L 1 Bright A_FadeOut(0.04+random(0.0075,-0.0075))
			Loop
	}
}

ACTOR PetrovecBoltExplode
{
	Scale 2
	Alpha 0.75
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			NPSS A 0
			NPSS ABCDEFGHIJKLMNOP 2 Bright A_FadeOut(0.05)
			Wait
	}
}


ACTOR PetrovecBoltSmokeExp
{
	Scale 1.75
	Alpha 0.5
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			NPSS A 0
			NPSS P 1 Bright A_FadeOut(0.005)
			Wait
	}
}

ACTOR PetrovecBoltRingExp
{
	Scale 0.25
	Alpha 0.99
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			NPSR A 0
			NPSR A 0 //A_SetScale(ScaleX +0.1, ScaleY +0.1)
			NPSR A 1 Bright A_FadeOut(0.05)
			NPSR A 0 //A_SetScale(ScaleX +0.1, ScaleY +0.1)
			NPSR A 1 Bright A_FadeOut(0.05)
			NPSR A 0 //A_SetScale(ScaleX +0.1, ScaleY +0.1)
			NPSR A 1 Bright A_FadeOut(0.05)
			NPSR A 0 //A_SetScale(ScaleX +0.1, ScaleY +0.1)
			NPSR A 1 Bright A_FadeOut(0.05)
		Looplet:
			NPSR A 0 //A_SetScale(ScaleX +0.1, ScaleY +0.1)
			NPSR A 1 Bright A_FadeOut(0.03)
			Loop
	}
}

ACTOR PetrovecBoltParticleExp : PetrovecBoltParticleTrail
{
	Scale 0.1
	Alpha 0.99
	+NOINTERACTION
	+CLIENTSIDEONLY
	Renderstyle Add
	States
	{
		Spawn:
			NPSB A 0
			NPSB A 0 A_Jump(255,"SpawnA","SpawnB","SpawnC","SpawnD","SpawnE","SpawnF","SpawnG","SpawnH","SpawnI","SpawnJ","SpawnK","SpawnL")
		SpawnA:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB A 1 Bright A_FadeOut(0.03+random(0.0075,-0.0075))
			Loop
		SpawnB:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB B 1 Bright A_FadeOut(0.05+random(0.0075,-0.0075))
			Loop
		SpawnC:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB C 1 Bright A_FadeOut(0.03+random(0.0075,-0.0075))
			Loop
		SpawnD:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB D 1 Bright A_FadeOut(0.03+random(0.0075,-0.0075))
			Loop
		SpawnE:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB E 1 Bright A_FadeOut(0.03+random(0.0075,-0.0075))
			Loop
		SpawnF:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB F 1 Bright A_FadeOut(0.03+random(0.0075,-0.0075))
			Loop
		SpawnG:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB G 1 Bright A_FadeOut(0.03+random(0.0075,-0.0075))
			Loop
		SpawnH:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB H 1 Bright A_FadeOut(0.03+random(0.0075,-0.0075))
			Loop
		SpawnI:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB I 1 Bright A_FadeOut(0.03+random(0.0075,-0.0075))
			Loop
		SpawnJ:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB J 1 Bright A_FadeOut(0.05+random(0.0075,-0.0075))
			Loop
		SpawnK:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB K 1 Bright A_FadeOut(0.05+random(0.0075,-0.0075))
			Loop
		SpawnL:
   			NPSB A 0 A_ChangeVelocity (frandom(0.6, -0.6),frandom(0.6, -0.6), frandom(0.6, -0.6), 0)
			NPSB A 0 //A_SetScale(ScaleX -0.00025, ScaleY -0.00025)
			NPSB L 1 Bright A_FadeOut(0.03+random(0.0075,-0.0075))
			Loop
	}
}
