Rise
The Vieneo Province
Loading...
Searching...
No Matches
cockpit.cpp
Go to the documentation of this file.
1#include "cockpit.h"
2#include "SparkoProp.h"
3#include "CockpitLighting.h"
4#ifdef SparkoPhysicsLog
5#include "SparkoTrace.h"
6#endif
7
8#include "AirfoilType.h"
9#include "Viewscreen.h"
10#include "../GameClass.h"
11#include "../MathUtilities.h"
13
14#define blastProofMaxDiffMb 2100.0f
15#define negativePressMaxDiffMb 2400.0f
16
18{
19 viewscreen = ptr;
20 logger = ptr->logger;
21}
22
23cockpit::~cockpit() = default;
24
25void cockpit::ResetProps(const char* reason) const
26{
27 if (sparkoProp)
28 {
29 sparkoProp->Reset(reason);
31 for (int i = SOUND_PROP1; i <= SOUND_PROP6; ++i)
32 viewscreen->gameclass->sound->Stop(static_cast<SOUNDS>(i));
33 }
34}
35
36void cockpit::FrameMovePropSounds(float elapsedTime) const
37{
40 const auto events = propAudio.Update(elapsedTime, sparkoProp ? sparkoProp->AudioInput(active) : PropAudio::Input{});
41 auto* sound = viewscreen->gameclass->sound.get();
42 if (events.stopAll)
43 for (int i = SOUND_PROP1; i <= SOUND_PROP6; ++i) sound->Stop(static_cast<SOUNDS>(i));
44 if (events.stopRolling)
45 for (int i = SOUND_PROP4; i <= SOUND_PROP6; ++i) sound->Stop(static_cast<SOUNDS>(i));
46 // One random one-shot per rolling start / impact; do not rewind an active clip.
47 if (events.startRolling)
48 {
49 const int variant = rand() % 3;
50 char message[160];
51 sprintf_s(message, sizeof message, "PROP_AUDIO play SOUND_PROP%d canroll%d.wav reason=rolling_started gain=1.0 restart=0", 4 + variant, 1 + variant);
52 logger->Log(message);
53 sound->PlayEx(static_cast<SOUNDS>(SOUND_PROP4 + variant), false, 0.5f, 1.f, 0.64f, false, false, true);
54 }
55 if (events.hit)
56 {
57 const int variant = rand() % 3;
58 char message[160];
59 sprintf_s(message, sizeof message, "PROP_AUDIO play SOUND_PROP%d canhit%d.wav reason=collision gain=1.0 restart=0", 1 + variant, 1 + variant);
60 logger->Log(message);
61 sound->PlayEx(static_cast<SOUNDS>(SOUND_PROP1 + variant), false, 0.5f, 1.f, 0.64f, false, false, true);
62 }
63}
64
66{
67 if (viewscreen->cameras.empty())
68 return;
69
70 unsigned char cameraVehicleType = static_cast<unsigned char>(ourcockpit.texturelib);
71 bool useParentVehicle = false;
72 if (playerships[0].reference == REF_INANOTHER)
73 {
74 const unsigned char parentSlot = playerships[0].inarray;
75 if (parentSlot < MAX_SCAN && playerships[parentSlot].type != 0)
76 {
77 cameraVehicleType = playerships[parentSlot].type;
78 useParentVehicle = true;
79 }
80 else
81 {
82 // Do not expose the child's external cameras while the parent metadata is pending.
83 cameraVehicleType = 0;
84 }
85 }
86
87 if (viewscreen->cameras.size() > 1 &&
88 externalCameraVehicleType == cameraVehicleType &&
89 externalCameraUsesParent == useParentVehicle)
90 {
91 return;
92 }
93
94 const SCamera interiorCamera = viewscreen->cameras.front();
95 viewscreen->cameras.clear();
96 viewscreen->cameras.emplace_back(interiorCamera);
97
98 switch (cameraVehicleType)
99 {
100 case VehicleType::C98:
101 viewscreen->cameras.emplace_back(SCamera("c-98 drone", 0, 0.0069f, -0.0176f, 0, -0.175f));
102 viewscreen->cameras.emplace_back(SCamera("C-98 Driver side.", -0.0019f, 0.0006f, -0.0035f, 0, -0.175f));
103 viewscreen->cameras.emplace_back(SCamera("unknown", 0.0019f, 0.0006f, -0.0035f, -0.346f, -0.175f));
104 break;
105 case VehicleType::E10:
106 viewscreen->cameras.emplace_back(SCamera("Above port tail", -0.0093f, 0.0101f, -0.0292f, -0.071f, -0.416f));
107 viewscreen->cameras.emplace_back(SCamera("Above starboard tail", 0.0093f, 0.0102f, -0.0293f, -0.045f, -0.069f));
108 viewscreen->cameras.emplace_back(SCamera("Under port wing", -0.0186f, -0.0015f, -0.0070f, 1.329f, -0.024f));
109 viewscreen->cameras.emplace_back(SCamera("Under starboard wing", 0.0189f, -0.0015f, -0.0067f, -1.512f, 0.068f));
110 viewscreen->cameras.emplace_back(SCamera("Landing gear", -0.0049f, -0.0032f, -0.0104f, 0, -0.175f));
111 viewscreen->cameras.emplace_back(SCamera("Above engine 1", -0.0186f, 0.0064f, -0.0016f, 1.508f, -0.028f));
112 viewscreen->cameras.emplace_back(SCamera("Above engine 3", 0.0190f, 0.0064f, -0.0015f, -1.463f, -0.236f));
113 break;
114 case VehicleType::P13:
115 viewscreen->cameras.emplace_back(SCamera("Port with tip top", -0.0150f, -0.0023f, -0.0018f, 1.203f, 0.105f));
116 viewscreen->cameras.emplace_back(SCamera("star wing top", 0.0151f, -0.0022f, -0.0014f, -1.447f, 0.429f));
117 viewscreen->cameras.emplace_back(SCamera("Gear cam", 0, 0.0003f, -0.0166f, 0, -0.175f));
118 break;
119 case VehicleType::A4:
120 viewscreen->cameras.emplace_back(SCamera("Top of tail", 0.0002f, 0.0102f, -0.0254f, 0, -0.175f));
121 viewscreen->cameras.emplace_back(SCamera("Port Wing tip", -0.0169f, 0.0076f, -0.0096f, 0, -0.175f));
122 viewscreen->cameras.emplace_back(SCamera("Star Wing tip", 0.0173f, 0.0076f, -0.0091f, -1.382f, -0.376f));
123 viewscreen->cameras.emplace_back(SCamera("Gear cam", 0, -0.0011f, -0.01f, 0, -0.175f));
124 viewscreen->cameras.emplace_back(SCamera("A-4 Cargo bay door", 0.0010f, 0.0022f, -0.0261f, -0.104f, -0.077f));
125 viewscreen->cameras.emplace_back(SCamera("Optional under port wing", -0.0180f, 0.0026f, -0.009f, 0, -0.175f));
126 viewscreen->cameras.emplace_back(SCamera("Optional under star wing", 0.0141f, 0.0017f, -0.0106f, 0, -0.175f));
127 break;
128 case VehicleType::C2:
129 viewscreen->cameras.emplace_back(SCamera("chase", 0.0006f, 0.0067f, -0.0161f, 0, -0.175f));
130 viewscreen->cameras.emplace_back(SCamera("Driver Side", -0.0015f, 0.0005f, -0.0026f, 0, -0.175f));
131 viewscreen->cameras.emplace_back(SCamera("PAx SIde", 0.0018f, 0.0003f, -0.0026f, 0, -0.175f));
132 break;
133 case VehicleType::C2A:
134 viewscreen->cameras.emplace_back(SCamera("C-2A driver side rear.", -0.002f, 0.0004f, -0.0023f, 0.098f, -0.016f));
135 viewscreen->cameras.emplace_back(SCamera("c-2a pax side rear", 0.002f, 0.0004f, -0.0023f, 0.098f, -0.016f));
136 viewscreen->cameras.emplace_back(SCamera("C2a chase cam", 0, 0.005f, -0.0124f, 0.003f, -0.175f));
137 break;
139 viewscreen->cameras.emplace_back(SCamera("Driver", -0.0014f, 0.0006f, -0.0055f, 0.090f, -0.019f));
140 viewscreen->cameras.emplace_back(SCamera("Pax side", 0.0018f, 0.0007f, -0.0057f, 0, -0.175f));
141 viewscreen->cameras.emplace_back(SCamera("Chase", 0, 0.0069f, -0.0166f, 0, -0.175f));
142 break;
144 viewscreen->cameras.emplace_back(SCamera("Drier side", -0.0017f, 0.0007f, -0.0060f, -0.419f, 0.001f));
145 viewscreen->cameras.emplace_back(SCamera("t-121 Pax", 0.0018f, 0.0007f, -0.0061f, 0, -0.175f));
146 viewscreen->cameras.emplace_back(SCamera("T-121 Chase", 0, 0.0085f, -0.0198f, 0, -0.172f));
147 break;
148 case VehicleType::E11:
149 viewscreen->cameras.emplace_back(SCamera("Above port tail", -0.0093f, 0.0101f, -0.0289f, -0.228f, -0.419f));
150 viewscreen->cameras.emplace_back(SCamera("Above starboard tail", 0.0096f, 0.0101f, -0.0291f, 0, -0.175f));
151 viewscreen->cameras.emplace_back(SCamera("Under port wing", -0.0179f, -0.0027f, -0.0043f, 1.508f, 0.053f));
152 viewscreen->cameras.emplace_back(SCamera("Under starboard wing", 0.0196f, -0.0017f, -0.0055f, -1.513f, 0.039f));
153 viewscreen->cameras.emplace_back(SCamera("Landing gear", -0.0028f, -0.0037f, -0.0108f, 0, -0.175f));
154 viewscreen->cameras.emplace_back(SCamera("Above engine 1", -0.0184f, 0.0065f, -0.0015f, 1.079f, -0.403f));
155 viewscreen->cameras.emplace_back(SCamera("Above engine 3", 0.0193f, 0.0064f, -0.0014f, -1.465f, -0.231f));
156 break;
157 case VehicleType::T19:
158 viewscreen->cameras.emplace_back(SCamera("Top of tail", 0, 0.0108f, -0.0204f, -0.111f, -0.419f));
159 viewscreen->cameras.emplace_back(SCamera("Top of Engine 1", -0.0033f, 0.0037f, 0.0033f, 0, -0.175f));
160 viewscreen->cameras.emplace_back(SCamera("Top of Engine 2", 0.0043f, 0.0036f, 0.0029f, 0, -0.175f));
161 viewscreen->cameras.emplace_back(SCamera("Under Port wing(Gear)", -0.0130f, -0.0004f, -0.0009f, 0, -0.175f));
162 viewscreen->cameras.emplace_back(SCamera("Under Start wing Gear", 0.0125f, 0.0002f, -0.0022f, 0, -0.175f));
163 viewscreen->cameras.emplace_back(SCamera("Cargo Door", 0, 0.0018f, -0.0195f, 0, -0.175f));
164 break;
167 viewscreen->cameras.emplace_back(SCamera("Above port tail", -0.0268f, 0.0074f, -0.0151f, 0, -0.175f));
168 viewscreen->cameras.emplace_back(SCamera("Above starboard tail", 0.0275f, 0.0075f, -0.0154f, -0.697f, -0.624f));
169 viewscreen->cameras.emplace_back(SCamera("Landing gear", 0, -0.0036f, -0.0160f, -0.105f, 0.034f));
170 viewscreen->cameras.emplace_back(SCamera("Under port wing", -0.0245f, -0.0006f, -0.0199f, 0, -0.175f));
171 viewscreen->cameras.emplace_back(SCamera("Under starboard wing", 0.0245f, -0.0006f, -0.0191f, 0, -0.175f));
172 break;
173 case VehicleType::T27:
174 viewscreen->cameras.emplace_back(SCamera("Trailing External", 0.0009f, 0.0136f, -0.0397f, 0.068f, -0.157f));
175 break;
176 default:
177 break;
178 }
179
180 externalCameraVehicleType = cameraVehicleType;
181 externalCameraUsesParent = useParentVehicle;
183 if (ourcockpit.dexterity != -999.0f)
187}
188
189void cockpit::CacheEngineSounds(bool useExteriorModel) const
190{
192 float forwardKm = 0.f;
193 switch (ourcockpit.texturelib)
194 {
197 forwardKm = ourcockpit.noseWheelToCgKm;
198 break;
201 forwardKm = ourcockpit.noseWheelToCgKm;
202 break;
203 case VehicleType::T27:
205 break;
206 }
207 // Unmarked models retain a documented body-space fallback near the engine
208 // arm/front axle. Never reuse another vehicle's positions or reference levels.
210 ourcockpit.i48CriticalEngineYawArmM * .001f, forwardKm);
211 if (useExteriorModel && ourcockpit.texturelib == playerships[0].type)
214}
215
216void cockpit::Load(unsigned char newType) const
217{
218 logger->AddToCallStack("cockpit::Load");
220 sparkoProp.reset(); // No state or component binding may survive a cockpit reload.
221#ifdef SparkoPhysicsLog
222 sparkoTrace.reset();
223#endif
224
225 char msg[199];
226 sprintf_s(msg, sizeof(msg), "cockpit::Load(%i) ... was %i ... logolight %i", newType, ourcockpit.texturelib, playerships[0].logolight);
227 logger->Log(msg);
228
229 ourcockpit.texturelib = newType;
233
234 const float hp2fwdthrust = 0.0085f / 100.0f;
235
237 ourcockpit.flapSettings.clear();
238
239 viewscreen->g_bStrapon = true; // forced to stay in seat
240
242
243 // this is going to have to be rethought, if you get in someone's vehicle that is already powered up or from elevator
244 // to subway it should be on already
245 if (playerships[0].logolight)
246 {
249 ourcockpit.power = 1.0f;
250
252 Command command;
253 command.name = "AuralScannerSync";
254 command.delay = 2.0f;
255 viewscreen->gameclass->bus->commandStream.emplace_back(command);
256 }
258 {
261 ourcockpit.power = 0.0f;
262 }
263
265 // ReSharper disable once CppExpressionWithoutSideEffects
267 // ReSharper disable once CppExpressionWithoutSideEffects
269
272
273 ourcockpit.attenuate = 0.0f;
280 ourcockpit.scanDisplayVesselLimit = 9; // plus waypoint
281 ourcockpit.VneEmpty = 0.0f;
282 ourcockpit.VneMaxGross = 0.0f;
283 ourcockpit.h9RudderSqFt = 0.0f; // rudder area
284 ourcockpit.h6ElevatorAreaSqFt = 0.0f; // elevator area
285 ourcockpit.d16HTailWithElevatorSqFt = 0.0f; // hstab area
286 ourcockpit.d17VTailWithRudderSqFt = 0.0f; // vstab area
287 ourcockpit.h12AileronAreaSqFt = 0.0f; // aileron area (one side)
291 ourcockpit.b12WingRollArmM = 0.0f; // wing roll arm
292 ourcockpit.b15WingPitchArmM = 0.0f; // wing pitch arm
293 ourcockpit.c9WingYawArmM = 0.0f; // wing yaw arm
294 ourcockpit.i48CriticalEngineYawArmM = 0.0f; // critical engine yaw arm (m)
295 ourcockpit.l48AverageEnginePitchArmM = 0.0f; // critical engine pitch arm (m)
296 ourcockpit.Vs2 = 0.0f; // for thrust aug top speed (0.0 uninstalled)
297 ourcockpit.VrefMod = 1.27f;
298 ourcockpit.VcMSL = 0.0f;
299 ourcockpit.pitchToAddInTurn = 0.10472f;
301 ourcockpit.VrEmpty = FLT_MAX;
302 ourcockpit.VrMaxGross = FLT_MAX;
303 //ourcockpit.V1 = FLT_MAX;
304 //ourcockpit.V2 = FLT_MAX;
305 ourcockpit.wings = AirfoilType::NACA64A410; // this was always the default
306 ourcockpit.wingspanM = 0.0f;
308 ourcockpit.rcsYParmM = 0.0f;
309 ourcockpit.tireRadiusKm = 0.0f; // if we override this here we have to change it in playerships[t].tireCircumferenceKm
325 ourcockpit.projecttexture = -1; // not supported yet
331 ourcockpit.struts = 0;
343 ourcockpit.Vle = 0.0f;
345 ourcockpit.wheelBaseKm = 0.023055f; // @todo this is the Manx, need everyone to override
346
347 viewscreen->cameras.clear();
348
349 int handle = -1;
350 switch (ourcockpit.texturelib)
351 {
352 case VehicleType::C98:
353 {
354 ourcockpit.attenuate = 0.85f;
355 ourcockpit.shelfFreq = 5000.0f;
356 ourcockpit.shelfGain = -9.0f;
357 ourcockpit.shelfSlope = 1.5f;
358 ourcockpit.lpFreq = 7000.0f;
359 ourcockpit.lpSlope = 4.0f;
360 ourcockpit.notchFreq = 1200.0f;
361 ourcockpit.notchGain = -4.0f;
362 ourcockpit.panFactor = 0.35f;
363
364 _sopen_s(&handle, "meshes\\MuVERcockpit-construction.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
365 ourcockpit.launchPosition.x = 0.0f;
366 ourcockpit.launchPosition.y = -0.00026364f; // down
367 ourcockpit.launchPosition.z = 0.0167f; // fwd, at the nose because the point between the lights is inside the cockpit
368 ourcockpit.fwdthrustlimit = 202.0f * hp2fwdthrust;
369 ourcockpit.spoolTime = 0.0f; // seconds
370 ourcockpit.revthrustlimit = 0.0f; // unused
371 ourcockpit.suspensionTravelKm = 0.000300f;
375 ourcockpit.tireComplianceKm = 0.000035f;
377 ourcockpit.spaceCapable = false;
378 ourcockpit.wheeled = true;
379 //ourcockpit.tires = 4;
381 ourcockpit.noseWheelToCgKm = 0.0011175f;
382 ourcockpit.steerLimitRadian = RiseMath::ToRadian(45.0f); // if we change this here we have to change it in playerships[t].steerLimitRadian too
383 ourcockpit.tireRadiusKm = 0.0004065f; // 0.000813f diameter or 32" if we change this here we have to change it in playerships[t].tireCircumferenceKm
384 ourcockpit.clutchtime = 0.375f;
386 ourcockpit.idleRPM = 800.0f;
387 ourcockpit.redlineRPM = 5500.0f;
388 // from F-150
389 ourcockpit.ratios[0] = -0.4310344827586206896551724137931f;
390 ourcockpit.ratios[1] = 0.25641025641025641025641025641026f; //.16
391 ourcockpit.ratios[2] = 0.44444444444444444444444444444444f;//0.32f;
392 ourcockpit.ratios[3] = 0.67114093959731543624161073825503f;
393 ourcockpit.ratios[4] = 1.0f;
394 ourcockpit.ratios[5] = 1.25f;
395 // differential?
396 ourcockpit.ratios[0] *= 2.0f;
397 ourcockpit.ratios[1] *= 2.0f;
398 ourcockpit.ratios[2] *= 2.0f;
399 ourcockpit.ratios[3] *= 2.0f;
400 ourcockpit.ratios[4] *= 2.0f;
401 ourcockpit.ratios[5] *= 2.0f;
402
404 ourcockpit.nextgen = false;
405 ourcockpit.bays = 0;
407 ourcockpit.emptyWeightLbs = 5376.520f;
408 ourcockpit.maxGrossLbs = 8016.800f;
409 ourcockpit.ffmax = 0.003575f * 1.5f; // gndvehicles are in lbs per second
410 ourcockpit.fuelFlowIdleLbsPerSec = ourcockpit.ffmax * 0.1f; // 52 lbs/hr
411 ourcockpit.fuelmax = 80.0f;
412 viewscreen->cameras.emplace_back(SCamera(-0.0002539102f, 0.00040625634f, 0.0006093845f, true));
413 ourcockpit.scanDisplayVesselLimit = 19; // plus waypt
414 ourcockpit.exteriorInsulationHeatTransferCoefficient = 67.4f; // Intermediate British Steels, 1933 CS 81: 0.1% C, 0.34% Mn
415
416 // Determined from new Intertial Moment routine
417 ourcockpit.momentp = 13928.78125f / ourcockpit.emptyWeightLbs;//2.59611f;
418 ourcockpit.momentr = 5015.320801f / ourcockpit.emptyWeightLbs;//0.934778f;
419 ourcockpit.momenty = 18027.724609f / ourcockpit.emptyWeightLbs;//3.360088f; // at 60mph 96kmh 16mpg 8ppg
420 ourcockpit.strutsrettoCGKm = 0.000508f; // so the bottom most polygon Z ... negated
421 ourcockpit.rooftoCGKm = 0.001625f; // verified
422
423 // All of these must go through the spreadsheet
424 ourcockpit.f28SideDragCoefficient = 0.116172648f; // side drag coefficient
425 ourcockpit.f20FrontBackDragCoeff = 0.056952f; // front/rear drag coefficient
426 ourcockpit.f25 = 0.0f; // landing gear extended adjustment
427 ourcockpit.f27PlanDragCoefficient = 0.146740f; // top/bottom drag coefficient
428 ourcockpit.d65wasd61 = 0.13600661f; // roll drag Cx
429 ourcockpit.e65wase61 = 3.279168f; // roll drag arm
430 ourcockpit.i66wasi62 = 0.0f; // ft� at m asym pitch body
431 ourcockpit.k66wask62 = 0.0f; // ft� at m asym pitch htail
432 ourcockpit.i65wasi61 = 0.0f; // ft� at m asym yaw body
433 ourcockpit.k65wask61 = 0.0f; // ft� at m asym yaw vtail
434 }
435 break;
436 case VehicleType::E10:
437 {
438 ourcockpit.attenuate = 0.6f;
439 ourcockpit.shelfFreq = 4000.0f;
440 ourcockpit.shelfGain = -10.0f;
441 ourcockpit.shelfSlope = 3.0f;
442 ourcockpit.lpFreq = 6000.0f;
443 ourcockpit.lpSlope = 6.0f;
444 ourcockpit.notchFreq = 1000.0f;
445 ourcockpit.notchGain = -5.0f;
446 ourcockpit.panFactor = 0.05f;
447
448 _sopen_s(&handle, "meshes\\e10cockpit1.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
449 ourcockpit.launchPosition.x = 0.0f;
450 ourcockpit.launchPosition.y = -0.00026364f; // down
451 ourcockpit.launchPosition.z = 0.02f; // fwd, at the nose because the point between the lights is inside the cockpit
452 ourcockpit.uptranslimit = 0.00625f; // at max gross
453 ourcockpit.dntranslimit = 0.0116f; // at max gross // 6550
454 ourcockpit.lrtranslimit = 0.00625f; // at max gross
455 ourcockpit.fwdthrustlimit = 0.0116f; // at max gross
456 ourcockpit.spoolTime = 5.8f; // seconds
457 ourcockpit.revthrustlimit = 0.0116f; // at max gross
458 ourcockpit.landingGearAbsorbKms = 0.002205393f * 5.0f; // meter/s
460 ourcockpit.wheeled = false;
463 ourcockpit.steerLimitRadian = 0.0f; // if we change this here we have to change it in playerships[t].steerLimitRadian too
464 ourcockpit.struts = 3;
466 ourcockpit.nextgen = true;
467 ourcockpit.bays = 6;
469 ourcockpit.emptyWeightLbs = 277581.7f;
470 ourcockpit.maxGrossLbs = 525100.4f;
471 ourcockpit.ffmax = 538.7927f; // at 0.0116 she burns 22500 lbs per hour 6.25 lbs per second
472 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // 52 lbs/hr
473 ourcockpit.fuelmax = 60000.0f; // lbs
474 ourcockpit.aoiWingRad = 0.0f;
475 viewscreen->cameras.emplace_back(SCamera(-0.0006964394f, 0.00121876895f, 0.0184556441f, true));
476 ourcockpit.appitagr = 3.5f; // aggressiveness for pitch on autopilot (2 is standard)
477 ourcockpit.aprolagr = 6.0f; // aggressiveness for roll on autopilot
478 ourcockpit.dockOffsetKmZ = 0.0027f;
480 ourcockpit.exteriorInsulationHeatTransferCoefficient = 0.063f; // calcium silicate
481 ourcockpit.pitchLimitRadians = 0.78539816339744830961566084581988f; // 45� control deflection stop
482 ourcockpit.machAngleDragScalar = sinf(atanf(1.320f));
484 ourcockpit.engineEfficiencyAtSeaLevelScalar = 0.921659f; // based on falcon 9 on earth which means this is 2.5x as efficient!
485
486 // Determined from new Inertial Moment routine
487 ourcockpit.momentp = 124.982147f;
488 ourcockpit.momentr = 71.806427f;
489 ourcockpit.momenty = 186.511765f;
490 ourcockpit.strutsrettoCGKm = 0.003134f; // so the bottom most polygon Z ... negated
492 ourcockpit.rooftoCGKm = 0.002089f; // might need to be negative 0.0013928788f; // 4 units
493 ourcockpit.wingspanM = 48.750797f;
494 ourcockpit.rcsYParmM = 16.714558f;
495
496 // All of these must go through the spreadsheet
497 ourcockpit.f28SideDragCoefficient = 3.542405185f; // side drag coefficient
498 ourcockpit.f20FrontBackDragCoeff = 2.568257887f; // front/rear drag coefficient
499 ourcockpit.f27PlanDragCoefficient = 14.53457189f; // top/bottom drag coefficient
500 ourcockpit.f25 = 0.172558f; // landing gear extended adjustment
501 ourcockpit.h9RudderSqFt = 125.3846f; // rudder area ft�
502 ourcockpit.h6ElevatorAreaSqFt = 240.8797f; // elevator area ft�
503 ourcockpit.d16HTailWithElevatorSqFt = 1183.560f; // hstab area ft�
504 ourcockpit.d17VTailWithRudderSqFt = 837.0745f; // vstab area ft�
505 ourcockpit.h12AileronAreaSqFt = 227.2816f; // aileron area (one side) ft�
507 ourcockpit.b9DistanceToVTailM = 24.325602f; // DV (m)
508 ourcockpit.b6DistanceToHTailM = 26.479713f; // DH (m)
509 ourcockpit.b12WingRollArmM = 18.137566f; // wing roll arm (m)
510 ourcockpit.b15WingPitchArmM = 7.180880f; // wing pitch arm (m)
511 ourcockpit.c9WingYawArmM = 19.151197f; // wing yaw arm (m)
512 ourcockpit.i48CriticalEngineYawArmM = 18.804f; // critical engine yaw arm (m)
513 ourcockpit.l48AverageEnginePitchArmM = -0.38014f; // critical engine pitch arm (m)
514 ourcockpit.d65wasd61 = 14.44276701f; // roll drag Cx
515 ourcockpit.e65wase61 = 7.755528f; // roll drag arm (m)
516 ourcockpit.Vs2 = 0.079f; // for thrust aug top speed, avionics setting not from spreadsheet
517 ourcockpit.VcMSL = 0.145f;
518 ourcockpit.i66wasi62 = 91.99259518f; // ft� at m asym pitch body
519 ourcockpit.k66wask62 = 158.1099498f; // ft� at m asym pitch htail
520 ourcockpit.i65wasi61 = 126.5371507f; // ft� at m asym yaw body
521 ourcockpit.k65wask61 = 111.2692687f; // ft� at m asym yaw vtail
523 ourcockpit.Vle = 0.125f; // based on C-17
524 ourcockpit.MaxDoorOpenOperatingKms = 0.125f; // based on C-17
525 }
526 break;
527 case VehicleType::P13:
528 {
529 ourcockpit.attenuate = 0.6f;
530 ourcockpit.shelfFreq = 4000.0f;
531 ourcockpit.shelfGain = -10.0f;
532 ourcockpit.shelfSlope = 3.0f;
533 ourcockpit.lpFreq = 6000.0f;
534 ourcockpit.lpSlope = 6.0f;
535 ourcockpit.notchFreq = 1000.0f;
536 ourcockpit.notchGain = -5.0f;
537 ourcockpit.panFactor = 0.10f;
538
539 _sopen_s(&handle, "meshes\\p13-cockpit1.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
540 ourcockpit.launchPosition.x = 0.0f;
541 ourcockpit.launchPosition.y = -0.00026364f; // down
542 ourcockpit.launchPosition.z = 0.0167f; // fwd, at the nose because the point between the lights is inside the cockpit
543 ourcockpit.uptranslimit = 0.002f; // at max gross
544 ourcockpit.dntranslimit = 0.02f; // at max gross
545 ourcockpit.lrtranslimit = 0.02f; // at max gross
546 ourcockpit.fwdthrustlimit = 0.02f; // 3600
547 ourcockpit.spoolTime = 10.0f; // seconds
549 ourcockpit.landingGearAbsorbKms = 0.001775581f * 5.0f; // meter/s
551 ourcockpit.wheeled = false;
554 ourcockpit.steerLimitRadian = 0.0f; // if we change this here we have to change it in playerships[t].steerLimitRadian too
555 ourcockpit.struts = 2;
557 ourcockpit.nextgen = true;
558 ourcockpit.bays = 0;
560 ourcockpit.emptyWeightLbs = 106639.568f;
561 ourcockpit.maxGrossLbs = 180378.000f;
562 ourcockpit.ffmax = 538.7927f; // at 0.0116 she burns 22500 lbs per hour 6.25 lbs per second
563 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // if we change this here, we have to change it on server
564 ourcockpit.fuelmax = 40000.0f;
565 ourcockpit.aoiWingRad = 0.0f;
566 viewscreen->cameras.emplace_back(SCamera(-0.0002539102f, 0.00040625634f, 0.0006093845f, true));
567 ourcockpit.appitagr = 2.0f; // aggressiveness for pitch on autopilot (2 is standard)
568 ourcockpit.aprolagr = 1.0f; // aggressiveness for roll on autopilot
569 ourcockpit.dockOffsetKmZ = 0.002786f - 0.003482f; // negative moves the ship UP on the dock interface, 0.003482 aligns with the FRONT instead of the BOTTOM docking port on the dock interface
570 ourcockpit.dockOffsetKmY = 0.016715f + 0.0013f; // 0.001393 aligns with the FRONT instead of the BOTTOM docking port on the dock interface
571 ourcockpit.dockingOrientationZ = 1.0f; // backwards
573 ourcockpit.exteriorInsulationHeatTransferCoefficient = 0.046f; // styrofoam-expanded polystyrene
575 ourcockpit.machAngleDragScalar = sinf(atanf(1.309f));
577
578 // Determined from new Intertial Moment routine
579 ourcockpit.momentp = 34.848396f;
580 ourcockpit.momentr = 15.824283f;
581 ourcockpit.momenty = 37.362788f;
582 ourcockpit.strutsrettoCGKm = 0.004527f; // so the bottom most polygon Z ... negated
584 ourcockpit.rooftoCGKm = 0.004179f;
585 ourcockpit.wingspanM = 30.643354f;
586 ourcockpit.rcsYParmM = 9.750158f;
587
588 // All of these must go through the spreadsheet
589 ourcockpit.f28SideDragCoefficient = 2.11575258f; // side drag coefficient
590 ourcockpit.f20FrontBackDragCoeff = 1.566484288f; // front/rear drag coefficient
591 ourcockpit.f27PlanDragCoefficient = 5.657307528f; // top/bottom drag coefficient
592 ourcockpit.f25 = 0.045902f; // landing gear extended coefficient
593 ourcockpit.h9RudderSqFt = 0.0f; // rudder area
594 ourcockpit.h6ElevatorAreaSqFt = 0.0f; // elevator area
595 ourcockpit.d16HTailWithElevatorSqFt = 0.0f; // hstab area
596 ourcockpit.d17VTailWithRudderSqFt = 0.0f; // vstab area
597 ourcockpit.h12AileronAreaSqFt = 146.9295f; // aileron area (one side)
599 ourcockpit.b9DistanceToVTailM = 0.0f; // DV (m)
600 ourcockpit.b6DistanceToHTailM = 0.0f; // DH (m)
601 ourcockpit.b12WingRollArmM = 7.377546f; // wing roll arm
602 ourcockpit.b15WingPitchArmM = 2.651964f; // wing pitch arm
603 ourcockpit.c9WingYawArmM = 7.040407f; // wing yaw arm
604 ourcockpit.i48CriticalEngineYawArmM = 0.0f; // critical engine yaw arm (m)
605 ourcockpit.l48AverageEnginePitchArmM = 0.0f; // critical engine pitch arm (m)
606 ourcockpit.d65wasd61 = 5.89985235f; // roll drag Cx
607 ourcockpit.e65wase61 = 4.569886f; // roll drag arm
608 ourcockpit.Vs2 = 0.189f; // for thrust aug top speed
609 ourcockpit.VcMSL = 0.189f;
610 ourcockpit.i66wasi62 = 37.96963685f; // ft� at m asym pitch body
611 ourcockpit.k66wask62 = 0.0f; // ft� at m asym pitch htail
612 ourcockpit.i65wasi61 = 28.30608656f; // ft� at m asym yaw body
613 ourcockpit.k65wask61 = 0.0f; // ft� at m asym yaw vtail
615 }
616 break;
617 case VehicleType::A4:
618 {
619 ourcockpit.attenuate = 0.7f;
620 ourcockpit.shelfFreq = 6000.0f;
621 ourcockpit.shelfGain = -8.0f;
622 ourcockpit.shelfSlope = 2.5f;
623 ourcockpit.lpFreq = 8000.0f;
624 ourcockpit.lpSlope = 4.0f;
625 ourcockpit.notchFreq = 1200.0f;
626 ourcockpit.notchGain = -4.0f;
627 ourcockpit.panFactor = 0.15f;
628
629 _sopen_s(&handle, "meshes\\T-8 Wanderer INT.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
630 ourcockpit.launchPosition.x = 0.0f;
631 ourcockpit.launchPosition.y = -0.00026364f; // down
632 ourcockpit.launchPosition.z = 0.0167f; // fwd, at the nose because the point between the lights is inside the cockpit
633 ourcockpit.uptranslimit = 0.0f; // at max gross
634 ourcockpit.dntranslimit = 0.02f; // at max gross
635 ourcockpit.lrtranslimit = 0.002f; // at max gross
636 ourcockpit.fwdthrustlimit = 0.0338f; // should be 30% faster than E-10 // 1791.4
637 ourcockpit.spoolTime = 16.9f; // seconds
638 ourcockpit.revthrustlimit = 0.0338f;
639 ourcockpit.landingGearAbsorbKms = 0.0017411f * 5.0f; // meter/s
640 ourcockpit.spaceCapable = false;
641 ourcockpit.wheeled = false;
644 ourcockpit.steerLimitRadian = 0.0f; // if we change this here we have to change it in playerships[t].steerLimitRadian too
645 ourcockpit.struts = 3;
647 ourcockpit.nextgen = true;
648 ourcockpit.bays = 1;
650 ourcockpit.emptyWeightLbs = 37827.200f;
651 ourcockpit.maxGrossLbs = 90537.660f; // in lbs
652 ourcockpit.bypassPercentage = 0.2f; // From Rise Vehicles sheet
653 ourcockpit.criticalEngineAltitudeKm = 6.0f; // @todo we need to revisit pricing on Rise Vehicles
654 ourcockpit.ffmax = 104.1665887f; // at 0.02 she burns 7500 lbs per hour 2.08 lbs per second
655 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // if we change this here, we have to change it on server
656 ourcockpit.fuelmax = 20000.0f;
657 ourcockpit.aoiWingRad = 0.0f;
658 viewscreen->cameras.emplace_back(SCamera(0.0f, 0.002396f, 0.007938f, true));
659 ourcockpit.appitagr = 2.0f; // aggressiveness for pitch on autopilot (2 is standard)
660 ourcockpit.aprolagr = 1.0f; // aggressiveness for roll on autopilot
662 ourcockpit.pitchLimitRadians = limiterC; // 30� control deflection stop
663 ourcockpit.machAngleDragScalar = sinf(atanf(0.943f));
665
666 // Determined from new Intertial Moment routine
667 ourcockpit.momentp = 5653430.5f / ourcockpit.emptyWeightLbs;//151.411484f;
668 ourcockpit.momentr = 1811122.625f / ourcockpit.emptyWeightLbs;//51.457165f;
669 ourcockpit.momenty = 7240540.5f / ourcockpit.emptyWeightLbs;//189.930054f;
670 ourcockpit.strutsrettoCGKm = 0.000348f; // so the bottom most polygon Z ... negated
672 ourcockpit.rooftoCGKm = 0.003482f;
673 ourcockpit.wingspanM = 33.777336f;
674 ourcockpit.rcsYParmM = 11.839479f;
675
676 // All of these must go through the spreadsheet
677 ourcockpit.f28SideDragCoefficient = 1.994480047f; // side drag coefficient
678 ourcockpit.f20FrontBackDragCoeff = 0.666857339f; // front/rear drag coefficient
679 ourcockpit.f27PlanDragCoefficient = 5.328341544f; // top/bottom drag coefficient
680 ourcockpit.f25 = 0.035702f; // landing gear extended coefficient
681 ourcockpit.h9RudderSqFt = 72.5818f; // rudder area
682 ourcockpit.h6ElevatorAreaSqFt = 147.2827f; // elevator area
683 ourcockpit.d16HTailWithElevatorSqFt = 437.963f; // hstab area
684 ourcockpit.d17VTailWithRudderSqFt = 288.7377f; // vstab area
685 ourcockpit.h12AileronAreaSqFt = 300.3932f; // aileron area (one side)
686 ourcockpit.d15TotalWingAreaSqFt = 1691.40f; // wing area
687 ourcockpit.b9DistanceToVTailM = 20.544979f; // DV (m)
688 ourcockpit.b6DistanceToHTailM = 20.782639f; // DH (m)
689 ourcockpit.b12WingRollArmM = 10.67159f; // wing roll arm
690 ourcockpit.b15WingPitchArmM = 7.398411f; // wing pitch arm
691 ourcockpit.c9WingYawArmM = 12.322233f; // wing yaw arm
692 ourcockpit.i48CriticalEngineYawArmM = 4.875f; // critical engine yaw arm (m)
693 ourcockpit.l48AverageEnginePitchArmM = -1.71160f; // critical engine pitch arm (m)
694 ourcockpit.d65wasd61 = 5.257788444f; // roll drag Cx
695 ourcockpit.e65wase61 = 6.910923f; // roll drag arm
696 ourcockpit.Vs2 = 0.040f; // for thrust aug top speed
697 ourcockpit.VcMSL = 0.286f;
698 ourcockpit.i66wasi62 = 79.67890442f; // ft� at m asym pitch body
699 ourcockpit.k66wask62 = 51.95791939f; // ft� at m asym pitch htail
700 ourcockpit.i65wasi61 = 39.61589503f; // ft� at m asym yaw body
701 ourcockpit.k65wask61 = 34.20395987f; // ft� at m asym yaw vtail
703 // negative pressure 2400 mb
704 // blast proof 2000 mb
705 }
706 break;
707 case VehicleType::C2:
708 {
709 ourcockpit.attenuate = 0.9f;
710 ourcockpit.shelfFreq = 8000;
711 ourcockpit.shelfGain = -6.0f;
712 ourcockpit.shelfSlope = 1.0f;
713 ourcockpit.lpFreq = 12000.0f;
714 ourcockpit.lpSlope = 2.0f;
715 ourcockpit.notchFreq = 1500.0f;
716 ourcockpit.notchGain = -3.0f;
717 ourcockpit.panFactor = 0.45f;
718
719 _sopen_s(&handle, "meshes\\C-2 Dasher INT.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
720 ourcockpit.launchPosition.x = 0.0f;
721 ourcockpit.launchPosition.y = -0.00009f; // down
722 ourcockpit.launchPosition.z = 0.001472f; // fwd, at the nose because the point between the lights is inside the cockpit
723 ourcockpit.spoolTime = 0.0f; // seconds
724 ourcockpit.suspensionTravelKm = 0.000234f; // 234 mm total travel gives 152 mm bump travel at normal static sag
728 ourcockpit.tireComplianceKm = 0.000025f; // 25 mm transient tire sidewall/tread compliance
730 ourcockpit.spaceCapable = false;
731 ourcockpit.wheeled = true;
733 ourcockpit.noseWheelToCgKm = 0.0010155f;
734 ourcockpit.steerLimitRadian = RiseMath::ToRadian(45.0f); // if we change this here we have to change it in playerships[t].steerLimitRadian too
735 //ourcockpit.tires = 4;
736 ourcockpit.tireRadiusKm = 0.0002155f; // 0.000431f diameter or 17" if we change this here we have to change it in playerships[t].tireCircumferenceKm
737
738
739 // Dodge Dynasty style 3-speed automatic, no overdrive.
740 // Earth-ish 0-60 mph target for a weak Dynasty: ~13-16 sec
741 // Vieneo 2.2 ATM adjusted 0 - 60 mph: ~18 - 24 se
742 // Earth top speed target for a weak Dynasty: ~168 kph / 104 mph.
743 // The model-derived wind-tunnel drag is much higher than a Dynasty body,
744 // so observed Vieneo 2.2 ATM practical top speed is closer to ~85-90 kph.
745 // Power is not reduced for intake because this vehicle is not naturally aspirated.
746 ourcockpit.fwdthrustlimit = 0.0085f; // ~100 hp Dynasty I4; target top speed ~168 kph / 104 mph with finalDrive 2.16
747 ourcockpit.clutchtime = 0.5f;
749 ourcockpit.idleRPM = 800.0f;
750 ourcockpit.redlineRPM = 5500.0f;
751
752 // Dodge Dynasty style 3-speed automatic, no overdrive.
753 // Transmission ratios approximated from Chrysler/Dodge 3-speed automatic:
754 // storedRatio = finalDrive / transmissionGearRatio
755 const float finalDrive = 2.16f;
756 ourcockpit.ratios[0] = -finalDrive / 2.13f; // reverse
757 ourcockpit.ratios[1] = finalDrive / 2.69f; // 1st
758 ourcockpit.ratios[2] = finalDrive / 1.55f; // 2nd
759 ourcockpit.ratios[3] = finalDrive / 1.00f; // 3rd/direct
760
761
762
764 ourcockpit.nextgen = false;
765 ourcockpit.bays = 0;
767 ourcockpit.emptyWeightLbs = 2017.019f; // in lbs
768 ourcockpit.maxGrossLbs = 2420.465f; // in lbs
769 ourcockpit.ffmax = 0.015f; // gndvehicles are in lbs per second, 4.6 hours at full throttle! no ... now 66 minutes at full throttle
770 ourcockpit.fuelFlowIdleLbsPerSec = ourcockpit.ffmax * 0.1f; // idle sucks fuel because RPM is 0.001f
771 ourcockpit.fuelmax = 60.0f;
772 viewscreen->cameras.emplace_back(SCamera(-0.000399f, 0.000468f, 0.000347f, true));
773 ourcockpit.scanDisplayVesselLimit = 19; // plus waypt
774 ourcockpit.exteriorInsulationHeatTransferCoefficient = 0.52f; // polymer, high-density
775
776 // Determined from new Intertial Moment routine
777 ourcockpit.momentp = 1179.111572f / ourcockpit.emptyWeightLbs;//2.59611f;
778 ourcockpit.momentr = 233.144287f / ourcockpit.emptyWeightLbs;//0.934778f;
779 ourcockpit.momenty = 1260.210083f / ourcockpit.emptyWeightLbs;//3.360088f; // at 60mph 96kmh 16mpg 8ppg
780 ourcockpit.strutsrettoCGKm = 0.000609f; // so the bottom most polygon Z ... negated
781 ourcockpit.rooftoCGKm = 0.000813f;//-ourcockpit.cockpitarm.y; // 4 units
782
783 // All of these must go through the spreadsheet
784 ourcockpit.f28SideDragCoefficient = 0.079903875f; // side drag coefficient
785 ourcockpit.f20FrontBackDragCoeff = 0.07239518f; // front/rear drag coefficient
786 ourcockpit.f25 = 0.0f; // landing gear extended adjustment
787 ourcockpit.f27PlanDragCoefficient = 0.14309f; // top/bottom drag coefficient
788 ourcockpit.d65wasd61 = 0.157540994f; // roll drag Cx
789 ourcockpit.e65wase61 = 2.026435f; // roll drag arm
790 ourcockpit.i66wasi62 = 0.0f; // ft� at m asym pitch body
791 ourcockpit.k66wask62 = 0.0f; // ft� at m asym pitch htail
792 ourcockpit.i65wasi61 = 0.0f; // ft� at m asym yaw body
793 ourcockpit.k65wask61 = 0.0f; // ft� at m asym yaw vtail
794 }
795 break;
796 case VehicleType::C2A:
797 {
798 ourcockpit.attenuate = 0.9f;
799 ourcockpit.shelfFreq = 8000.0f;
800 ourcockpit.shelfGain = -6.0f;
801 ourcockpit.shelfSlope = 1.0f;
802 ourcockpit.lpFreq = 12000.0f;
803 ourcockpit.lpSlope = 2.0f;
804 ourcockpit.notchFreq = 1500.0f;
805 ourcockpit.notchGain = -3.0f;
806 ourcockpit.panFactor = 0.45f;
807
808 _sopen_s(&handle, "meshes\\C-2A Dasher INT.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
809 ourcockpit.launchPosition.x = 0.0f;
810 ourcockpit.launchPosition.y = -0.00009f; // down
811 ourcockpit.launchPosition.z = 0.001472f; // fwd, at the nose because the point between the lights is inside the cockpit
812 ourcockpit.spoolTime = 0.0f; // seconds
813 ourcockpit.revthrustlimit = 0.0f; // unused
814 ourcockpit.suspensionTravelKm = 0.000234f; // 234 mm total travel gives 152 mm bump travel at normal static sag
818 ourcockpit.tireComplianceKm = 0.000040f; // larger C2A tire has more transient compliance
820 ourcockpit.spaceCapable = false;
821 ourcockpit.wheeled = true;
823 ourcockpit.noseWheelToCgKm = 0.001012f; // if we change this here we have to change it in playerships[t].tireCircumferenceKm
824 ourcockpit.steerLimitRadian = RiseMath::ToRadian(45.0f); // if we change this here we have to change it in playerships[t].steerLimitRadian too
825 //ourcockpit.tires = 4;
826 ourcockpit.tireRadiusKm = 0.000348f; // 0.000686f diameter or 27.4"
827
828
829 // 2016 Jeep Renegade
830 // But using the 2004 Jeep Wrangler 42RLE automatic style ratios.
831 // We are using 1st, 2nd, and 3rd only.
832 // 3rd is direct drive; 4th is overdrive and is intentionally omitted.
833 ourcockpit.fwdthrustlimit = 0.0136f; // ~160 hp 2016 Jeep Renegade 1.4L turbo; scaled from 100 hp Dynasty @ 0.0085f
834 ourcockpit.clutchtime = 0.35f;
836 ourcockpit.idleRPM = 700.0f;
837 ourcockpit.redlineRPM = 5500.0f;
838 const float axleRatio = 3.06f; // often listed for Std X/Sport automatic references
839 ourcockpit.ratios[0] = -axleRatio / 2.21f; // reverse
840 ourcockpit.ratios[1] = axleRatio / 2.84f; // 1st
841 ourcockpit.ratios[2] = axleRatio / 1.57f; // 2nd
842 ourcockpit.ratios[3] = axleRatio / 1.00f; // 3rd
843
844
846 ourcockpit.nextgen = false;
847 ourcockpit.bays = 0;
849 ourcockpit.emptyWeightLbs = 3450.0f; // in lbs
850 ourcockpit.maxGrossLbs = ourcockpit.emptyWeightLbs + 800.0f; // in lbs
851 ourcockpit.ffmax = 0.015f; // gndvehicles are in lbs per second, 4.6 hours at full throttle! no ... now 66 minutes at full throttle
852 ourcockpit.fuelFlowIdleLbsPerSec = ourcockpit.ffmax * 0.1f; // idle sucks fuel because RPM is 0.001f
853 ourcockpit.fuelmax = 60.0f;
854 viewscreen->cameras.emplace_back(SCamera(-0.0002f, 0.0002f, -0.0002f, true));
855 ourcockpit.scanDisplayVesselLimit = 19; // plus waypt
856 ourcockpit.exteriorInsulationHeatTransferCoefficient = 1.06f; // Plastic, fiber-reinforced
857
858 // Determined from new Inertial Moment routine
862 ourcockpit.rooftoCGKm = 0.000813f;
863 ourcockpit.strutsrettoCGKm = 0.000545f; // so the bottom most polygon Z ... negated
864 // All of these must go through the spreadsheet
865 ourcockpit.f28SideDragCoefficient = 0.061763652f; // side drag coefficient
866 ourcockpit.f20FrontBackDragCoeff = 0.037093f; // front/rear drag coefficient
867 ourcockpit.f25 = 0.0f; // landing gear extended adjustment
868 ourcockpit.f27PlanDragCoefficient = 0.1023068197f; // top/bottom drag coefficient
869 ourcockpit.d65wasd61 = 0.0f; // roll drag Cx
870 ourcockpit.e65wase61 = 0.0f; // roll drag arm
871 ourcockpit.i66wasi62 = 0.0f; // ft� at m asym pitch body
872 ourcockpit.k66wask62 = 0.0f; // ft� at m asym pitch htail
873 ourcockpit.i65wasi61 = 0.0f; // ft� at m asym yaw body
874 ourcockpit.k65wask61 = 0.0f; // ft� at m asym yaw vtail
875 }
876 break;
878 {
879 ourcockpit.attenuate = 0.85f;
880 ourcockpit.shelfFreq = 5000.0f;
881 ourcockpit.shelfGain = -9.0f;
882 ourcockpit.shelfSlope = 1.5f;
883 ourcockpit.lpFreq = 7000.0f;
884 ourcockpit.lpSlope = 4.0f;
885 ourcockpit.notchFreq = 1200.0f;
886 ourcockpit.notchGain = -4.0f;
887 ourcockpit.panFactor = 0.35f;
888
889 _sopen_s(&handle, "meshes\\T-120 Steerhead-stock INT.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
890 ourcockpit.launchPosition.x = 0.0f;
891 ourcockpit.launchPosition.y = -0.00026364f; // down
892 ourcockpit.launchPosition.z = 0.0167f; // fwd, at the nose because the point between the lights is inside the cockpit
893 ourcockpit.fwdthrustlimit = 260.0f * hp2fwdthrust; // ~260 hp newer Freightliner M2 / International MV / Cummins B6.7-style box truck0.0162f; // ~190 hp old International/DT466-style box truck; 0.0085f * 190/100
894 ourcockpit.spoolTime = 0.0f; // seconds
895 ourcockpit.revthrustlimit = 0.0f; // unused
896 ourcockpit.suspensionTravelKm = 0.000300f;
900 ourcockpit.tireComplianceKm = 0.000045f;
902 ourcockpit.spaceCapable = false;
903 ourcockpit.wheeled = true;
905 ourcockpit.noseWheelToCgKm = 0.002336f;
906 ourcockpit.steerLimitRadian = RiseMath::ToRadian(45.0f); // if we change this here we have to change it in playerships[t].steerLimitRadian too
907 //ourcockpit.tires = 10;
908 ourcockpit.tireRadiusKm = 0.0004065f; // 0.000813 diameter or 32" if we change this here we have to change it in playerships[t].tireCircumferenceKm
909 ourcockpit.clutchtime = 0.65f; // older/slushier medium-duty automatic feel
911 ourcockpit.idleRPM = 800.0f;
912 ourcockpit.redlineRPM = 5500.0f;
914 ourcockpit.fwdgears = 6; // 7 speed is 6 fwd, 1 rev
915 // 1/17.77 to 1/0.71 is 0.22536268067983968338260665097319 per gear
916 ourcockpit.ratios[0] = -0.147275f; // REV-HI
917 ourcockpit.ratios[1] = 0.091407f; // 1st-HI
918 ourcockpit.ratios[2] = 0.152207f; // 2nd-HI
919 ourcockpit.ratios[3] = 0.393700f; // 3rd
920 ourcockpit.ratios[4] = 0.636942f; // 4th
921 ourcockpit.ratios[5] = 1.0f; // 5th
922 ourcockpit.ratios[6] = 1.408450f; // 6th
923 // differential?
924 ourcockpit.ratios[0] *= 1.35479f; // bigger number gives it less power, higher allowable speed
925 ourcockpit.ratios[1] *= 1.35479f;
926 ourcockpit.ratios[2] *= 1.35479f;
927 ourcockpit.ratios[3] *= 1.35479f;
928 ourcockpit.ratios[4] *= 1.35479f;
929 ourcockpit.ratios[5] *= 1.35479f;
930 ourcockpit.ratios[6] *= 1.35479f;
931
933 ourcockpit.nextgen = false;
934 ourcockpit.bays = 1;
936 ourcockpit.emptyWeightLbs = 15590.672f;
937 ourcockpit.maxGrossLbs = 55073.412f;
938 ourcockpit.ffmax = 0.251f; // gndvehicles are in lbs per second
939 ourcockpit.fuelFlowIdleLbsPerSec = ourcockpit.ffmax * 0.1f; // idle sucks fuel because RPM is 0.001f
940 ourcockpit.fuelmax = 1800.0f;
941 viewscreen->cameras.emplace_back(SCamera(-0.000424f, 0.001683f, 0.001990f, true));
942 ourcockpit.scanDisplayVesselLimit = 19; // plus waypt
943 ourcockpit.exteriorInsulationHeatTransferCoefficient = 24.0f; // stainless steel
944
945 // Determined from new Intertial Moment routine
946 ourcockpit.momentp = 61169.5f / ourcockpit.emptyWeightLbs;//2.59611f;
947 ourcockpit.momentr = 17747.185547f / ourcockpit.emptyWeightLbs;//0.934778f;
948 ourcockpit.momenty = 78233.773438f / ourcockpit.emptyWeightLbs;//3.360088f; // at 60mph 96kmh 16mpg 8ppg
949 ourcockpit.strutsrettoCGKm = 0.000813f; // so the bottom most polygon Z ... negated
950 ourcockpit.rooftoCGKm = 0.002031f;//-ourcockpit.cockpitarm.y; // 4 units
951
952 // All of these must go through the spreadsheet
953 ourcockpit.f28SideDragCoefficient = 0.199476331f; // side drag coefficient
954 ourcockpit.f20FrontBackDragCoeff = 0.194659f; // front/rear drag coefficient
955 ourcockpit.f25 = 0.0f; // landing gear extended adjustment
956 ourcockpit.f27PlanDragCoefficient = 0.374018f; // top/bottom drag coefficient
957 ourcockpit.d65wasd61 = 0.30034791f; // roll drag Cx
958 ourcockpit.e65wase61 = 3.975927f; // roll drag arm
959 ourcockpit.i66wasi62 = 0.0f; // ft� at m asym pitch body
960 ourcockpit.k66wask62 = 0.0f; // ft� at m asym pitch htail
961 ourcockpit.i65wasi61 = 0.0f; // ft� at m asym yaw body
962 ourcockpit.k65wask61 = 0.0f; // ft� at m asym yaw vtail
963 }
964 break;
966 {
967 ourcockpit.attenuate = 0.85f;
968 ourcockpit.shelfFreq = 5000.0f;
969 ourcockpit.shelfGain = -9.0f;
970 ourcockpit.shelfSlope = 1.5f;
971 ourcockpit.lpFreq = 7000.0f;
972 ourcockpit.lpSlope = 4.0f;
973 ourcockpit.notchFreq = 1200.0f;
974 ourcockpit.notchGain = -4.0f;
975 ourcockpit.panFactor = 0.35f;
976
977 _sopen_s(&handle, "meshes\\2007 T-120 INT.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
978 ourcockpit.launchPosition.x = 0.0f;
979 ourcockpit.launchPosition.y = -0.00026364f; // down
980 ourcockpit.launchPosition.z = 0.0167f; // fwd, at the nose because the point between the lights is inside the cockpit
981 ourcockpit.fwdthrustlimit = 350.0f * hp2fwdthrust; // ~350 hp newer Freightliner M2 / International MV / Cummins B6.7-style box truck
982 ourcockpit.spoolTime = 0.0f; // seconds
983 ourcockpit.revthrustlimit = 0.0f; // unused
984 ourcockpit.suspensionTravelKm = 0.000300f;
988 ourcockpit.tireComplianceKm = 0.000045f;
990 ourcockpit.spaceCapable = false;
991 ourcockpit.wheeled = true;
993 ourcockpit.noseWheelToCgKm = 0.002336f;
994 ourcockpit.steerLimitRadian = RiseMath::ToRadian(45.0f); // if we change this here we have to change it in playerships[t].steerLimitRadian too
995 //ourcockpit.tires = 14;
996 ourcockpit.tireRadiusKm = 0.0004065f; // 0.000813 diameter or 32" if we change this here we have to change it in playerships[t].tireCircumferenceKm
997 ourcockpit.clutchtime = 0.45f; // newer/firmer commercial automatic feel
999 ourcockpit.idleRPM = 800.0f;
1000 ourcockpit.redlineRPM = 5500.0f;
1001 ourcockpit.tachDisplayMaxRPM = 8000.0f;
1002 ourcockpit.fwdgears = 6; // 7 speed is 6 fwd, 1 rev
1003 // 1/17.77 to 1/0.71 is 0.22536268067983968338260665097319 per gear
1004 ourcockpit.ratios[0] = -0.081407f; // REV-HI
1005 ourcockpit.ratios[1] = 0.091407f; // 1st-HI
1006 ourcockpit.ratios[2] = 0.152207f; // 2nd-HI
1007 ourcockpit.ratios[3] = 0.393700f; // 3rd
1008 ourcockpit.ratios[4] = 0.636942f; // 4th
1009 ourcockpit.ratios[5] = 1.0f; // 5th
1010 ourcockpit.ratios[6] = 1.408450f; // 6th
1011 // differential?
1012 ourcockpit.ratios[0] *= 1.35479f; // bigger number gives it less power, higher allowable speed
1013 ourcockpit.ratios[1] *= 1.35479f;
1014 ourcockpit.ratios[2] *= 1.35479f;
1015 ourcockpit.ratios[3] *= 1.35479f;
1016 ourcockpit.ratios[4] *= 1.35479f;
1017 ourcockpit.ratios[5] *= 1.35479f;
1018 ourcockpit.ratios[6] *= 1.35479f;
1019
1021 ourcockpit.nextgen = false;
1022 ourcockpit.bays = 1;
1023 ourcockpit.engines = 1;
1024 ourcockpit.emptyWeightLbs = 15590.672f;
1025 ourcockpit.maxGrossLbs = 55073.412f;
1026 ourcockpit.ffmax = 0.251f; // gndvehicles are in lbs per second
1027 ourcockpit.fuelFlowIdleLbsPerSec = ourcockpit.ffmax * 0.1f; // idle sucks fuel because RPM is 0.001f
1028 ourcockpit.fuelmax = 1800.0f;
1029 viewscreen->cameras.emplace_back(SCamera(-0.000424f, 0.001683f, 0.001990f, true));
1030 ourcockpit.scanDisplayVesselLimit = 19; // plus waypt
1031 ourcockpit.exteriorInsulationHeatTransferCoefficient = 24.0f; // stainless steel
1032
1033 // Determined from new Intertial Moment routine
1034 ourcockpit.momentp = 61169.5f / ourcockpit.emptyWeightLbs;//2.59611f;
1035 ourcockpit.momentr = 17747.185547f / ourcockpit.emptyWeightLbs;//0.934778f;
1036 ourcockpit.momenty = 78233.773438f / ourcockpit.emptyWeightLbs;//3.360088f; // at 60mph 96kmh 16mpg 8ppg
1037 ourcockpit.strutsrettoCGKm = 0.000813f; // so the bottom most polygon Z ... negated
1038 ourcockpit.rooftoCGKm = 0.002031f;//-ourcockpit.cockpitarm.y; // 4 units
1039
1040 // All of these must go through the spreadsheet
1041 ourcockpit.f28SideDragCoefficient = 0.199476331f; // side drag coefficient
1042 ourcockpit.f20FrontBackDragCoeff = 0.194659f; // front/rear drag coefficient
1043 ourcockpit.f25 = 0.0f; // landing gear extended adjustment
1044 ourcockpit.f27PlanDragCoefficient = 0.374018f; // top/bottom drag coefficient
1045 ourcockpit.d65wasd61 = 0.30034791f; // roll drag Cx
1046 ourcockpit.e65wase61 = 3.975927f; // roll drag arm
1047 ourcockpit.i66wasi62 = 0.0f; // ft� at m asym pitch body
1048 ourcockpit.k66wask62 = 0.0f; // ft� at m asym pitch htail
1049 ourcockpit.i65wasi61 = 0.0f; // ft� at m asym yaw body
1050 ourcockpit.k65wask61 = 0.0f; // ft� at m asym yaw vtail
1051 }
1052 break;
1053 case VehicleType::E11:
1054 {
1055 ourcockpit.attenuate = 0.6f;
1056 ourcockpit.shelfFreq = 4000.0f;
1057 ourcockpit.shelfGain = -10.0f;
1058 ourcockpit.shelfSlope = 3.0f;
1059 ourcockpit.lpFreq = 6000.0f;
1060 ourcockpit.lpSlope = 6.0f;
1061 ourcockpit.notchFreq = 1000.0f;
1062 ourcockpit.notchGain = -5.0f;
1063 ourcockpit.panFactor = 0.05f;
1064
1065 ourcockpit.pitchToAddInTurn = 0.2f; // assume half-ass job ... trying to double on 11/4/2023
1066 ourcockpit.VrefMod = 1.5f;
1067 _sopen_s(&handle, "meshes\\e11cockpit1.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1068 ourcockpit.launchPosition.x = 0.0f;
1069 ourcockpit.launchPosition.y = -0.00026364f; // down
1070 ourcockpit.launchPosition.z = 0.02f; // fwd, at the nose because the point between the lights is inside the cockpit
1071 ourcockpit.uptranslimit = 0.006125f; // at max gross
1072 ourcockpit.dntranslimit = 0.01316f; // at max gross // 6550
1073 ourcockpit.lrtranslimit = 0.00625f; // at max gross
1074 ourcockpit.fwdthrustlimit = 0.01316f; // at max gross
1075 ourcockpit.spoolTime = 5.8f; // seconds (was 6.5 before we had spoolTime!)
1076 ourcockpit.revthrustlimit = 0.01316f; // at max gross
1077 ourcockpit.landingGearAbsorbKms = 0.002205393f * 5.0f; // meter/s
1078 ourcockpit.spaceCapable = true;
1079 ourcockpit.wheeled = false;
1082 ourcockpit.steerLimitRadian = 0.0f; // if we change this here we have to change it in playerships[t].steerLimitRadian too
1083 ourcockpit.struts = 3;
1086 ourcockpit.nextgen = true;
1087 ourcockpit.bays = 6;
1088 ourcockpit.engines = 3;
1089 ourcockpit.emptyWeightLbs = 251179.705f; // lbs
1090 ourcockpit.maxGrossLbs = 525100.400f;
1091 ourcockpit.ffmax = 419.0609889f; // at 0.01316 she burns 19854 lbs per hour 5.515 lbs per second
1092 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // 52 lbs/hr
1093 ourcockpit.fuelmax = 60000.0f; // lbs
1094 ourcockpit.aoiWingRad = 0.0f;
1096 viewscreen->cameras.emplace_back(SCamera(-0.0006964394f, 0.00121876895f, 0.0184556441f, true));
1097 ourcockpit.appitagr = 3.5f; // aggressiveness for pitch on autopilot (2 is standard)
1098 ourcockpit.aprolagr = 6.0f; // aggressiveness for roll on autopilot
1099 ourcockpit.dockOffsetKmZ = 0.0027f;
1101 ourcockpit.exteriorInsulationHeatTransferCoefficient = 0.045f; // fiberglass or foam-glass
1102 ourcockpit.pitchLimitRadians = limiterC; // 30 degree control deflection stop
1103 ourcockpit.machAngleDragScalar = sinf(atanf(1.320f));
1105 ourcockpit.engineEfficiencyAtSeaLevelScalar = 0.93f; // based on falcon 9 on earth which means this is 2.5x as efficient!
1106
1107 // Determined from new Intertial Moment routine
1108 ourcockpit.momentp = 124.982147f;
1109 ourcockpit.momentr = 71.806427f;
1110 ourcockpit.momenty = 186.511765f;
1111 ourcockpit.strutsrettoCGKm = 0.003134f; // so the bottom most polygon Z ... negated
1112 ourcockpit.landingGearLengthKm = 0.002438f;
1113 ourcockpit.rooftoCGKm = 0.002089f; // might need to be negative 0.0013928788f; // 4 units
1114 ourcockpit.wingspanM = 48.750797f;
1115 ourcockpit.rcsYParmM = 16.714558f;
1116
1117 // All of these must go through the spreadsheet
1118 ourcockpit.f28SideDragCoefficient = 4.961967f; // side drag coefficient
1119 ourcockpit.f20FrontBackDragCoeff = 2.696208f; // front/rear drag coefficient
1120 ourcockpit.f27PlanDragCoefficient = 14.258089f; // top/bottom drag coefficient
1121
1123 ourcockpit.f25 = 0.048997f; // landing gear extended adjustment
1124
1125 ourcockpit.h9RudderSqFt = 131.1158f; // rudder area ft�
1126 ourcockpit.h6ElevatorAreaSqFt = 236.8446f; // elevator area ft�
1127 ourcockpit.d16HTailWithElevatorSqFt = 1686.596f; // hstab area ft�
1128 ourcockpit.d17VTailWithRudderSqFt = 853.2926f; // vstab area ft�
1129 ourcockpit.h12AileronAreaSqFt = 235.7941f; // aileron area (one side) ft�
1130 ourcockpit.d15TotalWingAreaSqFt = 4595.27f; // wing area ft�
1131 ourcockpit.b9DistanceToVTailM = 26.842907f; // DV (m)
1132 ourcockpit.b6DistanceToHTailM = 27.946484f; // DH (m)
1133 ourcockpit.b12WingRollArmM = 13.132276f; // wing roll arm (m)
1134 ourcockpit.b15WingPitchArmM = 6.826286f; // wing pitch arm (m)
1135 ourcockpit.c9WingYawArmM = 15.407158f; // wing yaw arm (m)
1136 ourcockpit.i48CriticalEngineYawArmM = 18.804f; // critical engine yaw arm (m)
1137 ourcockpit.l48AverageEnginePitchArmM = -0.38014f; // critical engine pitch arm (m)
1138 ourcockpit.d65wasd61 = 14.25808948f; // roll drag Cx
1139 ourcockpit.e65wase61 = 4.597237f; // roll drag arm (m)
1140 ourcockpit.Vs2 = 0.168f; // for thrust aug top speed, avionics setting not from spreadsheet, use Vr
1141 ourcockpit.VcMSL = 0.146f;
1142 ourcockpit.i65wasi61 = 8.88199401f; // ft� at m asym yaw body
1143 ourcockpit.k65wask61 = 41.92212376f; // ft� at m asym yaw vtail
1144 ourcockpit.i66wasi62 = 26.0577836f; // ft� at m asym pitch body
1145 ourcockpit.k66wask62 = 66.56828893f; // ft� at m asym pitch htail
1147 ourcockpit.Vle = 0.125f; // based on C-17
1148 ourcockpit.MaxDoorOpenOperatingKms = 0.125f; // based on C-17
1149 }
1150 break;
1151 case VehicleType::T19:
1152 {
1153 ourcockpit.attenuate = 0.7f;
1154 ourcockpit.shelfFreq = 6000.0f;
1155 ourcockpit.shelfGain = -8.0f;
1156 ourcockpit.shelfSlope = 2.5f;
1157 ourcockpit.lpFreq = 8000.0f;
1158 ourcockpit.lpSlope = 4.0f;
1159 ourcockpit.notchFreq = 1200.0f;
1160 ourcockpit.notchGain = -4.0f;
1161 ourcockpit.panFactor = 0.15f;
1162
1163 _sopen_s(&handle, "meshes\\stratomaster_06-hex.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1164 ourcockpit.launchPosition.x = 0.0f;
1165 ourcockpit.launchPosition.y = -0.00026364f; // down
1166 ourcockpit.launchPosition.z = 0.0167f; // fwd, at the nose because the point between the lights is inside the cockpit
1167 ourcockpit.fwdthrustlimit = 0.005f * 1.25f; // T-1
1168 ourcockpit.spoolTime = 2.5f; // seconds
1169 ourcockpit.revthrustlimit = 0.005f * 0.3f * 1.25f; // at max gross // https://aviation.stackexchange.com/questions/14597/how-much-thrust-can-the-thrust-reversers-create
1170 ourcockpit.landingGearAbsorbKms = 0.002438f * 5.0f; // meter/s
1171 ourcockpit.spaceCapable = false;
1172 ourcockpit.wheeled = true; // first one ever
1174 ourcockpit.steerLimitRadian = 1.22173f; // 70 degrees with tiller, if we change this here we have to change it in playerships[t].steerLimitRadian too
1175 ourcockpit.struts = 3;
1176 ourcockpit.tireRadiusKm = 0.000406f; // 0.000813f diameter same as T-1 if we change this here we have to change it in playerships[t].tireCircumferenceKm
1178 ourcockpit.nextgen = true;
1180 // based on the CRJ-200
1181 ourcockpit.flapSettings.emplace_back(FlapSetting(0, 0));
1182 ourcockpit.flapSettings.emplace_back(FlapSetting(8, 0.115f));
1183 ourcockpit.flapSettings.emplace_back(FlapSetting(20, 0.115f));
1184 ourcockpit.flapSettings.emplace_back(FlapSetting(30, 0.098f));
1185 ourcockpit.flapSettings.emplace_back(FlapSetting(40, 0.0955f));
1186
1187 ourcockpit.bays = 1; // T-1
1188 ourcockpit.engines = 2;
1189 ourcockpit.emptyWeightLbs = 27712.430f; // T-1
1190 ourcockpit.maxGrossLbs = 87054.186f; // T-1
1191 ourcockpit.bypassPercentage = 0.5f; // Per the Rise Vehicles sheet
1192 ourcockpit.criticalEngineAltitudeKm = 12.0f; // @todo we need to revisit pricing on Rise Vehicles
1193 ourcockpit.ffmax = 100.0f; // at 0.02 she burns 7500 lbs per hour 2.08 lbs per second
1194 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // if we change this here, we have to change it on server
1195 ourcockpit.fuelmax = 20000.0f;
1196 ourcockpit.aoiWingRad = 0.05f; // went from 0 to 3 degrees 5/26/2019 ... GA aircraft are usually 6 degrees
1197 ourcockpit.appitagr = 1.2f; // aggressiveness for pitch on autopilot (2 is standard) ... bumped up from 0.6 to 1.2 on 3/14/2023
1198 ourcockpit.aprolagr = 8.0f; // aggressiveness for roll on autopilot (1 is standard) was 2
1199 ourcockpit.apYawTurnCoordination = 1.0f; // @todo this should be one of beta-assist knobs
1200 ourcockpit.exteriorInsulationHeatTransferCoefficient = 56.1f; // aluminum alloy
1201 ourcockpit.pitchLimitRadians = limiterC; // 30� control deflection stop
1202 ourcockpit.machAngleDragScalar = sinf(atanf(1.315f));
1204
1205
1206 // Determined from NEWEST Intertial Moment routine, these change with CG and volumes now stored in ASM
1207 ourcockpit.momentp = 3765956.0f / ourcockpit.emptyWeightLbs; // T-1
1208 ourcockpit.momentr = 168191.3125f / ourcockpit.emptyWeightLbs; // T-1
1209 ourcockpit.momenty = 3868101.75f / ourcockpit.emptyWeightLbs; // T-1
1210
1211 ourcockpit.wingspanM = 29.923187f; // to determine when we are 1/2 the wingspan above the ground for ground effect
1212 ourcockpit.wingElevationM = 1.558785f; // positive is above the CG
1213 ourcockpit.rooftoCGKm = 0.002089f;
1214 ourcockpit.strutsrettoCGKm = 0.002263f; // so the bottom most polygon Z ... negated
1215 ourcockpit.noseWheelToCgKm = 0.006125f; // @todo this is one that changes with the forward/aft CG
1216 ourcockpit.landingGearLengthKm = 0.000843f;
1217 ourcockpit.wheelBaseKm = 0.007719f;
1218 ourcockpit.rcsYParmM = 11.143039f; // I don't think this is used on the T-19, related to RCS
1219 viewscreen->cameras.emplace_back(SCamera(-0.000591f, -0.000044f, 0.007574f, true));
1220 // @todo so there are some very predictable changes to B6, B9, C9, B15, I48, L48, H65-66, J65-66
1221
1222 // This one doesn't go through the spreadsheet, comes directly from windtunnel
1223 ourcockpit.spoilerAreaSqM = 19.020607f;
1224
1225 // All of these must go through the spreadsheet
1226 ourcockpit.f28SideDragCoefficient = 1.367459572f; // side drag coefficient
1227 ourcockpit.f20FrontBackDragCoeff = 0.245684f; // frontal drag coefficient
1228 ourcockpit.f27PlanDragCoefficient = 5.668763911f; // bottom drag coefficient
1229 ourcockpit.f25 = 0.085574f; // landing gear extended coefficient
1230 ourcockpit.h9RudderSqFt = 141.1862f; // rudder area
1231 ourcockpit.h6ElevatorAreaSqFt = 179.1441f; // elevator area
1232 ourcockpit.d16HTailWithElevatorSqFt = 591.63f; // hstab area sq.ft. // used to be 910.97f before 3/18/2023
1233 ourcockpit.d17VTailWithRudderSqFt = 402.05f; // vstab area sq.ft.
1234 ourcockpit.h12AileronAreaSqFt = 76.7760f; // aileron area (one side)
1235 ourcockpit.d15TotalWingAreaSqFt = 2084.35f; // wing area
1236 ourcockpit.k12flapsAreaSqMTE = 14.265455f; // from windtunnel
1237 // in reality it looks like it is a SPAN ratio not an AREA ratio but we don't have SPAN data
1239 ourcockpit.b9DistanceToVTailM = 19.553423f; // DV (m)
1240 ourcockpit.b6DistanceToHTailM = 19.021120f; // DH (m)
1241 ourcockpit.b12WingRollArmM = 9.893749f; // wing roll arm
1242 ourcockpit.b15WingPitchArmM = 4.329031f; // wing pitch arm
1243 ourcockpit.c9WingYawArmM = 4.186644f; // wing yaw arm
1244 ourcockpit.i48CriticalEngineYawArmM = 2.89181f; // critical engine yaw arm (m)
1245 ourcockpit.l48AverageEnginePitchArmM = -0.26026f; // critical engine pitch arm (m)
1247 ourcockpit.d65wasd61 = 20.3403858f; // roll drag Cx
1248 ourcockpit.e65wase61 = 2.948313f; // roll drag arm
1249 ourcockpit.i65wasi61 = 3.887601001f; // ft� at m asym yaw body weathervaning
1250 ourcockpit.k65wask61 = 11.70855105f; // ft� at m asym yaw vtail weathervaning
1251 ourcockpit.i66wasi62 = 14.17444094f; // ft� at m asym pitch body weathervaning
1252 ourcockpit.k66wask62 = 17.34993622f; // ft� at m asym pitch htail weathervaning
1253
1254 ourcockpit.flapMaxDegrees = 40.0f;
1255 ourcockpit.VcMSL = 0.130f;
1256 ourcockpit.VrEmpty = 0.097f;
1257 ourcockpit.VrMaxGross = 0.097f;
1259 }
1260 break;
1262 {
1263 ourcockpit.attenuate = 0.6f;
1264 ourcockpit.shelfFreq = 4000.0f;
1265 ourcockpit.shelfGain = -10.0f;
1266 ourcockpit.shelfSlope = 3.0f;
1267 ourcockpit.lpFreq = 6000.0f;
1268 ourcockpit.lpSlope = 6.0f;
1269 ourcockpit.notchFreq = 1000.0f;
1270 ourcockpit.notchGain = -5.0f;
1271 ourcockpit.panFactor = 0.05f;
1272
1273 ourcockpit.attenuate = 0.6f;
1274 _sopen_s(&handle, "meshes\\manx-int-hex.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1275 ourcockpit.launchPosition.x = 0.0f;
1276 ourcockpit.launchPosition.y = -0.00026364f; // down
1277 ourcockpit.launchPosition.z = 0.02f; // fwd, at the nose because the point between the lights is inside the cockpit
1278 ourcockpit.uptranslimit = 0.00625f; // at max gross
1279 ourcockpit.dntranslimit = 0.0116f * 0.5f; // at max gross // 6550
1280 ourcockpit.lrtranslimit = 0.00625f; // at max gross
1281 ourcockpit.fwdthrustlimit = 0.00980665f; // at max gross
1282 ourcockpit.spoolTime = 5.8f; // seconds, from E-10
1283 ourcockpit.revthrustlimit = 0.00980665f; // at max gross
1284 ourcockpit.landingGearAbsorbKms = 0.002205393f * 5.0f; // meter/s
1285 ourcockpit.spaceCapable = true;
1286 ourcockpit.wheeled = true;
1288 ourcockpit.steerLimitRadian = 1.22173f; // 70 degrees with tiller, if we change this here we have to change it in playerships[t].steerLimitRadian too
1289 ourcockpit.struts = 3;
1290 ourcockpit.tireRadiusKm = 0.00069f; // 0.00138 diameter 54.33 inches if we change this here we have to change it in playerships[t].tireCircumferenceKm
1292 ourcockpit.nextgen = true;
1294 // based on the CRJ-200
1295 ourcockpit.flapSettings.emplace_back(FlapSetting(0, 0));
1296 ourcockpit.flapSettings.emplace_back(FlapSetting(8, 0.115f));
1297 ourcockpit.flapSettings.emplace_back(FlapSetting(20, 0.115f));
1298 ourcockpit.flapSettings.emplace_back(FlapSetting(30, 0.098f));
1299 ourcockpit.flapSettings.emplace_back(FlapSetting(40, 0.0955f));
1300 ourcockpit.bays = 3;
1301 ourcockpit.engines = 2;
1302 ourcockpit.emptyWeightLbs = 110231.0f;
1303 ourcockpit.maxGrossLbs = 231503.619f;
1304 ourcockpit.ffmax = 254.9199551f; // from Rise Vehicles AD10
1305 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // 52 lbs/hr
1306 ourcockpit.fuelmax = 26455.0f; // lbs
1307 ourcockpit.aoiWingRad = 0.0f;
1308 ourcockpit.appitagr = 4.0f; // aggressiveness for pitch on autopilot (2 is standard) was 3.5 now 2.0 on 5/26/2019 .. trying 4 on 3/3/2023 after airfoil change
1309 ourcockpit.aprolagr = 10.0f; // aggressiveness for roll on autopilot // 6 until 3/3/2023 trying 8 due to airfoil change
1310 ourcockpit.apYawTurnCoordination = 3.0f; // @todo this should be one of beta-assist knobs
1312 ourcockpit.exteriorInsulationHeatTransferCoefficient = 0.039f; // extruded polystyrene XPS
1313 ourcockpit.pitchLimitRadians = 0.698131925192982f; // 40� control deflection stop
1314 ourcockpit.machAngleDragScalar = sinf(atanf(1.068f));
1316 ourcockpit.engineEfficiencyAtSeaLevelScalar = 0.92f; // based on falcon 9 on earth which means this is 2.5x as efficient!
1318
1319 // Determined from new Intertial Moment routine
1323 // x has to be determined from the cockpit interior ... how far left (neg) eye is from center of cockpit
1324 // y is up and down... negative means cockpit CG is below aircraft CG
1325 // z is front to back... positive is ahead of the CG ... should always be positive?
1326 viewscreen->cameras.emplace_back(SCamera(-0.000549f, -0.000597f, 0.020097f, true));
1327 ourcockpit.noseWheelToCgKm = 0.014603f;
1328 ourcockpit.strutsrettoCGKm = 0.003482f; // so the bottom most polygon Z ... negated
1329 ourcockpit.wheelBaseKm = 0.023055f;
1330 ourcockpit.rooftoCGKm = 0.002089f; // might need to be negative 0.0013928788f; // 4 units
1331 ourcockpit.wingspanM = 50.143673f;
1332 ourcockpit.wingElevationM = 1.39288f;
1334 ourcockpit.rcsYParmM = 19.848541f;
1335 ourcockpit.landingGearLengthKm = 0.001618f;
1336 // @warn so if we move the CG we have to update the docking interface position and the location the ARJs are dropped
1337 ourcockpit.dockOffsetKmZ = 0.002089f - 0.00034822f * 1.0f; // negative moves the ship UP
1338 ourcockpit.dockOffsetKmY = 0.008359f;
1339
1340 // This one doesn't go through the spreadsheet, comes directly from windtunnel
1341 ourcockpit.spoilerAreaSqM = 29.270157f;
1342 // All of these must go through the spreadsheet
1343 ourcockpit.f28SideDragCoefficient = 3.673211f; // side drag coefficient
1344 ourcockpit.f20FrontBackDragCoeff = 0.634544f; // front/rear drag coefficient
1345 ourcockpit.f27PlanDragCoefficient = 15.957622f; // top/bottom drag coefficient
1346 ourcockpit.f25 = 0.060729f; // landing gear extended adjustment
1347 ourcockpit.h9RudderSqFt = 42.1505f; // rudder area ft�
1348 ourcockpit.h6ElevatorAreaSqFt = 104.7312f; // elevator area ft�
1349 ourcockpit.d16HTailWithElevatorSqFt = 1880.86f; // hstab area ft�
1350 ourcockpit.d17VTailWithRudderSqFt = 854.62f; // vstab area ft�
1351 ourcockpit.h12AileronAreaSqFt = 110.4301f; // aileron area (one side) ft�
1352 ourcockpit.d15TotalWingAreaSqFt = 6333.98f; // wing area ft�
1353 ourcockpit.j12flapsAreaSqMLE = 23.236309f;
1354 ourcockpit.k12flapsAreaSqMTE = 29.250177f;
1355 // in reality it looks like it is a SPAN ratio not an AREA ratio but we don't have SPAN data
1357 ourcockpit.flapMaxDegrees = 40.0f;
1358 ourcockpit.b9DistanceToVTailM = 10.034484f; // DV (m)
1359 ourcockpit.b6DistanceToHTailM = -8.017312f; // DH (m)
1360 ourcockpit.b12WingRollArmM = 15.644191f; // wing roll arm (m)
1361 ourcockpit.b15WingPitchArmM = 6.675565f; // wing pitch arm (m)
1362 ourcockpit.c9WingYawArmM = 12.157233f; // wing yaw arm (m)
1363 ourcockpit.i48CriticalEngineYawArmM = 7.03223f; // critical engine yaw arm (m)
1364 ourcockpit.l48AverageEnginePitchArmM = 0.10126f; // critical engine pitch arm (m)
1365 ourcockpit.d65wasd61 = 15.94726969f; // roll drag Cx
1366 ourcockpit.e65wase61 = 9.287857f; // roll drag arm (m)
1367 ourcockpit.i65wasi61 = 17.11505155f; // ft� at m asym yaw body
1368 ourcockpit.k65wask61 = 9.214083222f; // ft� at m asym yaw vtail
1369 ourcockpit.i66wasi62 = 48.43512927f; // ft� at m asym pitch body
1370 ourcockpit.k66wask62 = 35.36754122f; // ft� at m asym pitch htail
1371
1372 ourcockpit.Vs2 = 0.067f; // for thrust aug top speed, avionics setting not from spreadsheet, used Vr here
1373 ourcockpit.VcMSL = 0.18f; // used to limit deflection (2x Vne)
1374 ourcockpit.pitchToAddInTurn = 0.05f; // at 30 degrees this is the pitch up in radians at empty weight
1375 ourcockpit.VneEmpty = 0.09f; // used to be Vne 0.094f ... flight test says 100 m/s is max so 90%
1376 ourcockpit.VneMaxGross = 0.095f; // used to be Vne 0.094f ... flight test says 100 m/s is max so 90%
1377 ourcockpit.VrEmpty = 0.039f; // rana could forcefully break nose at 38
1378 ourcockpit.VrMaxGross = 0.052f; // rana could forcefully break nose at 51
1380 }
1381 break;
1383 {
1384 ourcockpit.attenuate = 0.5f;
1385 ourcockpit.shelfFreq = 3000.0f;
1386 ourcockpit.shelfGain = -12.0f;
1387 ourcockpit.shelfSlope = 3.5f;
1388 ourcockpit.lpFreq = 4000.0f;
1389 ourcockpit.lpSlope = 6.0f;
1390 ourcockpit.notchFreq = 800.0f;
1391 ourcockpit.notchGain = -6.0f;
1392 ourcockpit.panFactor = 0.2f;
1393
1394 _sopen_s(&handle, "meshes\\Helmet.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1395 ourcockpit.launchPosition.x = 0.0f;
1396 ourcockpit.launchPosition.y = -0.00026364f; // down
1397 ourcockpit.launchPosition.z = 0.02f; // fwd, at the nose because the point between the lights is inside the cockpit
1398 ourcockpit.uptranslimit = 0.00325f; // at max gross
1399 ourcockpit.dntranslimit = 0.00325f; // at max gross
1400 ourcockpit.lrtranslimit = 0.00325f; // at max gross
1401 ourcockpit.fwdthrustlimit = 0.00325f; // at max gross
1402 ourcockpit.revthrustlimit = 0.00325f; // at max gross
1403 ourcockpit.spoolTime = 5.8f; // seconds, from E-10
1404 ourcockpit.landingGearAbsorbKms = 0; // meter/s
1405 ourcockpit.spaceCapable = true;
1406 ourcockpit.wheeled = false;
1408 ourcockpit.steerLimitRadian = 0; // 70 degrees with tiller, if we change this here we have to change it in playerships[t].steerLimitRadian too
1409 ourcockpit.struts = 0;
1410 ourcockpit.tireRadiusKm = 0; // 0.00138 diameter 54.33 inches if we change this here we have to change it in playerships[t].tireCircumferenceKm
1412 ourcockpit.nextgen = true;
1414 // based on the CRJ-200
1415 //ourcockpit.flapSettings.emplace_back(FlapSetting(0, 0));
1416 //ourcockpit.flapSettings.emplace_back(FlapSetting(8, 0.115f));
1417 //ourcockpit.flapSettings.emplace_back(FlapSetting(20, 0.115f));
1418 //ourcockpit.flapSettings.emplace_back(FlapSetting(30, 0.098f));
1419 //ourcockpit.flapSettings.emplace_back(FlapSetting(40, 0.0955f));
1420 ourcockpit.bays = 0;
1421 ourcockpit.engines = 0;
1422 ourcockpit.emptyWeightLbs = 145.5f;
1423 ourcockpit.maxGrossLbs = 500.0f;
1424 ourcockpit.ffmax = 0.0103703703703704f; // 22.5 minutes of constant thrust .. lbs per sec ...
1425 ourcockpit.fuelFlowIdleLbsPerSec = 0.0002160493827160494f; // 18 hours 14 lbs 52 lbs/hr
1426 ourcockpit.fuelmax = 14.0f; // lbs
1427 ourcockpit.aoiWingRad = 0.0f;
1428 ourcockpit.appitagr = 0.0f; // aggressiveness for pitch on autopilot (2 is standard) was 3.5 now 2.0 on 5/26/2019 .. trying 4 on 3/3/2023 after airfoil change
1429 ourcockpit.aprolagr = 0.0f; // aggressiveness for roll on autopilot // 6 until 3/3/2023 trying 8 due to airfoil change
1430 ourcockpit.apYawTurnCoordination = 0.0f; // @todo this should be one of beta-assist knobs
1432 ourcockpit.exteriorInsulationHeatTransferCoefficient = 0.039f; // extruded polystyrene XPS
1433 ourcockpit.pitchLimitRadians = 0.0f; // 40� control deflection stop
1438
1439 // Determined from new Intertial Moment routine
1443 // x has to be determined from the cockpit interior ... how far left (neg) eye is from center of cockpit
1444 // y is up and down... negative means cockpit CG is below aircraft CG
1445 // z is front to back... positive is ahead of the CG ... should always be positive?
1446 viewscreen->cameras.emplace_back(SCamera(-0.000549f, -0.000597f, 0.020097f, true));
1447 ourcockpit.noseWheelToCgKm = 0.014603f;
1448 ourcockpit.strutsrettoCGKm = 0.003482f; // so the bottom most polygon Z ... negated
1449 ourcockpit.rooftoCGKm = 0.002089f; // might need to be negative 0.0013928788f; // 4 units
1450 ourcockpit.wingspanM = 50.143673f;
1451 ourcockpit.wingElevationM = 1.39288f;
1453 ourcockpit.rcsYParmM = 19.848541f;
1454 ourcockpit.landingGearLengthKm = 0.001618f;
1455 // @warn so if we move the CG we have to update the docking interface position and the location the ARJs are dropped
1456 ourcockpit.dockOffsetKmZ = 0.002089f - 0.00034822f * 1.0f; // negative moves the ship UP
1457 ourcockpit.dockOffsetKmY = 0.008359f;
1458
1459 // This one doesn't go through the spreadsheet, comes directly from windtunnel
1460 ourcockpit.spoilerAreaSqM = 29.270157f;
1461 // All of these must go through the spreadsheet
1462 ourcockpit.f28SideDragCoefficient = 3.673211f; // side drag coefficient
1463 ourcockpit.f20FrontBackDragCoeff = 0.634544f; // front/rear drag coefficient
1464 ourcockpit.f27PlanDragCoefficient = 15.957622f; // top/bottom drag coefficient
1465 ourcockpit.f25 = 0.060729f; // landing gear extended adjustment
1466 ourcockpit.h9RudderSqFt = 42.1505f; // rudder area ft�
1467 ourcockpit.h6ElevatorAreaSqFt = 104.7312f; // elevator area ft�
1468 ourcockpit.d16HTailWithElevatorSqFt = 1880.86f; // hstab area ft�
1469 ourcockpit.d17VTailWithRudderSqFt = 854.62f; // vstab area ft�
1470 ourcockpit.h12AileronAreaSqFt = 110.4301f; // aileron area (one side) ft�
1471 ourcockpit.d15TotalWingAreaSqFt = 6333.98f; // wing area ft�
1472 ourcockpit.j12flapsAreaSqMLE = 23.236309f;
1473 ourcockpit.k12flapsAreaSqMTE = 29.250177f;
1474 // in reality, it looks like it is a SPAN ratio not an AREA ratio but we don't have SPAN data
1476 ourcockpit.flapMaxDegrees = 40.0f;
1477 ourcockpit.b9DistanceToVTailM = 10.034484f; // DV (m)
1478 ourcockpit.b6DistanceToHTailM = -8.017312f; // DH (m)
1479 ourcockpit.b12WingRollArmM = 15.644191f; // wing roll arm (m)
1480 ourcockpit.b15WingPitchArmM = 6.675565f; // wing pitch arm (m)
1481 ourcockpit.c9WingYawArmM = 12.157233f; // wing yaw arm (m)
1482 ourcockpit.i48CriticalEngineYawArmM = 7.03223f; // critical engine yaw arm (m)
1483 ourcockpit.l48AverageEnginePitchArmM = 0.10126f; // critical engine pitch arm (m)
1484 ourcockpit.d65wasd61 = 15.94726969f; // roll drag Cx
1485 ourcockpit.e65wase61 = 9.287857f; // roll drag arm (m)
1486 ourcockpit.i66wasi62 = 17.11505155f; // ft� at m asym pitch body
1487 ourcockpit.k66wask62 = 9.214083222f; // ft� at m asym pitch htail
1488 ourcockpit.i65wasi61 = 48.43512927f; // ft� at m asym yaw body
1489 ourcockpit.k65wask61 = 35.36754122f; // ft� at m asym yaw vtail
1490
1491 ourcockpit.Vs2 = 0.067f; // for thrust aug top speed, avionics setting not from spreadsheet, used Vr here
1492 ourcockpit.VcMSL = 0.18f; // used to limit deflection (2x Vne)
1493 ourcockpit.pitchToAddInTurn = 0.05f; // at 30 degrees this is the pitch up in radians at empty weight
1494 ourcockpit.VneEmpty = 0.09f; // used to be Vne 0.094f ... flight test says 100 m/s is max so 90%
1495 ourcockpit.VneMaxGross = 0.095f; // used to be Vne 0.094f ... flight test says 100 m/s is max so 90%
1496 ourcockpit.VrEmpty = 0.039f; // rana could forcefully break nose at 38
1497 ourcockpit.VrMaxGross = 0.052f; // rana could forcefully break nose at 51
1499 }
1500 break;
1501 case VehicleType::T27:
1502 {
1503 // The Mammoth has fixed landing gear. Correct any saved retracted state
1504 // before the exterior profile initializes its gear and wheel components.
1505 if (!playerships[0].geardown)
1506 {
1507 playerships[0].geardown = true;
1509 }
1510 ourcockpit.gearextent = 1.0f;
1513
1514 ourcockpit.attenuate = 0.75f;
1515 ourcockpit.shelfFreq = 6000.0f;
1516 ourcockpit.shelfGain = -8.0f;
1517 ourcockpit.shelfSlope = 2.0f;
1518 ourcockpit.lpFreq = 8000.0f;
1519 ourcockpit.lpSlope = 4.0f;
1520 ourcockpit.notchFreq = 1000.0f;
1521 ourcockpit.notchGain = -4.0f;
1522 ourcockpit.panFactor = 0.25f;
1523
1524 _sopen_s(&handle, "meshes\\mammoth-int.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1525 ourcockpit.launchPosition.x = 0.0f;
1526 ourcockpit.launchPosition.y = -0.00026364f; // down
1527 ourcockpit.launchPosition.z = 0.0167f; // fwd, at the nose because the point between the lights is inside the cockpit
1528 ourcockpit.uptranslimit = 0.0f;
1529 ourcockpit.dntranslimit = 0.0f;
1530 ourcockpit.lrtranslimit = 0.0f; // at max gross
1531 ourcockpit.fwdthrustlimit = 0.340f; // approx. 4000 HP if 100 HP = 0.0085; 52 kph tire limit below governs top speed
1532 ourcockpit.spoolTime = 5.0f; // seconds
1533 ourcockpit.revthrustlimit = 0.0f; // unused
1535 ourcockpit.suspensionTravelKm = 0.001930f;
1539 ourcockpit.tireComplianceKm = 0.000150f;
1542 ourcockpit.spaceCapable = false;
1543 ourcockpit.wheeled = true;
1548 // All eight fixed-angle tires steer by varying the speed of the four-wheel banks on each side.
1549 // Preserve the previous full-input yaw response while modeling that side-speed differential.
1551 // Preserve the former speed-sensitive keyboard centering response without pretending tires steer.
1553 ourcockpit.struts = 2;
1554 ourcockpit.tireRadiusKm = 0.001619f; // 0.003238 diameter or 127" if we change this here we have to change it in playerships[t].tireCircumferenceKm
1555 ourcockpit.clutchtime = 0.5f;
1556 ourcockpit.fwdgears = 1;
1557 ourcockpit.idleRPM = 0.0f;
1558 ourcockpit.redlineRPM = 5500.0f;
1559 // bigger number gives it less power, higher allowable speed
1560 ourcockpit.ratios[0] = -0.665188f; // REV-HI
1561 ourcockpit.ratios[1] = 0.72f; // 1st-HI
1563
1565 ourcockpit.nextgen = true;
1566 ourcockpit.bays = 18;
1567 ourcockpit.engines = 2;
1568 ourcockpit.emptyWeightLbs = 509047.0f;
1569 ourcockpit.maxGrossLbs = 1183660.478f;
1570 ourcockpit.ffmax = 0.3991f; // gndvehicles are in lbs per second, scaled with the 4000 HP Mammoth rating
1571 ourcockpit.fuelFlowIdleLbsPerSec = ourcockpit.ffmax * 0.1f; // idle sucks fuel because RPM is 0.001f
1572 ourcockpit.fuelmax = 8955.0f; // column L
1573 viewscreen->cameras.emplace_back(SCamera(-0.000424f, 0.002961f, 0.006355f, true));
1574 ourcockpit.exteriorInsulationHeatTransferCoefficient = 24.0f; // stainless steel
1575
1576 // Determined from new Intertial Moment routine
1577 ourcockpit.momentp = 22946042.0f / ourcockpit.emptyWeightLbs;//2.59611f;
1578 ourcockpit.momentr = 12107143.0f / ourcockpit.emptyWeightLbs;//0.934778f;
1579 ourcockpit.momenty = 32350316.0f / ourcockpit.emptyWeightLbs;//3.360088f; // at 60mph 96kmh 16mpg 8ppg
1580 ourcockpit.strutsrettoCGKm = 0.003839f; // so the bottom most polygon Z ... negated
1581 ourcockpit.rooftoCGKm = 0.005746f;
1582
1583 // All of these must go through the spreadsheet
1584 ourcockpit.f28SideDragCoefficient = 2.636859356f; // side drag coefficient
1585 ourcockpit.f20FrontBackDragCoeff = 1.536845f; // front/rear drag coefficient
1586 ourcockpit.f25 = 0.077463f; // landing gear extended adjustment
1587 ourcockpit.f27PlanDragCoefficient = 9.021116422f; // top/bottom drag coefficient
1588 ourcockpit.d65wasd61 = 10.86400327f; // roll drag Cx
1589 ourcockpit.e65wase61 = 1.204286f; // roll drag arm
1590 ourcockpit.i66wasi62 = 0.0f; // ft� at m asym pitch body
1591 ourcockpit.k66wask62 = 0.0f; // ft� at m asym pitch htail
1592 ourcockpit.i65wasi61 = 0.0f; // ft� at m asym yaw body
1593 ourcockpit.k65wask61 = 0.0f; // ft� at m asym yaw vtail
1594 }
1595 break;
1597 {
1598 ourcockpit.attenuate = 0.8f;
1599 ourcockpit.shelfFreq = 7000.0f;
1600 ourcockpit.shelfGain = -7.0f;
1601 ourcockpit.shelfSlope = 1.2f;
1602 ourcockpit.lpFreq = 10000.0f;
1603 ourcockpit.lpSlope = 2.0f;
1604 ourcockpit.notchFreq = 2000.0f;
1605 ourcockpit.notchGain = -2.0f;
1606 ourcockpit.panFactor = 0.55f;
1607
1608 _sopen_s(&handle, "meshes\\INT-apartment1.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1609 viewscreen->g_bStrapon = false; // can move around freely
1611 ourcockpit.nextgen = true;
1612 ourcockpit.bays = 0;
1613 ourcockpit.engines = 0;
1615 ourcockpit.uptranslimit = 0.006125f; // at max gross
1616 ourcockpit.dntranslimit = 0.0125f; // at max gross
1617 ourcockpit.lrtranslimit = 0.0125f; // at max gross
1618 ourcockpit.fwdthrustlimit = 0.0116f; // at max gross
1619 ourcockpit.spoolTime = 0.0f; // seconds
1620 ourcockpit.revthrustlimit = 0.0f; // at max gross
1621 ourcockpit.landingGearAbsorbKms = 0.002205393f * 5.0f; // meter/s
1622 ourcockpit.spaceCapable = false;
1623 ourcockpit.wheeled = false;
1626 ourcockpit.steerLimitRadian = 0.0f; // if we change this here we have to change it in playerships[t].steerLimitRadian too
1627 ourcockpit.emptyWeightLbs = 277000.0f;
1628 ourcockpit.maxGrossLbs = 524000.0f;
1629 ourcockpit.momentp = 124.982147f;
1630 ourcockpit.momentr = 71.806427f;
1631 ourcockpit.momenty = 186.511765f;
1632 ourcockpit.ffmax = 0.0f; // at 0.0116 she burns 22500 lbs per hour 6.25 lbs per second
1633 ourcockpit.fuelFlowIdleLbsPerSec = 0.0f; // 52 lbs/hr
1634 ourcockpit.fuelmax = 0.0f;
1635 viewscreen->cameras.emplace_back(SCamera(0, 0, 0, false));
1636 ourcockpit.rooftoCGKm = 0.0f;
1639 // All of these must go through the spreadsheet
1640 ourcockpit.f28SideDragCoefficient = 3.542405185f; // side drag coefficient
1641 ourcockpit.f20FrontBackDragCoeff = 2.568257887f; // front/rear drag coefficient
1642 ourcockpit.f27PlanDragCoefficient = 14.53457189f; // top/bottom drag coefficient
1643 ourcockpit.f25 = 0.172558f; // landing gear extended adjustment
1644 ourcockpit.d65wasd61 = 14.44276701f; // roll drag Cx
1645 ourcockpit.e65wase61 = 7.755528f; // roll drag arm (m)
1646 ourcockpit.i66wasi62 = 91.99259518f; // ft� at m asym pitch body
1647 ourcockpit.k66wask62 = 158.1099498f; // ft� at m asym pitch htail
1648 ourcockpit.i65wasi61 = 126.5371507f; // ft� at m asym yaw body
1649 ourcockpit.k65wask61 = 111.2692687f; // ft� at m asym yaw vtail
1650 }
1651 break;
1653 {
1654 ourcockpit.attenuate = 0.65f;
1655 ourcockpit.shelfFreq = 5000.0f;
1656 ourcockpit.shelfGain = -10.0f;
1657 ourcockpit.shelfSlope = 2.5f;
1658 ourcockpit.lpFreq = 6000.0f;
1659 ourcockpit.lpSlope = 4.0f;
1660 ourcockpit.notchFreq = 1200.0f;
1661 ourcockpit.notchGain = -6.0f;
1662 ourcockpit.panFactor = 0.1f;
1663
1664 _sopen_s(&handle, "meshes\\SimulatorBay.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1665 viewscreen->g_bStrapon = false; // can move around freely
1667 ourcockpit.nextgen = true;
1668 ourcockpit.bays = 0;
1669 ourcockpit.engines = 0;
1671 ourcockpit.uptranslimit = 0.006125f; // at max gross
1672 ourcockpit.dntranslimit = 0.0125f; // at max gross
1673 ourcockpit.lrtranslimit = 0.0125f; // at max gross
1674 ourcockpit.fwdthrustlimit = 0.0116f; // at max gross
1675 ourcockpit.spoolTime = 0.0f; // seconds
1676 ourcockpit.revthrustlimit = 0.0f; // at max gross
1677 ourcockpit.landingGearAbsorbKms = 0.002205393f * 5.0f; // meter/s
1678 ourcockpit.spaceCapable = false;
1679 ourcockpit.wheeled = false;
1682 ourcockpit.steerLimitRadian = 0.0f; // if we change this here we have to change it in playerships[t].steerLimitRadian too
1683 ourcockpit.emptyWeightLbs = 277000.0f;
1684 ourcockpit.maxGrossLbs = 524000.0f;
1685 ourcockpit.momentp = 124.982147f;
1686 ourcockpit.momentr = 71.806427f;
1687 ourcockpit.momenty = 186.511765f;
1688 ourcockpit.ffmax = 538.7927f; // at 0.0116 she burns 22500 lbs per hour 6.25 lbs per second
1689 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // 52 lbs/hr
1690 ourcockpit.fuelmax = 60000.0f;
1691 viewscreen->cameras.emplace_back(SCamera(0, 0, 0, false));
1692 ourcockpit.rooftoCGKm = 0.0f;
1695 // All of these must go through the spreadsheet
1696 ourcockpit.f28SideDragCoefficient = 3.542405185f; // side drag coefficient
1697 ourcockpit.f20FrontBackDragCoeff = 2.568257887f; // front/rear drag coefficient
1698 ourcockpit.f27PlanDragCoefficient = 14.53457189f; // top/bottom drag coefficient
1699 ourcockpit.f25 = 0.172558f; // landing gear extended adjustment
1700 ourcockpit.d65wasd61 = 14.44276701f; // roll drag Cx
1701 ourcockpit.e65wase61 = 7.755528f; // roll drag arm (m)
1702 ourcockpit.i66wasi62 = 91.99259518f; // ft� at m asym pitch body
1703 ourcockpit.k66wask62 = 158.1099498f; // ft� at m asym pitch htail
1704 ourcockpit.i65wasi61 = 126.5371507f; // ft� at m asym yaw body
1705 ourcockpit.k65wask61 = 111.2692687f; // ft� at m asym yaw vtail
1706 }
1707 break;
1709 {
1710 ourcockpit.attenuate = 0.78f;
1711 ourcockpit.shelfFreq = 6500.0f;
1712 ourcockpit.shelfGain = -7.0f;
1713 ourcockpit.shelfSlope = 1.3f;
1714 ourcockpit.lpFreq = 9000.0f;
1715 ourcockpit.lpSlope = 2.0f;
1716 ourcockpit.notchFreq = 1800.0f;
1717 ourcockpit.notchGain = -3.0f;
1718 ourcockpit.panFactor = 0.65f;
1719
1720 _sopen_s(&handle, "meshes\\controltower.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1721 viewscreen->g_bStrapon = false; // can move around freely
1723 ourcockpit.nextgen = true;
1724 ourcockpit.bays = 0;
1725 ourcockpit.engines = 0;
1727 ourcockpit.uptranslimit = 0.006125f; // at max gross
1728 ourcockpit.dntranslimit = 0.0125f; // at max gross
1729 ourcockpit.lrtranslimit = 0.0125f; // at max gross
1730 ourcockpit.fwdthrustlimit = 0.0116f; // at max gross
1731 ourcockpit.spoolTime = 0.0f; // seconds
1732 ourcockpit.revthrustlimit = 0.0f; // at max gross
1733 ourcockpit.landingGearAbsorbKms = 0.002205393f * 5.0f; // meter/s
1734 ourcockpit.spaceCapable = false;
1735 ourcockpit.wheeled = false;
1738 ourcockpit.steerLimitRadian = 0.0f; // if we change this here we have to change it in playerships[t].steerLimitRadian too
1739 ourcockpit.emptyWeightLbs = 277000.0f;
1740 ourcockpit.maxGrossLbs = 524000.0f;
1741 ourcockpit.momentp = 124.982147f;
1742 ourcockpit.momentr = 71.806427f;
1743 ourcockpit.momenty = 186.511765f;
1744 ourcockpit.ffmax = 538.7927f; // at 0.0116 she burns 22500 lbs per hour 6.25 lbs per second
1745 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // 52 lbs/hr
1746 ourcockpit.fuelmax = 60000.0f;
1747 viewscreen->cameras.emplace_back(SCamera(0, 0, 0, false));
1748 ourcockpit.rooftoCGKm = 0.0f;
1751 // All of these must go through the spreadsheet
1752 ourcockpit.f28SideDragCoefficient = 3.542405185f; // side drag coefficient
1753 ourcockpit.f20FrontBackDragCoeff = 2.568257887f; // front/rear drag coefficient
1754 ourcockpit.f27PlanDragCoefficient = 14.53457189f; // top/bottom drag coefficient
1755 ourcockpit.f25 = 0.172558f; // landing gear extended adjustment
1756 ourcockpit.d65wasd61 = 14.44276701f; // roll drag Cx
1757 ourcockpit.e65wase61 = 7.755528f; // roll drag arm (m)
1758 ourcockpit.i66wasi62 = 91.99259518f; // ft� at m asym pitch body
1759 ourcockpit.k66wask62 = 158.1099498f; // ft� at m asym pitch htail
1760 ourcockpit.i65wasi61 = 126.5371507f; // ft� at m asym yaw body
1761 ourcockpit.k65wask61 = 111.2692687f; // ft� at m asym yaw vtail
1762 }
1763 break;
1765 {
1767
1768 ourcockpit.attenuate = 0.65f;
1769 ourcockpit.shelfFreq = 5000.0f;
1770 ourcockpit.shelfGain = -10.0f;
1771 ourcockpit.shelfSlope = 2.0f;
1772 ourcockpit.lpFreq = 8000.0f;
1773 ourcockpit.lpSlope = 4.0f;
1774 ourcockpit.notchFreq = 1000.0f;
1775 ourcockpit.notchGain = -6.0f;
1776 ourcockpit.panFactor = 0.1f;
1777
1778 _sopen_s(&handle, "meshes\\hangar.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1779 viewscreen->g_bStrapon = false; // can move around freely
1781 ourcockpit.nextgen = true;
1782 ourcockpit.bays = 0;
1783 ourcockpit.engines = 0;
1785 ourcockpit.uptranslimit = 0.006125f; // at max gross
1786 ourcockpit.dntranslimit = 0.0125f; // at max gross
1787 ourcockpit.lrtranslimit = 0.0125f; // at max gross
1788 ourcockpit.fwdthrustlimit = 0.0116f; // at max gross
1789 ourcockpit.spoolTime = 0.0f; // seconds
1790 ourcockpit.revthrustlimit = 0.0f; // at max gross
1791 ourcockpit.landingGearAbsorbKms = 0.002205393f * 5.0f; // meter/s
1792 ourcockpit.spaceCapable = false;
1793 ourcockpit.wheeled = false;
1796 ourcockpit.steerLimitRadian = 0.0f; // if we change this here we have to change it in playerships[t].steerLimitRadian too
1797 ourcockpit.emptyWeightLbs = 277000.0f;
1798 ourcockpit.maxGrossLbs = 524000.0f;
1799 ourcockpit.momentp = 124.982147f;
1800 ourcockpit.momentr = 71.806427f;
1801 ourcockpit.momenty = 186.511765f;
1802 ourcockpit.ffmax = 538.7927f; // at 0.0116 she burns 22500 lbs per hour 6.25 lbs per second
1803 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // 52 lbs/hr
1804 ourcockpit.fuelmax = 60000.0f;
1805 switch (playerships[0].type)
1806 {
1807 case VehicleType::E10:
1808 case VehicleType::E11:
1809 viewscreen->cameras.emplace_back(SCamera(0, 0.0027f, 0, false)); // not sure if this should be strut length + strut ret to CG? 0.0027 worked great
1810 break;
1811 case VehicleType::A4:
1812 viewscreen->cameras.emplace_back(SCamera(0, 0.0059f, 0, false));
1813 break;
1814 case VehicleType::P13:
1815 viewscreen->cameras.emplace_back(SCamera(0, 0.0015f, 0, false));
1816 break;
1817 case VehicleType::T19:
1818 viewscreen->cameras.emplace_back(SCamera(0, 0.0049f, 0, false));
1819 break;
1821 viewscreen->cameras.emplace_back(SCamera(0, 0.0027f, 0, false));
1822 break;
1823 default:
1824 viewscreen->cameras.emplace_back(SCamera(0, 0, 0, false));
1825 }
1826 ourcockpit.rooftoCGKm = 0.0f;
1829 // All of these must go through the spreadsheet
1830 ourcockpit.f28SideDragCoefficient = 3.542405185f; // side drag coefficient
1831 ourcockpit.f20FrontBackDragCoeff = 2.568257887f; // front/rear drag coefficient
1832 ourcockpit.f27PlanDragCoefficient = 14.53457189f; // top/bottom drag coefficient
1833 ourcockpit.f25 = 0.172558f; // landing gear extended adjustment
1834 ourcockpit.d65wasd61 = 14.44276701f; // roll drag Cx
1835 ourcockpit.e65wase61 = 7.755528f; // roll drag arm (m)
1836 ourcockpit.i66wasi62 = 91.99259518f; // ft� at m asym pitch body
1837 ourcockpit.k66wask62 = 158.1099498f; // ft� at m asym pitch htail
1838 ourcockpit.i65wasi61 = 126.5371507f; // ft� at m asym yaw body
1839 ourcockpit.k65wask61 = 111.2692687f; // ft� at m asym yaw vtail
1840 }
1841 break;
1843 {
1844 ourcockpit.attenuate = 0.78f;
1845 ourcockpit.shelfFreq = 6500.0f;
1846 ourcockpit.shelfGain = -7.0f;
1847 ourcockpit.shelfSlope = 1.3f;
1848 ourcockpit.lpFreq = 9000.0f;
1849 ourcockpit.lpSlope = 2.0f;
1850 ourcockpit.notchFreq = 1800.0f;
1851 ourcockpit.notchGain = -3.0f;
1852 ourcockpit.panFactor = 0.65f;
1853
1854 _sopen_s(&handle, "meshes\\Estate.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1855 viewscreen->g_bStrapon = false; // can move around freely
1857 ourcockpit.nextgen = true;
1858 ourcockpit.bays = 0;
1859 ourcockpit.engines = 0;
1861 ourcockpit.uptranslimit = 0.006125f; // at max gross
1862 ourcockpit.dntranslimit = 0.0125f; // at max gross
1863 ourcockpit.lrtranslimit = 0.0125f; // at max gross
1864 ourcockpit.fwdthrustlimit = 0.0116f; // at max gross
1865 ourcockpit.spoolTime = 0.0f; // seconds
1866 ourcockpit.revthrustlimit = 0.0f; // at max gross
1867 ourcockpit.landingGearAbsorbKms = 0.002205393f * 5.0f; // meter/s
1868 ourcockpit.spaceCapable = false;
1869 ourcockpit.wheeled = false;
1872 ourcockpit.steerLimitRadian = 0.0f; // if we change this here we have to change it in playerships[t].steerLimitRadian too
1873 ourcockpit.emptyWeightLbs = 277000.0f;
1874 ourcockpit.maxGrossLbs = 524000.0f;
1875 ourcockpit.momentp = 124.982147f;
1876 ourcockpit.momentr = 71.806427f;
1877 ourcockpit.momenty = 186.511765f;
1878 ourcockpit.ffmax = 538.7927f; // at 0.0116 she burns 22500 lbs per hour 6.25 lbs per second
1879 ourcockpit.fuelFlowIdleLbsPerSec = 0.01448121f; // 52 lbs/hr
1880 ourcockpit.fuelmax = 60000.0f;
1881 viewscreen->cameras.emplace_back(SCamera(0, 0, 0, false));
1882 ourcockpit.rooftoCGKm = 0.0f;
1885 // All of these must go through the spreadsheet
1886 ourcockpit.f28SideDragCoefficient = 3.542405185f; // side drag coefficient
1887 ourcockpit.f20FrontBackDragCoeff = 2.568257887f; // front/rear drag coefficient
1888 ourcockpit.f27PlanDragCoefficient = 14.53457189f; // top/bottom drag coefficient
1889 ourcockpit.f25 = 0.172558f; // landing gear extended adjustment
1890 ourcockpit.d65wasd61 = 14.44276701f; // roll drag Cx
1891 ourcockpit.e65wase61 = 7.755528f; // roll drag arm (m)
1892 ourcockpit.i66wasi62 = 91.99259518f; // ft� at m asym pitch body
1893 ourcockpit.k66wask62 = 158.1099498f; // ft� at m asym pitch htail
1894 ourcockpit.i65wasi61 = 126.5371507f; // ft� at m asym yaw body
1895 ourcockpit.k65wask61 = 111.2692687f; // ft� at m asym yaw vtail
1896 }
1897 break;
1898 // ourcockpit.exteriorInsulationHeatTransferCoefficient = 0.2f; // acrylic glass
1899 // ourcockpit.exteriorInsulationHeatTransferCoefficient = 0.33f; // polymer, low-density
1900 // ourcockpit.exteriorInsulationHeatTransferCoefficient = 0.51f; // Polyethylene, high-density
1901 default:
1902 logger->Log("Unrecognized cockpit type!", Logger::Level::Fatal);
1903 break;
1904 }
1906
1912 {
1913 // load animation ... we used to have a female1.ani but it was terrible
1914 int anihandle = -1;
1915 _sopen_s(&anihandle, "meshes\\Animations\\MALE1.ani", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1916 if (anihandle == -1)
1917 {
1918 sprintf_s(msg, sizeof(msg), "InitApp() failed to load ANI for type %i!", ourcockpit.texturelib);
1920 }
1921 _read(anihandle, aniarray, sizeof(Sani) * MAX_ANI * MAX_STEPS);
1922 _close(anihandle);
1923 }
1924
1925 const float sqM_to_sqFt = 10.7639f;
1926 ourcockpit.i12WingAreaOneSideSqFt = ourcockpit.d15TotalWingAreaSqFt * 0.5f; // wing area (one side) ft�
1933
1934
1936
1938
1939 if (playerships[0].groundvehicle)
1940 {
1941 for (int i = 0; i < MAX_ENGINES; i++)
1942 viewscreen->gameclass->bus->EngineThrustLever[i] = 0.1f; // idle
1943 }
1944 else
1945 {
1946 for (int i = 0; i < MAX_ENGINES; i++)
1947 {
1948 // for aircraft, spacecraft https://jira.risetvp.com/view.php?id=236
1950 }
1951 }
1952
1953
1954 if (handle == -1)
1955 {
1956 sprintf_s(msg, sizeof(msg), "cockpit::Load failed to load cockpit DIX for type %i!", ourcockpit.texturelib);
1958 }
1959
1960 _lseek(handle, 0, SEEK_SET);
1961 _read(handle, &ourcockpit.components, 2);
1962
1963
1965 {
1967 viewscreen->gameclass->UpdateTrackedResource("ourcockpit.componentarray", 3);
1968 }
1969
1972 {
1973 sprintf_s(msg, sizeof(msg), "cockpit::Load Failed to initialize %i component(s) for cockpit type %i", ourcockpit.components, ourcockpit.texturelib);
1975 }
1976 else
1977 {
1978 viewscreen->gameclass->AddTrackedResource("ourcockpit.componentarray"); // managed, memory only
1979
1980 sprintf_s(msg, sizeof(msg), "cockpit::Load initialized %i component(s) for cockpit type %i", ourcockpit.components, ourcockpit.texturelib);
1981 logger->Log(msg);
1982 }
1983
1984
1985 short i_temp;
1986 for (short s = 0; s < ourcockpit.components; s++)
1987 {
1988 _lseek(handle, (long)s * 100L + 99L, SEEK_SET); // To 0
1989 _read(handle, &i_temp, 2); // 0
1990 ourcockpit.componentarray[s].startvertex = static_cast<UINT>(i_temp);
1991 _read(handle, &i_temp, 2); // 2
1992 ourcockpit.componentarray[s].primitives = static_cast<UINT>(i_temp);
1993 _read(handle, &ourcockpit.componentarray[s].nominalxyz, 12); // 4
1994 _read(handle, &ourcockpit.componentarray[s].nominalypr, 12); // 16
1995 _read(handle, &ourcockpit.componentarray[s].boundsphere, 4); // 28
1996 _read(handle, &ourcockpit.componentarray[s].extendby, 12); // 32
1997 _read(handle, &ourcockpit.componentarray[s].texture, 2); // 44
1999 {
2000 sprintf_s(msg, sizeof(msg), "Failure, out-of-bounds texture on component %i of cockpit %i: %i", s, ourcockpit.texturelib, ourcockpit.componentarray[s].texture);
2002 }
2003 _read(handle, &ourcockpit.componentarray[s].nominalCG, 12); // 46
2004 _read(handle, &ourcockpit.componentarray[s].type, 1); // 58
2005 _read(handle, &ourcockpit.componentarray[s].speedExtend, 4); // 59
2006 _read(handle, &ourcockpit.componentarray[s].hingeaxis, 12); // 63
2007 _read(handle, &ourcockpit.componentarray[s].hingeCG, 12); // 75
2008 _read(handle, &ourcockpit.componentarray[s].hingeextent, 4); // 87
2009 _read(handle, &ourcockpit.componentarray[s].attachto, 2); // 87
2010
2011 // Dynamic
2013 const auto& prop = ourcockpit.componentarray[s];
2015 {prop.nominalxyz.x, prop.nominalxyz.y, prop.nominalxyz.z},
2016 {prop.nominalypr.x, prop.nominalypr.y, prop.nominalypr.z}, prop.primitives))
2017 sparkoProp = std::make_unique<SparkoProp::Controller>(s,
2018 RigidProp::Vec{prop.nominalxyz.x, prop.nominalxyz.y, prop.nominalxyz.z},
2019 RigidProp::Vec{prop.nominalypr.x, prop.nominalypr.y, prop.nominalypr.z});
2020 }
2021
2022 _close(handle);
2023 handle = -1;
2024
2025 int stride = 32L;
2026 switch (ourcockpit.texturelib)
2027 {
2028 case VehicleType::C98: _sopen_s(&handle, "Meshes\\MuVERcockpit-construction.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2029 break;
2030 case VehicleType::E10: _sopen_s(&handle, "Meshes\\e10cockpit1.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2031 break;
2032 case VehicleType::E11: _sopen_s(&handle, "Meshes\\e11cockpit1.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2033 break;
2034 case VehicleType::P13: _sopen_s(&handle, "Meshes\\p13-cockpit1.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2035 break;
2036 case VehicleType::A4: _sopen_s(&handle, "Meshes\\T-8 Wanderer INT.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2037 break;
2038 case VehicleType::C2: _sopen_s(&handle, "Meshes\\C-2 Dasher INT.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2039 stride = 40L; // Updated ASM export includes a second UV pair.
2040 break;
2041 case VehicleType::T120: _sopen_s(&handle, "Meshes\\T-120 Steerhead-stock INT.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2042 stride = 40L; // Updated ASM export includes a second UV pair.
2043 break;
2044 case VehicleType::T121: _sopen_s(&handle, "Meshes\\2007 T-120 INT.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2045 stride = 40L; // Updated ASM export includes a second UV pair.
2046 break;
2047 case VehicleType::T19: _sopen_s(&handle, "Meshes\\stratomaster_06-hex.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2048 stride = 40L; // Updated ASM export includes a second UV pair.
2049 break;
2050 case VehicleType::W6Manx: _sopen_s(&handle, "Meshes\\manx-int-hex.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2051 break;
2052 case VehicleType::T27: _sopen_s(&handle, "Meshes\\mammoth-int.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2053 stride = 40L; // Updated ASM export includes a second UV pair.
2054 break;
2055 case VehicleType::Apartment: _sopen_s(&handle, "Meshes\\INT-apartment1.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2056 break;
2057 case VehicleType::C2A: _sopen_s(&handle, "Meshes\\C-2A Dasher INT.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2058 break;
2059 case VehicleType::EVA_SUIT: _sopen_s(&handle, "Meshes\\Helmet.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2060 break;
2061 case VehicleType::SimBay: _sopen_s(&handle, "Meshes\\SimulatorBay.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2062 break;
2063 case VehicleType::ControlTower: _sopen_s(&handle, "Meshes\\controltower.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2064 break;
2065 case VehicleType::Hangar: _sopen_s(&handle, "Meshes\\hangar.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2066 break;
2067 case VehicleType::Estate: _sopen_s(&handle, "Meshes\\Estate.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
2068 stride = 40L;
2069 break;
2070 default:
2071 logger->Log("Should not have gotten here, no valid cockpit::Load type", Logger::Fatal);
2072 break;
2073 }
2074 if (handle == -1)
2075 {
2076 char strerr[99];
2077 strerror_s(strerr, 99, errno);
2078 sprintf_s(msg, sizeof(msg), "cockpit::Load could not load cockpit (DAW file %i): %s", ourcockpit.texturelib, strerr);
2080 }
2081
2082 // Vertices -----------------------------------------------------------------------------
2083 _lseek(handle, 0L, SEEK_SET);
2084 _read(handle, &polyobjects[5].vertices, 2);
2086
2087 sprintf_s(msg, sizeof(msg), "cockpit::Load loading file (%i vertices) for polygon object number %i...", polyobjects[5].vertices, 5);
2088 logger->Log(msg);
2089
2090 if (polyobjects[5].vertices > cockpitvertC)
2091 {
2092 sprintf_s(msg, sizeof(msg), "cockpit::Load failure, out-of-bounds number of vertices %i/%i maximum", polyobjects[5].vertices, cockpitvertC);
2094 }
2095
2096 RiseVertexVertex* vtx;
2097 HRESULT hr;
2098
2099 // Lock the vertex buffer
2100 V(polyobjects[5].VB->Lock(0, 0, reinterpret_cast<void**>(&vtx), Rendering::LockFlags::DISCARD));
2101
2102 RiseMath::Vector3 tempnormal;
2103 std::vector<WindshieldRainRenderer::Vertex> cockpitVertices(polyobjects[5].vertices);
2104
2105 for (short s = 0; s < polyobjects[5].vertices; s++)
2106 {
2107 _lseek(handle, 2L + s * stride + 0L, SEEK_SET);
2108 _read(handle, &tempnormal, 12);
2109 vtx->x = tempnormal.x;
2110 vtx->y = tempnormal.y;
2111 vtx->z = tempnormal.z;
2112
2113 _lseek(handle, 2L + s * stride + 12L, SEEK_SET);
2114 _read(handle, &tempnormal, 12);
2115 vtx->nx = tempnormal.x;
2116 vtx->ny = tempnormal.y;
2117 vtx->nz = tempnormal.z;
2118
2119 _lseek(handle, 2L + s * stride + 24L, SEEK_SET);
2120 _read(handle, &tempnormal.x, 4);
2121 _read(handle, &tempnormal.y, 4);
2122 vtx->tu = tempnormal.x;
2123 vtx->tv = tempnormal.y;
2124 cockpitVertices[s] = { vtx->x,vtx->y,vtx->z,vtx->nx,vtx->ny,vtx->nz,vtx->tu,vtx->tv };
2125 vtx++;
2126 }
2127
2128 V(polyobjects[5].VB->Unlock());
2129
2130 viewscreen->windshieldRain.Clear(); // no water carried between vehicles
2134 for (int component = 0; component < ourcockpit.components; ++component)
2135 {
2136 const auto& mesh = ourcockpit.componentarray[component];
2137 const size_t count = size_t(mesh.primitives) * 3;
2138 if (mesh.startvertex + count > cockpitVertices.size()) continue;
2139 if ((mesh.type == 4 || mesh.type == 58) && count > 0)
2140 {
2141 // Some authored components contain several separate monitor rectangles.
2142 // Group consecutive triangles only when their UV rectangles agree.
2143 auto& parts = displayDraws[component];
2144 for (UINT triangle = 0; triangle < mesh.primitives; ++triangle)
2145 {
2146 const UINT start = mesh.startvertex + triangle * 3;
2147 const auto& first = cockpitVertices[start];
2148 DirectX::XMFLOAT4 bounds{first.u,first.v,first.u,first.v};
2149 for (UINT vertex = start + 1; vertex < start + 3; ++vertex)
2150 {
2151 const auto& uv = cockpitVertices[vertex];
2152 bounds.x = (std::min)(bounds.x,uv.u); bounds.y = (std::min)(bounds.y,uv.v);
2153 bounds.z = (std::max)(bounds.z,uv.u); bounds.w = (std::max)(bounds.w,uv.v);
2154 }
2155 if (!parts.empty() && parts.back().bounds.x == bounds.x && parts.back().bounds.y == bounds.y &&
2156 parts.back().bounds.z == bounds.z && parts.back().bounds.w == bounds.w)
2157 ++parts.back().primitives;
2158 else parts.push_back({start,1,bounds});
2159 }
2160 }
2161 if (mesh.type == 5)
2162 {
2163 viewscreen->windshieldRain.AddGlass(component, cockpitVertices.data() + mesh.startvertex, count);
2164 lightningWindows.Add(component, cockpitVertices.data() + mesh.startvertex, count);
2165 }
2166 else if (WindshieldWipers::HasBladeMotion(mesh.type, mesh.primitives,
2167 RiseMath::Vec3LengthSq(&mesh.hingeaxis), mesh.hingeextent, RiseMath::Vec3LengthSq(&mesh.extendby)))
2168 {
2170 viewscreen->windshieldRain.AddWiper(component, cockpitVertices.data() + mesh.startvertex, count);
2171 }
2172 }
2174
2175 _close(handle);
2176
2177
2178
2179 // The exterior profile is loaded after the cockpit in the vehicle packet.
2180 // Cache source levels/fallbacks now; fill authored positions at the end of that load.
2181 CacheEngineSounds(false);
2183
2187
2188
2190
2192
2193 OnLostDevice();
2195
2196 ResetHelp();
2197
2198 if (playerships[0].isSimulator)
2199 logger->Log("Cockpit is a simulator...");
2200}
2201
2202void cockpit::FrameMove(float fElapsedTime) const
2203{
2204 logger->AddToCallStack("cockpit::FrameMove");
2205 if (sparkoProp)
2206 {
2207 const auto& force = viewscreen->cockpitSpecificForceMss;
2208 const auto& ship = playerships[0];
2209 const auto& mount = viewscreen->cameras.front().position;
2210 const SparkoProp::Sample sample{{force.x, force.y, force.z},
2211 {ship.pitch, ship.yawRadPerSec, ship.rollRadPerSec},
2212 {ship.precisionx, ship.precisiony, ship.precisionz},
2213 {ship.velocity.x, ship.velocity.y, ship.velocity.z},
2214 ship.isSimulator || viewscreen->CockpitPropMotionSuppressed() || dead,
2215 {mount.x, mount.y, mount.z},
2216 {ship.barycentric.x, ship.barycentric.y, ship.barycentric.z}};
2217 sparkoProp->Update(fElapsedTime, sample);
2218#ifdef SparkoPhysicsLog
2219 if (!sparkoTrace)
2220 {
2221 wchar_t executable[32768];
2222 const DWORD length = GetModuleFileNameW(nullptr, executable, _countof(executable));
2223 if (length > 0 && length < _countof(executable))
2224 sparkoTrace = std::make_unique<SparkoProp::TraceFile>(std::filesystem::path(executable).parent_path());
2225 }
2226 if (sparkoTrace)
2227 sparkoTrace->Write(fElapsedTime, sample, *sparkoProp,
2231#endif
2232 }
2233
2234 for (unsigned short s = 0; s < ourcockpit.components; s++)
2235 {
2236 // radio
2237 if ((ourcockpit.componentarray[s].attachto == 1 && !ourcockpit.radioEquipped) || // radio equipped
2238 (ourcockpit.componentarray[s].attachto == 2 && ourcockpit.radioEquipped)) // radio not installed
2240 else if (ourcockpit.componentarray[s].attachto == 9 && !ourcockpit.polaroid1) // polaroid1
2242 else if (!playerships[0].isSimulator && ourcockpit.componentarray[s].attachto == 998) // simulator specific
2244 else if (ourcockpit.componentarray[s].type == 40 && ourcockpit.power < 0.1f) // scrolling signage... E-10/E-11 cockpit only?
2246 else
2248
2250 continue;
2251
2252 RiseMath::Matrix matrixWorld, matrixTemp;
2253 RiseMath::Vector3 result;
2254
2255 // If it is attached... rotate to correct orientation
2257
2258 // Animated rotations...
2259 // RiseMath::MatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z );
2260 // matrixWorld=matrixWorld*matrixTemp;
2261
2262 switch (ourcockpit.componentarray[s].type)
2263 {
2266 if (sparkoProp && sparkoProp->component == s)
2267 {
2268 const auto& pose = sparkoProp->simulation.body.pose;
2269 const RiseMath::Quaternion rotation(static_cast<float>(pose.rotation.x), static_cast<float>(pose.rotation.y),
2270 static_cast<float>(pose.rotation.z), static_cast<float>(pose.rotation.w));
2271 RiseMath::MatrixRotationQuaternion(&matrixWorld, &rotation);
2272 result = RiseMath::Vector3(static_cast<float>(pose.position.x * SparkoGeometry::KmPerUnit),
2273 static_cast<float>(pose.position.y * SparkoGeometry::KmPerUnit),
2274 static_cast<float>(pose.position.z * SparkoGeometry::KmPerUnit)) - ourcockpit.position;
2275 }
2276 break;
2277 case 33: // steering wheel
2282
2283 // Animated rotations...
2285 matrixWorld = matrixWorld * matrixTemp;
2287 matrixWorld = matrixWorld * matrixTemp;
2288
2289 // Animated extensions...
2292 result += ourcockpit.componentarray[s].hingeCG;
2293
2294 result -= ourcockpit.position;
2295 break;
2296 case 32: // chair
2297 case 58: // tablet
2298 // Animated extensions...
2300 ourcockpit.chairfwdeye = result.y;
2303 result -= ourcockpit.position;
2304
2305 break;
2306 case 20: // throttle
2307 case 21: // throttle
2308 case 22: // throttle
2309 {
2310 const int engineOrdinal = ourcockpit.componentarray[s].type - 20;
2312
2314 {
2315 // Animated rotations...
2317 matrixWorld = matrixWorld * matrixTemp;
2319 matrixWorld = matrixWorld * matrixTemp;
2320
2321 // Animated extensions...
2324 result += ourcockpit.componentarray[s].hingeCG;
2325
2326 result -= ourcockpit.position;
2327 }
2328 else
2329 {
2330 // Animated extensions...
2333 result -= ourcockpit.position;
2334 }
2335 }
2336 break;
2337 case 34: // 2-DOF stick
2338 // Animated rotations...
2340 matrixWorld = matrixWorld * matrixTemp;
2342 matrixWorld = matrixWorld * matrixTemp;
2343
2344 // Animated extensions...
2347 result += ourcockpit.componentarray[s].hingeCG;
2348
2349 result -= ourcockpit.position;
2350 break;
2351 case 35: // 2-DOF stick (pitch slides)
2352 case 49: // (pitch slides only)
2353 // Animated extensions...
2356 result -= ourcockpit.position;
2357 break;
2358 case 36: // 1-DOF stick (pitch slides) yoke
2359 // Animated rotations...
2361 matrixWorld = matrixWorld * matrixTemp;
2363 matrixWorld = matrixWorld * matrixTemp;
2364
2365 // Animated extensions...
2368 result += ourcockpit.componentarray[s].hingeCG;
2369
2370 result -= ourcockpit.position;
2371 break;
2372 case 37: // rudder
2373 // Animated rotations...
2375 matrixWorld = matrixWorld * matrixTemp;
2377 matrixWorld = matrixWorld * matrixTemp;
2378
2379 // Animated extensions...
2382 result += ourcockpit.componentarray[s].hingeCG;
2383
2384 result -= ourcockpit.position;
2385 break;
2386 case 65: // left brake
2388
2389 // Animated rotations...
2391 matrixWorld = matrixWorld * matrixTemp;
2393 matrixWorld = matrixWorld * matrixTemp;
2394
2395 // Animated extensions...
2398 result += ourcockpit.componentarray[s].hingeCG;
2399
2400 result -= ourcockpit.position;
2401 break;
2402 case 66: // right brake
2404
2405 // Animated rotations...
2407 matrixWorld = matrixWorld * matrixTemp;
2409 matrixWorld = matrixWorld * matrixTemp;
2410
2411 // Animated extensions...
2414 result += ourcockpit.componentarray[s].hingeCG;
2415
2416 result -= ourcockpit.position;
2417 break;
2418 case 52: // display, standard
2419 case 48: // general animation
2420 case 4: // monitors
2421 case 59: // master warning
2422 case 60: // master caution
2423 if (ourcockpit.componentarray[s].extendby.x != 0.0f ||
2424 ourcockpit.componentarray[s].extendby.y != 0.0f ||
2425 ourcockpit.componentarray[s].extendby.z != 0.0f ||
2427 {
2429
2430 // Animated rotations...
2432 matrixWorld = matrixWorld * matrixTemp;
2434 matrixWorld = matrixWorld * matrixTemp;
2435
2436 // Animated extensions...
2439 result += ourcockpit.componentarray[s].hingeCG;
2440
2441 result -= ourcockpit.position;
2442 }
2443 else
2444 {
2446 }
2447 break;
2448 case 39: // gear shift
2449 {
2450 ourcockpit.componentarray[s].extended = 1.0f - ((ourcockpit.gearshift + 2.0f) / (ourcockpit.fwdgears + 2.0f));
2451
2452 // Animated rotations...
2454 matrixWorld = matrixWorld * matrixTemp;
2456 matrixWorld = matrixWorld * matrixTemp;
2457
2458 // Animated extensions...
2461 result += ourcockpit.componentarray[s].hingeCG;
2462
2463 result -= ourcockpit.position;
2464 }
2465 break;
2466 case 47: // The cockpit and exterior share one phase per vehicle.
2467 ourcockpit.componentarray[s].extended = .5f - .5f * cosf(playerships[0].wipers.phase * RiseMath::Pi * 2.f);
2470 matrixWorld *= matrixTemp;
2472 {
2475 matrixWorld *= matrixTemp;
2476 }
2479 break;
2480 case 40: // Scrolling lightmap
2481 ourcockpit.componentarray[s].extended += fElapsedTime * 0.01f;
2482 if (ourcockpit.componentarray[s].extended >= 1.0f)
2485 break;
2486 case 191: // sim bay ramp 1
2487 case 193: // sim bay ramp 2
2488 case 195: // sim bay ramp 3
2489 {
2490 const int index = (ourcockpit.componentarray[s].type - 191) / 2 + 1;
2491 if (playerships[index].online)
2492 {
2493 if (ourcockpit.componentarray[s].extended < 1.0f) // not yet fully up
2495 }
2496 else
2497 {
2498 if (ourcockpit.componentarray[s].extended > 0.0f) // not yet fully down
2500 }
2501
2502 // Animated rotations...
2504 matrixWorld = matrixWorld * matrixTemp;
2506 matrixWorld = matrixWorld * matrixTemp;
2507
2508 // Animated extensions...
2511 result += ourcockpit.componentarray[s].hingeCG;
2512 result -= ourcockpit.position;
2513 }
2514 break;
2515
2516 default:
2518 break;
2519 }
2520
2521 RiseMath::MatrixTranslation(&matrixTemp, result.x, result.y, result.z);
2522 matrixWorld = matrixWorld * matrixTemp;
2523
2524
2525 // orient us in it correctly for the orientation of the vehicle
2526
2527 // special for helmet we need to back off a bit ... elevate vertically ... keep from rotating inside helmet too far (new tech)
2529 {
2530 RiseMath::MatrixRotationX(&matrixTemp, -RiseMath::HalfPi); // pitch 90 degrees... apparently are normally angled down?
2531 matrixWorld = matrixWorld * matrixTemp;
2533 // matrixWorld = matrixWorld * matrixTemp;
2534 // RiseMath::MatrixScaling(&matrixTemp, 8, 8, 8); // pitch 90 degrees... apparently are normally angled down?
2535 }
2536 else
2537 RiseMath::MatrixRotationX(&matrixTemp, RiseMath::HalfPi); // pitch 90 degrees... apparently are normally angled down?
2538 matrixWorld = matrixWorld * matrixTemp;
2539
2541 {
2542 RiseMath::MatrixRotationY(&matrixTemp, -RiseMath::Pi); // turn from south to north
2543 matrixWorld = matrixWorld * matrixTemp;
2544 }
2546 {
2547 RiseMath::MatrixRotationY(&matrixTemp, RiseMath::Pi); // turn from south to north
2548 matrixWorld = matrixWorld * matrixTemp;
2549 }
2550 else
2551 {
2552 RiseMath::MatrixRotationY(&matrixTemp, -RiseMath::Pi); // turn from south to north
2553 matrixWorld = matrixWorld * matrixTemp;
2554 }
2555
2556
2557 if (ourcockpit.componentarray[s].type == 33 && !playerships[0].groundvehicle) // 3-DOF stick ... have to check gndvehicle because steering wheel is 33 too!?
2558 {
2560 matrixWorld = matrixTemp * matrixWorld;
2561 }
2562 else if (ourcockpit.componentarray[s].type == 35 && !playerships[0].groundvehicle) // 2-DOF linear pitch stick
2563 {
2564 if (ourcockpit.texturelib == VehicleType::A4) // A-4 is different somehow
2565 RiseMath::MatrixRotationYawPitchRoll(&matrixTemp, 0.0f, -viewscreen->rollInput * 0.15f, -viewscreen->yawInput * 0.2f);
2566 else
2567 RiseMath::MatrixRotationYawPitchRoll(&matrixTemp, viewscreen->rollInput * 0.15f, 0.0f, -viewscreen->yawInput * 0.2f);
2568 matrixWorld = matrixTemp * matrixWorld;
2569 }
2570 else if (ourcockpit.componentarray[s].type == 190 || // sim bay sim 1
2571 ourcockpit.componentarray[s].type == 192 || // sim bay sim 2
2572 ourcockpit.componentarray[s].type == 194) // sim bay sim 3
2573 {
2574 const int index = (ourcockpit.componentarray[s].type - 190) / 2 + 1;
2575 matrixTemp = ComputeSimulatorMotion(index, fElapsedTime);
2576 matrixWorld = matrixTemp * matrixWorld;
2577 }
2578
2579 RiseMath::MatrixInverse(&matrixTemp, nullptr, &viewscreen->matrixView);
2580 ourcockpit.componentarray[s].matWorld = matrixWorld * matrixTemp;
2581 }
2582
2583 logger->AddToCallStack("cockpit::FrameMove END");
2584}
2585
2587{
2588 HRESULT hr;
2589
2590 // Windowless interiors draw ships first, leaving their two-UV vertex format
2591 // selected. Cockpit/interior buffers have one UV pair and a 32-byte stride.
2592 V(pd3dDevice->SetFVF(RISE_FVF_VERTEX));
2593
2594 // Exterior beams must not light cockpit surfaces or run their falloff tests.
2595 // The dedicated interior shaders do not use landing lights; the legacy
2596 // geometry path also needs both fixed-function slots disabled while drawing.
2597 for (unsigned slot : LandingLights::DeviceSlots)
2598 V(pd3dDevice->LightEnable(slot, false));
2599
2600 // Interiors use new rendering
2602 {
2603 logger->AddToCallStack("cockpit::Render NEW");
2604
2606 ourcockpit.power = 1.0f;
2607
2608 V(pd3dDevice->SetStreamSource(0, polyobjects[5].VB, 0, sizeof(RiseVertexVertex)));
2609
2610 V(viewscreen->gameclass->graphics->g_pEffect->Begin(nullptr, 0));
2611 V(viewscreen->gameclass->graphics->g_pEffect->BeginPass(10)); // cockpit
2612
2613 RiseMath::Vector4 ambient;
2615 {
2616 ambient.x = 1.0f;
2617 ambient.y = 1.0f;
2618 ambient.z = 1.0f;
2619 }
2620 else // outside light like on concrete skirt around control tower
2621 {
2622 ambient.x = viewscreen->sunlight.Diffuse.r;
2623 ambient.y = viewscreen->sunlight.Diffuse.g;
2624 ambient.z = viewscreen->sunlight.Diffuse.b;
2625 }
2626 ambient.w = 0.0f; // unused
2627 V(viewscreen->gameclass->graphics->g_pEffect->SetVector("ambient", &ambient));
2628
2629 V(pd3dDevice->SetRenderState(Rendering::RenderState::STENCILREF, 4)); // was 0 on Clear()
2631 V(pd3dDevice->SetRenderState(Rendering::RenderState::STENCILFUNC, Rendering::Compare::ALWAYS)); // was always before cockpit
2632
2633 RiseMath::Vector4 features;
2634 features.x = 0.0f; // has light map
2635 features.y = 0.0f; // unused, maybe for flicker
2636 features.z = 0.0f; // unused
2637 features.w = 0.0f; // unused, maybe for instance type
2638
2639#pragma region Cockpit components
2640 short oldtexture = -1;
2641 for (unsigned short s = 0; s < ourcockpit.components; s++)
2642 {
2643 // so this is all drawn first (cockpit.cpp) so we obviously wait on the glass and HUDs
2644 if (ourcockpit.componentarray[s].type == 5 ||
2645 ourcockpit.componentarray[s].type == 51 ||
2646 ourcockpit.componentarray[s].type == 251) // not windshield or HUDs until end of render
2647 continue;
2648
2649 if (!ourcockpit.componentarray[s].visible) continue;
2650
2652 V(viewscreen->gameclass->graphics->g_pEffect->SetMatrix("matWorld", &matrixWorld));
2653 RiseMath::Matrix mWorldViewProj = matrixWorld * viewscreen->matrixLook * viewscreen->matrixProjCock;
2654 V(viewscreen->gameclass->graphics->g_pEffect->SetMatrix("matWorldViewProj", &mWorldViewProj));
2655
2656#pragma region Texture assignment
2657
2658 if (oldtexture != ourcockpit.componentarray[s].texture)
2659 {
2660 oldtexture = ourcockpit.componentarray[s].texture;
2661 if (oldtexture == ourcockpit.screentexture) // monitor
2662 {
2664 }
2665 else if (oldtexture == ourcockpit.projecttexture) // projection screen
2666 {
2668 }
2669 else if (viewscreen->m_pddsCockpitTexture[oldtexture])
2670 {
2672 }
2673 else
2674 {
2675 V(viewscreen->gameclass->graphics->g_pEffect->SetTexture("ColorMap", nullptr)); // shouldn't have this case
2676 }
2677 if (!viewscreen->m_pddsCockpitLights[oldtexture])
2678 {
2679 V(viewscreen->gameclass->graphics->g_pEffect->SetTexture("ColorMap2", nullptr));
2680 features.x = 0.0f;
2681 }
2682 else
2683 {
2685 features.x = 1.0f;
2686 }
2687 }
2688
2689#pragma endregion
2690
2691 features.w = ourcockpit.componentarray[s].type;
2692 V(viewscreen->gameclass->graphics->g_pEffect->SetVector("Features", &features));
2693
2695
2697 }
2698#pragma endregion
2699
2702
2703 //V(pd3dDevice->SetRenderState( Rendering::RenderState::STENCILREF, 4)); // stays at 4
2706 }
2707 else
2708 {
2709 logger->AddToCallStack("cockpit::Render OLD");
2710
2711 // The same positioned pulse as the ground/hulls, sampled once for this
2712 // small cabin. Gate direct light through the authored moving window mesh.
2713 float exposure = playerships[0].isSimulator ? 0.f : 1.f;
2714 if (playerships[0].reference == REF_INANOTHER)
2715 {
2716 const unsigned parent = playerships[0].inarray;
2717 exposure *= parent < MAX_SCAN ? playerships[parent].baydoorextent : 0.f;
2718 }
2719 const auto cabinStrike = lightningWindows.Sample(strike, [&](unsigned component) -> const RiseMath::Matrix* {
2720 return component < ourcockpit.components && ourcockpit.componentarray[component].visible
2721 ? &ourcockpit.componentarray[component].matWorld : nullptr;
2722 }, exposure);
2723 CockpitLightning::ScopedLights strikeLights(pd3dDevice->Draws().Fixed(), cabinStrike);
2724
2725 Rendering::Light templight;
2726 RiseMath::Vector3 vieneohit, result;
2727
2728#pragma region Setting the scene
2729
2730 // Cockpit ------------------------------------------------------------------------------------
2731
2738
2739 V(pd3dDevice->SetStreamSource(0, polyobjects[5].VB, 0, sizeof(RiseVertexVertex)));
2740
2749
2750#pragma region Interior Lighting
2751
2752 logger->AddToCallStack("cockpit::Render OLD IL");
2753
2754 RiseMath::Color tempfactor;
2755
2757 tempfactor = 0xFFBFB5A8;
2758 else if (playerships[0].reference != REF_BUILDING && playerships[0].reference != REF_WINDOWLESS)
2759 tempfactor = 0xFF400000;
2760 else
2761 tempfactor = 0xFF000000;
2762
2764 RiseMath::ColorScale(&tempfactor, &tempfactor, ourcockpit.power);
2765 if (playerships[0].isSimulator)
2766 {
2767 tempfactor.r = RiseMath::Max(viewscreen->sunlight.Diffuse.r * 0.25f, tempfactor.r);
2768 tempfactor.g = RiseMath::Max(viewscreen->sunlight.Diffuse.g * 0.25f, tempfactor.g);
2769 tempfactor.b = RiseMath::Max(viewscreen->sunlight.Diffuse.b * 0.25f, tempfactor.b);
2770 }
2771
2772 // Keep lamps and sky fill unamplified until the surface shader mixes
2773 // them. Independent clipping erases the cabin lamp's red cast.
2774 const auto& surfaceVision = viewscreen->ptrWeather->cockpitVision;
2775 V(pd3dDevice->SetRenderState(Rendering::RenderState::TEXTUREFACTOR, tempfactor));
2776
2777#pragma endregion
2778
2779 int color0op;
2780 int color0arg2;
2781 if (!playerships[0].isSimulator)
2782 {
2787 }
2788 else
2789 {
2792 color0arg2 = -1;
2793 }
2794 V(pd3dDevice->SetTextureStageState(0, Rendering::TextureState::COLORARG1, Rendering::TextureArgument::TFACTOR)); // add cockpit illum to diffuse
2795 int color0arg1 = Rendering::TextureArgument::TFACTOR;
2797
2800 V(pd3dDevice->SetTextureStageState(1, Rendering::TextureState::COLORARG1, Rendering::TextureArgument::TEXTURE)); // modulate cockpit with result
2801 int color1arg1 = Rendering::TextureArgument::TEXTURE;
2803 int color1arg2 = Rendering::TextureArgument::CURRENT;
2805
2809 int color2arg1 = Rendering::TextureArgument::TEXTURE;
2811 int color2arg2 = Rendering::TextureArgument::CURRENT;
2813
2814 // now if it is a ground vehicle, we need to addsmooth the light then modulate the color
2815
2816
2818 {
2820 }
2821 //pd3dDevice->SetTextureStageState( 0, Rendering::TextureState::ALPHAARG1, Rendering::TextureArgument::TFACTOR );
2822 //pd3dDevice->SetTextureStageState( 1, Rendering::TextureState::ALPHAOP, Rendering::TextureOperation::SELECTARG1 ); // take texture alpha
2823 //pd3dDevice->SetTextureStageState( 1, Rendering::TextureState::ALPHAARG1, Rendering::TextureArgument::TEXTURE );
2824 //pd3dDevice->SetTextureStageState( 2, Rendering::TextureState::ALPHAOP, Rendering::TextureOperation::SELECTARG1 ); // carry
2825 //pd3dDevice->SetTextureStageState( 2, Rendering::TextureState::ALPHAARG1, Rendering::TextureArgument::CURRENT );
2826
2827 V(pd3dDevice->SetRenderState(Rendering::RenderState::STENCILREF, 4)); // was 0 on Clear()
2829 V(pd3dDevice->SetRenderState(Rendering::RenderState::STENCILFUNC, Rendering::Compare::ALWAYS)); // was always before cockpit
2830
2832
2833#pragma region Sunlight and Radiosity
2834
2835 logger->AddToCallStack("cockpit::Render OLD SLR");
2836
2837 if (!playerships[0].isSimulator)
2838 {
2840 {
2841 if (viewscreen->ptrWeather->shadow > 0.0f)
2842 {
2844 // radiosity
2845 ZeroMemory(&templight, sizeof Rendering::Light);
2847 RiseMath::Vec3Scale(&vieneohit, &Xsunlight, radiusC); // Where it hits Vieneo
2848 RiseMath::Vec3Subtract(&result, &vieneohit, &playerships[0].position); // Vector from surface point to this object
2849 RiseMath::Vec3Normalize(&result, &result);
2850 templight.Direction = result; // He doesn't have to be normalized but below does
2851 float radio = fabsf(RiseMath::Vec3Dot(&result, &Xsunlight)); // cos of angle between the two
2852 radio = 1.0f - radio; // Compliment, not comparing to surface normal ya know
2853 radio /= powf(RiseMath::Vec3Length(&playerships[0].position) / radiusC, 2.0f);
2855 // cloud average from aerobump is .93, .92, and .91, multiplied by sunlight
2856 templight.Diffuse.r = 0.6975f * (radio); templight.Diffuse.g = 0.805f * (radio); templight.Diffuse.b = 0.91f * (radio);
2857 V(pd3dDevice->SetLight(2, &templight)); // Radiosity
2858 V(pd3dDevice->LightEnable(2, true));
2859 }
2860
2861 // Adjust diffuse
2862 templight = viewscreen->sunlight;
2863 if (surfaceVision.clouds) templight.Diffuse = viewscreen->ptrWeather->cockpitRawCloudLight;
2865 {
2866 // The same scattered/direct light on both sides of 10 km.
2867 // Optical gain belongs to cockpit surfaces too; screens and
2868 // emissive labels retain their separate texture-stage paths.
2869 templight.Ambient = surfaceVision.clouds ? viewscreen->ptrWeather->cockpitRawAmbient
2872 }
2873 else if (f_ACL <= 0.150f) // legacy in or below clouds
2874 {
2875 templight.Ambient.r = templight.Diffuse.r * viewscreen->alphascreen.a;
2876 templight.Ambient.g = templight.Diffuse.g * viewscreen->alphascreen.a;
2877 templight.Ambient.b = templight.Diffuse.b * viewscreen->alphascreen.a;
2878 }
2879
2880 const float f_temp = viewscreen->ptrWeather->shadow *
2882 templight.Diffuse.r *= f_temp; // only ambient can get through clouds and objects
2883 templight.Diffuse.g *= f_temp; // only ambient can get through clouds and objects
2884 templight.Diffuse.b *= f_temp; // only ambient can get through clouds and objects
2885 V(pd3dDevice->SetLight(0, &templight));
2886 }
2887 else
2888 {
2889 // Adjust diffuse
2890 templight = viewscreen->sunlight;
2891 templight.Ambient = templight.Diffuse;
2892 if (surfaceVision.clouds) templight.Ambient = templight.Diffuse = viewscreen->ptrWeather->cockpitRawCloudLight;
2893 templight.Diffuse.r *= 0.25f;
2894 templight.Diffuse.g *= 0.25f;
2895 templight.Diffuse.b *= 0.25f;
2896 V(pd3dDevice->SetLight(0, &templight));
2897 }
2898 }
2899 else // simulator
2900 {
2901 // here is where we can override the ACL lighting?
2902 templight = viewscreen->sunlight;
2903 templight.Ambient.r = templight.Ambient.g = templight.Ambient.b = 1.0f;
2904 templight.Diffuse = RiseMath::Color();
2905 V(pd3dDevice->SetLight(0, &templight));
2906 }
2907#pragma endregion
2908
2909#pragma endregion
2910
2911 if (!viewscreen->camera->outside)
2912 {
2913#pragma region Cockpit components
2914
2915 logger->AddToCallStack("cockpit::Render OLD CC");
2916
2917 short oldtexture = -1;
2918 for (unsigned short s = 0; s < ourcockpit.components; s++)
2919 {
2920 // so this is all drawn first (cockpit.cpp) so we obviously wait on the glass and HUDs
2921 if (ourcockpit.componentarray[s].type == 5 ||
2922 ourcockpit.componentarray[s].type == 51 || // not windshield or HUDs until end of render
2923 ourcockpit.componentarray[s].type == 251 ||
2925 continue;
2926
2928 continue;
2929
2931
2932#pragma region Texture assignment
2933 if (oldtexture != ourcockpit.componentarray[s].texture)
2934 {
2935 oldtexture = ourcockpit.componentarray[s].texture;
2936 if (oldtexture == ourcockpit.screentexture) // monitor
2937 {
2938 V(pd3dDevice->SetTexture(1, viewscreen->m_pddsDynamicTexture));
2939 }
2940 else if (oldtexture == ourcockpit.projecttexture) // projection screen
2941 {
2943 }
2944 else if (viewscreen->m_pddsCockpitTexture[oldtexture])
2945 {
2946 V(pd3dDevice->SetTexture(1, viewscreen->m_pddsCockpitTexture[oldtexture]));
2949 }
2950 else
2951 {
2954 }
2955
2957 {
2960 }
2961 else
2962 {
2965 V(pd3dDevice->SetTexture(2, viewscreen->m_pddsCockpitLights[oldtexture]));
2966 }
2967 }
2968
2969 if (oldtexture == ourcockpit.screentexture) // monitor
2970 {
2971 assert(color1arg1 == Rendering::TextureArgument::TEXTURE);
2972 }
2973 else if (oldtexture == ourcockpit.projecttexture) // projection screen
2974 {
2975 assert(color1arg1 == Rendering::TextureArgument::TEXTURE);
2976 }
2978 {
2979 assert(color1arg1 == Rendering::TextureArgument::TEXTURE);
2980 }
2981 else
2982 {
2983 //assert(color1arg1 == Rendering::TextureArgument::SPECULAR);
2984 if (color1arg1 != Rendering::TextureArgument::SPECULAR)
2985 {
2986 // we were getting an assert failure here... and this is the old rendering pipeline so I just forced it
2989 }
2990 }
2991 assert(color1op == Rendering::TextureOperation::MODULATE);
2992 assert(color1arg2 == Rendering::TextureArgument::CURRENT);
2993
2995 {
2996 assert(color2op == Rendering::TextureOperation::DISABLE);
2997 }
2998 else
2999 {
3000 assert(color2op == Rendering::TextureOperation::ADDSMOOTH);
3001 }
3002 assert(color2arg1 == Rendering::TextureArgument::TEXTURE);
3003 assert(color2arg2 == Rendering::TextureArgument::CURRENT);
3004
3005
3006 if (oldtexture == ourcockpit.projecttexture) // projection screen
3007 {
3008 // flicker
3009 V(pd3dDevice->SetRenderState(Rendering::RenderState::TEXTUREFACTOR, viewscreen->flicker ? 0xFFBFBFBF : 0xFFBABABA));
3014 }
3015 else if (ourcockpit.componentarray[s].type == 4 || ourcockpit.componentarray[s].type == 58) // monitor and tablet
3016 {
3017 if (ourcockpit.power < (0.75f + 0.1f * RandomFloat() - 0.05f))
3018 {
3020 }
3023 // flicker
3029 }
3030 else if (ourcockpit.componentarray[s].type == 31 && // cockpit exterior
3031 ourcockpit.componentarray[s].attachto != 998) // simulator guts
3032 {
3035 V(pd3dDevice->SetRenderState(Rendering::RenderState::STENCILREF, 3)); // 0 is default
3036 }
3037 else if (ourcockpit.componentarray[s].type == 52) // standard cluster
3038 {
3039 if (viewscreen->m_pddsCockpitLights[oldtexture] && ourcockpit.power > 0.0f && playerships[0].headlight)
3040 {
3041 V(pd3dDevice->SetTexture(1, viewscreen->m_pddsCockpitLights[oldtexture]));
3044 }
3045 else
3046 {
3049 }
3050 if (oldtexture == ourcockpit.screentexture) // monitor
3051 {
3052 V(pd3dDevice->SetTexture(2, viewscreen->m_pddsDynamicTexture));
3053 }
3054 else
3055 {
3056 V(pd3dDevice->SetTexture(2, viewscreen->m_pddsCockpitTexture[oldtexture]));
3057 }
3060 }
3061 else if (ourcockpit.componentarray[s].type == 57) // transparency
3062 {
3064 }
3065 else if (ourcockpit.componentarray[s].type == 38) // mostly enclosed
3066 {
3067 V(pd3dDevice->SetRenderState(Rendering::RenderState::TEXTUREFACTOR, tempfactor * 0.25f));
3070 }
3071 else if (ourcockpit.componentarray[s].type == 47) // wipers
3072 {
3075 V(pd3dDevice->SetRenderState(Rendering::RenderState::STENCILREF, 3)); // 0 is default
3076 }
3077 else if (ourcockpit.componentarray[s].type == 40) // scrolling lightmap
3078 {
3079 // select color map only
3080 V(pd3dDevice->SetTextureStageState(0, Rendering::TextureState::COLOROP, Rendering::TextureState::COLORARG1)); // light map Rendering::TextureArgument::TEXTURE
3085 V(pd3dDevice->SetTextureStageState(1, Rendering::TextureState::COLOROP, Rendering::TextureOperation::DISABLE)); // light map Rendering::TextureArgument::TEXTURE
3086 V(pd3dDevice->SetTexture(0, viewscreen->m_pddsCockpitLights[oldtexture]));
3087
3088 RiseMath::Matrix matrixTemp;
3089 RiseMath::MatrixIdentity(&matrixTemp);
3090 matrixTemp._31 = ourcockpit.componentarray[s].extended;
3091 V(pd3dDevice->SetTransform(Rendering::TransformSlot::TEXTURE0, &matrixTemp));
3094 }
3095 else if (ourcockpit.componentarray[s].type == 59 &&
3096 (!viewscreen->gameclass->bus->MasterWarning || fmodf(static_cast<float>(viewscreen->gameclass->bus->ProgramTime), 2.0f) > 1.0f) ||
3097 (ourcockpit.componentarray[s].type == 60 && (!viewscreen->gameclass->bus->MasterCaution || fmodf(static_cast<float>(viewscreen->gameclass->bus->ProgramTime), 2.0f) < 1.0f)))
3098 {
3101 }
3102#pragma endregion
3103
3104 // Scope the optical response to this monitor draw; shared atlas data,
3105 // surface labels, the HUD and later draws retain their normal output.
3106 auto& fixedDisplay = pd3dDevice->Draws().Fixed();
3107 // Monitor/projection/scrolling emission has its own treatment.
3108 const bool surfaceDraw = ourcockpit.componentarray[s].type != 4 && ourcockpit.componentarray[s].type != 58 &&
3109 ourcockpit.componentarray[s].type != 40 && oldtexture != ourcockpit.projecttexture;
3110 fixedDisplay.nightVisionSurface = surfaceVision.clouds && surfaceDraw
3111 ? DirectX::XMFLOAT4(surfaceVision.red,surfaceVision.green,surfaceVision.blue,1) : DirectX::XMFLOAT4{};
3113 if ((ourcockpit.componentarray[s].type == 4 || ourcockpit.componentarray[s].type == 58) &&
3114 oldtexture != ourcockpit.projecttexture && displayStrength > 0 &&
3115 size_t(s) < displayDraws.size() && !displayDraws[s].empty())
3116 {
3117 for (const auto& part : displayDraws[s])
3118 {
3119 fixedDisplay.displayUvBounds = part.bounds;
3120 fixedDisplay.nightVisionDisplay = part.bounds.z > part.bounds.x && part.bounds.w > part.bounds.y ? displayStrength : 0;
3121 V(pd3dDevice->DrawPrimitive(Rendering::Primitive::TriangleList, part.startvertex, part.primitives));
3122 }
3123 }
3124 else
3125 {
3126 fixedDisplay.nightVisionDisplay = 0;
3128 }
3129 fixedDisplay.nightVisionDisplay = 0;
3130 fixedDisplay.nightVisionSurface = {};
3131
3132
3133 if (oldtexture == ourcockpit.projecttexture) // projection screen
3134 {
3135 V(pd3dDevice->SetRenderState(Rendering::RenderState::TEXTUREFACTOR, tempfactor));
3139 {
3142 }
3143 else
3144 {
3147 }
3148 }
3149 else if (ourcockpit.componentarray[s].type == 4 || ourcockpit.componentarray[s].type == 58) // monitor and tablet
3150 {
3156 {
3159 }
3160 else
3161 {
3164 }
3165 }
3166 else if (ourcockpit.componentarray[s].type == 31 && // cockpit exterior
3167 ourcockpit.componentarray[s].attachto != 998) // simulator guts
3168 {
3171 V(pd3dDevice->SetRenderState(Rendering::RenderState::STENCILREF, 4)); // 0 is defaul)t
3172 }
3173 else if (ourcockpit.componentarray[s].type == 52) // standard cluster
3174 {
3177 if (oldtexture == ourcockpit.screentexture) // monitor
3178 {
3179 V(pd3dDevice->SetTexture(1, viewscreen->m_pddsDynamicTexture));
3180 }
3181 else
3182 {
3183 V(pd3dDevice->SetTexture(1, viewscreen->m_pddsCockpitTexture[oldtexture]));
3184 }
3186 {
3189 }
3190 else
3191 {
3194 V(pd3dDevice->SetTexture(2, viewscreen->m_pddsCockpitLights[oldtexture]));
3195 }
3196 }
3197 else if (ourcockpit.componentarray[s].type == 57) // transparency
3198 {
3200 }
3201 else if (ourcockpit.componentarray[s].type == 38) // mostly enclosed
3202 {
3205 V(pd3dDevice->SetRenderState(Rendering::RenderState::TEXTUREFACTOR, tempfactor));
3206 }
3207 else if (ourcockpit.componentarray[s].type == 47) // wipers
3208 {
3211 V(pd3dDevice->SetRenderState(Rendering::RenderState::STENCILREF, 4)); // 0 is default
3212 }
3213 else if (ourcockpit.componentarray[s].type == 40) // scrolling lightmap
3214 {
3217 if (!playerships[0].isSimulator)
3218 {
3221 V(pd3dDevice->SetTextureStageState(0, Rendering::TextureState::COLORARG1, Rendering::TextureArgument::TFACTOR)); // add cockpit illum to diffuse
3223 }
3224 else
3225 {
3228 V(pd3dDevice->SetTextureStageState(0, Rendering::TextureState::COLORARG1, Rendering::TextureArgument::TFACTOR)); // add cockpit illum to diffuse
3230 }
3231
3234 }
3235 else if (ourcockpit.componentarray[s].type == 59 && (!viewscreen->gameclass->bus->MasterWarning || fmodf(static_cast<float>(viewscreen->gameclass->bus->ProgramTime), 2.0f) > 1.0f) ||
3236 (ourcockpit.componentarray[s].type == 60 && (!viewscreen->gameclass->bus->MasterCaution || fmodf(static_cast<float>(viewscreen->gameclass->bus->ProgramTime), 2.0f) < 1.0f)))
3237 {
3239 {
3242 }
3243 else
3244 {
3247 V(pd3dDevice->SetTexture(2, viewscreen->m_pddsCockpitLights[oldtexture]));
3248 }
3249 }
3250 }
3251#pragma endregion
3252 }
3253
3254
3257
3260
3264
3265
3266#pragma region Interior people (next closest)
3267
3268 //if (!g_bOutside)
3269 //{
3270 // if (game->gameclass->GUI->player[ourcockpit.ourplyrC].frame > 0)
3271 // {
3272 // //pd3dDevice->SetStreamSource( 0, polyobjects[playerships[0].VB].VB, 0, sizeof(RiseVertexVertex) );
3273 // //pd3dDevice->SetSamplerState( 0, Rendering::SamplerState::MAGFILTER, Rendering::Filter::LINEAR ); // hull texture
3274 // //pd3dDevice->SetSamplerState( 0, Rendering::SamplerState::MINFILTER, Rendering::Filter::LINEAR ); // hull texture
3275 // short t = ourcockpit.ourplyrC;
3276 // //for (short t=0; t<MAX_ONLINEPLAYERS; t++)
3277 // {
3278 // // reset mode
3279 // /*for (short s=0; s<playerships[0].components; s++)
3280 // {
3281 // RiseMath::MatrixIdentity(&playerships[0].componentarray[s].matReal);
3282 // RiseMath::MatrixIdentity(&playerships[0].componentarray[s].matRot);
3283 // }*/
3284 // if (game->gameclass->GUI->player[t].frame > -1) // initialized
3285 // {
3286 // /*RiseMath::Matrix matrixBase;
3287 // RiseMath::MatrixTranslation(&matrixBase,
3288 // game->gameclass->GUI->player[t].smoothx - ourcockpit.chaireye.x,
3289 // game->gameclass->GUI->player[t].smoothy - ourcockpit.chaireye.y,
3290 // game->gameclass->GUI->player[t].smoothz - ourcockpit.chaireye.z);
3291 // RiseMath::MatrixRotationZ(&matrixTemp, -game->gameclass->GUI->player[t].smoothhdg + RiseMath::Pi);
3292 // matrixBase = matrixTemp * matrixBase;*/
3293
3294 // // char msg[999];
3295 // // sprintf_s(msg, sizeof(msg), "DEBUG %i ANI %i time %.1f x %f y %f z %f (hdg %.0f)", t, player[t].ani, player[t].anitime, player[t].smoothx, player[t].smoothy, player[t].smoothz, player[t].smoothhdg);
3296 // // _write(logfile, msg, strlen(msg));
3297 // // if (t!=ourcockpit.ourplyrC) // eventually want to see ourselves in the mirror
3298 // // {
3299 // // // temporary storage for person
3300 // // for (s=0; s<playerships[0].components; s++)
3301 // // {
3302 // // if (playerships[0].componentarray[s].type==101)
3303 // // pd3dDevice->SetTexture( 0, game->m_pddsTempHumanHead );
3304 // // else
3305 // // pd3dDevice->SetTexture( 0, game->m_pddsTempHuman );
3306 // // bool hierarchy=false;
3307 // // RiseMath::Matrix matHier, matHierRot;
3308 // // // heirarchial people
3309 // // if (playerships[0].componentarray[s].type>100 &&
3310 // // playerships[0].componentarray[s].type<120)
3311 // // {
3312 // //// float tempy=module[t].instance[s].y, tempp=module[t].instance[s].p, tempr=module[t].instance[s].r;
3313 // //// CheckExtension(t, s);
3314 // // for (short r=0; r<playerships[0].components; r++)
3315 // // {
3316 // // if ((playerships[0].componentarray[s].type==101 && playerships[0].componentarray[r].type==100) ||
3317 // // (playerships[0].componentarray[s].type==102 && playerships[0].componentarray[r].type==100) ||
3318 // // (playerships[0].componentarray[s].type==103 && playerships[0].componentarray[r].type==100) ||
3319 // // (playerships[0].componentarray[s].type==104 && playerships[0].componentarray[r].type==100) ||
3320 // // (playerships[0].componentarray[s].type==105 && playerships[0].componentarray[r].type==103) ||
3321 // // (playerships[0].componentarray[s].type==106 && playerships[0].componentarray[r].type==104) ||
3322 // // (playerships[0].componentarray[s].type==107 && playerships[0].componentarray[r].type==105) ||
3323 // // (playerships[0].componentarray[s].type==108 && playerships[0].componentarray[r].type==106) ||
3324 // // (playerships[0].componentarray[s].type==109 && playerships[0].componentarray[r].type==102) ||
3325 // // (playerships[0].componentarray[s].type==110 && playerships[0].componentarray[r].type==102) ||
3326 // // (playerships[0].componentarray[s].type==111 && playerships[0].componentarray[r].type==109) ||
3327 // // (playerships[0].componentarray[s].type==112 && playerships[0].componentarray[r].type==110) ||
3328 // // (playerships[0].componentarray[s].type==113 && playerships[0].componentarray[r].type==111) ||
3329 // // (playerships[0].componentarray[s].type==114 && playerships[0].componentarray[r].type==112) ||
3330 // // (playerships[0].componentarray[s].type==115 && playerships[0].componentarray[r].type==102)) // hip accessory
3331 // // {
3332 // // // difference in location tells it the attachment point
3333 // // result=playerships[0].componentarray[s].nominalxyz-playerships[0].componentarray[r].nominalxyz;
3334 // // // find new location of attachment point
3335 // // RiseMath::Vec3TransformCoord(&result, &result, &playerships[0].componentarray[r].matReal);
3336 // // // set the location back to zero since we will add it later
3337 // // result-=playerships[0].componentarray[s].nominalxyz;
3338 // // RiseMath::MatrixTranslation(&matHier, result.x, result.y, result.z);
3339 // // // may not have been initialized
3340 // // matHierRot=playerships[0].componentarray[r].matRot;
3341 // // hierarchy=true; r=playerships[0].components;
3342 // // }
3343 // // }
3344 // // float pitch, yaw, roll;
3345 // // if (playerships[0].componentarray[s].type==101) // head
3346 // // {
3347 // // pitch = game->gameclass->GUI->player[t].smoothrolltilt;
3348 // // yaw = game->gameclass->GUI->player[t].smoothupdown;
3349 // // roll = -game->gameclass->GUI->player[t].smoothleftright;
3350 // // }
3351 // // else
3352 // // {
3353 // // roll=tempani.ypr[playerships[0].componentarray[s].type-100].z;
3354 // // pitch=tempani.ypr[playerships[0].componentarray[s].type-100].y;
3355 // // yaw=tempani.ypr[playerships[0].componentarray[s].type-100].x;
3356 // // }
3357 // //// float tempy=module[t].instance[s].y, tempp=module[t].instance[s].p, tempr=module[t].instance[s].r;
3358 // //// CheckExtension(t, s);
3359 // // result.x=-1.0f; result.y=0.0f; result.z=0.0f;
3360 // // if (hierarchy)
3361 // // RiseMath::Vec3TransformNormal(&result, &result, &matHierRot);
3362 // // RiseMath::MatrixRotationAxis(&playerships[0].componentarray[s].matRot, &result, game->yaw);
3363 // // result.x=0.0f; result.y=1.0f; result.z=0.0f;
3364 // // if (hierarchy)
3365 // // RiseMath::Vec3TransformNormal(&result, &result, &matHierRot);
3366 // // RiseMath::MatrixRotationAxis(&matrixTemp, &result, game->pitch);
3367 // // playerships[0].componentarray[s].matRot=matrixTemp*playerships[0].componentarray[s].matRot;
3368 // // result.x=0.0f; result.y=0.0f; result.z=1.0f;
3369 // // if (hierarchy)
3370 // // RiseMath::Vec3TransformNormal(&result, &result, &matHierRot);
3371 // // RiseMath::MatrixRotationAxis(&matrixTemp, &result, game->roll);
3372 // // playerships[0].componentarray[s].matRot=matrixTemp*playerships[0].componentarray[s].matRot;
3373 // //// module[t].instance[s].y=tempy;
3374 // //// module[t].instance[s].p=tempp;
3375 // //// module[t].instance[s].r=tempr;
3376 // // if (hierarchy)
3377 // // playerships[0].componentarray[s].matRot=matHierRot*playerships[0].componentarray[s].matRot;
3378 // // }
3379 // // else
3380 // // RiseMath::MatrixRotationYawPitchRoll( &playerships[0].componentarray[s].matRot, playerships[0].componentarray[s].nominalypr.x, playerships[0].componentarray[s].nominalypr.y, playerships[0].componentarray[s].nominalypr.z );
3381 // // result=playerships[0].componentarray[s].nominalxyz;
3382 // // RiseMath::MatrixTranslation(&matrixWorld, result.x, result.y, result.z );
3383 // // matrixWorld=playerships[0].componentarray[s].matRot*matrixWorld;
3384 // // if (hierarchy)
3385 // // matrixWorld=matrixWorld*matHier;
3386 // // playerships[0].componentarray[s].matReal=matrixWorld;
3387 // // matrixWorld=matrixWorld*matrixBase;
3388 // // // orient us in it correctly for the orientation of the vehicle
3389 // // RiseMath::MatrixRotationX( &matrixTemp, RiseMath::HalfPi ); // pitch
3390 // // matrixWorld=matrixWorld*matrixTemp;
3391 // // RiseMath::MatrixRotationY( &matrixTemp, RiseMath::Pi ); // pitch
3392 // // matrixWorld=matrixWorld*matrixTemp;
3393 // // RiseMath::MatrixInverse(&matrixTemp, NULL, &game->matrixView);
3394 // // matrixWorld=matrixWorld*matrixTemp;
3395 // // pd3dDevice->SetTransform( Rendering::TransformSlot::WORLD, &matrixWorld );
3396 // //// if (oldtexture!=playerships[0].componentarray[s].texture)
3397 // //// {
3398 // //// short oldtexture=playerships[0].componentarray[s].texture;
3399 // //// pd3dDevice->SetTexture( 0, m_pddsTempHuman );
3400 // //// }
3401 // // pd3dDevice->DrawPrimitive( Rendering::Primitive::TriangleList, playerships[0].componentarray[s].startvertex, playerships[0].componentarray[s].primitives );
3402 // // }
3403 // // }
3404 // }
3405 // }
3406 // }
3407 //}
3408
3409#pragma endregion
3410
3411
3412
3413
3414 V(pd3dDevice->SetRenderState(Rendering::RenderState::STENCILREF, 2)); // was 4
3415 // this is opposite of what you would think... this means that we pass the function if "2" is greater than what is currently in the buffer
3418
3419 if (playerships[0].isSimulator)
3420 {
3422 }
3423 else
3424 {
3426 }
3427
3428
3429 V(pd3dDevice->SetLight(0, &viewscreen->sunlight));
3430 if (!playerships[0].isSimulator)
3431 {
3433 {
3434 // Restore
3435 if (viewscreen->ptrWeather->shadow > 0.0f)
3436 {
3437 V(pd3dDevice->LightEnable(2, false));
3438 }
3439 }
3440 }
3441
3443
3450 }
3451
3452 // Exterior drawing follows the cockpit and still needs its current beams.
3454 logger->AddToCallStack("cockpit::Render END");
3455}
3456
3458{
3459 logger->AddToCallStack("cockpit::OnLostDevice");
3460 logger->Log("cockpit::OnLostDevice");
3461
3463 {
3465 viewscreen->gameclass->UpdateTrackedResource("m_pddsDynamicSurface", 3);
3466 }
3467
3469 {
3471 viewscreen->gameclass->UpdateTrackedResource("m_pddsDynamicTexture", 3);
3472 }
3473
3474 char msg[199];
3475 for (short s = 0; s < cockpittextureC; s++)
3476 {
3478 {
3480 sprintf_s(msg, sizeof msg, "m_pddsCockpitTexture[%i]", s);
3482 }
3483
3485 {
3487 sprintf_s(msg, sizeof msg, "m_pddsCockpitLights[%i]", s);
3489 }
3490 }
3491
3493 {
3495 viewscreen->gameclass->UpdateTrackedResource("m_pddsGVBackground", 3);
3496 }
3498 {
3500 viewscreen->gameclass->UpdateTrackedResource("m_pddsNamePlate", 3);
3501 }
3503 {
3505 viewscreen->gameclass->UpdateTrackedResource("m_pddsGVDialSmall", 3);
3506 }
3507 if (viewscreen->m_pddsAOA[0])
3508 {
3510 viewscreen->gameclass->UpdateTrackedResource("m_pddsAOA[0]", 3);
3511 }
3512 if (viewscreen->m_pddsAOA[1])
3513 {
3515 viewscreen->gameclass->UpdateTrackedResource("m_pddsAOA[1]", 3);
3516 }
3517 if (viewscreen->m_pddsAOA[2])
3518 {
3520 viewscreen->gameclass->UpdateTrackedResource("m_pddsAOA[2]", 3);
3521 }
3523 {
3525 viewscreen->gameclass->UpdateTrackedResource("m_pddsLightsCruiseIcons", 3);
3526 }
3528 {
3530 viewscreen->gameclass->UpdateTrackedResource("m_pddsFuelIcon", 3);
3531 }
3533 {
3535 viewscreen->gameclass->UpdateTrackedResource("m_pddsGVCompass", 3);
3536 }
3538 {
3540 viewscreen->gameclass->UpdateTrackedResource("m_pddsGVDirection", 3);
3541 }
3542
3543}
3544
3546{
3547 HRESULT hr;
3548 char msg[199];
3549
3550 logger->AddToCallStack("cockpit::OnResetDevice");
3551 sprintf_s(msg, sizeof msg,
3552 "cockpit::OnResetDevice device=%p texturelib=%u nextgen=%i player=%i dynamicTexture=%p dynamicSurface=%p",
3553 pd3dDevice, static_cast<unsigned int>(ourcockpit.texturelib), ourcockpit.nextgen ? 1 : 0,
3556 logger->Log(msg);
3557
3558 if (pd3dDevice == nullptr)
3559 {
3560 logger->Log("cockpit::OnResetDevice received a null Direct3D device", Logger::Level::Error, E_POINTER);
3561 return E_POINTER;
3562 }
3563
3564 logger->AddToCallStack("cockpit::OnResetDevice dynamic texture");
3565
3566 if (!ourcockpit.nextgen)
3567 {
3568 if (FAILED(hr = Rendering::CreateTexture(pd3dDevice, 907, 352, 1, Rendering::BufferUsage::RENDERTARGET,
3570 {
3571 logger->Log("cockpit::OnResetDevice failed to create the 907x352 instrumentation texture",
3573 return hr;
3574 }
3575 else
3577 }
3578 else
3579 {
3580 if (FAILED(hr = Rendering::CreateTexture(pd3dDevice, 1135, 388, 1, Rendering::BufferUsage::RENDERTARGET,
3582 {
3583 logger->Log("cockpit::OnResetDevice failed to create the 1135x388 instrumentation texture",
3585 return hr;
3586 }
3587 else
3589 }
3590
3591 logger->AddToCallStack("cockpit::OnResetDevice dynamic surface");
3593 {
3594 logger->Log("cockpit::OnResetDevice failed to get the instrumentation surface",
3597 viewscreen->gameclass->UpdateTrackedResource("m_pddsDynamicTexture", 3);
3598 return hr;
3599 }
3600 else
3601 {
3603 }
3604
3605 WCHAR hullfile[199], lightfile[199];
3606 logger->AddToCallStack("cockpit::OnResetDevice cockpit textures");
3607 for (short s = 0; s < cockpittextureC; s++)
3608 {
3609 // Defaults
3610 hullfile[0] = lightfile[0] = 0;
3612 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3613 switch (ourcockpit.texturelib)
3614 {
3615 case VehicleType::E10:
3616 {
3617 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3618 switch (s)
3619 {
3620 case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hull1.dds");
3621 break;
3622 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\E-10-saint-cockpit-glass.dds");
3623 break;
3624 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
3625 break;
3626 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
3627 break;
3628 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk.dds");
3629 break;
3630 //case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
3631 // break;
3632 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1-arm.dds");
3633 break;
3634 case 8: wcscpy_s(hullfile, 199, L"textures\\Interiors\\INT-FIX-light-incan1.dds");
3635 break; // must be renamed to Interiors
3636 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-monitor1.dds");
3637 break;
3638 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1.dds");
3639 break;
3640 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-buttonboard1.dds");
3641 break;
3642 case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand2-mount.dds");
3643 break;
3644 case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hatch1.dds");
3645 break;
3646 case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-tread1.dds");
3647 break;
3648 case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-bracing1.dds");
3649 break;
3650 case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-guts1.dds");
3651 break;
3652 case 17: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk-LIGHTWRAP.dds");
3653 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk-LIGHTWRAP.dds");
3654 break; // comment out hullfile and rename lightfile to LIGHTWRAP.dds
3655 case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitthrottle.dds");
3656 break;
3657 case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpittpull.dds");
3658 break;
3659 case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
3660 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
3661 break;
3662 case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
3663 break;
3664 case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons2.dds");
3665 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons2LIGHT.dds");
3666 break;
3667 case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
3668 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
3669 break;
3670 case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-door1.dds");
3671 break;
3672 case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10commandchair.dds");
3673 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
3674 break;
3675 case 26: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-frame1.dds");
3676 break;
3677 case 27: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-flightstick2.dds");
3678 break;
3679 case 28: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod1-emergency.dds");
3680 break;
3681 case 29: wcscpy_s(hullfile, 199, L"textures\\Interiors\\INT-FIX-glass1.dds");
3682 break; // Must be renamed to Interiors
3683 case 30: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-grate1.dds");
3684 break;
3685 }
3686 }
3687 break;
3688
3689 case VehicleType::E11:
3690 {
3691 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3692 switch (s)
3693 {
3694 case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hull1.dds");
3695 break;
3696 //case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\projection.dds");
3697 // break;
3698 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\tread2.dds");
3699 break;
3700 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-guts1.dds");
3701 break;
3702 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\E-10-saint-cockpit-glass.dds");
3703 break;
3704 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
3705 break;
3706 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-buttonboard1-2x.dds");
3707 break;
3708 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
3709 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
3710 break;
3711 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk.dds");
3712 break;
3713 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1-arm.dds");
3714 break;
3715 case 11: wcscpy_s(hullfile, 199, L"textures\\Interiors\\INT-FIX-light-incan1.dds");
3716 break; // Must be renamed to Interiors
3717 //case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
3718 // break;
3719 case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-monitor1.dds");
3720 break;
3721 case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1.dds");
3722 break;
3723 case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand2-mount.dds");
3724 break;
3725 case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hatch1.dds");
3726 break;
3727 case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-tread1.dds");
3728 break;
3729 case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-bracing1.dds");
3730 break;
3731 case 19: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk-LIGHTWRAP.dds");
3732 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk-LIGHTWRAP.dds");
3733 break; // must be renamed to LIGHTWRAP.dds ... comment out the hullfile!
3734 case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitthrottle.dds");
3735 break;
3736 case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpittpull.dds");
3737 break;
3738 case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
3739 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
3740 break;
3741 case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
3742 break;
3743 case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons2.dds");
3744 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons2LIGHT.dds");
3745 break;
3746 case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-door1.dds");
3747 break;
3748 case 26: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10commandchair.dds");
3749 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
3750 break;
3751 case 27: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-frame1.dds");
3752 break;
3753 case 28: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-flightstick2.dds");
3754 break;
3755 case 29: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod1-emergency-2x.dds");
3756 break;
3757 case 30: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
3758 break;
3759 case 31: wcscpy_s(hullfile, 199, L"textures\\Interiors\\INT-FIX-glass1.dds");
3760 break; // Must be renamed to Interiors
3761 case 32: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-grate1.dds");
3762 break;
3763 }
3764 }
3765 break;
3766
3767 case VehicleType::C98:
3768 {
3769 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3770 switch (s)
3771 {
3772 case 1: wcscpy_s(hullfile, 199, L"textures\\Vehicles\\GV-1.dds");
3773 break; // folder is actually Vehicles
3774 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-window.dds");
3775 break;
3776 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\durum-frame.dds");
3777 break;
3778 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-brake-standard.dds");
3779 break;
3780 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-rightwindshield.dds");
3781 break;
3782 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-leftwindshield.dds");
3783 break;
3784 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-housing.dds");
3785 break;
3786 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-frontwindshield.dds");
3787 break;
3788 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-backwall.dds");
3789 break;
3790 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-steeringwheel3.dds");
3791 break;
3792 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-floor.dds");
3793 break;
3794 case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-rightwall.dds");
3795 break;
3796 case 13: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Original T-120 Steerhead Cluster.dds");
3797 wcscpy_s(lightfile, 199, L"textures\\Instruments\\GVscreenblueprintLIGHT.dds");
3798 break; // day map gets commented out, night map is renamed Instruments\\GVscreenblueprintLIGHT.dds
3799 case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-leftwall.dds");
3800 break;
3801 case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-frontwall.dds");
3802 break;
3803 case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallpipe1.dds");
3804 break;
3805 case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-chair.dds");
3806 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
3807 break; // night map is renamed SHIPe10commandchairLIGHT
3808 case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-wirepipe.dds");
3809 break;
3810 case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod6.dds");
3811 break;
3812 case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-buttons.dds");
3813 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\GV-buttonsLIGHT.dds");
3814 break;
3815 case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-frame.dds");
3816 break;
3817 case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitvent.dds");
3818 break;
3819 case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
3820 break;
3821 case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod4.dds");
3822 break;
3823 case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitarm.dds");
3824 break;
3825 case 26: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
3826 break;
3827 case 27: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-front.dds");
3828 break;
3829
3830 }
3831 }
3832 break;
3833
3834 case VehicleType::A4:
3835 {
3836 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3837 switch (s)
3838 {
3839 case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Wanderer-glass.dds");
3840 break;
3841 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\durum-frame.dds");
3842 break;
3843 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\a3-cockpit-floor.dds");
3844 break;
3845 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10commandchair.dds");
3846 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
3847 break;
3848 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpit-hudmount.dds");
3849 break;
3850 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\a3-cockpit-rightwall.dds");
3851 break;
3852 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\a3-cockpit-leftwall.dds");
3853 break;
3854 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\a3-cockpit-backfrontwall.dds");
3855 break;
3856 //case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\A4screenblueprint.dds");
3857 // break;
3858 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitdashstation.dds");
3859 break;
3860 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallpipe1.dds");
3861 break;
3862 case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitconsole.dds");
3863 break;
3864 case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitcontrolstand.dds");
3865 break;
3866 case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod6.dds");
3867 break;
3868 case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-wirepipe.dds");
3869 break;
3870 case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
3871 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
3872 break;
3873 case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitthrottle.dds");
3874 break;
3875 case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod2.dds");
3876 break;
3877 case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitvent.dds");
3878 break;
3879 case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod1.dds");
3880 break;
3881 case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10commandchairbase.dds");
3882 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairbaseLIGHT.dds");
3883 break;
3884 case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
3885 break;
3886 case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod4.dds");
3887 break;
3888 case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod5.dds");
3889 break;
3890 case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitflightstick.dds");
3891 break;
3892 case 26: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
3893 break;
3894 case 27: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SteerheadCab.dds");
3895 break;
3896 }
3897 }
3898 break;
3899
3900 case VehicleType::P13:
3901 {
3902 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3903 switch (s)
3904 {
3905 case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-glass.dds");
3906 break;
3907 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-floor.dds");
3908 break;
3909 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-rightwall.dds");
3910 break;
3911 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-leftwall.dds");
3912 break;
3913 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hull1.dds");
3914 break;
3915 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-ceiling frame.dds");
3916 break;
3917 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-door1.dds");
3918 break;
3919 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip.dds");
3920 break;
3921 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-monitor1.dds");
3922 break;
3923 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-buttonboard1.dds");
3924 break;
3925 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk.dds");
3926 break;
3927 case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-frame1.dds");
3928 break;
3929 case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1.dds");
3930 break;
3931 case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpit-hudmount.dds");
3932 break;
3933 case 15: wcscpy_s(hullfile, 199, L"textures\\Ships\\p13-equipment cowl.dds");
3934 break; // this must be renamed from Cockpits to Ships
3935 case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpittpull.dds");
3936 break;
3937 //case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
3938 //break;
3939 case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1-arm.dds");
3940 break;
3941 case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-chair2.dds");
3942 break;
3943 case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitthrottle.dds");
3944 break;
3945 case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
3946 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
3947 break;
3948 case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
3949 break;
3950 case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
3951 break;
3952 case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
3953 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
3954 break;
3955 case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-flightstick2.dds");
3956 break;
3957 case 26: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
3958 break;
3959 }
3960 }
3961 break;
3962
3963 case VehicleType::T19:
3964 {
3965 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3966 switch (s)
3967 {
3968 case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-front.dds");
3969 break; // this must be renamed from Cockpits to Ships
3970 //case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\projection.dds");
3971 //break;
3972 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\tread2.dds");
3973 break;
3974 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-guts1.dds");
3975 break;
3976 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\AV-T-19-Stratomaster-glass.dds");
3977 break;
3978 //case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
3979 //break;
3980 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPfloor36-1_sub.dds");
3981 break;
3982 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SeatBody001.dds");
3983 break;
3984 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
3985 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
3986 break;
3987 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons2.dds");
3988 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons2LIGHT.dds");
3989 break;
3990 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
3991 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
3992 break;
3993 case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Door001.dds");
3994 break;
3995 case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\CockpitMainPart004.dds");
3996 break;
3997 case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
3998 break;
3999 case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
4000 break;
4001 }
4002 }
4003 break;
4004
4006 {
4007 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4008 switch (s)
4009 {
4010 // Manx_Diff.dds is in Ships folder
4011 case 1: wcscpy_s(hullfile, 199, L"textures\\Ships\\Manx_Diff.dds");
4012 break;
4013 //case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\projection.dds");
4014 // break;
4015 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\tread2.dds");
4016 break;
4017 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-guts1.dds");
4018 break;
4019 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GlassDiffuse.dds");
4020 break;
4021 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
4022 break;
4023 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
4024 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
4025 break;
4026 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Manx_Complete-Carpeted.dds");
4027 break;
4028 //case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
4029 // break;
4030 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Chair-3.dds");
4031 break;
4032 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
4033 break;
4034 }
4035 }
4036 break;
4037
4038 case VehicleType::C2:
4039 {
4040 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4041 switch (s)
4042 {
4043 case 1: wcscpy_s(hullfile, 199, L"textures\\Vehicles\\GV-1.dds");
4044 break; // Path must be Vehicles
4045 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-front.dds");
4046 break;
4047 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-1-GLASS.dds");
4048 break;
4049 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-brake-standard.dds");
4050 break;
4051 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-accelerator-standard.dds");
4052 break;
4053 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-housing.dds");
4054 break;
4055 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-gaugehousing.dds");
4056 break;
4057 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-floor.dds");
4058 break;
4059 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-frontwall.dds");
4060 break;
4061 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-steeringwheel3.dds");
4062 break;
4063 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-rightwall.dds");
4064 break;
4065 case 12: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Original C-2 Dasher Cluster.dds");
4066 wcscpy_s(lightfile, 199, L"textures\\Instruments\\GVscreenblueprintLIGHT.dds");
4067 break; // must be renamed to Instruments\\GVscreenblueprintLIGHT.dds
4068 case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-leftwall.dds");
4069 break;
4070 case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\monitor-palette.dds");
4071 break;
4072 case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallpipe1.dds");
4073 break;
4074 case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod1.dds");
4075 break;
4076 case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-chair.dds");
4077 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
4078 break; // must be renamed to SHIPe10commandchairLIGHT.dds
4079 case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod6.dds");
4080 break;
4081 case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-buttons.dds");
4082 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\GV-buttonsLIGHT.dds");
4083 break;
4084 case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-frame.dds");
4085 break;
4086 case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitvent.dds");
4087 break;
4088 case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
4089 break;
4090 case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
4091 break;
4092 }
4093 }
4094 break;
4095
4097 {
4098 switch (s)
4099 {
4100 case 1:
4102 wcscpy_s(hullfile, 199, L"textures\\Cockpits\\HelmetInterioro-Glass.dds");
4103 break;
4104 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\HelmetInterior.dds");
4105 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\HelmetInteriorLIGHT.dds");
4106 break;
4107 //case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
4108 // break;
4109 }
4110 }
4111 break;
4112 case VehicleType::C2A:
4113 {
4114 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4115 switch (s)
4116 {
4117 case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\mirror.dds");
4118 break;
4119 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\body.dds");
4120 break;
4121 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-front.dds");
4122 break;
4123 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\glass.dds");
4124 break;
4125 case 5: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\C-2A Dasher Cluster.dds");
4126 wcscpy_s(lightfile, 199, L"textures\\Instruments\\GVscreenblueprintLIGHT.dds");
4127 break; // comment out the hullfile, rename light map to Instruments\\GVscreenblueprintLIGHT.dds
4128 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-accelerator-standard.dds");
4129 break;
4130 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-brake-standard.dds");
4131 break;
4132 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\dash-center.dds");
4133 break;
4134 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\console-center.dds");
4135 break;
4136 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\dash-cover.dds");
4137 break;
4138 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\carpet1.dds");
4139 break;
4140 case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-rear.dds");
4141 break;
4142 case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\ceiling1.dds");
4143 break;
4144 case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\controls-env.dds");
4145 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\controls-envLIGHT.dds");
4146 break;
4147 case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\monitor-palette.dds");
4148 break;
4149 case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\radio1.dds");
4150 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\radio1LIGHT.dds");
4151 break;
4152 case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\chair1-back.dds");
4153 break;
4154 case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\chair1.dds");
4155 break;
4156 case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\gearshift.dds");
4157 break;
4158 case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\controls1.dds");
4159 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\controls1LIGHT.dds");
4160 break;
4161 case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Sparko.dds");
4162 break;
4163 case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
4164 break;
4165 }
4166 }
4167 break;
4168
4169 case VehicleType::T120:
4170 {
4171 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4172 switch (s)
4173 {
4174 case 1: wcscpy_s(hullfile, 199, L"textures\\Vehicles\\GV-1.dds");
4175 break; // path must be updated to Vehicles
4176 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-front.dds");
4177 break;
4178 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\T-120cockpit-window.dds");
4179 break;
4180 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-accelerator-standard.dds");
4181 break;
4182 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-brake-standard.dds");
4183 break;
4184 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-gaugehousing.dds");
4185 break;
4186 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Bedding.dds");
4187 break;
4188 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-housing.dds");
4189 break;
4190 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitdashmonitor.dds");
4191 break;
4192 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitdashmonitorplate2.dds");
4193 break;
4194 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-floor.dds");
4195 break;
4196 case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-steeringwheel3.dds");
4197 break;
4198 case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-rightwall.dds");
4199 break;
4200 case 14: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Original T-120 Steerhead Cluster.dds");
4201 wcscpy_s(lightfile, 199, L"Textures\\Instruments\\GVscreenblueprintLIGHT.dds");
4202 break;
4203 case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-leftwall.dds");
4204 break;
4205 case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\monitor-palette.dds");
4206 break;
4207 case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-frontwall.dds");
4208 break;
4209 case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallpipe1.dds");
4210 break;
4211 case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod1.dds");
4212 break;
4213 case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-chair.dds");
4214 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
4215 break; // light map must be renamed to SHIPe10commandchairLIGHT
4216 case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod2.dds");
4217 break;
4218 case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod6.dds");
4219 break;
4220 case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-buttons.dds");
4221 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\GV-buttonsLIGHT.dds");
4222 break;
4223 case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-frame.dds");
4224 break;
4225 case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitvent.dds");
4226 break;
4227 case 26: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
4228 break;
4229 case 27: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
4230 break;
4231 }
4232 }
4233 break;
4234
4235 case VehicleType::T121:
4236 {
4237 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4238 switch (s)
4239 {
4240 case 1: wcscpy_s(hullfile, 199, L"textures\\Vehicles\\GV-mirrors-1.dds");
4241 break; // Must be renamed to Vehicles
4242 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SteerheadCab.dds");
4243 break;
4244 case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-front.dds");
4245 break;
4246 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\T-120cockpit-window.dds");
4247 break;
4248 case 5: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Original T-120 Steerhead Cluster.dds");
4249 wcscpy_s(lightfile, 199, L"Textures\\Instruments\\GVscreenblueprintLIGHT.dds");
4250 break;
4251 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-buttons.dds");
4252 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\GV-buttonsLIGHT.dds");
4253 break;
4254 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SeatBody001.dds");
4255 break;
4256 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-housing.dds");
4257 break;
4258 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SteeringWheel.dds");
4259 break;
4260 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-frame.dds");
4261 break;
4262 case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
4263 break;
4264 case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
4265 break;
4266 }
4267 }
4268 break;
4269
4270 case VehicleType::T27:
4271 {
4272 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4273 switch (s)
4274 {
4275 case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-front.dds");
4276 break;
4277 case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\mammoth-glass.dds");
4278 break;
4279 //case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
4280 //break;
4281 case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1-Elongated.dds");
4282 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1-ElongatedLIGHT.dds");
4283 break;
4284 case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MamothSeat-Old-Body.dds");
4285 break;
4286 case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MammothSeat-Old-Bottom.dds");
4287 break;
4288 case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MammothSeat-New.dds");
4289 break;
4290 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Mammoth-Objects.dds");
4291 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\Mammoth-ObjectsLIGHT.dds");
4292 break;
4293 case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Mammoth-Walls.dds");
4294 wcscpy_s(lightfile, 199, L"textures\\Cockpits\\Mammoth-WallsLIGHT.dds");
4295 break;
4296 case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Polaroid1.dds");
4297 break;
4298
4299 }
4300 }
4301 break;
4302
4304 {
4305 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4306 switch (s)
4307 {
4308 case 1: wcscpy_s(hullfile, 199, L"textures\\Interiors\\glass.dds");
4309 break;
4310 case 2: wcscpy_s(hullfile, 199, L"textures\\Interiors\\ApartmentItems.dds");
4311 break;
4312 case 3: wcscpy_s(hullfile, 199, L"textures\\Interiors\\ApartmentBody.dds");
4313 wcscpy_s(lightfile, 199, L"textures\\Interiors\\ApartmentBodyLIGHT.dds");
4314 break;
4315 case 4: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Bellgirl1.dds");
4316 break;
4317 case 5: wcscpy_s(hullfile, 199, L"textures\\Interiors\\ApartmentKitchen.dds");
4318 break;
4319 //case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\INTscreenblueprint.dds");
4320 //break;
4321 case 7: wcscpy_s(hullfile, 199, L"textures\\Interiors\\modern1.dds");
4322 break;
4323 case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
4324 break;
4325 }
4326 }
4327 break;
4328
4330 {
4331 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4332 switch (s)
4333 {
4334 case 1: wcscpy_s(hullfile, 199, L"textures\\Interiors\\environment_BakedColor.dds");
4335 break;
4336 case 2: wcscpy_s(hullfile, 199, L"textures\\Interiors\\classroomWindows.dds");
4337 break;
4338 case 3: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SimulatorPodVRayCompleteMap2.dds");
4339 break;
4340 case 4: wcscpy_s(hullfile, 199, L"textures\\Interiors\\environmentEnd_BakedColor.dds");
4341 break;
4342 case 5: wcscpy_s(hullfile, 199, L"textures\\Interiors\\plaque.dds");
4343 break;
4344 }
4345 }
4346 break;
4347
4349 {
4350 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4351 switch (s)
4352 {
4353 case 1: wcscpy_s(hullfile, 199, L"textures\\Cities\\concrete1.dds");
4354 // uses outside model texture
4355 break;
4356 case 2: wcscpy_s(hullfile, 199, L"textures\\Interiors\\towerWindows.dds");
4357 // interiors
4358 break;
4359 case 3: wcscpy_s(hullfile, 199, L"textures\\Interiors\\towerDiffuse.dds");
4360 // interiors
4361 wcscpy_s(lightfile, 199, L"textures\\Interiors\\towerDiffuseLIGHT.dds");
4362 break;
4363 //case 4: wcscpy_s(hullfile, 199, L"textures\\Interiors\\monitorsDiffuse.dds");
4364 // // interiors
4365 // break;
4366 }
4367 }
4368 break;
4369
4371 {
4373 switch (s)
4374 {
4375 case 1: wcscpy_s(hullfile, 199, L"textures\\Interiors\\OuterWallsSides2VRayCompleteMap.dds");
4376 break;
4377 case 2: wcscpy_s(hullfile, 199, L"textures\\Interiors\\OuterWallsFrontandBack.dds");
4378 break;
4379 case 3: wcscpy_s(hullfile, 199, L"textures\\Interiors\\OuterWallNarrowThingies.dds");
4380 break;
4381 case 4: wcscpy_s(hullfile, 199, L"textures\\Interiors\\FloorWalk.dds");
4382 break;
4383 case 5: wcscpy_s(hullfile, 199, L"textures\\Interiors\\CeilingPlane.dds");
4384 break;
4385 case 6: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Front Things.dds");
4386 break;
4387 case 7: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SidesnTop.dds");
4388 break;
4389 case 8: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SideStairs.dds");
4390 break;
4391 case 9: wcscpy_s(hullfile, 199, L"textures\\Interiors\\OuterWallBigThingies.dds");
4392 break;
4393 case 10: wcscpy_s(hullfile, 199, L"textures\\Interiors\\StairRoom.dds");
4394 break;
4395 case 11: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Object041VRayCompleteMap.dds");
4396 break;
4397 case 12: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Object044VRayCompleteMap.dds");
4398 break;
4399 case 13: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Shape_VRayCompleteMap.dds");
4400 break;
4401 case 14: wcscpy_s(hullfile, 199, L"textures\\Interiors\\OuterCeilingThingies.dds");
4402 break;
4403 case 15: wcscpy_s(hullfile, 199, L"textures\\Interiors\\OuterWallLowerPart.dds");
4404 break;
4405 case 16: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Elevator.dds");
4406 break;
4407 case 17: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Floor2Ceiling.dds");
4408 break;
4409 case 18: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Floor3Ceiling.dds");
4410 break;
4411 case 19: wcscpy_s(hullfile, 199, L"textures\\Interiors\\1st Floor RoomB.dds");
4412 break;
4413 case 20: wcscpy_s(hullfile, 199, L"textures\\Interiors\\OuterFloor.dds");
4414 break;
4415 case 21: wcscpy_s(hullfile, 199, L"textures\\Interiors\\3rd Floor Facade.dds");
4416 break;
4417 case 22: wcscpy_s(hullfile, 199, L"textures\\Interiors\\3rd Floor Interior.dds");
4418 break;
4419 case 23: wcscpy_s(hullfile, 199, L"textures\\Interiors\\GroundFloorFacade.dds");
4420 break;
4421 case 24: wcscpy_s(hullfile, 199, L"textures\\Interiors\\1st n 2nd Floor Facade.dds");
4422 break;
4423 case 25: wcscpy_s(hullfile, 199, L"textures\\Interiors\\2nd Floor Interior.dds");
4424 break;
4425 case 26: wcscpy_s(hullfile, 199, L"textures\\Interiors\\1st Floor RoomA.dds");
4426 break;
4427 case 27: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Stair.dds");
4428 break;
4429 case 28: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Railings.dds");
4430 break;
4431 }
4432 }
4433 break;
4434
4436 {
4438 switch (s)
4439 {
4440 case 1: wcscpy_s(hullfile, 199, L"textures\\Interiors\\EstateGlass.dds");
4442 break;
4443 case 2: wcscpy_s(hullfile, 199, L"textures\\Interiors\\KitchenVRayCompleteMap.dds");
4444 wcscpy_s(lightfile, 199, L"textures\\Interiors\\Kitchen_OuterLight.dds");
4445 //format = Rendering::ImageFormat::BC2; // DirectX Texture Tool Crashed on the Kitchen_OuterLight.png going to DXT1 but works with DXT3 ... so we will see if runtime reconciles it
4446 break;
4447 case 3: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SmallRoomsVRayCompleteMap.dds");
4448 wcscpy_s(lightfile, 199, L"textures\\Interiors\\SmallRooms_OuterLight.dds");
4449 break;
4450 case 4: wcscpy_s(hullfile, 199, L"textures\\Interiors\\StudyWallsVRayCompleteMap.dds");
4451 wcscpy_s(lightfile, 199, L"textures\\Interiors\\StudyWalls_OuterLight.dds");
4452 break;
4453 case 5: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SpaceItemsVRayCompleteMap.dds");
4454 wcscpy_s(lightfile, 199, L"textures\\Interiors\\SpaceItems_OuterLight.dds");
4455 break;
4456 case 6: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SpaceFrontWallVRayCompleteMap.dds");
4457 wcscpy_s(lightfile, 199, L"textures\\Interiors\\SpaceFrontWall_OuterLight.dds");
4458 break;
4459 case 7: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SpaceBackWallVRayCompleteMap.dds");
4460 wcscpy_s(lightfile, 199, L"textures\\Interiors\\SpaceBackWall_OuterLight.dds");
4461 break;
4462 case 8: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SpaceBackIDetailsVRayCompleteMap.dds");
4463 wcscpy_s(lightfile, 199, L"textures\\Interiors\\SpaceBackIDetails_OuterLight.dds");
4464 break;
4465 case 9: wcscpy_s(hullfile, 199, L"textures\\Interiors\\RailsVRayCompleteMap.dds");
4466 wcscpy_s(lightfile, 199, L"textures\\Interiors\\Rails_OuterLight.dds");
4467 break;
4468 case 10: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SpaceItems2VRayCompleteMap2.dds");
4469 wcscpy_s(lightfile, 199, L"textures\\Interiors\\SpaceItems2_OuterLight.dds");
4470 break;
4471 case 11: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SpaceRoofCeilingVRayCompleteMap.dds");
4472 wcscpy_s(lightfile, 199, L"textures\\Interiors\\SpaceRoofCeiling_OuterLight.dds");
4473 break;
4474 case 12: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SpaceWallSide1VRayCompleteMap.dds");
4475 wcscpy_s(lightfile, 199, L"textures\\Interiors\\SpaceWallSide1_OuterLight.dds");
4476 break;
4477 case 13: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SpaceWallSide2VRayCompleteMap.dds");
4478 wcscpy_s(lightfile, 199, L"textures\\Interiors\\SpaceWallSide2_OuterLight.dds");
4479 break;
4480 case 14: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SpaceGlassVRayCompleteMap.dds");
4481 break;
4482 }
4483 }
4484 break;
4485 }
4486
4487 if (hullfile[0] != 0)
4488 {
4489 sprintf_s(msg, sizeof msg, "cockpit::OnResetDevice hull texture %i", s);
4490 logger->AddToCallStack(msg);
4491 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, hullfile, &viewscreen->m_pddsCockpitTexture[s], Rendering::DefaultSize)))
4492 {
4493 sprintf_s(msg, sizeof(msg), "Could not load \"%S\"! (%S)", hullfile, Rendering::ErrorString(hr));
4494 logger->Log(msg, Logger::Level::Fatal, hr);
4495 }
4496 else
4497 {
4498 sprintf_s(msg, sizeof msg, "m_pddsCockpitTexture[%i]", s);
4499 viewscreen->gameclass->AddTrackedResource(msg); // managed
4500 }
4501 }
4502
4503 if (lightfile[0] != 0)
4504 {
4505 sprintf_s(msg, sizeof msg, "cockpit::OnResetDevice light texture %i", s);
4506 logger->AddToCallStack(msg);
4507 if (s != ourcockpit.screentexture) // common in ground vehicles for the dashboard non-LCD generated
4508 {
4509 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, lightfile, &viewscreen->m_pddsCockpitLights[s], Rendering::DefaultSize)))
4510 {
4511 sprintf_s(msg, sizeof(msg), "Could not load \"%S\"! (%S)", lightfile, Rendering::ErrorString(hr));
4512 logger->Log(msg, Logger::Level::Fatal, hr);
4513 }
4514 else
4515 {
4516 sprintf_s(msg, sizeof msg, "m_pddsCockpitLights[%i]", s);
4517 viewscreen->gameclass->AddTrackedResource(msg); // managed
4518 }
4519 }
4520 else if (!ourcockpit.nextgen)
4521 {
4522 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, lightfile, &viewscreen->m_pddsCockpitLights[s], 1)))
4523 {
4524 sprintf_s(msg, sizeof(msg), "Could not load \"%S\"! (%S)", lightfile, Rendering::ErrorString(hr));
4525 logger->Log(msg, Logger::Level::Fatal, hr);
4526 }
4527 else
4528 {
4529 sprintf_s(msg, sizeof msg, "m_pddsCockpitLights[%i]", s);
4530 viewscreen->gameclass->AddTrackedResource(msg); // managed
4531 }
4532 }
4533 }
4534 }
4535
4536 sprintf_s(msg, sizeof(msg), "Cockpit DDS library number changed to %i", ourcockpit.texturelib);
4537 logger->Log(msg);
4538
4539 logger->AddToCallStack("cockpit::OnResetDevice ancillary textures");
4541 {
4542 sprintf_s(msg, sizeof msg, "cockpit::OnResetDevice invalid player slot %i (maximum %i)",
4543 static_cast<int>(ourcockpit.ourplyrC), MAX_ONLINEPLAYERS - 1);
4544 logger->Log(msg, Logger::Level::Error, E_INVALIDARG);
4545 return E_INVALIDARG;
4546 }
4547
4549 {
4550 if (!playerships[0].groundvehicle)
4551 {
4553 {
4554 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\SV-S-ind-ID-style-stand1arm.dds", &viewscreen->m_pddsNamePlate, 1)))
4555 {
4556 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\SV-S-ind-ID-style-stand1arm.dds\"! (%S)", Rendering::ErrorString(hr));
4558 }
4559 else
4560 viewscreen->gameclass->AddTrackedResource("m_pddsNamePlate"); // managed
4561 }
4562 }
4563 else
4564 {
4565 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\GVdirection.dds", &viewscreen->m_pddsGVDirection, 1)))
4566 {
4567 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\GVdirection.dds\"! (%S)", Rendering::ErrorString(hr));
4569 }
4570 else
4571 viewscreen->gameclass->AddTrackedResource("m_pddsGVDirection"); // managed
4572
4573 if (ourcockpit.texturelib != VehicleType::C2A) // not C2-A use old bg
4574 {
4575 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\GVbg.png", &viewscreen->m_pddsGVBackground, 1)))
4576 {
4577 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\GVbg.png\"! (%S)", Rendering::ErrorString(hr));
4579 }
4580 else
4581 viewscreen->gameclass->AddTrackedResource("m_pddsGVBackground"); // managed
4582
4583 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\dialsmall.dds", &viewscreen->m_pddsGVDialSmall, 1)))
4584 {
4585 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dialsmall.dds\"! (%S)", Rendering::ErrorString(hr));
4587 }
4588 else
4589 viewscreen->gameclass->AddTrackedResource("m_pddsGVDialSmall"); // managed
4590
4591 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\dial.dds", &viewscreen->m_pddsAOA[0], 1)))
4592 {
4593 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dials.dds\"! (%S)", Rendering::ErrorString(hr));
4595 }
4596 else
4597 viewscreen->gameclass->AddTrackedResource("m_pddsAOA[0]"); // managed
4598 }
4599 else
4600 {
4601 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\GVbgNEW.png", &viewscreen->m_pddsGVBackground, 1)))
4602 {
4603 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\GVbgNEW.png\"! (%S)", Rendering::ErrorString(hr));
4605 }
4606 else
4607 viewscreen->gameclass->AddTrackedResource("m_pddsGVBackground"); // managed
4608
4609 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\dialsmallNEW.dds", &viewscreen->m_pddsGVDialSmall, 1)))
4610 {
4611 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dialsmallNEW.dds\"! (%S)", Rendering::ErrorString(hr));
4613 }
4614 else
4615 viewscreen->gameclass->AddTrackedResource("m_pddsGVDialSmall"); // managed
4616
4617 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\dialNEW.dds", &viewscreen->m_pddsAOA[0], 1)))
4618 {
4619 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dialNEW.dds\"! (%S)", Rendering::ErrorString(hr));
4621 }
4622 else
4623 viewscreen->gameclass->AddTrackedResource("m_pddsAOA[0]"); // managed
4624 }
4625 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\dialmini.dds", &viewscreen->m_pddsAOA[1], 1)))
4626 {
4627 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dialmini.dds\"! (%S)", Rendering::ErrorString(hr));
4629 }
4630 else
4631 viewscreen->gameclass->AddTrackedResource("m_pddsAOA[1]"); // managed
4632
4633 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\icon-lights-cruise.dds", &viewscreen->m_pddsLightsCruiseIcons, 1)))
4634 {
4635 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\icon-lights-cruise.dds\"! (%S)", Rendering::ErrorString(hr));
4637 }
4638 else
4639 viewscreen->gameclass->AddTrackedResource("m_pddsLightsCruiseIcons"); // managed
4640
4641 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\icon-fuel.png", &viewscreen->m_pddsFuelIcon, 1)))
4642 {
4643 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\icon-fuel.png\"! (%S)", Rendering::ErrorString(hr));
4645 }
4646 else
4647 viewscreen->gameclass->AddTrackedResource("m_pddsFuelIcon"); // managed
4648
4649 if (FAILED(hr = Rendering::LoadTexture(pd3dDevice, L"Textures\\Instruments\\GVcompass.dds", &viewscreen->m_pddsGVCompass, 1)))
4650 {
4651 sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\GVcompass.dds\"! (%S)", Rendering::ErrorString(hr));
4653 }
4654 else
4655 viewscreen->gameclass->AddTrackedResource("m_pddsGVCompass"); // managed
4656 }
4657 }
4658
4659 logger->AddToCallStack("cockpit::OnResetDevice DONE");
4660 logger->Log("cockpit::OnResetDevice completed successfully");
4661 return S_OK;
4662}
4663
4665{
4666 logger->AddToCallStack("cockpit::ResetHelp");
4667 logger->Log("cockpit::ResetHelp");
4668
4669 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
4670 switch (ourcockpit.texturelib)
4671 {
4672 case VehicleType::E10:
4673 case VehicleType::E11:
4676 {
4680 }
4681 else
4682 {
4685 }
4686 break;
4687 case VehicleType::C98:
4689 if (viewscreen->ptrWeather->elevation < 0.5f)
4690 {
4691 if (!playerships[0].headlight)
4693 if (!playerships[0].domelight)
4695 }
4698 else
4703 else
4707 else
4710 break;
4711 case VehicleType::A4:
4714 {
4718 }
4719 else
4720 {
4723 }
4724 break;
4725 case VehicleType::P13:
4728 {
4732 }
4733 else
4734 {
4737 }
4738 break;
4739 case VehicleType::T19:
4740 if (playerships[0].isSimulator)
4741 {
4744 }
4749 {
4752 }
4753 else
4754 {
4756 }
4757 break;
4759 if (playerships[0].isSimulator)
4760 {
4763 }
4767 {
4770 }
4771 else
4772 {
4774 }
4775 break;
4776 case VehicleType::C2:
4777 case VehicleType::C2A:
4778 if (ourcockpit.power == 0.0f)
4780 if (viewscreen->ptrWeather->elevation < 0.5f)
4781 {
4782 if (!playerships[0].headlight)
4784 if (!playerships[0].domelight)
4786 }
4789 else
4794 else
4798 else
4801 break;
4802 case VehicleType::T120:
4803 case VehicleType::T121:
4805 if (viewscreen->ptrWeather->elevation < 0.5f)
4806 {
4807 if (!playerships[0].headlight)
4809 if (!playerships[0].domelight)
4811 }
4814 else
4819 else
4823 else
4828 break;
4834 break;
4835 }
4836}
4837
4838
4839RiseMath::Matrix cockpit::ComputeSimulatorMotion(unsigned char ordinal, float fElapsedTime) const
4840{
4841 RiseMath::Matrix matrixTemp;
4842 RiseMath::MatrixIdentity(&matrixTemp);
4843
4844 if (!playerships[ordinal].active || !playerships[ordinal].isSimulator || !playerships[ordinal].online)
4845 {
4846 viewscreen->gameclass->sound->Stop(static_cast<SOUNDS>(SOUND_COCKPITENGINELEFT - 1 + ordinal));
4847 return matrixTemp;
4848 }
4849
4850
4851 // @todo move statics
4852 //static float counteri = 0.0f, counterj = 0.0f, counterk = 0.0f; // this is the
4853
4854
4855 RiseMath::Vector3 limitacc = playerships[ordinal].acc;
4856
4857 limitacc.x = Clamp(limitacc.x, -1.0f, 1.0f);
4858 limitacc.y = Clamp(limitacc.y, -1.0f, 1.0f);
4859 limitacc.z = Clamp(limitacc.z, -1.0f, 1.0f);
4860
4861 float igs = limitacc.x;// - counteri;
4862 float jgs = limitacc.y - playerships[ordinal].counterj;
4863 float kgs = limitacc.z;// - counterk;
4864
4865 //counteri += igs * fElapsedTime * 0.1f;
4866 playerships[ordinal].counterj += jgs * fElapsedTime * 0.1f;
4867 //counterk += kgs * fElapsedTime * 0.1f;
4868
4869 //if (rand() % 50 == 0)
4870 //{
4871 // playerships[ordinal].accleft = RiseMath::Vector3(RandomFloat() * 2.0f - 1.0f, RandomFloat() * 2.0f - 1.0f, RandomFloat() * 2.0f - 1.0f);
4872 // playerships[ordinal].acciter = playerships[ordinal].accleft; // 1 seconds
4873 //}
4874
4875
4876 float roll = igs * RiseMath::ToRadian(15); // 15 degrees simulates .25 G ... this is .26 max
4877 float pitch = -kgs * RiseMath::ToRadian(15);
4878 float heave = jgs / 3280.84f; // -1.0f to 1.0f that is kilometers to 1 foot 0.00034 max
4879
4880 RiseMath::MatrixRotationYawPitchRoll(&matrixTemp, -roll, -pitch, 0);
4881
4882 const float mag = RiseMath::Max(fabsf(pitch), fabsf(roll)); // say pitch is 0.0f, roll is -0.9f, mag is 0.9f
4883 if (mag < 1.0f)
4884 {
4885 heave *= (1.0f - mag); // so if we have 0.1 avail 1.0f-0.9f = 0.1f available
4886 matrixTemp._43 += heave;
4887 }
4888
4889 const float fluid = fabsf(roll - playerships[ordinal].RPH.x) + fabsf(pitch - playerships[ordinal].RPH.y) + fabsf(heave - playerships[ordinal].RPH.z) * 1717.8f;
4890 playerships[ordinal].stewartFluid += fluid * 5.0f;
4891 if (playerships[ordinal].stewartFluid > 2.0f)
4892 playerships[ordinal].stewartFluid = 2.0f;
4893 viewscreen->gameclass->sound->PlayEx(static_cast<SOUNDS>(SOUND_COCKPITENGINELEFT - 1 + ordinal), true, RiseMath::Min(playerships[ordinal].stewartFluid, 1), 0.5f, 0, playerships[ordinal].stewartFluid < fElapsedTime);
4894
4895 playerships[ordinal].stewartFluid -= fElapsedTime;
4896 if (playerships[ordinal].stewartFluid < 0)
4897 playerships[ordinal].stewartFluid = 0;
4898
4899 playerships[ordinal].RPH = RiseMath::Vector3(roll, pitch, heave);
4900
4901 return matrixTemp;
4902}
@ WelcomeStratomaster
Definition ActiveHelp.h:410
@ WelcomeMuVER
Definition ActiveHelp.h:366
@ WelcomeApt1
Definition ActiveHelp.h:354
@ GroundVehicleKeysSteer
Definition ActiveHelp.h:369
@ WelcomeWheeled
Definition ActiveHelp.h:411
@ VTOLVehicleKeys
Definition ActiveHelp.h:370
@ ConfigJoystick
Definition ActiveHelp.h:387
@ WelcomeSimulator2
Definition ActiveHelp.h:413
@ GroundVehicleJoySteer
Definition ActiveHelp.h:373
@ AirOrAerospaceVehicleKeys2
Definition ActiveHelp.h:372
@ WelcomeSaint
Definition ActiveHelp.h:365
@ WelcomeSimulator1
Definition ActiveHelp.h:381
@ WelcomeWanderer
Definition ActiveHelp.h:367
@ NightOutDomeLight
Definition ActiveHelp.h:390
@ CargoBed
Definition ActiveHelp.h:437
@ WelcomeProwler
Definition ActiveHelp.h:368
@ GroundVehicleJoyGas
Definition ActiveHelp.h:393
@ WhereIsTheBrakeKeys
Definition ActiveHelp.h:391
@ AirOrAerospaceVehicleKeys1
Definition ActiveHelp.h:371
@ AirOrAerospaceVehicleJoy
Definition ActiveHelp.h:375
@ Tutorial
Definition ActiveHelp.h:382
@ GetMoving
Definition ActiveHelp.h:394
@ EnteringHangar
Definition ActiveHelp.h:443
@ GroundVehicleKeysGas
Definition ActiveHelp.h:392
@ WelcomeSteerhead
Definition ActiveHelp.h:376
@ GetItInGear
Definition ActiveHelp.h:388
@ VehicleBed
Definition ActiveHelp.h:438
@ WelcomeDasher
Definition ActiveHelp.h:361
@ WhereIsTheBrakeJoy
Definition ActiveHelp.h:377
@ VTOLVehicleJoy
Definition ActiveHelp.h:374
@ NightOutHeadlight
Definition ActiveHelp.h:389
@ NACA64A410
Definition AirfoilType.h:5
@ NACA64A210
Definition AirfoilType.h:8
#define SAFE_DELETE_ARRAY(value)
#define SAFE_RELEASE(value)
#define V(expression)
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
SCRIPT_CONTROL SCRIPT_STATE const void DWORD
@ STATUS_GAME
Definition GameState.h:9
float RandomFloat()
constexpr auto Clamp(T1 val, T2 min, T3 max)
@ EVENT_LANDINGGEAR_DOWN
Definition Networking.h:44
@ W6Manx
Definition ServerTypes.h:84
@ Hangar
Definition ServerTypes.h:90
@ EVA_SUIT
Definition ServerTypes.h:69
@ C98
Definition ServerTypes.h:61
@ ControlTower
Definition ServerTypes.h:86
@ C2
Definition ServerTypes.h:66
@ C2A
Definition ServerTypes.h:81
@ T19
Definition ServerTypes.h:87
@ P13
Definition ServerTypes.h:64
@ Apartment
Definition ServerTypes.h:80
@ E10
Definition ServerTypes.h:63
@ T120
Definition ServerTypes.h:67
@ T27
Definition ServerTypes.h:82
@ E11
Definition ServerTypes.h:68
@ SimBay
Definition ServerTypes.h:85
@ A4
Definition ServerTypes.h:65
@ T121
Definition ServerTypes.h:89
@ Estate
Definition ServerTypes.h:91
#define MAX_ONLINEPLAYERS
#define MAX_ENGINES
#define MAX_SCAN
const RiseMath::Vector3 centerC
@ REF_BUILDING
Definition ServerTypes.h:46
@ REF_INANOTHER
Definition ServerTypes.h:45
@ REF_WINDOWLESS
Definition ServerTypes.h:50
#define limiterC
SOUNDS
Definition Sound.h:23
@ SOUND_PROP1
Definition Sound.h:35
@ SOUND_PROP6
Definition Sound.h:36
@ SOUND_PROP4
Definition Sound.h:36
@ SOUND_COCKPITENGINELEFT
Definition Sound.h:30
float RightBrake
Definition Bus.h:383
bool MasterWarning
Definition Bus.h:171
float LeftBrake
Definition Bus.h:383
float LandingGearExtended
Definition Bus.h:301
UINT flapSettingTE
Definition Bus.h:67
float EngineThrustLever[MAX_ENGINES]
Definition Bus.h:357
struct Bus::Afcs AFCS
bool MasterCaution
Definition Bus.h:476
float EmptyWeightLbs
Definition Bus.h:461
double ProgramTime
Definition Bus.h:473
std::vector< Command > commandStream
Definition Bus.h:442
void Add(unsigned component, const Vertex *vertices, size_t count)
Lights Sample(const LocalLightning::Frame &frame, Transform transform, float exposure=1) const
InputConfig inputConfigSteer
Definition config.h:38
InputConfig inputConfigGas
Definition config.h:39
InputConfig inputConfigBrake
Definition config.h:40
InputConfig inputConfigPitch
Definition config.h:32
void ChangeCockpit()
Definition Displays.cpp:562
FlapSetting(float prmDegrees, float prmVfe)
Definition globals.h:584
GameState displaystage
Definition GameClass.h:118
std::unique_ptr< Bus > bus
Definition GameClass.h:108
Config config
Definition GameClass.h:100
void RequestScannerData() const
std::unique_ptr< HMI > GUI
Definition GameClass.h:106
std::unique_ptr< Sound > sound
Definition GameClass.h:104
bool TurnOffTVM() const
std::unique_ptr< Networking > networking
Definition GameClass.h:103
void AddTrackedResource(const char *name, Rendering::ResourcePool pool=Rendering::ResourcePool::Managed)
void UpdateTrackedResource(const char *name, int status)
std::unique_ptr< Displays > displays
Definition GameClass.h:110
void KillScannerData() const
bool TurnOffDOR(bool preserveGuidance=false) const
std::unique_ptr< Graphics > graphics
Definition GameClass.h:105
void AutopilotDisconnect() const
Rendering::RenderMaterial * g_pEffect
Definition Graphics.h:30
SPlayerData player[MAX_ONLINEPLAYERS]
Definition gui.h:1093
void TriggerWelcomeApt2() const
Definition gui.cpp:1281
InformationDialog * informationDialog
Definition gui.h:1120
unsigned char ourplayerC
Definition gui.h:1094
bool DismissHelp(int helpId, int nControlID=GUI_UNDERSTOOD)
bool PopUpHelp(short helpId, bool allowDismiss=true, bool isLearnMore=false)
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
void AddToCallStack(const char *msg)
Definition Logger.cpp:355
@ Warn
Definition Logger.h:26
@ Fatal
Definition Logger.h:29
@ Error
Definition Logger.h:28
void SendEvent(EventType eventType, float extent=0.0f) const
Events Update(double dt, const Input &input)
Definition PropAudio.h:21
FixedState11 & Fixed()
HRESULT DrawPrimitive(Primitive type, UINT first, UINT count)
DrawContext11 & Draws()
HRESULT SetStreamSource(UINT stream, RenderBuffer *buffer, UINT offset, UINT stride)
HRESULT LightEnable(DWORD index, BOOL enabled)
HRESULT SetLight(DWORD index, const Light *value)
HRESULT SetRenderState(DWORD state, DWORD value)
HRESULT SetFVF(DWORD value)
HRESULT SetTransform(DWORD slot, const RiseMath::Matrix *value)
HRESULT SetTextureStageState(DWORD stage, DWORD state, DWORD value)
HRESULT SetTexture(DWORD stage, RenderTexture *texture)
HRESULT SetSamplerState(DWORD sampler, DWORD state, DWORD value)
HRESULT SetVector(const char *name, const RiseMath::Vector4 *value)
HRESULT Begin(UINT *count, DWORD flags)
HRESULT BeginPass(UINT pass)
HRESULT SetTexture(const char *name, RenderTexture *value)
HRESULT SetMatrix(const char *name, const RiseMath::Matrix *value)
HRESULT GetSurfaceLevel(UINT level, RenderSurface **result)
SCamera(float x, float y, float z, bool isVehicle)
Definition Camera.h:30
float currentPan
Definition Camera.h:12
float currentTilt
Definition Camera.h:13
bool outside
Definition Camera.h:17
void SetSexDexterity(char sex)
Definition Camera.h:68
void Stop(SOUNDS soundEnum) const
Definition Sound.cpp:3397
void PlayEx(SOUNDS soundEnum, bool loop, float volume=1.0f, float frequencyMod=1.0f, float pan=0.0f, bool restart=true, bool fromOutside=false, bool partOfHull=false)
Definition Sound.cpp:1006
void ChangeCockpit(bool force)
Definition Sound.cpp:3645
PropAudio::Input AudioInput(bool active) const
Definition SparkoProp.h:45
void Reset(const char *reason="explicit", bool internal=false)
Definition SparkoProp.h:53
void Update(double dt, const Sample &input)
Definition SparkoProp.h:57
RigidProp::Simulation simulation
Definition SparkoProp.h:42
void ChangeCamera()
void EnableLandingLights() const
Definition framemove.cpp:17
float suspensionNormalLoadG
Definition Viewscreen.h:113
void ResetSuspensionState()
RiseMath::Matrix matrixProjSim
Definition Viewscreen.h:345
float yawInput
Definition Viewscreen.h:372
Rendering::RenderTexture * m_pddsNamePlate
Definition Viewscreen.h:269
Rendering::RenderTexture * m_pddsFuelIcon
Definition Viewscreen.h:273
RiseMath::Matrix matrixProjCock
Definition Viewscreen.h:345
bool hasAnimatedWipers
Definition Viewscreen.h:410
float pitchInput
Definition Viewscreen.h:372
Rendering::RenderTexture * m_pddsInterlace[2]
Definition Viewscreen.h:278
bool VolumeCloudsEnabled() const
Definition Viewscreen.h:404
GameClass * gameclass
Definition Viewscreen.h:439
float rolltilt
Definition Viewscreen.h:447
RiseMath::Matrix matrixView
Definition Viewscreen.h:346
RiseMath::Matrix matrixLook
Definition Viewscreen.h:346
std::unique_ptr< weather > ptrWeather
Definition Viewscreen.h:434
size_t cameraOrdinal
Definition Viewscreen.h:139
std::vector< SCamera > cameras
Definition Viewscreen.h:136
Rendering::RenderTexture * m_pddsGVCompass
Definition Viewscreen.h:270
Rendering::Light sunlight
Definition Viewscreen.h:328
float rollInput
Definition Viewscreen.h:372
Rendering::RenderTexture * m_pddsGVBackground
Definition Viewscreen.h:268
bool g_bStrapon
Definition Viewscreen.h:102
RiseMath::Color alphascreen
Definition Viewscreen.h:364
Rendering::RenderTexture * m_pddsCockpitTexture[cockpittextureC]
Definition Viewscreen.h:275
RiseMath::Vector3 cockpitSpecificForceMss
Definition Viewscreen.h:151
Rendering::RenderTexture * m_pddsGVDialSmall
Definition Viewscreen.h:267
Rendering::RenderTexture * m_pddsCockpitLights[cockpittextureC]
Definition Viewscreen.h:276
Rendering::RenderTexture * m_pddsGVDirection
Definition Viewscreen.h:271
float suspensionHeaveG
Definition Viewscreen.h:114
Rendering::RenderSurface * m_pddsDynamicSurface
Definition Viewscreen.h:313
WindshieldRainRenderer windshieldRain
Definition Viewscreen.h:395
SCamera * cockpitCamera
Definition Viewscreen.h:138
bool CockpitPropMotionSuppressed() const
Definition Viewscreen.h:150
Rendering::RenderTexture * m_pddsProjectionTexture
Definition Viewscreen.h:314
Logger * logger
Definition Viewscreen.h:440
RiseMath::Matrix matrixProj
Definition Viewscreen.h:345
Rendering::RenderTexture * m_pddsLightsCruiseIcons
Definition Viewscreen.h:272
SCamera * camera
Definition Viewscreen.h:137
Rendering::RenderTexture * m_pddsAOA[3]
Definition Viewscreen.h:274
Rendering::RenderTexture * m_pddsDynamicTexture
Definition Viewscreen.h:312
void AddGlass(int component, const Vertex *vertices, size_t count)
void AddWiper(int component, const Vertex *vertices, size_t count)
void ResetHelp() const
Definition cockpit.cpp:4664
bool externalCameraUsesParent
Definition cockpit.h:48
std::unique_ptr< SparkoProp::Controller > sparkoProp
Definition cockpit.h:41
std::vector< std::vector< DisplayDraw > > displayDraws
Definition cockpit.h:40
void Load(unsigned char newType) const
Definition cockpit.cpp:216
void Render(Rendering::RenderDevice *pd3dDevice, const LocalLightning::Frame &strike={}) const
Definition cockpit.cpp:2586
Logger * logger
Definition cockpit.h:37
void ResetProps(const char *reason) const
Definition cockpit.cpp:25
Viewscreen * viewscreen
Definition cockpit.h:36
RiseMath::Matrix ComputeSimulatorMotion(unsigned char ordinal, float fElapsedTime) const
Definition cockpit.cpp:4839
unsigned char externalCameraVehicleType
Definition cockpit.h:47
cockpit(Viewscreen *ptr)
Definition cockpit.cpp:17
void FrameMovePropSounds(float elapsedTime) const
Definition cockpit.cpp:36
void RefreshExternalCameras() const
Definition cockpit.cpp:65
void FrameMove(float fElapsedTime) const
Definition cockpit.cpp:2202
HRESULT OnResetDevice(Rendering::RenderDevice *pd3dDevice) const
Definition cockpit.cpp:3545
void CacheEngineSounds(bool useExteriorModel) const
Definition cockpit.cpp:189
CockpitLightning::Apertures lightningWindows
Definition cockpit.h:38
void OnLostDevice() const
Definition cockpit.cpp:3457
PropAudio::State propAudio
Definition cockpit.h:42
RiseMath::Color cockpitRawAmbient
Definition weather.h:192
float shadow
Definition weather.h:213
static float SunAttenuation()
Definition weather.cpp:22
RiseMath::Color cockpitAmbient
Definition weather.h:190
NightVisionGain::Response cockpitVision
Definition weather.h:189
float elevation
Definition weather.h:197
RiseMath::Color cockpitRawCloudLight
Definition weather.h:191
#define negativePressMaxDiffMb
Definition cockpit.cpp:15
#define blastProofMaxDiffMb
Definition cockpit.cpp:14
DeathType dead
Definition globals.cpp:37
float f_ACL
Definition globals.cpp:11
s_network_objects playerships[MAX_SCAN]
Definition globals.cpp:112
bool g_bEnabled
Definition globals.cpp:96
Scockpit ourcockpit
Definition globals.cpp:114
bool g_bAboveClouds
Definition globals.cpp:16
Sani aniarray[MAX_ANI][MAX_STEPS]
Definition globals.cpp:122
s_polygon_object polyobjects[maxpolyC]
Definition globals.cpp:106
#define rhoOver2SlugsCuFt2
Definition globals.h:95
#define MAX_ANI
Definition globals.h:82
#define radiusC
Definition globals.h:87
@ ImNotDeadYet
Definition globals.h:150
#define cockpitvertC
Definition globals.h:67
#define RISE_FVF_VERTEX
Definition globals.h:118
#define flatPlateDragCoefficient
Definition globals.h:93
#define MAX_STEPS
Definition globals.h:83
#define cockpittextureC
Definition globals.h:50
#define sunColorC
Definition globals.h:116
float DisplayStrength(const NightVisionGain::Response &vision)
void Locate(Sources &cache, const Component *components, unsigned count, const RiseMath::Matrix &modelToBody)
Definition EngineAudio.h:72
Sources Create(int count, Kind kind, float sideArmKm, float forwardKm)
Definition EngineAudio.h:55
constexpr unsigned DeviceSlots[MaxLights]
constexpr uint32_t INVSRCALPHA
constexpr uint32_t SRCALPHA
constexpr uint32_t RENDERTARGET
constexpr uint32_t GREATER
constexpr uint32_t ALWAYS
constexpr uint32_t POINT
constexpr uint32_t LINEAR
constexpr uint32_t NONE
constexpr uint32_t DIRECTIONAL
constexpr uint32_t DISCARD
constexpr uint32_t SRCBLEND
constexpr uint32_t STENCILFUNC
constexpr uint32_t STENCILREF
constexpr uint32_t ALPHABLENDENABLE
constexpr uint32_t STENCILPASS
constexpr uint32_t DESTBLEND
constexpr uint32_t TEXTUREFACTOR
constexpr uint32_t MIPFILTER
constexpr uint32_t MAGFILTER
constexpr uint32_t MINFILTER
constexpr uint32_t REPLACE
constexpr uint32_t TFACTOR
constexpr uint32_t DIFFUSE
constexpr uint32_t TEXTURE
constexpr uint32_t SPECULAR
constexpr uint32_t CURRENT
constexpr uint32_t DISABLE
constexpr uint32_t SELECTARG1
constexpr uint32_t ADDSMOOTH
constexpr uint32_t MODULATE
constexpr uint32_t SELECTARG2
constexpr uint32_t COLOROP
constexpr uint32_t COLORARG1
constexpr uint32_t ALPHAARG1
constexpr uint32_t ALPHAOP
constexpr uint32_t TEXCOORDINDEX
constexpr uint32_t COLORARG2
constexpr uint32_t TEXTURETRANSFORMFLAGS
constexpr uint32_t COUNT2
constexpr uint32_t DISABLE
constexpr uint32_t TEXTURE0
constexpr uint32_t PROJECTION
constexpr uint32_t WORLD
const wchar_t * ErrorString(HRESULT code)
RenderDevice * ClientRenderer()
constexpr unsigned DefaultSize
HRESULT LoadTexture(RenderDevice *owner, const wchar_t *path, RenderTexture **result, UINT levels=0, UINT width=0, UINT height=0)
HRESULT CreateTexture(RenderDevice *owner, UINT width, UINT height, UINT levels, DWORD usage, ImageFormat format, ResourcePool pool, RenderTexture **result)
auto ToRadian(T value)
Definition ClientMath.h:13
float Vec3Length(const Vector3 *a)
Definition ClientMath.h:95
constexpr float Pi
Definition ClientMath.h:12
constexpr auto Min(A first, B second)
Definition ClientMath.h:15
Vector3 * Vec3Add(Vector3 *out, const Vector3 *a, const Vector3 *b)
Definition ClientMath.h:96
Matrix * MatrixRotationX(Matrix *out, float value)
Definition ClientMath.h:126
Color * ColorScale(Color *out, const Color *a, float scale)
Definition ClientMath.h:174
Matrix * MatrixRotationQuaternion(Matrix *out, const Quaternion *q)
Definition ClientMath.h:135
float Vec3LengthSq(const Vector3 *a)
Definition ClientMath.h:94
Vector3 * Vec3Subtract(Vector3 *out, const Vector3 *a, const Vector3 *b)
Definition ClientMath.h:97
Matrix * MatrixRotationY(Matrix *out, float value)
Definition ClientMath.h:127
Matrix * MatrixRotationYawPitchRoll(Matrix *out, float yaw, float pitch, float roll)
Definition ClientMath.h:137
Matrix * MatrixInverse(Matrix *out, float *determinant, const Matrix *a)
Definition ClientMath.h:118
Matrix * MatrixIdentity(Matrix *out)
Definition ClientMath.h:115
Matrix * MatrixRotationAxis(Matrix *out, const Vector3 *axis, float angle)
Definition ClientMath.h:129
float Vec3Dot(const Vector3 *a, const Vector3 *b)
Definition ClientMath.h:93
Vector3 * Vec3Normalize(Vector3 *out, const Vector3 *a)
Definition ClientMath.h:103
Vector3 * Vec3Scale(Vector3 *out, const Vector3 *a, float scale)
Definition ClientMath.h:98
constexpr auto Max(A first, B second)
Definition ClientMath.h:16
Matrix * MatrixTranslation(Matrix *out, float x, float y, float z)
Definition ClientMath.h:125
constexpr float HalfPi
Definition ClientMath.h:12
constexpr double KmPerUnit
bool Matches(unsigned char type, bool c2a, Vec nominalKm, Vec ypr, unsigned primitives)
Definition SparkoProp.h:10
constexpr unsigned char InstanceType
Definition SparkoProp.h:9
bool HasBladeMotion(int type, unsigned primitives, float axisLengthSq, float hingeExtent, float travelLengthSq)
@ LateralMode_Off
Definition Bus.h:112
@ VerticalMode_Off
Definition Bus.h:97
enum Bus::Afcs::LateralModes CurrentLateralMode
enum Bus::Afcs::VerticalModes CurrentVerticalMode
std::string name
Definition Command.h:11
float delay
Definition Command.h:8
LPDIRECTINPUTDEVICE8 g_pJoystick
Definition InputConfig.h:22
RiseMath::Vector3 Direction
RiseMath::Color Diffuse
RiseMath::Color Ambient
float startupextend
Definition globals.h:599
short scanDisplayVesselLimit
Definition globals.h:725
float suspensionSpringFrequencyHz
Definition globals.h:621
bool polaroid1
Definition globals.h:669
float Vs2
Definition globals.h:644
float dntranslimit
Definition globals.h:601
float tireComplianceKm
Definition globals.h:620
float revthrustlimit
Definition globals.h:601
float skidSteerDifferentialRatio
Definition globals.h:654
int sonicBooms
Definition globals.h:737
float shelfFreq
Definition globals.h:744
float d17VTailWithRudderSqFt
Definition globals.h:638
float f28SideDragCoefficient
Definition globals.h:638
float maxGrossLbs
Definition globals.h:634
short texturelib
Definition globals.h:602
float elevatorAreaMod
Definition globals.h:720
float dockOffsetKmZ
Definition globals.h:722
float c9WingYawArmM
Definition globals.h:639
float chairfwdeye
Definition globals.h:613
float lrtranslimit
Definition globals.h:601
float momentr
Definition globals.h:636
float VrEmpty
Definition globals.h:644
float flapAreaModTE
Definition globals.h:716
float MaxDoorOpenOperatingKms
Definition globals.h:645
char fwdgears
Definition globals.h:677
float panFactor
Definition globals.h:751
short ourplyrC
Definition globals.h:682
float tachDisplayMaxRPM
Definition globals.h:679
float h9RudderSqFt
Definition globals.h:638
float wingspanM
Definition globals.h:640
float trimTargetEmpty
Definition globals.h:662
float i66wasi62
Definition globals.h:640
float b12WingRollArmM
Definition globals.h:639
float j12flapsAreaSqMLE
Definition globals.h:732
float b6DistanceToHTailM
Definition globals.h:639
float fuelFlowIdleLbsPerSec
Definition globals.h:647
float d65wasd61
Definition globals.h:640
float aprolagr
Definition globals.h:648
short projecttexture
Definition globals.h:602
float dexterity
Definition globals.h:687
float steerLimitRadian
Definition globals.h:651
float k65wask61
Definition globals.h:640
float uptranslimit
Definition globals.h:601
short screentexture
Definition globals.h:602
float f27PlanDragCoefficient
Definition globals.h:638
float speedLimiterKph
Definition globals.h:735
float ffmax
Definition globals.h:647
float e65wase61
Definition globals.h:640
float dockOffsetKmY
Definition globals.h:723
float d15TotalWingAreaSqFt
Definition globals.h:718
float power
Definition globals.h:599
float VneEmpty
Definition globals.h:644
float appitagr
Definition globals.h:648
float bypassPercentage
Definition globals.h:711
float aileronAreaMod
Definition globals.h:719
EngineAudio::Sources engineSounds
Definition globals.h:631
float apYawTurnCoordination
Definition globals.h:648
float momentp
Definition globals.h:636
float tireRadiusKm
Definition globals.h:733
float d27DerivedPlanAreaSqFt
Definition globals.h:641
float VcMSL
Definition globals.h:642
float momenty
Definition globals.h:636
float fuelmax
Definition globals.h:647
float engineEfficiencyAtSeaLevelScalar
Definition globals.h:738
float h6ElevatorAreaSqFt
Definition globals.h:638
unsigned short components
Definition globals.h:626
float f20FrontBackDragCoeff
Definition globals.h:638
std::vector< FlapSetting > flapSettings
Definition globals.h:661
float k12flapsAreaSqMTE
Definition globals.h:731
float lpSlope
Definition globals.h:748
float shelfSlope
Definition globals.h:746
float d16HTailWithElevatorSqFt
Definition globals.h:639
AirfoilType wings
Definition globals.h:659
float skidSteerInputCenteringScale
Definition globals.h:656
float suspensionVisualLeanScale
Definition globals.h:623
float i65wasi61
Definition globals.h:640
float emptyWeightLbs
Definition globals.h:633
float redlineRPM
Definition globals.h:679
float machAngleDragScalar
Definition globals.h:736
float dockingOrientationZ
Definition globals.h:724
bool nextgen
Definition globals.h:706
float rcsYParmM
Definition globals.h:640
float noseWheelToCgKm
Definition globals.h:650
float Vle
Definition globals.h:645
float wingElevationM
Definition globals.h:640
float aoiWingRad
Definition globals.h:657
float pitchToAddInTurn
Definition globals.h:643
float maxPressureDiffMb
Definition globals.h:635
char gearshift
Definition globals.h:677
float l48AverageEnginePitchArmM
Definition globals.h:713
float notchFreq
Definition globals.h:749
float b15WingPitchArmM
Definition globals.h:639
float VneMaxGross
Definition globals.h:644
float gearextent
Definition globals.h:617
float flapMaxDegrees
Definition globals.h:714
float suspensionDampingRatio
Definition globals.h:621
float f25
Definition globals.h:638
float landingGearLengthKm
Definition globals.h:617
std::array< LandingLights::Light, LandingLights::MaxLights > landingLights
Definition globals.h:604
float spoilerAreaSqM
Definition globals.h:717
float i12WingAreaOneSideSqFt
Definition globals.h:638
float suspensionTravelKm
Definition globals.h:618
float hStabAngleOfIncidenceRad
Definition globals.h:658
float clutchtime
Definition globals.h:676
bool parkingBrake
Definition globals.h:709
float lpFreq
Definition globals.h:747
float VrefMod
Definition globals.h:646
float suspensionTrackWidthKm
Definition globals.h:619
float idleRPM
Definition globals.h:679
float suspensionLateralLoadTransferPerG
Definition globals.h:622
float spoilerAreaMod
Definition globals.h:717
float suspensionStaticSagRatio
Definition globals.h:620
char startcycle
Definition globals.h:599
bool sentgearvoice
Definition globals.h:625
float chairfwd
Definition globals.h:613
float attenuate
Definition globals.h:743
bool wheeled
Definition globals.h:596
float criticalEngineAltitudeKm
Definition globals.h:712
char bays
Definition globals.h:630
float strutsrettoCGKm
Definition globals.h:624
float landingGearAbsorbKms
Definition globals.h:617
bool radioEquipped
Definition globals.h:669
float b9DistanceToVTailM
Definition globals.h:639
float wheelBaseKm
Definition globals.h:752
float suspensionRideHeightKm
Definition globals.h:618
float flapAreaModLE
Definition globals.h:715
float VrMaxGross
Definition globals.h:644
float h12AileronAreaSqFt
Definition globals.h:638
GroundSteeringMode groundSteeringMode
Definition globals.h:652
float ratios[8]
Definition globals.h:678
bool spaceCapable
Definition globals.h:596
char engines
Definition globals.h:630
float exteriorInsulationHeatTransferCoefficient
https://en.wikipedia.org/wiki/List_of_thermal_conductivities
Definition globals.h:729
char struts
Definition globals.h:630
float trimTolerance
Definition globals.h:662
float i48CriticalEngineYawArmM
Definition globals.h:649
float shelfGain
Definition globals.h:745
float suspensionWheelbaseKm
Definition globals.h:619
s_mesh_component * componentarray
Definition globals.h:704
float notchGain
Definition globals.h:750
RiseMath::Vector3 position
Definition globals.h:616
float rooftoCGKm
Definition globals.h:624
RiseMath::Vector3 launchPosition
Definition globals.h:603
char steerTires
Definition globals.h:628
unsigned landingLightCount
Definition globals.h:605
float spoolTime
Definition globals.h:601
float trimTargetMaxGross
Definition globals.h:662
float chairFwdRemaining
Definition globals.h:613
float pitchLimitRadians
Definition globals.h:734
float k66wask62
Definition globals.h:640
float suspensionLongitudinalLoadTransferPerG
Definition globals.h:622
float fwdthrustlimit
Definition globals.h:601
float hingeextent
Definition globals.h:421
RiseMath::Vector3 nominalxyz
Definition globals.h:413
RiseMath::Matrix matWorld
Definition globals.h:425
RiseMath::Vector3 nominalypr
Definition globals.h:414
float speedExtend
Definition globals.h:409
RiseMath::Vector3 hingeCG
Definition globals.h:420
unsigned char type
Definition globals.h:403
float boundsphere
Definition globals.h:410
RiseMath::Vector3 hingeaxis
Definition globals.h:420
RiseMath::Vector3 extendby
Definition globals.h:419
RiseMath::Vector3 nominalCG
Definition globals.h:416
RiseMath::Vector3 RPH
Definition globals.h:543
unsigned short components
Definition globals.h:551
RiseMath::Vector3 acc
Definition globals.h:504
unsigned char type
Definition globals.h:488
s_mesh_component * componentarray
Definition globals.h:552
unsigned char inarray
Definition globals.h:509
float baydoorextent
Definition globals.h:539
RiseMath::Matrix matrixBase
Definition globals.h:519
Rendering::RenderBuffer * VB
Definition globals.h:360