
//Dusk damage chart (type: Dmg)
//SP: 25
//MP: 20

const int Pistol2Dmg = 5;
const int Pistol2SpreadHorz = 5.6;
const int Pistol2SpreadVert = 0;


//Akimbo pistols. Give him two guns and he's god.
ACTOR Dusk_Pistol2 : DuskWeapon //replaces pistol
{
	Weapon.SelectionOrder 70
Weapon.Slotnumber 2
	Weapon.SisterWeapon Dusk_Pistol2_newammo

	Weapon.AmmoUse 1
	Weapon.AmmoGive 12//20
	Weapon.AmmoType "Clip"
	Weapon.UpSound "Pistol/raise"

	Inventory.PickupMessage "$PIST_PICK"
	Obituary "$PIST2_OB"
	Tag "Pistol"
	States
	{
	Ready:
TNT1 A 0 A_JumpIfInventory("Doosk_ExplosiveBarrelWeapon",1,"Select_Barrel")
TNT1 A 0 A_JumpIfInventory("Doosk_HereticBarrelWeapon",1,"Select_HereticBarrel")
TNT1 A 0 A_JumpIfInventory("Doosk_SoapWeapon",1,"Select_Soap")

		W12C A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
	Deselect:
    TNT1 A 0 A_TakeInventory("SetWeaponMemory",50)
    TNT1 A 0 A_GiveInventory("SetWeaponMemory",4)
	DeselectLoop:
		TST1 AAA 0 A_Lower
		TST1 A 1 A_Lower
		Loop
	Select:
		TNT1 A 0 A_SetCrosshair(11)
    TNT1 A 0 A_TakeInventory("SetWeaponActual",50)
    TNT1 A 0 A_GiveInventory("SetWeaponActual",4)
//		TNT1 A 0 A_WeaponReady(WRF_NOFIRE)
		W12A ABCDEFGHIJKLMN 1 A_WeaponReady//(WRF_NOFIRE)
		Goto Ready


	Reload://Weapon spin
	TNT1 A 0 A_PlaySound("sickles/fire")
		W01G A 0 A_CustomPunch(2 * random(1, 10), TRUE, 0, "MeleePuff")

		W12D ABCDE 1 A_WeaponReady //(WRF_ALLOWRELOAD)
		W12D FGHIJKLMNOPQRSTUVWXY 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


		
	Fire:
		W12F A 0 A_Gunflash		TNT1 A 0 A_GiveInventory("Player_WeaponShot",1)
		TNT1 A 0 A_JumpIfInventory("Weapon_Fireleft", 1, "Fire_Left")	 

        TNT1 A 0 A_GiveInventory("Weapon_Fireleft", 1)
		Goto Fire_Continue
		
	Fire_Left:
        TNT1 A 0 A_TakeInventory("Weapon_Fireleft", 2)
		Goto Fire_Continue


	Fire_Continue:
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",31,	"Fire_Stacked2")
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",1,	"Fire_Stacked1")

			W12F A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W12H A 0
		"####" ABCDEF 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" GHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
			W12G A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W12I A 0
			"####" ABCDEFGHIJ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Stacked1:
			W12F A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W12H A 0
		"####" ABC 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" DEF 1 bright A_WeaponReady (WRF_ALLOWRELOAD)
		"####" GHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
			W12G A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W12I A 0
			"####" ABCDEFGHIJ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Stacked2:
			W12F A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W12H A 0
		"####" AB 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" CDEF 1 bright A_WeaponReady (WRF_ALLOWRELOAD)
		"####" GHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
			W12G A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W12I A 0
			"####" ABCDEFGHIJ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready





	Flash:
		TNT1 A 0 A_FireBullets (Pistol2SpreadHorz, Pistol2SpreadVert, -1, Pistol2Dmg, "WeaponPuff")
	FlashContinue:
		TNT1 A 0 A_PlaySound("Pistol/fire", CHAN_WEAPON)
	TNT1 A 0 ACS_NamedExecuteAlways("Weapon_Recoil", 0, 4, 0, 0)

	TNT1 A 1 A_JumpIf(CallACS("CasingsType")==1, "CasingSpawner")
//Sprites casings
			C12B A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			C12A A 0
		"####" ABC 1 A_Light2
		"####" DEFG 1 A_Light1
		"####" A 0 A_Light0
		"####" HIJKLMNOPQRS 1 
Goto LightDone	


//Actor casings
	CasingSpawner:
			C12B A 0 A_JumpIfInventory("Weapon_Fireleft", 1, "CasingSpawner_Left")
		TNT1 A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,12,-10)//,-10,0,3,6)
		Goto CasingSpawner_Common

	CasingSpawner_Left:
		TNT1 A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,-12,-10)//,-10,0,-3,6)
		Goto CasingSpawner_Common

	CasingSpawner_Common:
	TNT1 A 3 A_Light2
	TNT1 A 4 A_Light1
	TNT1 A 0 A_Light0
		Goto LightDone



	Spawn:
		W02Z A -1
		Stop
	}
}


