
//Dusk damage chart (type: Dmg)
//SP: 150 (5x30)
//MP: 100 (5x20)

const int Winchester2Dmg = 5;
const int Winchester2SpreadHorz = 5.6;
const int Winchester2SpreadVert = 0;


//Double the shotguns, triple the fun.
ACTOR Dusk_Winchester2 : DuskWeapon //replaces shotgun
{
	Weapon.SelectionOrder 10
Weapon.Slotnumber 3
	Weapon.SisterWeapon Dusk_Winchester2_newammo

	Weapon.AmmoUse 1
	Weapon.AmmoGive 4//8
	Weapon.AmmoType "Shell"
	Weapon.UpSound "winchester/raise"

	Inventory.PickupMessage "$SHOT_PICK"
	Obituary "$SHOT2_OB"
	Tag "Winchester"
	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")

		W13C A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
	Deselect:
    TNT1 A 0 A_TakeInventory("SetWeaponMemory",50)
    TNT1 A 0 A_GiveInventory("SetWeaponMemory",6)
	DeselectLoop:
		TST1 AAA 0 A_Lower
		TST1 A 1 A_Lower
		Loop
	Select:
		TNT1 A 0 A_SetCrosshair(12)
    TNT1 A 0 A_TakeInventory("SetWeaponActual",50)
    TNT1 A 0 A_GiveInventory("SetWeaponActual",6)
//		TNT1 A 5 A_WeaponReady//(WRF_NOFIRE)
		W13A ABCDE 1 A_WeaponReady//(WRF_NOFIRE)
		Goto Ready


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

		W13D ABCDE 1 A_WeaponReady 
		W13D FGHIJKLMNOPQRSTUVWXY 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready



		
	Fire:
		W13F A 0 A_Gunflash		TNT1 A 0 A_GiveInventory("Player_WeaponShot",1)
		W13F 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")

			W13F A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W13H A 0
		"####" ABCD 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" EFGHIJKLMNOPQRSTUVW 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" XYZ 1 A_WeaponReady //(WRF_NOSWITCH)
			W13G A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W13I A 0
			"####" ABCDEF 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Stacked1:
			W13F A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W13H A 0
		"####" ABCD 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" EFGHIJKL 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" MNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
			W13G A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W13I A 0
			"####" ABCDEF 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Stacked2:
			W13F A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W13H A 0
		"####" ABCD 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" EF 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		"####" GHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
			W13G A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			W13I A 0
			"####" ABCDEF 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready








	Flash:
	TNT1 A 0 A_FireBullets (Winchester2SpreadHorz, Winchester2SpreadVert, 7, Winchester2Dmg, "WeaponPuff")
	FlashContinue:
	TNT1 A 0 A_PlaySound ("winchester/fire", CHAN_WEAPON)
	TNT1 A 0 ACS_NamedExecuteAlways("Weapon_Recoil", 0, 1, 0, 0)
		TNT1 A 3 A_Light2
		TNT1 A 4 A_Light1
		TNT1 A 7 A_Light0
	TNT1 A 1 A_JumpIf(CallACS("CasingsType")==1, "CasingSpawner")

//Sprites casings
			C13A A 0 A_JumpIfInventory("Weapon_Fireleft", 1, 2)
			C13B A 0
		"####" MNOPQRSTUVWXY 1
Goto LightDone


//Actor casings
	CasingSpawner:
		TNT1 A 0 A_JumpIfInventory("Weapon_Fireleft", 1, "CasingSpawner_Left")	 
		TNT1 A 0 A_FireCustomMissile("ShotgunCaseSpawn",5,0,-12,-6)//,10,0,2,6)
		Goto LightDone

	CasingSpawner_Left:
		TNT1 A 0 A_FireCustomMissile("ShotgunCaseSpawn",5,0,12,-6)//,-10,0,2,6)
		Goto LightDone


	Spawn:
		W03Z A -1
		Stop
	}
}


