ACTOR MP7 : Weapon
{
  Game Doom
  Weapon.SelectionOrder 100  
  weapon.ammotype "MP7Clip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "MP7Ammo"
  +AMMO_OPTIONAL
  States
  {
  Ready: 
	MP7S A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload")	
	MP7S A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    MP7S A 1 A_WeaponReady
    loop
  Deselect:
    MP7S A 0 A_Lower
    MP7S A 0 A_Lower
    MP7S A 1 A_Lower
    Loop
  Select:
    MP7S A 0 A_Raise
    MP7S A 0 A_Raise
    MP7S A 1 A_Raise
    Loop
  Fire:
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    MP7S A 0 A_jumpifinventory("doubletap",1,"Fire_doubletap")
    MP7S A 1
	MP7S B 0 A_Gunflash
	MP7S B 0 A_PlaySound("mp7/fire")
    MP7S B 0 A_FireBullets(5.5,5.5,1,random(800,800),"bulletPuff",0)
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,3,2)
    MP7S B 0 A_TakeInventory("MP7Clip",1)
    MP7S B 1 
    MP7S C 2
    MP7S C 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 2 A_ReFire
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S B 0 A_JumpIfNoAmmo("reload") 
    Goto Ready
  Fire_deadshot:
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_jumpifinventory("doubletap",1,"Fire_doubletapdeadshot")
    MP7S A 1
	MP7S B 0 A_Gunflash
	MP7S B 0 A_PlaySound("mp7/fire")
    MP7S B 0 A_FireBullets(3,2.5,1,random(800,800),"bulletPuff",0)
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,3,2)
    MP7S B 0 A_TakeInventory("MP7Clip",1)
    MP7S B 1 
    MP7S C 2
    MP7S C 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 2 A_ReFire
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S B 0 A_JumpIfNoAmmo("reload") 
    Goto Ready
  Fire_doubletapdeadshot:
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 0 A_JumpIfNoAmmo("reload") 
    MP7S A 1
	MP7S B 0 A_Gunflash
	MP7S B 0 A_PlaySound("mp7/fire")
    MP7S B 0 A_FireBullets(3,2.5,1,random(800,800),"bulletPuff",0)
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,3,2)
    MP7S B 0 A_TakeInventory("MP7Clip",1)
    MP7S B 1 
    MP7S C 1
    MP7S C 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 1 A_ReFire
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S B 0 A_JumpIfNoAmmo("reload") 
    Goto Ready
  Fire_doubletap:
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 0 A_JumpIfNoAmmo("reload") 
    MP7S A 1
	MP7S B 0 A_Gunflash
	MP7S B 0 A_PlaySound("mp7/fire")
    MP7S B 0 A_FireBullets(5.5,5.5,1,random(800,800),"bulletPuff",0)
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,3,2)
    MP7S B 0 A_TakeInventory("MP7Clip",1)
    MP7S B 1 
    MP7S C 1
    MP7S C 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 1 A_ReFire
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S B 0 A_JumpIfNoAmmo("reload") 
    Goto Ready
  Reload:
	MP7S A 0 A_TakeInventory("IsReloading",1)
    MP7S A 0 A_jumpifinventory("Speedcola", 1,"Reload_speed")
    MP7S A 0 A_jumpifinventory("MP7clip", 30,"ready")
	MP7S A 0 A_jumpifinventory("MP7Ammo", 1, 1)
	goto ready+1
	MP7S G 0 A_playsound("MP7/clipout")
	MP7S A 2 offset(0,38)
	MP7S A 2 offset(0,42)
	MP7S A 2 offset(0,46)
	MP7S A 2 offset(0,50)
	MP7S A 2 offset(0,54)
	MP7S A 2 offset(0,58)
	MP7S A 2 offset(0,62)
	MP7S A 2 offset(0,66)
    Goto Reload2
  Reload2:
    MP7S A 0 A_Giveinventory("MP7Clip",1)
	MP7S A 0 A_Takeinventory("MP7ammo",1)
    MP7S A 0 A_jumpifinventory("MP7clip",30,"reloaddone")
	MP7S A 0 A_jumpifinventory("MP7ammo",1,"reload2")
	goto reloaddone
  Reloaddone:
    MP7S A 0 A_playsound("MP7/clipin")
	MP7S A 25 offset(0,66)
	MP7S A 0 A_playsound("MP7/bolt")
	MP7S A 10 offset(0,66)
	MP7S A 2 offset(0,66)
	MP7S A 2 offset(0,62)
	MP7S A 2 offset(0,58)
	MP7S A 2 offset(0,54)
	MP7S A 2 offset(0,50)
	MP7S A 2 offset(0,46)
	MP7S A 2 offset(0,42)
	MP7S A 2 offset(0,38)
	goto ready
  Reload_speed:
	MP7S A 0 A_TakeInventory("IsReloading",1)
    MP7S A 0 A_jumpifinventory("MP7clip", 30,"ready")
	MP7S A 0 A_jumpifinventory("MP7Ammo", 1, 1)
	goto ready+1
	MP7S G 0 A_playsound("MP7/clipout")
	MP7S A 1 offset(0,38)
	MP7S A 1 offset(0,42)
	MP7S A 1 offset(0,46)
	MP7S A 1 offset(0,50)
	MP7S A 1 offset(0,54)
	MP7S A 1 offset(0,58)
	MP7S A 1 offset(0,62)
	MP7S A 1 offset(0,66)
    Goto Reload2_speed
  Reload2_speed:
    MP7S A 0 A_Giveinventory("MP7Clip",1)
	MP7S A 0 A_Takeinventory("MP7ammo",1)
    MP7S A 0 A_jumpifinventory("MP7clip",30,"reloaddone_speed")
	MP7S A 0 A_jumpifinventory("MP7ammo",1,"reload2_speed")
	goto reloaddone_speed
  Reloaddone_speed:
    MP7S A 0 A_playsound("MP7/clipin")
	MP7S A 12 offset(0,66)
	MP7S A 0 A_playsound("MP7/bolt")
	MP7S A 5 offset(0,66)
	MP7S A 1 offset(0,66)
	MP7S A 1 offset(0,62)
	MP7S A 1 offset(0,58)
	MP7S A 1 offset(0,54)
	MP7S A 1 offset(0,50)
	MP7S A 1 offset(0,46)
	MP7S A 1 offset(0,42)
	MP7S A 1 offset(0,38)
	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
	 }
}

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

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

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

ACTOR PAPMP7 : Weapon
{
  Game Doom
  Weapon.SelectionOrder 100  
  weapon.ammotype "PAPMP7Clip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "PAPMP7Ammo"
  +AMMO_OPTIONAL
  States
  {
  Ready: 
	MP7S A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload")	
	MP7S A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    MP7S A 1 A_WeaponReady
    loop
  Deselect:
    MP7S A 0 A_Lower
    MP7S A 0 A_Lower
    MP7S A 1 A_Lower
    Loop
  Select:
    MP7S A 0 A_Raise
    MP7S A 0 A_Raise
    MP7S A 1 A_Raise
    Loop
  Fire:
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    MP7S A 0 A_jumpifinventory("doubletap",1,"Fire_doubletap")
    MP7S A 1
	MP7S B 0 A_Gunflash
	MP7S B 0 A_PlaySound("mp7/fire")
    MP7S B 0 A_FireBullets(3,3.5,1,random(1650,1650),"bulletPuff",0)
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,3,2)
    MP7S B 0 A_TakeInventory("PAPMP7Clip",1)
    MP7S B 1 
    MP7S C 2
    MP7S C 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 1 A_ReFire
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S B 0 A_JumpIfNoAmmo("reload") 
    Goto Ready
  Fire_deadshot:
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_jumpifinventory("doubletap",1,"Fire_doubletapdeadshot")
    MP7S A 1
	MP7S B 0 A_Gunflash
	MP7S B 0 A_PlaySound("mp7/fire")
    MP7S B 0 A_FireBullets(1,1.5,1,random(1650,1650),"bulletPuff",0)
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,3,2)
    MP7S B 0 A_TakeInventory("PAPMP7Clip",1)
    MP7S B 1 
    MP7S C 2
    MP7S C 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 1 A_ReFire
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S B 0 A_JumpIfNoAmmo("reload") 
    Goto Ready
  Fire_doubletapdeadshot:
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 0 A_JumpIfNoAmmo("reload") 
    MP7S A 1
	MP7S B 0 A_Gunflash
	MP7S B 0 A_PlaySound("mp7/fire")
    MP7S B 0 A_FireBullets(1,1.5,1,random(1650,1650),"bulletPuff",0)
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,3,2)
    MP7S B 0 A_TakeInventory("PAPMP7Clip",1)
    MP7S B 1 
    MP7S C 1
    MP7S C 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 1 A_ReFire
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S B 0 A_JumpIfNoAmmo("reload") 
    Goto Ready
  Fire_doubletap:
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 0 A_JumpIfNoAmmo("reload") 
    MP7S A 1
	MP7S B 0 A_Gunflash
	MP7S B 0 A_PlaySound("mp7/fire")
    MP7S B 0 A_FireBullets(3,3.5,1,random(1650,1650),"bulletPuff",0)
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,3,2)
    MP7S B 0 A_TakeInventory("PAPMP7Clip",1)
    MP7S B 1 
    MP7S C 1
    MP7S C 0 A_JumpIfNoAmmo("reload") 
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S A 1 A_ReFire
    MP7S A 0 A_JumpIfInventory("IsReloading",1,"Reload") 	
    MP7S B 0 A_JumpIfNoAmmo("reload") 
    Goto Ready
  Reload:
	MP7S A 0 A_TakeInventory("IsReloading",1)
    MP7S A 0 A_jumpifinventory("Speedcola", 1,"Reload_speed")
    MP7S A 0 A_jumpifinventory("PAPMP7clip", 45,"ready")
	MP7S A 0 A_jumpifinventory("PAPMP7Ammo", 1, 1)
	goto ready+1
	MP7S G 0 A_playsound("MP7/clipout")
	MP7S A 2 offset(0,38)
	MP7S A 2 offset(0,42)
	MP7S A 2 offset(0,46)
	MP7S A 2 offset(0,50)
	MP7S A 2 offset(0,54)
	MP7S A 2 offset(0,58)
	MP7S A 2 offset(0,62)
	MP7S A 2 offset(0,66)
    Goto Reload2
  Reload2:
    MP7S A 0 A_Giveinventory("PAPMP7Clip",1)
	MP7S A 0 A_Takeinventory("PAPMP7ammo",1)
    MP7S A 0 A_jumpifinventory("PAPMP7clip",45,"reloaddone")
	MP7S A 0 A_jumpifinventory("PAPMP7ammo",1,"reload2")
	goto reloaddone
  Reloaddone:
    MP7S A 0 A_playsound("MP7/clipin")
	MP7S A 25 offset(0,66)
	MP7S A 0 A_playsound("MP7/bolt")
	MP7S A 10 offset(0,66)
	MP7S A 2 offset(0,66)
	MP7S A 2 offset(0,62)
	MP7S A 2 offset(0,58)
	MP7S A 2 offset(0,54)
	MP7S A 2 offset(0,50)
	MP7S A 2 offset(0,46)
	MP7S A 2 offset(0,42)
	MP7S A 2 offset(0,38)
	goto ready
  Reload_speed:
	MP7S A 0 A_TakeInventory("IsReloading",1)
    MP7S A 0 A_jumpifinventory("PAPMP7clip", 45,"ready")
	MP7S A 0 A_jumpifinventory("PAPMP7Ammo", 1, 1)
	goto ready+1
	MP7S G 0 A_playsound("MP7/clipout")
	MP7S A 1 offset(0,38)
	MP7S A 1 offset(0,42)
	MP7S A 1 offset(0,46)
	MP7S A 1 offset(0,50)
	MP7S A 1 offset(0,54)
	MP7S A 1 offset(0,58)
	MP7S A 1 offset(0,62)
	MP7S A 1 offset(0,66)
    Goto Reload2_speed
  Reload2_speed:
    MP7S A 0 A_Giveinventory("PAPMP7Clip",1)
	MP7S A 0 A_Takeinventory("PAPMP7ammo",1)
    MP7S A 0 A_jumpifinventory("PAPMP7clip",45,"reloaddone_speed")
	MP7S A 0 A_jumpifinventory("PAPMP7ammo",1,"reload2_speed")
	goto reloaddone_speed
  Reloaddone_speed:
    MP7S A 0 A_playsound("MP7/clipin")
	MP7S A 12 offset(0,66)
	MP7S A 0 A_playsound("MP7/bolt")
	MP7S A 5 offset(0,66)
	MP7S A 1 offset(0,66)
	MP7S A 1 offset(0,62)
	MP7S A 1 offset(0,58)
	MP7S A 1 offset(0,54)
	MP7S A 1 offset(0,50)
	MP7S A 1 offset(0,46)
	MP7S A 1 offset(0,42)
	MP7S A 1 offset(0,38)
	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
	 }
}

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