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 |
class ClassicSniperRifle extends Weapon config(user); var transient float LastFOV; var() bool zoomed; var color ChargeColor; #exec OBJ LOAD FILE=NewSniperRifle.utx #exec OBJ LOAD FILE=..\Sounds\NewWeaponSounds.uax simulated function PostBeginPlay() { Super.PostBeginPlay(); FireMode[1].FireAnim = 'Idle'; } simulated function ClientWeaponThrown() { if( (Instigator != None) && (PlayerController(Instigator.Controller) != None) ) PlayerController(Instigator.Controller).EndZoom(); Super.ClientWeaponThrown(); } simulated function IncrementFlashCount(int Mode) { if ( Mode == 1 ) return; Super.IncrementFlashCount(Mode); } simulated event RenderOverlays( Canvas Canvas ) { local float CX,CY,Scale; local float chargeBar; local float barOrgX, barOrgY; local float barSizeX, barSizeY; if ( PlayerController(Instigator.Controller) == None ) { Super.RenderOverlays(Canvas); zoomed=false; return; } if ( LastFOV > PlayerController(Instigator.Controller).DesiredFOV ) { PlaySound(Sound'WeaponSounds.LightningGun.LightningZoomIn', SLOT_Misc,,,,,false); } else if ( LastFOV < PlayerController(Instigator.Controller).DesiredFOV ) { PlaySound(Sound'WeaponSounds.LightningGun.LightningZoomOut', SLOT_Misc,,,,,false); } LastFOV = PlayerController(Instigator.Controller).DesiredFOV; if ( PlayerController(Instigator.Controller).DesiredFOV == PlayerController(Instigator.Controller).DefaultFOV ) { Super.RenderOverlays(Canvas); zoomed=false; } else { if ( FireMode[0].NextFireTime <= Level.TimeSeconds ) { chargeBar = 1.0; } else { chargeBar = 1.0 - ((FireMode[0].NextFireTime-Level.TimeSeconds) / FireMode[0].FireRate); } CX = Canvas.ClipX/2; CY = Canvas.ClipY/2; Scale = Canvas.ClipX/1024; Canvas.Style = ERenderStyle.STY_Alpha; Canvas.SetDrawColor(0,0,0); // Draw the crosshair Canvas.SetPos(CX-169*Scale,CY-155*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',169*Scale,310*Scale, 164,35, 169,310); Canvas.SetPos(CX,CY-155*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',169*Scale,310*Scale, 332,345, -169,-310); // Draw Cornerbars Canvas.SetPos(160*Scale,160*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 111*Scale, 111*Scale , 0 , 0, 111, 111); Canvas.SetPos(Canvas.ClipX-271*Scale,160*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 111*Scale, 111*Scale , 111 , 0, -111, 111); Canvas.SetPos(160*Scale,Canvas.ClipY-271*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 111*Scale, 111*Scale, 0 , 111, 111, -111); Canvas.SetPos(Canvas.ClipX-271*Scale,Canvas.ClipY-271*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 111*Scale, 111*Scale , 111 , 111, -111, -111); // Draw the 4 corners Canvas.SetPos(0,0); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',160*Scale,160*Scale, 0, 274, 159, -158); Canvas.SetPos(Canvas.ClipX-160*Scale,0); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',160*Scale,160*Scale, 159,274, -159, -158); Canvas.SetPos(0,Canvas.ClipY-160*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',160*Scale,160*Scale, 0,116, 159, 158); Canvas.SetPos(Canvas.ClipX-160*Scale,Canvas.ClipY-160*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',160*Scale,160*Scale, 159, 116, -159, 158); // Draw the Horz Borders Canvas.SetPos(160*Scale,0); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', Canvas.ClipX-320*Scale, 160*Scale, 284, 512, 32, -160); Canvas.SetPos(160*Scale,Canvas.ClipY-160*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', Canvas.ClipX-320*Scale, 160*Scale, 284, 352, 32, 160); // Draw the Vert Borders Canvas.SetPos(0,160*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 160*Scale, Canvas.ClipY-320*Scale, 0,308, 160,32); Canvas.SetPos(Canvas.ClipX-160*Scale,160*Scale); Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 160*Scale, Canvas.ClipY-320*Scale, 160,308, -160,32); // Draw the Charging meter Canvas.DrawColor = ChargeColor; Canvas.DrawColor.A = 255; if(chargeBar <1) Canvas.DrawColor.R = 255*chargeBar; else { Canvas.DrawColor.R = 0; Canvas.DrawColor.B = 0; } if(chargeBar == 1) Canvas.DrawColor.G = 255; else Canvas.DrawColor.G = 0; Canvas.Style = ERenderStyle.STY_Alpha; Canvas.SetPos( barOrgX, barOrgY ); Canvas.DrawTile(Texture'Engine.WhiteTexture',barSizeX,barSizeY*chargeBar, 0.0, 0.0,Texture'Engine.WhiteTexture'.USize,Texture'Engine.WhiteTexture'.VSize*chargeBar); zoomed = true; } } simulated function ClientStartFire(int mode) { if (mode == 1) { FireMode[mode].bIsFiring = true; if( Instigator.Controller.IsA( 'PlayerController' ) ) PlayerController(Instigator.Controller).ToggleZoom(); } else { Super.ClientStartFire(mode); } } simulated function ClientStopFire(int mode) { if (mode == 1) { FireMode[mode].bIsFiring = false; if( PlayerController(Instigator.Controller) != None ) PlayerController(Instigator.Controller).StopZoom(); } else { Super.ClientStopFire(mode); } } simulated function BringUp(optional Weapon PrevWeapon) { if ( PlayerController(Instigator.Controller) != None ) LastFOV = PlayerController(Instigator.Controller).DesiredFOV; Super.BringUp(PrevWeapon); } simulated function bool PutDown() { if( Instigator.Controller.IsA( 'PlayerController' ) ) PlayerController(Instigator.Controller).EndZoom(); if ( Super.PutDown() ) return true; return false; } // AI Interface function float SuggestAttackStyle() { return -0.4; } function float SuggestDefenseStyle() { return 0.2; } /* BestMode() choose between regular or alt-fire */ function byte BestMode() { return 0; } function float GetAIRating() { local Bot B; local float ZDiff, dist, Result; B = Bot(Instigator.Controller); if ( B == None ) return AIRating; if ( B.IsShootingObjective() ) return AIRating - 0.15; if ( B.Enemy == None ) { if ( (B.Target != None) && VSize(B.Target.Location - B.Pawn.Location) > 8000 ) return 0.78; return AIRating; } if ( B.Stopped() ) result = AIRating + 0.1; else result = AIRating - 0.1; if ( Vehicle(B.Enemy) != None ) result -= 0.2; ZDiff = Instigator.Location.Z - B.Enemy.Location.Z; if ( ZDiff < -200 ) result += 0.1; dist = VSize(B.Enemy.Location - Instigator.Location); if ( dist > 2000 ) { if ( !B.EnemyVisible() ) result = result - 0.15; return ( FMin(2.0,result + (dist - 2000) * 0.0002) ); } if ( !B.EnemyVisible() ) return AIRating - 0.1; return result; } function bool RecommendRangedAttack() { local Bot B; B = Bot(Instigator.Controller); if ( (B == None) || (B.Enemy == None) ) return true; return ( VSize(B.Enemy.Location - Instigator.Location) > 2000 * (1 + FRand()) ); } // end AI Interface simulated function bool WantsZoomFade() { return true; } defaultproperties { ChargeColor=(B=255,G=255,R=255,A=255) FireModeClass(0)=Class'UTClassic.ClassicSniperFire' FireModeClass(1)=Class'XWeapons.SniperZoom' SelectAnim="Pickup" PutDownAnim="PutDown" SelectAnimRate=0.750000 PutDownAnimRate=0.780000 PutDownTime=0.580000 BringUpTime=0.600000 SelectSound=Sound'NewWeaponSounds.NewSniper_load' SelectForce="NewSniperLoad" AIRating=0.690000 CurrentRating=0.690000 bSniping=Wahr Description="This high muzzle velocity sniper rifle with a 10X scope is a lethal weapon at any range, especially if you can land a head shot." EffectOffset=(X=100.000000,Y=28.000000,Z=-19.000000) DisplayFOV=60.000000 Priority=12 HudColor=(B=255,G=170,R=185) SmallViewOffset=(X=36.900002,Y=10.000000,Z=-14.000000) CenteredOffsetY=0.000000 CenteredYaw=-500 CustomCrossHairColor=(G=170,R=185) InventoryGroup=9 GroupOffset=1 PickupClass=Class'UTClassic.ClassicSniperRiflePickup' PlayerViewOffset=(X=27.700001,Y=5.300000,Z=-10.600000) PlayerViewPivot=(Yaw=16384) BobDamping=2.300000 AttachmentClass=Class'UTClassic.ClassicSniperAttachment' IconMaterial=Texture'HUDContent.Generic.HUD' IconCoords=(X1=420,Y1=180,X2=512,Y2=210) ItemName="Sniper Rifle" LightType=LT_Steady LightEffect=LE_NonIncidence LightHue=30 LightSaturation=170 LightBrightness=255.000000 LightRadius=5.000000 LightPeriod=3 CullDistance=5000.000000 Mesh=SkeletalMesh'SniperAnims.SniperRifle_1st' DrawScale=0.480000 HighDetailOverlay=Combiner'UT2004Weapons.WeaponSpecMap2' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |