ACTOR GE007DD44 : Weapon
{
  Weapon.Kickback 100
  Scale 0.1
        Weapon.Ammotype1 "DD44Clip"
    Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
	Weapon.AmmoGive2 8
	Weapon.AmmoType2 "GE007PistolAmmo"
	  +WEAPON.AMMO_OPTIONAL
  Inventory.PickupMessage "Picked up a DD44 Dostovei."
  Tag "DD44 Dostovei"
  Obituary  "%o was stopped in his tracks by %k's DD44 Dostovei."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
  States
  {
  Spawn:
    TKA1 E -1
    Loop
  Ready:
  TNT1 A 0 A_PlaySound ("GE007/Weapons/WeaponSFX1","Weapon")
    TK17 A 1 
    TK17 B 1
    TK17 C 1
    TK17 D 1
    TK17 EFGHIJKLMO 1
    TK17 P -1 A_WeaponReady
	goto ReloadCheck
	TK17 P 1 A_WeaponReady
    Goto Ready+6	
	
	
		  ReloadCheck:
	 KLBG A 0 A_JumpIfInventory("DD44Clip",8,2)
	 KLBG A 0 A_JumpIfInventory("GE007PistolAmmo",1,"ReloadStart")
	 KLBG A 0
	 goto Ready+15

  ReloadStart:
	 KLBR A 0 A_PlayWeaponSound("GE007/Weapons/Reload")
     TK17 MLKJIHGFEDCBA 1
	 TNT1 A 5
	 goto ReloadAmmo

  ReloadAmmo:
	 TNT1 A 0 A_TakeInventory("GE007PistolAmmo",1)
	 TNT1 A 0 A_GiveInventory("DD44Clip",1)
	 TNT1 A 0 A_JumpIfInventory("DD44Clip",8,"ReloadDone")
	 TNT1 A 0 A_JumpIfInventory("GE007PistolAmmo",1,"ReloadAmmo")
	 goto ReloadDone
	 
	 ReloadDone:
	 TNT1 A 5
	 TK17 ABCDEFGHIJKLMOP 1
	 goto Ready+15
	
  Deselect:
    TK17 MLKJIHGFEDCB 1
    TK17 A 1
    TK08 A 0 A_Lower
    wait
  Select: 
    TK08 A 0 A_Raise 
    Loop  
  Fire: 
    KLBG A 0 A_JumpIfNoAmmo("ReloadCheck")
 	TNT1 A 0 A_PlaySound ("GE007/Weapons/DD44","Weapon")
    TK17 Q 1 BRIGHT A_FireBullets (1, 1.2, -1, 19, "BulletPuff",FBF_USEAMMO|FBF_NORANDOM)
	PP7G B 0 BRIGHT A_SpawnItemEx ("GE007BulletCasing", 30,cos(pitch)*12,sin(-pitch)*10+30, frandom(0.5,1.2),frandom(0.5,1.2),frandom(1.5,2.5))
	TK17 RSTUV 1
	TK17 XYZ 1
	TK18 ABC 1 A_REFIRE
	TK18 DE 1
    Goto Ready+15
		AltFire:
		TK04 A 0
		goto ReloadCheck
  }
}

ACTOR DD44Clip : Ammo
{
Inventory.MaxAmount 8 // size of the clip
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 8 //MUST be the same as Inventory.MaxAmmount
+INVENTORY.IGNORESKILL
}

ACTOR GE007DD44Pickup : Custominventory
{
   Scale 0.1
  Inventory.PickupMessage "Picked up a DD44 Dostovei."
  	Inventory.PickupSound "GE007/Weapons/WeaponSFX1"
   States
   {
   Spawn:
	  TKA4 P -1
	  loop
   Pickup:
	  TNT1 A 0 A_GiveInventory("GE007DD44")
	  stop
   }
}
