ACTOR DesertEagle : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "Clip1"
	Weapon.AmmoType2 "DesertEagleAmmo"
	Obituary "%o was one-tapped by %k's Desert Eagle."
    AttackSound "None"
    Inventory.PickupSound "Degbol1"
	tag "IBDesertEagle."
	Inventory.Pickupmessage "You got the Desert Eagle!"
	+WEAPON.WIMPY_WEAPON
    +WEAPON.NOAUTOAIM
    +WEAPON.NOAUTOFIRE
    +FORCEXYBILLBOARD
	+WEAPON.NOALERT
	Scale 0.9
	States
	{
    	
		CheckSprint:
		DEGG A 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		TNT1 A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready3
		
	StartSprint:
		DEGG A 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("Accelerate", 1, 1)
		Goto Ready3
		TNT1 A 0 offset(-9,32) 
		TNT1 A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		TNT1 A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		TNT1 A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		TNT1 A 0 offset(-9,32) A_GiveInventory("UsedStamina", 5)
		TNT1 A 0 offset(-9,32)
		D1GF B 1 offset(-9,34) A_SetPitch(pitch -0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(-6,36) A_SetPitch(pitch -0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(-3,38) A_SetPitch(pitch -0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(0,38) A_SetPitch(pitch -0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(3,36) A_SetPitch(pitch -0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(6,34) A_SetPitch(pitch -0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(9,32) A_SetPitch(pitch -0.5, SPF_INTERPOLATE)
		TNT1 A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 offset(-9,32) A_GiveInventory("UsedStamina", 5)
		TNT1 A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		D1GF B 1 offset(9,34) A_SetPitch(pitch +0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(6,36) A_SetPitch(pitch +0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(3,38) A_SetPitch(pitch +0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(0,38) A_SetPitch(pitch +0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(-3,36) A_SetPitch(pitch +0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(-6,34) A_SetPitch(pitch +0.5, SPF_INTERPOLATE)
		D1GF B 1 offset(-9,32) A_SetPitch(pitch +0.5, SPF_INTERPOLATE)
		TNT1 A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		TNT1 A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		
		Goto StopSprint
	StopSprintTired:
		DEGG A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		TNT1 A 0 A_PlaySound("Tired", 2)
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		DEGG A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		DEGG A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		DEGG A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		DEGG A 5 A_WeaponReady
		TNT1 A 0 A_TakeInventory("UsedStamina", 2)
		DEGG A 5 A_WeaponReady
		Goto Ready3
	StopSprint:
		D1GF B 1
		RIFG A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready3
	
	
	Ready3:
	Ready:
	    TNT1 A 0 A_JumpIfInventory("Zoomed",1,"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("IsRunning",1,"CheckSprint")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("Unloading",1,"Unload")
		DEGG A 1 A_Weaponready
		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("IsRunning",1,"CheckSprint")
        TNT1 A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("Unloading",1,"Unload")
		D2AG G 1 A_Weaponready
		Loop
		
	Deselect:
	    TNT1 A 0 A_ZoomFactor(1)
		TNT1 A 0 A_TakeInventory("Zoomed",1)
        DEGG BCDE 1
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 0 A_TakeInventory("TossGrenade", 1)
		TNT1 A 1 A_Lower
		Wait
		
	Select:
		TNT1 A 0 A_Giveinventory("GoSpecial",1)
		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)
		goto selectAnimation
		
	SelectAnimation:
	    TNT1 A 1
		TNT1 AAAAAAAAAAAAAAA 0 A_Raise
        TNT1 A 0 A_PlaySound("DEGCOUT")
        DEGG EDCB 1 A_WeaponReady(WRF_NOFIRE)
		TNT1 A 0 A_GunFlash
		Goto Ready
		
	  Fire:
	    DEAG A 0 A_JumpIfInventory("zoomed",1,"Fire2")
        DEAG A 0 A_JumpIfInventory("DesertEagleAmmo",1,2)
        Goto NoAmmo
        TNT1 AAAA 0
		TNT1 A 0 A_AlertMonsters
        TNT1 A 0 A_PlaySound("DegFir1", 1)
		TNT1 A 0 A_ZoomFactor(0.98)
		DEGF A 2 
		DEGF B 1 A_FireBullets (0.25, 0.25, -1, 100, "ShotgunPuff")
		TNT1 A 0 A_ZoomFactor(1.0)
        RIFF A 0 A_FireCustomMissile("DecorativeTracer", random(-1,1), 0, 0, 0)
		TNT1 A 0 A_Takeinventory("DesertEagleAmmo",1)
        DEGF C 1 
		DEAG A 0 A_FireCustomMissile("PistolCaseSpawn",5,0,0,-8)
		DEGF DEFG 1 
		Goto Ready
		
	Fire2:
        DEAG A 0 A_JumpIfInventory("DesertEagleAmmo",1,2)
        Goto NoAmmo
        TNT1 AAAA 0
		TNT1 A 0 A_AlertMonsters
        TNT1 A 0 A_PlaySound("DegFir1", 1)
		TNT1 A 0 A_ZoomFactor(1.37)
		D2AF A 2 
		D2AF B 1 A_FireBullets (0, 0, -1, 100, "ShotgunPuff")
		TNT1 A 0 A_ZoomFactor(1.4)
        RIFF A 0 A_FireCustomMissile("DecorativeTracer", random(-1,1), 0, 0, 0)
		TNT1 A 0 A_Takeinventory("DesertEagleAmmo",1) 
		DEAG A 0 A_FireCustomMissile("PistolCaseSpawn",0,0,0,-5)
		D2AF CDEFG 1 
		Goto Ready
		
	AltFire:
       TNT1 A 0 A_JumpIfInventory("Zoomed",1,"StopAlt")
	   TNT1 A 0 A_SetCrosshair(41)
	   TNT1 A 0 A_ZoomFactor(1.4)
	   D2GS ABC 1
	   TNT1 A 0 A_GiveInventory("Zoomed",1)
	   Goto Ready2
	   
	 StopAlt:
	 TNT1 A 0 A_SetCrosshair(0)
	 TNT1 A 0 A_TakeInventory("Zoomed",1)
	 TNT1 A 0 A_ZoomFactor(1)
	 D2GS CBA 1
	 Goto Ready
	 
	 UnzoomRel:
	 TNT1 A 0 A_SetCrosshair(0)
	 TNT1 A 0 A_TakeInventory("Zoomed",1)
	 TNT1 A 0 A_ZoomFactor(1)
	 D2GS CBA 1
	 Goto Reload
	 
	 UnzoomUnl:
	 TNT1 A 0 A_SetCrosshair(0)
	 TNT1 A 0 A_TakeInventory("Zoomed",1)
	 TNT1 A 0 A_ZoomFactor(1)
	 D2GS CBA 1
	 Goto Unload
		
	NoAmmo:
		RIFG A 0
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		TNT1 A 0 A_TakeInventory("reloading", 1)
		NoAmmo2:
		RIFG A 0 A_JumpIfInventory("Zoomed",1,"Noammo3")
		RIFG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
	    RIFG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		RIFG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		RIFG A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		RIFG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		Goto Ready3
		
		NoAmmo3:
		RIFG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
	    RIFG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		RIFG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		RIFG A 0 A_JumpIfInventory("ExecuteDownedEnemy", 1, "DoExecution")
		RIFG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		Goto Ready2
		
	Reload:
		DEGG A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_JumpIfInventory("DesertEagleAmmo",10,"Ready")
			
        TNT1 A 0 A_JumpIfInventory("Clip1",3,3)
        Goto NoAmmo
        TNT1 AAA 0
		TNT1 A 0 A_JumpIfInventory("Zoomed",1,"UnzoomRel")
		D2AG A 0 A_Takeinventory("Zoomed",1)
        TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		TNT1 A 0 A_PlaySound("DEGCOUT")
		DEGR GFEDCB 1
		TNT1 A 0 A_JumpIfInventory("HasUnloaded", 1, 3)
		DEGR A 13
		RIFR C 0 A_FireCustomMissile("EmptyPistolClipSpawn",-18,0,18,-15)
		TNT1 A 0 A_PlaySound("DEGCIN")
		DEGR BCDEFG 1
		TNT1 A 0 A_PlaySound("DEAGBOL2")		
		TNT1 A 0 A_Takeinventory("HasUnloaded",1)
		DEAG A 0 A_JumpIfInventory("DesertEagleAmmo",1,"InsertBullets2")//9+1 effect
		
	TurboReload:
		DEAG A 0 A_Takeinventory("HasUnloaded",1)
        PISS BA 0
        Goto InsertBullets
		
	InsertBullets:
		TNT1 AAAA 0
		DEAG A 0 A_JumpIfInventory("DesertEagleAmmo",9,15)
		DEAG A 0 A_JumpIfInventory("Clip1",3,3)
		Goto Ready
        TNT1 AAAAAA 0
		DEAG A 0 A_Giveinventory("DesertEagleAmmo",1)
		DEAG A 0 A_Takeinventory("Clip1",3)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		DEAG A 0 A_Takeinventory("Reloading",1)
		
		DEAG A 0 A_Refire
        Goto Ready
		TNT1 AAAA 0
		DEAG A 0 A_Takeinventory("Reloading",1)
		
		DEAG A 0 A_Refire
        Goto Ready
		
	InsertBullets2:
		TNT1 AAAA 0
		DEAG A 0 A_JumpIfInventory("DesertEagleAmmo",10,15)
		DEAG A 0 A_JumpIfInventory("Clip1",3,3)
		Goto Ready
        TNT1 AAAAAA 0
		DEAG A 0 A_Giveinventory("DesertEagleAmmo",1)
		DEAG A 0 A_Takeinventory("Clip1",3)
		Goto InsertBullets2
		
		TNT1 AAAAAAAAAA 0
		DEAG A 0 A_Takeinventory("Reloading",1)
		
		DEAG A 0 A_Refire
        Goto Ready
		TNT1 AAAA 0
		DEAG A 0 A_Takeinventory("Reloading",1)
		
		DEAG A 0 A_Refire
        Goto Ready
		
	Unload:
		//DEGG A 1 A_WeaponReady
		TNT1 A 0 A_Takeinventory("Unloading",1)
		TNT1 A 0 A_JumpIfInventory("DesertEagleAmmo",1,3)
        Goto NoAmmo
        TNT1 AAA 0
		TNT1 A 0 A_JumpIfInventory("Zoomed",1,"UnzoomUnl")
		DEGG A 0 A_Takeinventory("Zoomed",1)
        DEGG A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_GiveInventory ("Pumping", 1)
		TNT1 A 0 A_Takeinventory("Reloading",1)
		TNT1 A 0 A_PlaySound("DEGCOUT")
		DEGR GFEDCB 1
		DEGU ABC 2
		TNT1 A 0 A_Playsound("DEGBOL2")
		TNT1 A 0 A_Giveinventory("HasUnloaded",1)
		TNT1 A 0 A_JumpIfInventory("DesertEagleAmmo",1,"RemoveBullets")
		
	RemoveBullets:
		TNT1 AAAA 0
		DEAG A 0 A_JumpIfInventory("DeserteagleAmmo",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		DEAG A 0 A_Takeinventory("DesertEagleAmmo",1)
		DEAG A 0 A_Giveinventory("Clip1",3)
		Goto RemoveBullets
		
		TNT1 AAAAAAAAAA 0
		DEAG A 0 A_Takeinventory("Reloading",1)
		
		DEAG A 0 A_Refire
        Goto Ready
		TNT1 AAAA 0
		DEAG A 0 A_Takeinventory("Reloading",1)
		
		DEAG A 0 A_Refire
        Goto Ready
		
		
 	Spawn:
		DEGP A -1
		Stop
	}
}

ACTOR DesertEagleAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 10
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 10
   Inventory.Icon DEGPA0
}