changeset 2273:42b6a910b5d8

FindIcon cleaned
author Ritor1
date Fri, 14 Mar 2014 02:03:41 +0600
parents 85296dca37cf
children 8193a64c7461
files GUIWindow.cpp IconFrameTable.cpp Indoor.cpp
diffstat 3 files changed, 90 insertions(+), 208 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Thu Mar 13 23:56:37 2014 +0600
+++ b/GUIWindow.cpp	Fri Mar 14 02:03:41 2014 +0600
@@ -1160,7 +1160,11 @@
                 v13 = uY + v31->uFrameY;
                 v12 = uX + v29 + v31->uFrameX;
                 if ( a8 )
-                  goto LABEL_36;
+                {
+                  v11 = v11 + v13 - 3;
+                  if ( v11 > a8 )
+                    return;
+                }
                 break;
               case 0xCu:
                 strncpy(Dest, &v32[v14 + 1], 5);
@@ -1180,7 +1184,6 @@
                 if ( a8 )
                 {
                   v11 = LOBYTE(v10->uFontHeight);
-LABEL_36:
                   v11 = v11 + v13 - 3;
                   if ( v11 > a8 )
                     return;
@@ -1228,8 +1231,7 @@
 
 //----- (0044CB4F) --------------------------------------------------------
 int GUIWindow::DrawTextInRect( GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text )
-    {
-
+{
   int pLineWidth; // ebx@1
   int text_width; // esi@3
   unsigned __int8 v12; // cl@7
@@ -1271,7 +1273,7 @@
   if ( reverse_text )
     _strrev(pTmpBuf2.data());
   Str1a = 0;
-  for (i=0; i<pNumLen; ++i)
+  for ( i = 0; i < pNumLen; ++i )
     {
       if ( text_width >= rect_width )
         break;
@@ -1293,7 +1295,7 @@
           text_width += pFont->pMetrics[v12].uWidth;
           if ( i < pNumLen )
               text_width += pFont->pMetrics[v12].uRightSpacing;
-          }       
+          }
       }
     }
   pTmpBuf2[i - 1] = 0;
@@ -1359,10 +1361,8 @@
           v13 += v20;
           if ( i < (signed int)pNumLen )
               v13 += pFont->pMetrics[v15].uRightSpacing;
-          }       
+          }
       }
-      
-   
   }
   return v28;
 }
@@ -1431,7 +1431,7 @@
 
 //----- (0041C432) --------------------------------------------------------
 GUIWindow * GUIWindow::Create( unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eWindowType, int pButton, const char* hint )
-    {
+{
   unsigned int uNextFreeWindowID; // ebp@1
   //int *v8; // eax@1
   //GUIWindow *pWindow; // esi@4
@@ -1568,9 +1568,7 @@
                   pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf.data(), 0);
                 }
                 else
-                {
                   pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять
-                }
                 num_menu_buttons = 2;
               }
             }
@@ -1578,7 +1576,8 @@
           }
           break;
             }
-        case WINDOW_ChangeLocation: {
+        case WINDOW_ChangeLocation:
+        {
           pMainScreenNum = pCurrentScreen;
           pCurrentScreen = SCREEN_CHANGE_LOCATION;
           pBtn_ExitCancel = pWindow->CreateButton(                  566,                   445,  75,  33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Остаться в этой области
@@ -1586,7 +1585,7 @@
                             pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0],  63,  73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0);
                             pWindow->CreateButton(                    8,                     8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1,   0, pWindow->Hint, 0);
           break;
-            }
+        }
         case WINDOW_SpellBook: {// окно книги заклов
           InitializeBookTextures();
           pWindow->OpenSpellBook();
@@ -1603,11 +1602,11 @@
       return pWindow;
     }
 //LABEL_62:
-    pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, '1', "", 0);
-    pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, '2', "", 0);
-    pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, '3', "", 0);
-    pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, '4', "", 0);
-    pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0);
+    pWindow->CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
+    pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
+    pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
+    pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
+    pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9, "", 0);
     return pWindow;
   }
   if (eWindowType == WINDOW_HouseInterior)
@@ -1830,9 +1829,7 @@
         if ( pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] <=pParty->uTimePlayed )
         {
           if ( window_SpeakInHouse->par1C < 53 )
-          {
             pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] = 0;
-          }
           continue;
         }
         pNumMessages = pMessageQueue_50CBD0->uNumMessages;
@@ -2115,9 +2112,7 @@
         continue;
       }
       default:
-      {
         continue;
-      }
     }
   }
   if ( GetCurrentMenuID() == -1 )
@@ -2158,9 +2153,6 @@
   Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3);
 }
 
-
-
-
 int modal_window_prev_screen;
 
 //----- (004141CA) --------------------------------------------------------
@@ -2202,10 +2194,9 @@
 
 //----- (00467FB6) --------------------------------------------------------
 void CreateScrollWindow()
-    {
+{
   unsigned int v0; // eax@1
   char *v1; // ST18_4@3
-  unsigned int v2; // eax@3
   GUIWindow a1; // [sp+Ch] [bp-54h]@1
 
   memcpy(&a1, pGUIWindow_ScrollWindow, sizeof(a1));
@@ -2214,8 +2205,7 @@
   a1.uFrameY = 1;
   a1.uFrameWidth = 468;
   v0 = pFontSmallnum->CalcTextHeight(pScrolls[pGUIWindow_ScrollWindow->par1C], &a1, 0, 0)
-     + 2 * LOBYTE(pFontCreate->uFontHeight)
-     + 24;
+     + 2 * LOBYTE(pFontCreate->uFontHeight) + 24;
   a1.uFrameHeight = v0;
   if ( (signed int)(v0 + a1.uFrameY) > 479 )
   {
@@ -2232,31 +2222,20 @@
   a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
   a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
   v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName;
-  v2 = Color16(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf.data(), format_4E2D80, v2, v1);
-  a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u);
-  a1.DrawText(
-           pFontSmallnum,
-           1,
-           LOBYTE(pFontCreate->uFontHeight) - 3,
-           0,
-           pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C],
-           0,
-           0,
-           0);
+  sprintf(pTmpBuf.data(), format_4E2D80, Color16(0xFFu, 0xFFu, 0x9Bu), v1);
+  a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3);
+  a1.DrawText(pFontSmallnum, 1, LOBYTE(pFontCreate->uFontHeight) - 3, 0,
+              pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], 0, 0, 0);
 }
 //----- (00467F48) --------------------------------------------------------
 void CreateMsgScrollWindow( signed int mscroll_id )
-    {
-  signed int v1; // esi@1
-
-  v1 = mscroll_id;
+{
   if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 )
   {
     if ( mscroll_id <= 782 )
     {
       uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE);
-      pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Scroll, v1 - 700, 0);
+      pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Scroll, mscroll_id - 700, 0);
     }
   }
 }
--- a/IconFrameTable.cpp	Thu Mar 13 23:56:37 2014 +0600
+++ b/IconFrameTable.cpp	Fri Mar 14 02:03:41 2014 +0600
@@ -7,83 +7,44 @@
 //----- (00494F3A) --------------------------------------------------------
 unsigned int IconFrameTable::FindIcon(const char *pIconName)
 {
-  IconFrameTable *v2; // esi@1
-  int v3; // ebx@1
-  unsigned int uID; // edi@1
-  unsigned int result; // eax@4
-
-  v2 = this;
-  v3 = 0;
-  uID = 0;
-  if ( (signed int)this->uNumIcons <= 0 )
+  for ( uint i = 0; i < (signed int)this->uNumIcons; i++ )
   {
-LABEL_4:
-    result = 0;
+    if ( !_stricmp(pIconName, this->pIcons[i].pAnimationName) )
+      return i;
   }
-  else
-  {
-    while ( _stricmp(pIconName, v2->pIcons[v3].pAnimationName) )
-    {
-      ++uID;
-      ++v3;
-      if ( (signed int)uID >= (signed int)v2->uNumIcons )
-        goto LABEL_4;
-    }
-    result = uID;
-  }
-  return result;
+  return 0;
 }
 
 //----- (00494F70) --------------------------------------------------------
 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID)
 {
-  //IconFrame *v3; // edi@1
-  IconFrame *v4; // ecx@1
-  //__int16 v5; // dx@2
   int v6; // edx@3
-  //unsigned int v7; // eax@3
-  char *i; // ecx@3
-  int v9; // esi@5
-  IconFrame *result; // eax@6
+  uint i;
 
-  v4 = &this->pIcons[uIconID];
-  if ( v4->uFlags & 1 && v4->uAnimLength != 0 )
+  if ( this->pIcons[uIconID].uFlags & 1 && this->pIcons[uIconID].uAnimLength != 0 )
   {
-    v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v4->uAnimLength;
-    for ( i = (char *)&v4->uAnimTime; ; i += 32 )
-    {
-      v9 = *(short *)i;
-      if ( v6 <= v9 )
-        break;
-      v6 -= v9;
-      ++uIconID;
-    }
-    result = &this->pIcons[uIconID];
+    v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)this->pIcons[uIconID].uAnimLength;
+    for ( i = uIconID; v6 > this->pIcons[i].uAnimTime; i++ )
+      v6 -= this->pIcons[i].uAnimTime;
+    return &this->pIcons[i];
   }
   else
-  {
-    result = &this->pIcons[uIconID];
-  }
-  return result;
+    return &this->pIcons[uIconID];
 }
 
 //----- (00494FBF) --------------------------------------------------------
 void IconFrameTable::InitializeAnimation(unsigned int uIconID)
 {
-  IconFrameTable *v2; // esi@1
   unsigned int v3; // edi@3
   const char *i; // eax@3
-  IconFrame *v5; // eax@5
 
-  v2 = this;
   if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 )
   {
     v3 = uIconID;
-    for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName )
+    for ( i = this->pIcons[uIconID].pTextureName; ; i = this->pIcons[v3].pTextureName )
     {
-      v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE);
-      v5 = v2->pIcons;
-      if ( !(v5[v3].uFlags & 1) )
+      this->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE);
+      if ( !(this->pIcons[v3].uFlags & 1) )
         break;
       ++v3;
     }
@@ -93,20 +54,20 @@
 //----- (0049500A) --------------------------------------------------------
 void IconFrameTable::ToFile()
 {
-  IconFrameTable *v1; // esi@1
+  //IconFrameTable *v1; // esi@1
   FILE *v2; // eax@1
-  FILE *v3; // edi@1
+  //FILE *v3; // edi@1
 
-  IconFrameTable* Str = this;
+  //IconFrameTable* Str = this;
 
-  v1 = Str;
+  //v1 = Str;
   v2 = fopen("data\\dift.bin", "wb");
-  v3 = v2;
+  //v3 = v2;
   if ( !v2 )
     Error("Unable to save dift.bin!");
-  fwrite(v1, 4u, 1u, v2);
-  fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3);
-  fclose(v3);
+  fwrite(this, 4, 1, v2);
+  fwrite(this->pIcons, 0x20u, this->uNumIcons, v2);
+  fclose(v2);
 }
 
 //----- (00495056) --------------------------------------------------------
@@ -129,7 +90,7 @@
 //----- (0049509D) --------------------------------------------------------
 int IconFrameTable::FromFileTxt(const char *Args)
 {
-  IconFrameTable *v2; // ebx@1
+  //IconFrameTable *v2; // ebx@1
   FILE *v3; // eax@1
   int v4; // esi@3
   void *v5; // eax@10
@@ -153,8 +114,9 @@
   FILE *File; // [sp+300h] [bp-4h]@1
   int Argsa; // [sp+30Ch] [bp+8h]@26
 
-  v2 = this;
+  //v2 = this;
   //TileTable::dtor((TileTable *)this);
+  __debugbreak();//Ritor1: this function not used
   v3 = fopen(Args, "r");
   File = v3;
   if ( !v3 )
@@ -179,13 +141,13 @@
     while ( fgets(&Buf, 490, File) );
     v4 = v21;
   }
-  v2->uNumIcons = v4;
+  this->uNumIcons = v4;
   v5 = malloc(32 * v4);//, "I Frames");
-  v2->pIcons = (IconFrame *)v5;
+  this->pIcons = (IconFrame *)v5;
   if ( v5 )
   {
     v6 = File;
-    v2->uNumIcons = 0;
+    this->uNumIcons = 0;
     fseek(v6, 0, 0);
     for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
     {
@@ -193,38 +155,38 @@
       memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20));
       if ( v20.uPropCount && *v20.pProperties[0] != 47 )
       {
-        strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]);
-        strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]);
+        strcpy(this->pIcons[this->uNumIcons].pAnimationName, v20.pProperties[0]);
+        strcpy(this->pIcons[this->uNumIcons].pTextureName, v20.pProperties[1]);
         v8 = v20.pProperties[2];
-        v2->pIcons[v2->uNumIcons].uFlags = 0;
+        this->pIcons[this->uNumIcons].uFlags = 0;
         if ( !_stricmp(v8, "new") )
         {
-          v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags;
+          v9 = (int)&this->pIcons[this->uNumIcons].uFlags;
           *(char *)v9 |= 4u;
         }
-        v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]);
-        v2->pIcons[v2->uNumIcons].uAnimLength = 0;
-        v2->pIcons[v2->uNumIcons++].uTextureID = 0;
+        this->pIcons[this->uNumIcons].uAnimTime = atoi(v20.pProperties[3]);
+        this->pIcons[this->uNumIcons].uAnimLength = 0;
+        this->pIcons[this->uNumIcons++].uTextureID = 0;
       }
     }
     fclose(File);
     v10 = 0;
-    if ( (signed int)(v2->uNumIcons - 1) > 0 )
+    if ( (signed int)(this->uNumIcons - 1) > 0 )
     {
       v11 = 0;
       do
       {
-        v12 = (int)&v2->pIcons[v11];
+        v12 = (int)&this->pIcons[v11];
         if ( !(*(char *)(v12 + 60) & 4) )
           *(char *)(v12 + 28) |= 1u;
         ++v10;
         ++v11;
       }
-      while ( v10 < (signed int)(v2->uNumIcons - 1) );
+      while ( v10 < (signed int)(this->uNumIcons - 1) );
     }
-    for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 )
+    for ( j = 0; j < (signed int)this->uNumIcons; *(short *)(Argsa + 26) = v15 )
     {
-      v14 = v2->pIcons;
+      v14 = this->pIcons;
       Argsa = (int)&v14[j];
       v15 = *(short *)(Argsa + 24);
       if ( *(char *)(Argsa + 28) & 1 )
--- a/Indoor.cpp	Thu Mar 13 23:56:37 2014 +0600
+++ b/Indoor.cpp	Fri Mar 14 02:03:41 2014 +0600
@@ -93,18 +93,9 @@
 //----- (0043F39E) --------------------------------------------------------
 void __fastcall PrepareDrawLists_BLV()
 {
-  //int *v1; // ecx@1
-  //double v2; // ST30_8@3
-  //double v3; // ST30_8@6
-  //double v4; // ST28_8@6
   int v5; // eax@4
-  //int v6; // eax@7
   unsigned int v7; // ebx@8
   BLVSector *v8; // esi@8
-  //unsigned __int16 *v9; // edi@8
-  //int i; // [sp+18h] [bp-8h]@7
-  //unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3
-  //signed int v12; // [sp+1Ch] [bp-4h]@8
 
   pBLVRenderParams->Reset();
   pMobileLightsStack->uNumLightsActive = 0;
@@ -137,46 +128,25 @@
   PrepareItemsRenderList_BLV();
   PrepareActorRenderList_BLV();
 
-  //v6 = 0;
   for (uint i = 0; i < pBspRenderer->uNumVisibleNotEmptySectors; ++i)
   {
     v7 = pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i];
-    //v12 = 0;
     v8 = &pIndoor->pSectors[pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]];
-    //v9 = v8->pDecorationIDs;
 
     for (uint j = 0; j < v8->uNumDecorations; ++j)
-    //if ( v8->uNumDecorations > 0 )
-    {
-    //  do
       PrepareDecorationsRenderList_BLV(v8->pDecorationIDs[j], v7);
-    //  while ( v12 < v8->uNumDecorations );
-    }
-    //v6 = i + 1;
   }
   FindBillboardsLightLevels_BLV();
   pGame->PrepareBloodsplats();
 }
 
-
-
 //----- (004407D9) --------------------------------------------------------
 void BLVRenderParams::Reset()
 {
-  //IndoorLocation_drawstru *v2; // ebx@1
-  //int v4; // ST08_4@1
-  //int v5; // ST04_4@1
-  //int v6; // ST00_4@1
   int v7; // eax@1
   int v8; // ST08_4@2
   int v9; // ST04_4@2
   int v10; // ST00_4@2
-  //unsigned int v11; // edi@4
-  //unsigned int v12; // ecx@4
-  //int v13; // edx@4
-  //signed int v14; // ecx@4
-  //unsigned int v15; // edx@4
-  //unsigned int v16; // eax@4
   double v17; // st7@5
   int v18; // eax@5
   double v19; // st7@5
@@ -188,7 +158,6 @@
   int v25; // eax@5
   int v26; // eax@5
   signed int v27; // eax@6
-  //int result; // eax@6
   int v29; // [sp+24h] [bp+8h]@5
 
   this->field_0_timer_ = pEventTimer->uTotalGameTimeElapsed;
@@ -295,21 +264,17 @@
 //----- (00440B44) --------------------------------------------------------
 void IndoorLocation::ExecDraw(bool bD3D)
 {
-  int v2; // eax@3
-  //IndoorCameraD3D_Vec4 *v3; // edx@4
-  //unsigned int v5; // ecx@9
-  //RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4
-
   if (bD3D)
   {
     pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
     for (uint i = 0; i < pBspRenderer->num_faces; ++i)
     {
-      //v2 = pBspRenderer->faces[i].uNodeID;
       if (pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].viewing_portal_id == -1)
         IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, nullptr, 4, nullptr);
       else
-        IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].std__vector_0007AC, 4, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].pPortalBounding);
+        IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID,
+                pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].std__vector_0007AC, 4,
+                pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].pPortalBounding);
     }
   }
   else for (uint j = 0; j < pBspRenderer->num_faces; ++j )
@@ -373,9 +338,6 @@
 }
 */
 
-
-
-
 //----- (00441BD4) --------------------------------------------------------
 void IndoorLocation::Draw()
 {
@@ -870,9 +832,7 @@
     return true;
   }
   else
-  {
     return false;
-  }
 }
 
 //----- (00444810) --------------------------------------------------------
@@ -895,8 +855,8 @@
     if ( bToggle )
       pIndoor->pLights[sLightID].uAtributes &= 0xFFFFFFF7u;
     else
-      pIndoor->pLights[sLightID].uAtributes |= 8u;
-    pParty->uFlags |= 2u;
+      pIndoor->pLights[sLightID].uAtributes |= 8;
+    pParty->uFlags |= 2;
   }
 }
 
@@ -1958,7 +1918,7 @@
     //v201 = pFilename;
     *(int *)pDest = 1;
     File = pGames_LOD->FindContainer(pFilename, 0);
-    fread(&header, 0x10u, 1u, File);
+    fread(&header, 0x10u, 1, File);
     uint v155 = header.uCompressedSize;
     uint Count = header.uDecompressedSize;
     BLVFace* Src = (BLVFace *)malloc(header.uDecompressedSize);
@@ -1966,9 +1926,7 @@
     if ( v155 <= Count )
     {
       if ( v155 == Count )
-      {
         fread(Src, 1, Count, File);
-      }
       else
       {
         void* _uSourceLen = malloc(v155);
@@ -1978,9 +1936,7 @@
       }
     }
     else
-    {
-    MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0);
-    }
+      MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0);
     pData = ((char *)Src + 40);
     //v154 = 875;
     goto LABEL_140;
@@ -2375,7 +2331,6 @@
   v4 = v43[0];
   if ( v55 == 1 )
     return this->pFaces[v4].uSectorID;
-  v37 = 0;
   if ( !v55 )
     return 0;
   pSectorID = 0;
@@ -2383,38 +2338,25 @@
   if ( v55 > 0 )
   {
     v39 = sY;
-    while ( 1 )
+    for ( v37 = 0; v37 < v55; ++v37 )
     {
-      pFace = &this->pFaces[v43[v37]];
-      //pPolygonType = pFace->uPolygonType;
-      if ( pFace->uPolygonType == POLYGON_Floor )
+      if ( this->pFaces[v43[v37]].uPolygonType == POLYGON_Floor )
+        v39 = sZ - this->pVertices[*this->pFaces[v43[v37]].pVertexIDs].z;
+      if ( this->pFaces[v43[v37]].uPolygonType == POLYGON_InBetweenFloorAndWall )
       {
-        v42 = this->pVertices[*pFace->pVertexIDs].z;
-        v39 = sZ - v42;
-        //goto LABEL_47;
+        v39 = sZ - ((fixpoint_mul(this->pFaces[v43[v37]].zCalc1, (sX << 16))
+                   + fixpoint_mul(this->pFaces[v43[v37]].zCalc2, (sY << 16))
+                   + this->pFaces[v43[v37]].zCalc3
+                   + 0x8000) >> 16);
       }
-      if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall )
-      {
-        //v51 = pFace->zCalc1;
-        v57 = fixpoint_mul(pFace->zCalc1, (sX << 16));
-        //v56 = sY << 16;
-        //v51 = pFace->zCalc2;
-        v56 = fixpoint_mul(pFace->zCalc2, (sY << 16));
-        v42 = (v56 + pFace->zCalc3 + v57 + 32768) >> 16;
-        v39 = sZ - v42;
-      }
-//LABEL_47:
       if ( v39 >= 0 )
       {
         if ( v39 < v53 )
         {
-          pSectorID = pFace->uSectorID;
+          pSectorID = this->pFaces[v43[v37]].uSectorID;
           v53 = v39;
         }
       }
-      ++v37;
-      if ( v37 >= v55 )
-        return pSectorID;
     }
   }
   return pSectorID;
@@ -2498,7 +2440,7 @@
 
 //----- (0044C23B) --------------------------------------------------------
 bool BLVFaceExtra::HasEventint()
-	{
+{
    signed int event_index; // eax@1
   _evt_raw* start_evt;
   _evt_raw* end_evt;
@@ -2548,8 +2490,6 @@
   unsigned __int16 v50; // ax@48
   unsigned int v51; // eax@51
   unsigned __int16 v52; // ax@54
-  int v53; // ecx@57
-  unsigned __int64 v55; // qax@57
   int v56; // ecx@58
   int v57; // eax@58
   Vec3_int_ v67;
@@ -2650,7 +2590,11 @@
         v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16;
         v31 = (v85 + v83 + v84) * (signed __int64)v29;
         v32 = v31 >> 16;
-        goto LABEL_58;
+        v57 = -v32;
+        v28->sTextureDeltaV = v57;
+        v28->sTextureDeltaU += door->pDeltaUs[v88];
+        v28->sTextureDeltaV = v57 + door->pDeltaVs[v88];
+        continue;
       }*/
       v28->sTextureDeltaU = 0;
       v28->sTextureDeltaV = 0;
@@ -2696,7 +2640,7 @@
         v28->sTextureDeltaV -= v40;
       else
       {
-        if ( face->uAttributes & 0x20000 )
+        if ( face->uAttributes & FACE_UNKNOW7 )
         {
           if ( face->uBitmapID != -1 )
             v28->sTextureDeltaV -= v82 + pBitmaps_LOD->GetTexture(face->uBitmapID)->uTextureHeight;
@@ -2708,16 +2652,13 @@
         v82 = fixpoint_mul(door->vDirection.y, v70.y);
         v83 = fixpoint_mul(door->vDirection.z, v70.z);
         v75 = v84 + v82 + v83;
-        v53 = v89;
         v82 = fixpoint_mul(v75, v89);
         v28->sTextureDeltaU = -v82;
         v84 = fixpoint_mul(door->vDirection.x, v67.x);
         v82 = fixpoint_mul(door->vDirection.y, v67.y);
         v83 = fixpoint_mul(door->vDirection.z, v67.z);
         v75 = v84 + v82 + v83;
-        v55 = v75 * (signed __int64)v53;
-        v32 = v55 >> 16;
-LABEL_58:
+        v32 = fixpoint_mul(v75, v89);
         v57 = -v32;
         v28->sTextureDeltaV = v57;
         v28->sTextureDeltaU += door->pDeltaUs[v88];