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

OnslaughtBP.ONSDualAttackCraft


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
//-----------------------------------------------------------
//
//-----------------------------------------------------------
class ONSDualAttackCraft extends ONSAttackCraft;

#exec OBJ LOAD FILE=ONSBPTextures.utx
#exec OBJ LOAD FILE=CicadaTex.utx
#exec OBJ LOAD FILE=CicadaSnds.uax

var	bool	bHeatSeeker;
var byte 	LastThrust;			// The last throttle position
var float 	DesiredPitch;
var float 	CurrentPitch;
var float 	PitchTime;

var rotator	FanYaw,TailYaw;
var float 	FanYawRate;

var int		LastYaw, DesiredYaw;
var float	YawTime;

var array<ONSDecoy> Decoys;

var 			Material 	LockedTexture;
var 			Material 	LockedEffect;
var localized 	string	 	LockedMsg;

var() HudBase.SpriteWidget HudMissileCount, HudMissileIcon;
var() HudBase.NumericWidget HudMissileDigits;
var() HudBase.DigitSet DigitsBig;

var vector OldLockedTarget;

// Hud Elements

var float LastHudRenderTime;	// Needed for animations
var bool  bLastLockType;

var localized string CoPilotLabel;

// --- All this for a cool crosshair ;)

// Animation Data.

struct AnimData
{
	var int			 key;		// Current Key-Frame
	var array<float> Value;		// Value being worked with
	var array<float> Dest;		// Dest for this value to head towards
	var array<float> Time;		// How fast should it get there
	var array<float> Delay;		// Should there be a delay before this frame begins
	var array<name>  Tags;		// Tag for the "event" when the frame is done
};

// The 2 circles

var AnimData SpinScale[2];		// Handles the Circle's scaling
var AnimData SpinFade[2];		// Hanldes the Circle's Fading
var AnimData SpinRot[2];		// Handles the Circle's Rotation

// The Brackets

var AnimData BracketScale;		// Handles the Brackets Scaling
var AnimData BracketFade;		// Handles the Brackets Fading

// The Missiles

var AnimData MissileFade;		// How bright is the missile count

//     Textures

var TexRotator SpinCircles[2];
var texture Brackets;
var texture MissileTick;

var int LastMissileCnt;
var bool bFreelanceStart;

// AI hint
function bool ImportantVehicle()
{
	return !bFreelanceStart;
}

simulated function ClientKDriverEnter(PlayerController PC)
{
	bHeadingInitialized = False;

	Super.ClientKDriverEnter(PC);
}

function KDriverEnter(Pawn P)
{
	Super.KDriverEnter(P);

	bHeadingInitialized = False;
    Weapons[1].bActive = True;
	bFreelanceStart = ( (Bot(Controller) != None) && (Bot(Controller).Squad != None) && Bot(Controller).Squad.bFreelance && !ONSTeamAI(Bot(Controller).Squad.Team.AI).bAllNodesTaken );
}

simulated function SpecialCalcBehindView(PlayerController PC, out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
{
	local vector CamLookAt, HitLocation, HitNormal, OffsetVector;
	local Actor HitActor;
    local vector x, y, z;

	if (DesiredTPCamDistance < TPCamDistance)
		TPCamDistance = FMax(DesiredTPCamDistance, TPCamDistance - CameraSpeed * (Level.TimeSeconds - LastCameraCalcTime));
	else if (DesiredTPCamDistance > TPCamDistance)
		TPCamDistance = FMin(DesiredTPCamDistance, TPCamDistance + CameraSpeed * (Level.TimeSeconds - LastCameraCalcTime));

    GetAxes(PC.Rotation, x, y, z);
	ViewActor = self;
	CamLookAt = GetCameraLocationStart() + (TPCamLookat >> Rotation) + TPCamWorldOffset;

	OffsetVector = vect(0, 0, 0);
	OffsetVector.X = -1.0 * TPCamDistance;

	CameraLocation = CamLookAt + (OffsetVector >> PC.Rotation);

	HitActor = Trace(HitLocation, HitNormal, CameraLocation, Location, true, vect(40, 40, 40));
	if ( HitActor != None
	     && (HitActor.bWorldGeometry || HitActor == GetVehicleBase() || Trace(HitLocation, HitNormal, CameraLocation, Location, false, vect(40, 40, 40)) != None) )
			CameraLocation = HitLocation;

    CameraRotation = Normalize(PC.Rotation + PC.ShakeRot);
    CameraLocation = CameraLocation + PC.ShakeOffset.X * x + PC.ShakeOffset.Y * y + PC.ShakeOffset.Z * z;
}

// - CenterDraw - Draws an images centered around a point.  Optionally, it can stretch the image.
simulated function CenterDraw(Canvas Canvas, Material Mat, float x, float y, float UScale, float VScale, optional bool bStretched)
{
	local float u,v,w,h;

	u = Mat.MaterialUSize(); w = u * UScale;
	v = Mat.MaterialVSize(); h = v * VScale;
	Canvas.SetPos(x - (w/2), y - (h/2) );
	if (!bStretched)
		Canvas.DrawTile(Mat,w,h,0,0,u,v);
	else
		Canvas.DrawTileStretched(Mat,w,h);
}

// - Update the data for a single animdata object.
simulated function UpdateAnimData(out AnimData Data, float Deltatime)
{

	local float key;
	if (Data.key >= Data.Value.Length)
		return;

	Key = Data.Key;

	if ( Data.Delay[Key] <= 0 )		// Make sure we aren't delaying this object
	{
		if ( Data.Time[Key] > 0 )		// Current keyframe
		{

			// Prefigure the constraint check for later on (ie: are we increasing or decreasing towards the Dest.
			// The constraint is critical for fades.

			if ( Data.Value[Key] < Data.Dest[Key] )
			{
				// Interpolate

				Data.Value[Key] += (Data.Dest[Key] - Data.Value[Key]) * (DeltaTime / Data.Time[Key]);
				if (Data.Value[Key] > Data.Dest[Key])
					Data.Value[Key] = Data.Dest[Key];
			}
			else
			{
				// Interpolate

				Data.Value[Key] += (Data.Dest[Key] - Data.Value[Key]) * (DeltaTime / Data.Time[Key]);
				if (Data.Value[Key] < Data.Dest[Key])
					Data.Value[Key] = Data.Dest[Key];
			}

			Data.Time[Key] -= Deltatime;
		}
		else
		{
			// Trigger an event if the frame changes

			AnimFrameChange(Data.Tags[Key]);
	    	Data.Key++;
		}

	}
	else
		Data.Delay[Key]-= DeltaTime;		// Count down the delay

}

// ClearAnimData - Scrubs the various arrays inside the struct
simulated function ClearAnimData(out AnimData Data)
{
	Data.Value.Remove(0,Data.Value.Length);
	Data.Dest.Remove(0,Data.Dest.Length);
	Data.Time.Remove(0,Data.Time.Length);
	Data.Delay.Remove(0,Data.Delay.Length);
	Data.Tags.Remove(0,Data.Tags.Length);
	Data.Key=0;
}

// AddAnimData - Adds data to the array.  Have to do it here since object creation in defprops doesn't
// support arrays within a struct
simulated function AddAnimData(out AnimData Data, float NewValue, float NewDest, float NewTime, optional float NewDelay, optional name NewTag)
{
	local int key;

	Key = Data.Value.Length + 1;
	Data.Value.Length 	= Key; 	Data.Value[Key-1] 	= NewValue;
	Data.Dest.Length 	= Key;	Data.Dest[Key-1] 	= NewDest;
	Data.Time.Length 	= Key;	Data.Time[Key-1]	= NewTime;
	Data.Delay.Length 	= Key;	Data.Delay[Key-1]	= NewDelay;
	Data.Tags.Length 	= Key;  Data.Tags[Key-1]	= NewTag;
}

// Value - Returns the current value of the AnimStruct.  If it's past the final key-frame,
// it returns the final values.
simulated function float Value(AnimData Data)
{
	if (Data.Key<Data.Value.Length)
		return Data.Value[Data.Key];
	else
		return Data.Value[Data.Value.Length-1];
}

// AnimFrameChange - Called when a the fame of a AnimData struc in incremented.

simulated function AnimFrameChange(name Tag)
{
	if (Tag=='Circ0Done')
	{
		SpinCircles[0].TexRotationType= TR_ConstantlyRotating;
		SpinCircles[0].Rotation.Yaw = 24000;
	}
	else if (Tag=='Circ1Done')
	{
		SpinCircles[1].TexRotationType= TR_ConstantlyRotating;
		SpinCircles[1].Rotation.Yaw = -24000;
	}
}

// Animate - Animate the various components of the crosshair
simulated function Animate(Canvas Canvas, float DeltaTime)
{
	local int i;

	for (i=0;i<2;i++)
	{
		UpdateAnimData(SpinScale[i],DeltaTime);
		UpdateAnimData(SpinFade[i],DeltaTime);
		UpdateAnimData(SpinRot[i],DeltaTime);

		if ( SpinCircles[i].TexRotationType == TR_FixedRotation )
			SpinCircles[i].Rotation.Yaw = Value(SpinRot[i]);
	}

	UpdateAnimData(BracketScale,DeltaTime);
	UpdateAnimData(BracketFade,DeltaTime);
	UpdateAnimData(MissileFade,DeltaTime);
}



simulated function ResetAnimation()
{

	ClearAnimData(SpinScale[0]);
	ClearAnimData(SpinScale[1]);
	ClearAnimData(SpinFade[0]);
	ClearAnimData(SpinFade[1]);
	ClearAnimData(SpinRot[0]);
	ClearAnimData(SpinRot[1]);

	SpinCircles[0].TexRotationType = TR_FixedRotation;
	SpinCircles[1].TexRotationType = TR_FixedRotation;

	ClearAnimData(BracketScale);
	ClearAnimData(BracketFade);

    // Circile 0

	AddAnimData(SpinScale[0], 2.25, 0.65, 0.75,0.0);
	AddAnimData(SpinFade[0],1.0,255,0.5,0.0);
	AddAnimData(SpinRot[0],65535,49152,0.75,0.0,'Circ0Done');

	// Circle 1

	AddAnimData(SpinScale[1],2.25,1.3,0.75,0.25);
	AddAnimData(SpinFade[1],1.0,200,0.5,0.25);
	AddAnimData(SpinFade[1],255,150,0.25,0.0);
	AddAnimData(SpinRot[1],0.0,16384,0.75,0.25,'Circ1Done');

	// Circle 2

	AddAnimData(BracketScale, 0.1, 0.0, 0.35, 0.5);
	AddAnimData(BracketFade,1.0,255,0.15,0.5);

	LastMissileCnt=0;

}

simulated function DrawBrackets(Canvas Canvas, float CX, float CY, float Scale)
{
	local float x,y;

	X = CX - (16*Scale) - (19*Scale) - ( Canvas.ClipX * Value(BracketScale) );
	Y = CY - (30*Scale);

	Canvas.SetPos(X,Y);
	Canvas.DrawTile(Brackets,19*Scale,64*Scale,19,30,19,64);
	X = CX + (16*Scale) + ( Canvas.ClipX * Value(BracketScale) );
	Canvas.SetPos(X,Y);
	Canvas.DrawTile(Brackets,19*Scale,60*Scale,88,30,19,64);

}

simulated function DrawMissiles(Canvas Canvas, float CX, float CY, float scale)
{

	local int h,MissileCnt;
	local float x1,x2,y;

	MissileCnt = ONSDualACSideGun(Weapons[0]).LoadedShotCount;
	h = (MissileCnt / 2) * 8;
	if (h>0)
	{
    	if (LastMissileCnt!=h)
    	{
    	 	ClearAnimData(MissileFade);
			AddAnimData(MissileFade,0,255,0.33,0.10);
    	}

		y  = (CY + (32*Scale) - (h*Scale) );
		x1 = (CX - (51*Scale));
		x2 = (CX + (18*Scale));

		Canvas.SetPos(x1,y);
		Canvas.DrawTile(MissileTick,32*Scale,h*Scale,0,64-h,32,h);
		Canvas.SetPos(x2,y);
		Canvas.DrawTile(MissileTick,32*Scale,h*Scale,32,64-h,-32,h);

		Canvas.SetDrawColor(255,255,255,Value(MissileFade));

		Canvas.SetPos(x1,y);
		Canvas.DrawTile(MissileTick,32*Scale,8*Scale,0,64-h,32,8);
		Canvas.SetPos(x2,y);
		Canvas.DrawTile(MissileTick,32*Scale,8*Scale,32,64-h,-32,8);
	}
	LastMissileCnt = h;
}

simulated function DrawHUD(Canvas Canvas)
{
	local vector X,Y,Z, Dir, LockedTarget;
	local float Dist,scale,xl,yl,posy;
	local PlayerController PC;
//	local ONSHudOnslaught H;
	local HudCDeathmatch H;

	local bool bIsLocked;
	local float DeltaTime;

	local string CoPilot;

	if ( !ONSDualACSideGun(Weapons[0]).bLocked )
		super.DrawHud(Canvas);

    DeltaTime = Level.TimeSeconds - LastHudRenderTime;
	LastHudRenderTime = Level.TimeSeconds;

	bIsLocked = ONSDualACSideGun(Weapons[0]).bLocked;

	PC = PlayerController(Owner);
	if (PC==None)
		return;

//	H = ONSHudOnslaught(PC.MyHud);
	H = HudCDeathmatch(PC.MyHud);
	if (H==None)
		return;

	if ( ONSDualACSideGun(Weapons[0]).bLocked )
	{
		if (bIsLocked != bLastLockType)	// Initialize the Crosshair
			ResetAnimation();

		Animate(Canvas,DeltaTime);

	    GetAxes(PC.GetViewRotation(), X,Y,Z);

	    LockedTarget = ONSDualACSideGun(Weapons[0]).LockedTarget;
	    if (OldLockedTarget != LockedTarget)
			PlaySound(Sound'CicadaSnds.Hud.TargetLock', SLOT_None, 2.0);

	    OldLockedTarget = LockedTarget;

		Dir = LockedTarget - Location;
		Dist = VSize(Dir);
		Dir = Dir/Dist;

	    if ( (Dir dot X) > 0.4 )
	    {
			// Draw the Locked on Symbol
			Dir = Canvas.WorldToScreen( LockedTarget );
			scale = float(Canvas.SizeX) / 1600;

			// new Stuff

			Canvas.SetDrawColor( 64,255,64,Value(SpinFade[0]) );
			CenterDraw(Canvas, SpinCircles[0], Dir.X, Dir.Y, Value(SpinScale[0])*Scale, Value(SpinScale[0])*Scale );
			Canvas.SetDrawColor(64,255,64,Value(SpinFade[1]) );
			CenterDraw(Canvas, SpinCircles[1], Dir.X, Dir.Y, Value(SpinScale[1])*Scale, Value(SpinScale[1])*Scale );

			Canvas.SetDrawColor(128,255,128,Value(BracketFade));
			DrawBrackets(Canvas,Dir.X,Dir.Y,Scale);
			DrawMissiles(Canvas,Dir.X,Dir.Y,Scale);

		}
	}

	bLastLockType = bIsLocked;

	HudMissileCount.Tints[0] = H.HudColorRed;
	HudMissileCount.Tints[1] = H.HudColorBlue;

	H.DrawSpriteWidget( Canvas, HudMissileCount );
	H.DrawSpriteWidget( Canvas, HudMissileIcon );
	HudMissileDigits.Value = ONSDualACSideGun(Weapons[0]).LoadedShotCount;
	H.DrawNumericWidget(Canvas, HudMissileDigits, DigitsBig);

	if (WeaponPawns[0]!=none && WeaponPawns[0].PlayerReplicationInfo!=None)
	{
		CoPilot = WeaponPawns[0].PlayerReplicationInfo.PlayerName;
		Canvas.Font = H.GetMediumFontFor(Canvas);
		Canvas.Strlen(CoPilot,xl,yl);
		posy = Canvas.ClipY*0.7;
		Canvas.SetPos(Canvas.ClipX-xl-5, posy);//(Canvas.ClipY/2) - (YL/2));
		Canvas.SetDrawColor(255,255,255,255);
		Canvas.DrawText(CoPilot);

		Canvas.Font = H.GetConsoleFont(Canvas);
        Canvas.StrLen(CoPilotLabel,xl,yl);
        Canvas.SetPos(Canvas.ClipX-xl-5,posy-5-yl);
		Canvas.SetDrawColor(160,160,160,255);
		Canvas.DrawText(CoPilotLabel);
	}

}

simulated function PostNetBeginPlay()
{
    Super.PostNetBeginPlay();

    if (Role == ROLE_Authority)
	{
		if (WeaponPawns[0]!=None)
		    WeaponPawns[0].Gun.SetOwner(self);

		if (Weapons.Length == 2 && ONSLinkableWeapon(Weapons[0]) != None)
    {
        ONSLinkableWeapon(Weapons[0]).ChildWeapon = Weapons[1];
        if (ONSDualACSideGun(Weapons[1]) != None)
            ONSDualACSideGun(Weapons[1]).bSkipFire = True;

	        if (ONSDualACSideGun(Weapons[0]) != None)
	            ONSDualACSideGun(Weapons[0]).bFiresRight = true;
	    }

    }
}

function DriverLeft()
{
    Super.DriverLeft();
    Weapons[1].bActive = False;
}

simulated function Tick(float DeltaTime)
{
	local rotator 	Adjusted,EnginePitch;
	local int 		Yaw;
	local actor		HitActor;
	local vector	HitLocation, HitNormal;
	local float GroundDist;

	super.Tick(DeltaTime);

	if ( !IsVehicleEmpty() )
		Enable('tick');

	if ( (Bot(Controller) != None) && !Controller.InLatentExecution(Controller.LATENT_MOVETOWARD)  )
	{
		if ( Rise < 0 )
		{
			if ( Velocity.Z < 0 )
			{
				if ( Velocity.Z < -2000 )
					Rise = -0.1;

				// FIX - use dist to adjust down as get closer
				HitActor = Trace(HitLocation, HitNormal, Location - vect(0,0,2000), Location, false);
				if ( HitActor != None )
				{
					GroundDist = Location.Z - HitLocation.Z;
					if ( GroundDist/(-1*Velocity.Z) < 0.85 )
						Rise = 1.0;
				}
			}
		}
		else if ( Rise == 0 )
		{
			if ( !FastTrace(Location - vect(0,0,300),Location) )
				Rise = FClamp((-1 * Velocity.Z)/MaxRiseForce,0.f,1.f);
		}
	}
	// Adjust the various effects

    if (Level.NetMode != NM_DedicatedServer)
	{
		if (LastThrust != CopState.ServerThrust)
		{
			if (CopState.ServerThrust<128)
				DesiredPitch = -10240;
			else if (CopState.ServerThrust>128)
				DesiredPitch = 10240;
			else
				DesiredPitch = 0;

			PitchTime = 1.0;
			LastThrust = CopState.ServerThrust;
		}
		if (CurrentPitch != DesiredPitch)
		{

			CurrentPitch += (DesiredPitch - CurrentPitch) * (DeltaTime / PitchTime);
			PitchTime -= DeltaTime;

			if (PitchTime<=0 || DesiredPitch == CurrentPitch)
			{
				PitchTime = 0.0;
				DesiredPitch = CurrentPitch;
			}
		}

		FanYaw.Yaw += FanYawRate * DeltaTime;

		EnginePitch.Pitch = CurrentPitch;
		SetBoneRotation('Engines',	 EnginePitch);
		SetBoneRotation('Fans_Left', FanYaw);
		SetBoneRotation('Fans_Right',FanYaw);

		Yaw = Rotation.Yaw;	// Give some deadzone
		if (Yaw != LastYaw)
		{
			if ( (Yaw>0 && LastYaw>0) || (Yaw<0 && LastYaw<0) )	// Skip sign changes
			{
				if (LastYaw>Yaw)
					DesiredYaw=-6144;
				else
					DesiredYaw=6144;

				YawTime = 1.0;
			}
		}
		else
		{
			DesiredYaw=0;
			YawTime = 1.0;
		}

		LastYaw = Yaw;
		if (DesiredYaw != TailYaw.Yaw)
		{
			TailYaw.Yaw += (DesiredYaw-TailYaw.Yaw) * (DeltaTime/YawTime);
			YawTime-= DeltaTime;

			if (YawTime<=0 || DesiredYaw == TailYaw.Yaw)
			{
				YawTime = 0.0;
				TailYaw.Yaw = DesiredYaw;
			}
		}

		Adjusted = TailYaw;

		if (Adjusted.Yaw < -2048)
			Adjusted.Yaw += 2048;

		else if (Adjusted.Yaw > 2048)
			Adjusted.Yaw -= 2048;

		else
			Adjusted.Yaw = 0;

		SetBoneRotation('Rudder',Adjusted);
	}
}

simulated event DrivingStatusChanged()
{
	local vector RotX, RotY, RotZ;
	local int i;

	super(ONSChopperCraft).DrivingStatusChanged();

    if (bDriving && Level.NetMode != NM_DedicatedServer && !bDropDetail)
	{
        GetAxes(Rotation,RotX,RotY,RotZ);

        if (TrailEffects.Length == 0)
        {
            TrailEffects.Length = TrailEffectPositions.Length;

        	for(i=0;i<TrailEffects.Length;i++)
            	if (TrailEffects[i] == None)
            	{
                	TrailEffects[i] = spawn(TrailEffectClass, self,, Location + (TrailEffectPositions[i] >> Rotation) );
                	TrailEffects[i].SetBase(self);
                    TrailEffects[i].SetRelativeRotation( rot(-16384,32768,0) );
                }
        }
    }
    else
    {
        if (Level.NetMode != NM_DedicatedServer)
    	{
        	for(i=0;i<TrailEffects.Length;i++)
        	   TrailEffects[i].Destroy();

        	TrailEffects.Length = 0;
        }
    }
}

// Check all of the active decoys and see if any take effect.

event bool VerifyLock(actor Aggressor, out actor NewTarget)
{
	local int i;

	for (i=0;i<Decoys.Length;i++)
	{
		if ( Decoys[i].CheckRange(Aggressor) )
		{
			NewTarget = Decoys[i];
			return false;
		}
	}

	return true;
}

function Vehicle FindEntryVehicle(Pawn P)
{
	local Bot B, S;

	B = Bot(P.Controller);
	if ( (B == None) || !IsVehicleEmpty() || (WeaponPawns[0].Driver != None) )
		return Super.FindEntryVehicle(P);

	for ( S=B.Squad.SquadMembers; S!=None; S=S.NextSquadMember )
	{
		if ( (S != B) && (S.RouteGoal == self) && S.InLatentExecution(S.LATENT_MOVETOWARD)
			&& ((S.MoveTarget == self) || (Pawn(S.MoveTarget) == None)) )
			return WeaponPawns[0];
	}
	return Super.FindEntryVehicle(P);
}

function bool RecommendLongRangedAttack()
{
	return true;
}

function float RangedAttackTime()
{
	local ONSDualACSideGun G;

	G = ONSDualACSideGun(Weapons[0]);
	if ( G.LoadedShotCount > 0 )
		return (0.05 + (G.MaxShotCount - G.LoadedShotCount) * G.FireInterval);
	return 1;
}

function ShouldTargetMissile(Projectile P)
{
}

// LockOnWarning() called every LockWarningInterval when bEnemyLockedOn is true (on server/standalone)
event LockOnWarning()
{
	local	class<LocalMessage>	LockOnClass;
	local   PlayerController PC;
	local  byte LockNum;

	if ( bHeatSeeker )
	{
		LockNum = 31;
		bHeatSeeker = false;
	}
	else
		LockNum = 12;

	LockOnClass = class<LocalMessage>(DynamicLoadObject(LockOnClassString, class'class'));

	PC = PlayerController(Controller);
	if (PC!=None)
		PC.ReceiveLocalizedMessage(LockOnClass, LockNum);

	if (WeaponPawns[0]!=None)
	{
		PC = PlayerController(WeaponPawns[0].Controller);
		if (PC!=None)
			PC.ReceiveLocalizedMessage(LockOnClass, LockNum);
	}

    LastLockWarningTime = Level.TimeSeconds;
}

function IncomingMissile(Projectile P)
{
	bHeatSeeker = true;
	if ( WeaponPawns.Length > 0 )
		ONSDualACGatlingGunPawn(WeaponPawns[0]).IncomingMissile(P);
}

function Died(Controller Killer, class<DamageType> damageType, vector HitLocation)
{
    bDriving = False;
    Super.Died(Killer, damageType, HitLocation);
}

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

	L.AddPrecacheStaticMesh(StaticMesh'VMWeaponsSM.PlayerWeaponsGroup.bomberBomb');

    L.AddPrecacheMaterial(Material'ONSBPTextures.Skins.CicadaGreen');
    L.AddPrecacheMaterial(Material'ONSBPTextures.Skins.CicadaTan');
    L.AddPrecacheMaterial(Material'ONSInterface-TX.tankBarrelAligned');
    L.AddPrecacheMaterial(Material'CicadaTex.HUD.RocketIcon');
    L.AddPrecacheMaterial(Material'VMWeaponsTX.PlayerWeaponsGroup.bomberBomb');
    L.AddPrecacheMaterial(Material'AW-2k4XP.Weapons.ShockTankEffectCore2Ga');
    L.AddPrecacheMaterial(Material'AW-2k4XP.Cicada.MissileTrail1a');
    L.AddPrecacheMaterial(Material'CicadaTex.HUD.ONS_Cic_Circle');
    L.AddPrecacheMaterial(Material'CicadaTex.HUD.ONS_Cic_Brackets');
    L.AddPrecacheMaterial(Material'XEffectMat.Ion.painter_beam');
    L.AddPrecacheMaterial(Material'CicadaTex.HUD.ONS_Cic_Missles');
    L.AddPrecacheMaterial(Material'XGameTextures.SuperPickups.DOMpointLINESg');
    L.AddPrecacheMaterial(Material'Turrets.Huds.TurretHud2');
    L.AddPrecacheMaterial(Material'AW-2k4XP.Cicada.LongSpark');
    L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.PlasmaFlare');
}

simulated function UpdatePrecacheStaticMeshes()
{
	Level.AddPrecacheStaticMesh(StaticMesh'VMWeaponsSM.PlayerWeaponsGroup.bomberBomb');

	Super.UpdatePrecacheStaticMeshes();
}

simulated function UpdatePrecacheMaterials()
{
    Level.AddPrecacheMaterial(Material'ONSBPTextures.Skins.CicadaGreen');
    Level.AddPrecacheMaterial(Material'ONSBPTextures.Skins.CicadaTan');
    Level.AddPrecacheMaterial(Material'ONSInterface-TX.tankBarrelAligned');
    Level.AddPrecacheMaterial(Material'CicadaTex.HUD.RocketIcon');
    Level.AddPrecacheMaterial(Material'VMWeaponsTX.PlayerWeaponsGroup.bomberBomb');
    Level.AddPrecacheMaterial(Material'AW-2k4XP.Weapons.ShockTankEffectCore2Ga');
    Level.AddPrecacheMaterial(Material'AW-2k4XP.Cicada.MissileTrail1a');
    Level.AddPrecacheMaterial(Material'CicadaTex.HUD.ONS_Cic_Circle');
    Level.AddPrecacheMaterial(Material'CicadaTex.HUD.ONS_Cic_Brackets');
    Level.AddPrecacheMaterial(Material'XEffectMat.Ion.painter_beam');
    Level.AddPrecacheMaterial(Material'CicadaTex.HUD.ONS_Cic_Missles');
    Level.AddPrecacheMaterial(Material'XGameTextures.SuperPickups.DOMpointLINESg');
    Level.AddPrecacheMaterial(Material'Turrets.Huds.TurretHud2');
    Level.AddPrecacheMaterial(Material'AW-2k4XP.Cicada.LongSpark');
    Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.PlasmaFlare');

	Super.UpdatePrecacheMaterials();
}

defaultproperties
{
     FanYawRate=98000.000000
     LockedTexture=Texture'CicadaTex.HUD.CicadaLockOn'
     LockedEffect=TexRotator'HUDContent.Reticles.rotDomRing'
     LockedMsg=" Locked "
     HudMissileCount=(WidgetTexture=Texture'HUDContent.Generic.HUD',RenderStyle=STY_Alpha,TextureCoords=(Y1=110,X2=166,Y2=163),TextureScale=0.530000,DrawPivot=DP_LowerRight,PosX=1.000000,PosY=1.000000,ScaleMode=SM_Right,Scale=1.000000,Tints[0]=(B=255,G=255,R=255,A=200),Tints[1]=(B=255,G=255,R=255,A=200))
     HudMissileIcon=(WidgetTexture=Texture'CicadaTex.HUD.RocketIcon',RenderStyle=STY_Alpha,TextureCoords=(X2=32,Y2=64),TextureScale=0.530000,DrawPivot=DP_LowerRight,PosX=1.000000,PosY=1.000000,OffsetX=-15,ScaleMode=SM_Right,Scale=1.000000,Tints[0]=(B=255,G=255,R=255,A=200),Tints[1]=(B=255,G=255,R=255,A=200))
     HudMissileDigits=(RenderStyle=STY_Alpha,TextureScale=0.490000,DrawPivot=DP_MiddleLeft,PosX=0.861000,PosY=1.000000,OffsetX=20,OffsetY=-29,Tints[0]=(B=255,G=255,R=255,A=255),Tints[1]=(B=255,G=255,R=255,A=255))
     DigitsBig=(DigitTexture=Texture'HUDContent.Generic.HUD',TextureCoords[0]=(X2=38,Y2=38),TextureCoords[1]=(X1=39,X2=77,Y2=38),TextureCoords[2]=(X1=78,X2=116,Y2=38),TextureCoords[3]=(X1=117,X2=155,Y2=38),TextureCoords[4]=(X1=156,X2=194,Y2=38),TextureCoords[5]=(X1=195,X2=233,Y2=38),TextureCoords[6]=(X1=234,X2=272,Y2=38),TextureCoords[7]=(X1=273,X2=311,Y2=38),TextureCoords[8]=(X1=312,X2=350,Y2=38),TextureCoords[9]=(X1=351,X2=389,Y2=38),TextureCoords[10]=(X1=390,X2=428,Y2=38))
     CoPilotLabel="Gunner"
     SpinCircles(0)=TexRotator'OnslaughtBP.ONSDualAttackCraft.CicCircle0'
     SpinCircles(1)=TexRotator'OnslaughtBP.ONSDualAttackCraft.CicCircle1'
     Brackets=Texture'CicadaTex.HUD.ONS_Cic_Brackets'
     MissileTick=Texture'CicadaTex.HUD.ONS_Cic_Missles'
     TrailEffectPositions(0)=(X=250.000000,Y=-20.000000,Z=10.000000)
     TrailEffectPositions(1)=(X=250.000000,Y=20.000000,Z=10.000000)
     MaxThrustForce=80.000000
     LongDamping=0.300000
     MaxStrafeForce=65.000000
     MaxRiseForce=200.000000
     RollTorqueTurnFactor=750.000000
     RollTorqueStrafeFactor=100.000000
     RollTorqueMax=100.000000
     PushForce=200000.000000
     DriverWeapons(0)=(WeaponClass=Class'OnslaughtBP.ONSDualACSideGun',WeaponBone="RightRLAttach")
     DriverWeapons(1)=(WeaponClass=Class'OnslaughtBP.ONSDualACSideGun',WeaponBone="LeftRLAttach")
     PassengerWeapons(0)=(WeaponPawnClass=Class'OnslaughtBP.ONSDualACGatlingGunPawn',WeaponBone="GatlingGunAttach")
     RedSkin=Texture'ONSBPTextures.Skins.CicadaTan'
     BlueSkin=Texture'ONSBPTextures.Skins.CicadaGreen'
     IdleSound=Sound'CicadaSnds.Flight.CicadaIdle'
     StartUpSound=Sound'CicadaSnds.Flight.CicadaStartUp'
     ShutDownSound=Sound'CicadaSnds.Flight.CicadaShutdown'
     DestroyedVehicleMesh=StaticMesh'ONSBP_DestroyedVehicles.Cicada.DestroyedCicada'
     DisintegrationEffectClass=Class'OnslaughtBP.ONSDualACDeathExp'
     DisintegrationHealth=-100.000000
     DestructionLinearMomentum=(Min=250000.000000,Max=400000.000000)
     DestructionAngularMomentum=(Max=150.000000)
     ExitPositions(0)=(Y=-400.000000)
     ExitPositions(1)=(Y=400.000000)
     ExitPositions(2)=(X=-600.000000,Z=100.000000)
     EntryPosition=(X=0.000000,Z=-20.000000)
     EntryRadius=300.000000
     TPCamDistance=700.000000
     TPCamWorldOffset=(Z=350.000000)
     VehiclePositionString="in a Cicada"
     VehicleNameString="Cicada"
     HealthMax=500.000000
     Health=500
     Mesh=SkeletalMesh'ONSBPAnimations.DualAttackCraftMesh'
     SoundVolume=255
     SoundRadius=300.000000
     CollisionRadius=240.000000
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: pr 5-2-2018 12:35:56.000 - Creation time: sk 18-3-2018 09:50:14.824 - Created with UnCodeX