287 short buildzoneOrdinal =
static_cast<short>(
buildzones.size());
288 sprintf_s(msg,
sizeof msg,
"Building() will be using slot %i...", buildzoneOrdinal);
297 (uint64_t(uint8_t(
viewscreen->
ptrGrid->
cube)) << 32) | (uint64_t(uint16_t(buildzone.
u)) << 16) | uint16_t(buildzone.
v);
299 sprintf_s(msg,
sizeof msg,
"Building() %i loading type %i @ %i %i (u%i v%i)...", buildzoneOrdinal,
gridarray[t][s].type, t, s, buildzone.
u, buildzone.
v);
308 switch (buildzone.
type)
311 sprintf_s(file,
sizeof file,
"meshes\\deois-financial.dix");
316 sprintf_s(file,
sizeof file,
"meshes\\house1.dix");
320 sprintf_s(file,
sizeof file,
"meshes\\mining1.dix");
325 sprintf_s(file,
sizeof file,
"meshes\\Deois-industrial.dix");
329 sprintf_s(file,
sizeof file,
"meshes\\Deois-city center.dix");
334 sprintf_s(file,
sizeof file,
"meshes\\Deois-transit district.dix");
343 sprintf_s(file,
sizeof file,
"meshes\\NorthPole.dix");
348 sprintf_s(file,
sizeof file,
"meshes\\chojeir.dix");
353 sprintf_s(file,
sizeof file,
"meshes\\farm1.dix");
358 sprintf_s(file,
sizeof file,
"meshes\\town1.dix");
363 sprintf_s(file,
sizeof file,
"meshes\\sea-arcridge.dix");
367 sprintf_s(file,
sizeof file,
"meshes\\Deois-port.dix");
371 sprintf_s(file,
sizeof file,
"meshes\\airfield.dix");
380 sprintf_s(file,
sizeof file,
"meshes\\refinery.dix");
385 sprintf_s(file,
sizeof file,
"meshes\\O-4 ruin 1-1.dix");
389 sprintf_s(file,
sizeof file,
"meshes\\O-4 ruin 1-2.dix");
393 sprintf_s(file,
sizeof file,
"meshes\\O-4 ruin 1-3.dix");
397 sprintf_s(file,
sizeof file,
"meshes\\O-4 ruin 1-4.dix");
401 sprintf_s(msg,
sizeof msg,
"Building() %i DIX could not match a type %i!", buildzoneOrdinal, buildzone.
type);
409 _sopen_s(&handle, file, _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
412 sprintf_s(msg,
sizeof msg,
"Building() %i failed to load \"%s\"!", buildzoneOrdinal, file);
414 return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
417 unsigned short filecomponents;
418 _lseek(handle, 0, SEEK_SET);
419 _read(handle, &filecomponents, 2);
430 for (r = 0; r < filecomponents; r++)
447 sprintf_s(msg,
sizeof msg,
"Building() %i could not create component array for \"%s\"", buildzoneOrdinal, file);
449 return E_OUTOFMEMORY;
454 sprintf_s(msg,
sizeof msg,
"Building() %i loading %i of %i components for \"%s\"", buildzoneOrdinal, buildzone.
components, filecomponents, file);
459 for (r = 0; r < filecomponents; r++)
470 _lseek(handle,
static_cast<long>(r) * 100L + 99L, SEEK_SET);
474 _read(handle, &i_temp, 2);
476 _read(handle, &i_temp, 2);
489 _lseek(handle, 12L, SEEK_CUR);
491 _lseek(handle, 32L, SEEK_CUR);
497 sprintf_s(msg,
sizeof msg,
"Building type %i component %i had out-of-bounds texture: %i",
gridarray[t][s].type, tempr, buildzone.
componentarray[tempr].
texture);
514 sprintf_s(msg,
sizeof msg,
"Building() %i loading RTS grid for \"%s\"", buildzoneOrdinal, file);
520 sprintf_s(msg,
sizeof msg,
"Building() %i could not create RTS array for \"%s\"", buildzoneOrdinal, file);
522 return E_OUTOFMEMORY;
543 char rtsFile[MAX_PATH];
544 strcpy_s(rtsFile, MAX_PATH, file);
545 int tt = strlen(file) - 3;
550 _sopen_s(&rtsHandle, rtsFile, _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
553 sprintf_s(msg,
sizeof msg,
"Building() %i failed to load \"%s\"!", buildzoneOrdinal, rtsFile);
555 return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
558 _read(rtsHandle, buildzone.
rts,
sizeof RTSGRID * 26 * 26);
565 sprintf_s(msg,
sizeof msg,
"Building() %i could not create RTS memory (%i vertices) for \"%s\"", buildzoneOrdinal, 26 * 26 * 3 * 2, file);
567 return E_OUTOFMEMORY;
573 sprintf_s(msg,
sizeof msg,
"buildzone[%i].rtscomponentarray", buildzoneOrdinal);
577 sprintf_s(msg,
sizeof msg,
"Building() %i could not create RTS component array for \"%s\"", buildzoneOrdinal, file);
579 return E_OUTOFMEMORY;
587 &buildzone.
VB, NULL)))
589 sprintf_s(msg,
sizeof msg,
"Building() %i could not create memory (%i vertices) for \"%s\"", buildzoneOrdinal, vertices, file);
591 return E_OUTOFMEMORY;
593 sprintf_s(msg,
sizeof msg,
"Building() %i created VB (%i vertices) for \"%s\"", buildzoneOrdinal, vertices, file);
603 sprintf_s(file,
sizeof file,
"Meshes\\deois-financial.daw");
606 sprintf_s(file,
sizeof file,
"Meshes\\house1.daw");
609 sprintf_s(file,
sizeof file,
"Meshes\\mining1.daw");
612 sprintf_s(file,
sizeof file,
"Meshes\\Deois-industrial.daw");
615 sprintf_s(file,
sizeof file,
"Meshes\\Deois-city center.daw");
618 sprintf_s(file,
sizeof file,
"Meshes\\Deois-transit district.daw");
624 sprintf_s(file,
sizeof file,
"Meshes\\NorthPole.daw");
627 sprintf_s(file,
sizeof file,
"Meshes\\chojeir.daw");
630 sprintf_s(file,
sizeof file,
"Meshes\\farm1.daw");
633 sprintf_s(file,
sizeof file,
"Meshes\\town1.daw");
636 sprintf_s(file,
sizeof file,
"Meshes\\sea-arcridge.daw");
639 sprintf_s(file,
sizeof file,
"Meshes\\Deois-port.daw");
642 sprintf_s(file,
sizeof file,
"Meshes\\airfield.daw");
648 sprintf_s(file,
sizeof file,
"Meshes\\refinery.daw");
651 sprintf_s(file,
sizeof file,
"Meshes\\O-4 ruin 1-1.daw");
654 sprintf_s(file,
sizeof file,
"Meshes\\O-4 ruin 1-2.daw");
657 sprintf_s(file,
sizeof file,
"Meshes\\O-4 ruin 1-3.daw");
660 sprintf_s(file,
sizeof file,
"Meshes\\O-4 ruin 1-4.daw");
663 sprintf_s(msg,
sizeof msg,
"Building() %i DAW could not match a type %i!", buildzoneOrdinal, buildzone.
type);
667 _sopen_s(&handle, file, _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, _SH_DENYWR, _S_IWRITE);
670 sprintf_s(msg,
sizeof msg,
"Building() %i failed to load \"%s\"", buildzoneOrdinal, file);
672 return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
676 _lseek(handle, 0L, SEEK_SET);
680 _read(handle, &i_temp, 2);
681 tempvertices = i_temp;
684 _read(handle, &tempvertices, 4);
686 sprintf_s(msg,
sizeof msg,
"Building() %i scanning %i file vertices...", buildzoneOrdinal, tempvertices);
692 for (r = 0; r < tempvertices; r++)
694 _read(handle, &tempnormal, 12);
695 tempdax[r].
x = tempnormal.x;
696 tempdax[r].
y = tempnormal.y;
697 tempdax[r].
z = tempnormal.z;
698 _read(handle, &tempnormal, 12);
699 tempdax[r].
nx = -tempnormal.x;
700 tempdax[r].
ny = tempnormal.y;
701 tempdax[r].
nz = tempnormal.z;
702 _read(handle, &tempnormal.x, 4);
703 tempdax[r].
tu = tempnormal.x;
704 _read(handle, &tempnormal.y, 4);
705 tempdax[r].
tv = tempnormal.y;
738 buildzone.
terpos = (ul + lr) * 0.5f;
748 buildzone.
terpos = (ul + lr) * 0.5f;
758 buildzone.
terpos = (ul + lr) * 0.5f;
768 buildzone.
terpos = (ul + lr) * 0.5f;
772 sprintf_s(msg,
sizeof msg,
"Building() %i zone %i!", buildzoneOrdinal,
gridarray[t][s].zone);
790#define FindMakeshipGrid
795#ifndef FindMakeshipGrid
824 RiseMath::Vector2 to[4] = { {-1.014f, 1.014f}, { -1.014f, -1.014f}, {1.014f, 1.014f}, {1.014f, -1.014f} };
831 bool returnInverse =
true;
834 for (
int i = 0; i < 4; i++)
836 to[i] *= 520.0f / 2.0f / 1.014f;
837 from[i] *= 520.0f / 2.0f / 1.014f;
843 memcpy(temp, from,
sizeof from);
844 memcpy(from, to,
sizeof to);
845 memcpy(to, temp,
sizeof temp);
849 { from[0].x, from[0].y, 1, 0, 0, 0, -from[0].x * to[0].x, -from[0].y * to[0].x },
850 { 0, 0, 0, from[0].x, from[0].y, 1, -from[0].x * to[0].y, -from[0].y * to[0].y },
851 { from[1].x, from[1].y, 1, 0, 0, 0, -from[1].x * to[1].x, -from[1].y * to[1].x },
852 { 0, 0, 0, from[1].x, from[1].y, 1, -from[1].x * to[1].y, -from[1].y * to[1].y },
853 { from[2].x, from[2].y, 1, 0, 0, 0, -from[2].x * to[2].x, -from[2].y * to[2].x },
854 { 0, 0, 0, from[2].x, from[2].y, 1, -from[2].x * to[2].y, -from[2].y * to[2].y },
855 { from[3].x, from[3].y, 1, 0, 0, 0, -from[3].x * to[3].x, -from[3].y * to[3].x },
856 { 0, 0, 0, from[3].x, from[3].y, 1, -from[3].x * to[3].y, -from[3].y * to[3].y }
862 float b[8][1] = { to[0].x, to[0].y, to[1].x, to[1].y, to[2].x, to[2].y, to[3].x, to[3].y };
865 for (
int i = 0; i < 8; ++i)
867 for (
int j = 0; j < 1; ++j)
870 for (
int k = 0; k < 8; ++k)
872 h[i][j] += inv[i][k] * b[k][j];
878 h[0][0], h[1][0], 0, h[2][0],
879 h[3][0], h[4][0], 0, h[5][0],
881 h[6][0], h[7][0], 0, 1
893 sprintf_s(msg,
sizeof msg,
"Building() %i zone %i powered %i", buildzoneOrdinal,
gridarray[t][s].zone,
gridarray[t][s].powered);
903 _read(handle, &fileEffects, 2);
904 sprintf_s(msg,
sizeof msg,
"Loading up to %i lights for buildingZoneOrdinal %i...", fileEffects, buildzoneOrdinal);
907 for (r = 0; r < static_cast<unsigned int>(fileEffects); r++)
910 _read(handle, &tempEffect.
position, 12);
911 _read(handle, &tempEffect.
normal, 12);
913 _read(handle, &diffuse, 4);
916 _read(handle, &tempEffect.
speed, 4);
917 _read(handle, &tempEffect.
power, 4);
918 _read(handle, &tempEffect.
attachto, 2);
923 for (
int q = 0; q < buildzone.
components; q++)
940 bool connected =
true;
944 for (
int c = 0; c < buildzone.
components; c++)
954 buildzone.
effects.emplace_back(tempEffect);
959 sprintf_s(msg,
sizeof msg,
"Building() %i built TEMPDAX with %i vertices for %zu added lights", buildzoneOrdinal, tempvertices, buildzone.
effects.size());
962#pragma region REIL (Runway End Identifier Lights)
980 for (r = 0; r < 6; r++)
982 newarray[r].
normal = -northvector;
986 newarray[r].
power = 1.0f;
996 for (r = 6; r < 12; r++)
998 newarray[r].
normal = northvector;
1002 newarray[r].
power = 1.0f;
1012 for (r = 12; r < 18; r++)
1014 newarray[r].
normal = northvector;
1018 newarray[r].
power = 1.0f;
1027 RiseMath::Vec3Lerp(&newarray[12].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 1.0f / 8.0f) * 2.0f);
1028 RiseMath::Vec3Lerp(&newarray[13].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 2.0f / 8.0f) * 2.0f);
1029 RiseMath::Vec3Lerp(&newarray[14].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 3.0f / 8.0f) * 2.0f);
1030 RiseMath::Vec3Lerp(&newarray[15].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 5.0f / 8.0f) * 2.0f);
1031 RiseMath::Vec3Lerp(&newarray[16].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 6.0f / 8.0f) * 2.0f);
1032 RiseMath::Vec3Lerp(&newarray[17].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 7.0f / 8.0f) * 2.0f);
1033 for (r = 18; r < 24; r++)
1035 newarray[r].
normal = -northvector;
1039 newarray[r].
power = 1.0f;
1043 RiseMath::Vec3Lerp(&newarray[18].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 1.0f / 8.0f) * 2.0f);
1044 RiseMath::Vec3Lerp(&newarray[19].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 2.0f / 8.0f) * 2.0f);
1045 RiseMath::Vec3Lerp(&newarray[20].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 3.0f / 8.0f) * 2.0f);
1046 RiseMath::Vec3Lerp(&newarray[21].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 5.0f / 8.0f) * 2.0f);
1047 RiseMath::Vec3Lerp(&newarray[22].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 6.0f / 8.0f) * 2.0f);
1048 RiseMath::Vec3Lerp(&newarray[23].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 7.0f / 8.0f) * 2.0f);
1050 for (r = 24; r < 26; r++)
1052 newarray[r].
normal = northvector;
1056 newarray[r].
power = 1.0f;
1059 for (r = 26; r < 28; r++)
1061 newarray[r].
normal = -northvector;
1065 newarray[r].
power = 1.0f;
1068 RiseMath::Vec3Lerp(&newarray[24].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * -1.0f / 8.0f) * 2.0f);
1069 RiseMath::Vec3Lerp(&newarray[25].position, &topLeft, &topRight, (-0.5f + 0.73857f + 0.02286f * 9.0f / 8.0f) * 2.0f);
1073 for (r = 0; r < 28; r++)
1074 buildzone.
effects.emplace_back(newarray[r]);
1084 for (
unsigned int q = 0; q < buildzone.
components; q++)
1094 for (
short q = 0; q < buildzone.
components; q++)
1115 sprintf_s(msg,
sizeof msg,
"Building() %i ZAP+RTS tempdaw to new buffer...", buildzoneOrdinal);
1119 unsigned int vertex = 0, i_temp;
1126 V(buildzone.
VB->
Lock(0, 0,
reinterpret_cast<void**
>(&vtx), 0));
1127 sprintf_s(msg,
sizeof msg,
"Building() %i ZAP+RTS locked VB successfully...", buildzoneOrdinal);
1130 for (
short q = 0; q < buildzone.
components; q++)
1135 if (buildzone.
componentarray[q].
type == 26 && i_temp <= tempvertices && tempvertices - i_temp >= 6)
1137 assert(i_temp < (
unsigned)tempvertices);
1152 float uhit, vhit, dist;
1225 tempnormal = -tempnormal;
1226 tempnormal -= buildzone.
terpos;
1227 tempnormal = -tempnormal;
1244 sprintf_s(msg,
sizeof msg,
"Problem1 with gridarray[t][s].type %i",
gridarray[t][s].type);
1246 sprintf_s(msg,
sizeof msg,
" %+.3f ,%+.3f ,%+.3f ,", tempnormal.x, tempnormal.y, tempnormal.z);
1264 float fabsbias = -999.0f;
1270 tempnormal.x = tempdax[i_temp + r].
x;
1271 tempnormal.y = tempdax[i_temp + r].
y;
1276 tempnormal = -tempnormal;
1277 tempnormal -= buildzone.
terpos;
1278 tempnormal = -tempnormal;
1292 sprintf_s(msg,
sizeof msg,
"Problem2 with gridarray[t][s].type %i",
gridarray[t][s].type);
1294 sprintf_s(msg,
sizeof msg,
" %+.3f ,%+.3f ,%+.3f ,", tempnormal.x, tempnormal.y, tempnormal.z);
1310 if (dist > fabsbias)
1335 sprintf_s(msg,
sizeof msg,
"Building() %i example of ZAP bias %f", buildzoneOrdinal, buildzone.
componentarray[q].
nominalCG.z);
1345 assert(i_temp <
static_cast<unsigned>(tempvertices));
1360 tempnormal.x = tempdax[i_temp].
x;
1361 tempnormal.y = tempdax[i_temp].
y;
1362 tempnormal.z = tempdax[i_temp].
z;
1365 vtx->
x = tempnormal.x; vtx->
y = tempnormal.y; vtx->
z = tempnormal.z;
1367 drawBounds.Include(tempnormal);
1369 const auto obstacleWorld = tempnormal+buildzone.
terpos;
1370 const float obstacleHeight = float(std::sqrt(
double(obstacleWorld.x)*obstacleWorld.x +
1371 double(obstacleWorld.y)*obstacleWorld.y +
double(obstacleWorld.z)*obstacleWorld.z)-
double(
radiusC));
1374 tempnormal.x = tempdax[i_temp].
nx;
1375 tempnormal.y = tempdax[i_temp].
ny;
1376 tempnormal.z = tempdax[i_temp].
nz;
1378 vtx->
nx = tempnormal.x; vtx->
ny = tempnormal.y; vtx->
nz = tempnormal.z;
1380 vtx->
tu = tempdax[i_temp].
tu; vtx->
tv = tempdax[i_temp].
tv;
1381 vtx->
tu2 = tempdax[i_temp].
tu2; vtx->
tv2 = tempdax[i_temp].
tv2;
1382 vtx++; vertex++; i_temp++;
1388 sprintf_s(msg,
sizeof msg,
"Building() %i filled %i/%i vertices for \"%s\"", buildzoneOrdinal, vertex, vertices, file);
1393#pragma region RTS Grid (for rendering after the buildings)
1413 V(buildzone.
RTSVB->
Lock(0, 0,
reinterpret_cast<void**
>(&vtx2), 0));
1422 for (t = 0; t < 26; t++)
1424 for (s = 0; s < 26; s++)
1433 const int east = t + corner.east;
1434 const int north = s + corner.north;
1436 vtx2->
x = position.x; vtx2->
y = position.y; vtx2->
z = position.z;
1443 vtx2->
tu = tex.u; vtx2->
tv = tex.v;
1459 sprintf_s(msg,
sizeof msg,
"Building() %i filled %i RTS primitives for \"%s\"", buildzoneOrdinal, i_temp, file);
1465 sortme.emplace_back(buildzoneOrdinal);
1787 if (rts.
u >= 0 && rts.
u < 26 && rts.
v >= 0 && rts.
v < 26 &&
1788 bump.
u >= 0 && bump.
u < 256 && bump.
v >= 0 && bump.
v < 256 &&
1793 char file[MAX_PATH];
1794 int rtsOrdinal = rts.
u * 26 + rts.
v;
1797 case 1: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f1a_BUMP.bmp");
break;
1798 case 2: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f1b_BUMP.bmp");
break;
1799 case 3: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f1c_BUMP.bmp");
break;
1800 case 4: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f2a_BUMP.bmp");
break;
1801 case 5: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f2b_BUMP.bmp");
break;
1802 case 6: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f2c_BUMP.bmp");
break;
1803 case 7: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f3a_BUMP.bmp");
break;
1804 case 8: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f3b_BUMP.bmp");
break;
1805 case 9: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f4a_BUMP.bmp");
break;
1806 case 10: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f4b_BUMP.bmp");
break;
1807 case 11: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f5a_BUMP.bmp");
break;
1808 case 12: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f6a_BUMP.bmp");
break;
1809 case 13: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f6b_BUMP.bmp");
break;
1810 case 14: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f6c_BUMP.bmp");
break;
1811 case 15: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f6d_BUMP.bmp");
break;
1812 case 16: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f6e_BUMP.bmp");
break;
1813 case 17: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f7a_BUMP.bmp");
break;
1814 case 18: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f7b_BUMP.bmp");
break;
1815 case 19: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f7c_BUMP.bmp");
break;
1816 case 20: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f8a_BUMP.bmp");
break;
1817 case 21: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f8b_BUMP.bmp");
break;
1818 case 22: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f8c_BUMP.bmp");
break;
1819 case 23: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f9a_BUMP.bmp");
break;
1820 case 24: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f9b_BUMP.bmp");
break;
1821 case 25: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f10a_BUMP.bmp");
break;
1822 case 26: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f10b_BUMP.bmp");
break;
1823 case 27: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f10c_BUMP.bmp");
break;
1824 case 28: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f10d_BUMP.bmp");
break;
1825 case 29: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f11a_BUMP.bmp");
break;
1826 case 30: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f33_Exit-above_BUMP.bmp");
break;
1827 case 31: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f12b_BUMP.bmp");
break;
1828 case 32: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f33_Exit-above_BUMP.bmp");
break;
1829 case 33: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f13b_BUMP.bmp");
break;
1831 case 35: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f14b_BUMP.bmp");
break;
1832 case 36: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f15a_BUMP.bmp");
break;
1833 case 37: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f15b_BUMP.bmp");
break;
1834 case 38: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f15c_BUMP.bmp");
break;
1838 case 40: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f15e_BUMP.bmp");
break;
1841 return 0.00020312817392f;
1842 case 43: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f18_BUMP.bmp");
break;
1843 case 44: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f19_BUMP.bmp");
break;
1844 case 45: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f20_BUMP.bmp");
break;
1845 case 46: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f21_BUMP.bmp");
break;
1846 case 47: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f22_BUMP.bmp");
break;
1847 case 48: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f23_BUMP.bmp");
break;
1848 case 49: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f24_BUMP.bmp");
break;
1852 case 51: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f26_BUMP.bmp");
break;
1853 case 52: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f27_BUMP.bmp");
break;
1854 case 53: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f28_BUMP.bmp");
break;
1855 case 54: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f29_BUMP.bmp");
break;
1856 case 55: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f30_BUMP.bmp");
break;
1857 case 56: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f15f_BUMP.bmp");
break;
1858 case 57: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f15g_BUMP.bmp");
break;
1861 case 60: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f33_BUMP.bmp");
break;
1862 case 61: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f34_BUMP.bmp");
break;
1863 case 62: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\city2playerN_BUMP.bmp");
break;
1864 case 63: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\city2playerS_BUMP.bmp");
break;
1873 case 70: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f8bpark_BUMP.bmp");
break;
1874 case 71: strcpy_s(file, MAX_PATH,
"Textures\\RTS\\f9bpark_BUMP.bmp");
break;
1880 _sopen_s(&deoisbump, file, _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
1881 if (deoisbump == -1)
1884 sprintf_s(msg,
sizeof msg,
"Could not find bump file %i for type %i!", buildzone.
rts[rtsOrdinal].
texture,
gridarray[u][v].
type);
1887 const unsigned long bpr = 256L;
1889 const unsigned char rotation = buildzone.
rts[rtsOrdinal].
rotation;
1892 if (rotation == 2 || rotation == 6)
1897 else if (rotation == 1 || rotation == 5)
1900 rotbump.
u = 255 - bump.
v;
1902 else if (rotation == 0 || rotation == 4)
1904 rotbump.
u = 255 - bump.
u;
1905 rotbump.
v = 255 - bump.
v;
1907 else if (rotation == 3 || rotation == 7)
1909 rotbump.
v = 255 - bump.
u;
1913 rotbump.
u = 255 - rotbump.
u;
1915 unsigned char uch_temp;
1916 unsigned long k = 54L + 1024L + rotbump.
u + (bpr - rotbump.
v - 1L) * bpr;
1917 _lseek(deoisbump, k, SEEK_SET);
1918 _read(deoisbump, &uch_temp, 1);
1921 if (uch_temp == 128)
1924 return (
static_cast<float>(uch_temp) - 128.0f) * 0.00001269551087f;