// Rifle
actor Rifle : AOWWeapon 21042 {
    Weapon.BobSpeed 1.75
    Weapon.BobRangeX 0.2
    Weapon.BobRangeY 0.4
    Weapon.BobStyle Alpha
	//$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"
	Weapon.UpSound "weapons/up/rifle"
	decal "BulletChipBig"
	States {
    Select:
		RIFL A 1 offset (90,100)
		RIFL A 1 offset (80,89)
		RIFL A 1 offset (70,79)
		RIFL A 1 offset (60,70)
		RIFL A 1 offset (50,62)
		RIFL A 1 offset (40,55)
		RIFL A 1 offset (30,49)
		RIFL A 1 offset (20,44)
		RIFL A 1 offset (15,40)
		RIFL A 1 offset (10,37)
		RIFL A 1 offset (5,34)
		RIFL A 1 offset (0,0)
		TNT1 A 0 A_TakeInventory("SelectAnimation",1)
		goto ready
	Deselect:
	    TNT1 A 0 A_TakeInventory("ActionFragGrenade",1)	
        TNT1 A 0 A_TakeInventory("ActionFlashbang",1)
        TNT1 A 0 A_TakeInventory("ActionRemoteC4",1)	
        TNT1 A 0 A_TakeInventory("ActionMeleeAttack",1)
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		RIFL A 1 offset (4,34)
		RIFL A 1 offset (8,40)
		RIFL A 1 offset (16,49)
		RIFL A 1 offset (24,62)
		RIFL A 1 offset (32,79)
		RIFL A 1 offset (40,100)
		TNT1 A 0 offset (1, 33)
		TNT1 A 0 A_Lower
		wait
	Ready:
        TNT1 A 0 A_JumpIfInventory("SelectAnimation",1,"Select")
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		RIFL A 1 A_WeaponReady
		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 0 bright A_RailAttack (25, 0, true, none, none, true, 0, "RiflePuff")
		RIFL B 1 bright A_SetPitch(pitch - 0.25)
		TNT1 A 0 A_SetPitch(pitch + 0.25)
		//RIFL B 0 Radius_Quake(1,5,0,1,0)
		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, 42)
		RIFL A 1 offset (0, 40)
		RIFL A 1 offset (0, 38)
		RIFL A 1 offset (0, 36)
		RIFL A 1 offset (0, 34)
		RIFL A 1 offset (0, 32)
		TNT1 A 0 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		RIFL AA 3 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		RIFL A 4 A_ReFire
		goto Ready
	Hold:
		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 (1, 1, -1, 25, "RiflePuff", FBF_NORANDOM|FBF_USEAMMO)
		RIFL B 1 bright A_SetPitch(pitch - 0.5)
		TNT1 A 0 A_SetPitch(pitch + 0.5)
		//RIFL B 0 Radius_Quake(1,5,0,1,0)
		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, 42)
		RIFL A 1 offset (0, 40)
		RIFL A 1 offset (0, 38)
		RIFL A 1 offset (0, 36)
		RIFL A 1 offset (0, 34)
		RIFL A 1 offset (0, 32)
		RIFL AA 3 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		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")
		TNT1 A 0 Radius_Quake(3,6,0,1,0)
		RIFL A 0 offset (0, 36) bright A_FireCustomMissile("RifleGrenade")
		RIFL A 1 offset (0, 36) bright A_SetPitch(pitch-0.6)
		RIFL A 1 offset (0, 40) A_SetPitch(pitch+0.6)
		RIFL A 1 offset (0, 42) A_Light1
		RIFL A 1 offset (0, 44) A_Light0
		RIFL A 1 offset (0, 42)
		RIFL A 1 offset (0, 40)
		RIFL A 1 offset (0, 38)
		RIFL A 1 offset (0, 37)
		RIFL A 1 offset (0, 36)
		RIFL A 1 offset (0, 35)
		RIFL A 1 offset (0, 34)
		RIFL A 1 offset (0, 33)
		RIFL A 1 offset (0, 32)
		TNT1 A 0 A_WeaponReady(WRF_NOBOB | WRF_NOFIRE)
		RIFL AAAA 2 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		RIFL A 3 A_PlayWeaponSound ("rifle/reload")
		RIFL A 5 A_JumpIfInventory ("IsRifleman", 1, 1)
		RIFL AAAA 3
		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"
}