changeset 899:393a83dcc359

Paperdoll equipment error fixed
author Ritor1
date Thu, 18 Apr 2013 11:15:54 +0600
parents 10fa7dad1391
children 4dc2252e0b03
files MM7.h UICharacter.cpp mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 5 files changed, 405 insertions(+), 561 deletions(-) [+]
line wrap: on
line diff
--- a/MM7.h	Mon Apr 15 16:36:56 2013 +0600
+++ b/MM7.h	Thu Apr 18 11:15:54 2013 +0600
@@ -152,7 +152,7 @@
 
 /*  372 */
 #pragma pack(push, 1)
-struct stru332
+/*struct stru332
 {
   unsigned int texids[11];
   int texid1;
@@ -160,21 +160,21 @@
   int texid3;
   int texid4;
   int texid5;
-};
+};*/
 #pragma pack(pop)
-extern stru332 stru_511698[];
+extern int paperdoll_helm_texture[2][16];
 
 
 /*  373 */
 #pragma pack(push, 1)
-struct stru333
+/*struct stru333
 {
   unsigned int texids[5];
   int texid1;
   int texid2;
-};
+};*/
 #pragma pack(pop)
-extern stru333 stru_511718[];
+extern int paperdoll_belt_texture[2][7];
 
 
 /*  374 */
--- a/UICharacter.cpp	Mon Apr 15 16:36:56 2013 +0600
+++ b/UICharacter.cpp	Thu Apr 18 11:15:54 2013 +0600
@@ -1188,90 +1188,80 @@
 {
   signed int pSex; // eax@1
   unsigned int v6; // ecx@9
-        int v7; // ecx@10
-        unsigned int pMainHandNum4; // eax@14
-        ItemGen *item_MainHand4; // eax@15
-        int v10; // edx@15
-        unsigned int pX_MainHand4; // edi@15
-        unsigned int v14; // ebx@18
-        Texture *v16; // ebp@27
-        double v17; // st7@29
-        int v18; // edi@30
-        char *v19; // eax@30
-        unsigned int pBowNum; // eax@37
-        ItemGen *itemBow; // edi@38
-        int pX_Bow; // ebx@38
-        double v28; // st7@51
-        char *v30; // eax@54
-        unsigned int pCloakNum; // eax@59
-        ItemGen *item_Cloak; // edx@60
-        int v33; // eax@65
-        int v34; // eax@74
-        int v35; // ebx@74
-        LODFile_IconsBitmaps *v38; // ecx@78
-        Texture *v39; // edi@85
-        double v40; // st7@87
-        int v41; // edi@88
-        unsigned int pArmorNum; // eax@93
-        ItemGen *item_Armor; // edx@94
-        int v45; // eax@98
-        int v46; // eax@106
-        int v48; // ebx@106
-        LODFile_IconsBitmaps *v50; // ecx@110
-        Texture *v51; // edi@117
-        double v52; // st7@119
-        int v53; // edi@120
-        char *v55; // eax@122
-        unsigned int pBootNum; // eax@127
-        ItemGen *item_Boot; // edi@128
-        int v59; // ebx@129
-        int v60; // ecx@132
-        int v61; // eax@134
-        Texture *v63; // edi@145
-        double v64; // st7@147
-        int v65; // edi@148
-        char *v66; // eax@148
-        unsigned int pMainHandNum; // edx@155
-        int v70; // edx@156
-        unsigned int pBeltNum; // eax@160
-        ItemGen *item_Belt; // edi@161
-        int v73; // edx@163
-        int v74; // ecx@168
-        unsigned int v75; // ebx@170
-        Texture *v77; // edi@181
-        double v78; // st7@183
-        int v79; // edi@184
-        char *v80; // eax@184
-        unsigned int pMainHandNum2; // eax@192
-        int v83; // eax@193
-        int pArmorShoulderNum; // eax@197
-        //ItemGen *item_ArmorShoulder; // ecx@197
-        int v87; // eax@197
-        int v88; // eax@198
-        int v89; // eax@199
-        //int v90; // edi@201
-        int v91; // edi@213
-        //int v92; // ebx@213
-        //int v93; // edi@214
-        int v94; // ebx@214
-        int v95; // eax@214
-        char *v96; // edi@226
-        double v97; // st7@228
-        int v98; // edi@229
-        char *v99; // eax@229
-        int v102; // edi@236
-        int pX_ArmorShoulder; // eax@237
-        int pY_ArmorShoulder; // ecx@237
-        int v106; // edx@238
-        int v107; // edx@239
-        int v108; // edx@240
-        int v109; // edi@250
-        char *v110; // edx@250
-        unsigned int pCloakCollarNum; // eax@259
-        ItemGen *item_CloakCollar; // eax@260
-        int v114; // eax@265
-        int v115; // eax@274
-        int v116; // ebx@274
+  int v7; // ecx@10
+  unsigned int pMainHandNum4; // eax@14
+  ItemGen *item_MainHand4; // eax@15
+  int v10; // edx@15
+  unsigned int pX_MainHand4; // edi@15
+  unsigned int v14; // ebx@18
+  Texture *v16; // ebp@27
+  double v17; // st7@29
+  int v18; // edi@30
+  char *v19; // eax@30
+  unsigned int pBowNum; // eax@37
+  ItemGen *itemBow; // edi@38
+  int pX_Bow; // ebx@38
+  double v28; // st7@51
+  char *v30; // eax@54
+  unsigned int pCloakNum; // eax@59
+  ItemGen *item_Cloak; // edx@60
+  int v33; // eax@65
+  int v34; // eax@74
+  int v35; // ebx@74
+  LODFile_IconsBitmaps *v38; // ecx@78
+  Texture *v39; // edi@85
+  double v40; // st7@87
+  int v41; // edi@88
+  unsigned int pArmorNum; // eax@93
+  ItemGen *item_Armor; // edx@94
+  int v45; // eax@98
+  int v48; // ebx@106
+  LODFile_IconsBitmaps *v50; // ecx@110
+  Texture *v51; // edi@117
+  double v52; // st7@119
+  int v53; // edi@120
+  char *v55; // eax@122
+  unsigned int pBootNum; // eax@127
+  ItemGen *item_Boot; // edi@128
+  int v59; // ebx@129
+  int v60; // ecx@132
+  Texture *v63; // edi@145
+  double v64; // st7@147
+  int v65; // edi@148
+  char *v66; // eax@148
+  unsigned int pMainHandNum; // edx@155
+  int v70; // edx@156
+  unsigned int pBeltNum; // eax@160
+  ItemGen *item_Belt; // edi@161
+  int v73; // edx@163
+  unsigned int v75; // ebx@170
+  Texture *v77; // edi@181
+  double v78; // st7@183
+  int v79; // edi@184
+  char *v80; // eax@184
+  unsigned int pMainHandNum2; // eax@192
+  int v83; // eax@193
+  int pArmorShoulderNum; // eax@197
+  int v87; // eax@197
+  int v88; // eax@198
+  int v89; // eax@199
+  int v94; // ebx@214
+  int v95; // eax@214
+  char *v96; // edi@226
+  double v97; // st7@228
+  int v98; // edi@229
+  char *v99; // eax@229
+  int pX_ArmorShoulder; // eax@237
+  int pY_ArmorShoulder; // ecx@237
+  int v106; // edx@238
+  int v107; // edx@239
+  int v108; // edx@240
+  int v109; // edi@250
+  char *v110; // edx@250
+  unsigned int pCloakCollarNum; // eax@259
+  ItemGen *item_CloakCollar; // eax@260
+  int v114; // eax@265
+  int v116; // ebx@274
         double v118; // st7@286
         int v119; // edi@287
         char *v120; // eax@287
@@ -1279,7 +1269,6 @@
         int pHelmNum; // ebx@297
         ItemGen *item_Helm; // edi@298
         int v125; // ecx@303
-        int v126; // eax@312
         unsigned int v127; // ebx@314
         Texture *v129; // edi@325
         double v130; // st7@327
@@ -1342,7 +1331,6 @@
         Texture *a2i; // [sp+14h] [bp-38h]@284
         int pX_Helm; // [sp+14h] [bp-38h]@312
         int pX_MainHand3; // [sp+14h] [bp-38h]@336
-        //int v223; // [sp+1Ch] [bp-30h]@213
         int pBodyComplection; // [sp+24h] [bp-28h]@6
         unsigned int pBowTextureNum; // [sp+2Ch] [bp-20h]@38
         signed int v245; // [sp+34h] [bp-18h]@361
@@ -1498,10 +1486,9 @@
       }
       if ( v33 >= 0 && v33 < 10 )
       {
-        v34 = v33 + 10 * pBodyComplection;
-        v35 = paperdoll_array_511828[0][v34];//Texture_Cloak
-        pX_Cloak = pPaperdoll_BodyX + paperdoll_Cloak[0][v34][0];
-        pY_Cloak = pPaperdoll_BodyY + paperdoll_Cloak[0][v34][1];
+        v35 = paperdoll_cloak_texture[pBodyComplection][v33];//Texture_Cloak
+        pX_Cloak = pPaperdoll_BodyX + paperdoll_Cloak[pBodyComplection][v33][0];
+        pY_Cloak = pPaperdoll_BodyY + paperdoll_Cloak[pBodyComplection][v33][1];
         if ( !(item_Cloak->uAttributes & 0xF0) )
         {
           v41 = v35 + 1;
@@ -1561,10 +1548,9 @@
       }
       if ( v45 >= 0 && v45 < 17 )
       {
-        v46 = 17 * pBodyComplection + v45;
-        pX_Armor = pPaperdoll_BodyX + paperdoll_Armor[0][v46][0];
-        pY_Armor = pPaperdoll_BodyY + paperdoll_Armor[0][v46][1];
-        v48 = paperdoll_array_511290[0][v46][0];//Texture_Armor
+        pX_Armor = pPaperdoll_BodyX + paperdoll_Armor[pBodyComplection][v45][0];
+        pY_Armor = pPaperdoll_BodyY + paperdoll_Armor[pBodyComplection][v45][1];
+        v48 = paperdoll_armor_texture[pBodyComplection][v45][0];
         if ( !(item_Armor->uAttributes & 0xF0) )
         {
           v53 = v48 + 1;
@@ -1605,18 +1591,17 @@
            pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD &&
           !pPlayers[uPlayerID]->pEquipment.uShield) )
         {
-          v91 = 17 * pBodyComplection + v45;
-          v94 = paperdoll_array_511290[0][v91][2];
+          v94 = paperdoll_armor_texture[pBodyComplection][v45][2];
           if ( v94 == pIcons_LOD->FindTextureByName("pending") )
           {
-            v94 = paperdoll_array_511290[0][v91][1];
-            pX_shoulder = pPaperdoll_BodyX + paperdoll_shoulder[0][v91][0];
-            pY_shoulder = pPaperdoll_BodyY + paperdoll_shoulder[0][v91][1];
+            v94 = paperdoll_armor_texture[pBodyComplection][v45][1];
+            pX_shoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0];
+            pY_shoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1];
           }
           else
           {
-            pX_shoulder = pPaperdoll_BodyX + dword_4E5270[v91][0];
-            pY_shoulder = pPaperdoll_BodyY + dword_4E5270[v91][1];
+            pX_shoulder = pPaperdoll_BodyX + dword_4E5270[v45][0];
+            pY_shoulder = pPaperdoll_BodyY + dword_4E5270[v45][1];
           }
           if ( !(item_Armor->uAttributes & 0xF0) )
           {
@@ -1662,12 +1647,11 @@
         }
         else
         {
-          v102 = 17 * pBodyComplection + v45;
-          v94 = paperdoll_array_511290[0][v102][1];
+          v94 = paperdoll_armor_texture[pBodyComplection][v45][1];
           if ( v94 != pIcons_LOD->FindTextureByName("pending") )
           {
-            pX_ArmorShoulder = pPaperdoll_BodyX + paperdoll_shoulder[0][v102][0];
-            pY_ArmorShoulder = pPaperdoll_BodyY + paperdoll_shoulder[0][v102][1];
+            pX_ArmorShoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0];
+            pY_ArmorShoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1];
             if ( !(item_Armor->uAttributes & 0xF0) )
             {
               v109 = v94 + 1;
@@ -1721,18 +1705,17 @@
           break;
         case 512:
           v60 = 6;
-          v59 = dword_511638[pBodyComplection][5];
+          v59 = paperdoll_boots_texture[pBodyComplection][5];
           break;
         default:
           v60 = item_Boot->uItemID - 115;
-          v59 = dword_511638[0][v60 + 6 * pBodyComplection];
+          v59 = paperdoll_boots_texture[pBodyComplection][v60];
           break;
       }
       if ( v60 >= 0 && v60 < 7 )
       {
-        v61 = v60 + 7 * pBodyComplection;
-        pY_Boot = pPaperdoll_BodyY + paperdoll_Boot[0][v61][1];
-        pX_Boot = pPaperdoll_BodyX + paperdoll_Boot[0][v61][0];
+        pX_Boot = pPaperdoll_BodyX + paperdoll_Boot[pBodyComplection][v60][0];
+        pY_Boot = pPaperdoll_BodyY + paperdoll_Boot[pBodyComplection][v60][1];
         if ( !(item_Boot->uAttributes & 0xF0) )
         {
           v65 = v59 + 1;
@@ -1796,13 +1779,12 @@
         }
         if ( v73 >= 0 && v73 < 7 )
         {
-          v74 = 7 * pBodyComplection + v73;
-          pX_Belt = pPaperdoll_BodyX + paperdoll_Belt[0][v74][0];
-          pY_Belt = pPaperdoll_BodyY + paperdoll_Belt[0][v74][1];
+          pX_Belt = pPaperdoll_BodyX + paperdoll_Belt[pBodyComplection][v73][0];
+          pY_Belt = pPaperdoll_BodyY + paperdoll_Belt[pBodyComplection][v73][1];
           if ( IsDwarf != 1 || v73 == 5 )
-            v75 = stru_511718[pBodyComplection].texids[v73];
+            v75 = paperdoll_belt_texture[pBodyComplection][v73];
           else
-           v75 = stru_511718[pBodyComplection - 2].texids[v73];
+           v75 = paperdoll_belt_texture[pBodyComplection - 2][v73];
           if ( !(item_Belt->uAttributes & 0xF0) )
           {
             v79 = v75 + 1;
@@ -1878,10 +1860,9 @@
         }
         if ( v114 >= 0 && v114 < 10 )
         {
-          v115 = v114 + 10 * pBodyComplection;
-          v116 = dword_511788[v115];
-          pX_CloakCollar = pPaperdoll_BodyX + paperdoll_CloakCollar[0][v115][0];
-          pY_CloakCollar = pPaperdoll_BodyY + paperdoll_CloakCollar[0][v115][1];
+          v116 = paperdoll_cloak_collar_texture[pBodyComplection][v114];
+          pX_CloakCollar = pPaperdoll_BodyX + paperdoll_CloakCollar[pBodyComplection][v114][0];
+          pY_CloakCollar = pPaperdoll_BodyY + paperdoll_CloakCollar[pBodyComplection][v114][1];
           if ( v116 != pIcons_LOD->FindTextureByName("pending") )
           {
             if ( !(item_CloakCollar->uAttributes & 0xF0) )
@@ -1953,11 +1934,10 @@
       }
       if ( v125 >= 0 && v125 < 16 )
       {
-        v126 = v125 + 16 * pBodyComplection;
-        pX_Helm = pPaperdoll_BodyX + paperdoll_Helm[v126][0];
-        pY_Helm = pPaperdoll_BodyY + paperdoll_Helm[v126][1];
+        pX_Helm = pPaperdoll_BodyX + paperdoll_Helm[pBodyComplection][v125][0];
+        pY_Helm = pPaperdoll_BodyY + paperdoll_Helm[pBodyComplection][v125][1];
         if ( IsDwarf != 1 || item_Helm->uItemID != 92 )
-          v127 = stru_511698[0].texids[v125 + 16 * pSex];
+          v127 = paperdoll_helm_texture[pSex][v125];
         else
           v127 = papredoll_dbrds[11];
         if ( item_Helm->uAttributes & 0xF0 )
@@ -2458,16 +2438,6 @@
   char *v9; // ebx@16
   char v10; // al@16
   signed int v11; // edi@21
-  Player *pPlayer3; // ebx@23
-  //Player *pPlayer4; // edi@29
-  //int v14; // ebp@29
-  //stru331 *v15; // edi@65
-  //signed int v16; // ebx@66
-  //unsigned int v17; // eax@67
-  //unsigned int *v18; // ecx@67
-  //unsigned int *v19; // ebx@68
-  //int v20; // edi@73
-  int v21; // ebp@73
   unsigned int v22; // eax@76
   int v23; // ecx@76
   unsigned int v24; // eax@78
@@ -2475,19 +2445,13 @@
   int v26; // ebx@79
   unsigned int v27; // eax@80
   int v28; // ecx@80
-  //int result; // eax@83
   int v30; // [sp+10h] [bp-28h]@5
-  //signed int v31; // [sp+10h] [bp-28h]@68
   signed int v32; // [sp+10h] [bp-28h]@75
   signed int v33; // [sp+10h] [bp-28h]@77
   int v34; // [sp+10h] [bp-28h]@79
-  //char *v35; // [sp+14h] [bp-24h]@65
-  int v36; // [sp+14h] [bp-24h]@75
+  int pItemTXTNum; // [sp+14h] [bp-24h]@75
   int v37; // [sp+14h] [bp-24h]@77
   signed int v38; // [sp+14h] [bp-24h]@79
-  //unsigned int *v39; // [sp+18h] [bp-20h]@66
-  int *v40; // [sp+18h] [bp-20h]@73
-  //unsigned int *v41; // [sp+1Ch] [bp-1Ch]@73
   int v42; // [sp+20h] [bp-18h]@6
   int v43; // [sp+20h] [bp-18h]@73
   char pContainer[128]; // [sp+24h] [bp-14h]@12
@@ -2565,216 +2529,152 @@
   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);
-  v11 = 0;
-  do
+  for ( v11 = 0; v11 < 54; ++v11 )// test equipment
   {
-    byte_5111C0[v11] = 0;
+    party_has_equipment[v11] = 0;
     if ( pParty->pPickedItem.uItemID != v11 + 66 )
     {
-      pPlayer3 = pParty->pPlayers;
-      while ( !sub_43EE15_player_has_item(v11 + 66, pPlayer3, 0) )
+      for ( uint i = 0; i < 4; ++i)
       {
-        ++pPlayer3;
-        if ( (signed int)pPlayer3 >= (signed int)pParty->pHirelings )
-          goto LABEL_28;
+        if ( Player_has_item(v11 + 66, &pParty->pPlayers[i], 0) )
+          party_has_equipment[v11] = 1;
       }
     }
-    byte_5111C0[v11] = 1;
-LABEL_28:
-    ++v11;
   }
-  while ( v11 < 54 );
 
   memset(byte_5111F6, 0, 16);
   for (uint i = 0; i < 4; ++i)
   {
     auto player = pParty->pPlayers + i;
 
-    if (sub_43EE15_player_has_item(ITEM_ARTICACT_GOVERNONS_ARMOR, player, 1))    byte_5111F6[0] = 1;
-    if (sub_43EE15_player_has_item(ITEM_ARTIFACT_YORUBA, player, 1))             byte_5111F6[1] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RELIC_HARECS_LEATHER, player, 1))        byte_5111F6[2] = 1;
-    if (sub_43EE15_player_has_item(ITEM_ARTIFACT_LEAGUE_BOOTS, player, 1))       byte_5111F6[3] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RELIC_TALEDONS_HELM, player, 1))         byte_5111F6[4] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RELIC_SCHOLARS_CAP, player, 1))          byte_5111F6[5] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RELIC_PHYNAXIAN_CROWN, player, 1))       byte_5111F6[6] = 1;
-    if (sub_43EE15_player_has_item(ITEM_ARTIFACT_MINDS_EYE, player, 1))          byte_5111F6[7] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RARE_SHADOWS_MASK, player, 1))           byte_5111F6[8] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RILIC_TITANS_BELT, player, 1))           byte_5111F6[9] = 1;
-    if (sub_43EE15_player_has_item(ITEM_ARTIFACT_HEROS_BELT, player, 1))         byte_5111F6[10] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RELIC_TWILIGHT, player, 1))              byte_5111F6[11] = 1;
-    if (sub_43EE15_player_has_item(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, player, 1)) byte_5111F6[12] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RARE_SUN_CLOAK, player, 1))              byte_5111F6[13] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RARE_MOON_CLOAK, player, 1))             byte_5111F6[14] = 1;
-    if (sub_43EE15_player_has_item(ITEM_RARE_VAMPIRES_CAPE, player, 1))          byte_5111F6[15] = 1;
-    if (sub_43EE15_player_has_item(ITEM_ELVEN_CHAINMAIL, player, 1))             byte_5111F6[16] = 1;
+    if (Player_has_item(ITEM_ARTICACT_GOVERNONS_ARMOR, player, 1))    byte_5111F6[0] = 1;
+    if (Player_has_item(ITEM_ARTIFACT_YORUBA, player, 1))             byte_5111F6[1] = 1;
+    if (Player_has_item(ITEM_RELIC_HARECS_LEATHER, player, 1))        byte_5111F6[2] = 1;
+    if (Player_has_item(ITEM_ARTIFACT_LEAGUE_BOOTS, player, 1))       byte_5111F6[3] = 1;
+    if (Player_has_item(ITEM_RELIC_TALEDONS_HELM, player, 1))         byte_5111F6[4] = 1;
+    if (Player_has_item(ITEM_RELIC_SCHOLARS_CAP, player, 1))          byte_5111F6[5] = 1;
+    if (Player_has_item(ITEM_RELIC_PHYNAXIAN_CROWN, player, 1))       byte_5111F6[6] = 1;
+    if (Player_has_item(ITEM_ARTIFACT_MINDS_EYE, player, 1))          byte_5111F6[7] = 1;
+    if (Player_has_item(ITEM_RARE_SHADOWS_MASK, player, 1))           byte_5111F6[8] = 1;
+    if (Player_has_item(ITEM_RILIC_TITANS_BELT, player, 1))           byte_5111F6[9] = 1;
+    if (Player_has_item(ITEM_ARTIFACT_HEROS_BELT, player, 1))         byte_5111F6[10] = 1;
+    if (Player_has_item(ITEM_RELIC_TWILIGHT, player, 1))              byte_5111F6[11] = 1;
+    if (Player_has_item(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, player, 1)) byte_5111F6[12] = 1;
+    if (Player_has_item(ITEM_RARE_SUN_CLOAK, player, 1))              byte_5111F6[13] = 1;
+    if (Player_has_item(ITEM_RARE_MOON_CLOAK, player, 1))             byte_5111F6[14] = 1;
+    if (Player_has_item(ITEM_RARE_VAMPIRES_CAPE, player, 1))          byte_5111F6[15] = 1;
+    if (Player_has_item(ITEM_ELVEN_CHAINMAIL, player, 1))             byte_5111F6[16] = 1;
   }
-  
-  //v14 = 1;
-  //v15 = &stru_511698.field_2C;
-  //v35 = (char *)&stru_511718.field_18;
   for (uint i = 0; i < 2; ++i)
   {
-    //v16 = 0;
-    //v39 = (unsigned int *)(v35 - 24);
-    for (uint j = 0; j < 5; ++j)
+    for ( uint j = 0; j < 5; ++j )//Belt
     {
-      _43C91D_FormItemTextureFilename(pContainer, j + 100, i + 1, 0);
-      //v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      //++v16;
-      //v18 = v39;
-      //++v39;
-      //*v18 = v17;
-      stru_511718[i].texids[j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, j + 100, i + 1, 0);
+      paperdoll_belt_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     }
-    //while ( v16 < 5 );
-    
-    //*(int *)v35 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    _43C91D_FormItemTextureFilename(pContainer, 535, i + 1, 0);
-    stru_511718[i].texid2 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-
-    //v31 = 0;
-    //v19 = (unsigned int *)((char *)v15 - 44);
-    for (uint j = 0; j < 11; ++j)
+    GetItemTextureFilename(pContainer, 535, i + 1, 0);
+    paperdoll_belt_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+    for ( uint j = 0; j < 11; ++j )//Helm
     {
-      _43C91D_FormItemTextureFilename(pContainer, j + 89, i + 1, 0);
-      //*v19 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      //++v19;
-      stru_511698[i].texids[j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, j + 89, i + 1, 0);
+      paperdoll_helm_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     }
-    //while ( v31 < 11 );
-
-    _43C91D_FormItemTextureFilename(pContainer, 521, i + 1, 0);
-    stru_511698[i].texid1 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    _43C91D_FormItemTextureFilename(pContainer, 522, i + 1, 0);
-    stru_511698[i].texid2 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    _43C91D_FormItemTextureFilename(pContainer, 523, i + 1, 0);
-    stru_511698[i].texid3 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    _43C91D_FormItemTextureFilename(pContainer, 532, i + 1, 0);
-    stru_511698[i].texid4 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    _43C91D_FormItemTextureFilename(pContainer, 544, i + 1, 0);
-    stru_511698[i].texid5 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+    GetItemTextureFilename(pContainer, 521, i + 1, 0);
+    paperdoll_helm_texture[i][11] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+    GetItemTextureFilename(pContainer, 522, i + 1, 0);
+    paperdoll_helm_texture[i][12] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+    GetItemTextureFilename(pContainer, 523, i + 1, 0);
+    paperdoll_helm_texture[i][13] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+    GetItemTextureFilename(pContainer, 532, i + 1, 0);
+    paperdoll_helm_texture[i][14] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+    GetItemTextureFilename(pContainer, 544, i + 1, 0);
+    paperdoll_helm_texture[i][15] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     if ( _43ED6F_check_party_races(true) )
       papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE);
-    //v35 += 28;
-    //++v14;
-    //++v15;
   }
-  //while ( v14 - 1 < 2 );
-
   v43 = 0;
-  //v20 = 1;
-  v40 = &dword_511638[0][5];
-  v21 = (int)paperdoll_array_511290[0][13];
-  //v41 = (unsigned int *)&stru_511718.texid1;
   for (uint i = 0; i < 4; ++i)
   {
     if ( sub_43EDB9_get_some_race_sex_relation_2(i) )
     {
-      _43C91D_FormItemTextureFilename(pContainer, 524, i + 1, 0);
-      v32 = 66;
-      stru_511718[i].texid1 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      v36 = v21 - 152;
-      do//armor
-      {
-        _43C91D_FormItemTextureFilename(pContainer, v32, i + 1, 0);
-        *(int *)(v36 - 4) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-        _43C91D_FormItemTextureFilename(pContainer, v32, i + 1, 1);
-        *(int *)v36 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-        _43C91D_FormItemTextureFilename(pContainer, v32, i + 1, 2);
-        v22 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-        v23 = v36;
-        v36 += 12;
-        ++v32;
-        *(int *)(v23 + 4) = v22;
-      }
-      while ( v32 - 66 < 13 );
-      _43C91D_FormItemTextureFilename(pContainer, 516, i + 1, 0);
-      *(int *)v21 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 516, i + 1, 1);
-      *(int *)(v21 + 4) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 516, i + 1, 2);
-      *(int *)(v21 + 8) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 505, i + 1, 0);
-      *(int *)(v21 + 12) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 505, i + 1, 1);
-      *(int *)(v21 + 16) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 505, i + 1, 2);
-      *(int *)(v21 + 20) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 504, i + 1, 0);
-      *(int *)(v21 + 24) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 504, i + 1, 1);
-      *(int *)(v21 + 28) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 504, i + 1, 2);
-      *(int *)(v21 + 32) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 533, i + 1, 0);
-      *(int *)(v21 + 36) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 533, i + 1, 1);
-      *(int *)(v21 + 40) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 533, i + 1, 2);
-      *(int *)(v21 + 44) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      v33 = 0;
-      v37 = (int)(v40 - 5);
-      do
+      GetItemTextureFilename(pContainer, 524, i + 1, 0);
+      paperdoll_belt_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Titans belt
+      pItemTXTNum = 66;
+      for ( v32 = 0; v32 < 13; ++v32 )//simple armor
       {
-        _43C91D_FormItemTextureFilename(pContainer, v33 + 115, i + 1, 0);
-        v24 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-        ++v33;
-        v25 = v37;
-        v37 += 4;
-        *(int *)v25 = v24;
+        GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 0);
+        paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+        GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 1);
+        paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+        GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 2);
+        paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+        pItemTXTNum++;
       }
-      while ( v33 < 5 );
-      _43C91D_FormItemTextureFilename(pContainer, 512, i + 1, 0);
-      v26 = v43;
-      v38 = 105;
-      v34 = v43;
-      *v40 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      do
+      GetItemTextureFilename(pContainer, 516, i + 1, 0);//artefacts
+      paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 516, i + 1, 1);
+      paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 516, i + 1, 2);
+      paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 505, i + 1, 0);
+      paperdoll_armor_texture[i][v32 + 1][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 505, i + 1, 1);
+      paperdoll_armor_texture[i][v32 + 1][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 505, i + 1, 2);
+      paperdoll_armor_texture[i][v32 + 1][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 504, i + 1, 0);
+      paperdoll_armor_texture[i][v32 + 2][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 504, i + 1, 1);
+      paperdoll_armor_texture[i][v32 + 2][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 504, i + 1, 2);
+      paperdoll_armor_texture[i][v32 + 2][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 533, i + 1, 0);
+      paperdoll_armor_texture[i][v32 + 3][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 533, i + 1, 1);
+      paperdoll_armor_texture[i][v32 + 3][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 533, i + 1, 2);
+      paperdoll_armor_texture[i][v32 + 3][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      for ( v33 = 0; v33 < 5; ++v33 )//boots
       {
-        _43C91D_FormItemTextureFilename(pContainer, v38, i + 1, 0);
-        *(int *)((char *)paperdoll_array_511828 + v34) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-        _43C91D_FormItemTextureFilename(pContainer, v38, i + 1, 1);
-        v27 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-        v28 = v34;
-        v34 += 4;
-        ++v38;
-        *(int *)((char *)dword_511788 + v28) = v27;
+        GetItemTextureFilename(pContainer, v33 + 115, i + 1, 0);
+        paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      }
+      GetItemTextureFilename(pContainer, 512, i + 1, 0);
+      paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      for ( v38 = 0; v38 < 5; ++v38 )//Cloak
+      {
+        GetItemTextureFilename(pContainer, v38 + 105, i + 1, 0);
+        paperdoll_cloak_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+        GetItemTextureFilename(pContainer, v38 + 105, i + 1, 1);
+        paperdoll_cloak_collar_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
       }
-      while ( v38 - 105 < 5 );
-      _43C91D_FormItemTextureFilename(pContainer, 525, i + 1, 0);
-      *(int *)((char *)&paperdoll_array_511828[0][5] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 530, i + 1, 0);
-      *(int *)((char *)&paperdoll_array_511828[0][6] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 547, i + 1, 0);
-      *(int *)((char *)&paperdoll_array_511828[0][7] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 548, i + 1, 0);
-      *(int *)((char *)&paperdoll_array_511828[0][8] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 550, i + 1, 0);
-      *(int *)((char *)&paperdoll_array_511828[0][9] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 525, i + 1, 1);
-      *(int *)((char *)&dword_51179C + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 530, i + 1, 1);
-      *(int *)((char *)&dword_5117A0 + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 547, i + 1, 1);
-      *(int *)((char *)&dword_5117A4 + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 548, i + 1, 1);
-      *(int *)((char *)&dword_5117A8 + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      _43C91D_FormItemTextureFilename(pContainer, 550, i + 1, 1);
-      *(int *)((char *)&dword_5117AC + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 525, i + 1, 0);
+      paperdoll_cloak_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 530, i + 1, 0);
+      paperdoll_cloak_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 547, i + 1, 0);
+      paperdoll_cloak_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 548, i + 1, 0);
+      paperdoll_cloak_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 550, i + 1, 0);
+      paperdoll_cloak_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 525, i + 1, 1);
+      paperdoll_cloak_collar_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 530, i + 1, 1);
+      paperdoll_cloak_collar_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 547, i + 1, 1);
+      paperdoll_cloak_collar_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 548, i + 1, 1);
+      paperdoll_cloak_collar_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      GetItemTextureFilename(pContainer, 550, i + 1, 1);
+      paperdoll_cloak_collar_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     }
     else
     {
       v26 = v43;
     }
-    //v41 += 7;
-    v40 += 6;
-    v21 += 204;
-    //++v20;
-    //result = v20 - 1;
     v43 = v26 + 40;
   }
-  //while ( v20 - 1 < 4 );
-  //return result;
 }
 
 //----- (00419401) --------------------------------------------------------
--- a/mm7_5.cpp	Mon Apr 15 16:36:56 2013 +0600
+++ b/mm7_5.cpp	Thu Apr 18 11:15:54 2013 +0600
@@ -5989,7 +5989,7 @@
 }
 
 //----- (0043C91D) --------------------------------------------------------
-int __fastcall _43C91D_FormItemTextureFilename(char *a1, signed int a2, int a3, int a4)
+int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder)
 {
   int result; // eax@2
   char v5; // zf@3
@@ -5999,195 +5999,167 @@
   signed int v9; // [sp-4h] [bp-10h]@69
 
   result = 0; //BUG   fn is void
-  if ( a2 <= 500 )
+  if ( item_id <= 500 )
   {
     //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0;
-    v5 = byte_5111C0[(a2 - 100) + 32 + 2] == 0;
-LABEL_21:
+    v5 = party_has_equipment[(item_id - 100) + 32 + 2] == 0;
+    switch ( item_id )
+    {
+      case 516:
+        v5 = byte_5111F6[2] == 0;
+        break;
+      case 505:
+        v5 = byte_5111F6[1] == 0;
+        break;
+      case 504:
+        v5 = byte_5111F6[0] == 0;
+        break;
+      case 533:
+        v5 = byte_5111F6[16] == 0;
+        break;
+      case 512:
+        v5 = byte_5111F6[3] == 0;
+        break;
+      case 521:
+        v5 = byte_5111F6[4] == 0;
+        break;
+      case 522:
+        v5 = byte_5111F6[5] == 0;
+        break;
+      case 523:
+        v5 = byte_5111F6[6] == 0;
+        break;
+      case 532:
+        v5 = byte_5111F6[7] == 0;
+        break;
+      case 544:
+        v5 = byte_5111F6[8] == 0;
+        break;
+      case 524:
+        v5 = byte_5111F6[9] == 0;
+        break;
+      case 535:
+        v5 = byte_5111F6[10] == 0;
+        break;
+      case 525:
+        v5 = byte_5111F6[11] == 0;
+        break;
+      case 530:
+        v5 = byte_5111F6[12] == 0;
+        break;
+      case 547:
+        v5 = byte_5111F6[13] == 0;
+        break;
+      case 548:
+        v5 = byte_5111F6[14] == 0;
+        break;
+      case 550:
+        v5 = byte_5111F6[15] == 0;
+        break;
+      default:
+        break;
+    }
     if ( v5 )
       return result;
     result = 516;
-    if ( a2 < 66 || a2 > 78 )
-    {
-      if ( a2 == 516 )
-        goto LABEL_79;
-      if ( a2 != 504 && a2 != 505 && a2 != 533 )
-      {
-        if ( (a2 < 100 || a2 > 104) && a2 != 524 && a2 != 535 )
-        {
-          if ( a2 >= 115 && a2 <= 119 || a2 == 512 )
-          {
-            if ( a2 == 512 )
-              a2 = 312;
-            goto LABEL_87;
-          }
-          if ( (a2 < 89 || a2 > 99) && a2 != 521 && a2 != 522 && a2 != 523 && a2 != 532 && a2 != 544 )
+    if ( item_id < 66 || item_id > 78 )
+    {
+      if ( item_id == 516 )
+      {
+        if ( !shoulder )
+          return sprintf(pOut, "item%3.3dv%d", 234, index);
+        if ( shoulder == 1 )
+          return sprintf(pOut, "item%3.3dv%da1", 234, index);
+        if ( shoulder == 2 )
+          return sprintf(pOut, "item%3.3dv%da2", 234, index);
+      }
+      if ( item_id != 504 && item_id != 505 && item_id != 533 )
+      {
+        if ( (item_id < 100 || item_id > 104) && item_id != 524 && item_id != 535 )
+        {
+          if ( item_id >= 115 && item_id <= 119 || item_id == 512 )
+          {
+            if ( item_id == 512 )
+              item_id = 312;
+            return sprintf(pOut, "item%3.3dv%d", item_id, index);
+          }
+          if ( (item_id < 89 || item_id > 99) && item_id != 521 && item_id != 522 && item_id != 523 && item_id != 532 && item_id != 544 )
           {
             result = 525;
-            if ( (a2 < 105 || a2 > 109) && a2 != 525 && a2 != 530 && a2 != 547 && a2 != 548 && a2 != 550 )
+            if ( (item_id < 105 || item_id > 109) && item_id != 525 && item_id != 530 && item_id != 547 && item_id != 548 && item_id != 550 )
               return result;
-            switch ( a2 )
+            switch ( item_id )
             {
               case 525:
-                a2 = 325;
+                item_id = 325;
                 break;
               case 530:
-                a2 = 330;
+                item_id = 330;
                 break;
               case 547:
-                a2 = 347;
+                item_id = 347;
                 break;
               case 548:
-                a2 = 348;
+                item_id = 348;
                 break;
               case 550:
-                a2 = 350;
+                item_id = 350;
                 break;
             }
-            v8 = a3;
-            v7 = a2;
-            if ( !a4 )
-              goto LABEL_88;
-LABEL_91:
-            v6 = "item%3.3dv%da1";
-            return sprintf(a1, v6, v7, v8);
-          }
-          if ( a2 == 521 )
-          {
-            a2 = 239;
-            goto LABEL_87;
-          }
-          if ( a2 == 522 )
-          {
-            a2 = 240;
-            goto LABEL_87;
-          }
-          if ( a2 == 523 )
-          {
-            a2 = 241;
-            goto LABEL_87;
-          }
-          if ( a2 != 532 )
-          {
-            if ( a2 == 544 )
-              a2 = 344;
-            goto LABEL_87;
-          }
-          v9 = 93;
-          goto LABEL_70;
-        }
-        if ( a2 == 524 )
-        {
-          a2 = 324;
-          goto LABEL_87;
-        }
-        if ( a2 == 535 )
-        {
-          v9 = 104;
-LABEL_70:
-          a2 = v9;
-        }
-LABEL_87:
-        v8 = a3;
-        v7 = a2;
-LABEL_88:
-        v6 = "item%3.3dv%d";
-        return sprintf(a1, v6, v7, v8);
-      }
-    }
-    if ( a2 != 516 )
-    {
-      switch ( a2 )
+            if ( !shoulder )
+              return sprintf(pOut, "item%3.3dv%d", item_id, index);
+            return sprintf(pOut, "item%3.3dv%da1", item_id, index);
+          }
+          if ( item_id == 521 )
+            return sprintf(pOut, "item%3.3dv%d", 239, index);
+          if ( item_id == 522 )
+            return sprintf(pOut, "item%3.3dv%d", 240, index);
+          if ( item_id == 523 )
+            return sprintf(pOut, "item%3.3dv%d", 241, index);
+          if ( item_id != 532 )
+          {
+            if ( item_id == 544 )
+              item_id = 344;
+            return sprintf(pOut, "item%3.3dv%d", item_id, index);
+          }
+          return sprintf(pOut, "item%3.3dv%d", 93, index);
+        }
+        if ( item_id == 524 )
+          return sprintf(pOut, "item%3.3dv%d", 324, index);
+        if ( item_id == 535 )
+          item_id = 104;
+        return sprintf(pOut, "item%3.3dv%d", item_id, index);
+      }
+    }
+    if ( item_id != 516 )
+    {
+      switch ( item_id )
       {
         case 504:
-          a2 = 235;
+          item_id = 235;
           break;
         case 505:
-          a2 = 236;
+          item_id = 236;
           break;
         case 533:
-          a2 = 73;
+          item_id = 73;
           break;
       }
-LABEL_86:
-      if ( a4 )
-      {
-        if ( a4 != 1 )
-        {
-          if ( a4 != 2 )
-            return result;
-          v8 = a3;
-          v7 = a2;
-          v6 = "item%3.3dv%da2";
-          return sprintf(a1, v6, v7, v8);
-        }
-        v8 = a3;
-        v7 = a2;
-        goto LABEL_91;
-      }
-      goto LABEL_87;
-    }
-LABEL_79:
-    a2 = 234;
-    goto LABEL_86;
-  }
-  result = a2 - 504;
-  switch ( a2 )
-  {
-    case 516:
-      v5 = byte_5111F6[2] == 0;
-      goto LABEL_21;
-    case 505:
-      v5 = byte_5111F6[1] == 0;
-      goto LABEL_21;
-    case 504:
-      v5 = byte_5111F6[0] == 0;
-      goto LABEL_21;
-    case 533:
-      v5 = byte_5111F6[16] == 0;
-      goto LABEL_21;
-    case 512:
-      v5 = byte_5111F6[3] == 0;
-      goto LABEL_21;
-    case 521:
-      v5 = byte_5111F6[4] == 0;
-      goto LABEL_21;
-    case 522:
-      v5 = byte_5111F6[5] == 0;
-      goto LABEL_21;
-    case 523:
-      v5 = byte_5111F6[6] == 0;
-      goto LABEL_21;
-    case 532:
-      v5 = byte_5111F6[7] == 0;
-      goto LABEL_21;
-    case 544:
-      v5 = byte_5111F6[8] == 0;
-      goto LABEL_21;
-    case 524:
-      v5 = byte_5111F6[9] == 0;
-      goto LABEL_21;
-    case 535:
-      v5 = byte_5111F6[10] == 0;
-      goto LABEL_21;
-    case 525:
-      v5 = byte_5111F6[11] == 0;
-      goto LABEL_21;
-    case 530:
-      v5 = byte_5111F6[12] == 0;
-      goto LABEL_21;
-    case 547:
-      v5 = byte_5111F6[13] == 0;
-      goto LABEL_21;
-    case 548:
-      v5 = byte_5111F6[14] == 0;
-      goto LABEL_21;
-    case 550:
-      v5 = byte_5111F6[15] == 0;
-      goto LABEL_21;
-    default:
-      return result;
-  }
+      if ( !shoulder )
+        return sprintf(pOut, "item%3.3dv%d", item_id, index);
+      if ( shoulder == 1 )
+        return sprintf(pOut, "item%3.3dv%da1", item_id, index);
+      if ( shoulder == 2 )
+        return sprintf(pOut, "item%3.3dv%da2", item_id, index);
+    }
+    if ( !shoulder )
+      return sprintf(pOut, "item%3.3dv%d", 234, index);
+    if ( shoulder == 1 )
+      return sprintf(pOut, "item%3.3dv%da1", 234, index);
+    if ( shoulder == 2 )
+      return sprintf(pOut, "item%3.3dv%da2", 234, index);
+  }
+  result = item_id - 504;
   return result;
 }
 
@@ -6278,55 +6250,28 @@
 // A750D8: using guessed type __int64 qword_A750D8;
 
 //----- (0043EE15) --------------------------------------------------------
-bool __fastcall sub_43EE15_player_has_item(unsigned int uItemID, Player *pPlayer, char a3)
-{
-  bool result; // eax@0
-  signed int v4; // edi@3
-  int *v5; // esi@3
-  signed int v6; // edi@7
-  bool *v7; // esi@7
-
+bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3)
+{
   if ( !a3 || pParty->pPickedItem.uItemID != uItemID )
   {
-    v4 = 0;
-    v5 = pPlayer->pInventoryIndices;
-    while ( 1 )
-    {
-      if ( *v5 )
-      {
-        result = 9 * *v5;
-        if ( *(int *)&pPlayer->pInventoryItems[*v5-1] == uItemID )
-          break;
-      }
-      ++v4;
-      ++v5;
-      if ( v4 >= 126 )
-      {
-        v6 = 0;
-        v7 = (bool *)&pPlayer->pEquipment;
-        while ( 1 )
-        {
-          result = *v7;
-          if ( *v7 )
-          {
-            result *= 9;
-            if ( *(int *)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] == uItemID )
-              break;
-          }
-          ++v6;
-          ++v7;
-          if ( v6 >= 16 )
-          {
-            LOBYTE(result) = 0;
-            return result;
-          }
-        }
-        break;
-      }
-    }
-  }
-  LOBYTE(result) = 1;
-  return result;
+    for ( uint i = 0; i < 126; ++i )
+    {
+      if ( pPlayer->pInventoryIndices[i] > 0 )
+      {
+        if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pInventoryIndices[i] - 1].uItemID == uItemID )
+          return true;
+      }
+    }
+    for ( uint i = 0; i < 16; ++i )
+    {
+      if ( pPlayer->pEquipment.pIndices[i] )
+      {
+        if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID )
+          return true;
+      }
+    }
+  }
+  return false;
 }
 
 //----- (0043EE77) --------------------------------------------------------
@@ -6347,7 +6292,7 @@
       v5 = 604;
       while ( 1 )
       {
-        result = sub_43EE15_player_has_item(v5, *pPlayers, 0);
+        result = Player_has_item(v5, *pPlayers, 0);
         if ( !result )
           break;
         result = v6->pEquipment.uArmor;
@@ -6363,7 +6308,7 @@
     }
     goto LABEL_6;
   }
-  result = sub_43EE15_player_has_item(604u, ::pPlayers[a1], 0);
+  result = Player_has_item(604u, ::pPlayers[a1], 0);
   if ( !result
     || (result = v2->pEquipment.uArmor) == 0
     || (result *= 9, *(int *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v3) )
--- a/mm7_data.cpp	Mon Apr 15 16:36:56 2013 +0600
+++ b/mm7_data.cpp	Thu Apr 18 11:15:54 2013 +0600
@@ -287,8 +287,8 @@
   0x83, 0xD8,  0x1D, 0xBA,  0x58, 0x77,  0, 0,  0, 0,  0, 0,  0, 0,        0, 0,  0, 0,  0, 0,  0, 0,  0, 0,  0, 0,  0, 0,  0, 0,  0, 0,
   0x7B, 0xD8,  0x23, 0xB8,  0x62, 0x77,  0, 0,  0, 0,  0, 0,  0, 0,        0, 0,  0, 0,  0, 0,  0, 0,  0, 0,  0, 0,  0, 0,  0, 0,  0, 0,
 };
-stru332 stru_511698[2];
-stru333 stru_511718[4];
+int paperdoll_helm_texture[2][16];
+int paperdoll_belt_texture[2][7];
 stru334 array_4E2940[26];
 stru348 stru_4E1890[13];
 
@@ -728,15 +728,12 @@
   0x3B, 0xD5,  0x37, 0xD2,  0x31, 0xD5,  0x39, 0xD6,  0x37, 0xD8,  0x37, 0xD1,  0x37, 0xD8,
   0x42, 0xD2,  0x3F, 0xD0,  0x3B, 0xD7,  0x3C, 0xD5,  0x3B, 0xD6,  0x3E, 0xCF,  0x36, 0xD6,
 };
-int paperdoll_Helm[64][2] = //0x4E58D0
+int paperdoll_Helm[4][16][2] = //0x4E58D0
 {
-  0x3E, 0x1F,  0x41, 0x2C,  0x37, 0x2F,  0x31, 0x32,  0x37, 0x2A,  0x39, 0x28,  0x36, 0x34,  0x41, 0x38,  0x40, 0x31,  0x40, 0x21,
-  0x40, 0x31,  0x3C, 0x33,  0x3D, 0x24,  0x3A, 0x1A,  0x37, 0x2A,  0x41, 0x48,  0x41, 0x1E,  0x42, 0x2B,  0x37, 0x2F,  0x34, 0x30,
-  0x39, 0x29,  0x3A, 0x26,  0x36, 0x34,  0x41, 0x37,  0x42, 0x32,  0x40, 0x21,  0x40, 0x31,  0x40, 0x2F,  0x3E, 0x22,  0x3B, 0x1A,
-  0x39, 0x29,  0x42, 0x47,  0x3F, 0x47,  0x41, 0x56,  0x37, 0x59,  0x32, 0x5E,  0x37, 0x58,  0x39, 0x54,  0x34, 0x61,  0x40, 0x61,
-  0x41, 0x5D,  0x3E, 0x4F,  0x3E, 0x5B,  0x3D, 0x5B,  0x3F, 0x4C,  0x3B, 0x45,  0x37, 0x58,  0x41, 0x74,  0x45, 0x45,  0x46, 0x54,
-  0x3A, 0x55,  0x38, 0x58,  0x3C, 0x54,  0x3F, 0x52,  0x39, 0x5B,  0x45, 0x5C,  0x47, 0x5C,  0x44, 0x4B,  0x44, 0x57,  0x43, 0x55,
-  0x44, 0x4A,  0x3E, 0x45,  0x3C, 0x54,  0x47, 0x70,
+  0x3E, 0x1F,  0x41, 0x2C,  0x37, 0x2F,  0x31, 0x32,  0x37, 0x2A,  0x39, 0x28,  0x36, 0x34,  0x41, 0x38,  0x40, 0x31,  0x40, 0x21,  0x40, 0x31,  0x3C, 0x33,  0x3D, 0x24,  0x3A, 0x1A,  0x37, 0x2A,  0x41, 0x48,
+  0x41, 0x1E,  0x42, 0x2B,  0x37, 0x2F,  0x34, 0x30,  0x39, 0x29,  0x3A, 0x26,  0x36, 0x34,  0x41, 0x37,  0x42, 0x32,  0x40, 0x21,  0x40, 0x31,  0x40, 0x2F,  0x3E, 0x22,  0x3B, 0x1A,  0x39, 0x29,  0x42, 0x47,
+  0x3F, 0x47,  0x41, 0x56,  0x37, 0x59,  0x32, 0x5E,  0x37, 0x58,  0x39, 0x54,  0x34, 0x61,  0x40, 0x61,  0x41, 0x5D,  0x3E, 0x4F,  0x3E, 0x5B,  0x3D, 0x5B,  0x3F, 0x4C,  0x3B, 0x45,  0x37, 0x58,  0x41, 0x74,
+  0x45, 0x45,  0x46, 0x54,  0x3A, 0x55,  0x38, 0x58,  0x3C, 0x54,  0x3F, 0x52,  0x39, 0x5B,  0x45, 0x5C,  0x47, 0x5C,  0x44, 0x4B,  0x44, 0x57,  0x43, 0x55,  0x44, 0x4A,  0x3E, 0x45,  0x3C, 0x54,  0x47, 0x70,
 };
 //int dword_4E58D4[777]; // HelmY 31
 int pPaperdoll_Beards[4] = //0x4E5AD0
@@ -1643,25 +1640,26 @@
 Vec3_int_ layingitem_vel_50FDFC;
 char pStartingMapName[777]; // idb
 unsigned __int8 IsPlayerWearingWatersuit[5];
-char byte_5111C0[54];
+char party_has_equipment[54];
 char byte_5111F6[16];
 unsigned int papredoll_dbrds[16];
 unsigned int papredoll_drhs[4];
 unsigned int papredoll_dlhus[4];
 unsigned int papredoll_dlhs[4];
 unsigned int papredoll_dbods[5];
-int paperdoll_array_511290[4][17][3];
+int paperdoll_armor_texture[4][17][3];
+//int paperdoll_array_51132C[165];
 unsigned int papredoll_dlaus[5];
 unsigned int papredoll_dlads[4];
 int papredoll_flying_feet[777]; // idb
-int dword_511638[4][6];
-int dword_511788[777]; // weak
-int dword_51179C; // weak
-int dword_5117A0; // weak
-int dword_5117A4; // weak
-int dword_5117A8; // weak
-int dword_5117AC; // weak
-int paperdoll_array_511828[4][10];
+int paperdoll_boots_texture[4][6];//0x511638
+int paperdoll_cloak_collar_texture[4][10]; // weak
+//int dword_51179C; // weak
+//int dword_5117A0; // weak
+//int dword_5117A4; // weak
+//int dword_5117A8; // weak
+//int dword_5117AC; // weak
+int paperdoll_cloak_texture[4][10];
 int bRingsShownInCharScreen; // weak
 int _unused000; // weak
 
--- a/mm7_data.h	Mon Apr 15 16:36:56 2013 +0600
+++ b/mm7_data.h	Thu Apr 18 11:15:54 2013 +0600
@@ -609,7 +609,7 @@
 extern int paperdoll_CloakCollar[4][10][2];
 //extern int dword_4E56B4; // weak
 extern int paperdoll_Belt[4][7][2];
-extern int paperdoll_Helm[64][2]; // weak
+extern int paperdoll_Helm[4][16][2];
 //extern int dword_4E58D4[]; // weak
 extern int pPaperdoll_Beards[4]; // weak
 extern int dword_4E5AD4[]; // weak
@@ -1088,25 +1088,26 @@
 extern Vec3_int_ layingitem_vel_50FDFC;
 extern char pStartingMapName[]; // idb
 extern unsigned __int8 IsPlayerWearingWatersuit[5];
-extern char byte_5111C0[54];
+extern char party_has_equipment[54];
 extern char byte_5111F6[];
 extern unsigned int papredoll_dbrds[16];
 extern unsigned int papredoll_drhs[4];
 extern unsigned int papredoll_dlhus[4];
 extern unsigned int papredoll_dlhs[4];
 extern unsigned int papredoll_dbods[5];
-extern int paperdoll_array_511290[4][17][3];
+extern int paperdoll_armor_texture[4][17][3];//0x511290
+//extern int paperdoll_array_51132C[165];
 extern unsigned int papredoll_dlaus[5];
 extern unsigned int papredoll_dlads[4];
 extern int papredoll_flying_feet[]; // idb
-extern int dword_511638[4][6];
-extern int dword_511788[]; // weak
-extern int dword_51179C; // weak
-extern int dword_5117A0; // weak
-extern int dword_5117A4; // weak
-extern int dword_5117A8; // weak
-extern int dword_5117AC; // weak
-extern int paperdoll_array_511828[4][10];
+extern int paperdoll_boots_texture[4][6];
+extern int paperdoll_cloak_collar_texture[4][10]; // weak
+//extern int dword_51179C; // weak
+//extern int dword_5117A0; // weak
+//extern int dword_5117A4; // weak
+//extern int dword_5117A8; // weak
+//extern int dword_5117AC; // weak
+extern int paperdoll_cloak_texture[4][10];
 extern int bRingsShownInCharScreen; // weak
 extern int _unused000; // weak
 
@@ -1733,12 +1734,12 @@
 // int __cdecl crt_deconstruct_43B9E3();
 int __stdcall DirectInputMouse_enumerator(int, int); // weak
 void CharacterUI_LoadPaperdollTextures();
-int __fastcall _43C91D_FormItemTextureFilename(char *a1, signed int a2, int a3, int a4);
+int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder);
 void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID); // idb
 void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID); // idb
 bool _43ED6F_check_party_races(bool b);
 bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int _this);
-bool __fastcall sub_43EE15_player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3);
+bool __fastcall Player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3);
 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1);
 void __fastcall WetsuitOn(unsigned int uPlayerID); // idb
 unsigned int __fastcall WetsuitOff(unsigned int uPlayerID);