/*
CREDITS:

Sprites:
GUN - Marty Kirra, refined by me!
PICKUP'N'PROJECTILE - base frame by DoomNukem, rest by me!

Sounds:
Up - Valve (Half-Life 2)
Fire - ? (Another unrecognizable mashup that I just couldn't say no to, sigh)
Throw - ID Soft. (Quake 2)
Scream, slightly sped up - Generic sound pack

*/

ACTOR BernieScreamer : Weapon //BERNI KRZYKACZ!
{
  Tag "Bernie Screamer"
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "You got the ''Bernie Screamer'' revolver! (2)"
  Obituary "AND THE PANTS WERE DEAD, so %k Freeman shoot his gun - really fast, killing %o." //No one will really play this mod in deathmatch. If you read this then your dumb.
  Weapon.UpSound "Weapons/BernieUp"
  Weapon.SelectionOrder 6
  Weapon.AmmoType "Boolet"
  Weapon.AmmoGive 0
  Weapon.AmmoUse 2
  Weapon.AmmoType2 "Boolet"
  Weapon.AmmoUse2 10
  Weapon.Kickback 20
  Weapon.SlotNumber 2
  Weapon.BobStyle InverseSmooth
  Weapon.BobSpeed 1.7
  Weapon.BobRangeY 0.6
  Weapon.BobRangeX 1.2
  AttackSound ""
  +WEAPON.CHEATNOTWEAPON
  +NOALERT
  States
  {
  //SINGLE LEVORVEL
  
   Ready:
      TNT1 A 0 A_JumpIfInventory("BasicUpgrade",1,"ZweiReady")
      REVG A 5
      REVG CDACDACDA 1
   ReadyMain:
      TNT1 A 0 A_JumpIfInventory("BasicUpgrade",1,"ZweiActivate")
      REVG A 1 A_WeaponReady
      Loop
   Deselect:
      TNT1 A 0 A_ZoomFactor(1)
      TNT1 A 0 A_JumpIfInventory("BasicUpgrade",1,"ZweiDeselect")
      REVG A 1 A_Lower
      REVG A 0 A_Lower
      Loop
   Select:
      TNT1 A 0 A_JumpIfInventory("BasicUpgrade",1,"ZweiSelect")
      REVG A 1 A_Raise
      REVG A 0 A_Raise
      Loop
   Fire:
      TNT1 A 0 A_GiveInventory("BooletCasing",2)
      REVF A 0 A_Recoil(2.5)
	  REVF A 0 A_AlertMonsters
      REVF A 0 A_PlaySound("Weapons/BernieFire",1,0.6)
      REVF A 0 A_JumpIfInventory("CaliberUpgrade",1,"CFire")
      REVF A 0 A_FireBullets(2.0,1.0,-1,120,"BulletPuff",1)
      Goto Rest
   CFire:
      REVF A 0 A_PlaySound("Weapons/WolgirHEndFire",6,0.8)
      REVF A 0 A_FireBullets(2.0,1.0,-1,240,"CaliberPuff",1)
   Rest:
	  REVF A 0 A_Light2
      REVF A 0 A_ZoomFactor(0.99)
	  REVF A 0 A_SetAngle(angle-1.0)
	  REVF A 0 A_SetPitch(pitch-1.2)
      REVF A 1 Bright
      REVF A 0 A_ZoomFactor(0.98)
	  REVC B 0 A_SetAngle(angle-0.5)
	  REVC B 0 A_SetPitch(pitch-0.6)
      REVC B 1
      REVC A 0 A_Light1
	  REVC A 0 A_SetAngle(angle-0.25)
	  REVC A 0 A_SetPitch(pitch-0.3)
      REVC C 1 A_ZoomFactor(0.975)
	  REVC A 0 A_SetAngle(angle-0.25)
	  REVC A 0 A_SetPitch(pitch-0.3)
      REVC D 1 A_ZoomFactor(0.97)
	  REVC A 0 A_SetAngle(angle-0.25)
	  REVC A 0 A_SetPitch(pitch-0.3)
      REVC E 1 A_ZoomFactor(0.975)
      REVF A 0 A_Light0
      REVC F 1 A_ZoomFactor(0.98)
      REVC G 1 A_ZoomFactor(0.985)
	  REVC H 1 A_ZoomFactor(0.99)
	  REVC I 1 A_ZoomFactor(0.995)
	  REVC J 1 A_ZoomFactor(1)
	  REVC K 1
	  REVC L 1
      REVC LMNOP 1
	  REVG CD 1
      REVG A 1 A_ReFire
      Goto ReadyMain
  AltFire:
	  REVT ABDFHJL 1
	  TNT1 A 5
      TNT1 A 0 A_GiveInventory("BooletCasing",10)
	  TNT1 A 0 A_PlaySound("Items/Throw",5,1.0)
	  TNT1 A 0 A_FireCustomMissile("BernieTediore",0,1,12,0) //Hurrr.
	  HNDG I 1
	  REVF A 0 A_SetAngle(angle+3.0)
	  REVF A 0 A_SetPitch(pitch+1.5)
	  HNDG J 1
	  REVF A 0 A_SetAngle(angle+2.5)
	  REVF A 0 A_SetPitch(pitch+1)
	  HNDG K 1
	  REVF A 0 A_SetAngle(angle+2)
	  REVF A 0 A_SetPitch(pitch+0.75)
	  HNDG L 1
	  REVF A 0 A_SetAngle(angle+1.5)
	  REVF A 0 A_SetPitch(pitch+0.5)
	  HNDG M 1
	  REVF A 0 A_SetAngle(angle+1.0)
	  REVF A 0 A_SetPitch(pitch+0.25)
	  HNDG NOP 1
	  TNT1 A 10
	  REVT KIGECA 1
	  REVG A 5
	  Goto ReadyMain

  //DOUBLE LEVORVEL

  ZweiSelect:
    RE3G A 0 A_Raise
	RE3G A 1 A_Raise
    Loop
  ZweiDeselect:
	TNT1 A 0 A_TakeInventory("SynthFireActive",1)
	TNT1 A 0 A_TakeInventory("SynthFireLeft",1)
	TNT1 A 0 A_TakeInventory("SynthFireRight",1)
  Zweihander:
    RE3G A 0 A_Lower
    RE3G A 1 A_Lower
	Loop
  ZweiReady:
    RE3G A 5
    RE3G CDACDACDA 1
  ZweiActivate:
  	RE2G A 0 A_GiveInventory("SynthFireActive",1)
	RE2G A 0 ACS_NamedExecuteAlways("SynthLeft")
	RE2G A 0 ACS_NamedExecuteAlways("SynthRight")
	RE2G A 0 A_Gunflash
	Goto LIdle
	
  //LEFT LEVORVEL
  
  LIdle:
	  RE2G A 0 A_JumpIfInventory("SynthFireLeft",1,"LFire")
	  RE2G A 1 A_WeaponReady(WRF_NOFIRE|WRF_ALLOWRELOAD)
	  Loop
  LFire:
	  RE2G A 1 A_JumpIfInventory("Boolet",2,1)
	  Goto LIdle
      TNT1 A 0 A_GiveInventory("BooletCasing",2)
      TNT1 A 0 A_TakeInventory("Boolet",2)
      RE2F A 0 A_Recoil(2.5)
	  RE2F A 0 A_AlertMonsters
      RE2F A 0 A_PlaySound("Weapons/BernieFire",5,0.6)
      RE2F A 0 A_JumpIfInventory("CaliberUpgrade",1,"CLFire")
      RE2F A 0 A_FireBullets(2.0,1.0,-1,120,"BulletPuff",0)
      Goto LRest
  CLFire:
      RE2F A 0 A_PlaySound("Weapons/WolgirHEndFire",6,0.8)
      RE2F A 0 A_FireBullets(2.0,1.0,-1,240,"CaliberPuff",0)
  LRest:
	  RE2F A 0 A_Light2
      RE2F A 0 A_ZoomFactor(0.99)
	  RE2F A 0 A_SetAngle(angle+1.0)
	  RE2F A 0 A_SetPitch(pitch-1.2)
      RE2F A 1 Bright
      RE2F A 0 A_ZoomFactor(0.98)
	  RE2C B 0 A_SetAngle(angle+0.5)
	  RE2C B 0 A_SetPitch(pitch-0.6)
      RE2C B 1
      RE2C A 0 A_Light1
	  RE2C A 0 A_SetAngle(angle+0.25)
	  RE2C A 0 A_SetPitch(pitch-0.3)
      RE2C C 1 A_ZoomFactor(0.975)
	  RE2C A 0 A_SetAngle(angle+0.25)
	  RE2C A 0 A_SetPitch(pitch-0.3)
      RE2C D 1 A_ZoomFactor(0.97)
	  RE2C A 0 A_SetAngle(angle+0.25)
	  RE2C A 0 A_SetPitch(pitch-0.3)
      RE2C E 1 A_ZoomFactor(0.975)
      RE2F A 0 A_Light0
      RE2C F 1 A_ZoomFactor(0.98)
      RE2C G 1 A_ZoomFactor(0.985)
	  RE2C H 1 A_ZoomFactor(0.99)
	  RE2C I 1 A_ZoomFactor(0.995)
	  RE2C J 1 A_ZoomFactor(1)
	  RE2C K 1
	  RE2C L 1
      RE2C LMNOP 1
	  RE2G CD 1
      RE2G A 1 A_JumpIfInventory("SynthFireLeft",1,"LFire")
      Goto LIdle
  LUnload:
	  REVG A 4
	  REVG A 0 A_TakeInventory("SynthReload",1)
	  Goto LIdle
  Reload:
	  HRNG A 0 A_GiveInventory("SynthReload",1)
	  Goto LReload
  LReload:
      TNT1 A 0 A_JumpIfInventory("Boolet",10,1)
	  Goto LUnload
	  RE2T ABD 1
	  RE2T D 0 A_TakeInventory("SynthReload",1)
	  RE2T FHJL 1
	  TNT1 A 5
      TNT1 A 0 A_TakeInventory("Boolet",10)
      TNT1 A 0 A_GiveInventory("BooletCasing",10)
	  TNT1 A 0 A_PlaySound("Items/Throw",5,1.0)
	  TNT1 A 0 A_FireCustomMissile("BernieTediore2",0,0,-12,0)
	  HN2G I 1
	  REVF A 0 A_SetAngle(angle-3.0)
	  REVF A 0 A_SetPitch(pitch+1.5)
	  HN2G J 1
	  REVF A 0 A_SetAngle(angle-2.5)
	  REVF A 0 A_SetPitch(pitch+1)
	  HN2G K 1
	  REVF A 0 A_SetAngle(angle-2)
	  REVF A 0 A_SetPitch(pitch+0.75)
	  HN2G L 1
	  REVF A 0 A_SetAngle(angle-1.5)
	  REVF A 0 A_SetPitch(pitch+0.5)
	  HN2G M 1
	  REVF A 0 A_SetAngle(angle-1.0)
	  REVF A 0 A_SetPitch(pitch+0.25)
	  HN2G NOP 1
	  TNT1 A 10
	  RE2T KIGECA 1
	  RE2G A 5
	  Goto LIdle
  
  //RIGHT LEVORVEL
  
   Flash:
	  TNT1 A 0 A_Light0
   RIdle:
	  REVG A 0 A_JumpIfInventory("SynthFireRight",1,"RFire")
      HR2G A 0 A_JumpIfInventory("SynthReload",1,"RReload")
	  REVG A 1
      Loop
  RFire:
	  REVG A 1 A_JumpIfInventory("Boolet",2,1)
	  Goto RIdle
      TNT1 A 0 A_GiveInventory("BooletCasing",2)
      TNT1 A 0 A_TakeInventory("Boolet",2)
      REVF A 0 A_Recoil(2.5)
	  REVF A 0 A_AlertMonsters
      REVF A 0 A_PlaySound("Weapons/BernieFire",1,0.6)
      REVF A 0 A_JumpIfInventory("CaliberUpgrade",1,"CRFire")
      REVF A 0 A_FireBullets(2.0,1.0,-1,120,"BulletPuff",0)
      Goto RRest
  CRFire:
      REVF A 0 A_PlaySound("Weapons/WolgirHEndFire",6,0.8)
      REVF A 0 A_FireBullets(2.0,1.0,-1,240,"CaliberPuff",0)
  RRest:
	  REVF A 0 A_Light2
      REVF A 0 A_ZoomFactor(0.99)
	  REVF A 0 A_SetAngle(angle-1.0)
	  REVF A 0 A_SetPitch(pitch-1.2)
      REVF A 1 Bright
      REVF A 0 A_ZoomFactor(0.98)
	  REVC B 0 A_SetAngle(angle-0.5)
	  REVC B 0 A_SetPitch(pitch-0.6)
      REVC B 1
      REVC A 0 A_Light1
	  REVC A 0 A_SetAngle(angle-0.25)
	  REVC A 0 A_SetPitch(pitch-0.3)
      REVC C 1 A_ZoomFactor(0.975)
	  REVC A 0 A_SetAngle(angle-0.25)
	  REVC A 0 A_SetPitch(pitch-0.3)
      REVC D 1 A_ZoomFactor(0.97)
	  REVC A 0 A_SetAngle(angle-0.25)
	  REVC A 0 A_SetPitch(pitch-0.3)
      REVC E 1 A_ZoomFactor(0.975)
      REVF A 0 A_Light0
      REVC F 1 A_ZoomFactor(0.98)
      REVC G 1 A_ZoomFactor(0.985)
	  REVC H 1 A_ZoomFactor(0.99)
	  REVC I 1 A_ZoomFactor(0.995)
	  REVC J 1 A_ZoomFactor(1)
	  REVC K 1
	  REVC L 1
      REVC LMNOP 1
	  REVG CD 1
      REVG A 1 A_JumpIfInventory("SynthFireRight",1,"RFire")
      Goto RIdle
  RUnload:
	  REVG A 5
	  REVG A 0 A_TakeInventory("SynthReload",1)
	  Goto RIdle
  RReload:
      TNT1 A 0 A_JumpIfInventory("Boolet",10,1)
	  Goto RUnload
	  REVT ABD 1
	  REVT D 0 A_TakeInventory("SynthReload",1)
	  REVT FHJL 1
	  TNT1 A 5
      TNT1 A 0 A_TakeInventory("Boolet",10)
      TNT1 A 0 A_GiveInventory("BooletCasing",10)
	  TNT1 A 0 A_PlaySound("Items/Throw",5,1.0)
	  TNT1 A 0 A_FireCustomMissile("BernieTediore",0,0,12,0)
	  HNDG I 1
	  REVF A 0 A_SetAngle(angle+3.0)
	  REVF A 0 A_SetPitch(pitch+1.5)
	  HNDG J 1
	  REVF A 0 A_SetAngle(angle+2.5)
	  REVF A 0 A_SetPitch(pitch+1)
	  HNDG K 1
	  REVF A 0 A_SetAngle(angle+2)
	  REVF A 0 A_SetPitch(pitch+0.75)
	  HNDG L 1
	  REVF A 0 A_SetAngle(angle+1.5)
	  REVF A 0 A_SetPitch(pitch+0.5)
	  HNDG M 1
	  REVF A 0 A_SetAngle(angle+1.0)
	  REVF A 0 A_SetPitch(pitch+0.25)
	  HNDG NOP 1
	  TNT1 A 10
	  REVT KIGECA 1
	  REVG A 5
	  Goto RIdle
  Spawn:
    TNT1 A -1
    Stop
	}
}

ACTOR BernieTediore
{
	Speed 40
	Radius 12
	Height 18
	Damage 420
	PROJECTILE
	-NOGRAVITY
	+BOUNCEONWALLS
	+BOUNCEONCEILINGS
	+BOUNCEONFLOORS
	SeeSound "Weapons/BernieScream"
	DeathSound "Weapons/BustExplo"
	Gravity 0.4
	Scale 0.8
	BounceCount 5
	BounceFactor 0.6
	WallBounceFactor 0.6
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_ScaleVelocity(frandom(0.9,1.1))
		TNT1 A 0 ThrustThingZ(0, 5, 0, 1)
	Rotation:
		RVPR A 0 A_AlertMonsters
		RVPR A 1 A_SetAngle(Angle+45)
		Loop
   Death:
      //TNT1 A 0 A_PlaySound("Weapons/BustExplo")
      TNT1 A 0 A_JumpIfInTargetInventory("NukerUpgrade",1,"NukerDeath")
      TNT1 A 0 A_Explode(125,128,0)
      TNT1 A 0 A_SpawnItemEx("MissileExplode",0,0,0,0,0,0,0,128,0)
      TNT1 BCD 5
      stop
   NukerDeath:
      TNT1 A 0 A_Explode(250,192,0)
      TNT1 A 1 A_SpawnItemEx("NukerMissileExplode",0,0,0,0,0,0,0,128,0)
      TNT1 BCD 5
      stop
	}
}

ACTOR BernieTediore2 : BernieTediore
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_ScaleVelocity(frandom(0.9,1.1))
		TNT1 A 0 ThrustThingZ(0, 5, 0, 1)
	Rotation:
		RVPR A 0 A_AlertMonsters
		RVPR A 1 A_SetAngle(Angle-45)
		Loop
	}
}