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

DruidsRPGcvs.EngineerInteraction


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
class EngineerInteraction extends Interaction
    config(UT2004RPG);

var EngineerPointsInv EInv;
var Font TextFont;
var color EPBarColor, WhiteColor, RedTeamTint, BlueTeamTint;
var localized string EPText, AdrenalineText, PointsText;
var int dummyi;

event Initialized()
{
    TextFont = Font(DynamicLoadObject("UT2003Fonts.jFontSmall", class'Font'));
    super.Initialized();
}

//Find local player's stats inventory item
function FindEPInv()
{
    local Inventory Inv;
    local EngineerPointsInv FoundEInv;

    for (Inv = ViewportOwner.Actor.Inventory; Inv != None; Inv = Inv.Inventory)
    {
        FoundEInv = EngineerPointsInv(Inv);
        if (FoundEInv != None)
        {
            if (FoundEInv.Owner == ViewportOwner.Actor || FoundEInv.Owner == ViewportOwner.Actor.Pawn)
                EInv = FoundEInv;
            return;
        }
        else
        {
            //atrocious hack for Jailbreak's bad code in JBTag (sets its Inventory property to itself)
            if (Inv.Inventory == Inv)
            {
                Inv.Inventory = None;
                foreach ViewportOwner.Actor.DynamicActors(class'EngineerPointsInv', FoundEInv)
                {
                    if (FoundEInv.Owner == ViewportOwner.Actor || FoundEInv.Owner == ViewportOwner.Actor.Pawn)
                    {
                        EInv = FoundEInv;
                        Inv.Inventory = EInv;
                        break;
                    }
                }
                return;
            }
        }
    }
}

function PostRender(Canvas Canvas)
{
    local float XL, YL, XLSmall, YLSmall, EPBarX, EPBarY;
    local Summonifact Sf;
    local int UsedPoints, TotalPoints;
    local string pText;

    if ( ViewportOwner == None || ViewportOwner.Actor == None || ViewportOwner.Actor.Pawn == None || ViewportOwner.Actor.Pawn.Health <= 0
         || (ViewportOwner.Actor.myHud != None && ViewportOwner.Actor.myHud.bShowScoreBoard)
         || ViewportOwner.Actor.myHud.bHideHUD )
        return;

    if (EInv == None)
        FindEPInv();
    if (EInv == None)
        return;
    UsedPoints = EInv.UsedTurretPoints+EInv.UsedVehiclePoints+EInv.UsedBuildingPoints;
    TotalPoints = EInv.TotalTurretPoints+EInv.TotalVehiclePoints+EInv.TotalBuildingPoints;
// Spectators shouldn't get the Total/UsedXObjPoints replicated now, so
// this should detect them appropriately.  Ideally, EInv won't be found
// either, but I don't know if I trust that - so this for sure will
// result in former spectators not seeing the display on spawn.
    if(TotalPoints == 0)
        return;

    if (TextFont != None)
        Canvas.Font = TextFont;
    Canvas.FontScaleX = Canvas.ClipX / 1024.f;
    Canvas.FontScaleY = Canvas.ClipY / 768.f;

    Canvas.FontScaleX *= 0.75; //make it smaller
    Canvas.FontScaleY *= 0.75;

    Canvas.TextSize(EPText, XL, YL);

    // increase size of the display if necessary for really high levels
    XL = FMax(XL + 9.f * Canvas.FontScaleX, 135.f * Canvas.FontScaleX);

    Canvas.Style = 5;
    Canvas.DrawColor = EPBarColor;
    EPBarX = Canvas.ClipX - XL - 1.f;
    EPBarY = Canvas.ClipY * 0.75 - YL * 2.5; //used to be 1.75. 
    Canvas.SetPos(EPBarX, EPBarY);
    if (EInv.TotalBuildingPoints > 0)
        Canvas.DrawTile(Material'InterfaceContent.Hud.SkinA', XL * EInv.UsedBuildingPoints / EInv.TotalBuildingPoints, 5.0 * Canvas.FontScaleY * 1.25, 836, 454, -386 * EInv.UsedBuildingPoints / EInv.TotalBuildingPoints, 36);
    Canvas.SetPos(EPBarX, EPBarY+(5* Canvas.FontScaleY * 1.25));
    if (EInv.TotalTurretPoints > 0)
        Canvas.DrawTile(Material'InterfaceContent.Hud.SkinA', XL * EInv.UsedTurretPoints / EInv.TotalTurretPoints, 5.0 * Canvas.FontScaleY * 1.25, 836, 454, -386 * EInv.UsedTurretPoints / EInv.TotalTurretPoints, 36);
    Canvas.SetPos(EPBarX, EPBarY+(10  * Canvas.FontScaleY * 1.25));
    if (EInv.TotalVehiclePoints > 0)
        Canvas.DrawTile(Material'InterfaceContent.Hud.SkinA', XL * EInv.UsedVehiclePoints / EInv.TotalVehiclePoints, 5.0 * Canvas.FontScaleY * 1.25, 836, 454, -386 * EInv.UsedVehiclePoints / EInv.TotalVehiclePoints, 36);
    if ( ViewportOwner.Actor.PlayerReplicationInfo == None || ViewportOwner.Actor.PlayerReplicationInfo.Team == None
         || ViewportOwner.Actor.PlayerReplicationInfo.Team.TeamIndex != 0 )
        Canvas.DrawColor = BlueTeamTint;
    else
        Canvas.DrawColor = RedTeamTint;
    Canvas.SetPos(EPBarX, EPBarY);
    Canvas.DrawTile(Material'InterfaceContent.Hud.SkinA', XL, 15.0 * Canvas.FontScaleY * 1.25, 836, 454, -386, 36);
    Canvas.DrawColor = WhiteColor;
    Canvas.SetPos(EPBarX, EPBarY);
    Canvas.DrawTile(Material'InterfaceContent.Hud.SkinA', XL, 16.0 * Canvas.FontScaleY * 1.25, 836, 415, -386, 38);

    Canvas.Style = 2;
    Canvas.DrawColor = WhiteColor;

    Canvas.SetPos(EPBarX + 9.f * Canvas.FontScaleX, Canvas.ClipY * 0.75 - YL * 3.7); //used to be 3
    Canvas.DrawText(EPText);

    pText = EInv.UsedBuildingPoints$":"$EInv.UsedTurretPoints$":"$EInv.UsedVehiclePoints$"/"$EInv.TotalBuildingPoints$":"$EInv.TotalTurretPoints$":"$EInv.TotalVehiclePoints;
    Canvas.TextSize(pText, XLSmall, YLSmall);
    Canvas.SetPos(Canvas.ClipX - XL * 0.5 - XLSmall * 0.5, Canvas.ClipY * 0.75 - YL * 2.5 + 12.5 * Canvas.FontScaleY - YLSmall * 0.5); //used to be 3.75
    Canvas.DrawText(pText);

    Sf = Summonifact(ViewportOwner.Actor.Pawn.SelectedItem);
    if (Sf != None)
    {
        //Draw summoning item "Artifact" HUD info

        Canvas.FontScaleX = Canvas.default.FontScaleX * 0.80;
        Canvas.FontScaleY = Canvas.default.FontScaleY * 0.80;

        Canvas.SetPos(10, Canvas.ClipY * 0.75 - YL * 7.65);
        Canvas.DrawText(Sf.FriendlyName);
        Canvas.SetPos(10, Canvas.ClipY * 0.75 - YL * 6.75);
        Canvas.DrawText(AdrenalineText $ Sf.Adrenaline);
        Canvas.SetPos(10, Canvas.ClipY * 0.75 - YL * 5.85);
        Canvas.DrawText(PointsText $ Sf.Points);
    }

    Canvas.FontScaleX = Canvas.default.FontScaleX;
    Canvas.FontScaleY = Canvas.default.FontScaleY;
    super.PostRender(Canvas);
}

event NotifyLevelChange()
{
    //close stats menu if it's open
    Master.RemoveInteraction(self);
    EInv.Interaction = None;
    super.NotifyLevelChange();
}

defaultproperties
{
     EPBarColor=(B=128,G=255,R=128,A=255)
     WhiteColor=(B=255,G=255,R=255,A=255)
     RedTeamTint=(R=100,A=100)
     BlueTeamTint=(B=102,G=66,R=37,A=150)
     EPText="Engineer Points:"
     AdrenalineText="Adrenaline:"
     PointsText="Points:"
     bVisible=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Tue 24/10/2006 14:31:36.000 - Creation time: Wed 7/2/2007 19:16:38.875 - Created with UnCodeX