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

BonusPack.HudMutant


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
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
// ====================================================================
//  Class: BonusPack.HudMutant
//
//  HUD for Mutant game-type. Adds things like the mutant-detecting radar
//
//  Written by James Golding
//  (c) 2002, Epic Games, Inc.  All Rights Reserved
// ====================================================================

class HudMutant extends HudCDeathMatch;

var()   SpriteWidget        TopRadarBG;
var()   SpriteWidget        CenterRadarBG;

//var()	localized String	CurrentMutantFontName;
//var()	Font				CurrentMutantFontFont;
var()   Color               CurrentMutantColor;
var()   Color               MutantHudTint;

var()   localized String    MutantRangeFontName;
var()   Font                MutantRangeFontFont;
var()   Color               MutantRangeColor;

var()   localized String    BottomFeederText;
var()   Color               BottomFeederTextColor;

var()   Color               AboveMutantColor;
var()   Color               LevelMutantColor;
var()   Color               BelowMutantColor;
var()   Color               RangeDotColor;
var()   float               LevelRampRegion;
var()   bool                bCenterRadar;
var()   bool                bTestHud;

var()   float               RangeRampRegion;
var()   float               MaxAngleDelta;
var()   float               BigDotSize;
var()   float               SmallDotSize;

var()   float               XCen, XRad, YCen, YRad; // Center radar tweaking
var()   float               MNOriginX, MNOriginY, MNSizeX, MNSizeY;
var()   float               BFIOriginX, BFIOriginY, BFISizeX, BFISizeY, BFIMargin, BFIPulseRate;
var()   Material            BottomFeederIcon;

var()   Texture             BottomFeederBeaconMat;

var     transient bool      bMutantHudColor;

function color LerpColor(float Alpha, color A, color B)
{
    local color output;

    output.R = lerp(Alpha, A.R, B.R);
    output.G = lerp(Alpha, A.G, B.G);
    output.B = lerp(Alpha, A.B, B.B);
    output.A = lerp(Alpha, A.A, B.A);

    return output;
}

simulated function UpdatePrecacheMaterials()
{
    Level.AddPrecacheMaterial(Material'InterfaceContent.HUD.SkinA');
    Super.UpdatePrecacheMaterials();
}

simulated function font LoadMutantRangeFont()
{
    if( MutantRangeFontFont == None )
    {
        MutantRangeFontFont = Font(DynamicLoadObject(MutantRangeFontName, class'Font'));
        if( MutantRangeFontFont == None )
            Log("Warning: "$Self$" Couldn't dynamically load font "$MutantRangeFontName);
    }
    return MutantRangeFontFont;
}

// Alpha Pass ==================================================================================
// Draw radar showing 

simulated function bool PRIIsBottomFeeder(PlayerReplicationInfo PRI)
{
    local MutantGameReplicationInfo mutantInfo;

    mutantInfo = MutantGameReplicationInfo( PlayerOwner.GameReplicationInfo );

    // Check this players PRI against the current BF PRI to see...
    if(PRI == mutantInfo.BottomFeederPRI)
        return true;
    else
        return false;
}

simulated function bool PRIIsMutant(PlayerReplicationInfo PRI)
{
    local MutantGameReplicationInfo mutantInfo;

    mutantInfo = MutantGameReplicationInfo( PlayerOwner.GameReplicationInfo );


    // Check this players PRI against the current Mutant PRI to see...
    if(PRI == mutantInfo.MutantPRI)
        return true;
    else
        return false;
}

// Copy from HudCDeathMatch - need to hack it to change HUD color.
simulated function DrawWeaponBar( Canvas C )
{
    local color RealRedColor, RealBlueColor;
    
    if ( !bMutantHUDColor )
    {
        Super.DrawWeaponBar(C);
        return;
    }
    
    RealRedColor = HudColorRed;
    RealBlueColor = HudColorBlue;
    
    HudColorRed = MutantHUDTint;
    HudColorBlue = MutantHUDTint;

    Super.DrawWeaponBar(C);
    
    HudColorRed = RealRedColor;
    HudColorBlue = RealBlueColor;
}

simulated function DrawHud(Canvas C)
{
    local color RealRedColor, RealBlueColor;

    bMutantHudColor = PRIIsMutant(PlayerOwner.PlayerReplicationInfo);
    
    if ( !bMutantHUDColor )
    {
        Super.DrawHud(C);
        return;
    }
    
    RealRedColor = HudColorRed;
    RealBlueColor = HudColorBlue;
    
    HudColorRed = MutantHUDTint;
    HudColorBlue = MutantHUDTint;

    Super.DrawHud(C);
    
    HudColorRed = RealRedColor;
    HudColorBlue = RealBlueColor;
}

simulated function bool PawnIsVisible(vector vecPawnView, vector X, pawn P)
{
    local vector StartTrace, EndTrace;

    if ( (PawnOwner == None) || (PlayerOwner==None) )
        return false;

    if ( PawnOwner != PlayerOwner.Pawn )
        return false;

    if ( (vecPawnView Dot X) <= 0.70 )
        return false;
        
    StartTrace = PawnOwner.Location;
    StartTrace.Z += PawnOwner.BaseEyeHeight;

    EndTrace = P.Location;
    EndTrace.Z += P.BaseEyeHeight;

    if ( !FastTrace(EndTrace, StartTrace) )
        return false;

    return true;        
}

function DrawCustomBeacon(Canvas C, Pawn P, float ScreenLocX, float ScreenLocY)
{
    if ( P.PlayerReplicationInfo != MutantGameReplicationInfo(PlayerOwner.GameReplicationInfo).BottomFeederPRI )
        return;

    C.DrawColor = BottomFeederTextColor;
    C.SetPos(ScreenLocX - 0.125 * BottomFeederBeaconMat.USize, ScreenLocY - 0.125 * BottomFeederBeaconMat.VSize);
    C.DrawTile(BottomFeederBeaconMat, 
        0.25 * BottomFeederBeaconMat.USize, 
        0.25 * BottomFeederBeaconMat.VSize, 
        0.0,
        0.0,
        BottomFeederBeaconMat.USize,
        BottomFeederBeaconMat.VSize);
}

simulated function DrawBottomFeederIndicator(Canvas C); //OBSOLETE

simulated function DrawHudPassA(Canvas C)
{
    local rotator Dir;
    local float Angle, VertDiff, Range, AngleDelta;
    local MutantGameReplicationInfo mutantInfo;
    local xMutantPawn x;

    Super.DrawHudPassA (C);

    mutantInfo = MutantGameReplicationInfo(PlayerOwner.GameReplicationInfo);
    x = xMutantPawn(PawnOwner);

    // If there is a mutant, and we are not it - draw radar indicating mutant location.
    if( bTestHud || (mutantInfo.MutantPRI != None && mutantInfo.MutantPRI != PlayerOwner.PlayerReplicationInfo) )
    {
        // Draw radar outline
        if(bCenterRadar)
        {
            PassStyle=STY_None;
            DrawSpriteWidget (C, CenterRadarBG);
            PassStyle=STY_Alpha;
        }
        else
        {
            DrawSpriteWidget(C, TopRadarBG);
        }

        if(bTestHud)
        {
            Dir = rotator(vect(0, 0, 0) - PawnOwner.Location);
            VertDiff = 0.0 - PawnOwner.Location.Z;
            Range = VSize(vect(0, 0, 0) - PawnOwner.Location) - class'xPawn'.default.CollisionRadius;
        }
        else
        {
            Dir = rotator(mutantInfo.MutantLocation - PawnOwner.Location);
            VertDiff = mutantInfo.MutantLocation.Z - PawnOwner.Location.Z;

            // Remove player radiii from range (so when you are standing next to the mutant range is zero)
            Range = VSize(mutantInfo.MutantLocation - PawnOwner.Location) - (2 * class'xPawn'.default.CollisionRadius);
        }

        Angle = ((Dir.Yaw - PawnOwner.Rotation.Yaw) & 65535) * 6.2832/65536;
    
        if(VertDiff > LevelRampRegion)
            C.DrawColor = AboveMutantColor;
        else if(VertDiff > 0)
            C.DrawColor = LerpColor(VertDiff/LevelRampRegion, LevelMutantColor, AboveMutantColor);
        else if(VertDiff > -LevelRampRegion)
            C.DrawColor = LerpColor(-VertDiff/LevelRampRegion, LevelMutantColor, BelowMutantColor);
        else
            C.DrawColor = BelowMutantColor;

        C.Style = ERenderStyle.STY_Alpha;

        if(bCenterRadar)
        {
            C.SetPos(XCen * C.ClipX + HudScale * XRad * C.ClipX * sin(Angle) - 0.5*BigDotSize*C.ClipX,
                YCen * C.ClipY - HudScale * YRad * C.ClipY * cos(Angle) - 0.5*BigDotSize*C.ClipX );
        }
        else
        {
            C.SetPos(0.492 * C.ClipX + HudScale * 0.034 * C.ClipX * sin(Angle),
                0.042 * C.ClipY - HudScale * 0.045 * C.ClipY * cos(Angle));
        }

        C.DrawTile(Material'InterfaceContent.Hud.SkinA', BigDotSize*C.ClipX, BigDotSize*C.ClipX,838,238,144,144);

        if(bCenterRadar)
        {
            //  Draw dots to indicate mutant range
            AngleDelta = (FMin(RangeRampRegion, Range)/RangeRampRegion) * MaxAngleDelta;

            C.DrawColor = RangeDotColor;

            C.SetPos(XCen * C.ClipX + HudScale * XRad * C.ClipX * sin(Angle + AngleDelta) - 0.5*SmallDotSize*C.ClipX,
                YCen * C.ClipY - HudScale * YRad * C.ClipY * cos(Angle + AngleDelta) - 0.5*SmallDotSize*C.ClipX );

            C.DrawTile(Material'InterfaceContent.Hud.SkinA', SmallDotSize*C.ClipX, SmallDotSize*C.ClipX, 838, 238, 144, 144);

            C.SetPos(XCen * C.ClipX + HudScale * XRad * C.ClipX * sin(Angle - AngleDelta) - 0.5*SmallDotSize*C.ClipX,
                YCen * C.ClipY - HudScale * YRad * C.ClipY * cos(Angle - AngleDelta) - 0.5*SmallDotSize*C.ClipX);

            C.DrawTile(Material'InterfaceContent.Hud.SkinA', SmallDotSize*C.ClipX, SmallDotSize*C.ClipX, 838, 238, 144, 144);
        }
        else
        {
            // Draw on Mutant range in middle of dial
            C.DrawColor = MutantRangeColor;
            C.Font = LoadMutantRangeFont();
            C.DrawTextJustified( Min(int(Range),9999) , 1, 0.4 * C.ClipX, 0.03 * C.ClipY, 0.6 * C.ClipX, 0.08 * C.ClipY);
        }

        // Draw on Mutant name

        C.DrawColor = WhiteColor;
        C.SetPos(C.ClipX * MNOriginX, C.ClipY * MNOriginY);
        C.DrawTileStretched(texture 'InterfaceContent.Menu.BorderBoxD', MNSizeX * C.ClipX, MNSizeY * C.ClipY);

        C.DrawColor = CurrentMutantColor;
        C.Font = LoadLevelActionFont();

        
        if( bTestHud)
            C.DrawTextJustified("DefLoc", 1, 0.3 * C.ClipX, 0.015 * C.ClipY, 0.7 * C.ClipX, 0.065 * C.ClipY);
        else
            C.DrawTextJustified(mutantInfo.MutantPRI.PlayerName, 1, 0.3 * C.ClipX, 0.015 * C.ClipY, 0.7 * C.ClipX, 0.065 * C.ClipY);
    }
        
    // If there is no bottom feeder - no more HUD to do.
    if( mutantInfo.BottomFeederPRI == None)
        return;

    // If we are a bottom feeder - indicate on the screen
    if( PRIIsBottomFeeder(PlayerOwner.PlayerReplicationInfo) )
    {
        C.DrawColor = WhiteColor;
        C.SetPos(C.ClipX * BFIOriginX, C.ClipY * BFIOriginY);
        C.DrawTileStretched(texture 'InterfaceContent.Menu.BorderBoxD', BFISizeX * C.ClipX, BFISizeY * C.ClipY);

        C.DrawColor.R = 255 * (0.5 + 0.5 * Cos(Level.TimeSeconds * Pi * BFIPulseRate));
        C.SetPos(C.ClipX * (BFIOriginX + BFIMargin), C.ClipY * (BFIOriginY + BFIMargin));
        C.DrawTile( BottomFeederIcon, C.ClipX * (BFISizeX - 2*BFIMargin), C.ClipY * (BFISizeY - 2*BFIMargin), 0, 0, 256, 256);
    }
}

// Draw enemy name. Also indicate bottom feeders.
function DisplayEnemyName(Canvas C, PlayerReplicationInfo PRI)
{
    // Send 'bottom feeder' indication
    if( PRIIsBottomFeeder( PRI ) )
        PlayerOwner.ReceiveLocalizedMessage(class'MutantNameMessage',1,PRI);
    else //send blank bottomfeeder message
        PlayerOwner.ReceiveLocalizedMessage(class'MutantNameMessage',0,PRI);
}

simulated function DrawCrosshair (Canvas C)
{
    Super.DrawCrosshair(C);
}

defaultproperties
{
     TopRadarBG=(WidgetTexture=Texture'InterfaceContent.HUD.SkinA',RenderStyle=STY_Alpha,TextureCoords=(X1=142,Y1=880,Y2=1023),TextureScale=0.350000,DrawPivot=DP_UpperMiddle,PosX=0.500000,PosY=0.010000,OffsetY=-15,ScaleMode=SM_Right,Scale=1.000000,Tints[0]=(B=255,G=255,R=255,A=255),Tints[1]=(B=255,G=255,R=255,A=255))
     CenterRadarBG=(WidgetTexture=Texture'MutantSkins.HUD.big_circle',RenderStyle=STY_Translucent,TextureCoords=(X1=255,Y2=255),TextureScale=0.800000,DrawPivot=DP_MiddleMiddle,PosX=0.500000,PosY=0.500000,ScaleMode=SM_Right,Scale=1.000000,Tints[0]=(B=255,G=255,R=255,A=255),Tints[1]=(B=255,G=255,R=255,A=255))
     CurrentMutantColor=(B=128,R=255,A=255)
     MutantHudTint=(B=128,R=200,A=100)
     MutantRangeFontName="UT2003Fonts.FontMono"
     MutantRangeColor=(B=200,G=200,R=200,A=255)
     BottomFeederText="BOTTOM FEEDER"
     BottomFeederTextColor=(B=255,G=255,A=255)
     AboveMutantColor=(B=255,A=255)
     LevelMutantColor=(B=255,G=255,R=255,A=255)
     BelowMutantColor=(R=255,A=255)
     RangeDotColor=(B=50,G=200,R=200,A=255)
     LevelRampRegion=500.000000
     bCenterRadar=Wahr
     RangeRampRegion=2500.000000
     MaxAngleDelta=1.000000
     BigDotSize=0.018750
     SmallDotSize=0.011250
     XCen=0.500000
     XRad=0.150000
     YCen=0.500000
     YRad=0.200000
     MNOriginX=0.280000
     MNOriginY=0.008000
     MNSizeX=0.450000
     MNSizeY=0.060000
     BFIOriginX=0.900000
     BFIOriginY=0.640000
     BFISizeX=0.090000
     BFISizeY=0.100000
     BFIMargin=0.010000
     BFIPulseRate=1.000000
     BottomFeederIcon=Texture'MutantSkins.HUD.BFeeder_icon'
     BottomFeederBeaconMat=Texture'TeamSymbols.TeamBeaconT'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 30.3.2007 08:43:50.000 - Creation time: Mo 16.4.2007 11:20:48.531 - Created with UnCodeX