changeset 1468:d88df3a2369d

Merge
author Nomad
date Mon, 26 Aug 2013 20:32:55 +0200
parents 0a7ceb4b25b7 (current diff) ec79ee6d44ce (diff)
children bba0944c9b27
files
diffstat 12 files changed, 314 insertions(+), 312 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/Actor.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -2084,8 +2084,8 @@
     {
       if ( pParty->uFine )
       {
-        if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_guilds_member_bits, 1) )
-          _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_guilds_member_bits, 1, 1u);
+        if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_achieved_awards_bits, 1) )
+          _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_achieved_awards_bits, 1, 1u);
       }
       ++ppPlayers;
     }
--- a/Arcomage.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/Arcomage.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -3932,7 +3932,7 @@
    
     for (int i=0; i<4; ++i  )
     {
-      v11 = (char *)&pParty->pPlayers[i]._guilds_member_bits;
+      v11 = (char *)&pParty->pPlayers[i]._achieved_awards_bits;
       if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v11, 1) )
         _449B7E_toggle_bit((unsigned char *)v11, PLAYER_GUILD_BITS__ARCOMAGE_WIN, 1);
       
@@ -3946,7 +3946,7 @@
   {
   for (int i=0; i<4; ++i  )
       {
-      v12 = (char *)&pParty->pPlayers[i]._guilds_member_bits;
+      v12 = (char *)&pParty->pPlayers[i]._achieved_awards_bits;
       if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v12, 1) )
         _449B7E_toggle_bit((unsigned char *)v12, PLAYER_GUILD_BITS__ARCOMAGE_LOSE, 1);
     }
--- a/LOD.h	Mon Aug 26 20:32:08 2013 +0200
+++ b/LOD.h	Mon Aug 26 20:32:55 2013 +0200
@@ -168,8 +168,9 @@
   inline struct Texture *GetTexture(int idx)
   {
     assert(idx < 1000);
-    if (idx == -1) return nullptr; // we need to return dummy texture here
-    return pTextures + idx;
+    if (idx == -1) 
+      return nullptr; // we need to return dummy texture here
+    return &pTextures[idx];
   }
 
 
--- a/NPC.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/NPC.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -1563,7 +1563,7 @@
   gold_transaction_amount = price_for_membership[pEventCode];
   if ( pPlayers[uActiveCharacter]->CanAct() )
   {
-    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) )
+    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, dword_F8B1AC_award_bit_number) )
     {
       return pNPCTopics[dialogue_base+13].pText;
     }
--- a/Player.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/Player.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -641,13 +641,13 @@
     switch ( uClass )
     {
       case 0x1Au:
-        return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 65));
+        return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65));
       case 0x1Bu:
-        return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 67));
+        return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67));
       case 0x22u:
-        return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 77));
+        return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77));
       case 0x23u:
-        return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 79));
+        return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79));
         break;
       default:
         assert("Should not be able to get here" && false);
@@ -5406,7 +5406,7 @@
   uExperience = 251 + rand() % 100;
   uBirthYear = 1147 - rand() % 6;
   memset(pActiveSkills, 0, sizeof(pActiveSkills));
-  memset(_guilds_member_bits, 0, 64);
+  memset(_achieved_awards_bits, 0, 64);
   memset(&spellbook, 0, sizeof(PlayerSpells));
 
   for (uint i = 0; i < 37; ++i)
@@ -6714,7 +6714,7 @@
           goto _j_cmp_against_arg;
         case VAR_Award:
           test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8;
-          our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8];
+          our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8];
           if ( !((unsigned __int8)test_bit_value & our_bit_value) )
             return true;
           return false;
@@ -7176,7 +7176,7 @@
         return;
       case VAR_Award:
         if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & 
-			  pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8])
+			  pPlayers[currPlayerId + 1]->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8])
               //&& dword_723E80_award_related[2 * a3] )
 		    && pAwards[var_value].pText )
         {
@@ -7184,7 +7184,7 @@
           DrawPlayerBuffAnimBasedOnCondition(currPlayerId);
           PlaySoundBasedOnCondition(currPlayerId);
         }
-        _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, var_value, 1u);
+        _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, var_value, 1u);
         return;
       case VAR_Experience:
         this->uExperience = var_value;
@@ -7598,7 +7598,7 @@
               return;
             case VAR_Award:
               v13 = pPlayers[uPlayerIdx + 1];
-              if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) 
+              if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) 
              
 				&& pAwards[val].pText )
               {
@@ -7607,7 +7607,7 @@
                 v3 = 1;
                 v14->PlaySound(SPEECH_96, 0);
               }
-              v15 = (char *)v4->_guilds_member_bits;
+              v15 = (char *)v4->_achieved_awards_bits;
               goto LABEL_44;
             case VAR_Experience:
               v16 = __CFADD__(val, LODWORD(Dst->uExperience));
@@ -8233,7 +8233,7 @@
           this->sAgeModifier -= (signed __int16)pValue;
           return result;
         case VAR_Award:
-          _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0);
+          _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0);
           return result;
         case VAR_Experience:
           v12 = (char *)&this->uExperience;
--- a/Player.h	Mon Aug 26 20:32:08 2013 +0200
+++ b/Player.h	Mon Aug 26 20:32:55 2013 +0200
@@ -697,7 +697,7 @@
     };
     unsigned __int16 pActiveSkills[37];
   };
-  unsigned char _guilds_member_bits[64];
+  unsigned char _achieved_awards_bits[64];
   PlayerSpells spellbook;
   char field__1F5[2]; // used to be [31]
   int pure_luck_used;      
--- a/UI/Books/UISpellBook.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/UI/Books/UISpellBook.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -97,7 +97,7 @@
   {
     for ( uint i = 1; i <= 11; ++i )
     {
-      if (player->_guilds_member_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] )
+      if (player->_achieved_awards_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] )
       {
         if ( SBPageSSpellsTextureList[i] != PendingTexture )
         {
--- a/UI/UICharacter.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/UI/UICharacter.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -194,7 +194,7 @@
 unsigned int papredoll_dlhus[4];
 unsigned int papredoll_dlhs[4];
 unsigned int papredoll_dbods[5];
-int paperdoll_armor_texture[4][17][3];
+int paperdoll_armor_texture[4][17][3];//0x511294
 //int paperdoll_array_51132C[165];
 unsigned int papredoll_dlaus[5];
 unsigned int papredoll_dlads[4];
@@ -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] =
@@ -572,7 +579,7 @@
 //----- (0041A000) --------------------------------------------------------
 void CharacterUI_AwardsTab_Draw(Player *player)
 {
-  unsigned int result; // eax@1
+  int items_per_page; // eax@1
   char *v6; // ebx@15
   char Source[100]; // [sp+Ch] [bp-C4h]@1
   GUIWindow awards_window; // [sp+70h] [bp-60h]@1
@@ -584,7 +591,7 @@
   strcat(pTmpBuf.data(), "\f00000");
 
   pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0);
-  result = books_primary_item_per_page;
+  items_per_page = books_primary_item_per_page;
   awards_window.uFrameX = 12;
   awards_window.uFrameY = 48;
   awards_window.uFrameWidth = 424;
@@ -592,31 +599,31 @@
   awards_window.uFrameZ = 435;
   awards_window.uFrameW = 337;
   if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book)
-    result = books_primary_item_per_page++ + 1;
-  if (BtnUp_flag && result)
+    items_per_page = books_primary_item_per_page++ + 1;
+  if (BtnUp_flag && items_per_page)
   {
-    --result;
-    books_primary_item_per_page = result;
+    --items_per_page;
+    books_primary_item_per_page = items_per_page;
   }
 
   if ( books_page_number < 0 )
   {
-    result += num_achieved_awards;
-    books_primary_item_per_page = result;
-    if ( (signed int)(num_achieved_awards + result) > full_num_items_in_book )
+    items_per_page += num_achieved_awards;
+    books_primary_item_per_page = items_per_page;
+    if ( (signed int)(num_achieved_awards + items_per_page) > full_num_items_in_book )
     {
-      result = full_num_items_in_book - num_achieved_awards;
-      books_primary_item_per_page = result;
+      items_per_page = full_num_items_in_book - num_achieved_awards;
+      books_primary_item_per_page = items_per_page;
     }
   }
   else if ( books_page_number > 0 )
   {
-    result -= num_achieved_awards;
-    books_primary_item_per_page = result;
-    if ( (result & 0x80000000u) != 0 )
+    items_per_page -= num_achieved_awards;
+    books_primary_item_per_page = items_per_page;
+    if ( items_per_page < 0 )
     {
-      result = 0;
-      books_primary_item_per_page = result;
+      items_per_page = 0;
+      books_primary_item_per_page = items_per_page;
     }
   }
   BtnDown_flag = 0;
@@ -624,7 +631,7 @@
   num_achieved_awards = 0;
   books_page_number = 0;
 
-  for ( int i = result; i < full_num_items_in_book; ++i)
+  for ( int i = items_per_page; i < full_num_items_in_book; ++i)
   {
     v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4];
     pTmpBuf[0] = 0;
@@ -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;
   }
 }
 
@@ -2354,31 +2334,52 @@
 //----- (00419100) --------------------------------------------------------
 void FillAwardsData()
 {
-        auto pPlayer = pPlayers[uActiveCharacter];
+    Player* pPlayer = pPlayers[uActiveCharacter];
 
-        memset(achieved_awards.data(), 0, 4000);
-        num_achieved_awards = 0;
+    memset(achieved_awards.data(), 0, 4000);
+    num_achieved_awards = 0;
 
-        memset(pTmpBuf2.data(), 0, 0x7D0u);
-        BtnDown_flag = 0;
-        BtnUp_flag = 0;
-        books_page_number = 0;
-        books_primary_item_per_page = 0;
-        for (int i = 0; i < 105; ++i)
+    memset(pTmpBuf2.data(), 0, 0x7D0u);
+    BtnDown_flag = 0;
+    BtnUp_flag = 0;
+    books_page_number = 0;
+    books_primary_item_per_page = 0;
+    for (int i = 1; i < 105; ++i)
+    {
+        if ( _449B57_test_bit(pPlayer->_achieved_awards_bits, i) && pAwards[i].pText )
         {
-            if ( _449B57_test_bit(pPlayer->_guilds_member_bits, i) && pAwards[i].pText )
-            {
-                achieved_awards[num_achieved_awards++] = (AwardType)i;
-            }
+            achieved_awards[num_achieved_awards++] = (AwardType)i;
         }
-        full_num_items_in_book = num_achieved_awards;
-        num_achieved_awards = 0;
+    }
+    full_num_items_in_book = num_achieved_awards;
+    num_achieved_awards = 0;
+
+    //sort awards index 
 
-        //sort awards index 
-        if (full_num_items_in_book > 0)
+    if (full_num_items_in_book>0)
         {
-            std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort);
+            for (int i = 0; i< full_num_items_in_book; ++i)
+                achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16);
+            for (int i = 1; i< full_num_items_in_book; ++i)
+                {
+                for (int j = i; j< full_num_items_in_book; ++j)
+                    {
+                    AwardType tmp;
+                    if (pAwards[achieved_awards[j]].uPriority < pAwards[achieved_awards[i]].uPriority)
+                        {
+                        tmp= achieved_awards[j];
+                        achieved_awards[j] = achieved_awards[i];
+                        achieved_awards[i] = tmp;
+                        }
+                    }
+                }
         }
+
+
+    //  if (full_num_items_in_book > 0)
+    /* {
+        std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort);
+    }*/
     }
 
 
@@ -2916,12 +2917,12 @@
     dword_507CC0_activ_ch = 0;
     for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = j )
     {
-	  j=i->pNext;
-	  if ( BYTE1(i->field_1C) & 0x80 )
-	  {
+      j = i->pNext;
+      if ( BYTE1(i->field_1C) & 0x80 )
+      {
         i->Release();
-		pAllocator->FreeChunk(i);
-	  }
+        pAllocator->FreeChunk(i);
+      }
     }
     for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext )
     {
--- a/UI/UIGuilds.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/UI/UIGuilds.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -191,7 +191,7 @@
     }
     return;
   }
-  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits,
+  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
             guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
   { //you must me member
     v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
--- a/UI/UIHouses.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/UI/UIHouses.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -937,7 +937,7 @@
 			v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags 
 			//v20 = uHouseID;
 			//if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
-			if(_449B57_test_bit(pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
+			if(_449B57_test_bit(pPlayers[uActiveCharacter]->_achieved_awards_bits,v19))
             {
 				PlayHouseSound(uHouseID, HouseSound_Greeting_2);
 				return 1;
@@ -4017,7 +4017,7 @@
     pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
     return; // void func
   }
-  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
+  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
   {
     v24 = pNPCTopics[171].pText;
     v25 = v31;
--- a/UI/UIShops.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/UI/UIShops.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -2067,7 +2067,7 @@
         return;
       }
       v70 = pMouse->GetCursorPos(&v102);
-      result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
+      result = v70->x + pSRZBufferLineOffsets[v70->y];
       if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
       {
         v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
--- a/mm7_4.cpp	Mon Aug 26 20:32:08 2013 +0200
+++ b/mm7_4.cpp	Mon Aug 26 20:32:55 2013 +0200
@@ -1999,7 +1999,7 @@
           break;
         case 8:
           v63 = 0;
-          v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits;
+          v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits;
           for ( uint i = 0; i < 28; ++i )
           {
             if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) )
@@ -2926,7 +2926,7 @@
     if ( pParty->uFine )
     {
       //v10 = result->_guilds_member_bits;
-      result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1);
+      result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_achieved_awards_bits, 1);
       if ( !(short)result )
 		  __debugbreak();
         //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u);