Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 |
//============================================================================= // Assault Rifle //============================================================================= class AssaultRifle extends Weapon config(user); var float DualPickupTime; var AssaultAttachment OffhandActor; var bool bDualMode; var bool bWasDualMode; var bool bFireLeft; #EXEC OBJ LOAD FILE=InterfaceContent.utx #EXEC OBJ LOAD FILE=UT2004Weapons.utx replication { reliable if ( Role == ROLE_Authority ) bDualMode; } simulated function Loaded() { bDualMode = true; } simulated function PostNetBeginPlay() { Super.PostNetBeginPlay(); if ( (Role < ROLE_Authority) && (Instigator != None) && (Instigator.Controller != None) && (Instigator.Weapon != self) && (Instigator.PendingWeapon != self) ) Instigator.Controller.ClientSwitchToBestWeapon(); } simulated function bool WeaponCentered() { return !bDualMode && Super.WeaponCentered(); } simulated event RenderOverlays( Canvas Canvas ) { local bool bRealHidden; local int RealHand; if (Instigator == None) return; if ( Instigator.Controller != None ) Hand = Instigator.Controller.Handedness; if ((Hand < -1.0) || (Hand > 1.0)) return; RealHand = Hand; if ( bDualMode && (Hand == 0) ) { Instigator.Controller.Handedness = -1; Hand = -1; } if ( bDualMode && (FireMode[1].FlashEmitter != None) ) { bRealHidden = FireMode[1].FlashEmitter.bHidden; if ( bFireLeft ) FireMode[1].FlashEmitter.bHidden = true; Super.RenderOverlays(Canvas); FireMode[1].FlashEmitter.bHidden = bRealHidden; } else Super.RenderOverlays(Canvas); if ( bDualMode ) RenderDualOverlay(Canvas); if ( Instigator.Controller != None ) Instigator.Controller.Handedness = RealHand; } simulated function RenderDualOverlay(Canvas Canvas) { local vector NewScale3D; local rotator WeaponRotation; local bool bRealHidden; Hand *= -1; newScale3D = Default.DrawScale3D; newScale3D.Y *= Hand; SetDrawScale3D(newScale3D); PlayerViewPivot.Roll = Default.PlayerViewPivot.Roll * Hand; PlayerViewPivot.Yaw = Default.PlayerViewPivot.Yaw * Hand; RenderedHand = Hand; if ( class'PlayerController'.Default.bSmallWeapons ) PlayerViewOffset = SmallViewOffset; else PlayerViewOffset = Default.PlayerViewOffset; PlayerViewOffset.Y *= Hand; SetLocation( Instigator.Location + Instigator.CalcDrawOffset(self) ); WeaponRotation = Instigator.GetViewRotation(); if ( bDualMode != bWasDualMode ) { bWasDualMode = true; DualPickupTime = Level.Timeseconds; } if ( DualPickupTime > Level.TimeSeconds - 0.5 ) WeaponRotation.Pitch = WeaponRotation.Pitch - 16384 - 32768 * (DualPickupTime - Level.TimeSeconds); SetRotation( WeaponRotation ); bDrawingFirstPerson = true; if ( bDualMode && (FireMode[1].FlashEmitter != None) ) { bRealHidden = FireMode[1].FlashEmitter.bHidden; if ( !bFireLeft ) FireMode[1].FlashEmitter.bHidden = true; Canvas.DrawActor(self, false, false, DisplayFOV); FireMode[1].FlashEmitter.bHidden = bRealHidden; } else Canvas.DrawActor(self, false, false, DisplayFOV); bDrawingFirstPerson = false; Hand *= -1; } simulated function DetachFromPawn(Pawn P) { bFireLeft = false; AssaultGrenade(FireMode[1]).ReturnToIdle(); Super.DetachFromPawn(P); if ( OffhandActor != None ) { OffhandActor.Destroy(); OffhandActor = None; } } function AttachToPawn(Pawn P) { local name BoneName; if ( ThirdPersonActor == None ) { ThirdPersonActor = Spawn(AttachmentClass,Owner); InventoryAttachment(ThirdPersonActor).InitFor(self); } BoneName = P.GetWeaponBoneFor(self); if ( BoneName == '' ) { ThirdPersonActor.SetLocation(P.Location); ThirdPersonActor.SetBase(P); } else P.AttachToBone(ThirdPersonActor,BoneName); if ( bDualMode ) { BoneName = P.GetOffHandBoneFor(self); if ( BoneName == '' ) return; if ( OffhandActor == None ) { OffhandActor = AssaultAttachment(Spawn(AttachmentClass,Owner)); OffhandActor.InitFor(self); } P.AttachToBone(OffhandActor,BoneName); if ( OffhandActor.AttachmentBone == '' ) OffhandActor.Destroy(); else { ThirdPersonActor.SetDrawScale(0.3); OffhandActor.SetDrawScale(0.3); OffhandActor.bDualGun = true; OffhandActor.TwinGun = AssaultAttachment(ThirdPersonActor); if ( Mesh == OldMesh ) { OffhandActor.SetRelativeRotation(rot(0,32768,0)); OffhandActor.SetRelativeLocation(vect(20,-10,-5)); } else { OffhandActor.SetRelativeRotation(rot(0,0,32768)); OffhandActor.SetRelativeLocation(vect(40,-3,-7)); } AssaultAttachment(ThirdPersonActor).TwinGun = OffhandActor; } } } simulated function DrawWeaponInfo(Canvas Canvas) { NewDrawWeaponInfo(Canvas, 0.705*Canvas.ClipY); } simulated function NewDrawWeaponInfo(Canvas Canvas, float YPos) { local int i,Count; local float ScaleFactor; ScaleFactor = 99 * Canvas.ClipX/3200; Canvas.Style = ERenderStyle.STY_Alpha; Canvas.DrawColor = class'HUD'.Default.WhiteColor; Count = Min(8,AmmoAmount(1)); for( i=0; i<Count; i++ ) { Canvas.SetPos(Canvas.ClipX - (0.5*i+1) * ScaleFactor, YPos); Canvas.DrawTile( Material'HudContent.Generic.HUD', ScaleFactor, ScaleFactor, 174, 259, 46, 45); } if ( AmmoAmount(1) > 8 ) { Count = Min(16,AmmoAmount(1)); for( i=8; i<Count; i++ ) { Canvas.SetPos(Canvas.ClipX - (0.5*(i-8)+1) * ScaleFactor, YPos - ScaleFactor); Canvas.DrawTile( Material'HudContent.Generic.HUD', ScaleFactor, ScaleFactor, 174, 259, 46, 45); } } } function byte BestMode() { local Bot B; B = Bot(Instigator.Controller); if ( (B != None) && (B.Enemy != None) ) { if ( ((FRand() < 0.1) || !B.EnemyVisible()) && (AmmoAmount(1) >= FireMode[1].AmmoPerFire) ) return 1; } if ( AmmoAmount(0) >= FireMode[0].AmmoPerFire ) return 0; return 1; } simulated function float ChargeBar() { return FMin(1,FireMode[1].HoldTime/AssaultGrenade(FireMode[1]).mHoldClampMax); } function bool HandlePickupQuery( pickup Item ) { if ( class == Item.InventoryType ) { if ( bDualMode ) return super.HandlePickupQuery(Item); bDualMode = true; if ( Instigator.Weapon == self ) { PlayOwnedSound(SelectSound, SLOT_Interact,,,,, false); AttachToPawn(Instigator); } if (Level.GRI.WeaponBerserk > 1.0) CheckSuperBerserk(); else FireMode[0].FireRate = FireMode[0].Default.FireRate * 0.55; FireMode[0].Spread = FireMode[0].Default.Spread * 1.5; if (xPawn(Instigator) != None && xPawn(Instigator).bBerserk) StartBerserk(); return false; } if ( item.inventorytype == AmmoClass[1] ) { if ( (AmmoCharge[1] >= MaxAmmo(1)) && (AmmoCharge[0] >= MaxAmmo(0)) ) return true; item.AnnouncePickup(Pawn(Owner)); AddAmmo(50, 0); AddAmmo(Ammo(item).AmmoAmount, 1); item.SetRespawn(); return true; } if ( Inventory == None ) return false; return Inventory.HandlePickupQuery(Item); } simulated function int MaxAmmo(int mode) { if ( bDualMode ) return 2 * FireMode[mode].AmmoClass.Default.MaxAmmo; else return FireMode[mode].AmmoClass.Default.MaxAmmo; } function float GetAIRating() { local Bot B; if ( !bDualMode ) return AIRating; B = Bot(Instigator.Controller); if ( B == None ) return AIRating; if ( B.Enemy == None ) { if ( (B.Target != None) && VSize(B.Target.Location - B.Pawn.Location) > 8000 ) return 0.78; return AIRating; } return (AIRating + 0.0003 * FClamp(1500 - VSize(B.Enemy.Location - Instigator.Location),0,1000)); } defaultproperties { FireModeClass(0)=Class'XWeapons.AssaultFire' FireModeClass(1)=Class'XWeapons.AssaultGrenade' PutDownAnim="PutDown" SelectSound=Sound'WeaponSounds.AssaultRifle.SwitchToAssaultRifle' SelectForce="SwitchToAssaultRifle" AIRating=0.400000 CurrentRating=0.400000 bShowChargingBar=True OldMesh=SkeletalMesh'Weapons.AssaultRifle_1st' OldPickup="WeaponStaticMesh.AssaultRiflePickup" OldCenteredOffsetY=0.000000 OldPlayerViewOffset=(X=-8.000000,Y=5.000000,Z=-6.000000) OldSmallViewOffset=(X=4.000000,Y=11.000000,Z=-12.000000) OldPlayerViewPivot=(Pitch=400) OldCenteredRoll=3000 Description="Inexpensive and easily produced, the AR770 provides a lightweight 5.56mm combat solution that is most effective against unarmored foes. With low-to-moderate armor penetration capabilities, this rifle is best suited to a role as a light support weapon.|The optional M355 Grenade Launcher provides the punch that makes this weapon effective against heavily armored enemies. Pick up a second assault rifle to double your fire power." EffectOffset=(X=100.000000,Y=25.000000,Z=-10.000000) DisplayFOV=70.000000 Priority=3 HudColor=(B=192,G=128) SmallViewOffset=(X=13.000000,Y=12.000000,Z=-10.000000) CenteredOffsetY=-5.000000 CenteredRoll=3000 CenteredYaw=-1500 CustomCrosshair=4 CustomCrossHairScale=0.666700 CustomCrossHairTextureName="Crosshairs.Hud.Crosshair_Cross5" InventoryGroup=2 PickupClass=Class'XWeapons.AssaultRiflePickup' PlayerViewOffset=(X=4.000000,Y=5.500000,Z=-6.000000) PlayerViewPivot=(Pitch=400) BobDamping=1.700000 AttachmentClass=Class'XWeapons.AssaultAttachment' IconMaterial=Texture'HUDContent.Generic.HUD' IconCoords=(X1=245,Y1=39,X2=329,Y2=79) ItemName="Assault Rifle" LightType=LT_Pulse LightEffect=LE_NonIncidence LightHue=30 LightSaturation=150 LightBrightness=255.000000 LightRadius=4.000000 LightPeriod=3 Mesh=SkeletalMesh'NewWeapons2004.AssaultRifle' DrawScale=0.800000 HighDetailOverlay=Combiner'UT2004Weapons.WeaponSpecMap2' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |