changeset 1991:012fcb1f223a

Merge
author Grumpy7
date Sun, 03 Nov 2013 01:20:06 -0800
parents 84fa3c83d63f (current diff) 33787c8938a5 (diff)
children 1e5f097e1c2d
files
diffstat 15 files changed, 176 insertions(+), 176 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Nov 03 01:19:07 2013 -0800
+++ b/.hgignore	Sun Nov 03 01:20:06 2013 -0800
@@ -3,3 +3,4 @@
 Release/
 *.orig
 .git/*
+Build/
--- a/Actor.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/Actor.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -3622,7 +3622,7 @@
   {
     int main_hand_idx = player->pEquipment.uMainHand;
     IsAdditionalDamagePossible = true;
-    if ( player->HasItemEquipped(EQUIP_MAIN_HAND) )
+    if ( player->HasItemEquipped(EQUIP_TWO_HANDED) )
     {
       uint main_hand_skill = player->GetMainHandItem()->GetPlayerSkillType();
       uint main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]);
@@ -3789,10 +3789,10 @@
         if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
         {
           ItemGen* item;
-          if (i == 0)
+          //if (i == 0)
             item = player->GetMainHandItem();
-          else
-            item = player->GetOffHandItem();
+          //else
+            //item = player->GetOffHandItem();
           a4 = item->_439DF3_get_additional_damage((int*)&attackElement, &isLifeStealing);
           if ( isLifeStealing && pMonster->sCurrentHP > 0 )
           {
--- a/Game.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/Game.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -752,11 +752,11 @@
 
 
   WriteWindowsRegistryInt("startinwindow", pRenderer->bWindowMode);
-  /*if ( GetWindowRect(hWnd, &Rect) && pRenderer->bWindowMode )
+  if ( GetWindowRect(window->GetApiHandle(), &Rect) && pRenderer->bWindowMode )
   {
     WriteWindowsRegistryInt("window X", Rect.left);
     WriteWindowsRegistryInt("window Y", Rect.top);
-  }*/
+  }
   WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
   pItemsTable->Release();
   pNPCStats->Release();
--- a/Indoor.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/Indoor.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -219,13 +219,13 @@
   this->uPartySectorID = v7;
   if ( !v7 )
   {
-    __debugbreak(); // shouldnt happen, please provide savegame
+    //__debugbreak(); // shouldnt happen, please provide savegame
     /*v8 = this->vPartyPos.z;
     this->vPartyPos.x = pParty->vPosition.x;
     v9 = pParty->vPosition.y;
     v10 = this->vPartyPos.x;
     this->vPartyPos.y = pParty->vPosition.y;*/
-    this->uPartySectorID = pIndoor->GetSector(v10, v9, v8);
+    this->uPartySectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
   }
   if ( pRenderer->pRenderD3D )
   {
@@ -3902,6 +3902,7 @@
     }
   }
 
+  // INDOOR initialize actors
   for (uint i = 0; i < uNumActors; ++i)
   //if ( (signed int)uNumActors > (signed int)v13 )
   {
--- a/Items.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/Items.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -549,17 +549,17 @@
 					{
 					if ( !_stricmp(test_string, "weapon") )
 						{
-						pItems[item_counter].uEquipType = EQUIP_OFF_HAND;
+						pItems[item_counter].uEquipType = EQUIP_SINGLE_HANDED;
 						break;
 						}
 					if ( !_stricmp(test_string, "weapon2") )
 						{
-						pItems[item_counter].uEquipType = EQUIP_MAIN_HAND;
+						pItems[item_counter].uEquipType = EQUIP_TWO_HANDED;
 						break;
 						}
 					if ( !_stricmp(test_string, "weapon1or2") )
 						{
-						pItems[item_counter].uEquipType = EQUIP_OFF_HAND;
+						pItems[item_counter].uEquipType = EQUIP_SINGLE_HANDED;
 						break;
 						}
 					if ( !(_stricmp(test_string, "missile")&&_stricmp(test_string, "bow")))
@@ -1618,7 +1618,7 @@
         PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID;
         switch (uTreasureType)
             {
-        case 20: requested_equip = EQUIP_OFF_HAND; break;
+        case 20: requested_equip = EQUIP_SINGLE_HANDED; break;
         case 21: requested_equip = EQUIP_ARMOUR; break;
         case 22: requested_skill = PLAYER_SKILL_MISC; break;
         case 23: requested_skill = PLAYER_SKILL_SWORD; break;
@@ -1769,8 +1769,8 @@
     //try get special enhansment
     switch (out_item->GetItemEquipType())
         {
-    case EQUIP_OFF_HAND:
-    case EQUIP_MAIN_HAND :   
+    case EQUIP_SINGLE_HANDED:
+    case EQUIP_TWO_HANDED :   
     case EQUIP_BOW :    
         if ( !uBonusChanceWpSpecial[v6] )
             return;
--- a/Items.h	Sun Nov 03 01:19:07 2013 -0800
+++ b/Items.h	Sun Nov 03 01:20:06 2013 -0800
@@ -164,8 +164,8 @@
 /*  331 */
 enum ITEM_EQUIP_TYPE: unsigned __int8
 {
-  EQUIP_OFF_HAND     = 0,
-  EQUIP_MAIN_HAND     = 1,
+  EQUIP_SINGLE_HANDED     = 0,
+  EQUIP_TWO_HANDED     = 1,
   EQUIP_BOW            = 2,
   EQUIP_ARMOUR         = 3,
   EQUIP_SHIELD         = 4,
--- a/OSWindow.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/OSWindow.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -517,8 +517,8 @@
     if (!GetMenu(api_handle))
       window_total_height += GetSystemMetrics(SM_CYMENU);
   #endif
-  MoveWindow(api_handle, (GetSystemMetrics(SM_CXSCREEN) - window_total_width) / 2,
-                         (GetSystemMetrics(SM_CYSCREEN) - window_total_height) / 2,
+  MoveWindow(api_handle, ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_total_width) / 2),
+                         ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_total_height) / 2),
                          window_total_width,
                          window_total_height, 0);
   #ifdef _DEBUG
@@ -687,6 +687,7 @@
     case 103:  pRenderer->SavePCXScreenshot(); break;
     case 101:  // Quit game
     case 40001:
+		pGame->Deinitialize();
       SendMessageW(api_handle, WM_DESTROY, 0, 0);
     break;
 
--- a/Player.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/Player.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -87,8 +87,8 @@
 
 unsigned char pEquipTypeToBodyAnchor[21] = // 4E8398
 {
-  1, // EQUIP_OFF_HAND
-  1, // EQUIP_MAIN_HAND
+  1, // EQUIP_SINGLE_HANDED
+  1, // EQUIP_TWO_HANDED
   2, // EQUIP_BOW
   3, // EQUIP_ARMOUR
   0, // EQUIP_SHIELD
@@ -1550,7 +1550,7 @@
   }
   else
   {
-    if ( HasItemEquipped(EQUIP_MAIN_HAND) )
+    if ( HasItemEquipped(EQUIP_TWO_HANDED) )
     {
       ItemGen *mainHandItemGen = this->GetMainHandItem();
       int itemId = mainHandItemGen->uItemID;
@@ -1561,7 +1561,7 @@
     }
     if ( !ignoreOffhand )
     {
-      if ( this->HasItemEquipped(EQUIP_OFF_HAND) )
+      if ( this->HasItemEquipped(EQUIP_SINGLE_HANDED) )
       {
         ItemGen *offHandItemGen = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uShield - 1];
         if ( offHandItemGen->GetItemEquipType() != EQUIP_SHIELD )
@@ -1908,8 +1908,8 @@
 //----- (0048D676) --------------------------------------------------------
 bool Player::IsUnarmed()
 {
-  return !HasItemEquipped(EQUIP_MAIN_HAND) &&
-        (!HasItemEquipped(EQUIP_OFF_HAND) || GetOffHandItem()->GetItemEquipType() == EQUIP_SHIELD);
+  return !HasItemEquipped(EQUIP_TWO_HANDED) &&
+        (!HasItemEquipped(EQUIP_SINGLE_HANDED) || GetOffHandItem()->GetItemEquipType() == EQUIP_SHIELD);
 }
 
 //----- (0048D6AA) --------------------------------------------------------
@@ -1979,7 +1979,7 @@
     v8 = SkillToMastery(v6);
     itemvalue = itemToSteal->GetValue();
     v10 = itemToSteal->GetItemEquipType();
-    if ( v10 == EQUIP_OFF_HAND || v10 == EQUIP_MAIN_HAND || v10 == EQUIP_BOW )
+    if ( v10 == EQUIP_SINGLE_HANDED || v10 == EQUIP_TWO_HANDED || v10 == EQUIP_BOW )
       itemvalue *= 3;
     currMaxItemValue = StealingRandomBonuses[rand() % 5] + v7 * StealingMasteryBonuses[v8];
     *fineIfFailed = 100 * (reputation + extraStealDifficulty) + itemvalue;
@@ -2283,7 +2283,7 @@
         {
           if ( i == EQUIP_ARMOUR )
             v46[v4++] = this->pEquipment.uArmor - 1;
-          if ( (i == EQUIP_OFF_HAND || i == EQUIP_MAIN_HAND) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SHIELD )
+          if ( (i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SHIELD )
             v46[v4++] = this->pEquipment.pIndices[i] - 1;
         }
       }
@@ -2299,8 +2299,8 @@
         {
           if ( i == EQUIP_BOW )
             v46[v4++] = LOBYTE(this->pEquipment.uBow) - 1;
-          if ( (i == EQUIP_OFF_HAND || i == EQUIP_MAIN_HAND)
-            && (GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_OFF_HAND || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_MAIN_HAND) )
+          if ( (i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED)
+            && (GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SINGLE_HANDED || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_TWO_HANDED) )
             v46[v4++] = this->pEquipment.pIndices[i] - 1;
         }
       }
@@ -2525,7 +2525,7 @@
   {
       weapon_recovery = base_recovery_times_per_weapon_type[1];
   }
-  else if ( HasItemEquipped(EQUIP_MAIN_HAND) )
+  else if ( HasItemEquipped(EQUIP_TWO_HANDED) )
   {
     weapon = GetMainHandItem();
     if (weapon->GetItemEquipType() == EQUIP_WAND)
@@ -2537,7 +2537,7 @@
     else
       weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()];
   }
-  if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) 
+  if (HasItemEquipped(EQUIP_SINGLE_HANDED) && GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) != EQUIP_SHIELD) 
       // ADD: shield check because shield recovery is added later and can be accidentally doubled
   {
     if (base_recovery_times_per_weapon_type[GetOffHandItem()->GetPlayerSkillType()] > weapon_recovery)
@@ -2576,7 +2576,7 @@
   }
 
   uint shield_recovery = 0;
-  if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD)
+  if (HasItemEquipped(EQUIP_SINGLE_HANDED) && GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) == EQUIP_SHIELD)
   {
     uchar skill_type = GetOffHandItem()->GetPlayerSkillType();
 
@@ -2948,7 +2948,7 @@
 //----- (0048EA46) --------------------------------------------------------
 int Player::GetSpecialItemBonus( int enchantmentId )
 {
-  for (int i = EQUIP_OFF_HAND; i < EQUIP_BOOK; ++i )
+  for (int i = EQUIP_SINGLE_HANDED; i < EQUIP_BOOK; ++i )
   {
     if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
     {
@@ -3060,9 +3060,9 @@
       }
       else
       {
-        if ( this->HasItemEquipped(EQUIP_MAIN_HAND) )
+        if ( this->HasItemEquipped(EQUIP_TWO_HANDED) )
         {
-          v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
+          v22 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED);
           if ( v22 >= 0 && v22 <= 2)
           {
             ItemGen* mainHandItem = GetMainHandItem();
@@ -3078,7 +3078,7 @@
             v5 = mainHandItem->GetDamageMod() + v25 * v26;
           }
         }
-        if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) ||  (GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0 || GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2))
+        if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) ||  (GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0 || GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2))
         {
             return v5;
         }
@@ -3098,15 +3098,15 @@
       {
         return 0;
       }
-      if ( this->HasItemEquipped(EQUIP_MAIN_HAND) )
+      if ( this->HasItemEquipped(EQUIP_TWO_HANDED) )
       {
-        v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
+        v17 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED);
         if ( v17 >= 0 && v17 <= 2)
         {
           v5 = GetMainHandItem()->GetDamageMod();
         }
       }
-      if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 )
+      if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0) || this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2 )
         return v5;
       else
       {
@@ -3120,9 +3120,9 @@
       {
         return 1;
       }
-      if ( this->HasItemEquipped(EQUIP_MAIN_HAND) )
+      if ( this->HasItemEquipped(EQUIP_TWO_HANDED) )
       {
-        v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND);
+        v9 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED);
         if ( v9 >= 0 && v9 <= 2)
         {
           ItemGen* mainHandItem = GetMainHandItem();
@@ -3135,7 +3135,7 @@
         }
       }
 
-      if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 )
+      if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0) || this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2 )
       {
         return v5;
       }
@@ -3642,7 +3642,7 @@
       if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
       {
         ItemGen* currItem = GetNthEquippedIndexItem(i);
-        if ( currItem->GetItemEquipType() <= EQUIP_MAIN_HAND)
+        if ( currItem->GetItemEquipType() <= EQUIP_TWO_HANDED)
         {
           PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem->GetPlayerSkillType();
           int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType);
@@ -3705,7 +3705,7 @@
       if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
       {
         ItemGen* currItemPtr = GetNthEquippedIndexItem(i);
-        if ( currItemPtr->GetItemEquipType() == EQUIP_MAIN_HAND || currItemPtr->GetItemEquipType() == EQUIP_OFF_HAND )
+        if ( currItemPtr->GetItemEquipType() == EQUIP_TWO_HANDED || currItemPtr->GetItemEquipType() == EQUIP_SINGLE_HANDED )
         {
           PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItemPtr->GetPlayerSkillType();
           int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType);
@@ -7479,13 +7479,13 @@
         if ( playerPtr->HasItemEquipped(EQUIP_ARMOUR)
           && playerPtr->GetArmorItem()->uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR )
           dmgToReceive >>= 1;
-        if ( playerPtr->HasItemEquipped(EQUIP_MAIN_HAND))
+        if ( playerPtr->HasItemEquipped(EQUIP_TWO_HANDED))
         {
           ItemGen* mainHandItem = playerPtr->GetMainHandItem();
           if ( mainHandItem->uItemID == ITEM_RELIC_KELEBRIM || mainHandItem->uItemID == ITEM_ARTIFACT_ELFBANE || (mainHandItem->GetItemEquipType() == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4))
             dmgToReceive >>= 1;
         }
-        if ( playerPtr->HasItemEquipped(EQUIP_OFF_HAND))
+        if ( playerPtr->HasItemEquipped(EQUIP_SINGLE_HANDED))
         {
           ItemGen* offHandItem = playerPtr->GetOffHandItem();
           if ( offHandItem->uItemID == ITEM_RELIC_KELEBRIM || offHandItem->uItemID == ITEM_ARTIFACT_ELFBANE || (offHandItem->GetItemEquipType() == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4))
--- a/Render.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/Render.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -1201,7 +1201,7 @@
   v2 = new RenderD3D__DevInfo[4];// 4 items
   *pOutDevices = v2;
   memset(v2, 0, 0xA0u);
-  DirectDrawEnumerateA((LPDDENUMCALLBACKA)RenderD3D__DeviceEnumerator, *pOutDevices);
+  DirectDrawEnumerateExA((LPDDENUMCALLBACKEXA)RenderD3D__DeviceEnumerator, *pOutDevices, DDENUM_ATTACHEDSECONDARYDEVICES);
 }
 
 //----- (0049DC58) --------------------------------------------------------
@@ -2106,7 +2106,7 @@
   //windowed_mode_width = windowed_width;
   //windowed_mode_height = windowed_height;
 
-  uDesiredDirect3DDevice = 0;//ReadWindowsRegistryInt("D3D Device", 1);
+  uDesiredDirect3DDevice = ReadWindowsRegistryInt("D3D Device", 0);
 
   bUseColoredLights = bColoredLights;//ReadWindowsRegistryInt("Colored Lights", 0);
   uLevelOfDetail = uDetailLevel;//ReadWindowsRegistryInt("Detail Level", 1);
@@ -3184,7 +3184,7 @@
           Error("There aren't any D3D devices to create.");
 
         v8 = pRenderD3D->CreateDevice(0, 0, window->GetApiHandle());
-        uAcquiredDirect3DDevice = 0;
+        uAcquiredDirect3DDevice = 1;
       }
     }
     if ( !v8 )
@@ -4996,20 +4996,11 @@
 void Render::DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID)
 {
   BLVFace *pFace; // esi@1
-  //unsigned int v3; // edi@1
-  //PolygonType v4; // al@1
   double v5; // st7@3
   signed __int64 v6; // qax@3
-  //PolygonType v7; // cl@3
-  //int v8; // esi@7
-  //int v9; // eax@7
-  //unsigned int v10; // eax@7
-  //double v11; // st6@7
   int v12; // edx@7
   int v13; // eax@7
-  //char *v14; // esi@8
   void *v15; // ecx@9
-  //int v16; // eax@9
   int v17; // edi@9
   double v18; // st7@9
   signed int v19; // ebx@9
@@ -5020,7 +5011,6 @@
   double v24; // st7@16
   unsigned __int8 v25; // sf@16
   unsigned __int8 v26; // of@16
-  //Render *v27; // ecx@17
   double v28; // st7@20
   char *v29; // ebx@20
   char *v30; // edx@20
@@ -5047,21 +5037,14 @@
   double v51; // st7@46
   RenderVertexSoft *v52; // edx@46
   void *v53; // edi@48
-  //char *v54; // ebx@52
-  //unsigned int v55; // eax@53
-  //unsigned int v56; // eax@55
-  //int v57; // ST10_4@55
-  //Texture *v58; // eax@55
   signed int v59; // [sp-4h] [bp-178h]@17
   struct Polygon *v60; // [sp+0h] [bp-174h]@17
   IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17
-  struct Polygon pSkyPoligon; // [sp+14h] [bp-160h]@6
+  struct Polygon pSkyPolygon; // [sp+14h] [bp-160h]@6
   unsigned int v63; // [sp+120h] [bp-54h]@7
-  //double v64; // [sp+124h] [bp-50h]@7
   unsigned int v65; // [sp+128h] [bp-4Ch]@1
   unsigned int v66; // [sp+12Ch] [bp-48h]@7
-  float v67; // [sp+130h] [bp-44h]@7
-  //__int64 v68; // [sp+134h] [bp-40h]@3
+  //float v67; // [sp+130h] [bp-44h]@7
   __int64 v69; // [sp+13Ch] [bp-38h]@3
   int v70; // [sp+144h] [bp-30h]@3
   int X; // [sp+148h] [bp-2Ch]@9
@@ -5077,6 +5060,7 @@
   const void *v81; // [sp+170h] [bp-4h]@7
 
   pFace = &pIndoor->pFaces[uFaceID];
+  //for floor and wall-------------------
   if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor)
   {
     int v69 = (GetTickCount() / 32) - pGame->pIndoorCameraD3D->vPartyPos.x;
@@ -5089,76 +5073,72 @@
     pRenderer->DrawIndoorPolygon(uNumVertices, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), -1, 0);
     return;
   }
-
-  //*(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY;
-  v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pGame->pIndoorCameraD3D->vPartyPos.z)
+//---------------------------------------
+  v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pGame->pIndoorCameraD3D->vPartyPos.z)//179
                        / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0)
                         * 65536.0)
                        + (double)pBLVRenderParams->uViewportCenterY);
-  v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064;
-  //*(float *)&v75 = v5;
-  v6 = (signed __int64)((double)pBLVRenderParams->uViewportCenterY
+  v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064;//0
+  v6 = (signed __int64)((double)pBLVRenderParams->uViewportCenterY//183
                       - (double)pBLVRenderParams->fov_rad_fixpoint
                       / ((cos(v5) * 16192.0 + 0.0000001)
                        * 65535.0)
                       * (sin(v5) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
 
-
-  stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0);
-  pSkyPoligon.Create_48607B(&stru_8019C8);
-  pSkyPoligon.uTileBitmapID = pFace->uBitmapID;
-
-  pSkyPoligon.pTexture = pBitmaps_LOD->GetTexture(pSkyPoligon.uTileBitmapID);
-  if ( !pSkyPoligon.pTexture )
+  pSkyPolygon.Create_48607B(&stru_8019C8);
+  pSkyPolygon.ptr_38->_48653D_frustum_blv(65536, 0, 0, 0, 65536, 0);
+  pSkyPolygon.uTileBitmapID = pFace->uBitmapID;
+
+  pSkyPolygon.pTexture = pBitmaps_LOD->GetTexture(pSkyPolygon.uTileBitmapID);
+  if ( !pSkyPolygon.pTexture )
     return;
 
-  pSkyPoligon.dimming_level = 0;
-  pSkyPoligon.uNumVertices = uNumVertices;
-  pSkyPoligon.v_18.y = 0;
-  pSkyPoligon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
-  pSkyPoligon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);
+  pSkyPolygon.dimming_level = 0;
+  pSkyPolygon.uNumVertices = uNumVertices;
+
+  pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
+  pSkyPolygon.v_18.y = 0;
+  pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);
+
   memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices]));
-  pSkyPoligon.field_24 = 0x2000000;
+  pSkyPolygon.field_24 = 0x2000000;
 
   extern float _calc_fov(int viewport_width, int angle_degree);
   //v64 = (double)(signed int)(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX) * 0.5;
   //v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5);
   v72 = 65536.0f / _calc_fov(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX, 74);
-  v12 = pSkyPoligon.pTexture->uWidthMinus1;
-  v13 = pSkyPoligon.pTexture->uHeightMinus1;
-  v67 = 1.0 / (double)pSkyPoligon.pTexture->uTextureWidth;
+  v12 = pSkyPolygon.pTexture->uWidthMinus1;
+  v13 = pSkyPolygon.pTexture->uHeightMinus1;
+  //v67 = 1.0 / (double)pSkyPolygon.pTexture->uTextureWidth;
   v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13;
   v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12;
   v78 = 0;
   v81 = 0;
-  float v68 = 1.0 / (double)pSkyPoligon.pTexture->uTextureHeight;
-  if ( (signed int)pSkyPoligon.uNumVertices <= 0 )
-  {
-LABEL_17:
-    v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID];
-    //v27 = pRenderer;
-    v60 = &pSkyPoligon;
-    v59 = pSkyPoligon.uNumVertices;
-    goto LABEL_18;
+  float v68 = 1.0 / (double)pSkyPolygon.pTexture->uTextureHeight;
+  if ( (signed int)pSkyPolygon.uNumVertices <= 0 )
+  {
+    pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon,
+       pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
+    return;
   }
 
   //v14 = (char *)&array_507D30[0].vWorldViewProjY;
   int _507D30_idx = 0;
   while ( 2 )
   {
-    v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY));
-    v77 = (unsigned __int64)(pSkyPoligon.ptr_38->viewing_angle_from_west_east * (signed __int64)(signed int)v15) >> 16;
-    v74 = v77 + pSkyPoligon.ptr_38->angle_from_north;
-    v77 = (int)v15;
-    v77 = (unsigned __int64)(pSkyPoligon.ptr_38->viewing_angle_from_north_south * (signed __int64)(signed int)v15) >> 16;
-    v79 = v15;
-    v75 = (RenderVertexSoft *)(v77 + pSkyPoligon.ptr_38->angle_from_east);
-    v79 = (void *)((unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v15) >> 16);
+    //v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY));
+    v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16;
+    v74 = v77 + pSkyPolygon.ptr_38->angle_from_north;
+
+    v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16;
+    v75 = (RenderVertexSoft *)(v77 + pSkyPolygon.ptr_38->angle_from_east);
+
+    v79 = (void *)(((unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16);
     v17 = v72 * (pBLVRenderParams->uViewportCenterX - (int)array_507D30[_507D30_idx].vWorldViewProjX);
     v18 = array_507D30[_507D30_idx].vWorldViewProjY - 1.0;
-    v19 = -pSkyPoligon.field_24;
-    v77 = -pSkyPoligon.field_24;
-    X = (int)((char *)v79 + pSkyPoligon.v_18.x);
+    v19 = -pSkyPolygon.field_24;
+    v77 = -pSkyPolygon.field_24;
+    X = (int)((char *)v79 + pSkyPolygon.v_18.x);
     LODWORD(v76) = (signed __int64)v18;
     v20 = (void *)(v72 * (v70 - LODWORD(v76)));
     while ( 1 )
@@ -5174,44 +5154,68 @@
       v19 = v77;
       v20 = v79;
 LABEL_14:
-      v79 = (void *)((unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v20) >> 16);
-      v22 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v20) >> 16;
+      v79 = (void *)((unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)v20) >> 16);
+      v22 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)v20) >> 16;
       --LODWORD(v76);
       v20 = (char *)v20 + v72;
-      X = v22 + pSkyPoligon.v_18.x;
+      X = v22 + pSkyPolygon.v_18.x;
       v78 = 1;
     }
     if ( !v78 )
     {
       LODWORD(v23) = v77 << 16;
-      HIDWORD(v23) = v77 >> 16;
-      v79 = (void *)(v23 / X);
+      HIDWORD(v23) = v77 >> 16;//v23 = 0xfffffe0000000000
+	  int i = HIDWORD(v23) / X;
+      v79 = (void *)(v23 / X);//X = FFFF96A3(FFFF9014)
       v77 = v17;
       v77 = v17;
-      LODWORD(v76) = v74 + ((unsigned __int64)(pSkyPoligon.ptr_38->angle_from_west * (signed __int64)v17) >> 16);
-      v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPoligon.ptr_38->angle_from_south * (signed __int64)v17) >> 16));
+
+      LODWORD(v76) = v74 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v17) >> 16);
+      LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4);
+      //v24 = (double)SLODWORD(v80) * 0.000015259022;
+      array_507D30[_507D30_idx].u = ((double)SLODWORD(v80) * 0.000015259022) * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth);
+
+      v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v17) >> 16));
+      LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4);
+      array_507D30[_507D30_idx].v = ((double)SLODWORD(v80) * 0.000015259022) * v68;
+
       v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16;
       LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16;
       //v14 += 48;
-      LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4);
       v81 = (char *)v81 + 1;
-      v24 = (double)SLODWORD(v80) * 0.000015259022;
-      LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4);
-      v26 = __OFSUB__((int)v81, pSkyPoligon.uNumVertices);
-      v25 = (signed int)((char *)v81 - pSkyPoligon.uNumVertices) < 0;
-      array_507D30[_507D30_idx].u = v24 * v67;
-      array_507D30[_507D30_idx].v = (double)SLODWORD(v80) * 0.000015259022 * v68;
+      //v26 = __OFSUB__((int)v81, pSkyPolygon.uNumVertices);
+      //v25 = (signed int)((char *)v81 - pSkyPolygon.uNumVertices) < 0;
       array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79;
+	  /*
+      v18 = v17 / v38;
+      if ( v18 < 0 )
+        v18 = pODMRenderParams->shading_dist_mist;
+
+      v37 = v35 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v13) >> 16);
+      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + ((signed int)((unsigned __int64)(v37 * (signed __int64)v18) >> 16) >> 3);
+      array_50AC10[i].u = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureWidth * 65536.0);
+
+      v36 = v36 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v13) >> 16);
+      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + ((signed int)((unsigned __int64)(v36 * (signed __int64)v18) >> 16) >> 3);
+      array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);
+
+      array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist
+      array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16);
+	  */
       _507D30_idx++;
-      if ( !(v25 ^ v26) )
-        goto LABEL_17;
+      if ( (int)v81 >= pSkyPolygon.uNumVertices )
+      {
+        pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon,
+           pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
+        return;
+      }
       continue;
     }
     break;
   }
   LODWORD(v73) = 0;
   v80 = v76;
-  if ( (signed int)pSkyPoligon.uNumVertices > 0 )
+  if ( (signed int)pSkyPolygon.uNumVertices > 0 )
   {
     v28 = (double)SLODWORD(v76);
     LODWORD(v76) = (int)(char *)array_50AC10 + 28;
@@ -5219,7 +5223,7 @@
     v30 = (char *)&array_507D30[1].vWorldViewProjY;
     v79 = array_50AC10;
     v81 = array_507D30;
-    v78 = pSkyPoligon.uNumVertices;
+    v78 = pSkyPolygon.uNumVertices;
     do
     {
       v31 = v28 < *((float *)v30 - 12);
@@ -5262,17 +5266,17 @@
   do
   {
     v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34));
-    v78 = pSkyPoligon.ptr_38->viewing_angle_from_west_east;
+    v78 = pSkyPolygon.ptr_38->viewing_angle_from_west_east;
     v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
-    v36 = (int)((char *)v81 + pSkyPoligon.ptr_38->angle_from_north);
+    v36 = (int)((char *)v81 + pSkyPolygon.ptr_38->angle_from_north);
     v81 = v35;
     v74 = v36;
-    v78 = pSkyPoligon.ptr_38->viewing_angle_from_north_south;
+    v78 = pSkyPolygon.ptr_38->viewing_angle_from_north_south;
     v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
     v78 = (int)v35;
-    v75 = (RenderVertexSoft *)((char *)v81 + pSkyPoligon.ptr_38->angle_from_east);
-    v81 = (const void *)pSkyPoligon.v_18.z;
-    v78 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v35) >> 16;
+    v75 = (RenderVertexSoft *)((char *)v81 + pSkyPolygon.ptr_38->angle_from_east);
+    v81 = (const void *)pSkyPolygon.v_18.z;
+    v78 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)v35) >> 16;
     v37 = (const void *)(v72
                        * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1)));
     v38 = (signed __int64)(*(float *)v34 - 1.0);
@@ -5291,34 +5295,34 @@
         break;
       v39 = v78;
 LABEL_36:
-      v78 = pSkyPoligon.v_18.z;
-      v41 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)v39) >> 16;
+      v78 = pSkyPolygon.v_18.z;
+      v41 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v39) >> 16;
       --LODWORD(v76);
       v39 += v72;
-      X = v41 + pSkyPoligon.v_18.x;
+      X = v41 + pSkyPolygon.v_18.x;
       v81 = (const void *)1;
     }
     if ( v81 )
     {
-      v79 = (void *)pSkyPoligon.v_18.z;
+      v79 = (void *)pSkyPolygon.v_18.z;
       v78 = 2 * LODWORD(v76);
-      v81 = (const void *)((unsigned __int64)(pSkyPoligon.v_18.z
+      v81 = (const void *)((unsigned __int64)(pSkyPolygon.v_18.z
                                             * (signed __int64)(signed int)(signed __int64)(((double)v70
                                                                                           - ((double)(2 * LODWORD(v76))
                                                                                            - *(float *)v34))
                                                                                          * (double)v72)) >> 16);
-      X = (int)((char *)v81 + pSkyPoligon.v_18.x);
+      X = (int)((char *)v81 + pSkyPolygon.v_18.x);
     }
     LODWORD(v42) = v77 << 16;
     HIDWORD(v42) = v77 >> 16;
     v79 = (void *)(v42 / X);
     v81 = v37;
-    v78 = pSkyPoligon.ptr_38->angle_from_west;
+    v78 = pSkyPolygon.ptr_38->angle_from_west;
     v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
     v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
     v74 = (unsigned int)v37;
     LODWORD(v76) = v43;
-    v78 = pSkyPoligon.ptr_38->angle_from_south;
+    v78 = pSkyPolygon.ptr_38->angle_from_south;
     v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16));
     v74 = (unsigned __int64)(v43 * v42 / X) >> 16;
     v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16);
@@ -5327,7 +5331,7 @@
     v44 = HIDWORD(v69)-- == 1;
     v45 = (double)v78 * 0.000015259022;
     v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4);
-    *((float *)v34 - 10) = v45 * v67;
+    *((float *)v34 - 10) = v45 * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth);
     *((float *)v34 - 9) = (double)v78 * 0.000015259022 * v68;
     v46 = (double)(signed int)v79;
     *((float *)v34 - 16) = 0.000015258789 * v46;
@@ -5356,16 +5360,15 @@
     }
     while ( HIDWORD(v69) );
   }
-  pSkyPoligon.uNumVertices = v47;
-  pRenderer->DrawIndoorSkyPolygon(v47, &pSkyPoligon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID]);
+  pSkyPolygon.uNumVertices = v47;
+  pRenderer->DrawIndoorSkyPolygon(v47, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
   *(float *)&v74 = 0.0;
   if ( SLODWORD(v73) > 0 )
   {
     v51 = (double)SLODWORD(v80);
     v75 = array_507D30;
     v52 = array_50AC10;
-    v80 = v73;
-    do
+    for ( v80 = v73; v80; --v80 )
     {
       if ( v51 <= v52->vWorldViewProjY )
       {
@@ -5375,17 +5378,11 @@
         memcpy(v53, v52, 0x30u);
       }
       ++v52;
-      --LODWORD(v80);
-    }
-    while ( v80 != 0.0 );
-  }
-  pSkyPoligon.uNumVertices = v74;
-  v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID];
-  v60 = &pSkyPoligon;
-  v59 = v74;
-  //v27 = pRenderer;
-LABEL_18:
-  pRenderer->DrawIndoorSkyPolygon(v59, v60, v61);
+      //--LODWORD(v80);
+    }
+    //while ( v80 != 0.0 );
+  }
+  pRenderer->DrawIndoorSkyPolygon(v74, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
 }
 
 
--- a/UI/UICharacter.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/UI/UICharacter.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -777,7 +777,7 @@
       pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor);
     //Рука не занята или ...
     if ( !player->GetItem(&PlayerEquipment::uMainHand)
-         || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_MAIN_HAND)
+         || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_TWO_HANDED)
          && (player->GetMainHandItem()->GetItemEquipType() != PLAYER_SKILL_SPEAR
          || player->GetItem(&PlayerEquipment::uShield)) )
       pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1],
@@ -1062,7 +1062,7 @@
     }
     //--------------------------------------------(Hand/Рука)------------------------------------------------------
     if ( !player->GetItem(&PlayerEquipment::uMainHand)
-        || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_MAIN_HAND)
+        || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_TWO_HANDED)
         && (player->GetMainHandItem()->GetPlayerSkillType() != PLAYER_SKILL_SPEAR
         || player->GetItem(&PlayerEquipment::uShield)) )
       pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0],
@@ -1130,7 +1130,7 @@
       //---------------------------------------------(Hand2/Рука2)--------------------------------------------------
       if ( player->GetItem(&PlayerEquipment::uMainHand) )
       {
-        if ( player->GetMainHandItem()->GetItemEquipType() == EQUIP_MAIN_HAND
+        if ( player->GetMainHandItem()->GetItemEquipType() == EQUIP_TWO_HANDED
              || player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR
              && !player->GetItem(&PlayerEquipment::uShield) )
           pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0],
@@ -1161,7 +1161,7 @@
         if ( index >= 0 && index < 17 )
         {
           if ( player->GetItem(&PlayerEquipment::uMainHand)
-            && (player->GetMainHandItem()->GetItemEquipType() == EQUIP_MAIN_HAND
+            && (player->GetMainHandItem()->GetItemEquipType() == EQUIP_TWO_HANDED
             ||  player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR
             && !player->GetItem(&PlayerEquipment::uShield) ))//без щита
           {
@@ -1528,7 +1528,7 @@
   if ( player->GetItem(&PlayerEquipment::uMainHand))
   {
     item = player->GetMainHandItem();
-    if ( item->GetItemEquipType() == EQUIP_MAIN_HAND
+    if ( item->GetItemEquipType() == EQUIP_TWO_HANDED
         || item->GetPlayerSkillType() == PLAYER_SKILL_SPEAR
         && !player->GetItem(&PlayerEquipment::uShield) )
       pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], 
@@ -2347,7 +2347,7 @@
   _this.Reset();
   v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand;
   v2 = pPlayers[uActiveCharacter]->pEquipment.uShield;
-  if ( v1 && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetItemEquipType() == EQUIP_MAIN_HAND )
+  if ( v1 && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetItemEquipType() == EQUIP_TWO_HANDED )
     v51 = v1;
   v3 = pParty->pPickedItem.uItemID;
   if ( pParty->pPickedItem.uItemID )
@@ -2476,7 +2476,7 @@
           _this.uBodyAnchor = 1;
           memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2], &_this, 0x24u);
           pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1;
-          if ( v51 == EQUIP_OFF_HAND )
+          if ( v51 == EQUIP_SINGLE_HANDED )
             return;
         }
         else
@@ -2505,7 +2505,7 @@
         pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0;
         return;
 //-------------------------taken in hand(взять в руку)-------------------------------------------
-      case EQUIP_OFF_HAND:
+      case EQUIP_SINGLE_HANDED:
       case EQUIP_WAND:
         if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped()
           && pParty->pPickedItem.uItemID != 64
@@ -2610,7 +2610,7 @@
         }
         break;
 //---------------------------take two hands(взять двумя руками)---------------------------------
-      case EQUIP_MAIN_HAND:
+      case EQUIP_TWO_HANDED:
         if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() )
         {
           pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
--- a/UI/UIPopup.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/UI/UIPopup.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -240,8 +240,8 @@
   out_text[200] = 0;
   switch (inspect_item->GetItemEquipType())
   {
-    case EQUIP_OFF_HAND:
-    case EQUIP_MAIN_HAND:
+    case EQUIP_SINGLE_HANDED:
+    case EQUIP_TWO_HANDED:
       sprintfex(out_text + 100, "%s: +%d   %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK],
           (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53],
           (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage"
@@ -1688,7 +1688,7 @@
     {
       if (item->IsBroken() ||                         // cant harden broken items
           item->uItemID >= ITEM_ARTIFACT_PUCK ||      // cant harden artifacts
-          item->GetItemEquipType() < EQUIP_OFF_HAND ||
+          item->GetItemEquipType() < EQUIP_SINGLE_HANDED ||
           item->GetItemEquipType() > EQUIP_WAND)
       {
         pMouse->RemoveHoldingItem();
--- a/UI/UiGame.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/UI/UiGame.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -376,7 +376,7 @@
     assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames.data())); // sometimes buffer overflows; errors emerge both here and in dialogue text
     sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s
   }
-  else
+  else if (pNPC->pName)
     strcpy(pTmpBuf.data(), pNPC->pName);
 
   window.DrawTitleText(pFontArrus, 483, 112, ui_game_dialogue_npc_name_color, pTmpBuf.data(), 3);
--- a/Viewport.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/Viewport.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -57,7 +57,7 @@
     if ( pRenderer->pRenderD3D == 0 )
         this->uScreenCenterY = this->uScreen_BR_Y - fixpoint_mul(field_30, uScreenHeight);
     else
-        this->uScreenCenterY = uScreenHeight/2;
+        this->uScreenCenterY = (br_y + tl_y)/2;
     SetViewport(this->uScreen_TL_X, this->uScreen_TL_Y, this->uScreen_BR_X, this->uScreen_BR_Y);
     }
 
--- a/mm7_2.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/mm7_2.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -3045,8 +3045,8 @@
   pTexture_PCX.Release();
   pTexture_PCX.Load("title.pcx", 0);
   SetCurrentMenuID(MENU_MAIN);
-  //SetForegroundWindow(hWnd);
-  //SendMessageW(hWnd, WM_ACTIVATEAPP, 1, 0);
+  SetForegroundWindow(window->GetApiHandle());
+  SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0);
   while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD)
   {
     POINT pt;
@@ -3994,7 +3994,7 @@
   }
   else
   {
-    window->SetWindowedMode(game_width, game_height);
+    //window->SetWindowedMode(game_width, game_height);
     pRenderer->SwitchToWindow();
   }
 
--- a/mm7_6.cpp	Sun Nov 03 01:19:07 2013 -0800
+++ b/mm7_6.cpp	Sun Nov 03 01:20:06 2013 -0800
@@ -438,7 +438,7 @@
     Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
 
     DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3);
-    if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND))
+    if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED))
           _42FA66_do_explosive_impact(
             actor->vPosition.x,
             actor->vPosition.y,
@@ -478,7 +478,7 @@
   else
   {
     int main_hand_idx = player->pEquipment.uMainHand;
-    if (player->HasItemEquipped(EQUIP_MAIN_HAND))
+    if (player->HasItemEquipped(EQUIP_TWO_HANDED))
       v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType();
     pTurnEngine->ApplyPlayerAction();
   }