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

SkaarjPack.HUDInvasion


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
class HUDInvasion extends HudCTeamDeathMatch
    config(user);

var float RadarPulse,RadarScale;
var config float RadarPosX, RadarPosY;
var float LastDrawRadar;
var float MinEnemyDist;

var config bool bNoRadarSound;

#EXEC OBJ LOAD FILE=InterfaceContent.utx
#EXEC OBJ LOAD FILE=AS_FX_TX.utx

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

simulated function ShowTeamScorePassA(Canvas C)
{
    local float RadarWidth, PulseWidth, PulseBrightness;

    RadarScale = Default.RadarScale * HUDScale;
    RadarWidth = 0.5 * RadarScale * C.ClipX;
    PulseWidth = RadarScale * C.ClipX;
    C.DrawColor = RedColor;
    C.Style = ERenderStyle.STY_Translucent;

    PulseBrightness = FMax(0,(1 - 2*RadarPulse) * 255.0);
    C.DrawColor.R = PulseBrightness;
    C.SetPos(RadarPosX*C.ClipX - 0.5*PulseWidth,RadarPosY*C.ClipY+RadarWidth-0.5*PulseWidth);
    C.DrawTile( Material'InterfaceContent.SkinA', PulseWidth, PulseWidth, 0, 880, 142, 142);

    PulseWidth = RadarPulse * RadarScale * C.ClipX;
    C.DrawColor = RedColor;
    C.SetPos(RadarPosX*C.ClipX - 0.5*PulseWidth,RadarPosY*C.ClipY+RadarWidth-0.5*PulseWidth);
    C.DrawTile( Material'InterfaceContent.SkinA', PulseWidth, PulseWidth, 0, 880, 142, 142);

    C.Style = ERenderStyle.STY_Alpha;
    C.DrawColor = GetTeamColor( PawnOwner.GetTeamNum() );
    C.SetPos(RadarPosX*C.ClipX - RadarWidth,RadarPosY*C.ClipY+RadarWidth);
    C.DrawTile( Material'AS_FX_TX.AssaultRadar', RadarWidth, RadarWidth, 0, 512, 512, -512);
    C.SetPos(RadarPosX*C.ClipX,RadarPosY*C.ClipY+RadarWidth);
    C.DrawTile( Material'AS_FX_TX.AssaultRadar', RadarWidth, RadarWidth, 512, 512, -512, -512);
    C.SetPos(RadarPosX*C.ClipX - RadarWidth,RadarPosY*C.ClipY);
    C.DrawTile( Material'AS_FX_TX.AssaultRadar', RadarWidth, RadarWidth, 0, 0, 512, 512);
    C.SetPos(RadarPosX*C.ClipX,RadarPosY*C.ClipY);
    C.DrawTile( Material'AS_FX_TX.AssaultRadar', RadarWidth, RadarWidth, 512, 0, -512, 512);
}

simulated function ShowTeamScorePassC(Canvas C)
{
    local Pawn P;
    local float Dist, MaxDist, RadarWidth, PulseBrightness,Angle,DotSize,OffsetY,OffsetScale;
    local rotator Dir;
    local vector Start;
    
    LastDrawRadar = Level.TimeSeconds;
    RadarWidth = 0.5 * RadarScale * C.ClipX;
    DotSize = 24*C.ClipX*HUDScale/1600;
    if ( PawnOwner == None )
        Start = PlayerOwner.Location;
    else
        Start = PawnOwner.Location;
    
    MaxDist = 3000 * RadarPulse;
    C.Style = ERenderStyle.STY_Translucent;
    OffsetY = RadarPosY + RadarWidth/C.ClipY;
    MinEnemyDist = 3000;
    ForEach DynamicActors(class'Pawn',P)
        if ( P.Health > 0 )
        {
            Dist = VSize(Start - P.Location);
            if ( Dist < 3000 )
            {
                if ( Dist < MaxDist )
                    PulseBrightness = 255 - 255*Abs(Dist*0.00033 - RadarPulse);
                else
                    PulseBrightness = 255 - 255*Abs(Dist*0.00033 - RadarPulse - 1);
                if ( Monster(P) != None )
                {
                    MinEnemyDist = FMin(MinEnemyDist, Dist);
                    C.DrawColor.R = PulseBrightness;
                    C.DrawColor.G = PulseBrightness;
                    C.DrawColor.B = 0;
                }
                else
                {
                    C.DrawColor.R = 0;
                    C.DrawColor.G = 0;
                    C.DrawColor.B = PulseBrightness;
                }
                Dir = rotator(P.Location - Start);
                OffsetScale = RadarScale*Dist*0.000167;
                if ( PawnOwner == None )
                    Angle = ((Dir.Yaw - PlayerOwner.Rotation.Yaw) & 65535) * 6.2832/65536;
                else
                    Angle = ((Dir.Yaw - PawnOwner.Rotation.Yaw) & 65535) * 6.2832/65536;
                C.SetPos(RadarPosX * C.ClipX + OffsetScale * C.ClipX * sin(Angle) - 0.5*DotSize,
                        OffsetY * C.ClipY - OffsetScale * C.ClipX * cos(Angle) - 0.5*DotSize);
                C.DrawTile(Material'InterfaceContent.Hud.SkinA',DotSize,DotSize,838,238,144,144);
            }
        }           
}

simulated function Tick(float DeltaTime)
{
    Super.Tick(DeltaTime);
    RadarPulse = RadarPulse + 0.5 * DeltaTime;
    if ( RadarPulse >= 1 )
    {
        if ( !bNoRadarSound && (Level.TimeSeconds - LastDrawRadar < 0.2) )
            PlayerOwner.ClientPlaySound(Sound'RadarPulseSound',true,FMin(1.0,300/MinEnemyDist));
        RadarPulse = RadarPulse - 1;
    }
}

defaultproperties
{
     RadarScale=0.200000
     RadarPosX=0.900000
     RadarPosY=0.250000
     YouveLostTheMatch="The Invasion Continues"
}

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.515 - Created with UnCodeX