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

UnrealShare.Eightball


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
//=============================================================================
// Eightball.
//=============================================================================
class Eightball expands Weapon;

#exec MESH IMPORT MESH=EightB ANIVFILE=MODELS\eightb_a.3D DATAFILE=MODELS\eightb_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=EightB X=0 Y=100 Z=-120 YAW=-64 ROLL=-8
#exec MESH SEQUENCE MESH=eightb SEQ=All      STARTFRAME=0   NUMFRAMES=65
#exec MESH SEQUENCE MESH=eightb SEQ=Select   STARTFRAME=0   NUMFRAMES=15 RATE=24 GROUP=Select
#exec MESH SEQUENCE MESH=eightb SEQ=Down     STARTFRAME=15  NUMFRAMES=12
#exec MESH SEQUENCE MESH=eightb SEQ=Idle     STARTFRAME=27  NUMFRAMES=2
#exec MESH SEQUENCE MESH=eightb SEQ=Idle2    STARTFRAME=29  NUMFRAMES=1
#exec MESH SEQUENCE MESH=eightb SEQ=Loading  STARTFRAME=30  NUMFRAMES=27
#exec MESH SEQUENCE MESH=eightb SEQ=Fire     STARTFRAME=57  NUMFRAMES=8
#exec TEXTURE IMPORT NAME=JEightB1 FILE=MODELS\eightbal.PCX GROUP=Skins
#exec MESHMAP SCALE MESHMAP=eightb X=0.005 Y=0.005 Z=0.01
#exec MESHMAP SETTEXTURE MESHMAP=eightb NUM=1 TEXTURE=Jeightb1

#exec MESH IMPORT MESH=EightPick ANIVFILE=MODELS\epick_a.3D DATAFILE=MODELS\epick_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=EightPick X=0 Y=170 Z=0 YAW=64
#exec MESH SEQUENCE MESH=eightpick SEQ=All    STARTFRAME=0   NUMFRAMES=1
#exec MESH SEQUENCE MESH=eightpick SEQ=Still  STARTFRAME=0   NUMFRAMES=1
#exec TEXTURE IMPORT NAME=JEightB1 FILE=MODELS\eightbal.PCX GROUP=Skins
#exec MESHMAP SCALE MESHMAP=eightpick X=0.04 Y=0.04 Z=0.08
#exec MESHMAP SETTEXTURE MESHMAP=eightpick NUM=1 TEXTURE=Jeightb1

// 3rd person perspective version
#exec MESH IMPORT MESH=8Ball3rd ANIVFILE=MODELS\8ball3_a.3D DATAFILE=MODELS\8ball3_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=8Ball3rd X=0 Y=-430 Z=-45 YAW=-64 ROLL=9
#exec MESH SEQUENCE MESH=8Ball3rd SEQ=All  STARTFRAME=0  NUMFRAMES=10
#exec MESH SEQUENCE MESH=8Ball3rd SEQ=Idle  STARTFRAME=0  NUMFRAMES=1
#exec MESH SEQUENCE MESH=8Ball3rd SEQ=Fire  STARTFRAME=1  NUMFRAMES=9
#exec TEXTURE IMPORT NAME=JEightB1 FILE=MODELS\eightbal.PCX GROUP="Skins"
#exec OBJ LOAD FILE=textures\FireEffect18.utx PACKAGE=UnrealShare.Effect18
#exec MESHMAP SCALE MESHMAP=8Ball3rd X=0.065 Y=0.065 Z=0.13
#exec MESHMAP SETTEXTURE MESHMAP=8Ball3rd NUM=1 TEXTURE=JEightB1
#exec MESHMAP SETTEXTURE MESHMAP=8Ball3rd NUM=0 TEXTURE=UnrealShare.Effect18.FireEffect18

#exec AUDIO IMPORT FILE="Sounds\eightbal\8ALTF1.WAV" NAME="EightAltFire" GROUP="EightBall"
#exec AUDIO IMPORT FILE="Sounds\eightbal\Barrelm1.WAV" NAME="BarrelMove" GROUP="EightBall"
#exec AUDIO IMPORT FILE="Sounds\eightbal\Eload1.WAV" NAME="Loading" GROUP="EightBall"
#exec AUDIO IMPORT FILE="Sounds\eightbal\Lock1.WAV" NAME="SeekLock" GROUP="EightBall"
#exec AUDIO IMPORT FILE="Sounds\eightbal\SeekLost.WAV" NAME="SeekLost" GROUP="EightBall"
#exec AUDIO IMPORT FILE="Sounds\eightbal\Select.WAV" NAME="Selecting" GROUP="EightBall"

#exec MESH NOTIFY MESH=Eightb SEQ=Loading TIME=0.45 FUNCTION=BarrelTurn

#exec TEXTURE IMPORT NAME=Crosshair6 FILE=Textures\Hud\chair6.PCX GROUP="Icons" FLAGS=2 MIPS=OFF

var int RocketsLoaded, RocketRad;
var bool bFireLoad,bTightWad;
var Actor LockedTarget, NewTarget, OldTarget;

simulated function PostRender( canvas Canvas )
{
    Super.PostRender(Canvas);
    bOwnsCrossHair = bLockedOn;
    if ( bOwnsCrossHair )
    {
        // if locked on, draw special crosshair
        Canvas.SetPos(0.5 * Canvas.ClipX - 8, 0.5 * Canvas.ClipY - 8 );
        Canvas.Style = 2;
        Canvas.DrawIcon(Texture'Crosshair6', 1.0);
        Canvas.Style = 1;   
    }
}
        
function float RateSelf( out int bUseAltMode )
{
    local float EnemyDist;
    local bool bRetreating;
    local vector EnemyDir;

    if ( AmmoType.AmmoAmount <=0 )
        return -2;
    if ( Pawn(Owner).Enemy == None )
    {
        bUseAltMode = 0;
        return AIRating;
    }

    EnemyDir = Pawn(Owner).Enemy.Location - Owner.Location; 
    EnemyDist = VSize(EnemyDir);
    if ( EnemyDist < 270 )
    {
        bUseAltMode = 0;
        return -0.1;
    }

    if ( Owner.Physics == PHYS_Falling )
        bUseAltMode = 0;
    else if ( EnemyDist < -1.5 * EnemyDir.Z )
        bUseAltMode = int( FRand() < 0.5 );
    else
    {
        bRetreating = ( ((EnemyDir/EnemyDist) Dot Owner.Velocity) < -0.7 );
        bUseAltMode = 0;
        if ( ((EnemyDist < 600) || (bRetreating && (EnemyDist < 800)))
            && (FRand() < 0.4) )
            bUseAltMode = 1;
    }
    return AIRating;
}

// return delta to combat style
function float SuggestAttackStyle()
{
    local float EnemyDist;

    EnemyDist = VSize(Pawn(Owner).Enemy.Location - Owner.Location);
    if ( EnemyDist < 500 )
        return -0.6;
    else
        return -0.2;
}

function BarrelTurn()
{
    Owner.PlaySound(Misc3Sound, SLOT_None, 0.1*Pawn(Owner).SoundDampening);
}

function Fire( float Value )
{
    //bFireMem = false;
    //bAltFireMem = false;
    bPointing=True;
    CheckVisibility();
    if ( AmmoType.UseAmmo(1) )
        GoToState('NormalFire');
}

function AltFire( float Value )
{
    //bFireMem = false;
    //bAltFireMem = false;
    bPointing=True;
    CheckVisibility();
    if ( AmmoType.UseAmmo(1) )
        GoToState('AltFiring');
}

function Actor CheckTarget()
{
    local Actor ETarget;
    local Vector Start, X,Y,Z;
    local float bestDist, bestAim;
    local Pawn PawnOwner;

    PawnOwner = Pawn(Owner);
    if ( !PawnOwner.bIsPlayer && (PawnOwner.Enemy == None) )
        return None; 
    GetAxes(PawnOwner.ViewRotation,X,Y,Z);
    Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; 
    bestAim = 0.93;
    ETarget = PawnOwner.PickTarget(bestAim, bestDist, X, Start);
    if ( !PawnOwner.bIsPlayer && (PawnOwner.Enemy != ETarget) )
        return None; 
    bPointing = (ETarget != None);
    Return ETarget;
}

//////////////////////////////////////////////////////
state AltFiring
{
    function Tick( float DeltaTime )
    {
        if( (pawn(Owner).bAltFire==0) || (RocketsLoaded > 5) )  // If if Fire button down, load up another
            GoToState('FireRockets');
    }

    function BeginState()
    {
        RocketsLoaded = 1;
        bFireLoad = False;
    }

Begin:
    bLockedOn = False;
    While ( RocketsLoaded < 6 )
    {
        if (AmmoType.AmmoAmount<=0) GoToState('FireRockets');       
        Owner.PlaySound(CockingSound, SLOT_None, Pawn(Owner).SoundDampening);       
        PlayAnim('Loading', 1.1,0.0);
        FinishAnim();
        RocketsLoaded++;
        AmmoType.UseAmmo(1);        
        if ( (PlayerPawn(Owner) == None) && ((FRand() > 0.5) || (Pawn(Owner).Enemy == None)) )
            Pawn(Owner).bAltFire = 0;
        if ( Level.Game.Difficulty > 0 )
            Owner.MakeNoise(0.15 * Level.Game.Difficulty * Pawn(Owner).SoundDampening);     
    }
}

///////////////////////////////////////////////////////
state NormalFire
{
    function bool BotFireRockets()
    {
        return ( (Pawn(Owner).MoveTarget != Pawn(Owner).Target) 
                || (Pawn(Owner).Enemy == None)
                || ((Owner.Physics == PHYS_Falling) && (Owner.Velocity.Z < 15))
                || (VSize(Owner.Location - Pawn(Owner).Target.Location) < 400) );
    }

    function Tick( float DeltaTime )
    {
        if ( (PlayerPawn(Owner) == None) && BotFireRockets() )
            Pawn(Owner).bFire = 0;

        if( pawn(Owner).bFire==0 || RocketsLoaded > 5)  // If Fire button down, load up another
            GoToState('FireRockets');
    }

    function BeginState()
    {
        bFireLoad = True;
        RocketsLoaded = 1;
        Super.BeginState();
    }

Begin:
    While ( RocketsLoaded < 6 )
    {
        if ( PlayerPawn(Owner) == None )
        {
            if ( ((Physics != PHYS_Falling) && (FRand() > 0.33)) 
                || BotFireRockets()
                || !Pawn(Owner).CheckFutureSight(0.15) )
                Pawn(Owner).bFire = 0;

            if ( Pawn(Owner).bFire == 0 )
                GoToState('FireRockets');
        }
        if (AmmoType.AmmoAmount<=0) GoToState('FireRockets');           
        Owner.PlaySound(CockingSound, SLOT_None, Pawn(Owner).SoundDampening);   
        PlayAnim('Loading', 1.1,0.0);
        FinishAnim();
        if (pawn(Owner).bAltFire!=0) bTightWad=True;
        NewTarget = CheckTarget();
        if ( Pawn(NewTarget) != None )
            Pawn(NewTarget).WarnTarget(Pawn(Owner), ProjectileSpeed, vector(Pawn(Owner).ViewRotation)); 
        If ( (LockedTarget != None) && (NewTarget != LockedTarget) ) 
        {
            LockedTarget = None;
            Owner.PlaySound(Misc2Sound, SLOT_None, Pawn(Owner).SoundDampening);
            bLockedOn=False;
        }
        else if (LockedTarget != None)
            Owner.PlaySound(Misc1Sound, SLOT_None, Pawn(Owner).SoundDampening);
        bPointing = true;
        if ( Level.Game.Difficulty > 0 )
            Owner.MakeNoise(0.15 * Level.Game.Difficulty * Pawn(Owner).SoundDampening);     
        RocketsLoaded++;
        AmmoType.UseAmmo(1);
    }
}

///////////////////////////////////////////////////////
state Idle
{
    function Timer()
    {
        NewTarget = CheckTarget();
        if ( NewTarget == OldTarget )
        {
            LockedTarget = NewTarget;
            If (LockedTarget != None) 
            {
                bLockedOn=True;         
                Owner.MakeNoise(Pawn(Owner).SoundDampening);
                Owner.PlaySound(Misc1Sound, SLOT_None,Pawn(Owner).SoundDampening);
                if ( (Pawn(LockedTarget) != None) && (FRand() < 0.7) )
                    Pawn(LockedTarget).WarnTarget(Pawn(Owner), ProjectileSpeed, vector(Pawn(Owner).ViewRotation));  
            }
        }
        else if( (OldTarget != None) && (NewTarget == None) ) 
        {
            Owner.PlaySound(Misc2Sound, SLOT_None,Pawn(Owner).SoundDampening);
            bLockedOn = False;
        }
        else 
        {
            LockedTarget = None;
            bLockedOn = False;
        }
        OldTarget = NewTarget;
    }
Begin:
    if (Pawn(Owner).bFire!=0) Fire(0.0);
    if (Pawn(Owner).bAltFire!=0) AltFire(0.0);  
    bPointing=False;
    if (AmmoType.AmmoAmount<=0) 
        Pawn(Owner).SwitchToBestWeapon();  //Goto Weapon that has Ammo
    LoopAnim('Idle', 0.01,0.4);
    OldTarget = CheckTarget();
    SetTimer(1.25,True);
    LockedTarget = None;
    bLockedOn = False;
}

///////////////////////////////////////////////////////
state FireRockets
{
    function Fire(float F) {}
    function AltFire(float F) {}

    function BeginState()
    {
        local vector FireLocation, StartLoc, X,Y,Z;
        local rotator FireRot;
        local rocket r;
        local grenade g;
        local float Angle;
        local pawn BestTarget;
        local int DupRockets;

        Angle = 0;
        DupRockets = RocketsLoaded - 1;
        if (DupRockets < 0) DupRockets = 0;
        if ( PlayerPawn(Owner) != None )
        {
            PlayerPawn(Owner).shakeview(ShakeTime, ShakeMag*RocketsLoaded, ShakeVert); //shake player view
            PlayerPawn(Owner).ClientInstantFlash( -0.4, vect(650, 450, 190));
        }
        else
            bTightWad = ( FRand() * 4 < Pawn(Owner).skill );

        GetAxes(Pawn(Owner).ViewRotation,X,Y,Z);
        StartLoc = Owner.Location + CalcDrawOffset(); 
        FireLocation = StartLoc + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; 
        if ( bFireLoad )        
            AdjustedAim = pawn(owner).AdjustAim(ProjectileSpeed, FireLocation, AimError, True, bWarnTarget);
        else 
            AdjustedAim = pawn(owner).AdjustToss(AltProjectileSpeed, FireLocation, AimError, True, bAltWarnTarget); 
            
        if ( PlayerPawn(Owner) != None )
            AdjustedAim = Pawn(Owner).ViewRotation;
                
        PlayAnim( 'Fire', 0.6, 0.05);   
        Owner.MakeNoise(Pawn(Owner).SoundDampening);
        if ( (LockedTarget!=None) || !bFireLoad )
        {
            BestTarget = Pawn(CheckTarget());
            if ( (LockedTarget!=None) && (LockedTarget != BestTarget) ) 
            {
                LockedTarget = None;
                bLockedOn=False;
            }
        }
        else 
            BestTarget = None;
        bPointing = true;
        FireRot = AdjustedAim;
        RocketRad = 4;
        if (bTightWad || !bFireLoad) RocketRad=7;
        While ( RocketsLoaded > 0 )
        {
            Firelocation = StartLoc - Sin(Angle)*Y*RocketRad + (Cos(Angle)*RocketRad - 10.78)*Z + X * (10 + 8 * FRand());
            if (bFireLoad)
            {
                if ( Angle > 0 )
                {
                    if ( Angle < 3 && !bTightWad)
                        FireRot.Yaw = AdjustedAim.Yaw - Angle * 600;
                    else if ( Angle > 3.5 && !bTightWad)
                        FireRot.Yaw = AdjustedAim.Yaw + (Angle - 3)  * 600;
                    else
                        FireRot.Yaw = AdjustedAim.Yaw;
                }
                if ( LockedTarget!=None )
                {
                    r = Spawn( class 'SeekingRocket',, '', FireLocation,FireRot);   
                    r.Seeking = LockedTarget;
                    r.NumExtraRockets = DupRockets;                 
                }
                else 
                {
                    r = Spawn( class 'Rocket',, '', FireLocation,FireRot);
                    r.NumExtraRockets = DupRockets;
                    if (RocketsLoaded>5 && bTightWad) r.bRing=True;
                }
                if ( Angle > 0 )
                    r.Velocity *= (0.9 + 0.2 * FRand());            
            }
            else 
            {
                g = Spawn( class 'Grenade',, '', FireLocation,AdjustedAim);
                g.WarnTarget = ScriptedPawn(BestTarget);
                g.NumExtraGrenades = DupRockets;
                Owner.PlaySound(AltFireSound, SLOT_None, 3.0*Pawn(Owner).SoundDampening);               
            }

            Angle += 1.0484; //2*3.1415/6;
            RocketsLoaded--;
        }
        bTightWad=False;
        //bFireMem = false;
        //bAltFireMem = false;		
    }

Begin:
    FinishAnim();
    if (AmmoType.AmmoAmount > 0) 
    {   
        Owner.PlaySound(CockingSound, SLOT_None,Pawn(Owner).SoundDampening);        
        PlayAnim('Loading', 1.5,0.0);   
        FinishAnim();       
        RocketsLoaded = 1;
    }
    LockedTarget = None;
    Finish();   
}

defaultproperties
{
     AmmoName=Class'UnrealShare.RocketCan'
     PickupAmmoCount=6
     bWarnTarget=True
     bAltWarnTarget=True
     bSplashDamage=True
     bRecommendSplashDamage=True
     ProjectileClass=Class'UnrealShare.Rocket'
     AltProjectileClass=Class'UnrealShare.Grenade'
     shakemag=350.000000
     shaketime=0.200000
     shakevert=7.500000
     AIRating=0.700000
     RefireRate=0.250000
     AltRefireRate=0.250000
     AltFireSound=Sound'UnrealShare.Eightball.EightAltFire'
     CockingSound=Sound'UnrealShare.Eightball.Loading'
     SelectSound=Sound'UnrealShare.Eightball.Selecting'
     Misc1Sound=Sound'UnrealShare.Eightball.SeekLock'
     Misc2Sound=Sound'UnrealShare.Eightball.SeekLost'
     Misc3Sound=Sound'UnrealShare.Eightball.BarrelMove'
     DeathMessage="%o was smacked down multiple times by %k's %w."
     AutoSwitchPriority=5
     InventoryGroup=5
     PickupMessage="You got the Eightball gun"
     ItemName="Eightball"
     PlayerViewOffset=(X=1.900000,Z=-1.890000)
     PlayerViewMesh=Mesh'UnrealShare.EightB'
     BobDamping=0.985000
     PickupViewMesh=Mesh'UnrealShare.EightPick'
     ThirdPersonMesh=Mesh'UnrealShare.8Ball3rd'
     PickupSound=Sound'UnrealShare.Pickups.WeaponPickup'
     Mesh=Mesh'UnrealShare.EightPick'
     bNoSmooth=False
     bMeshCurvy=False
     CollisionHeight=10.000000
}

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:51.711 - Created with UnCodeX