// Rifle
actor Rifle : AOWWeapon 21042 {
	//$Category Weapons
	+NOEXTREMEDEATH
	+ALT_AMMO_OPTIONAL
	Obituary "$OB_RIFLE"
	Inventory.PickupMessage "You got the rifle!"
	Weapon.SelectionOrder 18
	Weapon.KickBack 150
	Weapon.AmmoType "RifleAmmo"
	Weapon.AmmoUse 1
	Weapon.AmmoGive 10
	Weapon.AmmoType2 "RifleGrenadeAmmo"
	Weapon.AmmoUse2 1
	Weapon.AmmoGive2 2
	Weapon.PreferredSkin "MarineBase"
	States {
	Ready:
		RIFL A 1 A_WeaponReady
		loop
	Deselect:
		RIFL A 1 A_Lower
		loop
	Select:
		RIFL A 1 A_Raise
		loop
	Fire:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		RIFL B 0 A_Light2
		RIFL B 0 A_SpawnItemEx("RifleShellCasing",8,8,30,random(-2,-4),random(2,3),random(1,3),random(45,60),128)
		RIFL B 0 A_PlaySound("rifle/fire",CHAN_AUTO)
		RIFL B 0 bright A_FireBullets (0, 0, 0, 0, "RiflePuff", false)
		RIFL B 1 bright A_RailAttack (25, 0, true, none, none, true, 0, "RiflePuff")
		RIFL B 1 bright A_PlaySound("gun/bang",CHAN_AUTO,0.35)
		RIFL C 1 bright offset (0, 36) A_Light1
		RIFL C 1 bright offset (0, 40)
		RIFL B 1 bright offset (0, 42) A_Light0
		RIFL A 1 offset (0, 44)
		RIFL A 1 offset (0, 40)
		RIFL A 1 offset (0, 36)
		RIFL A 10 offset (0, 32)
		RIFL A 4 A_ReFire
		goto Ready
	AltFire:
		TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
		TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		RIFL A 0 A_JumpIfNoAmmo ("AltRejected")
		RIFL A 1 A_PlayWeaponSound ("grenade/fire")
		RIFL A 1 offset (0, 33) bright A_FireCustomMissile("RifleGrenade")
		RIFL A 1 offset (0, 34) 
		RIFL A 1 offset (0, 36) A_Light1
		RIFL A 1 offset (0, 37)
		RIFL A 1 offset (0, 38) A_Light0
		RIFL A 1 offset (0, 36)
		RIFL A 1 offset (0, 34)
		RIFL A 10 offset (0, 32)
		RIFL A 5
		RIFL A 15 A_PlayWeaponSound ("rifle/reload")
		RIFL A 4 A_ReFire
		goto Ready
	AltRejected:
		RIFL A 8 A_WeaponReady (WRF_NOSECONDARY)
		goto Ready
	Spawn:
		RIFL X -1
		stop
	}
}

actor RifleGrenade : GrenadeGrenade {
	obituary "$OB_RIFLEGRENADE"
	States {
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_ChangeVelocity(momx*1.3,momy*1.3,momz,CVF_REPLACE)
		goto Super::Spawn
	}
}

actor RiflePuff : HHBulletPuff {
	DamageType "Rifle"
}