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

XGame.xBombingRun


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
//=============================================================================
// xBombingRun.
//=============================================================================
class xBombingRun extends TeamGame
    config;

#exec OBJ LOAD FILE=E_Pickups.usx

var globalconfig bool   bBallDrainsTransloc;

var localized string BRPropText,BRPropText2;
var localized string BRDescText,BRDescText2;

var transient int TeamSpawnCount[2];
var xBombFlag Bomb;

var sound NewRoundSound;  // OBSOLETE
var float OldScore;

var(LoadingHints) private localized array<string> BRHints;


static function array<string> GetAllLoadHints(optional bool bThisClassOnly)
{
    local int i;
    local array<string> Hints;

    if ( !bThisClassOnly || default.BRHints.Length == 0 )
        Hints = Super.GetAllLoadHints();

    for ( i = 0; i < default.BRHints.Length; i++ )
        Hints[Hints.Length] = default.BRHints[i];

    return Hints;
}

function PostBeginPlay()
{
    Super.PostBeginPlay();

    // associate flags with teams
    ForEach DynamicActors(Class'xBombFlag',Bomb)
    {
        BombingRunTeamAI(Teams[0].AI).Bomb = Bomb;
        BombingRunTeamAI(Teams[1].AI).Bomb = Bomb;
        Bomb.bBallDrainsTransloc = bBallDrainsTransloc;
    }
    SetTeamBases();
}

function bool NearGoal(Controller C)
{
    return ( (VSize(C.Pawn.Location - BombingRunTeamAI(Teams[C.PlayerReplicationInfo.Team.TeamIndex].AI).EnemyBase.Location) < 1000) );
}

static function PrecacheGameAnnouncements(AnnouncerVoice V, bool bRewardSounds)
{
    Super.PrecacheGameAnnouncements(V,bRewardSounds);
    if ( !bRewardSounds )
    {
        V.PrecacheSound('NewRoundIn');
        V.PrecacheSound('BallReset');
        V.PrecacheSound('Red_Pass_Fumbled');
        V.PrecacheSound('Blue_Pass_Fumbled');
        V.PrecacheSound('Red_Team_on_Offence');
        V.PrecacheSound('Blue_Team_on_Offence');
        V.PrecacheSound('Last_Second_Save');
    }
}

/* OBSOLETE UpdateAnnouncements() - preload all announcer phrases used by this actor */
simulated function UpdateAnnouncements() {}

static function int OrderToIndex(int Order)
{
    if(Order == 2)
        return 14;

    return Order;
}

//------------------------------------------------------------------------------
// Game Querying.
function GetServerDetails( out ServerResponseLine ServerState )
{
    Super.GetServerDetails( ServerState );
    AddServerDetail( ServerState, "BallDrainsTranslocator", bBallDrainsTransloc );
}

static function PrecacheGameTextures(LevelInfo myLevel)
{
    class'xTeamGame'.static.PrecacheGameTextures(myLevel);

    myLevel.AddPrecacheMaterial(Material'WeaponSkins.BallLauncherTex0');
    myLevel.AddPrecacheMaterial(Material'WeaponSkins.BallLauncherEnergy');
    myLevel.AddPrecacheMaterial(Material'WeaponSkins.BallLauncherLine');

    myLevel.AddPrecacheMaterial(Material'XEffects.RedMarker_T');
    myLevel.AddPrecacheMaterial(Material'XEffects.BlueMarker_T');
    myLevel.AddPrecacheMaterial(Material'XGameShaders.BombIconBlue');
    myLevel.AddPrecacheMaterial(Material'XGameShaders.BombIconRed');
    myLevel.AddPrecacheMaterial(Material'XGameShaders.BombIconYELLOW');
    myLevel.AddPrecacheMaterial(Material'XGameShaders.BRBall');
    myLevel.AddPrecacheMaterial(Material'XGameTextures.BombDeliveryTex');
}

static function PrecacheGameStaticMeshes(LevelInfo myLevel)
{
    class'xDeathMatch'.static.PrecacheGameStaticMeshes(myLevel);

    myLevel.AddPrecacheStaticMesh(StaticMesh'XGame_rc.BombSpawnMesh');
    myLevel.AddPrecacheStaticMesh(StaticMesh'XGame_rc.BombEffectMesh');
    myLevel.AddPrecacheStaticMesh(StaticMesh'E_Pickups.FullBomb');
}

function SetTeamBases() // Important for tracking
{
    local xBombDelivery B;

    // associate flags with teams
    ForEach AllActors(Class'xBombDelivery',B)
    {
        Teams[B.Team].HomeBase = B;
    }
}

function GameObject GetGameObject( Name GameObjectName )
{
    // temp - sanity check
    assert(bomb != None && bomb.IsA(GameObjectName));

    if ( Bomb.IsA(GameObjectName) )
        return Bomb;

    return Super.GetGameObject(GameObjectName);
}

function Logout(Controller Exiting)
{
    if ( xBombFlag(Exiting.PlayerReplicationInfo.HasFlag) != None )
        xBombFlag(Exiting.PlayerReplicationInfo.HasFlag).Drop(vect(0,0,0));
    Super.Logout(Exiting);
}

function DiscardInventory( Pawn Other )
{
    if ( (Other.PlayerReplicationInfo != None) && (Other.PlayerReplicationInfo.HasFlag != None) )
        xBombFlag(Other.PlayerReplicationInfo.HasFlag).Drop(0.5 * Other.Velocity);
    Super.DiscardInventory(Other);
}

function ScoreGameObject( Controller C, GameObject GO )
{
    Super.ScoreGameObject(C,GO);
    if ( GO.IsA('xBombFlag') )
        ScoreBomb(C, xBombFlag(GO));
}

function ScoreBomb(Controller Scorer, xBombFlag theFlag)
{
    local bool ThrowingScore;
    local int i;
    local float ppp,numtouch,maxpoints,maxper;
    local controller C;

    Bomb = theFlag;

    if( ResetCountDown > 0 )
    {
        //log("Ignoring score during reset countdown.",'BombingRun');
        theFlag.SendHome();
        return;
    }

    // blow up all redeemer guided warheads
    for ( C=Level.ControllerList; C!=None; C=C.NextController )
        if ( (C.Pawn != None) && C.Pawn.IsA('RedeemerWarhead') )
            C.Pawn.Fire(0);

    // are we dealing with a throwing score?
    if (Scorer.PlayerReplicationInfo.HasFlag == None)
        ThrowingScore = true;
    if ( (Scorer.Pawn != None) && Scorer.Pawn.Weapon.IsA('BallLauncher') )
        Scorer.ClientSwitchToBestWeapon();

    theFlag.Instigator = none;  // jmw - need this to stop the reentering of ScoreBomb due to touch with the base

    // awards for scoring
    IncrementGoalsScored(Scorer.PlayerReplicationInfo);
    OldScore = Scorer.PlayerReplicationInfo.Team.Score;
    if (ThrowingScore)
    {
        Scorer.PlayerReplicationInfo.Team.Score += 3.0;
        Scorer.PlayerReplicationInfo.Team.NetUpdateTime = Level.TimeSeconds - 1;
        TeamScoreEvent(Scorer.PlayerReplicationInfo.Team.TeamIndex,3,"ball_tossed");

        // Individual points

        Scorer.PlayerReplicationInfo.Score += 2; // Just for scoring
        MaxPoints=10;
        MaxPer=2;
        ScoreEvent(Scorer.PlayerReplicationInfo,5,"ball_thrown_final");
    }
    else
    {
        Scorer.PlayerReplicationInfo.Team.Score += 7.0;
        Scorer.PlayerReplicationInfo.Team.NetUpdateTime = Level.TimeSeconds - 1;
        TeamScoreEvent(Scorer.PlayerReplicationInfo.Team.TeamIndex,7,"ball_carried");

        // Individual points

        Scorer.PlayerReplicationInfo.Score += 5; // Just for scoring
        MaxPoints=20;
        MaxPer=5;
        ScoreEvent(Scorer.PlayerReplicationInfo,5,"ball_cap_final");
    }
    Scorer.PlayerReplicationInfo.NetUpdateTime = Level.TimeSeconds - 1;

    // Each player gets MaxPoints/x but it's guarenteed to be at least 1 point but no more than MaxPer points
    numtouch=0;
    for (i=0;i<TheFlag.Assists.length;i++)
    {
        if ( (TheFlag.Assists[i]!=None) && (TheFlag.Assists[i].PlayerReplicationInfo.Team == Scorer.PlayerReplicationInfo.Team) )
            numtouch = numtouch + 1.0;
    }

    ppp = MaxPoints / numtouch;
    if (ppp<1.0)
        ppp = 1.0;

    if (ppp>MaxPer)
        ppp = MaxPer;

    for (i=0;i<TheFlag.Assists.length;i++)
    {
        if ( (TheFlag.Assists[i]!=None) && (TheFlag.Assists[i].PlayerReplicationInfo.Team == Scorer.PlayerReplicationInfo.Team) )
        {
            ScoreEvent(TheFlag.Assists[i].PlayerReplicationInfo,ppp,"ball_score_assist");
            TheFlag.Assists[i].PlayerReplicationInfo.Score += int(ppp);
        }
    }

    Scorer.AwardAdrenaline(ADR_Goal);
    BroadcastLocalizedMessage( class'xBombMessage', 0, Scorer.PlayerReplicationInfo, None, None );
    AnnounceScore(Scorer.PlayerReplicationInfo.Team.TeamIndex);

    if ( (bOverTime || (GoalScore != 0)) && (Teams[Scorer.PlayerReplicationInfo.Team.TeamIndex].Score >= GoalScore) )
        EndGame(Scorer.PlayerReplicationInfo,"teamscorelimit");
    else if ( bOverTime )
        EndGame(Scorer.PlayerReplicationInfo,"timelimit");

    ResetCountDown = ResetTimeDelay+1;
    if ( bGameEnded )
        theFlag.Score();
    else
        theFlag.SendHomeDisabled(ResetTimeDelay);
}

State MatchInProgress
{
    function Timer()
    {
        local Controller C;
        local Projectile Proj;
        local Inventory Inv;

        Super.Timer();

        if (ResetCountDown > 0)
        {
            ResetCountDown--;
            if ( ResetCountDown < 3 )
            {
                // blow up all redeemer guided warheads
                for ( C=Level.ControllerList; C!=None; C=C.NextController )
                    if ( (C.Pawn != None) && C.Pawn.IsA('RedeemerWarhead') )
                        C.Pawn.Fire(1);
            }
            if ( ResetCountDown == 8 )
            {
                for ( C = Level.ControllerList; C != None; C = C.NextController )
                    if ( PlayerController(C) != None )
                        PlayerController(C).PlayStatusAnnouncement('NewRoundIn',1,true);
            }
            else if ( (ResetCountDown > 1) && (ResetCountDown < 7) )
                BroadcastLocalizedMessage(class'TimerMessage', ResetCountDown-1);
            else if (ResetCountDown == 1)
            {
                // reset all bot enemies
                Teams[0].AI.ClearEnemies();
                Teams[1].AI.ClearEnemies();

                // reset all players position and rotation on the field for the next round
                for ( C = Level.ControllerList; C != None; C = C.NextController )
                    if ( (C.PlayerReplicationInfo != None) && !C.PlayerReplicationInfo.bOnlySpectator )
                    {
                        C.StartSpot = FindPlayerStart(C, C.PlayerReplicationInfo.Team.TeamIndex);
                        if ( C.StartSpot != None )
                        {
                            C.SetLocation(C.StartSpot.Location);
                            C.SetRotation(C.StartSpot.Rotation);
                        }
                        if ( C.Pawn != None )
                        {
                            if ( xPawn(C.Pawn) != None )
                            {
                                if (xPawn(C.Pawn).CurrentCombo != None)
                                {
                                    C.Adrenaline = 0;
                                    xPawn(C.Pawn).CurrentCombo.Destroy();
                                }
                                if ( xPawn(C.Pawn).UDamageTimer != None )
                                {
                                    xPawn(C.Pawn).UDamageTimer.Destroy();
                                    xPawn(C.Pawn).DisableUDamage();
                                }
                            }
                            C.Pawn.Health = Max(C.Pawn.Health,C.Pawn.HealthMax);
                            SetPlayerDefaults(C.Pawn);
                            C.Pawn.SetLocation(C.StartSpot.Location);
                            C.Pawn.SetRotation(C.StartSpot.Rotation);
                            C.Pawn.Velocity = vect(0,0,0);
                            C.Pawn.PlayTeleportEffect(false, true);
                            for ( Inv=C.Pawn.Inventory; Inv!=None; Inv=Inv.Inventory )
                                if ( Inv.IsA('TransLauncher') )
                                    Weapon(Inv).GiveAmmo(0, None, false);
                        }
                        if ( C.StartSpot != None )
                            C.ClientSetLocation(C.StartSpot.Location,C.StartSpot.Rotation);
                    }

               // destroy projectiles
                foreach DynamicActors(class'Projectile', Proj)
                    Proj.Destroy();

                Bomb.SendHome();
                ResetCountDown = 0;
           }
        }
        else
        {
            if ( Bomb == None )
                ForEach DynamicActors(class'xBombFlag',Bomb)
                    break;
            if ( Bomb != None )
                GameReplicationInfo.FlagPos = Bomb.Position().Location;
        }
    }
}

function AnnounceScore(int ScoringTeam)
{
    local Controller C;
    local name ScoreSound;
    local int OtherTeam;

    if ( ScoringTeam == 1 )
        OtherTeam = 0;
    else
        OtherTeam = 1;

    if ( OldScore <= Teams[OtherTeam].Score )
    {
        if ( Teams[ScoringTeam].Score > Teams[OtherTeam].Score )
            ScoreSound = TakeLeadName[ScoringTeam];
        else
            ScoreSound = CaptureSoundName[ScoringTeam];
    }
    else
    {
        if ( OldScore <= Teams[OtherTeam].Score + 3 )
            ScoreSound = IncreaseLeadName[ScoringTeam];
        else
            ScoreSound = CaptureSoundName[ScoringTeam];
    }

    for ( C=Level.ControllerList; C!=None; C=C.NextController )
    {
        if ( C.IsA('PlayerController') )
            PlayerController(C).PlayStatusAnnouncement(ScoreSound,1,true);
    }
}

function actor FindSpecGoalFor(PlayerReplicationInfo PRI, int TeamIndex)
{
    local XPlayer PC;
    local Controller C;
    local xBombFlag b;

    PC = XPlayer(PRI.Owner);
    if (PC==None)
        return none;

    // Look for a Player holding the flag
    for (C=Level.ControllerList;C!=None;C=C.NextController)
    {
        if ( (C.PlayerReplicationInfo != None) && (C.PlayerReplicationInfo.HasFlag!=None) )
            return C.Pawn;
    }

    foreach AllActors(class'xBombFlag',b)
        return b;

    return none;
}

static function FillPlayInfo(PlayInfo PI)
{
    Super.FillPlayInfo(PI);

    PI.AddSetting(default.RulesGroup,  "bBallDrainsTransloc", default.BRPropText2, 40, 0, "Check",,,,True);
}

static event string GetDescriptionText(string PropName)
{
    switch (PropName)
    {
        case "bBallDrainsTransloc": return default.BRDescText2;
    }

    return Super.GetDescriptionText(PropName);
}

function int BallCarrierMessage()
{
    return 15;
}

event SetGrammar()
{
    LoadSRGrammar("BR");
}

defaultproperties
{
     bBallDrainsTransloc=Wahr
     BRPropText="Delay ball contact"
     BRPropText2="BallLauncher drains Translocator"
     BRDescText="If checked, a player must wait a few seconds after throwing the ball before picking it up again."
     BRDescText2="If checked, a player must wait a few seconds after throwing the ball before being able to translocate (or until someone else catches or picks up the ball)."
     BRHints(0)="You can use %BASEPATH 0% to see the path to the Red Team base and %BASEPATH 1% to see the path to the Blue Team base."
     BRHints(1)="Firing the translocator sends out your translocator beacon.  Pressing %FIRE% again returns the beacon, while pressing %A:TFIRE% teleports you instantly to the beacon's location (if you fit)."
     BRHints(2)="While carrying the ball, you can target teammates by pressing %ALTFIRE%.  Pressing %FIRE% will pass the ball to the targeted teammate."
     BRHints(3)="Pressing %SWITCHWEAPON 10% after tossing the Translocator allows you to view from its internal camera."
     BRHints(4)="Pressing %FIRE% while your %ALTFIRE% is still held down after teleporting with the translocator will switch you back to your previous weapon."
     bScoreTeamKills=Falsch
     bSpawnInTeamArea=Wahr
     TeamAIType(0)=Class'UnrealGame.BombingRunTeamAI'
     TeamAIType(1)=Class'UnrealGame.BombingRunTeamAI'
     bAllowTrans=Wahr
     bDefaultTranslocator=Wahr
     bMustHaveMultiplePlayers=Falsch
     DefaultEnemyRosterClass="xGame.xTeamRoster"
     ADR_Kill=2.000000
     HUDType="XInterface.HudCBombingRun"
     MapListType="XInterface.MapListBombingRun"
     MapPrefix="BR"
     BeaconName="BR"
     ResetTimeDelay=11
     GoalScore=15
     DeathMessageClass=Class'XGame.xDeathMessage'
     OtherMesgGroup="BombingRun"
     GameName="Bombing Run"
     Description="Each level has a ball that starts in the middle of the playing field.  Your team scores by getting the ball through the enemy team's hoop.  You score 7 points for jumping through the hoop while holding the ball, and 3 points for tossing the ball through the hoop.  The ball can be passed to teammates, and is dropped if the player carrying it is killed."
     ScreenShotName="UT2004Thumbnails.BRShots"
     DecoTextName="XGame.BombingRun"
     Acronym="BR"
}

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