changeset 1291:1577d75db258

m
author Ritor1
date Fri, 14 Jun 2013 16:06:20 +0600
parents 93911045d8f1
children 24bc24b64ec2
files Indoor.cpp Indoor_stuff.h mm7_1.cpp mm7_3.cpp mm7_4.cpp stru367.h
diffstat 6 files changed, 235 insertions(+), 231 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Tue Jun 11 17:31:03 2013 +0600
+++ b/Indoor.cpp	Fri Jun 14 16:06:20 2013 +0600
@@ -347,9 +347,9 @@
 		  v4 = pRenderer->uTargetSurfacePitch * pNode->field_C._viewport_space_y;
 		  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 = (char *)&pBspRenderer->nodes[0].field_C.viewport_right_side[pNode->field_C._viewport_space_y + v7];
+			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);
@@ -1259,8 +1259,8 @@
   //stru170 *v4; // ebx@1
   //BLVFace *v5; // eax@1
   //int v6; // ecx@2
-  unsigned __int16 v7; // ax@11
-  Vec3_short_ *v8; // esi@15
+  unsigned __int16 TransitionSectorID; // ax@11
+  //Vec3_short_ *v8; // esi@15
   int v9; // edx@15
   //signed int v10; // eax@18
   //signed int v11; // edi@19
@@ -1326,16 +1326,16 @@
                                           + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
                                           + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane
       {
-        v7 = pFace->uSectorID;
-        if ( nodes[0].uSectorID == v7 )  // draw back sector
-          v7 = pFace->uBackSectorID;
-        nodes[num_nodes].uSectorID = v7;
+        TransitionSectorID = pFace->uSectorID;
+        if ( nodes[0].uSectorID == TransitionSectorID )  // draw back sector
+          TransitionSectorID = pFace->uBackSectorID;
+        nodes[num_nodes].uSectorID = TransitionSectorID;
         nodes[num_nodes].uFaceID = uFaceID;
         nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX;
         nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ;
         nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY;
         nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW;
-        nodes[num_nodes].field_C._43F9E1(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY,
+        nodes[num_nodes].field_C.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY,
                                          pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW);
         AddBspNodeToRenderList(++num_nodes - 1);
         return;
@@ -1344,10 +1344,10 @@
       //v6 = a0;
     }
 
-    v8 = &pIndoor->pVertices[pFace->pVertexIDs[0]];
-    v9 = pFace->pFacePlane_old.vNormal.x * (v8->x - pBLVRenderParams->vPartyPos.x)
-       + pFace->pFacePlane_old.vNormal.y * (v8->y - pBLVRenderParams->vPartyPos.y)
-       + pFace->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z);
+    //отбраковка по ориентации
+    v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x)
+       + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y)
+       + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z);
     if (p->uSectorID != pFace->uSectorID)
       v9 = -v9;
     if (v9 >= 0)
@@ -1491,7 +1491,7 @@
         v3->nodes[v3->num_nodes].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
         v3->nodes[v3->num_nodes].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
         v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
-        v3->nodes[v3->num_nodes++].field_C._43F9E1(
+        v3->nodes[v3->num_nodes++].field_C.GetViewportData(
           SLOWORD(pBLVRenderParams->uViewportX),
           pBLVRenderParams->uViewportY,
           SLOWORD(pBLVRenderParams->uViewportZ),
@@ -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	Tue Jun 11 17:31:03 2013 +0600
+++ b/Indoor_stuff.h	Fri Jun 14 16:06:20 2013 +0600
@@ -8,7 +8,7 @@
 #pragma pack(push, 1)
 struct BspRenderer_stru2
 {
-  void _43F9E1(__int16 x, int y, __int16 z, int w);
+  void GetViewportData(__int16 x, int y, __int16 z, int w);
 
   int _viewport_space_y;
   int _viewport_space_w;
@@ -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	Tue Jun 11 17:31:03 2013 +0600
+++ b/mm7_1.cpp	Fri Jun 14 16:06:20 2013 +0600
@@ -1505,9 +1505,9 @@
   //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 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
@@ -1522,26 +1522,26 @@
   //signed int v33; // ST30_4@29
   //signed __int64 v34; // qtt@29
   //int v35; // ST30_4@30
-  signed int v36; // edi@31
+  signed int for_x_num_vertices; // edi@31
   //unsigned int v37; // eax@31
-  bool v38; // edx@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
+  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 v48; // edi@51
+  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 v55; // ebx@61
+  int for_w_num_vertices; // ebx@61
   //unsigned int v56; // eax@61
   //signed int v57; // ecx@62
   //int v58; // esi@62
@@ -1557,16 +1557,16 @@
   int v69; // [sp+14h] [bp-14h]@54
   int v70; // [sp+14h] [bp-14h]@64
   signed int v71; // [sp+14h] [bp-14h]@75
-  bool thisa; // [sp+18h] [bp-10h]@9
-  int thisb; // [sp+18h] [bp-10h]@12
+  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 v79; // [sp+1Ch] [bp-Ch]@9
+  signed int length_num_vertices; // [sp+1Ch] [bp-Ch]@9
   int v80; // [sp+1Ch] [bp-Ch]@76
-  bool v81; // [sp+20h] [bp-8h]@10
-  bool v82; // [sp+20h] [bp-8h]@32
+  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
@@ -1578,9 +1578,8 @@
   //signed int iw; // [sp+24h] [bp-4h]@61
 
   pFace = &pIndoor->pFaces[uFaceID];
-  //v2 = &pIndoor->pVertices[pFace->pVertexIDs[0]];
-  //v4 = pIndoor->pVertices[pFace->pVertexIDs[0]].z;
-  if ( pFace->pFacePlane.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x)//maybe it's length = n * direction vector
+
+  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 )
   {
@@ -1594,7 +1593,7 @@
   }
   for (uint i = 0; i < pFace->uNumVertices; ++i)
   {
-      //auto v6 = &pIndoor->pVertices[pFace->pVertexIDs[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);
@@ -1605,7 +1604,7 @@
 
   bool bFound = false;
   for (uint i = 0; i < pFace->uNumVertices; ++i)
-    if (stru_50B700._view_transformed_xs[i] >= 0x80000u)
+    if (stru_50B700._view_transformed_xs[i] >= 0x80000u)//отбраковывание по задней границе(cull for near clip plane) по z координате
     {
       bFound = true;
       break;
@@ -1613,110 +1612,115 @@
   if (!bFound)
     return 0;
 
-  v79 = 0;
-  stru_50B700._view_transformed_xs[pFace->uNumVertices] = stru_50B700._view_transformed_xs[0];
+  int t;
+  //int new_point = 0;
+  length_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];
 
   //maybe for near clip plane
-  thisa = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u;
+  current_vertices_flag = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u;//координата у первой вершины >= ближней границы
   for ( uint i = 1; i <= pFace->uNumVertices; ++i)
   {
-    v81 = stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u;
-    if ( thisa ^ v81 )
+    next_vertices_flag = stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u;//координата у i-ой вершины >= ближней границы
+    if ( current_vertices_flag ^ next_vertices_flag )//первая или вторая координаты > ближней границы
     {
-      if ( stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u )
+      if ( stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u )//если координата у thisa < ближней границы, a i-ой вершины >= ближней границы
       {
-        //v12 = stru_50B700._view_transformed_xs[i] - stru_50B700._view_transformed_xs[i - 1];
-        //v13 = 0x80000 - stru_50B700._view_transformed_xs[i - 1];
-        //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])
-                                     * (0x80000 - stru_50B700._view_transformed_xs[i - 1])
-                                     / (stru_50B700._view_transformed_xs[i] - stru_50B700._view_transformed_xs[i - 1])))
-                                     + stru_50B700._view_transformed_zs[i - 1];
-        thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1])
-                * (0x80000 - stru_50B700._view_transformed_xs[i - 1])
-                / (stru_50B700._view_transformed_xs[i] - stru_50B700._view_transformed_xs[i - 1]));
+		  //t = (near_clip - v0.x)/(v1.x - v0.x)
+        t = (0x80000 - stru_50B700._view_transformed_xs[i - 1]) / (stru_50B700._view_transformed_xs[i] - stru_50B700._view_transformed_xs[i - 1]);
+        //z = (v1.z - v0.z)*t + v0.z
+        stru_50B700._view_transformed_zs[i] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i] - stru_50B700._view_transformed_zs[i - 1])
+                * t)) + stru_50B700._view_transformed_zs[i - 1];
+        //y = (v1.y -v0.y)*(near_clip - v0.x)/(v1.x - v0.x)
+        stru_50B700._view_transformed_ys[i] = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1])
+                * t) + stru_50B700._view_transformed_ys[i];
+        //stru_50B700._view_transformed_ys[i] = stru_50B700.field_38[new_point];
+        //stru_50B700._view_transformed_zs[i] = stru_50B700.field_128[new_point];
       }
-      else
+      else//если координата у thisa вершины >= ближней границы
       {
-        //v16 = stru_50B700._view_transformed_xs[i - 1] - stru_50B700._view_transformed_xs[i];
-        //v17 = 0x80000 - stru_50B700._view_transformed_xs[i];
-        //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])
-                                     * (0x80000 - stru_50B700._view_transformed_xs[i])
-                                     / (stru_50B700._view_transformed_xs[i - 1] - stru_50B700._view_transformed_xs[i])))
-                                     + stru_50B700._view_transformed_zs[i];
-        thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i])
-                * (0x80000 - stru_50B700._view_transformed_xs[i])
-                / (stru_50B700._view_transformed_xs[i - 1] - stru_50B700._view_transformed_xs[i]));
+        t = (0x80000 - stru_50B700._view_transformed_xs[i]) / (stru_50B700._view_transformed_xs[i - 1] - stru_50B700._view_transformed_xs[i]);
+        //z = (v0.z - v1.z)*(near_clip - v1.x)/(v0.x - v1.x) + v1.z
+        stru_50B700._view_transformed_zs[i] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i - 1] - stru_50B700._view_transformed_zs[i])
+                 * t)) + stru_50B700._view_transformed_zs[i];
+        //y = (v0.y - v1.y)*(near_clip - v1.x)/(v0.x - v1.x)
+        stru_50B700._view_transformed_ys[i] = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i])
+                * t) + stru_50B700._view_transformed_ys[i];
+        //stru_50B700._view_transformed_ys[i] = stru_50B700.field_38[new_point];
+        //stru_50B700._view_transformed_zs[i] = stru_50B700.field_128[new_point];
       }
-      v19 = v79++;
-      stru_50B700.field_38[v19] = thisb + stru_50B700._view_transformed_ys[i];
-      stru_50B700.field_218[v19] = 0x80000u;
+      //stru_50B700.field_218[new_point] 
+      //stru_50B700._view_transformed_xs[i] = 0x80000u;//z координата новой точки = 8.0
+      stru_50B700._view_transformed_xs[i] = 0x80000u;//z координата новой точки = 8.0
+      length_num_vertices++;
+      //new_point++;
     }
-    if ( v81 )
+	/*if ( next_vertices_flag )
     {
-      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];
-    }
-    thisa = v81;
+      //v20 = v79++;
+      stru_50B700.field_218[length_num_vertices] = stru_50B700._view_transformed_xs[i];
+      stru_50B700.field_128[length_num_vertices] = stru_50B700._view_transformed_zs[i];
+      stru_50B700.field_38[length_num_vertices] = stru_50B700._view_transformed_ys[i];
+      length_num_vertices++;
+    }*/
+    /*else
+      length_num_vertices++;
+      stru_50B700.field_218[0] = stru_50B700._view_transformed_xs[i];
+      stru_50B700.field_128[0] = stru_50B700._view_transformed_zs[i];
+      stru_50B700.field_38[0] = stru_50B700._view_transformed_ys[i];*/
+    current_vertices_flag = next_vertices_flag;//i-ная передвигается вправо
+    length_num_vertices++;
   }
-  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];
+  //v21 = v79;
+  /*stru_50B700.field_218[length_num_vertices] = stru_50B700.field_218[0];//новые точки пересечения(t1, t2) по х
+  stru_50B700.field_128[length_num_vertices] = stru_50B700.field_128[0];
+  stru_50B700.field_38[length_num_vertices] = stru_50B700.field_38[0];*/
 
   //maybe for far clip plane
-  for ( uint i = 0; i < v79; ++i )
+  for ( uint i = 0; i < length_num_vertices; ++i )
   {
-    if ( abs(stru_50B700.field_128[i]) <= abs(stru_50B700.field_218[i]) )
+    if ( abs(stru_50B700._view_transformed_zs[i]) <= abs(stru_50B700._view_transformed_xs[i]) )
     {
       //LODWORD(v28) = stru_50B700.field_128[i] << 16;
       //HIDWORD(v28) = stru_50B700.field_128[i] >> 16;
-      v26 = stru_50B700.field_128[i] / stru_50B700.field_218[i];
+      v26 = stru_50B700._view_transformed_zs[i] / stru_50B700._view_transformed_xs[i];
       v23 = 0;
     }
     else
     {
       v23 = 0;
       v24 = 0;
-      if ( stru_50B700.field_128[i] >= 0 )
+      if ( stru_50B700._view_transformed_zs[i] >= 0 )
       {
-        LOBYTE(v24) = stru_50B700.field_218[i] >= 0;
+        LOBYTE(v24) = stru_50B700._view_transformed_xs[i] >= 0;
         v26 = ((v24 - 1) & 0xFF800000) + 0x400000;
       }
       else
       {
-        LOBYTE(v24) = stru_50B700.field_218[i] >= 0;
-        //v25 = v24 - 1;
+        LOBYTE(v24) = stru_50B700._view_transformed_xs[i] >= 0;
         v26 = ((v24 - 1) & 0x800000) - 0x400000;
       }
     }
-    stru_50B700._xs3[i] = v26;
-    if ( abs(stru_50B700.field_38[i]) <= abs(stru_50B700.field_218[i]) )
+    stru_50B700._xs3[i] = v26;//дальняя координата вершины от камеры
+    if ( abs(stru_50B700._view_transformed_ys[i]) <= abs(stru_50B700._view_transformed_xs[i]) )
     {
       //LODWORD(v34) = stru_50B700.field_38[i] << 16;
       //HIDWORD(v34) = stru_50B700.field_38[i] >> 16;
-      v32 = stru_50B700.field_38[i] / stru_50B700.field_218[i];
+      v32 = stru_50B700._view_transformed_ys[i] / stru_50B700._view_transformed_xs[i];
     }
     else
     {
       v30 = 0;
-      if ( stru_50B700.field_38[i] >= v23 )
+      if ( stru_50B700._view_transformed_ys[i] >= v23 )
       {
-        LOBYTE(v30) = stru_50B700.field_218[i] >= v23;
+        LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= v23;
         v32 = ((v30 - 1) & 0xFF800000) + 0x400000;
       }
       else
       {
-        LOBYTE(v30) = stru_50B700.field_218[i] >= v23;
+        LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= v23;
         v32 = ((v30 - 1) & 0x800000) - 0x400000;
       }
     }
@@ -1726,19 +1730,19 @@
     stru_50B700._ys2[i] = pBLVRenderParams->uViewportCenterY - (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)
                            * (signed __int64)stru_50B700._ys2[i]);
   }
-  v36 = 0;
-  stru_50B700._xs3[v21] = stru_50B700._xs3[0];
-  stru_50B700._ys2[v21] = stru_50B700._ys2[0];
-  v38 = stru_50B700._xs3[0] < (signed int)pBLVRenderParams->uViewportX;
-  LOBYTE(v38) = stru_50B700._xs3[0] >= (signed int)pBLVRenderParams->uViewportX;
-  if ( v79 < 1 )
+
+  for_x_num_vertices = 0;
+  stru_50B700._xs3[length_num_vertices] = stru_50B700._xs3[0];
+  stru_50B700._ys2[length_num_vertices] = stru_50B700._ys2[0];
+  if ( length_num_vertices < 1 )
     return 0;
 
   //maybe for left clip plane
-  for ( uint i = 1; i <= v79; i++ )
+  current_vertices_flag = stru_50B700._xs3[0] >= (signed int)pBLVRenderParams->uViewportX;
+  for ( uint i = 1; i <= length_num_vertices; i++ )
   {
-    v82 = stru_50B700._xs3[i] >= (signed int)pBLVRenderParams->uViewportX;
-    if ( v38 ^ v82 )
+    next_vertices_flag = stru_50B700._xs3[i] >= (signed int)pBLVRenderParams->uViewportX;//координата у первой вершины >= левой границы
+    if ( current_vertices_flag ^ next_vertices_flag )
     {
       if ( stru_50B700._xs3[i] >= (signed int)pBLVRenderParams->uViewportX )
       {
@@ -1754,29 +1758,29 @@
             * (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];//c
       }
-      stru_50B700._ys[v36] = v67 + v42;
-      stru_50B700._xs2[v36] = pBLVRenderParams->uViewportX;
-      ++v36;
+      stru_50B700._ys[for_x_num_vertices] = v67 + v42;
+      stru_50B700._xs2[for_x_num_vertices] = pBLVRenderParams->uViewportX;
+      ++for_x_num_vertices;
     }
-    v38 = v82;
-    if ( v82 )
+    current_vertices_flag = next_vertices_flag;
+    if ( next_vertices_flag )
     {
-      stru_50B700._xs2[v36] = stru_50B700._xs3[i];
-      stru_50B700._ys[v36] = stru_50B700._ys2[i];
-      ++v36;
+      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 (v36 < 1)
+  if (for_x_num_vertices < 1)
     return 0;
 
-  v43 = 0;
-  stru_50B700._xs2[v36] = stru_50B700._xs2[0];
-  stru_50B700._ys[v36] = stru_50B700._ys[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];
 
   //maybe for right clip plane
   thisd = stru_50B700._xs2[0] <= (signed int)pBLVRenderParams->uViewportZ;
-  for ( uint i = 1; i <= v36; ++i )
+  for ( uint i = 1; i <= for_x_num_vertices; ++i )
   {
     v83 = stru_50B700._xs2[i] <= (signed int)pBLVRenderParams->uViewportZ;
     if ( thisd ^ v83 )
@@ -1795,29 +1799,29 @@
             * (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];//c
       }
-      stru_50B700.field_2F0[v43] = v68 + v47;
-      stru_50B700._xs[v43] = pBLVRenderParams->uViewportZ;
-      ++v43;
+      stru_50B700.field_2F0[for_z_num_vertices] = v68 + v47;
+      stru_50B700._xs[for_z_num_vertices] = pBLVRenderParams->uViewportZ;
+      ++for_z_num_vertices;
     }
     if ( v83 )
     {
-      stru_50B700._xs[v43] = stru_50B700._xs2[i];
-      stru_50B700.field_2F0[v43++] = stru_50B700._ys[i];
+      stru_50B700._xs[for_z_num_vertices] = stru_50B700._xs2[i];
+      stru_50B700.field_2F0[for_z_num_vertices++] = stru_50B700._ys[i];
     }
     thisd = v83;
   }
 
-  if (v43 < 1)
+  if (for_z_num_vertices < 1)
     return 0;
 
-  v48 = 0;
-  stru_50B700._xs[v43] = stru_50B700._xs[0];
-  stru_50B700.field_2F0[v43] = stru_50B700.field_2F0[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];
   v50 = stru_50B700.field_2F0[0] < (signed int)pBLVRenderParams->uViewportY;
 
   //maybr for top clip plane
   LOBYTE(v50) = stru_50B700.field_2F0[0] >= (signed int)pBLVRenderParams->uViewportY;
-  for ( uint i = 1; i <= v43; i++ )
+  for ( uint i = 1; i <= for_z_num_vertices; i++ )
   {
     v84 = stru_50B700.field_2F0[i] >= (signed int)pBLVRenderParams->uViewportY;
     if ( v50 ^ v84 )
@@ -1836,29 +1840,29 @@
             * (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];//c
       }
-      stru_50B700.field_3D4[v48] = v69 + v54;
-      stru_50B700._xs[v48 + 1] = pBLVRenderParams->uViewportY;
-      ++v48;
+      stru_50B700.field_3D4[for_y_num_vertices] = v69 + v54;
+      stru_50B700._xs[for_y_num_vertices + 1] = pBLVRenderParams->uViewportY;
+      ++for_y_num_vertices;
     }
     v50 = v84;
     if ( v84 )
     {
-      stru_50B700.field_3D4[v48] = stru_50B700._xs[i];
-      stru_50B700._xs[v48 + 1] = stru_50B700.field_2F0[i];
-      v48++;
+      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 (v48 < 1)
+  if (for_y_num_vertices < 1)
     return 0;
 
-  v55 = 0;
-  stru_50B700.field_3D4[v48] = stru_50B700.field_3D4[0];
-  stru_50B700._xs[v48 + 1] = stru_50B700._xs[1];
+  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];
 
   //maybe for bottom clip plane
   thise = stru_50B700._xs[1] <= (signed int)pBLVRenderParams->uViewportW;
-  for ( uint i = 1; i <= v48; ++i )
+  for ( uint i = 1; i <= for_y_num_vertices; ++i )
   {
     v85 = stru_50B700._xs[i + 1] <= (signed int)pBLVRenderParams->uViewportW;
     if ( thise ^ v85 )
@@ -1877,29 +1881,29 @@
             * (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];//c
       }
-      stru_50B700._screen_space_x[v55] = v70 + v59;
-      stru_50B700._screen_space_y[v55] = pBLVRenderParams->uViewportW;
-      ++v55;
+      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 ( v85 )
     {
-      stru_50B700._screen_space_x[v55] = stru_50B700.field_3D4[i];
-      stru_50B700._screen_space_y[v55++] = stru_50B700._xs[i + 1];
+      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];
     }
     thise = v85;
   }
 
-  if ( !v55 )
+  if ( !for_w_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[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[v55 + 1] = stru_50B700._screen_space_x[1];
-    stru_50B700._screen_space_y[v55 + 1] = stru_50B700._screen_space_y[1];
+    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 ( v55 > 0 )
+    if ( for_w_num_vertices > 0 )
     {
       v62 = 1;
       v71 = 1;
@@ -1908,12 +1912,12 @@
         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 ( 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])
@@ -1926,20 +1930,20 @@
         {
           v62 = v71;
           v65 = v71;
-          if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) )
+          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 * (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(&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));
           }
-          --v55;
+          --for_w_num_vertices;
         }
       }
-      while ( v62 - 1 < v55 );
+      while ( v62 - 1 < for_w_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];
+    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 v55;
+  return for_w_num_vertices;
 }
 
 //old function
@@ -2830,7 +2834,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;
@@ -2867,13 +2871,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;
@@ -2914,21 +2918,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;
@@ -2948,11 +2952,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;
@@ -2962,11 +2966,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;
@@ -2977,40 +2981,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	Tue Jun 11 17:31:03 2013 +0600
+++ b/mm7_3.cpp	Fri Jun 14 16:06:20 2013 +0600
@@ -11018,7 +11018,7 @@
     pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ;
     pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY;
     pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX;
-    pBspRenderer->nodes[0].field_C._43F9E1(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY,
+    pBspRenderer->nodes[0].field_C.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY,
                                            pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW);
     pBspRenderer->nodes[0].uFaceID = -1;
     pBspRenderer->nodes[0].viewing_portal_id = -1;
@@ -11030,7 +11030,7 @@
 }
 
 //----- (0043F9E1) --------------------------------------------------------
-void BspRenderer_stru2::_43F9E1(__int16 x, int y, __int16 z, int w)
+void BspRenderer_stru2::GetViewportData(__int16 x, int y, __int16 z, int w)
 {
   _viewport_space_y = y;
   _viewport_space_w = w;
@@ -11039,13 +11039,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	Tue Jun 11 17:31:03 2013 +0600
+++ b/mm7_4.cpp	Fri Jun 14 16:06:20 2013 +0600
@@ -4516,29 +4516,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);
@@ -5004,7 +5004,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;
@@ -5015,10 +5015,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))
--- a/stru367.h	Tue Jun 11 17:31:03 2013 +0600
+++ b/stru367.h	Fri Jun 14 16:06:20 2013 +0600
@@ -8,33 +8,33 @@
 {
 	int field_0;
 	int field_4[13];
-	int field_38[2];
+	int field_38[2];//new point x for near plane
 	int _view_transformed_ys_minus1;
-	int _view_transformed_ys[57];
-	int field_128[2];
+	int _view_transformed_ys[57];//origin coordinates x
+	int field_128[2];//new point y for near plane
 	int _view_transformed_zs_minus1;
-	int _view_transformed_zs[57];
-	int field_218[2];
+	int _view_transformed_zs[57];//origin coordinates y
+	int field_218[2];//new point z for near plane
 	int _view_transformed_xs_minus1;
-	int _view_transformed_xs[45];
+	int _view_transformed_xs[45];//origin coordinates z
 	int _screen_space_y[2];
 	int field_2E0;
 	int field_2E4[2];
 	int field_2EC;
-	int field_2F0[2];
+	int field_2F0[2];//new point y for right plane
 	int field_2F8;
-	int _ys[3];
-	int _ys2[48];
+	int _ys[3];//new point x for left plane
+	int _ys2[48];//
 	int _screen_space_x[2];
 	int field_3D0;
-	int field_3D4[2];
+	int field_3D4[2];//new point x for top plane
 	int field_3DC;
 	//int field_3E0;
-	int _xs[54];
+	int _xs[54];//
 	int field_3E4;
 	int field_3E8;
-	int _xs2[3];
-	int _xs3[48];
+	int _xs2[3];//new point y for left plane
+	int _xs3[48];//правый край
 };
 #pragma pack(pop)