view UICharacter.cpp @ 1039:682ba1c83fd3

Merge
author Nomad
date Thu, 23 May 2013 03:32:36 +0200
parents f93d17337113
children e23a79658fc5
line wrap: on
line source

#include <assert.h>

#include "MM7.h"

#include "MapInfo.h"
#include "Game.h"
#include "GUIWindow.h"
#include "GUIFont.h"
#include "GUIProgressBar.h"
#include "Party.h"
#include "AudioPlayer.h"
#include "Outdoor.h"
#include "IndoorCamera.h"
#include "LOD.h"
#include "Viewport.h"
#include "Time.h"
#include "Awards.h"
#include "CastSpellInfo.h"
#include "texts.h"

#include "mm7_data.h"




int bRingsShownInCharScreen; // 5118E0


unsigned int ui_mainmenu_copyright_color;

unsigned int ui_character_default_text_color;
unsigned int ui_character_skill_highlight_color;
unsigned int ui_character_header_text_color;
unsigned int ui_character_bonus_text_color;
unsigned int ui_character_bonus_text_color_neg;
unsigned int ui_character_skill_upgradeable_color;
unsigned int ui_character_skill_default_color;
unsigned int ui_character_award_color[6];

unsigned int ui_game_minimap_outline_color;
unsigned int ui_game_minimap_actor_friendly_color;
unsigned int ui_game_minimap_actor_hostile_color;
unsigned int ui_game_minimap_actor_corpse_color;
unsigned int ui_game_minimap_decoration_color_1;
unsigned int ui_game_minimap_projectile_color;
unsigned int ui_game_minimap_treasure_color;
unsigned int ui_game_character_record_playerbuff_colors[24];

unsigned int ui_gamemenu_video_gamma_title_color;
unsigned int ui_gamemenu_keys_action_name_color;
unsigned int ui_gamemenu_keys_key_selection_blink_color_1;
unsigned int ui_gamemenu_keys_key_selection_blink_color_2;
unsigned int ui_gamemenu_keys_key_default_color;

unsigned int ui_book_quests_title_color;
unsigned int ui_book_quests_text_color;
unsigned int ui_book_autonotes_title_color;
unsigned int ui_book_autonotes_text_color;
unsigned int ui_book_map_title_color;
unsigned int ui_book_map_coordinates_color;

unsigned int ui_book_calendar_title_color;
unsigned int ui_book_calendar_time_color;
unsigned int ui_book_calendar_day_color;
unsigned int ui_book_calendar_month_color;
unsigned int ui_book_calendar_year_color;
unsigned int ui_book_calendar_moon_color;
unsigned int ui_book_calendar_location_color;

unsigned int ui_book_journal_title_color;
unsigned int ui_book_journal_text_color;
unsigned int ui_book_journal_text_shadow;


void set_default_ui_skin()
{
  ui_mainmenu_copyright_color = TargetColor(255, 255, 255);

  ui_character_default_text_color = TargetColor(255, 255, 255);
  ui_character_header_text_color = TargetColor(255, 255, 155);
  ui_character_bonus_text_color = TargetColor(0, 255, 0);
  ui_character_bonus_text_color_neg = TargetColor(255, 0, 0);

  ui_character_skill_upgradeable_color = TargetColor(0, 175, 255);
  ui_character_skill_default_color = TargetColor(255, 0, 0);
  ui_character_skill_highlight_color = TargetColor(255, 0, 0);  

  ui_character_award_color[0] = TargetColor(248, 108, 160);
  ui_character_award_color[1] = TargetColor(112, 220, 248);
  ui_character_award_color[2] = TargetColor(192, 192, 240);
  ui_character_award_color[3] = TargetColor( 64, 244,  96);
  ui_character_award_color[4] = TargetColor(232, 244,  96);
  ui_character_award_color[5] = TargetColor(240, 252, 192);
  
  ui_game_minimap_outline_color = TargetColor(0, 0, 255);
  ui_game_minimap_actor_friendly_color = TargetColor(0, 255, 0);
  ui_game_minimap_actor_hostile_color = TargetColor(255, 0, 0);
  ui_game_minimap_actor_corpse_color = TargetColor(255, 255, 0);
  ui_game_minimap_decoration_color_1 = TargetColor(255, 255, 255);
  ui_game_minimap_projectile_color = TargetColor(255, 0, 0);
  ui_game_minimap_treasure_color = TargetColor(0, 0, 255);
  ui_game_character_record_playerbuff_colors[0] = TargetColor(150, 212, 255);
  ui_game_character_record_playerbuff_colors[1] = TargetColor(225, 225, 225);
  ui_game_character_record_playerbuff_colors[2] = TargetColor(255, 128, 0);
  ui_game_character_record_playerbuff_colors[3] = TargetColor(128, 128, 128);
  ui_game_character_record_playerbuff_colors[4] = TargetColor(225, 225, 225);
  ui_game_character_record_playerbuff_colors[5] = TargetColor(255, 85, 0);
  ui_game_character_record_playerbuff_colors[6] = TargetColor(255, 128, 0);
  ui_game_character_record_playerbuff_colors[7] = TargetColor(255, 85, 0);
  ui_game_character_record_playerbuff_colors[8] = TargetColor(225, 225, 225);
  ui_game_character_record_playerbuff_colors[9] = TargetColor(235, 15, 255);
  ui_game_character_record_playerbuff_colors[10] = TargetColor(192, 192, 240);
  ui_game_character_record_playerbuff_colors[11] = TargetColor(225, 225, 225);
  ui_game_character_record_playerbuff_colors[12] = TargetColor(255, 128, 0);
  ui_game_character_record_playerbuff_colors[13] = TargetColor(150, 212, 255);
  ui_game_character_record_playerbuff_colors[14] = TargetColor(128, 128, 128);
  ui_game_character_record_playerbuff_colors[15] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[16] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[17] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[18] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[19] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[20] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[21] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[22] = TargetColor(0, 128, 255);
  ui_game_character_record_playerbuff_colors[23] = TargetColor(0, 128, 255);

  ui_gamemenu_video_gamma_title_color = TargetColor(255, 255, 155);
  ui_gamemenu_keys_action_name_color = TargetColor(255, 255, 255);
  ui_gamemenu_keys_key_selection_blink_color_1 = TargetColor(50, 0, 0);
  ui_gamemenu_keys_key_selection_blink_color_2 = TargetColor(225, 205, 35);
  ui_gamemenu_keys_key_default_color = TargetColor(255, 255, 255);

  ui_book_quests_title_color = TargetColor(255, 255, 255);
  ui_book_quests_text_color = TargetColor(255, 255, 255);
  ui_book_autonotes_title_color = TargetColor(255, 255, 255);
  ui_book_autonotes_text_color = TargetColor(255, 255, 255);
  ui_book_map_title_color = TargetColor(255, 255, 255);
  ui_book_map_coordinates_color = TargetColor(255, 255, 255);

  ui_book_calendar_title_color = TargetColor(255, 255, 255);
  ui_book_calendar_time_color = TargetColor(75, 75, 75);
  ui_book_calendar_day_color = TargetColor(75, 75, 75);
  ui_book_calendar_month_color = TargetColor(75, 75, 75);
  ui_book_calendar_year_color = TargetColor(75, 75, 75);
  ui_book_calendar_moon_color = TargetColor(75, 75, 75);
  ui_book_calendar_location_color = TargetColor(75, 75, 75);

  ui_book_journal_title_color = TargetColor(255, 255, 255);
  ui_book_journal_text_color = TargetColor(255, 255, 255);
  ui_book_journal_text_shadow = TargetColor(0, 0, 0);
}




//----- (00421626) --------------------------------------------------------
GUIWindow *CharacterUI_Initialize(unsigned int _this)
{
  GUIWindow *pWindow; // edi@3

  ++pIcons_LOD->uTexturePacksCount;
  if ( !pIcons_LOD->uNumPrevLoadedFiles )
    pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;

  pEventTimer->Pause();
  pAudioPlayer->StopChannels(-1, -1);
  bRingsShownInCharScreen = false;
  CharacterUI_LoadPaperdollTextures();
  pCurrentScreen = _this;

  pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0);
  pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308,
                                pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureWidth,
                                pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureHeight,
                                1, 0, UIMSG_ClickStatsBtn, 0, 'S', pGlobalTXT_LocalizationStrings[216],// Stats
                                pIcons_LOD->GetTexture(papredoll_dbrds[10]),
                                pIcons_LOD->GetTexture(papredoll_dbrds[9]), 0);
  pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308,
                                 pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureWidth,
                                 pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureHeight,
                                 1, 0, UIMSG_ClickSkillsBtn, 0, 'K', pGlobalTXT_LocalizationStrings[205],//Skills
                                 pIcons_LOD->GetTexture(papredoll_dbrds[8]),
                                 pIcons_LOD->GetTexture(papredoll_dbrds[7]), 0);
  pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308,
                                    pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureWidth,
                                    pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureHeight,
                                    1, 0, UIMSG_ClickInventoryBtn, 0, 'I', pGlobalTXT_LocalizationStrings[120], //Inventory
                                    pIcons_LOD->GetTexture(papredoll_dbrds[6]),
                                    pIcons_LOD->GetTexture(papredoll_dbrds[5]), 0);
  pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308,
                                 pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureWidth,
                                 pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureHeight,
                                 1, 0, UIMSG_ClickAwardsBtn, 0, 'A', pGlobalTXT_LocalizationStrings[22], //Awards
                                 pIcons_LOD->GetTexture(papredoll_dbrds[4]),
                                 pIcons_LOD->GetTexture(papredoll_dbrds[3]), 0);
  pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308,
                 pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureWidth,
                 pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureHeight,
                 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit
                 pIcons_LOD->GetTexture(papredoll_dbrds[2]),
                 pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0);
  pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0);
  pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 30, 30, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0);
  pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0);

  pWindow->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
  pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
  pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
  pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);

  pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0);
  FillAwardsData();
  return pWindow;
}

//----- (004219BE) --------------------------------------------------------
GUIWindow *CastSpellInfo::sub_4219BE()
{
  GUIWindow *v2; // ebx@1

  pEventTimer->Pause();
  pAudioPlayer->StopChannels(-1, -1);
  bRingsShownInCharScreen = 0;
  CharacterUI_LoadPaperdollTextures();
  pCurrentScreen = SCREEN_CASTING;
  v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell_InInventory, (int)this, 0);
  pCharacterScreen_ExitBtn = v2->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0,
                 pGlobalTXT_LocalizationStrings[79], // Close
                 pIcons_LOD->GetTexture(papredoll_dbrds[2]),
                 pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0);
  v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0);
  pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0);

  v2->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
  v2->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
  v2->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
  v2->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);

  return v2;
}






static int CharacterUI_SkillsTab_Draw__DrawSkillTable(Player *player, int x, int y, int *skill_list, int skill_list_size, int right_margin, const char *skill_group_name)
{
  int y_offset = y;
  
  sprintf(pTmpBuf, "%s\r%03d%s", skill_group_name, right_margin, pGlobalTXT_LocalizationStrings[131]); //"Level"
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, x, y, ui_character_header_text_color, pTmpBuf, 0, 0, 0);

  int num_skills_drawn = 0;
  for (uint i = 0; i < skill_list_size; ++i)
  {
    auto skill = (PLAYER_SKILL_TYPE)skill_list[i];
    for (uint j = 0; j < pGUIWindow_CurrentMenu->uNumControls; ++j)
    {
      auto v8 = pGUIWindow_CurrentMenu->pControlsHead;

      for (int v7 = j; v7 > 0; --v7)
        v8 = v8->pNext;

      auto v9 = v8->field_1C;
      if ((short)(v8->field_1C) >= 0)
        continue;
      if ( (v9 & 0x7FFF) != skill )
        continue;

      ++num_skills_drawn;
      y_offset = v8->uY;

      auto skill_value = player->pActiveSkills[skill];
      auto skill_level = skill_value & 0x3F;

      uint skill_color = 0;
      uint skill_mastery_color = 0;
      if (player->uSkillPoints > skill_level)
        skill_color = ui_character_skill_upgradeable_color;

      if (pGUIWindow_CurrentMenu->pCurrentPosActiveItem == j)
      {
        if (player->uSkillPoints > skill_level)
          skill_mastery_color = ui_character_bonus_text_color;
        else
          skill_mastery_color = ui_character_skill_default_color;
        skill_color = skill_mastery_color;
      }

      if (SkillToMastery(skill_value) == 1)
      {
        sprintfex(pTmpBuf, "%s\r%03d%2d", pSkillNames[skill], right_margin, skill_level);
        pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf, 0, 0, 0);
      }
      else
      {
        const char *v46 = nullptr;

        switch (SkillToMastery(skill_value))
        {
          case 4: v46 = pGlobalTXT_LocalizationStrings[96];  break; // "Grand"
          case 3: v46 = pGlobalTXT_LocalizationStrings[432]; break; // Master
          case 2: v46 = pGlobalTXT_LocalizationStrings[433]; break; // Expert
        }

        if (!skill_mastery_color)
          skill_mastery_color = ui_character_header_text_color;

        
        sprintfex(pTmpBuf, "%s \f%05d%s\f%05d\r%03d%2d", pSkillNames[skill], skill_mastery_color, v46, skill_color, right_margin, skill_level);
        pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf, 0, 0, 0);
      }
    }
  }

  if (!num_skills_drawn)
  {
    y_offset += LOBYTE(pFontLucida->uFontHeight) - 3;
    pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, y_offset, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); //"None"
  }

  return y_offset;
}



//----- (00419719) --------------------------------------------------------
void CharacterUI_SkillsTab_Draw(Player *player)
{
  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_skill", TEXTURE_16BIT_PALETTE));

  sprintfex(pTmpBuf, "%s \f%05d^Pv[%s]\f00000\r177%s: \f%05d%d\f00000",
            pGlobalTXT_LocalizationStrings[206],        // Skills for
            ui_character_header_text_color,
            player->pName,
            pGlobalTXT_LocalizationStrings[207],        // Skill Points
            player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color,
            player->uSkillPoints);
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);

  int y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
  y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pWeaponSkills, 9, 400, pGlobalTXT_LocalizationStrings[242]); // "Weapons"

  y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10;
  CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pMagicSkills, 9, 400, pGlobalTXT_LocalizationStrings[138]); // "Magic"

  y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
  y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pArmorSkills, 5, 177, pGlobalTXT_LocalizationStrings[11]); // "Armor"
 
  y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10;
  y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pMiscSkills, 12, 177, pGlobalTXT_LocalizationStrings[143]); //"Misc"
}










//----- (0041A000) --------------------------------------------------------
void CharacterUI_AwardsTab_Draw(Player *player)
{
    //unsigned int v1; // esi@1
    //unsigned int v2; // ebx@1
    //unsigned int award_texture_id; // eax@1
    unsigned int result; // eax@1
    int v5; // eax@15
    char *v6; // ebx@15
    int v7; // eax@23
    int v8; // eax@24
    int v9; // eax@25
    //int v10; // eax@27
    int v11; // eax@32
    int v12; // eax@33
    int v13; // eax@34
    //signed int v14; // eax@43
    //unsigned int v15; // eax@43
    //int v16; // eax@43
    //int v17; // [sp-4h] [bp-D4h]@16
    char Source[100]; // [sp+Ch] [bp-C4h]@1
    GUIWindow a1; // [sp+70h] [bp-60h]@1
    //unsigned int v20; // [sp+C4h] [bp-Ch]@15
    //int v21; // [sp+C8h] [bp-8h]@14
    //int v22; // [sp+CCh] [bp-4h]@40

  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE));
  sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_character_header_text_color);
  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 (BtnDown_flag && num_achieved_awards + dword_506528 < num_achieved_awards_2)
    result = dword_506528++ + 1;
  if (BtnUp_flag && result)
  {
    --result;
    dword_506528 = result;
  }

    if ( dword_50651C < 0 )
        {
        result += num_achieved_awards;
        dword_506528 = result;
        if ( (signed int)(num_achieved_awards + result) > num_achieved_awards_2 )
            {
            result = num_achieved_awards_2 - num_achieved_awards;
            dword_506528 = result;
            }
        }
    else if ( dword_50651C > 0 )
        {
        result -= num_achieved_awards;
        dword_506528 = result;
        if ( (result & 0x80000000u) != 0 )
            {
            result = 0;
            dword_506528 = result;
            }
        }
    //LABEL_14:
    BtnDown_flag = 0;
    BtnUp_flag = 0;
    num_achieved_awards = 0;
    dword_50651C = 0;


    for (uint i = result; i < num_achieved_awards_2; ++i)
    {
      v5 = achieved_awards[i];
      v6 = (char *)pAwards[v5].pText;//(char *)dword_723E80_award_related[v20 / 4];

            pTmpBuf[0] = 0;
            switch (v5)
            {
              case Award_Arena_PageWins:    sprintf(pTmpBuf, v6, pParty->uNumArenaPageWins);     break;
              case Award_Arena_SquireWins:  sprintf(pTmpBuf, v6, pParty->uNumArenaSquireWins);   break;
              case Award_Arena_KnightWins:  sprintf(pTmpBuf, v6, pParty->uNumArenaKnightWins);   break;
              case Award_Arena_LordWins:    sprintf(pTmpBuf, v6, pParty->uNumArenaLordWins);     break;
              case Award_ArcomageWins:      sprintf(pTmpBuf, v6, pParty->uNumArcomageWins);      break;
              case Award_ArcomageLoses:     sprintf(pTmpBuf, v6, pParty->uNumArcomageLoses);     break;
              case Award_Deaths:            sprintf(pTmpBuf, v6, pParty->uNumDeaths);            break;
              case Award_BountiesCollected: sprintf(pTmpBuf, v6, pParty->uNumBountiesCollected); break;
              case Award_Fine:              sprintf(pTmpBuf, v6, pParty->uFine);                 break;
              case Award_PrisonTerms:       sprintf(pTmpBuf, v6, pParty->uNumPrisonTerms);       break;
            }

            if (*pTmpBuf)
              v6 = pTmpBuf;


            a1.DrawText(pFontArrus, 0, 0, ui_character_award_color[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;

            ++num_achieved_awards;
        }
 }






//----- (0041A2C1) --------------------------------------------------------
unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels)
{
  if ( (signed int)uNumPixels < 14 )
    uNumPixels = 14;
  return ((signed int)(uNumPixels - 14) >> 5) + 1;
}



//----- (0041A556) --------------------------------------------------------
void draw_leather()
{
  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather));
}


//----- (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;

    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;

    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;

    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 CharacterUI_DrawPaperdoll(Player *player)
{
  //signed int pSex; // eax@1
  unsigned int v6; // ecx@9
  int v7; // ecx@10
  unsigned int pMainHandNum4; // eax@14
  ItemGen *item_MainHand4; // eax@15
  int v10; // edx@15
  unsigned int pX_MainHand4; // edi@15
  unsigned int v14; // ebx@18
  Texture *v16; // ebp@27
  double v17; // st7@29
  int v18; // edi@30
  char *v19; // eax@30
  unsigned int pBowNum; // eax@37
  ItemGen *itemBow; // edi@38
  int pX_Bow; // ebx@38
  double v28; // st7@51
  char *v30; // eax@54
  unsigned int pCloakNum; // eax@59
  ItemGen *item_Cloak; // edx@60
  int v33; // eax@65
  int v34; // eax@74
  int v35; // ebx@74
  LODFile_IconsBitmaps *v38; // ecx@78
  Texture *v39; // edi@85
  double v40; // st7@87
  int v41; // edi@88
  unsigned int pArmorNum; // eax@93
  ItemGen *item_Armor; // edx@94
  int v45; // eax@98
  int v48; // ebx@106
  LODFile_IconsBitmaps *v50; // ecx@110
  Texture *v51; // edi@117
  double v52; // st7@119
  int v53; // edi@120
  char *v55; // eax@122
  unsigned int pBootNum; // eax@127
  ItemGen *item_Boot; // edi@128
  int v59; // ebx@129
  int v60; // ecx@132
  Texture *v63; // edi@145
  double v64; // st7@147
  int v65; // edi@148
  char *v66; // eax@148
  unsigned int pMainHandNum; // edx@155
  int v70; // edx@156
  unsigned int pBeltNum; // eax@160
  ItemGen *item_Belt; // edi@161
  int v73; // edx@163
  unsigned int v75; // ebx@170
  Texture *v77; // edi@181
  double v78; // st7@183
  int v79; // edi@184
  char *v80; // eax@184
  unsigned int pMainHandNum2; // eax@192
  int v83; // eax@193
  int pArmorShoulderNum; // eax@197
  int v87; // eax@197
  int v88; // eax@198
  int v89; // eax@199
  int v94; // ebx@214
  int v95; // eax@214
  char *v96; // edi@226
  double v97; // st7@228
  int v98; // edi@229
  char *v99; // eax@229
  int pX_ArmorShoulder; // eax@237
  int pY_ArmorShoulder; // ecx@237
  int v106; // edx@238
  int v107; // edx@239
  int v108; // edx@240papredoll_flying_feet
  int v109; // edi@250
  char *v110; // edx@250
  unsigned int pCloakCollarNum; // eax@259
  ItemGen *item_CloakCollar; // eax@260
  int v114; // eax@265
  int v116; // ebx@274
        double v118; // st7@286
        int v119; // edi@287
        char *v120; // eax@287
        unsigned int v122; // edi@295
        int pHelmNum; // ebx@297
        ItemGen *item_Helm; // edi@298
        int v125; // ecx@303
        unsigned int v127; // ebx@314
        Texture *v129; // edi@325
        double v130; // st7@327
        int v131; // edi@328
        char *v132; // eax@328
        unsigned int pMainHandNum3; // eax@335
        ItemGen *item_MainHand3; // eax@336
        unsigned int v138; // ebx@339
        Texture *v140; // edi@348
        double v141; // st7@350
        int v142; // edi@351
        char *v143; // eax@351
        unsigned int pShieldNum; // eax@358
        ItemGen *item_Shield; // eax@359
        int v149; // edx@359
        int pX_Shield; // ebx@362
        int v151; // ecx@363
        int v152; // ecx@364
        unsigned int v153; // eax@370
        Texture *v157; // ebp@381
        double v158; // st7@383
        char *v160; // eax@386
        unsigned int pMainHandNum5; // eax@393
        ItemGen *item_MainHand5; // eax@394
        char *v166; // [sp-8h] [bp-54h]@16
        const char *v167; // [sp-8h] [bp-54h]@23
        const char *v168; // [sp-8h] [bp-54h]@43
        const char *v169; // [sp-8h] [bp-54h]@79
        const char *v170; // [sp-8h] [bp-54h]@111
        const char *v171; // [sp-8h] [bp-54h]@141
        const char *v172; // [sp-8h] [bp-54h]@177
        const char *v173; // [sp-8h] [bp-54h]@222
        const char *v178; // [sp-8h] [bp-54h]@242
        const char *v179; // [sp-8h] [bp-54h]@280
        const char *v180; // [sp-8h] [bp-54h]@321
        char *v181; // [sp-8h] [bp-54h]@337
        const char *v182; // [sp-8h] [bp-54h]@344
        const char *v183; // [sp-8h] [bp-54h]@375
        signed int v186; // [sp-4h] [bp-50h]@202
        signed int v191; // [sp-4h] [bp-50h]@266
        signed int v192; // [sp-4h] [bp-50h]@304
        int pY_MainHand4; // [sp+10h] [bp-3Ch]@15
        int pY_Bow; // [sp+10h] [bp-3Ch]@38
        unsigned int pY_Cloak; // [sp+10h] [bp-3Ch]@74
        unsigned int pY_Armor; // [sp+10h] [bp-3Ch]@106
        int pY_Boot; // [sp+10h] [bp-3Ch]@129
        int pY_Belt; // [sp+10h] [bp-3Ch]@168
        unsigned int pY_shoulder; // [sp+10h] [bp-3Ch]@216
        unsigned int pY_CloakCollar; // [sp+10h] [bp-3Ch]@274
        int pY_Helm; // [sp+10h] [bp-3Ch]@312
        int pY_MainHand3; // [sp+10h] [bp-3Ch]@336
        int pY_Shield; // [sp+10h] [bp-3Ch]@362
        Texture *a2b; // [sp+14h] [bp-38h]@49
        int pX_Cloak; // [sp+14h] [bp-38h]@74
        int pX_Armor; // [sp+14h] [bp-38h]@106
        int pX_Boot; // [sp+14h] [bp-38h]@129
        int pX_Belt; // [sp+14h] [bp-38h]@168
        int pX_shoulder; // [sp+14h] [bp-38h]@214
        int pX_CloakCollar; // [sp+14h] [bp-38h]@274
        Texture *a2i; // [sp+14h] [bp-38h]@284
        int pX_Helm; // [sp+14h] [bp-38h]@312
        int pX_MainHand3; // [sp+14h] [bp-38h]@336
        int pBodyComplection; // [sp+24h] [bp-28h]@6
        unsigned int pBowTextureNum; // [sp+2Ch] [bp-20h]@38
        signed int v245; // [sp+34h] [bp-18h]@361
        signed int IsDwarf; // [sp+40h] [bp-Ch]@4

  pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
  if (player->GetRace() == CHARACTER_RACE_DWARF)
  {
    IsDwarf = 1;
    pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 2 : 3;
  }
  else
  {
    IsDwarf = 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(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]), 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],
         pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1]));
    pMainHandNum4 = pPlayers[uPlayerID]->pEquipment.uMainHand;
    if ( pMainHandNum4 )
    {
      item_MainHand4 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum4 - 1];
      pX_MainHand4 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipX;
      pY_MainHand4 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipY;
      if ( item_MainHand4->uItemID == 64 )
        v166 = "item64v1";
      else
        v166 = pItemsTable->pItems[item_MainHand4->uItemID].pIconName;
      v14 = pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE);
      if ( !( item_MainHand4->uAttributes & 0xF0 ) )
      {
        v18 = v14 + 1;
        v19 = (char *)pIcons_LOD->GetTexture(v14);
        if ( item_MainHand4->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_MainHand4, pY_MainHand4, (Texture *)v19);
        else
        {
          if ( item_MainHand4->uAttributes & 1 )
            pRenderer->DrawTextureTransparent(pX_MainHand4, pY_MainHand4, (Texture *)v19);
          else
            pRenderer->DrawTransparentGreenShade(pX_MainHand4, pY_MainHand4, (Texture *)v19);
        }
      }
      if ( item_MainHand4->uAttributes & 0xF0 )
      {
        if ( ( item_MainHand4->uAttributes & 0xF0) == 16 )
          v167 = "sptext01";
        if ( ( item_MainHand4->uAttributes & 0xF0) == 32 )
          v167 = "sp28a";
        if ( (item_MainHand4->uAttributes & 0xF0) == 64 )
          v167 = "sp30a";
        if ( (item_MainHand4->uAttributes & 0xF0) == 128 )
          v167 = "sp91a";
        v16 = pIcons_LOD->LoadTexturePtr(v167, TEXTURE_16BIT_PALETTE);
        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
        if ( _50C9A8_item_enchantment_timer <= 0 )
        {
          _50C9A8_item_enchantment_timer = 0;
          item_MainHand4->uAttributes &= 0xFu;
          ptr_50C9A4 = 0;
        }
        v17 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_MainHand4, pY_MainHand4, pIcons_LOD->GetTexture(v14), v16, (signed __int64)v17, 0, 255);
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_MainHand4, pY_MainHand4, (Texture *)v19, pMainHandNum4);
    }
  }
  else// без акваланга
  {
    pBowNum = pPlayers[uPlayerID]->pEquipment.uBow; //сначала рисуется лук
    if ( pBowNum )
    {
      itemBow = &pPlayers[uPlayerID]->pInventoryItems[pBowNum - 1];
      pX_Bow = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[itemBow->uItemID].uEquipX;
      pY_Bow = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[itemBow->uItemID].uEquipY;
      pBowTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[itemBow->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
      if ( !(itemBow->uAttributes & 0xF0) )// если не применён закл
      {
        if ( itemBow->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum));
        else
        {
          v30 = (char *)pIcons_LOD->GetTexture(pBowTextureNum);
          if ( !(itemBow->uAttributes & 1) )//не опознанный лук зелёный
            pRenderer->DrawTransparentGreenShade(pX_Bow, pY_Bow, (Texture *)v30);
          else // опознанный лук
            pRenderer->DrawTextureTransparent(pX_Bow, pY_Bow, (Texture *)v30);
        }
      }
      else
      {
        if ( (itemBow->uAttributes & 0xF0) == 16 )
          v168 = "sptext01";
        if ( (itemBow->uAttributes & 0xF0) == 32 )
          v168 = "sp28a";
        if ( (itemBow->uAttributes & 0xF0) == 64 )
          v168 = "sp30a";
        if ( (itemBow->uAttributes & 0xF0) == 128 )
          v168 = "sp91a";
        a2b = pIcons_LOD->LoadTexturePtr(v168, TEXTURE_16BIT_PALETTE);
        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
        if ( _50C9A8_item_enchantment_timer <= 0 )
        {
          _50C9A8_item_enchantment_timer = 0;
          itemBow->uAttributes &= 0xFu;
          ptr_50C9A4 = 0;
        }
        v28 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum), a2b, (signed __int64)v28, 0, 255);
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum), pBowNum);
    }
    pCloakNum = pPlayers[uPlayerID]->pEquipment.uCloak;// потом плащ
    if ( pCloakNum )
    {
      item_Cloak = &pPlayers[uPlayerID]->pInventoryItems[pCloakNum - 1];
      switch ( item_Cloak->uItemID )
      {
        case 525:
          v33 = 5;
          break;
        case 530:
          v33 = 6;
          break;
        case 547:
          v33 = 7;
          break;
        case 548:
          v33 = 8;
          break;
        case 550:
          v33 = 9;
          break;
        default:
          v33 = item_Cloak->uItemID - 105;
          break;
      }
      if ( v33 >= 0 && v33 < 10 )
      {
        v35 = paperdoll_cloak_texture[pBodyComplection][v33];//Texture_Cloak
        pX_Cloak = pPaperdoll_BodyX + paperdoll_Cloak[pBodyComplection][v33][0];
        pY_Cloak = pPaperdoll_BodyY + paperdoll_Cloak[pBodyComplection][v33][1];
        if ( !(item_Cloak->uAttributes & 0xF0) )
        {
          v41 = v35 + 1;
          if ( item_Cloak->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35));
          else
            pRenderer->DrawTextureTransparent(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35));
        }
        else
        {
          if ( (item_Cloak->uAttributes & 0xF0) == 16 )
            v169 = "sptext01";
          if ( (item_Cloak->uAttributes & 0xF0) == 32 )
            v169 = "sp28a";
          if ( (item_Cloak->uAttributes & 0xF0) != 64 )
            v169 = "sp30a";
          if ( (item_Cloak->uAttributes & 0xF0) == 128 )
            v169 = "sp91a";
          v39 = pIcons_LOD->LoadTexturePtr(v169, TEXTURE_16BIT_PALETTE);
          _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
          if ( _50C9A8_item_enchantment_timer <= 0 )
          {
            _50C9A8_item_enchantment_timer = 0;
            item_Cloak->uAttributes &= 0xFu;
            ptr_50C9A4 = 0;
          }
          v40 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35), v39, (signed __int64)v40, 0, 255);
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35), pCloakNum);
      }
    }
    pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY,//рисуется кукла
            pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]));
    pArmorNum = pPlayers[uPlayerID]->pEquipment.uArmor;// потом броня
    if ( pArmorNum )
    {
      item_Armor = &pPlayers[uPlayerID]->pInventoryItems[pArmorNum - 1];
      switch ( item_Armor->uItemID )
      {
        case 504:
          v45 = 15;
          break;
        case 505:
          v45 = 14;
          break;
        case 516:
          v45 = 13;
          break;
        case 533:
          v45 = 16;
          break;
        default:
          v45 = item_Armor->uItemID - 66;
          break;
      }
      if ( v45 >= 0 && v45 < 17 )
      {
        pX_Armor = pPaperdoll_BodyX + paperdoll_Armor[pBodyComplection][v45][0];
        pY_Armor = pPaperdoll_BodyY + paperdoll_Armor[pBodyComplection][v45][1];
        v48 = paperdoll_armor_texture[pBodyComplection][v45][0];
        if ( !(item_Armor->uAttributes & 0xF0) )
        {
          v53 = v48 + 1;
          if ( item_Armor->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Armor, pY_Armor, pIcons_LOD->GetTexture(v48));
          else
          {
            v55 = (char *)&pIcons_LOD->pTextures[v48];
            if ( !(item_Armor->uAttributes & 1) )
              pRenderer->DrawTransparentGreenShade(pX_Armor, pY_Armor, (Texture *)v55);
            else
              pRenderer->DrawTextureTransparent(pX_Armor, pY_Armor, (Texture *)v55);
          }
        }
        else
        {
          if ( (item_Armor->uAttributes & 0xF0) == 16 )
            v170 = "sptext01";
          if ( (item_Armor->uAttributes & 0xF0) == 32 )
            v170 = "sp28a";
          if ( (item_Armor->uAttributes & 0xF0) == 64 )
            v170 = "sp30a";
          if ( (item_Armor->uAttributes & 0xF0) == 128 )
            v170 = "sp91a";
          v51 = pIcons_LOD->LoadTexturePtr(v170, TEXTURE_16BIT_PALETTE);
          _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
          if ( _50C9A8_item_enchantment_timer <= 0 )
          {
            _50C9A8_item_enchantment_timer = 0;
            item_Armor->uAttributes &= 0xFu;
            ptr_50C9A4 = 0;
          }
          v52 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Armor, pY_Armor, pIcons_LOD->GetTexture(v48), v51, (signed __int64)v52, 0, 255);
        }
        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][v45][2];
          if ( v94 == pIcons_LOD->FindTextureByName("pending") )
          {
            v94 = paperdoll_armor_texture[pBodyComplection][v45][1];
            pX_shoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0];
            pY_shoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1];
          }
          else
          {
            pX_shoulder = pPaperdoll_BodyX + dword_4E5270[v45][0];
            pY_shoulder = pPaperdoll_BodyY + dword_4E5270[v45][1];
          }
          if ( !(item_Armor->uAttributes & 0xF0) )
          {
            v98 = v94 + 1;
            v99 = (char *)pIcons_LOD->GetTexture(v94);
            if ( item_Armor->uAttributes & 2 )
              pRenderer->DrawTransparentRedShade(pX_shoulder, pY_shoulder, (Texture *)v99);
            else
            {
              if ( item_Armor->uAttributes & 1 )
                pRenderer->DrawTextureTransparent(pX_shoulder, pY_shoulder, (Texture *)v99);
              else
                pRenderer->DrawTransparentGreenShade(pX_shoulder, pY_shoulder, (Texture *)v99);
            }
          }
          else
          {
            if ( v94 != pIcons_LOD->FindTextureByName("pending") )
            {
              if ( item_Armor->uAttributes & 0xF0 )
              {
                if ( (item_Armor->uAttributes & 0xF0) == 16 )
                  v173 = "sptext01";
                if ( (item_Armor->uAttributes & 0xF0) == 32 )
                  v173 = "sp28a";
                if ( ( item_Armor->uAttributes & 0xF0) == 64 )
                  v173 = "sp30a";
                if ( (item_Armor->uAttributes & 0xF0) == 128 )
                  v173 = "sp91a";
                v96 = (char *)pIcons_LOD->LoadTexturePtr(v173, TEXTURE_16BIT_PALETTE);
                _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
                if ( _50C9A8_item_enchantment_timer <= 0 )
                {
                  _50C9A8_item_enchantment_timer = 0;
                  item_Armor->uAttributes &= 0xFu;
                  ptr_50C9A4 = 0;
                }
                v97 = (double)GetTickCount();
                pRenderer->_4A63E6(pX_shoulder, pY_shoulder, pIcons_LOD->GetTexture(v94), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255);
              }
            }
          }
        }
        else
        {
          v94 = paperdoll_armor_texture[pBodyComplection][v45][1];
          if ( v94 != pIcons_LOD->FindTextureByName("pending") )
          {
            pX_ArmorShoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0];
            pY_ArmorShoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1];
            if ( !(item_Armor->uAttributes & 0xF0) )
            {
              v109 = v94 + 1;
              v110 = (char *)pIcons_LOD->GetTexture(v94);
              if ( item_Armor->uAttributes & 2 )
                pRenderer->DrawTransparentRedShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110);
              else
              {
                if ( item_Armor->uAttributes & 1 )
                  pRenderer->DrawTextureTransparent(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110);
                else
                  pRenderer->DrawTransparentGreenShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110);
              }
            }
            else
            {
              if ( (item_Armor->uAttributes & 0xF0) == 16 )
                v178 = "sptext01";
              if ( (item_Armor->uAttributes & 0xF0) == 32 )
                v178 = "sp28a";
              if ( (item_Armor->uAttributes & 0xF0) == 64 )
                v178 = "sp30a";
              if ( (item_Armor->uAttributes & 0xF0) == 128 )
                v178 = "sp91a";
              v96 = (char *)pIcons_LOD->LoadTexturePtr(v178, TEXTURE_16BIT_PALETTE);
              _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
              if ( _50C9A8_item_enchantment_timer <= 0 )
              {
                _50C9A8_item_enchantment_timer = 0;
                item_Armor->uAttributes &= 0xFu;
                ptr_50C9A4 = 0;
              }
              v97 = (double)GetTickCount();
              pRenderer->_4A63E6(pX_ArmorShoulder, pY_ArmorShoulder, pIcons_LOD->GetTexture(v94), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255);
            }
          }
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Armor, pY_Armor, (Texture *)v55, pArmorNum);
      }
    }
    pBootNum = pPlayers[uPlayerID]->pEquipment.uBoot;//далее обувь
    if ( pBootNum )
    {
      item_Boot = &pPlayers[uPlayerID]->pInventoryItems[pBootNum - 1];
      switch ( item_Boot->uItemID )
      {
        case 529:
          v60 = 5;
          v59 = papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace];
          break;
        case 512:
          v60 = 6;
          v59 = paperdoll_boots_texture[pBodyComplection][5];
          break;
        default:
          v60 = item_Boot->uItemID - 115;
          v59 = paperdoll_boots_texture[pBodyComplection][v60];
          break;
      }
      if ( v60 >= 0 && v60 < 7 )
      {
        pX_Boot = pPaperdoll_BodyX + paperdoll_Boot[pBodyComplection][v60][0];
        pY_Boot = pPaperdoll_BodyY + paperdoll_Boot[pBodyComplection][v60][1];
        if ( !(item_Boot->uAttributes & 0xF0) )
        {
          v65 = v59 + 1;
          v66 = (char *)pIcons_LOD->GetTexture(v59);
          if ( item_Boot->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Boot, pY_Boot, (Texture *)v66);
          else
          {
            if ( item_Boot->uAttributes & 1 )
              pRenderer->DrawTextureTransparent(pX_Boot, pY_Boot, (Texture *)v66);
            else
              pRenderer->DrawTransparentGreenShade(pX_Boot, pY_Boot, (Texture *)v66);
          }
        }
        else
        {
          if ( (item_Boot->uAttributes & 0xF0) == 16 )
            v171 = "sptext01";
          if ( (item_Boot->uAttributes & 0xF0) == 32 )
            v171 = "sp28a";
          if ( (item_Boot->uAttributes & 0xF0) == 64 )
            v171 = "sp30a";
          if ( (item_Boot->uAttributes & 0xF0) == 128 )
            v171 = "sp91a";
          v63 = pIcons_LOD->LoadTexturePtr(v171, TEXTURE_16BIT_PALETTE);
          _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
          if ( _50C9A8_item_enchantment_timer <= 0 )
          {
            _50C9A8_item_enchantment_timer = 0;
            item_Boot->uAttributes &= 0xFu;
            ptr_50C9A4 = 0;
          }
          v64 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Boot, pY_Boot, pIcons_LOD->GetTexture(v59), v63, (signed __int64)v64, 0, 255);
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Boot, pY_Boot, (Texture *)v66, pBootNum);
      }
    }
    pMainHandNum = pPlayers[uPlayerID]->pEquipment.uMainHand;
    if ( !pMainHandNum || (v70 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[pMainHandNum -1], pItemsTable->pItems[v70].uEquipType != 1)
        && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) )
      pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0],
            pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1],
                     pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1]));
        pBeltNum = pPlayers[uPlayerID]->pEquipment.uBelt;// далее пояс
        if ( pBeltNum )
        {
          item_Belt = &pPlayers[uPlayerID]->pInventoryItems[pBeltNum - 1];
        switch ( item_Belt->uItemID )
        {
          case 524:
            v73 = 5;
            break;
          case 535:
            v73 = 6;
            break;
          default:
            v73 = item_Belt->uItemID - 100;
            break;
        }
        if ( v73 >= 0 && v73 < 7 )
        {
          pX_Belt = pPaperdoll_BodyX + paperdoll_Belt[pBodyComplection][v73][0];
          pY_Belt = pPaperdoll_BodyY + paperdoll_Belt[pBodyComplection][v73][1];
          if ( IsDwarf != 1 || v73 == 5 )
            v75 = paperdoll_belt_texture[pBodyComplection][v73];
          else
           v75 = paperdoll_belt_texture[pBodyComplection - 2][v73];
          if ( !(item_Belt->uAttributes & 0xF0) )
          {
            v79 = v75 + 1;
            v80 = (char *)pIcons_LOD->GetTexture(v75);
            if ( item_Belt->uAttributes & 2 )
              pRenderer->DrawTransparentRedShade(pX_Belt, pY_Belt, (Texture *)v80);
            else
            {
              if ( item_Belt->uAttributes & 1 )
                pRenderer->DrawTextureTransparent(pX_Belt, pY_Belt, (Texture *)v80);
              else
                pRenderer->DrawTransparentGreenShade(pX_Belt, pY_Belt, (Texture *)v80);
            }
            if ( !bRingsShownInCharScreen )
              pRenderer->DrawMaskToZBuffer(pX_Belt, pY_Belt, (Texture *)v80, pBeltNum);
          }
          else
          {
            if ( (item_Belt->uAttributes & 0xF0) == 16 )
              v172 = "sptext01";
            if ( (item_Belt->uAttributes & 0xF0) == 32 )
              v172 = "sp28a";
            if ( (item_Belt->uAttributes & 0xF0) == 64 )
              v172 = "sp30a";
            if ( (item_Belt->uAttributes & 0xF0) == 128 )
              v172 = "sp91a";
            v77 = pIcons_LOD->LoadTexturePtr(v172, TEXTURE_16BIT_PALETTE);
            _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
            if ( _50C9A8_item_enchantment_timer <= 0 )
            {
              _50C9A8_item_enchantment_timer = 0;
              item_Belt->uAttributes &= 0xFu;
              ptr_50C9A4 = 0;
            }
            v78 = (double)GetTickCount() * 0.1;
            pRenderer->_4A63E6(pX_Belt, pY_Belt, pIcons_LOD->GetTexture(v75), v77, (signed __int64)v78, 0, 255);
          }
        }
      }
      pMainHandNum2 = pPlayers[uPlayerID]->pEquipment.uMainHand;
      if ( pMainHandNum2 )
      {
        v83 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[pMainHandNum2 - 1];
        if ( pItemsTable->pItems[v83].uEquipType == 1
             || pItemsTable->pItems[v83].uSkillType == 4 && !pPlayers[uPlayerID]->pEquipment.uShield )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0],
             pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1],
             pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1]));
      }
      pCloakCollarNum = pPlayers[uPlayerID]->pEquipment.uCloak;//далее воротник плаща
      if ( pCloakCollarNum )
      {
        item_CloakCollar = &pPlayers[uPlayerID]->pInventoryItems[pCloakCollarNum - 1];
        switch ( item_CloakCollar->uItemID )
        {
          case 525:
            v114 = 5;
            break;
          case 530:
            v114 = 6;
            break;
          case 547:
            v114 = 7;
            break;
          case 548:
            v114 = 8;
            break;
          case 550:
            v114 = 9;
            break;
          default:
            v114 = item_CloakCollar->uItemID - 105;
        }
        if ( v114 >= 0 && v114 < 10 )
        {
          v116 = paperdoll_cloak_collar_texture[pBodyComplection][v114];
          pX_CloakCollar = pPaperdoll_BodyX + paperdoll_CloakCollar[pBodyComplection][v114][0];
          pY_CloakCollar = pPaperdoll_BodyY + paperdoll_CloakCollar[pBodyComplection][v114][1];
          if ( v116 != pIcons_LOD->FindTextureByName("pending") )
          {
            if ( !(item_CloakCollar->uAttributes & 0xF0) )
            {
              v119 = v116 + 1;
              v120 = (char *)pIcons_LOD->GetTexture(v116);
              if ( item_CloakCollar->uAttributes & 2 )
                pRenderer->DrawTransparentRedShade(pX_CloakCollar, pY_CloakCollar, (Texture *)v120);
              else
                pRenderer->DrawTextureTransparent(pX_CloakCollar, pY_CloakCollar, (Texture *)v120);
              if ( !bRingsShownInCharScreen )
                pRenderer->DrawMaskToZBuffer(pX_CloakCollar, pY_CloakCollar, (Texture *)v120, pCloakCollarNum);
            }
            else
            {
              if ( (item_CloakCollar->uAttributes & 0xF0) == 16 )
                v179 = "sptext01";
              if ( (item_CloakCollar->uAttributes & 0xF0) == 32 )
                v179 = "sp28a";
              if ( (item_CloakCollar->uAttributes & 0xF0) == 64 )
                v179 = "sp30a";
              if ( (item_CloakCollar->uAttributes & 0xF0) == 128 )
                v179 = "sp91a";
              a2i = pIcons_LOD->LoadTexturePtr(v179, TEXTURE_16BIT_PALETTE);
              _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
              if ( _50C9A8_item_enchantment_timer <= 0 )
              {
                _50C9A8_item_enchantment_timer = 0;
                item_CloakCollar->uAttributes &= 0xFu;
                ptr_50C9A4 = 0;
              }
              v118 = (double)GetTickCount() * 0.1;
              pRenderer->_4A63E6(pX_CloakCollar, pY_CloakCollar, pIcons_LOD->GetTexture(v116), a2i, (signed __int64)v118, 0, 255);
            }
          }
        }
      }
      if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 )
      {
        v122 = papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace];
        if ( v122 != pIcons_LOD->FindTextureByName("Pending") )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 24],
                     pPaperdoll_BodyY + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 23],
                     pIcons_LOD->GetTexture(v122));
      }
    pHelmNum = pPlayers[uPlayerID]->pEquipment.uHelm;//далее шлем
    if ( pHelmNum )
    {
      item_Helm = &pPlayers[uPlayerID]->pInventoryItems[pHelmNum-1];
      switch ( item_Helm->uItemID )
      {
        case 521:
          v125 = 11;
          break;
        case 522:
          v125 = 12;
          break;
        case 523:
          v125 = 13;
          break;
        case 532:
          v125 = 14;
          break;
        case 544:
          v125 = 15;
          break;
        default:
          v125 = item_Helm->uItemID - 89;
      }
      if ( v125 >= 0 && v125 < 16 )
      {
        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[player->GetSexByVoice()][v125];
        else
          v127 = papredoll_dbrds[11];
        if ( item_Helm->uAttributes & 0xF0 )
        {
          if ( (item_Helm->uAttributes & 0xF0) == 16 )
            v180 = "sptext01";
          if ( (item_Helm->uAttributes & 0xF0) == 32 )
            v180 = "sp28a";
          if ( (item_Helm->uAttributes & 0xF0) == 64 )
            v180 = "sp30a";
          if ( (item_Helm->uAttributes & 0xF0) == 128 )
            v180 = "sp91a";
          v129 = pIcons_LOD->LoadTexturePtr(v180, TEXTURE_16BIT_PALETTE);
          _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
          if ( _50C9A8_item_enchantment_timer <= 0 )
          {
            _50C9A8_item_enchantment_timer = 0;
            item_Helm->uAttributes &= 0xFu;
            ptr_50C9A4 = 0;
          }
          v130 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Helm, pY_Helm, pIcons_LOD->GetTexture(v127), v129, (signed __int64)v130, 0, 255);
        }
        else
        {
          v131 = v127 + 1;
          v132 = (char *)pIcons_LOD->GetTexture(v127);
          if ( item_Helm->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Helm, pY_Helm, (Texture *)v132);
          else
          {
            if ( item_Helm->uAttributes & 1 )
              pRenderer->DrawTextureTransparent(pX_Helm, pY_Helm, (Texture *)v132);
            else
              pRenderer->DrawTransparentGreenShade(pX_Helm, pY_Helm, (Texture *)v132);
          }
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Helm, pY_Helm, (Texture *)v132, pHelmNum);
      }
    }
    pMainHandNum3 = pPlayers[uPlayerID]->pEquipment.uMainHand;//weapon in right hand
    if ( pMainHandNum3 )
    {
      item_MainHand3 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum3 - 1];
      pX_MainHand3 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipX;
      pY_MainHand3 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipY;
      if ( item_MainHand3->uItemID == 64 )
        v181 = "item64v1";
      else
        v181 = pItemsTable->pItems[item_MainHand3->uItemID].pIconName;
      v138 = pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE);
      if ( !(item_MainHand3->uAttributes & 0xF0) )
      {
        v142 = v138 + 1;
        v143 = (char *)pIcons_LOD->GetTexture(v138);
        if ( item_MainHand3->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_MainHand3, pY_MainHand3, (Texture *)v143);
        else
        {
          if ( item_MainHand3->uAttributes & 1 )
            pRenderer->DrawTextureTransparent(pX_MainHand3, pY_MainHand3, (Texture *)v143);
          else
            pRenderer->DrawTransparentGreenShade(pX_MainHand3, pY_MainHand3, (Texture *)v143);
        }
      }
      else
      {
        if ( (item_MainHand3->uAttributes & 0xF0) == 16 )
          v182 = "sptext01";
        if ( (item_MainHand3->uAttributes & 0xF0) == 32 )
          v182 = "sp28a";
        if ( (item_MainHand3->uAttributes & 0xF0) == 64 )
           v182 = "sp30a";
        if ( (item_MainHand3->uAttributes & 0xF0) == 128 )
          v182 = "sp91a";
        v140 = pIcons_LOD->LoadTexturePtr(v182, TEXTURE_16BIT_PALETTE);
        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
        if ( _50C9A8_item_enchantment_timer <= 0 )
        {
          _50C9A8_item_enchantment_timer = 0;
          item_MainHand3->uAttributes &= 0xFu;
          ptr_50C9A4 = 0;
        }
        v141 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_MainHand3, pY_MainHand3, pIcons_LOD->GetTexture(v138), v140, (signed __int64)v141, 0, 255);
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_MainHand3, pY_MainHand3, (Texture *)v143, pMainHandNum3);
    }
    pShieldNum = pPlayers[uPlayerID]->pEquipment.uShield;// далее щит
    if ( pShieldNum )
    {
      item_Shield = &pPlayers[uPlayerID]->pInventoryItems[pShieldNum - 1];
      v149 = pItemsTable->pItems[item_Shield->uItemID].uSkillType;
      if ( v149 == 2 || v149 == 1 )
      {
        v151 = item_Shield->uItemID - 400;
        pX_Shield = 596;
        v245 = 1;
        switch ( item_Shield->uItemID )
        {
          case 400:
            pY_Shield = 86;
            break;
          case 403:
            pY_Shield = 28;
            break;
          case 415:
            pX_Shield = 595;
            pY_Shield = 33;
            break;
          default:
            pX_Shield = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_Shield->uItemID].uEquipX;
            pY_Shield = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_Shield->uItemID].uEquipY;
            break;
        }
      }
      else
      {
        v245 = 0;
        pX_Shield = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_Shield->uItemID].uEquipX;
        pY_Shield = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_Shield->uItemID].uEquipY;
      }
      v153 = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_Shield->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
      if ( !(item_Shield->uAttributes & 0xF0) )
      {
        if ( item_Shield->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153));
        else
        {
          v160 = (char *)pIcons_LOD->GetTexture(v153);
          if ( !(item_Shield->uAttributes & 1) )
          pRenderer->DrawTransparentGreenShade(pX_Shield, pY_Shield, (Texture *)v160);
          else
            pRenderer->DrawTextureTransparent(pX_Shield, pY_Shield, (Texture *)v160);
        }
      }
      else
      {
        if ( (item_Shield->uAttributes & 0xF0) == 16 )
          v183 = "sptext01";
        if ( (item_Shield->uAttributes & 0xF0) == 32 )
          v183 = "sp28a";
        if ( (item_Shield->uAttributes & 0xF0) == 64 )
          v183 = "sp30a";
        if ( (item_Shield->uAttributes & 0xF0) == 128 )
          v183 = "sp91a";
        v157 = pIcons_LOD->LoadTexturePtr(v183, TEXTURE_16BIT_PALETTE);
        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
        if ( _50C9A8_item_enchantment_timer <= 0 )
        {
          _50C9A8_item_enchantment_timer = 0;
          item_Shield->uAttributes &= 0xFu;
          ptr_50C9A4 = 0;
        }
        v158 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153), v157, (signed __int64)v158, 0, 255);
        if ( v245 )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[pBodyComplection][0],
                 pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhs[uPlayerID - 1]));
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153), pShieldNum);
    }
  }
  pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_drhs[uPlayerID - 1]));
  pMainHandNum5 = pPlayers[uPlayerID]->pEquipment.uMainHand;
  if ( pMainHandNum5 )
  {
    item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum5 - 1];
    if ( pItemsTable->pItems[item_MainHand5->uItemID].uEquipType == 1 || pItemsTable->pItems[item_MainHand5->uItemID].uSkillType == 4 && !pPlayers[uPlayerID]->pEquipment.uShield )
      pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhus[uPlayerID - 1]));
  }
  if ( !bRingsShownInCharScreen )//рисование лупы
    pRenderer->DrawTextureTransparent(603, 299, pIcons_LOD->GetTexture(uTextureID_MAGNIF_B));
  pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));//обрамление
}







//----- (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)
    {
      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);
    }
    else
    {
      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;
    }
  }
}



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
  {
    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;
    }

    _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->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);
  }
}

//----- (0043BCA7) --------------------------------------------------------
void CharacterUI_LoadPaperdollTextures()
{
  int v0; // edi@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
  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
  unsigned int v22; // eax@76
  int v23; // ecx@76
  unsigned int v24; // eax@78
  int v25; // ecx@78
  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
  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
  {
    v42 = v30 + 1;
    if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v30 + 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;
      else
        v3 = (pSex != 0) + 1;
      wsprintfA(pContainer, "pc23v%dBod", v3);
      papredoll_dbods[v0] = 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
      wsprintfA(pContainer, "pc23v%dlau", v3);
      papredoll_dlaus[v0] = 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
      wsprintfA(pContainer, "pc23v%dlh", v3);
      papredoll_dlhs[v0] = 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_flying_feet[pPlayer->uCurrentFace] = 0;
      IsPlayerWearingWatersuit[v30 + 1] = 1;
    }
    else
    {
      v6 = v30;
      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);
      v7 = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
      pPlayer2 = pPlayers[v30 + 1];
      papredoll_dlhus[v30] = v7;
      v9 = (char *)&pPlayer2->uCurrentFace;
      v10 = *v9;
      if ( *v9 == 12 || v10 == 13 )
      {
        wsprintfA(pContainer, "pc%02dbrd", v10 + 1);
        v9 = (char *)&pPlayers[v6 + 1]->uCurrentFace;
        papredoll_dbrds[*v9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      }
      wsprintfA(pContainer, "item281pc%02d", *v9 + 1);
      papredoll_flying_feet[pPlayers[v6 + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      IsPlayerWearingWatersuit[v30 + 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);
  uTextureID_ar_dn_dn = pIcons_LOD->LoadTexture("ar_dn_dn", TEXTURE_16BIT_PALETTE);
  papredoll_dbrds[9] = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE);
  papredoll_dbrds[7] = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE);
  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
  {
    party_has_equipment[v11] = 0;
    if ( pParty->pPickedItem.uItemID != v11 + 66 )
    {
      for ( uint i = 0; i < 4; ++i)
      {
        if ( Player_has_item(v11 + 66, &pParty->pPlayers[i], 0) )
          party_has_equipment[v11] = 1;
      }
    }
  }
  memset(byte_5111F6, 0, 16);
  for (uint i = 0; i < 4; ++i)
  {
    auto player = pParty->pPlayers + i;

    if (Player_has_item(ITEM_ARTICACT_GOVERNONS_ARMOR, player, 1))    byte_5111F6[0] = 1;
    if (Player_has_item(ITEM_ARTIFACT_YORUBA, player, 1))             byte_5111F6[1] = 1;
    if (Player_has_item(ITEM_RELIC_HARECS_LEATHER, player, 1))        byte_5111F6[2] = 1;
    if (Player_has_item(ITEM_ARTIFACT_LEAGUE_BOOTS, player, 1))       byte_5111F6[3] = 1;
    if (Player_has_item(ITEM_RELIC_TALEDONS_HELM, player, 1))         byte_5111F6[4] = 1;
    if (Player_has_item(ITEM_RELIC_SCHOLARS_CAP, player, 1))          byte_5111F6[5] = 1;
    if (Player_has_item(ITEM_RELIC_PHYNAXIAN_CROWN, player, 1))       byte_5111F6[6] = 1;
    if (Player_has_item(ITEM_ARTIFACT_MINDS_EYE, player, 1))          byte_5111F6[7] = 1;
    if (Player_has_item(ITEM_RARE_SHADOWS_MASK, player, 1))           byte_5111F6[8] = 1;
    if (Player_has_item(ITEM_RILIC_TITANS_BELT, player, 1))           byte_5111F6[9] = 1;
    if (Player_has_item(ITEM_ARTIFACT_HEROS_BELT, player, 1))         byte_5111F6[10] = 1;
    if (Player_has_item(ITEM_RELIC_TWILIGHT, player, 1))              byte_5111F6[11] = 1;
    if (Player_has_item(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, player, 1)) byte_5111F6[12] = 1;
    if (Player_has_item(ITEM_RARE_SUN_CLOAK, player, 1))              byte_5111F6[13] = 1;
    if (Player_has_item(ITEM_RARE_MOON_CLOAK, player, 1))             byte_5111F6[14] = 1;
    if (Player_has_item(ITEM_RARE_VAMPIRES_CAPE, player, 1))          byte_5111F6[15] = 1;
    if (Player_has_item(ITEM_ELVEN_CHAINMAIL, player, 1))             byte_5111F6[16] = 1;
  }


  for (uint i = 0; i < 2; ++i)
  {
    for ( uint j = 0; j < 5; ++j )//Belt
    {
      GetItemTextureFilename(pContainer, j + 100, i + 1, 0);
      paperdoll_belt_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    }
    GetItemTextureFilename(pContainer, 535, i + 1, 0);
    paperdoll_belt_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    for ( uint j = 0; j < 11; ++j )//Helm
    {
      GetItemTextureFilename(pContainer, j + 89, i + 1, 0);
      paperdoll_helm_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    }
    GetItemTextureFilename(pContainer, 521, i + 1, 0);
    paperdoll_helm_texture[i][11] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    GetItemTextureFilename(pContainer, 522, i + 1, 0);
    paperdoll_helm_texture[i][12] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    GetItemTextureFilename(pContainer, 523, i + 1, 0);
    paperdoll_helm_texture[i][13] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    GetItemTextureFilename(pContainer, 532, i + 1, 0);
    paperdoll_helm_texture[i][14] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    GetItemTextureFilename(pContainer, 544, i + 1, 0);
    paperdoll_helm_texture[i][15] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    if ( _43ED6F_check_party_races(true) )
      papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE);
  }
  v43 = 0;
  for (uint i = 0; i < 4; ++i)
  {
    if ( sub_43EDB9_get_some_race_sex_relation_2(i) )
    {
      GetItemTextureFilename(pContainer, 524, i + 1, 0);
      paperdoll_belt_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Titans belt
      pItemTXTNum = 66;
      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);
        GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 1);
        paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 2);
        paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        pItemTXTNum++;
      }
      GetItemTextureFilename(pContainer, 516, i + 1, 0);//artefacts
      paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 516, i + 1, 1);
      paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 516, i + 1, 2);
      paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 505, i + 1, 0);
      paperdoll_armor_texture[i][v32 + 1][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 505, i + 1, 1);
      paperdoll_armor_texture[i][v32 + 1][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 505, i + 1, 2);
      paperdoll_armor_texture[i][v32 + 1][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 504, i + 1, 0);
      paperdoll_armor_texture[i][v32 + 2][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 504, i + 1, 1);
      paperdoll_armor_texture[i][v32 + 2][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 504, i + 1, 2);
      paperdoll_armor_texture[i][v32 + 2][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 533, i + 1, 0);
      paperdoll_armor_texture[i][v32 + 3][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 533, i + 1, 1);
      paperdoll_armor_texture[i][v32 + 3][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 533, i + 1, 2);
      paperdoll_armor_texture[i][v32 + 3][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      for ( v33 = 0; v33 < 5; ++v33 )//boots
      {
        GetItemTextureFilename(pContainer, v33 + 115, i + 1, 0);
        paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      }
      GetItemTextureFilename(pContainer, 512, i + 1, 0);
      paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      for ( v38 = 0; v38 < 5; ++v38 )//Cloak
      {
        GetItemTextureFilename(pContainer, v38 + 105, i + 1, 0);
        paperdoll_cloak_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        GetItemTextureFilename(pContainer, v38 + 105, i + 1, 1);
        paperdoll_cloak_collar_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      }
      GetItemTextureFilename(pContainer, 525, i + 1, 0);
      paperdoll_cloak_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 530, i + 1, 0);
      paperdoll_cloak_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 547, i + 1, 0);
      paperdoll_cloak_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 548, i + 1, 0);
      paperdoll_cloak_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 550, i + 1, 0);
      paperdoll_cloak_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 525, i + 1, 1);
      paperdoll_cloak_collar_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 530, i + 1, 1);
      paperdoll_cloak_collar_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 547, i + 1, 1);
      paperdoll_cloak_collar_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 548, i + 1, 1);
      paperdoll_cloak_collar_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 550, i + 1, 1);
      paperdoll_cloak_collar_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    }
    else
    {
      v26 = v43;
    }
    v43 = v26 + 40;
  }
}

//----- (00419401) --------------------------------------------------------
void CharacterUI_SkillsTab_CreateButtons()
{
    unsigned int v0; // ecx@3
    GUIButton *pButton; // eax@3
    GUIFont *v2; // eax@8
    unsigned int v3; // esi@8
    int v4; // eax@10
    unsigned int v5; // esi@14
    int v6; // eax@17
    unsigned int v7; // esi@19
    int v8; // eax@21
    unsigned int v9; // esi@25
    int v10; // eax@27
    int a2; // [sp+10h] [bp-14h]@1
    int v12; // [sp+14h] [bp-10h]@8
    int v13; // [sp+14h] [bp-10h]@19
    int *v14; // [sp+18h] [bp-Ch]@8
    int *v15; // [sp+18h] [bp-Ch]@14
    int *v16; // [sp+18h] [bp-Ch]@19
    int *v17; // [sp+18h] [bp-Ch]@25
    Player *v18; // [sp+1Ch] [bp-8h]@8
    int a5; // [sp+20h] [bp-4h]@8

    a2 = 0;
    if ( dword_507CC0 )
        CharacterUI_ReleaseButtons();
    v0 = uActiveCharacter;
    dword_507CC0 = uActiveCharacter;
    for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
    {
        if ( pButton->msg == UIMSG_InventoryLeftClick )
        {
            dword_50698C = pButton->uX;
            dword_506988 = pButton->uY;
            dword_506984 = pButton->uZ;
            dword_506980 = pButton->uW;
            pButton->uW = 0;
            pButton->uZ = 0;
            pButton->uY = 0;
            pButton->uX = 0;
            v0 = uActiveCharacter;
            }
        }
    v12 = 0;
    a5 = pGUIWindow_CurrentMenu->uNumControls;
    v18 = &pParty->pPlayers[v0-1];
    v2 = pFontLucida;
    v14 = pWeaponSkills;
    v3 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
    do
        {
        if ( v18->pActiveSkills[*v14] & 0x3F )//crash
            {
            v4 = LOBYTE(v2->uFontHeight);
            v3 = v3 + v4 - 3;
            ++a2;
            ++v12;
            pGUIWindow_CurrentMenu->CreateButton(0x18u, v3, 0xCCu, v4 - 3, 3, *v14 | 0x8000, UIMSG_SkillUp, *v14, 0, "", 0, 0);
            v2 = pFontLucida;
            }
        ++v14;
        }
        while ( v14 <= &pWeaponSkills[8] );
        if ( !v12 )
            v3 = v3 + LOBYTE(v2->uFontHeight) - 3;
        v15 = pMagicSkills;
        v5 = v3 + 2 * LOBYTE(v2->uFontHeight) - 6;
        do
            {
            if ( v18->pActiveSkills[*v15] & 0x3F && a2 < 15 )
                {
                v6 = LOBYTE(v2->uFontHeight);
                v5 = v5 + v6 - 3;
                ++a2;
                pGUIWindow_CurrentMenu->CreateButton(0x18u, v5, 0xCCu, v6 - 3, 3, *v15 | 0x8000, UIMSG_SkillUp, *v15, 0, "", 0, 0);
                v2 = pFontLucida;
                }
            ++v15;
            }
            while ( v15 <= &pMagicSkills[8] );
            v13 = 0;
            v16 = pArmorSkills;
            v7 = 2 * LOBYTE(v2->uFontHeight) + 13;
            do
                {
                if ( v18->pActiveSkills[*v16] & 0x3F )
                    {
                    v8 = LOBYTE(v2->uFontHeight);
                    v7 = v7 + v8 - 3;
                    ++a2;
                    ++v13;
                    pGUIWindow_CurrentMenu->CreateButton(0xF6u, v7, 0xCCu, v8 - 3, 3, *v16 | 0x8000, UIMSG_SkillUp, *v16, 0, "", 0, 0);
                    v2 = pFontLucida;
                    }
                ++v16;
                }
                while ( v16 <= &pArmorSkills[4] );
                if ( !v13 )
                    v7 = v7 + LOBYTE(v2->uFontHeight) - 3;
                v17 = pMiscSkills;
                v9 = v7 + 2 * LOBYTE(v2->uFontHeight) - 6;
                do
                    {
                    if ( v18->pActiveSkills[*v17] & 0x3F )
                        {
                        v10 = LOBYTE(v2->uFontHeight);
                        v9 = v9 + v10 - 3;
                        ++a2;
                        pGUIWindow_CurrentMenu->CreateButton(0xF6u, v9, 0xCCu, v10 - 3, 3, *v17 | 0x8000, UIMSG_SkillUp, *v17, 0, "", 0, 0);
                        v2 = pFontLucida;
                        }
                    ++v17;
                    }
                    while ( v17 <= &pMiscSkills[11] );
                    if ( a2 )
                        pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(a2, 1, 0, a5);
    }



//----- (00418511) --------------------------------------------------------
    void CharacterUI_StatsTab_Draw( Player *player )
        {
        //Player *pPlayer; // edi@1
        //unsigned int v4; // eax@2
        int v7; // ebp@4
        int v8; // eax@4
        unsigned int v9; // eax@4
        int v10; // ST34_4@4
        int v13; // ebp@4
        int v14; // eax@4
        unsigned int v15; // eax@4
        int v19; // ebp@4
        int v20; // eax@4
        unsigned int v21; // eax@4
        int v25; // ebp@4
        int v26; // eax@4
        unsigned int v27; // eax@4
        int v31; // ebp@4
        int v32; // eax@4
        unsigned int v33; // eax@4
        int v37; // ebp@4
        int v38; // eax@4
        unsigned int v39; // eax@4
        int v43; // ebp@4
        int v44; // eax@4
        unsigned int v45; // eax@4
        signed int v49; // eax@6
        unsigned int v50; // eax@6
        int v53; // eax@8
        unsigned int v54; // eax@8
        int v58; // ebp@8
        int v59; // eax@8
        unsigned int v60; // eax@8
        unsigned int v62; // eax@8
        signed int v64; // eax@8
        //unsigned __int8 v66; // al@8
        char *v67; // eax@9
        signed int v70; // ebp@11
        signed int v71; // eax@11
        unsigned int v72; // eax@11
        int v75; // ebp@13
        int v76; // eax@13
        unsigned int v77; // eax@13
        char *v78; // ecx@14
        unsigned int v81; // eax@16
        int v83; // eax@16
        char *v85; // eax@16
        int v87; // eax@16
        char *v89; // eax@16
        int v90; // eax@16
        unsigned int v92; // eax@19
        int v93; // eax@19
        unsigned int v95; // eax@22
        int v96; // eax@22
        unsigned int v98; // eax@25
        int v99; // eax@25
        unsigned int v101; // eax@27
        int v102; // eax@27
        unsigned int v104; // eax@30
        unsigned int v106; // eax@32
        int v107; // eax@33
        unsigned int v109; // eax@36
        unsigned int v111; // eax@38
        const char *a2; // [sp+14h] [bp-Ch]@4
        const char *a2a; // [sp+14h] [bp-Ch]@6
        const char *a2b; // [sp+14h] [bp-Ch]@11
        const char *a2c; // [sp+14h] [bp-Ch]@16
        const char *a2d; // [sp+14h] [bp-Ch]@19
        const char *a2e; // [sp+14h] [bp-Ch]@22
        const char *a2f; // [sp+14h] [bp-Ch]@25
        const char *a2g; // [sp+14h] [bp-Ch]@27
        const char *a2h; // [sp+14h] [bp-Ch]@33
        int v131; // [sp+18h] [bp-8h]@16
        int v132; // [sp+18h] [bp-8h]@19
        int v133; // [sp+18h] [bp-8h]@22
        int v134; // [sp+18h] [bp-8h]@25
        int v135; // [sp+18h] [bp-8h]@27
        int v136; // [sp+18h] [bp-8h]@33

        //pPlayer = &pParty->pPlayers[uPlayerID-1];
        //pPlayer = player;
  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE));
  sprintf(pTmpBuf, "\f%05d", ui_character_header_text_color);
  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_character_bonus_text_color : ui_character_default_text_color,
            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 += 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;
        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 = 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 ( player->GetMaxHealth() >= 1000 )
            a2 = "%s\f%05u\r388%d\f00000 / %d\n";
        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 ( player->GetMaxMana() >= 1000 )
            a2a = "%s\f%05u\r388%d\f00000 / %d\n";
        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 = 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 = 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;
        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 = 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 ( 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 (player->uExperience <= 9999999)
            v78 = pGlobalTXT_LocalizationStrings[83]; // "Experience"
        else
            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 = 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 = 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 = 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 = 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 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
        v90 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
        if ( v131 > 99 || v90 > 99 )
            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 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
        v93 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
        if ( v132 > 99 || v93 > 99 )
            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 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
        v96 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
        if ( v133 > 99 || v96 > 99 )
            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 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
        v99 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
        if ( v134 > 99 )
            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 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
        v102 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
        if ( v135 > 99 || v102 > 99 )
            a2g = "%s\f%05u\t180%d\f00000 / %d\n";
        v104 = UI_GetHealthManaStringColor(v135, v102);
        sprintf(pTmpBuf, a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v102);
        if ( player->classType == PLAYER_CLASS_LICH && v102 == 200 )
        {
            v106 = UI_GetHealthManaStringColor(v135, 200);
            sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, pGlobalTXT_LocalizationStrings[625]);
        }
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);

        a2h = format_4E2E10;
        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v136 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
        v107 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
        if ( v136 > 99 || v107 > 99 )
            a2h = "%s\f%05u\t180%d\f00000 / %d\n";
        v109 = UI_GetHealthManaStringColor(v136, v107);
        sprintf(pTmpBuf, a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v107);
        if ( player->classType == PLAYER_CLASS_LICH && v107 == 200 )
        {
            v111 = UI_GetHealthManaStringColor(v136, 200);
            sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, pGlobalTXT_LocalizationStrings[625]);
        }
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
}

//----- (00419100) --------------------------------------------------------
void FillAwardsData()
{
        auto pPlayer = pPlayers[uActiveCharacter];

        memset(achieved_awards, 0, 4000);
        num_achieved_awards = 0;

        memset(pTmpBuf2, 0, 0x7D0u);
        BtnDown_flag = 0;
        BtnUp_flag = 0;
        dword_50651C = 0;
        dword_506528 = 0;
        for (int i = 0; i < 105; ++i)
        {
            if ( _449B57_test_bit(pPlayer->_guilds_member_bits, i) && pAwards[i].pText )
                achieved_awards[num_achieved_awards++] = (AwardType)i;
        }
        num_achieved_awards_2 = num_achieved_awards;
        num_achieved_awards = 0;

        //sort awards index 
        if (num_achieved_awards_2 > 0)
        {
            for(int i=0; i<num_achieved_awards_2; ++i)
                achieved_awards[num_achieved_awards_2 + i] = (AwardType)(rand() % 16);

            for(int i=1; i<num_achieved_awards_2-1; ++i)
                {
                for (int j = i; j < num_achieved_awards_2-1; ++j )
                    {
                    auto tmp=achieved_awards[j];
                    if (pAwards[j].uPriority < pAwards[i].uPriority)
                        {
                        achieved_awards[j] = achieved_awards[i];
                        achieved_awards[i] = tmp;
                        }
                    }
                }
            }
        }