1 #using scripts\codescripts\struct;
3 #using scripts\shared\util_shared;
5 #insert scripts\shared\shared.gsh;
7 #using scripts\mp\_rewindobjects;
8 #using scripts\mp\_util;
9 #using scripts\mp\_vehicle;
11 #namespace airsupport;
13 function planeSounds( localClientNum, spawnSound, flybySound, flybySoundLoop )
17 playsound (0, spawnSound, (0,0,0));
18 if ( isdefined ( flybySound ) )
19 self playsound (0, flybySound);
20 self playloopsound( flybySoundLoop, 0 );
26 planemodel =
"t5_veh_jet_f4_gearup";
43 plane endon(
"delete" );
44 plane endon(
"entityshutdown" );
45 level endon(
"demo_jump" + localClientNum );
51 turnDirection = rightTurn;
53 turnDirection = leftTurn;
55 yawY = GetDvarFloat(
"scr_planeyaw", -1.5 * turnDirection );
56 rollZ = GetDvarFloat(
"scr_planeroll", 1.5 * turnDirection );
58 maxYaw = GetDvarFloat(
"scr_max_planeyaw", -45.0 * turnDirection );
59 minRoll = GetDvarFloat(
"scr_min_planeroll", 60.0 * turnDirection );
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 );
66 if (plane.angles[1] == 360)
67 plane.angles = ( plane.angles[0], 0, plane.angles[2] );
69 origX = plane.origin[0];
70 origY = plane.origin[1];
75 waitForMoveDone =
false;
76 while( loopTime <= halflife )
78 if (plane.angles[1] == 360)
79 plane.angles = ( plane.angles[0], 0, plane.angles[2] );
81 if ( minRoll != -1 && plane.angles[2] >= minRoll * turnDirection )
86 if ( accumTurn <= maxYaw * turnDirection )
90 angles = ( plane.angles[0], plane.angles[1] + yawY, plane.angles[2] + rollZ);
92 mathX = ( sin ( 45 * looptime / halflife ) ) * ox ;
93 mathY = ( cos ( 45 * looptime / halflife ) ) * oy ;
98 rotatedX = Cos(yaw) * oldX - Sin(yaw) * oldY;
99 rotatedY = Sin(yaw) * oldX + Cos(yaw) * oldY;
101 endPoint = ( origX + rotatedX, origY + rotatedY, plane.origin[2]);
102 if ( waitForMoveDone )
103 plane waittill(
"movedone" );
106 loopTime += waitAmount;
110 yawY = GetDvarFloat(
"scr_planeyaw2", 1.5 );
111 rollZ = GetDvarFloat(
"scr_planeroll2", -0.9 );
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 );
118 y = GetDvarFloat(
"scr_planey2", 0.6 );
119 z = GetDvarFloat(
"scr_planez2", -1.5 );
120 maxy = GetDvarFloat(
"scr_max_planey2", 90);
124 while( loopTime < halflife + halflife )
126 if (plane.angles[1] == 360)
127 plane.angles = ( plane.angles[0], 0, plane.angles[2] );
129 if ( minRoll != -1 && plane.angles[2] >= 0 )
134 if ( accumTurn >= maxYaw )
139 angles = ( plane.angles[0], plane.angles[1] + yawY, plane.angles[2] - rollZ);
141 mathX = ( sin ( 45 * looptime / halflife ) ) * ox ;
142 mathY = ( cos ( 45 * looptime / halflife ) ) * oy ;
147 rotatedX = Cos(yaw) * oldX - Sin(yaw) * oldY;
148 rotatedY = Sin(yaw) * oldX + Cos(yaw) * oldY;
150 endPoint = ( origX + rotatedX, origY + rotatedY, plane.origin[2]);
152 if ( waitForMoveDone )
153 plane waittill(
"movedone" );
156 loopTime += waitAmount;
163 plane endon(
"entityshutdown" );
164 plane endon(
"delete");
165 level endon(
"demo_jump");
167 origin = plane.origin;
168 originalHeight = origin[2];
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;
181 loopHeight += randomFloatRange( 0-loopHeightRand, loopHeightRand );
182 waitForMoveDone =
false;
183 angles = plane.angles;
184 originalRoll = plane.angles[2];
185 while ( timeElapsed < flytime )
187 timeElapsed += waitAmount;
188 if ( ( timeElapsed > loopWaitTime ) && ( degreesRolled < degreesToRoll ) )
190 pitch = degreesRolled / 8;
194 originalAngle = plane.angles[2];
196 scr_degreesToRoll = GetDvarInt(
"scr_degreesToRoll", 0 );
197 if ( scr_degreesToRoll )
199 angles = ( 0 - pitch, plane.angles[1], originalRoll + degreesRolled );
200 degreesRolled += rollZ;
203 ratio = timeElapsed / ( flytime / 2 );
207 nextHeight = originalHeight + ( loopHeight - ( cos(degreesRolled/2) * loopHeight ) );
208 nextPoint = ( nextPoint[0], nextPoint[1], nextHeight );
210 if ( waitForMoveDone )
211 plane waittill(
"movedone" );
221 plane endon(
"delete");
222 level endon(
"demo_jump");
224 distanceIncreaseRatio = 2;
228 plane waittill(
"movedone" );