changeset 991:c5d8ea1e6ccb

CharacterUI cleanings.
author Nomad
date Mon, 13 May 2013 17:01:20 +0200
parents d982fffb8b96
children 3a3ab572eff5
files GUIWindow.h Player.h Render.cpp Render.h UICharacter.cpp UiGame.cpp mm7_1.cpp mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 10 files changed, 574 insertions(+), 652 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Sat May 11 17:56:12 2013 +0200
+++ b/GUIWindow.h	Mon May 13 17:01:20 2013 +0200
@@ -460,7 +460,7 @@
 
 
 
-void QuickRefDraw();
+void GameUI_QuickRef_Draw();
 
 
 
@@ -476,11 +476,16 @@
 const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType);
 char CharacterUI_SkillsTab_ShowHint();
 void CharacterUI_StatsTab_ShowHint();
-char CharacterUI_StatsTab_Draw(unsigned int uPlayerID); // idb
+char CharacterUI_StatsTab_Draw(Player *player);
+void CharacterUI_SkillsTab_CreateButtons();
 void CharacterUI_SkillsTab_Draw(Player *player);
-void CharacterUI_AwardsTab_Draw(unsigned int uPlayerID); // idb
+void CharacterUI_AwardsTab_Draw(Player *player);
 void CharacterUI_InventoryTab_Draw(Player *player, bool a2);
-void CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx); // idb
+void CharacterUI_CharacterScreen_Draw(Player *player);
+void CharacterUI_DrawPaperdoll(Player *player);
+void CharacterUI_DrawPaperdollWithRingOverlay(Player *player);
+void CharacterUI_ReleaseButtons();
+
 
 
 
@@ -651,4 +656,5 @@
 extern unsigned int ui_color_text_bonus;
 extern unsigned int ui_color_text_bonus_neg;
 extern unsigned int ui_color_text_skill_upgradeable;
-extern unsigned int ui_color_text_skill_not_upgradeable;
\ No newline at end of file
+extern unsigned int ui_color_text_skill_not_upgradeable;
+extern unsigned int ui_color_text_awards[6];
\ No newline at end of file
--- a/Player.h	Sat May 11 17:56:12 2013 +0200
+++ b/Player.h	Mon May 13 17:01:20 2013 +0200
@@ -138,10 +138,10 @@
 /*  339 */
 enum CHARACTER_RACE
 {
-  CHARACTER_RACE_HUMAN = 0x0,
-  CHARACTER_RACE_ELF = 0x1,
-  CHARACTER_RACE_GOBLIN = 0x2,
-  CHARACTER_RACE_DWARF = 0x3,
+  CHARACTER_RACE_HUMAN = 0,
+  CHARACTER_RACE_ELF = 1,
+  CHARACTER_RACE_GOBLIN = 2,
+  CHARACTER_RACE_DWARF = 3,
 };
 enum CHARACTER_ATTRIBUTE
 {
--- a/Render.cpp	Sat May 11 17:56:12 2013 +0200
+++ b/Render.cpp	Mon May 13 17:01:20 2013 +0200
@@ -10583,7 +10583,7 @@
 }
 
 //----- (004A601E) --------------------------------------------------------
-void Render::_4A601E(signed int a2, signed int a3, Texture *pTexture, int a5)
+void Render::ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5)
 {
   signed int v5; // edx@3
   int v6; // ebx@3
--- a/Render.h	Sat May 11 17:56:12 2013 +0200
+++ b/Render.h	Mon May 13 17:01:20 2013 +0200
@@ -342,7 +342,7 @@
   void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
   void _4A5D33(unsigned int a2, unsigned int a3, int a4, int a5, RGBTexture *pTexture);
   void DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4);
-  void _4A601E(signed int a2, signed int a3, Texture *pTexture, int a5);
+  void ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5);
   void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal);
   void DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture);
   void _4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8);
--- a/UICharacter.cpp	Sat May 11 17:56:12 2013 +0200
+++ b/UICharacter.cpp	Mon May 13 17:01:20 2013 +0200
@@ -52,6 +52,7 @@
 unsigned int ui_color_text_bonus_neg;
 unsigned int ui_color_text_skill_upgradeable;
 unsigned int ui_color_text_skill_not_upgradeable;
+unsigned int ui_color_text_awards[6];
 void set_default_ui_skin()
 {
   ui_color_text_default = TargetColor(255, 255, 255);
@@ -62,6 +63,13 @@
 
   ui_color_text_skill_upgradeable = TargetColor(0, 175, 255);
   ui_color_text_skill_not_upgradeable = TargetColor(255, 0, 0);
+
+  ui_color_text_awards[0] = TargetColor(248, 108, 160);
+  ui_color_text_awards[1] = TargetColor(112, 220, 248);
+  ui_color_text_awards[2] = TargetColor(192, 192, 240);
+  ui_color_text_awards[3] = TargetColor( 64, 244,  96);
+  ui_color_text_awards[4] = TargetColor(232, 244,  96);
+  ui_color_text_awards[5] = TargetColor(240, 252, 192);
 }
 
 
@@ -182,27 +190,9 @@
 
 
 
-    
-unsigned int GetAwardColor(unsigned int priority)
-{
-  static unsigned __int8 pAwardsTextColors[6][3] =
-  {
-    {248, 108, 160},
-    {112, 220, 248},
-    {192, 192, 240},
-    { 64, 244,  96},
-    {232, 244,  96},
-    {240, 252, 192}
-  };
-
-  return TargetColor(pAwardsTextColors[priority % 6][0],
-                     pAwardsTextColors[priority % 6][1],
-                     pAwardsTextColors[priority % 6][2]);
-}
-
 
 //----- (0041A000) --------------------------------------------------------
-void CharacterUI_AwardsTab_Draw(unsigned int uPlayerID)
+void CharacterUI_AwardsTab_Draw(Player *player)
 {
     //unsigned int v1; // esi@1
     //unsigned int v2; // ebx@1
@@ -227,28 +217,28 @@
     //int v21; // [sp+C8h] [bp-8h]@14
     //int v22; // [sp+CCh] [bp-4h]@40
 
-    auto player = &pParty->pPlayers[uPlayerID - 1];
-    //v1 = uPlayerID;
-    pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE));
-    sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], TargetColor(0xFF, 0xFF, 0x9B));
-    sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
-    strcat(pTmpBuf, Source);
-    strcat(pTmpBuf, "\f00000");
-    pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
-    result = dword_506528;
-    a1.uFrameX = 12;
-    a1.uFrameY = 48;
-    a1.uFrameWidth = 424;
-    a1.uFrameHeight = 290;
-    a1.uFrameZ = 435;
-    a1.uFrameW = 337;
-    if ( dword_506544 && num_achieved_awards + dword_506528 < num_achieved_awards_2 )
-        result = dword_506528++ + 1;
-    if ( dword_506548 && result )
-        {
-        --result;
-        dword_506528 = result;
-        }
+  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE));
+  sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_color_text_header);
+  sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
+  strcat(pTmpBuf, Source);
+  strcat(pTmpBuf, "\f00000");
+
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
+  result = dword_506528;
+  a1.uFrameX = 12;
+  a1.uFrameY = 48;
+  a1.uFrameWidth = 424;
+  a1.uFrameHeight = 290;
+  a1.uFrameZ = 435;
+  a1.uFrameW = 337;
+  if (dword_506544 && num_achieved_awards + dword_506528 < num_achieved_awards_2)
+    result = dword_506528++ + 1;
+  if (dword_506548 && result)
+  {
+    --result;
+    dword_506528 = result;
+  }
+
     if ( dword_50651C < 0 )
         {
         result += num_achieved_awards;
@@ -300,7 +290,7 @@
               v6 = pTmpBuf;
 
 
-            a1.DrawText(pFontArrus, 0, 0, GetAwardColor(pAwards[v5].uPriority), v6, 0, 0, 0);
+            a1.DrawText(pFontArrus, 0, 0, ui_color_text_awards[pAwards[v5].uPriority % 6], v6, 0, 0, 0);
             a1.uFrameY = pFontArrus->CalcTextHeight(v6, &a1, 0, 0) + a1.uFrameY + 4;
             if (a1.uFrameY > a1.uFrameHeight)
               break;
@@ -322,95 +312,7 @@
   return ((signed int)(uNumPixels - 14) >> 5) + 1;
 }
 
-//----- (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
 
-  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->pInventoryIndices + i);
-
-    if (player->pInventoryIndices[i] <= 0)
-      continue;
-
-    int item_idx = player->pInventoryIndices[i];
-    auto item = &player->pInventoryItems[item_idx - 1];
-    if (!item->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 + ((((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)];
-
-
-    if (!(item->uAttributes & 0xF0))
-    {
-      if (item->Identified() || pCurrentScreen != SCREEN_HOUSE)
-      {
-        if (item->Broken())
-          pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7);
-        else
-          pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
-      }
-      else
-        pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7);
-
-      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
-      continue;
-    }
-    else
-    {
-      switch (item->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;
-        ptr_50C9A4 = 0;
-      }
-
-      pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255);
-      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
-    }
-  }
-}
 
 //----- (0041A556) --------------------------------------------------------
 void draw_leather()
@@ -418,265 +320,67 @@
   pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather));
 }
 
-    //----- (0041A57E) --------------------------------------------------------
-    void QuickRefDraw()
-        {
-        unsigned int v0; // ebx@1
-        //unsigned int v1; // eax@1
-        Player *pPlayer; // ebp@2
-        int v3; // eax@6
-        int v4; // edi@6
-        unsigned int v5; // eax@7
-        unsigned int v6; // edi@9
-        unsigned int v7; // edi@11
-        signed int v8; // eax@13
-        unsigned int v9; // eax@13
-        unsigned int v10; // edi@13
-        int v11; // eax@15
-        unsigned int v12; // eax@15
-        unsigned int v13; // edi@15
-        int v14; // eax@17
-        int v15; // ST18_4@17
-        int v16; // ebx@17
-        int v17; // eax@17
-        unsigned int v18; // eax@17
-        unsigned int v19; // edi@17
-        int v20; // eax@19
-        unsigned int v21; // edi@19
-        char *v22; // eax@21
-        unsigned int v23; // edi@21
-        int v24; // eax@23
-        unsigned int v25; // edi@23
-        char *v26; // eax@25
-        unsigned int v27; // edi@25
-        int v28; // ecx@27
-        char *v29; // eax@27
-        signed int v30; // edx@27
-        unsigned int v31; // edi@31
-        unsigned int v32; // edi@33
-        const char *v33; // ST10_4@35
-        unsigned int v34; // eax@35
-        unsigned int v35; // edi@35
-        unsigned __int8 v36; // al@37
-        char *v37; // eax@38
-        int v38; // eax@41
-        signed int v39; // edi@42
-        char *v40; // eax@45
-        unsigned int v41; // eax@45
-        signed int v43; // [sp+10h] [bp-1Ch]@1
-        unsigned int v44; // [sp+14h] [bp-18h]@2
-        int v45; // [sp+18h] [bp-14h]@1
-        unsigned int v46; // [sp+1Ch] [bp-10h]@1
-        unsigned int v47; // [sp+20h] [bp-Ch]@1
-        unsigned int v48; // [sp+24h] [bp-8h]@33
-        //unsigned int v49; // [sp+28h] [bp-4h]@1
+
+//----- (0041ABFD) --------------------------------------------------------
+void CharacterUI_CharacterScreen_Draw(Player *player)
+{
+  pRenderer->ClearZBuffer(0, 479);
+  switch (pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0])
+  {
+    case WINDOW_CharacterWindow_Stats:                                // stats
+      CharacterUI_ReleaseButtons();
+      sub_419379();
+      CharacterUI_StatsTab_Draw(player);
+      pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX,
+                                    pCharacterScreen_StatsBtn->uY,
+                                    pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE));
+    break;
 
-        v0 = 0;
-        v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-        //v49 = TargetColor(0xFFu, 0, 0);
-        v46 = TargetColor(0, 0xFFu, 0);
-        //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE);
-        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
-        v43 = 0;
-        v45 = LOBYTE(pFontArrus->uFontHeight) + 1;
-        do
-            {
-            pPlayer = &pParty->pPlayers[v43];
-            v44 = 94 * v43 + 89;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, v0, pGlobalTXT_LocalizationStrings[149], 60, v0);//Name
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, v47, pPlayer->pName, 84, v0);
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, v0, pGlobalTXT_LocalizationStrings[131], 60, v0); //Уров.
-            v3 = pPlayer->GetActualLevel();
-            sprintf(pTmpBuf, "%lu", v3);
-            v4 = pPlayer->GetBaseLevel();
-            if ( pPlayer->GetActualLevel() <= v4 )
-                v5 = pPlayer->GetExperienceDisplayColor();
-            else
-                v5 = TargetColor(0, 0xFFu, v0);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, v0);
-            v6 = v45 + 47;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, v0, pGlobalTXT_LocalizationStrings[41], 60, v0);//Класс
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, v0, pClassNames[pPlayer->classType], 84, v0);
-            v7 = v45 + v6;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, v0, pGlobalTXT_LocalizationStrings[107], 60, v0);//Здор.
-            sprintf(pTmpBuf, "%d", pPlayer->sHealth);
-            v8 = pPlayer->GetMaxHealth();
-            v9 = UI_GetHealthManaStringColor(pPlayer->sHealth, v8);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, v0);
-            v10 = v45 + v7;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, v0, pGlobalTXT_LocalizationStrings[209], 60, v0);//Мана
-            sprintf(pTmpBuf, "%d", pPlayer->sMana);
-            v11 = pPlayer->GetMaxMana();
-            v12 = UI_GetHealthManaStringColor(pPlayer->sMana, v11);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, v0);
-            v13 = v45 + v10;
-            if ( v43 == v0 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, v0, pGlobalTXT_LocalizationStrings[0], 60, v0);//Класс брони
-            v14 = pPlayer->GetActualAC();
-            sprintf(pTmpBuf, "%d", v14);
-            v15 = v0;
-            v16 = pPlayer->GetBaseAC();
-            v17 = pPlayer->GetActualAC();
-            v18 = UI_GetHealthManaStringColor(v17, v16);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, v15);
-            v0 = 0;
-            v19 = v45 + v13;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Атака
-            v20 = pPlayer->GetActualAttack(0);
-            sprintf(pTmpBuf, "%+d", v20);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0);
-            v21 = v45 + v19;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр.
-            v22 = pPlayer->GetMeleeDamageString();
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0);
-            v23 = v45 + v21;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Стрелять
-            v24 = pPlayer->GetRangedAttack();
-            sprintf(pTmpBuf, "%+d", v24);
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0);
-            v25 = v45 + v23;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр.
-            v26 = pPlayer->GetRangedDamageString();
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0);
-            v27 = v45 + v25;
-            if ( !v43 )
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Навыки
-            v28 = 0;
-            v29 = (char *)pPlayer->pActiveSkills;
-            v30 = 36;
-            do
-                {
-                if ( *(short *)v29 )
-                    ++v28;
-                v29 += 2;
-                --v30;
-                }
-                while ( v30 );
-                sprintf(pTmpBuf, "%lu", v28);
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0);
-                v31 = v45 + v27;
-                if ( !v43 )
-                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Очки
-                sprintf(pTmpBuf, "%lu", pPlayer->uSkillPoints);
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, pPlayer->uSkillPoints != 0 ? v46 : 0, pTmpBuf, 84, 0);
-                v32 = v45 + v31;
-                v48 = pPlayer->GetMajorConditionIdx();
-                if ( !v43 )
-                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Сост.
-                v33 = aCharacterConditionNames[v48];
-                v34 = GetConditionDrawColor(v48);
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0);
-                v35 = v45 + v32;
-                if ( !v43 )
-                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Б.Прим.
-                v36 = pPlayer->uQuickSpell;
-                if ( v36 )
-                    v37 = pSpellStats->pInfos[v36].pShortName;
-                else
-                    v37 = pGlobalTXT_LocalizationStrings[153];//Нет
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0);
-                ++v43;
-            }
-            while ( v43 < 4 );
+    case WINDOW_CharacterWindow_Skills:                                // skills
+      if (dword_507CC0 != uActiveCharacter)
+      {
+        CharacterUI_ReleaseButtons();
+        CharacterUI_SkillsTab_CreateButtons();
+      }
+      sub_419379();
+      CharacterUI_SkillsTab_Draw(player);
+      pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX,
+                                    pCharacterScreen_SkillsBtn->uY,
+                                    pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE));
+    break;
 
-            v38 = GetPartyReputation();
-            if ( v38 >= 0 )
-                {
-                if ( v38 <= 5 )
-                    v39 = TargetColor(0xFF, 0xFF, 0xFF);
-                else
-                    v39 = TargetColor(0xFF, 0, 0);
-                }
-            else
-                v39 = v46;
-
-            v40 = GetReputationString(v38);
-            sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation
-            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0);
-            v41 = pParty->GetPartyFame();
-            sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame Слава
-            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0);
-        }
-
-    //----- (0041ABFD) --------------------------------------------------------
-void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx)
-{
-  unsigned int v2; // eax@6
-  Texture *pTexture; // ecx@6
-  GUIButton *pButton; // eax@6
-  unsigned int v5; // eax@7
-  unsigned int v6; // eax@10
-  unsigned int v7; // eax@11
+    case WINDOW_CharacterWindow_Awards:                                // awards
+      CharacterUI_ReleaseButtons();
+      sub_419379();
+      sub_419220();
+      CharacterUI_AwardsTab_Draw(player);
+      pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX,
+                                    pCharacterScreen_AwardsBtn->uY,
+                                    pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE));
+    break;
 
-  if ( uPlayerIdx )
-  {
-    pRenderer->ClearZBuffer(0, 479);
-    switch ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] )
-    {
-      case WINDOW_CharacterWindow_Stats:                                // stats
-        sub_4196A0();
-        sub_419379();
-        CharacterUI_StatsTab_Draw(uPlayerIdx);
-        v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE);
-        pTexture = pIcons_LOD->GetTexture(v7);
-        pButton = pCharacterScreen_StatsBtn;
-        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
-        break;
-      case WINDOW_CharacterWindow_Skills:                                // skills
-        if ( dword_507CC0 != uActiveCharacter )
-        {
-          sub_4196A0();
-          CharacterUI_SkillScreen_Draw();
-        }
-        sub_419379();
-        CharacterUI_SkillsTab_Draw(pPlayers[uPlayerIdx]);
-        v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE);
-        pTexture = pIcons_LOD->GetTexture(v6);
-        pButton = pCharacterScreen_SkillsBtn;
-        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
-        break;
-      case WINDOW_CharacterWindow_Awards:                                // awards
-        sub_4196A0();
-        sub_419379();
-        sub_419220();
-        CharacterUI_AwardsTab_Draw(uPlayerIdx);
-        v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE);
-        pTexture = pIcons_LOD->GetTexture(v5);
-        pButton = pCharacterScreen_AwardsBtn;
-        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
-        break;
-      case WINDOW_CharacterWindow_Inventory:                                                        // inventory and other
-        sub_4196A0();
-        sub_419379();
-        CharacterUI_InventoryTab_Draw(pPlayers[uPlayerIdx], false);
-        v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE);
-        pTexture = pIcons_LOD->GetTexture(v2);
-        pButton = pCharacterScreen_InventoryBtn;
-        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
-        break;
-      default:
-        break;
-    }
-    if ( bRingsShownInCharScreen )
-      CharacterUI_DrawPaperdollWithRingOverlay(uPlayerIdx);
-    else
-      CharacterUI_DrawPaperdoll(uPlayerIdx);
+    case WINDOW_CharacterWindow_Inventory:                             // inventory and other
+      CharacterUI_ReleaseButtons();
+      sub_419379();
+      CharacterUI_InventoryTab_Draw(player, false);
+      pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX,
+                                    pCharacterScreen_InventoryBtn->uY,
+                                    pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE));
+    break;
+
+    default: break;
   }
+
+  if (bRingsShownInCharScreen)
+    CharacterUI_DrawPaperdollWithRingOverlay(player);
+  else
+    CharacterUI_DrawPaperdoll(player);
 }
 
 //----- (0043CC7C) --------------------------------------------------------
-void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID)
+void CharacterUI_DrawPaperdoll(Player *player)
 {
-  signed int pSex; // eax@1
+  //signed int pSex; // eax@1
   unsigned int v6; // ecx@9
   int v7; // ecx@10
   unsigned int pMainHandNum4; // eax@14
@@ -827,25 +531,33 @@
         signed int IsDwarf; // [sp+40h] [bp-Ch]@4
 
   pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
-  pSex = pPlayers[uPlayerID]->GetSexByVoice();
-  if ( pPlayers[uPlayerID]->GetRace() && pPlayers[uPlayerID]->GetRace() != 1 && pPlayers[uPlayerID]->GetRace() != 2 )
+  if (player->GetRace() == CHARACTER_RACE_DWARF)
   {
     IsDwarf = 1;
-    pBodyComplection = (pSex != 0) + 2;
+    pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 2 : 3;
   }
   else
   {
     IsDwarf = 0;
-    pBodyComplection = pSex != 0;
+    pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 0 : 1;
   }
+
+  int uPlayerID = 0;
+  for (uint i = 0; i < 4; ++i)
+    if (pPlayers[i + 1] == player)
+    {
+      uPlayerID = i + 1;
+      break;
+    }
+
   pRenderer->ResetTextureClipRect();
-  pRenderer->DrawTextureIndexed(0x1D3u, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));//Подложка
+  pRenderer->DrawTextureIndexed(467, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));//Подложка
   if ( IsPlayerWearingWatersuit[uPlayerID] )//акваланг
   {
     pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]));
     if ( !bRingsShownInCharScreen )
-      pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), pPlayers[uPlayerID]->pEquipment.uArmor);
-    v6 = pPlayers[uPlayerID]->pEquipment.uMainHand;
+      pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor);
+    v6 = player->pEquipment.uMainHand;
     if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1)
          && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1],
@@ -1424,7 +1136,7 @@
         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 = paperdoll_helm_texture[pSex][v125];
+          v127 = paperdoll_helm_texture[player->GetSexByVoice()][v125];
         else
           v127 = papredoll_dbrds[11];
         if ( item_Helm->uAttributes & 0xF0 )
@@ -1604,154 +1316,179 @@
   pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));//обрамление
 }
 
-//----- (0043E825) --------------------------------------------------------
-void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID)
+
+
+
+
+
+
+//----- (0041A2D1) --------------------------------------------------------
+void CharacterUI_InventoryTab_Draw(Player *player, bool a2)
 {
-  int v3; // ecx@1
-  unsigned int pItemTextureNum; // ebx@3
-  //int v9; // edi@17
-  char v13; // sf@24
-  unsigned __int8 v14; // of@24
-  unsigned int pItemNum; // eax@25
-  //int v20; // edi@40
-  //int v21; // eax@41
-  //int v33; // esi@61
-  const char *spell_texture_name; // [sp-8h] [bp-38h]@8
-  Texture *spell_texture; // [sp+10h] [bp-20h]@14
-  int v41; // [sp+10h] [bp-20h]@26
-  unsigned int pY_Ring; // [sp+14h] [bp-1Ch]@3
-  unsigned int pX_Ring; // [sp+18h] [bp-18h]@3
-  int v48; // [sp+24h] [bp-Ch]@1
-  ItemGen *item;
+        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
+
+  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->pInventoryIndices + i);
+
+    if (player->pInventoryIndices[i] <= 0)
+      continue;
 
-  pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
-  CharacterUI_DrawPaperdoll(uPlayerID);
-  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, pIcons_LOD->GetTexture(uTextureID_detaliz_close_button));
-  v3 = 0;
-  v48 = 0;
-  do
-  {
-    pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
-    if ( pPlayers[uPlayerID]->pEquipment.uRings[v3] )
+    int item_idx = player->pInventoryIndices[i];
+    auto item = &player->pInventoryItems[item_idx - 1];
+    if (!item->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 + ((((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)];
+
+    if (item->uAttributes & 0xF0)
     {
-      item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
-      pX_Ring = pPaperdollRingsX[v3];
-      pY_Ring = pPaperdollRingsY[v3];
-      pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-      if ( item->uAttributes & 0xF0 )
+      switch (item->uAttributes & 0xF0)
       {
-        if ( (item->uAttributes & 0xF0) == 16 )
-          spell_texture_name = "sptext01";
-        if ( (item->uAttributes & 0xF0) == 32 )
-          spell_texture_name = "sp28a";
-        if ( (item->uAttributes & 0xF0) == 64 )
-          spell_texture_name = "sp30a";
-        if ( (item->uAttributes & 0xF0) == 128 )
-          spell_texture_name = "sp91a";
-        spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE);
-        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
-        if ( _50C9A8_item_enchantment_timer <= 0 )
-        {
-          _50C9A8_item_enchantment_timer = 0;
-          item->uAttributes &= 0xFu;
-          ptr_50C9A4 = 0;
-        }
-        pRenderer->_4A63E6(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
+        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;
       }
-      else
-      {
-        if (item->Broken())
-          pRenderer->DrawTransparentRedShade(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum));
-        else if (!item->Identified())
-          pRenderer->DrawTransparentGreenShade(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum));
-        else
-          pRenderer->DrawTextureTransparent(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum));
 
-        pRenderer->_4A601E(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum), pItemNum);
-      }
-    }
-    v3++;
-    pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
-    v14 = (v48 + 1) > 5;
-    v13 = v48 - 4 < 0;
-    v48++;
-  }
-  while ( (unsigned __int8)(v13 ^ v14) | (v48 == 4) );
-  pItemNum = pPlayers[uPlayerID]->pEquipment.uAmulet;
-  if ( pItemNum )
-  {
-    v41 = pPlayers[uPlayerID]->pEquipment.uAmulet;
-    item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
-    pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-    if ( item->uAttributes & 0xF0 )
-    {
-      if ( (item->uAttributes & 0xF0) == 16 )
-        spell_texture_name = "sptext01";
-      if ( (item->uAttributes & 0xF0) == 32 )
-        spell_texture_name = "sp28a";
-      if ( (item->uAttributes & 0xF0) == 64 )
-        spell_texture_name = "sp30a";
-      if ( (item->uAttributes & 0xF0) == 128 )
-        spell_texture_name = "sp91a";
-      spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE);
       _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
-      if ( _50C9A8_item_enchantment_timer <= 0 )
+      if (_50C9A8_item_enchantment_timer <= 0)
       {
         _50C9A8_item_enchantment_timer = 0;
-        item->uAttributes &= 0xFu;
+        LOBYTE(item->uAttributes) &= 0xF;
         ptr_50C9A4 = 0;
       }
-      pRenderer->_4A63E6(493, 91, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
+
+      pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255);
+      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
     }
     else
     {
-      if (item->Broken())
-        pRenderer->DrawTransparentRedShade(493, 91, pIcons_LOD->GetTexture(pItemTextureNum));
-      else if (!item->Identified())
-        pRenderer->DrawTransparentGreenShade(493, 91, pIcons_LOD->GetTexture(pItemTextureNum));
+      if (item->Identified() || pCurrentScreen != SCREEN_HOUSE)
+      {
+        if (item->Broken())
+          pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7);
+        else
+          pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
+      }
       else
-        pRenderer->DrawTextureTransparent(493, 91, pIcons_LOD->GetTexture(pItemTextureNum));
+        pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7);
 
-      pRenderer->_4A601E(493, 91, pIcons_LOD->GetTexture(pItemTextureNum), v41);
+      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
+      continue;
     }
   }
-  pItemNum = pPlayers[uPlayerID]->pEquipment.uGlove;
-  if ( !pItemNum )
-    return;
-  item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
-  pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-  if ( !(item->uAttributes & 0xF0) )
+}
+
+
+
+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);
+
+  if (item->uAttributes & 0xF0) // enchant animation
   {
-    if (item->Broken())
-      pRenderer->DrawTransparentRedShade(586, 88, pIcons_LOD->GetTexture(pItemTextureNum));
-    else if (!item->Identified())
-      pRenderer->DrawTransparentGreenShade(586, 88, pIcons_LOD->GetTexture(pItemTextureNum));
-    else
-      pRenderer->DrawTextureTransparent(586, 88, pIcons_LOD->GetTexture(pItemTextureNum));
+    Texture *enchantment_texture = nullptr;
+    switch (item->uAttributes & 0xF0)
+    {
+      case ITEM_AURA_EFFECT_RED:    enchantment_texture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break;
+      case ITEM_AURA_EFFECT_BLUE:   enchantment_texture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE);    break;
+      case ITEM_AURA_EFFECT_GREEN:  enchantment_texture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE);    break;
+      case ITEM_AURA_EFFECT_PURPLE: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE);    break;
+    }
 
-    pRenderer->_4A601E(586, 88,pIcons_LOD->GetTexture(pItemTextureNum), pItemNum);
+    _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
+    if (_50C9A8_item_enchantment_timer <= 0)
+    {
+      _50C9A8_item_enchantment_timer = 0;
+      item->uAttributes &= 0xF;
+      ptr_50C9A4 = 0;
+    }
+    pRenderer->_4A63E6(x, y, item_texture, enchantment_texture, GetTickCount() * 0.1, 0, 255);
   }
   else
   {
-    if ( (item->uAttributes & 0xF0) == 16 )
-      spell_texture_name = "sptext01";
-    if ( (item->uAttributes & 0xF0) == 32 )
-      spell_texture_name = "sp28a";
-    if ( (item->uAttributes & 0xF0) == 64 )
-      spell_texture_name = "sp30a";
-    if ( (item->uAttributes & 0xF0) == 128 )
-      spell_texture_name = "sp91a";
-    spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE);
-    _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
-    if ( _50C9A8_item_enchantment_timer <= 0 )
-    {
-      _50C9A8_item_enchantment_timer = 0;
-      item->uAttributes &= 0xFu;
-      ptr_50C9A4 = 0;
-    }
-    pRenderer->_4A63E6(586, 88, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
+    if (item->Broken())
+      pRenderer->DrawTransparentRedShade(x, y, item_texture);
+    else if (!item->Identified())
+      pRenderer->DrawTransparentGreenShade(x, y, item_texture);
+    else
+      pRenderer->DrawTextureTransparent(x, y, item_texture);
+
+    pRenderer->ZBuffer_Fill_2(x, y, item_texture, id);
+  }
+}
+
+
+//----- (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,
+                                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->pInventoryItems[player->pEquipment.uRings[i] - 1],
+                         player->pEquipment.uRings[i]);
+  }
+
+
+  if (player->pEquipment.uAmulet)
+  {
+    CharacterUI_DrawItem(493, 91,
+                         &player->pInventoryItems[player->pEquipment.uAmulet - 1],
+                         player->pEquipment.uAmulet);
+  }
+
+  if (player->pEquipment.uGlove)
+  {
+    CharacterUI_DrawItem(586, 88,
+                         &player->pInventoryItems[player->pEquipment.uGlove - 1],
+                         player->pEquipment.uGlove);
   }
 }
 
@@ -2011,8 +1748,8 @@
 }
 
 //----- (00419401) --------------------------------------------------------
-void __cdecl CharacterUI_SkillScreen_Draw()
-    {
+void CharacterUI_SkillsTab_CreateButtons()
+{
     unsigned int v0; // ecx@3
     GUIButton *pButton; // eax@3
     GUIFont *v2; // eax@8
@@ -2036,7 +1773,7 @@
 
     a2 = 0;
     if ( dword_507CC0 )
-        sub_4196A0();
+        CharacterUI_ReleaseButtons();
     v0 = uActiveCharacter;
     dword_507CC0 = uActiveCharacter;
     for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
@@ -2130,10 +1867,10 @@
     }
 
 //----- (00418511) --------------------------------------------------------
-char CharacterUI_StatsTab_Draw(unsigned int uPlayerID)
+char CharacterUI_StatsTab_Draw(Player *player)
 {
-        Player *pPlayer; // edi@1
-        unsigned int v4; // eax@2
+        //Player *pPlayer; // edi@1
+        //unsigned int v4; // eax@2
         int v7; // ebp@4
         int v8; // eax@4
         unsigned int v9; // eax@4
@@ -2165,7 +1902,7 @@
         unsigned int v60; // eax@8
         unsigned int v62; // eax@8
         signed int v64; // eax@8
-        unsigned __int8 v66; // al@8
+        //unsigned __int8 v66; // al@8
         char *v67; // eax@9
         signed int v70; // ebp@11
         signed int v71; // eax@11
@@ -2209,203 +1946,202 @@
         int v135; // [sp+18h] [bp-8h]@27
         int v136; // [sp+18h] [bp-8h]@33
 
-        pPlayer = &pParty->pPlayers[uPlayerID-1];
-        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE));
-        sprintf(pTmpBuf, "\f%05d", TargetColor(0xFF, 0xFF, 0x9B));
-        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);//^Pi[%s] %s
-        strcat(pTmpBuf, pTmpBuf2);
-        if ( pPlayer->uSkillPoints )
-            v4 = TargetColor(0, 0xFFu, 0);
-        else
-            v4 = 0xFFFFu;
-        sprintf(pTmpBuf2,  "\f00000\r180%s: \f%05d%d\f00000\n\n\n", pGlobalTXT_LocalizationStrings[207], v4, pPlayer->uSkillPoints);//Skill points
-        strcat(pTmpBuf, pTmpBuf2);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf, 0, 0, 0);
+        //pPlayer = &pParty->pPlayers[uPlayerID-1];
+        //pPlayer = player;
+  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE));
+  sprintf(pTmpBuf, "\f%05d", ui_color_text_header);
+  sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);//"^Pi[%s] %s" / "%s the %s"
+  strcat(pTmpBuf, pTmpBuf2);
+  sprintfex(pTmpBuf2,  "\f00000\r180%s: \f%05d%d\f00000\n\n\n",
+            pGlobalTXT_LocalizationStrings[207], // "Skill points"
+            player->uSkillPoints ? ui_color_text_bonus : ui_color_text_default,
+            player->uSkillPoints);
+  strcat(pTmpBuf, pTmpBuf2);
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf, 0, 0, 0);
+
+  v10 = 53;
+  v7 = player->GetBaseStrength();
+  v8 = player->GetActualMight();
+  v9 = UI_GetHealthManaStringColor(v8, v7);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
-        v10 = 53;
-        v7 = pPlayer->GetBaseStrength();
-        v8 = pPlayer->GetActualMight();
-        v9 = UI_GetHealthManaStringColor(v8, v7);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
+  v13 = player->GetBaseIntelligence();
+  v14 = player->GetActualIntelligence();
+  v15 = UI_GetHealthManaStringColor(v14, v13);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+
+  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
+  v19 = player->GetBaseWillpower();
+  v20 = player->GetActualWillpower();
+  v21 = UI_GetHealthManaStringColor(v20, v19);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);//
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+
+  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
+  v25 = player->GetBaseEndurance();
+  v26 = player->GetActualEndurance();
+  v27 = UI_GetHealthManaStringColor(v26, v25);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);//
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+
+  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
+  v31 = player->GetBaseAccuracy();
+  v32 = player->GetActualAccuracy();
+  v33 = UI_GetHealthManaStringColor(v32, v31);
+  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31);
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v13 = pPlayer->GetBaseIntelligence();
-        v14 = pPlayer->GetActualIntelligence();
-        v15 = UI_GetHealthManaStringColor(v14, v13);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
-
-        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v19 = pPlayer->GetBaseWillpower();
-        v20 = pPlayer->GetActualWillpower();
-        v21 = UI_GetHealthManaStringColor(v20, v19);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);//
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
-
-        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v25 = pPlayer->GetBaseEndurance();
-        v26 = pPlayer->GetActualEndurance();
-        v27 = UI_GetHealthManaStringColor(v26, v25);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);//
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
-
-        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v31 = pPlayer->GetBaseAccuracy();
-        v32 = pPlayer->GetActualAccuracy();
-        v33 = UI_GetHealthManaStringColor(v32, v31);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
-
-        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v37 = pPlayer->GetBaseSpeed();
-        v38 = pPlayer->GetActualSpeed();
+        v37 = player->GetBaseSpeed();
+        v38 = player->GetActualSpeed();
         v39 = UI_GetHealthManaStringColor(v38, v37);
         sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], v39, v38, v37);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v43 = pPlayer->GetBaseLuck();
-        v44 = pPlayer->GetActualLuck();
+        v43 = player->GetBaseLuck();
+        v44 = player->GetActualLuck();
         v45 = UI_GetHealthManaStringColor(v44, v43);
         sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], v45, v44, v43);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2 = "%s\f%05u\r424%d\f00000 /\t185%d\n";
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight) + 5;
-        if ( pPlayer->GetMaxHealth() >= 1000 )
+        if ( player->GetMaxHealth() >= 1000 )
             a2 = "%s\f%05u\r388%d\f00000 / %d\n";
-        v49 = pPlayer->GetMaxHealth();
-        v50 = UI_GetHealthManaStringColor(pPlayer->sHealth, v49);
-        sprintf(pTmpBuf, a2, pGlobalTXT_LocalizationStrings[108], v50, pPlayer->sHealth, v49);
+        v49 = player->GetMaxHealth();
+        v50 = UI_GetHealthManaStringColor(player->sHealth, v49);
+        sprintf(pTmpBuf, a2, pGlobalTXT_LocalizationStrings[108], v50, player->sHealth, v49);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2a = "%s\f%05u\r424%d\f00000 /\t185%d\n";
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        if ( pPlayer->GetMaxMana() >= 1000 )
+        if ( player->GetMaxMana() >= 1000 )
             a2a = "%s\f%05u\r388%d\f00000 / %d\n";
-        v53 = pPlayer->GetMaxMana();
-        v54 = UI_GetHealthManaStringColor(pPlayer->sMana, v53);
-        sprintf(pTmpBuf, a2a, pGlobalTXT_LocalizationStrings[212], v54, pPlayer->sMana, v53);
+        v53 = player->GetMaxMana();
+        v54 = UI_GetHealthManaStringColor(player->sMana, v53);
+        sprintf(pTmpBuf, a2a, pGlobalTXT_LocalizationStrings[212], v54, player->sMana, v53);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v58 = pPlayer->GetBaseAC();
-        v59 = pPlayer->GetActualAC();
+        v58 = player->GetBaseAC();
+        v59 = player->GetActualAC();
         v60 = UI_GetHealthManaStringColor(v59, v58);
         sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], v60, v59, v58);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 2;
-        v62 = pPlayer->GetMajorConditionIdx();
+        v62 = player->GetMajorConditionIdx();
         v64 = GetConditionDrawColor(v62);
         sprintf(pTmpBuf, "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], v64, aCharacterConditionNames[v62]);
         pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf, 226, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) + - 1;
-        v66 = pPlayer->uQuickSpell;
-        if ( v66 )
-            v67 = pSpellStats->pInfos[v66].pShortName;
+        if (player->uQuickSpell)
+            v67 = pSpellStats->pInfos[player->uQuickSpell].pShortName;
         else
             v67 = pGlobalTXT_LocalizationStrings[153];
         sprintf(pTmpBuf, "%s: %s", pGlobalTXT_LocalizationStrings[172], v67);
         pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf, 226, 0);
 
         v10 = 50;
-        v70 = pPlayer->GetBaseAge();
-        v71 = pPlayer->GetActualAge();
+        v70 = player->GetBaseAge();
+        v71 = player->GetActualAge();
         v72 = UI_GetHealthManaStringColor(v71, v70);
         sprintf(pTmpBuf, "%s\f%05u\t100%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[5], v72, v71, v70);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2b = "%s\f%05u\t100%d\f00000 / %d\n";
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        if ( pPlayer->GetBaseLevel() > 99 )
-            a2b = format_4E2E68;
-        v75 = pPlayer->GetBaseLevel();
-        v76 = pPlayer->GetActualLevel();
+        if ( player->GetBaseLevel() > 99 )
+            a2b = "%s\f%05u\t180%d\f00000 / %d\n";
+        v75 = player->GetBaseLevel();
+        v76 = player->GetActualLevel();
         v77 = UI_GetHealthManaStringColor(v76, v75);
         sprintf(pTmpBuf, a2b, pGlobalTXT_LocalizationStrings[131], v77, v76, v75);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        if ( (signed __int64)pPlayer->uExperience <= 9999999 )
-            v78 = pGlobalTXT_LocalizationStrings[83];
+        if (player->uExperience <= 9999999)
+            v78 = pGlobalTXT_LocalizationStrings[83]; // "Experience"
         else
-            v78 = pGlobalTXT_LocalizationStrings[17];
-        v81 = pPlayer->GetExperienceDisplayColor();
-        sprintf(pTmpBuf, "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(pPlayer->uExperience));
+            v78 = pGlobalTXT_LocalizationStrings[17]; // "Exp."
+        v81 = player->GetExperienceDisplayColor();
+        sprintf(pTmpBuf, "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(player->uExperience));
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight);
-        v83 = pPlayer->GetActualAttack(0);
+        v83 = player->GetActualAttack(0);
         sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], v83);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v85 = pPlayer->GetMeleeDamageString();
+        v85 = player->GetMeleeDamageString();
         sprintf(pTmpBuf, "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], v85);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v87 = pPlayer->GetRangedAttack();
+        v87 = player->GetRangedAttack();
         sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], v87);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v89 = pPlayer->GetRangedDamageString();
+        v89 = player->GetRangedDamageString();
         sprintf(pTmpBuf, "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], v89);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2c = format_4E2E10;
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 4;
-        v131 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
-        v90 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
+        v131 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
+        v90 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
         if ( v131 > 99 || v90 > 99 )
-            a2c = format_4E2E68;
+            a2c = "%s\f%05u\t180%d\f00000 / %d\n";
         v92 = UI_GetHealthManaStringColor(v131, v90);
         sprintf(pTmpBuf, a2c, pGlobalTXT_LocalizationStrings[87], v92, v131, v90);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2d = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v132 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
-        v93 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
+        v132 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
+        v93 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
         if ( v132 > 99 || v93 > 99 )
-            a2d = format_4E2E68;
+            a2d = "%s\f%05u\t180%d\f00000 / %d\n";
         v95 = UI_GetHealthManaStringColor(v132, v93);
         sprintf(pTmpBuf, a2d, pGlobalTXT_LocalizationStrings[6], v95, v132, v93);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2e = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v133 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
-        v96 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
+        v133 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
+        v96 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
         if ( v133 > 99 || v96 > 99 )
-            a2e = format_4E2E68;
+            a2e = "%s\f%05u\t180%d\f00000 / %d\n";
         v98 = UI_GetHealthManaStringColor(v133, v96);
         sprintf(pTmpBuf, a2e, pGlobalTXT_LocalizationStrings[240], v98, v133, v96);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2f = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v134 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
-        v99 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
+        v134 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
+        v99 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
         if ( v134 > 99 )
-            a2f = format_4E2E68;
+            a2f = "%s\f%05u\t180%d\f00000 / %d\n";
         v101 = UI_GetHealthManaStringColor(v134, v99);
         sprintf(pTmpBuf, a2f, pGlobalTXT_LocalizationStrings[70], v101, v134, v99);
         pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
 
         a2g = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v135 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
-        v102 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
+        v135 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
+        v102 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
         if ( v135 > 99 || v102 > 99 )
-            a2g = format_4E2E68;
+            a2g = "%s\f%05u\t180%d\f00000 / %d\n";
         v104 = UI_GetHealthManaStringColor(v135, v102);
         sprintf(pTmpBuf, a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v102);
-        if ( pPlayer->classType == PLAYER_CLASS_LICH && v102 == 200 )
+        if ( player->classType == PLAYER_CLASS_LICH && v102 == 200 )
         {
             v106 = UI_GetHealthManaStringColor(v135, 200);
             sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, pGlobalTXT_LocalizationStrings[625]);
@@ -2414,13 +2150,13 @@
 
         a2h = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
-        v136 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
-        v107 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
+        v136 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
+        v107 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
         if ( v136 > 99 || v107 > 99 )
-            a2h = format_4E2E68;
+            a2h = "%s\f%05u\t180%d\f00000 / %d\n";
         v109 = UI_GetHealthManaStringColor(v136, v107);
         sprintf(pTmpBuf, a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v107);
-        if ( pPlayer->classType == PLAYER_CLASS_LICH && v107 == 200 )
+        if ( player->classType == PLAYER_CLASS_LICH && v107 == 200 )
         {
             v111 = UI_GetHealthManaStringColor(v136, 200);
             sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, pGlobalTXT_LocalizationStrings[625]);
--- a/UiGame.cpp	Sat May 11 17:56:12 2013 +0200
+++ b/UiGame.cpp	Mon May 13 17:01:20 2013 +0200
@@ -48,6 +48,196 @@
 
 
 
+
+//----- (0041A57E) --------------------------------------------------------
+void GameUI_QuickRef_Draw()
+{
+        unsigned int v0; // ebx@1
+        //unsigned int v1; // eax@1
+        Player *pPlayer; // ebp@2
+        int v3; // eax@6
+        int v4; // edi@6
+        unsigned int v5; // eax@7
+        unsigned int v6; // edi@9
+        unsigned int v7; // edi@11
+        signed int v8; // eax@13
+        unsigned int v9; // eax@13
+        unsigned int v10; // edi@13
+        int v11; // eax@15
+        unsigned int v12; // eax@15
+        unsigned int v13; // edi@15
+        int v14; // eax@17
+        int v15; // ST18_4@17
+        int v16; // ebx@17
+        int v17; // eax@17
+        unsigned int v18; // eax@17
+        unsigned int v19; // edi@17
+        int v20; // eax@19
+        unsigned int v21; // edi@19
+        char *v22; // eax@21
+        unsigned int v23; // edi@21
+        int v24; // eax@23
+        unsigned int v25; // edi@23
+        char *v26; // eax@25
+        unsigned int v27; // edi@25
+        int v28; // ecx@27
+        char *v29; // eax@27
+        signed int v30; // edx@27
+        unsigned int v31; // edi@31
+        unsigned int v32; // edi@33
+        const char *v33; // ST10_4@35
+        unsigned int v34; // eax@35
+        unsigned int v35; // edi@35
+        unsigned __int8 v36; // al@37
+        char *v37; // eax@38
+        int v38; // eax@41
+        signed int v39; // edi@42
+        char *v40; // eax@45
+        unsigned int v41; // eax@45
+        signed int v43; // [sp+10h] [bp-1Ch]@1
+        unsigned int v44; // [sp+14h] [bp-18h]@2
+        int v45; // [sp+18h] [bp-14h]@1
+        unsigned int v46; // [sp+1Ch] [bp-10h]@1
+        unsigned int v47; // [sp+20h] [bp-Ch]@1
+        unsigned int v48; // [sp+24h] [bp-8h]@33
+        //unsigned int v49; // [sp+28h] [bp-4h]@1
+
+        v0 = 0;
+        v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
+        //v49 = TargetColor(0xFFu, 0, 0);
+        v46 = TargetColor(0, 0xFFu, 0);
+        //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE);
+        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
+        v43 = 0;
+        v45 = LOBYTE(pFontArrus->uFontHeight) + 1;
+        do
+            {
+            pPlayer = &pParty->pPlayers[v43];
+            v44 = 94 * v43 + 89;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, v0, pGlobalTXT_LocalizationStrings[149], 60, v0);//Name
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, v47, pPlayer->pName, 84, v0);
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, v0, pGlobalTXT_LocalizationStrings[131], 60, v0); //Уров.
+            v3 = pPlayer->GetActualLevel();
+            sprintf(pTmpBuf, "%lu", v3);
+            v4 = pPlayer->GetBaseLevel();
+            if ( pPlayer->GetActualLevel() <= v4 )
+                v5 = pPlayer->GetExperienceDisplayColor();
+            else
+                v5 = TargetColor(0, 0xFFu, v0);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, v0);
+            v6 = v45 + 47;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, v0, pGlobalTXT_LocalizationStrings[41], 60, v0);//Класс
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, v0, pClassNames[pPlayer->classType], 84, v0);
+            v7 = v45 + v6;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, v0, pGlobalTXT_LocalizationStrings[107], 60, v0);//Здор.
+            sprintf(pTmpBuf, "%d", pPlayer->sHealth);
+            v8 = pPlayer->GetMaxHealth();
+            v9 = UI_GetHealthManaStringColor(pPlayer->sHealth, v8);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, v0);
+            v10 = v45 + v7;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, v0, pGlobalTXT_LocalizationStrings[209], 60, v0);//Мана
+            sprintf(pTmpBuf, "%d", pPlayer->sMana);
+            v11 = pPlayer->GetMaxMana();
+            v12 = UI_GetHealthManaStringColor(pPlayer->sMana, v11);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, v0);
+            v13 = v45 + v10;
+            if ( v43 == v0 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, v0, pGlobalTXT_LocalizationStrings[0], 60, v0);//Класс брони
+            v14 = pPlayer->GetActualAC();
+            sprintf(pTmpBuf, "%d", v14);
+            v15 = v0;
+            v16 = pPlayer->GetBaseAC();
+            v17 = pPlayer->GetActualAC();
+            v18 = UI_GetHealthManaStringColor(v17, v16);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, v15);
+            v0 = 0;
+            v19 = v45 + v13;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Атака
+            v20 = pPlayer->GetActualAttack(0);
+            sprintf(pTmpBuf, "%+d", v20);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0);
+            v21 = v45 + v19;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр.
+            v22 = pPlayer->GetMeleeDamageString();
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0);
+            v23 = v45 + v21;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Стрелять
+            v24 = pPlayer->GetRangedAttack();
+            sprintf(pTmpBuf, "%+d", v24);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0);
+            v25 = v45 + v23;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр.
+            v26 = pPlayer->GetRangedDamageString();
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0);
+            v27 = v45 + v25;
+            if ( !v43 )
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Навыки
+            v28 = 0;
+            v29 = (char *)pPlayer->pActiveSkills;
+            v30 = 36;
+            do
+                {
+                if ( *(short *)v29 )
+                    ++v28;
+                v29 += 2;
+                --v30;
+                }
+                while ( v30 );
+                sprintf(pTmpBuf, "%lu", v28);
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0);
+                v31 = v45 + v27;
+                if ( !v43 )
+                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Очки
+                sprintf(pTmpBuf, "%lu", pPlayer->uSkillPoints);
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, pPlayer->uSkillPoints != 0 ? v46 : 0, pTmpBuf, 84, 0);
+                v32 = v45 + v31;
+                v48 = pPlayer->GetMajorConditionIdx();
+                if ( !v43 )
+                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Сост.
+                v33 = aCharacterConditionNames[v48];
+                v34 = GetConditionDrawColor(v48);
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0);
+                v35 = v45 + v32;
+                if ( !v43 )
+                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Б.Прим.
+                v36 = pPlayer->uQuickSpell;
+                if ( v36 )
+                    v37 = pSpellStats->pInfos[v36].pShortName;
+                else
+                    v37 = pGlobalTXT_LocalizationStrings[153];//Нет
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0);
+                ++v43;
+            }
+            while ( v43 < 4 );
+
+            v38 = GetPartyReputation();
+            if ( v38 >= 0 )
+                {
+                if ( v38 <= 5 )
+                    v39 = TargetColor(0xFF, 0xFF, 0xFF);
+                else
+                    v39 = TargetColor(0xFF, 0, 0);
+                }
+            else
+                v39 = v46;
+
+            v40 = GetReputationString(v38);
+            sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation
+            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0);
+            v41 = pParty->GetPartyFame();
+            sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame Слава
+            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0);
+        }
+
 //----- (0041AD6E) --------------------------------------------------------
 void __cdecl GameUI_DrawRightPanelItems()
 {
--- a/mm7_1.cpp	Sat May 11 17:56:12 2013 +0200
+++ b/mm7_1.cpp	Mon May 13 17:01:20 2013 +0200
@@ -74,7 +74,7 @@
 }
 
 //----- (004196A0) --------------------------------------------------------
-void __cdecl sub_4196A0()
+void CharacterUI_ReleaseButtons()
 {
   GUIButton *i; // esi@2
   GUIButton *j; // esi@7
--- a/mm7_5.cpp	Sat May 11 17:56:12 2013 +0200
+++ b/mm7_5.cpp	Mon May 13 17:01:20 2013 +0200
@@ -1431,7 +1431,7 @@
                   continue;
                 }
 LABEL_319:
-                sub_4196A0();
+                CharacterUI_ReleaseButtons();
                 sub_419379();
 LABEL_321:
                 pIcons_LOD->_4114F2();
@@ -2932,15 +2932,15 @@
           continue;
         case UIMSG_ClickStatsBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
-          sub_4196A0();
+          CharacterUI_ReleaseButtons();
           sub_419379();
           GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0);
           continue;
         case UIMSG_ClickSkillsBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101;
-          sub_4196A0();
+          CharacterUI_ReleaseButtons();
           sub_419379();
-          CharacterUI_SkillScreen_Draw();
+          CharacterUI_SkillsTab_CreateButtons();
           GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0);
           continue;
         case UIMSG_SkillUp:
@@ -2969,7 +2969,7 @@
         case UIMSG_ClickInventoryBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
           sub_419379();
-          sub_4196A0();
+          CharacterUI_ReleaseButtons();
           GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0);
           continue;
         case UIMSG_ClickExitCharacterWindowBtn:
@@ -2977,7 +2977,7 @@
           continue;
         case UIMSG_ClickAwardsBtn:
           sub_419379();
-          sub_4196A0();
+          CharacterUI_ReleaseButtons();
           sub_419220();
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102;
           GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0);
@@ -10229,7 +10229,7 @@
       }
       case WINDOW_CharacterRecord:
       {
-        CharacterUI_CharacterScreen_Draw(uActiveCharacter);
+        CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]);
         continue;
       }
       case WINDOW_Options:
@@ -10249,7 +10249,7 @@
       }
       case WINDOW_QuickReference:
       {
-        QuickRefDraw();
+        GameUI_QuickRef_Draw();
         continue;
       }
       case WINDOW_Rest:
@@ -10331,7 +10331,7 @@
         pRenderer->ClearZBuffer(0, 479);
         draw_leather();
         CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
-        CharacterUI_DrawPaperdoll(uActiveCharacter);
+        CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]);
         pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u));
         continue;
       }
--- a/mm7_data.cpp	Sat May 11 17:56:12 2013 +0200
+++ b/mm7_data.cpp	Mon May 13 17:01:20 2013 +0200
@@ -544,7 +544,6 @@
 char aS100S[777]; // idb
 char aS100D[777]; // idb
 char aS180[6]; // idb
-const char *format_4E2E68 = "%s\f%05u\t180%d\f00000 / %d\n";
 char aS_6[2]; // idb
 char aSS_0[777]; // idb
 char aS_5[4]; // idb
@@ -754,8 +753,6 @@
   0x83, 0xD8,
   0x7B, 0xD8,
 };
-int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248};
-int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA};
 char aItem092v3[777]; // idb
 char aIbCd5D[777]; // idb
 char aItem281pc02d[777]; // idb
@@ -1604,7 +1601,7 @@
 int dword_50C998_turnbased_icon_1A; // weak
 int uSpriteID_Spell11; // idb
 _UNKNOWN unk_50C9A0; // weak
-int _50C9A8_item_enchantment_timer; // weak
+int _50C9A8_item_enchantment_timer = 0; // weak
 int dword_50C9AC; // weak
 int dword_50C9D0; // weak
 int dword_50C9D4; // weak
--- a/mm7_data.h	Sat May 11 17:56:12 2013 +0200
+++ b/mm7_data.h	Mon May 13 17:01:20 2013 +0200
@@ -461,7 +461,6 @@
 extern char aS100S[]; // idb
 extern char aS100D[]; // idb
 extern char aS180[6]; // idb
-extern const char *format_4E2E68; // format 2 text of resistance in Stats screen
 extern char aS_6[2]; // idb
 extern char aSS_0[]; // idb
 extern char aS_5[4]; // idb
@@ -582,8 +581,6 @@
 extern int pPaperdoll_SecondLeftHand[4][2];
 extern int pPaperdoll_RightHand[4][2];
 extern int pPaperdollLeftEmptyHand[4][2];
-extern int pPaperdollRingsX[6];
-extern int pPaperdollRingsY[6];
 extern char aItem092v3[]; // idb
 extern char aIbCd5D[]; // idb
 extern char aItem281pc02d[]; // idb
@@ -1596,8 +1593,6 @@
 void FillAwardsData();
 void sub_419220();
 void sub_419379();
-void CharacterUI_SkillScreen_Draw();
-void sub_4196A0();
 unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels);
 void __cdecl draw_leather();
 void __cdecl GameUI_DrawRightPanelItems();
@@ -1687,8 +1682,6 @@
 int __stdcall DirectInputMouse_enumerator(int, int); // weak
 void CharacterUI_LoadPaperdollTextures();
 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 Player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3);