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

const int WinchesterDmg = 5;
const int WinchesterSpreadHorz = 5.6;
const int WinchesterSpreadVert = 0;


//Swartzenibba's favourite gun.
ACTOR Dusk_Winchester : DuskWeapon //replaces shotgun
{
	Weapon.SelectionOrder 20
Weapon.Slotnumber 3
	Weapon.SisterWeapon Dusk_Winchester_newammo

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

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

	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("MultiplayerCheck",0,0,0,0) == 2,2)
TNT1 A 0 A_JumpIf(CallACS("ShotgunType")==1, "Ready_Old")

		W03C A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
	Deselect:
    TNT1 A 0 A_TakeInventory("SetWeaponMemory",50)
    TNT1 A 0 A_GiveInventory("SetWeaponMemory",5)
	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",5)
//		TNT1 A 6 A_WeaponReady//(WRF_NOFIRE)

	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("MultiplayerCheck",0,0,0,0) == 2,2)
TNT1 A 0 A_JumpIf(CallACS("ShotgunType")==1, "Select_Old")

		W03A ABCD 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")

	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("MultiplayerCheck",0,0,0,0) == 2,2)
TNT1 A 0 A_JumpIf(CallACS("ShotgunType")==1, "Reload_Old")
		W03D ABCDE 1 A_WeaponReady 
		W03D FGHIJKLMNOPQRSTUVW 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready
		



	Fire:
		W03F A 0 A_Gunflash		TNT1 A 0 A_GiveInventory("Player_WeaponShot",1)

	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("MultiplayerCheck",0,0,0,0) == 2,2)
TNT1 A 0 A_JumpIf(CallACS("ShotgunType")==1, "Fire_Old")

		W03F ABCD 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)

TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",31,	"Fire_Stacked2")
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",1,	"Fire_Stacked1")
		W03F EFGHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W03G ABCDEF 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		Goto Ready


	Fire_Stacked1:
		W03F EFGHIJKLMNOP 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W03F QRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		W03G ABCDEF 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Stacked2:
		W03F EFGH 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W03F IJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		W03G ABCDEF 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready








	Ready_Old:
		03WG K 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Goto Ready
	Select_Old:
		03WA ABCD 1 A_WeaponReady//(WRF_NOFIRE)
		03WA EFGHIJKLMNOP 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready




	Reload_Old://Spin weapon
		03WD BCDEF 1 A_WeaponReady 
		03WD FGHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Old:
		03WF ABCD 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)

TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",31,	"Fire_Old_Stacked2")
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",1,	"Fire_Old_Stacked1")
		03WF EFGHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		03WG ABCDEF 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		03WG GHIJ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Old_Stacked1:
		03WF EFGHIJKLMNOP 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		03WF QRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		03WG ABCDEFGHIJ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	Fire_Old_Stacked2:
		03WF EFGH 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		03WF IJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		03WG ABCDEFGHIJ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready




	Flash:
	TNT1 A 0 A_FireBullets (WinchesterSpreadHorz, WinchesterSpreadVert, 7, WinchesterDmg, "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")

//Sprite casings
		C03B A 0 A_JUMP(128, 2)
		C03A A 0
		"####" ABCDEFGHIJKLMNOPQR 1 
	Goto LightDone




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



	Spawn:
		W03Z A -1
		Stop
	}
}


