changeset 1179:883eaee77094

sub_424829
author Ritor1
date Wed, 05 Jun 2013 17:40:09 +0600
parents f7ad7bd0a806
children b542660e7302
files Events.cpp mm7_1.cpp
diffstat 2 files changed, 132 insertions(+), 146 deletions(-) [+]
line wrap: on
line diff
--- a/Events.cpp	Tue Jun 04 09:44:53 2013 +0600
+++ b/Events.cpp	Wed Jun 05 17:40:09 2013 +0600
@@ -1099,7 +1099,7 @@
                 if (v83 == 21 ||  // gold well on emerald isle
                     v83 == 22 || v83 == 23 || v83 == 24 )
                 {
-                  __debugbreak(); // find out what these decorations are
+                  //__debugbreak(); // bonfire
                     viewparams->bRedrawGameUI = true;
                 }
                 ++curr_seq_num;
--- a/mm7_1.cpp	Tue Jun 04 09:44:53 2013 +0600
+++ b/mm7_1.cpp	Wed Jun 05 17:40:09 2013 +0600
@@ -2238,71 +2238,71 @@
   int v8; // edx@5
   //int v9; // ecx@6
   int v10; // eax@12
-  int v11; // edi@13
+  //int v11; // edi@13
   //int v12; // edx@18
   int v13; // eax@22
   //int v14; // edi@28
   int v15; // ecx@29
-  int v16; // edi@30
+  //int v16; // edi@30
   //int v17; // edx@35
   int v18; // eax@39
   int v19; // eax@44
   int v20; // ecx@44
   //int v21; // edi@45
   int v22; // edi@46
-  __int16 *v23; // ecx@47
+  //__int16 *v23; // ecx@47
   int v24; // edx@48
-  int v25; // eax@50
+  //int v25; // eax@50
   int v26; // eax@55
   signed int v27; // edi@55
   //int v28; // edx@56
   int v29; // edx@57
-  int v30; // eax@59
+  //int v30; // eax@59
   int v31; // eax@64
   signed int v32; // edi@64
   //int v33; // edx@65
-  __int16 *v34; // eax@66
-  __int16 v35; // dx@66
+  int v34; // eax@66
+  int v35; // dx@66
   __int16 v36; // dx@67
   __int16 v37; // di@67
   __int16 v38; // dx@67
   //BspRenderer_stru2 *v39; // ecx@69
-  int v40; // edx@69
-  int v41; // edi@70
-  __int16 *v42; // eax@76
-  __int16 *v43; // eax@81
-  __int16 *v45; // eax@87
+  //int v40; // edx@69
+  //int v41; // edi@70
+  //__int16 *v42; // eax@76
+  //__int16 *v43; // eax@81
+  //__int16 *v45; // eax@87
   int v46; // edx@87
-  __int16 v47; // cx@88
-  int v48; // eax@93
+  //__int16 v47; // cx@88
+  //int v48; // eax@93
   int v49; // esi@93
-  __int16 *v50; // ecx@94
-  int v51; // eax@95
+  //__int16 *v50; // ecx@94
+  //int v51; // eax@95
   //int v52; // eax@97
   int v53; // [sp+Ch] [bp-34h]@44
   int v54; // [sp+10h] [bp-30h]@0
   int v55; // [sp+14h] [bp-2Ch]@12
-  __int16 *v56; // [sp+14h] [bp-2Ch]@47
-  __int16 *v57; // [sp+14h] [bp-2Ch]@76
-  __int16 *v58; // [sp+14h] [bp-2Ch]@81
-  __int16 *v59; // [sp+14h] [bp-2Ch]@87
+  //__int16 *v56; // [sp+14h] [bp-2Ch]@47
+  //__int16 v57; // [sp+14h] [bp-2Ch]@76
+  //__int16 v58; // [sp+14h] [bp-2Ch]@81
+  int v59; // [sp+14h] [bp-2Ch]@87
   //BspRenderer_stru2 *v60; // [sp+18h] [bp-28h]@1
   int v61; // [sp+1Ch] [bp-24h]@29
   int v62; // [sp+20h] [bp-20h]@0
   signed int v63; // [sp+24h] [bp-1Ch]@3
   signed int v64; // [sp+28h] [bp-18h]@3
   int v65; // [sp+2Ch] [bp-14h]@5
-  int v66; // [sp+2Ch] [bp-14h]@39
-  int v67; // [sp+30h] [bp-10h]@22
+  //int v66; // [sp+2Ch] [bp-14h]@39
+  //int v67; // [sp+30h] [bp-10h]@22
   int v68; // [sp+34h] [bp-Ch]@12
   int v69; // [sp+34h] [bp-Ch]@29
   int v70; // [sp+34h] [bp-Ch]@46
   int v71; // [sp+34h] [bp-Ch]@75
   int v72; // [sp+34h] [bp-Ch]@80
-  int v73; // [sp+38h] [bp-8h]@11
+  //int v73; // [sp+38h] [bp-8h]@11
   //int v74; // [sp+3Ch] [bp-4h]@1
-  int a3a; // [sp+48h] [bp+8h]@76
-  int a3b; // [sp+48h] [bp+8h]@87
+  //int a3a; // [sp+48h] [bp+8h]@76
+  //int a3b; // [sp+48h] [bp+8h]@87
 
   //try graphic engine with function returning 1 always, and without
   //return true;
@@ -2336,7 +2336,6 @@
       v7 = stru_50B700._screen_space_y[v6];
     }
   }
-  v73 = v8;
   if ( v8 == v7 )
     return false;
   v10 = v65;
@@ -2345,7 +2344,7 @@
   v55 = v65;
   if ( pNumVertices > 0 )
   {
-    v11 = v65;
+    //v11 = v65;
     for ( v68 = 0; v68 < pNumVertices; ++v68 )
     {
       v10 += v64;
@@ -2358,29 +2357,25 @@
       {
         v10 -= pNumVertices;
       }
-      if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v11] )
+      if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] )
       {
         v55 = v10;
-        v11 = v10;
+        v65 = v10;
       }
-      if ( stru_50B700._screen_space_y[v10] == v73 )
+      if ( stru_50B700._screen_space_y[v10] == v8 )
         break;
     }
   }
   v13 = v55 + v64;
-  v67 = v55 + v64;
-  if ( v55 + v64 < pNumVertices )
+  if ( v13 < pNumVertices )
   {
-    if ( v13 >= 0 )
-      goto LABEL_27;
-    v13 += pNumVertices;
+    if ( v13 < 0 )
+      v13 += pNumVertices;
   }
   else
   {
     v13 -= pNumVertices;
   }
-  v67 = v13;
-LABEL_27:
   if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] )
   {
     v62 = stru_50B700._screen_space_x[v55] << 16;
@@ -2391,7 +2386,7 @@
   v61 = v65;
   if ( pNumVertices > 0 )
   {
-    v16 = v65;
+    //v16 = v65;
     for ( v69 = 0; v69 < pNumVertices; ++v69 )
     {
       v15 += v63;
@@ -2404,86 +2399,75 @@
       {
         v15 -= pNumVertices;
       }
-      if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v16] )
+      if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] )
       {
         v61 = v15;
-        v16 = v15;
+        v65 = v15;
       }
-      if ( stru_50B700._screen_space_y[v15] == v73 )
+      if ( stru_50B700._screen_space_y[v15] == v8 )
         break;
     }
   }
   v18 = v63 + v61;
-  v66 = v63 + v61;
-  if ( v63 + v61 < pNumVertices )
+  if ( v18 < pNumVertices )
   {
-    if ( v18 >= 0 )
-      goto LABEL_44;
-    v18 += pNumVertices;
+    if ( v18 < 0 )
+      v18 += pNumVertices;
   }
   else
   {
     v18 -= pNumVertices;
   }
-  v66 = v18;
-LABEL_44:
   v19 = v18;
   v20 = v61;
   if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] )
   {
     v61 = stru_50B700._screen_space_x[v20] << 16;
     v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20];
-    a2->array_3D8[v73] = LOWORD(stru_50B700._screen_space_x[v20]);
+    a2->array_3D8[v8] = LOWORD(stru_50B700._screen_space_x[v20]);
   }
   v22 = v7;
-  if ( v7 <= v73 )
+  if ( v7 <= v8 )
   {
-    v56 = &a2->array_3D8[v7];
-    v23 = &a2->array_18[v7];
-    for ( v70 = v7; v70 <= v73; ++v70 )
+    //v56 = &a2->array_3D8[v7];
+    //v23 = &a2->array_18[v7];
+    for ( v70 = v7; v70 <= v8; ++v70 )
     {
-      v24 = v67;
-      if ( v22 < stru_50B700._screen_space_y[v67] || v22 == v73 )
-        goto LABEL_57;
-      v25 = v64 + v67;
-      v67 = v25;
-      if ( v25 < pNumVertices )
+      v24 = v13;
+      if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != v8 )
       {
-        if ( v25 >= 0 )
-          goto LABEL_55;
-        v25 += pNumVertices;
-      }
-      else
-      {
-        v25 -= pNumVertices;
+        v13 = v64 + v13;
+        if ( v13 < pNumVertices )
+        {
+          if ( v13 < 0 )
+            v13 += pNumVertices;
+        }
+        else
+        {
+          v13 -= pNumVertices;
+        }
+        v26 = v13;
+        //v27 = stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24];
+        if ( stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24] > 0 )
+        {
+          v54 = ((stru_50B700._screen_space_x[v26] - stru_50B700._screen_space_x[v24]) << 16) / stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24];
+          v62 = stru_50B700._screen_space_x[v24] << 16;
+        }
       }
-      v67 = v25;
-LABEL_55:
-      v26 = v25;
-      //v27 = stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24];
-      if ( stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24] > 0 )
-      {
-        v54 = ((stru_50B700._screen_space_x[v26] - stru_50B700._screen_space_x[v24]) << 16) / stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24];
-        v62 = stru_50B700._screen_space_x[v24] << 16;
-      }
-LABEL_57:
-      v29 = v66;
-      if ( v70 >= stru_50B700._screen_space_y[v66] && v70 != v73 )
+      v29 = v18;
+      if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != v8 )
       {
-        v30 = v63 + v66;
-        v66 += v63;
-        if ( v66 >= pNumVertices )
+        v18 += v63;
+        if ( v18 < pNumVertices )
         {
-          v30 -= pNumVertices;
-          goto LABEL_63;
+          if ( v18 < 0 )
+            v18 += pNumVertices;
         }
-        if ( v30 < 0 )
+        else
         {
-          v30 += pNumVertices;
-LABEL_63:
-          v66 = v30;
+          v18 -= pNumVertices;
         }
-        v31 = v30;
+        v31 = v18;
         //v32 = stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29];
         if ( stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29] > 0 )
         {
@@ -2491,96 +2475,98 @@
           v61 = stru_50B700._screen_space_x[v29] << 16;
         }
       }
-      *(__int16 *)((char *)v56 + (int)(char *)a2->array_18 - (char *)a2->array_3D8) = HIWORD(v62);
-      *v56 = HIWORD(v61);
-      v34 = v23 + 480;
-      v35 = v23[480];
-      if ( *v23 > v35 )
+	  //v34 = (char *)a2->array_18 - (char *)a2->array_3D8;
+	  //v35 = *(__int16 *)((char *)&a2->array_3D8[v70] + v34);
+      //v35 = HIWORD(v62);
+      a2->array_18[v70] = HIWORD(v62);
+      a2->array_3D8[v70] = HIWORD(v61);
+      //v34 = &a2->array_3D8[v70];
+      //v35 = a2->array_3D8[v70];
+      if ( a2->array_18[v70] > a2->array_3D8[v70] )
       {
-        v36 = *v23 ^ v35;
-        v37 = *v34;
-        *v23 = v36;
+        v36 = a2->array_18[v70] ^ a2->array_3D8[v70];
+        v37 = a2->array_3D8[v70];
+        a2->array_18[v70] = v36;
         v38 = v37 ^ v36;
-        *v23 ^= v38;
-        *v34 = v38;
+        a2->array_18[v70] ^= v38;
+        a2->array_3D8[v70] = v38;
       }
-      ++v56;
+      //++v56;
       v62 += v54;
       v22 = v70 + 1;
       v61 += v53;
-      ++v23;
+      //++v23;
     }
   }
-  v40 = v73;
-  if ( v73 < a3->_viewport_space_y || (v41 = a3->_viewport_space_w, v7 > v41) )
+  if ( v8 < a3->_viewport_space_y )
+    return false;
+  if ( v7 > a3->_viewport_space_w )
     return false;
   if ( v7 < a3->_viewport_space_y )
     v7 = a3->_viewport_space_y;
-  if ( v73 > v41 )
-  {
-    v40 = a3->_viewport_space_w;
-    v73 = a3->_viewport_space_w;
-  }
-  if ( v7 <= v40 )
+  if ( v8 > a3->_viewport_space_w )
+    v8 = a3->_viewport_space_w;
+  if ( v7 <= v8 )
   {
-    a3a = (char *)a2 - (char *)a3;
-    v57 = &a2->array_18[v7];
-    v42 = &a3->array_3D8[v7];
-    for ( v71 = v7; v71 <= v40; ++v71 )
+    //a3a = (char *)a2 - (char *)a3;
+    //v42 = &a3->array_3D8[v7];
+    //v57 = *(__int16 *)((char *)v42 + a3a);
+    for ( v71 = v7; v71 <= v8; ++v71 )
     {
-      if ( *(__int16 *)((char *)v42 + a3a) >= *(v42 - 480) && a2->array_18[v71] <= a3->array_3D8[v71] )
+      if ( a2->array_18[v71] >= a3->array_18[v71] && a2->array_18[v71] <= a3->array_3D8[v71] )
         break;
-      ++v57;
+      //++v57;
       ++v7;
-      ++v42;
+      //++v42;
     }
   }
-  if ( v40 < v7 )
+  if ( v8 < v7 )
     return false;
-  v58 = &a2->array_18[v40];
-  v43 = &a3->array_3D8[v40];
-  for ( v72 = v40; v72 >= v7; --v72 )
+  //a3a = (char *)a2 - (char *)a3;
+  //v43 = &a3->array_3D8[v8];
+  //v58 = *(__int16 *)((char *)v43 + a3a);
+  for ( v72 = v8; v72 >= v7; --v72 )
   {
-    if ( *(__int16 *)((char *)v43 + (int)(char *)a2 - (char *)a3) >= *(v43 - 480) && *v58 <= a3->array_3D8[v72] )
+    if ( a2->array_3D8[v72] >= a3->array_18[v72] && a2->array_18[v72] <= a3->array_3D8[v72] )
       break;
-    --v58;
-    --v40;
-    --v43;
-    v73 = v40;
+    //--v58;
+    --v8;
+    //--v43;
+    //v8 = v8;
   }
-  if ( v7 >= v40 )
+  if ( v7 >= v8 )
     return false;
-  a3b = (char *)a3 - (char *)a2;
-  v59 = &a3->array_3D8[v7];
-  v45 = &a2->array_18[v7];
+  //a3b = (char *)a3 - (char *)a2;
+  v59 = v7;
+  //v45 = &a2->array_18[v7];
   
-  for ( v46 = v73 - v7 + 1; v46; --v46 )
+  for ( v46 = v8 - v7 + 1; v46; --v46 )
   {
-    v47 = *(__int16 *)((char *)v45 + a3b);
-    if ( *v45 < v47 )
-      *v45 = v47;
-    if ( v45[480] > *v59 )
-      v45[480] = *v59;
+    //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];
     ++v59;
-    ++v45;
+    //++v45;
   }
   a2->_viewport_space_y = v7;
-  a2->_viewport_space_w = v73;
+  a2->_viewport_space_w = v8;
   a2->field_8 = a2->array_18[v7];
-  v48 = a2->array_3D8[v7];
+  //v48 = a2->array_3D8[v7];
   a2->field_10 = v7;
   a2->field_14 = v7;
-  a2->field_C = v48;
+  a2->field_C = a2->array_3D8[v7];
   v49 = v7 + 1;
-  if ( v49 <= v73 )
+  if ( v49 <= v8 )
   {
-    v50 = &a2->array_3D8[v49];
-    for ( v49; v49 <= v73; ++v49 )
+    //v50 = &a2->array_3D8[v49];
+    for ( v49; v49 <= v8; ++v49 )
     {
-      v51 = *(v50 - 480);
-      if ( v51 < a2->field_8 )
+      //v51 = a2->array_18[v49];
+      if ( a2->array_18[v49] < a2->field_8 )
       {
-        a2->field_8 = v51;
+        a2->field_8 = a2->array_18[v49];
         a2->field_10 = v49;
       }
       if ( a2->array_3D8[v49] > a2->field_C )
@@ -2588,7 +2574,7 @@
         a2->field_C = a2->array_3D8[v49];
         a2->field_14 = v49;
       }
-      ++v50;
+      //++v50;
     }
   }
   return true;