ACTOR M55Ammo : Ammo
{
   Inventory.Amount 5
   Inventory.MaxAmount 6
   Ammo.BackpackAmount 5
   Ammo.BackpackMaxAmount 6
 //Inventory.Icon "M55PA0"
}

//// --------------------------------------------------------------------------
//
// M55 Anti-Materiel Rifle
//
//// --------------------------------------------------------------------------

ACTOR M55 : Weapon
{
	Weapon.BobRangeX 0.3
	Weapon.BobRangeY 0.5
	Weapon.BobStyle InverseSmooth
	Weapon.BobSpeed 2.0
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 5
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 10
	YScale 0.6
	XScale 0.8
	Weapon.SelectionOrder 4500
	Weapon.AmmoType1 "SniperRound"
	Weapon.AmmoType2 "M55Ammo"
	tag "M55 Anti-Materiel Rifle"
	Obituary "%o was punctured by %k's Anti-Materiel Rifle."
    AttackSound "None"
    Inventory.PickupSound "weapons/m55_pickup"
	Inventory.Pickupmessage "You got the M55 Anti-Materiel Rifle Upgrade!"
	+WEAPON.WIMPY_WEAPON
    +WEAPON.NOAUTOAIM
    +WEAPON.NOALERT
    +WEAPON.NOAUTOFIRE
	-FORCEXYBILLBOARD
	+WEAPON.NO_AUTO_SWITCH
	+POWERED_UP
    Scale 0.8
	Weapon.SisterWeapon M50
	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/m55_pickup")
		M55S 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("ChangeShellType", 1, "WeaponSpecial")
		TNT1 A 0 A_TakeInventory("RifleSpread", 5)
		M55G A 1 A_WeaponReady
		TNT1 A 0 A_TakeInventory("M50Zoomed", 2)
		//------------------- TNT1 A 0 A_Takeinventory("M55Infrared")
		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("ChangeShellType", 1, "WeaponSpecial")
		M55Z A 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("ChangeShellType", 1, "WeaponSpecial")
		M55Z A 1 A_WeaponReady(WRF_NOBOB)
		TNT1 A 0 A_ZoomFactor(8.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("M55Infrared")
		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("ChangeShellType", 1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetCrosshair(0)
		M55S EDCBA 1
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1
		Wait
		
	Select:
		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(-8.0 + pitch)
		TNT1 A 1 A_Setpitch(pitch+2)
		TNT1 A 1 A_Setpitch(pitch+2)
		TNT1 A 1 A_Setpitch(pitch+2)
		TNT1 A 1 A_Setpitch(pitch+2)
		Stop
	RecoilFlash2:
		TNT1 A 1 A_SetPitch(-12.0 + pitch)
		TNT1 A 1 A_Setpitch(pitch+2)
		TNT1 A 1 A_Setpitch(pitch+2)
		TNT1 A 1 A_Setpitch(pitch+2)
		TNT1 A 1 A_Setpitch(pitch+2)
		TNT1 A 1 A_Setpitch(pitch+2)
		TNT1 A 1 A_Setpitch(pitch+2)
		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("ChangeShellType",1)
		TNT1 A 0 A_GiveInventory("HasAP")
		Goto FakeReload
		
	SwitchToNitro:
		TNT1 A 0 A_Print("Cartridge type: Nitroglycerine")
		TNT1 A 0 A_Takeinventory("ChangeShellType",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("ChangeShellType",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("M55Ammo",1,2)
        Goto Reload
        TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Fire2")
        TNT1 A 0 A_PlaySound("weapons/m55_fire",7)
		TNT1 A 0 A_playsound("weapons/m55_fire2", 6)
		M55F A 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)
		M55F B 1 BRIGHT A_FireBullets(1, 1, 1, 120, "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("M55WallPenetrationHitscan", 0, 0, -1, 0, 0, 0)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssQuad", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_Takeinventory("M55Ammo",1)
		M55F C 1 A_GunFlash("RecoilFlash")
        M55G A 1
		M55G 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")
		M55G 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/m55_fire",7)
		TNT1 A 0 A_playsound("weapons/m55_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)
		M55Z A 1 BRIGHT A_FireBullets(1, 1, 1, 120, "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("M55WallPenetrationHitscan", 0, 0, -1, -12, 0, 0)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssQuad", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("M55Ammo",1)
		M55Z A 1 A_GunFlash("RecoilFlash2")
        M55Z A 1
		M55Z AAAAAA 1 A_JumpIfInventory("Reloading",1,"Reload")
		M55Z A 10 A_WeaponReady(WRF_NOBOB)
        TNT1 A 0 A_JumpIfInventory("M50Zoomed",2,"Ready3")
		Goto Ready2

	APFire:
        TNT1 A 0 A_JumpIfInventory("M55Ammo",1,2)
        Goto Reload
        TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Fire2")
        TNT1 A 0 A_PlaySound("weapons/m55_fire",7)
		TNT1 A 0 A_playsound("weapons/m55_fire2", 6)
		M55F A 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)
		M55F B 1 BRIGHT A_RailAttack(100, 0, 1, None, None, 0, 0, "APBulletPuff")//SSawPuff3 
		TNT1 A 0 BRIGHT 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("ShakeYourAssQuad", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_Takeinventory("M55Ammo",1)
		M55F C 1 A_GunFlash("RecoilFlash")
        M55G A 1
		M55G 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")
		M55G A 5 A_WeaponReady(1)
		Goto RealReady

    APFire2:
		TNT1 A 0 A_PlaySound("weapons/m55_fire",7)
		TNT1 A 0 A_playsound("weapons/m55_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)
		M55Z A 1 BRIGHT A_RailAttack(100, 0, 1, None, None, 0, 0, "APBulletPuff")//SSawPuff3
        TNT1 A 0 BRIGHT 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("ShakeYourAssQuad", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("M55Ammo",1)
		M55Z A 1 A_GunFlash("RecoilFlash2")
        M55Z A 1
		M55Z AAAAAA 1 A_JumpIfInventory("Reloading",1,"Reload")
		M55Z A 10 A_WeaponReady(WRF_NOBOB)
        TNT1 A 0 A_JumpIfInventory("M50Zoomed",2,"Ready3")
		Goto Ready2
		
	NitroFire:
        TNT1 A 0 A_JumpIfInventory("M55Ammo",2,2)
        Goto Reload
        TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Fire2")
        TNT1 A 0 A_PlaySound("weapons/m55_fire",7)
		TNT1 A 0 A_playsound("weapons/m55_fire2", 6)
		M55F A 1 BRIGHT A_AlertMonsters
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		M55F B 1 BRIGHT //A_FireBullets(10, 10, 1, 30, "NitroPuff", FBF_NORANDOMPUFFZ)
        XMFF A 0 A_FireCustomMissile("M55NitroTracer", 0, 0, 0, 0, 0, 0)
	//	TNT1 A 0 A_JumpIfInventory("NoPenetration", 1, 2)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssQuad", 0, 0, 0, 0)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		TNT1 A 0 A_Takeinventory("M55Ammo", 2)
		M55F C 1 A_GunFlash("RecoilFlash")
        M55G A 1
		M55G 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")
		M55G A 5
		Goto Cock

    NitroFire2:
		TNT1 A 0 A_PlaySound("weapons/m55_fire",7)
		TNT1 A 0 A_playsound("weapons/m55_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)
		M55Z A 1 BRIGHT //A_FireBullets(1, 1, 1, 30, "NitroPuff", FBF_NORANDOMPUFFZ)
        RI2F A 0 BRIGHT A_FireCustomMissile("M55NitroTracer", 0, 0, 0, 0, 0, 0)
	//	TNT1 A 0 A_JumpIfInventory("NoPenetration", 1, 2)
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("ShakeYourAssQuad", 0, 0, 0, 0)
		TNT1 A 0 A_Takeinventory("M55Ammo", 2)
		M55Z A 1 A_GunFlash("RecoilFlash2")
        M55Z A 1
		M55Z AAAAAA 1 A_JumpIfInventory("Reloading",1,"Reload")
		M55Z A 5
     // TNT1 A 0 A_JumpIfInventory("M50Zoomed",2,"Ready3")
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetCrosshair(0)
		Goto Cock

    AltFire:
        TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",2,"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_SetCrosshair(8)
		TNT1 A 0 A_Giveinventory("ADSmode",1)
		//-------------------TNT1 A 0 A_Giveinventory("M55Infrared")
     // M50Z A 1
        Goto Ready2
	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(8.0)
		TNT1 A 0 A_SetCrosshair(8)
		TNT1 A 0 A_Giveinventory("ADSmode",1)
		//-------------------TNT1 A 0 A_Giveinventory("M55Infrared")
        M55Z A 1
        Goto Ready3
	UnZoom:
		TNT1 A 0 A_playsound("weapons/m50_zoomout", 6)
     // M50Z A 1
		TNT1 A 0 A_Takeinventory("M50Zoomed",2)
        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("M55Infrared")
        Goto RealReady
		
	NoAmmo:
		M55G A 1 A_PlaySound("weapons/empty")
		//-------------------TNT1 A 0 A_Takeinventory("M55Infrared")
		TNT1 A 0 A_Takeinventory("M50Zoomed",2)
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_Takeinventory("ADSmode",1)
		Goto RealReady
	
    Reload:
		M55G A 1 A_WeaponReady
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_SetCrosshair(0)
		//-------------------TNT1 A 0 A_Takeinventory("M55Infrared")
		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_JumpIfInventory("M55Ammo",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_GiveInventory ("Pumping", 1)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0
        M55U A 1  A_JumpIfInventory("Kicking",1,"DoKick")
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
        M55U ABCDEFGH 1
		M55D ABCDE 1 
		M55R C 2 A_playsound("weapons/m55_out", 5)
		M55R C 2 
		TNT1 A 0 A_FireCustomMissile("EmptyClipSpawn",-5,0,8,-4)
		M55R DEFGHI 2
		M55R JK 2
		TNT1 A 0 A_PlaySound("weapons/m55_in", 5)
		M55R LMN 2
		TNT1 A 0 A_Takeinventory("HasUnloaded",1)
		TNT1 A 0 A_JumpIfInventory("M55Ammo",1,"InsertBullets2")//30+1 effect	
		TNT1 A 0 A_GiveInventory("RifleWasEmpty", 1)
	InsertBullets:
		TNT1 AAAA 0
		TNT1 A 0 A_JumpIfInventory("M55Ammo",5,"DoneReloading")
		TNT1 A 0 A_JumpIfInventory("SniperRound",1,3)
		
		Goto DoneReloading
        TNT1 AAAAAA 0
		TNT1 A 0 A_Giveinventory("M55Ammo",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("M55Ammo",6,"DontCock")
		TNT1 A 0 A_JumpIfInventory("SniperRound",1,3)
		Goto DoneReloading
        TNT1 AAAAAA 0
		TNT1 A 0 A_Giveinventory("M55Ammo",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_FireCustomMissile("SniperCaseSpawn",1,0,8,0)
		M55R C 10
		M55C CDEF 1
		TNT1 A 0 A_PlaySound("weapons/m55_pickup", 5)
		M55C GHIJC 1
		M55D EDCBA 1 
		M55U HGFEDCBA 1
		TNT1 A 0 A_Refire("Fire")
		Goto RealReady
		
	DontCock:
		TNT1 A 0 A_TakeInventory("CartridgeCounter", 5)
		TNT1 A 0 A_TakeInventory("RifleWasEmpty")
		M55D EDCBA 1 
		M55U HGFEDCBA 1
		Goto RealReady
		
	FakeReload:
		M55G 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("M55Infrared")
		TNT1 A 0 A_Takeinventory("M50Zoomed",2)
        TNT1 AAA 0
		TNT1 A 0 A_Takeinventory("M50Zoomed",2)
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		TNT1 A 0
        M55U A 1  A_JumpIfInventory("Kicking",1,"DoKick")
        M55U ABCDEFGH 1
		M55D ABCDE 1 
		M55R C 2 A_playsound("weapons/m55_out", 5)
		M55R C 1 
		M55R DEFGHI 1
		M55R JK 1
		TNT1 A 0 A_PlaySound("weapons/m55_in", 5)
		M55R LMN 1
		M55R C 5
		M55C CDEF 1
		TNT1 A 0 A_PlaySound("weapons/m55_pickup", 5)
		M55C GHIJC 1
		M55D EDCBA 1 
		M55U HGFEDCBA 1
		TNT1 A 0 A_Refire("Fire")
		Goto RealReady

	Cock:
		//-------------------TNT1 A 0 A_Takeinventory("M55Infrared")
		M55U ABCDEFGH 1
		M55D ABCDE 1 
		M55R C 10
		M55C CDEF 1
		TNT1 A 0 A_PlaySound("weapons/m55_pickup", 5)
		TNT1 A 0 A_FireCustomMissile("SniperCaseSpawn",1,0,8,0)
		M55C GHIJC 1
		M55D EDCBA 1 
		M55U HGFEDCBA 1
		TNT1 A 0 A_Refire("Fire")
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",2,"Ready3")
		TNT1 A 0 A_JumpIfInventory("M50Zoomed",1,"Ready2")
		Goto RealReady
		
 	Spawn:
		M55P Z 1
		Loop
		
	DoKick:
	    TNT1 A 0
		TNT1 A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		//-------------------TNT1 A 0 A_Takeinventory("M55Infrared")
		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)
		M55K BCD 1
		RIFF A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
        M55K H 5
		KICK A 0 A_Takeinventory("Kicking",1)
		M55K I 1
		M55K 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)
		M55K BCD 1
        RIFF A 0 A_FireCustomMissile("SuperKickAttack", 0, 0, 0, -7)
        M55K H 5
		KICK A 0 A_Takeinventory("Kicking",1)
		M55K I 1
		M55K 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("M55Infrared")
		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("M55Infrared")
		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 SniperRound : Ammo
{
	Inventory.PickUpSound "items/cartridge_pick"
    Game Doom
	+DONTGIB
	+FLOORCLIP
	Inventory.PickUpMessage "Picked up a pair of .416 rounds."
	Inventory.Amount 2
    Inventory.MaxAmount 50
    Ammo.BackpackAmount 10
    Ammo.BackpackMaxAmount 100
	Scale 0.5
    Inventory.Icon "416AA0"
    States
    {
    Spawn:
      416A B -1
      Stop
	}
}

ACTOR SniperRoundBox : SniperRound
{
	Inventory.PickUpMessage "Picked up a case of .416 rounds."
	Inventory.PickUpSound "items/cartridge_pick"
	Inventory.Amount 10
    Inventory.MaxAmount 50
    Ammo.BackpackAmount 10
    Ammo.BackpackMaxAmount 100
	Scale 1
    States
    {
    Spawn:
      416B A -1
      Stop
	}
}

Actor M55WallPenetrationHitscan : WallPenetrationHitscan
{
states
	{
Death:
	TNT1 A 0
	TNT1 A 0 A_CheckFloor("Nothing")
	TNT1 A 0 A_CheckCeiling("Nothing")
	TNT1 AA 0 A_SpawnItemEx ("M55Penetrator",cos(-pitch)*24,0,0+(sin(pitch)*24),cos(-pitch)*100,0,sin(pitch)*100,0,SXF_TRANSFERPITCH)
	TNT1 A 2
    Stop
	
XDeath:
	TNT1 A 0
	TNT1 AA 0 A_SpawnItemEx ("M55Penetrator",cos(-pitch)*24,0,0+(sin(pitch)*24),cos(-pitch)*100,0,sin(pitch)*100,0,SXF_TRANSFERPITCH)
	Stop
	}
}

Actor M55Penetrator : Penetrator
{
Damage 25
States
{
XDEath:
TNT1 A 0
TNT1 A 0 A_Playsound("bulletfleshimpact", 1)
TNT1 A 0 A_SpawnItemEx ("M55Penetrator2",cos(-pitch)*24,0,0+(sin(pitch)*24),cos(-pitch)*100,0,sin(pitch)*100,0,SXF_TRANSFERPITCH)
TNT1 A 1
Stop	
}
}

Actor M55Penetrator2 : Penetrator2
{
Damage 25
States
{
XDeath:
TNT1 A 0
TNT1 A 0 A_Playsound("bulletfleshimpact", 1)
TNT1 A 0 A_SpawnItemEx ("M55Penetrator3",cos(-pitch)*24,0,0+(sin(pitch)*24),cos(-pitch)*100,0,sin(pitch)*100,0,SXF_TRANSFERPITCH)
TNT1 A 1
Stop	
}
}

Actor M55Penetrator3 : Penetrator3
{ Damage 25 }

Actor M55NitroTracer : Tracer
{
Speed 500
Damage 90
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 ("NitroExplosion2",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 M55APTracer : APTracer
{
Damage 30
Decal "BulletDecalNew1"
}

actor NitroExplosion2 : RocketExplosion
{
States    
	{
	Death:
	TNT1 A 0
	TNT1 A 0 A_SpawnItem("WhiteShockwave")
	TNT1 A 2
	TNT1 A 0 A_Explode(360,125)
    Stop
	}
}

actor M55Infrared : PowerupGiver
{
 //Powerup.Color BlueMap, 0.23
  inventory.maxamount 1
  powerup.duration -1800
  powerup.type LightAmp
  Powerup.Colormap 0.0, 0.0, 0.0, 1.0,0.5,0.5
  +INVENTORY.AUTOACTIVATE
}

ACTOR M55Infrared : PowerLightAmp { Powerup.Duration -1800 }