Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

XWeapons.Painter


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
class Painter extends Weapon
    config(user);

#exec OBJ LOAD FILE=XGameShaders.utx

var(Gfx) float borderX;
var(Gfx) float borderY;

var(Gfx) float focusX;
var(Gfx) float focusY;
var(Gfx) float innerArrowsX;
var(Gfx) float innerArrowsY;
var(Gfx) Color ArrowColor;
var(Gfx) Color FocusColor;
var(Gfx) Color ChargeColor;

var(Gfx) vector RechargeOrigin;
var(Gfx) vector RechargeSize;

var transient float LastFOV;
var bool zoomed;

var Vector EndEffect;
var vector MarkLocation;
var IonCannon FirstCannon;

function bool ConsumeAmmo(int Mode, float load, optional bool bAmountNeededIsMax)
{
    return true;
}

function ReallyConsumeAmmo(int Mode, float load)
{
    Super.ConsumeAmmo(Mode,load);
}

simulated function ClientWeaponThrown()
{
    if( (Instigator != None) && (PlayerController(Instigator.Controller) != None) )
        PlayerController(Instigator.Controller).EndZoom();
    Super.ClientWeaponThrown();
}

// compensate for bright fog
simulated function SetZoomBlendColor(Canvas c)
{
    local Byte    val;
    local Color   clr;
    local Color   fog;

    clr.R = 255;
    clr.G = 255;
    clr.B = 255;
    clr.A = 255;

    if( Instigator.Region.Zone.bDistanceFog )
    {
        fog = Instigator.Region.Zone.DistanceFogColor;
        val = 0;
        val = Max( val, fog.R);
        val = Max( val, fog.G);
        val = Max( val, fog.B);

        if( val > 128 )
        {
            val -= 128;
            clr.R -= val;
            clr.G -= val;
            clr.B -= val;
        }
    }
    c.DrawColor = clr;
}

simulated event RenderOverlays( Canvas Canvas )
{
    local float tileScaleX;
    local float tileScaleY;
    local float bX;
    local float bY;
    local float fX;
    local float fY;
    local float ChargeBar;

    local float barOrgX;
    local float barOrgY;
    local float barSizeX;
    local float barSizeY;

    local PainterFire PainterFire;

    CheckOutOfAmmo();

    //    FireSound=Sound'WeaponSounds.LightningGun.LightningScope'
    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
    {
        PainterFire = PainterFire(FireMode[0]);
        if (PainterFire.bIsFiring && PainterFire.bValidMark && Level.TimeSeconds - PainterFire.MarkTime > 0.4)
        {
            ChargeBar = FMin(1.0, ((Level.TimeSeconds - PainterFire.MarkTime) / PainterFire.PaintDuration));
            if (ChargeBar >= 1.0) ChargeBar = 0.0;
        }
        else
            ChargeBar = 0.0;

        tileScaleX = Canvas.SizeX / 640.0f;
        tileScaleY = Canvas.SizeY / 480.0f;

        bX = borderX * tileScaleX;
        bY = borderY * tileScaleY;
        fX = focusX * tileScaleX;
        fY = focusY * tileScaleX;

        barOrgX = RechargeOrigin.X * tileScaleX;
        barOrgY = RechargeOrigin.Y * tileScaleY;

        barSizeX = RechargeSize.X * tileScaleX;
        barSizeY = RechargeSize.Y * tileScaleY;

        SetZoomBlendColor(Canvas);

        Canvas.Style = 255;
        Canvas.SetPos(0,0);
        Canvas.DrawTile( Material'ZoomFB', Canvas.SizeX, Canvas.SizeY, 0.0, 0.0, 512, 512 ); // !! hardcoded size

        // draw border corners
        Canvas.Style = ERenderStyle.STY_Alpha;
        Canvas.SetPos(0,0);
        Canvas.DrawTile( Texture'SniperBorder', bX, bY, 0.0, 0.0, Texture'SniperBorder'.USize, Texture'SniperBorder'.VSize );

        Canvas.SetPos(Canvas.SizeX-bX,0);
        Canvas.DrawTile( Texture'SniperBorder', bX, bY, 0.0, 0.0, -Texture'SniperBorder'.USize, Texture'SniperBorder'.VSize );

        Canvas.SetPos(Canvas.SizeX-bX,Canvas.SizeY-bY);
        Canvas.DrawTile( Texture'SniperBorder', bX, bY, 0.0, 0.0, -Texture'SniperBorder'.USize, -Texture'SniperBorder'.VSize );

        Canvas.SetPos(0,Canvas.SizeY-bY);
        Canvas.DrawTile( Texture'SniperBorder', bX, bY, 0.0, 0.0, Texture'SniperBorder'.USize, -Texture'SniperBorder'.VSize );


        Canvas.DrawColor = FocusColor;
        Canvas.DrawColor.A = 255; // 255 was the original -asp. WTF??!?!?!
        Canvas.Style = ERenderStyle.STY_Alpha;

        Canvas.SetPos((Canvas.SizeX*0.5)-fX,(Canvas.SizeY*0.5)-fY);
        Canvas.DrawTile( Texture'SniperFocus', fX*2.0, fY*2.0, 0.0, 0.0, Texture'SniperFocus'.USize, Texture'SniperFocus'.VSize );

        fX = innerArrowsX * tileScaleX;
        fY = innerArrowsY * tileScaleY;

        Canvas.DrawColor = ArrowColor;
        Canvas.SetPos((Canvas.SizeX*0.5)-fX,(Canvas.SizeY*0.5)-fY);
        Canvas.DrawTile( Texture'SniperArrows', fX*2.0, fY*2.0, 0.0, 0.0, Texture'SniperArrows'.USize, Texture'SniperArrows'.VSize );


        // Draw the Charging meter  -AsP
        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( Instigator.Controller.IsA( 'PlayerController' ) )
            PlayerController(Instigator.Controller).StopZoom();
    }
    else
    {
        Super.ClientStopFire(mode);
    }
}

simulated function BringUp(optional Weapon PrevWeapon)
{
    if( Instigator.Controller.IsA( 'PlayerController' ) )
        LastFOV = PlayerController(Instigator.Controller).DesiredFOV;
    Super.BringUp(PrevWeapon);
}

simulated function bool PutDown()
{
    if( Instigator.Controller.IsA( 'PlayerController' ) )
        PlayerController(Instigator.Controller).EndZoom();
    return Super.PutDown();
}


simulated function bool HasAmmo()
{
    return (FireMode[0] != None && AmmoAmount(0) >= 1);
}

function IonCannon CheckMark(vector MarkLocation, bool bFire)
{
    if ( FirstCannon != None )
        return FirstCannon;
    foreach DynamicActors(class'IonCannon', FirstCannon)
        return FirstCannon;
    FirstCannon = spawn(class'IonCannon',,,Location+vect(0,0,2000));
    return FirstCannon;
}

// AI Interface
function float GetAIRating()
{
    local Bot B;
    local vector HitLocation, HitNormal;

    B = Bot(Instigator.Controller);
    if ( B == None )
        return AIRating;
    if ( B.IsShootingObjective() && Trace(HitLocation, HitNormal, B.Target.Location - vect(0,0,2000), B.Target.Location, false) != None )
    {
        MarkLocation = HitLocation;
        if ( CheckMark(MarkLocation, false) != None )
            return AIRating;
    }
    if ( (B.Enemy == None) || (Instigator.Location.Z < B.Enemy.Location.Z) || !B.EnemyVisible() )
        return 0;
    MarkLocation = B.Enemy.Location - B.Enemy.CollisionHeight * vect(0,0,2);
    if ( CheckMark(MarkLocation, false) != None )
        return 2.0;
    if ( TerrainInfo(B.Enemy.Base) == None )
        return 0;
    return 0.1;
}

/* BestMode()
choose between regular or alt-fire
*/
function byte BestMode()
{
    return 0;
}

function float SuggestAttackStyle()
{
    return 0;
}

function float SuggestDefenseStyle()
{
    return 2;
}

function float RangedAttackTime()
{
    return 6;
}

function bool RecommendRangedAttack()
{
    return true;
}

function bool RecommendLongRangedAttack()
{
    return true;
}

// End AI Interface

defaultproperties
{
     borderX=60.000000
     borderY=60.000000
     focusX=135.000000
     focusY=105.000000
     innerArrowsX=42.000000
     innerArrowsY=42.000000
     ArrowColor=(B=200,G=200,R=200,A=255)
     FocusColor=(B=126,G=90,R=71,A=215)
     ChargeColor=(B=255,G=255,R=255,A=255)
     RechargeOrigin=(X=600.000000,Y=330.000000)
     RechargeSize=(X=10.000000,Y=-180.000000)
     FireModeClass(0)=Class'XWeapons.PainterFire'
     FireModeClass(1)=Class'XWeapons.PainterZoom'
     PutDownAnim="PutDown"
     SelectSound=Sound'WeaponSounds.LinkGun.SwitchToLinkGun'
     SelectForce="SwitchToLinkGun"
     AIRating=1.000000
     CurrentRating=1.000000
     bNotInDemo=True
     Description="The Ion Painter seems innocuous enough at first glance, emitting a harmless low-power laser beam when the primary firing mode is engaged. Several seconds later a multi-gigawatt orbital ion cannon fires on the target, neutralizing any combatants in the vicinity.||The Ion Painter is a remote targeting device used to orient and fire the VAPOR Ion Cannon. The Ion Painter offers increased targeting accuracy via its telescopic sight, easily activated by the secondary fire mode of the weapon.|Once the Ion Painter has been used to designate a target it is highly recommended that the user put considerable distance between themselves and the weapon's area of effect."
     DemoReplacement=Class'XWeapons.SniperRifle'
     EffectOffset=(X=100.000000,Y=25.000000,Z=-3.000000)
     DisplayFOV=60.000000
     Priority=15
     SmallViewOffset=(X=37.000000,Y=8.000000,Z=-7.000000)
     CenteredOffsetY=-22.000000
     CenteredRoll=1000
     CustomCrosshair=13
     CustomCrossHairColor=(B=128)
     CustomCrossHairScale=2.000000
     CustomCrossHairTextureName="Crosshairs.Hud.Crosshair_Circle2"
     InventoryGroup=0
     PickupClass=Class'XWeapons.PainterPickup'
     PlayerViewOffset=(X=25.000000,Y=2.000000,Z=-1.000000)
     BobDamping=1.575000
     AttachmentClass=Class'XWeapons.PainterAttachment'
     IconMaterial=Texture'HUDContent.Generic.HUD'
     IconCoords=(Y1=407,X2=118,Y2=442)
     ItemName="Ion Painter"
     Mesh=SkeletalMesh'Weapons.Painter_1st'
     HighDetailOverlay=Combiner'UT2004Weapons.WeaponSpecMap2'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Tue 24/10/2006 17:08:00.000 - Creation time: Wed 7/2/2007 19:16:48.687 - Created with UnCodeX