//Enforcer DECORATE

actor TKRWUTEnforcer : Weapon
{
  obituary "%k riddled %o full of holes with the Enforcer."
  attacksound "UT/Weapons/enforcer/fire"
  inventory.pickupmessage "You picked up another Enforcer!"
  weapon.kickback 100
  weapon.ammotype "TKRWBullets"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "TKRWBullets"
  weapon.ammouse2 1
  inventory.Icon "TK68R0"
  Tag "Enforcer"
  +CHEATNOTWEAPON
  scale 0.8
  states
  {
  Spawn:
    TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("TKRWMag60",0,0,0,random(1,2),0,5,random(0,360),SXF_NOCHECKPOSITION,0)
    Stop
  Ready:
    200S ABCDEFG 3
    200F A 0 A_JumpIfInventory("EnforcerSwayCheck",25,10)
    200F AAAAAAAA 1 A_WeaponReady(WRF_ALLOWRELOAD)
    200F A 0 A_GiveInventory("EnforcerSwayCheck",1)
    goto Ready+7
    200F A 0 A_TakeInventory("EnforcerSwayCheck",random(15,25))
    200F BBBCCCDDDEEEFFFEEEDDDCCCBBB 1 A_WeaponReady(WRF_ALLOWRELOAD)
    goto Ready+7
  Deselect:
  TK01 A 0 A_JumpIfInventory ("TRWAkimboMag60Out",1,"DeselectAkimbo")
    200F A 0 A_Lower
    200F A 1 A_Lower
    loop
  Select:
    200F A 0 A_PlayWeaponSound("UT/Weapons/enforcer/select")
    200F A 0 A_Raise
    goto Select+1
  Fire:
  TK01 A 0 A_JumpIfInventory ("TRWAkimboMag60Out",1,"FireAkimbo")
    200A A 0 A_GunFlash
    200A A 2 BRIGHT A_FireBullets (1.0, 1.0, 1, 10, "BulletPuff",FBF_USEAMMO|FBF_NORANDOM)
	TNT1 A 0 A_SpawnItemEx("ucasing", 33,cos(pitch)*18,sin(-pitch)*25+33, frandom(0.5,1.2),frandom(0.5,1.2),frandom(2.5,3.5))
    200A B 2 BRIGHT
    200A CDEF 2
    200F A 1
    200F A 0 A_Refire
    goto Ready+7
  AltFire:
  TK01 A 0 A_JumpIfInventory ("TRWAkimboMag60Out",1,"ReadyAkimbo")
    2002 ABCDEF 2
    2002 G 0 A_GunFlash
    2002 G 2 BRIGHT A_FireBullets (7.0, 7.0, 1, 10, "BulletPuff",FBF_USEAMMO|FBF_NORANDOM)
	TNT1 A 0 A_SpawnItemEx("ucasing", 33,cos(pitch)*10,sin(-pitch)*25+37, frandom(0.5,1.2),frandom(0.5,1.2),frandom(1.5,2.5))
    2002 H 2 BRIGHT
    2002 IJ 2
    2002 F 1 A_JumpIfNoAmmo("EndAlt")
    2002 F 2 A_Refire
    2002 EDCBA 2
    goto Ready+7    
  AltHold:
    2002 G 0 A_GunFlash
    2002 G 2 BRIGHT A_FireBullets (7.0, 7.0, 1, 10, "BulletPuff",FBF_USEAMMO|FBF_NORANDOM)
	TNT1 A 0 A_SpawnItemEx("ucasing", 33,cos(pitch)*10,sin(-pitch)*25+37, frandom(0.5,1.2),frandom(0.5,1.2),frandom(1.5,2.5))
    2002 H 2 BRIGHT
    2002 IJ 2
    2002 F 1 A_JumpIfNoAmmo("EndAlt")
    2002 F 2 A_Refire
    2002 EDCBA 2
    goto Ready+7    
  EndAlt:
    2002 F 3
    2002 EDCBA 2
    2002 A 0 A_Refire
    goto Ready+7    
  Flash:
    TNT1 A 2 bright A_Light2
    TNT1 A 2 bright A_Light1
    TNT1 A 0 bright A_Light0
    stop
	
	Reload:
    TK01 A 0 A_JumpIfInventory ("TRWAkimboMag60Check",2,"PullOutAnotherPistol")
	 TNT1 A 0 A_Print("You need Two Enforcers to Akimbo!")
	goto Ready+7
	
	PullOutAnotherPistol:
	TNT1 A 0 A_JumpIfInventory("TRWAkimboMag60Out",1,"SwitchBack")
    TK01 A 0 A_Giveinventory ("TRWAkimboMag60Out",1)
	EN2F A 0 A_PlayWeaponSound("enforcer2/select")
    goto ReadyAkimbo
	
	SwitchBack:
    TK01 A 0 A_TakeInventory ("TRWAkimboMag60Out",1)
	EN2F A 0 A_PlayWeaponSound("UT/Weapons/enforcer/select")
    200S ABCDEFG 3
    goto ready+7
	
	/// This is where the Akimbo Pistol code starts there.
  ReadyAkimbo:
    EN2S ABCDEFG 3
    EN2F A 1 A_WeaponReady(WRF_ALLOWRELOAD)
    goto ReadyAkimbo+7
  DeselectAkimbo:
    EN2F A 0 A_Lower
    EN2F A 1 A_Lower
    loop
  SelectAkimbo:
    EN2F A 0 A_PlayWeaponSound("enforcer2/select")
    EN2F A 0 A_Raise
    goto SelectAkimbo+1
  FireAkimbo:
    NULL A 0 A_JumpIfInventory("TKRWBullets",2,1)
  goto ReadyAkimbo+7
    EN2A A 0 A_GunFlash
    EN2A A 2 BRIGHT A_FireBullets (2.0, 2.0, -1, 10, "BulletPuff",FBF_USEAMMO|FBF_NORANDOM)
	TNT1 A 0 A_SpawnItemEx("ucasing", 33,cos(pitch)*-10,sin(-pitch)*25+37, frandom(0.5,1.2),frandom(0.5,1.2),frandom(1.5,2.5))
    EN2A B 2 BRIGHT A_FireBullets (2.0, 2.0, -1, 10, "BulletPuff",FBF_USEAMMO|FBF_NORANDOM)
	TNT1 A 0 A_SpawnItemEx("ucasing", 33,cos(pitch)*10,sin(-pitch)*25+37, frandom(0.5,1.2),frandom(0.5,1.2),frandom(1.5,2.5))
    EN2A C 1 BRIGHT
    EN2A CDE 2
    EN2A FG 1
    EN2F A 1 A_Refire
    goto ReadyAkimbo+7	
  }
}

actor EnforcerSwayCheck : Inventory
{
    inventory.amount 0
    inventory.maxamount 25
}
