ACTOR DualRifles : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	YScale 0.6
	XScale 0.8
	Weapon.SelectionOrder 4500
	Weapon.AmmoType1 "Clip2"
	Weapon.AmmoType2 "dOUBLERifleAmmo"
	Obituary "%o was shot down by %k's assault rifle."
    AttackSound "None"
    Inventory.PickupSound "CLIPIN"
	Inventory.Pickupmessage "$GOTRIFLE"
    +WEAPON.NOAUTOAIM
    +WEAPON.NOALERT
    //+WEAPON.NOAUTOFIRE
	+WEAPON.NO_AUTO_SWITCH
	+FORCEXYBILLBOARD
	Tag "Dual Rifles"
    Scale 0.8
	States
	{
	
	TacticalWarning:
		TNT1 A 4
		DURI A 0 A_Print("Warning! You are playing on Tactical Mode. This mode is very different from the regular game (sprint is limited, guns have more recoil, etc.) and is only recommended for advanced players wanting a more tactical experience. If you want to play the original arcade-ish experience of Brutal Doom, restart the game as a different 'player class'.", 4)
		Goto LetsGetStarted
	WarmUp:
		DURI A 0
		DURI A 0 A_TakeInventory("JustStartedGame", 1)
		DURI A 0 A_JumpIfInventory("IsTacticalClass", 1, "TacticalWarning")
		
	LetsGetStarted:	
		TNT1 A 5 A_WeaponReady
		PUNS ABCD 1 A_WeaponReady
		DURI A 0 A_PlaySound("Knuckled")
		PUNS E 7 A_WeaponReady
		PUNS FGFE 3 A_WeaponReady
		PUNS DCB 1 A_WeaponReady
		TNT1 A 5 A_WeaponReady
		R2RL ABCDE 1 A_WeaponReady
        R2RL E 1 A_WeaponReady
		RIFR HIKL 1 A_WeaponReady
		DURI A 0 A_PlaySound("DryFire")
		RIFR M 1 A_WeaponReady
		RIFR NOPQRST 1 A_WeaponReady
		Goto Ready3
	
	
	
	
	
	
	CheckSprint:
		DURI A 1 A_WeaponReady(WRF_NOFIRE)
		DURI A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		DURI A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready3
		
	StartSprint:
		DURI A 1 A_WeaponReady(WRF_NOFIRE)
		DURI A 0 A_Takeinventory("Zoomed",1)
		DURI A 0 A_Takeinventory("ADSmode",1)
		DURI A 0 A_ZoomFactor(1.0)
		DURI A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		DURR A 0 offset(-9,32) 
		DURI A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		DURI 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.
		DURI A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		DURI A 0 offset(-9,32) A_GiveInventory("UsedStamina", 9)
		DURI A 0 offset(-9,32)
		DURR A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		DURR A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		DURR A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		DURR A 1 offset(0,38) A_SetPitch(pitch -0.5)
		DURR A 1 offset(3,36) A_SetPitch(pitch -0.5)
		DURR A 1 offset(6,34) A_SetPitch(pitch -0.5)
		DURR A 1 offset(9,32) A_SetPitch(pitch -0.5)
		DURI A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		DURI A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        DURI A 0 A_JumpIfInventory("Taunting",1,"Taunt")
        DURI A 0 A_JumpIfInventory("Reloading",1,"Reload")
		DURI A 0 offset(-9,32) A_GiveInventory("UsedStamina", 9)
		DURI A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		DURR A 1 offset(9,34) A_SetPitch(pitch +0.5)
		DURR A 1 offset(6,36) A_SetPitch(pitch +0.5)
		DURR A 1 offset(3,38) A_SetPitch(pitch +0.5)
		DURR A 1 offset(0,38) A_SetPitch(pitch +0.5)
		DURR A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		DURR A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		DURR A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		DURI A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		DURI A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		
		Goto StopSprint
	StopSprintTired:
		DURI A 1 
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		DURI A 0 A_PlaySound("Tired", 2)
		DURI A 0 A_TakeInventory("UsedStamina", 2)
		DURI A 5 A_WeaponReady
		DURI A 0 A_TakeInventory("UsedStamina", 2)
		DURI A 5 A_WeaponReady
		DURI A 0 A_TakeInventory("UsedStamina", 2)
		DURI A 5 A_WeaponReady
		DURI A 0 A_TakeInventory("UsedStamina", 2)
		DURI A 5 A_WeaponReady
		DURI A 0 A_TakeInventory("UsedStamina", 2)
		DURI A 5 A_WeaponReady
		Goto Ready3
	StopSprint:
		DURI A 1 A_WeaponReady(WRF_NOFIRE)
		DURI A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready3
	
	
	SelectAnimation:
        TNT1 AA 1 A_JumpIfInventory("GoFatality", 1, "Steady")
		DURI A 0 A_GunFlash
		DURI A 0 A_JumpIfInventory("JustStartedGame",1,"WarmUp")
        DURI A 0 A_PlaySound("CLIPIN")
		DURI A 0 A_Takeinventory("BDWeaponACtion",1)
        DURI A 1 Offset(0, 50)
		DURI A 1 Offset(0, 42)
		DURI A 1 Offset(0, 38)
		DURI A 1 Offset(0, 34)
        TNT1 AAAAAAAA 0
        DURI A 0 //A_JumpIfInventory("RifleAmmo",1,2)
        //Goto Reload
		DURI A 0 A_Takeinventory("StartDualWield",1)
        TNT1 AAAA 0
		Goto Ready3
		
	NoAmmoOnSecondGun:
		DURI A 2
	Ready:
	Ready3:
		DURI A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		DURI A 0 A_JumpIfInventory("BDWeaponACtion",1,"WeaponActions")
		DURI A 0 A_JumpIfInventory("JustStartedGame",1,"WarmUp")
		DURI A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		DURI A 0 A_JumpIfInventory("Unloading",1,"Unload")
		DURI A 0 A_JumpIfInventory("StartDualWield",1,"DualWield")
		Loop
		
    
	DualWield:
		DURI A 1
		DURI A 0 A_Takeinventory("StartDualWield",1)
		DURI A 0 A_SelectWEapon("Rifle")
		Goto Ready
	
	Deselect:
		DURI A 0
		DURI A 0 A_Takeinventory("Zoomed",1)
		DURI A 0 A_Takeinventory("ADSmode",1)
		DURI A 0 A_TakeInventory("TossGrenade", 1)
		DURI A 0 A_TakeInventory("Kicking",1)
        DURI A 0 A_TakeInventory("Taunting",1)
        DURI A 0 A_TakeInventory("Reloading",1)
		DURI A 0 A_TakeInventory("Unloading",1)
		DURI A 0 A_TakeInventory("Salute1", 1)
		DURI A 0 A_TakeInventory("Salute2", 1)
		DURI A 0 A_Takeinventory("RifleSelected",1)
        DURI A 0 A_ZoomFactor(1.0)

		DURI A 1 Offset(0, 34)
		DURI A 1 Offset(0, 38)
		DURI A 1 Offset(0, 42)
		DURI A 1 Offset(0, 50)
		TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait
		
	Select:
		DURI A 0 A_Giveinventory("GoSpecial",1)
		DURI A 0 A_Takeinventory("FistsSelected",1)
		DURI A 0 A_Takeinventory("SawSelected",1)
		DURI A 0 A_Takeinventory("ShotgunSelected",1)
		DURI A 0 A_Takeinventory("SSGSelected",1)
		DURI A 0 A_Takeinventory("MinigunSelected",1)
		DURI A 0 A_Takeinventory("PlasmaGunSelected",1)
		DURI A 0 A_Takeinventory("RocketLauncherSelected",1)
		DURI A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		DURI A 0 A_Takeinventory("BFGSelected",1)
		DURI A 0 A_Takeinventory("BFG10kSelected",1)
		DURI A 0 A_Takeinventory("RailGunSelected",1)
		DURI A 0 A_Takeinventory("SubMachineGunSelected",1)
		DURI A 0 A_Takeinventory("RevenantLauncherSelected",1)
		DURI A 0 A_Takeinventory("LostSoulSelected",1)
		DURI A 0 A_Takeinventory("FlameCannonSelected",1)
		DURI A 0 A_Takeinventory("HasBarrel",1)
		DURI A 0 A_TakeInventory("TossGrenade", 1)
		DURI A 0 A_TakeInventory("IsRunning", 1)
		DURI A 0 A_Giveinventory("RifleSelected",1)
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAA 0 A_Raise
		Goto SelectAnimation
	
    Fire:
        DURI A 0 A_JumpIfInventory("DoubleRifleAmmo",1,2)
        Goto NoAmmo
        TNT1 AA 0
		DURI A 0 A_PlaySound("FARRIF", 5)
		DURI A 0 A_Takeinventory("RifleAmmo",1)
        DURI A 0 A_PlaySound("weapons/rifle", 1)
		//RIFF A 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 16, -4, 0, 0)
		
		DURI A 0 A_AlertMonsters
		
		DURI A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		DURI B 1 BRIGHT A_FireBullets (8, 3, -1, 25, "HitPuff", FBF_NORANDOM)
        RIFF A 0 A_FireCustomMissile("DecorativeTracer", random(-5,5), 0, 16, -6, 0, random(-2,2))
		DURI A 0 A_ZoomFactor(0.97)
        DURI A 0 A_SetPitch(-1.2 + pitch)
		DURI A 0 A_Takeinventory("DoubleRifleAmmo",1)
		DURI A 0 A_SetPitch(+0.4 + pitch)
		DURI C 1 A_FireCustomMissile("RifleCaseSpawn",5,0,8,-14)
		DURI A 0 A_ZoomFactor(1.0)
		DURI A 0 A_SetANgle(angle + random(-1, 1))
		DURI A 1
		
		DURI A 0 A_JumpIfInventory("DoubleRifleAmmo",1,1)
        Goto NoAmmo
		DURI A 0 A_JumpIfInventory("RifleAmmo",1,1)//Checks if single gun is not depleted
        Goto NoAmmoOnSecondGun
		
		DURI A 0 A_PlaySound("FARRIF", 4)
        DURI A 0 A_PlaySound("weapons/rifle", 6)
		//RIFF A 0 A_FireCustomMissile("GunFireSmoke", 0, 0, -16, -4, 0, 0)
		
		DURI A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
		DURI D 1 BRIGHT A_FireBullets (8, 3, -1, 25, "HitPuff", FBF_NORANDOM)
        RIFF A 0 A_FireCustomMissile("DecorativeTracer", random(-5,2), 0, -16, -6, 0, random(-2,2))
		DURI A 0 A_ZoomFactor(0.97)
        DURI A 0 A_SetPitch(-1.2 + pitch)
		DURI A 0 A_Takeinventory("DoubleRifleAmmo",1)
		DURI A 0 A_SetPitch(+0.4 + pitch)
		DURI E 1 A_FireCustomMissile("RifleCaseSpawn",5,0,-8,-14)
		DURI A 0 A_ZoomFactor(1.0)
		DURI A 0 A_SetANgle(angle + random(-1, 1))
		DURI A 2

		DURI A 0 A_Refire
		DURI A 4 A_WeaponReady(1)
		Goto Ready3
	
     
	NoAmmo:
		DURI A 1
		RIFG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_Takeinventory("Zoomed",1)
		RIFG A 0 A_Takeinventory("ADSmode",1)
		RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
		NoAmmo2:
		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")
		DURI A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOFIRE)
		RIFG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		RIFG A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		RIFG A 0 A_JumpIfInventory("Clip2",1,"Reload")
		RIFG A 0 A_JumpIfInventory("FiredPrimary",1,"NoAmmo2")
		Goto Ready3
	
    Reload:
		DURI A 1 A_WeaponReady
		DURI A 0 A_ZoomFactor(1.0)
		DURI A 0 A_Takeinventory("Reloading",1)
		DURI A 0 A_Takeinventory("ADSmode",1)
		DURI A 0 A_Takeinventory("Zoomed",1)
		DURI A 0 A_JumpIfInventory("DoubleRifleAmmo",62,76)
		DURI A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
        DURI A 0 A_JumpIfInventory("Clip2",1,3)
        Goto NoAmmo
        TNT1 AAA 0
		DURI A 0 A_Takeinventory("Zoomed",1)
        DURI A 0 A_PlaySound("Reload")
		DURI A 0 A_GiveInventory ("Pumping", 1)
		DURI A 0 A_Takeinventory("Reloading",1)
		DURI A 0 A_JumpIfInventory("TurboReload",1,"TurboReload")
		DURI A 0
        
		DURI A 1 Offset(0, 34)
		DURI A 1 Offset(0, 38)
		DURI A 1 Offset(0, 42)
		DURI A 1 Offset(0, 50)
		DURI A 0 Offset(0, 32)
		TNT1 A 5
		DURI A 0 A_PlaySound("RELOAD", 1)//reload sound
		DURI A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
		DURI A 0 A_FireCustomMissile("EmptyClipSpawn",185,0,8,-4)
		R2RR ABCDDDDDDEFGHIIJJKLMNO 1
		TNT1 A 10
		DURI A 0 A_PlaySound("RELOAD", 1)//reload sound
		DURI A 0 A_JumpIfInventory("HasUnloaded", 1, 2)
		DURI A 0 A_FireCustomMissile("EmptyClipSpawn",-5,0,8,-4)
		R2RL ABCDDDDDDEFGHIIJJKLMNO 1
		DURI A 0 A_TakeInventory("StopDualWield", 1)
		DURI A 0 A_TakeInventory("FiredPrimary", 1)
		DURI A 0 A_TakeInventory("FiredSecondary", 1)
		TNT1 A 5
		
		DURI A 1 Offset(0, 50)
		DURI A 1 Offset(0, 42)
		DURI A 1 Offset(0, 38)
		DURI A 1 Offset(0, 34)
		DURI A 0 Offset(0, 32)
		DURI A 0 A_Takeinventory("HasUnloaded",1)
		DURI A 0 A_JumpIfInventory("DoubleRifleAmmo",1,"InsertBullets2")//30+1 effect
		Goto InsertBullets
		
	TurboReload:
		DURI A 0 A_Takeinventory("HasUnloaded",1)
		RIFS ABC 0
        Goto InsertBullets
		
	InsertBullets:
		TNT1 AAAA 0
		DURI A 0 A_JumpIfInventory("DoubleRifleAmmo",60,15)
		DURI A 0 A_JumpIfInventory("Clip2",1,3)
		Goto FinishReloading
        TNT1 AAAAAA 0
		DURI A 0 A_Giveinventory("RifleAmmo",1)
		DURI A 0 A_Giveinventory("DoubleRifleAmmo",1)
		DURI A 0 A_Takeinventory("Clip2",1)
		Goto InsertBullets
		
		TNT1 AAAAAAAAAA 0
		DURI A 0 A_Takeinventory("Reloading",1)
		
		DURI A 0 A_Refire
        Goto Ready3
		TNT1 AAAA 0
		DURI A 0 A_Takeinventory("Reloading",1)
		
		DURI A 0 A_Refire
        Goto Ready3
		
	InsertBullets2:
		TNT1 AAAA 0
		DURI A 0 A_JumpIfInventory("DoubleRifleAmmo",62,15)
		DURI A 0 A_JumpIfInventory("Clip2",1,3)
		Goto FinishReloading
        TNT1 AAAAAA 0
		DURI A 0 A_Giveinventory("RifleAmmo",1)
		DURI A 0 A_Giveinventory("DoubleRifleAmmo",1)
		DURI A 0 A_Takeinventory("Clip2",1)
		Goto InsertBullets2
		
		TNT1 AAAAAAAAAA 0
		DURI A 0 A_Takeinventory("Reloading",1)
		DURI A 0 A_Refire
        Goto Ready3
		TNT1 AAAA 0
		DURI A 0 A_Takeinventory("Reloading",1)
		
		DURI A 0 A_Refire
        Goto Ready3	
		
	FinishReloading:
		DURI A 0
		DURI A 0 A_Refire
		Goto Ready3
		
		
		
		
		
		
	Unload:
		DURI A 1
		DURI A 0 A_Takeinventory("Unloading",1)
        DURI A 0 A_JumpIfInventory("DoubleRifleAmmo",1,3)
        Goto Ready3
        
		
	RemoveBullets:
		TNT1 AAAA 0
		DURI A 0 A_JumpIfInventory("DoubleRifleAmmo",1,3)
		Goto FinishUnload
        TNT1 AAAAAA 0
		DURI A 0 A_Takeinventory("RifleAmmo",1)
		DURI A 0 A_Takeinventory("DoubleRifleAmmo",1)
		DURI A 0 A_Giveinventory("Clip2",1)
		Goto RemoveBullets
	
	FInishUnload:
		TNT1 AAA 0
		DURI A 0 A_GiveInventory("StopDualWield")
		DURI A 0 A_Takeinventory("Zoomed",1)
        DURI A 0 A_PlaySound("Reload")
		DURI A 0 A_GiveInventory ("Pumping", 1)
		DURI A 0 A_Takeinventory("Unloading",1)
		R2RL ONMLKJIHGFEDCBA 1
		R2RR ONMLKJIHGFEDCBA 1
		DURI A 0 A_GiveInventory("HasUnloaded", 1)
		DURI A 0 A_TakeInventory("StopDualWield")
		DURI A 0 A_Takeinventory("Unloading",1)
		Goto Ready
		
		
		
 	Spawn:
		RIFL A -1
		Stop
	}
}
