actor "H&K USP45" : RGUWeapon
{
  obituary "%k capped %o with the USP45."
  inventory.pickupmessage "You got the H&K USP45. It's .45ACP time."
  //attacksound "u45/fire6"
  weapon.selectionorder 19
  weapon.ammotype "USP45Clip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "USP45Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  states
  {
  Ready:
    M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    GRNA L 0 A_TakeInventory("weapondropper",2)
    U45A A 0 A_PlaySoundEx("weapon/draw","SoundSlot5")
    U45A BCDEFGHI 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A JKL 2 A_WeaponReady(WRF_ALLOWZOOM)
	G18A I 0 A_JumpIfInventory("USP45Token",1,"Reload")
    U45A L 0 A_JumpIfNoAmmo("Reload")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"DropWeapon")
    U45A L 0 A_JumpIfInventory("Aiming",1,5)
    U45A L 0 A_JumpIfInventory("Reloading",1,"Reload")
    U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45A L 1 A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+16
    U45F F 0 A_JumpIfInventory("Reloading",1,"Reload")
  ReadyAim:
    U45F F 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45F F 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"AltFire3")
    U45F F 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+22
  Deselect:
    U45A L 0 A_PlaySoundEx("weapon/down","SoundSlot5")
    U45A L 0 A_TakeInventory("Firing",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45A L 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    U45A L 0 A_ZoomFactor(1.0)
    U45A L 0 A_Lower
    U45A L 1 A_Lower
    Goto Deselect+6
  Select:
    U45A A 0
    U45A A 0 A_TakeInventory("Firing",1)
    U45A A 0 A_Raise
    Goto Select+2
  Fire:
    U45B A 0 A_JumpIfInventory("Aiming",1,"FireAim")
    U45A L 1 A_JumpIfNoAmmo("ReloadStart")
    U45B A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Fire_SteadyAim")
    U45B A 0 A_JumpIfInventory("Firing",1,"FireHold")
    U45B A 0 A_PlayWeaponSound("u45/fire")
    U45B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,7,3)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45B A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-5.00,5.00), 1, 0, 4, 0, frandom(-5.00,5.00))
	U45B A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,5,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45B A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45B A 0 A_JumpIfNoAmmo("FireEmpty")
    U45B B 1 BRIGHT A_GunFlash
    U45B B 0 A_GiveInventory("Firing",1)
    U45B CDEFGHI 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A L 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A L 0 A_TakeInventory("Firing",1)
    U45A L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45A L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FireEmpty:
    U45B J 1 BRIGHT A_GunFlash
    U45B K 1 BRIGHT A_PlaySound("m9/lock")
    U45B LMNO 1
    U45B P 0 A_TakeInventory("Firing",1)
    U45B P 1 A_GiveInventory("USPBolt",1)
    U45A L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45A L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FireHold:
    U45B A 0 A_PlayWeaponSound("u45/fire")
    U45B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,7,3)
    U45B A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-8.00,8.00))
	U45B A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,5,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45B A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45B A 0 A_JumpIfNoAmmo("FireEmpty")
    U45B B 1 BRIGHT A_GunFlash
    U45B B 0 A_GiveInventory("Firing",1)
    U45B CDEFGHI 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A L 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A L 0 A_TakeInventory("Firing",1)
    U45A L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45A L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FireAim:
    U45F F 1 A_JumpIfNoAmmo("ReloadStart")
    U45F F 0 A_JumpIfInventory("Firing",1,"FireAimHold")
    U45F F 0 A_PlayWeaponSound("u45/fire")
    U45F F 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,8)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45F G 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-1.00,1.00), 1, 0, 4, 0, frandom(-1.00,1.00))
	U45F G 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,-4,43-(Sin(Pitch)*43),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45F G 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45F G 0 A_JumpIfNoAmmo("FireAimEmpty")
    U45F G 1 BRIGHT A_GunFlash
    U45F G 0 A_GiveInventory("Firing",1)
    U45F HH 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWZOOM)
    U45F IIJJFF 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWZOOM)
    U45F F 0 A_TakeInventory("Firing",1)
    U45F F 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+22
    U45F F 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+22
  FireAimHold:
    U45F F 0 A_PlayWeaponSound("u45/fire")
    U45F F 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,8)
    U45F G 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-3.00,3.00), 1, 0, 4, 0, frandom(-3.00,3.00))
	U45F G 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,-4,43-(Sin(Pitch)*43),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45F G 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45F G 0 A_JumpIfNoAmmo("FireAimEmpty")
    U45F G 1 BRIGHT A_GunFlash
    U45F G 0 A_GiveInventory("Firing",1)
    U45F HH 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWZOOM)
    U45F IIJJFF 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWZOOM)
    U45F F 0 A_TakeInventory("Firing",1)
    U45F F 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+22
    U45F F 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+22
  FireAimEmpty:
    U45F H 2 BRIGHT A_GunFlash
    U45F I 2 A_PlaySound("m9/lock")
    U45F J 0 A_TakeInventory("Firing",1)
    U45F J 2 A_GiveInventory("USPBolt",1)
    U45F F 2
    U45F F 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+22
    U45F F 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+22
  Reload: //AltFire:
    U45A L 0 A_JumpIfInventory("USP45Clip",12,2)
    U45A L 0 A_JumpIfInventory("USP45Ammo",1,"ReloadStart")
    U45A L 0 A_TakeInventory("Reloading",1)
    U45A L 0 A_JumpIfInventory("Aiming",1,"ReadyAim")
    Goto Ready+19
  ReloadStart:
    U45C A 0 ACS_NamedExecuteAlways("RefSpeak",0,0,0,0)
    U45C A 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    U45C A 3 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
    U45C B 3 A_JumpIfInventory("USPBolt",1,"ReloadStartBolt")
	U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload2")
    U45C CDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45C F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45C F 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
	U45C F 0 A_GiveInventory("USP45Token",1)
	U45C GHI 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload2
  Reload2:
    U45C JKL 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45C M 3 A_TakeInventory("Reloading",1)
    U45C N 3 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmo
  ReloadAmmo:
    U45C N 0 A_JumpIfInventory("USP45Clip",12,"ReloadEnd")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45C N 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEnd
    U45C N 0 A_GiveInventory("USP45Clip",1)
    U45C N 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmo
  ReloadEnd:
    U45C OPQR 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  Zoom:
  PostReloadAlt:
    G18A I 0 A_JumpIfInventory("USP45Token",1,"Reload")
    TNT1 A 0 A_GiveInventory("Aiming",1)
	P20C A 0 A_ZoomFactor(1.15)
	P20C A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	U45F ABCDEF 1
    Goto AltHold
  ReloadBreak:
    U45F F 0 A_ZoomFactor(1.0)
    U45F FE 1
    U45F E 0 A_TakeInventory("Aiming",1)
    U45F DCBA 1
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    TNT1 A 0 A_ClearReFire
    Goto Reload
  ClearRefire: //Prevents full auto
    U45F F 1 A_ClearReFire
	Goto AltHold
  FireAimAltHold:
    "####" "#" 0 A_JumpIfInventory("USP45Clip",1,2)
	TNT1 A 0 A_GiveInventory("USPBolt",1)
	Goto ReloadBreak
    U45F F 0 A_PlayWeaponSound("u45/fire")
	GRNA L 0 A_TakeInventory("USP45Clip",1)
    U45F F 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,8)
	"####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45F G 0 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-2.00,2.00), 1, 0, 4, 0, frandom(-2.00,2.00))
	U45F G 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,-4,43-(Sin(Pitch)*43),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45F G 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45F G 1 BRIGHT A_GunFlash
	"####" "#" 0 A_JumpIfInventory("USP45Clip",1,2)
	TNT1 A 0 A_GiveInventory("USPBolt",1)
	Goto ReloadBreak
	A12C A 0 A_ClearReFire
    Goto AltHold
  AltHold:
    A12C C 0 A_JumpIfInventory("FireHeld",1,"ClearRefire")
    U45F F 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
	A12C C 0 A_JumpIfInventory("FireHeld",1,"FireAimAltHold")
	A12C C 0 A_JumpIfInventory("Reloading",1,"ReloadBreak")
	U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"AltFire3")
	A12C F 0 A_Refire("AltHold")
	A12C C 0 A_JumpIfInventory("Aiming",1,"AltFire2")
	Goto Ready+24
  AltFire:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    G18A I 0 A_JumpIfInventory("USP45Token",1,"Reload")
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"AltHold")
    U45F A 0 A_JumpIfInventory("Aiming",1,"AltFire2")
    U45F A 0 A_ZoomFactor(1.15)
    U45F AB 1
    U45F B 0 A_GiveInventory("Aiming",1)
    U45F CDEF 1
    U45F G 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	A12C F 0 A_Refire("AltHold")
    Goto Ready+22
  AltFire2:
    U45F F 0 A_ZoomFactor(1.0)
    U45F FE 1
    U45F E 0 A_TakeInventory("Aiming",1)
    U45F DCBA 1
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	//M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt") //Only necessary for -NOAUTOFIRE weapons
    Goto Ready+16
  AltFire3:
    U45F F 0 A_ZoomFactor(1.0)
    U45F FE 1
    U45F E 0 A_TakeInventory("Aiming",1)
    U45F DCBA 1
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	goto DropWeapon
  ReloadStartAim:
    U45F F 0 A_ZoomFactor(1.0)
    U45F FE 1
    U45F E 0 A_TakeInventory("Aiming",1)
    U45F DCBA 1
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    Goto ReloadStart+2
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP P 0
    WEAP P 0 A_SpawnItem("USP45Drop")
    stop
  ReloadStartBolt:
    U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload3")
    U45D ABCDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45C F 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
	U45C F 0 A_GiveInventory("USP45Token",1)
    U45D GHI 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload3
  Reload3:
    U45D JKL 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45D M 3 A_TakeInventory("Reloading",1)
    U45D N 3 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmoBolt
  ReloadAmmoBolt:
    U45D P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEndBolt")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45D P 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEndBolt
    U45D P 0 A_GiveInventory("USP45Clip",1)
    U45D P 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmoBolt
  ReloadEndBolt:
    U45D O 0 A_TakeInventory("USPBolt",1)
    U45D OPQR 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D S 3 A_PlaySound("m9/slide1")
    U45D TUVW 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	//M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  ReloadStart_SOH:
    U45C B 0 A_JumpIfInventory("USPBolt",1,"ReloadStartBolt_SOH")
    U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload4")
    U45C AB 2
    U45C CDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45C F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45C F 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
    U45C F 0 A_GiveInventory("USP45Token",1)
    U45C GHI 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload4
  Reload4:
    U45C JKL 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45C M 2 A_TakeInventory("Reloading",1)
    U45C N 2 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    U45C N 0 A_JumpIfInventory("USP45Clip",12,"ReloadEnd_SOH")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45C N 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEnd_SOH
    U45C N 0 A_GiveInventory("USP45Clip",1)
    U45C N 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmo_SOH
  ReloadEnd_SOH:
    U45C OPQR 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  ReloadStartBolt_SOH:
    U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload5")
    U45D ABCDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45C F 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
    U45C F 0 A_GiveInventory("USP45Token",1)
    U45D GHI 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload5
  Reload5:
    U45D JKL 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45D M 2 A_TakeInventory("Reloading",1)
    U45D N 2 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmoBolt_SOH
  ReloadAmmoBolt_SOH:
    U45D P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEndBolt_SOH")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45D P 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEndBolt_SOH
    U45D P 0 A_GiveInventory("USP45Clip",1)
    U45D P 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmoBolt_SOH
  ReloadEndBolt_SOH:
    U45D O 0 A_TakeInventory("USPBolt",1)
    U45D OPQR 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D S 2 A_PlaySound("m9/slide1")
    U45D TUVW 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	//M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  Fire_SteadyAim:
    U45B A 0 A_JumpIfInventory("Firing",1,"FireHold_SteadyAim")
    U45B A 0 A_PlayWeaponSound("u45/fire")
    U45B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,7,3)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45B A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-3.50,3.50), 1, 0, 4, 0, frandom(-3.50,3.50))
	U45B A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,5,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45B A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45B A 0 A_JumpIfNoAmmo("FireEmpty")
    U45B B 1 BRIGHT A_GunFlash
    U45B B 0 A_GiveInventory("Firing",1)
    U45B CDEFGHI 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A L 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A L 0 A_TakeInventory("Firing",1)
    U45A L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45A L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FireHold_SteadyAim:
    U45B A 0 A_PlayWeaponSound("u45/fire")
    U45B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,7,3)
    U45B A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-6.00,6.00), 1, 0, 4, 0, frandom(-6.00,6.00))
	U45B A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,5,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45B A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45B A 0 A_JumpIfNoAmmo("FireEmpty")
    U45B B 1 BRIGHT A_GunFlash
    U45B B 0 A_GiveInventory("Firing",1)
    U45B CDEFGHI 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A L 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A L 0 A_TakeInventory("Firing",1)
    U45A L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45A L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FragGrenade:
    U45F A 0 ACS_NamedExecuteAlways("RefSpeak",0,1,0,0)
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	M4CA J 0 A_JumpIfInventory("ThrowingStun",1,"StunGrenade")
	M4CA J 0 A_JumpIfInventory("ThrowingIncd",1,"IncGrenade")
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"FragGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  FragGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"KnifeAttack_SOH")
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_Commando")
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    KNFA DEFGHIJKL 1
    TNT1 A 20
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack_Commando:
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    KNFA DEFGHIJKL 1
    TNT1 A 20
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack_SOH:
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_SOH_Commando")
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    KNFA DEFGHIJKL 1
    TNT1 A 10
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack_SOH_Commando:
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    KNFA DEFGHIJKL 1
    TNT1 A 10
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  StunGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"StunGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  IncGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"IncGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  StunGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  IncGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  DropWeapon:
    U45A KJIHGFEDCBA 2 A_WeaponReady(WRF_NOPRIMARY)
    U45A A 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	M4CC F 0 A_JumpIfInventory("weapondropper",2,"ThrowWeapon")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",1)
	M4CB A 0 A_FireCustomMissile("USP45Dropped",0,0,7,2)
	stop
  ThrowWeapon:
    GRNA IKMN 1
	KNFA B 0 A_PlaySound("knife/swing")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",2)
	M4CB A 0 A_FireCustomMissile("USP45Thrown",0,0,7,2)
	stop
  }
}

actor USPBolt : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}
actor USP45Clip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 12
    ammo.backpackamount 0
    ammo.backpackmaxamount 12
    +IGNORESKILL
}

actor "H&K USP45 Ex Mags" : "H&K USP45"
{
  obituary "%k capped %o with the USP45."
  inventory.pickupmessage "You got the H&K USP45. So Boss!"
  //attacksound "u45/fire6"
  weapon.selectionorder 19
  weapon.ammotype "USP45Clip2"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "USP45Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  states
  {
  Ready:
    M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    GRNA L 0 A_TakeInventory("weapondropper",2)
    U45A A 0 A_PlaySoundEx("weapon/draw","SoundSlot5")
    U45A BCDEFGHI 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45A JKL 2 A_WeaponReady(WRF_ALLOWZOOM)
	G18A I 0 A_JumpIfInventory("USP45Token",1,"Reload")
    U45A L 0 A_JumpIfNoAmmo("Reload")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"DropWeapon")
    U45A L 0 A_JumpIfInventory("Aiming",1,5)
    U45A L 0 A_JumpIfInventory("Reloading",1,"Reload")
    U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45A L 1 A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+16
    U45F F 0 A_JumpIfInventory("Reloading",1,"Reload")
  ReadyAim:
    U45F F 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45F F 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"AltFire3")
    U45F F 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+22
  Reload: //AltFire:
    VECC A 0 A_JumpIfInventory("USP45Clip2",18,2)
    VECC A 0 A_JumpIfInventory("USP45Ammo",1,"ReloadStart")
    VECC A 0 A_TakeInventory("Reloading",1)
    VECC A 0 A_JumpIfInventory("Aiming",1,"ReadyAim")
    Goto Ready+19
  ReloadStart:
    U45C A 0 ACS_NamedExecuteAlways("RefSpeak",0,0,0,0)
    U45C A 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    U45C A 3 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
    U45C B 3 A_JumpIfInventory("USPBolt",1,"ReloadStartBolt")
	U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload2")
    U45C CDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45C F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45C F 0 A_FireCustomMissile("PistolExtEmptyMagSpawner",0,0,0,1)
    U45C F 0 A_GiveInventory("USP45Token",1)
	U45C GHI 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload2
  Reload2:
    U45C JKL 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45C M 3 A_TakeInventory("Reloading",1)
    U45C N 3 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmo
  ReloadAmmo:
    U45C N 0 A_JumpIfInventory("USP45Clip2",18,"ReloadEnd")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45C N 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEnd
    U45C N 0 A_GiveInventory("USP45Clip2",1)
    U45C N 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmo
  ReloadEnd:
    U45C OPQR 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	U45C N 0 A_TakeInventory("Aiming",1)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  ReloadStartBolt:
    U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload3")
    U45D ABCDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45C F 0 A_FireCustomMissile("PistolExtEmptyMagSpawner",0,0,0,1)
    U45C F 0 A_GiveInventory("USP45Token",1)
	U45D GHI 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload3
  Reload3:
    U45D JKL 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45D M 3 A_TakeInventory("Reloading",1)
    U45D N 3 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmoBolt
  ReloadAmmoBolt:
    U45D P 0 A_JumpIfInventory("USP45Clip2",18,"ReloadEndBolt")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45D P 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEndBolt
    U45D P 0 A_GiveInventory("USP45Clip2",1)
    U45D P 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmoBolt
  ReloadEndBolt:
    U45D O 0 A_TakeInventory("USPBolt",1)
    U45D OPQR 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D S 3 A_PlaySound("m9/slide1")
    U45D TUVW 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	//M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  ReloadStart_SOH:
    U45C A 2
    U45C B 2 A_JumpIfInventory("USPBolt",1,"ReloadStartBolt_SOH")
	U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload4")
    U45C CDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45C F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45C F 0 A_FireCustomMissile("PistolExtEmptyMagSpawner",0,0,0,1)
    U45C F 0 A_GiveInventory("USP45Token",1)
	U45C GHI 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload4
  Reload4:
    U45C JKL 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45C M 2 A_TakeInventory("Reloading",1)
    U45C N 2 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    U45C N 0 A_JumpIfInventory("USP45Clip2",18,"ReloadEnd_SOH")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45C N 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEnd_SOH
    U45C N 0 A_GiveInventory("USP45Clip2",1)
    U45C N 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmo_SOH
  ReloadEnd_SOH:
    U45C OPQR 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  ReloadStartBolt_SOH:
    U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload5")
    U45D ABCDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45C F 0 A_FireCustomMissile("PistolExtEmptyMagSpawner",0,0,0,1)
    U45C F 0 A_GiveInventory("USP45Token",1)
	U45D GHI 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload5
  Reload5:
    U45D JKL 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45D M 2 A_TakeInventory("Reloading",1)
    U45D N 2 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmoBolt_SOH
  ReloadAmmoBolt_SOH:
    U45D P 0 A_JumpIfInventory("USP45Clip2",18,"ReloadEndBolt_SOH")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45D P 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEndBolt_SOH
    U45D P 0 A_GiveInventory("USP45Clip2",1)
    U45D P 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmoBolt_SOH
  ReloadEndBolt_SOH:
    U45D O 0 A_TakeInventory("USPBolt",1)
    U45D OPQR 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D S 2 A_PlaySound("m9/slide1")
    U45D TUVW 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	//M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  ReloadStartAim:
    U45F F 0 A_ZoomFactor(1.0)
    U45F FE 1
    U45F E 0 A_TakeInventory("Aiming",1)
    U45F DCBA 1
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    Goto ReloadStart+2
  ReloadBreak:
    U45F F 0 A_ZoomFactor(1.0)
    U45F FE 1
    U45F E 0 A_TakeInventory("Aiming",1)
    U45F DCBA 1
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    TNT1 A 0 A_ClearReFire
    Goto Reload
  FireAimAltHold:
    "####" "#" 0 A_JumpIfInventory("USP45Clip2",1,2)
	TNT1 A 0 A_GiveInventory("USPBolt",1)
	Goto ReloadBreak
    U45F F 0 A_PlayWeaponSound("u45/fire")
	GRNA L 0 A_TakeInventory("USP45Clip2",1)
    U45F F 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,8)
	"####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45F G 0 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-2.00,2.00), 1, 0, 4, 0, frandom(-2.00,2.00))
	U45F G 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,-4,43-(Sin(Pitch)*43),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45F G 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45F G 1 BRIGHT A_GunFlash
	"####" "#" 0 A_JumpIfInventory("USP45Clip2",1,2)
	TNT1 A 0 A_GiveInventory("USPBolt",1)
	Goto ReloadBreak
	A12C A 0 A_ClearReFire
    Goto AltHold
  }
}

actor USP45Clip2 : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 18
    ammo.backpackamount 0
    ammo.backpackmaxamount 18
    +IGNORESKILL
}


actor USP45ExMags : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}
actor "H&K USP45 Akimbo" : RGUWeapon
{
  obituary "%k capped %o with a pair of USP45s."
  inventory.pickupmessage "You got the H&K USP45. So Boss!"
  //attacksound "u45/fire6"
  weapon.selectionorder 19
  weapon.ammotype "USP45Clip3"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "USP45Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  states
  {
  Ready:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    TNT1 A 2 A_PlaySoundEx("weapon/draw","SoundSlot5")
    TNT1 AA 2
    U45G ABCDEFGHI 1 A_WeaponReady(WRF_NOFIRE)
	G18A I 0 A_JumpIfInventory("USP45Token",1,"Reload")
    U45G I 0 A_JumpIfNoAmmo("Reload")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"DropWeapon")
    U45G I 0 A_JumpIfInventory("Reloading",1,"Reload")
    U45G I 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45G I 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45G I 1 A_WeaponReady(WRF_ALLOWRELOAD)
    Goto Ready+14
  Deselect:
    U45G I 0 A_PlaySoundEx("weapon/down","SoundSlot5")
    U45G I 0 A_TakeInventory("Aiming",1)
    U45G I 0 A_TakeInventory("Reloading",1)
    U45G I 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    U45G I 0 A_Lower
    U45G I 1 A_Lower
    Goto Deselect+4
  Select:
    U45G A 0 A_Raise
    Loop
  Fire: //Right
    U45G I 0 A_JumpIfNoAmmo("ReloadStart")
    U45I A 0 A_JumpIfInventory("FireSwitch",1,"FireLeft")
    U45I A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Fire_SteadyAim")
    U45I A 0 A_PlayWeaponSound("u45/fire")
    U45I A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,20,2)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45I A 1 BRIGHT A_FireCustomMissile("HHCBUSP45A", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-8.00,8.00))
	U45I A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,19,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45I A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45I A 0 A_JumpIfNoAmmo("FireEmpty")
    U45I B 1 BRIGHT A_GunFlash
    U45I B 0 A_GiveInventory("FireSwitch",1)
    U45I B 0 A_JumpIfInventory("USP45Clip3",2,2)
    U45I B 0 BRIGHT A_PlaySound("m9/lock")
    U45I CDE 1 A_WeaponReady
    U45G III 1 A_WeaponReady
    U45I A 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+14
    U45I A 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+14
  FireLeft:
    U45H A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"FireLeft_SteadyAim")
    U45H A 0 A_PlaySoundEx("u45/fire","SoundSlot6")
    U45H A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,-20,4)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45H A 1 BRIGHT A_FireCustomMissile("HHCBUSP45A", frandom(-8.00,8.00), 1, 0, 4, 0, frandom(-8.00,8.00))
	U45H A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,-19,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45H A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45H A 0 A_JumpIfNoAmmo("FireEmptyLeft")
    U45H B 1 BRIGHT A_GunFlash
    U45H B 0 A_TakeInventory("FireSwitch",1)
    U45H B 0 A_JumpIfInventory("USP45Clip3",2,2)
    U45H B 0 BRIGHT A_PlaySound("m9/lock")
    U45H CDE 1 A_WeaponReady
    U45G III 1 A_WeaponReady
    U45H A 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+14
    U45H A 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+14
  FireEmpty:
    U45I B 1 BRIGHT A_GunFlash
    U45I C 1 BRIGHT A_PlaySound("m9/lock")
    U45I D 1
    U45I E 1 A_GiveInventory("USPBolt",1)
    U45I A 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+14
    U45I A 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+14
  FireEmptyLeft:
    U45H B 1 BRIGHT A_GunFlash
    U45H C 1 BRIGHT A_PlaySound("m9/lock")
    U45H D 1
    U45H E 1 A_GiveInventory("USPBolt",1)
    U45H A 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+14
    U45H A 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+14
  AltFire: //Does nothing
    U45G I 1 A_WeaponReady(WRF_NOSECONDARY|WRF_ALLOWRELOAD)
    Goto Ready+14
  Reload:
    G18A I 0 A_JumpIfInventory("weapondropper",1,"DropWeapon")
    U45G A 0 A_JumpIfInventory("USP45Clip3",24,2)
    U45G A 0 A_JumpIfInventory("USP45Ammo",1,"ReloadStart")
    U45G A 0 A_TakeInventory("Reloading",1)
    Goto Ready+17
  ReloadStart:
    U45K A 0 ACS_NamedExecuteAlways("RefSpeak",0,0,0,0)
    U45K A 3 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
	U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload2")
    U45K B 3 A_TakeInventory("FireSwitch",1)
    U45K CDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45K F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45K F 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
    U45K G 3 A_PlaySoundEx("m9/clipout","SoundSlot7")
	U45K G 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,6)
    U45C F 0 A_GiveInventory("USP45Token",1)
	U45K GHI 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload2
  Reload2:
    U45K JKL 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45K M 3 A_TakeInventory("Reloading",1)
    U45K N 9 A_PlaySoundEx("m9/clipin","SoundSlot5")
    U45K N 3 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmo
  ReloadAmmo:
    U45K N 0 A_JumpIfInventory("USP45Clip3",24,"ReloadEnd")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45K N 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEnd
    U45K N 0 A_GiveInventory("USP45Clip3",1)
    U45K N 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmo
  ReloadEnd:
    U45K O 3 A_JumpIfInventory("USPBolt",1,"ReloadEndBolt")
    U45G ABCDEFGHI 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    Goto Ready+14
  ReloadEndBolt:
    U45K OOOO 3
    U45K O 0 A_TakeInventory("USPBolt",1)
    U45G A 3 A_PlaySoundEx("m9/slide1","SoundSlot5")
    U45G B 3 A_PlayWeaponSound("m9/slide1")
    U45G CDEFGHI 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    Goto Ready+14
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP P 0
    WEAP P 0 A_SpawnItem("USP45Drop")
    stop
  ReloadStart_SOH:
    U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload3")
    U45K A 2
	U45K B 2 A_TakeInventory("FireSwitch",1)
    U45K CDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45K F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45K F 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
    U45K G 2 A_PlaySoundEx("m9/clipout","SoundSlot7")
	U45K G 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,6)
    U45C F 0 A_GiveInventory("USP45Token",1)
	U45K GHI 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload3
  Reload3:
    U45K JKL 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45K M 2 A_TakeInventory("Reloading",1)
    U45K N 8 A_PlaySoundEx("m9/clipin","SoundSlot5")
    U45K N 2 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    U45K N 0 A_JumpIfInventory("USP45Clip3",24,"ReloadEnd_SOH")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45K N 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEnd_SOH
    U45K N 0 A_GiveInventory("USP45Clip3",1)
    U45K N 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmo_SOH
  ReloadEnd_SOH:
    U45K O 2 A_JumpIfInventory("USPBolt",1,"ReloadEndBolt_SOH")
    U45G ABCDEFGHI 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    Goto Ready+12
  ReloadEndBolt_SOH:
    U45K OOOO 2
    U45K O 0 A_TakeInventory("USPBolt",1)
    U45G A 2 A_PlaySoundEx("m9/slide1","SoundSlot5")
    U45G B 2 A_PlayWeaponSound("m9/slide1")
    U45G CDEFGHI 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    Goto Ready+14
  Fire_SteadyAim: //Right
    U45I A 0 A_PlayWeaponSound("u45/fire")
    U45I A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,20,2)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45I A 1 BRIGHT A_FireCustomMissile("HHCBUSP45A", frandom(-6.00,6.00), 1, 0, 4, 0, frandom(-6.00,6.00))
	U45I A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,19,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45I A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45I A 0 A_JumpIfNoAmmo("FireEmpty")
    U45I B 1 BRIGHT A_GunFlash
    U45I B 0 A_GiveInventory("FireSwitch",1)
    U45I B 0 A_JumpIfInventory("USP45Clip3",2,2)
    U45I B 0 BRIGHT A_PlaySound("m9/lock")
    U45I CDE 1 A_WeaponReady
    U45G III 1 A_WeaponReady
    U45I A 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+14
    U45I A 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+14
  FireLeft_SteadyAim:
    U45H A 0 A_PlaySoundEx("u45/fire","SoundSlot6")
    U45H A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,-20,4)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45H A 1 BRIGHT A_FireCustomMissile("HHCBUSP45A", frandom(-6.00,6.00), 1, 0, 4, 0, frandom(-6.00,6.00))
	U45H A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,-19,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45H A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45H A 0 A_JumpIfNoAmmo("FireEmptyLeft")
    U45H B 1 BRIGHT A_GunFlash
    U45H B 0 A_TakeInventory("FireSwitch",1)
    U45H B 0 A_JumpIfInventory("USP45Clip3",2,2)
    U45H B 0 BRIGHT A_PlaySound("m9/lock")
    U45H CDE 1 A_WeaponReady
    U45G III 1 A_WeaponReady
    U45H A 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+14
    U45H A 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+14
  FragGrenade:
    U45F A 0 ACS_NamedExecuteAlways("RefSpeak",0,1,0,0)
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	M4CA J 0 A_JumpIfInventory("ThrowingStun",1,"StunGrenade")
	M4CA J 0 A_JumpIfInventory("ThrowingIncd",1,"IncGrenade")
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"FragGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
    Goto Ready+2
  FragGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
    Goto Ready+2
  KnifeAttack:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"KnifeAttack_SOH")
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_Commando")
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    KNFA DEFGHIJKL 1
    TNT1 A 20
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    Goto Ready+2
  KnifeAttack_Commando:
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    KNFA DEFGHIJKL 1
    TNT1 A 20
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    Goto Ready+2
  KnifeAttack_SOH:
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_SOH_Commando")
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    KNFA DEFGHIJKL 1
    TNT1 A 10
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    Goto Ready+2
  KnifeAttack_SOH_Commando:
    KNFA A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA C 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    KNFA DEFGHIJKL 1
    TNT1 A 10
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    Goto Ready+2
  StunGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"StunGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
    Goto Ready+2
  IncGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"IncGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
    Goto Ready+2
  StunGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
    Goto Ready+2
  IncGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
    Goto Ready+2
  DropWeapon:
    U45G HGFEDCBA 2 A_WeaponReady(WRF_NOPRIMARY)
    U45G A 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	M4CC F 0 A_JumpIfInventory("weapondropper",2,"ThrowWeapon")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",1)
	M4CB A 0 A_FireCustomMissile("USP45Dropped",0,0,7,2)
	stop
  ThrowWeapon:
    GRNA IKMN 1
	KNFA B 0 A_PlaySound("knife/swing")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",2)
	M4CB A 0 A_FireCustomMissile("USP45Thrown",0,0,7,2)
	stop
  }
}

actor USP45Clip3 : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 24
    ammo.backpackamount 0
    ammo.backpackmaxamount 24
    +IGNORESKILL
}
actor USP45Akimbo : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}

actor "H&K USP45 Tac Knife" : RGUWeapon
{
  obituary "%k capped %o with the USP45."
  inventory.pickupmessage "You got the H&K USP45. So Boss!"
  //attacksound "u45/fire6"
  weapon.selectionorder 19
  weapon.ammotype "USP45Clip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "USP45Ammo"
  weapon.ammouse2 0
  weapon.ammogive2 0
  states
  {
  Ready:
    M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    GRNA L 0 A_TakeInventory("weapondropper",2)
    U45L A 0 A_PlaySoundEx("weapon/draw","SoundSlot5")
    U45L BCDEFGHI 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45L JKL 2 A_WeaponReady(WRF_ALLOWZOOM)
	G18A I 0 A_JumpIfInventory("USP45Token",1,"Reload")
    U45L L 0 A_JumpIfNoAmmo("Reload")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"DropWeapon")
    U45L L 0 A_JumpIfInventory("Aiming",1,5)
    U45L L 0 A_JumpIfInventory("Reloading",1,"Reload")
    U45L L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45L L 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45L L 1 A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+16
    U45N F 0 A_JumpIfInventory("Reloading",1,"Reload")
  ReadyAim:
    U45N F 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45N F 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"AltFire3")
    U45N F 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
    Goto Ready+22
  Deselect:
    U45L L 0 A_PlaySoundEx("weapon/down","SoundSlot5")
    U45L L 0 A_TakeInventory("Firing",1)
    U45L L 0 A_TakeInventory("Aiming",1)
    U45L L 0 A_TakeInventory("Reloading",1)
    U45L L 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    U45L L 0 A_ZoomFactor(1.0)
    U45L L 0 A_Lower
    U45L L 1 A_Lower
    Goto Deselect+6
  Select:
    U45L A 0
    U45L A 0 A_TakeInventory("Firing",1)
    U45L A 0 A_Raise
    Goto Select+2
  Fire:
    U45L L 0 A_JumpIfInventory("Aiming",1,"FireAim")
    U45L L 1 A_JumpIfNoAmmo("ReloadStart")
    U45M A 0 A_JumpIfInventory("Perk3_SteadyAim",1,"Fire_SteadyAim")
    U45M A 0 A_JumpIfInventory("Firing",1,"FireHold")
    U45M A 0 A_PlayWeaponSound("u45/fire")
    U45M A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,8)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45M A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-6.00,6.00), 1, 0, 4, 0, frandom(-6.00,6.00))
	U45M A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,5,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45M A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45M A 0 A_JumpIfNoAmmo("FireEmpty")
    U45M B 1 BRIGHT A_GunFlash
    U45M B 0 A_GiveInventory("Firing",1)
    U45M CDE 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45L LLLLL 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45L L 0 A_TakeInventory("Firing",1)
    U45L L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45L L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FireEmpty:
    U45M B 1 BRIGHT A_GunFlash
    U45M C 1 BRIGHT A_PlaySound("m9/lock")
    U45M DE 1
    U45L L 0 A_TakeInventory("Firing",1)
    U45L L 1 A_GiveInventory("USPBolt",1)
    U45L L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45L L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FireHold:
    U45M A 0 A_PlayWeaponSound("u45/fire")
    U45M A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,8)
    U45M A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-9.00,9.00), 1, 0, 4, 0, frandom(-9.00,9.00))
	U45M A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,5,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45M A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45M A 0 A_JumpIfNoAmmo("FireEmpty")
    U45M B 1 BRIGHT A_GunFlash
    U45M B 0 A_GiveInventory("Firing",1)
    U45M CDE 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45L LLLLL 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45L L 0 A_TakeInventory("Firing",1)
    U45L L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45L L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FireAim:
    U45N F 1 A_JumpIfNoAmmo("ReloadStart")
    U45N F 0 A_JumpIfInventory("Firing",1,"FireAimHold")
    U45N F 0 A_PlayWeaponSound("u45/fire")
    U45N F 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,8)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45O A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-1.20,1.20), 1, 0, 4, 0, frandom(-1.20,1.20))
	U45O A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,-4,43-(Sin(Pitch)*43),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45O A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45O A 0 A_JumpIfNoAmmo("FireAimEmpty")
    U45O B 1 BRIGHT A_GunFlash
    U45O B 0 A_GiveInventory("Firing",1)
    U45O CDE 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWZOOM)
    U45N FFFFF 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWZOOM)
    U45N F 0 A_TakeInventory("Firing",1)
    U45N F 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+22
    U45N F 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+22
  FireAimHold:
    U45N F 0 A_PlayWeaponSound("u45/fire")
    U45N F 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,8)
    U45O A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-3.60,3.60), 1, 0, 4, 0, frandom(-3.60,3.60))
	U45O A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,-4,43-(Sin(Pitch)*43),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45O A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45O A 0 A_JumpIfNoAmmo("FireAimEmpty")
    U45O B 1 BRIGHT A_GunFlash
    U45O B 0 A_GiveInventory("Firing",1)
    U45O CDE 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWZOOM)
    U45N FFFFF 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWZOOM)
    U45N F 0 A_TakeInventory("Firing",1)
    U45N F 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+22
    U45N F 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+22
  FireAimEmpty:
    U45O A 1 BRIGHT A_GunFlash
    U45O B 1 A_PlaySound("m9/lock")
    U45O C 0 A_TakeInventory("Firing",1)
    U45O C 1 A_GiveInventory("USPBolt",1)
    U45O DE 1
    U45N F 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+22
    U45N F 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+22
  Reload: //AltFire:
    U45L L 0 A_JumpIfInventory("USP45Clip",12,2)
    U45L L 0 A_JumpIfInventory("USP45Ammo",1,"ReloadStart")
    U45L L 0 A_TakeInventory("Reloading",1)
    U45L L 0 A_JumpIfInventory("Aiming",1,"ReadyAim")
    Goto Ready+19
  ReloadStart:
    U45P A 0 ACS_NamedExecuteAlways("RefSpeak",0,0,0,0)
    U45P A 0 A_JumpIfInventory("Aiming",1,"ReloadStartAim")
    U45P A 3 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
    U45P A 0 A_JumpIfInventory("USPBolt",1,"ReloadStartBolt")
	U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload2")
    U45P BC 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45P D 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45P D 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
	U45C F 0 A_GiveInventory("USP45Token",1)
	U45P EFG 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload2
  Reload2:
    U45P HIJK 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45P L 3 A_TakeInventory("Reloading",1)
    U45P M 3 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmo
  ReloadAmmo:
    U45P M 0 A_JumpIfInventory("USP45Clip",12,"ReloadEnd")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45P M 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEnd
    U45P M 0 A_GiveInventory("USP45Clip",1)
    U45P M 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmo
  ReloadEnd:
    U45P NOPQ 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45P RST 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  ReloadStartBolt:
    U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload3")
    U45Q ABCD 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45Q E 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45P D 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
    U45C F 0 A_GiveInventory("USP45Token",1)
	U45P EFG 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload3
  Reload3:
    U45P HIJK 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45Q N 3 A_TakeInventory("Reloading",1)
    U45Q O 3 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmoBolt
  ReloadAmmoBolt:
    U45Q P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEndBolt")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45Q P 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEndBolt
    U45Q P 0 A_GiveInventory("USP45Clip",1)
    U45Q P 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmoBolt
  ReloadEndBolt:
    U45Q T 0 A_TakeInventory("USPBolt",1)
    U45Q PQRS 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45Q T 3 A_PlayWeaponSound("m9/slide1")
    U45Q UVW 3 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	//M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  Zoom:
  PostReloadAlt:
    G18A I 0 A_JumpIfInventory("USP45Token",1,"Reload")
    U45N F 0 A_ZoomFactor(1.15)
    U45N E 0 A_GiveInventory("Aiming",1)
    U45N A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	U45N ABCDEF 1
    Goto AltHold
  ReloadBreak:
    U45N F 0 A_ZoomFactor(1.0)
    U45N FE 1
    U45N E 0 A_TakeInventory("Aiming",1)
    U45N DCBA 1
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    TNT1 A 0 A_ClearReFire
    Goto Reload
  ClearRefire:
    U45N F 1 A_ClearReFire
	Goto AltHold
  FireAimAltHold:
    "####" "#" 0 A_JumpIfInventory("USP45Clip",1,2)
	TNT1 A 0 A_GiveInventory("USPBolt",1)
	Goto ReloadBreak
    U45F F 0 A_PlayWeaponSound("u45/fire")
	GRNA L 0 A_TakeInventory("USP45Clip",1)
    U45F F 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,8)
	"####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45F G 0 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-2.00,2.00), 1, 0, 4, 0, frandom(-2.00,2.00))
	U45F G 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,-4,43-(Sin(Pitch)*43),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45F G 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45O B 1 BRIGHT A_GunFlash
	"####" "#" 0 A_JumpIfInventory("USP45Clip",1,2)
	TNT1 A 0 A_GiveInventory("USPBolt",1)
	Goto ReloadBreak
	A12C A 0 A_ClearReFire
    Goto AltHold
  AltHold:
    A12C C 0 A_JumpIfInventory("FireHeld",1,"ClearRefire")
    U45N F 1 A_WeaponReady(WRF_NOBOB|WRF_ALLOWRELOAD|WRF_ALLOWZOOM)
	A12C C 0 A_JumpIfInventory("FireHeld",1,"FireAimAltHold")
	A12C C 0 A_JumpIfInventory("Reloading",1,"ReloadBreak")
	U45A L 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45A L 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	G18A I 0 A_JumpIfInventory("weapondropper",1,"AltFire3")
	A12C F 0 A_Refire("AltHold")
	A12C C 0 A_JumpIfInventory("Aiming",1,"AltFire2")
	Goto Ready+24
  AltFire:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    G18A I 0 A_JumpIfInventory("USP45Token",1,"Reload")
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"AltHold")
    U45N A 0 A_JumpIfInventory("Aiming",1,"AltFire2")
    U45N A 0 A_ZoomFactor(1.15)
    U45N AB 1
    U45N B 0 A_GiveInventory("Aiming",1)
    U45N CDEF 1
    U45N G 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	A12C F 0 A_Refire("AltHold")
    Goto Ready+22
  AltFire2:
    U45N F 0 A_ZoomFactor(1.0)
    U45N FE 1
    U45N E 0 A_TakeInventory("Aiming",1)
    U45N DCBA 1
    U45N A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	//M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  AltFire3:
    U45N F 0 A_ZoomFactor(1.0)
    U45N FE 1
    U45N E 0 A_TakeInventory("Aiming",1)
    U45N DCBA 1
    U45N A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	goto DropWeapon
  ReloadStartAim:
    U45N F 0 A_ZoomFactor(1.0)
    U45N FE 1
    U45N E 0 A_TakeInventory("Aiming",1)
    U45N DCBA 1
    U45N A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    Goto ReloadStart+2
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP P 15
    WEAP A 0 A_SpawnItem("USP45Drop")
    stop
  ReloadStart_SOH:
    U45P A 2 A_JumpIfInventory("USPBolt",1,"ReloadStartBolt_SOH")
	U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload4")
    U45P BC 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45P D 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45P D 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
    U45C F 0 A_GiveInventory("USP45Token",1)
	U45P EFG 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload4
  Reload4:
    U45P HIJK 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45P L 2 A_TakeInventory("Reloading",1)
    U45P M 2 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    U45P M 0 A_JumpIfInventory("USP45Clip",12,"ReloadEnd_SOH")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45P M 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEnd_SOH
    U45P M 0 A_GiveInventory("USP45Clip",1)
    U45P M 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmo_SOH
  ReloadEnd_SOH:
    U45P NOPQ 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45P RST 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  ReloadStartBolt_SOH:
    U45C B 0 A_JumpIfInventory("USP45Token",1,"Reload5")
    U45Q ABCD 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45Q E 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
	U45P D 0 A_FireCustomMissile("PistolEmptyMagSpawner",0,0,0,1)
    U45C F 0 A_GiveInventory("USP45Token",1)
	U45P EFG 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	goto Reload5
  Reload5:
    U45P HIJK 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
    U45Q N 2 A_TakeInventory("Reloading",1)
    U45Q O 2 A_PlayWeaponSound("m9/clipin")
    Goto ReloadAmmoBolt_SOH
  ReloadAmmoBolt_SOH:
    U45Q P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEndBolt_SOH")
	U45C N 0 A_TakeInventory("USP45Token",1)
    U45Q P 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto ReloadEndBolt_SOH
    U45Q P 0 A_GiveInventory("USP45Clip",1)
    U45Q P 0 A_TakeInventory("USP45Ammo",1)
    Goto ReloadAmmoBolt_SOH
  ReloadEndBolt_SOH:
    U45Q T 0 A_TakeInventory("USPBolt",1)
    U45Q PQRS 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45Q T 2 A_PlayWeaponSound("m9/slide1")
    U45Q UVW 2 A_WeaponReady(WRF_NOBOB|WRF_NOFIRE)
	//M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+16
  Fire_SteadyAim:
    U45M A 0 A_JumpIfInventory("Firing",1,"FireHold_SteadyAim")
    U45M A 0 A_PlayWeaponSound("u45/fire")
    U45M A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,8)
    "####" # 0 A_FireBullets(0.0, 0.0, 0, 0, "HHTag", FBF_NOFLASH, 4096)
    U45M A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-4.00,4.00), 1, 0, 4, 0, frandom(-4.00,4.00))
	U45M A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,5,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45M A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45M A 0 A_JumpIfNoAmmo("FireEmpty")
    U45M B 1 BRIGHT A_GunFlash
    U45M B 0 A_GiveInventory("Firing",1)
    U45M CDE 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45L LLLLL 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45L L 0 A_TakeInventory("Firing",1)
    U45L L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45L L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FireHold_SteadyAim:
    U45M A 0 A_PlayWeaponSound("u45/fire")
    U45M A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,8)
    U45M A 1 BRIGHT A_FireCustomMissile("HHCBUSP45", frandom(-7.00,7.00), 1, 0, 4, 0, frandom(-7.00,7.00))
	U45M A 0 A_SpawnItemEx("bulletcasing45",Cos(Pitch)*30,5,40-(Sin(Pitch)*40),Cos(Pitch)*FRandom(2,4),FRandom(3,6),-Sin(Pitch)*FRandom(3,6),0,SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH)
    U45M A 0 BRIGHT ACS_NamedExecuteAlways("RefKick",0,0,0,0)
    U45M A 0 A_JumpIfNoAmmo("FireEmpty")
    U45M B 1 BRIGHT A_GunFlash
    U45M B 0 A_GiveInventory("Firing",1)
    U45M CDE 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45L LLLLL 1 A_WeaponReady(WRF_ALLOWZOOM)
    U45L L 0 A_TakeInventory("Firing",1)
    U45L L 0 A_JumpIfInventory("USP45Ammo",1,1)
    Goto Ready+16
    U45L L 0 A_JumpIfNoAmmo("ReloadStart")
    Goto Ready+16
  FragGrenade:
    U45F A 0 ACS_NamedExecuteAlways("RefSpeak",0,1,0,0)
    U45F A 0 A_ZoomFactor(1.0)
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45F A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
	M4CA J 0 A_JumpIfInventory("ThrowingStun",1,"StunGrenade")
	M4CA J 0 A_JumpIfInventory("ThrowingIncd",1,"IncGrenade")
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"FragGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  FragGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("GrenadeAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("FragGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack:
    GRNA L 0 A_TakeInventory("weapondropper",2)
    U45R A 0 A_ZoomFactor(1.0)
    U45R A 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45R A 0 A_TakeInventory("Aiming",1)
    U45R A 0 A_TakeInventory("Reloading",1)
    U45R A 0 ACS_NamedExecuteAlways("RefSpeed",0,0,0,0)
    U45R A 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"KnifeAttack_SOH")
    U45R A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_Commando")
    U45R A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    U45R AB 1
    U45R C 1 A_PlaySound("knife/swing")
    U45R D 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    U45R EF 1
    TNT1 AAA 5
    U45R L 0 A_TakeInventory("ThrowingGrenade",1)
    U45R L 0 A_TakeInventory("KnifeAttack",1)
    U45L A 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack_Commando:
    U45R A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    U45R AB 1
    U45R C 1 A_PlaySound("knife/swing")
    U45R D 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    U45R EF 1
    TNT1 AAA 5
    U45R L 0 A_TakeInventory("ThrowingGrenade",1)
    U45R L 0 A_TakeInventory("KnifeAttack",1)
    U45L A 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack_SOH:
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_SOH_Commando")
    U45R A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    U45R AB 1
    U45R C 1 A_PlaySound("knife/swing")
    U45R D 1 A_CustomPunch(102,1,0,"KnifePuff",104)
    U45R EF 1
    TNT1 A 5
    U45R L 0 A_TakeInventory("ThrowingGrenade",1)
    U45R L 0 A_TakeInventory("KnifeAttack",1)
    U45L A 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  KnifeAttack_SOH_Commando:
    U45R A 0 ACS_NamedExecuteAlways("RefSlash",0,0,0,0)
    U45R AB 1
    U45R C 1 A_PlaySound("knife/swing")
    U45R D 1 A_CustomPunch(102,1,0,"KnifePuff",160)
    U45R EF 1
    TNT1 A 5
    U45R L 0 A_TakeInventory("ThrowingGrenade",1)
    U45R L 0 A_TakeInventory("KnifeAttack",1)
    U45L A 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  StunGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"StunGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  IncGrenade:
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"IncGrenade_SOH")
    GRNA ABC 2
    GRNA D 2 A_PlaySound("grenade/pinpull")
    GRNA EFGH 2
    TNT1 A 15
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 2
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 2 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 2
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  StunGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("StunAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("StunGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  IncGrenade_SOH:
    GRNA ABC 1
    GRNA D 1 A_PlaySound("grenade/pinpull")
    GRNA EFGH 1
    TNT1 A 10
    TNT1 A 0 A_PlaySound("grenade/throw")
    GRNA A 0 A_PlaySoundEx("us/grenades","Voice")
    GRNA IJK 1
    GRNA L 0 A_TakeInventory("IncdAmmo",1)
    GRNA L 0 A_TakeInventory("ThrowingGrenade",1)
	GRNA L 0 A_TakeInventory("ThrowingStun",1)
	GRNA L 0 A_TakeInventory("ThrowingIncd",1)
    U45A L 0 A_TakeInventory("Aiming",1)
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    GRNA L 1 A_FireCustomMissile("IncGrenade",frandom(-2.00,2.00),0,0,16,0,frandom(-1.50,1.50))
    GRNA MN 1
	M4CA C 0 A_JumpIfInventory("AltFireHeld",1,"PostReloadAlt")
    Goto Ready+3
  DropWeapon:
    U45L KJIHGFEDCBA 2 A_WeaponReady(WRF_NOPRIMARY)
    U45L A 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
	M4CC F 0 A_JumpIfInventory("weapondropper",2,"ThrowWeapon")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",1)
	M4CB A 0 A_FireCustomMissile("USP45Dropped",0,0,7,2)
	stop
  ThrowWeapon:
    GRNA IKMN 1
	KNFA B 0 A_PlaySound("knife/swing")
    KNFA A 0 ACS_NamedExecuteAlways("RefDropW",0,0,0,0)
	GRNA L 0 A_TakeInventory("weapondropper",2)
	M4CB A 0 A_FireCustomMissile("USP45Thrown",0,0,7,2)
	stop
  }
}

actor USP45Knife : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}
actor USP45Pickup : CustomInventory
{
  inventory.pickupmessage "You got the H&K USP45. So Boss!"
  inventory.pickupsound "deagle/bolt"
  +INVENTORY.AUTOACTIVATE
  //inventory.respawntics 70
  scale 0.11
  States
  {
  Spawn:
    WEAP P -1
    stop
  Pickup:
    WEAP P 0
    WEAP P 0 A_JumpIf((ACS_NamedExecuteWithResult("RefCheckVar",0,0,0)) == 1, "PickupStay")
    WEAP P 0 A_JumpIfInventory("H&K USP45",1,"AmmoPickup") // If the player already has this weapon, they get more ammo for it
    WEAP P 0 A_JumpIfInventory("H&K USP45 Ex Mags",1,"AmmoPickup")
    WEAP P 0 A_JumpIfInventory("H&K USP45 Akimbo",1,"AmmoPickup")
    WEAP P 0 A_JumpIfInventory("H&K USP45 Tac Knife",1,"AmmoPickup")
	WEAP P 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP P 0 A_JumpIfInventory("MaxWeaponsFilled",96,"FailPickup2")
	WEAP P 0 A_GiveInventory("MaxWeaponsFilled",5)
    WEAP P 0 ACS_NamedExecuteWithResult("RefPickU",3,0,0)
    stop
  PickupStay:
    WEAP P 0
    WEAP P 0 A_JumpIfInventory("H&K USP45",1,"FailPickup") // If the player already has this weapon, they get more ammo for it
    WEAP P 0 A_JumpIfInventory("H&K USP45 Ex Mags",1,"FailPickup")
    WEAP P 0 A_JumpIfInventory("H&K USP45 Akimbo",1,"FailPickup")
    WEAP P 0 A_JumpIfInventory("H&K USP45 Tac Knife",1,"FailPickup")
	WEAP P 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP P 0 A_JumpIfInventory("MaxWeaponsFilled",96,"FailPickup2")
	WEAP P 0 A_GiveInventory("MaxWeaponsFilled",5)
    WEAP P 0 ACS_NamedExecuteWithResult("RefPickU",3,0,0)
    WEAP P 0 ACS_NamedExecuteWithResult("RefPickC",3,0,0)
    WEAP P 0 A_PlaySound("deagle/bolt")
    fail
  AmmoPickup:
    WEAP P 0
    WEAP P 0 A_JumpIfInventory("USP45Ammo",0,"FailPickup")
    WEAP P 0 A_GiveInventory("USP45Ammo",12)
    stop
  OneManArmy:
    WEAP P 0
	WEAP P 0 A_JumpIfInventory("MaxWeaponsFilled",133,"FailPickup2")
	WEAP P 0 A_GiveInventory("MaxWeaponsFilled",5)
	WEAP P 0 ACS_NamedExecuteWithResult("RefPickU",3,0,0)
	stop
  FailPickup:
    WEAP P 1
    fail
  FailPickup2:
    WEAP P 1
    WEAP P 0 ACS_NamedExecuteAlways("RefSlots",0,0,0,0)
    fail
  }
}

actor USP45Drop : USP45Pickup
{
  States
  {
  Spawn:
    WEAP P -1
    stop
  Pickup:
    WEAP P 0
    WEAP P 0 A_JumpIfInventory("H&K USP45",1,"AmmoPickup") // If the player already has this weapon, they get more ammo for it
    WEAP P 0 A_JumpIfInventory("H&K USP45 Ex Mags",1,"AmmoPickup")
    WEAP P 0 A_JumpIfInventory("H&K USP45 Akimbo",1,"AmmoPickup")
    WEAP P 0 A_JumpIfInventory("H&K USP45 Tac Knife",1,"AmmoPickup")
	WEAP P 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP P 0 A_JumpIfInventory("MaxWeaponsFilled",96,"FailPickup2")
	WEAP P 0 A_GiveInventory("MaxWeaponsFilled",5)
    WEAP P 0 ACS_NamedExecuteWithResult("RefPickU",3,0,0)
    stop
  }
}

actor USP45Drop2 : USP45Drop
{
  States
  {
  Spawn:
    WEAP P -1
    stop
  Pickup:
    WEAP P 0
    WEAP P 0 A_JumpIfInventory("H&K USP45",1,"AmmoPickup") // If the player already has this weapon, they get more ammo for it
    WEAP P 0 A_JumpIfInventory("H&K USP45 Ex Mags",1,"AmmoPickup")
    WEAP P 0 A_JumpIfInventory("H&K USP45 Akimbo",1,"AmmoPickup")
    WEAP P 0 A_JumpIfInventory("H&K USP45 Tac Knife",1,"AmmoPickup")
	WEAP P 0 A_JumpIfInventory("Perk1_OneManArmy",1,"OneManArmy")
    WEAP P 0 A_JumpIfInventory("MaxWeaponsFilled",96,"FailPickup2")
	WEAP P 0 A_GiveInventory("MaxWeaponsFilled",5)
    WEAP P 0 ACS_NamedExecuteWithResult("RefPickU",3,0,0)
    stop
  }
}

actor HHCBUSP45 : HHBullet
{
  damage (random(16,23))
  Speed 300
  States
  {
  Spawn:
    TNT1 A 10
    TNT1 A 5 A_ScaleVelocity(0.667)
    stop
  Death:
    TNT1 A 0 A_SpawnItemEx("ImpactSmokePuff", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 5 A_PlaySound("generic/ricochet")
    stop
  XDeath:
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
    TNT1 A 5 A_PlaySound("generic/ricochets")
    stop
  Crash:
    TNT1 A 0 A_GiveToTarget("HitIndicator",1)
    TNT1 A 0 A_SpawnItemEx("ImpactSmokePuff_2", 0, 0, 0, 0, 0, 0, 0, 128, 0)
    TNT1 A 5 A_PlaySound("generic/ricochet")
    stop
  }
}

actor HHCBUSP45A : HHCBUSP45
{
  damage (random(16,23))
}