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

ROEngine.ROCriticalMessage


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
//=============================================================================
// ROCriticalMessage
// started by EMH_Mark3 on 10/26/2005
//
// Copyright (C) 2003 Jeffrey Nakai
//
// Used to display critical messages on the hud
//=============================================================================
class ROCriticalMessage extends ROStringMessage;

var bool bQuickFade;
var float quickFadeTime;     // if bQuickFade = true, then keep message on for lifetime
                             // and then fade in quickFadeTime seconds

var float TextAlpha;

var float timePerCharacter;

var int iconID;
var int altIconID;
var int errorIconID;

var Material iconTexture;

var float maxMessageWidth;    // Maximum width that a message can take on the screen before wrapping (0-1)

var int maxMessagesOnScreen;

static function RenderComplexMessageExtra(
    Canvas Canvas,
    out float XL,
    out float YL,
    out float YL_temp,
    optional int Switch,
    optional PlayerReplicationInfo RelatedPRI_1,
    optional PlayerReplicationInfo RelatedPRI_2,
    optional Object OptionalObject,
    optional array<string> lines,
    optional int background_type
    )
{
    local color oldColor;
    local float totalXL;
    local float tileX, tileY, tileXL, tileYL, iconSize;
    local float textX, textY;
    local float myXL, myYL;
    local int i, iconID;

    oldColor = Canvas.DrawColor;
    iconSize = YL / lines.length;
    totalXL = XL + (iconSize * 1.4);

    tileX = Canvas.CurX;
    tileY = Canvas.CurY;
    tileXL = totalXL * (float(256) / (256 - 30));
    tileYL = YL * (float(64) / (64 - 20));
    textX = tileX + totalXL * (float(15) / (256 - 30));
    textY = tileY + YL * (float(10) / (64 - 20));

    Canvas.SetPos(tileX, tileY);
    Canvas.Style =  ERenderStyle.STY_Normal;
    Canvas.SetDrawColor(255, 255, 255, oldColor.A);
    if (oldColor.A != 0) // fix: for some reason, alpha of 0 is considered the same as alpha of 255 for images
    {
        // Draw background
//        Canvas.DrawTile(Texture'InterfaceArt_tex.HUD.CriticalMsgBackground',
//            tileXL, tileYL, 0, background_type * 64, 256, 64);

        // Draw icon
        if (lines.length == 1)
            Canvas.SetPos(textX, textY);
        else
            Canvas.SetPos(textX, textY + iconSize / 2);

        iconID = GetIconID(Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject);

        Canvas.DrawTile(default.iconTexture, iconSize, iconSize, (iconID % 4) * 64, (iconID / 4) * 64, 64, 64);
    }

    // Draw all lines of text iteratively
    Canvas.DrawColor = oldColor;
    Canvas.DrawColor.A = float(Canvas.DrawColor.A) * default.TextAlpha;
    for (i = 0; i < lines.length; i++)
    {
        Canvas.SetPos(textX + totalXL - XL, textY);
   	    Canvas.DrawText(lines[i]);
   	    Canvas.TextSize(lines[i], myXL, myYL);
   	    textY += myYL;
   	}

    // To let ROHud how large a gap it should give between messages
    YL_temp = (tileYL + iconSize * 0.2) / Canvas.ClipY;
}

// Calculate how long message should be displayed based on number of characters in string
/*static function float GetLifeTime(int Switch)
{
    local string message;
    message = GetString(switch);
    return Min(Max(Len(message) * default.timePerCharacter, 3), default.LifeTime);
}*/

static function int getIconID(
    optional int Switch,
    optional PlayerReplicationInfo RelatedPRI_1,
    optional PlayerReplicationInfo RelatedPRI_2,
    optional Object OptionalObject)
{
    return default.iconID;
}

defaultproperties
{
     bQuickFade=True
     quickFadeTime=1.000000
     TextAlpha=0.750000
     timePerCharacter=0.300000
     iconID=11
     altIconID=11
     errorIconID=11
     iconTexture=Texture'InterfaceArt_tex.HUD.criticalmessages_icons'
     maxMessageWidth=0.300000
     maxMessagesOnScreen=4
     bComplexString=True
     bIsSpecial=True
     bFadeMessage=True
     DrawColor=(B=0,G=0,R=0)
     DrawPivot=DP_UpperLeft
     StackMode=SM_Down
     PosX=0.020000
     PosY=0.020000
     FontSize=-2
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 13-10-2023 03:17:28.000 - Creation time: Fri 13-10-2023 03:19:06.862 - Created with UnCodeX