Mercurial > mm7
changeset 1282:8a196c858180
Слияние
author | Ritor1 |
---|---|
date | Sat, 15 Jun 2013 09:55:27 +0600 |
parents | 21a46b38ca24 (diff) 2929c4406d2c (current diff) |
children | 2a1ca27945e1 |
files | Indoor.cpp Indoor_stuff.h mm7_1.cpp mm7_3.cpp mm7_4.cpp |
diffstat | 5 files changed, 605 insertions(+), 175 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Sat Jun 15 01:22:17 2013 +0400 +++ b/Indoor.cpp Sat Jun 15 09:55:27 2013 +0600 @@ -348,8 +348,8 @@ if ( pNode->field_C._viewport_space_y <= pNode->field_C._viewport_space_w ) { //v5 = (char *)&pBspRenderer->nodes[0].field_C.array_3D8[pNode->field_C._viewport_space_y + v7]; - v5 = &pNode->field_C.array_3D8[pNode->field_C._viewport_space_y]; - v8 = &pNode->field_C.array_18[pNode->field_C._viewport_space_y]; + v5 = &pNode->field_C.viewport_right_side[pNode->field_C._viewport_space_y]; + v8 = &pNode->field_C.viewport_left_side[pNode->field_C._viewport_space_y]; do { v1[v4 + *v8] = 255; @@ -875,29 +875,29 @@ v120 = 2 * stru_F8A590._viewport_space_y; while ( 1 ) { - a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v24); + a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); sub_4AE313(a1, v21, &stru_F81018.field_0); if ( LOBYTE(viewparams->field_20) ) { v27 = v111 * (v24 - pBLVRenderParams->uViewportY); pZPixel = &pBLVRenderParams->pTargetZBuffer[2 - * (*(__int16 *)((char *)stru_F8A590.array_18 + v24) + * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) + 320 * (v24 - pBLVRenderParams->uViewportY)) - pBLVRenderParams->uViewportX]; pColorPixel = &pBLVRenderParams->pRenderTarget[v27 - + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v24) + + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) - pBLVRenderParams->uViewportX]; v26 = &pBLVRenderParams->pRenderTarget[v27 - + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v24) + + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24) - pBLVRenderParams->uViewportX]; v23 = v119; } else { - v25 = *(__int16 *)((char *)stru_F8A590.array_18 + v24); + v25 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); pZPixel = &pBLVRenderParams->pTargetZBuffer[v25 + v23]; pColorPixel = &pBLVRenderParams->pRenderTarget[v25 + v110]; - v26 = &pBLVRenderParams->pRenderTarget[v110 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v24)]; + v26 = &pBLVRenderParams->pRenderTarget[v110 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24)]; } v131 = (unsigned int)v26; HIWORD(v28) = HIWORD(stru_F81018.field_0.field_0); @@ -1610,8 +1610,8 @@ v6 = 640 * stru_F8A590._viewport_space_y; do { - v5[v6 + stru_F8A590.array_18[v4]] = -1; - v7 = v6 + stru_F8A590.array_3D8[v4]; + v5[v6 + stru_F8A590.viewport_left_side[v4]] = -1; + v7 = v6 + stru_F8A590.viewport_right_side[v4]; v6 += 640; v5[v7] = -1; ++v4;
--- a/Indoor_stuff.h Sat Jun 15 01:22:17 2013 +0400 +++ b/Indoor_stuff.h Sat Jun 15 09:55:27 2013 +0600 @@ -16,8 +16,8 @@ int field_C; int field_10; int field_14; - __int16 array_18[480]; - __int16 array_3D8[480]; + __int16 viewport_left_side[480]; + __int16 viewport_right_side[480]; }; #pragma pack(pop) extern BspRenderer_stru2 stru_F8A590;
--- a/mm7_1.cpp Sat Jun 15 01:22:17 2013 +0400 +++ b/mm7_1.cpp Sat Jun 15 09:55:27 2013 +0600 @@ -1489,6 +1489,431 @@ int __fastcall sub_423B5D(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 v8; // eax@5 + //signed int i_; // ecx@10 + //int v10; // eax@10 + //int v11; // edx@11 + //int v12; // ST28_4@12 + //signed int v13; // edx@12 + //signed __int64 v14; // qtt@12 + //int *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 v31; // eax@27 + int v32; // eax@27 + //signed int v33; // ST30_4@29 + //signed __int64 v34; // qtt@29 + //int v35; // ST30_4@30 + signed int for_x_num_vertices; // 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 for_z_num_vertices; // ebx@41 + //unsigned int v44; // eax@41 + //signed int v45; // ecx@42 + //int v46; // esi@42 + int v47; // eax@44 + signed int for_y_num_vertices; // edi@51 + //unsigned int v49; // eax@51 + //bool v50; // edx@51 + //int v51; // ecx@51 + //int v52; // ecx@52 + //signed int v53; // esi@52 + int v54; // eax@54 + int for_w_num_vertices; // 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 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 + 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 i; // [sp+24h] [bp-4h]@9 + //unsigned int i; // [sp+24h] [bp-4h]@19 + //signed int ix; // [sp+24h] [bp-4h]@31 + //signed int iz; // [sp+24h] [bp-4h]@41 + //signed int iy; // [sp+24h] [bp-4h]@51 + //signed int iw; // [sp+24h] [bp-4h]@61 + + pFace = &pIndoor->pFaces[uFaceID]; + memset(&stru_50B700, 0, sizeof(stru367)); + + if ( pFace->pFacePlane.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x)//check the angle of the vector and the plane + + pFace->pFacePlane.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) + + pFace->pFacePlane.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) + { + stru_50B700.field_0 = 1; + } + else + { + stru_50B700.field_0 = 0; + if ( !pFace->Portal() ) + return 0; + } + for (uint i = 0; i < pFace->uNumVertices; ++i) + { + // ( ), + 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], &stru_50B700._view_transformed_zs[i], &stru_50B700._view_transformed_ys[i], 0); + } + + if (pFace->uNumVertices <= 0) + return 0; + + bool bFound = false; + for (uint i = 0; i < pFace->uNumVertices; ++i) + if (stru_50B700._view_transformed_xs[i] >= 0x80000u)// (cull for near clip plane) z + { + bFound = true; + break; + } + if (!bFound) + return 0; + + int t; + depth_num_vertices = 0; + stru_50B700._view_transformed_xs[pFace->uNumVertices] = stru_50B700._view_transformed_xs[0]; + stru_50B700._view_transformed_zs[pFace->uNumVertices] = stru_50B700._view_transformed_zs[0]; + stru_50B700._view_transformed_ys[pFace->uNumVertices] = stru_50B700._view_transformed_ys[0]; + + //for near clip plane + current_vertices_flag = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u; + for ( uint i = 1; i <= pFace->uNumVertices; ++i) + { + next_vertices_flag = stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u; + if ( current_vertices_flag ^ next_vertices_flag ) + { + if ( next_vertices_flag ) + { + //t = (near_clip - v0.z)/(v1.z - v0.z) + t = (0x80000 - stru_50B700._view_transformed_xs[i - 1]) / (stru_50B700._view_transformed_xs[i] - stru_50B700._view_transformed_xs[i - 1]); + //x = (v1.x -v0.x)*t + v1.x + stru_50B700.field_38[depth_num_vertices] = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1]) + * t) + stru_50B700._view_transformed_ys[i]; + //y = (v1.y - v0.y)*t + v0.y + stru_50B700.field_128[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i] - stru_50B700._view_transformed_zs[i - 1]) + * t)) + stru_50B700._view_transformed_zs[i - 1]; + stru_50B700.field_218[depth_num_vertices] = 0x80000u;//z = 8.0 + } + else + { + t = (0x80000 - stru_50B700._view_transformed_xs[i]) / (stru_50B700._view_transformed_xs[i - 1] - stru_50B700._view_transformed_xs[i]); + //x = (v0.x - v1.x)*t + v1.x + stru_50B700.field_38[depth_num_vertices] = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i]) + * t) + stru_50B700._view_transformed_ys[i]; + //y = (v0.y - v1.y)*t + v1.y + stru_50B700.field_128[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i - 1] - stru_50B700._view_transformed_zs[i]) + * t)) + stru_50B700._view_transformed_zs[i]; + stru_50B700.field_218[depth_num_vertices] = 0x80000u;//z = 8.0 + } + depth_num_vertices++; + } + if ( next_vertices_flag ) + { + stru_50B700.field_38[depth_num_vertices] = stru_50B700._view_transformed_ys[i]; + stru_50B700.field_128[depth_num_vertices] = stru_50B700._view_transformed_zs[i]; + stru_50B700.field_218[depth_num_vertices] = stru_50B700._view_transformed_xs[i]; + depth_num_vertices++; + } + current_vertices_flag = next_vertices_flag; + } + stru_50B700.field_218[depth_num_vertices] = stru_50B700.field_218[0]; + stru_50B700.field_128[depth_num_vertices] = stru_50B700.field_128[0]; + stru_50B700.field_38[depth_num_vertices] = stru_50B700.field_38[0]; + + //for far clip plane + for ( uint i = 1; i <= depth_num_vertices; ++i ) + { + if (SHIWORD(stru_50B700.field_128[i]) >= 0) + { + if (SHIWORD(stru_50B700.field_218[i]) >= 0) + v26 = 0x400000; // 64.0 + else + v26 = 0xFFC00000; // -63.0 + } + else + { + if (SHIWORD(stru_50B700.field_218[i]) >= 0) + v26 = 0xFFC00000; // -63.0 + else + v26 = 0x400000; // 64.0 + } + stru_50B700._xs3[i] = v26; + if (SHIWORD(stru_50B700.field_38[i]) >= 0) + { + if (SHIWORD(stru_50B700.field_218[i]) >= 0) + v26 = 0x400000; // 64.0 + else + v26 = 0xFFC00000; // -63.0 + } + else + { + if (SHIWORD(stru_50B700.field_218[i]) >= 0) + v26 = 0xFFC00000; // -63.0 + else + v26 = 0x400000; // 64.0 + } + stru_50B700._ys2[i] = v26; + stru_50B700._xs3[i] = pBLVRenderParams->uViewportCenterX -(unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)//maybe screen space x + * (signed __int64)stru_50B700._xs3[i]); + stru_50B700._ys2[i] = pBLVRenderParams->uViewportCenterY - (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)//screen space y + * (signed __int64)stru_50B700._ys2[i]); + } + + for_x_num_vertices = 0; + stru_50B700._xs3[depth_num_vertices] = stru_50B700._xs3[0]; + stru_50B700._ys2[depth_num_vertices] = stru_50B700._ys2[0]; + if ( depth_num_vertices < 1 ) + return 0; + + //for left clip plane + current_vertices_flag = stru_50B700._xs3[0] >= (signed int)pBLVRenderParams->uViewportX; + for ( uint i = 1; i <= depth_num_vertices; i++ ) + { + next_vertices_flag = stru_50B700._xs3[i] >= (signed int)pBLVRenderParams->uViewportX;// >= + if ( current_vertices_flag ^ next_vertices_flag ) + { + if ( next_vertices_flag ) + { + v67 = (signed int)(pBLVRenderParams->uViewportX - stru_50B700._xs3[i - 1]) + * (signed __int64)(stru_50B700._ys2[i] - stru_50B700._ys2[i - 1]) / (stru_50B700._xs3[i] - stru_50B700._xs3[i - 1]); + v42 = stru_50B700._ys2[i - 1]; + } + else + { + v67 = (signed int)(pBLVRenderParams->uViewportX - stru_50B700._xs3[i]) + * (signed __int64)(stru_50B700._ys2[i - 1] - stru_50B700._ys2[i]) / (stru_50B700._xs3[i - 1] - stru_50B700._xs3[i]); + v42 = stru_50B700._ys2[i]; + } + stru_50B700._ys[for_x_num_vertices] = v67 + v42; + stru_50B700._xs2[for_x_num_vertices] = pBLVRenderParams->uViewportX; + ++for_x_num_vertices; + } + current_vertices_flag = next_vertices_flag; + if ( next_vertices_flag ) + { + stru_50B700._xs2[for_x_num_vertices] = stru_50B700._xs3[i]; + stru_50B700._ys[for_x_num_vertices] = stru_50B700._ys2[i]; + ++for_x_num_vertices; + } + } + + if (for_x_num_vertices < 1) + return 0; + + for_z_num_vertices = 0; + stru_50B700._xs2[for_x_num_vertices] = stru_50B700._xs2[0]; + stru_50B700._ys[for_x_num_vertices] = stru_50B700._ys[0]; + + //for right clip plane + current_vertices_flag = stru_50B700._xs2[0] <= (signed int)pBLVRenderParams->uViewportZ; + for ( uint i = 1; i <= for_x_num_vertices; ++i ) + { + next_vertices_flag = stru_50B700._xs2[i] <= (signed int)pBLVRenderParams->uViewportZ; + if ( current_vertices_flag ^ next_vertices_flag ) + { + if ( next_vertices_flag ) + { + v68 = (signed int)(pBLVRenderParams->uViewportZ - stru_50B700._xs2[i - 1]) + * (signed __int64)(stru_50B700._ys[i] - stru_50B700._ys[i - 1]) / (stru_50B700._xs2[i] - stru_50B700._xs2[i - 1]); + v47 = stru_50B700._ys[i - 1]; + } + else + { + v68 = (signed int)(pBLVRenderParams->uViewportZ - stru_50B700._xs2[i]) + * (signed __int64)(stru_50B700._ys[i - 1] - stru_50B700._ys[i]) / (stru_50B700._xs2[i - 1] - stru_50B700._xs2[i]); + v47 = stru_50B700._ys[i]; + } + stru_50B700.field_2F0[for_z_num_vertices] = v68 + v47; + stru_50B700._xs[for_z_num_vertices] = pBLVRenderParams->uViewportZ; + ++for_z_num_vertices; + } + if ( next_vertices_flag ) + { + stru_50B700._xs[for_z_num_vertices] = stru_50B700._xs2[i]; + stru_50B700.field_2F0[for_z_num_vertices++] = stru_50B700._ys[i]; + } + current_vertices_flag = next_vertices_flag; + } + + if (for_z_num_vertices < 1) + return 0; + + for_y_num_vertices = 0; + stru_50B700._xs[for_z_num_vertices] = stru_50B700._xs[0]; + stru_50B700.field_2F0[for_z_num_vertices] = stru_50B700.field_2F0[0]; + + //for top clip plane + current_vertices_flag = stru_50B700.field_2F0[0] >= (signed int)pBLVRenderParams->uViewportY; + for ( uint i = 1; i <= for_z_num_vertices; i++ ) + { + next_vertices_flag = stru_50B700.field_2F0[i] >= (signed int)pBLVRenderParams->uViewportY; + if ( current_vertices_flag ^ next_vertices_flag ) + { + if ( next_vertices_flag ) + { + v69 = (signed int)(pBLVRenderParams->uViewportY - stru_50B700.field_2F0[i - 1]) + * (signed __int64)(stru_50B700._xs[i] - stru_50B700._xs[i - 1]) / (stru_50B700.field_2F0[i] - stru_50B700.field_2F0[i - 1]); + v54 = stru_50B700._xs[i - 1]; + } + else + { + v69 = (signed int)(pBLVRenderParams->uViewportY - stru_50B700.field_2F0[i]) + * (signed __int64)(stru_50B700._xs[i - 1] - stru_50B700._xs[i]) / (stru_50B700.field_2F0[i - 1] - stru_50B700.field_2F0[i]); + v54 = stru_50B700._xs[i]; + } + stru_50B700.field_3D4[for_y_num_vertices] = v69 + v54; + stru_50B700._xs[for_y_num_vertices + 1] = pBLVRenderParams->uViewportY; + ++for_y_num_vertices; + } + current_vertices_flag = next_vertices_flag; + if ( next_vertices_flag ) + { + stru_50B700.field_3D4[for_y_num_vertices] = stru_50B700._xs[i]; + stru_50B700._xs[for_y_num_vertices + 1] = stru_50B700.field_2F0[i]; + for_y_num_vertices++; + } + } + + if (for_y_num_vertices < 1) + return 0; + + for_w_num_vertices = 0; + stru_50B700.field_3D4[for_y_num_vertices] = stru_50B700.field_3D4[0]; + stru_50B700._xs[for_y_num_vertices + 1] = stru_50B700._xs[1]; + + //for bottom clip plane + current_vertices_flag = stru_50B700._xs[1] <= (signed int)pBLVRenderParams->uViewportW; + for ( uint i = 1; i <= for_y_num_vertices; ++i ) + { + next_vertices_flag = stru_50B700._xs[i + 1] <= (signed int)pBLVRenderParams->uViewportW; + if ( current_vertices_flag ^ next_vertices_flag ) + { + if ( next_vertices_flag ) + { + v70 = (signed int)(pBLVRenderParams->uViewportW - stru_50B700._xs[i]) + * (signed __int64)(stru_50B700.field_3D4[i] - stru_50B700.field_3D4[i - 1]) / (stru_50B700._xs[i + 1] - stru_50B700._xs[i]); + v59 = stru_50B700.field_3D4[i - 1]; + } + else + { + v70 = (signed int)(pBLVRenderParams->uViewportW - stru_50B700._xs[i + 1]) + * (signed __int64)(stru_50B700.field_3D4[i - 1] - stru_50B700.field_3D4[i]) / (stru_50B700._xs[i] - stru_50B700._xs[i + 1]); + v59 = stru_50B700.field_3D4[i]; + } + stru_50B700._screen_space_x[for_w_num_vertices] = v70 + v59; + stru_50B700._screen_space_y[for_w_num_vertices] = pBLVRenderParams->uViewportW; + ++for_w_num_vertices; + } + if ( next_vertices_flag ) + { + stru_50B700._screen_space_x[for_w_num_vertices] = stru_50B700.field_3D4[i]; + stru_50B700._screen_space_y[for_w_num_vertices++] = stru_50B700._xs[i + 1]; + } + current_vertices_flag = next_vertices_flag; + } + + if ( !for_w_num_vertices ) + return 0; + v61 = pRenderer->pRenderD3D == 0; + stru_50B700._screen_space_x[for_w_num_vertices] = stru_50B700._screen_space_x[0]; + stru_50B700._screen_space_y[for_w_num_vertices] = stru_50B700._screen_space_y[0]; + if ( v61 && for_w_num_vertices > 3 ) + { + stru_50B700._screen_space_x[for_w_num_vertices + 1] = stru_50B700._screen_space_x[1]; + stru_50B700._screen_space_y[for_w_num_vertices + 1] = stru_50B700._screen_space_y[1]; + thisf = 2 * (stru_50B700.field_0 != 0) - 1; + if ( for_w_num_vertices > 0 ) + { + v62 = 1; + v71 = 1; + do + { + v63 = v62 - 1; + v64 = v62 + 1; + v80 = v62 + 1; + if ( v62 - 1 >= for_w_num_vertices ) + v63 -= for_w_num_vertices; + if ( v62 >= for_w_num_vertices ) + v62 -= for_w_num_vertices; + if ( v64 >= for_w_num_vertices ) + v64 -= for_w_num_vertices; + 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 ) + { + v62 = v80; + v71 = v80; + } + else + { + v62 = v71; + v65 = v71; + if ( v71 < for_w_num_vertices || (v65 = v71 - for_w_num_vertices, v71 - for_w_num_vertices < for_w_num_vertices) ) + { + memcpy(&stru_50B700._screen_space_y[v65], &stru_50B700._screen_space_y[v65 + 1], 4 * ((unsigned int)(4 * (for_w_num_vertices - v65)) >> 2)); + memcpy(&stru_50B700._screen_space_x[v65], &stru_50B700._screen_space_x[v65 + 1], 4 * ((unsigned int)(4 * (for_w_num_vertices - v65)) >> 2)); + } + --for_w_num_vertices; + } + } + while ( v62 - 1 < for_w_num_vertices ); + } + stru_50B700._screen_space_x[for_w_num_vertices] = stru_50B700._screen_space_x[0]; + stru_50B700._screen_space_y[for_w_num_vertices] = stru_50B700._screen_space_y[0]; + } + return for_w_num_vertices; +} + +//old function +/*int __fastcall sub_423B5D(unsigned int uFaceID) +{ + BLVFace *v1; // ebx@1 Vec3_short_ *v2; // esi@1 //int v3; // ST28_4@1 __int16 v4; // ST2C_2@1 @@ -1578,40 +2003,46 @@ signed int id; // [sp+24h] [bp-4h]@51 signed int ie; // [sp+24h] [bp-4h]@61 - pFace = &pIndoor->pFaces[uFaceID]; + v1 = &pIndoor->pFaces[uFaceID]; //this = pGame->pIndoorCameraD3D; - v2 = &pIndoor->pVertices[pFace->pVertexIDs[0]]; + v2 = &pIndoor->pVertices[v1->pVertexIDs[0]]; //v3 = *(_DWORD *)&v2->x; v4 = v2->z; //v5 = 0; - if ( pFace->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) - + pFace->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) - + pFace->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) + if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) + + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) + + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) { - stru_50B700.field_0 = 1; + dword_50B700 = 1; } else { - stru_50B700.field_0 = 0; - if ( !pFace->Portal() ) + dword_50B700 = 0; + if ( !v1->Portal() ) return 0; } //v66 = v1->uNumVertices; - for (uint i = 0; i < pFace->uNumVertices; ++i) + for (uint i = 0; i < v1->uNumVertices; ++i) { - auto v6 = &pIndoor->pVertices[pFace->pVertexIDs[i]]; - pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(v6->x, v6->y, v6->z, - &stru_50B700._view_transformed_xs[i], &stru_50B700._view_transformed_zs[i], &stru_50B700._view_transformed_ys[i], 0); + auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]]; + pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( + v6->x, + v6->y, + v6->z, + &_50B924_view_transformed_xs[i], + &_50B834_view_transformed_zs[i], + &_50B744_view_transformed_ys[i], + 0); } //v7 = v1->uNumVertices; //v8 = 0; - if (pFace->uNumVertices <= 0) + if (v1->uNumVertices <= 0) return 0; bool bFound = false; - for (uint i = 0; i < pFace->uNumVertices; ++i) - if (stru_50B700._view_transformed_xs[i] >= 0x80000u) + for (uint i = 0; i < v1->uNumVertices; ++i) + if (_50B924_view_transformed_xs[i] >= 0x80000u) { bFound = true; break; @@ -1620,27 +2051,27 @@ return 0; v79 = 0; - stru_50B700._view_transformed_xs[pFace->uNumVertices] = stru_50B700._view_transformed_xs[0]; - stru_50B700._view_transformed_zs[pFace->uNumVertices] = stru_50B700._view_transformed_zs[0]; - stru_50B700._view_transformed_ys[pFace->uNumVertices] = stru_50B700._view_transformed_ys[0]; - thisa = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u; + _50B924_view_transformed_xs[v1->uNumVertices] = _50B924_view_transformed_xs[0]; + _50B834_view_transformed_zs[v1->uNumVertices] = _50B834_view_transformed_zs[0]; + _50B744_view_transformed_ys[v1->uNumVertices] = _50B744_view_transformed_ys[0]; + thisa = _50B924_view_transformed_xs[0] >= (signed int)0x80000u; //int i = 1; - for (uint i = 1; i <= pFace->uNumVertices; ++i) + for (uint i = 1; i <= v1->uNumVertices; ++i) { - v10 = stru_50B700._view_transformed_xs[i]; + v10 = _50B924_view_transformed_xs[i]; v81 = v10 >= (signed int)0x80000u; if ( thisa ^ v81 ) { - v11 = stru_50B700._view_transformed_xs[i - 1]; + v11 = _50B924_view_transformed_xs[i - 1]; if ( v10 >= (signed int)0x80000u ) { v12 = v10 - v11; v13 = 0x80000 - v11; LODWORD(v14) = v13 << 16; HIDWORD(v14) = v13 >> 16; - v15 = &stru_50B700._view_transformed_ys[i - 1]; - stru_50B700.field_128[v79] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i] - stru_50B700._view_transformed_zs[i - 1]) * v14 / v12) >> 16) + stru_50B700._view_transformed_zs[i - 1]; - thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1]) * v14 / v12) >> 16; + v15 = &_50B744_view_transformed_ys[i - 1]; + dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i] - _50B834_view_transformed_zs[i - 1]) * v14 / v12) >> 16) + _50B834_view_transformed_zs[i - 1]; + thisb = (unsigned __int64)((_50B744_view_transformed_ys[i] - _50B744_view_transformed_ys[i - 1]) * v14 / v12) >> 16; } else { @@ -1648,93 +2079,93 @@ v17 = 0x80000 - v10; LODWORD(v18) = v17 << 16; HIDWORD(v18) = v17 >> 16; - v15 = &stru_50B700._view_transformed_ys[i]; - stru_50B700.field_128[v79] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i - 1] - stru_50B700._view_transformed_zs[i]) * v18 / v16) >> 16) + stru_50B700._view_transformed_zs[i]; - thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i]) * v18 / v16) >> 16; + v15 = &_50B744_view_transformed_ys[i]; + dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i - 1] - _50B834_view_transformed_zs[i]) * v18 / v16) >> 16) + _50B834_view_transformed_zs[i]; + thisb = (unsigned __int64)((_50B744_view_transformed_ys[i - 1] - _50B744_view_transformed_ys[i]) * v18 / v16) >> 16; } v19 = v79++; //v7 = v66; - stru_50B700.field_38[v19] = thisb + *v15; - stru_50B700.field_218[v19] = 0x80000u; + dword_50B738[v19] = thisb + *v15; + dword_50B918[v19] = 0x80000u; } if ( v81 ) { v20 = v79++; - stru_50B700.field_218[v20] = stru_50B700._view_transformed_xs[i]; - stru_50B700.field_128[v20] = stru_50B700._view_transformed_zs[i]; - stru_50B700.field_38[v20] = stru_50B700._view_transformed_ys[i]; + dword_50B918[v20] = _50B924_view_transformed_xs[i]; + dword_50B828[v20] = _50B834_view_transformed_zs[i]; + dword_50B738[v20] = _50B744_view_transformed_ys[i]; } //++i; thisa = v81; } v21 = v79; - stru_50B700.field_218[v79] = stru_50B700.field_218[0]; - stru_50B700.field_128[v79] = stru_50B700.field_128[0]; - stru_50B700.field_38[v79] = stru_50B700.field_38[0]; + dword_50B918[v79] = dword_50B918[0]; + dword_50B828[v79] = dword_50B828[0]; + dword_50B738[v79] = dword_50B738[0]; for (ia = 0; ia < v79; ++ia) { v22 = ia; - thisc = abs(stru_50B700.field_218[ia]); - if ( abs(stru_50B700.field_128[ia]) >> 13 <= thisc ) + thisc = abs(dword_50B918[ia]); + if ( abs(dword_50B828[ia]) >> 13 <= thisc ) { - v27 = stru_50B700.field_128[v22]; + v27 = dword_50B828[v22]; LODWORD(v28) = v27 << 16; HIDWORD(v28) = v27 >> 16; - v26 = v28 / stru_50B700.field_218[v22]; + v26 = v28 / dword_50B918[v22]; v23 = 0; } else { v23 = 0; v24 = 0; - if ( stru_50B700.field_128[v22] >= 0 ) + if ( dword_50B828[v22] >= 0 ) { - LOBYTE(v24) = stru_50B700.field_218[v22] >= 0; + LOBYTE(v24) = dword_50B918[v22] >= 0; v26 = ((v24 - 1) & 0xFF800000) + 0x400000; } else { - LOBYTE(v24) = stru_50B700.field_218[v22] >= 0; + LOBYTE(v24) = dword_50B918[v22] >= 0; v25 = v24 - 1; v26 = (v25 & 0x800000) - 0x400000; } } - v29 = stru_50B700.field_38[v22]; - stru_50B700._xs3[v22] = v26; + v29 = dword_50B738[v22]; + dword_50BAF8_xs[v22] = v26; if ( abs(v29) >> 13 <= thisc ) { - v33 = stru_50B700.field_38[v22]; + v33 = dword_50B738[v22]; LODWORD(v34) = v33 << 16; HIDWORD(v34) = v33 >> 16; - v32 = v34 / stru_50B700.field_218[v22]; + v32 = v34 / dword_50B918[v22]; } else { v30 = 0; - if ( stru_50B700.field_38[v22] >= v23 ) + if ( dword_50B738[v22] >= v23 ) { - LOBYTE(v30) = stru_50B700.field_218[v22] >= v23; + LOBYTE(v30) = dword_50B918[v22] >= v23; v32 = ((v30 - 1) & 0xFF800000) + 0x400000; } else { - LOBYTE(v30) = stru_50B700.field_218[v22] >= v23; + LOBYTE(v30) = dword_50B918[v22] >= v23; v31 = v30 - 1; v32 = (v31 & 0x800000) - 0x400000; } } - stru_50B700._ys2[v22] = v32; - stru_50B700._xs3[v22] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._xs3[v22]) >> 16; - v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._ys2[v22]) >> 16; - stru_50B700._xs3[v22] = pBLVRenderParams->uViewportCenterX - stru_50B700._xs3[v22]; - stru_50B700._ys2[v22] = pBLVRenderParams->uViewportCenterY - v35; + dword_50BA08_ys[v22] = v32; + dword_50BAF8_xs[v22] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BAF8_xs[v22]) >> 16; + v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08_ys[v22]) >> 16; + dword_50BAF8_xs[v22] = pBLVRenderParams->uViewportCenterX - dword_50BAF8_xs[v22]; + dword_50BA08_ys[v22] = pBLVRenderParams->uViewportCenterY - v35; } v36 = 0; - stru_50B700._xs3[v21] = stru_50B700._xs3[0]; - stru_50B700._ys2[v21] = stru_50B700._ys2[0]; + dword_50BAF8_xs[v21] = dword_50BAF8_xs[0]; + dword_50BA08_ys[v21] = dword_50BA08_ys[0]; v37 = pBLVRenderParams->uViewportX; - v38 = stru_50B700._xs3[0] < (signed int)pBLVRenderParams->uViewportX; - LOBYTE(v38) = stru_50B700._xs3[0] >= (signed int)pBLVRenderParams->uViewportX; + v38 = dword_50BAF8_xs[0] < (signed int)pBLVRenderParams->uViewportX; + LOBYTE(v38) = dword_50BAF8_xs[0] >= (signed int)pBLVRenderParams->uViewportX; v39 = 1; ib = 1; if ( v79 < 1 ) @@ -1742,30 +2173,30 @@ do { v40 = v39; - v41 = stru_50B700._xs3[v40]; + v41 = dword_50BAF8_xs[v40]; v82 = v41 >= (signed int)v37; if ( v38 ^ v82 ) { if ( v41 >= (signed int)v37 ) { - v67 = (signed int)(v37 - stru_50B700._xs3[v40 - 1]) * (signed __int64)(stru_50B700._ys2[v40] - stru_50B700._ys2[v40 - 1]) / (v41 - stru_50B700._xs3[v40 - 1]); - v42 = stru_50B700._ys2[v40 - 1]; + v67 = (signed int)(v37 - dword_50BAF8_xs[v40 - 1]) * (signed __int64)(dword_50BA08_ys[v40] - dword_50BA08_ys[v40 - 1]) / (v41 - dword_50BAF8_xs[v40 - 1]); + v42 = dword_50BA08_ys[v40 - 1]; } else { - v67 = (signed int)(v37 - v41) * (signed __int64)(stru_50B700._ys2[v40 - 1] - stru_50B700._ys2[v40]) / (stru_50B700._xs3[v40 - 1] - v41); - v42 = stru_50B700._ys2[v40]; + v67 = (signed int)(v37 - v41) * (signed __int64)(dword_50BA08_ys[v40 - 1] - dword_50BA08_ys[v40]) / (dword_50BAF8_xs[v40 - 1] - v41); + v42 = dword_50BA08_ys[v40]; } - stru_50B700._ys[v36] = v67 + v42; + dword_50B9FC_ys[v36] = v67 + v42; v37 = pBLVRenderParams->uViewportX; - stru_50B700._xs2[v36] = pBLVRenderParams->uViewportX; + dword_50BAEC_xs[v36] = pBLVRenderParams->uViewportX; ++v36; } v38 = v82; if ( v82 ) { - stru_50B700._xs2[v36] = stru_50B700._xs3[v40]; - stru_50B700._ys[v36] = stru_50B700._ys2[v40]; + dword_50BAEC_xs[v36] = dword_50BAF8_xs[v40]; + dword_50B9FC_ys[v36] = dword_50BA08_ys[v40]; ++v36; } v39 = ib++ + 1; @@ -1776,38 +2207,38 @@ return 0; v43 = 0; - stru_50B700._xs2[v36] = stru_50B700._xs2[0]; - stru_50B700._ys[v36] = stru_50B700._ys[0]; + dword_50BAEC_xs[v36] = dword_50BAEC_xs[0]; + dword_50B9FC_ys[v36] = dword_50B9FC_ys[0]; v44 = pBLVRenderParams->uViewportZ; - thisd = stru_50B700._xs2[0] <= (signed int)pBLVRenderParams->uViewportZ; + thisd = dword_50BAEC_xs[0] <= (signed int)pBLVRenderParams->uViewportZ; ic = 1; do { v45 = ic; - v46 = stru_50B700._xs2[ic]; + v46 = dword_50BAEC_xs[ic]; v83 = v46 <= (signed int)v44; if ( thisd ^ v83 ) { if ( v46 <= (signed int)v44 ) { - v68 = (signed int)(v44 - stru_50B700._xs2[v45 - 1]) * (signed __int64)(stru_50B700._ys[v45] - stru_50B700._ys[v45 - 1]) / (v46 - stru_50B700._xs2[v45 - 1]); - v47 = stru_50B700._ys[v45 - 1]; + v68 = (signed int)(v44 - dword_50BAEC_xs[v45 - 1]) * (signed __int64)(dword_50B9FC_ys[v45] - dword_50B9FC_ys[v45 - 1]) / (v46 - dword_50BAEC_xs[v45 - 1]); + v47 = dword_50B9FC_ys[v45 - 1]; } else { - v68 = (signed int)(v44 - v46) * (signed __int64)(stru_50B700._ys[v45 - 1] - stru_50B700._ys[v45]) / (stru_50B700._xs2[v45 - 1] - v46); - v47 = stru_50B700._ys[v45]; + v68 = (signed int)(v44 - v46) * (signed __int64)(dword_50B9FC_ys[v45 - 1] - dword_50B9FC_ys[v45]) / (dword_50BAEC_xs[v45 - 1] - v46); + v47 = dword_50B9FC_ys[v45]; } - stru_50B700.field_2F0[v43] = v68 + v47; + dword_50B9F0[v43] = v68 + v47; v44 = pBLVRenderParams->uViewportZ; - stru_50B700._xs[v43] = pBLVRenderParams->uViewportZ; + dword_50BAE0[v43] = pBLVRenderParams->uViewportZ; ++v43; } if ( v83 ) { - stru_50B700._xs[v43] = stru_50B700._xs2[v45]; - stru_50B700.field_2F0[v43++] = stru_50B700._ys[v45]; + dword_50BAE0[v43] = dword_50BAEC_xs[v45]; + dword_50B9F0[v43++] = dword_50B9FC_ys[v45]; } ++ic; thisd = v83; @@ -1818,41 +2249,40 @@ return 0; v48 = 0; - stru_50B700._xs[v43] = stru_50B700._xs[0]; - stru_50B700.field_2F0[v43] = stru_50B700.field_2F0[0]; + dword_50BAE0[v43] = dword_50BAE0[0]; + dword_50B9F0[v43] = dword_50B9F0[0]; v49 = pBLVRenderParams->uViewportY; - v50 = stru_50B700.field_2F0[0] < (signed int)pBLVRenderParams->uViewportY; - LOBYTE(v50) = stru_50B700.field_2F0[0] >= (signed int)pBLVRenderParams->uViewportY; + v50 = dword_50B9F0[0] < (signed int)pBLVRenderParams->uViewportY; + LOBYTE(v50) = dword_50B9F0[0] >= (signed int)pBLVRenderParams->uViewportY; v51 = 1; id = 1; do { v52 = v51; - v53 = stru_50B700.field_2F0[v52]; + v53 = dword_50B9F0[v52]; v84 = v53 >= (signed int)v49; if ( v50 ^ v84 ) { if ( v53 >= (signed int)v49 ) { - v69 = (signed int)(v49 - stru_50B700.field_2F0[v52 - 1]) * (signed __int64)(stru_50B700._xs[v52] - stru_50B700._xs[v52 - 1]) / (v53 - stru_50B700.field_2F0[v52 - 1]); - v54 = stru_50B700._xs[v52 - 1]; + v69 = (signed int)(v49 - dword_50B9F0[v52 - 1]) * (signed __int64)(dword_50BAE0[v52] - dword_50BAE0[v52 - 1]) / (v53 - dword_50B9F0[v52 - 1]); + v54 = dword_50BAE0[v52 - 1]; } else { - v69 = (signed int)(v49 - v53) * (signed __int64)(stru_50B700._xs[v52 - 1] - stru_50B700._xs[v52]) / (stru_50B700.field_2F0[v52 - 1] - v53); - v54 = stru_50B700._xs[v52]; + v69 = (signed int)(v49 - v53) * (signed __int64)(dword_50BAE0[v52 - 1] - dword_50BAE0[v52]) / (dword_50B9F0[v52 - 1] - v53); + v54 = dword_50BAE0[v52]; } - stru_50B700.field_3D4[v48] = v69 + v54; + dword_50BAD4[v48] = v69 + v54; v49 = pBLVRenderParams->uViewportY; - stru_50B700._xs[v48+1] = pBLVRenderParams->uViewportY; + dword_50B9E4[v48] = pBLVRenderParams->uViewportY; ++v48; } v50 = v84; if ( v84 ) { - stru_50B700.field_3D4[v48] = stru_50B700._xs[v52]; - stru_50B700._xs[v48+1] = stru_50B700.field_2F0[v52]; - v48++; + dword_50BAD4[v48] = dword_50BAE0[v52]; + dword_50B9E4[v48++] = dword_50B9F0[v52]; } v51 = id++ + 1; } @@ -1862,37 +2292,37 @@ return 0; v55 = 0; - stru_50B700.field_3D4[v48] = stru_50B700.field_3D4[0]; - stru_50B700._xs[v48+1] = stru_50B700._xs[1]; + dword_50BAD4[v48] = dword_50BAD4[0]; + dword_50B9E4[v48] = dword_50B9E4[0]; v56 = pBLVRenderParams->uViewportW; - thise = stru_50B700._xs[1] <= (signed int)pBLVRenderParams->uViewportW; + thise = dword_50B9E4[0] <= (signed int)pBLVRenderParams->uViewportW; ie = 1; do { v57 = ie; - v58 = stru_50B700._xs[ie+1]; + v58 = dword_50B9E4[ie]; v85 = v58 <= (signed int)v56; if ( thise ^ v85 ) { if ( v58 <= (signed int)v56 ) { - v70 = (signed int)(v56 - stru_50B700._xs[v57]) * (signed __int64)(stru_50B700.field_3D4[v57] - stru_50B700.field_3D4[v57 - 1]) / (v58 - stru_50B700._xs[v57]); - v59 = stru_50B700.field_3D4[v57 - 1]; + v70 = (signed int)(v56 - dword_50B9E4[v57 - 1]) * (signed __int64)(dword_50BAD4[v57] - dword_50BAD4[v57 - 1]) / (v58 - dword_50B9E4[v57 - 1]); + v59 = dword_50BAD4[v57 - 1]; } else { - v70 = (signed int)(v56 - v58) * (signed __int64)(stru_50B700.field_3D4[v57 - 1] - stru_50B700.field_3D4[v57]) / (stru_50B700._xs[v57] - v58); - v59 = stru_50B700.field_3D4[v57]; + v70 = (signed int)(v56 - v58) * (signed __int64)(dword_50BAD4[v57 - 1] - dword_50BAD4[v57]) / (dword_50B9E4[v57 - 1] - v58); + v59 = dword_50BAD4[v57]; } - stru_50B700._screen_space_x[v55] = v70 + v59; + _50BAC8_screen_space_x[v55] = v70 + v59; v56 = pBLVRenderParams->uViewportW; - stru_50B700._screen_space_y[v55] = pBLVRenderParams->uViewportW; + _50B9D8_screen_space_y[v55] = pBLVRenderParams->uViewportW; ++v55; } if ( v85 ) { - stru_50B700._screen_space_x[v55] = stru_50B700.field_3D4[v57]; - stru_50B700._screen_space_y[v55++] = stru_50B700._xs[v57+1]; + _50BAC8_screen_space_x[v55] = dword_50BAD4[v57]; + _50B9D8_screen_space_y[v55++] = dword_50B9E4[v57]; } ++ie; thise = v85; @@ -1902,13 +2332,13 @@ if ( !v55 ) 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]; + _50BAC8_screen_space_x[v55] = _50BAC8_screen_space_x[0]; + _50B9D8_screen_space_y[v55] = _50B9D8_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; + _50BAC8_screen_space_x[v55 + 1] = _50BAC8_screen_space_x[1]; + _50B9D8_screen_space_y[v55 + 1] = _50B9D8_screen_space_y[1]; + thisf = 2 * (dword_50B700 != 0) - 1; if ( v55 > 0 ) { v62 = 1; @@ -1925,8 +2355,8 @@ 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 ) + * ((_50B9D8_screen_space_y[v64] - _50B9D8_screen_space_y[v63]) * (_50BAC8_screen_space_x[v62] - _50BAC8_screen_space_x[v63]) + - (_50B9D8_screen_space_y[v62] - _50B9D8_screen_space_y[v63]) * (_50BAC8_screen_space_x[v64] - _50BAC8_screen_space_x[v63])) < 0 ) { v62 = v80; v71 = v80; @@ -1937,19 +2367,19 @@ v65 = v71; if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) { - 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(&_50B9D8_screen_space_y[v65], &_50B9D8_screen_space_y[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); + memcpy(&_50BAC8_screen_space_x[v65], &_50BAC8_screen_space_x[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); } --v55; } } while ( v62 - 1 < v55 ); } - stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; - stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; + _50BAC8_screen_space_x[v55] = _50BAC8_screen_space_x[0]; + _50B9D8_screen_space_y[v55] = _50B9D8_screen_space_y[0]; } return v55; -} +}*/ //----- (00424579) -------------------------------------------------------- int __fastcall sub_424579(int uFaceID, stru320 *a2) @@ -2368,7 +2798,7 @@ { 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->array_18[min_y] = LOWORD(stru_50B700._screen_space_x[v55]); + a2->viewport_left_side[min_y] = LOWORD(stru_50B700._screen_space_x[v55]); } v15 = v65; v61 = v65; @@ -2405,13 +2835,13 @@ { 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->array_3D8[max_y] = LOWORD(stru_50B700._screen_space_x[v20]); + a2->viewport_right_side[max_y] = LOWORD(stru_50B700._screen_space_x[v20]); } v22 = min_y; if ( min_y <= max_y ) { - //v56 = &a2->array_3D8[v7]; - //v23 = &a2->array_18[v7]; + //v56 = &a2->viewport_right_side[v7]; + //v23 = &a2->viewport_left_side[v7]; for ( v70 = min_y; v70 <= max_y; ++v70 ) { v24 = v13; @@ -2452,21 +2882,21 @@ v61 = stru_50B700._screen_space_x[v29] << 16; } } - //v34 = (char *)a2->array_18 - (char *)a2->array_3D8; - //v35 = *(__int16 *)((char *)&a2->array_3D8[v70] + v34); + //v34 = (char *)a2->viewport_left_side - (char *)a2->viewport_right_side; + //v35 = *(__int16 *)((char *)&a2->viewport_right_side[v70] + v34); //v35 = HIWORD(v62); - a2->array_18[v70] = HIWORD(v62); - a2->array_3D8[v70] = HIWORD(v61); + a2->viewport_left_side[v70] = HIWORD(v62); + a2->viewport_right_side[v70] = HIWORD(v61); //v34 = &a2->array_3D8[v70]; //v35 = a2->array_3D8[v70]; - if ( a2->array_18[v70] > a2->array_3D8[v70] ) + if ( a2->viewport_left_side[v70] > a2->viewport_right_side[v70] ) { - v36 = a2->array_18[v70] ^ a2->array_3D8[v70]; - v37 = a2->array_3D8[v70]; - a2->array_18[v70] = v36; + v36 = a2->viewport_left_side[v70] ^ a2->viewport_right_side[v70]; + v37 = a2->viewport_right_side[v70]; + a2->viewport_left_side[v70] = v36; v38 = v37 ^ v36; - a2->array_18[v70] ^= v38; - a2->array_3D8[v70] = v38; + a2->viewport_left_side[v70] ^= v38; + a2->viewport_right_side[v70] = v38; } //++v56; v62 += v54; @@ -2486,11 +2916,11 @@ if ( min_y <= max_y ) { //a3a = (char *)a2 - (char *)a3; - //v42 = &a3->array_3D8[v7]; + //v42 = &a3->viewport_right_side[v7]; //v57 = *(__int16 *)((char *)v42 + a3a); for ( v71 = min_y; v71 <= max_y; ++v71 ) { - if ( a2->array_18[v71] >= a3->array_18[v71] && a2->array_18[v71] <= a3->array_3D8[v71] ) + if ( a2->viewport_left_side[v71] >= a3->viewport_left_side[v71] && a2->viewport_left_side[v71] <= a3->viewport_right_side[v71] ) break; //++v57; ++min_y; @@ -2500,11 +2930,11 @@ if ( max_y < min_y ) return false; //a3a = (char *)a2 - (char *)a3; - //v43 = &a3->array_3D8[v8]; + //v43 = &a3->viewport_right_side[v8]; //v58 = *(__int16 *)((char *)v43 + a3a); for ( v72 = max_y; v72 >= min_y; --v72 ) { - if ( a2->array_3D8[v72] >= a3->array_18[v72] && a2->array_18[v72] <= a3->array_3D8[v72] ) + if ( a2->viewport_right_side[v72] >= a3->viewport_left_side[v72] && a2->viewport_left_side[v72] <= a3->viewport_right_side[v72] ) break; //--v58; --max_y; @@ -2515,40 +2945,40 @@ return false; //a3b = (char *)a3 - (char *)a2; v59 = min_y; - //v45 = &a2->array_18[v7]; + //v45 = &a2->viewport_left_side[v7]; for ( v46 = max_y - min_y + 1; v46; --v46 ) { //v47 = *(__int16 *)((char *)v45 + a3b); - if ( a2->array_18[v59] < a3->array_18[v59] ) - a2->array_18[v59] = a3->array_18[v59]; - if ( a2->array_3D8[v59] > a3->array_3D8[v59] ) - a2->array_3D8[v59] = a3->array_3D8[v59]; + if ( a2->viewport_left_side[v59] < a3->viewport_left_side[v59] ) + a2->viewport_left_side[v59] = a3->viewport_left_side[v59]; + if ( a2->viewport_right_side[v59] > a3->viewport_right_side[v59] ) + a2->viewport_right_side[v59] = a3->viewport_right_side[v59]; ++v59; //++v45; } a2->_viewport_space_y = min_y; a2->_viewport_space_w = max_y; - a2->field_8 = a2->array_18[min_y]; - //v48 = a2->array_3D8[v7]; + a2->field_8 = a2->viewport_left_side[min_y]; + //v48 = a2->viewport_right_side[v7]; a2->field_10 = min_y; a2->field_14 = min_y; - a2->field_C = a2->array_3D8[min_y]; + a2->field_C = a2->viewport_right_side[min_y]; v49 = min_y + 1; if ( v49 <= max_y ) { - //v50 = &a2->array_3D8[v49]; + //v50 = &a2->viewport_right_side[v49]; for ( v49; v49 <= max_y; ++v49 ) { - //v51 = a2->array_18[v49]; - if ( a2->array_18[v49] < a2->field_8 ) + //v51 = a2->viewport_left_side[v49]; + if ( a2->viewport_left_side[v49] < a2->field_8 ) { - a2->field_8 = a2->array_18[v49]; + a2->field_8 = a2->viewport_left_side[v49]; a2->field_10 = v49; } - if ( a2->array_3D8[v49] > a2->field_C ) + if ( a2->viewport_right_side[v49] > a2->field_C ) { - a2->field_C = a2->array_3D8[v49]; + a2->field_C = a2->viewport_right_side[v49]; a2->field_14 = v49; } //++v50;
--- a/mm7_3.cpp Sat Jun 15 01:22:17 2013 +0400 +++ b/mm7_3.cpp Sat Jun 15 09:55:27 2013 +0600 @@ -11040,13 +11040,13 @@ { if ( i < y || i > w ) { - array_18[i] = 640; - array_3D8[i] = -1; + viewport_left_side[i] = 640; + viewport_right_side[i] = -1; } else { - array_18[i] = x; - array_3D8[i] = z; + viewport_left_side[i] = x; + viewport_right_side[i] = z; } } }
--- a/mm7_4.cpp Sat Jun 15 01:22:17 2013 +0400 +++ b/mm7_4.cpp Sat Jun 15 09:55:27 2013 +0600 @@ -4511,29 +4511,29 @@ v101 = 2 * stru_F8A590._viewport_space_y; while ( 1 ) { - a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); + a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12); sub_4AE313(a1, result, &stru_F81018.field_0); if ( LOBYTE(viewparams->field_20) ) { v15 = v95 * (v12 - pBLVRenderParams->uViewportY); v119 = &pBLVRenderParams->pTargetZBuffer[2 - * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) + * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v12) + 320 * (v12 - pBLVRenderParams->uViewportY)) - pBLVRenderParams->uViewportX]; v16 = &pBLVRenderParams->pRenderTarget[v15 - + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) + + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12) - pBLVRenderParams->uViewportX]; v14 = &pBLVRenderParams->pRenderTarget[v15 - + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) + + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12) - pBLVRenderParams->uViewportX]; v123 = (unsigned int)v16; } else { - v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); + v13 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12); v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; - v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; + v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12)]; } v117 = (unsigned int)v14; HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); @@ -4999,7 +4999,7 @@ v56 = 640 * stru_F8A590._viewport_space_y; for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) { - sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); + sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13), v12); v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); v15 = GetTickCount(); v16 = v14->field_0; @@ -5010,10 +5010,10 @@ v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; v18 = v14->field_28; - v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); + v19 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13); LOWORD(v18) = 0; v46 = stru_F8AD28.field_0 | v18; - v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; + v61 = *(__int16 *)((char *)stru_F8A590.viewport_right_side + v13) - v19; if ( LOBYTE(viewparams->field_20) ) { v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY))