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

UnrealShare.UnrealIPlayer


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
//=============================================================================
// UnrealIPlayer.
//=============================================================================
class UnrealIPlayer expands PlayerPawn
    config(user)
    abstract;

#exec AUDIO IMPORT FILE="Sounds\Generic\land1.WAV" NAME="Land1" GROUP="Generic"
#exec AUDIO IMPORT FILE="Sounds\Generic\lsplash.WAV" NAME="LSplash" GROUP="Generic"
#exec AUDIO IMPORT FILE="Sounds\Generic\Say3A.WAV" NAME="Beep" GROUP="Generic"

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() config class<VoicePack> VoiceType;

replication
{
    // Functions server can call.
    unreliable if( Role==ROLE_Authority )
        ClientPlayTakeHit;
}

function PostBeginPlay()
{
    Super.PostBeginPlay();
    PlayerReplicationInfo.VoiceType = VoiceType;
}

event Possess()
{
    local UnrealMeshMenu M;

    Super.Possess();

    if ( Level.Netmode == NM_Client )
    {
        M = spawn(class'UnrealMeshMenu');
        M.LoadAllMeshes();
        M.Destroy();
    }
}

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

exec event ShowUpgradeMenu()
{
    bSpecialMenu = true;
    SpecialMenu = class'UpgradeMenu';
    ShowMenu();
}

exec function ShowLoadMenu()
{
    bSpecialMenu = true;
    SpecialMenu = class'UnrealLoadMenu';
    ShowMenu();
}

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

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

    if ( Role < ROLE_Authority )
        return;
    if ( !bIsWalking && (Level.Game.Difficulty > 1) && ((Weapon == None) || !Weapon.bPointing) )
        MakeNoise(0.05 * Level.Game.Difficulty);
    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;

    if ( bIsWalking )
        PlaySound(step, SLOT_Interact, 0.5, false, 400.0, 1.0);
    else 
        PlaySound(step, SLOT_Interact, 2, false, 800.0, 1.0);
}

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

    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 ( (Level.Game != None) && Level.Game.bVeryLowGore )
                spawn(class 'BloodBurst',,,hitLocation + BloodOffset, rotator(BloodOffset));
            else
                spawn(class 'BloodSpray',,,hitLocation + BloodOffset, rotator(BloodOffset));
        }
    }   

    rnd = FClamp(Damage, 15, 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.017 * rnd, rnd * vect(24, 4, 4));

    ShakeView(0.15 + 0.005 * Damage, Damage * 30, 0.3 * Damage); 
    PlayTakeHitSound(Damage, damageType, 1);
    bServerGuessWeapon = ( ((Weapon != None) && Weapon.bPointing) || (GetAnimGroup(AnimSequence) == 'Dodge') );
    ClientPlayTakeHit(0.1, hitLocation, Damage, 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)
{
    local Bubble1 bub;

    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 ( (damageType != 'Drowned') && (damageType != 'Corroded') )
        spawn(class 'BloodSpray',self,'', hitLocation);
}

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

function PlayDyingSound()
{
    local float rnd;

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

    rnd = FRand();
    if (rnd < 0.25)
        PlaySound(Die, SLOT_Talk);
    else if (rnd < 0.5)
        PlaySound(Die2, SLOT_Talk);
    else if (rnd < 0.75)
        PlaySound(Die3, SLOT_Talk);
    else 
        PlaySound(Die4, SLOT_Talk);
}

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, 1.5);
        else if ( FRand() < 0.5 )
            PlaySound(UWHit1, SLOT_Pain,2.0,,,Frand()*0.15+0.9);
        else
            PlaySound(UWHit2, SLOT_Pain,2.0,,,Frand()*0.15+0.9);
        return;
    }
    damage *= FRand();

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

function ClientPlayTakeHit(float tweentime, vector HitLoc, int Damage, bool bServerGuessWeapon)
{
    if ( bServerGuessWeapon && ((GetAnimGroup(AnimSequence) == 'Dodge') || ((Weapon != None) && Weapon.bPointing)) )
        return;
    Enable('AnimEnd');
    bAnimTransition = true;
    BaseEyeHeight = Default.BaseEyeHeight;
    PlayTakeHit(tweentime, 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);
}

defaultproperties
{
     VoiceType=Class'Engine.VoicePack'
     bSinglePlayer=True
     bCanStrafe=True
     MeleeRange=50.000000
     GroundSpeed=400.000000
     AirSpeed=400.000000
     AccelRate=2048.000000
     UnderWaterTime=20.000000
     Intelligence=BRAINS_HUMAN
     Land=Sound'UnrealShare.Generic.Land1'
     WaterStep=Sound'UnrealShare.Generic.LSplash'
     AnimSequence=WalkSm
     DrawType=DT_Mesh
     LightBrightness=70
     LightHue=40
     LightSaturation=128
     LightRadius=6
     RotationRate=(Pitch=3072,Yaw=65000,Roll=2048)
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sun 21/2/2010 23:48:40.000 - Creation time: Sun 21/2/2010 23:49:54.192 - Created with UnCodeX