// pretty sure WildWeasel made this, although I think(?) it
// was for an EDGE mod and I had to basically rewrite it
// in DECORATE. idunno it's so old but yeah credit to WW
// for the sprites and sounds anyways

ACTOR Magnum : DoomWeapon 25137
{ 
 //$Category Weapons
	+CHEATNOTWEAPON
	//+WEAPON.NOAUTOSWITCHTO
	+WEAPON.WIMPY_WEAPON
	Decal BulletChip
	Weapon.AmmoType "Magshot" 
	Weapon.AmmoGive 6
	Weapon.AmmoUse 1
	Weapon.AmmoType2 "magnumammo" 
	Weapon.AmmoGive2 12
	Weapon.AmmoUse2 0
	Inventory.PickupSound "misc/w_pkup" 
	Inventory.PickupMessage "You found a .44 Magnum revolver!"
	Obituary "%o thought %k fired 6 rounds ... %o felt too lucky today."
	Weapon.SelectionOrder 760
        +NOALERT
	+AMMO_OPTIONAL
        +ALT_AMMO_OPTIONAL
        +axeblood
        -Weapon.NOLMS
        +Weapon.Noautofire
        Weapon.Kickback 210//300
  Weapon.preferredSkin "PistolSkin"
		scale 0.14
	States 
	{ 
	Spawn: 
	44MG A -1 
	Loop 
	Ready: 
	REVG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
	TNT1 A 0 A_JumpIfInventory("IsReloading",1,"Reload")
	//NULL A 0 A_JumpIfNoAmmo("Reload")
	LOOP
	Deselect: 
	REVG A 0 A_Lower 
	REVG A 1 A_Lower 
	Loop 
	Select: 
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "Ready")
		TNT1 A 0 A_Raise
		REVR I 1 A_Raise
		TNT1 A 0 A_Raise
		REVR I 1 A_Raise
    BERT K 0 ACS_ExecuteAlways(779,0, 13,0,0)
		TNT1 AAAAAAAAAAA 0 A_Raise
		    REVR H 1
			REVR G 1     
			REVR F 2     
			REVR E 2     
			REVR D 2     
			REVR C 3     
			REVR B 2     
			REVR A 1
			Goto Ready
	Fire:
		TNT1 A 0 A_JumpIfInventory("IsReloading",1,"Reload")
		REVG A 0 A_JumpIfNoAmmo("Reload")
		REVG A 0 A_PlaySoundEx("weapons/magnumtrigger", "SoundSlot5")
		REVF BB 1
		TNT1 A 0 A_SetAngle(angle+random(-1,1))
        TNT1 A 0 A_SetPitch(pitch+random(-1,1))
		
		REVG A 0 A_Playweaponsound("weapons/magnumfire") 
    NULL AAA 0 A_SpawnItemEx ("PistolEcho", 0,0,0, 0,0,0, 0, 160)
    NULL A 0 A_SpawnItemEx ("ChaingunEcho", 0,0,0, 0,0,0, 0, 160)
		NULL A 0 A_RailAttack(random(9,15), 1, 0, "none", "none", 1, 0, "SSTBulletpuff2a",0,0,2100,140,1.5,1.0,"MagnumTrail",4)
		//NULL A 0 A_RailAttack(random(9,15), 4, 0, "none", "DD DD DD", 1, 0, "SSTBulletpuff2a")
		NULL AAAAAA 0 A_FireBullets(0.1,0.1, -1,4,"SSTShotgunPuff",0)//4
		//PISG A 0 A_FireCustomMissile ("MagnumTracer", 0, 0, 11, 2, 0, 0)
		NULL A 0 A_FireBullets(0.25,0.25,-1,20,"SSTBulletpuff2a",1)
		NULL A 0 A_FireCustomMissile("GunAlert2",0,0,0,0)

		TNT1 A 0 A_SetAngle(angle+random(-1,1))
        TNT1 A 0 A_SetPitch(pitch-5)//6
		
    	TNT1 A 0 //ACS_ExecuteAlways(925,0, 800,0,0)
		REVF A 2 BRIGHT
		REVG B 1
		REVG C 1
		REVG D 2
		REVG E 2
		REVG BB 1 A_WeaponReady
		REVG AA 1 A_WeaponReady
		Goto ready

	AltFire:
		REVG F 1     
		REVG G 1     
		REVG H 1     
		NULL A 5     //8
		NULL A 0 A_Refire
	AltHold:
		NULL A 1
		NULL A 0 A_Refire
		REVG I 1 A_Playsound("weapons/magnumwhip") 
		REVM A 1     
		REVM B 1   
		REVM C 1 A_Saw("","punches",26,"sstbulletpuff1")
		REVM C 0 //A_Saw
		REVM D 1 //A_Saw 
		REVM E 1 //A_punch   
		NULL A 5   //6  
		REVG I 2 A_WeaponReady(4) 
		REVG H 2 A_WeaponReady(4)
		REVG G 2 A_WeaponReady(4)
		REVG F 2 A_WeaponReady(4)
		Goto ready
	Nvm:
	NULL A 0
	Goto Ready
	Reload:
		TNT1 A 0 A_Takeinventory("IsReloading",1)
	NULL A 0 A_JumpIfInventory("magshot",6,"nvm")
	NULL A 0 A_JumpIfInventory("magnumammo",1,2)
	REVF B 4 A_PlaySoundEx("weapons/magnumtrigger", "SoundSlot5")
	Goto Ready
	NULL A 0
		REVR A 3 A_Playsound("weapons/magnumreload")
		REVR B 3     
		REVR C 10     
		REVR D 3     
		REVR E 3     
		REVR F 3     
		REVR G 3     
		REVR H 3     
		REVR G 10
	Load:
		NULL A 0
		BRTR A 0 A_TakeInventory("magnumammo", 1)
		BRTR A 0 A_GiveInventory("Magshot", 1)
    	NULL A 0 A_FireCustomMissile("BulletCasing",0+random(-16,16),0,2,3)
		BRTR A 0 A_JumpIfInventory("Magshot",6,"ReloadDone")
		BRTR A 0 A_JumpIfInventory("magnumammo",1,"Load")
		BRTR A 0
		Goto ReloadDone
	ReloadDone:
			REVR J 3     
			REVR I 3     
			REVR J 3     
			REVR J 10     
			REVR K 3     
			REVR I 3     
			REVR J 3     
			REVR G 3     
			REVR F 3     
			REVR E 3     
			REVR D 3     
			REVR C 4     
			REVR B 3     
			REVR A 2
			Goto Ready
	} 
} 

ACTOR Magshot : Ammo
{
      +IgnoreSkill
    Inventory.MaxAmount 6
}

ACTOR MagnumPuff : SSTShotgunPuff
{
}

ACTOR MagnumAmmo : Ammo 25126
{
 //$Category Ammunition
    Inventory.MaxAmount 120
    Inventory.Amount	6
	Ammo.BackpackAmount 12
	Ammo.BackpackMaxAmount 150
	Inventory.PickupMessage "Found 6 magnum rounds."
    States
    {
    Spawn:
    	MAG1 A -1
    	LOOP
	}
}
