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

Botpack.TournamentPlayer


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
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
//=============================================================================
// TournamentPlayer.
//=============================================================================
class TournamentPlayer extends PlayerPawn
    config(User)
    abstract;

#exec AUDIO IMPORT FILE="Sounds\chatsound\chat8a.WAV" NAME="NewBeep" GROUP="ChatSound"
#exec AUDIO IMPORT FILE="Sounds\chatsound\spree-sound.WAV" NAME="SpreeSound" GROUP="ChatSound"

#exec TEXTURE IMPORT NAME=Man FILE=TEXTURES\HUD\IMale2.PCX GROUP="Icons" MIPS=OFF
#exec TEXTURE IMPORT NAME=ManBelt FILE=TEXTURES\HUD\IMaleSBelt.PCX GROUP="Icons" MIPS=OFF

var(Messages)   localized string spreenote[10];
var(Sounds)     Sound Deaths[6];
var int         FaceSkin;
var int         FixedSkin;
var int         TeamSkin1;
var int         TeamSkin2;
var int         MultiLevel;
var string      DefaultSkinName;
var string      DefaultPackage;
var float       LastKillTime;

var(Sounds) sound   drown;
var(Sounds) sound   breathagain;
var(Sounds) sound   Footstep1;
var(Sounds) sound   Footstep2;
var(Sounds) sound   Footstep3;
var(Sounds) sound   HitSound3;
var(Sounds) sound   HitSound4;
var(Sounds) sound   Die2;
var(Sounds) sound   Die3;
var(Sounds) sound   Die4;
var(Sounds) sound   GaspSound;
var(Sounds) sound   UWHit1;
var(Sounds) sound   UWHit2;
var(Sounds) sound   LandGrunt;

var bool bLastJumpAlt;
var  globalconfig bool bInstantRocket;
var  globalconfig bool bAutoTaunt; // player automatically generates taunts when fragging someone
var  globalconfig bool bNoAutoTaunts; // don't receive auto-taunts
var  globalconfig bool bNoVoiceTaunts; // don't receive any taunts
var  globalconfig bool bNoMatureLanguage;
var  globalconfig bool bNoVoiceMessages; // don't receive any voice messages
var bool bNeedActivate;
var bool b3DSound;

var int WeaponUpdate;

// HUD status 
var texture StatusDoll, StatusBelt;

// allowed voices
var string VoicePackMetaClass;

var NavigationPoint StartSpot; //where player started the match

var Weapon ClientPending;
var Weapon OldClientWeapon;

var globalconfig int AnnouncerVolume;
var class<CriticalEventPlus> TimeMessageClass;

var class<Actor> BossRef;

replication
{
    // Things the server should send to the client.
    unreliable if( Role==ROLE_Authority )
        ClientPlayTakeHit, TimeMessage;
    reliable if ( Role == ROLE_Authority )
        SendClientFire, SendClientAltFire, RealWeapon, PlayWinMessage; 

    // client to server
    reliable if ( Role < ROLE_Authority )
        Advance, AdvanceAll, ServerSetTaunt, ServerSetInstantRocket, ServerSetVoice, IAmTheOne;
}

exec function AddBotNamed(string BotName)
{
    if ( Level.NetMode == NM_Client )
    {
        ClientMessage("Can't added named bots from client.");
        return;
    }

    if ( DeathMatchPlus(Level.Game) != None )   
        DeathMatchPlus(Level.Game).BotConfig.DesiredName = BotName;
    Level.Game.ForceAddBot();
}

function PlayWinMessage(bool bWinner)
{
    local sound Announcement;

    if ( bWinner )
        Announcement = Sound(DynamicLoadObject("Announcer.Winner", class'Sound'));
    else
        Announcement = Sound(DynamicLoadObject("Announcer.LostMatch", class'Sound'));

    ClientPlaySound(Announcement, true, true);
}

//Player Jumped
function DoJump( optional float F )
{
    if ( CarriedDecoration != None )
        return;
    if ( !bIsCrouching && (Physics == PHYS_Walking) )
    {
        if ( !bUpdating )
            PlayOwnedSound(JumpSound, SLOT_Talk, 1.5, true, 1200, 1.0 );
        if ( (Level.Game != None) && (Level.Game.Difficulty > 0) )
            MakeNoise(0.1 * Level.Game.Difficulty);
        PlayInAir();
        if ( bCountJumps && (Role == ROLE_Authority) && (Inventory != None) )
            Inventory.OwnerJumped();
        if ( bIsWalking )
            Velocity.Z = Default.JumpZ;
        else
            Velocity.Z = JumpZ;
        if ( (Base != Level) && (Base != None) )
            Velocity.Z += Base.Velocity.Z; 
        SetPhysics(PHYS_Falling);
    }
}
//Play a sound client side (so only client will hear it
simulated function ClientPlaySound(sound ASound, optional bool bInterrupt, optional bool bVolumeControl )
{   
    local actor SoundPlayer;
    local int Volume;

    if ( b3DSound )
    {
        if ( bVolumeControl && (AnnouncerVolume == 0) )
            Volume = 0;
        else
            Volume = 1;
    }
    else if ( bVolumeControl )
        Volume = AnnouncerVolume;
    else
        Volume = 4;

    LastPlaySound = Level.TimeSeconds;  // so voice messages won't overlap
    if ( ViewTarget != None )
        SoundPlayer = ViewTarget;
    else
        SoundPlayer = self;

    if ( Volume == 0 )
        return;
    SoundPlayer.PlaySound(ASound, SLOT_None, 16.0, bInterrupt);
    if ( Volume == 1 )
        return;
    SoundPlayer.PlaySound(ASound, SLOT_Interface, 16.0, bInterrupt);
    if ( Volume == 2 )
        return;
    SoundPlayer.PlaySound(ASound, SLOT_Misc, 16.0, bInterrupt);
    if ( Volume == 3 )
        return;
    SoundPlayer.PlaySound(ASound, SLOT_Talk, 16.0, bInterrupt);
}

//==============
// Encroachment
event bool EncroachingOn( actor Other )
{
    if ( GameReplicationInfo.bTeamGame && Other.bIsPawn 
        && (Pawn(Other).PlayerReplicationInfo != None)
        && (Pawn(Other).PlayerReplicationInfo.Team == PlayerReplicationInfo.Team) )
    {
        if ( (Role == ROLE_Authority) && Level.Game.IsA('DeathMatchPlus')
            && DeathMatchPlus(Level.Game).bStartMatch )
            return Super.EncroachingOn(Other);
        else
            return true;
    }
    return Super.EncroachingOn(Other);
}

simulated function PostBeginPlay()
{
    Super.PostBeginPlay();
    if ( Level.NetMode != NM_DedicatedServer )
        Shadow = Spawn(class'PlayerShadow',self);
    if ( (Role == ROLE_Authority) && (Level.NetMode != NM_Standalone) )
        BossRef = class<Actor>(DynamicLoadObject("Botpack.TBoss",class'Class'));

    b3DSound = bool(ConsoleCommand("get ini:Engine.Engine.AudioDevice Use3dHardware"));
}

function ClientReplicateSkins(texture Skin1, optional texture Skin2, optional texture Skin3, optional texture Skin4)
{
    local class<Actor> C;

    // do nothing (just loading other player skins onto client)
    log("Getting "$Skin1$", "$Skin2$", "$Skin3$", "$Skin4);
    if ( Role != ROLE_Authority )
        BossRef = class<Actor>(DynamicLoadObject("Botpack.TBoss",class'Class'));
}

function PreCacheReferences()
{
    //never called - here to force precaching of meshes
    spawn(class'TMale1');
    spawn(class'TMale2');
    spawn(class'TFemale1');
    spawn(class'TFemale2');
    spawn(class'ImpactHammer');
    spawn(class'Translocator');
    spawn(class'Enforcer');
    spawn(class'UT_Biorifle');
    spawn(class'ShockRifle');
    spawn(class'PulseGun');
    spawn(class'Ripper');
    spawn(class'Minigun2');
    spawn(class'UT_FlakCannon');
    spawn(class'UT_Eightball');
    spawn(class'SniperRifle');
}

function SendClientFire(weapon W, int N)
{
    RealWeapon(W,N);
    if ( Weapon.IsA('TournamentWeapon') )
    {
        TournamentWeapon(Weapon).bCanClientFire = true;
        TournamentWeapon(Weapon).ForceClientFire();
    }
}

function SendClientAltFire(weapon W, int N)
{
    RealWeapon(W,N);
    if ( Weapon.IsA('TournamentWeapon') )
    {
        TournamentWeapon(Weapon).bCanClientFire = true;
        TournamentWeapon(Weapon).ForceClientAltFire();
    }
}

exec function KillAll(class<actor> aClass)
{
    if ( bAdmin && (Level.NetMode != NM_Standalone) && Level.Game.IsA('DeathMatchPlus')
        && ((aClass == class'Bot') || (aClass == class'Pawn')) )
        DeathMatchPlus(Level.Game).MinPlayers = 0;

    Super.KillAll(aClass);
}

function ClientPutDown(Weapon Current, Weapon Next)
{   
    if ( Role == ROLE_Authority )
        return;
    bNeedActivate = false;
    if ( (Current != None) && (Current != Next) )
        Current.ClientPutDown(Next);
    else if ( Weapon != None )
    {
        if ( Weapon != Next )
            Weapon.ClientPutDown(Next);
        else
        {
            bNeedActivate = false;
            ClientPending = None;
            if ( Weapon.IsInState('ClientDown') || !Weapon.IsAnimating() )
            {
                Weapon.GotoState('');
                Weapon.TweenToStill();
            }
        }
    }
}

function SendFire(Weapon W)
{
    WeaponUpdate++;
    SendClientFire(W,WeaponUpdate);
}

function SendAltFire(Weapon W)
{
    WeaponUpdate++;
    SendClientAltFire(W,WeaponUpdate);
}

function UpdateRealWeapon(Weapon W)
{
    WeaponUpdate++;
    RealWeapon(W,WeaponUpdate);
}
    
function RealWeapon(weapon Real, int N)
{
    if ( N <= WeaponUpdate )
        return;
    WeaponUpdate = N;
    Weapon = Real;
    if ( (Weapon != None) && !Weapon.IsAnimating() )
    {
        if ( bNeedActivate || (Weapon == ClientPending) )
            Weapon.GotoState('ClientActive');
        else
            Weapon.TweenToStill();
    }
    bNeedActivate = false;
    ClientPending = None;   // make sure no client side weapon changes pending
}

function ReplicateMove
(
    float DeltaTime, 
    vector NewAccel, 
    eDodgeDir DodgeMove, 
    rotator DeltaRot
)
{
    Super.ReplicateMove(DeltaTime,NewAccel,DodgeMove,DeltaRot);
    if ( (Weapon != None) && !Weapon.IsAnimating() )
    {
        if ( (Weapon == ClientPending) || (Weapon != OldClientWeapon) )
        {
            if ( Weapon.IsInState('ClientActive') )
                AnimEnd();
            else
                Weapon.GotoState('ClientActive');
            if ( (Weapon != ClientPending) && (myHUD != None) && myHUD.IsA('ChallengeHUD') )
                ChallengeHUD(myHUD).WeaponNameFade = 1.3;
            if ( (Weapon != OldClientWeapon) && (OldClientWeapon != None) )
                OldClientWeapon.GotoState('');

            ClientPending = None;
            bNeedActivate = false;
        }
        else
        {
            Weapon.GotoState('');
            Weapon.TweenToStill();
        }
    }
    OldClientWeapon = Weapon;
}
    
function TimeMessage(int Num)
{
    if ( TimeMessageClass == None )
        TimeMessageClass = class<CriticalEventPlus>(DynamicLoadObject("Botpack.TimeMessage", class'Class'));
    ReceiveLocalizedMessage( TimeMessageClass, 16 - Num );
}

function SetVoice(class<ChallengeVoicePack> V)
{
    PlayerReplicationInfo.VoiceType = V;
    UpdateURL("Voice", string(V), True);
    ServerSetVoice(V);
}

function ServerSetVoice(class<ChallengeVoicePack> V)
{
    PlayerReplicationInfo.VoiceType = V;
}

exec function ListBots()
{
    local Pawn P;

    for (P=Level.PawnList; P!=None; P=P.NextPawn)
        if ( P.bIsPlayer && P.IsA('Bot') ) 
            log(P.PlayerReplicationInfo.PlayerName$" skill "$P.Skill$" novice "$Bot(P).bNovice);
}

function PreSetMovement()
{
    bCanJump = true;
    bCanWalk = true;
    bCanSwim = true;
    bCanFly = false;
    bCanOpenDoors = true;
    bCanDoSpecial = true;
}

function ServerSetTaunt(bool B)
{
    bAutoTaunt = B;
}

function SetAutoTaunt(bool B)
{
    bAutoTaunt = B;
    ServerSetTaunt(B);
}

function ServerSetInstantRocket(bool B)
{
    bInstantRocket = B;
}

exec function SetInstantRocket(bool B)
{
    bInstantRocket = B;
    ServerSetInstantRocket(B);
}

function ChangeSetHand( string S )
{
    Super.ChangeSetHand(S);
    if ( Handedness == 1 )
        LoadLeftHand();
}

function LoadLeftHand()
{
    local mesh M;

    // load left handed weapon meshes
    M = mesh(DynamicLoadObject("Botpack.PulseGunL", class'Mesh'));
    M = mesh(DynamicLoadObject("Botpack.Rifle2mL", class'Mesh'));
    M = mesh(DynamicLoadObject("Botpack.EightML", class'Mesh'));
    M = mesh(DynamicLoadObject("Botpack.Minigun2L", class'Mesh'));
}

event Possess()
{
    local byte i;

    if ( Handedness == 1 )
        LoadLeftHand();

    if ( Level.Netmode == NM_Client )
    {
        ServerSetTaunt(bAutoTaunt);
        ServerSetInstantRocket(bInstantRocket);
    }

    Super.Possess();
}

function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
{
    if ( bNoVoiceMessages )
        return;
    if ( bNoVoiceTaunts && ((messageType == 'TAUNT') || (messageType == 'AUTOTAUNT')) )
        return;
    if ( bNoAutoTaunts && (messageType == 'AUTOTAUNT') )
        return;

    Super.ClientVoiceMessage(Sender, Recipient, messagetype, messageID);
}

function SendGlobalMessage(PlayerReplicationInfo Recipient, name MessageType, byte MessageID, float Wait)
{
    if ( Level.TimeSeconds - OldMessageTime < 5 )
        return;

    SendVoiceMessage(PlayerReplicationInfo, Recipient, MessageType, MessageID, 'GLOBAL');
}


function SendTeamMessage(PlayerReplicationInfo Recipient, name MessageType, byte MessageID, float Wait)
{
    if ( Level.TimeSeconds - OldMessageTime < 10 )
        return;

    SendVoiceMessage(PlayerReplicationInfo, Recipient, MessageType, MessageID, 'TEAM');
}

function Killed(pawn Killer, pawn Other, name damageType)
{
    Super.Killed(Killer, Other, damageType);

    if ( (Killer == self) 
        && (((bFire == 0) && (bAltFire == 0))
            || ((Weapon != None) && !Weapon.IsA('Minigun2') && !Weapon.IsA('PulseGun'))) )
        Other.Health = FMin(Other.Health, -11); // don't let other do stagger death
}

exec function Loaded()
{
    local inventory Inv;
    local weapon Weap;
    local DeathMatchPlus DM;

    if( !bCheatsEnabled )
        return;
    if( Level.Netmode!=NM_Standalone )
        return;

    DM = DeathMatchPlus(Level.Game);
    if ( DM == None )
        return;

    DM.GiveWeapon(self, "Botpack.PulseGun");
    DM.GiveWeapon(self, "Botpack.ShockRifle");
    DM.GiveWeapon(self, "Botpack.UT_FlakCannon");
    DM.GiveWeapon(self, "Botpack.UT_BioRifle");
    DM.GiveWeapon(self, "Botpack.Minigun2");
    DM.GiveWeapon(self, "Botpack.SniperRifle");
    DM.GiveWeapon(self, "Botpack.Ripper");
    DM.GiveWeapon(self, "Botpack.UT_Eightball");
    
    for ( inv=inventory; inv!=None; inv=inv.inventory )
    {
        weap = Weapon(inv);
        if ( (weap != None) && (weap.AmmoType != None) )
            weap.AmmoType.AmmoAmount = weap.AmmoType.MaxAmmo;
    }

    inv = Spawn(class'Armor2');
    if( inv != None )
    {
        inv.bHeldItem = true;
        inv.RespawnTime = 0.0;
        inv.GiveTo(self);
    }
    inv = Spawn(class'Thighpads');
    if( inv != None )
    {
        inv.bHeldItem = true;
        inv.RespawnTime = 0.0;
        inv.GiveTo(self);
    }
}

function PlayDodge(eDodgeDir DodgeMove)
{
    Velocity.Z = 210;
    if ( DodgeMove == DODGE_Left )
        TweenAnim('DodgeL', 0.25);
    else if ( DodgeMove == DODGE_Right )
        TweenAnim('DodgeR', 0.25);
    else if ( DodgeMove == DODGE_Back )
        TweenAnim('DodgeB', 0.25);
    else 
        PlayAnim('Flip', 1.35 * FMax(0.35, Region.Zone.ZoneGravity.Z/Region.Zone.Default.ZoneGravity.Z), 0.06);
}

function PlayDyingSound()
{
    local int rnd;

    if ( HeadRegion.Zone.bWaterZone )
    {
        if ( FRand() < 0.5 )
            PlaySound(UWHit1, SLOT_Pain,16,,,Frand()*0.2+0.9);
        else
            PlaySound(UWHit2, SLOT_Pain,16,,,Frand()*0.2+0.9);
        return;
    }

    rnd = Rand(6);
    PlaySound(Deaths[rnd], SLOT_Talk, 16);
    PlaySound(Deaths[rnd], SLOT_Pain, 16);
}

simulated function PlayBeepSound()
{
    PlaySound(sound'NewBeep',SLOT_Interface, 2.0);
}

function PlayChatting()
{
    if ( mesh != None )
        LoopAnim('Chat1', 0.7, 0.25);
}

function PlayWaiting()
{
    local name newAnim;

    if ( Mesh == None )
        return;

    if ( bIsTyping )
    {
        PlayChatting();
        return;
    }

    if ( (IsInState('PlayerSwimming')) || (Physics == PHYS_Swimming) )
    {
        BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
        if ( (Weapon == None) || (Weapon.Mass < 20) )
            LoopAnim('TreadSM');
        else
            LoopAnim('TreadLG');
    }
    else
    {   
        BaseEyeHeight = Default.BaseEyeHeight;
        ViewRotation.Pitch = ViewRotation.Pitch & 65535;
        If ( (ViewRotation.Pitch > RotationRate.Pitch) 
            && (ViewRotation.Pitch < 65536 - RotationRate.Pitch) )
        {
            If (ViewRotation.Pitch < 32768) 
            {
                if ( (Weapon == None) || (Weapon.Mass < 20) )
                    TweenAnim('AimUpSm', 0.3);
                else
                    TweenAnim('AimUpLg', 0.3);
            }
            else
            {
                if ( (Weapon == None) || (Weapon.Mass < 20) )
                    TweenAnim('AimDnSm', 0.3);
                else
                    TweenAnim('AimDnLg', 0.3);
            }
        }
        else if ( (Weapon != None) && Weapon.bPointing )
        {
            if ( Weapon.bRapidFire && ((bFire != 0) || (bAltFire != 0)) )
                LoopAnim('StillFRRP');
            else if ( Weapon.Mass < 20 )
                TweenAnim('StillSMFR', 0.3);
            else
                TweenAnim('StillFRRP', 0.3);
        }
        else
        {
            if ( FRand() < 0.1 )
            {
                if ( (Weapon == None) || (Weapon.Mass < 20) )
                    PlayAnim('CockGun', 0.5 + 0.5 * FRand(), 0.3);
                else
                    PlayAnim('CockGunL', 0.5 + 0.5 * FRand(), 0.3);
            }
            else
            {
                if ( (Weapon == None) || (Weapon.Mass < 20) )
                {
                    if ( (FRand() < 0.75) && ((AnimSequence == 'Breath1') || (AnimSequence == 'Breath2')) )
                        newAnim = AnimSequence;
                    else if ( FRand() < 0.5 )
                        newAnim = 'Breath1';
                    else
                        newAnim = 'Breath2';
                }
                else
                {
                    if ( (FRand() < 0.75) && ((AnimSequence == 'Breath1L') || (AnimSequence == 'Breath2L')) )
                        newAnim = AnimSequence;
                    else if ( FRand() < 0.5 )
                        newAnim = 'Breath1L';
                    else
                        newAnim = 'Breath2L';
                }
                                
                if ( AnimSequence == newAnim )
                    LoopAnim(newAnim, 0.4 + 0.4 * FRand());
                else
                    PlayAnim(newAnim, 0.4 + 0.4 * FRand(), 0.25);
            }
        }
    }
}

function EndSpree(PlayerReplicationInfo Killer, PlayerReplicationInfo Other)
{
    if ( (Killer == Other) || (Killer == None) )
        ReceiveLocalizedMessage( class'KillingSpreeMessage', 1, None, Other );
    else
        ReceiveLocalizedMessage( class'KillingSpreeMessage', 0, Other, Killer );
}

exec function IAmTheOne()
{
    // What are you doing looking at this?!  CHEATER!!!
    bCheatsEnabled = True;
}

exec function SetAirControl(float F)
{
    if ( bAdmin || (Level.Netmode == NM_Standalone) )
        AirControl = F;
}

exec function Verbose()
{
    if ( Bot(ViewTarget) != None )
        Bot(ViewTarget).bVerbose = true;
}

// Skip any map.
exec function Advance()
{
    if( !bCheatsEnabled )
        return;
    if ( !bAdmin && (Level.Netmode != NM_Standalone) )
        return;

    if (Level.Game.IsA('DeathMatchPlus'))
        DeathMatchPlus(Level.Game).Skip();
}

// Skip all maps.
exec function AdvanceAll()
{
    if( !bCheatsEnabled )
        return;
    if ( !bAdmin && (Level.Netmode != NM_Standalone) )
        return;

    if (Level.Game.IsA('DeathMatchPlus'))
        DeathMatchPlus(Level.Game).SkipAll();
}

/* Skin Stuff */
static function GetMultiSkin( Actor SkinActor, out string SkinName, out string FaceName )
{
    local string ShortSkinName, FullSkinName, ShortFaceName, FullFaceName;

    FullSkinName  = String(SkinActor.Multiskins[default.FixedSkin]);
    ShortSkinName = SkinActor.GetItemName(FullSkinName);

    FullFaceName = String(SkinActor.Multiskins[default.FaceSkin]);
    ShortFaceName = SkinActor.GetItemName(FullFaceName);

    SkinName = Left(FullSkinName, Len(FullSkinName) - Len(ShortSkinName)) $ Left(ShortSkinName, 4);
    FaceName = Left(FullFaceName, Len(FullFaceName) - Len(ShortFaceName)) $Mid(ShortFaceName, 5);
}

static function SetMultiSkin(Actor SkinActor, string SkinName, string FaceName, byte TeamNum)
{
    local string MeshName, FacePackage, SkinItem, FaceItem, SkinPackage;

    MeshName = SkinActor.GetItemName(string(SkinActor.Mesh));

    SkinItem = SkinActor.GetItemName(SkinName);
    FaceItem = SkinActor.GetItemName(FaceName);
    FacePackage = Left(FaceName, Len(FaceName) - Len(FaceItem));
    SkinPackage = Left(SkinName, Len(SkinName) - Len(SkinItem));

    if(SkinPackage == "")
    {
        SkinPackage=default.DefaultPackage;
        SkinName=SkinPackage$SkinName;
    }
    if(FacePackage == "")
    {
        FacePackage=default.DefaultPackage;
        FaceName=FacePackage$FaceName;
    }

    // Set the fixed skin element.  If it fails, go to default skin & no face.
    if(!SetSkinElement(SkinActor, default.FixedSkin, SkinName$string(default.FixedSkin+1), default.DefaultSkinName$string(default.FixedSkin+1)))
    {
        SkinName = default.DefaultSkinName;
        FaceName = "";
    }

    // Set the face - if it fails, set the default skin for that face element.
    SetSkinElement(SkinActor, default.FaceSkin, FacePackage$SkinItem$String(default.FaceSkin+1)$FaceItem, SkinName$String(default.FaceSkin+1));

    // Set the team elements
    if( TeamNum != 255 )
    {
        SetSkinElement(SkinActor, default.TeamSkin1, SkinName$string(default.TeamSkin1+1)$"T_"$String(TeamNum), SkinName$string(default.TeamSkin1+1));
        SetSkinElement(SkinActor, default.TeamSkin2, SkinName$string(default.TeamSkin2+1)$"T_"$String(TeamNum), SkinName$string(default.TeamSkin2+1));
    }
    else
    {
        SetSkinElement(SkinActor, default.TeamSkin1, SkinName$string(default.TeamSkin1+1), "");
        SetSkinElement(SkinActor, default.TeamSkin2, SkinName$string(default.TeamSkin2+1), "");
    }

    // Set the talktexture
    if(Pawn(SkinActor) != None)
    {
        if(FaceName != "")
            Pawn(SkinActor).PlayerReplicationInfo.TalkTexture = Texture(DynamicLoadObject(FacePackage$SkinItem$"5"$FaceItem, class'Texture'));
        else
            Pawn(SkinActor).PlayerReplicationInfo.TalkTexture = None;
    }       
}

exec function Summon( string ClassName )
{
    local class<actor> NewClass;
    if( !bCheatsEnabled )
        return;
    if( !bAdmin && (Level.Netmode != NM_Standalone) )
        return;
    if( instr(ClassName,".")==-1 )
        ClassName = "Botpack." $ ClassName;
    Super.Summon( ClassName );
}

function CheckBob(float DeltaTime, float Speed2D, vector Y)
{
    local float OldBobTime;
    local int m,n;

    OldBobTime = BobTime;
    if ( Speed2D < 10 )
        BobTime += 0.2 * DeltaTime;
    else
        BobTime += DeltaTime * (0.3 + 0.7 * Speed2D/GroundSpeed);
    WalkBob = Y * 0.4 * Bob * Speed2D * sin(8 * BobTime);
    AppliedBob = AppliedBob * (1 - FMin(1, 16 * deltatime));
    if ( Speed2D < 10 )
        WalkBob.Z = AppliedBob;
    else
        WalkBob.Z = AppliedBob + 0.3 * Bob * Speed2D * sin(16 * BobTime);
    if ( LandBob > 0.01 )
    {
        AppliedBob += FMin(1, 16 * deltatime) * LandBob;
        LandBob *= (1 - 8*Deltatime);
    }

    if ( bBehindView || (Speed2D < 10) )
        return;

    m = int(0.5 * Pi + 9.0 * OldBobTime/Pi);
    n = int(0.5 * Pi + 9.0 * BobTime/Pi);

    if ( (m != n) && !bIsWalking )
        FootStepping();
}

simulated function PlayFootStep()
{
    if ( (Level.NetMode != NM_Client) 
        && ((Weapon == None) || !Weapon.bPointing) )
        MakeNoise(0.1);

    if ( bBehindView || (Role==ROLE_SimulatedProxy) )   
        FootStepping();
}

simulated function FootStepping()
{
    local sound step;
    local float decision;

    if ( FootRegion.Zone.bWaterZone )
    {
        PlaySound(WaterStep, SLOT_Interact, 1, false, 1000.0, 1.0);
        return;
    }

    decision = FRand();
    if ( decision < 0.34 )
        step = Footstep1;
    else if (decision < 0.67 )
        step = Footstep2;
    else
        step = Footstep3;

    PlaySound(step, SLOT_Interact, 2.2, false, 1000.0, 1.0);
}

function PlayHit(float Damage, vector HitLocation, name damageType, vector Momentum)
{
    local float rnd;
    local Bubble1 bub;
    local bool bServerGuessWeapon;
    local class<DamageType> DamageClass;
    local vector BloodOffset, Mo;
    local int iDam;

    if ( (Damage <= 0) && (ReducedDamageType != 'All') )
        return;

    //DamageClass = class(damageType);
    if ( ReducedDamageType != 'All' ) //spawn some blood
    {
        if (damageType == 'Drowned')
        {
            bub = spawn(class 'Bubble1',,, Location 
                + 0.7 * CollisionRadius * vector(ViewRotation) + 0.3 * EyeHeight * vect(0,0,1));
            if (bub != None)
                bub.DrawScale = FRand()*0.06+0.04; 
        }
        else if ( (damageType != 'Burned') && (damageType != 'Corroded') 
                    && (damageType != 'Fell') )
        {
            BloodOffset = 0.2 * CollisionRadius * Normal(HitLocation - Location);
            BloodOffset.Z = BloodOffset.Z * 0.5;
            if ( (DamageType == 'shot') || (DamageType == 'decapitated') || (DamageType == 'shredded') )
            {
                Mo = Momentum;
                if ( Mo.Z > 0 )
                    Mo.Z *= 0.5;
                spawn(class 'UT_BloodHit',self,,hitLocation + BloodOffset, rotator(Mo));
            }
            else
                spawn(class 'UT_BloodBurst',self,,hitLocation + BloodOffset);
        }
    }   

    rnd = FClamp(Damage, 20, 60);
    if ( damageType == 'Burned' )
        ClientFlash( -0.009375 * rnd, rnd * vect(16.41, 11.719, 4.6875));
    else if ( damageType == 'Corroded' )
        ClientFlash( -0.01171875 * rnd, rnd * vect(9.375, 14.0625, 4.6875));
    else if ( damageType == 'Drowned' )
        ClientFlash(-0.390, vect(312.5,468.75,468.75));
    else 
        ClientFlash( -0.019 * rnd, rnd * vect(26.5, 4.5, 4.5));

    ShakeView(0.15 + 0.005 * Damage, Damage * 30, 0.3 * Damage); 
    PlayTakeHitSound(Damage, damageType, 1);
    bServerGuessWeapon = ( ((Weapon != None) && Weapon.bPointing) || (GetAnimGroup(AnimSequence) == 'Dodge') );
    iDam = Clamp(Damage,0,200);
    ClientPlayTakeHit(hitLocation - Location, iDam, bServerGuessWeapon ); 
    if ( !bServerGuessWeapon 
        && ((Level.NetMode == NM_DedicatedServer) || (Level.NetMode == NM_ListenServer)) )
    {
        Enable('AnimEnd');
        BaseEyeHeight = Default.BaseEyeHeight;
        bAnimTransition = true;
        PlayTakeHit(0.1, hitLocation, Damage);
    }
}

function PlayDeathHit(float Damage, vector HitLocation, name damageType, vector Momentum)
{
    local Bubble1 bub;
    local vector Mo;

    if ( Region.Zone.bDestructive && (Region.Zone.ExitActor != None) )
        Spawn(Region.Zone.ExitActor);
    if (HeadRegion.Zone.bWaterZone)
    {
        bub = spawn(class 'Bubble1',,, Location 
            + 0.3 * CollisionRadius * vector(Rotation) + 0.8 * EyeHeight * vect(0,0,1));
        if (bub != None)
            bub.DrawScale = FRand()*0.08+0.03; 
        bub = spawn(class 'Bubble1',,, Location 
            + 0.2 * CollisionRadius * VRand() + 0.7 * EyeHeight * vect(0,0,1));
        if (bub != None)
            bub.DrawScale = FRand()*0.08+0.03; 
        bub = spawn(class 'Bubble1',,, Location 
            + 0.3 * CollisionRadius * VRand() + 0.6 * EyeHeight * vect(0,0,1));
        if (bub != None)
            bub.DrawScale = FRand()*0.08+0.03; 
    }

    if ( (!Level.bDropDetail || (FRand() < 0.67))
            && ((DamageType == 'shot') || (DamageType == 'decapitated') || (DamageType == 'shredded')) )
    {
        Mo = Momentum;
        if ( Mo.Z > 0 )
            Mo.Z *= 0.5;
        spawn(class 'UT_BloodHit',self,,hitLocation, rotator(Mo));
    }
    else if ( (damageType != 'Drowned') && (damageType != 'Corroded') )
        spawn(class 'UT_BloodBurst',self,'', hitLocation);
}

//-----------------------------------------------------------------------------
// Sound functions

function PlayTakeHitSound(int damage, name damageType, int Mult)
{
    if ( Level.TimeSeconds - LastPainSound < 0.3 )
        return;
    LastPainSound = Level.TimeSeconds;

    if ( HeadRegion.Zone.bWaterZone )
    {
        if ( damageType == 'Drowned' )
            PlaySound(drown, SLOT_Pain, 12);
        else if ( FRand() < 0.5 )
            PlaySound(UWHit1, SLOT_Pain,16,,,Frand()*0.15+0.9);
        else
            PlaySound(UWHit2, SLOT_Pain,16,,,Frand()*0.15+0.9);
        return;
    }
    damage *= FRand();

    if (damage < 8) 
        PlaySound(HitSound1, SLOT_Pain,16,,,Frand()*0.15+0.9);
    else if (damage < 25)
    {
        if (FRand() < 0.5) PlaySound(HitSound2, SLOT_Pain,16,,,Frand()*0.15+0.9);           
        else PlaySound(HitSound3, SLOT_Pain,16,,,Frand()*0.15+0.9);
    }
    else
        PlaySound(HitSound4, SLOT_Pain,16,,,Frand()*0.15+0.9);          
}

function ClientPlayTakeHit(vector HitLoc, byte Damage, bool bServerGuessWeapon)
{
    local ChallengeHUD CHUD;

    CHUD = ChallengeHUD(myHUD);
    if ( CHUD != None )
        CHUD.SetDamage(HitLoc, damage);

    HitLoc += Location;
    if ( bServerGuessWeapon && ((GetAnimGroup(AnimSequence) == 'Dodge') || ((Weapon != None) && Weapon.bPointing)) )
        return;
    Enable('AnimEnd');
    bAnimTransition = true;
    BaseEyeHeight = Default.BaseEyeHeight;
    PlayTakeHit(0.1, HitLoc, Damage);
}   

function Gasp()
{
    if ( Role != ROLE_Authority )
        return;
    if ( PainTime < 2 )
        PlaySound(GaspSound, SLOT_Talk, 2.0);
    else
        PlaySound(BreathAgain, SLOT_Talk, 2.0);
}

//-----------------------------------------------------------------------------
// Animation functions

function PlayTurning()
{
    BaseEyeHeight = Default.BaseEyeHeight;
    if ( (Weapon == None) || (Weapon.Mass < 20) )
        PlayAnim('TurnSM', 0.3, 0.3);
    else
        PlayAnim('TurnLG', 0.3, 0.3);
}

function TweenToWalking(float tweentime)
{
    BaseEyeHeight = Default.BaseEyeHeight;
    if (Weapon == None)
        TweenAnim('Walk', tweentime);
    else if ( Weapon.bPointing || (CarriedDecoration != None) ) 
    {
        if (Weapon.Mass < 20)
            TweenAnim('WalkSMFR', tweentime);
        else
            TweenAnim('WalkLGFR', tweentime);
    }
    else
    {
        if (Weapon.Mass < 20)
            TweenAnim('WalkSM', tweentime);
        else
            TweenAnim('WalkLG', tweentime);
    } 
}

function PlayWalking()
{
    BaseEyeHeight = Default.BaseEyeHeight;
    if (Weapon == None)
        LoopAnim('Walk');
    else if ( Weapon.bPointing || (CarriedDecoration != None) ) 
    {
        if (Weapon.Mass < 20)
            LoopAnim('WalkSMFR');
        else
            LoopAnim('WalkLGFR');
    }
    else
    {
        if (Weapon.Mass < 20)
            LoopAnim('WalkSM');
        else
            LoopAnim('WalkLG');
    }
}

function TweenToRunning(float tweentime)
{
    local vector X,Y,Z, Dir;

    BaseEyeHeight = Default.BaseEyeHeight;
    if (bIsWalking)
    {
        TweenToWalking(0.1);
        return;
    }

    GetAxes(Rotation, X,Y,Z);
    Dir = Normal(Acceleration);
    if ( (Dir Dot X < 0.75) && (Dir != vect(0,0,0)) )
    {
        // strafing or backing up
        if ( Dir Dot X < -0.75 )
            PlayAnim('BackRun', 0.9, tweentime);
        else if ( Dir Dot Y > 0 )
            PlayAnim('StrafeR', 0.9, tweentime);
        else
            PlayAnim('StrafeL', 0.9, tweentime);
    }
    else if (Weapon == None)
        PlayAnim('RunSM', 0.9, tweentime);
    else if ( Weapon.bPointing ) 
    {
        if (Weapon.Mass < 20)
            PlayAnim('RunSMFR', 0.9, tweentime);
        else
            PlayAnim('RunLGFR', 0.9, tweentime);
    }
    else
    {
        if (Weapon.Mass < 20)
            PlayAnim('RunSM', 0.9, tweentime);
        else
            PlayAnim('RunLG', 0.9, tweentime);
    } 
}

function PlayRunning()
{
    local vector X,Y,Z, Dir;

    BaseEyeHeight = Default.BaseEyeHeight;

    // determine facing direction
    GetAxes(Rotation, X,Y,Z);
    Dir = Normal(Acceleration);
    if ( (Dir Dot X < 0.75) && (Dir != vect(0,0,0)) )
    {
        // strafing or backing up
        if ( Dir Dot X < -0.75 )
            LoopAnim('BackRun');
        else if ( Dir Dot Y > 0 )
            LoopAnim('StrafeR');
        else
            LoopAnim('StrafeL');
    }
    else if (Weapon == None)
        LoopAnim('RunSM');
    else if ( Weapon.bPointing ) 
    {
        if (Weapon.Mass < 20)
            LoopAnim('RunSMFR');
        else
            LoopAnim('RunLGFR');
    }
    else
    {
        if (Weapon.Mass < 20)
            LoopAnim('RunSM');
        else
            LoopAnim('RunLG');
    }
}

function PlayRising()
{
    BaseEyeHeight = 0.4 * Default.BaseEyeHeight;
    TweenAnim('DuckWlkS', 0.7);
}

function PlayFeignDeath()
{
    local float decision;

    BaseEyeHeight = 0;
    decision = frand();
    if ( decision < 0.33 )
        TweenAnim('DeathEnd', 0.5);
    else if ( decision < 0.67 )
        TweenAnim('DeathEnd2', 0.5);
    else 
        TweenAnim('DeathEnd3', 0.5);
}

function PlayGutHit(float tweentime)
{
    if ( (AnimSequence == 'GutHit') || (AnimSequence == 'Dead2') )
    {
        if (FRand() < 0.5)
            TweenAnim('LeftHit', tweentime);
        else
            TweenAnim('RightHit', tweentime);
    }
    else if ( FRand() < 0.6 )
        TweenAnim('GutHit', tweentime);
    else
        TweenAnim('Dead2', tweentime);

}

function PlayHeadHit(float tweentime)
{
    if ( (AnimSequence == 'HeadHit') || (AnimSequence == 'Dead4') )
        TweenAnim('GutHit', tweentime);
    else if ( FRand() < 0.6 )
        TweenAnim('HeadHit', tweentime);
    else
        TweenAnim('Dead4', tweentime);
}

function PlayLeftHit(float tweentime)
{
    if ( (AnimSequence == 'LeftHit') || (AnimSequence == 'Dead3') )
        TweenAnim('GutHit', tweentime);
    else if ( FRand() < 0.6 )
        TweenAnim('LeftHit', tweentime);
    else 
        TweenAnim('Dead3', tweentime);
}

function PlayRightHit(float tweentime)
{
    if ( (AnimSequence == 'RightHit') || (AnimSequence == 'Dead5') )
        TweenAnim('GutHit', tweentime);
    else if ( FRand() < 0.6 )
        TweenAnim('RightHit', tweentime);
    else
        TweenAnim('Dead5', tweentime);
}
    
function PlayLanded(float impactVel)
{   
    impactVel = impactVel/JumpZ;
    impactVel = 0.1 * impactVel * impactVel;
    BaseEyeHeight = Default.BaseEyeHeight;

    if ( impactVel > 0.17 )
        PlayOwnedSound(LandGrunt, SLOT_Talk, FMin(5, 5 * impactVel),false,1200,FRand()*0.4+0.8);
    if ( !FootRegion.Zone.bWaterZone && (impactVel > 0.01) )
        PlayOwnedSound(Land, SLOT_Interact, FClamp(4 * impactVel,0.5,5), false,1000, 1.0);
    if ( (impactVel > 0.06) || (GetAnimGroup(AnimSequence) == 'Jumping') || (GetAnimGroup(AnimSequence) == 'Ducking') )
    {
        if ( (Weapon == None) || (Weapon.Mass < 20) )
            TweenAnim('LandSMFR', 0.12);
        else
            TweenAnim('LandLGFR', 0.12);
    }
    else if ( !IsAnimating() )
    {
        if ( GetAnimGroup(AnimSequence) == 'TakeHit' )
        {
            SetPhysics(PHYS_Walking);
            AnimEnd();
        }
        else 
        {
            if ( (Weapon == None) || (Weapon.Mass < 20) )
                TweenAnim('LandSMFR', 0.12);
            else
                TweenAnim('LandLGFR', 0.12);
        }
    }
}
    
function PlayInAir()
{
    local vector X,Y,Z, Dir;
    local float f, TweenTime;

    BaseEyeHeight =  0.7 * Default.BaseEyeHeight;

    if ( (GetAnimGroup(AnimSequence) == 'Landing') && !bLastJumpAlt )
    {
        GetAxes(Rotation, X,Y,Z);
        Dir = Normal(Acceleration);
        f = Dir dot Y;
        if ( f > 0.7 )
            TweenAnim('DodgeL', 0.35);
        else if ( f < -0.7 )
            TweenAnim('DodgeR', 0.35);
        else if ( Dir dot X > 0 )
            TweenAnim('DodgeF', 0.35);
        else
            TweenAnim('DodgeB', 0.35);
        bLastJumpAlt = true;
        return;
    }
    bLastJumpAlt = false;
    if ( GetAnimGroup(AnimSequence) == 'Jumping' )
    {
        if ( (Weapon == None) || (Weapon.Mass < 20) )
            TweenAnim('DuckWlkS', 2);
        else
            TweenAnim('DuckWlkL', 2);
        return;
    }
    else if ( GetAnimGroup(AnimSequence) == 'Ducking' )
        TweenTime = 2;
    else 
        TweenTime = 0.7;

    if ( AnimSequence == 'StrafeL' )
        TweenAnim('DodgeR', TweenTime);
    else if ( AnimSequence == 'StrafeR' )
        TweenAnim('DodgeL', TweenTime);
    else if ( AnimSequence == 'BackRun' )
        TweenAnim('DodgeB', TweenTime);
    else if ( (Weapon == None) || (Weapon.Mass < 20) )
        TweenAnim('JumpSMFR', TweenTime);
    else
        TweenAnim('JumpLGFR', TweenTime); 
}

function PlayDuck()
{
    BaseEyeHeight = 0;
    if ( (Weapon == None) || (Weapon.Mass < 20) )
        TweenAnim('DuckWlkS', 0.25);
    else
        TweenAnim('DuckWlkL', 0.25);
}

function PlayCrawling()
{
    //log("Play duck");
    BaseEyeHeight = 0;
    if ( (Weapon == None) || (Weapon.Mass < 20) )
        LoopAnim('DuckWlkS');
    else
        LoopAnim('DuckWlkL');
}

function TweenToWaiting(float tweentime)
{
    if ( (IsInState('PlayerSwimming')) || (Physics == PHYS_Swimming) )
    {
        BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
        if ( (Weapon == None) || (Weapon.Mass < 20) )
            TweenAnim('TreadSM', tweentime);
        else
            TweenAnim('TreadLG', tweentime);
    }
    else
    {
        BaseEyeHeight = Default.BaseEyeHeight;
        if ( (Weapon == None) || (Weapon.Mass < 20) )
            TweenAnim('StillSMFR', tweentime);
        else 
            TweenAnim('StillFRRP', tweentime);
    }
}
    
function PlayRecoil(float Rate)
{
    if ( Weapon.bRapidFire )
    {
        if ( !IsAnimating() && (Physics == PHYS_Walking) )
            LoopAnim('StillFRRP', 0.02);
    }
    else if ( AnimSequence == 'StillSmFr' )
        PlayAnim('StillSmFr', Rate, 0.02);
    else if ( (AnimSequence == 'StillLgFr') || (AnimSequence == 'StillFrRp') )  
        PlayAnim('StillLgFr', Rate, 0.02);
}

function PlayFiring()
{
    // switch animation sequence mid-stream if needed
    if (AnimSequence == 'RunLG')
        AnimSequence = 'RunLGFR';
    else if (AnimSequence == 'RunSM')
        AnimSequence = 'RunSMFR';
    else if (AnimSequence == 'WalkLG')
        AnimSequence = 'WalkLGFR';
    else if (AnimSequence == 'WalkSM')
        AnimSequence = 'WalkSMFR';
    else if ( AnimSequence == 'JumpSMFR' )
        TweenAnim('JumpSMFR', 0.03);
    else if ( AnimSequence == 'JumpLGFR' )
        TweenAnim('JumpLGFR', 0.03);
    else if ( (GetAnimGroup(AnimSequence) == 'Waiting') || (GetAnimGroup(AnimSequence) == 'Gesture')
        && (AnimSequence != 'TreadLG') && (AnimSequence != 'TreadSM') )
    {
        if ( Weapon.Mass < 20 )
            TweenAnim('StillSMFR', 0.02);
        else
            TweenAnim('StillFRRP', 0.02);
    }
}

function PlayWeaponSwitch(Weapon NewWeapon)
{
    if ( (Weapon == None) || (Weapon.Mass < 20) )
    {
        if ( (NewWeapon != None) && (NewWeapon.Mass > 20) )
        {
            if ( (AnimSequence == 'RunSM') || (AnimSequence == 'RunSMFR') )
                AnimSequence = 'RunLG';
            else if ( (AnimSequence == 'WalkSM') || (AnimSequence == 'WalkSMFR') )
                AnimSequence = 'WalkLG';    
            else if ( AnimSequence == 'JumpSMFR' )
                AnimSequence = 'JumpLGFR';
            else if ( AnimSequence == 'DuckWlkL' )
                AnimSequence = 'DuckWlkS';
            else if ( AnimSequence == 'StillSMFR' )
                AnimSequence = 'StillFRRP';
            else if ( AnimSequence == 'AimDnSm' )
                AnimSequence = 'AimDnLg';
            else if ( AnimSequence == 'AimUpSm' )
                AnimSequence = 'AimUpLg';
         }  
    }
    else if ( (NewWeapon == None) || (NewWeapon.Mass < 20) )
    {       
        if ( (AnimSequence == 'RunLG') || (AnimSequence == 'RunLGFR') )
            AnimSequence = 'RunSM';
        else if ( (AnimSequence == 'WalkLG') || (AnimSequence == 'WalkLGFR') )
            AnimSequence = 'WalkSM';
        else if ( AnimSequence == 'JumpLGFR' )
            AnimSequence = 'JumpSMFR';
        else if ( AnimSequence == 'DuckWlkS' )
            AnimSequence = 'DuckWlkL';
        else if (AnimSequence == 'StillFRRP')
            AnimSequence = 'StillSMFR';
        else if ( AnimSequence == 'AimDnLg' )
            AnimSequence = 'AimDnSm';
        else if ( AnimSequence == 'AimUpLg' )
            AnimSequence = 'AimUpSm';
    }
}

function PlaySwimming()
{
    BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
    if ((Weapon == None) || (Weapon.Mass < 20) )
        LoopAnim('SwimSM');
    else
        LoopAnim('SwimLG');
}

function TweenToSwimming(float tweentime)
{
    BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
    if ((Weapon == None) || (Weapon.Mass < 20) )
        TweenAnim('SwimSM',tweentime);
    else
        TweenAnim('SwimLG',tweentime);
}

function NeedActivate()
{
    bNeedActivate = true;
}

state FeigningDeath
{
    function NeedActivate()
    {
        bNeedActivate = false;
    }

    function BeginState()
    {
        if ( (Role == ROLE_Authority) && (PlayerReplicationInfo.HasFlag != None)
            && PlayerReplicationInfo.HasFlag.IsA('CTFFlag')  )
            PlayerReplicationInfo.HasFlag.Drop(vect(0,0,0));
        Super.BeginState();
        bNeedActivate = false;
    }
}

state Dying
{
ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, SwitchWeapon, Falling, PainTimer;

    function ViewFlash(float DeltaTime)
    {
        if ( Carcass(ViewTarget) != None )
        {
            InstantFlash = -0.3;
            InstantFog = vect(0.25, 0.03, 0.03);
        }
        Super.ViewFlash(DeltaTime);
    }

    function BeginState()
    {
        Super.BeginState();
        LastKillTime = 0;
    }
}
    
state GameEnded
{
    ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, TakeDamage, PainTimer, Died;

    exec function Fire( optional float F )
    {
        if ( Role < ROLE_Authority )
            return;

        if ( (Level.NetMode == NM_Standalone) && !bFrozen )
            ServerReStartGame();
    }
}

defaultproperties
{
     spreenote(0)="is on a killing spree!"
     spreenote(1)="is on a rampage!"
     spreenote(2)="is dominating!"
     spreenote(3)="is brutalizing the competition!"
     spreenote(4)="is unstoppable!"
     spreenote(5)="owns you!"
     spreenote(6)="needs to find some real competition!"
     spreenote(7)="is a GOD!"
     LastKillTime=-1000.000000
     Footstep1=Sound'Botpack.FemaleSounds.(All).stone02'
     Footstep2=Sound'Botpack.FemaleSounds.(All).stone04'
     Footstep3=Sound'Botpack.FemaleSounds.(All).stone05'
     StatusDoll=Texture'Botpack.Icons.Man'
     StatusBelt=Texture'Botpack.Icons.ManBelt'
     VoicePackMetaClass="BotPack.ChallengeVoicePack"
     AnnouncerVolume=4
     bSinglePlayer=True
     bCheatsEnabled=True
     bCanStrafe=True
     bIsHuman=True
     bIsMultiSkinned=True
     MeleeRange=50.000000
     GroundSpeed=400.000000
     AirSpeed=400.000000
     AccelRate=2048.000000
     AirControl=0.350000
     BaseEyeHeight=27.000000
     EyeHeight=27.000000
     UnderWaterTime=20.000000
     Intelligence=BRAINS_HUMAN
     Land=Sound'UnrealShare.Generic.Land1'
     WaterStep=Sound'UnrealShare.Generic.LSplash'
     VoiceType="BotPack.VoiceMaleOne"
     AnimSequence=WalkSm
     DrawType=DT_Mesh
     AmbientGlow=17
     CollisionRadius=17.000000
     CollisionHeight=39.000000
     LightBrightness=70
     LightHue=40
     LightSaturation=128
     LightRadius=6
     Buoyancy=99.000000
     RotationRate=(Pitch=3072,Yaw=65000,Roll=2048)
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Do 19.5.2005 19:42:14.000 - Creation time: Fr 7.6.2013 13:16:05.772 - Created with UnCodeX