actor "USP .45" : RGUWeapon
{
  obituary "%k capped %o with the USP .45."
  inventory.pickupmessage "USP .45"  
  //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:
    U45A A 2 //A_PlayWeaponSound("m9/select")
    U45A BCDEFGHIJKL 1 A_WeaponReady(WRF_NOPRIMARY)
    U45A L 0 A_JumpIfNoAmmo("Reload")
    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
    goto Ready+12
    U45F F 0 A_JumpIfInventory("Reloading",1,"Reload")    
    U45F F 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45F F 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45F F 1 A_WeaponReady(WRF_NOBOB)
    goto Ready+18
  Deselect:
    U45A L 0 A_TakeInventory("Aiming",1)
    U45A A 0 ACS_ExecuteAlways(602,0,0,0,0)
    U45A L 0 A_TakeInventory("Reloading",1)
    U45A L 0 A_ZoomFactor(1.0)
    U45A L 0 A_Lower
    U45A L 1 A_Lower
    goto Deselect+2
  Select:
    U45A A 0 A_Raise
	U45A A 0 ACS_ExecuteAlways(602,0,0,0,0)
	TNT1 A 0 A_GiveInventory("InCombatCrosshair",35)
    loop
  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")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,8,3)
    U45B A 1 BRIGHT A_FireBullets (10.0, 10.0, -1, 11, "HHBulletPuff", 1, 4000)
    U45B B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    U45B A 0 A_JumpIfNoAmmo("FireEmpty")
    U45B B 1 BRIGHT A_GunFlash
    U45B B 0 A_GiveInventory("Firing",1)
    U45B CD 1 A_WeaponReady
    U45B E 1 A_WeaponReady
    U45B FGHI 1 A_WeaponReady
    U45B A 0 A_TakeInventory("Firing",1)
    U45B A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45B A 0 A_ReFire
    goto Ready+12
    U45B A 0 A_JumpIfNoAmmo("ReloadStart")
    U45B A 0 A_ReFire
    goto Ready+12
  FireEmpty:
    U45B J 1 BRIGHT A_GunFlash
    U45B K 1 BRIGHT A_PlaySound("m9/lock")
    U45B LMNO 1
    U45B P 1 A_GiveInventory("USPBolt",1)
    U45B A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45B A 0 A_ReFire
    goto Ready+12
    U45C A 0 A_JumpIfNoAmmo("ReloadStart")
    U45C A 0 A_ReFire
    goto Ready+12
  FireHold:
    U45A L 0 A_JumpIfNoAmmo("Reload")
    U45B A 0 A_PlayWeaponSound("u45/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,8,3)
    U45B A 1 BRIGHT A_FireBullets (20, 20.0, -1, 11, "HHBulletPuff", 1, 4000)
    U45B B 0 BRIGHT ACS_Execute(600,0,120,0,0)
    U45B A 0 A_JumpIfNoAmmo("FireEmpty")
    U45B B 1 BRIGHT A_GunFlash
    U45B B 0 A_GiveInventory("Firing",1)
    U45B CD 1 A_WeaponReady
    U45B E 1 A_WeaponReady
    U45B FGHI 1 A_WeaponReady
    U45B A 0 A_TakeInventory("Firing",1)
    U45B A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45B A 0 A_ReFire
    goto Ready+12
    U45B A 0 A_JumpIfNoAmmo("ReloadStart")
    U45B A 0 A_ReFire
    goto Ready+12
  Hold:  	
    U45A L 3 A_JumpIfInventory("Aiming",1,"HoldAim")
    U45A L 1 A_ReFire
    goto Ready+12
  HoldAim:
    U45F F 3
    U45F F 1 A_ReFire
    goto Ready+18
  FireAim:
    U45F F 1 A_JumpIfNoAmmo("ReloadStart")
    U45F F 0 A_PlayWeaponSound("u45/fire")
    U45F F 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,8)
    U45F G 1 BRIGHT A_FireBullets (2, 2, -1, 11, "HHBulletPuff", 1, 4000)
    U45F G 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    U45F G 0 A_JumpIfNoAmmo("FireAimEmpty")
    U45F G 1 BRIGHT A_GunFlash
    U45F HH 1 A_WeaponReady
    U45F IIJJ 1 A_WeaponReady
    U45F A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45F A 0 A_ReFire
    goto Ready+18
    U45F A 0 A_JumpIfNoAmmo("ReloadStart")
    U45F A 0 A_ReFire
    goto Ready+18
  FireAimEmpty:
    U45F H 2 BRIGHT A_GunFlash
    U45F I 2 A_PlaySound("m9/lock")
    U45F J 2 A_GiveInventory("USPBolt",1)
    U45F F 2 
    U45F A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45F A 0 A_ReFire
    goto Ready+18
    U45F A 0 A_JumpIfNoAmmo("ReloadStart")
    U45F A 0 A_ReFire
    goto Ready+18
  Reload: //AltFire:
    VECC A 0 A_JumpIfInventory("USP45Ammo",1,"ReloadStart")
    VECC A 0 A_TakeInventory("Reloading",1)
    goto Ready+15
  ReloadStart:
  	TNT1 A 0 ACS_ExecuteAlways(652,0,0,0,0) // Shout "Reloading" 
    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 CDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45C F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45C GHIJ 3 A_WeaponReady(WRF_NOFIRE)
    U45C K 3 A_TakeInventory("Reloading",1)
    U45C L 3 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmo
  ReloadAmmo:
    U45C P 0 A_GiveInventory("USP45Clip",1)
    U45C P 0 A_TakeInventory("USP45Ammo",1)
    U45C P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEnd")
    U45C P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmo")
    goto ReloadEnd
  ReloadEnd:
    U45C MNOPQR 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    //U45D Z 2 A_PlaySound("m9/slide1")
    //U45E ABCDEFG 2 A_WeaponReady(WRF_NOFIRE)
    U45A G 0 A_ReFire
    goto Ready+12
  AltFire:
    U45F A 0 A_JumpIfInventory("Aiming",1,"AltFire2")
    U45F A 0 A_ZoomFactor(1.2)
    U45F ABCDEF 1
    U45F G 0 A_GiveInventory("Aiming",1)
    U45F G 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto Ready+18
  AltFire2:
    U45F F 1 A_ZoomFactor(1.0)
    U45F FEDCBA 1
    U45F A 0 A_TakeInventory("Aiming",1)
    U45F A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto Ready+12
  ReloadStartAim:
    U45F F 1 A_ZoomFactor(1.0)
    U45F FEDCBA 1
    U45F A 0 A_TakeInventory("Aiming",1)
    U45F A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto ReloadStart+1
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP P 15
    WEAP A 0 A_SpawnItem("USP45Pickup")
    stop
  ReloadStartBolt:
    U45D ABCDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45D GHIJ 3 A_WeaponReady(WRF_NOFIRE)
    U45D K 0 A_TakeInventory("USPBolt",1)
    U45D K 3 A_TakeInventory("Reloading",1)
    U45D L 3 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmoBolt
  ReloadAmmoBolt:
    U45D P 0 A_GiveInventory("USP45Clip",1)
    U45D P 0 A_TakeInventory("USP45Ammo",1)
    U45D P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEndBolt")
    U45D P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmoBolt")
    goto ReloadEndBolt
  ReloadEndBolt:
    U45D MNOPQR 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D S 3 A_PlaySound("m9/slide1")
    U45D TUVW 3 A_WeaponReady(WRF_NOFIRE)
    U45D G 0 A_ReFire
    goto Ready+12
  ReloadStart_SOH:
    U45C A 2
    U45C B 2 A_JumpIfInventory("USPBolt",1,"ReloadStartBolt_SOH")
    U45C CDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45C F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45C GHIJ 2 A_WeaponReady(WRF_NOFIRE)
    U45C K 2 A_TakeInventory("Reloading",1)
    U45C L 2 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    U45C P 0 A_GiveInventory("USP45Clip",1)
    U45C P 0 A_TakeInventory("USP45Ammo",1)
    U45C P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEnd_SOH")
    U45C P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmo_SOH")
    goto ReloadEnd_SOH
  ReloadEnd_SOH:
    U45C MNOPQR 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    //U45D Z 2 A_PlaySound("m9/slide1")
    //U45E ABCDEFG 2 A_WeaponReady(WRF_NOFIRE)
    U45A G 0 A_ReFire
    goto Ready+12
  ReloadStartBolt_SOH:
    U45D ABCDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45D GHIJ 2 A_WeaponReady(WRF_NOFIRE)
    U45D K 0 A_TakeInventory("USPBolt",1)
    U45D K 2 A_TakeInventory("Reloading",1)
    U45D L 2 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmoBolt_SOH
  ReloadAmmoBolt_SOH:
    U45D P 0 A_GiveInventory("USP45Clip",1)
    U45D P 0 A_TakeInventory("USP45Ammo",1)
    U45D P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEndBolt_SOH")
    U45D P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmoBolt_SOH")
    goto ReloadEndBolt_SOH
  ReloadEndBolt_SOH:
    U45D MNOPQR 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D S 2 A_PlaySound("m9/slide1")
    U45D TUVW 2 A_WeaponReady(WRF_NOFIRE)
    U45D G 0 A_ReFire
    goto Ready+12
  Fire_SteadyAim:
    U45B A 0 A_JumpIfInventory("Aiming",1,"FireAim")
    U45A L 1 A_JumpIfNoAmmo("ReloadStart")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45B A 0 A_JumpIfInventory("Firing",1,"FireHold_SteadyAim")
    U45B A 0 A_PlayWeaponSound("u45/fire")
    U45B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,8,3)
    U45B A 1 BRIGHT A_FireBullets (6.6, 6.6, -1, 11, "HHBulletPuff", 1, 4000)
    U45B B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    U45B A 0 A_JumpIfNoAmmo("FireEmpty")
    U45B B 1 BRIGHT A_GunFlash
    U45B B 0 A_GiveInventory("Firing",1)
    U45B CD 1 A_WeaponReady
    U45B E 1 A_WeaponReady
    U45B FGHI 1 A_WeaponReady
    U45B A 0 A_TakeInventory("Firing",1)
    U45B A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45B A 0 A_ReFire
    goto Ready+12
    U45B A 0 A_JumpIfNoAmmo("ReloadStart")
    U45B A 0 A_ReFire
    goto Ready+12
  FireHold_SteadyAim:
    U45A L 0 A_JumpIfNoAmmo("Reload")
    U45B A 0 A_PlayWeaponSound("u45/fire")
    U45B A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,8,3)
    U45B A 1 BRIGHT A_FireBullets (13.2, 13.2, -1, 11, "HHBulletPuff", 1, 4000)
    U45B B 0 BRIGHT ACS_Execute(600,0,120,0,0)
    U45B A 0 A_JumpIfNoAmmo("FireEmpty")
    U45B B 1 BRIGHT A_GunFlash
    U45B B 0 A_GiveInventory("Firing",1)
    U45B CD 1 A_WeaponReady
    U45B E 1 A_WeaponReady
    U45B FGHI 1 A_WeaponReady
    U45B A 0 A_TakeInventory("Firing",1)
    U45B A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45B A 0 A_ReFire
    goto Ready+12
    U45B A 0 A_JumpIfNoAmmo("ReloadStart")
    U45B A 0 A_ReFire
    goto Ready+12
  FragGrenade:
    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_ExecuteAlways(602,0,0,0,0)
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"FragGrenade_SOH")
    GRNA A 2 A_PlaySound("grenade/pinpull")
    GRNA BCDEFGH 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("FragGrenadeAmmo",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",0,0,0,16)
    GRNA MN 2 
    goto Ready+1
  FragGrenade_SOH:
    GRNA A 1 A_PlaySound("grenade/pinpull")
    GRNA BCDEFGH 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("FragGrenadeAmmo",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",0,0,0,16)
    GRNA MN 1 
    goto Ready+1
  KnifeAttack:
    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_ExecuteAlways(602,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_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",96)
    KNFA FGHIJKL 1 
    TNT1 A 20
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  KnifeAttack_Commando:
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",160)
    KNFA FGHIJKL 1 
    TNT1 A 20
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  KnifeAttack_SOH:
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_SOH_Commando")
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",96)
    KNFA FGHIJKL 1 
    TNT1 A 10
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  KnifeAttack_SOH_Commando:
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",160)
    KNFA FGHIJKL 1 
    TNT1 A 10
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  }
}

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 FragGrenadeAmmo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 2
    inventory.maxamount 2
    ammo.backpackamount 2
    ammo.backpackmaxamount 4
    +IGNORESKILL
}

actor FragGrenade
{
  obituary "%o caught %k's hot potato."
  radius 5
  height 5
  speed 23
  damage 0
  PROJECTILE
  -NOGRAVITY
  +RANDOMIZE
  +HEXENBOUNCE
  +EXTREMEDEATH
  +FORCERADIUSDMG
  +CANBOUNCEWATER
  +BOUNCEONACTORS
  +ROCKETTRAIL
  -NOTELEPORT
  +TELESTOMP
  Scale 0.16
  gravity 0.4
  bouncefactor 0.30
  damagetype "Explosion"
  ReactionTime 3
  seesound "grenade/lob"
  states
  {
  Spawn:
    FRGX ABCDEFG 4
    FRGX H 4 A_Countdown
    loop
  Death:
    TNT1 A 0 
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_RadiusThrust(160,128)
    TNT1 A 0 Radius_Quake(3,30,0,128,0)
    TNT1 A 0 A_SpawnItemEx("ExplosionMain",0,0,0,0,0,0,0,0,0)
    TNT1 A 0 A_SpawnItemEx("FragGrenadeExplosion",-1,0,0,0,0,0,0,0,0)
    TNT1 AAAAAAAAAA 0 A_SpawnItemEx("ImpactSpark2", random(-32,32), random(-32,32), random(-32,32), random(-5,5), random(-5,5), random(-1,5), 0, 128, 0)
    TNT1 AAAAAAAAAA 0 A_SpawnItemEx("ImpactSpark2", random(-32,32), random(-32,32), random(-32,32), random(-5,5), random(-5,5), random(-1,5), 0, 128, 0)
    TNT1 A 1 //A_NoGravity
    stop
  DangerClose:
	TNT1 A 0
	stop
  }
}
actor FragGrenadeDropped : FragGrenade
{
  speed 2
  damage 0
  PROJECTILE
  -NOGRAVITY
  +RANDOMIZE
  +HEXENBOUNCE
  +NOEXTREMEDEATH
  +FORCERADIUSDMG
  +CANBOUNCEWATER
  +BOUNCEONACTORS
  +ROCKETTRAIL
  -NOTELEPORT
  -TELESTOMP
  Scale 0.16
  gravity 0.4
  bouncefactor 0.5
  damagetype "Explosion"
  ReactionTime 3
  seesound "grenade/lob"
  states
  {
  Spawn:
    FRGX ABCDEFG 4
    FRGX H 4 A_Countdown
    loop
  Death:
    TNT1 A 0 
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_SpawnItemEx("ExplosionMain",0,0,0,0,0,0,0,0,0)
    TNT1 A 0 A_SpawnItemEx("FragGrenadeExplosion",-1,0,0,0,0,0,0,0,0)
    TNT1 AAAAAAAAAA 0 A_SpawnItemEx("ImpactSpark2", random(-32,32), random(-32,32), random(-32,32), random(-5,5), random(-5,5), random(-1,5), 0, 128, 0)
    TNT1 AAAAAAAAAA 0 A_SpawnItemEx("ImpactSpark2", random(-32,32), random(-32,32), random(-32,32), random(-5,5), random(-5,5), random(-1,5), 0, 128, 0)
    TNT1 A 1 //A_NoGravity
    stop
  }
}
actor FragGrenadeExplosion
{
  RenderStyle None
  -RANDOMIZE
  +NOCLIP
  PROJECTILE
  Speed 1
  Damage 0
  Scale 0.7
  Obituary "%o didn't see %k's grenade."
  DamageType "Explosion"
  states
  {
  Spawn:
    TNT1 A 0
	TNT1 A 0 A_JumpIfInTargetInventory("Perk2_DangerClose_Pro", 1, "DangerClosePro")
    TNT1 A 0 A_Explode(150,90,0)
    TNT1 A 5 A_Explode(100,160)
    stop
  DangerClosePro:
    TNT1 A 0 A_Explode(150,140,0)
    TNT1 A 5 A_Explode(100,250)
	stop
  }  
}
actor "USP .45 Ex Mags" : "USP .45"
{
  obituary "%k capped %o with the USP .45."
  inventory.pickupmessage "USP .45"  
  //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
  {
  Reload: //AltFire:
    VECC A 0 A_JumpIfInventory("USP45Ammo",1,"ReloadStart")
    VECC A 0 A_TakeInventory("Reloading",1)
    goto Ready+15
  ReloadStart:
  	TNT1 A 0 ACS_ExecuteAlways(652,0,0,0,0) // Shout "Reloading" 
    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 CDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45C F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45C GHIJ 3 A_WeaponReady(WRF_NOFIRE)
    U45C K 3 A_TakeInventory("Reloading",1)
    U45C L 3 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmo
  ReloadAmmo:
    U45C P 0 A_GiveInventory("USP45Clip2",1)
    U45C P 0 A_TakeInventory("USP45Ammo",1)
    U45C P 0 A_JumpIfInventory("USP45Clip2",18,"ReloadEnd")
    U45C P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmo")
    goto ReloadEnd
  ReloadEnd:
    U45C MNOPQR 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    //U45D Z 2 A_PlaySound("m9/slide1")
    //U45E ABCDEFG 2 A_WeaponReady(WRF_NOFIRE)
    U45A G 0 A_ReFire
    goto Ready+12
  ReloadStartBolt:
    U45D ABCDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45D GHIJ 3 A_WeaponReady(WRF_NOFIRE)
    U45D K 0 A_TakeInventory("USPBolt",1)
    U45D K 3 A_TakeInventory("Reloading",1)
    U45D L 3 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmoBolt
  ReloadAmmoBolt:
    U45D P 0 A_GiveInventory("USP45Clip2",1)
    U45D P 0 A_TakeInventory("USP45Ammo",1)
    U45D P 0 A_JumpIfInventory("USP45Clip2",18,"ReloadEndBolt")
    U45D P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmoBolt")
    goto ReloadEndBolt
  ReloadEndBolt:
    U45D MNOPQR 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D S 3 A_PlaySound("m9/slide1")
    U45D TUVW 3 A_WeaponReady(WRF_NOFIRE)
    U45D G 0 A_ReFire
    goto Ready+12
  ReloadStart_SOH:
    U45C A 2
    U45C B 2 A_JumpIfInventory("USPBolt",1,"ReloadStartBolt_SOH")
    U45C CDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45C F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45C GHIJ 2 A_WeaponReady(WRF_NOFIRE)
    U45C K 2 A_TakeInventory("Reloading",1)
    U45C L 2 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    U45C P 0 A_GiveInventory("USP45Clip2",1)
    U45C P 0 A_TakeInventory("USP45Ammo",1)
    U45C P 0 A_JumpIfInventory("USP45Clip2",18,"ReloadEnd_SOH")
    U45C P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmo_SOH")
    goto ReloadEnd_SOH
  ReloadEnd_SOH:
    U45C MNOPQR 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    //U45D Z 2 A_PlaySound("m9/slide1")
    //U45E ABCDEFG 2 A_WeaponReady(WRF_NOFIRE)
    U45A G 0 A_ReFire
    goto Ready+12
  ReloadStartBolt_SOH:
    U45D ABCDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45D GHIJ 2 A_WeaponReady(WRF_NOFIRE)
    U45D K 0 A_TakeInventory("USPBolt",1)
    U45D K 2 A_TakeInventory("Reloading",1)
    U45D L 2 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmoBolt_SOH
  ReloadAmmoBolt_SOH:
    U45D P 0 A_GiveInventory("USP45Clip2",1)
    U45D P 0 A_TakeInventory("USP45Ammo",1)
    U45D P 0 A_JumpIfInventory("USP45Clip2",18,"ReloadEndBolt_SOH")
    U45D P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmoBolt_SOH")
    goto ReloadEndBolt_SOH
  ReloadEndBolt_SOH:
    U45D MNOPQR 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45D S 2 A_PlaySound("m9/slide1")
    U45D TUVW 2 A_WeaponReady(WRF_NOFIRE)
    U45D G 0 A_ReFire
    goto Ready+12
  ReloadStartAim:
    U45F F 1 A_ZoomFactor(1.0)
    U45F FEDCBA 1
    U45F A 0 A_TakeInventory("Aiming",1)
    U45F A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto ReloadStart+1
  }
}

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 "USP .45 Akimbo" : RGUWeapon
{
  obituary "%k capped %o with the USP .45."
  inventory.pickupmessage "USP .45"  
  //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:
    TNT1 AAA 2 //A_PlayWeaponSound("m9/select")
    U45G ABCDEFGHI 1 A_WeaponReady(WRF_NOFIRE)
    U45G I 0 A_JumpIfNoAmmo("Reload")
    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
    goto Ready+12
  Deselect:
    U45G L 0 A_TakeInventory("Aiming",1)
    U45G A 0 ACS_ExecuteAlways(602,0,0,0,0)
    U45G L 0 A_TakeInventory("Reloading",1)
    U45G L 0 A_ZoomFactor(1.0)
    U45G L 0 A_Lower
    U45G I 1 A_Lower
    goto Deselect+2
  Select:
    U45G A 0 A_Raise
	U45G A 0 ACS_ExecuteAlways(602,0,0,0,0)
	TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    loop
  Fire: //Right		
    U45G I 1 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")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45I A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,20,0)
    U45I A 1 BRIGHT A_FireBullets (10, 10, -1, 11, "HHBulletPuff", 1, 4000)
    U45I B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    U45I A 0 A_JumpIfNoAmmo("FireEmpty")
    U45I B 1 BRIGHT A_GunFlash
    U45I B 0 A_GiveInventory("FireSwitch",1)
    U45I CDE 1 A_WeaponReady
    U45G II 1 A_WeaponReady
    U45I A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45I A 0 A_ReFire
    goto Ready+12
    U45I A 0 A_JumpIfNoAmmo("ReloadStart")
    U45I A 0 A_ReFire
    goto Ready+12
  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,0)
    U45H A 1 BRIGHT A_FireBullets (10, 10, -1, 11, "HHBulletPuff", 1, 4000)
    U45H B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    U45H A 0 A_JumpIfNoAmmo("FireEmptyLeft")
    U45H B 1 BRIGHT A_GunFlash
    U45H B 0 A_TakeInventory("FireSwitch",1)
    U45H CDE 1 A_WeaponReady
    U45G II 1 A_WeaponReady
    U45H A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45H A 0 A_ReFire
    goto Ready+12
    U45H A 0 A_JumpIfNoAmmo("ReloadStart")
    U45H A 0 A_ReFire
    goto Ready+12
  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,2)
    U45I A 0 A_ReFire
    goto Ready+12
    U45I A 0 A_JumpIfNoAmmo("ReloadStart")
    U45I A 0 A_ReFire
    goto Ready+12
  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,2)
    U45H A 0 A_ReFire
    goto Ready+12
    U45H A 0 A_JumpIfNoAmmo("ReloadStart")
    U45H A 0 A_ReFire
    goto Ready+12
  AltFire: //Does nothing
    U45G I 5
    goto Ready+12
  Hold:
    U45G I 3 
    U45G I 1 A_ReFire
    goto Ready+12
  Reload: //AltFire:
    U45G A 0 A_JumpIfInventory("USP45Ammo",1,"ReloadStart")
    U45G A 0 A_TakeInventory("Reloading",1)
    goto Ready+15
  ReloadStart:
  	TNT1 A 0 ACS_ExecuteAlways(652,0,0,0,0) // Shout "Reloading" 
    U45K A 3 A_JumpIfInventory("Perk1_SOH",1,"ReloadStart_SOH")
    U45K B 3 
    U45K CDE 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45K F 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45K GHIJKL 3 A_WeaponReady(WRF_NOFIRE)
    U45K M 3 A_TakeInventory("Reloading",1)
    U45K N 3 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmo
  ReloadAmmo:
    U45K P 0 A_GiveInventory("USP45Clip3",1)
    U45K P 0 A_TakeInventory("USP45Ammo",1)
    U45K P 0 A_JumpIfInventory("USP45Clip3",24,"ReloadEnd")
    U45K P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmo")
    goto ReloadEnd
  ReloadEnd:
    U45K O 3 A_JumpIfInventory("USPBolt",1,"ReloadEndBolt")
    U45G ABCDEFGHI 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45K O 0 A_ReFire
    goto Ready+12
  ReloadEndBolt:
    U45K OOOO 3 
    U45K O 0 A_TakeInventory("USPBolt",1)
    U45G A 3 A_PlayWeaponSound("m9/slide1")
    U45G BCDEFGHI 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45K O 0 A_ReFire
    goto Ready+12
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP P 15
    WEAP A 0 A_SpawnItem("USP45Pickup")
    stop
  ReloadStart_SOH:
    U45K AB 2 
    U45K CDE 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45K F 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45K GHIJKL 2 A_WeaponReady(WRF_NOFIRE)
    U45K M 2 A_TakeInventory("Reloading",1)
    U45K N 2 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    U45K P 0 A_GiveInventory("USP45Clip3",1)
    U45K P 0 A_TakeInventory("USP45Ammo",1)
    U45K P 0 A_JumpIfInventory("USP45Clip3",24,"ReloadEnd_SOH")
    U45K P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmo_SOH")
    goto ReloadEnd_SOH
  ReloadEnd_SOH:
    U45K O 2 A_JumpIfInventory("USPBolt",1,"ReloadEndBolt_SOH")
    U45G ABCDEFGHI 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45K O 0 A_ReFire
    goto Ready+12
  ReloadEndBolt_SOH:
    U45K OOOO 2 
    U45K O 0 A_TakeInventory("USPBolt",1)
    U45G A 2 A_PlayWeaponSound("m9/slide1")
    U45G BCDEFGHI 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45K O 0 A_ReFire
    goto Ready+12
  Fire_SteadyAim: //Right
    U45I A 0 A_PlayWeaponSound("u45/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45I A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,20,0)
    U45I A 1 BRIGHT A_FireBullets (6.6, 6.6, -1, 11, "HHBulletPuff", 1, 4000)
    U45I B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    U45I A 0 A_JumpIfNoAmmo("FireEmpty")
    U45I B 1 BRIGHT A_GunFlash
    U45I B 0 A_GiveInventory("FireSwitch",1)
    U45I CDE 1 A_WeaponReady
    U45G II 1 A_WeaponReady
    U45I A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45I A 0 A_ReFire
    goto Ready+12
    U45I A 0 A_JumpIfNoAmmo("ReloadStart")
    U45I A 0 A_ReFire
    goto Ready+12
  FireLeft_SteadyAim:
    U45H A 0 A_PlaySoundEx("u45/fire","SoundSlot6")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45H A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,-20,0)
    U45H A 1 BRIGHT A_FireBullets (6.6, 6.6, -1, 11, "HHBulletPuff", 1, 4000)
    U45H B 0 BRIGHT ACS_ExecuteAlways(600,0,120,0,0)
    U45H A 0 A_JumpIfNoAmmo("FireEmptyLeft")
    U45H B 1 BRIGHT A_GunFlash
    U45H B 0 A_TakeInventory("FireSwitch",1)
    U45H CDE 1 A_WeaponReady
    U45G II 1 A_WeaponReady
    U45H A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45H A 0 A_ReFire
    goto Ready+12
    U45H A 0 A_JumpIfNoAmmo("ReloadStart")
    U45H A 0 A_ReFire
    goto Ready+12
  FragGrenade:
    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_ExecuteAlways(602,0,0,0,0)
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"FragGrenade_SOH")
    GRNA A 2 A_PlaySound("grenade/pinpull")
    GRNA BCDEFGH 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("FragGrenadeAmmo",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",0,0,0,16)
    GRNA MN 2 
    goto Ready+1
  FragGrenade_SOH:
    GRNA A 1 A_PlaySound("grenade/pinpull")
    GRNA BCDEFGH 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("FragGrenadeAmmo",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",0,0,0,16)
    GRNA MN 1 
    goto Ready+1
  KnifeAttack:
    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_ExecuteAlways(602,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_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",96)
    KNFA FGHIJKL 1 
    TNT1 A 20
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  KnifeAttack_Commando:
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",160)
    KNFA FGHIJKL 1 
    TNT1 A 20
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  KnifeAttack_SOH:
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_SOH_Commando")
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",96)
    KNFA FGHIJKL 1 
    TNT1 A 10
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  KnifeAttack_SOH_Commando:
    KNFA A 0 ACS_ExecuteAlways(599,0,0,0,0)
    KNFA AB 1
    KNFA B 0 A_PlaySound("knife/swing")
    KNFA CDE 1 A_CustomPunch(34,1,0,"KnifePuff",160)
    KNFA FGHIJKL 1 
    TNT1 A 10
    GRNA L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready+1
  }
}

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 FireSwitch : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}

actor "USP .45 Tac Knife" : RGUWeapon
{
  obituary "%k capped %o with the USP .45."
  inventory.pickupmessage "USP .45"  
  //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:
    U45L A 2 //A_PlayWeaponSound("m9/select")
    U45L BCDEFGHIJKL 1 A_WeaponReady(WRF_NOPRIMARY)
    U45L L 0 A_JumpIfNoAmmo("Reload")
    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
    goto Ready+12
    U45N F 0 A_JumpIfInventory("Reloading",1,"Reload")    
    U45N F 0 A_JumpIfInventory("ThrowingGrenade",1,"FragGrenade")
    U45N F 0 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45N F 1 A_WeaponReady(WRF_NOBOB)
    goto Ready+18
  Deselect:
    U45L L 0 A_TakeInventory("Aiming",1)
    U45L A 0 ACS_ExecuteAlways(602,0,0,0,0)
    U45L L 0 A_TakeInventory("Reloading",1)
    U45L L 0 A_ZoomFactor(1.0)
    U45L L 0 A_Lower
    U45L L 1 A_Lower
    goto Deselect+2
  Select:
    U45L A 0 A_Raise
	U45L A 0 ACS_ExecuteAlways(602,0,0,0,0)
	TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    loop
  Fire:
    U45L A 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")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45M A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,8)
    U45M A 1 BRIGHT A_FireBullets (10.0, 10.0, -1, 11, "HHBulletPuff", 1, 4000)
    U45M B 0 BRIGHT ACS_ExecuteAlways(600,0,120,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
    U45L LLLL 1 A_WeaponReady
    U45M A 0 A_TakeInventory("Firing",1)
    U45M A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45M A 0 A_ReFire
    goto Ready+12
    U45M A 0 A_JumpIfNoAmmo("ReloadStart")
    U45M A 0 A_ReFire
    goto Ready+12
  FireEmpty:
    U45M B 1 BRIGHT A_GunFlash
    U45M C 1 BRIGHT A_PlaySound("m9/lock")
    U45M DE 1 
    U45L L 1 A_GiveInventory("USPBolt",1)
    U45M A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45M A 0 A_ReFire
    goto Ready+12
    U45M A 0 A_JumpIfNoAmmo("ReloadStart")
    U45M A 0 A_ReFire
    goto Ready+12
  FireHold:
    U45L L 0 A_JumpIfNoAmmo("Reload")
    U45M A 0 A_PlayWeaponSound("u45/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45M A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,8)
    U45M A 1 BRIGHT A_FireBullets (10, 10, -1, 11, "HHBulletPuff", 1, 4000)
    U45M B 0 BRIGHT ACS_Execute(600,0,120,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
    U45L LLLL 1 A_WeaponReady
    U45M A 0 A_TakeInventory("Firing",1)
    U45M A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45M A 0 A_ReFire
    goto Ready+12
    U45M A 0 A_JumpIfNoAmmo("ReloadStart")
    U45M A 0 A_ReFire
    goto Ready+12
  Hold:
    U45L L 3 A_JumpIfInventory("Aiming",1,"HoldAim")
    U45L L 1 A_ReFire
    goto Ready+12
  HoldAim:
    U45N F 3
    U45N F 1 A_ReFire
    goto Ready+18
  FireAim:
    U45N F 1 A_JumpIfNoAmmo("ReloadStart")
    U45N F 0 A_PlayWeaponSound("u45/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45N F 0 A_FireCustomMissile("WeaponSmokePuff",0,0,0,8)
    U45O A 1 BRIGHT A_FireBullets (2, 2, -1, 11, "HHBulletPuff", 1, 4000)
    U45O G 0 BRIGHT ACS_ExecuteAlways(600,0,0,0,0)
    U45O G 0 A_JumpIfNoAmmo("FireAimEmpty")
    U45O B 1 BRIGHT A_GunFlash
    U45O CDE 1 A_WeaponReady
    U45N FFFF 1 A_WeaponReady
    U45O A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45O A 0 A_ReFire
    goto Ready+18
    U45O A 0 A_JumpIfNoAmmo("ReloadStart")
    U45O A 0 A_ReFire
    goto Ready+18
  FireAimEmpty:
    U45O A 1 BRIGHT A_GunFlash
    U45O B 1 A_PlaySound("m9/lock")
    U45O C 1 A_GiveInventory("USPBolt",1)
    U45O DE 1
    U45O A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45O A 0 A_ReFire
    goto Ready+18
    U45F A 0 A_JumpIfNoAmmo("ReloadStart")
    U45F A 0 A_ReFire
    goto Ready+18
  Reload: //AltFire:
    VECC A 0 A_JumpIfInventory("USP45Ammo",1,"ReloadStart")
    VECC A 0 A_TakeInventory("Reloading",1)
    goto Ready+15
  ReloadStart:
  	TNT1 A 0 ACS_ExecuteAlways(652,0,0,0,0) // Shout "Reloading" 
    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")
    U45P BC 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45P D 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45P EFGHIJK 3 A_WeaponReady(WRF_NOFIRE)
    U45P L 3 A_TakeInventory("Reloading",1)
    U45P M 3 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmo
  ReloadAmmo:
    U45P P 0 A_GiveInventory("USP45Clip",1)
    U45P P 0 A_TakeInventory("USP45Ammo",1)
    U45P P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEnd")
    U45P P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmo")
    goto ReloadEnd
  ReloadEnd:
    U45P NOPQ 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45P RST 3 A_WeaponReady(WRF_NOFIRE)
    U45P G 0 A_ReFire
    goto Ready+12
  ReloadStartBolt:
    U45Q ABCD 3 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45Q E 3 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45Q FGHIJKLM 3 A_WeaponReady(WRF_NOFIRE)
    U45Q N 3 A_TakeInventory("Reloading",1)
    U45Q O 3 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmoBolt
  ReloadAmmoBolt:
    U45Q P 0 A_GiveInventory("USP45Clip",1)
    U45Q P 0 A_TakeInventory("USP45Ammo",1)
    U45Q P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEndBolt")
    U45Q P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmoBolt")
    goto ReloadEndBolt
  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_NOFIRE)
    U45Q G 0 A_ReFire
    goto Ready+12
  AltFire:
    U45N A 0 A_JumpIfInventory("Aiming",1,"AltFire2")
    U45N A 0 A_ZoomFactor(1.2)
    U45N ABCDEF 1
    U45N G 0 A_GiveInventory("Aiming",1)
    U45N G 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto Ready+18
  AltFire2:
    U45N F 1 A_ZoomFactor(1.0)
    U45N FEDCBA 1
    U45N A 0 A_TakeInventory("Aiming",1)
    U45N A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto Ready+12
  ReloadStartAim:
    U45N F 1 A_ZoomFactor(1.0)
    U45N FEDCBA 1
    U45N A 0 A_TakeInventory("Aiming",1)
    U45N A 0 ACS_ExecuteAlways(602,0,0,0,0)
    goto ReloadStart+1
  Flash:
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
  Spawn:
    WEAP P 15
    WEAP A 0 A_SpawnItem("USP45Pickup")
    stop
  ReloadStart_SOH:
    U45P A 2 A_JumpIfInventory("USPBolt",1,"ReloadStartBolt_SOH")
    U45P BC 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45P D 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45P EFGHIJK 2 A_WeaponReady(WRF_NOFIRE)
    U45P L 2 A_TakeInventory("Reloading",1)
    U45P M 2 A_PlayWeaponSound("m9/clipin")
    goto ReloadAmmo_SOH
  ReloadAmmo_SOH:
    U45P P 0 A_GiveInventory("USP45Clip",1)
    U45P P 0 A_TakeInventory("USP45Ammo",1)
    U45P P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEnd_SOH")
    U45P P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmo_SOH")
    goto ReloadEnd_SOH
  ReloadEnd_SOH:
    U45P NOPQ 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45P RST 2 A_WeaponReady(WRF_NOFIRE)
    U45P G 0 A_ReFire
    goto Ready+12
  ReloadStartBolt_SOH:
    U45Q ABCD 2 A_JumpIfInventory("KnifeAttack",1,"KnifeAttack")
    U45Q E 2 A_PlaySoundEx("m9/clipout","SoundSlot5")
    U45Q FGHIJKLM 2 A_WeaponReady(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_GiveInventory("USP45Clip",1)
    U45Q P 0 A_TakeInventory("USP45Ammo",1)
    U45Q P 0 A_JumpIfInventory("USP45Clip",12,"ReloadEndBolt_SOH")
    U45Q P 0 A_JumpIfInventory("USP45Ammo",1,"ReloadAmmoBolt_SOH")
    goto ReloadEndBolt_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_NOFIRE)
    U45Q G 0 A_ReFire
    goto Ready+12
  Fire_SteadyAim:
    U45M A 0 A_JumpIfInventory("Firing",1,"FireHold_SteadyAim")
    U45M A 0 A_PlayWeaponSound("u45/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45M A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,8)
    U45M A 1 BRIGHT A_FireBullets (6.6, 6.6, -1, 11, "HHBulletPuff", 1, 4000)
    U45M B 0 BRIGHT ACS_ExecuteAlways(600,0,120,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
    U45L LLLL 1 A_WeaponReady
    U45M A 0 A_TakeInventory("Firing",1)
    U45M A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45M A 0 A_ReFire
    goto Ready+12
    U45M A 0 A_JumpIfNoAmmo("ReloadStart")
    U45M A 0 A_ReFire
    goto Ready+12
  FireHold_SteadyAim:
    U45L L 0 A_JumpIfNoAmmo("Reload")
    U45M A 0 A_PlayWeaponSound("u45/fire")
    TNT1 F 0 A_GiveInventory("InCombatCrosshair", 35)
    TNT1 F 0 A_GiveInventory("InCombat", 5)
    U45M A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,6,8)
    U45M A 1 BRIGHT A_FireBullets (13.2, 13.2, -1, 11, "HHBulletPuff", 1, 4000)
    U45M B 0 BRIGHT ACS_Execute(600,0,120,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
    U45L LLLL 1 A_WeaponReady
    U45M A 0 A_TakeInventory("Firing",1)
    U45M A 0 A_JumpIfInventory("USP45Ammo",1,2)
    U45M A 0 A_ReFire
    goto Ready+12
    U45M A 0 A_JumpIfNoAmmo("ReloadStart")
    U45M A 0 A_ReFire
    goto Ready+12
  FragGrenade:
    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_ExecuteAlways(602,0,0,0,0)
    U45A L 0 A_JumpIfInventory("Perk1_SOH_Pro",1,"FragGrenade_SOH")
    GRNA A 2 A_PlaySound("grenade/pinpull")
    GRNA BCDEFGH 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("FragGrenadeAmmo",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",0,0,0,16)
    GRNA MN 2 
    goto Ready+1
  FragGrenade_SOH:
    GRNA A 1 A_PlaySound("grenade/pinpull")
    GRNA BCDEFGH 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("FragGrenadeAmmo",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",0,0,0,16)
    GRNA MN 1 
    goto Ready+1
  KnifeAttack:
    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_ExecuteAlways(602,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_ExecuteAlways(599,0,0,0,0)
    U45R AB 2
    U45R C 2 A_PlaySound("knife/swing")
    U45R DD 0 A_CustomPunch(34,1,0,"KnifePuff",96)
    U45R D 2 A_CustomPunch(34,1,0,"KnifePuff",96)
    U45R EF 2
    TNT1 A 10
    U45R L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready
  KnifeAttack_Commando:
    U45R A 0 ACS_ExecuteAlways(599,0,0,0,0)
    U45R AB 2
    U45R C 2 A_PlaySound("knife/swing")
    U45R DD 0 A_CustomPunch(34,1,0,"KnifePuff",160)
    U45R D 2 A_CustomPunch(34,1,0,"KnifePuff",160)
    U45R EF 2
    TNT1 A 10
    U45R L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready
  KnifeAttack_SOH:
    U45C A 0 A_JumpIfInventory("Perk3_Commando",1,"KnifeAttack_SOH_Commando")
    U45R A 0 ACS_ExecuteAlways(599,0,0,0,0)
    U45R AB 1
    U45R C 1 A_PlaySound("knife/swing")
    U45R DD 0 A_CustomPunch(28,1,0,"KnifePuff",96)
    U45R D 1 A_CustomPunch(28,1,0,"KnifePuff",96)
    U45R EF 1
    TNT1 A 5
    U45R L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready
  KnifeAttack_SOH_Commando:
    U45R A 0 ACS_ExecuteAlways(599,0,0,0,0)
    U45R AB 1
    U45R C 1 A_PlaySound("knife/swing")
    U45R DD 0 A_CustomPunch(28,1,0,"KnifePuff",160)
    U45R D 1 A_CustomPunch(28,1,0,"KnifePuff",160)
    U45R EF 1
    TNT1 A 5
    U45R L 0 A_TakeInventory("KnifeAttack",1)
    goto Ready
  }
}

actor USP45Knife : Inventory
{
    inventory.amount 0
    inventory.maxamount 1
}
actor USP45Pickup : CustomInventory
{
  inventory.pickupmessage "USP .45"  
  inventory.pickupsound "misc/w_pkup"
  +INVENTORY.AUTOACTIVATE
  inventory.respawntics 35
  scale 0.15
  States
  {
  Spawn:
    WEAP P -1
    stop
  Pickup:
    JDGP A 0
    JDGP A 0 A_JumpIfInventory("USP .45",1,"FailPickup") // If the player already has this weapon, they get more ammo for it
    JDGP A 0 A_JumpIfInventory("USP .45 Ex Mags",1,"FailPickup")
    JDGP A 0 A_JumpIfInventory("USP .45 Akimbo",1,"FailPickup")
    JDGP A 0 A_JumpIfInventory("USP .45 Tac Knife",1,"FailPickup")
    JDGP A 0 A_JumpIfInventory("MaxWeaponsFilled",0,"FailPickup2")
    BKPK A 0 ACS_ExecuteWithResult(618,3,0,0)
    stop
  AmmoPickup:
    JDGP A 0
    JDGP A 0 A_JumpIfInventory("USP45Ammo",0,"FailPickup")
    JDGP A 0 A_GiveInventory("USP45Ammo",12)
    stop
  FailPickup:
    WEAP P 1
    fail
  FailPickup2:
    WEAP P 1 
    BKPK A 0 ACS_ExecuteAlways(620,0,2,0,0)
    fail
  }
}

actor "USP .45 LastStand": "USP .45"
{
}
