ACTOR OrderDualLeft : Ammo
{
  Inventory.Amount 1
  Inventory.MaxAmount 10
  Inventory.Icon "CLIPA0"
  +INVENTORY.IGNORESKILL
}

ACTOR OrderDualRight : Ammo
{
  Inventory.Amount 1
  Inventory.MaxAmount 10
  Inventory.Icon "CLIPA0"
  +INVENTORY.IGNORESKILL
}

ACTOR OrderDualSecondary : Ammo
{
  Inventory.PickupMessage "You picked up a mag of Order Pistol ammunition." // "Picked up a clip."
  Inventory.PickupSound "bullpup/magin"
  Inventory.Amount 10
  Inventory.MaxAmount 120
  Ammo.BackpackAmount 30
  Ammo.BackpackMaxAmount 120
  Inventory.Icon "CLIPA0"
  +INVENTORY.IGNORESKILL
  States
  {
  Spawn:
    CLIP A -1
    Stop
  }
}

ACTOR DualOrderPistols : Weapon
{
  Weapon.AmmoUse 0
  Weapon.AmmoGive 0
  Weapon.AmmoGive2 0
  Weapon.AmmoType "OrderDualLeft"
  Weapon.AmmoType2 "OrderDualRight"
  Obituary "\cJ%k \cG> \cKOrder Pistol \cG> \cJ%o"
  Inventory.Pickupmessage "You picked up the Order Pistol."
  Inventory.PickupSound "ppsh/pickup"
	//$Category ZT2 - Weapons
	//$Title PPSH-41
	//$Sprite PPSHF0
  Tag "Dual Order Pistols"
  Scale 0.75
  +WEAPON.NOAUTOFIRE
  +INVENTORY.UNDROPPABLE
  States
  {
  //=================================================================
  // GUN FLASHES - USED FOR DUAL WIELDING
  //------------------------------------------------
  DualPistols:
	DPIR A 0
  RIdle:
	DPIR A 0 A_JumpIfInventory("ReloadingR",1,"RReload")
	DPIR A 0 A_JumpIfInventory("SynthFireRight",1,"Fire")
	DPIR A 1
    Loop
  RSelect:
	DPIQ ABC 1
	Goto RIdle
  RDeselect:
	DPIQ CBA 1
	Goto Stop
  RReload:
	DPIS A 0 A_TakeInventory("ReloadingR",1)
	DPIS A 0 A_JumpIfInventory("OrderDualRight",10,"RIdle")
	DPIS A 0 A_JumpIfInventory("OrderDualSecondary",1,1)
	Goto RIdle
	DPIS ABCDEF 1
	ORRL F 0 A_PlaySoundEx("orderpistol/magout","SoundSlot6")
	DPIS GHI 1
	BPSS A 0 A_FireCustomMissile("PistolMagShooter",5,0,16,-3)
	DPIS JKLMNOP 1
	TNT1 A 5
	DPIS R 1
	ORRL R 0 A_PlaySoundEx("cloth/knife","SoundSlot6")
	DPIS ST 1
	DPIS U 2
	DPIS V 3
	ORRL R 0 A_PlaySoundEx("orderpistol/magin","SoundSlot6")
	DPIS WWX 1
	DPIS YZ 1
	DPIT ABCDEF 1
	DPIT G 0 A_Takeinventory("ReloadingR",1)
	Goto CalcR
  CalcR:
	DPIS A 0 A_JumpIfInventory("OrderDualRight",10,"RIdle")
	DPIS A 0 A_JumpIfInventory("OrderSecondary",1,1)
	Goto RIdle
	DPIS A 0 A_TakeInventory("OrderDualSecondary",1)
	DPIS A 0 A_GiveInventory("OrderDualRight",1)
	Loop
  CalcL:
	DPIS A 0 A_JumpIfInventory("OrderDualLeft",10,"LIdle")
	DPIS A 0 A_JumpIfInventory("OrderSecondary",1,1)
	Goto LIdle
	DPIS A 0 A_TakeInventory("OrderDualSecondary",1)
	DPIS A 0 A_GiveInventory("OrderDualLeft",1)
	Loop
  LReload:
	DPIS A 0 A_TakeInventory("ReloadingL",1)
	DPIS A 0 A_JumpIfInventory("OrderDualLeft",10,"LIdle")
	DPIS A 0 A_JumpIfInventory("OrderDualSecondary",1,1)
	Goto LIdle
	DPIM ABCDEFGHI 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	ORRL F 0 A_PlaySoundEx("orderpistol/magout","SoundSlot6")
	DPIM JKLM 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	BPSS A 0 A_FireCustomMissile("PistolMagShooter",5,0,-16,-3)
	DPIM NOPQRSTUV 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	TNT1 A 5 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	DPIM X 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	ORRL R 0 A_PlaySoundEx("cloth/knife","SoundSlot6")
	DPIM YZ 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	DPIN A 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	ORRL F 0 A_PlaySoundEx("orderpistol/magin","SoundSlot6")
	DPIN BCC 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	DPIN DEFGHIJKLM 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	DPIT G 0 A_Takeinventory("ReloadingL",1)
	Goto CalcL
  //------------------------------------------------
  // DRY FIRES
  //------------------------------------------------
  DryFireR:
	TNT1 A 0 A_TakeInventory("SynthFireRight",1)
	TNT1 A 0 A_JumpIfInventory("OrderDualPrimary",1,"RIdle")
	NULL A 0 A_PlaySoundEx("orderpistol/dryfire","SoundSlot6")
	Goto RIdle
  GiveBothReload:
	TNT1 A 0 A_TakeInventory("IsReloading",1)
	TNT1 A 0 A_GiveInventory("ReloadingL",1)
	TNT1 A 0 A_GiveInventory("ReloadingR",1)
	Goto LIdle
  //=================================================================
  Ready:
	PPSS A 0
	PPSS A 0 A_TakeInventory("SynthFireLeft",1)
	PPSS A 0 A_TakeInventory("SynthFireRight",1)
	Goto LIdle
  LIdle:
	PPSS A 0 A_JumpIfInventory("IsReloading",1,"GiveBothReload")
	PPSS A 0 A_JumpIfInventory("ReloadingL",1,"LReload")
	PPSS A 0 A_JumpIfInventory("SynthFireLeft",1,"LFire")
	PPSS A 0 A_JumpIfInventory("DoBlocking",1,"QuickMelee")
    PPSS A 0 //A_JumpIfInventory("QuickGrenading",1,"ToGrenade")
	//PPSS A 0 A_JumpIfInventory("ReloadingL",1,"LReload")
	PPSS A 0 A_TakeInventory("BackToEmpty",1)
    DPIL A 1 A_WeaponReady(12)
    Loop
  ToGrenade:
	//PPSS A 0 ACS_ExecuteAlways(558,0,0,0,1)
	ORDD A 1
	Goto Ready
  Profanity:
	9MRL A 0 ACS_ExecuteAlways(820,0,2,0,0)
	ORFU ABC 2
	ORFU D 26
	ORFU CBA 2
	PPFU A 0 A_TakeInventory("FuckYou",1)
	Goto Ready
  QuickMelee:
	ORDM A 0 A_JumpIfInventory("OrderDualPrimary",1,1)
	Goto QMEmpty
	ORDM A 0 A_PlaySoundEx("fist/swing","Weapon")
	ORDM ABCDF 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	PPBL D 0 A_CustomPunch (random(4,5),1,0,"BlockPuff")
	ORDM HIJKL 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	TNT1 A 2
	ORDS ABCD 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	PPBL A 0 A_TakeInventory("DoBlocking",1)
	Goto Ready
  QMEmpty:
	ORDN A 0 A_PlaySoundEx("fist/swing","Weapon")
	ORDN ABCDF 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	PPBL D 0 A_CustomPunch (random(4,5),1,0,"BlockPuff")
	ORDN HIJKL 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	TNT1 A 2
	ORDS EFGH 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	PPBL A 0 A_TakeInventory("DoBlocking",1)
	Goto Ready
  ToReady:
	NULL A 0
	Goto Ready
	NULL AAA 0
	NULL A 0 A_PlaySoundEx("orderpistol/dryfire","SoundSlot6")
	Goto Ready
  NullFlash:
	TNT1 A 0
	Stop
  Deselect:
	 TNT1 A 0 A_GunFlash("RDeselect")
	 DPIK CBA 1
	 TNT1 A 0 A_TakeInventory("SynthFireActive",1)
     TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
	 TNT1 A 1 A_Lower
     Goto Deselect+13
  DeselectEmpty:
	 ORDS HGFE 1
     TNT1 AAAAAAAAAA 0 A_Lower
	 TNT1 A 1 A_Lower
     Goto DeselectEmpty+5
  Select:
	 TNT1 A 0 A_SetCrosshair(15)
	 TNT1 AA 0 A_Raise
	 TNT1 A 0 A_GiveInventory("SynthFireActive",1)
	 TNT1 A 1 A_WeaponReady
	 TNT1 A 0 A_PlaySoundEx("orderpistol/select","SoundSlot6")
	 Goto SelectAnim
  SelectAnim:
	ORDS A 0 A_GunFlash("RSelect")
	DPIK ABC 1 A_WeaponReady(WRF_NOFIRE | WRF_NOSWITCH)
	TNT1 A 0 ACS_ExecuteAlways(562,0,0,0,0)
	TNT1 A 0 ACS_ExecuteAlways(563,0,0,0,0)
	//TNT1 A 0 A_Gunflash("DualPistols")
	Goto Ready
  AltFire:
	Stop
  Fire:
     PPFI A 0 A_TakeInventory("SynthFireLeft",1)
	 PPFI A 0 A_JumpIfInventory("OrderDualRight",1,1)
	 Goto DryFireR
	 PPFI A 0 A_TakeInventory("OrderDualRight",1)
	 PPFI A 0 A_AlertMonsters
	 PPFI A 0 A_FireBullets (ACS_ExecuteWithResult(566,3,0,0), ACS_ExecuteWithResult(566,3,0,0), 1, 10, "BulletPuff2")
	 BPSS A 0 A_FireCustomMissile("LongRifleCaseSpawn",5,0,16,-3)
	 PPFI A 0 A_PlaySound("orderpistol/fire", CHAN_WEAPON)
	 TNT1 A 0 A_SpawnItemEx("ShooterLight",0,0,0)
	 PPFI A 0 A_SetPitch(pitch-1.0)
	 DPIR B 1 bright A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	 PPFI A 0 A_SetPitch(pitch+0.6)
	 DPIR CDE 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	 Goto RIdle
  LFire:
     PPFI A 0 A_TakeInventory("SynthFireLeft",1)
	 PPFI A 0 A_JumpIfInventory("OrderDualLeft",1,1)
	 Goto ToReady+2
	 PPFI A 0 A_TakeInventory("OrderDualLeft",1)
	 PPFI A 0 A_AlertMonsters
	 PPFI A 0 A_FireBullets (ACS_ExecuteWithResult(566,3,0,0), ACS_ExecuteWithResult(566,3,0,0), 1, 10, "BulletPuff2")
	 BPSS A 0 A_FireCustomMissile("LongRifleCaseSpawn",5,0,-16,-3)
	 PPFI A 0 A_PlaySound("orderpistol/fire", CHAN_WEAPON)
	 TNT1 A 0 A_SpawnItemEx("ShooterLight",0,0,0)
	 PPFI A 0 A_SetPitch(pitch-1.0)
	 DPIL B 1 bright A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	 PPFI A 0 A_SetPitch(pitch+0.6)
	 DPIL CDE 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	 Goto LIdle
  Spawn:
    PPSH F -1
    Stop
  }
}