21 static int curbLog = -1;
23 _sopen_s(&curbLog,
"curb.log", _O_WRONLY | O_TEXT | _O_CREAT | _O_TRUNC,
24 _SH_DENYWR, _S_IWRITE);
29 sprintf_s(line,
sizeof(line),
"%7.3f VT%u CT%i VID%u %s\n",
35 _write(curbLog, line,
static_cast<unsigned int>(strlen(line)));
43 logger = g->logger.get();
44 logger->AddToCallStack(
"Viewscreen::ctor");
47 ptrGrid = std::make_unique<grid>(
this);
48 ptrWeapon = std::make_unique<weapon>(
this);
49 ptrBuildings = std::make_unique<buildings>(
this);
50 ptrKeyboard = std::make_unique<keyboard>(
this);
51 ptrJoystick = std::make_unique<joystick>(
this);
52 ptrFreeTrack = std::make_unique<FreeTrack>(
this);
53 ptrPropulsion = std::make_unique<propulsion>(
this);
54 ptrRenderer = std::make_unique<renderer>(
this);
55 ptrWeather = std::make_unique<weather>(
this);
56 ptrCockpit = std::make_unique<cockpit>(
this);
57 ptrInstruments = std::make_unique<instruments>(
this);
58 ptrWaypoints = std::make_unique<waypoints>(gameclass);
67 pitchInput = 0.0f; rollInput = 0.0f; yawInput = 0.0f;
69 BCLoffsetu = BCLoffsetv = 0;
90 m_pFontLicense =
nullptr;
91 m_pFontNamePlate =
nullptr;
92 m_pFontHull =
nullptr;
95 m_avStaticStars =
nullptr;
97 m_avBillboardVertices =
nullptr;
98 m_avRunningLights =
nullptr;
99 m_aiCloudGrid =
nullptr;
100 m_avCloudGrid =
nullptr;
102 m_avLocalGrid =
nullptr;
105 m_avRainDrops =
nullptr;
106 m_avSkyDome =
nullptr;
107 m_avSkyRing =
nullptr;
108 m_avScreen =
nullptr;
109 m_avInstrument =
nullptr;
113 m_pddsWorld2a1 =
nullptr;
114 m_pddsCloudBaseMap =
nullptr;
115 m_pddsCloudDetailAbove =
nullptr;
116 m_pddsCloudDetailBelow =
nullptr;
117 m_pddsBinoculars =
nullptr;
118 m_pddsNightVision =
nullptr;
119 m_pddsBinocularsCompass =
nullptr;
120 m_pddsBinocularsArrow =
nullptr;
121 m_pddsNightVisionCompass =
nullptr;
122 m_pddsNightVisionArrow =
nullptr;
123 m_pddsSunglasses =
nullptr;
124 m_pddsSunTexture =
nullptr;
125 m_pddsStarTexture =
nullptr;
126 m_pddsHolidayTexture =
nullptr;
130 m_pddsWeapon[t] = m_pddsSinker[t] =
nullptr;
131 m_pddsFuzerX =
nullptr;
132 m_pddsSinkerX =
nullptr;
133 m_pddsBlastX =
nullptr;
135 m_pddsFirework1[t] =
nullptr;
137 m_pddsFirework2[t] =
nullptr;
139 m_pddsFirework3[t] =
nullptr;
141 m_pddsElmo[t] =
nullptr;
143 for (t = 0; t < smoketrailC; t++)
144 m_pddsSmoke[t] =
nullptr;
147 m_pddsDIHV[t] =
nullptr;
149 m_pddsHeart[t] =
nullptr;
150 m_pddsFlame =
nullptr;
153 m_pddsGVDialSmall =
nullptr;
154 m_pddsGVBackground =
nullptr;
155 m_pddsNamePlate =
nullptr;
156 m_pddsGVCompass =
nullptr;
157 m_pddsGVDirection =
nullptr;
158 m_pddsLightsCruiseIcons =
nullptr;
159 m_pddsFuelIcon =
nullptr;
160 for (t = 0; t < 3; t++)
161 m_pddsAOA[t] =
nullptr;
163 m_pddsCockpitTexture[t] = m_pddsCockpitLights[t] =
nullptr;
166 for (t = 0; t < 2; t++)
167 m_pddsInterlace[t] =
nullptr;
173 m_pddsLetters =
nullptr;
175 m_pddsAtmosphere =
nullptr;
177 m_pddsShipTexture[t] = m_pddsShipLights[t] =
nullptr;
179 m_pddsDockTexture[t] = m_pddsDockLights[t] =
nullptr;
181 m_pddsRTSTexture[t] = m_pddsRTSLights[t] =
nullptr;
183 m_pddsCityTexture[t] = m_pddsCityLights[t] =
nullptr;
185 m_pddsLandform[t] =
nullptr;
187 m_pddsTransition[t] =
nullptr;
188 m_pddsWaterNormal =
nullptr;
189 m_pddsMarston1 =
nullptr;
190 m_pddsRunwayEdgeLight1 =
nullptr;
191 m_pddsRoad =
nullptr;
192 m_pddsIntersection =
nullptr;
195 m_pddsDynamicTexture =
nullptr;
196 m_pddsDynamicSurface =
nullptr;
197 m_pddsProjectionTexture =
nullptr;
198 m_pddsProjectionSurface =
nullptr;
199 m_pRenderToSurface =
nullptr;
200 m_pRenderToSurfaceNextGen =
nullptr;
201 m_pHullRender2Surface =
nullptr;
203 logger->Log(
"Viewscreen::ctor Initializing vehicles array!");
208 gameclass->bus->scanslot[t] = t;
209 gameclass->bus->scandist[t] = 0.0f;
301 m_pddsHullDynamicTexture[t] =
nullptr;
304 verticaltime = lateraltime = 0.0f;
310 reentryDamageIntensity = 0.f;
351 logger->
Log(
"Viewscreen Initialize() Called!");
353 _controlfp_s(
nullptr, _PC_64, MCW_PC);
359 _sopen_s(&universe,
"universe.dat", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
364 strerror_s(strerr, 99, errno);
373 _lseek(universe, t * 1000 + 999 + 0, SEEK_SET);
376 _lseek(universe, t * 1000 + 999 + 2, SEEK_SET);
379 _lseek(universe, t * 1000 + 999 + 6, SEEK_SET);
381 _lseek(universe, t * 1000 + 999 + 10, SEEK_SET);
382 _read(universe, &
allobjects[t].inclination, 4);
383 _lseek(universe, t * 1000 + 999 + 14, SEEK_SET);
385 _lseek(universe, t * 1000 + 999 + 18, SEEK_SET);
387 _lseek(universe, t * 1000 + 999 + 22, SEEK_SET);
388 _read(universe, &
allobjects[t].revolution, 4);
389 _lseek(universe, t * 1000 + 999 + 26, SEEK_SET);
391 _lseek(universe, t * 1000 + 999 + 30, SEEK_SET);
393 _lseek(universe, t * 1000 + 999 + 64, SEEK_SET);
412 for (
short t = 0; t <
maxstarC - 1; t++)
425 strcpy_s(
msg,
sizeof msg,
"Types in sort order:");
426 for (
short t = 0; t <
maxstarC; t++)
431 ourmoonC =
static_cast<unsigned char>(t);
436 UCLobjC =
static_cast<unsigned char>(t);
440 ourstarC =
static_cast<unsigned char>(t);
446 logger->
Log(
"Viewscreen Initialize() Done!");
467 AddFontResourceEx(L
"Fonts\\cour.ttf", FR_PRIVATE,
nullptr);
468 int nHeight = -9 * 96 / 72;
470 OUT_TT_ONLY_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
471 TEXT(
"Courier New"), &
m_pFont)))
480 AddFontResourceEx(L
"Fonts\\LicensePlate.ttf", FR_PRIVATE,
nullptr);
482 OUT_TT_ONLY_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
492 AddFontResourceEx(L
"Fonts\\pala.ttf", FR_PRIVATE,
nullptr);
493 nHeight = -9 * 96 / 72;
495 OUT_TT_ONLY_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
509 AddFontResourceEx(L
"Fonts\\rcaf6-GIMP.ttf", FR_PRIVATE,
nullptr);
511 OUT_TT_ONLY_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
525 logger->
Log(
"InitDeviceObjects() font for HUD loaded!");
528 logger->
Log(
"Viewscreen::OnCreateDevice() creating vertex buffers...");
598 logger->
Log(
"Viewscreen::OnCreateDevice() created all static vertex/index buffers!");
603 unsigned char offset = 0;
605 int runningVerts = 0;
615 int handle = -1, t = 0;
626 logger->
Log(
"Restored selected cockpit geometry after device replacement");
635 case 0: _sopen_s(&handle,
"Meshes\\farspher.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
641 case 2: _sopen_s(&handle,
"Meshes\\sphere.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
643 case 3: _sopen_s(&handle,
"Meshes\\E-10.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
645 case 4: _sopen_s(&handle,
"Meshes\\cargo-standard.daw", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
652 case 6: _sopen_s(&handle,
"Meshes\\T-8 Wanderer.daw", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
654 case 7: _sopen_s(&handle,
"Meshes\\dihv.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
657 case 8: _sopen_s(&handle,
"Meshes\\C-98 MuVER-construction.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
660 case 9: _sopen_s(&handle,
"Meshes\\p-13.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
662 case 10: _sopen_s(&handle,
"Meshes\\C-2 Dasher.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
665 case 11: _sopen_s(&handle,
"Meshes\\T-120 Steerhead-stock.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
668 case 12: _sopen_s(&handle,
"Meshes\\E-11.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
671 case 13: _sopen_s(&handle,
"Meshes\\WEP-WVM1-hornet.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
673 case 14: _sopen_s(&handle,
"Meshes\\C-2A Dasher.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
676 case 15: _sopen_s(&handle,
"Meshes\\2007 T-120 EXT.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
679 case 16: _sopen_s(&handle,
"Meshes\\manx-hex.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
682 case 17: _sopen_s(&handle,
"Meshes\\BeishtKione.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
684 case 18: _sopen_s(&handle,
"Meshes\\fuel-standard-ext.daw", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
687 case 19: _sopen_s(&handle,
"Meshes\\T-19 Stratomaster.DAW", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
690 case 20: _sopen_s(&handle,
"Meshes\\cargo-toploader.daw", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
693 case 21: _sopen_s(&handle,
"Meshes\\munitions-standard-ext.daw", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
695 case 22: _sopen_s(&handle,
"Meshes\\Holidays\\Spacesuit-Morholt-posed.daw", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
697 case 23: _sopen_s(&handle,
"Meshes\\pax-exterior-hex.daw", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
700 case 24: _sopen_s(&handle,
"Meshes\\T-27 Mammoth.daw", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
704 if (handle == -1 && !skip)
707 strerror_s(strerr, 99, errno);
708 sprintf_s(
msg,
sizeof(
msg),
"Could not load polygon object (DAW file) number %i: %s", t, strerr);
716 _lseek(handle, 0L, SEEK_SET);
718 sprintf_s(
msg,
sizeof(
msg),
"Loading file (%i vertices) for polygon object number %i...",
polyobjects[t].vertices, t);
738 sprintf_s(
msg,
sizeof(
msg),
"Creating memory (%i vertices) for polygon object number %i...",
polyobjects[t].vertices, t);
746 sprintf_s(
msg,
sizeof(
msg),
"Could not create memory (%i vertices) for polygon object number %i!",
polyobjects[t].vertices, t);
757 sprintf_s(
msg,
sizeof msg,
"Could not create memory (%i vertices) for polygon object number %i!",
polyobjects[t].vertices, t);
762 sprintf_s(
msg,
sizeof msg,
"polyobjects[%i].VB", t);
768 V(
polyobjects[t].VB->Lock(0, 0,
reinterpret_cast<void**
>(&vtx), 0));
780 _read(handle, &tempnormal, 12);
790 vtx->
x = tempnormal.x;
791 vtx->
y = tempnormal.y;
792 vtx->
z = tempnormal.z;
802 _lseek(handle, 12L, SEEK_CUR);
811 _lseek(handle, 12L, SEEK_CUR);
816 _read(handle, &tempnormal, 12);
818 vtx->
nx = tempnormal.x;
819 vtx->
ny = tempnormal.y;
820 vtx->
nz = tempnormal.z;
822 _read(handle, &tempnormal.x, 4);
823 _read(handle, &tempnormal.y, 4);
824 vtx->
tu = tempnormal.x;
825 vtx->
tv = tempnormal.y;
828 _read(handle, &tempnormal.x, 4);
829 _read(handle, &tempnormal.y, 4);
830 vtx->
tu2 = tempnormal.x;
831 vtx->
tv2 = tempnormal.y;
834 vtx->
tu2 = vtx->
tv2 = 0.0f;
883 short numberOfEffects;
884 _read(handle, &numberOfEffects, 2);
885 sprintf_s(
msg,
sizeof(
msg),
"OnCreateDevice loading %i light(s) for polygon object number %i...", numberOfEffects, t);
887 for (s = 0; s < numberOfEffects; s++)
890 _read(handle, &vtx2->
x, 4);
891 _read(handle, &vtx2->
y, 4);
892 _read(handle, &vtx2->
z, 4);
896 _read(handle, &newEffect.
normal, 12);
897 _read(handle, &vtx2->
diffuse, 4);
900 _read(handle, &newEffect.
speed, 4);
901 _read(handle, &newEffect.
power, 4);
902 _read(handle, &newEffect.
attachto, 2);
938 _sopen_s(&handle,
"Meshes\\cutters.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
943 strerror_s(strerr, 99, errno);
949 _sopen_s(&handle,
"Meshes\\easydock.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
954 strerror_s(strerr, 99, errno);
960 _sopen_s(&handle,
"Meshes\\sentry station 12.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
965 strerror_s(strerr, 99, errno);
970 _lseek(handle, 0, SEEK_SET);
974 sprintf_s(
msg,
sizeof msg,
"allobjects[%i].componentarray", t);
983 sprintf_s(
msg,
sizeof(
msg),
"Failed to initialize %i components for dock mesh %i",
allobjects[t].components, t);
985 return E_OUTOFMEMORY;
990 sprintf_s(
msg,
sizeof(
msg),
"Initialized %i components for dock mesh %i",
allobjects[t].components, t);
995 _lseek(handle, s * 100L + 99L, SEEK_SET);
996 _read(handle, &i_temp, 2);
998 _read(handle, &i_temp, 2);
1000 _read(handle, &
allobjects[t].componentarray[s].nominalxyz, 12);
1001 _read(handle, &
allobjects[t].componentarray[s].nominalypr, 12);
1002 _read(handle, &
allobjects[t].componentarray[s].boundsphere, 4);
1003 _read(handle, &
allobjects[t].componentarray[s].extendby, 12);
1004 _read(handle, &
allobjects[t].componentarray[s].texture, 2);
1008 _lseek(handle, 12, SEEK_CUR);
1009 _read(handle, &
allobjects[t].componentarray[s].type, 1);
1025 _sopen_s(&handle,
"Meshes\\starlist.daw", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
1030 strerror_s(strerr, 99, errno);
1037 unsigned char chtemp;
1042 for (t = 0; t <
starsC; t++)
1044 _lseek(handle,
static_cast<long>(t) * 19L, SEEK_SET);
1045 _read(handle, &temp, 12);
1048 vtxs->
x = temp.x; vtxs->
y = temp.y; vtxs->
z = temp.z;
1050 _read(handle, &f_temp, 4);
1051 vtxs->
psize = powf(f_temp, 2.512f) * 4.0f;
1053 _read(handle, &chtemp, 1); tempcolor.
r =
static_cast<float>(chtemp) / 255.0f;
1054 _read(handle, &chtemp, 1); tempcolor.
g =
static_cast<float>(chtemp) / 255.0f;
1055 _read(handle, &chtemp, 1); tempcolor.
b =
static_cast<float>(chtemp) / 255.0f;
1095 logger->
Log(
"Viewscreen::OnCreateDevice() exiting successfully!");
1135 L
"Rise is using simpler cloud rendering.\n\n"
1136 L
"The following effects are unavailable:\n"
1137 L
" - Volumetric cloud formations\n"
1138 L
" - Cloud-top lightning flashes\n"
1139 L
" - Headlight illumination inside clouds\n\n"
1140 L
"You can continue playing. Details have been saved in the trace log. "
1141 L
"Please include your trace log when reporting this issue.",
1142 L
"Rise - Reduced cloud effects", MB_OK | MB_ICONWARNING);
1155 logger->
Log(
"Viewscreen::OnResetDevice() called!");
1158 if (FAILED(cloudResult))
1162 if (FAILED(envelopeResult))
1165 if (FAILED(boltResult))
1168 if (FAILED(rainResult))
1250 fAspect = (float)pBackBufferSurfaceDesc->
Height / (
float)pBackBufferSurfaceDesc->
Width;
1280 logger->
Log(
"Viewscreen::OnResetDevice creating vertex buffers...");
1333 logger->
Log(
"Viewscreen::OnResetDevice() created all dynamic vertex and index buffers!");
1341 logger->
Log(
"Viewscreen::OnResetDevice() failed to CreateQuery even through device previously claimed to support it!",
Logger::Fatal);
1386 logger->
Log(
"Viewscreen::OnResetDevice() exited successfully!");
1396 logger->
Log(
"ViewScreen::OnLostDevice() called!");
1513 for (
short t = 0; t <
MAX_SCAN; t++)
1517 sprintf_s(
msg,
sizeof(
msg),
"Viewscreen::OnLostDevice released m_pddsHullDynamicTexture slot %i!", t);
1520 sprintf_s(
msg,
sizeof(
msg),
"m_pddsHullDynamicTexture[%i]", t);
1528 logger->
Log(
"Viewscreen::OnLostDevice() exited successfully!");
1534 logger->
Log(
"Viewscreen::OnDestroyDevice() called!");
1594 sprintf_s(
msg,
sizeof msg,
"m_pddsLogos[%zu]", i);
1604 sprintf_s(
msg,
sizeof msg,
"m_pddsShipTexture[%i]", t);
1609 sprintf_s(
msg,
sizeof msg,
"m_pddsShipLights[%i]", t);
1616 sprintf_s(
msg,
sizeof msg,
"m_pddsCityTexture[%i]", t);
1621 sprintf_s(
msg,
sizeof msg,
"m_pddsCityLights[%i]", t);
1630 sprintf_s(
msg,
sizeof msg,
"m_pddsRTSTexture[%i]", t);
1636 sprintf_s(
msg,
sizeof msg,
"m_pddsRTSLights[%i]", t);
1644 sprintf_s(
msg,
sizeof msg,
"m_pddsLandform[%i]", t);
1651 sprintf_s(
msg,
sizeof msg,
"m_pddsTransition[%i]", t);
1658#ifndef skipAnimations
1662 sprintf_s(
msg,
sizeof msg,
"m_pddsWeapon[%i]", t);
1665 sprintf_s(
msg,
sizeof msg,
"m_pddsSinker[%i]", t);
1677 for (t = 0; t < smoketrailC; t++)
1684 sprintf_s(
msg,
sizeof msg,
"m_pddsDIHV[%i]", t);
1690 sprintf_s(
msg,
sizeof msg,
"m_pddsHeart[%i]", t);
1696 sprintf_s(
msg,
sizeof msg,
"m_pddsFirework1[%i]", t);
1702 sprintf_s(
msg,
sizeof msg,
"m_pddsFirework2[%i]", t);
1708 sprintf_s(
msg,
sizeof msg,
"m_pddsFirework3[%i]", t);
1719 sprintf_s(
msg,
sizeof msg,
"m_pddsElmo[%i]", t);
1790 sprintf_s(
msg,
sizeof msg,
"m_pddsCockpitTexture[%i]", t);
1796 sprintf_s(
msg,
sizeof msg,
"m_pddsCockpitLights[%i]", t);
1820 sprintf_s(
msg,
sizeof msg,
"m_pddsDockTexture[%i]", t);
1825 sprintf_s(
msg,
sizeof msg,
"m_pddsDockLights[%i]", t);
1836 sprintf_s(
msg,
sizeof msg,
"allobjects[%i].componentarray", t);
1848 sprintf_s(
msg,
sizeof(
msg),
"Viewscreen::OnDestroyDevice released m_pddsHullDynamicTexture slot %i!", t);
1851 sprintf_s(
msg,
sizeof msg,
"m_pddsHullDynamicTexture[%i]", t);
1855 if (!preserveModels &&
playerships[t].componentarray)
1859 sprintf_s(
msg,
sizeof msg,
"playerships[%i].componentarray", t);
1931 if (preserveModels && t == 5)
1938 sprintf_s(
msg,
sizeof(
msg),
"polyobjects[%i].VB", t);
1948 for (
short l = 0; l < 64; l++)
1950 for (
short m = 0; m < 64; m++)
1952 if (
gridarray[l][m].buildzoneOrdinal != -1)
1954 sprintf_s(
msg,
sizeof(
msg),
"OnDestroyDevice HG2 released VB slot %i!",
gridarray[l][m].buildzoneOrdinal);
1978 logger->
Log(
"Viewscreen::OnDestroyDevice() exited successfully!");
1999 for (
short t = 0; t <
maxstarC; t++)
2056 vtxn->
x = 1.0f; vtxn->
y = 0.0f; vtxn->
z = 1.0f;
2057 vtxn->
tu = 1.0f; vtxn->
tv = 0.0f;
2059 vtxn->
x = 1.0f; vtxn->
y = 0.0f; vtxn->
z = -1.0f;
2060 vtxn->
tu = 0.0f; vtxn->
tv = 0.0f;
2062 vtxn->
x = -1.0f; vtxn->
y = 0.0f; vtxn->
z = 1.0f;
2063 vtxn->
tu = 1.0f; vtxn->
tv = 1.0f;
2065 vtxn->
x = -1.0f; vtxn->
y = 0.0f; vtxn->
z = -1.0f;
2066 vtxn->
tu = 0.0f; vtxn->
tv = 1.0f;
2098 short l, m, n = 0, o = 0;
2099 for (l = 0; l < 63; l++)
2101 for (m = 0; m < 63; m++)
2106 if (sqrtf(powf(31.0f -
static_cast<float>(l), 2.0f) + powf(31.0f -
static_cast<float>(m), 2.0f)) <= 32.0f)
2110 if (l > 15 && l < 48 && m > 15 && m < 48)
2120 sprintf_s(
msg,
sizeof(
msg),
"ApplyEnvironmentMap() visible grid has %i/%i squares (%i are patched)!", n,
drawlistC, o);
2124#if defined(_DEBUG) && defined(VISIBLEGRIDDUMP)
2125 int visiblegridfile;
2126 _sopen_s(&visiblegridfile,
"visiblegrid.txt", _O_RDWR | _O_CREAT | _O_TRUNC | _O_TEXT | _O_SEQUENTIAL, SH_DENYWR, S_IWRITE);
2128 for (l = 0; l < 63; l++)
2130 for (m = 0; m < 63; m++)
2133 _write(visiblegridfile,
msg, strlen(
msg));
2135 sprintf_s(
msg,
sizeof msg,
"\n");
2136 _write(visiblegridfile,
msg, strlen(
msg));
2138 _close(visiblegridfile);
2142 short indexgrid[64][64];
2144 for (l = 0; l < 64; l++)
2146 for (m = 0; m < 64; m++)
2148 indexgrid[l][m] = n;
2152 sprintf_s(
msg,
sizeof(
msg),
"ApplyEnvironmentMap() index grid for clouds has %i/%i indices!", n, 4096);
2156 unsigned short* itxg;
2160 for (
short t = 0; t < 63; t++)
2162 for (s = 0; s < 63; s++)
2166 (*itxg++) = indexgrid[t][s];
2167 (*itxg++) = indexgrid[t + 1][s + 1];
2168 (*itxg++) = indexgrid[t][s + 1];
2170 (*itxg++) = indexgrid[t][s];
2171 (*itxg++) = indexgrid[t + 1][s];
2172 (*itxg++) = indexgrid[t + 1][s + 1];
2178 sprintf_s(
msg,
sizeof msg,
"ApplyEnvironmentMap() cloud index buffer has %i/%i indices!", n,
cloudindicesC);
2188 short leftup, rightdown = 32;
2191 unsigned short startindex = 0;
2200 for (leftup = 30; leftup >= 0; leftup--)
2203 for (
short t = leftup; t <= rightdown; t++)
2207 if (t > 15 && t < 47 && leftup > 15 && leftup < 47)
2227 if (t > 15 && t < 47 && rightdown > 15 && rightdown < 47)
2241 drawlist[n].
v = (
unsigned char)rightdown;
2247 for (s = leftup + 1; s < rightdown; s++)
2251 if (s > 15 && s < 47 && rightdown > 15 && rightdown < 47)
2264 drawlist[n].
u = (
unsigned char)rightdown;
2271 if (s > 15 && s < 47 && leftup > 15 && leftup < 47)
2292 sprintf_s(
msg,
sizeof(
msg),
"ApplyEnvironmentMap() terrain draw list, vertices %i, list length %i/%i", startindex, n,
drawlistC);
2302 if (u < 1 || u > 62 || v < 1 || v > 62)
2310 rayPos -= rayDir * 10.0f;
2313 float pu = -1.0f, pv = -1.0f, dist = -1.0f;
2326 if (u > 15 && u < 48 && v > 15 && v < 48)
2369 sprintf_s(
msg,
sizeof msg,
"*** CalculateAGL() u%i v%i x%.3f y%.3f z%.3f (%i) yielded no result, trying larger tesselation...", u, v,
position.x,
position.y,
position.z, makeleveler);
2383 sprintf_s(
msg,
sizeof msg,
" CalculateAGL() u%i v%i is at x%.3f y%.3f z%.3f, still no result, returning %.3f (%.3f)", u, v,
gridarray[u][v].
position.x,
gridarray[u][v].
position.y,
gridarray[u][v].
position.z, dist,
radiusC +
playerships[0].
mslKm - dist);
2399 sprintf_s(
msg,
sizeof msg,
"+++ CalculateAGL() u%i v%i x%.3f y%.3f z%.3f (%i) yielded no result, returning %.3f", u, v,
position.x,
position.y,
position.z, makeleveler, dist);
2403 if (makeleveler && dist != -1.0f)
2413 return -(dist - 10.0f);
2424 const float RH = R + H;
2427 auto intersectSphere = [&](
float r,
float& tNear,
float& tFar) {
2430 float disc = B * B - C;
2431 if (disc < 0.0f)
return false;
2432 float sq = sqrtf(disc);
2443 float tSurfaceNear, tSurfaceFar;
2444 if (intersectSphere(R, tSurfaceNear, tSurfaceFar)) {
2446 if ((tSurfaceFar > 0.0f && tSurfaceNear <= 0.0f)
2447 || (tSurfaceNear > 0.0f))
2454 float tAtmNear, tAtmFar;
2455 if (!intersectSphere(RH, tAtmNear, tAtmFar)) {
2461 float tEntry = (tAtmNear > 0.0f ? tAtmNear : 0.0f);
2462 float tExit = (tAtmFar > 0.0f ? tAtmFar : 0.0f);
2465 if (tExit <= 0.0f)
return 1.0f;
2468 float pathLength = tExit - tEntry;
2472 float maxChord = 2.0f * sqrtf(RH * RH - R * R);
2474 float f = 1.0f - pathLength / maxChord;
2475 return Clamp(f, 0, 1);
2481 const int steps = 10;
2483 for (
int t = 0; t < steps; t++)
2486 if ((f_time >=
aniarray[ani][t].start || fabsf(
aniarray[ani][t].start - f_time) < 0.05f) &&
2492 for (
short s = 0; s < 16; s++)
2495 returnani.
start = returnani.
end = 0.0f;
2500 if ((f_time >=
aniarray[ani][t].start || fabsf(
aniarray[ani][t].start - f_time) < 0.05f) &&
2504 returnani.
end = -353.0f;
2508 char sliderstr[499];
2509 sprintf_s(sliderstr, 499,
"Could not find key frame that covers the time interval of %.1f seconds", f_time);
2523 if (fabsf(gthrust->z) < 1.0f)
2533 return cross * f_temp;
2543 if (f_tempu >= 0.4981712f && f_tempu <= 0.5018288f && f_tempv <= 0.4963424f)
2548 if (f_tempu >= 0.4963424 && f_tempu <= 0.5036576 && f_tempv >= 0.5036576)
2554 if (f_tempu <= 0.4963424 && f_tempv >= 0.4963424 && f_tempv <= 0.5036576)
2559 if (f_tempu >= 0.5036576 && f_tempv >= 0.4963424 && f_tempv <= 0.5036576)
2562 if (f_tempu > 0.4963424 && f_tempu < 0.5036576 && f_tempv > 0.4963424 && f_tempv < 0.5036576)
2576 ship.crashHornFault = ship.hornPressed = ship.rainProtectionEnabled =
false;
2597 return velocityBody + rotation;
2608 if (after == before)
return;
2615 sprintf_s(message,
sizeof message,
2616 "Landing light impact: vehicle %u lamp %u (%s from driver) %d->%d, %s, closing %.2f m/s clearance %.3f m mountBody=(%.3f,%.3f,%.3f)m",
2618 mount.x * 1000.f, mount.y * 1000.f, mount.z * 1000.f);
2647 const float closing = sweep.
Sphere(centerBody, radiusKm);
2661 double proposedx, proposedy, proposedz;
2671 proposedx = proposed.x; proposedy = proposed.y; proposedz = proposed.z;
2702 sprintf_s(
msg,
sizeof(
msg),
"\tET: %f", ElapsedTime);
2718 sprintf_s(
msg,
sizeof(
msg),
"\torientation X: %f",
playerships[0].orientation.x);
2720 sprintf_s(
msg,
sizeof(
msg),
"\torientation Y: %f",
playerships[0].orientation.y);
2722 sprintf_s(
msg,
sizeof(
msg),
"\torientation Z: %f",
playerships[0].orientation.z);
2724 sprintf_s(
msg,
sizeof(
msg),
"\torientation W: %f",
playerships[0].orientation.w);
2727 sprintf_s(
msg,
sizeof(
msg),
"Trapped a violation after gravity adjusted...");
2751 proposed.x =
static_cast<float>(proposedx);
2752 proposed.y =
static_cast<float>(proposedy);
2753 proposed.z =
static_cast<float>(proposedz);
2879 float frontback = -0.003f - aft;
2880 float updown = -0.0025f;
2881 float leftright = -0.0030f;
2889 float frontback = -0.003f - aft;
2890 float updown = -0.0025f;
2891 float leftright = -0.0030f;
2899 float frontback = -0.003f - aft;
2900 float updown = -0.0025f;
2901 float leftright = -0.0030f;
2915 float frontback = -0.003f - aft;
2916 float updown = -0.0025f;
2917 float leftright = 0.003f;
2925 float frontback = -0.003f - aft;
2926 float updown = -0.0025f;
2927 float leftright = 0.003f;
2935 float frontback = -0.003f - aft;
2936 float updown = -0.0025f;
2937 float leftright = 0.003f;
2965 float updown = -0.0027f;
2978 leftright = -0.0025f;
2982 leftright = 0.0025f;
2989 float frontback = -0.003f - aft;
2997 float frontback = -0.003f - aft;
3005 float frontback = -0.003f - aft;
3016 float frontback = -0.003f - aft;
3024 float frontback = -0.003f - aft;
3032 float frontback = -0.003f - aft;
3043 float frontback = -0.003f - aft;
3051 float frontback = -0.003f - aft;
3059 float frontback = -0.003f - aft;
3096 if (fabsf(gthrust.z) < 1.0f)
3103 else if (lat <= -1.0f)
3123 proposedx = proposed.x; proposedy = proposed.y; proposedz = proposed.z;
3136 proposedx = proposed.x; proposedy = proposed.y; proposedz = proposed.z;
3155 bool collision =
false;
3197 result = source - target;
3201 if (distCgtoCg <= separateBy)
3217 proposedx -=
static_cast<double>(result.x);
3218 proposedy -=
static_cast<double>(result.y);
3219 proposedz -=
static_cast<double>(result.z);
3221 if (-f_temp > 0.001f)
3249 result.x = result.y = result.z = 999.0f;
3261 sprintf_s(
msg,
sizeof msg,
"Major axis with IVR %s, separating %.3f %.3f %.3f dist %f",
playerships[s].IVR, result.x, result.y, result.z, dist);
3283 result = ourComponentPosition - theirComponentPosition;
3285 if (dist < (
playerships[0].componentarray[q].boundsphere +
playerships[s].componentarray[r].boundsphere))
3287 sprintf_s(
msg,
sizeof(
msg),
"Minor axis with IVR %s, separating %.3f %.3f %.3f dist %f",
playerships[s].IVR, result.x, result.y, result.z, dist);
3293 if (separation < 0.0001f)
3297 if (dist < FLT_EPSILON)
3308 proposed -= displacement;
3309 proposedx -=
static_cast<double>(displacement.x);
3310 proposedy -=
static_cast<double>(displacement.y);
3311 proposedz -=
static_cast<double>(displacement.z);
3319 const float theirPenalty = ourweight1 / (ourweight1 + hisweight1);
3320 const float ourPenalty = hisweight1 / (ourweight1 + hisweight1);
3338 const auto exteriorVelocity = -velDiff;
3341 velocityBody, ElapsedTime);
3348 outpacket.
f_x = theirPenaltyVel.x;
3349 outpacket.
f_y = theirPenaltyVel.y;
3350 outpacket.
f_z = theirPenaltyVel.z;
3377 sprintf_s(
msg,
sizeof msg,
"Collided with IVR %s, separating %.3f %.3f %.3f dist %f",
playerships[s].IVR, result.x, result.y, result.z, dist);
3397 float f_tempu, f_tempv, f_tempd;
3403 f_tempu = 1.0f - f_tempu;
3406 f_tempd = roundf(f_tempu * 6656.0f);
3407 rts.
u =
static_cast<short>(floorf(f_tempd / 256.0f));
3408 bump.
u =
static_cast<short>(fmodf(f_tempd, 256.0f));
3410 f_tempd = roundf(f_tempv * 6656.0f);
3411 rts.
v =
static_cast<short>(floorf(f_tempd / 256.0f));
3412 bump.
v =
static_cast<short>(fmodf(f_tempd, 256.0f));
3423 f_tempv = 1.0f - f_tempv;
3426 f_tempd = roundf(f_tempu * 6656.0f);
3427 rts.
u =
static_cast<short>(floorf(f_tempd / 256.0f));
3428 bump.
u =
static_cast<short>(fmodf(f_tempd, 256.0f));
3430 f_tempd = roundf(f_tempv * 6656.0f);
3431 rts.
v =
static_cast<short>(floorf(f_tempd / 256.0f));
3432 bump.
v =
static_cast<short>(fmodf(f_tempd, 256.0f));
3464 float newcityelev, newflorelev;
3486 f_tempu > 0.73857f && f_tempu < 0.76143189f && f_tempv > 0.25f)
3528 if (
f_AGL < newflorelev && newflorelev != 255.0f)
3588 float longitudinalMod = 1.0f - cosf(theta);
3589 float verticalMod = sinf(theta);
3591 auto applyCurbImpact = [&](
const char* direction)
3593 const float verticalVelocityKms = cross.z * verticalMod;
3594 const float verticalDisplacementKm =
3595 (verticalVelocityKms * verticalVelocityKms) / (2.0f *
gravityKmssC);
3597 const float weightRatio =
Clamp(
3602 const float droopTravelKm = loadedSagKm;
3606 const float unabsorbedRatio = verticalDisplacementKm > FLT_EPSILON
3607 ? 1.0f -
RiseMath::Min(1.0f, compliantTravelKm / verticalDisplacementKm)
3609 const float suspensionShare = compliantTravelKm > FLT_EPSILON
3610 ? bumpTravelKm / compliantTravelKm
3614 const float lateralVelocityKms = -cross.x;
3618 -verticalVelocityKms * unabsorbedRatio, -cross.z * longitudinalMod) * ElapsedTime);
3620 char diagnostic[1024];
3621 sprintf_s(diagnostic,
sizeof(diagnostic),
3622 "CURB #%u dir=%s dt=%.5f speed=%.2fkph height=%.1fmm tireRadius=%.1fmm theta=%.2fdeg "
3623 "weight=%.0flb weightRatio=%.3f normalLoad=%.3fG travel=%.1fmm sag=%.1fmm bump=%.1fmm droop=%.1fmm "
3624 "tireCompliance=%.1fmm verticalDisp=%.1fmm unabsorbed=%.3f longMod=%.3f "
3625 "wheelCompression=(%.1f,%.1f,%.1f,%.1f)mm wheelVelocity=(%.3f,%.3f,%.3f,%.3f)mps "
3626 "deltaV=(%+.6f,%+.6f,%+.6f)",
3631 bumpTravelKm * 1000000.0f, droopTravelKm * 1000000.0f,
3633 unabsorbedRatio, longitudinalMod,
3642 lateralVelocityKms * ElapsedTime,
3643 -verticalVelocityKms * unabsorbedRatio * ElapsedTime,
3644 -cross.z * longitudinalMod * ElapsedTime);
3647 sprintf_s(
msg,
sizeof msg,
"X%7.3f Y%7.3f Z%7.3f curb %s",
3654 if ((newcurbelev != 0 ||
citystuff.
curbelev != 0) && fabsf(elevationDiff) > FLT_EPSILON)
3656 sprintf_s(
msg,
sizeof msg,
"Bary U%i V%i RTS U%i V%i Bump U%i V%i newcurb %f oldcurb %f",
newdepthpos.
u,
newdepthpos.
v,
rts.
u,
rts.
v,
bump.
u,
bump.
v, newcurbelev,
citystuff.
curbelev);
3658 sprintf_s(
msg,
sizeof msg,
"-> elevation change %f theta %f longitudinalMod %f verticalMod %f", elevationDiff, theta, longitudinalMod, verticalMod);
3666 if (elevationDiff > FLT_EPSILON)
3668 sprintf_s(
msg,
sizeof(
msg),
"-> Riding up a curb %.6f", elevationDiff);
3674 if (
bump.
u > oldbump.
u && abs(
bump.
u - oldbump.
u) < 128)
3688 applyCurbImpact(
"east");
3690 sprintf_s(
msg,
sizeof msg,
"-> W2E cross.x %f cross.z %f cross.z*rolldiff %f ewmag %f", cross.x, cross.z, cross.z * longitudinalMod, fabsf(f_temp *
UniverseRelativeSpeedKms));
3693 else if (
bump.
u < oldbump.
u && abs(
bump.
u - oldbump.
u) < 128)
3707 applyCurbImpact(
"west");
3709 sprintf_s(
msg,
sizeof msg,
"-> E2W cross.x %f cross.z %f cross.z*skiddiff*rolldiff %f ewmag %f", cross.x, cross.z, cross.z * elevationDiff * longitudinalMod, fabsf(f_temp *
UniverseRelativeSpeedKms));
3713 if (
bump.
v < oldbump.
v && abs(
bump.
v - oldbump.
v) < 128)
3727 applyCurbImpact(
"north");
3729 sprintf_s(
msg,
sizeof msg,
"-> S2N cross.x %f cross.z %f cross.z*skiddiff*rolldiff %f nsmag %f", cross.x, cross.z, cross.z * elevationDiff * longitudinalMod, fabsf(f_temp *
UniverseRelativeSpeedKms));
3732 else if (
bump.
v > oldbump.
v && abs(
bump.
v - oldbump.
v) < 128)
3746 applyCurbImpact(
"south");
3748 sprintf_s(
msg,
sizeof msg,
"-> N2S cross.x %f cross.z %f cross.z*skiddiff*rolldiff %f nsmag %f", cross.x, cross.z, cross.z * elevationDiff * longitudinalMod, fabsf(f_temp *
UniverseRelativeSpeedKms));
3752 else if (elevationDiff < -FLT_EPSILON)
3757 sprintf_s(
msg,
sizeof(
msg),
"-> Riding down a curb %.6f", elevationDiff);
3778 if (buildZoneOrdinal != -1)
3808 sprintf_s(
msg,
sizeof msg,
"Collision calling Undock...");
3868 if (rand() % 2 == 0)
3935 if (fabsf(
playerships[t].tireRotationRadPerS) < 0.852f)
3960 float f_temp = FLT_MAX;
3962 for (
short s = 0; s < 6; s++)
3966 if (f_temp2 < f_temp)
3969 cube =
static_cast<char>(s);
3987 ul.x = -1.0f; ul.y = -1.0f; ul.z = 1.0f;
3988 lr.x = 1.0f; lr.y = -1.0f; lr.z = -1.0f;
3989 ll.x = -1.0f; ll.y = -1.0f; ll.z = -1.0f;
3999 tcp.
u = (short)((ul.x + 1.0f) * 1019.0f); tcp.
v = (short)((ul.z + 1.0f) * 1019.0f);
4005 ul.x = 1.0f; ul.y = -1.0f; ul.z = 1.0f;
4006 lr.x = 1.0f; lr.y = 1.0f; lr.z = -1.0f;
4007 ll.x = 1.0f; ll.y = -1.0f; ll.z = -1.0f;
4018 tcp.
u = (short)((ul.y + 1.0f) * 1019.0f) + 2038; tcp.
v = (short)((ul.z + 1.0f) * 1019.0f);
4024 ul.x = -1.0f; ul.y = 1.0f; ul.z = 1.0f;
4025 lr.x = -1.0f; lr.y = -1.0f; lr.z = -1.0f;
4026 ll.x = -1.0f; ll.y = 1.0f; ll.z = -1.0f;
4037 tcp.
u = (short)((-ul.y + 1.0f) * 1019.0f) - 2038; tcp.
v = (short)((ul.z + 1.0f) * 1019.0f);
4043 ul.x = 1.0f; ul.y = 1.0f; ul.z = 1.0f;
4044 lr.x = -1.0f; lr.y = 1.0f; lr.z = -1.0f;
4045 ll.x = 1.0f; ll.y = 1.0f; ll.z = -1.0f;
4056 tcp.
u = (short)((-ul.x + 1.0f) * 1019.0f) + 4076; tcp.
v = (short)((ul.z + 1.0f) * 1019.0f);
4062 ul.x = -1.0f; ul.y = 1.0f; ul.z = -1.0f;
4063 lr.x = 1.0f; lr.y = -1.0f; lr.z = -1.0f;
4064 ll.x = -1.0f; ll.y = -1.0f; ll.z = -1.0f;
4075 tcp.
u = (short)((ul.x + 1.0f) * 1019.0f);
4076 tcp.
v = (short)((-ul.y + 1.0f) * 1019.0f) - 2038;
4082 ul.x = -1.0f; ul.y = -1.0f; ul.z = 1.0f;
4083 lr.x = 1.0f; lr.y = 1.0f; lr.z = 1.0f;
4084 ll.x = -1.0f; ll.y = 1.0f; ll.z = 1.0f;
4095 tcp.
u = (short)((ul.x + 1.0f) * 1019.0f); tcp.
v = (short)((ul.y + 1.0f) * 1019.0f) + 2038;
4114 if (u == 2038 && v < 0)
4121 else if ((u < 0 || u > 2037) && (v < 0 || v > 2037))
4130 if (v < 0 && u == 2038)
4135 u = (short)(2038 + v);
4139 else if ((u < 2038 || u>4076) && (v < 0 || v>2038))
4144 else if (u == 2038 && v < 0)
4149 else if (u > 2038 && u < 4076 && v < 0)
4156 else if (u >= 2038 && u <= 4076 && v > 2037)
4161 u = 2038 - (vtemp - 2038);
4164 else if (u > 4076 && u < 6114 && v>2037)
4167 v = 4076 - (v - 2038);
4173 if (u >= 0 && (v < 0 || v > 2037))
4178 else if (v < 0 && u >= -2038 && u < 0)
4187 else if (v >= 2038 && u >= -2038 && u <= 0)
4190 v = (short)(2038 - u);
4191 u = (short)(vtemp - 2038);
4202 if ((u < 4076 || u>6114) && (v < 0 || v>2038))
4204 u = 30000; v = 30000;
4206 else if (u == 4076 && v < 0)
4208 u = 4076 + v; v = 0;
4210 else if (u == 6114 && v < 0)
4212 u = 6114 - v - 8152; v = 0;
4214 else if (u > 4076 && u < 6114 && v < 0)
4216 u = (short)abs(u - 6114);
4219 else if (u < 4076 && v == 2038)
4223 else if (u > 6113 && v == 2038)
4225 v = 10190 - u; u = 0;
4227 else if (u >= 4076 && u < 6114 && v >= 2038)
4231 u = (short)abs(u - 6114);
4232 v = 4076 - (v - 2038);
4242 if ((u < 0 || u>2038) && (v < -2038 || v>0))
4244 u = 30000; v = 30000;
4246 else if (u < 0 && v == 0)
4250 else if (u < 1 && v >= -2038 && v < 0)
4256 else if (u > 2038 && v == -2038)
4258 v = u - 2038; u = 4076;
4260 else if (u >= 2038 && v >= -2038 && v <= 0)
4266 else if (u > 0 && u <= 2038 && v <= -2038)
4274 if ((u < 0 || u > 2038) && (v < 2038 || v >= 4076))
4279 else if (u < 0 && v > 2038 && v < 4076)
4282 v = (short)(u + 2038);
4283 u = (short)(2038 - vtemp);
4286 else if (u > 2038 && v >= 2038 && v < 4076)
4290 v = (short)(2038 - (u - 2038));
4294 else if (u == 0 && v >= 4076)
4297 v = (short)(6114 - v);
4299 else if (u > 0 && u <= 2038 && v >= 4076)
4301 u = (short)(2038 - u + 4076);
4302 v = (short)(6114 - v);
4308 tcp.
u = u; tcp.
v = v;
4321 gridtemp.
tcp = temp;
4323 if (temp.
u == 30000 || temp.
v == 30000 || sourcedata.
pri_landform == 255)
4331 gridtemp.
position.x =
static_cast<float>(tcp.
u + t - 31);
4332 gridtemp.
position.y =
static_cast<float>(tcp.
v + s - 31);
4365 sprintf_s(
msg,
sizeof msg,
"Got a pri_landform type %i that we don't recognize at %i %i!", sourcedata.
pri_landform, gridtemp.
tcp.
u, gridtemp.
tcp.
v);
4396 const unsigned char uc_temp =
static_cast<unsigned char>(255.0f -
RandomFloat() * 0.2f);
4400 if (planar.x == 0.0f && planar.y == 0.0f && planar.z == 0.0f)
4403 sprintf_s(
msg,
sizeof msg,
"CalculateSRV found a renderable plot at u%i v%i but couldn't determine CalculatePlanar!", temp.
u, temp.
v);
4409 const float elevation =
static_cast<float>(gridtemp.
elevation) * 0.001f;
4410 const float height = -(
radiusC + elevation);
4426 const float t0 = 0.0f;
4427 const float t1 = 1.0f;
4428 const float t2 = 2.0f;
4430 const float scale0 = ((t - t1) / (t0 - t1)) * ((t - t2) / (t0 - t2));
4431 const float scale1 = ((t - t0) / (t1 - t0)) * ((t - t2) / (t1 - t2));
4432 const float scale2 = ((t - t0) / (t2 - t0)) * ((t - t1) / (t2 - t1));
4439 return newvel0 + newvel1 + newvel2;
4454 if (letter >= 65 && letter <= 90)
4455 return (
long)(letter - 65) * 23;
4460 if (letter >= 48 && letter <= 57)
4461 return (
long)(letter - 20) * 23;
4476 case PlotType::DeoisFinancial: _sopen_s(&depthFile,
"Textures\\Cities\\deoisdepth.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4478 case PlotType::DeoisIndustrial: _sopen_s(&depthFile,
"Textures\\Cities\\deoisdepth1.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4480 case PlotType::DeoisCityCenter: _sopen_s(&depthFile,
"Textures\\Cities\\deoisdepth2.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4482 case PlotType::DeoisTransit: _sopen_s(&depthFile,
"Textures\\Cities\\deoisdepth3.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4484 case PlotType::DeoisPort: _sopen_s(&depthFile,
"Textures\\Cities\\deoisdepth4.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4486 case PlotType::Arcridge: _sopen_s(&depthFile,
"Textures\\Cities\\arcridgedepth.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4488 case PlotType::O4Ruin1: _sopen_s(&depthFile,
"Textures\\Cities\\o4ruindepth1.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4490 case PlotType::O4Ruin2: _sopen_s(&depthFile,
"Textures\\Cities\\o4ruindepth2.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4492 case PlotType::O4Ruin3: _sopen_s(&depthFile,
"Textures\\Cities\\o4ruindepth3.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4494 case PlotType::O4Ruin4: _sopen_s(&depthFile,
"Textures\\Cities\\o4ruindepth4.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4496 case PlotType::NorthPole: _sopen_s(&depthFile,
"Textures\\Cities\\northpoledepth.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4498 case PlotType::Chojeir: _sopen_s(&depthFile,
"Textures\\Cities\\chojeirdepth.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4502 if (depthFile != -2)
4504 if (depthFile == -1)
4506 sprintf_s(
msg,
sizeof(
msg),
"DEPTH Could not find depth file for type %i!",
gridarray[u][v].type);
4509 unsigned char uch_temp;
4512 _lseek(depthFile, k, SEEK_SET);
4513 _read(depthFile, &uch_temp, 1);
4516 return static_cast<float>(uch_temp) *
cityscaleC;
4532 case PlotType::DeoisFinancial: _sopen_s(&floorFile,
"Textures\\Cities\\deoisfloor.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4534 case PlotType::DeoisIndustrial: _sopen_s(&floorFile,
"Textures\\Cities\\deoisfloor1.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4536 case PlotType::DeoisCityCenter: _sopen_s(&floorFile,
"Textures\\Cities\\deoisfloor2.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4538 case PlotType::DeoisTransit: _sopen_s(&floorFile,
"Textures\\Cities\\deoisfloor3.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4540 case PlotType::DeoisPort: _sopen_s(&floorFile,
"Textures\\Cities\\deoisfloor4.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4542 case PlotType::Arcridge: _sopen_s(&floorFile,
"Textures\\Cities\\arcridgefloor.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4544 case PlotType::O4Ruin1: _sopen_s(&floorFile,
"Textures\\Cities\\o4ruinfloor1.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4546 case PlotType::O4Ruin2: _sopen_s(&floorFile,
"Textures\\Cities\\o4ruinfloor2.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4548 case PlotType::O4Ruin3: _sopen_s(&floorFile,
"Textures\\Cities\\o4ruinfloor3.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4550 case PlotType::O4Ruin4: _sopen_s(&floorFile,
"Textures\\Cities\\o4ruinfloor4.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4552 case PlotType::NorthPole: _sopen_s(&floorFile,
"Textures\\Cities\\northpolefloor.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4554 case PlotType::Chojeir: _sopen_s(&floorFile,
"Textures\\Cities\\chojeirfloor.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
4558 if (floorFile != -2)
4560 if (floorFile == -1)
4562 sprintf_s(
msg,
sizeof msg,
"Could not find floor file %i!",
gridarray[u][v].type);
4565 unsigned char uch_temp;
4568 _lseek(floorFile, k, SEEK_SET);
4569 _read(floorFile, &uch_temp, 1);
4571 return static_cast<float>(uch_temp) *
cityscaleC;
4586 logger->
Log(
"Tried to undock but was not finished docking...");
4601 outpacket.
f_y = 0.0f;
4602 outpacket.
f_z = 0.0f;
4603 outpacket.
f_w = 0.0f;
4610 for (
short t = 0; t < DOCKRAND; t++)
4616 command.
name =
"AuralAllMooringsCleared";
4617 command.
delay = 3.0f;
4624 logger->
Log(
"Tried to undock but was not not docked...");
4637 float hf = (hue - floorf(hue)) * 6.0f;
4638 int i =
static_cast<int>(floorf(hf));
4640 float p = v * (1.0f - s);
4641 float q = v * (1.0f - s * f);
4642 float t = v * (1.0f - s * (1.0f - f));
4666 tempcenter.x = -
static_cast<float>(proposedx +
terprecisionx);
4667 tempcenter.y = -
static_cast<float>(proposedy +
terprecisiony);
4668 tempcenter.z = -
static_cast<float>(proposedz +
terprecisionz);
4670 negposition = proposed;
4673 tempcenter -= negposition * 10.0f;
4676 float pu = -1.0f, pv = -1.0f, dist = -1.0f;
4694 strcpy_s(
area, 3,
"1a");
4697 else if (
RiseMath::IntersectTri(&ins23131, &ins13131, &ins03131, &tempcenter, &negposition, &pu, &pv, &dist))
4702 strcpy_s(
area, 3,
"1b");
4709 else if (
RiseMath::IntersectTri(&ins03131, &grid3231, &ins23131, &tempcenter, &negposition, &pu, &pv, &dist))
4714 strcpy_s(
area, 3,
"2a");
4718 else if (
RiseMath::IntersectTri(&ins13231, &ins23131, &grid3231, &tempcenter, &negposition, &pu, &pv, &dist))
4723 strcpy_s(
area, 3,
"2b");
4731 else if (
RiseMath::IntersectTri(&ins13131, &ins23131, &grid3132, &tempcenter, &negposition, &pu, &pv, &dist))
4736 strcpy_s(
area, 3,
"4a");
4740 else if (
RiseMath::IntersectTri(&ins03132, &grid3132, &ins23131, &tempcenter, &negposition, &pu, &pv, &dist))
4745 strcpy_s(
area, 3,
"4b");
4753 else if (
RiseMath::IntersectTri(&ins23131, &ins13231, &ins03132, &tempcenter, &negposition, &pu, &pv, &dist))
4758 strcpy_s(
area, 3,
"3a");
4763 else if (
RiseMath::IntersectTri(&grid3232, &ins03132, &ins13231, &tempcenter, &negposition, &pu, &pv, &dist))
4768 strcpy_s(
area, 3,
"3b");
4778 sprintf_s(
msg,
sizeof msg,
"*** CalculateAGLd() yielded no result, returning %.3f", dist - 1.0f);
4784 if (makeleveler && dist != -1.0f)
4798 if (pu != -1.0f && pv != -1.0f)
4810 return dist - 10.0f;
4818 if (u >= -2038 && u < 0 && v >= 0 && v < 2038)
4820 planar.x = -2038.0f;
4821 planar.y = -2.0f * (float)(u + 1019);
4822 planar.z = 2.0f * (float)(v - 1019);
4824 else if (u >= 0 && u < 2038 && v >= 0 && v < 2038)
4826 planar.x = 2.0f * (float)(u - 1019);
4827 planar.y = -2038.0f;
4828 planar.z = 2.0f * (float)(v - 1019);
4830 else if (u >= 2038 && u < 4076 && v >= 0 && v < 2038)
4833 planar.y = 2.0f * (float)(u - 3057);
4834 planar.z = 2.0f * (float)(v - 1019);
4836 else if (u >= 4076 && u < 6114 && v >= 0 && v < 2038)
4838 planar.x = -2.0f * (float)(u - 5095);
4840 planar.z = 2.0f * (float)(v - 1019);
4842 else if (u > 0 && u < 2038 && v >= -2038 && v <= 0)
4844 planar.x = 2.0f * (float)(u - 1019);
4845 planar.y = -2.0f * (float)(v + 1019);
4846 planar.z = -2038.0f;
4848 else if (u >= 0 && u <= 2038 && v >= 2038 && v <= 4076)
4850 planar.x = 2.0f * (float)(u - 1019);
4851 planar.y = 2.0f * (float)(v - 3057);
4856 sprintf_s(
msg,
sizeof msg,
"u%i v%i was not on any face...", u, v);
4858 planar.x = planar.y = planar.z = 0.0f;
4939 command.
name =
"AuralInTransit";
5011 command.
name = newStatus ?
"AuralReverseThrust" :
"AuralForwardThrust";
5046 outpacket.
type = 23;
5047 outpacket.
f_x = 0.0f;
5048 outpacket.
f_y = 0.0f;
5049 outpacket.
f_z = 0.0f;
5050 outpacket.
f_w = 0.0f;
5194 const HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, wcslen(str) * 2 + 2);
5195 memcpy(GlobalLock(hMem), str, wcslen(str) * 2 + 2);
5198 OpenClipboard(
nullptr);
5200 SetClipboardData(CF_UNICODETEXT, hMem);
5508 !entryBlock.empty())
5606 outpacket.
type = 18;
5607 outpacket.
f_x = 1.0f;
5608 outpacket.
f_y = 0.0f;
5609 outpacket.
f_z = 0.0f;
5611 outpacket.
f_w =
static_cast<float>(playership.
vehicleId);
5631 outpacket.
type = 17;
5632 outpacket.
f_x = 0.0f;
5633 outpacket.
f_y = 0.0f;
5634 outpacket.
f_z = 0.0f;
5661 outpacket.
type = 17;
5662 outpacket.
f_x = 1.0f;
5663 outpacket.
f_y = 0.0f;
5664 outpacket.
f_z = 0.0f;
5948 command.
name =
"AcknowledgeAllMessages";
6167 outpacket.
type = 36;
6168 outpacket.
f_x = 0.0f;
6169 outpacket.
f_y = 0.0f;
6170 outpacket.
f_z = 0.0f;
6172 outpacket.
f_w =
static_cast<float>(network_objects.
vehicleId);
6179 strcpy_s(modeAC.
IVR, 6, network_objects.
IVR);
6188 modeAC.
type = network_objects.
type;
6449 if (!std::isfinite(distanceKm) || distanceKm<0 || distanceKm>=64)
return;
6451 if(!path.count)
return;
6467 float boltHue = ((220.0f +
RandomFloat() * 40.0f) / 360.0f);
6474 for (
int i = 0; i < path.count; i++)
6476 const auto& segment=path.segments[i];
6480 if(!std::isfinite(distanceKm) || distanceKm>=64)
continue;
6483 float volume = sqrtf(1.0f - distanceKm/64.f) * intensity;
6489 if (!testStrike && segment.groundContact && distanceKm < 2.0f)
6493 if (distanceKm < 2.0f)
6501 else if (distanceKm < 20.0f)
6509 else if (distanceKm < 50.0f)
6519 sprintf_s(
msg,
sizeof(
msg),
"Lightning channel %i/%i: distance %.3f km intensity %.3f delay %.3f s", i+1, path.count, distanceKm, intensity, delaySeconds);
6534 sprintf_s(
msg,
sizeof(
msg),
"playerships[%i].componentarray", t);
6550 _sopen_s(&handle,
"meshes\\C-98 MuVER-construction.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6561 _sopen_s(&handle,
"meshes\\dihv.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6572 _sopen_s(&handle,
"meshes\\e-10.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6583 _sopen_s(&handle,
"meshes\\p-13.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6594 _sopen_s(&handle,
"meshes\\T-8 Wanderer.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6605 _sopen_s(&handle,
"meshes\\C-2 Dasher.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6616 _sopen_s(&handle,
"meshes\\T-120 Steerhead-stock.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6627 _sopen_s(&handle,
"meshes\\E-11.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6638 _sopen_s(&handle,
"meshes\\pax-exterior-hex.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6649 _sopen_s(&handle,
"meshes\\cargo-standard.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6660 _sopen_s(&handle,
"meshes\\fuel-standard-ext.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6671 _sopen_s(&handle,
"meshes\\cargo-toploader.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6682 _sopen_s(&handle,
"meshes\\munitions-standard-ext.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6694 _sopen_s(&handle,
"meshes\\C-2A Dasher.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6705 _sopen_s(&handle,
"meshes\\T-27 Mammoth.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6716 _sopen_s(&handle,
"meshes\\BeishtKione.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6727 _sopen_s(&handle,
"meshes\\manx-hex.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6738 _sopen_s(&handle,
"meshes\\T-19 Stratomaster.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6749 _sopen_s(&handle,
"meshes\\Holidays\\Spacesuit-Morholt-posed.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6760 _sopen_s(&handle,
"meshes\\2007 T-120 EXT.dix", _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
6796 sprintf_s(
msg,
sizeof(
msg),
"InitApp() failed to load DIX for type %i!",
playerships[t].type);
6801 _lseek(handle, 0, SEEK_SET);
6805 _read(handle, &version, 4);
6807 sprintf_s(
msg,
sizeof msg,
"playerships[%i].componentarray", t);
6816 sprintf_s(
msg,
sizeof(
msg),
"LoadVehicleProfile() Failed to initialize %i component(s) for slot %i, type %i",
playerships[t].components, t,
playerships[t].type);
6823 sprintf_s(
msg,
sizeof(
msg),
"LoadVehicleProfile() Initialized %i component(s) for slot %i, type %i",
playerships[t].components, t,
playerships[t].type);
6831 _lseek(handle, (
long)s * 100L + 99L, SEEK_SET);
6832 _read(handle, &i_temp, 2);
6834 _read(handle, &i_temp, 2);
6836 _read(handle, &
playerships[t].componentarray[s].nominalxyz, 12);
6837 _read(handle, &
playerships[t].componentarray[s].nominalypr, 12);
6838 _read(handle, &
playerships[t].componentarray[s].boundsphere, 4);
6839 _read(handle, &
playerships[t].componentarray[s].extendby, 12);
6840 _read(handle, &
playerships[t].componentarray[s].texture, 2);
6843 sprintf_s(
msg,
sizeof(
msg),
"Type %i Component %i Texture %i out-of-bounds", t, s,
playerships[t].componentarray[s].texture);
6846 _read(handle, &
playerships[t].componentarray[s].nominalCG, 12);
6847 _read(handle, &
playerships[t].componentarray[s].type, 1);
6848 _read(handle, &
playerships[t].componentarray[s].speedExtend, 4);
6849 _read(handle, &
playerships[t].componentarray[s].hingeaxis, 12);
6850 _read(handle, &
playerships[t].componentarray[s].hingeCG, 12);
6851 _read(handle, &
playerships[t].componentarray[s].hingeextent, 4);
6852 _read(handle, &
playerships[t].componentarray[s].attachto, 2);
6854 if (version >= 2.44f)
6856 _read(handle, &
playerships[t].componentarray[s].useLightMap, 1);
6857 _read(handle, &
playerships[t].componentarray[s].speedRetract, 4);
6871 sprintf_s(
msg,
sizeof(
msg),
"LoadVehicleProfile() finished component list");
6938 logger->
Log(
"LoadVehicleProfile() done!");
@ DockingFullAndCompleteStop
@ VehicleTooLargeForVehicle
@ FirstSelectVehicleOrContainer
@ VehicleOrContainerOnBoard
#define SAFE_DELETE_ARRAY(value)
#define V_RETURN(expression)
#define SAFE_RELEASE(value)
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
float Lerp(float val1, float val2, float lerp)
constexpr auto Clamp(T1 val, T2 min, T3 max)
const RiseMath::Vector3 eastpoleI
const RiseMath::Vector3 northpoleK
const RiseMath::Vector3 meridianJ
const RiseMath::Vector3 centerC
#define depthFloorResolutionC
@ ADMIN_STORECAMERA_CLIPBOARD
@ THRUST_MINUS10_TVMMINUS
@ ADMIN_RELOADVEHICLEPROFILE
@ THRUSTAUGMENTATION_CYCLE
RiseMath::Vector3 DebugDepth
float RollAttitudeRadians
float MapScaleInnerRingKm
float PitchAttitudeRadians
float TrailingEdgeFlapsPosition
float ComputedTrimTargetDegrees
float LandingGearExtended
float EngineThrustLever[MAX_ENGINES]
float IndicatedAirspeedKms
double SimulatorTimeOffset
float LeadingEdgeFlapsPosition
float FlightSpoilerPositionScalar
void AddCommand(const Command &command, bool onlyOne)
float GroundSpoilerPositionScalar
bool ThrustReverserCommand[MAX_ENGINES]
std::vector< Command > commandStream
HRESULT Initialize(Rendering::RenderDevice *device)
const std::string & InitializationStatus() const
InputConfig inputConfigSteer
InputConfig inputConfigRoll
InputConfig inputConfigYaw
InputConfig inputConfigPitchTrim
std::string TogglePageReverse(std::string screenName)
std::string TogglePage(std::string screenName)
void ChangePage(std::string screenName, std::string pageName)
HRESULT Initialize(Rendering::RenderDevice *device)
std::unique_ptr< Bus > bus
std::unique_ptr< HMI > GUI
std::unique_ptr< Sound > sound
std::unique_ptr< Networking > networking
void AddTrackedResource(const char *name, Rendering::ResourcePool pool=Rendering::ResourcePool::Managed)
void UpdateTrackedResource(const char *name, int status)
void FlightDirectorOn() const
std::unique_ptr< Displays > displays
void RepairVehicle() const
std::unique_ptr< Viewscreen > viewscreen
bool TurnOffDOR(bool preserveGuidance=false) const
void ChangeGear(char newGear, bool isInit=false) const
std::unique_ptr< Logger > logger
void AutopilotDisconnect() const
SPlayerData player[MAX_ONLINEPLAYERS]
InformationDialog * informationDialog
char GetAlignment(int ownerId) const
void Log(const char *msg, Level level=Info, int errorCode=0)
void AddToCallStack(const char *msg)
void SendToServer(void *pData, DWORD dwSize, bool bGuaranteed, PacketOrdering order=ORDERING_NONE) const
void RequestVerbiage(int helpId) const
void SendEvent(EventType eventType, float extent=0.0f) const
HRESULT Initialize(ID3D11Device *device, const std::filesystem::path &directory={})
HRESULT Initialize(ID3D11Device *device, const std::filesystem::path &directory={})
HRESULT Lock(UINT offset, UINT bytes, void **output, DWORD flags)
HRESULT SetMaterial(const Material *value)
HRESULT LightEnable(DWORD index, BOOL enabled)
HRESULT SetLight(DWORD index, const Light *value)
HRESULT CreateIndexBuffer(UINT bytes, DWORD usage, ImageFormat format, ResourcePool pool, RenderBuffer **result, void *shared)
HRESULT SetRenderState(DWORD state, DWORD value)
HRESULT CreateQuery(UINT type, RenderQuery **result)
HRESULT CreateVertexBuffer(UINT bytes, DWORD usage, DWORD format, ResourcePool pool, RenderBuffer **result, void *shared)
HRESULT SetTextureStageState(DWORD stage, DWORD state, DWORD value)
HRESULT GetSurfaceLevel(UINT level, RenderSurface **result)
RiseMath::Vector3 position
void AddDelayedSound(SOUNDS soundEnum, float delay, float volume=1.0f, float freq=1.0f, bool fromOutside=false)
void Stop(SOUNDS soundEnum) const
void PlayCabinAnnouncement(SOUNDS sound_enum)
float Play(SOUNDS soundEnum, float volume=1.0f)
void PlayEx(SOUNDS soundEnum, bool loop, float volume=1.0f, float frequencyMod=1.0f, float pan=0.0f, bool restart=true, bool fromOutside=false, bool partOfHull=false)
Rendering::RenderFont * m_pFontLicense
Rendering::RenderTexture * m_pddsShipTexture[shiptextureC]
Rendering::RenderQuery * m_pNightVisionRangeQuery
Rendering::ProceduralLightning11 proceduralLightning
RiseMath::Vector3 position
float suspensionNormalLoadG
Rendering::RenderTexture * m_pddsHullDynamicTexture[MAX_SCAN]
Rendering::RenderBuffer * m_avInstrument
Rendering::RenderTexture * m_pddsHeart[heartanimateC]
void ShowCloudFallbackWarning(HWND owner) const
Rendering::RenderTexture * m_pddsFlame
Rendering::RenderTexture * m_pddsFirework2[firework2C]
void Movement(short t, float ElapsedTime)
std::unique_ptr< renderer > ptrRenderer
RiseMath::Matrix matrixProjSim
std::unique_ptr< keyboard > ptrKeyboard
Rendering::RenderTexture * m_pddsSinker[weaponanimateC]
float CheckFloorMap(VECTOR2SHORT newdepthpos, short u, short v)
Rendering::RenderBuffer * m_avStaticStars
Rendering::RenderBuffer * m_avCone
Rendering::RenderBuffer * m_avSkyDome
static constexpr UINT CloudFallbackWarningMessage
CloudVolumeRenderer cloudVolume
Rendering::RenderToTexture * m_pHullRender2Surface
Rendering::Material restore
void DamageLandingLight(unsigned lamp, float clearanceKm, float closingMps, const char *cause)
Rendering::RenderTexture * m_pddsNamePlate
Rendering::RenderTexture * m_pddsFuelIcon
Rendering::RenderTexture * m_pddsBinoculars
Rendering::RenderTexture * m_pddsShipLights[shiptextureC]
RiseMath::Matrix matrixProjCock
bool m_nightVisionRangefinderActive
Rendering::RenderBuffer * m_avLocalGrid
Rendering::RenderBuffer * m_aiCloudGrid
Rendering::RenderTexture * m_pddsWeapon[weaponanimateC]
RiseMath::Vector3 UniverseRelativeVelocityKms
Rendering::RenderTexture * m_pddsDIHV[dihvanimateC]
void RunBindingFunction(BindingEnum function, bool repeating)
bool cloudFallbackWarningShown
void ApplyCollisionImpulse(const RiseMath::Vector3 &impulseKms)
Rendering::RenderQuery * m_pLightSunVizQuery
RiseMath::Vector3 LandingLightImpactVelocity(unsigned lamp, const RiseMath::Vector3 &velocityBody) const
Rendering::RenderTexture * m_pddsDockTexture[docktextureC]
RiseMath::Vector3 QuadraticVectorInterpolation(RiseMath::Vector3 *vel0, RiseMath::Vector3 *vel1, RiseMath::Vector3 *vel2, float t) const
void OnDestroyDevice(bool preserveModels=false)
Rendering::RenderToTexture * m_pRenderToSurface
float GetAverageSuspensionBumpTravelKm() const
Rendering::RenderBuffer * m_avRainDrops
std::array< LandingLights::Light, LandingLights::MaxLights > landingLights
Rendering::RenderTexture * m_pddsMarston1
RiseMath::Vector3 rainarray[MAX_RAINDROPS]
Rendering::RenderTexture * m_pddsSinkerX
RiseMath::Vector3 gravityacc
Rendering::RenderTexture * m_pddsInterlace[2]
Sani GetAni(float f_time, unsigned char ani) const
std::unique_ptr< waypoints > ptrWaypoints
void DamageLandingLightsAgainstSphere(const RiseMath::Vector3 ¢erBody, float radiusKm, const RiseMath::Vector3 &velocityBody, float seconds)
RiseMath::Vector3 leveler
static bool CheckPlotRoads(float f_tempu, float f_tempv)
Rendering::RenderTexture * m_pddsCloudDetailBelow
Rendering::RenderTexture * m_pddsAtmosphere
Rendering::RenderTexture * m_pddsNightVisionArrow
ReentryEnvelope::State reentryState
void SetRainProtection(bool enabled)
std::unique_ptr< propulsion > ptrPropulsion
Rendering::RenderTexture * m_pddsWaterNormal
Rendering::RenderTexture * m_pddsWorld2a1
Rendering::RenderTexture * m_pddsCloudDetailAbove
bool m_bDeviceSupportsVizQuery
HRESULT OnCreateDevice(Rendering::RenderDevice *pd3dDevice)
int curbDiagnosticFramesRemaining
RiseMath::Vector3 reentryWindward
Rendering::RenderTexture * m_pddsCityTexture[citytextureC]
std::unique_ptr< weather > ptrWeather
Rendering::RenderBuffer * m_avRunningLights
std::vector< SCamera > cameras
unsigned int curbDiagnosticSequence
RiseMath::Vector3 posnorml
std::unique_ptr< grid > ptrGrid
Rendering::RenderTexture * m_pddsGVCompass
unsigned short causearray
void SetProjectionMatrices()
Rendering::RenderTexture * m_pddsNightVision
Rendering::RenderTexture * m_pddsStarTexture
Rendering::RenderTexture * m_pddsElmo[elmoAnimateC]
std::array< SuspensionWheelState, 4 > suspensionWheels
Rendering::RenderTexture * m_pddsBinocularsCompass
void ApplyEnvironmentMap()
std::vector< std::string > sofTracking
void LoadVehicleProfile(short t)
Rendering::Light sunlight
static RiseMath::Color HSVtoRGB(float hue, float s, float v)
Converts HSV in [0…1] to RGB in [0…1].
Rendering::RenderTexture * m_pddsLetters
bool AssertTelemetry(const char *location, short id)
void LogCurbDiagnostic(const char *text)
Rendering::RenderFont * m_pFontHull
Rendering::RenderTexture * m_pddsNightVisionCompass
float CalculateAGLd(RiseMath::Vector3 terpos, double terprecisionx, double terprecisiony, double terprecisionz, double proposedx, double proposedy, double proposedz, RiseMath::Vector3 proposed, bool makeleveler)
std::unique_ptr< instruments > ptrInstruments
Rendering::RenderBuffer * m_avSkyRing
Rendering::RenderTexture * m_pddsRunwayEdgeLight1
Rendering::AdDiagnostics11 adDiagnostics
Rendering::RenderTexture * m_pddsRoad
CityCampaignLogos cityCampaignLogos
float UniverseRelativeSpeedKms
Rendering::RenderTexture * m_pddsGVBackground
Rendering::RenderTexture * m_pddsRTSLights[RTStextureC]
VECTOR2SHORT CalculateCGC(RiseMath::Vector3 position, char cube) const
Rendering::RenderSprite * m_spriteVector
Rendering::RenderTexture * m_pddsCockpitTexture[cockpittextureC]
Rendering::RenderTexture * m_pddsCityLights[citytextureC]
float CalculateAGL(short u, short v, RiseMath::Vector3 position, bool makeleveler)
Rendering::RenderTexture * m_pddsLandform[landformtextureC]
void DamageLandingLights(const RiseMath::Vector3 &surfaceNormalBody, float planeDistanceKm, const RiseMath::Vector3 &impactVelocityBody, const char *cause)
unsigned int curbDiagnosticFrame
static RiseMath::Vector3 CalculateBarycentric(RiseMath::Vector3 *position, RiseMath::Vector3 *gthrust, float *radius)
Rendering::RenderBuffer * m_avBillboardVertices
VECTOR2SHORT CalculateWrap(short u, short v, char cube, char *rotate) const
void QueueCloudFallbackWarning() const
Rendering::RenderTexture * m_pddsGVDialSmall
std::unique_ptr< buildings > ptrBuildings
long FontOffset(char letter) const
Rendering::RenderTexture * m_pddsRTSTexture[RTStextureC]
Rendering::RenderTexture * m_pddsCockpitLights[cockpittextureC]
void ApplySuspensionImpact(float absorbedVelocityKms)
Rendering::RenderBuffer * m_avScreen
RiseMath::Vector3 cloudpos
RiseMath::Vector3 sumofforces
std::vector< Rendering::RenderTexture * > m_pddsLogos
Rendering::RenderTexture * m_pddsGVDirection
Rendering::RenderTexture * m_pddsSunglasses
LOCALGRID2 CalculateSRV(short t, short s, VECTOR2SHORT tcp, char cube, SRenderVertex sourcedata)
CollisionDamage::StructuralEpisode crashDamageEpisode
RiseMath::Vector3 CalculatePlanar(short u, short v)
Rendering::RenderBuffer * m_avCloudGrid
std::unique_ptr< cockpit > ptrCockpit
bool m_nightVisionRangeQueryPending
bool cloudFallbackWarningPending
float CheckDepthMap(VECTOR2SHORT newdepthpos, short u, short v)
Rendering::RenderSurface * m_pddsDynamicSurface
s_polygon_extras2 polyextras2
RiseMath::Vector3 gravityvec
void TriggerBCLLightningAt(const RiseMath::Vector3 &ground, const RiseMath::Vector3 &cloud, float distanceKm, int seed, int chainedBolts, bool testStrike=false) const
void UpdateLandingLights(double seconds)
std::unique_ptr< joystick > ptrJoystick
Rendering::RenderTexture * m_pddsBlastX
WindshieldRainRenderer windshieldRain
Rendering::RenderSurface * m_pddsProjectionSurface
char CalculateCube(RiseMath::Vector3 position) const
Rendering::RenderTexture * m_pddsFirework1[firework1C]
std::unique_ptr< FreeTrack > ptrFreeTrack
HRESULT OnResetDevice(Rendering::RenderDevice *pd3dDevice, const Rendering::SurfaceDescription *pBackBufferSurfaceDesc)
std::unique_ptr< weapon > ptrWeapon
Rendering::RenderTexture * m_pddsIntersection
Rendering::RenderTexture * m_pddsCracked
Rendering::RenderTexture * m_pddsCloudBaseMap
Rendering::RenderTexture * m_pddsHolidayTexture
float m_nightVisionRangeKm
ExteriorRainRenderer exteriorRainRenderer
Rendering::RenderTexture * m_pddsProjectionTexture
CollisionDamage::Episode controlJoltEpisode
Rendering::RenderTexture * m_pddsBinocularsArrow
Rendering::RenderTexture * m_pddsTransition[transitiontextureC]
void ClearCollisionEffects()
Rendering::RenderTexture * m_pddsSunTexture
Rendering::RenderToTexture * m_pRenderToSurfaceNextGen
RiseMath::Matrix matrixProj
Rendering::RenderTexture * m_pddsLightsCruiseIcons
float ProbeBoundSphere(RiseMath::Vector3 *position, const RiseMath::Vector3 *Xsunlight) const
Rendering::RenderTexture * m_pddsAOA[3]
Rendering::RenderTexture * m_pddsFirework3[firework3C]
Rendering::RenderFont * m_pFontNamePlate
RiseMath::Vector3 structuralImpactImpulse
Rendering::RenderTexture * m_pddsFuzerX
Rendering::ReentryEnvelope11 reentryRenderer
Rendering::RenderFont * m_pFont
Rendering::RenderTexture * m_pddsDynamicTexture
Rendering::RenderTexture * m_pddsDockLights[docktextureC]
void TriggerBCLLightning(int u, int v, float distanceKm, int seed, int chainedBolts) const
static bool CheckLayout(unsigned i, LOCALGRID2 localgrid2)
void BuildCurbs(VECTOR2SHORT rts)
void DamageLandingLightContacts(const RiseMath::Vector3 &velocity, float seconds) const
float CheckRtsBumpMap(VECTOR2SHORT rts, VECTOR2SHORT bump, short u, short v)
bool CheckCollision(short buildZoneOrdinal, RiseMath::Vector3 position, RiseMath::Vector3 velocity, float bound, float ElapsedTime, RiseMath::Vector3 *cross) const
HRESULT OnResetDevice(Rendering::RenderDevice *pd3dDevice) const
void CacheEngineSounds(bool useExteriorModel) const
void OnLostDevice() const
void RemoveBuildZone(short ordinal) const
void OnResetDevice(Rendering::RenderDevice *pd3dDevice, const Rendering::SurfaceDescription *pBackBufferSurfaceDesc)
void OnCreateDevice(Rendering::RenderDevice *pd3dDevice)
float GetTotalThrust() const
void InsertUpdateModeAC(USHORT vehicleId, SmodeAC modeAC)
void ClearChildren(unsigned short parentId)
void EnergyWeaponImpact()
void FireWeapon(unsigned char bay) const
float GetCloudCeilingMslKm() const
FIREWORKS fireworks[fireworksC]
s_network_objects playerships[MAX_SCAN]
RiseMath::Vector3 dockMarker
RiseMath::Vector3 insidearray[63][63][3]
s_universe_object allobjects[maxstarC]
BATCHINDEX2 drawlist[drawlistC]
unsigned char cloudBaseObjC
Sani aniarray[MAX_ANI][MAX_STEPS]
LIGHTNINGBELOW lightningbelow
s_polygon_object polyobjects[maxpolyC]
LOCALGRID2 gridarray[64][64]
#define oneOvergForceKmssC
#define RISE_FVF_INSTRUMENT
#define RISE_FVF_NONORMAL
#define RISE_FVF_LOCALGRID
#define RISE_FVF_RAINDROP
#define RISE_FVF_STATICSTARS
#define transitiontextureC
auto NextVertical(typename Afcs::VerticalModes current, bool onGround, double horizontal, double vertical)
double Capture(double horizontal, double vertical)
float Distance(const Vector3 &a, const Vector3 &b)
Light Configure(Light light, unsigned char type, const RiseMath::Matrix &modelBase)
unsigned FromModel(const Effects &effects, std::array< Light, MaxLights > &lights)
constexpr unsigned MaxLights
constexpr unsigned FogVertexCount
void FogMesh(const Light &light, Vertex *output, bool spill)
const char * BodySide(float x)
Path Build(Vector3 ground, Vector3 cloud, uint32_t seed, int chains, float cloudTopRadius)
std::wstring EntryEngagementBlock(const Snapshot &s)
Mode Objective(const Request &r, TargetKind target)
bool EntryGearRefusal(const BusState &data)
bool AscentSelected(const BusState &data)
Command EntryGearCallout(const BusState &data, int vehicle)
bool ManualAttitudeDisconnect(const Guidance &g)
constexpr uint32_t DYNAMIC
constexpr uint32_t POINTS
constexpr uint32_t RENDERTARGET
constexpr uint32_t WRITEONLY
constexpr uint32_t LINEAR
constexpr uint32_t DIRECTIONAL
constexpr uint32_t COLORWRITEENABLE
constexpr uint32_t MULTISAMPLEANTIALIAS
constexpr uint32_t POINTSPRITEENABLE
constexpr uint32_t STENCILENABLE
constexpr uint32_t RANGEFOGENABLE
constexpr uint32_t NORMALIZENORMALS
constexpr uint32_t FOGVERTEXMODE
constexpr uint32_t ZENABLE
constexpr uint32_t DIFFUSE
constexpr uint32_t COLORARG2
HRESULT CreateRenderToSurface(RenderDevice *owner, UINT width, UINT height, ImageFormat format, BOOL depth, ImageFormat depthFormat, RenderToTexture **result)
constexpr PackedColor ColorRGB(unsigned r, unsigned g, unsigned b)
HRESULT CreateFontW(RenderDevice *owner, INT height, UINT width, UINT weight, UINT mipLevels, BOOL italic, DWORD charset, DWORD precision, DWORD quality, DWORD pitch, const wchar_t *face, RenderFont **result)
HRESULT CreateSprite(RenderDevice *owner, RenderSprite **result)
HRESULT SaveTextureToFile(const wchar_t *path, ImageFile format, RenderTexture *texture, const void *)
const wchar_t * ErrorString(HRESULT code)
const SurfaceDescription * ClientBackBufferDescription()
const wchar_t * ClientDeviceStats()
HRESULT CreateTexture(RenderDevice *owner, UINT width, UINT height, UINT levels, DWORD usage, ImageFormat format, ResourcePool pool, RenderTexture **result)
float Vec3Length(const Vector3 *a)
Vector3 * Vec3Cross(Vector3 *out, const Vector3 *a, const Vector3 *b)
constexpr auto Min(A first, B second)
bool IntersectTri(const Vector3 *a, const Vector3 *b, const Vector3 *c, const Vector3 *origin, const Vector3 *direction, float *u, float *v, float *distance)
Vector3 * Vec3TransformCoord(Vector3 *out, const Vector3 *a, const Matrix *m)
Vector3 * Vec3Add(Vector3 *out, const Vector3 *a, const Vector3 *b)
Plane * PlaneFromPoints(Plane *out, const Vector3 *a, const Vector3 *b, const Vector3 *c)
Matrix * MatrixRotationX(Matrix *out, float value)
Quaternion * QuaternionMultiply(Quaternion *out, const Quaternion *a, const Quaternion *b)
Matrix * MatrixMultiply(Matrix *out, const Matrix *a, const Matrix *b)
Matrix * MatrixRotationQuaternion(Matrix *out, const Quaternion *q)
Quaternion * QuaternionNormalize(Quaternion *out, const Quaternion *q)
Vector3 * Vec3Lerp(Vector3 *out, const Vector3 *a, const Vector3 *b, float t)
float Vec3LengthSq(const Vector3 *a)
Vector3 * Vec3Subtract(Vector3 *out, const Vector3 *a, const Vector3 *b)
Quaternion * QuaternionRotationYawPitchRoll(Quaternion *out, float yaw, float pitch, float roll)
Vector3 * Vec3TransformNormal(Vector3 *out, const Vector3 *a, const Matrix *m)
Matrix * MatrixRotationY(Matrix *out, float value)
Matrix * MatrixInverse(Matrix *out, float *determinant, const Matrix *a)
Matrix * MatrixPerspectiveRH(Matrix *out, float width, float height, float nearZ, float farZ)
Matrix * MatrixIdentity(Matrix *out)
Quaternion * QuaternionIdentity(Quaternion *out)
float Vec3Dot(const Vector3 *a, const Vector3 *b)
Matrix * MatrixScaling(Matrix *out, float x, float y, float z)
Vector3 * Vec3Normalize(Vector3 *out, const Vector3 *a)
Vector3 * Vec3Scale(Vector3 *out, const Vector3 *a, float scale)
Matrix * MatrixRotationZ(Matrix *out, float value)
constexpr auto Max(A first, B second)
Matrix * MatrixTranslation(Matrix *out, float x, float y, float z)
Vector3 * PlaneIntersectLine(Vector3 *out, const Plane *plane, const Vector3 *first, const Vector3 *second)
constexpr unsigned Segments
unsigned short startindex
float DesiredPitchRadians
float DesiredHeadingRadians
enum Bus::Afcs::LateralModes CurrentLateralMode
float DesiredCourseRadians
float DesiredClosingSpeed
enum Bus::Afcs::VerticalModes StandbyVerticalMode
enum Bus::Afcs::LateralModes StandbyLateralMode
enum Bus::Afcs::VerticalModes CurrentVerticalMode
unsigned char sec_landform
RiseMath::Vector3 cloudpos
unsigned char pri_landform
unsigned char sec_transition
RiseMath::Vector3 position
unsigned char pri_transition
unsigned char ter_landform
float Sphere(const RiseMath::Vector3 ¢er, float radiusKm) const
RiseMath::Vector3 velocity
double SegmentStart(int index) const
void Start(uint32_t packetSeed, const Path &geometry)
unsigned char pri_transition
unsigned char ter_landform
unsigned char pri_landform
unsigned char sec_landform
unsigned char sec_transition
RiseMath::Vector3 ypr[16]
short scanDisplayVesselLimit
unsigned short components
std::vector< FlapSetting > flapSettings
int landingDamageVehicleId
std::array< LandingLights::ImpactCondition, LandingLights::MaxLights > landingLightImpact
std::array< LandingLights::Light, LandingLights::MaxLights > landingLights
float landingGearAbsorbKms
s_mesh_component * componentarray
unsigned landingLightCount
RiseMath::Vector3 location
float timer[PlotType::PlotTypeEnum]
unsigned long compare[PlotType::PlotTypeEnum]
float speed[PlotType::PlotTypeEnum]
RiseMath::Vector3 position
RiseMath::Vector3 barycentric
RiseMath::Vector3 dockingvel
RiseMath::Vector3 position
RiseMath::Vector3 positer
unsigned short components
float tireRotationRadPerS
float tireCircumferenceKm
bool rainProtectionEnabled
RiseMath::Vector3 dockoffset
RiseMath::Vector3 velleft
s_mesh_component * componentarray
RiseMath::Vector3 posleft
RiseMath::Vector3 velocity
WindshieldWipers::Motion wipers
RiseMath::Vector3 veliter
RiseMath::Matrix matrixBase
unsigned landingLightCount
Rendering::RenderBuffer * VB
std::vector< s_light_effect > effects
std::array< LandingLights::Light, LandingLights::MaxLights > landingLights
RiseMath::Matrix matrixBase
s_mesh_component * componentarray
RiseMath::Matrix matrixWorld
RiseMath::Vector3 position
unsigned short components