changeset 1475:d7720c1f1d3b

Слияние
author Ritor1
date Wed, 28 Aug 2013 14:39:01 +0600
parents 3cda66022a77 (current diff) 5a29caf9b79d (diff)
children 92b63e3dca90 7ef4b64f6329
files
diffstat 6 files changed, 87 insertions(+), 174 deletions(-) [+]
line wrap: on
line diff
--- a/UI/UiGame.cpp	Wed Aug 28 14:38:51 2013 +0600
+++ b/UI/UiGame.cpp	Wed Aug 28 14:39:01 2013 +0600
@@ -1387,7 +1387,7 @@
             for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
                 i > 450;
                 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) )
-                byte_5C3427[strlen(GameUI_Footer_TimedString.data())] = 0;
+                GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0;
             }
         else
             {
@@ -1395,7 +1395,7 @@
             for ( j = pFontLucida->GetLineWidth(pFooterString.data());
                 j > 450;
                 j = pFontLucida->GetLineWidth(pFooterString.data()) )
-                GameUI_Footer_TimedString[strlen(pFooterString.data()) + 199] = 0;
+                pFooterString[strlen(pFooterString.data()) - 1] = 0;
             }
         }
     }
@@ -1428,7 +1428,7 @@
                 {
                 v4 = strlen(GameUI_Footer_TimedString.data());
                 v5 = pFontLucida;
-                byte_5C3427[v4] = 0;
+                GameUI_Footer_TimedString[v4 - 1] = 0;
                 v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
                 }
             }
@@ -1441,7 +1441,7 @@
                 {
                 v7 = strlen(pFooterString.data());
                 v8 = pFontLucida;
-                GameUI_Footer_TimedString[v7 + 199] = 0;
+                pFooterString[v7 - 1] = 0;
                 v6 = pFontLucida->GetLineWidth(pFooterString.data());
                 }
             }
--- a/mm7_2.cpp	Wed Aug 28 14:38:51 2013 +0600
+++ b/mm7_2.cpp	Wed Aug 28 14:39:01 2013 +0600
@@ -3422,11 +3422,22 @@
   struct tagPAINTSTRUCT Paint; // [sp+24h] [bp-48h]@13
   int pXY[2]; // [sp+64h] [bp-8h]@261
   int a2; // [sp+7Ch] [bp+10h]@50
-  
+
   switch (Msg)
   {
     case WM_SIZING:  return 1;
+    case WM_SHOWWINDOW:
+    case WM_GETTEXT:
     case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam);
+
+    case WM_WINDOWPOSCHANGED:
+    {
+      if (pVideoPlayer && pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer)
+        BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0);
+
+      return DefWindowProcW(hWnd, Msg, wParam, lParam);
+    }
+
     case WM_CHAR:
     {
       if (!pKeyActionMap->_459F10(wParam) && !viewparams->field_4C)
@@ -3773,15 +3784,7 @@
   }
   if ( Msg > WM_ACTIVATEAPP )
   {
-    if ( Msg == WM_WINDOWPOSCHANGED )
-    {
-      if (pVideoPlayer && pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer)
-      {
-        BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0);
-      }
-      return DefWindowProcA(hWnd, Msg, wParam, lParam);
-    }
-    if ( Msg != WM_KEYFIRST )
+    if ( Msg != WM_KEYFIRST && Msg != WM_WINDOWPOSCHANGED)
     {
       if ( Msg == WM_KEYUP && wParam == VK_CONTROL )
       {
--- a/mm7_3.cpp	Wed Aug 28 14:38:51 2013 +0600
+++ b/mm7_3.cpp	Wed Aug 28 14:39:01 2013 +0600
@@ -7763,7 +7763,7 @@
   for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
         i > 450;
         i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) )
-    byte_5C3427[strlen(GameUI_Footer_TimedString.data())] = 0;
+    GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0;
 }
 
 //----- (0044C1D0) --------------------------------------------------------
--- a/mm7_5.cpp	Wed Aug 28 14:38:51 2013 +0600
+++ b/mm7_5.cpp	Wed Aug 28 14:39:01 2013 +0600
@@ -3918,7 +3918,7 @@
   }
   else
   {
-    result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 3]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2];
+    result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 1]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2];
   }
   return result;
 }
@@ -4598,20 +4598,15 @@
 //----- (004075DB) --------------------------------------------------------
 bool __fastcall sub_4075DB(int a1, int a2, int a3, BLVFace *a4)
 {
-  BLVFace *v4; // eax@1
   unsigned int v5; // esi@1
-  signed int v6; // esi@2
   char v7; // zf@2
   int v8; // edi@2
   Vec3_short_ *v9; // ecx@3
   int v10; // edx@4
-  signed int v11; // esi@7
   Vec3_short_ *v12; // ecx@8
   int v13; // edx@9
-  signed int v14; // esi@11
   Vec3_short_ *v15; // ecx@12
   int v16; // edx@13
-  int v17; // eax@14
   bool v18; // esi@14
   int v19; // ecx@14
   int v20; // ecx@16
@@ -4622,113 +4617,70 @@
   signed int v25; // eax@22
   signed __int64 v26; // qtt@22
   bool result; // eax@25
-  int v28; // [sp+8h] [bp-14h]@14
   int v29; // [sp+10h] [bp-Ch]@14
   signed int a3a; // [sp+24h] [bp+8h]@14
   int a4a; // [sp+28h] [bp+Ch]@2
 
   __debugbreak();
 
-  v4 = a4;
   v5 = a4->uAttributes;
-  if ( v5 & 0x100 )
+  v9 = pIndoor->pVertices;
+  if ( v5 & FACE_XY_PLANE )
   {
-    v6 = 0;
-    v7 = a4->uNumVertices == 0;
     a4a = a1;
     v8 = a2;
-    if ( !v7 )
-    {
-      v9 = pIndoor->pVertices;
-      do
-      {
-        dword_4F5D98_xs[v6] = v9[v4->pVertexIDs[v6]].x;
-        v10 = v4->pVertexIDs[v6++];
-        dword_4F5CC4_ys[v6] = v9[v10].y;
-      }
-      while ( v6 < v4->uNumVertices );
-    }
+    for(int i = 0; i < a4->uNumVertices; i++)
+	{
+        dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x;
+        dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i]].y;
+	}
   }
   else
   {
     v8 = a3;
-    if ( v5 & 0x200 )
+    if ( v5 & FACE_XY_PLANE )
     {
-      v11 = 0;
-      v7 = a4->uNumVertices == 0;
       a4a = a1;
-      if ( !v7 )
-      {
-        v12 = pIndoor->pVertices;
-        do
-        {
-          dword_4F5D98_xs[v11] = v12[v4->pVertexIDs[v11]].x;
-          v13 = v4->pVertexIDs[v11++];
-          dword_4F5CC4_ys[v11] = v12[v13].z;
-        }
-        while ( v11 < v4->uNumVertices );
-      }
+      for(int i = 0; i < a4->uNumVertices; i++)
+	  {
+		dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x;
+		dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i]].z;
+	  }
     }
     else
     {
-      v14 = 0;
-      v7 = a4->uNumVertices == 0;
       a4a = a2;
-      if ( !v7 )
-      {
-        v15 = pIndoor->pVertices;
-        do
-        {
-          dword_4F5D98_xs[v14] = v15[v4->pVertexIDs[v14]].y;
-          v16 = v4->pVertexIDs[v14++];
-          dword_4F5CC4_ys[v14] = v15[v16].z;
-        }
-        while ( v14 < v4->uNumVertices );
-      }
+      for(int i = 0; i < a4->uNumVertices; i++)
+	  {
+		dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].y;
+		dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i]].z;
+	  }
     }
   }
-  v17 = v4->uNumVertices;
   a3a = 0;
-  dword_4F5D98_xs[v17] = dword_4F5D98_xs[0];
-  dword_4F5CC4_ys[v17 + 1] = dword_4F5CC4_ys[1];
-  v28 = v17;
-  v18 = dword_4F5CC4_ys[1] >= v8;
-  v19 = 0;
-  v29 = 0;
-  if ( v17 <= 0 )
-    return 0;
-  do
+  dword_4F5D98_xs[a4->uNumVertices] = dword_4F5D98_xs[0];
+  dword_4F5CC4_ys[a4->uNumVertices + 1] = dword_4F5CC4_ys[1];
+  for(int i = 0; i < a4->uNumVertices; i++)
   {
     if ( a3a >= 2 )
       break;
-    v20 = v19;
-    v21 = dword_4F5CC4_ys[v20 + 2];
-    if ( v18 ^ (v21 >= v8) )
+    if ( dword_4F5CC4_ys[i + 1] >= v8 ^ (dword_4F5CC4_ys[i + 2] >= v8) )
     {
-      v22 = dword_4F5D98_xs[v20 + 1];
-      if ( v22 >= a4a )
-        v23 = 0;
-      else
-        v23 = 2;
-      v24 = v23 | (dword_4F5D98_xs[v20] < a4a);
-      if ( v24 != 3 )
+	  if( dword_4F5D98_xs[i + 1] >= a4a || dword_4F5D98_xs[i] >= a4a)
       {
-        if ( !v24
-          || (v25 = v22 - dword_4F5D98_xs[v20],
+		  if ( (dword_4F5D98_xs[i + 1] >= a4a && dword_4F5D98_xs[i] >= a4a)
+          || (v25 = dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i],
               LODWORD(v26) = v25 << 16,
               HIDWORD(v26) = v25 >> 16,
-              dword_4F5D98_xs[v20]
+              dword_4F5D98_xs[i]
             + ((signed int)(((unsigned __int64)(v26
-                                              / (v21 - dword_4F5CC4_ys[v20 + 1])
-                                              * ((v8 - dword_4F5CC4_ys[v20 + 1]) << 16)) >> 16)
+                                              / (dword_4F5CC4_ys[i + 2] - dword_4F5CC4_ys[i + 1])
+                                              * ((v8 - dword_4F5CC4_ys[i + 1]) << 16)) >> 16)
                           + 32768) >> 16) >= a4a) )
           ++a3a;
       }
     }
-    v18 = v21 >= v8;
-    v19 = v29++ + 1;
   }
-  while ( v29 < v28 );
   result = 1;
   if ( a3a != 1 )
     result = 0;
@@ -4738,11 +4690,12 @@
 //----- (004077F1) --------------------------------------------------------
 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5)
 {
-  ODMFace *v5; // eax@1
-  unsigned int v6; // esi@1
+  //ODMFace *v5; // eax@1
+  Vec3_int_ *v9;
+  unsigned int v5; // esi@1
   signed int v7; // edi@1
-  char v8; // zf@2
-  unsigned __int16 *v9; // edx@3
+  //char v8; // zf@2
+  //unsigned __int16 *v9; // edx@3
   int v10; // ecx@4
   unsigned __int16 *v11; // edx@8
   int v12; // ecx@9
@@ -4764,111 +4717,68 @@
 
   __debugbreak();
 
-  v5 = a4;
-  v6 = a4->uAttributes;
-  v7 = 0;
-  if ( v6 & 0x100 )
+  v5 = a4->uAttributes;
+  v9 = a5->pVertices;
+  if ( v5 & FACE_XY_PLANE )
   {
-    v8 = a4->uNumVertices == 0;
     a4a = a1;
     a3 = a2;
-    if ( !v8 )
-    {
-      v9 = v5->pVertexIDs;
-      do
-      {
-        ++v7;
-        dword_4F5BF4_xs[v7] = a5->pVertices[*v9].x;
-        v10 = *v9;
-        ++v9;
-        dword_4F5B24_ys[v7] = a5->pVertices[v10].y;
-      }
-      while ( v7 < v5->uNumVertices );
-    }
+    for(int i = 0; i < a4->uNumVertices; i++)
+	{
+        dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x;
+        dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].y;
+	}
   }
   else
   {
-    if ( v6 & 0x200 )
+    if ( v5 & FACE_XY_PLANE )
     {
-      v8 = a4->uNumVertices == 0;
       a4a = a1;
-      if ( !v8 )
-      {
-        v11 = v5->pVertexIDs;
-        do
-        {
-          ++v7;
-          dword_4F5BF4_xs[v7] = a5->pVertices[*v11].x;
-          v12 = *v11;
-          ++v11;
-          dword_4F5B24_ys[v7] = a5->pVertices[v12].z;
-        }
-        while ( v7 < v5->uNumVertices );
-      }
+      for(int i = 0; i < a4->uNumVertices; i++)
+	  {
+		dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x;
+		dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z;
+	  }
     }
     else
     {
-      v8 = a4->uNumVertices == 0;
       a4a = a2;
-      if ( !v8 )
-      {
-        v13 = (int)v5->pVertexIDs;
-        do
-        {
-          ++v7;
-          dword_4F5BF4_xs[v7] = a5->pVertices[*(short *)v13].y;
-          v14 = *(short *)v13;
-          v13 += 2;
-          dword_4F5B24_ys[v7] = a5->pVertices[v14].z;
-        }
-        while ( v7 < v5->uNumVertices );
-      }
+      for(int i = 0; i < a4->uNumVertices; i++)
+	  {
+		dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].y;
+		dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z;
+	  }
     }
   }
-  v15 = v5->uNumVertices;
   a5a = 0;
-  dword_4F5BF4_xs[v15 + 1] = dword_4F5BF4_xs[1];
-  dword_4F5B24_ys[v15 + 1] = dword_4F5B24_ys[1];
-  v25 = 0;
-  v16 = dword_4F5B24_ys[1] >= a3;
-  if ( v15 <= 0 )
-    return 0;
-  do
+  dword_4F5BF4_xs[a4->uNumVertices + 1] = dword_4F5BF4_xs[1];
+  dword_4F5B24_ys[a4->uNumVertices + 1] = dword_4F5B24_ys[1];
+  for(int i = 0; i < a4->uNumVertices; i++)
   {
     if ( a5a >= 2 )
       break;
-    v17 = v25;
-    v18 = dword_4F5B24_ys[v25 + 2];
-    if ( v16 ^ (v18 >= a3) )
+    if ( dword_4F5B24_ys[i + 1] >= a3 ^ (dword_4F5B24_ys[i + 2] >= a3) )
     {
-      v19 = dword_4F5BF4_xs[v17 + 2];
-      if ( v19 >= a4a )
-        v20 = 0;
-      else
-        v20 = 2;
-      v21 = v20 | (dword_4F5BF4_xs[v17 + 1] < a4a);
-      if ( v21 != 3 )
+	  if( dword_4F5BF4_xs[i + 2] >= a4a || dword_4F5BF4_xs[i] >= a4a)
       {
-        if ( !v21
-          || (v22 = v19 - dword_4F5BF4_xs[v17 + 1],
-              LODWORD(v23) = v22 << 16,
-              HIDWORD(v23) = v22 >> 16,
-              dword_4F5BF4_xs[v17 + 1]
+		  if ( (dword_4F5BF4_xs[i + 2] >= a4a && dword_4F5BF4_xs[i + 1] >= a4a)
+          || (v25 = dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1],
+              LODWORD(v23) = v25 << 16,
+              HIDWORD(v23) = v25 >> 16,
+              dword_4F5BF4_xs[i + 1]
             + ((signed int)(((unsigned __int64)(v23
-                                              / (v18 - dword_4F5B24_ys[v17 + 1])
-                                              * ((a3 - dword_4F5B24_ys[v17 + 1]) << 16)) >> 16)
+                                              / (dword_4F5B24_ys[i + 2] - dword_4F5B24_ys[i + 1])
+                                              * ((a3 - dword_4F5B24_ys[i + 1]) << 16)) >> 16)
                           + 32768) >> 16) >= a4a) )
           ++a5a;
-      }
+	  }
     }
-    ++v25;
-    v16 = v18 >= a3;
   }
-  while ( v25 < v15 );
   result = 1;
   if ( a5a != 1 )
     result = 0;
   return result;
+
 }
 
 //----- (004088E9) --------------------------------------------------------
--- a/mm7_data.cpp	Wed Aug 28 14:38:51 2013 +0600
+++ b/mm7_data.cpp	Wed Aug 28 14:39:01 2013 +0600
@@ -1072,7 +1072,7 @@
 int dword_5C3418; // weak
 int dword_5C341C; // weak
 int _5C3420_pDecoration;
-std::array<char, 777> byte_5C3427; // weak
+//std::array<char, 777> byte_5C3427; // weak
 std::array<char, 200> GameUI_Footer_TimedString;
 std::array<char, 200> pFooterString;
 unsigned int GameUI_Footer_TimeLeft;
--- a/mm7_data.h	Wed Aug 28 14:38:51 2013 +0600
+++ b/mm7_data.h	Wed Aug 28 14:39:01 2013 +0600
@@ -716,7 +716,7 @@
 extern int dword_5C3418; // weak
 extern int dword_5C341C; // weak
 extern int _5C3420_pDecoration;
-extern std::array<char, 777> byte_5C3427; // weak
+//extern std::array<char, 777> byte_5C3427; // weak
 extern std::array<char, 200> GameUI_Footer_TimedString;
 extern std::array<char, 200> pFooterString;
 extern unsigned int GameUI_Footer_TimeLeft;