//   BARRACUDA BA27-SC ASSAULT RIFLE
//////////////////////

Actor arifle_normflash : Inventory { Inventory.MaxAmount 1 }
Actor arifle_zoomflash : Inventory { Inventory.MaxAmount 1 }

actor barracudarifle : weapon replaces Chaingun{
	Tag "Barracuda Rifle"
	
	weapon.selectionorder 150
	inventory.pickupsound "weapons/ar_clipin"
	inventory.pickupmessage "Barracuda BA27-SC Assault Rifle"	
	weapon.ammotype "barraclip"
	weapon.ammotype2 "arifle_ammobox"
	weapon.ammouse 0//1
	weapon.ammogive2 18
	weapon.kickback 100
	Weapon.preferredSkin "ARifleSkin"
	//weapon.bobstyle inverse
	//weapon.bobrangeX 0.4
	//weapon.bobrangeY 0.75
	//weapon.bobspeed 2.5
	scale 0.32
	+AMMO_OPTIONAL
	+NOALERT
	+WEAPON.NOAUTOAIM
   	states{
		spawn:
			ARXW A -1
			loop
	
		Flash:
			NULL A 0 A_JumpIfInventory("arifle_normflash", 1, "normflash")
			NULL A 0 A_JumpIfInventory("arifle_zoomflash", 1, "zoomflash")
			Stop
		AltFlash:
			Goto Flash
	
	
		ready:		
			ARXI A 1 A_WeaponReady
			NULL A 0 A_JumpIfInventory("TossGrenade", 1, "Grenade")
			TNT1 A 0 A_JumpIfInventory("SprintingPlayer", 1, "Sprint")
			NULL A 0 A_JumpIfInventory("AltFuncSwitch", 1, "ZoomWeapon")
			NULL A 0 A_JumpIfInventory("ReloadingWeapon",1,"Reload")
			loop
				
		readyzoom:
			ARZI A 1 A_WeaponReady(WRF_NOBOB)
			NULL A 0 A_JumpIfInventory("AltFuncSwitch", 1, "UnZoomWeapon")
			TNT1 A 0 A_JumpIfInventory("SprintingPlayer", 1, "UnZoom2Sprint")
			NULL A 0 A_JumpIfInventory("TossGrenade", 1, "UnZoom2Gren")
			NULL A 0 A_JumpIfInventory("ReloadingWeapon",1,"UnZoom2Relo")
			loop

		UnZoom2Sprint:
			TNT1 A 0 ACS_ExecuteAlways(Player_ChangeSpeed,0,100,0,0)
			TNT1 A 0 A_ZoomFactor(1.0)
			ARZU EDCBA 1
			TNT1 A 0 A_TakeInventory("barrazoom", 1)
		Sprint:
			TNT1 A 0 A_JumpIfInventory("PlayerStamina", 1, "SprStart")
			TNT1 A 0 A_TakeInventory("SprintingPlayer",1)
			goto ready
		SprStart:
			TNT1 A 0 A_PlaySound("sfx/sprintstart",CHAN_AUTO)
			TNT1 A 0 ACS_ExecuteAlways(Player_ChangeSpeed,0,200,0,0)
			TNT1 A 0 A_SetBlend("49 99 0",0.4,15)
			TNT1 A 0 A_Recoil(-15)
			ARXS ABCDE 1 
			TNT1 A 0 A_JumpIfInventory("SprintingPlayer", 1, "SprLoop1")
			goto SprEnd
		SprLoop1:
			TNT1 A 0 A_JumpIfInventory("PlayerStamina", 1, "SL1")
			TNT1 A 0 A_TakeInventory("SprintingPlayer",1)
			goto SprEnd
		SL1:
			ARXS E 1 Offset(-14,33)
			//ARXS E 1 Offset(-27,36)
			ARXS E 1 Offset(-34,39)
			ARXS E 1 Offset(-40,44)
			ARXS E 1 Offset(-43,47)
			ARXS E 1 Offset(-44,50)
			
			TNT1 A 0 A_JumpIfInventory("SprintingPlayer", 1, "SprLoop2")
			goto SprEnd
		SprLoop2:
			TNT1 A 0 A_JumpIfInventory("PlayerStamina", 1, "SL2")
			TNT1 A 0 A_TakeInventory("SprintingPlayer",1)
			goto SprEnd
		SL2:
			ARXS E 1 Offset(-44,50)
			//ARXS E 1 Offset(-43,47)
			ARXS E 1 Offset(-40,44)
			ARXS E 1 Offset(-34,39)
			ARXS E 1 Offset(-27,36)
			ARXS E 1 Offset(-14,33)
			TNT1 A 0 A_TakeInventory("PlayerStamina", 4)
			TNT1 A 0 A_JumpIfInventory("SprintingPlayer", 1, "SprLoop3")
			goto SprEnd
		SprLoop3:
			TNT1 A 0 A_JumpIfInventory("PlayerStamina", 1, "SL3")
			TNT1 A 0 A_TakeInventory("SprintingPlayer",1)
			goto SprEnd
		SL3:
			ARXS E 1 Offset(14,33)
			//ARXS E 1 Offset(27,36)
			ARXS E 1 Offset(34,39)
			ARXS E 1 Offset(40,44)
			ARXS E 1 Offset(43,47)
			ARXS E 1 Offset(44,50)
					
			TNT1 A 0 A_JumpIfInventory("SprintingPlayer", 1, "SprLoop4")
			goto SprEnd
		SprLoop4:
			TNT1 A 0 A_JumpIfInventory("PlayerStamina", 1, "SL4")
			TNT1 A 0 A_TakeInventory("SprintingPlayer",1)
			goto SprEnd
		SL4:
			ARXS E 1 Offset(44,50)
			//ARXS E 1 Offset(43,47)
			ARXS E 1 Offset(40,44)
			ARXS E 1 Offset(34,39)
			ARXS E 1 Offset(27,36)
			ARXS E 1 Offset(14,33)
			TNT1 A 0 A_TakeInventory("PlayerStamina", 4)
			TNT1 A 0 A_JumpIfInventory("SprintingPlayer", 1, "SprLoop1")
		SprEnd:
			TNT1 A 0 ACS_ExecuteAlways(Player_ChangeSpeed,0,100,0,0)
			TNT1 A 0 A_PlaySound("sfx/sprintend",CHAN_AUTO)
			ARXS EDCBA 1 Offset(-8,38)
			goto ready

		select:
			//TNT1 A 0 A_SetCrosshair(10)
			TNT1 A 0 A_JumpIfInventory("gtoss_weaponmemory",13,"GrenadeEnd")
			NULL A 8 
			NULL A 0 A_TakeInventory("AltFuncSwitch", 1)
			NULL A 0 A_TakeInventory("barrazoom", 1)
			ARXU F 1 A_PlaySound("weapons/ar_select", CHAN_WEAPON)
			ARXU EDCBA 1
			NULL A 0 A_GiveInventory("xhair_switch", 1)
		selectLoop:
			ARXI A 1 A_Raise
			Goto selectLoop
			
		deselect:
			NULL A 0 A_TakeInventory("xhair_switch", 1)
			NULL A 0 A_TakeInventory("arifle_acc", 50)
			NULL A 0 ACS_ExecuteAlways(Player_ChangeSpeed,0,100,0,0)
			NULL A 0 A_ZoomFactor(1.0,ZOOM_INSTANT)
			ARXU A 1 A_PlaySound("weapons/ar_deselect", CHAN_WEAPON)
			ARXU BCDEF 1
			NULL A 2 
		deselectLoop:
			NULL A 1 A_Lower
			Goto deselectLoop

		fire:
			TNT1 A 0 A_JumpIfInventory("barrazoom", 1, "zoomedfire")
			TNT1 A 0 A_JumpIfInventory("barraclip", 1, 3)
			ARXI A 1 A_PlayWeaponSound("weapons/noammo")
			ARXI A 4
			goto Ready
			
			TNT1 A 0 A_TakeInventory("barraclip", 1)
			
			TNT1 A 0 A_PlayWeaponSound("weapons/ar_fire")
			TNT1 A 0 A_AlertMonsters
			NULL A 0 A_TakeInventory("arifle_zoomflash", 1)
			NULL A 0 A_GiveInventory("arifle_normflash", 1)
			TNT1 A 0 A_GunFlash
			/*
			TNT1 A 0 A_JumpIfInventory("arifle_acc", 27, "FrAcc9")
			TNT1 A 0 A_JumpIfInventory("arifle_acc", 24, "FrAcc8")
			TNT1 A 0 A_JumpIfInventory("arifle_acc", 21, "FrAcc7")
			*/
			TNT1 A 0 A_JumpIfInventory("arifle_acc", 18, "FrAcc6")
			TNT1 A 0 A_JumpIfInventory("arifle_acc", 15, "FrAcc5")
			TNT1 A 0 A_JumpIfInventory("arifle_acc", 12, "FrAcc4")
			TNT1 A 0 A_JumpIfInventory("arifle_acc", 9, "FrAcc3")
			TNT1 A 0 A_JumpIfInventory("arifle_acc", 6, "FrAcc2")
			TNT1 A 0 A_JumpIfInventory("arifle_acc", 3, "FrAcc1")
			
		FrAcc0:
			TNT1 A 1 A_FireBullets (1,0,-1, 29 * 1.25 ,"arifle_impact",FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_GiveInventory("arifle_acc", 9)
			goto FireLast
		FrAcc1:
			TNT1 A 1 A_FireBullets (1,1,-1, 29 * 1.25 ,"arifle_impact",FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_GiveInventory("arifle_acc", 9)
			goto FireLast
		FrAcc2:
			TNT1 A 1 A_FireBullets (2,1,-1, 29 * 1.25 ,"arifle_impact",FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_GiveInventory("arifle_acc", 9)
			goto FireLast
		FrAcc3:
			TNT1 A 1 A_FireBullets (2,2,-1, 29 * 1.25 ,"arifle_impact",FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_GiveInventory("arifle_acc", 9)
			goto FireLast
		FrAcc4:
			TNT1 A 1 A_FireBullets (3,2,-1, 29 * 1.25 ,"arifle_impact",FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_GiveInventory("arifle_acc", 9)
			goto FireLast
		FrAcc5:
			TNT1 A 1 A_FireBullets (3,3,-1, 29 * 1.25 ,"arifle_impact",FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_GiveInventory("arifle_acc", 9)
			goto FireLast
		FrAcc6:
			TNT1 A 1 A_FireBullets (4,3,-1, 29 * 1.25 ,"arifle_impact",FBF_NORANDOM | FBF_USEAMMO)
			TNT1 A 0 A_GiveInventory("arifle_acc", 9)
			goto FireLast
		/*
		FrAcc7:
			TNT1 A 1 A_FireBullets (8,8,-1,13,"arb_puff",1)
			TNT1 A 0 A_GiveInventory("arifle_acc", 12)
			goto FireLast
		FrAcc8:
			TNT1 A 1 A_FireBullets (9,9,-1,13,"arb_puff",1)
			TNT1 A 0 A_GiveInventory("arifle_acc", 12)
			goto FireLast
		FrAcc9:
			TNT1 A 1 A_FireBullets (10,10,-1,13,"arb_puff",1)
			TNT1 A 0 A_GiveInventory("arifle_acc", 12)
			goto FireLast
        */
		FireLast:
			TNT1 A 1
			//TNT1 A 0 ACS_ExecuteAlways(Weapon_Recoil,0,12,random(-9,0),0)
			TNT1 A 0 A_FireCustomMissile("arcasing_spawner",0,0,0,4,0)
			ARXC BA 1
			Goto ready
		
		NormFlash:
			// A_Jump is bugged in mp
			//TNT1 A 0 A_Jump(255, "firef1", "firef2", "firef3")
			TNT1 A 0
			goto firef2
			
		firef1:
			ARXF A 1 bright A_Light2
			ARXF D 1 bright A_Light1
			TNT1 A 1 A_Light0
			stop
	    firef2:
			ARXF B 1 bright A_Light2
			ARXF E 1 bright A_Light1
			TNT1 A 1 A_Light0
			stop
		firef3:
			ARXF C 1 bright A_Light2
			ARXF F 1 bright A_Light1
			TNT1 A 1 A_Light0
			stop

		
		zoomedfire:
			TNT1 A 0 A_JumpIfInventory("barraclip", 1, 3)
			ARZI A 1 A_PlaySound("weapons/noammo")
			ARZI A 4
			goto readyzoom
			
			TNT1 A 0 A_TakeInventory("barraclip", 1)
			TNT1 A 0 A_PlayWeaponSound("weapons/ar_fire")
			TNT1 A 0 A_AlertMonsters
			NULL A 0 A_TakeInventory("arifle_normflash", 1)
			NULL A 0 A_GiveInventory("arifle_zoomflash", 1)
			TNT1 A 0 A_GunFlash
			
			TNT1 A 1 bright A_FireBullets (0,0,1, 28 * 1.25 ,"arifle_impact",FBF_NORANDOM | FBF_USEAMMO)
			
			TNT1 A 1 
			//TNT1 A 0 ACS_ExecuteAlways(Weapon_Recoil,0,15,random(-15,15),0)
			TNT1 A 0 A_FireCustomMissile("arcasing_spawner2",0,0,0,4,0)
			ARZC CB 1
			goto readyzoom
			
		ZoomFlash:
			// A_Jump is bugged in mp
			//TNT1 A 0 A_Jump(255, "zfiref1", "zfiref2", "zfiref3")
			TNT1 A 0
			goto zfiref1
		zfiref1:
			ARZF A 1 bright A_Light2
			ARZF D 1 bright A_Light1
			TNT1 A 1 A_Light0
			stop
	    zfiref2:
			ARZF B 1 bright A_Light2
			ARZF E 1 bright A_Light1
			TNT1 A 1 A_Light0
			stop
		zfiref3:
			ARZF C 1 bright A_Light2
			ARZF F 1 bright A_Light1
			TNT1 A 1 A_Light0
			stop
		
		ZoomWeapon:
			TNT1 A 0 A_GiveInventory("barrazoom", 1)
			TNT1 A 0 A_TakeInventory("AltFuncSwitch", 1)
			TNT1 A 0 A_TakeInventory("arifle_acc", 50)
			TNT1 A 0 ACS_ExecuteAlways(Player_ChangeSpeed,0,50,0,0)
			TNT1 A 0 A_ZoomFactor(2.0)
			ARZU ABCDE 1
			goto readyzoom
			
		UnZoomWeapon:
			TNT1 A 0 ACS_ExecuteAlways(Player_ChangeSpeed,0,100,0,0)
			TNT1 A 0 A_ZoomFactor(1.0)
			TNT1 A 0 A_TakeInventory("AltFuncSwitch", 1)
			ARZU EDCBA 1
			TNT1 A 0 A_TakeInventory("barrazoom", 1)
			TNT1 A 0 A_JumpIfInventory("ReloadingWeapon",1,"Reload")
			goto ready	
		
		QuickUnZoom:
			NULL A 0 A_ZoomFactor(1.0,ZOOM_INSTANT)
			//NULL A 0 A_TakeInventory("AltFuncSwitch", 2)
			NULL A 0 A_TakeInventory("barrazoom", 1)
	
			NULL A 0 A_JumpIfInventory("TossGrenade", 1, "Grenade")
			//NULL A 0 A_JumpIfInventory("ReloadingWeapon",1,"Reload")
			goto ready
		
		
		UnZoom2Relo:
			TNT1 A 0 ACS_ExecuteAlways(Player_ChangeSpeed,0,100,0,0)
			TNT1 A 0 A_ZoomFactor(1.0)
			ARZU EDCBA 1
			TNT1 A 0 A_TakeInventory("barrazoom", 1)
			//TNT1 A 0 A_TakeInventory("AltFuncSwitch", 2)
		Reload:
			NULL A 0 A_JumpIfInventory("barraclip", 36, 2)
			NULL A 0 A_JumpIfInventory("arifle_ammobox", 1, 2)
			NULL A 0
			goto ready
			
			TNT1 A 0 A_GiveInventory("xhair_hold", 1)
			TNT1 A 0 A_GiveInventory("arifle_acc", 28) //

			ARRS ABCDEF 1
			ARRS G 1 A_PlaySound("weapons/ar_clipout", CHAN_WEAPON)
			ARRS HIJK 1
			ARRS L 12 //hold
			ARRS MNOP 1
			ARRS Q 2 A_PlaySound("weapons/ar_clipin", CHAN_WEAPON)
						
			TNT1 A 0 A_JumpIfInventory("barraclip", 1, "Reload_FillClipB") 
			
		Reload_FillClipA:
			NULL A 0 A_TakeInventory("arifle_ammobox",1)
			NULL A 0 A_GiveInventory("barraclip",1)
			NULL A 0 A_JumpIfInventory("barraclip",36,"ReloadFinish_Long")
			NULL A 0 A_JumpIfInventory("arifle_ammobox",1,"Reload_FillClipA")
		ReloadFinish_Long:	
			ARRL ABC 1 
			ARRL D 7//small hold
			ARRL EFGH 1
			ARRL I 3 A_PlaySound("weapons/ar_pinpull", CHAN_WEAPON) //small hold / pin sound
			ARRL J 1
			ARRL K 8 //small hold
			TNT1 A 0 A_TakeInventory("xhair_hold", 1)
			ARRL LMNOPQR 1
			goto ready
			
			//ARXR X 1 A_PlaySound("weapons/ar_clipin2", CHAN_WEAPON)		
		Reload_FillClipB:
			NULL A 0 A_TakeInventory("arifle_ammobox",1)
			NULL A 0 A_GiveInventory("barraclip",1)
			NULL A 0 A_JumpIfInventory("barraclip",36,"ReloadFinish_Quick")
			NULL A 0 A_JumpIfInventory("arifle_ammobox",1,"Reload_FillClipB")
		ReloadFinish_Quick:
			ARRQ ABC 1 
			ARRQ D 7 //small hold
			TNT1 A 0 A_TakeInventory("xhair_hold", 1)
			ARRQ BEFGHIJK 1
			goto ready
		
		
		UnZoom2Gren:
			TNT1 A 0 A_JumpIfInventory("grenades", 1, 2)
			TNT1 A 0
			goto readyzoom
		
			TNT1 A 0 ACS_ExecuteAlways(Player_ChangeSpeed,0,100,0,0)
			TNT1 A 0 A_ZoomFactor(1.0)
			ARZU EDCBA 1
			TNT1 A 0 A_TakeInventory("barrazoom", 1)
			//TNT1 A 0 A_TakeInventory("AltFuncSwitch", 2)
		Grenade:
			TNT1 A 0 A_JumpIfInventory("grenades", 1, 2)
			TNT1 A 0
			goto ready
			ARXG ABCDEFG 1
			TNT1 A 0 A_GiveInventory("gtoss_weaponmemory", 13)
			TNT1 A 0 A_SelectWeapon("grenade_toss")
			goto deselectLoop
		GrenadeEnd:
			TNT1 A 0 A_TakeInventory("gtoss_weaponmemory",99)
			ARXG GFEDCBA 1
			goto selectLoop
		
		AltFire:
			TNT1 A 0 A_JumpIfInventory("barrazoom", 1, 2)
			TNT1 A 0
			goto altfire+7
			
			TNT1 A 0 ACS_ExecuteAlways(Player_ChangeSpeed,0,100,0,0)
			TNT1 A 0 A_ZoomFactor(1.0)
			ARZU DCB 1
			NULL A 0 A_TakeInventory("barrazoom", 1)
			
			ARXM C 1 A_Recoil(-6)
			NULL A 0 A_PlayWeaponSound("sfx/meleeswing")
			ARXM EGJ 1
			ARXM L 9 A_CustomPunch ((164+random(1,32)), 1 , 0 , "meleepuff",88)
			ARXM KJIHGFEDCBA 1	
			goto ready
		
	}
		
}

actor barraclip : Ammo{
	Inventory.MaxAmount 36
	Inventory.Icon "NULLA0"
	+INVENTORY.IGNORESKILL
}

actor barrazoom : inventory{
	inventory.maxamount 1
}

actor arifle_acc : Inventory {
	-INVBAR
	Inventory.icon "CBALH0"
	Inventory.Amount 1
	Inventory.MaxAmount 28
}

actor arifle_impact{		
	Radius 1
	Height 1
	Alpha 1
	DamageType arifle_damage
	RenderStyle ADD
	Scale 0.21
	+NOGRAVITY
	+NOBLOCKMAP
	+FLOORCLIP
	+NOTELEPORT
	+FORCEXYBILLBOARD
	+NOEXTREMEDEATH
	+NOINTERACTION
	+PUFFONACTORS
	+CLIENTSIDEONLY
	States{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_PlaySound("sfx/bulletric")
			TNT1 A 0 A_SpawnItemEx ("arifle_flare", 0, 0, 0,  0,0,0, 0)
			TNT1 AAAAA 0 A_SpawnItemEx ("arifle_spark", 0, 0, 0, /*f*/random(0.5,1.0), random(3,5) , random(0,6) , random(0,180))
			TNT1 AA 0 A_SpawnItemEx ("arifle_spark2", 0, 0, 0, /*f*/random(0.5,1.0), random(3,5) , random(0,6) , random(0,180))
			TNT1 AA 0 A_SpawnItemEx ("arifle_smoke", 0, 0, 0,  0, /*f*/random(-0.3,0.3) , /*f*/random(0,0.35) , random(0,180))
			TNT1 A 0 A_Jump(255, "Puff1","Puff2","Puff3","Puff4")
		Puff1:
			IPF2 AAA 1 bright //A_SetScale (scaleX * 0.9 ,scaleY * 0.9)
			stop
		Puff2:
			IPF2 BBB 1 bright //A_SetScale (scaleX * 0.9 ,scaleY * 0.9)
			stop
		Puff3:
			IPF2 CCC 1 bright //A_SetScale (scaleX * 0.9 ,scaleY * 0.9)
			stop
		Puff4:
			IPF2 DDD 1 bright //A_SetScale (scaleX * 0.9 ,scaleY * 0.9)
			stop
			
		xdeath:
			TNT1 A 0
			stop
	}
}

actor arifle_flare {
	scale 0.21
	alpha 1.0
	renderstyle add
	+NOINTERACTION
	+FORCEXYBILLBOARD
	+NOTELEPORT
	+CLIENTSIDEONLY
	
	states {
		spawn:
			LEYS O 3
		spawnloop:
			LEYS O 1 bright A_FadeOut(0.25)
			loop
	}
}

actor arifle_spark {
	radius 2
	height 2
	alpha 1
	scale 0.028
	gravity 0.4
	renderstyle add
	+NOTELEPORT
	+FLOORCLIP
	+FORCEXYBILLBOARD
	+CLIENTSIDEONLY
	bouncetype "doom"
	bouncefactor 0.2
	states{
		spawn:
			SPRK AAA 2 bright A_ScaleVelocity(0.9)
		spawnloop:
			TNT1 A 0 A_ScaleVelocity(0.9)
			SPRK A 1 bright A_FadeOut(0.1)
			loop
	}
}

actor arifle_spark2 : arifle_spark {
	scale 0.032
	gravity 0.3
	states{
		spawn:
			SPRK CCCCC 2 bright A_ScaleVelocity(0.9) 
		spawnloop:
			TNT1 A 0 A_ScaleVelocity(0.9)
			SPRK C 1 bright A_FadeOut(0.1)
			loop
	}
}

actor arifle_smoke {
	scale 0.12
	alpha 0.45
	renderstyle add
	+NOTELEPORT
	+FORCEXYBILLBOARD
	+NOINTERACTION
	+CLIENTSIDEONLY
	states{
		spawn:
			TNT1 A 3
			TNT1 A 0 A_Jump(255,"smoek1","smoek2","smoek3","smoek4","smoek5","smoek6")
		smoek1:
			TNT1 A 0 //A_SetScale(ScaleX * 1.02, ScaleY * 1.02)
			SMK1 A 2 A_Fadeout(0.015)
			loop
		smoek2:
			TNT1 A 0 //A_SetScale(ScaleX * 1.02, ScaleY * 1.02)
			SMK1 B 2 A_Fadeout(0.015)
			loop
		smoek3:
			TNT1 A 0 //A_SetScale(ScaleX * 1.02, ScaleY * 1.02)
			SMK1 C 2 A_Fadeout(0.015)
			loop
		smoek4:
			TNT1 A 0 //A_SetScale(ScaleX * 1.02, ScaleY * 1.02)
			SMK1 D 2 A_Fadeout(0.015)
			loop
		smoek5:
			TNT1 A 0 //A_SetScale(ScaleX * 1.02, ScaleY * 1.02)
			SMK1 E 2 A_Fadeout(0.015)
			loop
		smoek6:
			TNT1 A 0 //A_SetScale(ScaleX * 1.02, ScaleY * 1.02)
			SMK1 F 2 A_Fadeout(0.015)
			loop
	}
}


actor arifle_casing {
	scale 0.12
	radius 2
	height 2
	speed 6
	mass 4
	bouncefactor 0.5
	PROJECTILE
	+DOOMBOUNCE
	+NODROPOFF
	+FORCEXYBILLBOARD
	+NOTELEPORT
	+FLOORCLIP
	-NOGRAVITY
	-NOBLOCKMAP
	+CLIENTSIDEONLY
	seesound "casings/ar_casing"
	states{
		spawn:
			ARBC ABCDEF 2
			loop
		death:
			NULL A 0 A_Jump(255, "pos1", "pos2", "pos3")
			NULL A 0
		pos1:
			ARBC A 400
			ARBC AAAAAAAAAA 1 A_FadeOut(0.1)
			stop
		pos2:
			ARBC D 400
			ARBC DDDDDDDDDD 1 A_FadeOut(0.1)
			stop
		pos3:
			ARBC C 400
			ARBC CCCCCCCCCC 1 A_FadeOut(0.1)
			stop
			
	}
}

actor arifle_casing2 : arifle_casing {
	states{
		spawn:
			ARBC FABCDE 2
			loop
		death:
			NULL A 0 A_Jump(255, "pos1", "pos2", "pos3")
			NULL A 0
		pos1:
			ARBC A 400
			ARBC AAAAAAAAAA 1 A_FadeOut(0.1)
			stop
		pos2:
			ARBC D 400
			ARBC DDDDDDDDDD 1 A_FadeOut(0.1)
			stop
		pos3:
			ARBC C 400
			ARBC CCCCCCCCCC 1 A_FadeOut(0.1)
			stop
			
	}
}

actor arcasing_spawner {
	speed 15
	PROJECTILE
	+NOCLIP
	+CLIENTSIDEONLY
	states{
		spawn:
			NULL A 0
			NULL A 1 A_SpawnItemEx("arifle_casing", 0, 10, 0, random(0,1), random(4,5), random(0,1), 0, SXF_TRANSFERPOINTERS) 
			stop
	}

}

actor arcasing_spawner2 : arcasing_spawner {
	states{
		spawn:
			NULL A 0
			NULL A 1 A_SpawnItemEx("arifle_casing2", 0, 3, 0, random(0,1), random(4,5), random(0,1), 0, SXF_TRANSFERPOINTERS) 
			stop
	}

}