diff UI/UICharacter.cpp @ 1466:ec79ee6d44ce

Paperdoll shoulder fix
author Ritor1
date Mon, 26 Aug 2013 15:05:15 +0600
parents 090ff42290c4
children 3cda66022a77
line wrap: on
line diff
--- a/UI/UICharacter.cpp	Mon Aug 26 10:39:24 2013 +0600
+++ b/UI/UICharacter.cpp	Mon Aug 26 15:05:15 2013 +0600
@@ -283,7 +283,7 @@
 
 int pPaperdoll_BodyX = 481; // 004E4C28
 int pPaperdoll_BodyY = 0;   // 004E4C2C
-const int paperdoll_Armor[4][17][2] = //4E4E30
+const int paperdoll_Armor_Coord[4][17][2] = //4E4E30
     {
     // X     Y
     0x2C, 0x67,  0x30, 0x69,  0x2D, 0x67,  0x2C, 0x64,  0x14, 0x66,  0x22, 0x67,  0x20, 0x66,  0x25, 0x66,  0x12, 0x66,//Human
@@ -298,7 +298,7 @@
     0x33, 0x90,  0x32, 0x90,  0x34, 0x91,  0x32, 0x8E,  0x21, 0x8B,  0x31, 0x8B,  0x33, 0x8E,  0x2F, 0x8F,  0x16, 0x8D,
     0x18, 0x8C,  0x19, 0x8C,  0x1B, 0x8E,  0x0C, 0x8C,  0x21, 0x8B,  0x0C, 0x8C,  0x18, 0x8C,  0x2F, 0x8F,
     };
-const int paperdoll_shoulder[4][17][2] = //4E5050
+const int paperdoll_shoulder_coord[4][17][2] = //4E5050
     {
     0x64, 0x67,  0x61, 0x67,  0x65, 0x68,  0x6E, 0x74,  0x6C, 0x68,  0x61, 0x67,  0x66, 0x68,  0x6C, 0x6A,  0x6E, 0x6D,
     0x67, 0x69,  0x70, 0x67,  0x6E, 0x6D,  0x6C, 0x6F,  0x6C, 0x68,  0x6C, 0x6F,  0x67, 0x69,  0x6C, 0x6A,
@@ -312,12 +312,19 @@
     0x72, 0x91,  0x72, 0x91,  0, 0,        0x6E, 0x92,  0x6F, 0x91,  0, 0,        0, 0,        0x6E, 0x91,  0x71, 0x90,
     0x72, 0x8D,  0x72, 0x90,  0x73, 0x93,  0x73, 0x90,  0x6F, 0x91,  0x73, 0x90,  0x72, 0x8D,  0x6E, 0x91,
     };
-const int dword_4E5270[4][2] = 
+const int paperdoll_shoulder_second_coord[4][17][2] = //dword_4E5270
     {
-    0, 0,
-    0x61, 0x67,
-    0, 0,
-    0x64, 0x69,
+    0, 0,        0x61, 0x67,  0, 0,        0x64, 0x69,  0x64, 0x68,  0, 0,        0, 0,        0x5E, 0x66,  0x5F, 0x69,
+    0x55, 0x69,  0x5F, 0x67,  0x5F, 0x68,  0x32, 0x69,  0x64, 0x68,  0x32, 0x69,  0x55, 0x69,  0x5E, 0x66,
+
+    0, 0,        0x60, 0x6C,  0, 0,        0x60, 0x6C,  0x5E, 0x69,  0, 0,        0, 0,        0x5D, 0x6A,  0x5B, 0x6A,
+    0x5B, 0x6A,  0x59, 0x69,  0x56, 0x68,  0x38, 0x6E,  0x5E, 0x69,  0x38, 0x6E,  0x5B, 0x6A,  0x5D, 0x6A,
+
+    0, 0,        0x75, 0x8C,  0, 0,        0x72, 0x8D,  0x62, 0x89,  0, 0,        0, 0,        0x69, 0x8C,  0x5E, 0x8D,
+    0x61, 0x8D,  0x5F, 0x8D,  0x60, 0x8D,  0x2E, 0x8C,  0x62, 0x89,  0x2E, 0x8C,  0x61, 0x8D,  0x69, 0x8C,
+
+    0, 0,        0x72, 0x91,  0, 0,        0x72, 0x91,  0x67, 0x8F,  0, 0,        0, 0,        0x6E, 0x91,  0x64, 0x93,
+    0x65, 0x8C,  0x65, 0x91,  0x67, 0x91,  0x36, 0x90,  0x67, 0x8F,  0x36, 0x90,  0x65, 0x8C,  0x6E, 0x91,
     };
 
 const char *dlad_texnames_by_face[25] =
@@ -956,8 +963,8 @@
       }
       if ( index >= 0 && index < 17 )
       {
-        item_X = pPaperdoll_BodyX + paperdoll_Armor[pBodyComplection][index][0];
-        item_Y = pPaperdoll_BodyY + paperdoll_Armor[pBodyComplection][index][1];
+        item_X = pPaperdoll_BodyX + paperdoll_Armor_Coord[pBodyComplection][index][0];
+        item_Y = pPaperdoll_BodyY + paperdoll_Armor_Coord[pBodyComplection][index][1];
         if ( !(item->uAttributes & 0xF0) )
         {
           if ( item->uAttributes & 2 )
@@ -990,105 +997,6 @@
           pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][0]),
                           pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255);
         }
-        //--------------------------------(Shoulder/Плечи)---------------------------------------------
-        if ( pPlayers[uPlayerID]->pEquipment.uMainHand
-          && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND ||
-           pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD &&
-          !pPlayers[uPlayerID]->pEquipment.uShield) )//без щита
-        {
-          v94 = paperdoll_armor_texture[pBodyComplection][index][2];
-          if ( paperdoll_armor_texture[pBodyComplection][index][2] == pIcons_LOD->FindTextureByName("pending") )
-          {
-            v94 = paperdoll_armor_texture[pBodyComplection][index][1];
-            item_X = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][index][0];
-            item_Y = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][index][1];
-          }
-          else
-          {
-            item_X = pPaperdoll_BodyX + dword_4E5270[index][0];
-            item_Y = pPaperdoll_BodyY + dword_4E5270[index][1];
-          }
-          if ( !(item->uAttributes & 0xF0) )
-          {
-            //v98 = v94 + 1;
-            if ( item->uAttributes & 2 )
-              pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v94));
-            else
-            {
-              if ( item->uAttributes & 1 )
-                pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v94));
-              else
-                pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v94));
-            }
-          }
-          else
-          {
-            if ( paperdoll_armor_texture[pBodyComplection][index][2] != pIcons_LOD->FindTextureByName("pending") )
-            {
-              if ( item->uAttributes & 0xF0 )
-              {
-                if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED )
-                  container = "sptext01";
-                if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE )
-                  container = "sp28a";
-                if ( ( item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN )
-                  container = "sp30a";
-                if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE )
-                  container = "sp91a";
-                _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
-                if ( _50C9A8_item_enchantment_timer <= 0 )
-                {
-                  _50C9A8_item_enchantment_timer = 0;
-                  item->uAttributes &= 0xFFFFFF0Fu;
-                  ptr_50C9A4 = 0;
-                }
-                pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v94), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE),
-                              GetTickCount() * 0.1, 0, 255);
-              }
-            }
-          }
-        }
-        else//с щитом
-        {
-          //v94 = paperdoll_armor_texture[pBodyComplection][index][1];
-          if ( paperdoll_armor_texture[pBodyComplection][index][1] != pIcons_LOD->FindTextureByName("pending") )
-          {
-            item_X = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][index][0];
-            item_Y = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][index][1];
-            if ( !(item->uAttributes & 0xF0) )
-            {
-              if ( item->uAttributes & 2 )
-                pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][2]));
-              else
-              {
-                if ( item->uAttributes & 1 )
-                  pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][2]));
-                else
-                  pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][2]));
-              }
-            }
-            else
-            {
-              if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED )
-                container = "sptext01";
-              if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE )
-                container = "sp28a";
-              if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN )
-                container = "sp30a";
-              if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE )
-                container = "sp91a";
-              _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
-              if ( _50C9A8_item_enchantment_timer <= 0 )
-              {
-                _50C9A8_item_enchantment_timer = 0;
-                item->uAttributes &= 0xFFFFFF0Fu;
-                ptr_50C9A4 = 0;
-              }
-              pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]),
-                    pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255);
-            }
-          }
-        }
 
         if ( !bRingsShownInCharScreen )
           pRenderer->DrawMaskToZBuffer(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]],
@@ -1231,6 +1139,130 @@
           pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0],
                      pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1]));
       }
+      //--------------------------------(Shoulder/Плечи)---------------------------------------------
+      item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uArmor - 1];
+      switch ( item->uItemID )
+      {
+        case ITEM_ARTICACT_GOVERNONS_ARMOR:
+          index = 15;
+          break;
+        case ITEM_ARTIFACT_YORUBA:
+          index = 14;
+          break;
+        case ITEM_RELIC_HARECS_LEATHER:
+          index = 13;
+          break;
+        case ITEM_ELVEN_CHAINMAIL:
+          index = 16;
+          break;
+        default:
+          index = item->uItemID - 66;
+          break;
+      }
+      if ( index >= 0 && index < 17 )
+      {
+      if ( pPlayers[uPlayerID]->pEquipment.uMainHand
+        && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND
+        ||  pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD
+        && !pPlayers[uPlayerID]->pEquipment.uShield) )//без щита
+      {
+        v94 = paperdoll_armor_texture[pBodyComplection][index][2];
+        if ( paperdoll_armor_texture[pBodyComplection][index][2] == pIcons_LOD->FindTextureByName("pending") )
+        {
+          v94 = paperdoll_armor_texture[pBodyComplection][index][1];
+          item_X = pPaperdoll_BodyX + paperdoll_shoulder_coord[pBodyComplection][index][0];
+          item_Y = pPaperdoll_BodyY + paperdoll_shoulder_coord[pBodyComplection][index][1];
+        }
+        else
+        {
+          item_X = pPaperdoll_BodyX + paperdoll_shoulder_second_coord[pBodyComplection][index][0];
+          item_Y = pPaperdoll_BodyY + paperdoll_shoulder_second_coord[pBodyComplection][index][1];
+        }
+        if ( v94 != pIcons_LOD->FindTextureByName("pending") )
+        {
+          if ( !(item->uAttributes & 0xF0) )
+          {
+            if ( item->uAttributes & 2 )
+              pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v94));
+            else
+            {
+              if ( item->uAttributes & 1 )
+                pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v94));
+              else
+                pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v94));
+            }
+          }
+          else
+          {
+            if ( paperdoll_armor_texture[pBodyComplection][index][2] != pIcons_LOD->FindTextureByName("pending") )
+            {
+              if ( item->uAttributes & 0xF0 )
+              {
+                if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED )
+                  container = "sptext01";
+                if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE )
+                  container = "sp28a";
+                if ( ( item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN )
+                  container = "sp30a";
+                if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE )
+                  container = "sp91a";
+                _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
+                if ( _50C9A8_item_enchantment_timer <= 0 )
+                {
+                  _50C9A8_item_enchantment_timer = 0;
+                  item->uAttributes &= 0xFFFFFF0Fu;
+                  ptr_50C9A4 = 0;
+                }
+                pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v94), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE),
+                              GetTickCount() * 0.1, 0, 255);
+              }
+            }
+          }
+        }
+      }
+      else//без ничего или с щитом
+      {
+        //v94 = paperdoll_armor_texture[pBodyComplection][index][1];
+        if ( paperdoll_armor_texture[pBodyComplection][index][1] != pIcons_LOD->FindTextureByName("pending") )
+        {
+          item_X = pPaperdoll_BodyX + paperdoll_shoulder_coord[pBodyComplection][index][0];
+          item_Y = pPaperdoll_BodyY + paperdoll_shoulder_coord[pBodyComplection][index][1];
+          if ( !(item->uAttributes & 0xF0) )
+          {
+            if ( item->uAttributes & 2 )
+              pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]));
+            else
+            {
+              if ( item->uAttributes & 1 )
+                pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]));
+              else
+                pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]));
+            }
+          }
+          else
+          {
+            if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED )
+              container = "sptext01";
+            if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE )
+              container = "sp28a";
+            if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN )
+              container = "sp30a";
+            if ( (item->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE )
+              container = "sp91a";
+            _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
+            if ( _50C9A8_item_enchantment_timer <= 0 )
+            {
+              _50C9A8_item_enchantment_timer = 0;
+              item->uAttributes &= 0xFFFFFF0Fu;
+              ptr_50C9A4 = 0;
+            }
+            pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]),
+                  pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255);
+          }
+        }
+	  }
+
+      }
       //----------------------------------------------(Cloak collar/воротник плаща)-------------------------------------
       if ( pPlayers[uPlayerID]->pEquipment.uCloak )
       {
@@ -1512,93 +1544,72 @@
 //----- (0041A2D1) --------------------------------------------------------
 void CharacterUI_InventoryTab_Draw(Player *player, bool a2)
 {
-        Texture *v7; // esi@6
-        signed int v11; // edx@6
-        int v13; // eax@13
-        signed int v14; // edx@13
-        int v15; // eax@13
-        unsigned int v17; // edi@15
-        Texture *pTexture; // ebx@24
-        unsigned int uCellX; // [sp+30h] [bp-8h]@5
-        unsigned int uCellY; // [sp+34h] [bp-4h]@5
+  Texture *pTexture; // esi@6
+  int v13; // eax@13
+  int v15; // eax@13
+  unsigned int v17; // edi@15
+  unsigned int uCellX; // [sp+30h] [bp-8h]@5
+  unsigned int uCellY; // [sp+34h] [bp-4h]@5
 
   pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_CharacterUI_InventoryBackground));
   if (a2)
     pRenderer->DrawTextureIndexed(8, 305, pIcons_LOD->LoadTexturePtr("fr_strip", TEXTURE_16BIT_PALETTE));
-
-  int i = 0;
   for (uint i = 0; i < 126; ++i)
   {
-    int v26 = (int)(player->pInventoryMatrix + i);
-
-    if (player->pInventoryMatrix[i] <= 0)
+    if ( player->pInventoryMatrix[i] <= 0 )
       continue;
-
-    int item_idx = player->pInventoryMatrix[i];
-    auto item = &player->pInventoryItemList[item_idx - 1];
-    if (!item->uItemID)
+    if ( !player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uItemID )
       continue;
-
     uCellY = 32 * (i / 14) + 17;
     uCellX = 32 * (i % 14) + 14;
-    uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-    v7 = pIcons_LOD->GetTexture(item_texture_id);
-
-                    v11 = v7->uTextureWidth;
-                    if (v11 < 14)
-                        v11 = 14;
-
-                    if ( (v11 - 14) / 32 == 0 && v7->uTextureWidth < 32)
-                        uCellX += (32 - v7->uTextureWidth) / 2;
-                    v13 = v11 - 14;
-                    LOBYTE(v13) = v13 & 0xE0;
-                    v15 = v13 + 32;
-                    v14 = v7->uTextureHeight;
-                    if (v14 < 14 )
-                        v14 = 14;
-                    v17 = uCellX + ((v15 - v7->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + (( (int)((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)];   //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up
-
-    if (item->uAttributes & 0xF0)
+    uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+    pTexture = pIcons_LOD->GetTexture(item_texture_id);
+    if (pTexture->uTextureWidth < 14)
+      pTexture->uTextureWidth = 14;
+    if ( (pTexture->uTextureWidth - 14) / 32 == 0 && pTexture->uTextureWidth < 32)
+      uCellX += (32 - pTexture->uTextureWidth) / 2;
+    v13 = pTexture->uTextureWidth - 14;
+    LOBYTE(v13) = v13 & 0xE0;
+    v15 = v13 + 32;
+    if (pTexture->uTextureHeight < 14 )
+      pTexture->uTextureHeight = 14;
+    v17 = uCellX + ((v15 - pTexture->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + (( (int)((pTexture->uTextureHeight - 14) & 0xFFFFFFE0) - pTexture->uTextureHeight + 32) >> 1)];   //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up
+    if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes & 0xF0)
     {
-      switch (item->uAttributes & 0xF0)
+      switch (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes & 0xF0)
       {
         case ITEM_AURA_EFFECT_RED:    pTexture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break;
         case ITEM_AURA_EFFECT_BLUE:   pTexture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE);    break;
         case ITEM_AURA_EFFECT_GREEN:  pTexture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE);    break;
         case ITEM_AURA_EFFECT_PURPLE: pTexture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE);    break;
       }
-
       _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
       if (_50C9A8_item_enchantment_timer <= 0)
       {
         _50C9A8_item_enchantment_timer = 0;
-        LOBYTE(item->uAttributes) &= 0xF;
+        LOBYTE(player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes) &= 0xF;
         ptr_50C9A4 = 0;
       }
-
-      pRenderer->DrawAura(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255);
-      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
+      pRenderer->DrawAura(uCellX, uCellY, pTexture, pTexture, GetTickCount() * 0.1, 0, 255);
+      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, player->pInventoryMatrix[i]);
     }
     else
     {
-      if (item->Identified() || pCurrentScreen != SCREEN_HOUSE)
+      if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].Identified() || pCurrentScreen != SCREEN_HOUSE)
       {
-        if (item->Broken())
-          pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7);
+        if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].Broken())
+          pRenderer->DrawTransparentRedShade(uCellX, uCellY, pTexture);
         else
-          pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
+          pRenderer->DrawTextureTransparent(uCellX, uCellY, pTexture);
       }
       else
-        pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7);
-
-      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
+        pRenderer->DrawTransparentGreenShade(uCellX, uCellY, pTexture);
+      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, player->pInventoryMatrix[i]);
       continue;
     }
   }
 }
 
-
-
 static void CharacterUI_DrawItem(int x, int y, ItemGen *item, int id)
 {
   auto item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
@@ -1636,140 +1647,110 @@
   }
 }
 
-
 //----- (0043E825) --------------------------------------------------------
 void CharacterUI_DrawPaperdollWithRingOverlay(Player *player)
 {
   CharacterUI_DrawPaperdoll(player);
-
   pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND));
   pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));
-  pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX,
-                                pCharacterScreen_DetalizBtn->uY,
+  pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY,
                                 pIcons_LOD->GetTexture(uTextureID_detaliz_close_button));
-
   for (uint i = 0; i < 6; ++i)
   {
     if (!player->pEquipment.uRings[i])
       continue;
-    
     static int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248};
     static int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA};
-
-    CharacterUI_DrawItem(pPaperdollRingsX[i],
-                         pPaperdollRingsY[i],
-                         &player->pInventoryItemList[player->pEquipment.uRings[i] - 1],
+    CharacterUI_DrawItem(pPaperdollRingsX[i], pPaperdollRingsY[i], &player->pInventoryItemList[player->pEquipment.uRings[i] - 1],
                          player->pEquipment.uRings[i]);
   }
-
-
   if (player->pEquipment.uAmulet)
-  {
-    CharacterUI_DrawItem(493, 91,
-                         &player->pInventoryItemList[player->pEquipment.uAmulet - 1],
-                         player->pEquipment.uAmulet);
-  }
-
+    CharacterUI_DrawItem(493, 91, &player->pInventoryItemList[player->pEquipment.uAmulet - 1], player->pEquipment.uAmulet);
   if (player->pEquipment.uGlove)
-  {
-    CharacterUI_DrawItem(586, 88,
-                         &player->pInventoryItemList[player->pEquipment.uGlove - 1],
-                         player->pEquipment.uGlove);
-  }
+    CharacterUI_DrawItem(586, 88, &player->pInventoryItemList[player->pEquipment.uGlove - 1], player->pEquipment.uGlove);
 }
 
 //----- (0043BCA7) --------------------------------------------------------
 void CharacterUI_LoadPaperdollTextures()
 {
-  int v0; // edi@7
-  enum CHARACTER_RACE pRace; // ebx@7
-  signed int pSex; // eax@7
+  //enum CHARACTER_RACE pRace; // ebx@7
+  //signed int pSex; // eax@7
   int v3; // ebx@10
   Player *pPlayer; // edi@12
-  unsigned __int8 v5; // cl@12
+  //unsigned __int8 v5; // cl@12
   int v6; // edi@16
   unsigned int v7; // eax@16
   Player *pPlayer2; // ebx@16
   char *v9; // ebx@16
-  char v10; // al@16
-  signed int v11; // edi@21
+  //char v10; // al@16
+  //signed int v11; // edi@21
   unsigned int v22; // eax@76
   int v23; // ecx@76
   unsigned int v24; // eax@78
   int v25; // ecx@78
-  int v26; // ebx@79
+  //int v26; // ebx@79
   unsigned int v27; // eax@80
   int v28; // ecx@80
-  int v30; // [sp+10h] [bp-28h]@5
   signed int v32; // [sp+10h] [bp-28h]@75
   signed int v33; // [sp+10h] [bp-28h]@77
   int v34; // [sp+10h] [bp-28h]@79
   int pItemTXTNum; // [sp+14h] [bp-24h]@75
   int v37; // [sp+14h] [bp-24h]@77
   signed int v38; // [sp+14h] [bp-24h]@79
-  int v42; // [sp+20h] [bp-18h]@6
-  int v43; // [sp+20h] [bp-18h]@73
+  //int v43; // [sp+20h] [bp-18h]@73
   char pContainer[128]; // [sp+24h] [bp-14h]@12
 
   uTextureID_MAGNIF_B = pIcons_LOD->LoadTexture("MAGNIF-B", TEXTURE_16BIT_PALETTE);
   //if ( !pParty->uAlignment || pParty->uAlignment == 1 || pParty->uAlignment == 2 )
   uTextureID_BACKDOLL = pIcons_LOD->LoadTexture("BACKDOLL", TEXTURE_16BIT_PALETTE);
   uTextureID_right_panel_loop = uTextureID_right_panel;
-  v30 = 0;
   uTextureID_BACKHAND = pIcons_LOD->LoadTexture("BACKHAND", TEXTURE_16BIT_PALETTE);
   uTextureID_detaliz_close_button = uExitCancelTextureId;
-  do
+  for ( uint i = 0; i < 4; ++i )
   {
-    v42 = v30 + 1;
-    if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v30 + 1) )
+    if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(i + 1) )
     {
-      v0 = v30;
-      pRace = pPlayers[v30 + 1]->GetRace();
-      pSex = pPlayers[v30 + 1]->GetSexByVoice();
-      if ( pRace && pRace != 1 && pRace != 2 )//race == 3
-        v3 = (pSex != 0) + 3;
+      if ( pPlayers[i + 1]->GetRace() == CHARACTER_RACE_DWARF )
+        v3 = (pPlayers[i + 1]->GetSexByVoice() != 0) + 3;
       else
-        v3 = (pSex != 0) + 1;
+        v3 = (pPlayers[i + 1]->GetSexByVoice() != 0) + 1;
       wsprintfA(pContainer, "pc23v%dBod", v3);
-      papredoll_dbods[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Body texture
+      papredoll_dbods[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Body texture
       wsprintfA(pContainer, "pc23v%dlad", v3);
-      papredoll_dlads[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand
+      papredoll_dlads[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand
       wsprintfA(pContainer, "pc23v%dlau", v3);
-      papredoll_dlaus[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand2
+      papredoll_dlaus[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand2
       wsprintfA(pContainer, "pc23v%drh", v3);
-      papredoll_drhs[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Right Hand
+      papredoll_drhs[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Right Hand
       wsprintfA(pContainer, "pc23v%dlh", v3);
-      papredoll_dlhs[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Fist
+      papredoll_dlhs[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Fist
       wsprintfA(pContainer, "pc23v%dlhu", v3);
-      papredoll_dlhus[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); // Left Fist 2
-      pPlayer = pPlayers[v0 + 1];
-      v5 = pPlayer->uCurrentFace;
-      if ( v5 == 12 || v5 == 13 )
-        papredoll_dbrds[(char)v5] = 0;
+      papredoll_dlhus[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); // Left Fist 2
+      pPlayer = pPlayers[i + 1];
+      if ( pPlayer->uCurrentFace == 12 || pPlayer->uCurrentFace == 13 )
+        papredoll_dbrds[(char)pPlayer->uCurrentFace] = 0;
       papredoll_flying_feet[pPlayer->uCurrentFace] = 0;
-      IsPlayerWearingWatersuit[v30 + 1] = 1;
+      IsPlayerWearingWatersuit[i + 1] = 1;
     }
     else
     {
-      papredoll_dbods[v30] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
-      papredoll_dlads[v30] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
-      papredoll_dlaus[v30] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
-      papredoll_drhs[v30] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
-      papredoll_dlhs[v30] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
-      papredoll_dlhus[v30] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
-      v10 = pPlayers[v30 + 1]->uCurrentFace;
-      if ( v10 == 12 || v10 == 13 )
+      papredoll_dbods[i] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      papredoll_dlads[i] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      papredoll_dlaus[i] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      papredoll_drhs[i] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      papredoll_dlhs[i] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      papredoll_dlhus[i] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      if ( pPlayers[i + 1]->uCurrentFace == 12 || pPlayers[i + 1]->uCurrentFace == 13 )
       {
-        wsprintfA(pContainer, "pc%02dbrd", v10 + 1);
-        papredoll_dbrds[v10] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+        wsprintfA(pContainer, "pc%02dbrd", pPlayers[i + 1]->uCurrentFace + 1);
+        papredoll_dbrds[pPlayers[i + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
       }
-      wsprintfA(pContainer, "item281pc%02d", v10 + 1);
-      papredoll_flying_feet[pPlayers[v30 + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      IsPlayerWearingWatersuit[v30 + 1] = 0;
+      wsprintfA(pContainer, "item281pc%02d", pPlayers[i + 1]->uCurrentFace + 1);
+      papredoll_flying_feet[pPlayers[i + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      IsPlayerWearingWatersuit[i + 1] = 0;
     }
-    ++v30;
   }
-  while ( v42 < 4 );
+
   uTextureID_ar_up_up = pIcons_LOD->LoadTexture("ar_up_up", TEXTURE_16BIT_PALETTE);
   uTextureID_ar_up_dn = pIcons_LOD->LoadTexture("ar_up_dn", TEXTURE_16BIT_PALETTE);
   uTextureID_ar_dn_up = pIcons_LOD->LoadTexture("ar_dn_up", TEXTURE_16BIT_PALETTE);
@@ -1779,15 +1760,15 @@
   papredoll_dbrds[5] = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE);
   papredoll_dbrds[3] = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE);
   papredoll_dbrds[1] = pIcons_LOD->LoadTexture("ib-cd5-d", TEXTURE_16BIT_PALETTE);
-  for ( v11 = 0; v11 < 54; ++v11 )// test equipment
+  for ( uint i = 0; i < 54; ++i )// test equipment
   {
-    party_has_equipment[v11] = 0;
-    if ( pParty->pPickedItem.uItemID != v11 + 66 )
+    party_has_equipment[i] = 0;
+    if ( pParty->pPickedItem.uItemID != i + 66 )
     {
-      for ( uint i = 0; i < 4; ++i)
+      for ( uint j = 0; j < 4; ++j)
       {
-        if ( Player_has_item(v11 + 66, &pParty->pPlayers[i], 0) )
-          party_has_equipment[v11] = 1;
+        if ( Player_has_item(i + 66, &pParty->pPlayers[j], 0) )
+          party_has_equipment[i] = 1;
       }
     }
   }
@@ -1815,7 +1796,6 @@
     if (Player_has_item(ITEM_ELVEN_CHAINMAIL, player, 1))             byte_5111F6[16] = 1;
   }
 
-
   for (uint i = 0; i < 2; ++i)
   {
     for ( uint j = 0; j < 5; ++j )//Belt
@@ -1843,7 +1823,7 @@
     if ( _43ED6F_check_party_races(true) )
       papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE);
   }
-  v43 = 0;
+  //v43 = 0;
   for (uint i = 0; i < 4; ++i)
   {
     if ( sub_43EDB9_get_some_race_sex_relation_2(i) )
@@ -1854,11 +1834,11 @@
       for ( v32 = 0; v32 < 13; ++v32 )//simple armor
       {
         GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 0);
-        paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+        paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// armor
         GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 1);
-        paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+        paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// shoulder 1
         GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 2);
-        paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+        paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// shoulder 2
         pItemTXTNum++;
       }
       GetItemTextureFilename(pContainer, 516, i + 1, 0);//artefacts
@@ -1920,11 +1900,11 @@
       GetItemTextureFilename(pContainer, 550, i + 1, 1);
       paperdoll_cloak_collar_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     }
-    else
-    {
-      v26 = v43;
-    }
-    v43 = v26 + 40;
+    //else
+    //{
+      //v26 = v43;
+    //}
+    //v43 = v26 + 40;
   }
 }