actor PulseMachinegun : Weapon
{
  Game Doom
  Weapon.SelectionOrder 1300
  weapon.ammotype "PulseMGClip"
  weapon.ammouse 1
  weapon.ammogive1 999
  weapon.ammogive2 999
  weapon.ammotype2 "PulseMGAmmo"
  Obituary "$OB_MPPISTOL" // "%o was tickled by %k's pea shooter."
  Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED" // "Picked up a pistol."
  States
  {
  Ready: 
	BRFG A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload")	
	BRFG A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    BRFG A 1 A_WeaponReady
    loop
  Deselect: 
    BRFG A 0 A_Lower
    BRFG A 0 A_Lower
    BRFG A 1 A_Lower
    loop
  Select:
    BRFG A 0 A_Raise
    BRFG A 0 A_Raise
    BRFG A 1 A_Raise
    loop
  Fire:
     BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
     BRFG A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
     BRFG A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletap")
     BRFG A 0 A_jumpifnoammo("Reload")
     BRFG A 2
	 BRFG A 0 A_playsound("Pulsefire")
	 BRFG B 3 A_FireBullets(7,7,1,random(1000,1000),"PulsePuff")
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 2
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 2 A_REFIRE
     BRFG A 0 A_jumpifnoammo("Reload")
	 goto ready
  Fire_deadshot:
     BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
     BRFG A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletapdeadshot")
     BRFG A 0 A_jumpifnoammo("Reload")
     BRFG A 2
	 BRFG A 0 A_playsound("Pulsefire")
	 BRFG B 3 A_FireBullets(2.5,2.5,1,random(1000,1000),"PulsePuff")
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 2
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 2 A_REFIRE
     BRFG A 0 A_jumpifnoammo("Reload")
	 goto ready
  Fire_Doubletapdeadshot:
     BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
     BRFG A 0 A_jumpifnoammo("Reload")
     BRFG A 1
	 BRFG A 0 A_playsound("Pulsefire")
	 BRFG B 2 A_FireBullets(2.5,2.5,1,random(1000,1000),"PulsePuff")
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 1
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 1 A_REFIRE
     BRFG A 0 A_jumpifnoammo("Reload")
	 goto ready
  Fire_Doubletap:
     BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
     BRFG A 0 A_jumpifnoammo("Reload")
     BRFG A 1
	 BRFG A 0 A_playsound("Pulsefire")
	 BRFG B 2 A_FireBullets(7,7,1,random(1000,1000),"PulsePuff")
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 1
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 1 A_REFIRE
     BRFG A 0 A_jumpifnoammo("Reload")
	 goto ready
  Reload:	
    BRFG A 0 A_takeinventory("IsReloading",1)
    BRFG A 0 A_jumpifinventory("SpeedCola",1,"Reload_speed")
    BRFG A 0 A_jumpifinventory("PulseMGclip",35,"ready")
	BRFG A 0 A_jumpifinventory("PulseMGammo",1,1)
	goto ready
    BRFG A 2 offset(0,40)
	BRFG A 2 offset(0,44)
	BRFG A 2 offset(0,48)
	BRFG A 2 offset(0,52)
	BRFG A 2 offset(0,56)
	BRFG A 2 offset(0,60)
	BRFG A 2 offset(0,64)
	BRFG A 20 offset(0,64)
	goto reload2
  Reload2:
    BRFG A 0 A_Giveinventory("PulseMGclip",1)
    BRFG A 0 A_Takeinventory("PulseMGammo",1)
    BRFG A 0 A_Jumpifinventory("PulseMGclip",35,"reloaddone")
    BRFG A 0 A_Jumpifinventory("PulseMGammo",1,"reload2")
	goto reloaddone
  Reloaddone:
	BRFG A 0 A_playsound("pulseout")
	BRFG A 20 offset(0,64)
	BRFG A 0 A_playsound("pulsein")
	BRFG A 20 offset(0,64)
	BRFG A 0 A_playsound("pulsebolt")
	BRFG A 20 offset(0,64)
	BRFG A 2 offset(0,60)
	BRFG A 2 offset(0,56)
	BRFG A 2 offset(0,52)
	BRFG A 2 offset(0,48)
	BRFG A 2 offset(0,44)
	BRFG A 2 offset(0,40)
    goto ready
  Reload_speed:	
    BRFG A 0 A_takeinventory("IsReloading",1)
    BRFG A 0 A_jumpifinventory("PulseMGclip",35,"ready")
	BRFG A 0 A_jumpifinventory("PulseMGammo",1,1)
	goto ready
    BRFG A 1 offset(0,40)
	BRFG A 1 offset(0,44)
	BRFG A 1 offset(0,48)
	BRFG A 1 offset(0,52)
	BRFG A 1 offset(0,56)
	BRFG A 1 offset(0,60)
	BRFG A 1 offset(0,64)
	BRFG A 10 offset(0,64)
	goto reload2_speed
  Reload2_speed:
    BRFG A 0 A_Giveinventory("PulseMGclip",1)
    BRFG A 0 A_Takeinventory("PulseMGammo",1)
    BRFG A 0 A_Jumpifinventory("PulseMGclip",35,"reloaddone_speed")
    BRFG A 0 A_Jumpifinventory("PulseMGammo",1,"reload2_speed")
	goto reloaddone_speed
  Reloaddone_speed:
	BRFG A 0 A_playsound("pulseout")
	BRFG A 10 offset(0,64)
	BRFG A 0 A_playsound("pulsein")
	BRFG A 10 offset(0,64)
	BRFG A 0 A_playsound("pulsebolt")
	BRFG A 10 offset(0,64)
	BRFG A 1 offset(0,60)
	BRFG A 1 offset(0,56)
	BRFG A 1 offset(0,52)
	BRFG A 1 offset(0,48)
	BRFG A 1 offset(0,44)
	BRFG A 1 offset(0,40)
    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 PulseMGClip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 35
    ammo.backpackamount 0
    ammo.backpackmaxamount 35
    +IGNORESKILL
}

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

ACTOR PulsePuff
{ 
    Mass 5
    Scale 0.15
    Radius 3
    Height 3
    +NOBLOCKMAP
    +NOGRAVITY
    +PUFFONACTORS
    Renderstyle Add
    Alpha 0.5
    States
    {
    Spawn:
      MICX ABCDEFG 1 BRIGHT
      Stop
    }
}

actor PAPPulseMachinegun : Weapon
{
  Game Doom
  Weapon.SelectionOrder 1300
  weapon.ammotype "PAPPulseMGClip"
  weapon.ammouse 1
  weapon.ammogive1 999
  weapon.ammogive2 999
  weapon.ammotype2 "PAPPulseMGAmmo"
  Obituary "$OB_MPPISTOL" // "%o was tickled by %k's pea shooter."
  Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED" // "Picked up a pistol."
  States
  {
  Ready: 
	BRFG A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload")	
	BRFG A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    BRFG A 1 A_WeaponReady
    loop
  Deselect: 
    BRFG A 0 A_Lower
    BRFG A 0 A_Lower
    BRFG A 1 A_Lower
    loop
  Select:
    BRFG A 0 A_Raise
    BRFG A 0 A_Raise
    BRFG A 1 A_Raise
    loop
  Fire:
     BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
     BRFG A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
     BRFG A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletap")
     BRFG A 0 A_jumpifnoammo("Reload")
     BRFG A 2
	 BRFG A 0 A_playsound("Pulsefire")
	 BRFG B 3 A_FireBullets(5,5,1,random(2000,2000),"PulsePuff")
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 2
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 2 A_REFIRE
     BRFG A 0 A_jumpifnoammo("Reload")
	 goto ready
  Fire_deadshot:
     BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
     BRFG A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletapdeadshot")
     BRFG A 0 A_jumpifnoammo("Reload")
     BRFG A 2
	 BRFG A 0 A_playsound("Pulsefire")
	 BRFG B 3 A_FireBullets(1,1,1,random(2000,2000),"PulsePuff")
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 2
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 2 A_REFIRE
     BRFG A 0 A_jumpifnoammo("Reload")
	 goto ready
  Fire_Doubletapdeadshot:
     BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
     BRFG A 0 A_jumpifnoammo("Reload")
     BRFG A 1
	 BRFG A 0 A_playsound("Pulsefire")
	 BRFG B 2 A_FireBullets(1,1,1,random(2000,2000),"PulsePuff")
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 1
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 1 A_REFIRE
     BRFG A 0 A_jumpifnoammo("Reload")
	 goto ready
  Fire_Doubletap:
     BRFG A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
     BRFG A 0 A_jumpifnoammo("Reload")
     BRFG A 1
	 BRFG A 0 A_playsound("Pulsefire")
	 BRFG B 2 A_FireBullets(5,5,1,random(2000,2000),"PulsePuff")
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 1
     BRFG A 0 A_jumpifnoammo("Reload")
	 BRFG C 1 A_REFIRE
     BRFG A 0 A_jumpifnoammo("Reload")
	 goto ready
  Reload:	
    BRFG A 0 A_takeinventory("IsReloading",1)
    BRFG A 0 A_jumpifinventory("SpeedCola",1,"Reload_speed")
    BRFG A 0 A_jumpifinventory("PAPPulseMGclip",50,"ready")
	BRFG A 0 A_jumpifinventory("PAPPulseMGammo",1,1)
	goto ready
    BRFG A 2 offset(0,40)
	BRFG A 2 offset(0,44)
	BRFG A 2 offset(0,48)
	BRFG A 2 offset(0,52)
	BRFG A 2 offset(0,56)
	BRFG A 2 offset(0,60)
	BRFG A 2 offset(0,64)
	BRFG A 20 offset(0,64)
	goto reload2
  Reload2:
    BRFG A 0 A_Giveinventory("PAPPulseMGclip",1)
    BRFG A 0 A_Takeinventory("PAPPulseMGammo",1)
    BRFG A 0 A_Jumpifinventory("PAPPulseMGclip",50,"reloaddone")
    BRFG A 0 A_Jumpifinventory("PAPPulseMGammo",1,"reload2")
	goto reloaddone
  Reloaddone:
	BRFG A 0 A_playsound("pulseout")
	BRFG A 20 offset(0,64)
	BRFG A 0 A_playsound("pulsein")
	BRFG A 20 offset(0,64)
	BRFG A 0 A_playsound("pulsebolt")
	BRFG A 20 offset(0,64)
	BRFG A 2 offset(0,60)
	BRFG A 2 offset(0,56)
	BRFG A 2 offset(0,52)
	BRFG A 2 offset(0,48)
	BRFG A 2 offset(0,44)
	BRFG A 2 offset(0,40)
    goto ready
  Reload_speed:	
    BRFG A 0 A_takeinventory("IsReloading",1)
    BRFG A 0 A_jumpifinventory("PAPPulseMGclip",50,"ready")
	BRFG A 0 A_jumpifinventory("PAPPulseMGammo",1,1)
	goto ready
    BRFG A 1 offset(0,40)
	BRFG A 1 offset(0,44)
	BRFG A 1 offset(0,48)
	BRFG A 1 offset(0,52)
	BRFG A 1 offset(0,56)
	BRFG A 1 offset(0,60)
	BRFG A 1 offset(0,64)
	BRFG A 10 offset(0,64)
	goto reload2_speed
  Reload2_speed:
    BRFG A 0 A_Giveinventory("PAPPulseMGclip",1)
    BRFG A 0 A_Takeinventory("PAPPulseMGammo",1)
    BRFG A 0 A_Jumpifinventory("PAPPulseMGclip",50,"reloaddone_speed")
    BRFG A 0 A_Jumpifinventory("PAPPulseMGammo",1,"reload2_speed")
	goto reloaddone_speed
  Reloaddone_speed:
	BRFG A 0 A_playsound("pulseout")
	BRFG A 10 offset(0,64)
	BRFG A 0 A_playsound("pulsein")
	BRFG A 10 offset(0,64)
	BRFG A 0 A_playsound("pulsebolt")
	BRFG A 10 offset(0,64)
	BRFG A 1 offset(0,60)
	BRFG A 1 offset(0,56)
	BRFG A 1 offset(0,52)
	BRFG A 1 offset(0,48)
	BRFG A 1 offset(0,44)
	BRFG A 1 offset(0,40)
    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 PAPPulseMGClip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 50
    ammo.backpackamount 0
    ammo.backpackmaxamount 50
    +IGNORESKILL
}

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