
//Dusk damage chart (type: Dmg)
//SP: 400 (2x200)
//MP: 100 (2x50)


//Fires two bullets at the same time. Not a bug.
ACTOR Dusk_Sniper_newammo : DuskWeapon //replaces chainsaw
{
	+POWERED_UP 
	Weapon.SisterWeapon Dusk_Sniper

	+NOALERT
//	+weapon.bfg
	Weapon.SelectionOrder 60
Weapon.Slotnumber 6
//	Weapon.SisterWeapon Dusk_Sniper_Fastfire

	Weapon.AmmoUse 1
	Weapon.AmmoGive 5
	Weapon.AmmoType "Dusk_Wep6Ammo"
	Weapon.UpSound "sniper/raise"

	Inventory.PickupMessage "$SNIP_PICK"
	Obituary "$SNIP_OB"
	Tag "Hunting Rifle"
	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_JumpIfInventory("altfire_Toggle", 1, "NewZoom")

				TNT1 A 0 A_JumpIfInventory("Weapon_Zoom", 1, "Ready_Zoom")
            TNT1 A 0 A_ZoomFactor (1.0)		W06C A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Loop
	Ready_Zoom:
            TNT1 A 0 A_ZoomFactor (3.5)		W06L A 1 A_WeaponReady(WRF_ALLOWRELOAD)

			TNT1 A 0 A_JumpIfInventory("altfire_Toggle", 1, "Ready_Zoom")
		goto NewZoom

//		Goto Ready


		
	Deselect:
    TNT1 A 0 A_TakeInventory("SetWeaponMemory",50)
    TNT1 A 0 A_GiveInventory("SetWeaponMemory",9)
		TNT1 A 0 A_TakeInventory("Weapon_Zoom",1)
            TNT1 A 0 A_ZoomFactor (1.0)
	DeselectLoop:
		TST1 AAA 0 A_Lower
		TST1 A 1 A_Lower
		Loop
	Select:
		TNT1 A 0 A_TakeInventory("Weapon_Zoom",1)
            TNT1 A 0 A_ZoomFactor (1.0)
		TNT1 A 0 A_SetCrosshair(15)
    TNT1 A 0 A_TakeInventory("SetWeaponActual",50)
    TNT1 A 0 A_GiveInventory("SetWeaponActual",9)
//		TNT1 A 3 A_WeaponReady//(WRF_NOFIRE)
		W06A ABCDEFGHIJK 1 A_WeaponReady//(WRF_NOFIRE)
		Goto Ready



	Reload://Weapon spin
		TNT1 A 0 A_TakeInventory("Weapon_Zoom",1)
            TNT1 A 0 A_ZoomFactor (1.0)

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

		W06D A 1 A_WeaponReady //(WRF_ALLOWRELOAD)
		W06D BCDE 1 A_WeaponReady (WRF_NOBOB)
		W06D FGHI 1 A_WeaponReady (WRF_NOBOB|WRF_ALLOWRELOAD)
		W06D JKLMNOPQRSTUVW 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready




	Fire:
		W06F A 0 A_Gunflash		TNT1 A 0 A_GiveInventory("Player_WeaponShot",1)
		TNT1 A 0 A_JumpIfInventory("Weapon_Zoom", 1, "Fire_Zoom")

	FireNormal:
            TNT1 A 0 A_ZoomFactor (1.0)			TNT1 A 0 A_TakeInventory("Weapon_Zoom", 1)
		W06F ABCD 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)

TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",31,	"FireNormal_Stacked2")
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",1,	"FireNormal_Stacked1")

		W06F EFGHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W06G ABCDEFGHIJKLMNO 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		Goto Ready


	FireNormal_Stacked1:
		W06F EFGHIJKLMNOPQRSTU 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W06F VWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		W06G ABCDEFGHIJKLMNO 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready


	FireNormal_Stacked2:
		W06F EFGHIJKL 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W06F MNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		W06G ABCDEFGHIJKLMNO 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready
	
	
	


//If weapon is zoomed in.
	Fire_Zoom:
		W06J ABCD 1 bright A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",31,	"Fire_Zoom_Stacked2")
TNT1 A 0 A_JumpIfInventory("Fastfire_TotemAmount",1,	"Fire_Zoom_Stacked1")

		W06J EFGHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W06K ABCDEFGHIJKLMNO 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		Goto Ready_Zoom


	Fire_Zoom_Stacked1:
		W06J EFGHIJKLMNOPQRSTU 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W06J VWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		W06K ABCDEFGHIJKLMNO 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready_Zoom

	Fire_Zoom_Stacked2:
		W06J EFGHIJKL 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W06J MNOPQRSTUVWXYZ 1 A_WeaponReady (WRF_ALLOWRELOAD)
		W06K ABCDEFGHIJKLMNO 1 A_WeaponReady (WRF_ALLOWRELOAD)
		Goto Ready_Zoom






NewZoom:
//	AltFire://Allows you to eagle eye =P (I mean, zoom)
		TNT1 A 0 A_PlaySound("weapon/zoom")
		TNT1 A 0 A_JumpIfInventory("Weapon_Zoom", 1, "Zoom_Out")


Zoom_In:
            TNT1 A 0 A_ZoomFactor (3.5)			TNT1 A 0 A_GiveInventory("Weapon_Zoom", 1)
			
		W06H ABCDE 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W06L A 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
//		TNT1 A 0 A_Refire("Zoom_Hold")
		Goto Ready_Zoom


Zoom_Out:
            TNT1 A 0 A_ZoomFactor (1.0)			TNT1 A 0 A_TakeInventory("Weapon_Zoom", 1)
			
		W06L A 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
		W06I ABCDE 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
//		TNT1 A 0 A_Refire("Zoom_Hold")
		Goto Ready


	Zoom_Hold://Prevents the weapon to keep zooming in and out.
			W06L A 0 A_JumpIfInventory("Weapon_Zoom", 1, 2)
			W06C A 0
		"####" A 1 A_WeaponReady (WRF_NOFIRE|WRF_NOSWITCH)
//		TNT1 A 0 A_ReFire("Zoom_Hold")
		Goto Ready




	Flash:
//	TNT1 A 0 A_JumpIfNoAmmo("Ready")
//TNT1 A 0 A_TakeInventory("Dusk_Wep6Ammo",1)

TNT1 A 0 A_JumpIf(CallACS("instagibcheck")==1, "Flash_Instagib")
	    TNT1 A 0 A_JumpIfInventory("DeathMatchToken",1,"Flash_DM")
		W06F A 0 A_FireBullets (0, 0, -1, SniperDmg, "WeaponPuff_AllowGib")//30 If monster is killed by this bullet, next bullet will go through him.
		W06F A 0 A_FireBullets (0, 0, -1, SniperDmg, "WeaponPuff_AllowGib",0)//30
	FlashContinue:
		TNT1 A 0 A_PlaySound("sniper/fire", CHAN_WEAPON)
	TNT1 A 0 ACS_NamedExecuteAlways("Weapon_Recoil", 0, 1, 0, 0)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 3 A_Light2
		TNT1 A 4 A_Light1
		TNT1 A 8 A_Light0

	TNT1 A 1 A_JumpIf(CallACS("CasingsType")==1, "CasingSpawner")

//Sprite casings
		C06B A 0 A_JUMP(128, 2)
		C06A A 0
		"####" ABCDEFGHIJKL 1 
Goto LightDone	



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



	Flash_Instagib:
		W06F A 0 A_FireBullets (0, 0, -1, SniperDmgInstagib, "WeaponPuff")//30 If monster is killed by this bullet, next bullet will go through him.
		W06F A 0 A_FireBullets (0, 0, -1, SniperDmgInstagib, "WeaponPuff",0)//30
goto FlashContinue

	Flash_DM:
		W06F A 0 A_FireBullets (0, 0, -1, SniperDmg, "WeaponPuff",FBF_NORANDOM|FBF_USEAMMO)//30 If monster is killed by this bullet, next bullet will go through him.
		W06F A 0 A_FireBullets (0, 0, -1, SniperDmg, "WeaponPuff",FBF_NORANDOM|FBF_USEAMMO)//30
goto FlashContinue



	Spawn:
		W06Z A -1
		Stop
	}
}

