File
- Defined in \weapons\RIFLE.txt
Flags
Properties
//$category | Weapons |
attacksound | "None" |
game | Doom |
inventory.pickupmessage | "You got the Assault Rifle!" |
inventory.pickupsound | "weapons/rifle/clip" |
obituary | "%o was shot down by %k's assault rifle." |
weapon.ammogive1 | 0 |
weapon.ammogive2 | 10 |
weapon.ammotype1 | "RifleAmmoLoaded" |
weapon.ammotype2 | "RifleAmmo" |
weapon.ammouse1 | 0 |
weapon.ammouse2 | 0 |
weapon.selectionorder | 4500 |
weapon.slotnumber | 2 |
xscale | 1.0 |
yscale | 0.7 |
States
Spawn:
RIFL A -1
Stop
Ready:
TNT1 A 0 A_PlaySound("weapons/rifle/clip")
RIF4 D 1 Offset(-10, 46)
RIF4 D 1 Offset(-5, 38)
RIF4 D 1 Offset(-2, 34)
ReadyLoop:
//This is a swanky unnecessary bit of code to power the indicator on top of the gun - select our sprite name based on the amount of ammo that's loaded. Same happens in the Fire state.
RIF1 D 0 A_JumpIfInventory("RifleAmmoLoaded", 21, "ReadyLoop2")
RIF2 D 0 A_JumpIfInventory("RifleAmmoLoaded", 11, "ReadyLoop2")
RIF3 D 0 A_JumpIfInventory("RifleAmmoLoaded", 1, "ReadyLoop2")
RIF4 D 0
ReadyLoop2:
"####" D 1 A_WeaponReady(WRF_ALLOWRELOAD | WRF_ALLOWZOOM)
Goto ReadyLoop
Deselect:
RIF4 B 1 Offset(-2, 34)
RIF4 B 1 Offset(-5, 38)
RIF4 B 1 Offset(-10, 46)
TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
TNT1 A 1
Wait
Fire:
//These ones require +1 compared to the ready ones, so that the player sees the indicator just before firing
RIF1 D 0 A_JumpIfInventory("RifleAmmoLoaded", 22, "FireAnimate")
RIF2 D 0 A_JumpIfInventory("RifleAmmoLoaded", 12, "FireAnimate")
RIF3 D 0 A_JumpIfInventory("RifleAmmoLoaded", 2, "FireAnimate")
RIF4 D 0
FireAnimate:
"####" A 0 A_JumpIfInventory("RifleAmmoLoaded", 1, 1)
Goto Reload
"####" A 0
{
A_PlaySound("weapons/rifle/fire");
if (CountInv("RifleAmmoLoaded") < 12) //mxd
{
A_PlaySound("weapons/rifle/dryfire", CHAN_AUTO);
}
}
"####" A 1 BRIGHT A_AlertMonsters
"####" A 0 A_SpawnItemEx("PlayerMuzzle1",30,5,30)
"####" B 1 Offset(0, 34) BRIGHT A_FireBullets (0, 0, 1, 9, "HitPuff")
"####" A 0 A_FireCustomMissile("Tracer", 0, 0, 0, -12, 0, random(-1,1))
"####" A 0 A_SetPitch(-1.3 + pitch)
"####" A 0 A_Takeinventory("RifleAmmoLoaded",1)
"####" A 0 A_SetPitch(+0.6 + pitch)
"####" C 1 Offset(0, 33) A_SpawnItemEx("BulletCasing", 17, 3, 35, 0, random(3,6), random(3,7))
"####" D 1 A_SetPitch(+0.5 + pitch)
"####" A 0 A_Refire
Goto ReadyLoop
Reload:
"####" A 0 A_JumpIfInventory("RifleAmmoLoaded", 0, "ReadyLoop")
"####" A 0 A_JumpIfInventory("RifleAmmo",1,"ReloadAnimate")
"####" D 8 A_PlaySound("weapons/empty")
Goto ReadyLoop
ReloadAnimate:
TNT1 A 0 A_PlaySound("weapons/rifle/reload")
RIFR ABCDE 1 A_WeaponReady(WRF_ALLOWZOOM | WRF_NOFIRE)
RIFR F 1 A_SpawnItemEx("EmptyClip", 17, 2, 35, 0, random(3,6), 4)
RIFR G 8
RIFR HIKL 1
RIFR M 3
RIFR NOPQRST 1 A_WeaponReady(WRF_ALLOWZOOM | WRF_NOFIRE)
ReloadAmmo:
TNT1 AAAA 0
TNT1 A 0 A_JumpIfInventory("RifleAmmoLoaded", 0, "ReadyLoop")
TNT1 A 0 A_JumpIfInventory("RifleAmmo", 1, 1)
Goto ReadyLoop
TNT1 A 0 A_Giveinventory("RifleAmmoLoaded",1)
TNT1 A 0 A_Takeinventory("RifleAmmo",1)
Goto ReloadAmmo