Mercurial > mm7
changeset 1368:cc2a25ce8ed2
Merge
author | Gloval |
---|---|
date | Mon, 15 Jul 2013 08:18:35 +0400 |
parents | e33188605eeb (current diff) b99aeb077d4f (diff) |
children | 6b4a1c44a56f |
files | |
diffstat | 9 files changed, 492 insertions(+), 583 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Mon Jul 15 08:18:11 2013 +0400 +++ b/Indoor.cpp Mon Jul 15 08:18:35 2013 +0400 @@ -768,7 +768,7 @@ v126 = stru_F8AD28.pDeltaUV[0]; v128 = stru_F8AD28.pDeltaUV[1]; v107 = bUseLoResSprites; - v7 = sub_423B5D(v1); + v7 = GetPortalScreenCoord(v1); if ( v7 ) { if ( sub_424829(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) @@ -1352,25 +1352,25 @@ if (v9 >= 0) return; - auto num_vertices = sub_423B5D(uFaceID); + auto num_vertices = GetPortalScreenCoord(uFaceID); if (num_vertices < 2) return; - auto face_min_screenspace_x = stru_50B700._screen_space_x[0], - face_max_screenspace_x = stru_50B700._screen_space_x[0]; - auto face_min_screenspace_y = stru_50B700._screen_space_y[0], - face_max_screenspace_y = stru_50B700._screen_space_y[0]; + auto face_min_screenspace_x = PortalFace._screen_space_x[0], + face_max_screenspace_x = PortalFace._screen_space_x[0]; + auto face_min_screenspace_y = PortalFace._screen_space_y[0], + face_max_screenspace_y = PortalFace._screen_space_y[0]; for (uint i = 1; i < num_vertices; ++i) { - if (face_min_screenspace_x > stru_50B700._screen_space_x[i]) - face_min_screenspace_x = stru_50B700._screen_space_x[i]; - if (face_max_screenspace_x < stru_50B700._screen_space_x[i]) - face_max_screenspace_x = stru_50B700._screen_space_x[i]; - - if (face_min_screenspace_y > stru_50B700._screen_space_y[i]) - face_min_screenspace_y = stru_50B700._screen_space_y[i]; - if (face_max_screenspace_y < stru_50B700._screen_space_y[i]) - face_max_screenspace_y = stru_50B700._screen_space_y[i]; + if (face_min_screenspace_x > PortalFace._screen_space_x[i]) + face_min_screenspace_x = PortalFace._screen_space_x[i]; + if (face_max_screenspace_x < PortalFace._screen_space_x[i]) + face_max_screenspace_x = PortalFace._screen_space_x[i]; + + if (face_min_screenspace_y > PortalFace._screen_space_y[i]) + face_min_screenspace_y = PortalFace._screen_space_y[i]; + if (face_max_screenspace_y < PortalFace._screen_space_y[i]) + face_max_screenspace_y = PortalFace._screen_space_y[i]; } //_screen_space_x = 719, 568, 493 //savegame: qw , 0Bh and 0x1D4h @@ -1500,29 +1500,29 @@ v9 = -v9; if ( v9 < 0 ) { - v10 = sub_423B5D(uFaceID); + v10 = GetPortalScreenCoord(uFaceID); v19 = v10; if ( v10 ) { - v11 = stru_50B700._screen_space_x[0]; - v12 = stru_50B700._screen_space_y[0]; - v23 = stru_50B700._screen_space_x[0]; + v11 = PortalFace._screen_space_x[0]; + v12 = PortalFace._screen_space_y[0]; + v23 = PortalFace._screen_space_x[0]; v13 = 1; - v22 = stru_50B700._screen_space_y[0]; + v22 = PortalFace._screen_space_y[0]; if ( v10 > 1 ) { do { - v14 = stru_50B700._screen_space_x[v13]; + v14 = PortalFace._screen_space_x[v13]; if ( v14 < v23 ) - v23 = stru_50B700._screen_space_x[v13]; + v23 = PortalFace._screen_space_x[v13]; if ( v14 > v11 ) - v11 = stru_50B700._screen_space_x[v13]; - v15 = stru_50B700._screen_space_y[v13]; + v11 = PortalFace._screen_space_x[v13]; + v15 = PortalFace._screen_space_y[v13]; if ( v15 < v22 ) - v22 = stru_50B700._screen_space_y[v13]; + v22 = PortalFace._screen_space_y[v13]; if ( v15 > v12 ) - v12 = stru_50B700._screen_space_y[v13]; + v12 = PortalFace._screen_space_y[v13]; v10 = v19; ++v13; } @@ -1588,7 +1588,7 @@ { v2 = pBspRenderer->faces[i].uFaceID; pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].field_C; - v3 = sub_423B5D(v2); + v3 = GetPortalScreenCoord(v2); if ( v3 ) { if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) @@ -6910,10 +6910,10 @@ //return true; if ( pNumVertices <= 1 ) return false; - min_y = stru_50B700._screen_space_y[0]; + min_y = PortalFace._screen_space_y[0]; v65 = 0; - max_y = stru_50B700._screen_space_y[0]; - if ( !stru_50B700.field_0 ) + max_y = PortalFace._screen_space_y[0]; + if ( !PortalFace.direction ) { v63 = 1; v64 = -1; @@ -6926,15 +6926,15 @@ for ( v6 = 1; v6 < pNumVertices; ++v6 ) { - if ( stru_50B700._screen_space_y[v6] >= min_y ) + if ( PortalFace._screen_space_y[v6] >= min_y ) { - if ( stru_50B700._screen_space_y[v6] > max_y ) - max_y = stru_50B700._screen_space_y[v6]; + if ( PortalFace._screen_space_y[v6] > max_y ) + max_y = PortalFace._screen_space_y[v6]; } - if ( stru_50B700._screen_space_y[v6] < min_y ) + if ( PortalFace._screen_space_y[v6] < min_y ) { v65 = v6; - min_y = stru_50B700._screen_space_y[v6]; + min_y = PortalFace._screen_space_y[v6]; } } if ( max_y == min_y ) @@ -6955,12 +6955,12 @@ } else v10 -= pNumVertices; - if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] ) + if ( PortalFace._screen_space_y[v10] <= PortalFace._screen_space_y[v65] ) { v55 = v10; v65 = v10; } - if ( stru_50B700._screen_space_y[v10] == max_y ) + if ( PortalFace._screen_space_y[v10] == max_y ) break; } v13 = v55 + v64; @@ -6971,11 +6971,11 @@ } else v13 -= pNumVertices; - if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] ) - { - v62 = stru_50B700._screen_space_x[v55] << 16; - 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]); - a2->viewport_left_side[min_y] = LOWORD(stru_50B700._screen_space_x[v55]); + if ( PortalFace._screen_space_y[v13] != PortalFace._screen_space_y[v55] ) + { + v62 = PortalFace._screen_space_x[v55] << 16; + v54 = ((PortalFace._screen_space_x[v13] - PortalFace._screen_space_x[v55]) << 16) / (PortalFace._screen_space_y[v13] - PortalFace._screen_space_y[v55]); + a2->viewport_left_side[min_y] = LOWORD(PortalFace._screen_space_x[v55]); } v15 = v65; v61 = v65; @@ -6990,12 +6990,12 @@ } else v15 -= pNumVertices; - if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] ) + if ( PortalFace._screen_space_y[v15] <= PortalFace._screen_space_y[v65] ) { v61 = v15; v65 = v15; } - if ( stru_50B700._screen_space_y[v15] == max_y ) + if ( PortalFace._screen_space_y[v15] == max_y ) break; } v18 = v63 + v61; @@ -7008,11 +7008,11 @@ v18 -= pNumVertices; v19 = v18; v20 = v61; - if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] ) - { - v61 = stru_50B700._screen_space_x[v20] << 16; - 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]; - a2->viewport_right_side[max_y] = LOWORD(stru_50B700._screen_space_x[v20]); + if ( PortalFace._screen_space_y[v19] != PortalFace._screen_space_y[v61] ) + { + v61 = PortalFace._screen_space_x[v20] << 16; + v53 = ((PortalFace._screen_space_x[v19] - PortalFace._screen_space_x[v20]) << 16) / PortalFace._screen_space_y[v19] - PortalFace._screen_space_y[v20]; + a2->viewport_right_side[max_y] = LOWORD(PortalFace._screen_space_x[v20]); } v22 = min_y; if ( min_y <= max_y ) @@ -7022,7 +7022,7 @@ for ( v70 = min_y; v70 <= max_y; ++v70 ) { v24 = v13; - if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != max_y ) + if ( v22 >= PortalFace._screen_space_y[v13] && v22 != max_y ) { v13 = v64 + v13; if ( v13 < pNumVertices ) @@ -7033,15 +7033,15 @@ else v13 -= pNumVertices; v26 = v13; - //v27 = stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; - if ( stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24] > 0 ) + //v27 = PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24]; + if ( PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24] > 0 ) { - 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]; - v62 = stru_50B700._screen_space_x[v24] << 16; + v54 = ((PortalFace._screen_space_x[v26] - PortalFace._screen_space_x[v24]) << 16) / PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24]; + v62 = PortalFace._screen_space_x[v24] << 16; } } v29 = v18; - if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != max_y ) + if ( v70 >= PortalFace._screen_space_y[v18] && v70 != max_y ) { v18 += v63; if ( v18 < pNumVertices ) @@ -7052,11 +7052,11 @@ else v18 -= pNumVertices; v31 = v18; - //v32 = stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; - if ( stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29] > 0 ) + //v32 = PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29]; + if ( PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29] > 0 ) { - 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]; - v61 = stru_50B700._screen_space_x[v29] << 16; + v53 = ((PortalFace._screen_space_x[v31] - PortalFace._screen_space_x[v29]) << 16) / PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29]; + v61 = PortalFace._screen_space_x[v29] << 16; } } //v34 = (char *)a2->array_18 - (char *)a2->array_3D8; @@ -7164,141 +7164,93 @@ return true; } //----- (00423B5D) -------------------------------------------------------- -int __fastcall sub_423B5D(unsigned int uFaceID) +int __fastcall GetPortalScreenCoord(unsigned int uFaceID) { BLVFace *pFace; // ebx@1 - //Vec3_short_ *v2; // esi@1 - //int v3; // ST28_4@1 - //__int16 v4; // ST2C_2@1 - //signed int v5; // esi@1 - //Vec3_short_ *v6; // eax@4 - //signed int v7; // edi@5 - //signed int bFound; // eax@5 - //signed int v9; // ecx@10 - //int v10; // eax@10 - //int v11; // edx@11 - int v12; // ST28_4@12 + int pNextVertices; // edx@11 + int t; // ST28_4@12 signed int v13; // edx@12 signed __int64 v14; // qtt@12 - char *v15; // ebx@12 - int v16; // ST28_4@14 signed int v17; // eax@14 signed __int64 v18; // qtt@14 - signed int v19; // edx@15 signed int v20; // edx@17 - signed int v21; // ebx@19 - signed int v22; // esi@20 - int v23; // edi@21 - int v24; // eax@21 int v25; // eax@22 - int v26; // eax@22 - signed int v27; // ST30_4@24 - signed __int64 v28; // qtt@24 - int v29; // ST18_4@25 - int v30; // eax@26 + int pScreenX; // eax@22 int v31; // eax@27 - int v32; // eax@27 - signed int v33; // ST30_4@29 - signed __int64 v34; // qtt@29 + int pScreenY; // eax@27 int v35; // ST30_4@30 - signed int v36; // edi@31 - unsigned int v37; // eax@31 - bool v38; // edx@31 - int v39; // ecx@31 - int v40; // ecx@32 - int v41; // esi@32 - int v42; // eax@34 - signed int v43; // ebx@41 - unsigned int v44; // eax@41 - signed int v45; // ecx@42 - int v46; // esi@42 - int v47; // eax@44 - signed int v48; // edi@51 - unsigned int v49; // eax@51 - bool v50; // edx@51 - int v51; // ecx@51 - int v52; // ecx@52 - int v53; // esi@52 - int v54; // eax@54 - int v55; // ebx@61 - unsigned int v56; // eax@61 - signed int v57; // ecx@62 - int v58; // esi@62 - int v59; // eax@64 - char v61; // zf@72 + signed int left_num_vertices; // edi@31 + signed int right_num_vertices; // ebx@41 + signed int top_num_vertices; // edi@51 + int bottom_num_vertices; // ebx@61 signed int v62; // edx@75 int v63; // ecx@76 int v64; // esi@76 int v65; // ecx@83 - //signed int v66; // [sp+14h] [bp-14h]@3 - int v67; // [sp+14h] [bp-14h]@34 - int v68; // [sp+14h] [bp-14h]@44 - int v69; // [sp+14h] [bp-14h]@54 - int v70; // [sp+14h] [bp-14h]@64 signed int v71; // [sp+14h] [bp-14h]@75 - //IndoorCameraD3D *_this; // [sp+18h] [bp-10h]@1 bool current_vertices_flag; // [sp+18h] [bp-10h]@9 int thisb; // [sp+18h] [bp-10h]@12 - int thisc; // [sp+18h] [bp-10h]@20 - bool thisd; // [sp+18h] [bp-10h]@41 - bool thise; // [sp+18h] [bp-10h]@61 int thisf; // [sp+18h] [bp-10h]@74 signed int depth_num_vertices; // [sp+1Ch] [bp-Ch]@9 int v80; // [sp+1Ch] [bp-Ch]@76 bool next_vertices_flag; // [sp+20h] [bp-8h]@10 - bool v82; // [sp+20h] [bp-8h]@32 - bool v83; // [sp+20h] [bp-8h]@42 - bool v84; // [sp+20h] [bp-8h]@52 - bool v85; // [sp+20h] [bp-8h]@62 - //signed int v86; // [sp+24h] [bp-4h]@9 - signed int v87; // [sp+24h] [bp-4h]@19 - signed int v88; // [sp+24h] [bp-4h]@31 - signed int v89; // [sp+24h] [bp-4h]@41 signed int v90; // [sp+24h] [bp-4h]@51 - signed int v91; // [sp+24h] [bp-4h]@61 pFace = &pIndoor->pFaces[uFaceID]; - memset(&stru_50B700, 0, sizeof(stru367)); - //_this = pGame->pIndoorCameraD3D; - //v2 = &pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]]; - //v3 = *(_DWORD *)pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x; - //v4 = pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z; - //v5 = 0; + memset(&PortalFace, 0, sizeof(stru367)); + + //get direction the face(определение направленности фейса)********************************************************************************* if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) { - stru_50B700.field_0 = 1; + PortalFace.direction = true; } else { - stru_50B700.field_0 = 0; + PortalFace.direction = false; if ( !(pFace->Portal()) ) return 0; } - //v66 = pFace->uNumVertices; + //***************************************************************************************************************************************** + //generate/cinvertetion in camera location coordinates(генерация/конвертирование в координаты пространства камеры) + + //for new coordinates: + //int x = 0x AAAA BBBB; + //AAAA - integer(целая часть), BBBB - fractional(дробная) + //float v = HIWORD(x) + LOWORD(x) / 65535.0f; + //0x0351A281 это 849(351 в шестнадцатиричной) в целой части и A281 в дробной(хотя как точно BBBB считалась не помню) + //if in HIWORD: FFFF = -1 + //FFFE = -2 + //FFFD = -3 + //.... + //8000 = -32767 + //7FFF = 32767 + //7FFE = 32766 + //если в LOWORD например лежит FFFF то не совсем понятно, что это + //потому что если и hiword и loword равны FFFF FFFF то двойное отрицание как бы, нужно тестировать что конкретно получается чтобы понять что это значит + //всё что больше 7FFF для верхнего слова это идёт уже с минусом/Nomad/ + if ( (signed int)pFace->uNumVertices > 0 ) { for (uint i = 0; i < pFace->uNumVertices; ++i) { - //v6 = &pIndoor->pVertices[pFace->pVertexIDs[v5]]; - pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( - pIndoor->pVertices[pFace->pVertexIDs[i]].x, - pIndoor->pVertices[pFace->pVertexIDs[i]].y, - pIndoor->pVertices[pFace->pVertexIDs[i]].z, - &stru_50B700._view_transformed_xs[i + 3], - &stru_50B700._view_transformed_zs[i + 3], - &stru_50B700._view_transformed_ys[i + 3], - 0); + pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(pIndoor->pVertices[pFace->pVertexIDs[i]].x, + pIndoor->pVertices[pFace->pVertexIDs[i]].y, + pIndoor->pVertices[pFace->pVertexIDs[i]].z, + &PortalFace._view_transformed_z[i + 3], &PortalFace._view_transformed_x[i + 3], &PortalFace._view_transformed_y[i + 3], 0); } } - //v7 = pFace->uNumVertices; + //х: 55681665, 55681665, 53050369, 47787777, 45156481, 45156481 + //x: 0x0351 a281,0x0351 a281,0x0329 7c01,0x02d9 2f01,0x02b1 0881,0x02b1 0881 + //***************************************************************************************************************************************** + //check vertices for the nearest plane(проверка вершин есть ли в области за ближайшей плоскостью) if ( pFace->uNumVertices <= 0 ) return 0; bool bFound = false; for (uint i = 0; i < pFace->uNumVertices; ++i) { - if ( stru_50B700._view_transformed_xs[i + 3] >= 524288 ) + if ( PortalFace._view_transformed_z[i + 3] >= 524288 )// 8.0(0x80000) { bFound = true; break; @@ -7306,345 +7258,314 @@ } if ( !bFound ) return 0; - + //***************************************************************************************************************************************** + //check for near clip plane(проверка по ближней границе) + // + // v0 v1 + // ._________________. + // / \ + // / \ + // v5. . v2 + // | | + // | | + // | | + // ---------------------------- 8.0(near_clip) + // | | + // ._______________________. + // v4 v3 depth_num_vertices = 0; - stru_50B700._view_transformed_xs[pFace->uNumVertices + 3] = stru_50B700._view_transformed_xs[3]; - stru_50B700._view_transformed_zs[pFace->uNumVertices + 3] = stru_50B700._view_transformed_zs[3]; - stru_50B700._view_transformed_ys[pFace->uNumVertices + 3] = stru_50B700._view_transformed_ys[3]; - current_vertices_flag = stru_50B700._view_transformed_xs[3] >= 524288; - //v86 = 1; + PortalFace._view_transformed_z[pFace->uNumVertices + 3] = PortalFace._view_transformed_z[3]; + PortalFace._view_transformed_x[pFace->uNumVertices + 3] = PortalFace._view_transformed_x[3]; + PortalFace._view_transformed_y[pFace->uNumVertices + 3] = PortalFace._view_transformed_y[3]; + current_vertices_flag = PortalFace._view_transformed_z[3] >= 524288;// 8.0(0x80000) if ( pFace->uNumVertices >= 1 ) { for ( uint i = 1; i <= pFace->uNumVertices; ++i) { - //v9 = v86; - //v10 = stru_50B700._view_transformed_xs[v86 + 3]; - next_vertices_flag = stru_50B700._view_transformed_xs[i + 3] >= 524288; - if ( current_vertices_flag ^ next_vertices_flag ) + next_vertices_flag = PortalFace._view_transformed_z[i + 3] >= 524288;// 8.0(0x80000) + if ( current_vertices_flag ^ next_vertices_flag )//или текущая или следующая вершина за ближней границей { - //v11 = stru_50B700._view_transformed_xs[i + 2]; - if ( stru_50B700._view_transformed_xs[i + 3] >= 524288 ) + if ( next_vertices_flag )//следующая вершина за ближней границей { - v12 = stru_50B700._view_transformed_xs[i + 3] - stru_50B700._view_transformed_xs[i + 2]; - v13 = 524288 - stru_50B700._view_transformed_xs[i + 2]; + v13 = 524288 - PortalFace._view_transformed_z[i + 2]; LODWORD(v14) = v13 << 16; HIDWORD(v14) = v13 >> 16; - v15 = (char *)&stru_50B700._view_transformed_ys[i + 2]; - stru_50B700._view_transformed_zs[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i + 3] - - stru_50B700._view_transformed_zs[i + 2]) - * v14 - / v12) >> 16) - + stru_50B700._view_transformed_zs[i + 2]; - thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i + 3] - stru_50B700._view_transformed_ys[i + 2]) - * v14 - / v12) >> 16; + //t = near_clip - v0.z / v1.z - v0.z + t = v14 / PortalFace._view_transformed_z[i + 3] - PortalFace._view_transformed_z[i + 2]; + //New_x = (v1.x - v0.x)*t + v0.x + PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 3] + - PortalFace._view_transformed_x[i + 2]) * t) >> 16) + PortalFace._view_transformed_x[i + 2]; + //New_y = (v1.y - v0.y)*t + v0.y + PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 3] - PortalFace._view_transformed_y[i + 2]) + * t) >> 16) + PortalFace._view_transformed_y[i + 2]; + //New_z = 8.0(0x80000) + PortalFace._view_transformed_z[depth_num_vertices] = 524288; } - else + else// текущая вершина за ближней границей { - v16 = stru_50B700._view_transformed_xs[i + 2] - stru_50B700._view_transformed_xs[i + 3]; - v17 = 524288 - stru_50B700._view_transformed_xs[i + 3]; + v17 = 524288 - PortalFace._view_transformed_z[i + 3]; LODWORD(v18) = v17 << 16; HIDWORD(v18) = v17 >> 16; - v15 = (char *)&stru_50B700._view_transformed_ys[i + 3]; - stru_50B700._view_transformed_zs[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i + 2] - - stru_50B700._view_transformed_zs[i + 3]) - * v18 - / v16) >> 16) - + stru_50B700._view_transformed_zs[i + 3]; - thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i + 2] - stru_50B700._view_transformed_ys[i + 3]) - * v18 - / v16) >> 16; + //t = near_clip - v1.z / v0.z - v1.z + t = v18 / PortalFace._view_transformed_z[i + 2] - PortalFace._view_transformed_z[i + 3]; + //New_x = (v0.x - v1.x)*t + v1.x + PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 2] + - PortalFace._view_transformed_x[i + 3]) * t) >> 16) + PortalFace._view_transformed_x[i + 3]; + //New_y = (v0.x - v1.y)*t + v1.y + PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 2] - PortalFace._view_transformed_y[i + 3]) + * t) >> 16) + PortalFace._view_transformed_y[i + 3]; + //New_z = 8.0(0x80000) + PortalFace._view_transformed_z[depth_num_vertices] = 524288; } - v19 = depth_num_vertices++; - //v7 = pFace->uNumVertices; - stru_50B700._view_transformed_ys[v19] = thisb + *(_DWORD *)v15; - stru_50B700._view_transformed_xs[v19] = 524288; + depth_num_vertices++; } - if ( next_vertices_flag ) + if ( next_vertices_flag )//если следующая вершина за ближней границей { - v20 = depth_num_vertices++; - stru_50B700._view_transformed_xs[v20] = stru_50B700._view_transformed_xs[i + 3]; - stru_50B700._view_transformed_zs[v20] = stru_50B700._view_transformed_zs[i + 3]; - stru_50B700._view_transformed_ys[v20] = stru_50B700._view_transformed_ys[i + 3]; + pNextVertices = depth_num_vertices++; + PortalFace._view_transformed_z[pNextVertices] = PortalFace._view_transformed_z[i + 3]; + PortalFace._view_transformed_x[pNextVertices] = PortalFace._view_transformed_x[i + 3]; + PortalFace._view_transformed_y[pNextVertices] = PortalFace._view_transformed_y[i + 3]; } current_vertices_flag = next_vertices_flag; } } - - v87 = 0; - v21 = depth_num_vertices; - stru_50B700._view_transformed_xs[depth_num_vertices] = stru_50B700._view_transformed_xs[0]; - stru_50B700._view_transformed_zs[depth_num_vertices] = stru_50B700._view_transformed_zs[0]; - for ( stru_50B700._view_transformed_ys[depth_num_vertices] = stru_50B700._view_transformed_ys[0]; - v87 < depth_num_vertices; - stru_50B700._screen_space_y[v22 + 12] = pBLVRenderParams->uViewportCenterY - v35 ) - { - v22 = v87; - thisc = abs(stru_50B700._view_transformed_xs[v87]); - if ( abs(stru_50B700._view_transformed_zs[v87]) >> 13 <= thisc ) - { - v27 = stru_50B700._view_transformed_zs[v22]; - LODWORD(v28) = v27 << 16; - HIDWORD(v28) = v27 >> 16; - v26 = v28 / stru_50B700._view_transformed_xs[v22]; - v23 = 0; - } + //результат: нет моргания на границе портала(когда проходим сквозь портал) + //************************************************************************************************************************************ + //convertion in screen coordinates(конвертирование в координаты экрана) + PortalFace._view_transformed_z[depth_num_vertices] = PortalFace._view_transformed_z[0]; + PortalFace._view_transformed_x[depth_num_vertices] = PortalFace._view_transformed_x[0]; + PortalFace._view_transformed_y[depth_num_vertices] = PortalFace._view_transformed_y[0]; + for ( uint i = 0; i < depth_num_vertices; ++i ) + { + if ( (abs(PortalFace._view_transformed_x[i]) >> 13) <= abs(PortalFace._view_transformed_z[i]) ) + pScreenX = fixpoint_div(PortalFace._view_transformed_x[i], PortalFace._view_transformed_z[i]); else { - v23 = 0; - v24 = 0; - if ( stru_50B700._view_transformed_zs[v22] >= 0 ) + if ( PortalFace._view_transformed_x[i] >= 0 ) { - //LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; - //v26 = ((v24 - 1) & 0xFF800000) + 4194304; - if (stru_50B700._view_transformed_xs[v22] >= 0) - v26 = 0x400000; // 64.0 + if (PortalFace._view_transformed_z[i] >= 0) + pScreenX = 0x400000; // 64.0 else - v26 = 0xFFC00000; + pScreenX = 0xFFC00000; // -63.0 } else { - //LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; - //v25 = v24 - 1; - //v26 = (v25 & 0x800000) - 4194304; - if (stru_50B700._view_transformed_xs[v22] >= 0) - v26 = 0xFFC00000; // -63.0 + if (PortalFace._view_transformed_z[i] >= 0) + pScreenX = 0xFFC00000; // -63.0 else - v26 = 0x400000; + pScreenX = 0x400000; // 64.0 } } - v29 = stru_50B700._view_transformed_ys[v22]; - stru_50B700._screen_space_x[v22 + 12] = v26; - if ( abs(v29) >> 13 <= thisc ) - { - v33 = stru_50B700._view_transformed_ys[v22]; - LODWORD(v34) = v33 << 16; - HIDWORD(v34) = v33 >> 16; - v32 = v34 / stru_50B700._view_transformed_xs[v22]; - } + if ( (abs(PortalFace._view_transformed_y[i]) >> 13) <= abs(PortalFace._view_transformed_z[i]) ) + pScreenY = fixpoint_div(PortalFace._view_transformed_y[i], PortalFace._view_transformed_z[i]); else { - v30 = 0; - if ( stru_50B700._view_transformed_ys[v22] >= v23 ) + if ( PortalFace._view_transformed_y[i] >= 0 ) { - //LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; - //v32 = ((v30 - 1) & 0xFF800000) + 4194304; - if (stru_50B700._view_transformed_xs[v22] >= v23) - v32 = 0x400000; // 64.0 + if (PortalFace._view_transformed_z[i] >= 0) + pScreenY = 0x400000; // 64.0 else - v32 = 0xFFC00000; + pScreenY = 0xFFC00000; // -63.0 } else { - //LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; - //v31 = v30 - 1; - //v32 = (v31 & 0x800000) - 4194304; - if (stru_50B700._view_transformed_xs[v22] >= v23) - v32 = 0xFFC00000; // -63.0 + if (PortalFace._view_transformed_z[i] >= 0) + pScreenY = 0xFFC00000; // -63.0 else - v32 = 0x400000; + pScreenY = 0x400000; // 64.0 } } - stru_50B700._screen_space_y[v22 + 12] = v32; - stru_50B700._screen_space_x[v22 + 12] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) - * (signed __int64)stru_50B700._screen_space_x[v22 + 12]) >> 16; - v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._screen_space_y[v22 + 12]) >> 16; - stru_50B700._screen_space_x[v22 + 12] = pBLVRenderParams->uViewportCenterX - stru_50B700._screen_space_x[v22 + 12]; - ++v87; - } - v36 = 0; - stru_50B700._screen_space_x[v21 + 12] = stru_50B700._screen_space_x[12]; - stru_50B700._screen_space_y[v21 + 12] = stru_50B700._screen_space_y[12]; - v37 = pBLVRenderParams->uViewportX; - v38 = stru_50B700._screen_space_x[12] < (signed int)pBLVRenderParams->uViewportX; - LOBYTE(v38) = stru_50B700._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX; - v39 = 1; - v88 = 1; + PortalFace._screen_space_x[i + 12] = pBLVRenderParams->uViewportCenterX - ((unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)pScreenX) >> 16); + PortalFace._screen_space_y[i + 12] = pBLVRenderParams->uViewportCenterY - ((unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)pScreenY) >> 16); + } + //х -34, 4, 61, 83, 83, -34 + //y 211, 152, 172, 216, 273, 293 + // результат: при повороте камеры, когда граница портала сдвигается к краю экрана, портал остается прозрачным(видимым) + //****************************************************************************************************************************************** + //check for left_clip plane(порверка по левой границе) + left_num_vertices = 0; + PortalFace._screen_space_x[depth_num_vertices + 12] = PortalFace._screen_space_x[12]; + PortalFace._screen_space_y[depth_num_vertices + 12] = PortalFace._screen_space_y[12]; + current_vertices_flag = PortalFace._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX; if ( depth_num_vertices < 1 ) return 0; - do - { - v40 = v39; - v41 = stru_50B700._screen_space_x[v40 + 12]; - v82 = v41 >= (signed int)v37; - if ( v38 ^ v82 ) + for ( uint i = 1; i <= depth_num_vertices; ++i ) + { + next_vertices_flag = PortalFace._screen_space_x[i + 12] >= (signed int)pBLVRenderParams->uViewportX; + if ( current_vertices_flag ^ next_vertices_flag ) { - if ( v41 >= (signed int)v37 ) + if ( next_vertices_flag ) { - v67 = (signed int)(v37 - stru_50B700._screen_space_x[v40 + 11]) - * (signed __int64)(stru_50B700._screen_space_y[v40 + 12] - stru_50B700._screen_space_y[v40 + 11]) - / (v41 - stru_50B700._screen_space_x[v40 + 11]); - v42 = stru_50B700._screen_space_y[v40 + 11]; + //t = left_clip - v0.x / v1.x - v0.x + t = (signed __int64)(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 11]) + / (PortalFace._screen_space_x[i + 12] - PortalFace._screen_space_x[i + 11]); + //New_y = (v1.y - v0.y)*t + v0.y + PortalFace._screen_space_y[left_num_vertices + 9] = (signed int)(PortalFace._screen_space_y[i + 12]- PortalFace._screen_space_y[i + 11]) + * t + PortalFace._screen_space_y[i + 11]; + //New_x = left_clip + PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX; } else { - v67 = (signed int)(v37 - v41) - * (signed __int64)(stru_50B700._screen_space_y[v40 + 11] - stru_50B700._screen_space_y[v40 + 12]) - / (stru_50B700._screen_space_x[v40 + 11] - v41); - v42 = stru_50B700._screen_space_y[v40 + 12]; + //t = left_clip - v1.x / v0.x - v1.x + t = (signed __int64)(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 12]) + / (PortalFace._screen_space_x[i + 11] - PortalFace._screen_space_x[i + 12]); + //New_y = (v0.y - v1.y)*t + v1.y + PortalFace._screen_space_y[left_num_vertices + 9] = (signed int)( PortalFace._screen_space_y[i + 11] - PortalFace._screen_space_y[i + 12]) + * t + PortalFace._screen_space_y[i + 12]; + //New_x = left_clip + PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX; } - ++v36; - stru_50B700._screen_space_y[v36 + 8] = v67 + v42; - v37 = pBLVRenderParams->uViewportX; - stru_50B700._screen_space_x[v36 + 8] = pBLVRenderParams->uViewportX; + left_num_vertices++; } - v38 = v82; - if ( v82 ) + if ( next_vertices_flag ) { - stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[v40 + 12]; - stru_50B700._screen_space_y[v36++ + 9] = stru_50B700._screen_space_y[v40 + 12]; + pNextVertices = left_num_vertices++; + PortalFace._screen_space_x[pNextVertices + 9] = PortalFace._screen_space_x[i + 12]; + PortalFace._screen_space_y[pNextVertices + 9] = PortalFace._screen_space_y[i + 12]; } - v39 = v88++ + 1; - } - while ( v88 <= depth_num_vertices ); - if ( !v36 - || (v43 = 0, - stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[9], - stru_50B700._screen_space_y[v36 + 9] = stru_50B700._screen_space_y[9], - v44 = pBLVRenderParams->uViewportZ, - thisd = stru_50B700._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ, - v89 = 1, - v36 < 1) ) + current_vertices_flag = next_vertices_flag; + } +//********************************************************************************************************************************* +//for right_clip plane(проверка по правой плоскости) + right_num_vertices = 0; + PortalFace._screen_space_x[left_num_vertices + 9] = PortalFace._screen_space_x[9]; + PortalFace._screen_space_y[left_num_vertices + 9] = PortalFace._screen_space_y[9]; + current_vertices_flag = PortalFace._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ; + if (left_num_vertices < 1) return 0; - do - { - v45 = v89; - v46 = stru_50B700._screen_space_x[v89 + 9]; - v83 = v46 <= (signed int)v44; - if ( thisd ^ v83 ) + for ( uint i = 1; i <= left_num_vertices; ++i ) + { + next_vertices_flag = PortalFace._screen_space_x[i + 9] <= (signed int)pBLVRenderParams->uViewportZ; + if ( current_vertices_flag ^ next_vertices_flag ) { - if ( v46 <= (signed int)v44 ) + if ( next_vertices_flag ) { - v68 = (signed int)(v44 - stru_50B700._screen_space_x[v45 + 8]) - * (signed __int64)(stru_50B700._screen_space_y[v45 + 9] - stru_50B700._screen_space_y[v45 + 8]) - / (v46 - stru_50B700._screen_space_x[v45 + 8]); - v47 = stru_50B700._screen_space_y[v45 + 8]; + //t = right_clip - v1.x / v0.x - v1.x + t = (signed __int64)(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 9]) + / (PortalFace._screen_space_x[i + 8] - PortalFace._screen_space_x[i + 9]); + //New_y = (v0.y - v1.y)*t + v1.y + PortalFace._screen_space_y[right_num_vertices + 6] = (signed int)(PortalFace._screen_space_y[i + 8] - PortalFace._screen_space_y[i + 9]) + * t + PortalFace._screen_space_y[i + 9]; + //New_x = right_clip + PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ; } else { - v68 = (signed int)(v44 - v46) - * (signed __int64)(stru_50B700._screen_space_y[v45 + 8] - stru_50B700._screen_space_y[v45 + 9]) - / (stru_50B700._screen_space_x[v45 + 8] - v46); - v47 = stru_50B700._screen_space_y[v45 + 9]; + //t = right_clip - v0.x / v1.x - v0.x + t = (signed __int64)(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 8]) + / (PortalFace._screen_space_x[i + 9] - PortalFace._screen_space_x[i + 8]); + //New_y = (v1.y - v0.y)*t + v0.y + PortalFace._screen_space_y[right_num_vertices + 6] = (signed int)(PortalFace._screen_space_y[i + 9] - PortalFace._screen_space_y[i + 8]) + * t + PortalFace._screen_space_y[i + 8]; + //New_x = right_clip + PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ; } - ++v43; - stru_50B700._screen_space_y[v43 + 5] = v68 + v47; - v44 = pBLVRenderParams->uViewportZ; - stru_50B700._screen_space_x[v43 + 5] = pBLVRenderParams->uViewportZ; + right_num_vertices++; } - if ( v83 ) + if ( next_vertices_flag ) { - stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[v45 + 9]; - stru_50B700._screen_space_y[v43++ + 6] = stru_50B700._screen_space_y[v45 + 9]; + pNextVertices = right_num_vertices++; + PortalFace._screen_space_x[pNextVertices + 6] = PortalFace._screen_space_x[i + 9]; + PortalFace._screen_space_y[pNextVertices + 6] = PortalFace._screen_space_y[i + 9]; } - ++v89; - thisd = v83; - } - while ( v89 <= v36 ); - if ( !v43 - || (v48 = 0, - stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[6], - stru_50B700._screen_space_y[v43 + 6] = stru_50B700._screen_space_y[6], - v49 = pBLVRenderParams->uViewportY, - v50 = stru_50B700._screen_space_y[6] < (signed int)pBLVRenderParams->uViewportY, - LOBYTE(v50) = stru_50B700._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY, - v51 = 1, - v90 = 1, - v43 < 1) ) + current_vertices_flag = next_vertices_flag; + } + //************************************************************************************************************************************ + // for top clip plane + top_num_vertices = 0; + PortalFace._screen_space_x[right_num_vertices + 6] = PortalFace._screen_space_x[6]; + PortalFace._screen_space_y[right_num_vertices + 6] = PortalFace._screen_space_y[6]; + + current_vertices_flag = PortalFace._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY; + if ( right_num_vertices < 1 ) return 0; - do - { - v52 = v51; - v53 = stru_50B700._screen_space_y[v52 + 6]; - v84 = v53 >= (signed int)v49; - if ( v50 ^ v84 ) + for ( uint i = 1; i <= right_num_vertices; ++i ) + { + next_vertices_flag = PortalFace._screen_space_y[i + 6] >= (signed int)pBLVRenderParams->uViewportY; + if ( current_vertices_flag ^ next_vertices_flag ) { - if ( v53 >= (signed int)v49 ) + if ( next_vertices_flag ) { - v69 = (signed int)(v49 - stru_50B700._screen_space_y[v52 + 5]) - * (signed __int64)(stru_50B700._screen_space_x[v52 + 6] - stru_50B700._screen_space_x[v52 + 5]) - / (v53 - stru_50B700._screen_space_y[v52 + 5]); - v54 = stru_50B700._screen_space_x[v52 + 5]; + t = (signed __int64)(pBLVRenderParams->uViewportY - PortalFace._screen_space_y[i + 5]) + / (PortalFace._screen_space_y[i + 6] - PortalFace._screen_space_y[i + 5]); + PortalFace._screen_space_x[top_num_vertices + 3] = (signed int)(PortalFace._screen_space_x[i + 6] - PortalFace._screen_space_x[i + 5]) + * t + PortalFace._screen_space_x[i + 5]; + PortalFace._screen_space_y[top_num_vertices + 3] = pBLVRenderParams->uViewportY; } else { - v69 = (signed int)(v49 - v53) - * (signed __int64)(stru_50B700._screen_space_x[v52 + 5] - stru_50B700._screen_space_x[v52 + 6]) - / (stru_50B700._screen_space_y[v52 + 5] - v53); - v54 = stru_50B700._screen_space_x[v52 + 6]; + t = (signed __int64)(pBLVRenderParams->uViewportY - PortalFace._screen_space_y[i + 6]) + / (PortalFace._screen_space_y[i + 5] - PortalFace._screen_space_y[i + 6]); + PortalFace._screen_space_x[top_num_vertices + 3] = (signed int)(PortalFace._screen_space_x[i + 5]- PortalFace._screen_space_x[i + 6]) + * t + PortalFace._screen_space_x[i + 6]; + PortalFace._screen_space_y[top_num_vertices + 3] = pBLVRenderParams->uViewportY; } - ++v48; - stru_50B700._screen_space_x[v48 + 2] = v69 + v54; - v49 = pBLVRenderParams->uViewportY; - stru_50B700._screen_space_y[v48 + 2] = pBLVRenderParams->uViewportY; + top_num_vertices++; } - v50 = v84; - if ( v84 ) + current_vertices_flag = next_vertices_flag; + if ( next_vertices_flag ) { - stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[v52 + 6]; - stru_50B700._screen_space_y[v48++ + 3] = stru_50B700._screen_space_y[v52 + 6]; + pNextVertices = top_num_vertices++; + PortalFace._screen_space_x[pNextVertices + 3] = PortalFace._screen_space_x[i + 6]; + PortalFace._screen_space_y[pNextVertices + 3] = PortalFace._screen_space_y[i + 6]; } - v51 = v90++ + 1; - } - while ( v90 <= v43 ); - if ( !v48 - || (v55 = 0, - stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[3], - stru_50B700._screen_space_y[v48 + 3] = stru_50B700._screen_space_y[3], - v56 = pBLVRenderParams->uViewportW, - thise = stru_50B700._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW, - v91 = 1, - v48 < 1) ) + } +//********************************************************************************************************************************** +//for bottom_clip plane(проверка по нижней плоскости) + bottom_num_vertices = 0; + PortalFace._screen_space_x[top_num_vertices + 3] = PortalFace._screen_space_x[3]; + PortalFace._screen_space_y[top_num_vertices + 3] = PortalFace._screen_space_y[3]; + current_vertices_flag = PortalFace._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW; + if ( top_num_vertices < 1 ) return 0; - do - { - v57 = v91; - v58 = stru_50B700._screen_space_y[v91 + 3]; - v85 = v58 <= (signed int)v56; - if ( thise ^ v85 ) + for ( uint i =1; i <= top_num_vertices; ++i ) + { + next_vertices_flag = PortalFace._screen_space_y[i + 3] <= (signed int)pBLVRenderParams->uViewportW; + if ( current_vertices_flag ^ next_vertices_flag ) { - if ( v58 <= (signed int)v56 ) + if ( next_vertices_flag ) { - v70 = (signed int)(v56 - stru_50B700._screen_space_y[v57 + 2]) - * (signed __int64)(stru_50B700._screen_space_x[v57 + 3] - stru_50B700._screen_space_x[v57 + 2]) - / (v58 - stru_50B700._screen_space_y[v57 + 2]); - v59 = stru_50B700._screen_space_x[v57 + 2]; + t = (signed __int64)(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 3]) + / (PortalFace._screen_space_y[i + 2] - PortalFace._screen_space_y[i + 3]); + PortalFace._screen_space_x[bottom_num_vertices] = (signed int)(PortalFace._screen_space_x[i + 2] - PortalFace._screen_space_x[i + 3]) + * t + PortalFace._screen_space_x[i + 3]; + PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW; } else { - v70 = (signed int)(v56 - v58) - * (signed __int64)(stru_50B700._screen_space_x[v57 + 2] - stru_50B700._screen_space_x[v57 + 3]) - / (stru_50B700._screen_space_y[v57 + 2] - v58); - v59 = stru_50B700._screen_space_x[v57 + 3]; + t = (signed __int64)(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 2]) + / (PortalFace._screen_space_y[i + 3] - PortalFace._screen_space_y[i + 2]); + PortalFace._screen_space_x[bottom_num_vertices] = (signed int)(PortalFace._screen_space_x[i + 3] - PortalFace._screen_space_x[i + 2]) + * t + PortalFace._screen_space_x[i + 2]; + PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW; } - ++v55; - //stru_50B700._screen_space_y[v55 + 59] = v70 + v59; - stru_50B700._screen_space_x[v55 - 1] = v70 + v59; - v56 = pBLVRenderParams->uViewportW; - //stru_50B700._view_transformed_xs[v55 + 47] = pBLVRenderParams->uViewportW; - stru_50B700._screen_space_y[v55 - 1] = pBLVRenderParams->uViewportW; + bottom_num_vertices++; } - if ( v85 ) + if ( next_vertices_flag ) { - stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[v57 + 3]; - stru_50B700._screen_space_y[v55++] = stru_50B700._screen_space_y[v57 + 3]; + pNextVertices = bottom_num_vertices++; + PortalFace._screen_space_x[pNextVertices] = PortalFace._screen_space_x[i + 3]; + PortalFace._screen_space_y[pNextVertices] = PortalFace._screen_space_y[i + 3]; } - ++v91; - thise = v85; - } - while ( v91 <= v48 ); - if ( !v55 ) + current_vertices_flag = next_vertices_flag; + } + //out_x: 83,8,8,61,83 + //out_y: 273,293,152,172,216 +//*************************************************************************************************************************************** + + if ( !bottom_num_vertices ) return 0; - v61 = pRenderer->pRenderD3D == 0; - stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; - stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; - if ( v61 && v55 > 3 ) - { - stru_50B700._screen_space_x[v55 + 1] = stru_50B700._screen_space_x[1]; - stru_50B700._screen_space_y[v55 + 1] = stru_50B700._screen_space_y[1]; - thisf = 2 * (stru_50B700.field_0 != 0) - 1; - if ( v55 > 0 ) + PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0]; + PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0]; +//check for software(проверка для софтвар) + if ( !pRenderer->pRenderD3D && bottom_num_vertices > 3 ) + { + PortalFace._screen_space_x[bottom_num_vertices + 1] = PortalFace._screen_space_x[1]; + PortalFace._screen_space_y[bottom_num_vertices + 1] = PortalFace._screen_space_y[1]; + thisf = PortalFace.direction == true ? 1 : - 1; + if ( bottom_num_vertices > 0 ) { v62 = 1; v71 = 1; @@ -7653,17 +7574,16 @@ v63 = v62 - 1; v64 = v62 + 1; v80 = v62 + 1; - if ( v62 - 1 >= v55 ) - v63 -= v55; - if ( v62 >= v55 ) - v62 -= v55; - if ( v64 >= v55 ) - v64 -= v55; - if ( thisf - * ((stru_50B700._screen_space_y[v64] - stru_50B700._screen_space_y[v63]) - * (stru_50B700._screen_space_x[v62] - stru_50B700._screen_space_x[v63]) - - (stru_50B700._screen_space_y[v62] - stru_50B700._screen_space_y[v63]) - * (stru_50B700._screen_space_x[v64] - stru_50B700._screen_space_x[v63])) < 0 ) + if ( v62 - 1 >= bottom_num_vertices ) + v63 -= bottom_num_vertices; + if ( v62 >= bottom_num_vertices ) + v62 -= bottom_num_vertices; + if ( v64 >= bottom_num_vertices ) + v64 -= bottom_num_vertices; + if ( thisf * ((PortalFace._screen_space_y[v64] - PortalFace._screen_space_y[v63]) + * (PortalFace._screen_space_x[v62] - PortalFace._screen_space_x[v63]) + - (PortalFace._screen_space_y[v62] - PortalFace._screen_space_y[v63]) + * (PortalFace._screen_space_x[v64] - PortalFace._screen_space_x[v63])) < 0 ) { v62 = v80; v71 = v80; @@ -7672,24 +7592,20 @@ { v62 = v71; v65 = v71; - if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) + if ( v71 < bottom_num_vertices || (v65 = v71 - bottom_num_vertices, v71 - bottom_num_vertices < bottom_num_vertices) ) { - memcpy( - &stru_50B700._screen_space_y[v65], - &stru_50B700._screen_space_y[v65 + 1], - 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); - memcpy( - &stru_50B700._screen_space_x[v65], - &stru_50B700._screen_space_x[v65 + 1], - 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); + memcpy(&PortalFace._screen_space_y[v65], &PortalFace._screen_space_y[v65 + 1], + 4 * ((unsigned int)(4 * (bottom_num_vertices - v65)) >> 2)); + memcpy(&PortalFace._screen_space_x[v65], &PortalFace._screen_space_x[v65 + 1], + 4 * ((unsigned int)(4 * (bottom_num_vertices - v65)) >> 2)); } - --v55; + --bottom_num_vertices; } } - while ( v62 - 1 < v55 ); + while ( v62 - 1 < bottom_num_vertices ); } - stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; - stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; - } - return v55; + PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0]; + PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0]; + } + return bottom_num_vertices; } \ No newline at end of file
--- a/Outdoor_stuff.h Mon Jul 15 08:18:11 2013 +0400 +++ b/Outdoor_stuff.h Mon Jul 15 08:18:35 2013 +0400 @@ -68,7 +68,7 @@ { int _48616B(int a2, int a3, int a4, int a5, int a6, int a7); int _48653D(int a2, int a3, int a4, int a5, int a6, int a7); - int _48694B(); + int sky_48694B(); int field_0_party_dir_x; int field_4_party_dir_y;
--- a/Render.cpp Mon Jul 15 08:18:11 2013 +0400 +++ b/Render.cpp Mon Jul 15 08:18:35 2013 +0400 @@ -566,7 +566,7 @@ return; array_77EC08[1999]._48607B(&stru_8019C8); - array_77EC08[1999].ptr_38->_48694B(); + array_77EC08[1999].ptr_38->sky_48694B(); if (pOutdoor->uMainTile_BitmapID == -1) { @@ -589,7 +589,7 @@ cos((double)pIndoorCamera->sRotationX * 0.0030664064); sin((double)pIndoorCamera->sRotationX * 0.0030664064); array_77EC08[1999]._48607B(&stru_8019C8); - array_77EC08[1999].ptr_38->_48694B(); + array_77EC08[1999].ptr_38->sky_48694B(); if (pOutdoor->uSky_TextureID == -1) { @@ -1727,9 +1727,9 @@ //-------------------------------------------------------------------------------------------------------------------- // - for (unsigned int z = 0; z < 128; ++z) - { - for (unsigned int x = 0; x < 128; ++x) + for (unsigned int z = 0; z < 127; ++z) + { + for (unsigned int x = 0; x < 127; ++x) { pTile = &array_77EC08[pOutdoorCamera->numStru148s]; pTile->flags = 0;
--- a/mm7_1.cpp Mon Jul 15 08:18:11 2013 +0400 +++ b/mm7_1.cpp Mon Jul 15 08:18:35 2013 +0400 @@ -547,11 +547,11 @@ + v2->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v4->x >> 16) - pBLVRenderParams->vPartyPos.y) + v2->pFacePlane_old.vNormal.z * (v4->z - pBLVRenderParams->vPartyPos.z) < 0 ) { - stru_50B700.field_0 = 1; + PortalFace.field_0 = 1; } else { - stru_50B700.field_0 = 0; + PortalFace.field_0 = 0; if ( !(v2->uAttributes & 1) ) return 0; } @@ -786,7 +786,7 @@ return result;*/ } -// 50B700: using guessed type int stru_50B700.field_0; +// 50B700: using guessed type int PortalFace.field_0; //----- (00424CD7) -------------------------------------------------------- signed int __fastcall sr_424CD7(unsigned int uVertexID)
--- a/mm7_3.cpp Mon Jul 15 08:18:11 2013 +0400 +++ b/mm7_3.cpp Mon Jul 15 08:18:35 2013 +0400 @@ -5958,36 +5958,21 @@ { int v0; // esi@2 int v1; // eax@2 - //double v2; // st7@2 - //double v3; // st6@2 - //double v4; // st5@2 - //double v5; // st4@2 - //double v6; // st7@2 - //char *v7; // esi@3 int v8; // eax@4 int v9; // eax@4 int v10; // ebx@4 signed __int64 v11; // qax@6 - double v12; // st7@6 + //double v12; // st7@6 int v13; // edi@6 int v14; // ecx@6 - int v15; // eax@8 + //int v15; // eax@8 int v16; // eax@12 signed __int64 v17; // qtt@13 - signed int v18; // ecx@13 - //Texture *v19; // eax@15 - //double v20; // st6@15 - //double v21; // st7@15 - //double v22; // st6@15 - //unsigned __int8 v23; // sf@15 - //unsigned __int8 v24; // of@15 - stru148 _this; // [sp+14h] [bp-150h]@1 - //double v26; // [sp+120h] [bp-44h]@4 - //float v27; // [sp+128h] [bp-3Ch]@4 + signed int pShading; // ecx@13 + stru148 pSky; // [sp+14h] [bp-150h]@1 float v28; // [sp+12Ch] [bp-38h]@2 int v29; // [sp+130h] [bp-34h]@4 int v30; // [sp+134h] [bp-30h]@1 - //int v31; // [sp+138h] [bp-2Ch]@2 int v32; // [sp+13Ch] [bp-28h]@6 int v33; // [sp+140h] [bp-24h]@2 int v34; // [sp+144h] [bp-20h]@1 @@ -6007,26 +5992,32 @@ v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z) / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY); - v38 = pViewport->uScreenCenterY - - pOutdoorCamera->int_fov_rad / (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) * - (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z); - _this._48607B(&stru_8019C8); - _this.ptr_38->_48694B(); - _this.uTileBitmapID = pOutdoor->uSky_TextureID; - _this.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? &pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0); + v38 = pViewport->uScreenCenterY - pOutdoorCamera->int_fov_rad / + (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) * + (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z); + + pSky._48607B(&stru_8019C8); + pSky.ptr_38->sky_48694B(); + pSky.uTileBitmapID = pOutdoor->uSky_TextureID;//номер текстуры + pSky.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//текстура неба if (pOutdoor->uSky_TextureID == -1) return; - _this.dimming_level = 0; - _this.uNumVertices = 4; - _this.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); - _this.v_18.y = 0; - _this.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16); - _this.field_24 = 0x2000000; - - _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; - _this.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; - + pSky.dimming_level = 0;//затемнение + pSky.uNumVertices = 4;//количество вершин + + //centering(центруем)--------------------------------------------------------------- + pSky.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);//-3216 + pSky.v_18.y = 0; + pSky.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);//-65457 + //--------------------------------------------------------------------------- + + pSky.field_24 = 0x2000000; + + pSky.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; + pSky.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; + + //sky position(положение неба)---------------------------------------------- array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X; array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y; @@ -6038,9 +6029,10 @@ array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y; + //-------------------------------------------------------------------------- //pParty->sRotationY / 2048.0f - + // move sky(двидение неба)--------------include----------------------------- float t = (GetTickCount() % 96000) / 96000.0f; array_50AC10[0].u = t - pParty->sRotationY / 1024.0f; array_50AC10[0].v = t - pParty->sRotationX / 512.0f; @@ -6053,100 +6045,101 @@ array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f; array_50AC10[3].v = t - pParty->sRotationX / 512.0f; - - v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5; - v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); - - for (uint i = 0; i < _this.uNumVertices; ++i) - { - v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f); - v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536; - v8 = v39 + _this.ptr_38->field_C; - - v39 = (unsigned __int64)(_this.ptr_38->field_20 * v33 * (v30 - v29)) / 65536; - v36 = v39 + _this.ptr_38->field_18; - - v9 = (unsigned __int64)(_this.v_18.z * v33 * (v30 - v29)) / 65536; - v10 = _this.v_18.x + v9; - v39 = _this.v_18.x + v9; - if ( _this.v_18.x + v9 > 0 ) + //-------------------------------------------------------------------------- + + //rotate skydome(вращение купола неба)-------------------------------------- + v36 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5;//центр экрана 230 + v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5);//214 + + for (uint i = 0; i < pSky.uNumVertices; ++i) + { + v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);//8 + v39 = (unsigned __int64)(pSky.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;//0 + v8 = v39 + pSky.ptr_38->field_C;//0 + + v39 = (unsigned __int64)(pSky.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;//0 + v36 = v39 + pSky.ptr_38->field_18;//65536 + + v9 = (unsigned __int64)(pSky.v_18.z * v33 * (v30 - v29)) / 65536;//27917 + v10 = pSky.v_18.x + v9;//24701 + v39 = pSky.v_18.x + v9;//24701 + if ( pSky.v_18.x + v9 > 0 ) { v10 = 0; v39 = 0; } //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX; v38 = v10; - v12 = array_50AC10[i].vWorldViewProjY - 1.0; + //v12 = array_50AC10[i].vWorldViewProjY - 1.0; v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX); - v34 = -_this.field_24; - v32 = (signed __int64)v12; + v34 = -pSky.field_24; + v32 = (signed __int64)array_50AC10[i].vWorldViewProjY - 1.0; v14 = v33 * (v30 - v32); + while ( 1 ) { - //v40 = v14; + v40 = v14; if ( !v10 ) { - v37 = _this.v_18.z; - v16 = (unsigned __int64)(_this.v_18.z * (signed __int64)v14) >> 16; + v37 = pSky.v_18.z; + v16 = (unsigned __int64)(pSky.v_18.z * (signed __int64)v14) >> 16; --v32; v14 += v33; - v10 = _this.v_18.x + v16; - v39 = _this.v_18.x + v16; - v38 = _this.v_18.x + v16; + v10 = pSky.v_18.x + v16; + v39 = pSky.v_18.x + v16; + v38 = pSky.v_18.x + v16; break; } v37 = abs(v34 >> 14); - v15 = abs(v10); - if ( v37 <= v15 || v32 <= pViewport->uViewportTL_Y ) + if ( abs(v34 >> 14) <= abs(v10) || v32 <= pViewport->uViewportTL_Y ) { if ( v39 <= 0 ) break; } - //v14 = v40; - v37 = _this.v_18.z; - v16 = (unsigned __int64)(_this.v_18.z * v14) >> 16; + v14 = v40; + v37 = pSky.v_18.z; + v16 = (unsigned __int64)(pSky.v_18.z * v14) >> 16; --v32; v14 += v33; - v10 = _this.v_18.x + v16; - v39 = _this.v_18.x + v16; - v38 = _this.v_18.x + v16; + v10 = pSky.v_18.x + v16; + v39 = pSky.v_18.x + v16; + v38 = pSky.v_18.x + v16; break; } + LODWORD(v17) = v34 << 16; HIDWORD(v17) = v34 >> 16; - v18 = v17 / v38; - if ( v18 < 0 ) - v18 = pOutdoorCamera->shading_dist_mist; - - v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16); - v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16); - v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, v18) / 8; - v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v36, v18) / 8; + pShading = v17 / v38; + if ( pShading < 0 ) + pShading = pOutdoorCamera->shading_dist_mist; + + v37 += ((unsigned __int64)(pSky.ptr_38->field_10 * v13) >> 16); + v36 += ((unsigned __int64)(pSky.ptr_38->field_1C * v13) >> 16); + v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, pShading) / 8; + v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v36, pShading) / 8; //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; - //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0); + //array_50AC10[i].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0); //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); - //array_50AC10[i].vWorldPosition.z = v35 / (_this.pTexture->uTextureWidth * 65536.0); + //array_50AC10[i].vWorldPosition.z = v35 / (pSky.pTexture->uTextureWidth * 65536.0); //array_50AC10[i]._rhw = 1.0f / (v18 >> 16); - //array_50AC10[i].u = (double)v35 / (65536.0 * _this.pTexture->uTextureWidth); - //array_50AC10[i].v = (double)v36 / (65536.0 * _this.pTexture->uTextureHeight); - //float t = (GetTickCount() % 96000) / 96000.0f; + //array_50AC10[i].u = (double)v35 / (65536.0 * pSky.pTexture->uTextureWidth); + //array_50AC10[i].v = (double)v36 / (65536.0 * pSky.pTexture->uTextureHeight); + //----------------------------------------------------------------------------------------- + array_50AC10[i]._rhw = 1.0f; - //array_50AC10[i].u = t; - //array_50AC10[i].v = t; - } - //if ( i == _this.uNumVertices - 1 ) - //{ - pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); - - array_50AC10[0].vWorldViewProjY = v38; - array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0; - array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0; - array_50AC10[3].vWorldViewProjY = v38; - - pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); - //return; - //} + } + //if ( i == _this.uNumVertices - 1 ) + //{ + pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]); + + array_50AC10[0].vWorldViewProjY = v38; + array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0; + array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0; + array_50AC10[3].vWorldViewProjY = v38; + + pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]); + //} } //----- (00479A53) -------------------------------------------------------- @@ -10535,7 +10528,7 @@ } //----- (0048694B) -------------------------------------------------------- -int stru149::_48694B() +int stru149::sky_48694B() { int v1; // eax@1 int v2; // ST04_4@1
--- a/mm7_4.cpp Mon Jul 15 08:18:11 2013 +0400 +++ b/mm7_4.cpp Mon Jul 15 08:18:35 2013 +0400 @@ -3494,7 +3494,7 @@ v91 = &pIndoor->pFaces[sFaceID]; if ( !pRenderer->pRenderD3D ) { - result = sub_423B5D(sFaceID); + result = GetPortalScreenCoord(sFaceID); if ( result ) { result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); @@ -3959,7 +3959,7 @@ } else { - v59 = sub_423B5D(uFaceID); + v59 = GetPortalScreenCoord(uFaceID); v3 = v59; } if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) )
--- a/mm7_data.cpp Mon Jul 15 08:18:11 2013 +0400 +++ b/mm7_data.cpp Mon Jul 15 08:18:35 2013 +0400 @@ -967,25 +967,25 @@ int dword_507CD8; // weak std::array<int, 50> dword_50B570; // weak std::array<int, 50> dword_50B638; // weak -stru367 stru_50B700; -/*int stru_50B700.field_0; // weak -int stru_50B700.field_38[777]; // idb -int stru_50B700._view_transformed_ys[45]; -int stru_50B700.field_128[777]; -int stru_50B700._view_transformed_zs[45]; -int stru_50B700.field_218[777]; -int stru_50B700._view_transformed_xs[45]; -int stru_50B700._screen_space_y[777]; -int stru_50B700.field_3E4[777]; -int stru_50B700.field_2F0[2]; // idb -int stru_50B700._ys[3 + 45]; -int stru_50B700._ys2[48]; // idb -int stru_50B700._screen_space_x[777]; // idb -int stru_50B700.field_3D4[777]; // weak -int stru_50B700._xs[777]; // weak +stru367 PortalFace; +/*int PortalFace.field_0; // weak +int PortalFace.field_38[777]; // idb +int PortalFace._view_transformed_ys[45]; +int PortalFace.field_128[777]; +int PortalFace._view_transformed_zs[45]; +int PortalFace.field_218[777]; +int PortalFace._view_transformed_xs[45]; +int PortalFace._screen_space_y[777]; +int PortalFace.field_3E4[777]; +int PortalFace.field_2F0[2]; // idb +int PortalFace._ys[3 + 45]; +int PortalFace._ys2[48]; // idb +int PortalFace._screen_space_x[777]; // idb +int PortalFace.field_3D4[777]; // weak +int PortalFace._xs[777]; // weak int dword_50BAE8[777]; // weak -int stru_50B700._xs2[3 + 45]; // weak -int stru_50B700._xs3[48]; // weak*/ +int PortalFace._xs2[3 + 45]; // weak +int PortalFace._xs3[48]; // weak*/ std::array<int, 100> dword_50BC10; // weak std::array<int, 100> dword_50BDA0; // weak std::array<int, 100> dword_50BF30; // weak
--- a/mm7_data.h Mon Jul 15 08:18:11 2013 +0400 +++ b/mm7_data.h Mon Jul 15 08:18:35 2013 +0400 @@ -610,25 +610,25 @@ extern int dword_507CD8; // weak extern std::array<int, 50> dword_50B570; // weak extern std::array<int, 50> dword_50B638; // weak -extern struct stru367 stru_50B700; -/*extern int stru_50B700.field_0; // weak -extern int stru_50B700.field_38[]; // idb -extern int stru_50B700._view_transformed_ys[]; -extern int stru_50B700.field_128[]; -extern int stru_50B700._view_transformed_zs[]; -extern int stru_50B700.field_218[]; -extern int stru_50B700._view_transformed_xs[]; -extern int stru_50B700._screen_space_y[]; -extern int stru_50B700.field_3E4[]; -extern int stru_50B700.field_2F0[]; // idb -extern int stru_50B700._ys[]; -extern int stru_50B700._ys2[]; // idb -extern int stru_50B700._screen_space_x[]; // idb -extern int stru_50B700.field_3D4[]; // weak -extern int stru_50B700._xs[]; // weak +extern struct stru367 PortalFace; +/*extern int PortalFace.field_0; // weak +extern int PortalFace.field_38[]; // idb +extern int PortalFace._view_transformed_ys[]; +extern int PortalFace.field_128[]; +extern int PortalFace._view_transformed_zs[]; +extern int PortalFace.field_218[]; +extern int PortalFace._view_transformed_xs[]; +extern int PortalFace._screen_space_y[]; +extern int PortalFace.field_3E4[]; +extern int PortalFace.field_2F0[]; // idb +extern int PortalFace._ys[]; +extern int PortalFace._ys2[]; // idb +extern int PortalFace._screen_space_x[]; // idb +extern int PortalFace.field_3D4[]; // weak +extern int PortalFace._xs[]; // weak extern int dword_50BAE8[]; // weak -extern int stru_50B700._xs2[]; // weak -extern int stru_50B700._xs3[]; // weak*/ +extern int PortalFace._xs2[]; // weak +extern int PortalFace._xs3[]; // weak*/ extern std::array<int, 100> dword_50BC10; // weak extern std::array<int, 100> dword_50BDA0; // weak extern std::array<int, 100> dword_50BF30; // weak @@ -1149,7 +1149,7 @@ void __cdecl reset_some_strus_flt_2Cs(); void __cdecl j_sub_423B4A(); void __cdecl sub_423B4A(); -int __fastcall sub_423B5D(unsigned int uFaceID); +int __fastcall GetPortalScreenCoord(unsigned int uFaceID); signed int __fastcall sub_424579(int uFaceID, struct stru320 *a2); bool sub_424829(int pNumVertices, struct BspRenderer_stru2 *a2, struct BspRenderer_stru2 *a3, int uFaceID); signed int __fastcall sr_424CD7(unsigned int uVertexID); // idb
--- a/stru367.h Mon Jul 15 08:18:11 2013 +0400 +++ b/stru367.h Mon Jul 15 08:18:35 2013 +0400 @@ -6,11 +6,11 @@ #pragma pack(push, 1) struct stru367 { - int field_0; + bool direction; std::array<int, 13> field_4; - std::array<int, 60> _view_transformed_ys; - std::array<int, 60> _view_transformed_zs; - std::array<int, 48> _view_transformed_xs; + std::array<int, 60> _view_transformed_x; + std::array<int, 60> _view_transformed_y; + std::array<int, 48> _view_transformed_z; std::array<int, 60> _screen_space_y; std::array<int, 60> _screen_space_x; };