104 lines
2.7 KiB
Ucode
104 lines
2.7 KiB
Ucode
class ScrnRPGFire extends LAWFire;
|
|
|
|
var bool bFiringLastRound;
|
|
var name FireLastAnim;
|
|
|
|
function DoFireEffect()
|
|
{
|
|
local Vector StartProj, HitLocation, HitNormal, StartTrace, X,Y,Z;
|
|
local Rotator R, Aim;
|
|
local Actor Other;
|
|
local int p, SpawnCount;
|
|
|
|
Instigator.MakeNoise(1.0);
|
|
Weapon.GetViewAxes(X,Y,Z);
|
|
|
|
StartTrace = Instigator.Location + Instigator.EyePosition();
|
|
StartProj = StartTrace + X*ProjSpawnOffset.X;
|
|
if ( !Weapon.WeaponCentered() && !KFWeap.bAimingRifle )
|
|
StartProj = StartProj + Weapon.Hand * Y*ProjSpawnOffset.Y + Z*ProjSpawnOffset.Z;
|
|
Other = Weapon.Trace(HitLocation, HitNormal, StartProj, StartTrace, false);
|
|
|
|
if (Other != None)
|
|
{
|
|
StartProj = HitLocation;
|
|
}
|
|
|
|
Aim = AdjustAim(StartProj, AimError);
|
|
|
|
Aim.Pitch += 250;
|
|
|
|
SpawnCount = Max(1, ProjPerFire * int(Load));
|
|
|
|
switch (SpreadStyle)
|
|
{
|
|
case SS_Random:
|
|
X = Vector(Aim);
|
|
for (p = 0; p < SpawnCount; p++)
|
|
{
|
|
R.Yaw = Spread * (FRand()-0.5);
|
|
R.Pitch = Spread * (FRand()-0.5);
|
|
R.Roll = Spread * (FRand()-0.5);
|
|
SpawnProjectile(StartProj, Rotator(X >> R));
|
|
}
|
|
break;
|
|
}
|
|
|
|
if (Instigator != none )
|
|
{
|
|
if( Instigator.Physics != PHYS_Falling )
|
|
{
|
|
Instigator.AddVelocity(KickMomentum >> Instigator.GetViewRotation());
|
|
}
|
|
else if( Instigator.Physics == PHYS_Falling
|
|
&& Instigator.PhysicsVolume.Gravity.Z > class'PhysicsVolume'.default.Gravity.Z)
|
|
{
|
|
Instigator.AddVelocity((KickMomentum * LowGravKickMomentumScale) >> Instigator.GetViewRotation());
|
|
}
|
|
}
|
|
}
|
|
|
|
function ModeDoFire()
|
|
{
|
|
bFiringLastRound = Weapon.AmmoAmount(0) <= AmmoPerFire;
|
|
super.ModeDoFire();
|
|
}
|
|
|
|
function ServerPlayFiring()
|
|
{
|
|
Super(KFShotgunFire).ServerPlayFiring();
|
|
if (bFiringLastRound)
|
|
{
|
|
Weapon.PlayAnim(FireLastAnim, FireAnimRate, TweenTime);
|
|
}
|
|
}
|
|
|
|
function PlayFiring()
|
|
{
|
|
Super(KFShotgunFire).PlayFiring();
|
|
if (bFiringLastRound)
|
|
{
|
|
Weapon.PlayAnim(FireLastAnim, FireAnimRate, TweenTime);
|
|
}
|
|
if ( ScrnRPG(Weapon) != none)
|
|
{
|
|
ScrnRPG(Weapon).HideRocket();
|
|
}
|
|
}
|
|
|
|
defaultproperties
|
|
{
|
|
FireLastAnim="Fire"
|
|
maxVerticalRecoilAngle=200
|
|
maxHorizontalRecoilAngle=200
|
|
FireSoundRef="ScrnWeaponPack_SND.ScrnRPG7.fire_m"
|
|
StereoFireSoundRef="ScrnWeaponPack_SND.ScrnRPG7.fire_s"
|
|
FireAnimRate=0.940000
|
|
ReloadAnimRate=0.940000
|
|
AmmoClass=Class'ScrnWeaponPack.ScrnRPGAmmo'
|
|
ShakeRotTime=1.000000
|
|
ShakeOffsetMag=(X=0.000000,Y=0.000000,Z=0.000000)
|
|
ProjectileClass=Class'ScrnWeaponPack.ScrnRPGProj'
|
|
FlashEmitterClass=Class'ScrnWeaponPack.ScrnRPGMuzzleFlash'
|
|
}
|