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

UT2k4AssaultFull.ASTurret_LinkTurret


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
//=============================================================================
// ASTurret_LinkTurret
//=============================================================================
// Created by Laurent Delayen
// © 2003, Epic Games, Inc.  All Rights Reserved
//=============================================================================

class ASTurret_LinkTurret extends ASTurret;

#exec OBJ LOAD FILE=Turrets.utx

var     float   Energy, OldEnergy;

// Shield effect actors
var class<Actor>    GenericShieldEffect[2];
var float           NextShieldTime;

var     float   RechargeWait;
var     float   RechargeSpeed;
var     float   LastEnergyUse;

var vector ShieldPivot;

replication
{
    reliable if (Role==ROLE_Authority && bNetDirty && bNetOwner )
        Energy;
}

simulated function UpdateLinkColor( LinkAttachment.ELinkColor Color )
{
    switch ( Color )
    {
        case LC_Gold    :   Skins[2] = material'PowerPulseShaderYellow';    break;
        case LC_Green   :   Skins[2] = material'PowerPulseShader';          break;
        case LC_Red     :   Skins[2] = material'PowerPulseShaderRed';       break;
        case LC_Blue    :   Skins[2] = material'PowerPulseShaderBlue';      break;
    }
    Skins[0] = Combiner'AS_Weapons_TX.LinkTurret.LinkTurret_Skin2_C';
}


simulated function bool CheckRecharge()
{
    return ( Energy<default.Energy && (Level.TimeSeconds > LastEnergyUse + RechargeWait) );
}

// FIXME: move this to a timer...
simulated function Tick(float DeltaTime)
{
    if ( Role == Role_Authority && CheckRecharge() ) 
    {
        // Play Recharge Sound
        Energy += Default.Energy * (DeltaTime / RechargeSpeed);
        if ( Energy >= Default.Energy )
        {
            Energy = Default.Energy;
        }
    }

    super.Tick(DeltaTime);
}

simulated function PlayFiring(optional float Rate, optional name FiringMode )
{
    PlayAnim('Fire', 1.f);
}

simulated function DrawHealthInfo( Canvas C, PlayerController PC );

simulated function DrawVehicleHUD( Canvas C, PlayerController PC )
{
    if ( !PC.bBehindView )
    {
        C.Style = 255;
        C.SetPos(0,0);
        C.DrawColor = class'Canvas'.static.MakeColor(255,255,255);
        C.DrawTile( Material'Turrets.TurretHud2', C.SizeX, C.SizeY, 0, 0, 1024, 768 );
    }
    super.DrawVehicleHUD( C, PC );
}

simulated function DrawWeaponInfo( Canvas C, HUD H )
{
    local float     XL, YL;
    local float     E, XO, YO, myfPulse;

    C.Style = ERenderStyle.STY_Alpha;

    XL = 256 * 0.5 * H.ResScaleX * H.HUDScale;
    YL = 128 * 0.5 * H.ResScaleY * H.HUDScale;

    // Team color overlay
    C.DrawColor = class'HUD_Assault'.static.GetTeamColor( Team );
    C.SetPos( C.ClipX - XL, C.ClipY - YL );
    C.DrawTile(Texture'AS_FX_TX.HUD.SpaceHUD_Weapon_Grey', XL, YL, 0, 0, 256, 128);

    // Solid Background
    C.DrawColor = class'Canvas'.Static.MakeColor(255, 255, 255);
    C.SetPos( C.ClipX - XL, C.ClipY - YL );
    C.DrawTile(WeaponInfoTexture, XL, YL, 0, 0, 256, 128);

    E = Energy / default.Energy;
    XL = 53 * 0.5 * H.ResScaleX * H.HUDScale;
    YL = 10 * 0.5 * H.ResScaleY * H.HUDScale;
    XO = C.ClipX - 57 * 0.5 * H.ResScaleX * H.HUDScale;
    YO = C.ClipY - 63 * 0.5 * H.ResScaleY * H.HUDScale;

    C.DrawColor = class'HUD_Assault'.static.GetGYRColorRamp( E );
    C.DrawColor.A = 96;

    if ( E == 1.f )
    {
        // Ugly hack FIXME
        if ( HUD_Assault(H) != None )
            myfPulse = HUD_Assault(H).fPulse;
        else
            myfPulse = 1.f;

        C.DrawColor = C.DrawColor * myfPulse + class'Canvas'.Static.MakeColor(255, 255, 255) * (1.f-myfPulse);
        C.DrawColor.A = 128 + 127 * ( 1.f - myfPulse );
    }

    C.SetPos( XO - XL*0.5, YO - YL*0.5 );
    C.DrawTile(Texture'InterfaceContent.WhileSquare', XL*E, YL, 0, 0, 8, 8);
}


simulated function vector FPVAdjustBeamStart()
{
    local float             XOffset;
    local float             ZoomPct;
    local PlayerController  PC;

    PC = PlayerController(Controller);
    if ( PC != None && IsLocallyControlled() && !PC.bBehindView )
    {
        ZoomPct = 1 - (PC.FOVAngle-MinPlayerFOV) / (PC.DefaultFOV-MinPlayerFOV);
        XOffset = -160 * (1-ZoomPct);
    }

    return GetFireStart( XOffset );
}

simulated function PostZoomAdjust( float ZoomPct )
{
    // Fudge the weapon effects so they look right
    if ( Weapon != None )
        Weapon.SmallViewOffset.X = Weapon.default.SmallViewOffset.X - (ZoomWeaponOffsetAdjust * ZoomPct);
}

function PossessedBy(Controller C)
{
    super.PossessedBy(C);

    if ( Weapon != None )
        Weapon.SmallViewOffset.X = -25;
}


simulated function bool SpecialCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
{
    local bool b;
    
    b = super.SpecialCalcView(ViewActor, CameraLocation, CameraRotation );
    if ( Driver != None )
        Driver.bOwnerNoSee = false;

    return b;
}

function AdjustDriverDamage(out int Damage, Pawn InstigatedBy, Vector HitLocation, out Vector Momentum, class<DamageType> DamageType)
{
    super.AdjustDriverDamage(Damage, InstigatedBy, HitLocation, Momentum, DamageType);

    if ( PlayerController(Controller) != None )
        PlayerController(Controller).ClientFlash(DamageType.Default.FlashScale,DamageType.Default.FlashFog);
}

function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation,
                        Vector momentum, class<DamageType> damageType)
{
    local int       OldHealth, EnergyUsed;
    local vector    x,y,z,v;

    if ( Energy > 0 )
    {
        GetAxes(Rotation, X, Y, Z);
        if ( HitLocation == vect(0,0,0) || HitLocation == Location )
            HitLocation = Location + X * 50;
        V = Normal(HitLocation - Location);
        if ( (V dot X) >= 0 )
        {
            EnergyUsed = Max(float(Damage)*0.67, 1);
            Damage =  Max(float(Damage)*0.33, 1);
        }
    }

    OldHealth = Health;
    if ( Damage > 0 )
        super.TakeDamage(Damage, InstigatedBy, HitLocation, momentum, DamageType);
    
    if ( Health < OldHealth && EnergyUsed > 0 )
    {
        UseEnergy( EnergyUsed );
        if ( Role == Role_Authority )
            DoShieldEffect(HitLocation, Normal(HitLocation - Location) );
    }
}

function UseEnergy(int Amount)
{
    LastEnergyUse = Level.TimeSeconds;
    Energy = FMax(Energy-Amount, 0);
}

function DoShieldEffect(vector HitLocation, vector HitNormal)
{
    local Actor ShieldEffect;
    local byte  TeamShield;

    if ( Team > 1 )
        TeamShield = 1;
    else
        TeamShield = Team;

    if ( EffectIsRelevant(HitLocation, true) && NextShieldTime < Level.TimeSeconds )
    {
        NextShieldTime = Level.TimeSeconds + 0.1;
        ShieldEffect = Spawn(GenericShieldEffect[TeamShield], Self,, HitLocation + HitNormal * 10, rotator(HitNormal));
    }
}

static function StaticPrecache(LevelInfo L)
{
    super.StaticPrecache( L );

    L.AddPrecacheMaterial( Material'AS_Weapons_TX.LinkTurret.LinkTurret_skin1' );       // Skins
    L.AddPrecacheMaterial( Material'AS_Weapons_TX.LinkTurret.LinkTurret_skin2' );
    L.AddPrecacheMaterial( material'PowerPulseShader' );
    L.AddPrecacheMaterial( material'PowerPulseShaderRed' );
    L.AddPrecacheMaterial( material'PowerPulseShaderBlue' );
    
    L.AddPrecacheMaterial( Material'Turrets.TurretHud2' );  // HUD
    L.AddPrecacheMaterial( Texture'AS_FX_TX.HUD.SpaceHUD_Weapon_Grey' );
    L.AddPrecacheMaterial( Texture'InterfaceContent.WhileSquare' );

    L.AddPrecacheMaterial( Material'ExplosionTex.Framed.exp7_frames' );         // Explosion Effect
    L.AddPrecacheMaterial( Material'EpicParticles.Flares.SoftFlare' );
    L.AddPrecacheMaterial( Material'AW-2004Particles.Fire.MuchSmoke2t' );
    L.AddPrecacheMaterial( Material'AS_FX_TX.Trails.Trail_red' );
    L.AddPrecacheMaterial( Material'ExplosionTex.Framed.exp1_frames' );
    L.AddPrecacheMaterial( Material'EmitterTextures.MultiFrame.rockchunks02' );

    L.AddPrecacheMaterial( Texture'AS_FX_TX.Flares.Laser_Flare' );  // Fire Effect
    L.AddPrecacheMaterial( Texture'EpicParticles.Smoke.StellarFog1aw' );
    L.AddPrecacheStaticMesh( StaticMesh'AS_Weapons_SM.Projectiles.Skaarj_Energy' );

    L.AddPrecacheStaticMesh( StaticMesh'AS_Weapons_SM.Turret.LinkBase' );
    
    //L.AddPrecacheMaterial( Material'AS_FX_TX.WhiteShield_FB' );		// Shield Effect
    //L.AddPrecacheStaticMesh( StaticMesh'LinkTurretShield' );
    L.AddPrecacheStaticMesh( StaticMesh'WeaponStaticMesh.Shield' );
    L.AddPrecacheMaterial( Material'XEffectMat.RedShell' );
    L.AddPrecacheMaterial( Material'XEffectMat.BlueShell' );
}

simulated function UpdatePrecacheStaticMeshes()
{
    Level.AddPrecacheStaticMesh( StaticMesh'AS_Weapons_SM.Turret.LinkBase' );
    //Level.AddPrecacheStaticMesh( StaticMesh'LinkTurretShield' );
    Level.AddPrecacheStaticMesh( StaticMesh'AS_Weapons_SM.Projectiles.Skaarj_Energy' );
    Level.AddPrecacheStaticMesh( StaticMesh'WeaponStaticMesh.Shield' );

    super.UpdatePrecacheStaticMeshes();
}


simulated function UpdatePrecacheMaterials()
{
    Level.AddPrecacheMaterial( Material'AS_Weapons_TX.LinkTurret.LinkTurret_skin1' );       // Skins
    Level.AddPrecacheMaterial( Material'AS_Weapons_TX.LinkTurret.LinkTurret_skin2' );
    Level.AddPrecacheMaterial( material'PowerPulseShader' );
    Level.AddPrecacheMaterial( material'PowerPulseShaderRed' );
    Level.AddPrecacheMaterial( material'PowerPulseShaderBlue' );
    Level.AddPrecacheMaterial( material'PowerPulseShaderYellow' );
    
    //Level.AddPrecacheMaterial( Material'AS_FX_TX.WhiteShield_FB' );	
    Level.AddPrecacheMaterial( Material'XEffectMat.RedShell' );
    Level.AddPrecacheMaterial( Material'XEffectMat.BlueShell' );

    Level.AddPrecacheMaterial( Material'Turrets.TurretHud2' );  // HUD
    Level.AddPrecacheMaterial( Texture'AS_FX_TX.HUD.SpaceHUD_Weapon_Grey' );
    Level.AddPrecacheMaterial( Texture'InterfaceContent.WhileSquare' );

    Level.AddPrecacheMaterial( Material'ExplosionTex.Framed.exp7_frames' );         // Explosion Effect
    Level.AddPrecacheMaterial( Material'EpicParticles.Flares.SoftFlare' );
    Level.AddPrecacheMaterial( Material'AW-2004Particles.Fire.MuchSmoke2t' );
    Level.AddPrecacheMaterial( Material'AS_FX_TX.Trails.Trail_red' );
    Level.AddPrecacheMaterial( Material'ExplosionTex.Framed.exp1_frames' );
    Level.AddPrecacheMaterial( Material'EmitterTextures.MultiFrame.rockchunks02' );

    Level.AddPrecacheMaterial( Texture'AS_FX_TX.Flares.Laser_Flare' );  // Fire Effect
    Level.AddPrecacheMaterial( Texture'EpicParticles.Smoke.StellarFog1aw' );

    super.UpdatePrecacheMaterials();
}

defaultproperties
{
     Energy=1500.000000
     GenericShieldEffect(0)=Class'UT2k4AssaultFull.FX_SpaceFighter_Shield_Red'
     GenericShieldEffect(1)=Class'UT2k4AssaultFull.FX_SpaceFighter_Shield'
     RechargeWait=4.000000
     RechargeSpeed=10.000000
     TurretBaseClass=Class'UT2k4AssaultFull.ASTurret_LinkTurret_Base'
     TurretSwivelClass=Class'UT2k4AssaultFull.ASTurret_LinkTurret_Swivel'
     RotationInertia=0.500000
     RotPitchConstraint=(Min=8000.000000,Max=5000.000000)
     RotationSpeed=5.000000
     CamRelLocation=(X=250.000000,Z=150.000000)
     CamDistance=(Z=0.000000)
     ZoomWeaponOffsetAdjust=275.000000
     WeaponInfoTexture=Texture'AS_FX_TX.HUD.SpaceHUD_Weapon_Solid_Skaarj'
     DefaultWeaponClassName="UT2k4AssaultFull.Weapon_LinkTurret"
     VehicleProjSpawnOffset=(X=220.000000,Y=0.000000,Z=15.000000)
     bCHZeroYOffset=False
     bRelativeExitPos=False
     bHideRemoteDriver=True
     AutoTurretControllerClass=Class'UT2k4AssaultFull.LinkTurretController'
     DriveAnim="Biggun_Aimed"
     VehiclePositionString="manning a Link Turret"
     VehicleNameString="Link Turret"
     HealthMax=400.000000
     Health=400
     Mesh=SkeletalMesh'AS_VehiclesFull_M.LinkBody'
     DrawScale=0.300000
     CollisionHeight=116.000000
     bNetNotify=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 23/10/2006 20:40:04.000 - Creation time: Wed 7/2/2007 19:16:34.203 - Created with UnCodeX