Rise
The Vieneo Province
cockpit.cpp
Go to the documentation of this file.
1 #include "cockpit.h"
2 
3 #include "..\GameClass.h"
4 #include "Viewscreen.h"
5 #include "../Dialogs/InformationDialog.h"
6 #include "../MathUtilities.h"
7 
9 {
10  viewscreen = ptr;
11  logger = ptr->logger;
12 }
13 
14 void cockpit::Load(IDirect3DDevice9* pd3dDevice) const
15 {
16  logger->AddToCallStack("cockpit::Load");
17  logger->Log("cockpit::Load");
18 
20 
22 
24 
25  OnLostDevice();
26  OnResetDevice(pd3dDevice);
27 
28  ResetHelp();
29 
30 
31  if (playerships[0].simulator)
32  logger->Log("Cockpit is a simulator...");
33 }
34 
35 void cockpit::FrameMove(float fElapsedTime) const
36 {
37  logger->AddToCallStack("cockpit::FrameMove");
38 
39  for (unsigned short s = 0; s < ourcockpit.components; s++)
40  {
41  // radio
45  else if (ourcockpit.componentarray[s].attachto == 3 ||
50  else if (!playerships[0].simulator &&
51  ourcockpit.componentarray[s].attachto == 998) // simulator specific
53  else if (ourcockpit.componentarray[s].type == 40 && ourcockpit.power < 0.1f)
55  else
57 
58  if (!ourcockpit.componentarray[s].visible) continue;
59 
60  D3DXMATRIX matrixWorld, matrixTemp;
61  D3DXVECTOR3 result;
62 
63  // If it is attached... rotate to correct orientation
64  D3DXMatrixRotationYawPitchRoll(&matrixWorld, ourcockpit.componentarray[s].nominalypr.x, ourcockpit.componentarray[s].nominalypr.y, ourcockpit.componentarray[s].nominalypr.z);
65 
66  // Animated rotations...
67  // D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z );
68  // matrixWorld=matrixWorld*matrixTemp;
69 
70  switch (ourcockpit.componentarray[s].type)
71  {
72  case 33: // steering wheel
74  if (ourcockpit.texturelib == T27)
77 
78  // Animated rotations...
79  D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z);
80  matrixWorld = matrixWorld * matrixTemp;
82  matrixWorld = matrixWorld * matrixTemp;
83 
84  // Animated extensions...
85  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, ourcockpit.componentarray[s].extended);
86  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
87  result += ourcockpit.componentarray[s].hingeCG;
88 
89  result -= ourcockpit.position;
90  break;
91  case 32: // chair
92  case 58: // tablet
93  // Animated extensions...
94  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, ourcockpit.chairfwd);
95  ourcockpit.chairfwdeye = result.y;
97  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
98  result -= ourcockpit.position;
99 
100  break;
101  case 20: // throttle
102  case 21: // throttle
103  case 22: // throttle
104  {
105  const int engineOrdinal = ourcockpit.componentarray[s].type - 20;
107 
109  {
110  // Animated rotations...
111  D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z);
112  matrixWorld = matrixWorld * matrixTemp;
114  matrixWorld = matrixWorld * matrixTemp;
115 
116  // Animated extensions...
117  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, ourcockpit.componentarray[s].extended);
118  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
119  result += ourcockpit.componentarray[s].hingeCG;
120 
121  result -= ourcockpit.position;
122  }
123  else
124  {
125  // Animated extensions...
126  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, viewscreen->gameclass->bus->EngineThrustLever[engineOrdinal]);
127  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
128  result -= ourcockpit.position;
129  }
130  }
131  break;
132  case 34: // 2-DOF stick
133  // Animated rotations...
134  D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z);
135  matrixWorld = matrixWorld * matrixTemp;
136  D3DXMatrixRotationYawPitchRoll(&matrixTemp, viewscreen->rollInput * 0.5f, viewscreen->pitchInput * 0.5f, 0.0f);
137  matrixWorld = matrixWorld * matrixTemp;
138 
139  // Animated extensions...
140  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, 0.0f);
141  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
142  result += ourcockpit.componentarray[s].hingeCG;
143 
144  result -= ourcockpit.position;
145  break;
146  case 35: // 2-DOF stick (pitch slides)
147  case 49: // (pitch slides only)
148  // Animated extensions...
149  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, 0.5f - viewscreen->pitchInput * 0.5f);
150  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
151  result -= ourcockpit.position;
152  break;
153  case 36: // 1-DOF stick (pitch slides) yoke
154  // Animated rotations...
155  D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z);
156  matrixWorld = matrixWorld * matrixTemp;
157  D3DXMatrixRotationAxis(&matrixTemp, &ourcockpit.componentarray[s].hingeaxis, viewscreen->rollInput * D3DX_HALFPI); // 90 degrees
158  matrixWorld = matrixWorld * matrixTemp;
159 
160  // Animated extensions...
161  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, 0.5f - viewscreen->pitchInput * 0.5f);
162  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
163  result += ourcockpit.componentarray[s].hingeCG;
164 
165  result -= ourcockpit.position;
166  break;
167  case 37: // rudder
168  // Animated rotations...
169  D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z);
170  matrixWorld = matrixWorld * matrixTemp;
171  D3DXMatrixRotationAxis(&matrixTemp, &ourcockpit.componentarray[s].hingeaxis, viewscreen->yawInput * ourcockpit.componentarray[s].hingeextent);
172  matrixWorld = matrixWorld * matrixTemp;
173 
174  // Animated extensions...
175  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, viewscreen->yawInput);
176  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
177  result += ourcockpit.componentarray[s].hingeCG;
178 
179  result -= ourcockpit.position;
180  break;
181  case 65: // left brake
183 
184  // Animated rotations...
185  D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z);
186  matrixWorld = matrixWorld * matrixTemp;
188  matrixWorld = matrixWorld * matrixTemp;
189 
190  // Animated extensions...
191  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, ourcockpit.componentarray[s].extended);
192  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
193  result += ourcockpit.componentarray[s].hingeCG;
194 
195  result -= ourcockpit.position;
196  break;
197  case 66: // right brake
199 
200  // Animated rotations...
201  D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z);
202  matrixWorld = matrixWorld * matrixTemp;
204  matrixWorld = matrixWorld * matrixTemp;
205 
206  // Animated extensions...
207  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, ourcockpit.componentarray[s].extended);
208  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
209  result += ourcockpit.componentarray[s].hingeCG;
210 
211  result -= ourcockpit.position;
212  break;
213  case 52: // display, standard
214  case 48: // general animation
215  case 4: // monitors
216  case 59: // master warning
217  case 60: // master caution
218  if (ourcockpit.componentarray[s].extendby.x != 0.0f ||
219  ourcockpit.componentarray[s].extendby.y != 0.0f ||
220  ourcockpit.componentarray[s].extendby.z != 0.0f ||
222  {
224 
225  // Animated rotations...
226  D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z);
227  matrixWorld = matrixWorld * matrixTemp;
229  matrixWorld = matrixWorld * matrixTemp;
230 
231  // Animated extensions...
232  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, ourcockpit.componentarray[s].extended);
233  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
234  result += ourcockpit.componentarray[s].hingeCG;
235 
236  result -= ourcockpit.position;
237  }
238  else
239  {
241  }
242  break;
243  case 39: // gear shift
244  {
245  ourcockpit.componentarray[s].extended = 1.0f - ((ourcockpit.gearshift + 2.0f) / (ourcockpit.fwdgears + 2.0f));
246 
247  // Animated rotations...
248  D3DXMatrixTranslation(&matrixTemp, -ourcockpit.componentarray[s].hingeCG.x, -ourcockpit.componentarray[s].hingeCG.y, -ourcockpit.componentarray[s].hingeCG.z);
249  matrixWorld = matrixWorld * matrixTemp;
251  matrixWorld = matrixWorld * matrixTemp;
252 
253  // Animated extensions...
254  D3DXVec3Scale(&result, &ourcockpit.componentarray[s].extendby, ourcockpit.componentarray[s].extended);
255  D3DXVec3Add(&result, &ourcockpit.componentarray[s].nominalxyz, &result);
256  result += ourcockpit.componentarray[s].hingeCG;
257 
258  result -= ourcockpit.position;
259  }
260  break;
261  case 40: // Scolling lightmap
262  ourcockpit.componentarray[s].extended += fElapsedTime * 0.01f;
263  if (ourcockpit.componentarray[s].extended >= 1.0f)
266  break;
267  default:
269  break;
270  }
271 
272  D3DXMatrixTranslation(&matrixTemp, result.x, result.y, result.z);
273  matrixWorld = matrixWorld * matrixTemp;
274 
275 
276  // orient us in it correctly for the orientation of the vehicle
277  D3DXMatrixRotationX(&matrixTemp, D3DX_HALFPI); // pitch
278  matrixWorld = matrixWorld * matrixTemp;
279  if (ourcockpit.texturelib != Apartment && ourcockpit.texturelib != SimBay && ourcockpit.texturelib != ControlTower)
280  {
281  D3DXMatrixRotationY(&matrixTemp, D3DX_PI); // pitch
282  matrixWorld = matrixWorld * matrixTemp;
283  }
284  else
285  {
286  D3DXMatrixRotationY(&matrixTemp, -D3DX_PI); // rotate
287  matrixWorld = matrixWorld * matrixTemp;
288  }
289 
290 
291  if (ourcockpit.componentarray[s].type == 33 && !ourcockpit.gndvehicle) // 3-DOF stick ... have to check gndvehicle because steering wheel is 33 too!?
292  {
293 
294  D3DXMatrixRotationYawPitchRoll(&matrixTemp, viewscreen->pitchInput, -viewscreen->rollInput, -viewscreen->yawInput);
295  matrixWorld = matrixTemp * matrixWorld;
296  }
297  else if (ourcockpit.componentarray[s].type == 35 && !ourcockpit.gndvehicle) // 2-DOF linear pitch stick
298  {
299  if (ourcockpit.texturelib == A4) // A-4 is different somehow
300  D3DXMatrixRotationYawPitchRoll(&matrixTemp, 0.0f, -viewscreen->rollInput * 0.15f, -viewscreen->yawInput * 0.2f);
301  else
302  D3DXMatrixRotationYawPitchRoll(&matrixTemp, viewscreen->rollInput * 0.15f, 0.0f, -viewscreen->yawInput * 0.2f);
303  matrixWorld = matrixTemp * matrixWorld;
304  }
305 
306  D3DXMatrixInverse(&matrixTemp, nullptr, &viewscreen->matrixView);
307  ourcockpit.componentarray[s].matWorld = matrixWorld * matrixTemp;
308  }
309 
310  logger->AddToCallStack("cockpit::FrameMove END");
311 }
312 
313 void cockpit::Render(IDirect3DDevice9* pd3dDevice) const
314 {
315  HRESULT hr;
316 
317  // Apartment and control tower uses new rendering
318  if (viewscreen->gameclass->GUI->player[ourcockpit.ourplyrC].frame == REF_SIMBAY || ( viewscreen->gameclass->GUI->player[ourcockpit.ourplyrC].frame == REF_BUILDING &&
320  {
321  logger->AddToCallStack("cockpit::Render NEW");
322 
323  if (ourcockpit.texturelib == VehicleType::ControlTower)
324  ourcockpit.power = 1.0f;
325 
326  V(pd3dDevice->SetStreamSource(0, polyobjects[5].VB, 0, sizeof(D3DVERTEX)));
327 
328  V(viewscreen->gameclass->graphics->g_pEffect->Begin(nullptr, 0));
329  V(viewscreen->gameclass->graphics->g_pEffect->BeginPass(10)); // cockpit
330 
331  D3DXVECTOR4 features;
332  features.x = 0.0f; // has light map
333  features.y = 0.0f; // unused, maybe for flicker
334  features.z = 0.0f; // unused
335  features.w = 0.0f; // unused, maybe for instance type
336 
337  D3DXVECTOR4 ambient;
338  if (viewscreen->gameclass->GUI->player[ourcockpit.ourplyrC].frame == REF_SIMBAY)
339  {
340  ambient.x = 1.0f;
341  ambient.y = 1.0f;
342  ambient.z = 1.0f;
343  }
344  else // outside light like on concrete skirt around control tower
345  {
346  ambient.x = viewscreen->sunlight.Diffuse.r;
347  ambient.y = viewscreen->sunlight.Diffuse.g;
348  ambient.z = viewscreen->sunlight.Diffuse.b;
349  }
350  ambient.w = 0.0f; // unused
351  V(viewscreen->gameclass->graphics->g_pEffect->SetVector("ambient", &ambient));
352 
353  V(pd3dDevice->SetRenderState(D3DRS_STENCILREF, 4)); // was 0 on Clear()
354  V(pd3dDevice->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE)); // with 3
355  V(pd3dDevice->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS)); // was always before cockpit
356 
357 
358 #pragma region Cockpit components
359  short oldtexture = -1;
360  for (unsigned short s = 0; s < ourcockpit.components; s++)
361  {
362  // so this is all drawn first (cockpit.cpp) so we obviously wait on the glass and HUDs
363  if (ourcockpit.componentarray[s].type == 5 ||
364  ourcockpit.componentarray[s].type == 51 ||
365  ourcockpit.componentarray[s].type == 251) // not windshield or HUDs until end of render
366  continue;
367 
368  if (!ourcockpit.componentarray[s].visible) continue;
369 
370  D3DXMATRIX matrixWorld = ourcockpit.componentarray[s].matWorld;
371  V(viewscreen->gameclass->graphics->g_pEffect->SetMatrix("matWorld", &matrixWorld));
372  D3DXMATRIX mWorldViewProj = matrixWorld * viewscreen->matrixLook * viewscreen->matrixProjCock;
373  V(viewscreen->gameclass->graphics->g_pEffect->SetMatrix("matWorldViewProj", &mWorldViewProj));
374 
375 #pragma region Texture assignment
376 
377  if (oldtexture != ourcockpit.componentarray[s].texture)
378  {
379  oldtexture = ourcockpit.componentarray[s].texture;
380  if (oldtexture == ourcockpit.screentexture) // monitor
381  {
382  V(viewscreen->gameclass->graphics->g_pEffect->SetTexture("ColorMap", viewscreen->m_pddsDynamicTexture));
383  }
384  else if (oldtexture == ourcockpit.projecttexture) // projection screen
385  {
387  }
388  else if (viewscreen->m_pddsCockpitTexture[oldtexture])
389  {
390  V(viewscreen->gameclass->graphics->g_pEffect->SetTexture("ColorMap", viewscreen->m_pddsCockpitTexture[oldtexture]));
391  }
392  else
393  {
394  V(viewscreen->gameclass->graphics->g_pEffect->SetTexture("ColorMap", nullptr)); // shouldn't have this cas)e
395  }
396  if (!viewscreen->m_pddsCockpitLights[oldtexture])
397  {
398  V(viewscreen->gameclass->graphics->g_pEffect->SetTexture("ColorMap2", nullptr));
399  features.x = 0.0f;
400  }
401  else
402  {
403  V(viewscreen->gameclass->graphics->g_pEffect->SetTexture("ColorMap2", viewscreen->m_pddsCockpitLights[oldtexture]));
404  features.x = 1.0f;
405  }
406  }
407 
408 #pragma endregion
409 
410  features.w = ourcockpit.componentarray[s].type;
411  V(viewscreen->gameclass->graphics->g_pEffect->SetVector("Features", &features));
412 
413  V(viewscreen->gameclass->graphics->g_pEffect->CommitChanges());
414 
415  V(pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, ourcockpit.componentarray[s].startvertex, ourcockpit.componentarray[s].primitives));
416  }
417 #pragma endregion
418 
419  V(viewscreen->gameclass->graphics->g_pEffect->EndPass());
420  V(viewscreen->gameclass->graphics->g_pEffect->End());
421 
422  //V(pd3dDevice->SetRenderState( D3DRS_STENCILREF, 4)); // stays at 4
423  V(pd3dDevice->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_KEEP)); // 3
424  V(pd3dDevice->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_GREATER)); // 0-2
425  }
426  else
427  {
428  logger->AddToCallStack("cockpit::Render OLD");
429 
430  D3DLIGHT9 templight;
431  D3DXVECTOR3 vieneohit, result;
432 
433 #pragma region Setting the scene
434 
435  // Cockpit ------------------------------------------------------------------------------------
436 
437  V(pd3dDevice->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR));
438  V(pd3dDevice->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR));
439  V(pd3dDevice->SetSamplerState(1, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR));
440  V(pd3dDevice->SetSamplerState(2, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR));
441  V(pd3dDevice->SetSamplerState(2, D3DSAMP_MINFILTER, D3DTEXF_LINEAR));
442  V(pd3dDevice->SetSamplerState(2, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR));
443 
444  V(pd3dDevice->SetStreamSource(0, polyobjects[5].VB, 0, sizeof(D3DVERTEX)));
445 
446  V(pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA));
447  V(pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA));
448  V(pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1));
449  V(pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR));
450  V(pd3dDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1));
451  V(pd3dDevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE));
452  V(pd3dDevice->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1));
453  V(pd3dDevice->SetTextureStageState(2, D3DTSS_ALPHAARG1, D3DTA_CURRENT));
454 
455 #pragma region Interior Lighting
456 
457  D3DXCOLOR tempfactor;
458 
459  if (playerships[0].domelight || viewscreen->gameclass->GUI->player[ourcockpit.ourplyrC].frame > REF_INANOTHER)
460  tempfactor = 0xFFBFB5A8;
461  else if (playerships[0].reference != REF_BUILDING && playerships[0].reference != REF_SIMBAY)
462  tempfactor = 0xFF400000;
463  else
464  tempfactor = 0xFF000000;
465 
466  if (ourcockpit.power < 1.0f && viewscreen->gameclass->GUI->player[ourcockpit.ourplyrC].frame == REF_INANOTHER)
467  D3DXColorScale(&tempfactor, &tempfactor, ourcockpit.power);
468  if (playerships[0].simulator)
469  {
470  tempfactor.r = max(viewscreen->sunlight.Diffuse.r * 0.25f, tempfactor.r);
471  tempfactor.g = max(viewscreen->sunlight.Diffuse.g * 0.25f, tempfactor.g);
472  tempfactor.b = max(viewscreen->sunlight.Diffuse.b * 0.25f, tempfactor.b);
473  }
474 
475  V(pd3dDevice->SetRenderState(D3DRS_TEXTUREFACTOR, tempfactor));
476 
477 #pragma endregion
478 
479  int color0op;
480  int color0arg2;
481  if (!playerships[0].simulator)
482  {
483  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
484  color0op = D3DTOP_ADDSMOOTH;
485  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE));
486  color0arg2 = D3DTA_DIFFUSE;
487  }
488  else
489  {
490  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1));
491  color0op = D3DTOP_SELECTARG1;
492  color0arg2 = -1;
493  }
494  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR)); // add cockpit illum to diffuse
495  int color0arg1 = D3DTA_TFACTOR;
496  V(pd3dDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0));
497 
498  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE));
499  int color1op = D3DTOP_MODULATE;
500  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE)); // modulate cockpit with result
501  int color1arg1 = D3DTA_TEXTURE;
502  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT));
503  int color1arg2 = D3DTA_CURRENT;
504  V(pd3dDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0));
505 
506  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
507  int color2op = D3DTOP_ADDSMOOTH;
508  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_TEXTURE)); // add light maps smoothly
509  int color2arg1 = D3DTA_TEXTURE;
510  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLORARG2, D3DTA_CURRENT));
511  int color2arg2 = D3DTA_CURRENT;
512  V(pd3dDevice->SetTextureStageState(2, D3DTSS_TEXCOORDINDEX, 0));
513 
514  // now if it is a ground vehicle, we need to addsmooth the light then modulate the color
515 
516 
517  if (ourcockpit.texturelib == VehicleType::C2A)
518  {
519  V(pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false));
520  }
521  //pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR );
522  //pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); // take texture alpha
523  //pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
524  //pd3dDevice->SetTextureStageState( 2, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); // carry
525  //pd3dDevice->SetTextureStageState( 2, D3DTSS_ALPHAARG1, D3DTA_CURRENT );
526 
527  V(pd3dDevice->SetRenderState(D3DRS_STENCILREF, 4)); // was 0 on Clear()
528  V(pd3dDevice->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE)); // with 3
529  V(pd3dDevice->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS)); // was always before cockpit
530 
531  V(pd3dDevice->SetTransform(D3DTS_PROJECTION, &viewscreen->matrixProjCock));
532 
533 #pragma region Sunlight and Radiosity
534 
535  if (!playerships[0].simulator)
536  {
537  if (g_bAboveClouds)
538  {
539  if (viewscreen->ptrWeather->shadow > 0.0f)
540  {
541  D3DXVECTOR3 Xsunlight = viewscreen->sunlight.Direction;
542  // radiosity
543  ZeroMemory(&templight, sizeof D3DLIGHT9);
544  templight.Type = D3DLIGHT_DIRECTIONAL;
545  D3DXVec3Scale(&vieneohit, &Xsunlight, radiusC); // Where it hits Vieneo
546  D3DXVec3Subtract(&result, &vieneohit, &playerships[0].position); // Vector from surface point to this object
547  D3DXVec3Normalize(&result, &result);
548  templight.Direction = result; // He doesn't have to be normalized but below does
549  float radio = fabsf(D3DXVec3Dot(&result, &Xsunlight)); // cos of angle between the two
550  radio = 1.0f - radio; // Compliment, not comparing to surface normal ya know
551  radio /= powf(D3DXVec3Length(&playerships[0].position) / radiusC, 2.0f);
552  // cloud average from aerobump is .93, .92, and .91, multiplied by sunlight
553  templight.Diffuse.r = 0.6975f*(radio); templight.Diffuse.g = 0.805f*(radio); templight.Diffuse.b = 0.91f*(radio);
554  V(pd3dDevice->SetLight(2, &templight)); // Radiosity
555  V(pd3dDevice->LightEnable(2, true));
556  }
557 
558  // Adjust diffuse
559  templight = viewscreen->sunlight;
560  if (f_ACL <= 0.150f) // in or below clouds
561  {
562  templight.Ambient.r = templight.Diffuse.r*viewscreen->alphascreen.a;
563  templight.Ambient.g = templight.Diffuse.g*viewscreen->alphascreen.a;
564  templight.Ambient.b = templight.Diffuse.b*viewscreen->alphascreen.a;
565  }
566 
567  const float f_temp = viewscreen->ptrWeather->shadow * (1.0f - viewscreen->alphascreen.a);
568  templight.Diffuse.r *= f_temp; // only ambient can get through clouds and objects
569  templight.Diffuse.g *= f_temp; // only ambient can get through clouds and objects
570  templight.Diffuse.b *= f_temp; // only ambient can get through clouds and objects
571  V(pd3dDevice->SetLight(0, &templight));
572  }
573  else
574  {
575  // Adjust diffuse
576  templight = viewscreen->sunlight;
577  templight.Ambient = templight.Diffuse;
578  templight.Diffuse.r *= 0.25f;
579  templight.Diffuse.g *= 0.25f;
580  templight.Diffuse.b *= 0.25f;
581  V(pd3dDevice->SetLight(0, &templight));
582  }
583  }
584  else // simulator
585  {
586  // here is where we can override the ACL lighting?
587  templight = viewscreen->sunlight;
588  templight.Ambient.r = templight.Ambient.g = templight.Ambient.b = 1.0f;
589  templight.Diffuse = D3DCOLORVALUE();
590  V(pd3dDevice->SetLight(0, &templight));
591  }
592 #pragma endregion
593 
594 #pragma endregion
595 
596  if (!viewscreen->outside)
597  {
598 #pragma region Cockpit components
599  short oldtexture = -1;
600  for (unsigned short s = 0; s < ourcockpit.components; s++)
601  {
602  // so this is all drawn first (cockpit.cpp) so we obviously wait on the glass and HUDs
603  if (ourcockpit.componentarray[s].type == 5 ||
604  ourcockpit.componentarray[s].type == 51 || // not windshield or HUDs until end of render
605  ourcockpit.componentarray[s].type == 251 ||
607  continue;
608 
609  if (!ourcockpit.componentarray[s].visible) continue;
610 
611  V(pd3dDevice->SetTransform(D3DTS_WORLD, &ourcockpit.componentarray[s].matWorld));
612 
613 #pragma region Texture assignment
614  if (oldtexture != ourcockpit.componentarray[s].texture)
615  {
616  oldtexture = ourcockpit.componentarray[s].texture;
617  if (oldtexture == ourcockpit.screentexture) // monitor
618  {
619  V(pd3dDevice->SetTexture(1, viewscreen->m_pddsDynamicTexture));
620  }
621  else if (oldtexture == ourcockpit.projecttexture) // projection screen
622  {
623  V(pd3dDevice->SetTexture(1, viewscreen->m_pddsProjectionTexture));
624  }
625  else if (viewscreen->m_pddsCockpitTexture[oldtexture])
626  {
627  V(pd3dDevice->SetTexture(1, viewscreen->m_pddsCockpitTexture[oldtexture]));
628  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE)); // color map
629  color1arg1 = D3DTA_TEXTURE;
630  }
631  else
632  {
633  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_SPECULAR)); // black
634  color1arg1 = D3DTA_SPECULAR;
635  }
636 
637  if (!viewscreen->m_pddsCockpitLights[oldtexture] || ourcockpit.power < 0.1f)
638  {
639  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE));
640  color2op = D3DTOP_DISABLE;
641  }
642  else
643  {
644  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
645  color2op = D3DTOP_ADDSMOOTH;
646  V(pd3dDevice->SetTexture(2, viewscreen->m_pddsCockpitLights[oldtexture]));
647  }
648  }
649 
650  if (oldtexture == ourcockpit.screentexture) // monitor
651  {
652  assert(color1arg1 == D3DTA_TEXTURE);
653  }
654  else if (oldtexture == ourcockpit.projecttexture) // projection screen
655  {
656  assert(color1arg1 == D3DTA_TEXTURE);
657  }
659  {
660  assert(color1arg1 == D3DTA_TEXTURE);
661  }
662  else
663  {
664  assert(color1arg1 == D3DTA_SPECULAR);
665  }
666  assert(color1op == D3DTOP_MODULATE);
667  assert(color1arg2 == D3DTA_CURRENT);
668 
670  {
671  assert(color2op == D3DTOP_DISABLE);
672  }
673  else
674  {
675  assert(color2op == D3DTOP_ADDSMOOTH);
676  }
677  assert(color2arg1 == D3DTA_TEXTURE);
678  assert(color2arg2 == D3DTA_CURRENT);
679 
680 
681  if (oldtexture == ourcockpit.projecttexture) // projection screen
682  {
683  // flicker
684  V(pd3dDevice->SetRenderState(D3DRS_TEXTUREFACTOR, viewscreen->flicker ? 0xFFBFBFBF : 0xFFBABABA));
685  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_TFACTOR)); // instead of screentexture
686  color1arg2 = D3DTA_TFACTOR;
687  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE));
688  color2op = D3DTOP_DISABLE;
689  }
690  else if (ourcockpit.componentarray[s].type == 4 || ourcockpit.componentarray[s].type == 58) // monitor and tablet
691  {
692  if (ourcockpit.power < (0.75f + 0.1f * RandomFloat() - 0.05f))
693  {
694  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_SPECULAR)); // instead of screentexture
695  }
696  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_SELECTARG1));
697  color1op = D3DTOP_SELECTARG1;
698  // flicker
701  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_MODULATE));
702  color2op = D3DTOP_MODULATE;
703  V(pd3dDevice->SetTexture(2, viewscreen->m_pddsInterlace[viewscreen->flicker]));
704  }
705  else if (ourcockpit.componentarray[s].type == 31 && // cockpit exterior
706  ourcockpit.componentarray[s].attachto != 998) // simulator guts
707  {
708  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG2));
709  color0op = D3DTOP_SELECTARG2;
710  V(pd3dDevice->SetRenderState(D3DRS_STENCILREF, 3)); // 0 is default
711  }
712  else if (ourcockpit.componentarray[s].type == 52) // standard cluster
713  {
714  if (viewscreen->m_pddsCockpitLights[oldtexture] && ourcockpit.power > 0.0f && playerships[0].headlight)
715  {
716  V(pd3dDevice->SetTexture(1, viewscreen->m_pddsCockpitLights[oldtexture]));
717  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
718  color1op = D3DTOP_ADDSMOOTH;
719  }
720  else
721  {
722  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_SELECTARG2));
723  color1op = D3DTOP_SELECTARG2;
724  }
725  if (oldtexture == ourcockpit.screentexture) // monitor
726  {
727  V(pd3dDevice->SetTexture(2, viewscreen->m_pddsDynamicTexture));
728  }
729  else
730  {
731  V(pd3dDevice->SetTexture(2, viewscreen->m_pddsCockpitTexture[oldtexture]));
732  }
733  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_MODULATE));
734  color2op = D3DTOP_MODULATE;
735  }
736  else if (ourcockpit.componentarray[s].type == 57) // transparency
737  {
738  V(pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true));
739  }
740  else if (ourcockpit.componentarray[s].type == 38) // mostly enclosed
741  {
742  V(pd3dDevice->SetRenderState(D3DRS_TEXTUREFACTOR, tempfactor*0.25f));
743  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR));
744  color0arg2 = D3DTA_TFACTOR;
745  }
746  else if (ourcockpit.componentarray[s].type == 47) // wipers
747  {
748  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG2));
749  color0op = D3DTOP_SELECTARG2;
750  V(pd3dDevice->SetRenderState(D3DRS_STENCILREF, 3)); // 0 is default
751  }
752  else if (ourcockpit.componentarray[s].type == 40) // scrolling lightmap
753  {
754  // select color map only
755  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTSS_COLORARG1)); // light map D3DTA_TEXTURE
756  color0op = D3DTSS_COLORARG1;
757  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE));
758  color0arg1 = D3DTA_TEXTURE;
759  color1op = D3DTOP_DISABLE;
760  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE)); // light map D3DTA_TEXTURE
761  V(pd3dDevice->SetTexture(0, viewscreen->m_pddsCockpitLights[oldtexture]));
762 
763  D3DXMATRIX matrixTemp;
764  D3DXMatrixIdentity(&matrixTemp);
765  matrixTemp._31 = ourcockpit.componentarray[s].extended;
766  V(pd3dDevice->SetTransform(D3DTS_TEXTURE0, &matrixTemp));
767  V(pd3dDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2));
769  }
770  else if (ourcockpit.componentarray[s].type == 59 &&
771  (!viewscreen->gameclass->bus->MasterWarning || fmodf(static_cast<float>(viewscreen->gameclass->bus->ProgramTime), 2.0f) > 1.0f) ||
772  (ourcockpit.componentarray[s].type == 60 && (!viewscreen->gameclass->bus->MasterCaution || fmodf(static_cast<float>(viewscreen->gameclass->bus->ProgramTime), 2.0f) < 1.0f)))
773  {
774  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE));
775  color2op = D3DTOP_DISABLE;
776  }
777 #pragma endregion
778 
779  V(pd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, ourcockpit.componentarray[s].startvertex, ourcockpit.componentarray[s].primitives));
780 
781 
782  if (oldtexture == ourcockpit.projecttexture) // projection screen
783  {
784  V(pd3dDevice->SetRenderState(D3DRS_TEXTUREFACTOR, tempfactor));
785  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT));
786  color1arg2 = D3DTA_CURRENT;
788  {
789  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE));
790  color2op = D3DTOP_DISABLE;
791  }
792  else
793  {
794  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
795  color2op = D3DTOP_ADDSMOOTH;
796  }
797  }
798  else if (ourcockpit.componentarray[s].type == 4 || ourcockpit.componentarray[s].type == 58) // monitor and tablet
799  {
800  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE));
801  color1arg1 = D3DTA_TEXTURE;
802  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE));
803  color1op = D3DTOP_MODULATE;
805  {
806  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE));
807  color2op = D3DTOP_DISABLE;
808  }
809  else
810  {
811  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
812  color2op = D3DTOP_ADDSMOOTH;
813  }
814  }
815  else if (ourcockpit.componentarray[s].type == 31 && // cockpit exterior
816  ourcockpit.componentarray[s].attachto != 998) // simulator guts
817  {
818  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
819  color0op = D3DTOP_ADDSMOOTH;
820  V(pd3dDevice->SetRenderState(D3DRS_STENCILREF, 4)); // 0 is defaul)t
821  }
822  else if (ourcockpit.componentarray[s].type == 52) // standard cluster
823  {
824  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE));
825  color1op = D3DTOP_MODULATE;
826  if (oldtexture == ourcockpit.screentexture) // monitor
827  {
828  V(pd3dDevice->SetTexture(1, viewscreen->m_pddsDynamicTexture));
829  }
830  else
831  {
832  V(pd3dDevice->SetTexture(1, viewscreen->m_pddsCockpitTexture[oldtexture]));
833  }
835  {
836  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE));
837  color2op = D3DTOP_DISABLE;
838  }
839  else
840  {
841  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
842  color2op = D3DTOP_ADDSMOOTH;
843  V(pd3dDevice->SetTexture(2, viewscreen->m_pddsCockpitLights[oldtexture]));
844  }
845  }
846  else if (ourcockpit.componentarray[s].type == 57) // transparency
847  {
848  V(pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false));
849  }
850  else if (ourcockpit.componentarray[s].type == 38) // mostly enclosed
851  {
852  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE));
853  color0arg2 = D3DTA_DIFFUSE;
854  V(pd3dDevice->SetRenderState(D3DRS_TEXTUREFACTOR, tempfactor));
855  }
856  else if (ourcockpit.componentarray[s].type == 47) // wipers
857  {
858  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
859  color0op = D3DTOP_ADDSMOOTH;
860  V(pd3dDevice->SetRenderState(D3DRS_STENCILREF, 4)); // 0 is default
861  }
862  else if (ourcockpit.componentarray[s].type == 40) // scrolling lightmap
863  {
864  V(pd3dDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE));
866  if (!playerships[0].simulator)
867  {
868  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
869  color0op = D3DTOP_ADDSMOOTH;
870  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR)); // add cockpit illum to diffuse
871  color0arg1 = D3DTA_TFACTOR;
872  }
873  else
874  {
875  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1));
876  color0op = D3DTOP_SELECTARG1;
877  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR)); // add cockpit illum to diffuse
878  color0arg1 = D3DTA_TFACTOR;
879  }
880 
881  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE));
882  color1op = D3DTOP_MODULATE;
883  }
884  else if (ourcockpit.componentarray[s].type == 59 && (!viewscreen->gameclass->bus->MasterWarning || fmodf(static_cast<float>(viewscreen->gameclass->bus->ProgramTime), 2.0f) > 1.0f) ||
885  (ourcockpit.componentarray[s].type == 60 && (!viewscreen->gameclass->bus->MasterCaution || fmodf(static_cast<float>(viewscreen->gameclass->bus->ProgramTime), 2.0f) < 1.0f)))
886  {
888  {
889  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE));
890  color2op = D3DTOP_DISABLE;
891  }
892  else
893  {
894  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH));
895  color2op = D3DTOP_ADDSMOOTH;
896  V(pd3dDevice->SetTexture(2, viewscreen->m_pddsCockpitLights[oldtexture]));
897  }
898  }
899  }
900 #pragma endregion
901  }
902 
903 
904  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1));
905  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE));
906 
907  V(pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE));
908  V(pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE));
909 
910  V(pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE)); // back to default
911  V(pd3dDevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE)); // back to default
912  V(pd3dDevice->SetTextureStageState(2, D3DTSS_ALPHAARG1, D3DTA_TEXTURE)); // back to default
913 
914 
915 #pragma region Interior people (next closest)
916 
917  //if (!g_bOutside)
918  //{
919  // if (game->gameclass->GUI->player[ourcockpit.ourplyrC].frame > 0)
920  // {
921  // //pd3dDevice->SetStreamSource( 0, polyobjects[playerships[0].VB].VB, 0, sizeof(D3DVERTEX) );
922  // //pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR ); // hull texture
923  // //pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR ); // hull texture
924  // short t = ourcockpit.ourplyrC;
925  // //for (short t=0; t<MAX_ONLINEPLAYERS; t++)
926  // {
927  // // reset mode
928  // /*for (short s=0; s<playerships[0].components; s++)
929  // {
930  // D3DXMatrixIdentity(&playerships[0].componentarray[s].matReal);
931  // D3DXMatrixIdentity(&playerships[0].componentarray[s].matRot);
932  // }*/
933  // if (game->gameclass->GUI->player[t].frame > -1) // initialized
934  // {
935  // /*D3DXMATRIX matrixBase;
936  // D3DXMatrixTranslation(&matrixBase,
937  // game->gameclass->GUI->player[t].smoothx - ourcockpit.chaireye.x,
938  // game->gameclass->GUI->player[t].smoothy - ourcockpit.chaireye.y,
939  // game->gameclass->GUI->player[t].smoothz - ourcockpit.chaireye.z);
940  // D3DXMatrixRotationZ(&matrixTemp, -game->gameclass->GUI->player[t].smoothhdg + D3DX_PI);
941  // matrixBase = matrixTemp * matrixBase;*/
942 
943  // // char msg[999];
944  // // 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);
945  // // _write(logfile, msg, strlen(msg));
946  // // if (t!=ourcockpit.ourplyrC) // eventually want to see ourselves in the mirror
947  // // {
948  // // // temporary storage for person
949  // // for (s=0; s<playerships[0].components; s++)
950  // // {
951  // // if (playerships[0].componentarray[s].type==101)
952  // // pd3dDevice->SetTexture( 0, game->m_pddsTempHumanHead );
953  // // else
954  // // pd3dDevice->SetTexture( 0, game->m_pddsTempHuman );
955  // // bool hierarchy=false;
956  // // D3DXMATRIX matHier, matHierRot;
957  // // // heirarchial people
958  // // if (playerships[0].componentarray[s].type>100 &&
959  // // playerships[0].componentarray[s].type<120)
960  // // {
961  // //// float tempy=module[t].instance[s].y, tempp=module[t].instance[s].p, tempr=module[t].instance[s].r;
962  // //// CheckExtension(t, s);
963  // // for (short r=0; r<playerships[0].components; r++)
964  // // {
965  // // if ((playerships[0].componentarray[s].type==101 && playerships[0].componentarray[r].type==100) ||
966  // // (playerships[0].componentarray[s].type==102 && playerships[0].componentarray[r].type==100) ||
967  // // (playerships[0].componentarray[s].type==103 && playerships[0].componentarray[r].type==100) ||
968  // // (playerships[0].componentarray[s].type==104 && playerships[0].componentarray[r].type==100) ||
969  // // (playerships[0].componentarray[s].type==105 && playerships[0].componentarray[r].type==103) ||
970  // // (playerships[0].componentarray[s].type==106 && playerships[0].componentarray[r].type==104) ||
971  // // (playerships[0].componentarray[s].type==107 && playerships[0].componentarray[r].type==105) ||
972  // // (playerships[0].componentarray[s].type==108 && playerships[0].componentarray[r].type==106) ||
973  // // (playerships[0].componentarray[s].type==109 && playerships[0].componentarray[r].type==102) ||
974  // // (playerships[0].componentarray[s].type==110 && playerships[0].componentarray[r].type==102) ||
975  // // (playerships[0].componentarray[s].type==111 && playerships[0].componentarray[r].type==109) ||
976  // // (playerships[0].componentarray[s].type==112 && playerships[0].componentarray[r].type==110) ||
977  // // (playerships[0].componentarray[s].type==113 && playerships[0].componentarray[r].type==111) ||
978  // // (playerships[0].componentarray[s].type==114 && playerships[0].componentarray[r].type==112) ||
979  // // (playerships[0].componentarray[s].type==115 && playerships[0].componentarray[r].type==102)) // hip accessory
980  // // {
981  // // // difference in location tells it the attachment point
982  // // result=playerships[0].componentarray[s].nominalxyz-playerships[0].componentarray[r].nominalxyz;
983  // // // find new location of attachment point
984  // // D3DXVec3TransformCoord(&result, &result, &playerships[0].componentarray[r].matReal);
985  // // // set the location back to zero since we will add it later
986  // // result-=playerships[0].componentarray[s].nominalxyz;
987  // // D3DXMatrixTranslation(&matHier, result.x, result.y, result.z);
988  // // // may not have been initialized
989  // // matHierRot=playerships[0].componentarray[r].matRot;
990  // // hierarchy=true; r=playerships[0].components;
991  // // }
992  // // }
993  // // float pitch, yaw, roll;
994  // // if (playerships[0].componentarray[s].type==101) // head
995  // // {
996  // // pitch = game->gameclass->GUI->player[t].smoothrolltilt;
997  // // yaw = game->gameclass->GUI->player[t].smoothupdown;
998  // // roll = -game->gameclass->GUI->player[t].smoothleftright;
999  // // }
1000  // // else
1001  // // {
1002  // // roll=tempani.ypr[playerships[0].componentarray[s].type-100].z;
1003  // // pitch=tempani.ypr[playerships[0].componentarray[s].type-100].y;
1004  // // yaw=tempani.ypr[playerships[0].componentarray[s].type-100].x;
1005  // // }
1006  // //// float tempy=module[t].instance[s].y, tempp=module[t].instance[s].p, tempr=module[t].instance[s].r;
1007  // //// CheckExtension(t, s);
1008  // // result.x=-1.0f; result.y=0.0f; result.z=0.0f;
1009  // // if (hierarchy)
1010  // // D3DXVec3TransformNormal(&result, &result, &matHierRot);
1011  // // D3DXMatrixRotationAxis(&playerships[0].componentarray[s].matRot, &result, game->yaw);
1012  // // result.x=0.0f; result.y=1.0f; result.z=0.0f;
1013  // // if (hierarchy)
1014  // // D3DXVec3TransformNormal(&result, &result, &matHierRot);
1015  // // D3DXMatrixRotationAxis(&matrixTemp, &result, game->pitch);
1016  // // playerships[0].componentarray[s].matRot=matrixTemp*playerships[0].componentarray[s].matRot;
1017  // // result.x=0.0f; result.y=0.0f; result.z=1.0f;
1018  // // if (hierarchy)
1019  // // D3DXVec3TransformNormal(&result, &result, &matHierRot);
1020  // // D3DXMatrixRotationAxis(&matrixTemp, &result, game->roll);
1021  // // playerships[0].componentarray[s].matRot=matrixTemp*playerships[0].componentarray[s].matRot;
1022  // //// module[t].instance[s].y=tempy;
1023  // //// module[t].instance[s].p=tempp;
1024  // //// module[t].instance[s].r=tempr;
1025  // // if (hierarchy)
1026  // // playerships[0].componentarray[s].matRot=matHierRot*playerships[0].componentarray[s].matRot;
1027  // // }
1028  // // else
1029  // // D3DXMatrixRotationYawPitchRoll( &playerships[0].componentarray[s].matRot, playerships[0].componentarray[s].nominalypr.x, playerships[0].componentarray[s].nominalypr.y, playerships[0].componentarray[s].nominalypr.z );
1030  // // result=playerships[0].componentarray[s].nominalxyz;
1031  // // D3DXMatrixTranslation(&matrixWorld, result.x, result.y, result.z );
1032  // // matrixWorld=playerships[0].componentarray[s].matRot*matrixWorld;
1033  // // if (hierarchy)
1034  // // matrixWorld=matrixWorld*matHier;
1035  // // playerships[0].componentarray[s].matReal=matrixWorld;
1036  // // matrixWorld=matrixWorld*matrixBase;
1037  // // // orient us in it correctly for the orientation of the vehicle
1038  // // D3DXMatrixRotationX( &matrixTemp, D3DX_HALFPI ); // pitch
1039  // // matrixWorld=matrixWorld*matrixTemp;
1040  // // D3DXMatrixRotationY( &matrixTemp, D3DX_PI ); // pitch
1041  // // matrixWorld=matrixWorld*matrixTemp;
1042  // // D3DXMatrixInverse(&matrixTemp, NULL, &game->matrixView);
1043  // // matrixWorld=matrixWorld*matrixTemp;
1044  // // pd3dDevice->SetTransform( D3DTS_WORLD, &matrixWorld );
1045  // //// if (oldtexture!=playerships[0].componentarray[s].texture)
1046  // //// {
1047  // //// short oldtexture=playerships[0].componentarray[s].texture;
1048  // //// pd3dDevice->SetTexture( 0, m_pddsTempHuman );
1049  // //// }
1050  // // pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, playerships[0].componentarray[s].startvertex, playerships[0].componentarray[s].primitives );
1051  // // }
1052  // // }
1053  // }
1054  // }
1055  // }
1056  //}
1057 
1058 #pragma endregion
1059 
1060 
1061 
1062 
1063  V(pd3dDevice->SetRenderState(D3DRS_STENCILREF, 2)); // was 4
1064  // 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
1065  V(pd3dDevice->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_KEEP)); // 3
1066  V(pd3dDevice->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_GREATER)); // 0-2
1067 
1068  if (playerships[0].simulator)
1069  {
1070  V(pd3dDevice->SetTransform(D3DTS_PROJECTION, &viewscreen->matrixProjSim));
1071  }
1072  else
1073  {
1074  V(pd3dDevice->SetTransform(D3DTS_PROJECTION, &viewscreen->matrixProj));
1075  }
1076 
1077 
1078  V(pd3dDevice->SetLight(0, &viewscreen->sunlight));
1079  if (!playerships[0].simulator)
1080  {
1081  if (g_bAboveClouds)
1082  {
1083  // Restore
1084  if (viewscreen->ptrWeather->shadow > 0.0f)
1085  {
1086  V(pd3dDevice->LightEnable(2, false));
1087  }
1088  }
1089  }
1090 
1091  V(pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE));
1092 
1093  V(pd3dDevice->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_POINT));
1094  V(pd3dDevice->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_POINT));
1095  V(pd3dDevice->SetSamplerState(1, D3DSAMP_MIPFILTER, D3DTEXF_NONE));
1096  V(pd3dDevice->SetSamplerState(2, D3DSAMP_MAGFILTER, D3DTEXF_POINT));
1097  V(pd3dDevice->SetSamplerState(2, D3DSAMP_MINFILTER, D3DTEXF_POINT));
1098  V(pd3dDevice->SetSamplerState(2, D3DSAMP_MIPFILTER, D3DTEXF_NONE));
1099  }
1100 
1101  logger->AddToCallStack("cockpit::Render END");
1102 }
1103 
1105 {
1106  logger->AddToCallStack("cockpit::OnLostDevice");
1107  logger->Log("cockpit::OnLostDevice");
1108 
1110  {
1111  SAFE_RELEASE(viewscreen->m_pddsDynamicSurface);
1112  viewscreen->gameclass->UpdateTrackedResource("m_pddsDynamicSurface", 3);
1113  }
1114 
1116  {
1117  SAFE_RELEASE(viewscreen->m_pddsDynamicTexture);
1118  viewscreen->gameclass->UpdateTrackedResource("m_pddsDynamicTexture", 3);
1119  }
1120 
1121  char msg[199];
1122  for (short s = 0; s < cockpittextureC; s++)
1123  {
1125  {
1126  SAFE_RELEASE(viewscreen->m_pddsCockpitTexture[s]);
1127  sprintf_s(msg, 199, "m_pddsCockpitTexture[%i]", s);
1129  }
1130 
1132  {
1133  SAFE_RELEASE(viewscreen->m_pddsCockpitLights[s]);
1134  sprintf_s(msg, 199, "m_pddsCockpitLights[%i]", s);
1136  }
1137  }
1138 
1140  {
1141  SAFE_RELEASE(viewscreen->m_pddsGVBackground);
1142  viewscreen->gameclass->UpdateTrackedResource("m_pddsGVBackground", 3);
1143  }
1145  {
1146  SAFE_RELEASE(viewscreen->m_pddsNamePlate);
1147  viewscreen->gameclass->UpdateTrackedResource("m_pddsNamePlate", 3);
1148  }
1150  {
1151  SAFE_RELEASE(viewscreen->m_pddsGVDialSmall);
1152  viewscreen->gameclass->UpdateTrackedResource("m_pddsGVDialSmall", 3);
1153  }
1154  if (viewscreen->m_pddsAOA[0])
1155  {
1156  SAFE_RELEASE(viewscreen->m_pddsAOA[0]);
1157  viewscreen->gameclass->UpdateTrackedResource("m_pddsAOA[0]", 3);
1158  }
1159  if (viewscreen->m_pddsAOA[1])
1160  {
1161  SAFE_RELEASE(viewscreen->m_pddsAOA[1]);
1162  viewscreen->gameclass->UpdateTrackedResource("m_pddsAOA[1]", 3);
1163  }
1164  if (viewscreen->m_pddsAOA[2])
1165  {
1166  SAFE_RELEASE(viewscreen->m_pddsAOA[2]);
1167  viewscreen->gameclass->UpdateTrackedResource("m_pddsAOA[2]", 3);
1168  }
1170  {
1171  SAFE_RELEASE(viewscreen->m_pddsLightsCruiseIcons);
1172  viewscreen->gameclass->UpdateTrackedResource("m_pddsLightsCruiseIcons", 3);
1173  }
1175  {
1176  SAFE_RELEASE(viewscreen->m_pddsFuelIcon);
1177  viewscreen->gameclass->UpdateTrackedResource("m_pddsFuelIcon", 3);
1178  }
1180  {
1181  SAFE_RELEASE(viewscreen->m_pddsGVCompass);
1182  viewscreen->gameclass->UpdateTrackedResource("m_pddsGVCompass", 3);
1183  }
1185  {
1186  SAFE_RELEASE(viewscreen->m_pddsGVDirection);
1187  viewscreen->gameclass->UpdateTrackedResource("m_pddsGVDirection", 3);
1188  }
1189 
1191  {
1192  SAFE_RELEASE(viewscreen->m_pddsKeycard);
1193  viewscreen->gameclass->UpdateTrackedResource("m_pddsKeycard", 3);
1194  }
1195 }
1196 
1197 void cockpit::OnResetDevice(IDirect3DDevice9* pd3dDevice) const
1198 {
1199  HRESULT hr;
1200  char msg[199];
1201 
1202  logger->AddToCallStack("cockpit::OnResetDevice");
1203  logger->Log("cockpit::OnResetDevice");
1204 
1205  if (!ourcockpit.nextgen)
1206  {
1207  if (FAILED(hr = D3DXCreateTexture(pd3dDevice, 907, 352, 1, D3DUSAGE_RENDERTARGET,
1208  D3DFMT_R8G8B8, D3DPOOL_DEFAULT, &viewscreen->m_pddsDynamicTexture)))
1209  {
1210  logger->Log("Viewscreen::OnResetDevice() failed to create instrumentation texture!", Logger::Fatal);
1211  }
1212  else
1213  viewscreen->gameclass->AddTrackedResource("m_pddsDynamicTexture", D3DPOOL_DEFAULT);
1214  }
1215  else
1216  {
1217  if (FAILED(hr = D3DXCreateTexture(pd3dDevice, 1135, 388, 1, D3DUSAGE_RENDERTARGET,
1218  D3DFMT_R8G8B8, D3DPOOL_DEFAULT, &viewscreen->m_pddsDynamicTexture)))
1219  {
1220  logger->Log("Viewscreen::OnResetDevice() failed to create instrumentation texture!", Logger::Fatal);
1221  }
1222  else
1223  viewscreen->gameclass->AddTrackedResource("m_pddsDynamicTexture", D3DPOOL_DEFAULT);
1224  }
1225 
1226  if (FAILED(hr = viewscreen->m_pddsDynamicTexture->GetSurfaceLevel(0, &viewscreen->m_pddsDynamicSurface)))
1227  {
1228  logger->Log("Viewscreen::OnResetDevice() failed to get instrumentation surface!", Logger::Fatal);
1229  }
1230  else
1231  viewscreen->gameclass->AddTrackedResource("m_pddsDynamicSurface", D3DPOOL_DEFAULT);
1232 
1233  WCHAR hullfile[199], lightfile[199];
1234  for (short s = 0; s < cockpittextureC; s++)
1235  {
1236  // Defaults
1237  hullfile[0] = lightfile[0] = 0;
1238  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1239  switch (ourcockpit.texturelib)
1240  {
1241  case E10:
1242  {
1243  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1244  switch (s)
1245  {
1246  case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hull1.dds");
1247  break;
1248  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
1249  break;
1250  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\E-10-saint-cockpit-glass.dds");
1251  break;
1252  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk.dds");
1253  break;
1254  //case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
1255  // break; // commented out
1256  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1-arm.dds");
1257  break;
1258  case 7: wcscpy_s(hullfile, 199, L"textures\\Interiors\\INT-FIX-light-incan1.dds");
1259  break; // must be renamed to Interiors
1260  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-monitor1.dds");
1261  break;
1262  case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1.dds");
1263  break;
1264  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-buttonboard1.dds");
1265  break;
1266  case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand2-mount.dds");
1267  break;
1268  case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hatch1.dds");
1269  break;
1270  case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-tread1.dds");
1271  break;
1272  case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-bracing1.dds");
1273  break;
1274  case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-guts1.dds");
1275  break;
1276  case 16: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk-LIGHTWRAP.dds");
1277  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk-LIGHTWRAP.dds");
1278  break; // comment out hullfile and rename lightfile to LIGHTWRAP.dds
1279  case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitthrottle.dds");
1280  break;
1281  case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpittpull.dds");
1282  break;
1283  case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
1284  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
1285  break;
1286  case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
1287  break;
1288  case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons2.dds");
1289  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons2LIGHT.dds");
1290  break;
1291  case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
1292  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
1293  break;
1294  case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-door1.dds");
1295  break;
1296  case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10commandchair.dds");
1297  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
1298  break;
1299  case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-frame1.dds");
1300  break;
1301  case 26: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-flightstick2.dds");
1302  break;
1303  case 27: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod1-emergency.dds");
1304  break;
1305  case 28: wcscpy_s(hullfile, 199, L"textures\\Interiors\\INT-FIX-glass1.dds");
1306  break; // Must be renamed to Interiors
1307  case 29: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-grate1.dds");
1308  break;
1309  }
1310  }
1311  break;
1312 
1313  case E11:
1314  {
1315  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1316  switch (s)
1317  {
1318  case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hull1.dds");
1319  break;
1320  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
1321  break;
1322  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\E-10-saint-cockpit-glass.dds");
1323  break;
1324  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-buttonboard1-2x.dds");
1325  break;
1326  case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
1327  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
1328  break;
1329  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk.dds");
1330  break;
1331  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1-arm.dds");
1332  break;
1333  case 8: wcscpy_s(hullfile, 199, L"textures\\Interiors\\INT-FIX-light-incan1.dds");
1334  break; // Must be renamed to Interiors
1335  // case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
1336  // break; // commented out
1337  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-monitor1.dds");
1338  break;
1339  case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1.dds");
1340  break;
1341  case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand2-mount.dds");
1342  break;
1343  case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hatch1.dds");
1344  break;
1345  case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-tread1.dds");
1346  break;
1347  case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-bracing1.dds");
1348  break;
1349  case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-guts1.dds");
1350  break;
1351  case 17: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk-LIGHTWRAP.dds");
1352  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk-LIGHTWRAP.dds");
1353  break; // must be renamed to LIGHTWRAP.dds ... comment out the hullfile!
1354  case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitthrottle.dds");
1355  break;
1356  case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpittpull.dds");
1357  break;
1358  case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
1359  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
1360  break;
1361  case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
1362  break;
1363  case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons2.dds");
1364  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons2LIGHT.dds");
1365  break;
1366  case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-door1.dds");
1367  break;
1368  case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10commandchair.dds");
1369  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
1370  break;
1371  case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-frame1.dds");
1372  break;
1373  case 26: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-flightstick2.dds");
1374  break;
1375  case 27: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod1-emergency-2x.dds");
1376  break;
1377  case 28: wcscpy_s(hullfile, 199, L"textures\\Interiors\\INT-FIX-glass1.dds");
1378  break; // Must be renamed to Interiors
1379  case 29: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-grate1.dds");
1380  break;
1381  }
1382  }
1383  break;
1384 
1385  case C98:
1386  {
1387  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1388  switch (s)
1389  {
1390  case 1: wcscpy_s(hullfile, 199, L"textures\\Vehicles\\GV-1.dds");
1391  break; // folder is actually Vehicles
1392  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-window.dds");
1393  break; // rename to remove -1024 suffix
1394  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\durum-frame.dds");
1395  break;
1396  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-brake-standard.dds");
1397  break;
1398  case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-gaugehousing.dds");
1399  break;
1400  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-rightwindshield.dds");
1401  break;
1402  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-leftwindshield.dds");
1403  break;
1404  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-housing.dds");
1405  break;
1406  case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-frontwindshield.dds");
1407  break;
1408  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-backwall.dds");
1409  break;
1410  case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-steeringwheel3.dds");
1411  break;
1412  case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-floor.dds");
1413  break;
1414  case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-rightwall.dds");
1415  break;
1416  case 14: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Original T-120 Steerhead Cluster.dds");
1417  wcscpy_s(lightfile, 199, L"Textures\\Instruments\\GVscreenblueprintLIGHT.dds");
1418  break; // day map gets commented out, night map is renamed Instruments\\GVscreenblueprintLIGHT.dds
1419  case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-leftwall.dds");
1420  break;
1421  case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-frontwall.dds");
1422  break;
1423  case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallpipe1.dds");
1424  break;
1425  case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-chair.dds");
1426  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
1427  break; // night map is renamed SHIPe10commandchairLIGHT
1428  case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-wirepipe.dds");
1429  break;
1430  case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod6.dds");
1431  break;
1432  case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-buttons.dds");
1433  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\GV-buttonsLIGHT.dds");
1434  break;
1435  case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-frame.dds");
1436  break;
1437  case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitvent.dds");
1438  break;
1439  case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
1440  break;
1441  case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod4.dds");
1442  break;
1443  case 26: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitarm.dds");
1444  break;
1445  }
1446  }
1447  break;
1448 
1449  case A4:
1450  {
1451  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1452  switch (s)
1453  {
1454  case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Wanderer-glass.dds");
1455  break;
1456  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\durum-frame.dds");
1457  break;
1458  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\a3-cockpit-floor.dds");
1459  break;
1460  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10commandchair.dds");
1461  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
1462  break;
1463  case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpit-hudmount.dds");
1464  break;
1465  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\a3-cockpit-rightwall.dds");
1466  break;
1467  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\a3-cockpit-leftwall.dds");
1468  break;
1469  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\a3-cockpit-backfrontwall.dds");
1470  break;
1471  //case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\A4screenblueprint.dds");
1472  // break;
1473  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitdashstation.dds");
1474  break;
1475  case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallpipe1.dds");
1476  break;
1477  case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitconsole.dds");
1478  break;
1479  case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitcontrolstand.dds");
1480  break;
1481  case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod6.dds");
1482  break;
1483  case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-wirepipe.dds");
1484  break;
1485  case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
1486  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
1487  break;
1488  case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitthrottle.dds");
1489  break;
1490  case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod2.dds");
1491  break;
1492  case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitvent.dds");
1493  break;
1494  case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod1.dds");
1495  break;
1496  case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10commandchairbase.dds");
1497  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairbaseLIGHT.dds");
1498  break;
1499  case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
1500  break;
1501  case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod4.dds");
1502  break;
1503  case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod5.dds");
1504  break;
1505  case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitflightstick.dds");
1506  break;
1507  }
1508  }
1509  break;
1510 
1511  case P13:
1512  {
1513  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1514  switch (s)
1515  {
1516  case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-glass.dds");
1517  break;
1518  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-floor.dds");
1519  break;
1520  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-rightwall.dds");
1521  break;
1522  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-leftwall.dds");
1523  break;
1524  case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-hull1.dds");
1525  break;
1526  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\p13-cockpit-ceiling frame.dds");
1527  break;
1528  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-door1.dds");
1529  break;
1530  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip.dds");
1531  break;
1532  case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-monitor1.dds");
1533  break;
1534  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-S-skin-buttonboard1.dds");
1535  break;
1536  case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-mod2-equiptrunk.dds");
1537  break;
1538  case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-frame1.dds");
1539  break;
1540  case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1.dds");
1541  break;
1542  case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpit-hudmount.dds");
1543  break;
1544  case 15: wcscpy_s(hullfile, 199, L"textures\\Ships\\p13-equipment cowl.dds");
1545  break; // this must be renamed from Cockpits to Ships
1546  case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpittpull.dds");
1547  break;
1548  //case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
1549  // break;
1550  case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-stand1-arm.dds");
1551  break;
1552  case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-chair2.dds");
1553  break;
1554  case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitthrottle.dds");
1555  break;
1556  case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
1557  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
1558  break;
1559  case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
1560  break;
1561  case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
1562  break;
1563  case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
1564  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
1565  break;
1566  case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-ind-flightstick2.dds");
1567  break;
1568  }
1569  }
1570  break;
1571 
1572  case T19:
1573  {
1574  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1575  switch (s)
1576  {
1577  //case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\projection.dds");
1578  // break;
1579  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\tread2.dds");
1580  break;
1581  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-guts1.dds");
1582  break;
1583  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\AV-T-19-Stratomaster-glass.dds");
1584  break;
1585  case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPfloor36-1_sub.dds");
1586  break;
1587  //case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
1588  // break;
1589  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SeatBody001.dds");
1590  break;
1591  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
1592  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
1593  break;
1594  case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons2.dds");
1595  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons2LIGHT.dds");
1596  break;
1597  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1.dds");
1598  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1LIGHT.dds");
1599  break;
1600  case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Door001.dds");
1601  break;
1602  case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\CockpitMainPart004.dds");
1603  break;
1604  case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
1605  break;
1606  }
1607  }
1608  break;
1609 
1610  case W6Manx:
1611  {
1612  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1613  switch (s)
1614  {
1615  //case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\projection.dds");
1616  //break;
1617  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\tread2.dds");
1618  break;
1619  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-guts1.dds");
1620  break;
1621  // Manx_Diff.dds is in Ships folder
1622  case 4: wcscpy_s(hullfile, 199, L"textures\\Ships\\Manx_Diff.dds");
1623  break;
1624  case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GlassDiffuse.dds");
1625  break;
1626  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
1627  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons3LIGHT.dds");
1628  break;
1629  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Manx_Complete-Carpeted.dds");
1630  break;
1631  //case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
1632  //break;
1633  case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Chair-3.dds");
1634  break;
1635  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SV-INT-skin-chair-base1.dds");
1636  break;
1637  }
1638  }
1639  break;
1640 
1641  case C2:
1642  {
1643  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1644  switch (s)
1645  {
1646  case 1: wcscpy_s(hullfile, 199, L"textures\\Vehicles\\GV-1.dds");
1647  break; // Path must be Vehicles
1648  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-1-GLASS.dds");
1649  break; // Must be renamed to GV-1-GLASS.dds
1650  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-brake-standard.dds");
1651  break;
1652  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-accelerator-standard.dds");
1653  break;
1654  case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-housing.dds");
1655  break;
1656  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-gaugehousing.dds");
1657  break;
1658  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-floor.dds");
1659  break;
1660  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-frontwall.dds");
1661  break;
1662  case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-steeringwheel3.dds");
1663  break;
1664  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-rightwall.dds");
1665  break;
1666  case 11: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Original C-2 Dasher Cluster.dds");
1667  wcscpy_s(lightfile, 199, L"textures\\Instruments\\GVscreenblueprintLIGHT.dds");
1668  break; // must be renamed to Instruments\\GVscreenblueprintLIGHT.dds
1669  case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-leftwall.dds");
1670  break;
1671  case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\monitor-palette.dds");
1672  break;
1673  case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallpipe1.dds");
1674  break;
1675  case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod1.dds");
1676  break;
1677  case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-chair.dds");
1678  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
1679  break; // must be renamed to SHIPe10commandchairLIGHT.dds
1680  case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod6.dds");
1681  break;
1682  case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-buttons.dds");
1683  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\GV-buttonsLIGHT.dds");
1684  break;
1685  case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-frame.dds");
1686  break;
1687  case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitvent.dds");
1688  break;
1689  case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
1690  break;
1691  }
1692  }
1693  break;
1694 
1695  case C2A:
1696  {
1697  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1698  switch (s)
1699  {
1700  case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\mirror.dds");
1701  break;
1702  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\body.dds");
1703  break;
1704  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-front.dds");
1705  break;
1706  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\glass.dds");
1707  break;
1708  case 5: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\C-2A Dasher Cluster.dds");
1709  wcscpy_s(lightfile, 199, L"textures\\Instruments\\GVscreenblueprintLIGHT.dds");
1710  break; // comment out the hullfile, rename light map to Instruments\\GVscreenblueprintLIGHT.dds
1711  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-accelerator-standard.dds");
1712  break;
1713  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-brake-standard.dds");
1714  break;
1715  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\dash-center.dds");
1716  break;
1717  case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\console-center.dds");
1718  break;
1719  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\dash-cover.dds");
1720  break;
1721  case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\carpet1.dds");
1722  break;
1723  case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-rear.dds");
1724  break;
1725  case 13: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\ceiling1.dds");
1726  break;
1727  case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\controls-env.dds");
1728  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\controls-envLIGHT.dds");
1729  break;
1730  case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\monitor-palette.dds");
1731  break;
1732  case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\radio1.dds");
1733  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\radio1LIGHT.dds");
1734  break;
1735  case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\chair1-back.dds");
1736  break;
1737  case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\chair1.dds");
1738  break;
1739  case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\gearshift.dds");
1740  break;
1741  case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\controls1.dds");
1742  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\controls1LIGHT.dds");
1743  break;
1744  case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Sparko.dds");
1745  break;
1746  }
1747  }
1748  break;
1749 
1750  case T120:
1751  case T121:
1752  {
1753  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1754  switch (s)
1755  {
1756  case 1: wcscpy_s(hullfile, 199, L"textures\\Vehicles\\GV-1.dds");
1757  break; // path must be updated to Vehicles
1758  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\T-120cockpit-window.dds");
1759  break; // filename must be T-120cockpit-window.dds
1760  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-accelerator-standard.dds");
1761  break;
1762  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\pedal-brake-standard.dds");
1763  break;
1764  case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-gaugehousing.dds");
1765  break;
1766  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Bedding.dds");
1767  break;
1768  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-housing.dds");
1769  break;
1770  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitdashmonitor.dds");
1771  break;
1772  case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitdashmonitorplate2.dds");
1773  break;
1774  case 10: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-floor.dds");
1775  break;
1776  case 11: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-steeringwheel3.dds");
1777  break;
1778  case 12: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-rightwall.dds");
1779  break;
1780  case 13: //wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Original T-120 Steerhead Cluster.dds");
1781  wcscpy_s(lightfile, 199, L"Textures\\Instruments\\GVscreenblueprintLIGHT.dds");
1782  break;
1783  case 14: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-leftwall.dds");
1784  break;
1785  case 15: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\monitor-palette.dds");
1786  break;
1787  case 16: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-frontwall.dds");
1788  break;
1789  case 17: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallpipe1.dds");
1790  break;
1791  case 18: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod1.dds");
1792  break;
1793  case 19: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MuVERcockpit-chair.dds");
1794  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\SHIPe10commandchairLIGHT.dds");
1795  break; // light map must be renamed to SHIPe10commandchairLIGHT
1796  case 20: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod2.dds");
1797  break;
1798  case 21: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPwallmod6.dds");
1799  break;
1800  case 22: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-buttons.dds");
1801  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\GV-buttonsLIGHT.dds");
1802  break;
1803  case 23: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\GV-dash-frame.dds");
1804  break;
1805  case 24: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitvent.dds");
1806  break;
1807  case 25: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\SHIPe10cockpitgrip2.dds");
1808  break;
1809  }
1810  }
1811  break;
1812 
1813  case T27:
1814  {
1815  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1816  switch (s)
1817  {
1818  case 1: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\door-front.dds");
1819  break;
1820  case 2: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\mammoth-glass.dds");
1821  break;
1822  case 3: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons1-Elongated.dds");
1823  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\buttons1-ElongatedLIGHT.dds");
1824  break;
1825  case 4: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MamothSeat-Old-Body.dds");
1826  break;
1827  case 5: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MammothSeat-Old-Bottom.dds");
1828  break;
1829  case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\MammothSeat-New.dds");
1830  break;
1831  case 7: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Mammoth-Objects.dds");
1832  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\Mammoth-ObjectsLIGHT.dds");
1833  break;
1834  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\Mammoth-Walls.dds");
1835  wcscpy_s(lightfile, 199, L"textures\\Cockpits\\Mammoth-WallsLIGHT.dds");
1836  break;
1837  //case 9: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\nextgen.dds");
1838  // break;
1839  }
1840  }
1841  break;
1842 
1843  case Apartment:
1844  {
1845  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1846  switch (s)
1847  {
1848  case 1: wcscpy_s(hullfile, 199, L"textures\\Interiors\\glass.dds");
1849  break;
1850  case 2: wcscpy_s(hullfile, 199, L"textures\\Interiors\\ApartmentItems.dds");
1851  break;
1852  case 3: wcscpy_s(hullfile, 199, L"textures\\Interiors\\ApartmentBody.dds");
1853  wcscpy_s(lightfile, 199, L"textures\\Interiors\\ApartmentBodyLIGHT.dds");
1854  break;
1855  case 4: wcscpy_s(hullfile, 199, L"textures\\Interiors\\Bellgirl1.dds");
1856  break;
1857  case 5: wcscpy_s(hullfile, 199, L"textures\\Interiors\\ApartmentKitchen.dds");
1858  break;
1859  //case 6: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\INTscreenblueprint.dds");
1860  //break;
1861  case 7: wcscpy_s(hullfile, 199, L"textures\\Interiors\\modern1.dds");
1862  break;
1863  case 8: wcscpy_s(hullfile, 199, L"textures\\Cockpits\\buttons3.dds");
1864  break;
1865  }
1866  }
1867  break;
1868 
1869  case SimBay:
1870  {
1871  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1872  switch (s)
1873  {
1874  case 1: wcscpy_s(hullfile, 199, L"textures\\Interiors\\environment_BakedColor.dds");
1875  break;
1876  case 2: wcscpy_s(hullfile, 199, L"textures\\Interiors\\classroomWindows.dds");
1877  break;
1878  case 3: wcscpy_s(hullfile, 199, L"textures\\Interiors\\SimulatorPodVRayCompleteMap2.dds");
1879  break;
1880  case 4: wcscpy_s(hullfile, 199, L"textures\\Interiors\\environmentEnd_BakedColor.dds");
1881  break;
1882  }
1883  }
1884  break;
1885 
1886  case ControlTower:
1887  {
1888  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1889  switch (s)
1890  {
1891  case 1: wcscpy_s(hullfile, 199, L"textures\\Cities\\concrete1.dds");
1892  // uses outside model texture
1893  break;
1894  case 2: wcscpy_s(hullfile, 199, L"textures\\Interiors\\towerWindows.dds");
1895  // interiors
1896  break;
1897  case 3: wcscpy_s(hullfile, 199, L"textures\\Interiors\\towerDiffuse.dds");
1898  // interiors
1899  wcscpy_s(lightfile, 199, L"textures\\Interiors\\towerDiffuseLIGHT.dds");
1900  break;
1901  case 4: wcscpy_s(hullfile, 199, L"textures\\Interiors\\monitorsDiffuse.dds");
1902  // interiors
1903  break;
1904  }
1905  }
1906  }
1907 
1908  if (hullfile[0] != 0)
1909  {
1910  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, hullfile,
1911  D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_DXT5,
1912  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
1913  D3DX_FILTER_BOX | D3DX_FILTER_MIRROR, 0, NULL, NULL, &viewscreen->m_pddsCockpitTexture[s])))
1914  {
1915  sprintf_s(msg, sizeof(msg), "Could not load \"%S\"! (%x)", hullfile, hr);
1916  logger->Log(msg, Logger::Level::Fatal);
1917  }
1918  else
1919  {
1920  sprintf_s(msg, 199, "m_pddsCockpitTexture[%i]", s);
1921  viewscreen->gameclass->AddTrackedResource(msg); // managed
1922  }
1923  }
1924 
1925  if (lightfile[0] != 0)
1926  {
1927  if (s != ourcockpit.screentexture) // common in ground vehicles for the dashboard non-LCD generated
1928  {
1929  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, lightfile,
1930  D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_DXT1,
1931  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
1932  D3DX_FILTER_BOX | D3DX_FILTER_MIRROR, 0, NULL, NULL, &viewscreen->m_pddsCockpitLights[s])))
1933  {
1934  sprintf_s(msg, sizeof(msg), "Could not load \"%S\"! (%x)", lightfile, hr);
1935  logger->Log(msg, Logger::Level::Fatal);
1936  }
1937  else
1938  {
1939  sprintf_s(msg, 199, "m_pddsCockpitLights[%i]", s);
1940  viewscreen->gameclass->AddTrackedResource(msg); // managed
1941  }
1942  }
1943  else if (!ourcockpit.nextgen)
1944  {
1945  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, lightfile,
1946  907, 352, 1, 0, D3DFMT_L8,
1947  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
1948  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsCockpitLights[s])))
1949  {
1950  sprintf_s(msg, sizeof(msg), "Could not load \"%S\"! (%x)", lightfile, hr);
1951  logger->Log(msg, Logger::Level::Fatal);
1952  }
1953  else
1954  {
1955  sprintf_s(msg, 199, "m_pddsCockpitLights[%i]", s);
1956  viewscreen->gameclass->AddTrackedResource(msg); // managed
1957  }
1958  }
1959  }
1960  }
1961 
1962  sprintf_s(msg, sizeof(msg), "Cockpit DDS library number changed to %i", ourcockpit.texturelib);
1963  logger->Log(msg);
1964 
1965 
1966  if (viewscreen->gameclass->GUI->player[ourcockpit.ourplyrC].frame == REF_INANOTHER)
1967  {
1968  if (!ourcockpit.gndvehicle)
1969  {
1970  viewscreen->gameclass->LoadTexture(&viewscreen->m_pddsKeycard, "m_pddsKeycard", L"keycard-aerospace.jpg", D3DFMT_R8G8B8);
1971 
1972  if (ourcockpit.texturelib == E10 || ourcockpit.texturelib == T19 || ourcockpit.texturelib == P13 || ourcockpit.texturelib == E11 || ourcockpit.texturelib == W6Manx) // interior nameplate
1973  {
1974  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\SV-S-ind-ID-style-stand1arm.dds",
1975  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_DXT1,
1976  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
1977  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsNamePlate)))
1978  {
1979  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\SV-S-ind-ID-style-stand1arm.dds\"! (%x)", hr);
1980  logger->Log(msg, Logger::Level::Fatal);
1981  }
1982  else
1983  viewscreen->gameclass->AddTrackedResource("m_pddsNamePlate"); // managed
1984  }
1985  }
1986  else
1987  {
1988  viewscreen->gameclass->LoadTexture(&viewscreen->m_pddsKeycard, "m_pddsKeycard", L"keycard-ground.jpg", D3DFMT_R8G8B8);
1989 
1990  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\GVdirection.dds",
1991  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_DXT3,
1992  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
1993  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsGVDirection)))
1994  {
1995  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\GVdirection.dds\"! (%x)", hr);
1996  logger->Log(msg, Logger::Level::Fatal);
1997  }
1998  else
1999  viewscreen->gameclass->AddTrackedResource("m_pddsGVDirection"); // managed
2000 
2001  if (ourcockpit.texturelib != C2A) // not C2-A use old bg
2002  {
2003  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\GVbg.png",
2004  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_R8G8B8,
2005  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2006  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsGVBackground)))
2007  {
2008  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\GVbg.png\"! (%x)", hr);
2009  logger->Log(msg, Logger::Level::Fatal);
2010  }
2011  else
2012  viewscreen->gameclass->AddTrackedResource("m_pddsGVBackground"); // managed
2013 
2014  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\dialsmall.dds",
2015  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_DXT3,
2016  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2017  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsGVDialSmall)))
2018  {
2019  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dialsmall.dds\"! (%x)", hr);
2020  logger->Log(msg, Logger::Level::Fatal);
2021  }
2022  else
2023  viewscreen->gameclass->AddTrackedResource("m_pddsGVDialSmall"); // managed
2024 
2025  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\dial.dds",
2026  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_DXT3,
2027  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2028  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsAOA[0])))
2029  {
2030  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dials.dds\"! (%x)", hr);
2031  logger->Log(msg, Logger::Level::Fatal);
2032  }
2033  else
2034  viewscreen->gameclass->AddTrackedResource("m_pddsAOA[0]"); // managed
2035  }
2036  else
2037  {
2038  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\GVbgNEW.png",
2039  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_R8G8B8,
2040  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2041  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsGVBackground)))
2042  {
2043  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\GVbgNEW.png\"! (%x)", hr);
2044  logger->Log(msg, Logger::Level::Fatal);
2045  }
2046  else
2047  viewscreen->gameclass->AddTrackedResource("m_pddsGVBackground"); // managed
2048 
2049  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\dialsmallNEW.dds",
2050  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_DXT3,
2051  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2052  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsGVDialSmall)))
2053  {
2054  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dialsmallNEW.dds\"! (%x)", hr);
2055  logger->Log(msg, Logger::Level::Fatal);
2056  }
2057  else
2058  viewscreen->gameclass->AddTrackedResource("m_pddsGVDialSmall"); // managed
2059 
2060  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\dialNEW.dds",
2061  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_DXT3,
2062  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2063  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsAOA[0])))
2064  {
2065  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dialNEW.dds\"! (%x)", hr);
2066  logger->Log(msg, Logger::Level::Fatal);
2067  }
2068  else
2069  viewscreen->gameclass->AddTrackedResource("m_pddsAOA[0]"); // managed
2070  }
2071  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\dialmini.dds",
2072  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_DXT3,
2073  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2074  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsAOA[1])))
2075  {
2076  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\dialmini.dds\"! (%x)", hr);
2077  logger->Log(msg, Logger::Level::Fatal);
2078  }
2079  else
2080  viewscreen->gameclass->AddTrackedResource("m_pddsAOA[1]"); // managed
2081 
2082  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\icon-lights-cruise.dds",
2083  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_A8L8,
2084  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2085  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsLightsCruiseIcons)))
2086  {
2087  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\icon-lights-cruise.dds\"! (%x)", hr);
2088  logger->Log(msg, Logger::Level::Fatal);
2089  }
2090  else
2091  viewscreen->gameclass->AddTrackedResource("m_pddsLightsCruiseIcons"); // managed
2092 
2093  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\icon-fuel.png",
2094  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_A8L8,
2095  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2096  D3DX_FILTER_NONE, 0, NULL, NULL, &viewscreen->m_pddsFuelIcon)))
2097  {
2098  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\icon-fuel.png\"! (%x)", hr);
2099  logger->Log(msg, Logger::Level::Fatal);
2100  }
2101  else
2102  viewscreen->gameclass->AddTrackedResource("m_pddsFuelIcon"); // managed
2103 
2104  if (FAILED(hr = D3DXCreateTextureFromFileEx(pd3dDevice, L"Textures\\Instruments\\GVcompass.dds",
2105  D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_L8,
2106  D3DPOOL_MANAGED, D3DX_FILTER_NONE,
2107  D3DX_FILTER_MIRROR_U, 0, NULL, NULL, &viewscreen->m_pddsGVCompass)))
2108  {
2109  sprintf_s(msg, sizeof(msg), "Could not load \"Instruments\\GVcompass.dds\"! (%x)", hr);
2110  logger->Log(msg, Logger::Level::Fatal);
2111  }
2112  else
2113  viewscreen->gameclass->AddTrackedResource("m_pddsGVCompass"); // managed
2114  }
2115  }
2116  else
2117  {
2118  viewscreen->gameclass->LoadTexture(&viewscreen->m_pddsKeycard, "m_pddsKeycard", L"keycard-interior.jpg", D3DFMT_R8G8B8);
2119  }
2120 }
2121 
2123 {
2124  logger->AddToCallStack("cockpit::ResetHelp");
2125  logger->Log("cockpit::ResetHelp");
2126 
2127  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
2128  switch (ourcockpit.texturelib)
2129  {
2130  case E10:
2131  case E11:
2134  {
2138  }
2139  else
2140  {
2143  }
2144  break;
2145  case C98:
2147  if (viewscreen->ptrWeather->elevation < 0.5f)
2148  {
2149  if (!playerships[0].headlight)
2151  if (!playerships[0].domelight)
2153  }
2156  else
2161  else
2165  else
2168  break;
2169  case A4:
2172  {
2176  }
2177  else
2178  {
2181  }
2182  break;
2183  case P13:
2186  {
2190  }
2191  else
2192  {
2195  }
2196  break;
2197  case T19:
2198  if (playerships[0].simulator)
2199  {
2202  }
2207  {
2210  }
2211  else
2212  {
2214  }
2215  break;
2216  case W6Manx:
2217  if (playerships[0].simulator)
2218  {
2221  }
2225  {
2228  }
2229  else
2230  {
2232  }
2233  break;
2234  case C2:
2235  case C2A:
2236  if (ourcockpit.power == 0.0f)
2238  if (viewscreen->ptrWeather->elevation < 0.5f)
2239  {
2240  if (!playerships[0].headlight)
2242  if (!playerships[0].domelight)
2244  }
2247  else
2252  else
2256  else
2259  break;
2260  case T120:
2261  case T121:
2263  if (viewscreen->ptrWeather->elevation < 0.5f)
2264  {
2265  if (!playerships[0].headlight)
2267  if (!playerships[0].domelight)
2269  }
2272  else
2277  else
2281  else
2284  break;
2285  case Apartment:
2290  break;
2291  }
2292 }
#define radiusC
Definition: globals.h:88
D3DXMATRIX matWorld
Definition: globals.h:428
Scockpit ourcockpit
Definition: globals.cpp:176
float yawInput
Definition: Viewscreen.h:237
D3DLIGHT9 sunlight
Definition: Viewscreen.h:217
ID3DXEffect * g_pEffect
Definition: Graphics.h:30
double ProgramTime
Definition: Bus.h:373
LPDIRECT3DTEXTURE9 m_pddsKeycard
Definition: Viewscreen.h:168
float power
Definition: globals.h:608
float yawdeflect
Definition: globals.h:562
float RightBrake
Definition: Bus.h:289
void FrameMove(float fElapsedTime) const
Definition: cockpit.cpp:35
Config config
Definition: GameClass.h:102
bool g_bAboveClouds
Definition: globals.cpp:22
Logger * logger
Definition: cockpit.h:26
LPDIRECT3DTEXTURE9 m_pddsCockpitTexture[cockpittextureC]
Definition: Viewscreen.h:162
GameClass * gameclass
Definition: Viewscreen.h:292
unsigned char type
Definition: globals.h:406
D3DXMATRIX matrixLook
Definition: Viewscreen.h:220
short projecttexture
Definition: globals.h:612
LPDIRECT3DTEXTURE9 m_pddsNamePlate
Definition: Viewscreen.h:156
bool radioEquipped
Definition: globals.h:644
LPDIRECT3DTEXTURE9 m_pddsAOA[3]
Definition: Viewscreen.h:161
InformationDialog * informationDialog
Definition: gui.h:789
LPDIRECT3DTEXTURE9 m_pddsGVDirection
Definition: Viewscreen.h:158
s_network_objects playerships[MAX_SCAN]
Definition: globals.cpp:174
short texturelib
Definition: globals.h:612
float rollInput
Definition: Viewscreen.h:237
D3DXCOLOR alphascreen
Definition: Viewscreen.h:231
InputConfig inputConfigGas
Definition: config.h:33
float extended
Definition: globals.h:427
D3DXMATRIX matrixProj
Definition: Viewscreen.h:219
float f_ACL
Definition: globals.cpp:16
LPDIRECT3DTEXTURE9 m_pddsGVDialSmall
Definition: Viewscreen.h:154
LPDIRECT3DVERTEXBUFFER9 VB
Definition: globals.h:366
s_mesh_component * componentarray
Definition: globals.h:678
weather * ptrWeather
Definition: Viewscreen.h:287
LPDIRECTINPUTDEVICE8 g_pJoystick
Definition: InputConfig.h:22
D3DXVECTOR3 nominalypr
Definition: globals.h:417
void ChangeCockpit(bool force)
Definition: Sound.cpp:1977
char fwdgears
Definition: globals.h:652
cockpit(Viewscreen *ptr)
Definition: cockpit.cpp:8
void ResetHelp() const
Definition: cockpit.cpp:2122
float startupextend
Definition: globals.h:608
bool PopUpHelp(short helpId, bool allowDismiss=true, bool isLearnMore=false)
bool outside
Definition: Viewscreen.h:272
SPlayerData player[MAX_ONLINEPLAYERS]
Definition: gui.h:765
void ChangeCockpit()
Definition: Displays.cpp:318
D3DXVECTOR3 nominalxyz
Definition: globals.h:416
short screentexture
Definition: globals.h:612
InputConfig inputConfigPitch
Definition: config.h:26
float pitchInput
Definition: Viewscreen.h:237
D3DXMATRIX matrixProjCock
Definition: Viewscreen.h:219
D3DXMATRIX matrixProjSim
Definition: Viewscreen.h:219
void OnLostDevice() const
Definition: cockpit.cpp:1104
void LoadTexture(LPDIRECT3DTEXTURE9 *resource, const std::string &pointerName, const WCHAR *file, D3DFORMAT format=D3DFMT_A8R8G8B8)
Definition: GameClass.cpp:2020
InputConfig inputConfigBrake
Definition: config.h:34
void Render(IDirect3DDevice9 *pd3dDevice) const
Definition: cockpit.cpp:313
bool MasterWarning
Definition: Bus.h:148
void Load(IDirect3DDevice9 *pd3dDevice) const
Definition: cockpit.cpp:14
short attachto
Definition: globals.h:407
float chairfwd
Definition: globals.h:616
unsigned short components
Definition: globals.h:624
Graphics * graphics
Definition: GameClass.h:109
void TriggerWelcomeApt2() const
Definition: gui.cpp:1180
LPDIRECT3DTEXTURE9 m_pddsDynamicTexture
Definition: Viewscreen.h:201
Sound * sound
Definition: GameClass.h:108
D3DXVECTOR3 extendby
Definition: globals.h:422
LPDIRECT3DTEXTURE9 m_pddsLightsCruiseIcons
Definition: Viewscreen.h:159
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition: Logger.cpp:11
s_polygon_object polyobjects[maxpolyC]
Definition: globals.cpp:160
bool MasterCaution
Definition: Bus.h:375
#define cockpittextureC
Definition: globals.h:39
LPDIRECT3DTEXTURE9 m_pddsFuelIcon
Definition: Viewscreen.h:160
float chairFwdRemaining
Definition: globals.h:616
float chairfwdeye
Definition: globals.h:616
D3DXVECTOR3 position
Definition: globals.h:619
D3DXMATRIX matrixView
Definition: Viewscreen.h:220
float hingeextent
Definition: globals.h:424
LPDIRECT3DTEXTURE9 m_pddsCockpitLights[cockpittextureC]
Definition: Viewscreen.h:163
HMI * GUI
Definition: GameClass.h:110
short ourplyrC
Definition: globals.h:659
UINT startvertex
Definition: globals.h:408
LPDIRECT3DSURFACE9 m_pddsDynamicSurface
Definition: Viewscreen.h:202
void AddTrackedResource(const char *name, _D3DPOOL pool=D3DPOOL_MANAGED)
Definition: GameClass.cpp:2702
float shadow
Definition: weather.h:80
LPDIRECT3DTEXTURE9 m_pddsGVCompass
Definition: Viewscreen.h:157
LPDIRECT3DTEXTURE9 m_pddsInterlace[2]
Definition: Viewscreen.h:167
bool parkingBrake
Definition: globals.h:685
float LeftBrake
Definition: Bus.h:289
bool gndvehicle
Definition: globals.h:604
void UpdateTrackedResource(const char *name, int status)
Definition: GameClass.cpp:2725
void AddToCallStack(const char *msg)
Definition: Logger.cpp:86
Bus * bus
Definition: GameClass.h:112
bool nextgen
Definition: globals.h:680
D3DXVECTOR3 hingeCG
Definition: globals.h:423
char gearshift
Definition: globals.h:652
D3DXVECTOR3 hingeaxis
Definition: globals.h:423
float RandomFloat()
Definition: MathUtilities.h:98
InputConfig inputConfigSteer
Definition: config.h:32
Logger * logger
Definition: Viewscreen.h:293
Displays * displays
Definition: GameClass.h:114
LPDIRECT3DTEXTURE9 m_pddsProjectionTexture
Definition: Viewscreen.h:203
float elevation
Definition: weather.h:67
Viewscreen * viewscreen
Definition: cockpit.h:25
void OnResetDevice(IDirect3DDevice9 *pd3dDevice) const
Definition: cockpit.cpp:1197
float EngineThrustLever[MAX_ENGINES]
Definition: Bus.h:264
char flicker
Definition: Viewscreen.h:269
LPDIRECT3DTEXTURE9 m_pddsGVBackground
Definition: Viewscreen.h:155