diff mm7_1.cpp @ 561:8b9cbf1f87fb

Cave kinda works
author Nomad
date Tue, 05 Mar 2013 00:24:28 +0200
parents f146781c5c2d
children b23f19fc0d1b
line wrap: on
line diff
--- a/mm7_1.cpp	Mon Mar 04 22:45:22 2013 +0200
+++ b/mm7_1.cpp	Tue Mar 05 00:24:28 2013 +0200
@@ -5804,7 +5804,7 @@
   _50B744_view_transformed_ys[v1->uNumVertices] = _50B744_view_transformed_ys[0];
   thisa = _50B924_view_transformed_xs[0] >= 0x80000u;
   //int i = 1;
-  for (uint i = 1; i < v1->uNumVertices; ++i)
+  for (uint i = 1; i <= v1->uNumVertices; ++i)
   {
       v10 = _50B924_view_transformed_xs[i];
       v81 = v10 >= (signed int)0x80000u;
@@ -5846,11 +5846,11 @@
       //++i;
       thisa = v81;
   }
-  ia = 0;
   v21 = v79;
   dword_50B918[v79] = dword_50B918[0];
   dword_50B828[v79] = dword_50B828[0];
-  for ( dword_50B738[v79] = dword_50B738[0]; ia < v79; dword_50BA08[v22] = pBLVRenderParams->uViewportCenterY - v35 )
+  dword_50B738[v79] = dword_50B738[0];
+  for (ia = 0; ia < v79; ++ia)
   {
     v22 = ia;
     thisc = abs(dword_50B918[ia]);
@@ -5879,7 +5879,7 @@
       }
     }
     v29 = dword_50B738[v22];
-    dword_50BAF4_xs[v22 + 1] = v26;
+    dword_50BAF8_xs[v22] = v26;
     if ( abs(v29) >> 13 <= thisc )
     {
       v33 = dword_50B738[v22];
@@ -5902,18 +5902,18 @@
         v32 = (v31 & 0x800000) - 0x400000;
       }
     }
-    dword_50BA08[v22] = v32;
-    dword_50BAF4_xs[v22 + 1] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BAF4_xs[v22 + 1]) >> 16;
-    v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08[v22]) >> 16;
-    dword_50BAF4_xs[v22 + 1] = pBLVRenderParams->uViewportCenterX - dword_50BAF4_xs[v22 + 1];
-    ++ia;
+    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;
-  dword_50BAF4_xs[v21 + 1] = dword_50BAF4_xs[1];
-  dword_50BA08[v21] = dword_50BA08[0];
+  dword_50BAF8_xs[v21] = dword_50BAF8_xs[0];
+  dword_50BA08_ys[v21] = dword_50BA08_ys[0];
   v37 = pBLVRenderParams->uViewportX;
-  v38 = dword_50BAF4_xs[1] < (signed int)pBLVRenderParams->uViewportX;
-  LOBYTE(v38) = dword_50BAF4_xs[1] >= (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 )
@@ -5921,30 +5921,31 @@
   do
   {
     v40 = v39;
-    v41 = dword_50BAF4_xs[v40 + 1];
+    v41 = dword_50BAF8_xs[v40];
     v82 = v41 >= (signed int)v37;
     if ( v38 ^ v82 )
     {
       if ( v41 >= (signed int)v37 )
       {
-        v67 = (signed int)(v37 - dword_50BAF4_xs[v40]) * (signed __int64)(dword_50BA08[v40] - dword_50B9F8[v40 + 3]) / (v41 - dword_50BAF4_xs[v40]);
-        v42 = dword_50B9F8[v40 + 3];
+        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)(dword_50B9F8[v40 + 3] - dword_50BA08[v40]) / (dword_50BAF4_xs[v40] - v41);
-        v42 = dword_50BA08[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];
       }
+      dword_50B9FC_ys[v36] = v67 + v42;
+      v37 = pBLVRenderParams->uViewportX;
+      dword_50BAEC_xs[v36] = pBLVRenderParams->uViewportX;
       ++v36;
-      dword_50B9F8[v36] = v67 + v42;
-      v37 = pBLVRenderParams->uViewportX;
-      dword_50BAE8_xs[v36] = pBLVRenderParams->uViewportX;
     }
     v38 = v82;
     if ( v82 )
     {
-      dword_50BAE8_xs[v36 + 1] = dword_50BAF4_xs[v40 + 1];
-      dword_50B9F8[v36++ + 1] = dword_50BA08[v40];
+      dword_50BAEC_xs[v36] = dword_50BAF8_xs[v40];
+      dword_50B9FC_ys[v36] = dword_50BA08_ys[v40];
+      ++v36;
     }
     v39 = ib++ + 1;
   }
@@ -5954,38 +5955,38 @@
     return 0;
 
   v43 = 0;
-  dword_50BAE8_xs[v36 + 1] = dword_50BAE8_xs[1];
-  dword_50B9F8[v36 + 1] = dword_50B9F8[1];
+  dword_50BAEC_xs[v36] = dword_50BAEC_xs[0];
+  dword_50B9FC_ys[v36] = dword_50B9FC_ys[0];
   v44 = pBLVRenderParams->uViewportZ;
-  thisd = dword_50BAE8_xs[1] <= (signed int)pBLVRenderParams->uViewportZ;
+  thisd = dword_50BAEC_xs[0] <= (signed int)pBLVRenderParams->uViewportZ;
   ic = 1;
 
   do
   {
     v45 = ic;
-    v46 = dword_50BAE8_xs[ic + 1];
+    v46 = dword_50BAEC_xs[ic];
     v83 = v46 <= (signed int)v44;
     if ( thisd ^ v83 )
     {
       if ( v46 <= (signed int)v44 )
       {
-        v68 = (signed int)(v44 - dword_50BAE8_xs[v45]) * (signed __int64)(dword_50B9F8[v45 + 1] - dword_50B9F8[v45]) / (v46 - dword_50BAE8_xs[v45]);
-        v47 = dword_50B9F8[v45];
+        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)(dword_50B9F8[v45] - dword_50B9F8[v45 + 1]) / (dword_50BAE8_xs[v45] - v46);
-        v47 = dword_50B9F8[v45 + 1];
+        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];
       }
+      dword_50B9F0[v43] = v68 + v47;
+      v44 = pBLVRenderParams->uViewportZ;
+      dword_50BAE0[v43] = pBLVRenderParams->uViewportZ;
       ++v43;
-      dword_50B9EC[v43] = v68 + v47;
-      v44 = pBLVRenderParams->uViewportZ;
-      dword_50BADC_xs[v43] = pBLVRenderParams->uViewportZ;
     }
     if ( v83 )
     {
-      dword_50BAE0[v43] = dword_50BAE8_xs[v45 + 1];
-      dword_50B9F0[v43++] = dword_50B9F8[v45 + 1];
+      dword_50BAE0[v43] = dword_50BAEC_xs[v45];
+      dword_50B9F0[v43++] = dword_50B9FC_ys[v45];
     }
     ++ic;
     thisd = v83;
@@ -6012,24 +6013,24 @@
     {
       if ( v53 >= (signed int)v49 )
       {
-        v69 = (signed int)(v49 - dword_50B9EC[v52]) * (signed __int64)(dword_50BAE0[v52] - dword_50BADC_xs[v52]) / (v53 - dword_50B9EC[v52]);
-        v54 = dword_50BADC_xs[v52];
+        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)(dword_50BADC_xs[v52] - dword_50BAE0[v52]) / (dword_50B9EC[v52] - v53);
+        v69 = (signed int)(v49 - v53) * (signed __int64)(dword_50BAE0[v52 - 1] - dword_50BAE0[v52]) / (dword_50B9F0[v52 - 1] - v53);
         v54 = dword_50BAE0[v52];
       }
+      dword_50BAD4[v48] = v69 + v54;
+      v49 = pBLVRenderParams->uViewportY;
+      dword_50B9E4[v48] = pBLVRenderParams->uViewportY;
       ++v48;
-      dword_50BAD0[v48] = v69 + v54;
-      v49 = pBLVRenderParams->uViewportY;
-      dword_50B9E0_ys[v48] = pBLVRenderParams->uViewportY;
     }
     v50 = v84;
     if ( v84 )
     {
       dword_50BAD4[v48] = dword_50BAE0[v52];
-      dword_50B9E0_ys[v48++ + 1] = dword_50B9F0[v52];
+      dword_50B9E4[v48++] = dword_50B9F0[v52];
     }
     v51 = id++ + 1;
   }
@@ -6040,36 +6041,36 @@
 
   v55 = 0;
   dword_50BAD4[v48] = dword_50BAD4[0];
-  dword_50B9E0_ys[v48 + 1] = dword_50B9E0_ys[1];
+  dword_50B9E4[v48] = dword_50B9E4[0];
   v56 = pBLVRenderParams->uViewportW;
-  thise = dword_50B9E0_ys[1] <= (signed int)pBLVRenderParams->uViewportW;
+  thise = dword_50B9E4[0] <= (signed int)pBLVRenderParams->uViewportW;
   ie = 1;
   do
   {
     v57 = ie;
-    v58 = dword_50B9E0_ys[ie + 1];
+    v58 = dword_50B9E4[ie];
     v85 = v58 <= (signed int)v56;
     if ( thise ^ v85 )
     {
       if ( v58 <= (signed int)v56 )
       {
-        v70 = (signed int)(v56 - dword_50B9E0_ys[v57]) * (signed __int64)(dword_50BAD4[v57] - dword_50BAD0[v57]) / (v58 - dword_50B9E0_ys[v57]);
-        v59 = dword_50BAD0[v57];
+        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)(dword_50BAD0[v57] - dword_50BAD4[v57]) / (dword_50B9E0_ys[v57] - v58);
+        v70 = (signed int)(v56 - v58) * (signed __int64)(dword_50BAD4[v57 - 1] - dword_50BAD4[v57]) / (dword_50B9E4[v57 - 1] - v58);
         v59 = dword_50BAD4[v57];
       }
+      dword_50BAC8[v55] = v70 + v59;
+      v56 = pBLVRenderParams->uViewportW;
+      dword_50B9D8_ys[v55] = pBLVRenderParams->uViewportW;
       ++v55;
-      dword_50BAC4[v55] = v70 + v59;
-      v56 = pBLVRenderParams->uViewportW;
-      unk_50B9D4[v55] = pBLVRenderParams->uViewportW;
     }
     if ( v85 )
     {
       dword_50BAC8[v55] = dword_50BAD4[v57];
-      dword_50B9D8_ys[v55++] = dword_50B9E0_ys[v57 + 1];
+      dword_50B9D8_ys[v55++] = dword_50B9E4[v57];
     }
     ++ie;
     thise = v85;