XIII
Class FusilChasse

source: C:\XIII\XIII\Classes\FusilChasse.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Weapon
            |
            +--XIII.XIIIWeapon
               |
               +--XIII.FusilChasse
Direct Known Subclasses:None

class FusilChasse
extends XIII.XIIIWeapon

//----------------------------------------------------------- // //-----------------------------------------------------------

Function Summary
 string GetAmmoText(out int)
     
//_____________________________________________________________________________
// ELR Text to be displayed in HUD
 Name GetBaseWeaponBone()
     
//_____________________________________________________________________________
 bool HasAltAmmo()
     
//_____________________________________________________________________________
 
simulated
PlayAltFiring()
     
//_____________________________________________________________________________
 
simulated
PlayFiring()
     
//_____________________________________________________________________________
 
simulated
PlayIdleAnim()
     
//_____________________________________________________________________________
 
simulated
PlaySelect()
     
//_____________________________________________________________________________
 float RateSelf()
     
//_____________________________________________________________________________
// FRD
 
simulated
RumbleFX()
     
//_____________________________________________________________________________
 void TraceFire(float Accuracy, float YOffset, float ZOffset)
     
//_____________________________________________________________________________
 
simulated
TweenDown()
     
//_____________________________________________________________________________



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class FusilChasse extends XIIIWeapon;
00005	
00006	//_____________________________________________________________________________
00007	simulated function bool HasAltAmmo()
00008	{ // because we can stun only if we have ammo (bAllowEmptyShot=false, must down weapon after last fire)
00009	    return true;
00010	}
00011	
00012	//_____________________________________________________________________________
00013	// ELR Text to be displayed in HUD
00014	simulated function string GetAmmoText(out int bDrawbulletIcon)
00015	{
00016	    local string AmmoText,AltAmmoText;
00017	
00018	    bDrawbulletIcon = 1;
00019	
00020	    // Setup ammotext
00021	    AmmoText = ReLoadCount@"|"@(Ammotype.AmmoAmount-ReLoadCount);
00022	    return AmmoText;
00023	}
00024	
00025	//_____________________________________________________________________________
00026	simulated function Name GetBaseWeaponBone()
00027	{
00028	    return 'FChasse';
00029	}
00030	
00031	//_____________________________________________________________________________
00032	simulated function RumbleFX()
00033	{
00034	    if( XIIIPlayerController(Instigator.Controller) == none )
00035	        return;
00036	
00037	    if ( (Instigator != none) && Instigator.IsHumanControlled() && Instigator.IsLocallyControlled() )
00038	    {
00039	      if ( ReloadCount == 1 )
00040	        XIIIPlayerController(Instigator.Controller).RumbleFX(RumbleFXNum);
00041	      else
00042	        XIIIPlayerController(Instigator.Controller).RumbleFX(RumbleFXNum+1);
00043	    }
00044	}
00045	
00046	//_____________________________________________________________________________
00047	function TraceFire( float Accuracy, float YOffset, float ZOffset )
00048	{
00049	    local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
00050	    local actor Other;
00051	    local int I;
00052	    local Material HitMat;
00053	    local Vector vWaterDir;
00054	
00055	    MakeNoise(FireNoise);
00056	    GetAxes(Instigator.GetViewRotation(),X,Y,Z);
00057	    StartTrace = GetFireStart(X,Y,Z);
00058	    AdjustedAim = Instigator.AdjustAim(AmmoType, StartTrace, 0);
00059	
00060	    // the one that uses ammo.
00061	    EndTrace = StartTrace + (TraceDist * vector(AdjustedAim));
00062	    EndTrace += vRand() * fRand() * (TraceAccuracy/100.0) * TraceDist;
00063	    Other = Trace(HitLocation,HitNormal,EndTrace,StartTrace,True, vect(0,0,0), HitMat, TRACETYPE_DiscardIfCanShootThroughWithRayCastingWeapon|TRACETYPE_RequestBones);
00064	    if ( XIIIPawn(Other) != none )
00065	      XIIIPawn(Other).LastBoneHit = GetLastTraceBone();
00066	    if ( HitMat != none )
00067	      AmmoType.PlayImpactSound(HitMat.HitSound);
00068	    AmmoType.ProcessTraceHit(self, Other, HitLocation, HitNormal, X,Y,Z);
00069	
00070	    // 4 shots AFTER because ony the 1rst one update the impact visual type
00071	    // then 4 shots w/out ammo
00072	    AmmoType.Ammoamount ++;
00073	    for (i=0;i<4;i++)
00074	    { // to make multiple shots without using ammo
00075	      EndTrace = StartTrace + (TraceDist * vector(AdjustedAim));
00076	      EndTrace += vRand() * fRand() * (TraceAccuracy/100.0) * TraceDist;
00077	      Other = IntersectWaterPlane(StartTrace, EndTrace, HitLocation);
00078	      if ( Other != none )
00079	      {
00080	        vWaterDir = HitLocation - StartTrace;
00081	        vWaterDir.Z = abs(vWaterDir.z) * 8.0;
00082	        WRE = PhysicsVolume(Other).BeingHitByBullets(HitLocation+vect(0,0,1), rotator(vWaterDir cross Y), AmmoType.HitSoundType);
00083	      }
00084	      Other = Trace(HitLocation,HitNormal,EndTrace,StartTrace,True, vect(0,0,0), HitMat, TRACETYPE_DiscardIfCanShootThroughWithRayCastingWeapon|TRACETYPE_RequestBones);
00085	      if ( XIIIPawn(Other) != none )
00086	        XIIIPawn(Other).LastBoneHit = GetLastTraceBone();
00087	      if ( HitMat != none )
00088	        AmmoType.PlayImpactSound(HitMat.HitSound);
00089	      if ( i>0 )
00090	        AmmoType.bPlayHitSound = false;
00091	      AmmoType.ProcessTraceHitNoAmmo(self, Other, HitLocation, HitNormal, X,Y,Z);
00092	    }
00093	    AmmoType.Ammoamount --;
00094	
00095	    FeedBack();
00096	}
00097	
00098	//_____________________________________________________________________________
00099	// FRD
00100	function float RateSelf()
00101	{
00102	    local float distance;
00103	
00104	    if ( !HasAmmo() )
00105	      return -2;
00106	    if (instigator.controller.enemy!=none)
00107	    {
00108	      distance=Vsize(instigator.controller.enemy.location-instigator.location);
00109	      if (distance>1110)
00110	        return 0.4;
00111	    }
00112	    return AIRating;
00113	}
00114	
00115	//_____________________________________________________________________________
00116	simulated function PlayIdleAnim()
00117	{
00118	    if ( bHaveBoredSfx && Pawn(Owner).IsPlayerPawn() && (iBoredCount > BOREDSFXTHRESHOLD) )
00119	    {
00120	      iBoredCount = 0;
00121	      if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
00122	        Instigator.PlayRolloffSound(hActWaitSound, self, 0, int(Pawn(Owner).IsPlayerPawn()), 0 );
00123	      if ( ReloadCount == 2 )
00124	        PlayAnim('WaitAct1', 1.0, 0.3);
00125	      else if ( ReloadCount == 1 )
00126	        PlayAnim('WaitAct2', 1.0, 0.3);
00127	      else
00128	        PlayAnim('WaitAct3', 1.0, 0.3);
00129	    }
00130	    else
00131	    {
00132	      if ( ReloadCount == 2 )
00133	        PlayAnim('Wait1', 1.0, 0.3);
00134	      else if ( ReloadCount == 1 )
00135	        PlayAnim('Wait2', 1.0, 0.3);
00136	      else
00137	        PlayAnim('Wait3', 1.0, 0.3);
00138	    }
00139	}
00140	
00141	//_____________________________________________________________________________
00142	simulated function PlayFiring()
00143	{
00144	    if ( HasAmmo() )
00145	    {
00146	      if ( ReloadCount == 1 )
00147	        PlayAnim('Fire1', 1.0);
00148	      else
00149	        PlayAnim('Fire2', 1.0);
00150	    }
00151	    else
00152	      PlayAnim('FireVide', 1.0);
00153	    if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
00154	      PlayFiringSound();
00155	
00156	    if ( !HasAmmo() )
00157	      return;
00158	
00159	    IncrementFlashCount();
00160	    if ( bDrawMuzzleflash )
00161	      SetUpMuzzleFlash();
00162	}
00163	
00164	//_____________________________________________________________________________
00165	simulated function PlayAltFiring()
00166	{
00167	//    Log("PlayFiring call for"@self@"w/FiringMode="$FiringMode);
00168	    if ( ReloadCount == 2 )
00169	      PlayAnim('FireAlt1', 1.0);
00170	    else if ( ReloadCount == 1 )
00171	      PlayAnim('FireAlt2', 1.0);
00172	    else
00173	      PlayAnim('FireAlt3', 1.0);
00174	
00175	    IncrementAltFlashCount();
00176	    if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
00177	      PlayAltFiringSound();
00178	}
00179	
00180	//_____________________________________________________________________________
00181	simulated function PlaySelect()
00182	{
00183	//    log("#"@DBUGFrameCount@" PlaySelect call for"@self@"w/ mesh="$Mesh);
00184	    bForceFire = false;
00185	    bForceAltFire = false;
00186	    if ( !IsAnimating() || !AnimIsInGroup(0,'Select') )
00187	    {
00188	      if ( ReloadCount == 2)
00189	        PlayAnim('Select1',1.0);
00190	      else if ( ReloadCount == 1)
00191	        PlayAnim('Select2',1.0);
00192	      else
00193	        PlayAnim('Select3',1.0);
00194	    }
00195	    if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
00196	      Instigator.PlayRolloffSound(hSelectWeaponSound, self, 0, int(Pawn(Owner).IsPlayerPawn()), 0 );
00197	}
00198	
00199	//_____________________________________________________________________________
00200	simulated function TweenDown()
00201	{
00202	//    log("#"@DBUGFrameCount@" TweenDown call for"@self);
00203	    if ( ReloadCount == 2)
00204	      PlayAnim('Down1',1.0);
00205	    else if ( ReloadCount == 1)
00206	      PlayAnim('Down2',1.0);
00207	    else
00208	      PlayAnim('Down3',1.0);
00209	}
00210	
00211	//    Icon=texture'XIIIMenu.FChasseIcon'
00212	
00213	
00214	defaultproperties
00215	{
00216	     WeaponOnoClass=Class'XIDSpec.RifleWeaponOno'
00217	     bHaveAltFire=True
00218	     bHaveBoredSfx=True
00219	     bDrawMuzzleFlash=True
00220	     WHand=WHA_2HShot
00221	     AmmoName=Class'XIII.PompeAmmo'
00222	     AltAmmoName=Class'XIII.HuntGunAltAmmo'
00223	     PickupAmmoCount=2
00224	     ReloadCount=2
00225	     MeshName="XIIIArmes.FpsFChasseM"
00226	     FireOffset=(Y=5.000000,Z=-2.000000)
00227	     AltFireOffset=(X=7.000000,Y=4.000000,Z=-6.000000)
00228	     CrossHair=Texture'XIIIMenu.HUD.MireFusil'
00229	     TraceAccuracy=8.000000
00230	     ShotTime=0.200000
00231	     FiringMode="FM_2H"
00232	     AltFireNoise=0.000000
00233	     LoadedAltFiringAnim="FireAlt"
00234	     ViewFeedBack=(X=3.000000,Y=15.000000)
00235	     RumbleFXNum=2
00236	     FPMFRelativeLoc=(X=0.500000,Y=85.000000,Z=7.500000)
00237	     ShakeMag=900.000000
00238	     shaketime=7.000000
00239	     ShakeVert=(X=5.000000,Y=10.000000,Z=-25.000000)
00240	     ShakeCycles=2.000000
00241	     AIRating=0.560000
00242	     TraceDist=180.000000
00243	     hFireSound=Sound'XIIIsound.Guns__GunFire.GunFire__hGunFire'
00244	     hReloadSound=Sound'XIIIsound.Guns__GunRel.GunRel__hGunRel'
00245	     hNoAmmoSound=Sound'XIIIsound.Guns__GunDryFire.GunDryFire__hGunDry'
00246	     hSelectWeaponSound=Sound'XIIIsound.Guns__GunSelWp.GunSelWp__hGunSelWp'
00247	     hAltFireSound=Sound'XIIIsound.Guns__ShotFireAlt.ShotFireAlt__hShotFireAlt'
00248	     hActWaitSound=Sound'XIIIsound.Guns__ShotWait.ShotWait__hShotWait'
00249	     MuzzleScale=0.800000
00250	     FlashOffsetY=0.070000
00251	     FlashOffsetX=0.090000
00252	     InventoryGroup=10
00253	     PickupClassName="XIII.FusilChassePick"
00254	     PlayerViewOffset=(X=4.000000,Y=6.500000)
00255	     ThirdPersonRelativeLocation=(X=29.000000,Y=-4.500000,Z=14.500000)
00256	     ThirdPersonRelativeRotation=(Pitch=7000)
00257	     AttachmentClass=Class'XIII.FusilChasseAttach'
00258	     ItemName="HUNTING GUN"
00259	     DrawScale=0.300000
00260	}

End Source Code