‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_airsupport.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\util_shared;
4 
5 #insert scripts\shared\shared.gsh;
6 
7 #using scripts\mp\_rewindobjects;
8 #using scripts\mp\_util;
9 #using scripts\mp\_vehicle;
10 
11 #namespace airsupport;
12 
13 function ‪planeSounds( localClientNum, spawnSound, flybySound, flybySoundLoop )
14 {
15  self endon("delete");
16 
17  playsound (0, spawnSound, (0,0,0));
18  if ( isdefined ( flybySound ) )
19  self playsound (0, flybySound);
20  self playloopsound( flybySoundLoop, 0 );
21 }
22 
23 
24 function ‪getPlaneModel( teamFaction )
25 {
26  planemodel = "t5_veh_jet_f4_gearup";
27  return planeModel;
28 }
29 
30 
31 function ‪planeTurnRight( localClientNum, plane, yaw, halfLife, ‪startTime)
32 {
33  ‪planeTurn( localClientNum, plane, yaw, halfLife, ‪startTime, true );
34 }
35 
36 function ‪planeTurnLeft( localClientNum, plane, yaw, halfLife, ‪startTime )
37 {
38  ‪planeTurn( localClientNum, plane, yaw, halfLife, ‪startTime, false );
39 }
40 
41 function ‪planeTurn( localClientNum, plane, yaw, halfLife, ‪startTime, isTurningRight )
42 {
43  plane endon( "delete" );
44  plane endon( "entityshutdown" );
45  level endon( "demo_jump" + localClientNum );
46 
47  leftTurn = -1;
48  rightTurn = 1;
49 
50  if( isTurningRight )
51  turnDirection = rightTurn;
52  else
53  turnDirection = leftTurn;
54 
55  yawY = GetDvarFloat( "scr_planeyaw", -1.5 * turnDirection );
56  rollZ = GetDvarFloat( "scr_planeroll", 1.5 * turnDirection );
57 
58  maxYaw = GetDvarFloat( "scr_max_planeyaw", -45.0 * turnDirection );
59  minRoll = GetDvarFloat( "scr_min_planeroll", 60.0 * turnDirection );
60 
61  ox = GetDvarFloat( "scr_planeox", 30000.0 );
62  oy = GetDvarFloat( "scr_planeoy", -30000.0 * turnDirection );
63  maxoX = GetDvarFloat( "scr_maxo_planex", -1.0 );
64  maxoY = GetDvarFloat( "scr_maxo_planey", -1.0 );
65 
66  if (plane.angles[1] == 360)
67  plane.angles = ( plane.angles[0], 0, plane.angles[2] );
68 
69  origX = plane.origin[0];
70  origY = plane.origin[1];
71 
72  accumTurn = 0;
73  looptime = 0.1;
74  waitAmount = 0.1;
75  waitForMoveDone = false;
76  while( loopTime <= halflife )
77  {
78  if (plane.angles[1] == 360)
79  plane.angles = ( plane.angles[0], 0, plane.angles[2] );
80 
81  if ( minRoll != -1 && plane.angles[2] >= minRoll * turnDirection )
82  rollZ = 0.0;
83 
84  accumTurn += yawY;
85 
86  if ( accumTurn <= maxYaw * turnDirection )
87  {
88  yawY = 0.0;
89  }
90  angles = ( plane.angles[0], plane.angles[1] + yawY, plane.angles[2] + rollZ);
91 
92  mathX = ( sin ( 45 * looptime / halflife ) ) * ox ;
93  mathY = ( cos ( 45 * looptime / halflife ) ) * oy ;
94 
95  oldX = mathX;
96  oldY = oy - mathY;
97 
98  rotatedX = Cos(yaw) * oldX - Sin(yaw) * oldY;
99  rotatedY = Sin(yaw) * oldX + Cos(yaw) * oldY;
100 
101  endPoint = ( origX + rotatedX, origY + rotatedY, plane.origin[2]);
102  if ( waitForMoveDone )
103  plane waittill( "movedone" );
104  waitForMoveDone = plane ‪rewindobjects::serverTimedMoveTo( localClientNum, plane.origin, endPoint, ‪startTime, waitAmount );
105  plane ‪rewindobjects::serverTimedRotateTo( localClientNum, angles, ‪startTime, waitAmount );
106  loopTime += waitAmount;
107  ‪startTime += waitAmount * 1000;
108  }
109 
110  yawY = GetDvarFloat( "scr_planeyaw2", 1.5 );
111  rollZ = GetDvarFloat( "scr_planeroll2", -0.9 );
112 
113  ox = GetDvarFloat( "scr_planeox", 30000.0 );
114  oy = GetDvarFloat( "scr_planeoy", -30000.0 * turnDirection );
115  maxoX = GetDvarFloat( "scr_maxo_planex", -1.0 );
116  maxoY = GetDvarFloat( "scr_maxo_planey", -1.0 );
117 
118  y = GetDvarFloat( "scr_planey2", 0.6 );
119  z = GetDvarFloat( "scr_planez2", -1.5 );
120  maxy = GetDvarFloat( "scr_max_planey2", 90);
121 
122  accumTurn = 0;
123 
124  while( loopTime < halflife + halflife )
125  {
126  if (plane.angles[1] == 360)
127  plane.angles = ( plane.angles[0], 0, plane.angles[2] );
128 
129  if ( minRoll != -1 && plane.angles[2] >= 0 )
130  rollZ = 0.0;
131 
132  accumTurn += yawY;
133 
134  if ( accumTurn >= maxYaw )
135  {
136  yawY = 0.0;
137  }
138 
139  angles = ( plane.angles[0], plane.angles[1] + yawY, plane.angles[2] - rollZ);
140 
141  mathX = ( sin ( 45 * looptime / halflife ) ) * ox ;
142  mathY = ( cos ( 45 * looptime / halflife ) ) * oy ;
143 
144  oldX = mathX;
145  oldY = oy - mathY;
146 
147  rotatedX = Cos(yaw) * oldX - Sin(yaw) * oldY;
148  rotatedY = Sin(yaw) * oldX + Cos(yaw) * oldY;
149 
150  endPoint = ( origX + rotatedX, origY + rotatedY, plane.origin[2]);
151 
152  if ( waitForMoveDone )
153  plane waittill( "movedone" );
154  waitForMoveDone = plane ‪rewindobjects::serverTimedMoveTo( localClientNum, plane.origin, endPoint, ‪startTime, waitAmount );
155  plane ‪rewindobjects::serverTimedRotateTo( localClientNum, angles, ‪startTime, waitAmount );
156  loopTime += waitAmount;
157  ‪startTime += waitAmount * 1000;
158  }
159 }
160 
161 function ‪doABarrelRoll( localClientNum, plane, endPoint, flytime, ‪startTime )
162 {
163  plane endon( "entityshutdown" );
164  plane endon("delete");
165  level endon("demo_jump");
166 
167  origin = plane.origin;
168  originalHeight = origin[2];
169 
170  loopWaitTime = GetDvarFloat( "scr_loopwaittime", 0.5 );
171  loopHeightRand = GetDvarFloat( "scr_loopheightrand", 500 );
172  loopHeight = GetDvarFloat( "scr_loopheight", 1200 );
173  rollZ = GetDvarFloat( "scr_barrelroll", 10 );
174  degreesToRoll = GetDvarFloat( "scr_degreesToRoll", 360 );
175  unitsFromCentrePoint = 100;
176 
177  timeElapsed = 0;
178  degreesRolled = 0;
179  waitAmount = 0.1;
180 
181  loopHeight += randomFloatRange( 0-loopHeightRand, loopHeightRand );
182  waitForMoveDone = false;
183  angles = plane.angles;
184  originalRoll = plane.angles[2];
185  while ( timeElapsed < flytime )
186  {
187  timeElapsed += waitAmount;
188  if ( ( timeElapsed > loopWaitTime ) && ( degreesRolled < degreesToRoll ) )
189  {
190  pitch = degreesRolled / 8;
191  if ( pitch > 22.5 )
192  pitch = 45 - pitch;
193 
194  originalAngle = plane.angles[2];
195 
196  scr_degreesToRoll = GetDvarInt( "scr_degreesToRoll", 0 );
197  if ( scr_degreesToRoll )
198  plane.angles[1] = 0;
199  angles = ( 0 - pitch, plane.angles[1], originalRoll + degreesRolled );
200  degreesRolled += rollZ;
201  }
202 
203  ratio = timeElapsed / ( flytime / 2 );
204 
205  nextPoint = ‪rewindobjects::getPointOnLine( origin, endPoint, ratio );
206 
207  nextHeight = originalHeight + ( loopHeight - ( cos(degreesRolled/2) * loopHeight ) );
208  nextPoint = ( nextPoint[0], nextPoint[1], nextHeight );
209 
210  if ( waitForMoveDone )
211  plane waittill( "movedone" );
212  waitForMoveDone = plane ‪rewindobjects::serverTimedMoveTo( localClientNum, plane.origin, nextPoint, ‪startTime, waitAmount );
213  plane ‪rewindobjects::serverTimedRotateTo( localClientNum, angles, ‪startTime, waitAmount );
214  ‪startTime += waitAmount * 1000;
215  }
216 }
217 
218 
219 function ‪planeGoStraight( localClientNum, plane, startPoint, endPoint, moveTime, ‪startTime )
220 {
221  plane endon("delete");
222  level endon("demo_jump");
223 
224  distanceIncreaseRatio = 2;
225 
226  destPoint = ‪rewindobjects::getPointOnLine( startPoint, endPoint, distanceIncreaseRatio );
227  if ( plane ‪rewindobjects::serverTimedMoveTo( localClientNum, startPoint, destPoint, ‪startTime, moveTime ) )
228  plane waittill( "movedone" );
229 }
230 
‪startTime
‪class AnimationAdjustmentInfoZ startTime
‪planeTurn
‪function planeTurn(localClientNum, plane, yaw, halfLife, startTime, isTurningRight)
Definition: _airsupport.csc:41
‪planeTurnRight
‪function planeTurnRight(localClientNum, plane, yaw, halfLife, startTime)
Definition: _airsupport.csc:31
‪serverTimedRotateTo
‪function serverTimedRotateTo(localClientNum, angles, startTime, duration, timeIn, timeout)
Definition: _rewindobjects.csc:243
‪getPlaneModel
‪function getPlaneModel(teamFaction)
Definition: _airsupport.csc:24
‪serverTimedMoveTo
‪function serverTimedMoveTo(localClientNum, startPoint, endPoint, startTime, duration)
Definition: _rewindobjects.csc:217
‪planeGoStraight
‪function planeGoStraight(localClientNum, plane, startPoint, endPoint, moveTime, startTime)
Definition: _airsupport.csc:219
‪doABarrelRoll
‪function doABarrelRoll(localClientNum, plane, endPoint, flytime, startTime)
Definition: _airsupport.csc:161
‪planeTurnLeft
‪function planeTurnLeft(localClientNum, plane, yaw, halfLife, startTime)
Definition: _airsupport.csc:36
‪planeSounds
‪function planeSounds(localClientNum, spawnSound, flybySound, flybySoundLoop)
Definition: _airsupport.csc:13
‪getPointOnLine
‪function getPointOnLine(startPoint, endPoint, ratio)
Definition: _rewindobjects.csc:288