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

GUI2K4.UT2K4Tab_OnslaughtMap


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
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
// ====================================================================
// Onslaught minimap tab
//
// Written by Matt Oelfke
// (C) 2003, Epic Games, Inc. All Rights Reserved
// ====================================================================

class UT2K4Tab_OnslaughtMap extends MidGamePanel;


var() float OnslaughtMapCenterX, OnslaughtMapCenterY, OnslaughtMapRadius;

var automated GUIFooter f_Legend;

var automated GUILabel l_HelpText, l_HintText, l_TeamText;
var automated GUIButton b_Designer; //calls up the link designer
var automated moComboBox co_MenuOptions;

var automated GUIImage i_Background, i_HintImage, i_Team;

var() localized string MapPreferenceStrings[3];
var() localized string NodeTeleportHelpText,
                     SetDefaultText,
                     ChooseSpawnText,
                     ClearDefaultText,
                     SetDefaultHint,
                     ClearDefaultHint,
                     SpawnText,
                     TeleportText,
                     SpawnHint,
                     TeleportHint,
                     SelectedHint,
                     UnderAttackHint,
                     CoreHint,
                     NodeHint,
                     UnclaimedHint,
                     LockedHint;

var() localized string Titles[6];
var() localized string NewSelectedHint, NewTeleportHint, EnemyCoreHint;
var   localized string DefendMsg;

var color TColor[2];


var() material NodeImage;

var() color SelectionColor;
var() bool bNodeTeleporting; //this page is open because the player wants to node teleport

// Actor references - these must be cleared at level change
var ONSPlayerReplicationInfo PRI;
var ONSPowerCore SelectedCore;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
    local int x;

    Super.InitComponent(MyController, MyOwner);

    for (x = 0; x < 3; x++)
        co_MenuOptions.AddItem(MapPreferenceStrings[x]);
}

event Opened( GUIComponent Sender )
{
    Super.Opened(Sender);
    bNodeTeleporting = false;
}

//called to inform tab that it should be in Node Teleport mode instead of Select Spawn Point mode
function NodeTeleporting()
{
    bNodeTeleporting = true;
}

function ShowPanel(bool bShow)
{
    local string colorname,t;
    Super.ShowPanel(bShow);

    if ( bShow )
    {
        if ( (PRI != None) && (PRI.Team != None) )
        {
            colorname = PRI.Team.ColorNames[PRI.Team.TeamIndex];
            t = Repl(DefendMsg, "%t", colorname, false);
            l_TeamText.Caption = t;

            i_Team.Image = PRI.Level.GRI.TeamSymbols[PRI.Team.TeamIndex];
            i_Team.ImageColor = TColor[PRI.Team.TeamIndex];
        }
        if (PRI != None && (PRI.Level.NetMode == NM_Standalone || (PRI.bAdmin && PRI.Level.GRI != None && !PRI.Level.GRI.bMatchHasBegun)))
            b_Designer.Show();
        else
            b_Designer.Hide();
    }

}

function bool InternalOnPreDraw( Canvas C )
{
    local ONSPowerCore Core;
    local ONSHudOnslaught ONSHUD;

    ONSHUD = ONSHudOnslaught(PlayerOwner().myHud);
    Core = ONSHUD.LocatePowerCore(Controller.MouseX - OnslaughtMapCenterX, Controller.MouseY - OnslaughtMapCenterY, OnslaughtMapRadius);

    if ( Core == None || Core.CoreStage == 255 || Core.PowerLinks.Length == 0 )
    {
        l_HintText.Caption = "";
        l_HelpText.Caption = "";
        i_HintImage.Image = None;

        l_TeamText.SetVisibility(true);

    }

    else
    {
        l_TeamText.SetVisibility(false);

        if ( Core.bUnderAttack || (Core.CoreStage == 0 && Core.bSevered) )
            DrawAttackHint();
        else if ( PRI != None && Core == PRI.StartCore )
            DrawSpawnHint();
        else if (Core.bFinalCore)
        {
            if (Core.DefenderTeamIndex == PlayerOwner().PlayerReplicationInfo.Team.TeamIndex)
                DrawCoreHint(true);
            else
                DrawCoreHint(false);
        }
        else DrawNodeHint( ONSHUD, Core );
    }

    return false;
}

function DrawAttackHint()
{
    l_HintText.Caption = UnderAttackHint;
    SetHintImage(NodeImage,0,64,64,64);
    l_HelpText.Caption=Titles[0];
}

function DrawSpawnHint()
{
    l_HintText.Caption = SelectedHint;
    SetHintImage( NodeImage, 64, 64, 64, 64);
    l_HelpText.Caption=Titles[1];
}

function DrawCoreHint(bool HomeTeam)
{
    if (!HomeTeam)
    {
        l_HintText.Caption = EnemyCoreHint;
        SetHintImage( NodeImage, 65, 0, 62, 64 );
        return;
    }

    l_HintText.Caption = CoreHint;
    SetHintImage( NodeImage, 65, 0, 62, 64 );
    l_HelpText.Caption=Titles[2];

    if (bNodeTeleporting)
        L_HintText.Caption = l_HintText.Caption$NewTeleportHint;

    l_HintText.Caption = l_HintText.Caption$NewSelectedHint;
}

function DrawNodeHint( ONSHudOnslaught HUD, ONSPowerCore Core )
{
    if ( HUD == None || Core == None )
        return;

    if (Core.CoreStage == 4)
    {
        if (HUD.PowerCoreAttackable(Core))
        {
            l_HintText.Caption = UnclaimedHint;
            SetHintImage( NodeImage,0,0,31,32);
            l_HelpText.Caption=Titles[3];
        }
        else
        {
            l_HintText.Caption = LockedHint;
            SetHintImage( NodeImage,0,32,31,32);
            l_HelpText.Caption=Titles[4];
        }
    }
    else if (HUD.PowerCoreAttackable(Core))
    {
        l_HintText.Caption = NodeHint;
        SetHintImage( NodeImage, 32,0,32,31);
        l_HelpText.Caption=Titles[5];
    }
    else
    {
        l_HintText.Caption = LockedHint;
        SetHintImage( NodeImage,0,32,31,32);
        l_HelpText.Caption=Titles[4];
    }

    if (PlayerOwner().PlayerReplicationInfo.Team != None && Core.DefenderTeamIndex == PlayerOwner().PlayerReplicationInfo.Team.TeamIndex)
    {
        if (bNodeTeleporting)
            L_HintText.Caption = l_HintText.Caption$NewTeleportHint;

        if (!HUD.PowerCoreAttackable(Core) )
            l_HintText.Caption = l_HintText.Caption$NewSelectedHint;
    }
}

function SetHintImage( Material NewImage, int X1, int Y1, int X2, int Y2 )
{
    i_HintImage.Image = NewImage;
    i_HintImage.X1 = X1;
    i_HintImage.X2 = X1 + X2;
    i_HintImage.Y1 = Y1;
    i_HintImage.Y2 = Y1 + Y2;
}

function bool PreDrawMap(Canvas C)
{
    local float L,T,W,H;
    OnslaughtMapRadius = fmin( i_Background.ActualHeight(),i_Background.ActualWidth() ) / 2;
    OnslaughtMapCenterX = i_Background.Bounds[0] + OnslaughtMapRadius;
    OnslaughtMapCenterY = i_Background.Bounds[1] + i_Background.ActualHeight() / 2;

    l_HelpText.bBoundToParent=false;
    l_HelpText.bScaleToParent=false;

    l_HintText.bScaleToParent=false;
    l_HintText.bBoundToParent=false;

    i_HintImage.bScaleToParent=false;
    i_HintImage.bBoundToParent=false;

    l_TeamText.bScaleToParent=false;
    l_TeamText.bBoundToParent=false;

    i_Team.bScaleToParent=false;
    i_Team.bBoundToParent=false;

    L = OnslaughtMapCenterX + OnslaughtMapRadius + (ActualWidth()*0.05);
    T = OnslaughtMapCenterY - OnslaughtMapRadius;

    W = ActualLeft() + ActualWidth() - L;
    H = ActualTop() + ActualHeight() - T;

    i_HintImage.WinLeft = L;
    i_HintImage.WinTop = T;

    l_HelpText.WinLeft = i_HintImage.ActualLeft() + i_HintImage.ActualWidth() + 8;
    l_HelpText.WinTop = t;
    l_HelpText.WinHeight = i_HintImage.ActualHeight();
    l_HelpTExt.WinWidth = W - i_HintImage.ActualWidth() - 8;

    t += i_HintImage.ActualHeight()+8;
    l_HintText.WinLeft = l;
    l_HintText.WinTop= t;
    l_HintText.WinWidth = w;
    l_HintText.WinHeight = H - i_HintImage.ActualHeight() - 8;

    L = OnslaughtMapCenterX + OnslaughtMapRadius;
    W = ActualLeft() + ActualWidth() - L;

    i_Team.WinLeft = L;
    i_Team.WinWidth = W;
    i_Team.WinHeight = W;
    i_Team.WinTop = i_Background.ActualTop() + i_Background.ActualHeight() - i_Team.ActualHeight();


    l_TeamText.WinLeft = L;
    l_TeamText.WinWidth = W;
    l_TeamText.WinTop = i_Team.ActualTop() - l_TeamText.ActualHeight();

    return false;
}

function bool DrawMap(Canvas C)
{
    local ONSPowerCore Core;
    local ONSHudOnslaught ONSHUD;
    local float HS;

    if ( PRI != None )
        Core = PRI.StartCore;


    ONSHUD = ONSHudOnslaught(PlayerOwner().myHud);
    HS = ONSHUD.HudScale;
    ONSHUD.HudScale=1.0;
    ONSHUD.DrawRadarMap(C, OnslaughtMapCenterX, OnslaughtMapCenterY, OnslaughtMapRadius, false);
    ONSHUD.HudScale=HS;

    if ( Core != None )
        ONSHUD.DrawSpawnIcon(C, Core.HUDLocation, Core.bFinalCore, ONSHUD.IconScale, ONSHUD.HUDScale);

    return true;
}

function InternalOnPostDraw(Canvas Canvas)
{
    PRI = ONSPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo);
    if (PRI != None)
    {
        bInit = False;
        co_MenuOptions.SetIndex(PRI.ShowMapOnDeath);
        OnRendered = None;
        ShowPanel(true);
    }
}

function SetSelectedCore()
{
    local ONSPowerCore Core;

    Core = ONSHudOnslaught(PlayerOwner().myHUD).LocatePowerCore(Controller.MouseX - OnslaughtMapCenterX, Controller.MouseY - OnslaughtMapCenterY, OnslaughtMapRadius);
    if ( ValidSpawnPoint(Core) )
        SelectedCore = Core;
    else SelectedCore = None;
}

function bool SelectClick( GUIComponent Sender )
{
    local PlayerController PC;

    if (bInit || PRI == None || PRI.bOnlySpectator)
        return true;

    PC = PlayerOwner();
    SetSelectedCore();
    if ( SelectedCore == None )
        return True;

    if ( SelectedCore == PRI.StartCore )
        PRI.SetStartCore( None, false );
    else PRI.SetStartCore( SelectedCore, false );
}

function bool SpawnClick(GUIComponent Sender)
{
    local PlayerController PC;

    if (bInit || PRI == None || PRI.bOnlySpectator)
        return true;

    PC = PlayerOwner();
    SetSelectedCore();

    if ( SelectedCore == None )
        return True;

    if ( bNodeTeleporting )
    {
        if ( SelectedCore != None )
        {
            Controller.CloseMenu(false);
            PRI.TeleportTo(SelectedCore);
        }
    }
    else
    {
        Controller.CloseMenu(false);
        PRI.SetStartCore( SelectedCore, true );
        PC.ServerRestartPlayer();
    }
}

function bool InternalOnClick(GUIComponent Sender)
{
    if (bInit || PRI == None)
        return true;

    PRI.RequestLinkDesigner();
    return true;
}

function Timer()
{
    local PlayerController PC;

    PC = PlayerOwner();
    PC.ServerRestartPlayer();
    PC.bFire = 0;
    PC.bAltFire = 0;
    Controller.CloseMenu(false);
}

function bool ValidSpawnPoint(ONSPowerCore Core)
{
    if ( Core == None )
        return false;

    if (Core.DefenderTeamIndex == PRI.Team.TeamIndex && Core.CoreStage == 0 && (!Core.bUnderAttack || Core.bFinalCore) && Core.PowerLinks.Length > 0)
        return true;

    return false;
}

function Closed(GUIComponent Sender, bool bCancelled)
{
    local ONSPlayerReplicationInfo.EMapPreference Pref;

    if (PRI != None)
    {
        Pref = EMapPreference(co_MenuOptions.GetIndex());
        if ( Pref != PRI.ShowMapOnDeath )
        {
            PRI.ShowMapOnDeath = Pref;
            PRI.SaveConfig();
        }
    }

    Super.Closed(Sender,bCancelled);
}

function Free()
{
    Super.Free();

    PRI = None;
    SelectedCore = None;
}

function LevelChanged()
{
    Super.LevelChanged();

    PRI = None;
    SelectedCore = None;
}

defaultproperties
{
     OnslaughtMapCenterX=0.650000
     OnslaughtMapCenterY=0.400000
     OnslaughtMapRadius=0.300000
     Begin Object Class=GUILabel Name=HelpText
         TextColor=(B=255,G=255,R=255)
         StyleName="TextLabel"
         WinTop=0.035141
         WinLeft=0.719388
         WinWidth=0.274188
     End Object
     l_HelpText=GUILabel'GUI2K4.UT2K4Tab_OnslaughtMap.HelpText'

     Begin Object Class=GUILabel Name=HintLabel
         bMultiLine=Wahr
         FontScale=FNS_Small
         StyleName="TextLabel"
         WinTop=0.117390
         WinLeft=0.669020
         WinWidth=0.323888
         WinHeight=0.742797
         RenderWeight=0.520000
     End Object
     l_HintText=GUILabel'GUI2K4.UT2K4Tab_OnslaughtMap.HintLabel'

     Begin Object Class=GUILabel Name=TeamLabel
         Caption="Defend the Red Core"
         TextAlign=TXTA_Center
         bMultiLine=Wahr
         FontScale=FNS_Small
         StyleName="TextLabel"
         WinTop=0.391063
         WinLeft=0.597081
         WinWidth=0.385550
         WinHeight=0.043963
         RenderWeight=0.520000
     End Object
     l_TeamText=GUILabel'GUI2K4.UT2K4Tab_OnslaughtMap.TeamLabel'

     Begin Object Class=GUIButton Name=LinkDesignButton
         Caption="Link Designer"
         bAutoSize=Wahr
         WinTop=0.863674
         WinLeft=0.760387
         WinWidth=0.187876
         WinHeight=0.047400
         RenderWeight=0.520000
         TabOrder=3
         OnClick=UT2K4Tab_OnslaughtMap.InternalOnClick
         OnKeyEvent=LinkDesignButton.InternalOnKeyEvent
     End Object
     b_Designer=GUIButton'GUI2K4.UT2K4Tab_OnslaughtMap.LinkDesignButton'

     Begin Object Class=moComboBox Name=MapComboBox
         bReadOnly=Wahr
         CaptionWidth=0.300000
         Caption="Show Map:"
         OnCreateComponent=MapComboBox.InternalOnCreateComponent
         WinTop=0.866668
         WinLeft=0.032347
         WinWidth=0.628008
         WinHeight=0.038462
         TabOrder=2
     End Object
     co_MenuOptions=moComboBox'GUI2K4.UT2K4Tab_OnslaughtMap.MapComboBox'

     Begin Object Class=GUIImage Name=BackgroundImage
         Image=Texture'2K4Menus.Controls.outlinesquare'
         ImageStyle=ISTY_Stretched
         WinTop=0.070134
         WinLeft=0.029188
         WinWidth=0.634989
         WinHeight=0.747156
         bAcceptsInput=Wahr
         OnPreDraw=UT2K4Tab_OnslaughtMap.PreDrawMap
         OnDraw=UT2K4Tab_OnslaughtMap.DrawMap
         OnClick=UT2K4Tab_OnslaughtMap.SpawnClick
         OnRightClick=UT2K4Tab_OnslaughtMap.SelectClick
     End Object
     i_Background=GUIImage'GUI2K4.UT2K4Tab_OnslaughtMap.BackgroundImage'

     Begin Object Class=GUIImage Name=IconHintImage
         Image=Texture'ONSInterface-TX.NewHUDicons'
         ImageStyle=ISTY_Scaled
         WinTop=0.033996
         WinLeft=0.671639
         WinWidth=0.043667
         WinHeight=0.049502
         RenderWeight=0.510000
     End Object
     i_HintImage=GUIImage'GUI2K4.UT2K4Tab_OnslaughtMap.IconHintImage'

     Begin Object Class=GUIImage Name=iTeam
         ImageColor=(G=128,R=0,A=90)
         ImageStyle=ISTY_Scaled
         WinTop=0.400000
         WinLeft=0.619446
         WinWidth=0.338338
         WinHeight=0.405539
         TabOrder=10
     End Object
     i_Team=GUIImage'GUI2K4.UT2K4Tab_OnslaughtMap.iTeam'

     MapPreferenceStrings(0)="Never"
     MapPreferenceStrings(1)="When Body is Still"
     MapPreferenceStrings(2)="Immediately"
     NodeTeleportHelpText="Choose Node Teleport Destination"
     SetDefaultText="Set Default"
     ChooseSpawnText="Choose Your Spawn Point"
     ClearDefaultText="Clear Default"
     SetDefaultHint="Set the currently selected node as your preferred spawn location"
     ClearDefaultHint="Allow the game to choose the most appropriate spawn location"
     SpawnText="Spawn Here"
     TeleportText="Teleport Here"
     SpawnHint="Spawn at the currently selected node"
     TeleportHint="Teleport to the currently selected node"
     SelectedHint="Preferred spawn location"
     UnderAttackHint="Node is currently under attack"
     CoreHint="Main power core"
     NodeHint="Node is currently vulnerable to enemy attack"
     UnclaimedHint="Node is currently neutral and may be taken by either team"
     LockedHint="Node is currently unlinked and may not be attacked by the enemy"
     Titles(0)="Core (Under Attack)"
     Titles(1)="Preferred Node"
     Titles(2)="Core"
     Titles(3)="Node (Unclaimed)"
     Titles(4)="Node (Locked)"
     Titles(5)="Node (Attackable)"
     NewSelectedHint="||Right-Click on this node to select it as the preferred spawn location."
     NewTeleportHint="||Left-Click on this node to teleport to it"
     EnemyCoreHint="Enemy Core||Connect the nodes until you can reach this core"
     DefendMsg="Defend the %t core"
     TColor(0)=(B=100,G=100,R=255,A=128)
     TColor(1)=(B=255,G=128,A=128)
     NodeImage=Texture'ONSInterface-TX.NewHUDicons'
     SelectionColor=(B=255,G=255,R=255,A=255)
     OnPreDraw=UT2K4Tab_OnslaughtMap.InternalOnPreDraw
     OnRendered=UT2K4Tab_OnslaughtMap.InternalOnPostDraw
}

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