ACTOR Magnum : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Weapon.SelectionOrder 500
	Weapon.AmmoType1 "Ammo357"
	Weapon.AmmoType2 "MagnumAmmo"
	Obituary "%o was shot down by %k's assault Magnum."
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "$GOTMagnum"
    +WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Tag "S&W Magnum .357"
	States
	{
	
	Spawn:
		TNT1 A 1
		TNT1 A 0 A_SpawnItemEx("MagnumWeapon", 0, 0, 0, momx, momy, momz)
		Stop
	
	Ready:
	Ready3:
		REVO A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		REVO A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        REVO A 0 A_JumpIfInventory("Reloading",1,"Reload")
		REVO A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"----" # 0 A_JumpIfInventory("UsedBandage", 1, "UseBandages")
		Loop
	
	Deselect:
		REVO AAAAAA 1 A_Lower
		TNT1 A 1 A_Lower
		Wait
		
	Select:
		REVO AAA 1 A_Raise
		TNT1 AAAAAAAAA 0 A_Raise
		Goto Ready3
	
    Fire:
        REVO A 0 A_JumpIfInventory("MagnumAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		REVO A 0 A_AlertMonsters
		
		TNT1 A 0 A_FireBullets (0.0, 0.0, -1, 60, "M14Puff", FBF_NORANDOM, 400)
		TNT1 A 0 A_FireBullets (2.0, 2.0, -1, 35, "M14Puff", FBF_NORANDOM)
		REVO A 0 A_PlaySound("M19FIRE", 1)
		SMGG A 0 A_PlaySound("FARM16", 6) //play a similar sound that can be heard further
		REVO B 1 BRIGHT A_FireCustomMissile("SmokeSpawner", random(-0.3,0.3), 0, 0, 0, 0, random(-0.3,0.3))
		REVO C 1
		REVO A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
        REVO A 0 A_FireCustomMissile("DecorativeTracer", random(-1,1), 0, 0, -12, 0, random(-1,1))
		REVO A 0 A_ZoomFactor(0.96)
		REVO A 0 A_SetPitch(pitch-1.6)
		REVO A 0 A_Takeinventory("MagnumAmmo",1)
		REVO D 1
		REVO A 0 A_ZoomFactor(1.0)
		REVO EF 1 A_SetPitch(pitch+0.4)
		REVO A 1
		REVO A 0 A_SetPitch(pitch+0.3)
		REVO A 1
		REVO A 1 A_SetPitch(pitch+0.1)
		REVO A 15 A_weaponready
		TNT1 A 0 A_Refire
		Goto Ready3
	
    Reload:
		REVO A 1 A_WeaponReady
		REVO A 0 A_ZoomFactor(1.0)
		REVO A 0 A_Takeinventory("Reloading",1)
		REVO A 0 A_Takeinventory("ADSmode",1)
		REVO A 0 A_Takeinventory("Zoomed",1)
		REVO A 0 A_JumpIfInventory("MagnumAmmo",6,"Ready3")
        REVO A 0 A_JumpIfInventory("Ammo357",1,3)
        Goto FinishReloading
        TNT1 AAA 0
		REVO A 0 A_Takeinventory("Zoomed",1)
		REVO A 0 A_GiveInventory ("Pumping", 1)
		REVO A 0 A_Takeinventory("Reloading",1)
		
		REVO A 0
		TNT1 A 0 A_PLaySound("RELO1", 4)
        REVR ABCDEF 1
		TNT1 A 10
		Goto InsertBullets
		
		
	InsertBullets:
		TNT1 AAAA 0
		REVO A 0 A_JumpIfInventory("MagnumAmmo",6,15)
		REVO A 0 A_JumpIfInventory("Ammo357",1,3)
		Goto FinishReload
        TNT1 AAAAAA 0
		REVO A 0 A_Giveinventory("MagnumAmmo",1)
		REVO A 0 A_Giveinventory("DoubleMagnumAmmo",1)
		REVO A 0 A_Takeinventory("Ammo357",1)
		TNT1 A 0 A_PlaySound("insertshell")
		TNT1 A 10 A_FireCustomMissile("PistolCaseSpawn",5,0,6,-14)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		REVO A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload	
		TNT1 AAAA 0
		REVO A 0 A_Takeinventory("Reloading",1)
        Goto FinishReload	

	FinishReloading:
		REVO A 0
		REVO A 0 A_Refire
		Goto Ready3
		
		

		
	FinishReload:
		REVR FEDCBA 1
		Goto Ready3		
		
				
		
	NoAmmo:
		REVO A 0
		REVO A 0 A_ZoomFactor(1.0)
		REVO A 0 A_Takeinventory("Zoomed",1)
		REVO A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
	NoAmmo2:
		REVO A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
        REVO A 0 A_JumpIfInventory("Reloading",1,"Reload")
		REVO A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		REVO A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOPRIMARY)
		REVO A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		REVO A 0 A_JumpIfInventory("Ammo357",1,"Reload")
		Goto Ready3
	}
}

ACTOR MagnumAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 6
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 6
   Inventory.Icon "WPISA0"
}