Mercurial > mm7
comparison Indoor.cpp @ 1344:65379a50e4eb
Portals in indoor (continue)
author | Ritor1 |
---|---|
date | Thu, 11 Jul 2013 17:47:12 +0600 |
parents | 2ddb0af0f437 |
children | b99aeb077d4f |
comparison
equal
deleted
inserted
replaced
1339:8bfdc44cebfd | 1344:65379a50e4eb |
---|---|
766 v109 = v6; | 766 v109 = v6; |
767 sub_4AE5F1(v1); | 767 sub_4AE5F1(v1); |
768 v126 = stru_F8AD28.pDeltaUV[0]; | 768 v126 = stru_F8AD28.pDeltaUV[0]; |
769 v128 = stru_F8AD28.pDeltaUV[1]; | 769 v128 = stru_F8AD28.pDeltaUV[1]; |
770 v107 = bUseLoResSprites; | 770 v107 = bUseLoResSprites; |
771 v7 = sub_423B5D(v1); | 771 v7 = GetPortalScreenCoord(v1); |
772 if ( v7 ) | 772 if ( v7 ) |
773 { | 773 { |
774 if ( sub_424829(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) | 774 if ( sub_424829(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) |
775 { | 775 { |
776 if ( v2->uPolygonType == 1 ) | 776 if ( v2->uPolygonType == 1 ) |
1350 if (nodes[node_id].uSectorID != pFace->uSectorID) | 1350 if (nodes[node_id].uSectorID != pFace->uSectorID) |
1351 v9 = -v9; | 1351 v9 = -v9; |
1352 if (v9 >= 0) | 1352 if (v9 >= 0) |
1353 return; | 1353 return; |
1354 | 1354 |
1355 auto num_vertices = sub_423B5D(uFaceID); | 1355 auto num_vertices = GetPortalScreenCoord(uFaceID); |
1356 if (num_vertices < 2) | 1356 if (num_vertices < 2) |
1357 return; | 1357 return; |
1358 | 1358 |
1359 auto face_min_screenspace_x = stru_50B700._screen_space_x[0], | 1359 auto face_min_screenspace_x = PortalFace._screen_space_x[0], |
1360 face_max_screenspace_x = stru_50B700._screen_space_x[0]; | 1360 face_max_screenspace_x = PortalFace._screen_space_x[0]; |
1361 auto face_min_screenspace_y = stru_50B700._screen_space_y[0], | 1361 auto face_min_screenspace_y = PortalFace._screen_space_y[0], |
1362 face_max_screenspace_y = stru_50B700._screen_space_y[0]; | 1362 face_max_screenspace_y = PortalFace._screen_space_y[0]; |
1363 for (uint i = 1; i < num_vertices; ++i) | 1363 for (uint i = 1; i < num_vertices; ++i) |
1364 { | 1364 { |
1365 if (face_min_screenspace_x > stru_50B700._screen_space_x[i]) | 1365 if (face_min_screenspace_x > PortalFace._screen_space_x[i]) |
1366 face_min_screenspace_x = stru_50B700._screen_space_x[i]; | 1366 face_min_screenspace_x = PortalFace._screen_space_x[i]; |
1367 if (face_max_screenspace_x < stru_50B700._screen_space_x[i]) | 1367 if (face_max_screenspace_x < PortalFace._screen_space_x[i]) |
1368 face_max_screenspace_x = stru_50B700._screen_space_x[i]; | 1368 face_max_screenspace_x = PortalFace._screen_space_x[i]; |
1369 | 1369 |
1370 if (face_min_screenspace_y > stru_50B700._screen_space_y[i]) | 1370 if (face_min_screenspace_y > PortalFace._screen_space_y[i]) |
1371 face_min_screenspace_y = stru_50B700._screen_space_y[i]; | 1371 face_min_screenspace_y = PortalFace._screen_space_y[i]; |
1372 if (face_max_screenspace_y < stru_50B700._screen_space_y[i]) | 1372 if (face_max_screenspace_y < PortalFace._screen_space_y[i]) |
1373 face_max_screenspace_y = stru_50B700._screen_space_y[i]; | 1373 face_max_screenspace_y = PortalFace._screen_space_y[i]; |
1374 } | 1374 } |
1375 //_screen_space_x = 719, 568, 493 | 1375 //_screen_space_x = 719, 568, 493 |
1376 //savegame: qw , 0Bh and 0x1D4h | 1376 //savegame: qw , 0Bh and 0x1D4h |
1377 //problem here when standing near/on portal, condition is false because of face_min_screenspace_x > p->uViewportZ | 1377 //problem here when standing near/on portal, condition is false because of face_min_screenspace_x > p->uViewportZ |
1378 if (face_max_screenspace_x >= nodes[node_id].uViewportX && | 1378 if (face_max_screenspace_x >= nodes[node_id].uViewportX && |
1498 + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); | 1498 + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); |
1499 if ( *((short *)v5 + 2004) != v4->uSectorID ) | 1499 if ( *((short *)v5 + 2004) != v4->uSectorID ) |
1500 v9 = -v9; | 1500 v9 = -v9; |
1501 if ( v9 < 0 ) | 1501 if ( v9 < 0 ) |
1502 { | 1502 { |
1503 v10 = sub_423B5D(uFaceID); | 1503 v10 = GetPortalScreenCoord(uFaceID); |
1504 v19 = v10; | 1504 v19 = v10; |
1505 if ( v10 ) | 1505 if ( v10 ) |
1506 { | 1506 { |
1507 v11 = stru_50B700._screen_space_x[0]; | 1507 v11 = PortalFace._screen_space_x[0]; |
1508 v12 = stru_50B700._screen_space_y[0]; | 1508 v12 = PortalFace._screen_space_y[0]; |
1509 v23 = stru_50B700._screen_space_x[0]; | 1509 v23 = PortalFace._screen_space_x[0]; |
1510 v13 = 1; | 1510 v13 = 1; |
1511 v22 = stru_50B700._screen_space_y[0]; | 1511 v22 = PortalFace._screen_space_y[0]; |
1512 if ( v10 > 1 ) | 1512 if ( v10 > 1 ) |
1513 { | 1513 { |
1514 do | 1514 do |
1515 { | 1515 { |
1516 v14 = stru_50B700._screen_space_x[v13]; | 1516 v14 = PortalFace._screen_space_x[v13]; |
1517 if ( v14 < v23 ) | 1517 if ( v14 < v23 ) |
1518 v23 = stru_50B700._screen_space_x[v13]; | 1518 v23 = PortalFace._screen_space_x[v13]; |
1519 if ( v14 > v11 ) | 1519 if ( v14 > v11 ) |
1520 v11 = stru_50B700._screen_space_x[v13]; | 1520 v11 = PortalFace._screen_space_x[v13]; |
1521 v15 = stru_50B700._screen_space_y[v13]; | 1521 v15 = PortalFace._screen_space_y[v13]; |
1522 if ( v15 < v22 ) | 1522 if ( v15 < v22 ) |
1523 v22 = stru_50B700._screen_space_y[v13]; | 1523 v22 = PortalFace._screen_space_y[v13]; |
1524 if ( v15 > v12 ) | 1524 if ( v15 > v12 ) |
1525 v12 = stru_50B700._screen_space_y[v13]; | 1525 v12 = PortalFace._screen_space_y[v13]; |
1526 v10 = v19; | 1526 v10 = v19; |
1527 ++v13; | 1527 ++v13; |
1528 } | 1528 } |
1529 while ( v13 < v19 ); | 1529 while ( v13 < v19 ); |
1530 } | 1530 } |
1586 { | 1586 { |
1587 if ( v1 < (signed int)pIndoor->uNumFaces ) | 1587 if ( v1 < (signed int)pIndoor->uNumFaces ) |
1588 { | 1588 { |
1589 v2 = pBspRenderer->faces[i].uFaceID; | 1589 v2 = pBspRenderer->faces[i].uFaceID; |
1590 pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].field_C; | 1590 pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].field_C; |
1591 v3 = sub_423B5D(v2); | 1591 v3 = GetPortalScreenCoord(v2); |
1592 if ( v3 ) | 1592 if ( v3 ) |
1593 { | 1593 { |
1594 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) | 1594 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) |
1595 { | 1595 { |
1596 v4 = stru_F8A590._viewport_space_y; | 1596 v4 = stru_F8A590._viewport_space_y; |
6908 | 6908 |
6909 //try graphic engine with function returning 1 always, and without | 6909 //try graphic engine with function returning 1 always, and without |
6910 //return true; | 6910 //return true; |
6911 if ( pNumVertices <= 1 ) | 6911 if ( pNumVertices <= 1 ) |
6912 return false; | 6912 return false; |
6913 min_y = stru_50B700._screen_space_y[0]; | 6913 min_y = PortalFace._screen_space_y[0]; |
6914 v65 = 0; | 6914 v65 = 0; |
6915 max_y = stru_50B700._screen_space_y[0]; | 6915 max_y = PortalFace._screen_space_y[0]; |
6916 if ( !stru_50B700.field_0 ) | 6916 if ( !PortalFace.direction ) |
6917 { | 6917 { |
6918 v63 = 1; | 6918 v63 = 1; |
6919 v64 = -1; | 6919 v64 = -1; |
6920 } | 6920 } |
6921 else | 6921 else |
6924 v64 = 1; | 6924 v64 = 1; |
6925 } | 6925 } |
6926 | 6926 |
6927 for ( v6 = 1; v6 < pNumVertices; ++v6 ) | 6927 for ( v6 = 1; v6 < pNumVertices; ++v6 ) |
6928 { | 6928 { |
6929 if ( stru_50B700._screen_space_y[v6] >= min_y ) | 6929 if ( PortalFace._screen_space_y[v6] >= min_y ) |
6930 { | 6930 { |
6931 if ( stru_50B700._screen_space_y[v6] > max_y ) | 6931 if ( PortalFace._screen_space_y[v6] > max_y ) |
6932 max_y = stru_50B700._screen_space_y[v6]; | 6932 max_y = PortalFace._screen_space_y[v6]; |
6933 } | 6933 } |
6934 if ( stru_50B700._screen_space_y[v6] < min_y ) | 6934 if ( PortalFace._screen_space_y[v6] < min_y ) |
6935 { | 6935 { |
6936 v65 = v6; | 6936 v65 = v6; |
6937 min_y = stru_50B700._screen_space_y[v6]; | 6937 min_y = PortalFace._screen_space_y[v6]; |
6938 } | 6938 } |
6939 } | 6939 } |
6940 if ( max_y == min_y ) | 6940 if ( max_y == min_y ) |
6941 return false; | 6941 return false; |
6942 | 6942 |
6953 if ( v10 < 0 ) | 6953 if ( v10 < 0 ) |
6954 v10 += pNumVertices; | 6954 v10 += pNumVertices; |
6955 } | 6955 } |
6956 else | 6956 else |
6957 v10 -= pNumVertices; | 6957 v10 -= pNumVertices; |
6958 if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] ) | 6958 if ( PortalFace._screen_space_y[v10] <= PortalFace._screen_space_y[v65] ) |
6959 { | 6959 { |
6960 v55 = v10; | 6960 v55 = v10; |
6961 v65 = v10; | 6961 v65 = v10; |
6962 } | 6962 } |
6963 if ( stru_50B700._screen_space_y[v10] == max_y ) | 6963 if ( PortalFace._screen_space_y[v10] == max_y ) |
6964 break; | 6964 break; |
6965 } | 6965 } |
6966 v13 = v55 + v64; | 6966 v13 = v55 + v64; |
6967 if ( v13 < pNumVertices ) | 6967 if ( v13 < pNumVertices ) |
6968 { | 6968 { |
6969 if ( v13 < 0 ) | 6969 if ( v13 < 0 ) |
6970 v13 += pNumVertices; | 6970 v13 += pNumVertices; |
6971 } | 6971 } |
6972 else | 6972 else |
6973 v13 -= pNumVertices; | 6973 v13 -= pNumVertices; |
6974 if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] ) | 6974 if ( PortalFace._screen_space_y[v13] != PortalFace._screen_space_y[v55] ) |
6975 { | 6975 { |
6976 v62 = stru_50B700._screen_space_x[v55] << 16; | 6976 v62 = PortalFace._screen_space_x[v55] << 16; |
6977 v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]); | 6977 v54 = ((PortalFace._screen_space_x[v13] - PortalFace._screen_space_x[v55]) << 16) / (PortalFace._screen_space_y[v13] - PortalFace._screen_space_y[v55]); |
6978 a2->viewport_left_side[min_y] = LOWORD(stru_50B700._screen_space_x[v55]); | 6978 a2->viewport_left_side[min_y] = LOWORD(PortalFace._screen_space_x[v55]); |
6979 } | 6979 } |
6980 v15 = v65; | 6980 v15 = v65; |
6981 v61 = v65; | 6981 v61 = v65; |
6982 | 6982 |
6983 for ( v69 = 0; v69 < pNumVertices; ++v69 ) | 6983 for ( v69 = 0; v69 < pNumVertices; ++v69 ) |
6988 if ( v15 < 0 ) | 6988 if ( v15 < 0 ) |
6989 v15 += pNumVertices; | 6989 v15 += pNumVertices; |
6990 } | 6990 } |
6991 else | 6991 else |
6992 v15 -= pNumVertices; | 6992 v15 -= pNumVertices; |
6993 if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] ) | 6993 if ( PortalFace._screen_space_y[v15] <= PortalFace._screen_space_y[v65] ) |
6994 { | 6994 { |
6995 v61 = v15; | 6995 v61 = v15; |
6996 v65 = v15; | 6996 v65 = v15; |
6997 } | 6997 } |
6998 if ( stru_50B700._screen_space_y[v15] == max_y ) | 6998 if ( PortalFace._screen_space_y[v15] == max_y ) |
6999 break; | 6999 break; |
7000 } | 7000 } |
7001 v18 = v63 + v61; | 7001 v18 = v63 + v61; |
7002 if ( v18 < pNumVertices ) | 7002 if ( v18 < pNumVertices ) |
7003 { | 7003 { |
7006 } | 7006 } |
7007 else | 7007 else |
7008 v18 -= pNumVertices; | 7008 v18 -= pNumVertices; |
7009 v19 = v18; | 7009 v19 = v18; |
7010 v20 = v61; | 7010 v20 = v61; |
7011 if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] ) | 7011 if ( PortalFace._screen_space_y[v19] != PortalFace._screen_space_y[v61] ) |
7012 { | 7012 { |
7013 v61 = stru_50B700._screen_space_x[v20] << 16; | 7013 v61 = PortalFace._screen_space_x[v20] << 16; |
7014 v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20]; | 7014 v53 = ((PortalFace._screen_space_x[v19] - PortalFace._screen_space_x[v20]) << 16) / PortalFace._screen_space_y[v19] - PortalFace._screen_space_y[v20]; |
7015 a2->viewport_right_side[max_y] = LOWORD(stru_50B700._screen_space_x[v20]); | 7015 a2->viewport_right_side[max_y] = LOWORD(PortalFace._screen_space_x[v20]); |
7016 } | 7016 } |
7017 v22 = min_y; | 7017 v22 = min_y; |
7018 if ( min_y <= max_y ) | 7018 if ( min_y <= max_y ) |
7019 { | 7019 { |
7020 //v56 = &a2->array_3D8[v7]; | 7020 //v56 = &a2->array_3D8[v7]; |
7021 //v23 = &a2->array_18[v7]; | 7021 //v23 = &a2->array_18[v7]; |
7022 for ( v70 = min_y; v70 <= max_y; ++v70 ) | 7022 for ( v70 = min_y; v70 <= max_y; ++v70 ) |
7023 { | 7023 { |
7024 v24 = v13; | 7024 v24 = v13; |
7025 if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != max_y ) | 7025 if ( v22 >= PortalFace._screen_space_y[v13] && v22 != max_y ) |
7026 { | 7026 { |
7027 v13 = v64 + v13; | 7027 v13 = v64 + v13; |
7028 if ( v13 < pNumVertices ) | 7028 if ( v13 < pNumVertices ) |
7029 { | 7029 { |
7030 if ( v13 < 0 ) | 7030 if ( v13 < 0 ) |
7031 v13 += pNumVertices; | 7031 v13 += pNumVertices; |
7032 } | 7032 } |
7033 else | 7033 else |
7034 v13 -= pNumVertices; | 7034 v13 -= pNumVertices; |
7035 v26 = v13; | 7035 v26 = v13; |
7036 //v27 = stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; | 7036 //v27 = PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24]; |
7037 if ( stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24] > 0 ) | 7037 if ( PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24] > 0 ) |
7038 { | 7038 { |
7039 v54 = ((stru_50B700._screen_space_x[v26] - stru_50B700._screen_space_x[v24]) << 16) / stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; | 7039 v54 = ((PortalFace._screen_space_x[v26] - PortalFace._screen_space_x[v24]) << 16) / PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24]; |
7040 v62 = stru_50B700._screen_space_x[v24] << 16; | 7040 v62 = PortalFace._screen_space_x[v24] << 16; |
7041 } | 7041 } |
7042 } | 7042 } |
7043 v29 = v18; | 7043 v29 = v18; |
7044 if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != max_y ) | 7044 if ( v70 >= PortalFace._screen_space_y[v18] && v70 != max_y ) |
7045 { | 7045 { |
7046 v18 += v63; | 7046 v18 += v63; |
7047 if ( v18 < pNumVertices ) | 7047 if ( v18 < pNumVertices ) |
7048 { | 7048 { |
7049 if ( v18 < 0 ) | 7049 if ( v18 < 0 ) |
7050 v18 += pNumVertices; | 7050 v18 += pNumVertices; |
7051 } | 7051 } |
7052 else | 7052 else |
7053 v18 -= pNumVertices; | 7053 v18 -= pNumVertices; |
7054 v31 = v18; | 7054 v31 = v18; |
7055 //v32 = stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; | 7055 //v32 = PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29]; |
7056 if ( stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29] > 0 ) | 7056 if ( PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29] > 0 ) |
7057 { | 7057 { |
7058 v53 = ((stru_50B700._screen_space_x[v31] - stru_50B700._screen_space_x[v29]) << 16) / stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; | 7058 v53 = ((PortalFace._screen_space_x[v31] - PortalFace._screen_space_x[v29]) << 16) / PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29]; |
7059 v61 = stru_50B700._screen_space_x[v29] << 16; | 7059 v61 = PortalFace._screen_space_x[v29] << 16; |
7060 } | 7060 } |
7061 } | 7061 } |
7062 //v34 = (char *)a2->array_18 - (char *)a2->array_3D8; | 7062 //v34 = (char *)a2->array_18 - (char *)a2->array_3D8; |
7063 //v35 = *(__int16 *)((char *)&a2->array_3D8[v70] + v34); | 7063 //v35 = *(__int16 *)((char *)&a2->array_3D8[v70] + v34); |
7064 //v35 = HIWORD(v62); | 7064 //v35 = HIWORD(v62); |
7162 } | 7162 } |
7163 } | 7163 } |
7164 return true; | 7164 return true; |
7165 } | 7165 } |
7166 //----- (00423B5D) -------------------------------------------------------- | 7166 //----- (00423B5D) -------------------------------------------------------- |
7167 int __fastcall sub_423B5D(unsigned int uFaceID) | 7167 int __fastcall GetPortalScreenCoord(unsigned int uFaceID) |
7168 { | 7168 { |
7169 BLVFace *pFace; // ebx@1 | 7169 BLVFace *pFace; // ebx@1 |
7170 //Vec3_short_ *v2; // esi@1 | 7170 int pNextVertices; // edx@11 |
7171 //int v3; // ST28_4@1 | 7171 int t; // ST28_4@12 |
7172 //__int16 v4; // ST2C_2@1 | |
7173 //signed int v5; // esi@1 | |
7174 //Vec3_short_ *v6; // eax@4 | |
7175 //signed int v7; // edi@5 | |
7176 //signed int bFound; // eax@5 | |
7177 //signed int v9; // ecx@10 | |
7178 //int v10; // eax@10 | |
7179 //int v11; // edx@11 | |
7180 int v12; // ST28_4@12 | |
7181 signed int v13; // edx@12 | 7172 signed int v13; // edx@12 |
7182 signed __int64 v14; // qtt@12 | 7173 signed __int64 v14; // qtt@12 |
7183 char *v15; // ebx@12 | |
7184 int v16; // ST28_4@14 | |
7185 signed int v17; // eax@14 | 7174 signed int v17; // eax@14 |
7186 signed __int64 v18; // qtt@14 | 7175 signed __int64 v18; // qtt@14 |
7187 signed int v19; // edx@15 | |
7188 signed int v20; // edx@17 | 7176 signed int v20; // edx@17 |
7189 signed int v21; // ebx@19 | |
7190 signed int v22; // esi@20 | |
7191 int v23; // edi@21 | |
7192 int v24; // eax@21 | |
7193 int v25; // eax@22 | 7177 int v25; // eax@22 |
7194 int v26; // eax@22 | 7178 int pScreenX; // eax@22 |
7195 signed int v27; // ST30_4@24 | |
7196 signed __int64 v28; // qtt@24 | |
7197 int v29; // ST18_4@25 | |
7198 int v30; // eax@26 | |
7199 int v31; // eax@27 | 7179 int v31; // eax@27 |
7200 int v32; // eax@27 | 7180 int pScreenY; // eax@27 |
7201 signed int v33; // ST30_4@29 | |
7202 signed __int64 v34; // qtt@29 | |
7203 int v35; // ST30_4@30 | 7181 int v35; // ST30_4@30 |
7204 signed int v36; // edi@31 | 7182 signed int left_num_vertices; // edi@31 |
7205 unsigned int v37; // eax@31 | 7183 signed int right_num_vertices; // ebx@41 |
7206 bool v38; // edx@31 | 7184 signed int top_num_vertices; // edi@51 |
7207 int v39; // ecx@31 | 7185 int bottom_num_vertices; // ebx@61 |
7208 int v40; // ecx@32 | |
7209 int v41; // esi@32 | |
7210 int v42; // eax@34 | |
7211 signed int v43; // ebx@41 | |
7212 unsigned int v44; // eax@41 | |
7213 signed int v45; // ecx@42 | |
7214 int v46; // esi@42 | |
7215 int v47; // eax@44 | |
7216 signed int v48; // edi@51 | |
7217 unsigned int v49; // eax@51 | |
7218 bool v50; // edx@51 | |
7219 int v51; // ecx@51 | |
7220 int v52; // ecx@52 | |
7221 int v53; // esi@52 | |
7222 int v54; // eax@54 | |
7223 int v55; // ebx@61 | |
7224 unsigned int v56; // eax@61 | |
7225 signed int v57; // ecx@62 | |
7226 int v58; // esi@62 | |
7227 int v59; // eax@64 | |
7228 char v61; // zf@72 | |
7229 signed int v62; // edx@75 | 7186 signed int v62; // edx@75 |
7230 int v63; // ecx@76 | 7187 int v63; // ecx@76 |
7231 int v64; // esi@76 | 7188 int v64; // esi@76 |
7232 int v65; // ecx@83 | 7189 int v65; // ecx@83 |
7233 //signed int v66; // [sp+14h] [bp-14h]@3 | |
7234 int v67; // [sp+14h] [bp-14h]@34 | |
7235 int v68; // [sp+14h] [bp-14h]@44 | |
7236 int v69; // [sp+14h] [bp-14h]@54 | |
7237 int v70; // [sp+14h] [bp-14h]@64 | |
7238 signed int v71; // [sp+14h] [bp-14h]@75 | 7190 signed int v71; // [sp+14h] [bp-14h]@75 |
7239 //IndoorCameraD3D *_this; // [sp+18h] [bp-10h]@1 | |
7240 bool current_vertices_flag; // [sp+18h] [bp-10h]@9 | 7191 bool current_vertices_flag; // [sp+18h] [bp-10h]@9 |
7241 int thisb; // [sp+18h] [bp-10h]@12 | 7192 int thisb; // [sp+18h] [bp-10h]@12 |
7242 int thisc; // [sp+18h] [bp-10h]@20 | |
7243 bool thisd; // [sp+18h] [bp-10h]@41 | |
7244 bool thise; // [sp+18h] [bp-10h]@61 | |
7245 int thisf; // [sp+18h] [bp-10h]@74 | 7193 int thisf; // [sp+18h] [bp-10h]@74 |
7246 signed int depth_num_vertices; // [sp+1Ch] [bp-Ch]@9 | 7194 signed int depth_num_vertices; // [sp+1Ch] [bp-Ch]@9 |
7247 int v80; // [sp+1Ch] [bp-Ch]@76 | 7195 int v80; // [sp+1Ch] [bp-Ch]@76 |
7248 bool next_vertices_flag; // [sp+20h] [bp-8h]@10 | 7196 bool next_vertices_flag; // [sp+20h] [bp-8h]@10 |
7249 bool v82; // [sp+20h] [bp-8h]@32 | |
7250 bool v83; // [sp+20h] [bp-8h]@42 | |
7251 bool v84; // [sp+20h] [bp-8h]@52 | |
7252 bool v85; // [sp+20h] [bp-8h]@62 | |
7253 //signed int v86; // [sp+24h] [bp-4h]@9 | |
7254 signed int v87; // [sp+24h] [bp-4h]@19 | |
7255 signed int v88; // [sp+24h] [bp-4h]@31 | |
7256 signed int v89; // [sp+24h] [bp-4h]@41 | |
7257 signed int v90; // [sp+24h] [bp-4h]@51 | 7197 signed int v90; // [sp+24h] [bp-4h]@51 |
7258 signed int v91; // [sp+24h] [bp-4h]@61 | |
7259 | 7198 |
7260 pFace = &pIndoor->pFaces[uFaceID]; | 7199 pFace = &pIndoor->pFaces[uFaceID]; |
7261 memset(&stru_50B700, 0, sizeof(stru367)); | 7200 memset(&PortalFace, 0, sizeof(stru367)); |
7262 //_this = pGame->pIndoorCameraD3D; | 7201 |
7263 //v2 = &pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]]; | 7202 //get direction the face(определение направленности фейса)********************************************************************************* |
7264 //v3 = *(_DWORD *)pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x; | |
7265 //v4 = pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z; | |
7266 //v5 = 0; | |
7267 if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) | 7203 if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) |
7268 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) | 7204 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) |
7269 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) | 7205 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) |
7270 { | 7206 { |
7271 stru_50B700.field_0 = 1; | 7207 PortalFace.direction = true; |
7272 } | 7208 } |
7273 else | 7209 else |
7274 { | 7210 { |
7275 stru_50B700.field_0 = 0; | 7211 PortalFace.direction = false; |
7276 if ( !(pFace->Portal()) ) | 7212 if ( !(pFace->Portal()) ) |
7277 return 0; | 7213 return 0; |
7278 } | 7214 } |
7279 //v66 = pFace->uNumVertices; | 7215 //***************************************************************************************************************************************** |
7216 //generate/cinvertetion in camera location coordinates(генерация/конвертирование в координаты пространства камеры) | |
7217 | |
7218 //for new coordinates: | |
7219 //int x = 0x AAAA BBBB; | |
7220 //AAAA - integer(целая часть), BBBB - fractional(дробная) | |
7221 //float v = HIWORD(x) + LOWORD(x) / 65535.0f; | |
7222 //0x0351A281 это 849(351 в шестнадцатиричной) в целой части и A281 в дробной(хотя как точно BBBB считалась не помню) | |
7223 //if in HIWORD: FFFF = -1 | |
7224 //FFFE = -2 | |
7225 //FFFD = -3 | |
7226 //.... | |
7227 //8000 = -32767 | |
7228 //7FFF = 32767 | |
7229 //7FFE = 32766 | |
7230 //если в LOWORD например лежит FFFF то не совсем понятно, что это | |
7231 //потому что если и hiword и loword равны FFFF FFFF то двойное отрицание как бы, нужно тестировать что конкретно получается чтобы понять что это значит | |
7232 //всё что больше 7FFF для верхнего слова это идёт уже с минусом/Nomad/ | |
7233 | |
7280 if ( (signed int)pFace->uNumVertices > 0 ) | 7234 if ( (signed int)pFace->uNumVertices > 0 ) |
7281 { | 7235 { |
7282 for (uint i = 0; i < pFace->uNumVertices; ++i) | 7236 for (uint i = 0; i < pFace->uNumVertices; ++i) |
7283 { | 7237 { |
7284 //v6 = &pIndoor->pVertices[pFace->pVertexIDs[v5]]; | 7238 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(pIndoor->pVertices[pFace->pVertexIDs[i]].x, |
7285 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( | 7239 pIndoor->pVertices[pFace->pVertexIDs[i]].y, |
7286 pIndoor->pVertices[pFace->pVertexIDs[i]].x, | 7240 pIndoor->pVertices[pFace->pVertexIDs[i]].z, |
7287 pIndoor->pVertices[pFace->pVertexIDs[i]].y, | 7241 &PortalFace._view_transformed_z[i + 3], &PortalFace._view_transformed_x[i + 3], &PortalFace._view_transformed_y[i + 3], 0); |
7288 pIndoor->pVertices[pFace->pVertexIDs[i]].z, | 7242 } |
7289 &stru_50B700._view_transformed_xs[i + 3], | 7243 } |
7290 &stru_50B700._view_transformed_zs[i + 3], | 7244 //х: 55681665, 55681665, 53050369, 47787777, 45156481, 45156481 |
7291 &stru_50B700._view_transformed_ys[i + 3], | 7245 //x: 0x0351 a281,0x0351 a281,0x0329 7c01,0x02d9 2f01,0x02b1 0881,0x02b1 0881 |
7292 0); | 7246 //***************************************************************************************************************************************** |
7293 } | 7247 //check vertices for the nearest plane(проверка вершин есть ли в области за ближайшей плоскостью) |
7294 } | |
7295 //v7 = pFace->uNumVertices; | |
7296 if ( pFace->uNumVertices <= 0 ) | 7248 if ( pFace->uNumVertices <= 0 ) |
7297 return 0; | 7249 return 0; |
7298 bool bFound = false; | 7250 bool bFound = false; |
7299 for (uint i = 0; i < pFace->uNumVertices; ++i) | 7251 for (uint i = 0; i < pFace->uNumVertices; ++i) |
7300 { | 7252 { |
7301 if ( stru_50B700._view_transformed_xs[i + 3] >= 524288 ) | 7253 if ( PortalFace._view_transformed_z[i + 3] >= 524288 )// 8.0(0x80000) |
7302 { | 7254 { |
7303 bFound = true; | 7255 bFound = true; |
7304 break; | 7256 break; |
7305 } | 7257 } |
7306 } | 7258 } |
7307 if ( !bFound ) | 7259 if ( !bFound ) |
7308 return 0; | 7260 return 0; |
7309 | 7261 //***************************************************************************************************************************************** |
7262 //check for near clip plane(проверка по ближней границе) | |
7263 // | |
7264 // v0 v1 | |
7265 // ._________________. | |
7266 // / \ | |
7267 // / \ | |
7268 // v5. . v2 | |
7269 // | | | |
7270 // | | | |
7271 // | | | |
7272 // ---------------------------- 8.0(near_clip) | |
7273 // | | | |
7274 // ._______________________. | |
7275 // v4 v3 | |
7310 depth_num_vertices = 0; | 7276 depth_num_vertices = 0; |
7311 stru_50B700._view_transformed_xs[pFace->uNumVertices + 3] = stru_50B700._view_transformed_xs[3]; | 7277 PortalFace._view_transformed_z[pFace->uNumVertices + 3] = PortalFace._view_transformed_z[3]; |
7312 stru_50B700._view_transformed_zs[pFace->uNumVertices + 3] = stru_50B700._view_transformed_zs[3]; | 7278 PortalFace._view_transformed_x[pFace->uNumVertices + 3] = PortalFace._view_transformed_x[3]; |
7313 stru_50B700._view_transformed_ys[pFace->uNumVertices + 3] = stru_50B700._view_transformed_ys[3]; | 7279 PortalFace._view_transformed_y[pFace->uNumVertices + 3] = PortalFace._view_transformed_y[3]; |
7314 current_vertices_flag = stru_50B700._view_transformed_xs[3] >= 524288; | 7280 current_vertices_flag = PortalFace._view_transformed_z[3] >= 524288;// 8.0(0x80000) |
7315 //v86 = 1; | |
7316 if ( pFace->uNumVertices >= 1 ) | 7281 if ( pFace->uNumVertices >= 1 ) |
7317 { | 7282 { |
7318 for ( uint i = 1; i <= pFace->uNumVertices; ++i) | 7283 for ( uint i = 1; i <= pFace->uNumVertices; ++i) |
7319 { | 7284 { |
7320 //v9 = v86; | 7285 next_vertices_flag = PortalFace._view_transformed_z[i + 3] >= 524288;// 8.0(0x80000) |
7321 //v10 = stru_50B700._view_transformed_xs[v86 + 3]; | 7286 if ( current_vertices_flag ^ next_vertices_flag )//или текущая или следующая вершина за ближней границей |
7322 next_vertices_flag = stru_50B700._view_transformed_xs[i + 3] >= 524288; | 7287 { |
7323 if ( current_vertices_flag ^ next_vertices_flag ) | 7288 if ( next_vertices_flag )//следующая вершина за ближней границей |
7324 { | |
7325 //v11 = stru_50B700._view_transformed_xs[i + 2]; | |
7326 if ( stru_50B700._view_transformed_xs[i + 3] >= 524288 ) | |
7327 { | 7289 { |
7328 v12 = stru_50B700._view_transformed_xs[i + 3] - stru_50B700._view_transformed_xs[i + 2]; | 7290 v13 = 524288 - PortalFace._view_transformed_z[i + 2]; |
7329 v13 = 524288 - stru_50B700._view_transformed_xs[i + 2]; | |
7330 LODWORD(v14) = v13 << 16; | 7291 LODWORD(v14) = v13 << 16; |
7331 HIDWORD(v14) = v13 >> 16; | 7292 HIDWORD(v14) = v13 >> 16; |
7332 v15 = (char *)&stru_50B700._view_transformed_ys[i + 2]; | 7293 //t = near_clip - v0.z / v1.z - v0.z |
7333 stru_50B700._view_transformed_zs[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i + 3] | 7294 t = v14 / PortalFace._view_transformed_z[i + 3] - PortalFace._view_transformed_z[i + 2]; |
7334 - stru_50B700._view_transformed_zs[i + 2]) | 7295 //New_x = (v1.x - v0.x)*t + v0.x |
7335 * v14 | 7296 PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 3] |
7336 / v12) >> 16) | 7297 - PortalFace._view_transformed_x[i + 2]) * t) >> 16) + PortalFace._view_transformed_x[i + 2]; |
7337 + stru_50B700._view_transformed_zs[i + 2]; | 7298 //New_y = (v1.y - v0.y)*t + v0.y |
7338 thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i + 3] - stru_50B700._view_transformed_ys[i + 2]) | 7299 PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 3] - PortalFace._view_transformed_y[i + 2]) |
7339 * v14 | 7300 * t) >> 16) + PortalFace._view_transformed_y[i + 2]; |
7340 / v12) >> 16; | 7301 //New_z = 8.0(0x80000) |
7302 PortalFace._view_transformed_z[depth_num_vertices] = 524288; | |
7341 } | 7303 } |
7342 else | 7304 else// текущая вершина за ближней границей |
7343 { | 7305 { |
7344 v16 = stru_50B700._view_transformed_xs[i + 2] - stru_50B700._view_transformed_xs[i + 3]; | 7306 v17 = 524288 - PortalFace._view_transformed_z[i + 3]; |
7345 v17 = 524288 - stru_50B700._view_transformed_xs[i + 3]; | |
7346 LODWORD(v18) = v17 << 16; | 7307 LODWORD(v18) = v17 << 16; |
7347 HIDWORD(v18) = v17 >> 16; | 7308 HIDWORD(v18) = v17 >> 16; |
7348 v15 = (char *)&stru_50B700._view_transformed_ys[i + 3]; | 7309 //t = near_clip - v1.z / v0.z - v1.z |
7349 stru_50B700._view_transformed_zs[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i + 2] | 7310 t = v18 / PortalFace._view_transformed_z[i + 2] - PortalFace._view_transformed_z[i + 3]; |
7350 - stru_50B700._view_transformed_zs[i + 3]) | 7311 //New_x = (v0.x - v1.x)*t + v1.x |
7351 * v18 | 7312 PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 2] |
7352 / v16) >> 16) | 7313 - PortalFace._view_transformed_x[i + 3]) * t) >> 16) + PortalFace._view_transformed_x[i + 3]; |
7353 + stru_50B700._view_transformed_zs[i + 3]; | 7314 //New_y = (v0.x - v1.y)*t + v1.y |
7354 thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i + 2] - stru_50B700._view_transformed_ys[i + 3]) | 7315 PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 2] - PortalFace._view_transformed_y[i + 3]) |
7355 * v18 | 7316 * t) >> 16) + PortalFace._view_transformed_y[i + 3]; |
7356 / v16) >> 16; | 7317 //New_z = 8.0(0x80000) |
7318 PortalFace._view_transformed_z[depth_num_vertices] = 524288; | |
7357 } | 7319 } |
7358 v19 = depth_num_vertices++; | 7320 depth_num_vertices++; |
7359 //v7 = pFace->uNumVertices; | 7321 } |
7360 stru_50B700._view_transformed_ys[v19] = thisb + *(_DWORD *)v15; | 7322 if ( next_vertices_flag )//если следующая вершина за ближней границей |
7361 stru_50B700._view_transformed_xs[v19] = 524288; | 7323 { |
7362 } | 7324 pNextVertices = depth_num_vertices++; |
7363 if ( next_vertices_flag ) | 7325 PortalFace._view_transformed_z[pNextVertices] = PortalFace._view_transformed_z[i + 3]; |
7364 { | 7326 PortalFace._view_transformed_x[pNextVertices] = PortalFace._view_transformed_x[i + 3]; |
7365 v20 = depth_num_vertices++; | 7327 PortalFace._view_transformed_y[pNextVertices] = PortalFace._view_transformed_y[i + 3]; |
7366 stru_50B700._view_transformed_xs[v20] = stru_50B700._view_transformed_xs[i + 3]; | |
7367 stru_50B700._view_transformed_zs[v20] = stru_50B700._view_transformed_zs[i + 3]; | |
7368 stru_50B700._view_transformed_ys[v20] = stru_50B700._view_transformed_ys[i + 3]; | |
7369 } | 7328 } |
7370 current_vertices_flag = next_vertices_flag; | 7329 current_vertices_flag = next_vertices_flag; |
7371 } | 7330 } |
7372 } | 7331 } |
7373 | 7332 //результат: нет моргания на границе портала(когда проходим сквозь портал) |
7374 v87 = 0; | 7333 //************************************************************************************************************************************ |
7375 v21 = depth_num_vertices; | 7334 //convertion in screen coordinates(конвертирование в координаты экрана) |
7376 stru_50B700._view_transformed_xs[depth_num_vertices] = stru_50B700._view_transformed_xs[0]; | 7335 PortalFace._view_transformed_z[depth_num_vertices] = PortalFace._view_transformed_z[0]; |
7377 stru_50B700._view_transformed_zs[depth_num_vertices] = stru_50B700._view_transformed_zs[0]; | 7336 PortalFace._view_transformed_x[depth_num_vertices] = PortalFace._view_transformed_x[0]; |
7378 for ( stru_50B700._view_transformed_ys[depth_num_vertices] = stru_50B700._view_transformed_ys[0]; | 7337 PortalFace._view_transformed_y[depth_num_vertices] = PortalFace._view_transformed_y[0]; |
7379 v87 < depth_num_vertices; | 7338 for ( uint i = 0; i < depth_num_vertices; ++i ) |
7380 stru_50B700._screen_space_y[v22 + 12] = pBLVRenderParams->uViewportCenterY - v35 ) | 7339 { |
7381 { | 7340 if ( (abs(PortalFace._view_transformed_x[i]) >> 13) <= abs(PortalFace._view_transformed_z[i]) ) |
7382 v22 = v87; | 7341 pScreenX = fixpoint_div(PortalFace._view_transformed_x[i], PortalFace._view_transformed_z[i]); |
7383 thisc = abs(stru_50B700._view_transformed_xs[v87]); | |
7384 if ( abs(stru_50B700._view_transformed_zs[v87]) >> 13 <= thisc ) | |
7385 { | |
7386 v27 = stru_50B700._view_transformed_zs[v22]; | |
7387 LODWORD(v28) = v27 << 16; | |
7388 HIDWORD(v28) = v27 >> 16; | |
7389 v26 = v28 / stru_50B700._view_transformed_xs[v22]; | |
7390 v23 = 0; | |
7391 } | |
7392 else | 7342 else |
7393 { | 7343 { |
7394 v23 = 0; | 7344 if ( PortalFace._view_transformed_x[i] >= 0 ) |
7395 v24 = 0; | 7345 { |
7396 if ( stru_50B700._view_transformed_zs[v22] >= 0 ) | 7346 if (PortalFace._view_transformed_z[i] >= 0) |
7397 { | 7347 pScreenX = 0x400000; // 64.0 |
7398 //LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; | |
7399 //v26 = ((v24 - 1) & 0xFF800000) + 4194304; | |
7400 if (stru_50B700._view_transformed_xs[v22] >= 0) | |
7401 v26 = 0x400000; // 64.0 | |
7402 else | 7348 else |
7403 v26 = 0xFFC00000; | 7349 pScreenX = 0xFFC00000; // -63.0 |
7404 } | 7350 } |
7405 else | 7351 else |
7406 { | 7352 { |
7407 //LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; | 7353 if (PortalFace._view_transformed_z[i] >= 0) |
7408 //v25 = v24 - 1; | 7354 pScreenX = 0xFFC00000; // -63.0 |
7409 //v26 = (v25 & 0x800000) - 4194304; | |
7410 if (stru_50B700._view_transformed_xs[v22] >= 0) | |
7411 v26 = 0xFFC00000; // -63.0 | |
7412 else | 7355 else |
7413 v26 = 0x400000; | 7356 pScreenX = 0x400000; // 64.0 |
7414 } | 7357 } |
7415 } | 7358 } |
7416 | 7359 |
7417 v29 = stru_50B700._view_transformed_ys[v22]; | 7360 if ( (abs(PortalFace._view_transformed_y[i]) >> 13) <= abs(PortalFace._view_transformed_z[i]) ) |
7418 stru_50B700._screen_space_x[v22 + 12] = v26; | 7361 pScreenY = fixpoint_div(PortalFace._view_transformed_y[i], PortalFace._view_transformed_z[i]); |
7419 if ( abs(v29) >> 13 <= thisc ) | |
7420 { | |
7421 v33 = stru_50B700._view_transformed_ys[v22]; | |
7422 LODWORD(v34) = v33 << 16; | |
7423 HIDWORD(v34) = v33 >> 16; | |
7424 v32 = v34 / stru_50B700._view_transformed_xs[v22]; | |
7425 } | |
7426 else | 7362 else |
7427 { | 7363 { |
7428 v30 = 0; | 7364 if ( PortalFace._view_transformed_y[i] >= 0 ) |
7429 if ( stru_50B700._view_transformed_ys[v22] >= v23 ) | 7365 { |
7430 { | 7366 if (PortalFace._view_transformed_z[i] >= 0) |
7431 //LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; | 7367 pScreenY = 0x400000; // 64.0 |
7432 //v32 = ((v30 - 1) & 0xFF800000) + 4194304; | |
7433 if (stru_50B700._view_transformed_xs[v22] >= v23) | |
7434 v32 = 0x400000; // 64.0 | |
7435 else | 7368 else |
7436 v32 = 0xFFC00000; | 7369 pScreenY = 0xFFC00000; // -63.0 |
7437 } | 7370 } |
7438 else | 7371 else |
7439 { | 7372 { |
7440 //LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; | 7373 if (PortalFace._view_transformed_z[i] >= 0) |
7441 //v31 = v30 - 1; | 7374 pScreenY = 0xFFC00000; // -63.0 |
7442 //v32 = (v31 & 0x800000) - 4194304; | |
7443 if (stru_50B700._view_transformed_xs[v22] >= v23) | |
7444 v32 = 0xFFC00000; // -63.0 | |
7445 else | 7375 else |
7446 v32 = 0x400000; | 7376 pScreenY = 0x400000; // 64.0 |
7447 } | 7377 } |
7448 } | 7378 } |
7449 stru_50B700._screen_space_y[v22 + 12] = v32; | 7379 PortalFace._screen_space_x[i + 12] = pBLVRenderParams->uViewportCenterX - ((unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)pScreenX) >> 16); |
7450 stru_50B700._screen_space_x[v22 + 12] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) | 7380 PortalFace._screen_space_y[i + 12] = pBLVRenderParams->uViewportCenterY - ((unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)pScreenY) >> 16); |
7451 * (signed __int64)stru_50B700._screen_space_x[v22 + 12]) >> 16; | 7381 } |
7452 v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._screen_space_y[v22 + 12]) >> 16; | 7382 //х -34, 4, 61, 83, 83, -34 |
7453 stru_50B700._screen_space_x[v22 + 12] = pBLVRenderParams->uViewportCenterX - stru_50B700._screen_space_x[v22 + 12]; | 7383 //y 211, 152, 172, 216, 273, 293 |
7454 ++v87; | 7384 // результат: при повороте камеры, когда граница портала сдвигается к краю экрана, портал остается прозрачным(видимым) |
7455 } | 7385 //****************************************************************************************************************************************** |
7456 v36 = 0; | 7386 //check for left_clip plane(порверка по левой границе) |
7457 stru_50B700._screen_space_x[v21 + 12] = stru_50B700._screen_space_x[12]; | 7387 left_num_vertices = 0; |
7458 stru_50B700._screen_space_y[v21 + 12] = stru_50B700._screen_space_y[12]; | 7388 PortalFace._screen_space_x[depth_num_vertices + 12] = PortalFace._screen_space_x[12]; |
7459 v37 = pBLVRenderParams->uViewportX; | 7389 PortalFace._screen_space_y[depth_num_vertices + 12] = PortalFace._screen_space_y[12]; |
7460 v38 = stru_50B700._screen_space_x[12] < (signed int)pBLVRenderParams->uViewportX; | 7390 current_vertices_flag = PortalFace._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX; |
7461 LOBYTE(v38) = stru_50B700._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX; | |
7462 v39 = 1; | |
7463 v88 = 1; | |
7464 if ( depth_num_vertices < 1 ) | 7391 if ( depth_num_vertices < 1 ) |
7465 return 0; | 7392 return 0; |
7466 do | 7393 for ( uint i = 1; i <= depth_num_vertices; ++i ) |
7467 { | 7394 { |
7468 v40 = v39; | 7395 next_vertices_flag = PortalFace._screen_space_x[i + 12] >= (signed int)pBLVRenderParams->uViewportX; |
7469 v41 = stru_50B700._screen_space_x[v40 + 12]; | 7396 if ( current_vertices_flag ^ next_vertices_flag ) |
7470 v82 = v41 >= (signed int)v37; | 7397 { |
7471 if ( v38 ^ v82 ) | 7398 if ( next_vertices_flag ) |
7472 { | 7399 { |
7473 if ( v41 >= (signed int)v37 ) | 7400 //t = left_clip - v0.x / v1.x - v0.x |
7474 { | 7401 t = (signed __int64)(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 11]) |
7475 v67 = (signed int)(v37 - stru_50B700._screen_space_x[v40 + 11]) | 7402 / (PortalFace._screen_space_x[i + 12] - PortalFace._screen_space_x[i + 11]); |
7476 * (signed __int64)(stru_50B700._screen_space_y[v40 + 12] - stru_50B700._screen_space_y[v40 + 11]) | 7403 //New_y = (v1.y - v0.y)*t + v0.y |
7477 / (v41 - stru_50B700._screen_space_x[v40 + 11]); | 7404 PortalFace._screen_space_y[left_num_vertices + 9] = (signed int)(PortalFace._screen_space_y[i + 12]- PortalFace._screen_space_y[i + 11]) |
7478 v42 = stru_50B700._screen_space_y[v40 + 11]; | 7405 * t + PortalFace._screen_space_y[i + 11]; |
7406 //New_x = left_clip | |
7407 PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX; | |
7479 } | 7408 } |
7480 else | 7409 else |
7481 { | 7410 { |
7482 v67 = (signed int)(v37 - v41) | 7411 //t = left_clip - v1.x / v0.x - v1.x |
7483 * (signed __int64)(stru_50B700._screen_space_y[v40 + 11] - stru_50B700._screen_space_y[v40 + 12]) | 7412 t = (signed __int64)(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 12]) |
7484 / (stru_50B700._screen_space_x[v40 + 11] - v41); | 7413 / (PortalFace._screen_space_x[i + 11] - PortalFace._screen_space_x[i + 12]); |
7485 v42 = stru_50B700._screen_space_y[v40 + 12]; | 7414 //New_y = (v0.y - v1.y)*t + v1.y |
7486 } | 7415 PortalFace._screen_space_y[left_num_vertices + 9] = (signed int)( PortalFace._screen_space_y[i + 11] - PortalFace._screen_space_y[i + 12]) |
7487 ++v36; | 7416 * t + PortalFace._screen_space_y[i + 12]; |
7488 stru_50B700._screen_space_y[v36 + 8] = v67 + v42; | 7417 //New_x = left_clip |
7489 v37 = pBLVRenderParams->uViewportX; | 7418 PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX; |
7490 stru_50B700._screen_space_x[v36 + 8] = pBLVRenderParams->uViewportX; | 7419 } |
7491 } | 7420 left_num_vertices++; |
7492 v38 = v82; | 7421 } |
7493 if ( v82 ) | 7422 if ( next_vertices_flag ) |
7494 { | 7423 { |
7495 stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[v40 + 12]; | 7424 pNextVertices = left_num_vertices++; |
7496 stru_50B700._screen_space_y[v36++ + 9] = stru_50B700._screen_space_y[v40 + 12]; | 7425 PortalFace._screen_space_x[pNextVertices + 9] = PortalFace._screen_space_x[i + 12]; |
7497 } | 7426 PortalFace._screen_space_y[pNextVertices + 9] = PortalFace._screen_space_y[i + 12]; |
7498 v39 = v88++ + 1; | 7427 } |
7499 } | 7428 current_vertices_flag = next_vertices_flag; |
7500 while ( v88 <= depth_num_vertices ); | 7429 } |
7501 if ( !v36 | 7430 //********************************************************************************************************************************* |
7502 || (v43 = 0, | 7431 //for right_clip plane(проверка по правой плоскости) |
7503 stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[9], | 7432 right_num_vertices = 0; |
7504 stru_50B700._screen_space_y[v36 + 9] = stru_50B700._screen_space_y[9], | 7433 PortalFace._screen_space_x[left_num_vertices + 9] = PortalFace._screen_space_x[9]; |
7505 v44 = pBLVRenderParams->uViewportZ, | 7434 PortalFace._screen_space_y[left_num_vertices + 9] = PortalFace._screen_space_y[9]; |
7506 thisd = stru_50B700._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ, | 7435 current_vertices_flag = PortalFace._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ; |
7507 v89 = 1, | 7436 if (left_num_vertices < 1) |
7508 v36 < 1) ) | |
7509 return 0; | 7437 return 0; |
7510 do | 7438 for ( uint i = 1; i <= left_num_vertices; ++i ) |
7511 { | 7439 { |
7512 v45 = v89; | 7440 next_vertices_flag = PortalFace._screen_space_x[i + 9] <= (signed int)pBLVRenderParams->uViewportZ; |
7513 v46 = stru_50B700._screen_space_x[v89 + 9]; | 7441 if ( current_vertices_flag ^ next_vertices_flag ) |
7514 v83 = v46 <= (signed int)v44; | 7442 { |
7515 if ( thisd ^ v83 ) | 7443 if ( next_vertices_flag ) |
7516 { | 7444 { |
7517 if ( v46 <= (signed int)v44 ) | 7445 //t = right_clip - v1.x / v0.x - v1.x |
7518 { | 7446 t = (signed __int64)(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 9]) |
7519 v68 = (signed int)(v44 - stru_50B700._screen_space_x[v45 + 8]) | 7447 / (PortalFace._screen_space_x[i + 8] - PortalFace._screen_space_x[i + 9]); |
7520 * (signed __int64)(stru_50B700._screen_space_y[v45 + 9] - stru_50B700._screen_space_y[v45 + 8]) | 7448 //New_y = (v0.y - v1.y)*t + v1.y |
7521 / (v46 - stru_50B700._screen_space_x[v45 + 8]); | 7449 PortalFace._screen_space_y[right_num_vertices + 6] = (signed int)(PortalFace._screen_space_y[i + 8] - PortalFace._screen_space_y[i + 9]) |
7522 v47 = stru_50B700._screen_space_y[v45 + 8]; | 7450 * t + PortalFace._screen_space_y[i + 9]; |
7451 //New_x = right_clip | |
7452 PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ; | |
7523 } | 7453 } |
7524 else | 7454 else |
7525 { | 7455 { |
7526 v68 = (signed int)(v44 - v46) | 7456 //t = right_clip - v0.x / v1.x - v0.x |
7527 * (signed __int64)(stru_50B700._screen_space_y[v45 + 8] - stru_50B700._screen_space_y[v45 + 9]) | 7457 t = (signed __int64)(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 8]) |
7528 / (stru_50B700._screen_space_x[v45 + 8] - v46); | 7458 / (PortalFace._screen_space_x[i + 9] - PortalFace._screen_space_x[i + 8]); |
7529 v47 = stru_50B700._screen_space_y[v45 + 9]; | 7459 //New_y = (v1.y - v0.y)*t + v0.y |
7530 } | 7460 PortalFace._screen_space_y[right_num_vertices + 6] = (signed int)(PortalFace._screen_space_y[i + 9] - PortalFace._screen_space_y[i + 8]) |
7531 ++v43; | 7461 * t + PortalFace._screen_space_y[i + 8]; |
7532 stru_50B700._screen_space_y[v43 + 5] = v68 + v47; | 7462 //New_x = right_clip |
7533 v44 = pBLVRenderParams->uViewportZ; | 7463 PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ; |
7534 stru_50B700._screen_space_x[v43 + 5] = pBLVRenderParams->uViewportZ; | 7464 } |
7535 } | 7465 right_num_vertices++; |
7536 if ( v83 ) | 7466 } |
7537 { | 7467 if ( next_vertices_flag ) |
7538 stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[v45 + 9]; | 7468 { |
7539 stru_50B700._screen_space_y[v43++ + 6] = stru_50B700._screen_space_y[v45 + 9]; | 7469 pNextVertices = right_num_vertices++; |
7540 } | 7470 PortalFace._screen_space_x[pNextVertices + 6] = PortalFace._screen_space_x[i + 9]; |
7541 ++v89; | 7471 PortalFace._screen_space_y[pNextVertices + 6] = PortalFace._screen_space_y[i + 9]; |
7542 thisd = v83; | 7472 } |
7543 } | 7473 current_vertices_flag = next_vertices_flag; |
7544 while ( v89 <= v36 ); | 7474 } |
7545 if ( !v43 | 7475 //************************************************************************************************************************************ |
7546 || (v48 = 0, | 7476 // for top clip plane |
7547 stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[6], | 7477 top_num_vertices = 0; |
7548 stru_50B700._screen_space_y[v43 + 6] = stru_50B700._screen_space_y[6], | 7478 PortalFace._screen_space_x[right_num_vertices + 6] = PortalFace._screen_space_x[6]; |
7549 v49 = pBLVRenderParams->uViewportY, | 7479 PortalFace._screen_space_y[right_num_vertices + 6] = PortalFace._screen_space_y[6]; |
7550 v50 = stru_50B700._screen_space_y[6] < (signed int)pBLVRenderParams->uViewportY, | 7480 |
7551 LOBYTE(v50) = stru_50B700._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY, | 7481 current_vertices_flag = PortalFace._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY; |
7552 v51 = 1, | 7482 if ( right_num_vertices < 1 ) |
7553 v90 = 1, | |
7554 v43 < 1) ) | |
7555 return 0; | 7483 return 0; |
7556 do | 7484 for ( uint i = 1; i <= right_num_vertices; ++i ) |
7557 { | 7485 { |
7558 v52 = v51; | 7486 next_vertices_flag = PortalFace._screen_space_y[i + 6] >= (signed int)pBLVRenderParams->uViewportY; |
7559 v53 = stru_50B700._screen_space_y[v52 + 6]; | 7487 if ( current_vertices_flag ^ next_vertices_flag ) |
7560 v84 = v53 >= (signed int)v49; | 7488 { |
7561 if ( v50 ^ v84 ) | 7489 if ( next_vertices_flag ) |
7562 { | 7490 { |
7563 if ( v53 >= (signed int)v49 ) | 7491 t = (signed __int64)(pBLVRenderParams->uViewportY - PortalFace._screen_space_y[i + 5]) |
7564 { | 7492 / (PortalFace._screen_space_y[i + 6] - PortalFace._screen_space_y[i + 5]); |
7565 v69 = (signed int)(v49 - stru_50B700._screen_space_y[v52 + 5]) | 7493 PortalFace._screen_space_x[top_num_vertices + 3] = (signed int)(PortalFace._screen_space_x[i + 6] - PortalFace._screen_space_x[i + 5]) |
7566 * (signed __int64)(stru_50B700._screen_space_x[v52 + 6] - stru_50B700._screen_space_x[v52 + 5]) | 7494 * t + PortalFace._screen_space_x[i + 5]; |
7567 / (v53 - stru_50B700._screen_space_y[v52 + 5]); | 7495 PortalFace._screen_space_y[top_num_vertices + 3] = pBLVRenderParams->uViewportY; |
7568 v54 = stru_50B700._screen_space_x[v52 + 5]; | |
7569 } | 7496 } |
7570 else | 7497 else |
7571 { | 7498 { |
7572 v69 = (signed int)(v49 - v53) | 7499 t = (signed __int64)(pBLVRenderParams->uViewportY - PortalFace._screen_space_y[i + 6]) |
7573 * (signed __int64)(stru_50B700._screen_space_x[v52 + 5] - stru_50B700._screen_space_x[v52 + 6]) | 7500 / (PortalFace._screen_space_y[i + 5] - PortalFace._screen_space_y[i + 6]); |
7574 / (stru_50B700._screen_space_y[v52 + 5] - v53); | 7501 PortalFace._screen_space_x[top_num_vertices + 3] = (signed int)(PortalFace._screen_space_x[i + 5]- PortalFace._screen_space_x[i + 6]) |
7575 v54 = stru_50B700._screen_space_x[v52 + 6]; | 7502 * t + PortalFace._screen_space_x[i + 6]; |
7576 } | 7503 PortalFace._screen_space_y[top_num_vertices + 3] = pBLVRenderParams->uViewportY; |
7577 ++v48; | 7504 } |
7578 stru_50B700._screen_space_x[v48 + 2] = v69 + v54; | 7505 top_num_vertices++; |
7579 v49 = pBLVRenderParams->uViewportY; | 7506 } |
7580 stru_50B700._screen_space_y[v48 + 2] = pBLVRenderParams->uViewportY; | 7507 current_vertices_flag = next_vertices_flag; |
7581 } | 7508 if ( next_vertices_flag ) |
7582 v50 = v84; | 7509 { |
7583 if ( v84 ) | 7510 pNextVertices = top_num_vertices++; |
7584 { | 7511 PortalFace._screen_space_x[pNextVertices + 3] = PortalFace._screen_space_x[i + 6]; |
7585 stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[v52 + 6]; | 7512 PortalFace._screen_space_y[pNextVertices + 3] = PortalFace._screen_space_y[i + 6]; |
7586 stru_50B700._screen_space_y[v48++ + 3] = stru_50B700._screen_space_y[v52 + 6]; | 7513 } |
7587 } | 7514 } |
7588 v51 = v90++ + 1; | 7515 //********************************************************************************************************************************** |
7589 } | 7516 //for bottom_clip plane(проверка по нижней плоскости) |
7590 while ( v90 <= v43 ); | 7517 bottom_num_vertices = 0; |
7591 if ( !v48 | 7518 PortalFace._screen_space_x[top_num_vertices + 3] = PortalFace._screen_space_x[3]; |
7592 || (v55 = 0, | 7519 PortalFace._screen_space_y[top_num_vertices + 3] = PortalFace._screen_space_y[3]; |
7593 stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[3], | 7520 current_vertices_flag = PortalFace._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW; |
7594 stru_50B700._screen_space_y[v48 + 3] = stru_50B700._screen_space_y[3], | 7521 if ( top_num_vertices < 1 ) |
7595 v56 = pBLVRenderParams->uViewportW, | |
7596 thise = stru_50B700._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW, | |
7597 v91 = 1, | |
7598 v48 < 1) ) | |
7599 return 0; | 7522 return 0; |
7600 do | 7523 for ( uint i =1; i <= top_num_vertices; ++i ) |
7601 { | 7524 { |
7602 v57 = v91; | 7525 next_vertices_flag = PortalFace._screen_space_y[i + 3] <= (signed int)pBLVRenderParams->uViewportW; |
7603 v58 = stru_50B700._screen_space_y[v91 + 3]; | 7526 if ( current_vertices_flag ^ next_vertices_flag ) |
7604 v85 = v58 <= (signed int)v56; | 7527 { |
7605 if ( thise ^ v85 ) | 7528 if ( next_vertices_flag ) |
7606 { | 7529 { |
7607 if ( v58 <= (signed int)v56 ) | 7530 t = (signed __int64)(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 3]) |
7608 { | 7531 / (PortalFace._screen_space_y[i + 2] - PortalFace._screen_space_y[i + 3]); |
7609 v70 = (signed int)(v56 - stru_50B700._screen_space_y[v57 + 2]) | 7532 PortalFace._screen_space_x[bottom_num_vertices] = (signed int)(PortalFace._screen_space_x[i + 2] - PortalFace._screen_space_x[i + 3]) |
7610 * (signed __int64)(stru_50B700._screen_space_x[v57 + 3] - stru_50B700._screen_space_x[v57 + 2]) | 7533 * t + PortalFace._screen_space_x[i + 3]; |
7611 / (v58 - stru_50B700._screen_space_y[v57 + 2]); | 7534 PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW; |
7612 v59 = stru_50B700._screen_space_x[v57 + 2]; | |
7613 } | 7535 } |
7614 else | 7536 else |
7615 { | 7537 { |
7616 v70 = (signed int)(v56 - v58) | 7538 t = (signed __int64)(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 2]) |
7617 * (signed __int64)(stru_50B700._screen_space_x[v57 + 2] - stru_50B700._screen_space_x[v57 + 3]) | 7539 / (PortalFace._screen_space_y[i + 3] - PortalFace._screen_space_y[i + 2]); |
7618 / (stru_50B700._screen_space_y[v57 + 2] - v58); | 7540 PortalFace._screen_space_x[bottom_num_vertices] = (signed int)(PortalFace._screen_space_x[i + 3] - PortalFace._screen_space_x[i + 2]) |
7619 v59 = stru_50B700._screen_space_x[v57 + 3]; | 7541 * t + PortalFace._screen_space_x[i + 2]; |
7620 } | 7542 PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW; |
7621 ++v55; | 7543 } |
7622 //stru_50B700._screen_space_y[v55 + 59] = v70 + v59; | 7544 bottom_num_vertices++; |
7623 stru_50B700._screen_space_x[v55 - 1] = v70 + v59; | 7545 } |
7624 v56 = pBLVRenderParams->uViewportW; | 7546 if ( next_vertices_flag ) |
7625 //stru_50B700._view_transformed_xs[v55 + 47] = pBLVRenderParams->uViewportW; | 7547 { |
7626 stru_50B700._screen_space_y[v55 - 1] = pBLVRenderParams->uViewportW; | 7548 pNextVertices = bottom_num_vertices++; |
7627 } | 7549 PortalFace._screen_space_x[pNextVertices] = PortalFace._screen_space_x[i + 3]; |
7628 if ( v85 ) | 7550 PortalFace._screen_space_y[pNextVertices] = PortalFace._screen_space_y[i + 3]; |
7629 { | 7551 } |
7630 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[v57 + 3]; | 7552 current_vertices_flag = next_vertices_flag; |
7631 stru_50B700._screen_space_y[v55++] = stru_50B700._screen_space_y[v57 + 3]; | 7553 } |
7632 } | 7554 //out_x: 83,8,8,61,83 |
7633 ++v91; | 7555 //out_y: 273,293,152,172,216 |
7634 thise = v85; | 7556 //*************************************************************************************************************************************** |
7635 } | 7557 |
7636 while ( v91 <= v48 ); | 7558 if ( !bottom_num_vertices ) |
7637 if ( !v55 ) | |
7638 return 0; | 7559 return 0; |
7639 v61 = pRenderer->pRenderD3D == 0; | 7560 PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0]; |
7640 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; | 7561 PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0]; |
7641 stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; | 7562 //check for software(проверка для софтвар) |
7642 if ( v61 && v55 > 3 ) | 7563 if ( !pRenderer->pRenderD3D && bottom_num_vertices > 3 ) |
7643 { | 7564 { |
7644 stru_50B700._screen_space_x[v55 + 1] = stru_50B700._screen_space_x[1]; | 7565 PortalFace._screen_space_x[bottom_num_vertices + 1] = PortalFace._screen_space_x[1]; |
7645 stru_50B700._screen_space_y[v55 + 1] = stru_50B700._screen_space_y[1]; | 7566 PortalFace._screen_space_y[bottom_num_vertices + 1] = PortalFace._screen_space_y[1]; |
7646 thisf = 2 * (stru_50B700.field_0 != 0) - 1; | 7567 thisf = PortalFace.direction == true ? 1 : - 1; |
7647 if ( v55 > 0 ) | 7568 if ( bottom_num_vertices > 0 ) |
7648 { | 7569 { |
7649 v62 = 1; | 7570 v62 = 1; |
7650 v71 = 1; | 7571 v71 = 1; |
7651 do | 7572 do |
7652 { | 7573 { |
7653 v63 = v62 - 1; | 7574 v63 = v62 - 1; |
7654 v64 = v62 + 1; | 7575 v64 = v62 + 1; |
7655 v80 = v62 + 1; | 7576 v80 = v62 + 1; |
7656 if ( v62 - 1 >= v55 ) | 7577 if ( v62 - 1 >= bottom_num_vertices ) |
7657 v63 -= v55; | 7578 v63 -= bottom_num_vertices; |
7658 if ( v62 >= v55 ) | 7579 if ( v62 >= bottom_num_vertices ) |
7659 v62 -= v55; | 7580 v62 -= bottom_num_vertices; |
7660 if ( v64 >= v55 ) | 7581 if ( v64 >= bottom_num_vertices ) |
7661 v64 -= v55; | 7582 v64 -= bottom_num_vertices; |
7662 if ( thisf | 7583 if ( thisf * ((PortalFace._screen_space_y[v64] - PortalFace._screen_space_y[v63]) |
7663 * ((stru_50B700._screen_space_y[v64] - stru_50B700._screen_space_y[v63]) | 7584 * (PortalFace._screen_space_x[v62] - PortalFace._screen_space_x[v63]) |
7664 * (stru_50B700._screen_space_x[v62] - stru_50B700._screen_space_x[v63]) | 7585 - (PortalFace._screen_space_y[v62] - PortalFace._screen_space_y[v63]) |
7665 - (stru_50B700._screen_space_y[v62] - stru_50B700._screen_space_y[v63]) | 7586 * (PortalFace._screen_space_x[v64] - PortalFace._screen_space_x[v63])) < 0 ) |
7666 * (stru_50B700._screen_space_x[v64] - stru_50B700._screen_space_x[v63])) < 0 ) | |
7667 { | 7587 { |
7668 v62 = v80; | 7588 v62 = v80; |
7669 v71 = v80; | 7589 v71 = v80; |
7670 } | 7590 } |
7671 else | 7591 else |
7672 { | 7592 { |
7673 v62 = v71; | 7593 v62 = v71; |
7674 v65 = v71; | 7594 v65 = v71; |
7675 if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) | 7595 if ( v71 < bottom_num_vertices || (v65 = v71 - bottom_num_vertices, v71 - bottom_num_vertices < bottom_num_vertices) ) |
7676 { | 7596 { |
7677 memcpy( | 7597 memcpy(&PortalFace._screen_space_y[v65], &PortalFace._screen_space_y[v65 + 1], |
7678 &stru_50B700._screen_space_y[v65], | 7598 4 * ((unsigned int)(4 * (bottom_num_vertices - v65)) >> 2)); |
7679 &stru_50B700._screen_space_y[v65 + 1], | 7599 memcpy(&PortalFace._screen_space_x[v65], &PortalFace._screen_space_x[v65 + 1], |
7680 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | 7600 4 * ((unsigned int)(4 * (bottom_num_vertices - v65)) >> 2)); |
7681 memcpy( | |
7682 &stru_50B700._screen_space_x[v65], | |
7683 &stru_50B700._screen_space_x[v65 + 1], | |
7684 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | |
7685 } | 7601 } |
7686 --v55; | 7602 --bottom_num_vertices; |
7687 } | 7603 } |
7688 } | 7604 } |
7689 while ( v62 - 1 < v55 ); | 7605 while ( v62 - 1 < bottom_num_vertices ); |
7690 } | 7606 } |
7691 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; | 7607 PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0]; |
7692 stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; | 7608 PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0]; |
7693 } | 7609 } |
7694 return v55; | 7610 return bottom_num_vertices; |
7695 } | 7611 } |