// --------------------------------------------------------------------------
//
// Deagle (Demo weapon)
//
// --------------------------------------------------------------------------


//Weapon Auxiliar
ACTOR FastFireFlash : Inventory
{
	Inventory.MaxAmount 1
}

Actor FasterRevolver: Inventory
{
Inventory.MaxAmount 1
}

ACTOR SlowFireShot : Inventory
{
	Inventory.MaxAmount 1
}



ACTOR "Revolver" : CSDMOWeapon //5010
{
	Weapon.SisterWeapon revolver_rat

+AMMO_OPTIONAL

	Weapon.SelectionOrder 600
  weapon.ammotype "RevolverClip"
  weapon.ammouse 1
  weapon.ammogive 0
  weapon.ammotype2 "RevolverAmmo"
  weapon.ammouse1 1
  weapon.ammouse2 0
  weapon.ammogive2 0 //7
	obituary "%k killed %o with R8 Revolver."
	+WEAPON.WIMPY_WEAPON
	Inventory.Pickupmessage "Picked up a R8 Revolver."
	Tag "R8 Revolver"
	Weapon.UpSound "Revolver/Ready"
	//AttackSound "Deagle/Fire" 
	Scale 0.2
	//+NOAUTOFIRE

	States
	{
	
	
	Deselect:
		    TNT1 A 0 A_TakeInventory("SlowFireShot",1)
		    TNT1 A 0 A_TakeInventory("FastFireFlash",1)
	TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 2, 0, 0)
    TNT1 A 1 
			TNT1 A 0 A_StopSound (6)
				TNT1 A 1 A_ZoomFactor(1.0)
                TNT1 AAAAAAAAAAAAAAAAA 0 A_Lower
                TNT1 AAAAAA 1 A_Lower
		Loop	
	
	Ready:
		W46F H 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("IsBot",1,"BotReady")
  TNT1 A 0 A_TakeInventory("SlowFireShot",1)
		TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		Loop
		

		


	Select:
	TNT1 A 1 A_Raise
	TNT1 AA 0 A_Raise
	TNT1 A 0 ACS_ExecuteAlways(798, 0, 230, 0, 0)//Weapon Weight
	TNT1 A 5 A_TakeInventory("CrosshairType",2)
 
 TNT1 A 0 ACS_NamedExecuteAlways("HSPreviousWeapon", 0, 1, 0, 0)
    TNT1 A 0 A_JumpIfInventory("RAT_Trigger",1,"RAT_TriggerSelect")

		W46A FGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W46B ABCDEFGHIJKLMNOP 1 A_WEAPONREADY(WRF_NOFIRE)
		Goto Ready

	RAT_TriggerSelect:
    TNT1 A 0 A_TakeInventory("Rat_Trigger",1)

		W46A FGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W46B ABCDEFGHIJKLMNOP 1 A_WEAPONREADY//(WRF_NOFIRE)
		Goto Ready



	ToFast:
	TNT1 A 0 A_JumpIfInventory("FasterRevolver", 1, "ToNormal")
        TNT1 A 0 A_Playsound("Function/Alternate")
	  SCOP A 0 A_GiveInventory("FasterRevolver", 1)
	TNT1 A 0 A_Print("Switched to Alternate mode")
		W46F H 10 A_WeaponReady(WRF_NOFIRE)
		Goto Ready
		


	ToNormal:
	  TNT1 A 0 A_TakeInventory("FasterRevolver", 1)
        TNT1 A 0 A_Playsound("Function/Alternate")
	TNT1 A 0 A_Print("Switched to Normal mode")
		W46F H 10 A_WeaponReady(WRF_NOFIRE)
		Goto Ready



	Fire:

	W46F H 0 A_JumpIfNoAmmo("AltFire")
	TNT1 A 0 A_JumpIfInventory("IsBot",1,"BotFire")
	TNT1 A 0 A_JumpIfInventory("FasterRevolver",1,"FastFire")
	TNT1 A 0 A_JumpIfInventory("SlowFireShot",1,"SlowFire")
	
			TNT1 A 0 A_PlaySound ("Revolver/Hammer", 0)
//		W46C ABCDEFGHIJK 1 A_WEAPONREADY(WRF_NOFIRE)
//        W46C A 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_A
        W46C B 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_B
        W46C C 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_C
        W46C D 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_D
        W46C E 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_E
        W46C F 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_F
        W46C G 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_G
        W46C H 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_H
//        W46C I 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_I
        W46C J 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_J
//        W46C K 1 A_WEAPONREADY(WRF_NOFIRE)		TNT1 A 0 A_Refire(1)		Goto FireStop_K


  TNT1 A 0 A_GiveInventory("SlowFireShot",1)			
		W46C P 0 A_Refire
  TNT1 A 0 A_TakeInventory("SlowFireShot",1)


		W46C L 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46C M 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46C N 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46C O 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46C P 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")

  
		W46C O 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46C N 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46C M 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46C L 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_K:
		W46C K 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_J:
		W46C J 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_I:
		W46C I 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_H:
		W46C H 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_G:
		W46C G 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_F:
		W46C F 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_E:
		W46C E 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_D:
		W46C D 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_C:
		W46C C 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_B:
		W46C B 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
FireStop_A:
		W46C A 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")

		Goto Ready



		SlowFire:
	
	W46C Q 1 A_GunFlash
  TNT1 A 0 A_TakeInventory("SlowFireShot",2)

		W46C RSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W46D ABCDEF 1 A_WEAPONREADY(WRF_NOFIRE)
		
		W46D G 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46D H 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46D I 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46D J 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46D K 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46D L 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46D M 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46D N 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		Goto Ready



	FastFire:

	W46F H 0 A_JumpIfNoAmmo("AltFire")

		W46E A 1 A_GunFlash
		W46E B 1 A_WEAPONREADY(WRF_NOFIRE)
		W46E CDEFGHIJK 1 A_WEAPONREADY(WRF_NOFIRE)

		//TNT1 A 0 A_Refire		
		W46E L 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E M 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E N 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")		
		W46E O 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E P 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E Q 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E R 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E S 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E T 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E U 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E V 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E W 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E X 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E Y 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46E Z 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		
		W46F A 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46F B 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46F C 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46F D 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46F E 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46F F 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46F G 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")
		W46F H 1 A_WeaponReady 			TNT1 A 0 A_JumpIfInventory("IsAltFire",1,"ToFast")

		Goto Ready









//Bot compatibility


	BotReady:
		
		W46F H 1 A_WeaponReady
		TNT1 A 0 A_REFIRE
		Loop

	BotFire:
	
		W46E A 1 A_GunFlash
		W46E B 1 A_WEAPONREADY(WRF_NOFIRE)
		W46E CDEFGHIJKL 1 A_WEAPONREADY(WRF_NOFIRE)


		W46E MNOPQRSTUVWXYZ 1 A_Refire
		W46F ABCDEFGH 1 A_Refire

		Goto Ready






  Altfire:
    TNT1 A 0 A_JumpIfInventory("RevolverClip",8,"Ready")
    TNT1 A 0 A_JumpIfInventory("RevolverAmmo",1,"ReloadStart")
    goto Ready


	ReloadStart:
		TNT1 A 0 A_PlaySound("Revolver/Reload", 6)
		W46G AB 1 A_WEAPONREADY(WRF_NOFIRE)
		W46G CDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W46H ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W46I ABCDEFGHIJKLMNOPQ 1 A_WEAPONREADY(WRF_NOFIRE)
		Goto ReloadAmmo
	
	
  ReloadAmmo:
    TNT1 A 0 A_GiveInventory("RevolverClip",1)
    TNT1 A 0 A_TakeInventory("RevolverAmmo",1)
    TNT1 A 0 A_JumpIfInventory("RevolverClip",0,"ReloadEnd")
    TNT1 A 0 A_JumpIfInventory("RevolverAmmo",1,"ReloadAmmo")
    goto ReloadEnd		

	ReloadEnd:
		W46I RSTUVWXYZ 1 A_WEAPONREADY(WRF_NOFIRE)
		W46J AB 1 A_WEAPONREADY(WRF_NOFIRE)
//  TNT1 A 0 A_TakeInventory("SlowFireShot",1)
		Goto Ready




	Flash:
	TNT1 A 0 ACS_ExecuteAlways(799, 0, 2, 0, 0)
	TNT1 A 0 A_GiveInventory("CrosshairGrow", 14)
	TNT1 A 0 A_FireCustomMissile("WeaponSmokePuff",0,0,15,8)
		TNT1 A 0 Bright A_Light1
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_PlaySound ("Revolver/FIRE")
		TNT1 A 0 A_PlaySound("Revolver/Distant", 7)
//		TNT1 A 0 A_FireCustomMissile("RifleCaseSpawn",5,0,12,-6)
	TNT1 A 0 A_JumpIfInventory("IsBot",1,"FlashFast")
		TNT1 A 0 A_JumpIfInventory("FasterRevolver",1,"FlashFast")
        TNT1 A 0 BRIGHT A_FireCustomMissile("Tracer", 0, 0, 11, 0, 0, 0)
		TNT1 A 3 A_FireBullets(0.1, 0.1, -1, 404, "DeagleBullet")//52
		Goto LightDone
		
	FlashFast:
        TNT1 A 0 BRIGHT A_FireCustomMissile("Tracer", frandom(-3.5,3.5), 0, 11, 0, 0, frandom(-1.5,1.5))
  TNT1 A 3 A_FireBullets(8, 8, -1, 404, "DeagleBullet")//52
		Goto LightDone		
		
		
 	Spawn:
		W46Z A -1
		Stop
	}
}