ACTOR M50Ammo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 6
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 6
// Inventory.Icon "M50PA0"
}

Actor M50Zoomed : inventory { inventory.maxamount 2 }
Actor HasAP : inventory { inventory.maxamount 1 }
Actor HasNitro : inventory { inventory.maxamount 1 }
Actor CartridgeCounter : inventory { inventory.maxamount 5 }
ACTOR ChangeCartridgeType : Inventory { Inventory.MaxAmount 1 }

//// --------------------------------------------------------------------------
//
// M50 Sniper Rifle
//
//// --------------------------------------------------------------------------

ACTOR M50 : Weapon
{
	Weapon.BobRangeX 0.3
	Weapon.BobRangeY 0.5
	Weapon.BobStyle InverseSmooth
	Weapon.BobSpeed 2.0
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 10
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	YScale 0.6
	XScale 0.8
	Weapon.SelectionOrder 4500
	Weapon.AmmoType1 "SniperRound"
	Weapon.AmmoType2 "M50Ammo"
	tag "M50 Sniper Rifle"
	Obituary "%o was assassinated by %k's Sniper Rifle."
    AttackSound "None"
    Inventory.PickupSound "weapons/m50_pickup"
	Inventory.Pickupmessage "You got the M50 Sniper Rifle! (Slot 0)"
	+WEAPON.WIMPY_WEAPON
    +WEAPON.NOAUTOAIM
    +WEAPON.NOALERT
    +WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	+WEAPON.NO_AUTO_SWITCH
    Scale 0.6
	States
	{
	PickUp:
	TNT1 A 0 A_Playsound("PICKUPONELINER")
	TNT1 A 0
	Stop
	
	Steady:
	TNT1 A 1
	Goto Ready
	
	Ready:
        TNT1 A 2 A_JumpIfInventory("GoFatality", 1, "Steady")
		
        TNT1 A 0 A_PlaySound("weapons/m50_pickup")
		M50S ABCDE 1
        TNT1 AAAAAAAA 0
        TNT1 A 0 //A_JumpIfInventory("L96A5Ammo",1,2)
        //Goto Reload
        TNT1 AAAA 0
	RealReady:
        TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ChangeCartridgeType", 1, "WeaponSpecial")
		TNT1 A 0 A_TakeInventory("RifleSpread", 5)
		M50G A 1 A_WeaponReady
//		TNT1 A 0 A_TakeInventory("M50Zoomed",2)
TNT1 A 0 A_TakeInventory("M50Zoomed",1)
		TNT1 A 0 A_Zoomfactor(1.0)
		TNT1 A 0 A_SetCrosshair(0)
		TNT1 A 0 A_TakeInventory("UsedStamina", 1)
        Loop
    Ready2:
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ChangeCartridgeType", 1, "WeaponSpecial")
		M50Z B 1 A_WeaponReady(WRF_NOBOB)
		TNT1 A 0 A_ZoomFactor(2.0)
		TNT1 A 0 A_SetCrosshair(8)
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		Loop
		
	Ready3:
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("ChangeCartridgeType", 1, "WeaponSpecial")
		M50Z B 1 A_WeaponReady(WRF_NOBOB)
		TNT1 A 0 A_ZoomFactor(5.0)
		TNT1 A 0 A_SetCrosshair(8)
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		Loop
	Deselect:
		TNT1 A 0
//		TNT1 A 0 A_Takeinventory("M50Zoomed",2)
		TNT1 A 0 A_Takeinventory("M50Zoomed",1)

		TNT1 A 0 A_Takeinventory("HasPlasmaWeapon",1)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
	//	TNT1 A 0 A_TakeInventory("ThrowPipeBomb", 1)
	//	TNT1 A 0 A_TakeInventory("DetonatePipeBomb", 1)
		TNT1 A 0 A_TakeInventory("Kicking", 1)
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		TNT1 A 0 A_TakeInventory("Salute1", 1)
		TNT1 A 0 A_TakeInventory("Salute2", 1)
		TNT1 A 0 A_TakeInventory("ChangeCartridgeType", 1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetCrosshair(0)
		M50S EDCBA 1
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1
		Wait
		
	Select:
		TNT1 A 0 A_SelectWeapon("M50")
		TNT1 A 0 A_Takeinventory("FistsSelected",1)
		TNT1 A 0 A_Takeinventory("SawSelected",1)
		TNT1 A 0 A_Takeinventory("ShotgunSelected",1)
		TNT1 A 0 A_Takeinventory("SSGSelected",1)
		TNT1 A 0 A_Takeinventory("MinigunSelected",1)
		TNT1 A 0 A_Takeinventory("PlasmaGunSelected",1)
		TNT1 A 0 A_Takeinventory("RocketLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("BFGSelected",1)
		TNT1 A 0 A_Takeinventory("BFG10kSelected",1)
		TNT1 A 0 A_Takeinventory("RailGunSelected",1)
		TNT1 A 0 A_Takeinventory("SubMachineGunSelected",1)
		TNT1 A 0 A_Takeinventory("RevenantLauncherSelected",1)
		TNT1 A 0 A_Takeinventory("LostSoulSelected",1)
		TNT1 A 0 A_Takeinventory("FlameCannonSelected",1)
		TNT1 A 0 A_Takeinventory("HasBarrel",1)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
	//	MARN A 0 ACS_ExecuteAlways(728, 0, 0, 0, 0)//Check if penetration is on.
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
		
		Goto Ready
	RecoilFlash:
		TNT1 A 1 A_SetPitch(-4.0 + pitch)
		TNT1 A 1 A_Setpitch(pitch+1)
		TNT1 A 1 A_Setpitch(pitch+1)
		TNT1 A 1 A_Setpitch(pitch+1)
		TNT1 A 1 A_Setpitch(pitch+1)
		Stop
	RecoilFlash2:
		TNT1 A 1 A_SetPitch(-6.0 + pitch)
		TNT1 A 1 A_Setpitch(pitch+1)
		TNT1 A 1 A_Setpitch(pitch+1)
		TNT1 A 1 A_Setpitch(pitch+1)
		TNT1 A 1 A_Setpitch(pitch+1)
		TNT1 A 1 A_Setpitch(pitch+1)
		TNT1 A 1 A_Setpitch(pitch+1)
		Stop
		
	WeaponSpecial:
		TNT1 A 0 A_JumpIfInventory("HasAP", 1, "SwitchToNitro")
		TNT1 A 0 A_JumpIfInventory("HasNitro", 1, "SwitchToFMJ")
		TNT1 A 0 A_Print("Cartridge type: Armor-Piercing")
		TNT1 A 0 A_Takeinventory("ChangeCartridgeType",1)
		TNT1 A 0 A_GiveInventory("HasAP")
		Goto FakeReload
		
	SwitchToNitro:
		TNT1 A 0 A_Print("Cartridge type: Nitroglycerine")
		TNT1 A 0 A_Takeinventory("ChangeCartridgeType",1)
		TNT1 A 0 A_Takeinventory("HasAP", 1)
		TNT1 A 0 A_GiveInventory("HasNitro")
		Goto FakeReload
		
	SwitchToFMJ:
		TNT1 A 0 A_Print("Cartridge type: Full Metal Jacket")
		TNT1 A 0 A_Takeinventory("ChangeCartridgeType",1)
		TNT1 A 0 A_Takeinventory("HasAP", 1)
		TNT1 A 0 A_Takeinventory("HasNitro",1)
		Goto FakeReload
		
    Fire:
		TNT1 A 0 A_JumpIfInventory("HasAP", 1, "APFire")
		TNT1 A 0 A_JumpIfInventory("HasNitro", 1, "NitroFire")
        TNT1 A 0 A_JumpIfInventory("M50Ammo",1,2)
        Goto Reload
        TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Fire2")
        TNT1 A 0 A_PlaySound("weapons/m50_fire",7)
		TNT1 A 0 A_playsound("weapons/m50_fire2", 6)
		M50F B 1 BRIGHT A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_FireCustomMissile("SniperCaseSpawn",1,0,8,0)
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		M50F C 1 BRIGHT A_FireBullets(1, 1, 1, 80, "HitPuff")
        XMFF A 0 A_FireCustomMissile("Tracer", 0, 0, 12, -6, 0, random(-3,3))
		TNT1 A 0 A_JumpIfInventory("NoPenetration", 1, 2)
		RIFF A 0 A_FireCustomMissile("WallPenetrationHitscan", 0, 0, -1, 0, 0, 0)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_Takeinventory("M50Ammo",1)
		M50F D 1 A_GunFlash("RecoilFlash")
        M50G A 1
		M50G AAAA 1 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		M50G A 5 A_WeaponReady(1)
		Goto RealReady

    Fire2:
		TNT1 A 0 A_JumpIfInventory("HasAP", 1, "APFire2")
		TNT1 A 0 A_JumpIfInventory("HasNitro", 1, "NitroFire2")
		TNT1 A 0 A_PlaySound("weapons/m50_fire",7)
		TNT1 A 0 A_playsound("weapons/m50_fire2", 6)
        //TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		RI2G A 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,5)
		TNT1 A 0 A_FireCustomMissile("SniperCaseSpawn",1,0,8,0)
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,0,45)
		M50Z B 1 BRIGHT A_FireBullets(1, 1, 1, 80, "HitPuff")
        RI2F A 0 BRIGHT A_FireCustomMissile("Tracer", 0, 0, -1, 0)
		TNT1 A 0 A_JumpIfInventory("NoPenetration", 1, 2)
		RIFF A 0 A_FireCustomMissile("WallPenetrationHitscan", 0, 0, -1, -12, 0, 0)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("M50Ammo",1)
		M50Z B 1 A_GunFlash("RecoilFlash2")
        M50Z B 1
		M50Z BBBBBB 1 A_JumpIfInventory("Reloading",1,"Reload")
		M50Z B 10 A_WeaponReady(WRF_NOBOB)
//        TNT1 A 0 A_JumpIfInventory("M50Zoomed",2,"Ready3")
        TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Ready3")

		Goto Ready2

	APFire:
        TNT1 A 0 A_JumpIfInventory("M50Ammo",1,2)
        Goto Reload
        TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Fire2")
        TNT1 A 0 A_PlaySound("weapons/m50_fire",7)
		TNT1 A 0 A_playsound("weapons/m50_fire2", 6)
		M50F B 1 BRIGHT A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_FireCustomMissile("SniperCaseSpawn",1,0,8,0)
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		M50F C 1 BRIGHT A_RailAttack(60, 0, 1, None, None, 0, 0, "APBulletPuff")//SSawPuff3
        TNT1 A 0 A_FireBullets(0, 0, 1, 1, "HitPuff")
		XMFF A 0 A_FireCustomMissile("Tracer", 0, 0, 12, -6, 0, random(-3,3))
	//	TNT1 A 0 A_JumpIfInventory("NoPenetration", 1, 2)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_Takeinventory("M50Ammo",1)
		M50F D 1 A_GunFlash("RecoilFlash")
        M50G A 1
		M50G AAAA 1 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		M50G A 5 A_WeaponReady(1)
		Goto RealReady

    APFire2:
		TNT1 A 0 A_PlaySound("weapons/m50_fire",7)
		TNT1 A 0 A_playsound("weapons/m50_fire2", 6)
        //TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		RI2G A 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,5)
		TNT1 A 0 A_FireCustomMissile("SniperCaseSpawn",1,0,8,0)
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,0,45)
		M50Z B 1 BRIGHT A_RailAttack(60, 0, 1, None, None, 0, 0, "APBulletPuff")//SSawPuff3
        TNT1 A 0 A_FireBullets(0, 0, 1, 1, "HitPuff")
        RI2F A 0 BRIGHT A_FireCustomMissile("Tracer", 0, 0, -1, 0)
	//	TNT1 A 0 A_JumpIfInventory("NoPenetration", 1, 2)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("M50Ammo",1)
		M50Z B 1 A_GunFlash("RecoilFlash2")
        M50Z B 1
		M50Z BBBBBB 1 A_JumpIfInventory("Reloading",1,"Reload")
		M50Z B 10 A_WeaponReady(WRF_NOBOB)
        TNT1 A 0 A_JumpIfInventory("M50Zoomed",2,"Ready3")
		Goto Ready2
		
	NitroFire:
        TNT1 A 0 A_JumpIfInventory("M50Ammo",2,2)
        Goto Reload
        TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Fire2")
        TNT1 A 0 A_PlaySound("weapons/m50_fire",7)
		TNT1 A 0 A_playsound("weapons/m50_fire2", 6)
		M50F B 1 BRIGHT A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
	//	M50F C 1 BRIGHT A_FireBullets(10, 10, 1, 30, "NitroPuff", FBF_NORANDOMPUFFZ)
        XMFF A 0 A_FireCustomMissile("NitroTracer", 0, 0, 0, 0, 0, 0)
	//	TNT1 A 0 A_JumpIfInventory("NoPenetration", 1, 2)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_Takeinventory("M50Ammo", 2)
		M50F D 1 A_GunFlash("RecoilFlash")
        M50G A 1
		M50G AAAA 1 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		M50G A 5
		M50F EFGHIJ 1
		Goto Cock

    NitroFire2:
		TNT1 A 0 A_PlaySound("weapons/m50_fire",7)
		TNT1 A 0 A_playsound("weapons/m50_fire2", 6)
        //TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		RI2G A 0 A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,5)
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,0,45)
	//	M50Z B 1 BRIGHT A_FireBullets(1, 1, 1, 30, "NitroPuff", FBF_NORANDOMPUFFZ)
        RI2F A 0 BRIGHT A_FireCustomMissile("NitroTracer", 0, 0, 0, 0, 0, 0)
	//	TNT1 A 0 A_JumpIfInventory("NoPenetration", 1, 2)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssDouble", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("M50Ammo", 2)
		M50Z B 1 A_GunFlash("RecoilFlash2")
        M50Z B 1
		M50Z BBBBBB 1 A_JumpIfInventory("Reloading",1,"Reload")
		M50Z B 5
     // TNT1 A 0 A_JumpIfInventory("M50Zoomed",2,"Ready3")
		TNT1 A 0 A_ZoomFactor(1.0)
		M50F EFGHIJ 1
		Goto Cock

    AltFire:
        TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"UnZoom")
	//	TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Zoom2")
		
	Zoom1:
		TNT1 A 0 A_Giveinventory("M50Zoomed",1)
		TNT1 A 0 A_playsound("weapons/m50_zoomin", 4)
		TNT1 A 0 A_Giveinventory("GoSpecial",1)
//        TNT1 A 0 A_ZoomFactor(2.0)
TNT1 A 0 A_ZoomFactor(4.5)
		TNT1 A 0 A_SetCrosshair(8)
		TNT1 A 0 A_Giveinventory("ADSmode",1)
      M50Z A 1 //zoom in sprite
       // Goto Ready2
Goto Ready3



	//Zoom2:
	//	TNT1 A 0 A_Giveinventory("M50Zoomed",1)
	//	TNT1 A 0 A_playsound("weapons/m50_zoomin", 4)
	//	TNT1 A 0 A_Giveinventory("GoSpecial",1)
       // TNT1 A 0 A_ZoomFactor(5.0)
		//TNT1 A 0 A_SetCrosshair(8)
		//TNT1 A 0 A_Giveinventory("ADSmode",1)
        //M50Z B 1
        //Goto Ready3

	UnZoom:
		TNT1 A 0 A_playsound("weapons/m50_zoomout", 6)
      M50Z A 1 // zoom in sprite
	//	TNT1 A 0 A_Takeinventory("M50Zoomed",2)
TNT1 A 0 A_Takeinventory("M50Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetCrosshair(0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
        Goto RealReady
		
	NoAmmo:
		M50G A 1 A_PlaySound("weapons/empty")
//		TNT1 A 0 A_Takeinventory("M50Zoomed",2)
TNT1 A 0 A_Takeinventory("M50Zoomed",1)
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetCrosshair(0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		Goto RealReady
	
    Reload:
		M50G A 1 A_WeaponReady
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetCrosshair(0)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		//TNT1 A 0 A_Takeinventory("M50Zoomed",2)
		TNT1 A 0 A_Takeinventory("M50Zoomed",1)
		TNT1 A 0 A_JumpIfInventory("M50Ammo",6,"RealReady")
        TNT1 A 0 A_JumpIfInventory("SniperRound",1,3)
        Goto NoAmmo
        TNT1 AAA 0
		//TNT1 A 0 A_Takeinventory("M50Zoomed",2)
		TNT1 A 0 A_Takeinventory("M50Zoomed",1)
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0
        M50F EE 1  A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
        M50F FFGHIJ 1
		M50F KK 1 A_playsound("weapons/m50_out", 5)
		M50F LL 1 
		TNT1 A 0 A_FireCustomMissile("EmptyClipSpawn",-5,0,8,-4)
		M50R ABCDDDDDEEEFFGHIJJKLKLKLJKLJKLJJJKKKKLLLLLMNOPPPPQR 1
TNT1 A 0 A_PlaySound("weapons/m50_in", 5)
		M50R ST 2
		M50R UVWX 2
		TNT1 A 0 A_Takeinventory("HasUnloaded",1)
		TNT1 A 0 A_JumpIfInventory("M50Ammo",1,"InsertBullets2")//30+1 effect	
		TNT1 A 0 A_GiveInventory("RifleWasEmpty", 1)
	InsertBullets:
		TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("M50Ammo",5,"DoneReloading")
		TNT1 A 0 A_JumpIfInventory("SniperRound",1,3)
		Goto DoneReloading
        TNT1 AAAAAA 0
		TNT1 A 0 A_Giveinventory("M50Ammo",1)
		TNT1 A 0 A_Giveinventory("CartridgeCounter", 1)
		TNT1 A 0 A_Takeinventory("SniperRound",1,TIF_NOTAKEINFINITE)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
        Goto DoneReloading
		TNT1 AAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
        Goto DoneReloading
	InsertBullets2:
		TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("M50Ammo",6,"DontCock")
		TNT1 A 0 A_JumpIfInventory("SniperRound",1,3)
		Goto DoneReloading
        TNT1 AAAAAA 0
		TNT1 A 0 A_Giveinventory("M50Ammo",1)
		TNT1 A 0 A_Giveinventory("CartridgeCounter", 1)
		TNT1 A 0 A_Takeinventory("SniperRound",1,TIF_NOTAKEINFINITE)
		Goto InsertBullets2
		
		TNT1 AAAAAAAAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
        Goto DoneReloading
		TNT1 AAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
        Goto DoneReloading
		
	DoneReloading:
		TNT1 A 0 A_JumpIfInventory("CartridgeCounter", 5, 1)
		Goto DontCock
		TNT1 A 0 A_TakeInventory("CartridgeCounter", 5)
		TNT1 A 0 A_TakeInventory("RifleWasEmpty")
		TNT1 A 0 A_PlaySound("weapons/m50_boltopen", 5)
	//	TNT1 A 0 A_FireCustomMissile("SniperCaseSpawn",1,0,8,0)
		M50F LMNONML 1
		TNT1 A 0 A_PlaySound("weapons/m50_boltclose", 5)
		M50F KJIHGFE 1
		TNT1 A 0 A_Refire("Fire")
		Goto RealReady
		
	DontCock:
		TNT1 A 0 A_TakeInventory("CartridgeCounter", 5)
		TNT1 A 0 A_TakeInventory("RifleWasEmpty")
		M50F KJIHGFE 1
		Goto RealReady
		
	FakeReload:
		M50G A 1 A_WeaponReady
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetCrosshair(0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		//TNT1 A 0 A_Takeinventory("M50Zoomed",2)
		TNT1 A 0 A_Takeinventory("M50Zoomed",1)

		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		TNT1 A 0
        M50F E 1  A_JumpIfInventory("Kicking",1,"DoKick")
        M50F FGHIJ 1
		M50F K 1 A_playsound("weapons/m50_out", 5)
		M50F L 1
		TNT1 A 0
		M50R ABCEGIKMOQR 1
TNT1 A 0 A_PlaySound("weapons/m50_in", 5)		
M50R ST 1
		
		M50R UVWX 1
		TNT1 A 0 A_PlaySound("weapons/m50_boltopen", 5)
		M50F LMNONML 1
		TNT1 A 0 A_PlaySound("weapons/m50_boltclose", 5)
		M50F KJIHGFE 1
		TNT1 A 0 A_Refire("Fire")
		Goto RealReady

	Cock:
		TNT1 A 0 A_PlaySound("weapons/m50_boltopen", 5)
		TNT1 A 0 A_FireCustomMissile("SniperCaseSpawn",1,0,8,0)
		M50F LMNONML 1
		TNT1 A 0 A_PlaySound("weapons/m50_boltclose", 5)
		M50F KJIHGFE 1
		TNT1 A 0 A_Refire("Fire")
//		TNT1 A 0 A_JumpIfInventory("M50Zoomed",2,"Ready3")
TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Ready3")
		//TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Ready2")
		Goto RealReady
		
 	Spawn:
		M50P A -1
		Stop
		
	DoKick:
	    TNT1 A 0
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		NULL A 0 A_JumpIf (momZ > 0, "AirKick")
		NULL A 0 A_JumpIf (momZ < 0, "AirKick")
		NULL A 0 A_JumpIf (pitch > 32, "LowKickChecker1")
		Goto InitializeNormalKick
		
		LowKickChecker1:
		TNT1 A 0
	    NULL A 0 A_JumpIf (pitch > 90, "InitializeNormalKick")
		RIFF A 0 A_FireCustomMissile("KickAttackDetectDowned", 0, 0, 0, 0)
		
		InitializeNOrmalKick:
        TNT1 A 0 A_jumpifinventory("PowerStrength",1,"BerserkerKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		M50K BCD 1
		RIFF A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        M50K H 5
		KICK A 0 A_Takeinventory("Kicking",1)
		M50K I 1
		M50K GFEDCBA 1 
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+6
    BerserkerKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 SetPlayerProperty(0,1,0)
		M50K BCD 1
        RIFF A 0 A_FireCustomMissile("SuperKickAttack", 0, 0, 0, -7)
        M50K H 5
		KICK A 0 A_Takeinventory("Kicking",1)
		M50K I 1
		M50K GFEDCBA 1 
		TNT1 A 0 SetPlayerProperty(0,0,0)
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+6
	
	AirKick:
	    TNT1 A 0 A_jumpifinventory("PowerStrength",1,"SuperAirKick")
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KICK JKLMN 1
        RIFF A 0 A_FireCustomMissile("AirKickAttack", 0, 0, 0, -31)
        KICK O 3
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+6
		
	SuperAirKick:
		TNT1 A 0 A_PlaySound("KICK")
		TNT1 A 0 A_Recoil (-6)
		KICK JKLMN 1
        RIFF A 0 A_FireCustomMissile("SuperAirKickAttack", 0, 0, 0, -31)
        KICK O 3
		KICK A 0 A_Takeinventory("Kicking",1)
		KICK PQRST 2
		TNT1 A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
		Goto Ready+6
	
	Taunt:
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("Taunting",1)
		TNT1 A 0 A_JumpIfInventory("RealismMode", 1, "CheckGrab")
        TNT1 A 10
		FUCK A 1
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 0, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", -9, 0, -1, 0)
		TNT1 A 0 BRIGHT A_FireCustomMissile("Taunter", 9, 0, -1, 0)
        FUCK B 1 A_PlaySound("FUCK", 2)
        FUCK CD 1 A_AlertMonsters
		FUCK E 15 A_Takeinventory("Taunting",1)
        FUCK DCBA 1
        TNT1 A 10
		Goto Ready
	Salute:
	    TNT1 A 0 SetPlayerProperty(0,1,0)
		TNT1 A 0 A_ALertMonsters
		SALU ABCDEDCDEDCDEDCBA 4
		TNT1 A 0 A_TakeInventory("Salute1",1)
		TNT1 A 0 A_TakeInventory("Salute2",1)
		TNT1 A 0 SetPlayerProperty(0,0,0)
		Goto Ready
		
	CheckGrab:
	    TNT1 A 0 
		TNT1 A 0 A_JumpIfTargetInLOS("CheckDistanceGrab")
		Goto Ready+6
	CheckDistanceGrab:
	    TNT1 A 0 
		TNT1 A 0 A_JumpIfCloser(100, "Grab")
		Goto Ready+6
	CheckIfCanGrab:
	    TNT1 A 0 
		TNT1 A 0 A_JumpIfInTargetInventory("CanGrab", 1, "Grab")
		Goto Ready+6	
	Grab:
	    PKUP ABC 2
		TNT1 A 0 A_CustomMissile("PickupProjectile")
		PKUP DEF 2
		Goto Ready
	TossGrenade:	
		TNT1 A 0
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 0 A_JumpIfInventory("GrenadeAmmo", 1, 1)
		Goto NoGrenade
		GRTH ABCD 1
		TNT1 A 0 A_GiveInventory("FiredGrenade", 1)
		TNT1 A 0 A_PLaySound ("GRNPIN")
		GRTH EEFG 1
		TNT1 A 0 A_PLaySound ("GRNTOSS")
		GRTH HI 1
		TNT1 A 0 A_TakeInventory("GrenadeAmmo", 1)
		TNT1 A 0 A_FireCustomMissile("HandGrenade", random(-2,2), 0, 0, 0, 0, 0)
	    TNT1 A 0 A_TakeInventory("FiredGrenade", 1)
		GRTH JKLM 1
		TNT1 A 1 
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		Goto Ready	
	NoGrenade:
		TNT1 A 0
		TNT1 A 0 A_Print("No Grenades Left.")
		Goto Ready+6
	}
}

Actor WallPenetrationHitscan: FastProjectile
{
Projectile
+RANDOMIZE
+FORCEXYBILLBOARD
+DONTSPLASH
damage 0
radius 2
height 2
speed 900
renderstyle ADD
alpha 0.9
scale .3
states
	{
	Spawn:
		TRAC A 1 BRIGHT
		Loop
Death:
	TNT1 A 0
	TNT1 A 0 A_CheckFloor("Nothing")
	TNT1 A 0 A_CheckCeiling("Nothing")
	TNT1 A 0 A_SpawnItemEx ("Penetrator",cos(-pitch)*24,0,0+(sin(pitch)*24),cos(-pitch)*100,0,sin(pitch)*100,0,SXF_TRANSFERPITCH)
	tnt1 A 2
    Stop
	
Nothing:
	TNT1 A 0 
	Stop
	
XDeath:
TNT1 A 0
	TNT1 A 0 A_SpawnItemEx ("Penetrator",cos(-pitch)*24,0,0+(sin(pitch)*24),cos(-pitch)*100,0,sin(pitch)*100,0,SXF_TRANSFERPITCH)
Stop
	}
}


Actor SpawnBulletDecalBackwards: FastProjectile
{
Projectile
+RANDOMIZE
+FORCEXYBILLBOARD
+DONTSPLASH
+THRUACTORS
damage 0
radius 2
height 2
speed 50
renderstyle ADD
Decal "BulletDecalNew1"
alpha 0.9
scale .3
states
	{
	Spawn:
		TNT1 A 1 BRIGHT
		Loop
Death:
	TNT1 A 0 A_SpawnItem("HitPuff")
	TNT1 A 10
    Stop
XDeath:
TNT1 A 0
Stop
	}
}



Actor SpawnRocketDecalBackwards: FastProjectile
{
Projectile
+RANDOMIZE
+FORCEXYBILLBOARD
+DONTSPLASH
+THRUACTORS
damage 0
radius 6
height 2
speed 50
renderstyle ADD
Decal "Scorch"
alpha 0.9
scale .3
states
	{
	Spawn:
		TNT1 A 1 BRIGHT
		Loop
Death:
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 4 A_CustomMissile ("PLasmaSmoke", 2, 0, random (0, 360), 2, random (10, 60))
    Stop
XDeath:
TNT1 A 0
Stop
	}
}


Actor Penetrator: MarineTracer
{
damage (random(8,10))
Decal "none"
DamageType FriendBullet
-SKYEXPLODE
//+Ripper
States
{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile("SpawnBulletDecalBackwards", 0, 0, 0)
		TRAC A 10 BRIGHT
		sTOP
		
Death:
	TNT1 A 0
	TNT1 A 0 A_CheckFloor("XDeath")
	TNT1 A 0 A_CheckCeiling("XDeath")
    TNT1 A 1 A_SpawnItem("HitPuff")
	Stop
	
DeathSpecial:	
	
    Stop
XDEath:
TNT1 A 0
TNT1 A 0 A_Playsound("bulletfleshimpact", 1)
TNT1 A 0 A_SpawnItemEx ("Penetrator2",cos(-pitch)*24,0,0+(sin(pitch)*24),cos(-pitch)*100,0,sin(pitch)*100,0,SXF_TRANSFERPITCH)
TNT1 A 1
Stop	
}
}

Actor Penetrator2: MarineTracer
{
damage (random(8,10))
Decal "none"
DamageType FriendBullet
-SKYEXPLODE
//+Ripper
States
{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile("SpawnBulletDecalBackwards", 0, 0, 0)
		TRAC A 10 BRIGHT
		sTOP
		
Death:
	TNT1 A 0
	TNT1 A 0 A_CheckFloor("XDeath")
	TNT1 A 0 A_CheckCeiling("XDeath")
    TNT1 A 1 A_SpawnItem("HitPuff")
	Stop
	
DeathSpecial:	
	
    Stop
XDEath:
TNT1 A 0
TNT1 A 0 A_Playsound("bulletfleshimpact", 1)
TNT1 A 0 A_SpawnItemEx ("Penetrator3",cos(-pitch)*24,0,0+(sin(pitch)*24),cos(-pitch)*100,0,sin(pitch)*100,0,SXF_TRANSFERPITCH)
TNT1 A 1
Stop	
}
}

Actor Penetrator3: MarineTracer
{
damage (random(8,10))
Decal "none"
DamageType FriendBullet
-SKYEXPLODE
//+Ripper
States
{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile("SpawnBulletDecalBackwards", 0, 0, 0)
		TRAC A 10 BRIGHT
		sTOP
		
Death:
	TNT1 A 0
	TNT1 A 0 A_CheckFloor("XDeath")
	TNT1 A 0 A_CheckCeiling("XDeath")
    TNT1 A 1 A_SpawnItem("HitPuff")
	Stop
	
DeathSpecial:	
	
    Stop
XDEath:
TNT1 A 0
TNT1 A 1
Stop	
}
}

Actor NitroTracer : Tracer
{
Speed 500
Damage 45
Decal "Scorch"
states
	{
	Death:
	XDeath:
		TNT1 A 0 A_Stopsound(6)
		MISL B 0 ACS_NamedExecuteAlways("GuidedMissileACS101",0,800,0,0)
		EXPL A 0 Radius_Quake (3, 16, 0, 15, 0)
		TNT1 A 0 A_SpawnItem ("BigRicoChet", 0, -30)
        TNT1 A 0 A_SpawnItemEx ("DetectFloorCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	    TNT1 A 0 A_SpawnItemEx ("DetectCeilCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	    TNT1 A 0 A_SpawnItemEx ("UnderwaterExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_SpawnItemEx ("NitroExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
        TNT1 AAAAA 0 A_CustomMissile ("MediumExplosionFlames", 0, 0, random (0, 360), 2, random (0, 360))
        EXPL AAAAA 0 A_CustomMissile ("ExplosionSmokeFast22", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 1
		TNT1 A 0 A_PlaySound("FAREXPL", 3)
		TNT1 A 20
		Stop
	}
}

Actor APTracer : Tracer
{
Speed 500
Damage 20
+FOILINVUL
+RIPPER
Decal "BulletPuff"
States
{
	Death:
	XDeath:
	TNT1 A 0 A_SpawnItem("BulletPuff")
	Stop
	}
}

actor NitroExplosion : RocketExplosion
{
States    
	{
	Death:
	TNT1 A 0
	TNT1 A 0 A_SpawnItem("WhiteShockwave")
	TNT1 A 2
	TNT1 A 0 A_Explode(240,75)
    Stop
	}
}
		
ACTOR SniperCaseSpawn
{
	Speed 20
	PROJECTILE
	+NOCLIP
	+CLIENTSIDEONLY
	States
	{
	Spawn:
        TNT1 A 0
		TNT1 A 1 A_CustomMissile("EmptyBrassSniper",-5,0,random(-80,-100),2,random(45,80))
		Stop
	}
}

ACTOR EmptyBrassSniper : EmptyBrass
{
   Scale 0.25
   States
   {
   Spawn:
      CASS ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH 3 A_JumpIf(waterlevel > 1, "Splash")
	  Stop
	  
	Death:
	  TNT1 A 0
	//  TNT1 A 0 ACS_ExecuteAlways(798, 0, 0, 0, 0)//Check Effects
      LCPJ A 0 A_Jump(256,"Rest1","Rest2","Rest3","Rest4","Rest5","Rest6","Rest7","Rest8")
      Goto Rest1

    Rest1:
      CASS I 900
	  TNT1 A 0 A_JumpIfInventory("LowGraphicsMode", 1, "Stoping")
      Loop
    Rest2:
      CASS J 900
	  TNT1 A 0 A_JumpIfInventory("LowGraphicsMode", 1, "Stoping")
      loop
    Rest3:
	  CASS K 900
	  TNT1 A 0 A_JumpIfInventory("LowGraphicsMode", 1, "Stoping")
      Loop
    Rest4:
      CASS L 900
	  TNT1 A 0 A_JumpIfInventory("LowGraphicsMode", 1, "Stoping")
      Loop
    Rest5:
      CASS M 900
	  TNT1 A 0 A_JumpIfInventory("LowGraphicsMode", 1, "Stoping")
      Loop
    Rest6:
      CASS I 900
	  TNT1 A 0 A_JumpIfInventory("LowGraphicsMode", 1, "Stoping")
      Loop
    Rest7:
      CASS J 900
	  TNT1 A 0 A_JumpIfInventory("LowGraphicsMode", 1, "Stoping")
      Loop
    Rest8:
      CASS K 900
	  TNT1 A 0 A_JumpIfInventory("LowGraphicsMode", 1, "Stoping")
      Loop
	  
  Disappear:
  TNT1 A 1
  Stop
	 
	Splash:
	TNT1 A 0
	TNT1 A 0 A_SpawnItem("UnderwaterEmptyBrass")
	Stop
	
   }
}

Actor APBulletPuff : BulletPuff
{	+ALWAYSPUFF		}

Actor DecalTracer : Tracer
{ Decal "BulletChip" }

ACTOR ClipSpawner replaces Clip //Base coding is from Trailblazer.
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_SpawnItemEx("Clip2")
		TNT1 A 0 A_DropItem("SniperRound",1,64)
		Stop
	}
}

ACTOR ClipBoxSpawner replaces ClipBox
{
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_SpawnItemEx("ClipBox2")
		TNT1 A 0 A_DropItem("SniperRoundBox",1,64)
		Stop
	}
}

Actor M50Spawner : RandomSpawner replaces Rifle
{
DropItem "Rifle", 256, 16
DropItem "M50", 256, 11
//DropItem "M55", 256, 1
}
