comparison Render.cpp @ 1175:9e3bacdbec56

m
author Ritor1
date Mon, 03 Jun 2013 09:10:21 +0600
parents ad89d1905b48
children dac817fbf85a
comparison
equal deleted inserted replaced
1174:05247ad19710 1175:9e3bacdbec56
902 int v28; // edx@60 902 int v28; // edx@60
903 int v29; // ecx@61 903 int v29; // ecx@61
904 int v30; // ecx@64 904 int v30; // ecx@64
905 int v31; // ecx@68 905 int v31; // ecx@68
906 int v32; // eax@70 906 int v32; // eax@70
907 int v33; // ecx@71 907 //int v33; // ecx@71
908 int v34; // eax@73 908 int v34; // eax@73
909 int v35; // ecx@77 909 int v35; // ecx@77
910 int v36; // ecx@81 910 int v36; // ecx@81
911 int v37; // ecx@86 911 int v37; // ecx@86
912 int v38; // eax@88 912 int v38; // eax@88
913 int v39; // ecx@88 913 int v39; // ecx@88
914 int v40; // eax@90 914 int v40; // eax@90
915 int v41; // edx@94 915 int v41; // edx@94
916 int v42; // ecx@95 916 //int v42; // ecx@95
917 int v43; // ecx@98 917 int v43; // ecx@98
918 int v44; // ecx@102 918 int v44; // ecx@102
919 int v45; // eax@104 919 int v45; // eax@104
920 int v46; // eax@107 920 int v46; // eax@107
921 int v47; // ecx@111 921 int v47; // ecx@111
929 int v55; // ecx@132 929 int v55; // ecx@132
930 int v56; // eax@139 930 int v56; // eax@139
931 int v57; // ecx@140 931 int v57; // ecx@140
932 int v58; // eax@142 932 int v58; // eax@142
933 int v59; // ecx@146 933 int v59; // ecx@146
934 int v60; // ecx@147 934 //int v60; // ecx@147
935 int v61; // ecx@150 935 int v61; // ecx@150
936 int v62; // ecx@155 936 int v62; // ecx@155
937 int v63; // eax@157 937 int v63; // eax@157
938 int v64; // ecx@157 938 int v64; // ecx@157
939 int v65; // eax@159 939 int v65; // eax@159
944 int v70; // edi@178 944 int v70; // edi@178
945 //int v71; // eax@178 945 //int v71; // eax@178
946 //int v72; // ecx@178 946 //int v72; // ecx@178
947 //int x; // ebx@180 947 //int x; // ebx@180
948 //int v74; // eax@182 948 //int v74; // eax@182
949 int v75; // eax@184 949 //int v75; // eax@184
950 IndoorCameraD3D *pIndoorCameraD3D_3; // ecx@184 950 IndoorCameraD3D *pIndoorCameraD3D_3; // ecx@184
951 int uStartZ; // ecx@184 951 int uStartZ; // ecx@184
952 int v79; // ebx@185 952 int v79; // ebx@185
953 int v127; // esi@185 953 int v127; // esi@185
954 int v86; // edi@196 954 int v86; // edi@196
990 int v126; // [sp+70h] [bp-4h]@9 990 int v126; // [sp+70h] [bp-4h]@9
991 991
992 v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2 992 v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2
993 pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY);//1536 993 pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY);//1536
994 pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512 994 pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512
995 v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16; 995 v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16;//88
996 v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16; 996 v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16;// 66
997 v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X 997 v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X
998 v119 = pOutdoorCamera->outdoor_grid_band_3 + v123; 998 v119 = pOutdoorCamera->outdoor_grid_band_3 + v123;
999 v2 = pOutdoorCamera->uCameraFovInDegrees + 15; 999 v2 = pOutdoorCamera->uCameraFovInDegrees + 15;//90
1000 i = v124 - pOutdoorCamera->outdoor_grid_band_3; 1000 i = v124 - pOutdoorCamera->outdoor_grid_band_3;
1001 v122 = v123 - pOutdoorCamera->outdoor_grid_band_3; 1001 v122 = v123 - pOutdoorCamera->outdoor_grid_band_3;
1002 1002
1003 if ( v2 > 90 ) 1003 if ( v2 > 90 )
1004 v2 = 90; 1004 v2 = 90;
1005 v3 = (v2 << 11) / 720; 1005 v3 = (v2 << 11) / 720;
1006 v4 = stru_5C6E00->uDoublePiMask & (pDirectionIndicator1 - v3); 1006 v4 = stru_5C6E00->uDoublePiMask & (pDirectionIndicator1 - v3);
1007 v5 = stru_5C6E00->uDoublePiMask & (v3 + pDirectionIndicator1); 1007 v5 = stru_5C6E00->uDoublePiMask & (v3 + pDirectionIndicator1);
1008
1008 v106 = stru_5C6E00->Cos(v4); 1009 v106 = stru_5C6E00->Cos(v4);
1009 uEndZ = stru_5C6E00->Sin(v4); 1010 uEndZ = stru_5C6E00->Sin(v4);
1011
1010 v111 = stru_5C6E00->Cos(v5); 1012 v111 = stru_5C6E00->Cos(v5);
1011 v6 = stru_5C6E00->Sin(v5); 1013 v6 = stru_5C6E00->Sin(v5);
1014
1012 v7 = v4 & stru_5C6E00->uPiMask; 1015 v7 = v4 & stru_5C6E00->uPiMask;
1013
1014 if ( (v4 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) 1016 if ( (v4 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi )
1015 v8 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v7]; 1017 v8 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v7];
1016 else 1018 else
1017 v8 = stru_5C6E00->pTanTable[v7]; 1019 v8 = stru_5C6E00->pTanTable[v7];
1018 v112 = abs(v8); 1020 v112 = abs(v8);
1021
1019 v9 = v5 & stru_5C6E00->uPiMask; 1022 v9 = v5 & stru_5C6E00->uPiMask;
1020 if ( (v5 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) 1023 if ( (v5 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi )
1021 v10 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v9]; 1024 v10 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v9];
1022 else 1025 else
1023 v10 = stru_5C6E00->pTanTable[v9]; 1026 v10 = stru_5C6E00->pTanTable[v9];
1024 v108 = abs(v10); 1027 v108 = abs(v10);
1028
1025 //v11 = v124; 1029 //v11 = v124;
1026 //v12 = v123; 1030 //v12 = v123;
1027 v114 = 0; 1031 v114 = 0;
1028 v115 = 0; 1032 v115 = 0;
1029 pIndoorCameraD3D_4 = 0; 1033 pIndoorCameraD3D_4 = 0;
1030 v125 = 0; 1034 v125 = 0;
1031 v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1;
1032 v126 = v124; 1035 v126 = v124;
1033 v118 = v123; 1036 v118 = v123;
1037
1038 v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1;
1034 v109 = (uEndZ >= 0 ? 1: -1);//2 * (v107 >= 0) - 1; 1039 v109 = (uEndZ >= 0 ? 1: -1);//2 * (v107 >= 0) - 1;
1035 uEndZ = (v111 >= 0 ? 1: -1);//2 * (v111 >= 0) - 1; 1040 uEndZ = (v111 >= 0 ? 1: -1);//2 * (v111 >= 0) - 1;
1036 terrain_76E1C8[0] = 65535; 1041 v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1;
1042
1037 uint _i = 1; 1043 uint _i = 1;
1038 v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1;
1039 uint j = 1; 1044 uint j = 1;
1040 terrain_76E3C8[0] = 65535; 1045
1041 terrain_76DDC8[0] = 65535; 1046 terrain_76DDC8[0] = -1;
1042 terrain_76DFC8[0] = 65535; 1047 terrain_76DFC8[0] = -1;
1043 for( _i = 1; _i < 128; _i++) 1048 terrain_76E1C8[0] = -1;
1049 terrain_76E3C8[0] = -1;
1050
1051 for( uint _i = 1; _i < 128; _i++)
1044 { 1052 {
1045 if ( v112 >= 0x10000 ) 1053 if ( v112 >= 0x10000 )
1046 { 1054 {
1047 int v1, v2; 1055 int v1, v2;
1048 /*v111 = 4294967296i64 / v112; 1056 /*v111 = 4294967296i64 / v112;
1110 } 1118 }
1111 v16 = 0; 1119 v16 = 0;
1112 v126 = 0; 1120 v126 = 0;
1113 v17 = j - 1; 1121 v17 = j - 1;
1114 v18 = _i - 1; 1122 v18 = _i - 1;
1123
1115 switch ( v105 ) 1124 switch ( v105 )
1116 { 1125 {
1117 case 0: 1126 case 0:
1118 case 7: 1127 case 7:
1119 { 1128 {
1221 //v116 = terrain_76DDC8[v17]; 1230 //v116 = terrain_76DDC8[v17];
1222 if ( v122 < terrain_76DDC8[v17] ) 1231 if ( v122 < terrain_76DDC8[v17] )
1223 { 1232 {
1224 v106 = v122; 1233 v106 = v122;
1225 memset32(terrain_76DBC8, v120 + 1, 4 * (terrain_76DDC8[v17] - v122 + 1)); 1234 memset32(terrain_76DBC8, v120 + 1, 4 * (terrain_76DDC8[v17] - v122 + 1));
1226 v32 = v122; 1235 for ( v32 = v122; v32 <= terrain_76DDC8[v17]; v32++)
1227 do 1236 terrain_76D9C8[v126++] = v32;
1228 {
1229 v33 = v126++;
1230 terrain_76D9C8[v33] = v32++;
1231 }
1232 while ( v32 <= terrain_76DDC8[v17] );
1233 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) 1237 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] )
1234 { 1238 {
1235 do 1239 do
1236 v34 = terrain_76DBC8[v17-- -1]; 1240 v34 = terrain_76DBC8[v17-- -1];
1237 while ( v34 == terrain_76DBC8[v17 -1] ); 1241 while ( v34 == terrain_76DBC8[v17 -1] );
1294 if ( v18 < 0 ) 1298 if ( v18 < 0 )
1295 v18 = 0; 1299 v18 = 0;
1296 v41 = terrain_76E1C8[v18]; 1300 v41 = terrain_76E1C8[v18];
1297 while ( v41 <= v123 ) 1301 while ( v41 <= v123 )
1298 { 1302 {
1299 v42 = terrain_76E3C8[v18];
1300 terrain_76D5C8[v16] = v41; 1303 terrain_76D5C8[v16] = v41;
1301 terrain_76D7C8[v16] = v42; 1304 terrain_76D7C8[v16] = terrain_76E3C8[v18];
1302 if ( v42 == 65535 ) 1305 if ( terrain_76E3C8[v18] == 65535 )
1303 { 1306 {
1304 terrain_76D7C8[v16] = v124; 1307 terrain_76D7C8[v16] = v124;
1305 break; 1308 break;
1306 } 1309 }
1307 if ( !v18 ) 1310 if ( !v18 )
1324 //v116 = terrain_76DDC8[v17]; 1327 //v116 = terrain_76DDC8[v17];
1325 if ( v119 > terrain_76DDC8[v17] ) 1328 if ( v119 > terrain_76DDC8[v17] )
1326 { 1329 {
1327 v106 = v119; 1330 v106 = v119;
1328 memset32(terrain_76DBC8, i, 4 * (v119 - terrain_76DDC8[v17] + 1)); 1331 memset32(terrain_76DBC8, i, 4 * (v119 - terrain_76DDC8[v17] + 1));
1329 v45 = v119; 1332 for ( v45 = v119; v45 >= terrain_76DDC8[v17]; v45--)
1330 do 1333 terrain_76D9C8[v126++] = v45;
1331 terrain_76D9C8[v126++] = v45--;
1332 while ( v45 >= terrain_76DDC8[v17] );
1333 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) 1334 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] )
1334 { 1335 {
1335 do 1336 do
1336 v46 = terrain_76DBC8[v17-- -1]; 1337 v46 = terrain_76DBC8[v17-- -1];
1337 while ( v46 == terrain_76DBC8[v17 -1] ); 1338 while ( v46 == terrain_76DBC8[v17 -1] );
1448 { 1449 {
1449 v125 = v59; 1450 v125 = v59;
1450 if ( v59 > v124 ) 1451 if ( v59 > v124 )
1451 break; 1452 break;
1452 terrain_76DBC8[v16] = v59; 1453 terrain_76DBC8[v16] = v59;
1453 v60 = terrain_76DDC8[v17]; 1454 //v60 = terrain_76DDC8[v17];
1454 terrain_76D9C8[v16] = v60; 1455 terrain_76D9C8[v16] = terrain_76DDC8[v17];
1455 if ( v60 == 65535 ) 1456 if ( terrain_76DDC8[v17] == 65535 )
1456 { 1457 {
1457 terrain_76D9C8[v16] = v123; 1458 terrain_76D9C8[v16] = v123;
1458 break; 1459 break;
1459 } 1460 }
1460 if ( !v17 ) 1461 if ( !v17 )
1547 if ( terrain_76DBC8[i] <= 0 ) 1548 if ( terrain_76DBC8[i] <= 0 )
1548 terrain_76DBC8[i] = -terrain_76DBC8[i]; 1549 terrain_76DBC8[i] = -terrain_76DBC8[i];
1549 //v74 = terrain_76D7C8[i]; 1550 //v74 = terrain_76D7C8[i];
1550 if ( terrain_76D7C8[i] <= 0 ) 1551 if ( terrain_76D7C8[i] <= 0 )
1551 terrain_76D7C8[i] = -terrain_76D7C8[i]; 1552 terrain_76D7C8[i] = -terrain_76D7C8[i];
1552 v75 = terrain_76D7C8[i] + 2; 1553 uEndZ = terrain_76D7C8[i] + 2;
1553 //pIndoorCameraD3D_3 = pGame->pIndoorCameraD3D; 1554 //pIndoorCameraD3D_3 = pGame->pIndoorCameraD3D;
1554 uEndZ = v75; 1555 //uEndZ = v75;
1555 //pIndoorCameraD3D_4 = pIndoorCameraD3D_3; 1556 //pIndoorCameraD3D_4 = pIndoorCameraD3D_3;
1556 uStartZ = terrain_76DBC8[i] - 2; 1557 uStartZ = terrain_76DBC8[i] - 2;
1557 if ( terrain_76DBC8[i] - 2 < v75 ) 1558 if ( terrain_76DBC8[i] - 2 < uEndZ )
1558 { 1559 {
1559 v127 = 0; 1560 v127 = 0;
1560 //v79 = (v73 - 66) << 9; 1561 //v79 = (v73 - 66) << 9;
1561 //v116 = v77; 1562 //v116 = v77;
1562 //pHeight = v79; 1563 //pHeight = v79;
1563 v111 = v75 - uStartZ; 1564 v111 = uEndZ - uStartZ;
1564 for (int z = uStartZ; z < uEndZ; ++z) 1565 for (int z = uStartZ; z < uEndZ; ++z)
1565 { 1566 {
1566 ptr_801A08[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512; 1567 ptr_801A08[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512;
1567 ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512; 1568 ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512;
1568 ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i]); 1569 ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i]);
1570
1569 ptr_801A04[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512; 1571 ptr_801A04[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;
1570 ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512; 1572 ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512;
1571 ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i] + 1); 1573 ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i] + 1);
1574
1572 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) 1575 if ( !byte_4D864C || !(pGame->uFlags & 0x80) )
1573 { 1576 {
1574 pIndoorCameraD3D_4->ViewTransform(&ptr_801A08[v127], 1); 1577 pIndoorCameraD3D_4->ViewTransform(&ptr_801A08[v127], 1);
1575 pIndoorCameraD3D_4->ViewTransform(&ptr_801A04[v127], 1); 1578 pIndoorCameraD3D_4->ViewTransform(&ptr_801A04[v127], 1);
1579
1576 pIndoorCameraD3D_4->Project(&ptr_801A08[v127], 1, 0); 1580 pIndoorCameraD3D_4->Project(&ptr_801A08[v127], 1, 0);
1577 pIndoorCameraD3D_4->Project(&ptr_801A04[v127], 1, 0); 1581 pIndoorCameraD3D_4->Project(&ptr_801A04[v127], 1, 0);
1578 } 1582 }
1579 //v79 += 512; 1583 //v79 += 512;
1580 v127 ++; 1584 v127 ++;
1584 //while ( v116 < v107 ); 1588 //while ( v116 < v107 );
1585 } 1589 }
1586 v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]); 1590 v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]);
1587 v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]); 1591 v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]);
1588 if ( pRenderer->pRenderD3D )//Ritor1: do comment to test 1592 if ( pRenderer->pRenderD3D )//Ritor1: do comment to test
1589 Render::DrawTerrainD3D(v111, 0, v103, v104);//Render::RenderTerrainD3D(); 1593 Render::DrawTerrainD3D(v111, 0, v103, v104);
1594 //Render::RenderTerrainD3D();
1590 else 1595 else
1591 Render::DrawTerrainSW(v111, 0, v103, v104); 1596 Render::DrawTerrainSW(v111, 0, v103, v104);
1592 } 1597 }
1593 } 1598 }
1594 else 1599 else
1620 //pHeight = (66 - terrain_76D9C8[i]) << 9; 1625 //pHeight = (66 - terrain_76D9C8[i]) << 9;
1621 v111 = terrain_76D5C8[i] + 2 - (terrain_76D9C8[i] - 2); 1626 v111 = terrain_76D5C8[i] + 2 - (terrain_76D9C8[i] - 2);
1622 //do 1627 //do
1623 for ( v116 = terrain_76D9C8[i] - 2; v116 < v107; ++v116 ) 1628 for ( v116 = terrain_76D9C8[i] - 2; v116 < v107; ++v116 )
1624 { 1629 {
1625 //v93 = v116;
1626 //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 64) << 9;
1627 ptr_801A08[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 64) << 9; 1630 ptr_801A08[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 64) << 9;
1628 //*(float *)&pHeight = (double)pHeight;
1629 ptr_801A08[v86].vWorldPosition.y = v92; 1631 ptr_801A08[v86].vWorldPosition.y = v92;
1630 //v106 = ;
1631 //v97 = v116;
1632 ptr_801A08[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86], v116); 1632 ptr_801A08[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86], v116);
1633 //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 63) << 9; 1633
1634 ptr_801A04[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 63) << 9; 1634 ptr_801A04[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 63) << 9;
1635 ptr_801A04[v86].vWorldPosition.y = v92; 1635 ptr_801A04[v86].vWorldPosition.y = v92;
1636 //pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97);
1637 ptr_801A04[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86] + 1, v116); 1636 ptr_801A04[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86] + 1, v116);
1638 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) 1637 if ( !byte_4D864C || !(pGame->uFlags & 0x80) )
1639 { 1638 {
1640 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1); 1639 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1);
1641 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1); 1640 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1);
1980 v88 = 0; 1979 v88 = 0;
1981 v84 = a1 - 1; 1980 v84 = a1 - 1;
1982 v90 = (float)pOutdoor->vSunlight.x / 65536.0; 1981 v90 = (float)pOutdoor->vSunlight.x / 65536.0;
1983 v91 = (float)pOutdoor->vSunlight.y / 65536.0; 1982 v91 = (float)pOutdoor->vSunlight.y / 65536.0;
1984 v92 = (float)pOutdoor->vSunlight.z / 65536.0; 1983 v92 = (float)pOutdoor->vSunlight.z / 65536.0;
1985 if ( a1 - 1 > 0 ) 1984 /* if ( a1 - 1 > 0 )
1986 { 1985 {
1987 while ( 1 ) 1986 while ( 1 )
1988 { 1987 {
1989 v5 = abs(X);//v5 = 13108 1988 v5 = abs(X);//v5 = 13108
1990 v6 = abs(v83);//v6 = 13108 1989 v6 = abs(v83);//v6 = 13108
2010 WorldPosToGridCellX(sX), 2009 WorldPosToGridCellX(sX),
2011 WorldPosToGridCellZ(sY), 2010 WorldPosToGridCellZ(sY),
2012 !byte_4D864C) 2011 !byte_4D864C)
2013 || !(pGame->uFlags & 0x80)) 2012 || !(pGame->uFlags & 0x80))
2014 && !sub_481EFA(v8, v9, v101, pVertices, 1)) )*/ 2013 && !sub_481EFA(v8, v9, v101, pVertices, 1)) )*/
2015 if ( !&stru_76E5C8[(v5 << 7) + v6] ) 2014 /*if ( !&stru_76E5C8[(v5 << 7) + v6] )
2016 goto LABEL_162; 2015 goto LABEL_162*/
2017 v8 = &pVerticesSR_806210[v4]; 2016 v8 = &pVerticesSR_806210[v4];
2018 pVertices2 = &pVerticesSR_801A10[v4 + 1]; 2017 //pVertices2 = &pVerticesSR_801A10[v4 + 1];
2019 v102 = v8; 2018 //v102 = v8;
2020 if (!v82) 2019 if (!v82)
2021 { 2020 {
2022 pVertices = &pVerticesSR_801A10[v4]; 2021 pVertices = &pVerticesSR_801A10[v4];
2023 v101 = &pVerticesSR_806210[v4 + 1]; 2022 v101 = &pVerticesSR_806210[v4 + 1];
2024 } 2023 }
2029 } 2028 }
2030 sX = floorf(v8->vWorldPosition.x + 0.5f); 2029 sX = floorf(v8->vWorldPosition.x + 0.5f);
2031 sY = floorf(v8->vWorldPosition.z + 0.5f); 2030 sY = floorf(v8->vWorldPosition.z + 0.5f);
2032 v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f)); 2031 v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f));
2033 v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f)); 2032 v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f));
2034 WorldPosToGridCellX(sX); 2033 /*WorldPosToGridCellX(sX);
2035 WorldPosToGridCellZ(sY); 2034 WorldPosToGridCellZ(sY);
2036 if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !sub_481EFA(v8, pVertices, v101, pVertices2, 1)) 2035 if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !sub_481EFA(v8, pVertices, v101, pVertices2, 1))
2037 if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y 2036 if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y
2038 || pVertices2->vWorldPosition.y != v101->vWorldPosition.y ) 2037 || pVertices2->vWorldPosition.y != v101->vWorldPosition.y )
2039 break; 2038 break;*/
2040 v16 = &array_77EC08[pOutdoorCamera->numStru148s]; 2039 v16 = &array_77EC08[pOutdoorCamera->numStru148s];
2041 v16->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); 2040 v16->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
2042 if ( v16->uTileBitmapID != -1 ) 2041 if ( v16->uTileBitmapID != -1 )
2043 { 2042 {
2044 v19 = v97; 2043 v19 = v97;
2172 LABEL_162: 2171 LABEL_162:
2173 v4 = v88 + 1; 2172 v4 = v88 + 1;
2174 if ( ++v88 >= v84 ) 2173 if ( ++v88 >= v84 )
2175 return; 2174 return;
2176 } 2175 }
2177 v40 = &array_77EC08[pOutdoorCamera->numStru148s]; 2176 /* v40 = &array_77EC08[pOutdoorCamera->numStru148s];
2178 v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); 2177 v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
2179 if ( v40->uTileBitmapID == -1 ) 2178 if ( v40->uTileBitmapID == -1 )
2180 goto LABEL_162; 2179 goto LABEL_162;
2181 v42 = pOutdoor->GetSomeOtherTileInfo(sX, sY); 2180 v42 = pOutdoor->GetSomeOtherTileInfo(sX, sY);
2182 BYTE1(v42) |= 0x80u; 2181 BYTE1(v42) |= 0x80u;
2209 //goto LABEL_77; 2208 //goto LABEL_77;
2210 { 2209 {
2211 --pOutdoorCamera->numStru148s; 2210 --pOutdoorCamera->numStru148s;
2212 goto LABEL_112; 2211 goto LABEL_112;
2213 }*/ 2212 }*/
2214 memcpy(&array_50AC10[0], v102, 0x30u); 2213 /*memcpy(&array_50AC10[0], v102, 0x30u);
2215 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); 2214 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
2216 array_50AC10[0].u = 0.0; 2215 array_50AC10[0].u = 0.0;
2217 array_50AC10[0].v = 0.0; 2216 array_50AC10[0].v = 0.0;
2218 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); 2217 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1]));
2219 array_50AC10[1]._rhw = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097; 2218 array_50AC10[1]._rhw = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097;
2234 { 2233 {
2235 byte_76D5C0 |= 2; 2234 byte_76D5C0 |= 2;
2236 stru148(stru_76D590); 2235 stru148(stru_76D590);
2237 atexit(loc_48118F); 2236 atexit(loc_48118F);
2238 }*/ 2237 }*/
2239 v96 = pGame->pLightmapBuilder; 2238 /*v96 = pGame->pLightmapBuilder;
2240 pGame->pLightmapBuilder->StackLights_TerrainFace(v48, (float *)&a4, array_50AC10, 3, 0); 2239 pGame->pLightmapBuilder->StackLights_TerrainFace(v48, (float *)&a4, array_50AC10, 3, 0);
2241 pDecalBuilder->_49BE8A(v40, v48, &a4, array_50AC10, 3, 0); 2240 pDecalBuilder->_49BE8A(v40, v48, &a4, array_50AC10, 3, 0);
2242 uNumVertices = 3; 2241 uNumVertices = 3;
2243 if ( byte_4D864C && pGame->uFlags & 0x80 ) 2242 if ( byte_4D864C && pGame->uFlags & 0x80 )
2244 { 2243 {
2357 if (!__init_flag1) 2356 if (!__init_flag1)
2358 { 2357 {
2359 __init_flag1 = true; 2358 __init_flag1 = true;
2360 stru154::stru154(&static_sub_0048034E_stru_76D578); 2359 stru154::stru154(&static_sub_0048034E_stru_76D578);
2361 }*/ 2360 }*/
2362 v96 = pGame->pLightmapBuilder; 2361 /* v96 = pGame->pLightmapBuilder;
2363 pGame->pLightmapBuilder->StackLights_TerrainFace(v63, &v87, array_50AC10, 3, 1); 2362 pGame->pLightmapBuilder->StackLights_TerrainFace(v63, &v87, array_50AC10, 3, 1);
2364 pDecalBuilder->_49BE8A(v40, v63, &v87, array_50AC10, 3, 1); 2363 pDecalBuilder->_49BE8A(v40, v63, &v87, array_50AC10, 3, 1);
2365 v100 = 3; 2364 v100 = 3;
2366 if ( byte_4D864C && pGame->uFlags & 0x80 ) 2365 if ( byte_4D864C && pGame->uFlags & 0x80 )
2367 { 2366 {
2437 } 2436 }
2438 v71->uNumVertices = v73; 2437 v71->uNumVertices = v73;
2439 OutdoorCamera::Project(v73); 2438 OutdoorCamera::Project(v73);
2440 goto LABEL_154; 2439 goto LABEL_154;
2441 } 2440 }
2442 } 2441 }*/
2443 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); 2442 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
2444 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); 2443 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int);
2445 // 4D864C: using guessed type char byte_4D864C; 2444 // 4D864C: using guessed type char byte_4D864C;
2446 // 76D5C0: using guessed type char static_sub_0048034E_byte_76D5C0__init_flag; 2445 // 76D5C0: using guessed type char static_sub_0048034E_byte_76D5C0__init_flag;
2447 2446