actor Revolver : Weapon
{
  Game Doom
  Weapon.SelectionOrder 1600
  weapon.ammotype "RevolverClip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "RevolverAmmo"
  Weapon.KickBack 75
  Obituary "$OB_MPPISTOL" // "%o was tickled by %k's pea shooter."
  Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED" // "Picked up a pistol."
 +AMMO_OPTIONAL
 +NOAUTOFIRE
  States
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload")  
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    REVO A 1 A_WeaponReady
    Loop
  Deselect: 
    REVO A 0 A_Lower
    REVO A 0 A_Lower
    REVO A 1 A_Lower
    loop
  Select:
    REVO A 0 A_Raise
    REVO A 0 A_Raise
    REVO A 1 A_Raise
    loop
  Fire:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    REVO A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    REVO A 0 A_jumpifinventory("doubletap",1,"Fire_doubletap")
    REVO A 5
	REVO B 0 A_Gunflash
	REVO B 0 A_PlaySound("REV/fire")
    REVO B 0 A_FireBullets(3,3,1,random(950,950),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    REVO B 7
    REVO A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_deadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    REVO A 0 A_jumpifinventory("doubletap",1,"Fire_doubletapdeadshot")
    REVO A 5
	REVO B 0 A_Gunflash
	REVO B 0 A_PlaySound("REV/fire")
    REVO B 0 A_FireBullets(1.3,1.2,1,random(950,950),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    REVO B 7
    REVO A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_doubletap:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    REVO A 2
	REVO B 0 A_Gunflash
	REVO B 0 A_PlaySound("REV/fire")
    REVO B 0 A_FireBullets(3,3,1,random(950,950),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    REVO B 4
    REVO A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_doubletapdeadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    REVO A 2
	REVO B 0 A_Gunflash
	REVO B 0 A_PlaySound("REV/fire")
    REVO B 0 A_FireBullets(1.3,1.2,1,random(950,950),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    REVO B 4
    REVO A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Reload:
	AUG1 A 0 A_TakeInventory("IsReloading",1)
    REVE A 0 A_jumpifinventory("SpeedCola",1,"Reload_speed")
	REVE A 0 A_jumpifInventory("Revolverclip",6,"Ready")
    REVE A 0 A_JumpIfInventory("RevolverAmmo", 1, 1)
	goto ready+1
	REVE A 0 A_playsound("REV/clipout")
	REVE ABCDEFGH 2
	REVE I 20
	goto Reload2
  Reload2:
	REVE A 0 A_giveinventory("Revolverclip",1)
	REVE A 0 A_takeinventory("Revolverammo",1)
	REVE A 0 A_jumpifInventory("Revolverclip",6,"Reloaddone")
    REVE A 0 A_JumpIfInventory("RevolverAmmo", 1, "reload2")
	goto reloaddone
  Reloaddone:
	REVE I 0 A_playsound("REV/clipin")
    REVE I 15
	REVE I 0 A_playsound("REV/bolt")
    REVE I 10
	REVE IHGFEDCBA 2
	goto Ready
  Reload_speed:
	REVE A 0 A_jumpifInventory("Revolverclip",6,"Ready")
    REVE A 0 A_JumpIfInventory("RevolverAmmo", 1, 1)
	goto ready+1
	REVE A 0 A_playsound("REV/clipout")
	REVE ABCDEFGH 1
	REVE I 10
	goto Reload2_speed
  Reload2_speed:
	REVE A 0 A_giveinventory("Revolverclip",1)
	REVE A 0 A_takeinventory("Revolverammo",1)
	REVE A 0 A_jumpifInventory("Revolverclip",6,"Reloaddone_speed")
    REVE A 0 A_JumpIfInventory("RevolverAmmo", 1, "reload2_speed")
	goto reloaddone_speed
  Reloaddone_speed:
	REVE I 0 A_playsound("REV/clipin")
    REVE I 7
	REVE I 0 A_playsound("REV/bolt")
    REVE I 5
	REVE IHGFEDCBA 1
	goto Ready
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Flash:
    TNTT A 2 Bright A_Light1
    Goto LightDone
  Spawn:
    REVP A -1
    Stop
  }
}

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

actor RevolverAmmo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 6
    inventory.maxamount 80
    ammo.backpackamount 6
    ammo.backpackmaxamount 80
    +IGNORESKILL
    inventory.pickupmessage "Got Pistol! rounds!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}

actor PAPRevolverAmmo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 12
    inventory.maxamount 144
    ammo.backpackamount 12
    ammo.backpackmaxamount 144
    +IGNORESKILL
    inventory.pickupmessage "Got Pistol! rounds!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}


actor PAPRevolver : Weapon
{
  Game Doom
  Weapon.SelectionOrder 1900
  weapon.ammotype "PAPRevolverClip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "PAPRevolverAmmo"
  Obituary "$OB_MPPISTOL" // "%o was tickled by %k's pea shooter."
  Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED" // "Picked up a pistol."
   +AMMO_OPTIONAL
 +NOAUTOFIRE
  States
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife") 
    REVO A 1 A_WeaponReady
    Loop
  Deselect: 
    REVO A 0 A_Lower
    REVO A 0 A_Lower
    REVO A 1 A_Lower
    loop
  Select:
    REVO A 0 A_Raise
    REVO A 0 A_Raise
    REVO A 1 A_Raise
    loop
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Fire:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    REVO A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    REVO A 0 A_jumpifinventory("doubletap",1,"Fire_doubletap")
    REVO A 2
	REVO B 0 A_Gunflash
	REVO B 0 A_PlaySound("REV/fire")
    REVO B 0 A_FireBullets(2.2,2.1,1,random(1950,1950),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    REVO B 3 
    REVO A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_deadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    REVO A 0 A_jumpifinventory("doubletap",1,"Fire_doubletapdeadshot")
    REVO A 2
	REVO B 0 A_Gunflash
	REVO B 0 A_PlaySound("REV/fire")
    REVO B 0 A_FireBullets(1,1,1,random(1950,1950),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    REVO B 3 
    REVO A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_doubletap:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    REVO A 1
	REVO B 0 A_Gunflash
	REVO B 0 A_PlaySound("REV/fire")
    REVO B 0 A_FireBullets(2.2,2.1,1,random(1950,1950),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    REVO B 2
    REVO A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_doubletapdeadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    REVO A 1
	REVO B 0 A_Gunflash
	REVO B 0 A_PlaySound("REV/fire")
    REVO B 0 A_FireBullets(1,1,1,random(1950,1950),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
    REVO B 2
    REVO A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    REVO A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Reload:
	AUG1 A 0 A_TakeInventory("IsReloading",1)
    REVE A 0 A_jumpifinventory("SpeedCola",1,"Reload_speed")
	REVE A 0 A_jumpifInventory("PAPRevolverclip",12,"Ready")
    REVE A 0 A_JumpIfInventory("PAPRevolverAmmo", 1, 1)
	goto ready+1
	REVE A 0 A_playsound("REV/clipout")
	REVE ABCDEFGH 2
	REVE I 20
	goto Reload2
  Reload2:
	REVE A 0 A_giveinventory("PAPRevolverclip",1)
	REVE A 0 A_takeinventory("PAPRevolverammo",1)
	REVE A 0 A_jumpifInventory("PAPRevolverclip",12,"Reloaddone")
    REVE A 0 A_JumpIfInventory("PAPRevolverAmmo", 1, "reload2")
	goto reloaddone
  Reloaddone:
	REVE I 0 A_playsound("REV/clipin")
    REVE I 15
	REVE I 0 A_playsound("REV/bolt")
    REVE I 10
	REVE IHGFEDCBA 2
	goto Ready
  Reload_speed:
	REVE A 0 A_jumpifInventory("PAPRevolverclip",12,"Ready")
    REVE A 0 A_JumpIfInventory("PAPRevolverAmmo", 1, 1)
	goto ready+1
	REVE A 0 A_playsound("REV/clipout")
	REVE ABCDEFGH 1
	REVE I 10
	goto Reload2_speed
  Reload2_speed:
	REVE A 0 A_giveinventory("PAPRevolverclip",1)
	REVE A 0 A_takeinventory("PAPRevolverammo",1)
	REVE A 0 A_jumpifInventory("PAPRevolverclip",12,"Reloaddone_speed")
    REVE A 0 A_JumpIfInventory("PAPRevolverAmmo", 1, "reload2_speed")
	goto reloaddone_speed
  Reloaddone_speed:
	REVE I 0 A_playsound("REV/clipin")
    REVE I 7
	REVE I 0 A_playsound("REV/bolt")
    REVE I 5
	REVE IHGFEDCBA 1
	goto Ready
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Flash:
    TNTT A 2 Bright A_Light1
    Goto LightDone
  Spawn:
    REVP A -1
    Stop
  }
}

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