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

Engine.GameReplicationInfo


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
//=============================================================================
// GameReplicationInfo.
//=============================================================================
class GameReplicationInfo extends ReplicationInfo
    native nativereplication exportstructs;

var string GameName;                        // Assigned by GameInfo.
var string GameClass;                       // Assigned by GameInfo.
var bool bTeamGame;                         // Assigned by GameInfo.
var bool bStopCountDown;
var bool bMatchHasBegun;
var bool bTeamSymbolsUpdated;
var bool bNoTeamSkins;
var bool bForceTeamSkins;
var bool bForceNoPlayerLights;
var bool bAllowPlayerLights;
var bool bFastWeaponSwitching;
var bool bNoTeamChanges;

var int  RemainingTime, ElapsedTime, RemainingMinute;
var float SecondCount;
var int GoalScore;
var int TimeLimit;
var int MaxLives;
var int MinNetPlayers;
var float WeaponBerserk;

var TeamInfo Teams[2];

var() globalconfig string ServerName;       // Name of the server, i.e.: Bob's Server.
var() globalconfig string ShortName;        // Abbreviated name of server, i.e.: B's Serv (stupid example)
var() globalconfig string AdminName;        // Name of the server admin.
var() globalconfig string AdminEmail;       // Email address of the server admin.
var() globalconfig int    ServerRegion;     // Region of the game server.

var() globalconfig string MessageOfTheDay;
var() deprecated string MOTDLine1, MOTDLine2, MOTDLine3, MOTDLine4;

var Actor Winner;           // set by gameinfo when game ends
var VoiceChatReplicationInfo VoiceReplicationInfo;

var() texture TeamSymbols[2];
var() array<PlayerReplicationInfo> PRIArray;

// mc - localized PlayInfo descriptions & extra info
const PROPNUM = 4;
var localized string GRIPropsDisplayText[PROPNUM];
var localized string GRIPropDescText[PROPNUM];

var vector FlagPos; // replicated 2D position of one object
var EFlagState FlagState[2];
var PlayerReplicationInfo FlagHolder[2];    // hack to work around flag holder replication FIXME remove when break net compatibility
var PlayerReplicationInfo FlagTarget;       // used by Bombing Run (targeted player)

// stats
var int MatchID;

var int BotDifficulty;      // for bPlayersVsBots

replication
{
    reliable if ( bNetDirty && (Role == ROLE_Authority) )
        bStopCountDown, Winner, Teams, FlagPos, FlagState, bMatchHasBegun, MatchID, FlagTarget;

    reliable if ( !bNetInitial && bNetDirty && (Role == ROLE_Authority) )
        RemainingMinute;

    reliable if ( bNetInitial && (Role==ROLE_Authority) )
        GameName, GameClass, bTeamGame, bNoTeamSkins, bForceTeamSkins, bForceNoPlayerLights, WeaponBerserk, bAllowPlayerLights, bFastWeaponSwitching,
        RemainingTime, ElapsedTime, MessageOfTheDay, ServerName, ShortName, AdminName,
        AdminEmail, ServerRegion, GoalScore, MaxLives, TimeLimit, TeamSymbols,
        VoiceReplicationInfo, MinNetPlayers, bNoTeamChanges,BotDifficulty;
}


simulated function PostNetBeginPlay()
{
    local PlayerReplicationInfo PRI;


    Level.GRI = self;

    if ( VoiceReplicationInfo == None )
        foreach DynamicActors(class'VoiceChatReplicationInfo', VoiceReplicationInfo)
            break;

    ForEach DynamicActors(class'PlayerReplicationInfo',PRI)
        AddPRI(PRI);

    if ( Level.NetMode == NM_Client )
        TeamSymbolNotify();
}

simulated function TeamSymbolNotify()
{
    local Actor A;
    if ( TeamSymbols[0] == None )
        return;
    bTeamSymbolsUpdated = true;
    ForEach AllActors(class'Actor', A)
        A.SetGRI(self);
}

simulated function UpdatePrecacheMaterials()
{
    Level.AddPrecacheMaterial(TeamSymbols[0]);
    Level.AddPrecacheMaterial(TeamSymbols[1]);
}

simulated function PostBeginPlay()
{
    super.PostBeginPlay();
    MessageOfTheDay = repl(MessageOfTheDay, chr(160),' ');

    if( Level.NetMode == NM_Client )
    {
        // clear variables so we don't display our own values if the server has them left blank
        ServerName = "";
        AdminName = "";
        AdminEmail = "";
        MessageOfTheDay = "";
    }

    SecondCount = Level.TimeSeconds;
    SetTimer(Level.TimeDilation, true);
}

/* Reset()
reset actor to initial state - used when restarting level without reloading.
*/
function Reset()
{
    Super.Reset();
    Winner = None;
}

simulated function Timer()
{
    local int i;
    local PlayerReplicationInfo OldHolder[2];
    local Controller C;

    if ( Level.NetMode == NM_Client )
    {
        ElapsedTime++;
        if ( RemainingMinute != 0 )
        {
            RemainingTime = RemainingMinute;
            RemainingMinute = 0;
        }
        if ( (RemainingTime > 0) && !bStopCountDown )
            RemainingTime--;
        if ( !bTeamSymbolsUpdated )
            TeamSymbolNotify();
        SetTimer(Level.TimeDilation, true);
    }
    else if ( Level.NetMode != NM_Standalone )
    {
        OldHolder[0] = FlagHolder[0];
        OldHolder[1] = FlagHolder[1];
        FlagHolder[0] = None;
        FlagHolder[1] = None;
        for ( i=0; i<PRIArray.length; i++ )
            if ( (PRIArray[i].HasFlag != None) && (PRIArray[i].Team != None) )
                FlagHolder[PRIArray[i].Team.TeamIndex] = PRIArray[i];

        for ( i=0; i<2; i++ )
            if ( OldHolder[i] != FlagHolder[i] )
            {
                for ( C=Level.ControllerList; C!=None; C=C.NextController )
                    if ( PlayerController(C) != None )
                        PlayerController(C).ClientUpdateFlagHolder(FlagHolder[i],i);
            }
    }
}

simulated function PlayerReplicationInfo FindPlayerByID( int PlayerID )
{
    local int i;

    for( i=0; i<PRIArray.Length; i++ )
    {
        if( PRIArray[i].PlayerID == PlayerID )
            return PRIArray[i];
    }
    return None;
}


simulated function AddPRI(PlayerReplicationInfo PRI)
{
    local byte NewVoiceID;
    local int i;

    if ( Level.NetMode == NM_ListenServer || Level.NetMode == NM_DedicatedServer )
    {
        for (i = 0; i < PRIArray.Length; i++)
        {
            if ( PRIArray[i].VoiceID == NewVoiceID )
            {
                i = -1;
                NewVoiceID++;
                continue;
            }
        }

        if ( NewVoiceID >= 32 )
            NewVoiceID = 0;

        PRI.VoiceID = NewVoiceID;
    }

    PRIArray[PRIArray.Length] = PRI;
}

simulated function RemovePRI(PlayerReplicationInfo PRI)
{
    local int i;

    for (i=0; i<PRIArray.Length; i++)
    {
        if (PRIArray[i] == PRI)
        {
            PRIArray.Remove(i,1);
            return;
        }
    }

    log("GameReplicationInfo::RemovePRI() pri="$PRI$" not found.", 'Error');
}

simulated function GetPRIArray(out array<PlayerReplicationInfo> pris)
{
    local int i;
    local int num;

    pris.Remove(0, pris.Length);
    for (i=0; i<PRIArray.Length; i++)
    {
        if (PRIArray[i] != None)
            pris[num++] = PRIArray[i];
    }
}

static function FillPlayInfo(PlayInfo PlayInfo)
{
    local int i;

    Super.FillPlayInfo(PlayInfo);  // Always begin with calling parent

    PlayInfo.AddSetting(default.ServerGroup,  "ServerName",       default.GRIPropsDisplayText[i++], 255, 1, "Text",                     "60",,True);
    PlayInfo.AddSetting(default.ServerGroup,  "AdminName",        default.GRIPropsDisplayText[i++], 255, 1, "Text",                     "40",,True,True);
    PlayInfo.AddSetting(default.ServerGroup,  "AdminEmail",       default.GRIPropsDisplayText[i++], 255, 1, "Text",                     "60",,True,True);
    PlayInfo.AddSetting(default.ServerGroup,  "MessageOfTheDay",  default.GRIPropsDisplayText[i++], 251, 1, "Custom","255;;GUI2K4.MOTDConfigPage",,True,True);
}

static event string GetDescriptionText(string PropName)
{
    switch (PropName)
    {
        case "ServerName":      return default.GRIPropDescText[0];
        case "AdminName":       return default.GRIPropDescText[1];
        case "AdminEmail":      return default.GRIPropDescText[2];
        case "MessageOfTheDay": return default.GRIPropDescText[3];
    }

    return Super.GetDescriptionText(PropName);
}

defaultproperties
{
     bStopCountDown=Wahr
     WeaponBerserk=1.000000
     ServerName="UT2004 Server"
     ShortName="UT2 Server"
     GRIPropsDisplayText(0)="Server Name"
     GRIPropsDisplayText(1)="Admin Name"
     GRIPropsDisplayText(2)="Admin E-Mail"
     GRIPropsDisplayText(3)="MOTD"
     GRIPropDescText(0)="Server name shown on server browser."
     GRIPropDescText(1)="Server administrator's name"
     GRIPropDescText(2)="Server administrator's email address."
     GRIPropDescText(3)="Message of the Day"
     BotDifficulty=-1
}

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