view UICharacter.cpp @ 944:7cbe4f80e322

Слияние
author Ritor1
date Wed, 01 May 2013 17:06:31 +0600
parents 9be9afdbeac3
children 5a2dbb00c399
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 "Overlays.h"
#include "Monsters.h"
#include "Arcomage.h"
#include "LOD.h"
#include "Actor.h"
#include "Allocator.h"
#include "Events.h"
#include "Viewport.h"
#include "FrameTableInc.h"
#include "Math.h"
#include "SpriteObject.h"
#include "ObjectList.h"
#include "Chest.h"
#include "PaletteManager.h"
#include "DecorationList.h"
#include "SaveLoad.h"
#include "stru123.h"
#include "Time.h"
#include "IconFrameTable.h"
#include "Awards.h"
#include "Autonotes.h"
#include "stru160.h"
#include "TurnEngine.h"
#include "CastSpellInfo.h"
#include "Weather.h"
#include "stru298.h"
#include "StorylineTextTable.h"
#include "Events2D.h"
#include "texts.h"

#include "mm7_data.h"





//----- (00419719) --------------------------------------------------------
char __fastcall CharacterUI_SkillsTab_Draw(unsigned int uPlayerID)
    {
    unsigned int v1; // esi@1
    Player *pPlayer; // ebp@1
    unsigned int v3; // eax@1
    signed int v4; // ecx@1
    int v5; // edi@3
    GUIWindow *v6; // ecx@3
    int v7; // eax@4
    GUIButton *v8; // edx@5
    int v9; // eax@7
    unsigned int v10; // ecx@9
    unsigned __int16 v11; // ax@9
    int v12; // eax@9
    unsigned __int8 v13; // cf@12
    unsigned __int8 v14; // zf@12
    unsigned int v15; // eax@12
    char *v16; // ecx@22
    GUIWindow *v17; // ecx@33
    int v18; // edx@34
    GUIButton *v19; // eax@35
    int v20; // edx@37
    unsigned __int16 v21; // cx@39
    unsigned int v22; // eax@39
    int v23; // edi@39
    unsigned int v24; // eax@42
    char v25; // sf@52
    char *v26; // ecx@52
    int v27; // edi@63
    GUIWindow *v28; // ecx@63
    int v29; // edx@64
    GUIButton *v30; // eax@65
    int v31; // edx@67
    unsigned int v32; // ecx@69
    int v33; // eax@69
    unsigned int v34; // eax@72
    char *v35; // ecx@82
    GUIWindow *v36; // ecx@93
    int v37; // edx@94
    GUIButton *v38; // eax@94
    int v39; // edx@97
    unsigned __int16 v40; // cx@99
    unsigned int v41; // eax@99
    int v42; // edi@99
    unsigned int v43; // eax@102
    char *v44; // ecx@112
    char *v46; // [sp-Ch] [bp-4Ch]@19
    char *v47; // [sp-Ch] [bp-4Ch]@49
    char *v48; // [sp-Ch] [bp-4Ch]@79
    char *v49; // [sp-Ch] [bp-4Ch]@109
    unsigned int v50; // [sp-8h] [bp-48h]@19
    unsigned int v51; // [sp-8h] [bp-48h]@49
    unsigned int v52; // [sp-8h] [bp-48h]@79
    unsigned int v53; // [sp-8h] [bp-48h]@109
    int v54; // [sp-4h] [bp-44h]@19
    int v55; // [sp-4h] [bp-44h]@49
    int v56; // [sp-4h] [bp-44h]@79
    int v57; // [sp-4h] [bp-44h]@109
    unsigned int v58; // [sp+10h] [bp-30h]@9
    unsigned int v59; // [sp+10h] [bp-30h]@39
    unsigned int v60; // [sp+10h] [bp-30h]@69
    unsigned int v61; // [sp+10h] [bp-30h]@99
    int v62; // [sp+14h] [bp-2Ch]@4
    int v63; // [sp+14h] [bp-2Ch]@34
    int v64; // [sp+14h] [bp-2Ch]@64
    int v65; // [sp+14h] [bp-2Ch]@94
    signed int i; // [sp+18h] [bp-28h]@4
    signed int v67; // [sp+18h] [bp-28h]@34
    signed int v68; // [sp+18h] [bp-28h]@64
    signed int v69; // [sp+18h] [bp-28h]@94
    int v70; // [sp+1Ch] [bp-24h]@3
    int v71; // [sp+1Ch] [bp-24h]@33
    int v72; // [sp+1Ch] [bp-24h]@63
    int v73; // [sp+1Ch] [bp-24h]@93
    int uY; // [sp+20h] [bp-20h]@9
    int uYa; // [sp+20h] [bp-20h]@33
    int uYb; // [sp+20h] [bp-20h]@69
    int uYc; // [sp+20h] [bp-20h]@93
    unsigned int a5; // [sp+24h] [bp-1Ch]@1
    unsigned int v79; // [sp+28h] [bp-18h]@1
    int *v80; // [sp+2Ch] [bp-14h]@3
    int *v81; // [sp+2Ch] [bp-14h]@33
    int *v82; // [sp+2Ch] [bp-14h]@63
    int *v83; // [sp+2Ch] [bp-14h]@93
    unsigned int v84; // [sp+30h] [bp-10h]@1
    int v85; // [sp+34h] [bp-Ch]@1
    unsigned int v86; // [sp+38h] [bp-8h]@1
    unsigned __int16 v87; // [sp+3Ch] [bp-4h]@9
    char *v88; // [sp+3Ch] [bp-4h]@24
    char *v89; // [sp+3Ch] [bp-4h]@54
    unsigned __int16 v90; // [sp+3Ch] [bp-4h]@69
    char *v91; // [sp+3Ch] [bp-4h]@84
    char *v92; // [sp+3Ch] [bp-4h]@114

    v1 = uPlayerID;
    a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
    v84 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xAFu, 0xFFu);
    v85 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem;
    v86 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
    v79 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
    pPlayer = &pParty->pPlayers[v1-1];
    v3 = pIcons_LOD->LoadTexture("fr_skill", TEXTURE_16BIT_PALETTE);
    pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0));
    v4 = v79;
    if ( !pPlayer->uSkillPoints )
        v4 = 65535;
    sprintf(
        pTmpBuf,
        "%s \f%05d%s\f00000\r177%s: \f%05d%d\f00000",
        pGlobalTXT_LocalizationStrings[206],        // Skills for
        a5,
        pPlayer->pName,
        pGlobalTXT_LocalizationStrings[207],        // Skill Points
        v4,
        pPlayer->uSkillPoints);
    pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
    v5 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;// Weapons,   Level
    sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[242], pGlobalTXT_LocalizationStrings[131]);
    pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, v5, a5, pTmpBuf, 0, 0, 0);
    v6 = pGUIWindow_CurrentMenu;
    v70 = 0;
    v80 = pWeaponSkills;
    do
        {
        v62 = *v80;
        v7 = 0;
        for ( i = 0; i < (signed int)v6->uNumControls; v7 = i++ + 1 )
            {
            v8 = v6->pControlsHead;
            if ( v7 > 0 )
                {
                do
                    {
                    v8 = v8->pNext;
                    --v7;
                    }
                    while ( v7 );
                }
            v9 = v8->field_1C;
            if ( SBYTE1(v9) >= 0 )
                continue;
            BYTE1(v9) &= 0x7Fu;
            if ( v9 != v62 )
                continue;
            v5 = v8->uY;
            v10 = pPlayer->uSkillPoints;
            ++v70;
            v11 = pPlayer->pActiveSkills[v62];
            v87 = pPlayer->pActiveSkills[v62];
            v12 = v11 & 0x3F;
            v58 = 0;
            uY = v12;
            if ( v10 >= v12 + 1 )
                v58 = v84;
            if ( v85 == i )
                {
                v13 = v10 < v12;
                v14 = v10 == v12;
                v15 = v86;
                if ( !(v13 | v14) )
                    v15 = v79;
                v58 = v15;
                }
            else
                {
                v15 = v58;
                }
            if ( HIBYTE(v87) & 1 )
                {
                if ( !v15 )
                    v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
                v54 = uY;
                v50 = v58;
                v46 = pGlobalTXT_LocalizationStrings[96];
                }
            else
                {
                if ( !(v87 & 0xC0) )
                    {
                    sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v62], uY);
                    pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0);
                    v6 = pGUIWindow_CurrentMenu;
                    continue;
                    }
                v16 = pGlobalTXT_LocalizationStrings[432];
                if ( (v87 & 0x80u) == 0 )
                    v16 = pGlobalTXT_LocalizationStrings[433];
                v88 = v16;
                if ( !v15 )
                    v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
                v54 = uY;
                v50 = v58;
                v46 = v88;
                }
            sprintf(pTmpBuf, "%s ", pSkillNames[v62], v15, v46, v50, v54);
            pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0);
            v6 = pGUIWindow_CurrentMenu;
            }
        ++v80;
        }
        while ( v80 <= &pWeaponSkills[8]);
        if ( !v70 )
            {
            v5 = v5 + LOBYTE(pFontLucida->uFontHeight) - 3;
            v6->DrawText(pFontLucida, 24, v5, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0);
            }
        uYa = v5 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10;
        sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[138], pGlobalTXT_LocalizationStrings[131]);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, uYa, a5, pTmpBuf, 0, 0, 0);
        v17 = pGUIWindow_CurrentMenu;
        v71 = 0;
        v81 = pMagicSkills;
        do
            {
            v18 = 0;
            v67 = 0;
            v63 = *v81;
            while ( v67 < (signed int)v17->uNumControls )
                {
                v19 = v17->pControlsHead;
                if ( v18 > 0 )
                    {
                    do
                        {
                        v19 = v19->pNext;
                        --v18;
                        }
                        while ( v18 );
                    }
                v20 = v19->field_1C;
                if ( SBYTE1(v20) >= 0 || (BYTE1(v20) &= 0x7Fu, v20 != v63) )
                    {
                    v18 = v67++ + 1;
                    continue;
                    }
                ++v71;
                uYa = v19->uY;
                v21 = pPlayer->pActiveSkills[v63];
                v22 = pPlayer->uSkillPoints;
                v23 = pPlayer->pActiveSkills[v63] & 0x3F;
                v59 = 0;
                if ( v22 >= v23 + 1 )
                    v59 = v84;
                if ( v85 == v67 )
                    {
                    v13 = v22 < v23;
                    v14 = v22 == v23;
                    v24 = v86;
                    if ( !(v13 | v14) )
                        v24 = v79;
                    v59 = v24;
                    }
                else
                    {
                    v24 = v59;
                    }
                if ( HIBYTE(v21) & 1 )
                    {
                    if ( !v24 )
                        v24 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
                    v55 = v23;
                    v51 = v59;
                    v47 = pGlobalTXT_LocalizationStrings[96];
                    }
                else
                    {
                    if ( !(v21 & 0xC0) )
                        {
                        sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v63], v23);
                        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0);
                        v17 = pGUIWindow_CurrentMenu;
                        v18 = v67++ + 1;
                        continue;
                        }
                    v25 = (v21 & 0x80u) != 0;
                    v26 = pGlobalTXT_LocalizationStrings[432];
                    if ( !v25 )
                        v26 = pGlobalTXT_LocalizationStrings[433];
                    v89 = v26;
                    if ( !v24 )
                        v24 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
                    v55 = v23;
                    v51 = v59;
                    v47 = v89;
                    }
                sprintf(pTmpBuf, "%s ", pSkillNames[v63], v24, v47, v51, v55);
                //LABEL_58:
                pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0);
                v17 = pGUIWindow_CurrentMenu;
                //LABEL_59:
                v18 = v67++ + 1;
                }
            ++v81;
            }
            while ( v81 <= &pMagicSkills[8]);
            if ( !v71 )
                v17->DrawText(
                pFontLucida,
                24,
                LOBYTE(pFontLucida->uFontHeight) + uYa - 3,
                0,
                pGlobalTXT_LocalizationStrings[153],
                0,
                0,
                0);
            v27 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
            sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[11], pGlobalTXT_LocalizationStrings[131]);
            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, v27, a5, pTmpBuf, 0, 0, 0);
            v28 = pGUIWindow_CurrentMenu;
            v72 = 0;
            v82 = pArmorSkills;
            do
                {
                v29 = 0;
                v68 = 0;
                v64 = *v82;
                while ( v68 < (signed int)v28->uNumControls )
                    {
                    v30 = v28->pControlsHead;
                    if ( v29 > 0 )
                        {
                        do
                            {
                            v30 = v30->pNext;
                            --v29;
                            }
                            while ( v29 );
                        }
                    v31 = v30->field_1C;
                    if ( SBYTE1(v31) >= 0 || (BYTE1(v31) &= 0x7Fu, v31 != v64) )
                        {
                        v29 = v68++ + 1;
                        continue;
                        }
                    v27 = v30->uY;
                    ++v72;
                    v60 = 0;
                    v90 = pPlayer->pActiveSkills[v64];
                    v32 = pPlayer->uSkillPoints;
                    v33 = pPlayer->pActiveSkills[v64] & 0x3F;
                    uYb = v33;
                    if ( v32 >= v33 + 1 )
                        v60 = v84;
                    if ( v85 == v68 )
                        {
                        v13 = v32 < v33;
                        v14 = v32 == v33;
                        v34 = v86;
                        if ( !(v13 | v14) )
                            v34 = v79;
                        v60 = v34;
                        }
                    else
                        {
                        v34 = v60;
                        }
                    if ( (pPlayer->pActiveSkills[v64] >> 8) & 1 )
                        {
                        if ( !v34 )
                            v34 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
                        v56 = uYb;
                        v52 = v60;
                        v48 = pGlobalTXT_LocalizationStrings[96];
                        }
                    else
                        {
                        if ( !(v90 & 0xC0) )
                            {
                            sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v64], uYb);
                            pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0);
                            v28 = pGUIWindow_CurrentMenu;
                            v29 = v68++ + 1;
                            continue;
                            }
                        v35 = pGlobalTXT_LocalizationStrings[432];
                        if ( (v90 & 0x80u) == 0 )
                            v35 = pGlobalTXT_LocalizationStrings[433];
                        v91 = v35;
                        if ( !v34 )
                            v34 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
                        v56 = uYb;
                        v52 = v60;
                        v48 = v91;
                        }
                    sprintf(pTmpBuf, "%s ", pSkillNames[v64], v34, v48, v52, v56);
                    //LABEL_88:
                    pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0);
                    v28 = pGUIWindow_CurrentMenu;
                    //LABEL_89:
                    v29 = v68++ + 1;
                    }
                ++v82;
                }
                while ( v82 <= &pArmorSkills[4]);
                if ( !v72 )
                    {
                    v27 = v27 + LOBYTE(pFontLucida->uFontHeight) - 3;
                    v28->DrawText(pFontLucida, 248, v27, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0);
                    }
                uYc = v27 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10;
                sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[143], pGlobalTXT_LocalizationStrings[131]);
                pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, uYc, a5, pTmpBuf, 0, 0, 0);
                v36 = pGUIWindow_CurrentMenu;
                v73 = 0;
                v83 = pMiscSkills;
                do
                    {
                    v37 = 0;
                    v69 = 0;
                    v38 = (GUIButton *)*v83;
                    v65 = *v83;
                    while ( v69 < (signed int)v36->uNumControls )
                        {
                        v38 = v36->pControlsHead;
                        if ( v37 > 0 )
                            {
                            do
                                {
                                v38 = v38->pNext;
                                --v37;
                                }
                                while ( v37 );
                            }
                        v39 = v38->field_1C;
                        if ( SBYTE1(v39) >= 0 || (BYTE1(v39) &= 0x7Fu, v39 != v65) )
                            {
                            //goto LABEL_119;
                            v37 = v69++ + 1;
                            continue;
                            }
                        ++v73;
                        uYc = v38->uY;
                        v40 = pPlayer->pActiveSkills[v65];
                        v41 = pPlayer->uSkillPoints;
                        v42 = pPlayer->pActiveSkills[v65] & 0x3F;
                        v61 = 0;
                        if ( v41 >= v42 + 1 )
                            v61 = v84;
                        if ( v85 == v69 )
                            {
                            v13 = v41 < v42;
                            v14 = v41 == v42;
                            v43 = v86;
                            if ( !(v13 | v14) )
                                v43 = v79;
                            v61 = v43;
                            }
                        else
                            {
                            v43 = v61;
                            }
                        if ( HIBYTE(v40) & 1 )
                            {
                            if ( !v43 )
                                v43 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
                            v57 = v42;
                            v53 = v61;
                            v49 = pGlobalTXT_LocalizationStrings[96];
                            }
                        else
                            {
                            if ( !(v40 & 0xC0) )
                                {
                                sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v65], v42);
                                LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0);
                                v36 = pGUIWindow_CurrentMenu;
                                v37 = v69++ + 1;
                                continue;
                                }
                            v25 = (v40 & 0x80u) != 0;
                            v44 = pGlobalTXT_LocalizationStrings[432];
                            if ( !v25 )
                                v44 = pGlobalTXT_LocalizationStrings[433];
                            v92 = v44;
                            if ( !v43 )
                                v43 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
                            v57 = v42;
                            v53 = v61;
                            v49 = v92;
                            }
                        sprintf(pTmpBuf, "%s ", pSkillNames[v65], v43, v49, v53, v57);
                        LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0);
                        v36 = pGUIWindow_CurrentMenu;
                        v37 = v69++ + 1;
                        }
                    ++v83;
                    }
                    while ( v83 <= &pMiscSkills[11]);
                    if ( !v73 )
                        LOBYTE(v38) = v36->DrawText(
                        pFontLucida,
                        248,
                        LOBYTE(pFontLucida->uFontHeight) + uYc - 3,
                        0,
                        pGlobalTXT_LocalizationStrings[153],
                        0,
                        0,
                        0);
                    return (char)v38;
    }

//----- (0041A000) --------------------------------------------------------
void CharacterUI_AwardsTab_Draw( unsigned int uPlayerID )
    {
    //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

    auto player = &pParty->pPlayers[uPlayerID - 1];
    //v1 = uPlayerID;
    v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
    award_texture_id = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE);
    pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(award_texture_id != -1 ? &pIcons_LOD->pTextures[award_texture_id] : 0));
    sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], v2);
    sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
    strcat(pTmpBuf, Source);
    strcat(pTmpBuf, "\f00000");
    pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
    result = dword_506528;
    a1.uFrameX = 12;
    a1.uFrameY = 48;
    a1.uFrameWidth = 424;
    a1.uFrameHeight = 290;
    a1.uFrameZ = 435;
    a1.uFrameW = 337;
    if ( dword_506544 && awards_count + dword_506528 < awards_count2 )
        result = dword_506528++ + 1;
    if ( dword_506548 && result )
        {
        --result;
        dword_506528 = result;
        }
    if ( dword_50651C < 0 )
        {
        result += awards_count;
        dword_506528 = result;
        if ( (signed int)(awards_count + result) > awards_count2 )
            {
            result = awards_count2 - awards_count;
            dword_506528 = result;
            }
        }
    else if ( dword_50651C > 0 )
        {
        result -= awards_count;
        dword_506528 = result;
        if ( (result & 0x80000000u) != 0 )
            {
            result = 0;
            dword_506528 = result;
            }
        }
    //LABEL_14:
    dword_506544 = 0;
    dword_506548 = 0;
    awards_count = 0;
    dword_50651C = 0;
    v21 = result;
    if ( (signed int)result < awards_count2 )
        {
        while ( 1 )
            {
            v5 = achievedAwardsIndex[v21];
            v20 = achievedAwardsIndex[v21];
            v6 = (char *)pAwards[v20].pText;//(char *)dword_723E80_award_related[v20 / 4];
            if ( v5 != 1 )
                {
                if (!( (v5 < 85 || v5 > 91) && (v5 < 103 || v5 > 104) ))
                    {
                    if ( v5 > 89 )
                        {
                        if ( v5 == 90 )
                            {
                            v10 = (unsigned __int8)pParty->uNumArenaKnightWins;
                            v22 = v10;
                            }
                        else if ( v5 == 91 )
                            {
                            v10 = (unsigned __int8)pParty->uNumArenaLordWins;
                            v22 = v10;
                            }
                        else if ( v5 == 103 )
                            {
                            v10 = pParty->field_874;
                            v22 = v10;
                            }
                        else if ( v5 == 104 )
                            {
                            v10 = pParty->field_878;
                            v22 = v10;
                            }
                        }
                    else
                        {
                        if ( v5 == 89 )
                            {
                            v10 = (unsigned __int8)pParty->uNumArenaSquireWins;
                            v22 = v10;
                            }
                        else if ( v5 == 85 )
                            {
                            v10 = pParty->uNumDeaths;
                            v22 = v10;
                            }
                        else if ( v5 == 86 )
                            {
                            v10 = pParty->uNumBountiesCollected;
                            v22 = v10;
                            }
                        else if ( v5 == 87 )
                            {
                            v10 = pParty->uNumPrisonTerms;
                            v22 = v10;
                            }
                        else if ( v5 == 88)
                            {
                            v10 = (unsigned __int8)pParty->uNumArenaPageWins;
                            v22 = v10;
                            }
                        }
                    v17 = v22;
                    sprintf(pTmpBuf, v6, v17);
                    v6 = pTmpBuf;
                    }
                }
            else
                {
                v17 = pParty->uFine;
                sprintf(pTmpBuf, v6, v17);
                v6 = pTmpBuf;
                }
            v14 = pAwards[v20].uSort;//dword_723E84[v20 / 4];
            ++awards_count;
            v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(
                pAwardsTextColors[3 * v14 % 6],
                pAwardsTextColors[3 * v14 % 6 + 1],
                pAwardsTextColors[3 * v14 % 6 + 2]);
            a1.DrawText(pFontArrus, 0, 0, v15, v6, 0, 0, 0);
            v16 = pFontArrus->CalcTextHeight(v6, &a1, 0, 0);
            result = v16 + a1.uFrameY + 4;
            if ( (signed int)result <= (signed int)a1.uFrameHeight )
                {
                ++v21;
                a1.uFrameY = result;
                result = v21;
                if ( v21 < awards_count2 )
                    continue;
                }
            return;
            }

        }
    return;
    }






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

    //----- (0041A2D1) --------------------------------------------------------
    void __fastcall CharacterUI_InventoryTab_Draw(unsigned int uPlayerID, char a2)
        {
        Player *pPlayer; // esi@1
        char v3; // bl@1
        unsigned int v4; // eax@2
        ItemGen *pItem; // ebx@5
        unsigned int v6; // eax@6
        Texture *v7; // esi@6
        __int16 v8; // ax@6
        signed int v9; // edi@6
        signed int v10; // ecx@6
        signed int v11; // edx@6
        signed int v12; // eax@11
        int v13; // eax@13
        signed int v14; // edx@13
        int v15; // eax@13
        unsigned int v16; // ebx@15
        unsigned int v17; // edi@15
        Texture *pTexture; // ebx@24
        double v19; // st7@26
        const char *v20; // [sp-8h] [bp-40h]@20
        Player *pPlayer2; // [sp+14h] [bp-24h]@1
        int uTextureId; // [sp+18h] [bp-20h]@6
        int *v23; // [sp+1Ch] [bp-1Ch]@1
        int v24; // [sp+20h] [bp-18h]@5
        ItemGen *pItem2; // [sp+24h] [bp-14h]@5
        int v26; // [sp+28h] [bp-10h]@3
        unsigned int uCellID; // [sp+2Ch] [bp-Ch]@3
        unsigned int uCellX; // [sp+30h] [bp-8h]@5
        unsigned int uCellY; // [sp+34h] [bp-4h]@5

        v23 = pRenderer->pActiveZBuffer;
        pPlayer = pPlayers[uPlayerID];
        v3 = a2;
        pPlayer2 = pPlayers[uPlayerID];
        pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_507958 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507958] : 0));
        if ( v3 )
            {
            v4 = pIcons_LOD->LoadTexture("fr_strip", TEXTURE_16BIT_PALETTE);
            pRenderer->DrawTextureIndexed(8u, 0x131u, (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0));
            }
        uCellID = 0;
        v26 = (int)pPlayer->pInventoryIndices;
        do
            {
            if ( *(int *)v26 > 0 )
                {
                v24 = *(int *)v26 - 1;
                uCellY = 32 * (uCellID / 14) + 17;
                pItem = &pPlayer->pInventoryItems[v24];
                uCellX = 32 * (uCellID % 14) + 14;
                pItem2 = pItem;
                if ( pItem->uItemID )
                    {
                    v6 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pItem->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
                    uTextureId = v6;
                    v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
                    v8 = (v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24);
                    v9 = v7->uTextureHeight;
                    v10 = v7->uTextureWidth;
                    v11 = v7->uTextureWidth;
                    if ( v10 < 14 )
                        v11 = 14;
                    if ( (v11 - 14) >> 5 == 0 && v8 < 32 )
                        uCellX += (32 - v10) / 2;
                    v12 = v7->uTextureWidth;
                    if ( v10 < 14 )
                        v12 = 14;
                    v13 = v12 - 14;
                    v14 = v7->uTextureHeight;
                    LOBYTE(v13) = v13 & 0xE0;
                    v15 = v13 + 32;
                    if ( v9 < 14 )
                        v14 = 14;
                    v16 = pItem->uAttributes;
                    v17 = uCellX + ((v15 - v10) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v9 + 32) >> 1)];
                    if ( !(v16 & 0xF0) )
                        {
                        if (pItem->Identified() || pCurrentScreen != SCREEN_HOUSE )
                            {
                            if (pItem->Broken())
                                pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7);
                            else
                                pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
                            }
                        else
                            {
                            pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7);
                            }
                        ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
                        pPlayer = pPlayer2;
                        //goto LABEL_34;
                        ++uCellID;
                        v26 += 4;
                        continue;
                        }
                    if ( (unsigned __int8)(v16 & 0xF0) != 16 )
                        {
                        if ( (unsigned __int8)(v16 & 0xF0) == 32 )
                            {
                            v20 = "sp28a";
                            pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
                            dword_50C9A8 -= pEventTimer->uTimeElapsed;
                            if ( dword_50C9A8 <= 0 )
                                {
                                dword_50C9A8 = 0;
                                LOBYTE(pItem2->uAttributes) &= 0xFu;
                                ptr_50C9A4 = 0;
                                }
                            v19 = (double)GetTickCount() * 0.1;
                            pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
                            ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
                            pPlayer = pPlayer2;
                            //goto LABEL_34;
                            ++uCellID;
                            v26 += 4;
                            continue;
                            }
                        if ( (unsigned __int8)(v16 & 0xF0) == 64 )
                            {
                            v20 = "sp30a";
                            pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
                            dword_50C9A8 -= pEventTimer->uTimeElapsed;
                            if ( dword_50C9A8 <= 0 )
                                {
                                dword_50C9A8 = 0;
                                LOBYTE(pItem2->uAttributes) &= 0xFu;
                                ptr_50C9A4 = 0;
                                }
                            v19 = (double)GetTickCount() * 0.1;
                            pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
                            ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
                            pPlayer = pPlayer2;
                            //goto LABEL_34;
                            ++uCellID;
                            v26 += 4;
                            continue;
                            }
                        if ( (unsigned __int8)(v16 & 0xF0) == 128 )
                            {
                            v20 = "sp91a";
                            pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
                            dword_50C9A8 -= pEventTimer->uTimeElapsed;
                            if ( dword_50C9A8 <= 0 )
                                {
                                dword_50C9A8 = 0;
                                LOBYTE(pItem2->uAttributes) &= 0xFu;
                                ptr_50C9A4 = 0;
                                }
                            v19 = (double)GetTickCount() * 0.1;
                            pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
                            ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
                            pPlayer = pPlayer2;
                            //goto LABEL_34;
                            ++uCellID;
                            v26 += 4;
                            continue;
                            }
                        }
                    v20 = "sptext01";
                    pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
                    dword_50C9A8 -= pEventTimer->uTimeElapsed;
                    if ( dword_50C9A8 <= 0 )
                        {
                        dword_50C9A8 = 0;
                        LOBYTE(pItem2->uAttributes) &= 0xFu;
                        ptr_50C9A4 = 0;
                        }
                    v19 = (double)GetTickCount() * 0.1;
                    pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
                    ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
                    pPlayer = pPlayer2;
                    }
                }
            //LABEL_34:
            ++uCellID;
            v26 += 4;
            }
            while ( uCellID < 126 );
        }

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

    //----- (0041A57E) --------------------------------------------------------
    void QuickRefDraw()
        {
        unsigned int v0; // ebx@1
        //unsigned int v1; // eax@1
        Player *pPlayer; // ebp@2
        int v3; // eax@6
        int v4; // edi@6
        unsigned int v5; // eax@7
        unsigned int v6; // edi@9
        unsigned int v7; // edi@11
        signed int v8; // eax@13
        unsigned int v9; // eax@13
        unsigned int v10; // edi@13
        int v11; // eax@15
        unsigned int v12; // eax@15
        unsigned int v13; // edi@15
        int v14; // eax@17
        int v15; // ST18_4@17
        int v16; // ebx@17
        int v17; // eax@17
        unsigned int v18; // eax@17
        unsigned int v19; // edi@17
        int v20; // eax@19
        unsigned int v21; // edi@19
        char *v22; // eax@21
        unsigned int v23; // edi@21
        int v24; // eax@23
        unsigned int v25; // edi@23
        char *v26; // eax@25
        unsigned int v27; // edi@25
        int v28; // ecx@27
        char *v29; // eax@27
        signed int v30; // edx@27
        unsigned int v31; // edi@31
        unsigned int v32; // edi@33
        const char *v33; // ST10_4@35
        unsigned int v34; // eax@35
        unsigned int v35; // edi@35
        unsigned __int8 v36; // al@37
        char *v37; // eax@38
        int v38; // eax@41
        signed int v39; // edi@42
        char *v40; // eax@45
        unsigned int v41; // eax@45
        signed int v43; // [sp+10h] [bp-1Ch]@1
        unsigned int v44; // [sp+14h] [bp-18h]@2
        int v45; // [sp+18h] [bp-14h]@1
        unsigned int v46; // [sp+1Ch] [bp-10h]@1
        unsigned int v47; // [sp+20h] [bp-Ch]@1
        unsigned int v48; // [sp+24h] [bp-8h]@33
        //unsigned int v49; // [sp+28h] [bp-4h]@1

        v0 = 0;
        v47 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
        //v49 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
        v46 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
        //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE);
        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
        v43 = 0;
        v45 = LOBYTE(pFontArrus->uFontHeight) + 1;
        do
            {
            pPlayer = &pParty->pPlayers[v43];
            v44 = 94 * v43 + 89;
            if ( v43 == v0 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, v0, pGlobalTXT_LocalizationStrings[149], 60, v0);//Name
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, v47, pPlayer->pName, 84, v0);
            if ( v43 == v0 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, v0, pGlobalTXT_LocalizationStrings[131], 60, v0); //.
            v3 = pPlayer->GetActualLevel();
            sprintf(pTmpBuf, "%lu", v3);
            v4 = pPlayer->GetBaseLevel();
            if ( pPlayer->GetActualLevel() <= v4 )
                v5 = pPlayer->GetExperienceDisplayColor();
            else
                v5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, v0);
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, v0);
            v6 = v45 + 47;
            if ( v43 == v0 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, v0, pGlobalTXT_LocalizationStrings[41], 60, v0);//
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, v0, pClassNames[pPlayer->classType], 84, v0);
            v7 = v45 + v6;
            if ( v43 == v0 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, v0, pGlobalTXT_LocalizationStrings[107], 60, v0);//.
            sprintf(pTmpBuf, "%d", pPlayer->sHealth);
            v8 = pPlayer->GetMaxHealth();
            v9 = UI_GetHealthManaStringColor(pPlayer->sHealth, v8);
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, v0);
            v10 = v45 + v7;
            if ( v43 == v0 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, v0, pGlobalTXT_LocalizationStrings[209], 60, v0);//
            sprintf(pTmpBuf, "%d", pPlayer->sMana);
            v11 = pPlayer->GetMaxMana();
            v12 = UI_GetHealthManaStringColor(pPlayer->sMana, v11);
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, v0);
            v13 = v45 + v10;
            if ( v43 == v0 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, v0, pGlobalTXT_LocalizationStrings[0], 60, v0);// 
            v14 = pPlayer->GetActualAC();
            sprintf(pTmpBuf, "%d", v14);
            v15 = v0;
            v16 = pPlayer->GetBaseAC();
            v17 = pPlayer->GetActualAC();
            v18 = UI_GetHealthManaStringColor(v17, v16);
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, v15);
            v0 = 0;
            v19 = v45 + v13;
            if ( !v43 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//
            v20 = pPlayer->GetActualAttack(0);
            sprintf(pTmpBuf, "%+d", v20);
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0);
            v21 = v45 + v19;
            if ( !v43 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//.
            v22 = pPlayer->GetMeleeDamageString();
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0);
            v23 = v45 + v21;
            if ( !v43 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// 
            v24 = pPlayer->GetRangedAttack();
            sprintf(pTmpBuf, "%+d", v24);
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0);
            v25 = v45 + v23;
            if ( !v43 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//.
            v26 = pPlayer->GetRangedDamageString();
            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0);
            v27 = v45 + v25;
            if ( !v43 )
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//
            v28 = 0;
            v29 = (char *)pPlayer->pActiveSkills;
            v30 = 36;
            do
                {
                if ( *(short *)v29 )
                    ++v28;
                v29 += 2;
                --v30;
                }
                while ( v30 );
                sprintf(pTmpBuf, "%lu", v28);
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0);
                v31 = v45 + v27;
                if ( !v43 )
                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//
                sprintf(pTmpBuf, "%lu", pPlayer->uSkillPoints);
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, pPlayer->uSkillPoints != 0 ? v46 : 0, pTmpBuf, 84, 0);
                v32 = v45 + v31;
                v48 = pPlayer->GetMajorConditionIdx();
                if ( !v43 )
                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//.
                v33 = aCharacterConditionNames[v48];
                v34 = GetConditionDrawColor(v48);
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0);
                v35 = v45 + v32;
                if ( !v43 )
                    pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//..
                v36 = pPlayer->uQuickSpell;
                if ( v36 )
                    v37 = pSpellStats->pInfos[v36].pShortName;
                else
                    v37 = pGlobalTXT_LocalizationStrings[153];//
                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0);
                ++v43;
            }
            while ( v43 < 4 );

            v38 = GetPartyReputation();
            if ( v38 >= 0 )
                {
                if ( v38 <= 5 )
                    v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF);
                else
                    v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0, 0);
                }
            else
                v39 = v46;

            v40 = GetReputationString(v38);
            sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation
            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0);
            v41 = pParty->GetPartyFame();
            sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame 
            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0);
        }

    //----- (0041ABFD) --------------------------------------------------------
void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx)
{
  unsigned int v2; // eax@6
  Texture *pTexture; // ecx@6
  GUIButton *pButton; // eax@6
  unsigned int v5; // eax@7
  unsigned int v6; // eax@10
  unsigned int v7; // eax@11

  if ( uPlayerIdx )
  {
    pRenderer->ClearZBuffer(0, 479);
    switch ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] )
    {
      case WINDOW_CharacterWindow_Stats:                                // stats
        sub_4196A0();
        sub_419379();
        CharacterUI_StatsTab_Draw(uPlayerIdx);
        v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE);
        pTexture = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0);
        pButton = pCharacterScreen_StatsBtn;
        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
        break;
      case WINDOW_CharacterWindow_Skills:                                // skills
        if ( dword_507CC0 != uActiveCharacter )
        {
          sub_4196A0();
          CharacterUI_SkillScreen_Draw();
        }
        sub_419379();
        CharacterUI_SkillsTab_Draw(uPlayerIdx);
        v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE);
        pTexture = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
        pButton = pCharacterScreen_SkillsBtn;
        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
        break;
      case WINDOW_CharacterWindow_Awards:                                // awards
        sub_4196A0();
        sub_419379();
        sub_419220();
        CharacterUI_AwardsTab_Draw(uPlayerIdx);
        v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE);
        pTexture = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0);
        pButton = pCharacterScreen_AwardsBtn;
        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
        break;
      case WINDOW_CharacterWindow_Inventory:                                                        // inventory and other
        sub_4196A0();
        sub_419379();
        CharacterUI_InventoryTab_Draw(uPlayerIdx, 0);
        v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE);
        pTexture = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0);
        pButton = pCharacterScreen_InventoryBtn;
        pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
        break;
      default:
        break;
    }
    if ( bRingsShownInCharScreen )
      CharacterUI_DrawPaperdollWithRingOverlay(uPlayerIdx);
    else
      CharacterUI_DrawPaperdoll(uPlayerIdx);
  }
}

//----- (0043CC7C) --------------------------------------------------------
void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID)
{
  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);
  pSex = pPlayers[uPlayerID]->GetSexByVoice();
  if ( pPlayers[uPlayerID]->GetRace() && pPlayers[uPlayerID]->GetRace() != 1 && pPlayers[uPlayerID]->GetRace() != 2 )
  {
    IsDwarf = 1;
    pBodyComplection = (pSex != 0) + 2;
  }
  else
  {
    IsDwarf = 0;
    pBodyComplection = pSex != 0;
  }
  pRenderer->ResetTextureClipRect();
  pRenderer->DrawTextureIndexed(0x1D3u, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));//
  if ( IsPlayerWearingWatersuit[uPlayerID] )//
  {
    pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY,
            (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0));
    if ( !bRingsShownInCharScreen )
      pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY,
                 (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0),
                 pPlayers[uPlayerID]->pEquipment.uArmor);
    v6 = pPlayers[uPlayerID]->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],
         (Texture *)(papredoll_dlads[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlads[uPlayerID - 1]] : 0));
    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->pTextures[v14];
        if ( item_MainHand4->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0));
        else
        {
          if ( item_MainHand4->uAttributes & 1 )
            pRenderer->DrawTextureTransparent(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0));
          else
            pRenderer->DrawTransparentGreenShade(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0));
        }
      }
      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->pTextures[pIcons_LOD->LoadTexture(v167, TEXTURE_16BIT_PALETTE)];
        dword_50C9A8 -= pEventTimer->uTimeElapsed;
        if ( dword_50C9A8 <= 0 )
        {
          dword_50C9A8 = 0;
          item_MainHand4->uAttributes &= 0xFu;
          ptr_50C9A4 = 0;
        }
        v17 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_MainHand4, pY_MainHand4, (Texture *)(v14 != -1 ? (int)&pIcons_LOD->pTextures[v14] : 0), v16, (signed __int64)v17, 0, 255);
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0), 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, (Texture *)(pBowTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pBowTextureNum] : 0));
        else
        {
          v30 = (char *)&pIcons_LOD->pTextures[pBowTextureNum];
          if ( !(itemBow->uAttributes & 1) )//   
            pRenderer->DrawTransparentGreenShade(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)v30 : 0));
          else //  
            pRenderer->DrawTextureTransparent(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)v30 : 0));
        }
      }
      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->pTextures[pIcons_LOD->LoadTexture(v168, TEXTURE_16BIT_PALETTE)];
        dword_50C9A8 -= pEventTimer->uTimeElapsed;
        if ( dword_50C9A8 <= 0 )
        {
          dword_50C9A8 = 0;
          itemBow->uAttributes &= 0xFu;
          ptr_50C9A4 = 0;
        }
        v28 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pBowTextureNum] : 0), a2b, (signed __int64)v28, 0, 255);
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pBowTextureNum] : 0), 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, (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0));
          else
            pRenderer->DrawTextureTransparent(pX_Cloak, pY_Cloak, (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0));
        }
        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->pTextures[pIcons_LOD->LoadTexture(v169, TEXTURE_16BIT_PALETTE)];
          dword_50C9A8 -= pEventTimer->uTimeElapsed;
          if ( dword_50C9A8 <= 0 )
          {
            dword_50C9A8 = 0;
            item_Cloak->uAttributes &= 0xFu;
            ptr_50C9A4 = 0;
          }
          v40 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Cloak, pY_Cloak, (Texture *)(v35 != -1 ? (int)&pIcons_LOD->pTextures[v35] : 0), v39, (signed __int64)v40, 0, 255);
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Cloak, pY_Cloak, (Texture *)(v41 != 0 ? (int)&pIcons_LOD->pTextures[v35] : 0), pCloakNum);
      }
    }
    pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY,// 
            (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0));
    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, (Texture *)(v53 != 0 ? (int)&pIcons_LOD->pTextures[v48] : 0));
          else
          {
            v55 = (char *)&pIcons_LOD->pTextures[v48];
            if ( !(item_Armor->uAttributes & 1) )
              pRenderer->DrawTransparentGreenShade(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)v55 : 0));
            else
              pRenderer->DrawTextureTransparent(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)v55 : 0));
          }
        }
        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->pTextures[pIcons_LOD->LoadTexture(v170, TEXTURE_16BIT_PALETTE)];
          dword_50C9A8 -= pEventTimer->uTimeElapsed;
          if ( dword_50C9A8 <= 0 )
          {
            dword_50C9A8 = 0;
            item_Armor->uAttributes &= 0xFu;
            ptr_50C9A4 = 0;
          }
          v52 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Armor, pY_Armor, (Texture *)(v48 != -1 ? (int)&pIcons_LOD->pTextures[v48] : 0), 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->pTextures[v94];
            if ( item_Armor->uAttributes & 2 )
              pRenderer->DrawTransparentRedShade(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0));
            else
            {
              if ( item_Armor->uAttributes & 1 )
                pRenderer->DrawTextureTransparent(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0));
              else
                pRenderer->DrawTransparentGreenShade(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0));
            }
          }
          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->pTextures[pIcons_LOD->LoadTexture(v173, TEXTURE_16BIT_PALETTE)];
                dword_50C9A8 -= pEventTimer->uTimeElapsed;
                if ( dword_50C9A8 <= 0 )
                {
                  dword_50C9A8 = 0;
                  item_Armor->uAttributes &= 0xFu;
                  ptr_50C9A4 = 0;
                }
                v97 = (double)GetTickCount();
                pRenderer->_4A63E6(pX_shoulder, pY_shoulder, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (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->pTextures[v94];
              if ( item_Armor->uAttributes & 2 )
                pRenderer->DrawTransparentRedShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v109 != 0 ? (int)v110 : 0));
              else
              {
                if ( item_Armor->uAttributes & 1 )
                  pRenderer->DrawTextureTransparent(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v109 != 0 ? (int)v110 : 0));
                else
                  pRenderer->DrawTransparentGreenShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v109 != 0 ? (int)v110 : 0));
              }
            }
            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->pTextures[pIcons_LOD->LoadTexture(v178, TEXTURE_16BIT_PALETTE)];
              dword_50C9A8 -= pEventTimer->uTimeElapsed;
              if ( dword_50C9A8 <= 0 )
              {
                dword_50C9A8 = 0;
                item_Armor->uAttributes &= 0xFu;
                ptr_50C9A4 = 0;
              }
              v97 = (double)GetTickCount();
              pRenderer->_4A63E6(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255);
            }
          }
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)v55 : 0), 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]->uFace];
          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->pTextures[v59];
          if ( item_Boot->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0));
          else
          {
            if ( item_Boot->uAttributes & 1 )
              pRenderer->DrawTextureTransparent(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0));
            else
              pRenderer->DrawTransparentGreenShade(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0));
          }
        }
        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->pTextures[pIcons_LOD->LoadTexture(v171, TEXTURE_16BIT_PALETTE)];
          dword_50C9A8 -= pEventTimer->uTimeElapsed;
          if ( dword_50C9A8 <= 0 )
          {
            dword_50C9A8 = 0;
            item_Boot->uAttributes &= 0xFu;
            ptr_50C9A4 = 0;
          }
          v64 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Boot, pY_Boot, (Texture *)(v59 != -1 ? (int)&pIcons_LOD->pTextures[v59] : 0), v63, (signed __int64)v64, 0, 255);
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0), 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],
                     (Texture *)(papredoll_dlads[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlads[uPlayerID - 1]] : 0));
        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->pTextures[v75];
            if ( item_Belt->uAttributes & 2 )
              pRenderer->DrawTransparentRedShade(pX_Belt, pY_Belt, (Texture *)(v79 != 0 ? (int)v80 : 0));
            else
            {
              if ( item_Belt->uAttributes & 1 )
                pRenderer->DrawTextureTransparent(pX_Belt, pY_Belt, (Texture *)(v79 != 0 ? (int)v80 : 0));
              else
                pRenderer->DrawTransparentGreenShade(pX_Belt, pY_Belt, (Texture *)(v79 != 0 ? (int)v80 : 0));
            }
            if ( !bRingsShownInCharScreen )
              pRenderer->DrawMaskToZBuffer(pX_Belt, pY_Belt, (Texture *)(v79 != 0 ? (int)v80 : 0), 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->pTextures[pIcons_LOD->LoadTexture(v172, TEXTURE_16BIT_PALETTE)];
            dword_50C9A8 -= pEventTimer->uTimeElapsed;
            if ( dword_50C9A8 <= 0 )
            {
              dword_50C9A8 = 0;
              item_Belt->uAttributes &= 0xFu;
              ptr_50C9A4 = 0;
            }
            v78 = (double)GetTickCount() * 0.1;
            pRenderer->_4A63E6(pX_Belt, pY_Belt, (Texture *)(v75 != -1 ? (int)&pIcons_LOD->pTextures[v75] : 0), 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],
             (Texture *)(papredoll_dlaus[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlaus[uPlayerID - 1]] : 0));
      }
      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->pTextures[v116];
              if ( item_CloakCollar->uAttributes & 2 )
                pRenderer->DrawTransparentRedShade(pX_CloakCollar, pY_CloakCollar, (Texture *)(v119 != 0 ? (int)v120 : 0));
              else
                pRenderer->DrawTextureTransparent(pX_CloakCollar, pY_CloakCollar, (Texture *)(v119 != 0 ? (int)v120 : 0));
              if ( !bRingsShownInCharScreen )
                pRenderer->DrawMaskToZBuffer(pX_CloakCollar, pY_CloakCollar, (Texture *)(v119 != 0 ? (int)v120 : 0), 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->pTextures[pIcons_LOD->LoadTexture(v179, TEXTURE_16BIT_PALETTE)];
              dword_50C9A8 -= pEventTimer->uTimeElapsed;
              if ( dword_50C9A8 <= 0 )
              {
                dword_50C9A8 = 0;
                item_CloakCollar->uAttributes &= 0xFu;
                ptr_50C9A4 = 0;
              }
              v118 = (double)GetTickCount() * 0.1;
              pRenderer->_4A63E6(pX_CloakCollar, pY_CloakCollar, (Texture *)(v116 != -1 ? (int)&pIcons_LOD->pTextures[v116] : 0), a2i, (signed __int64)v118, 0, 255);
            }
          }
        }
      }
      if ( pPlayers[uPlayerID]->uFace == 12 || pPlayers[uPlayerID]->uFace == 13 )
      {
        v122 = papredoll_dbrds[pPlayers[uPlayerID]->uFace];
        if ( v122 != pIcons_LOD->FindTextureByName("Pending") )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uFace - 24],
                     pPaperdoll_BodyY + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uFace - 23],
                     (Texture *)(v122 != -1 ? (int)&pIcons_LOD->pTextures[v122] : 0));
      }
    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[pSex][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->pTextures[pIcons_LOD->LoadTexture(v180, TEXTURE_16BIT_PALETTE)];
          dword_50C9A8 -= pEventTimer->uTimeElapsed;
          if ( dword_50C9A8 <= 0 )
          {
            dword_50C9A8 = 0;
            item_Helm->uAttributes &= 0xFu;
            ptr_50C9A4 = 0;
          }
          v130 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Helm, pY_Helm, (Texture *)(v127 != -1 ? (int)&pIcons_LOD->pTextures[v127] : 0), v129, (signed __int64)v130, 0, 255);
        }
        else
        {
          v131 = v127 + 1;
          v132 = (char *)&pIcons_LOD->pTextures[v127];
          if ( item_Helm->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0));
          else
          {
            if ( item_Helm->uAttributes & 1 )
              pRenderer->DrawTextureTransparent(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0));
            else
              pRenderer->DrawTransparentGreenShade(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0));
          }
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0), 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->pTextures[v138];
        if ( item_MainHand3->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0));
        else
        {
          if ( item_MainHand3->uAttributes & 1 )
            pRenderer->DrawTextureTransparent(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0));
          else
            pRenderer->DrawTransparentGreenShade(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0));
        }
      }
      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->pTextures[pIcons_LOD->LoadTexture(v182, TEXTURE_16BIT_PALETTE)];
        dword_50C9A8 -= pEventTimer->uTimeElapsed;
        if ( dword_50C9A8 <= 0 )
        {
          dword_50C9A8 = 0;
          item_MainHand3->uAttributes &= 0xFu;
          ptr_50C9A4 = 0;
        }
        v141 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_MainHand3, pY_MainHand3, (Texture *)(v138 != -1 ? (int)&pIcons_LOD->pTextures[v138] : 0), v140, (signed __int64)v141, 0, 255);
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0), 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, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0));
        else
        {
          v160 = (char *)&pIcons_LOD->pTextures[v153];
          if ( !(item_Shield->uAttributes & 1) )
          pRenderer->DrawTransparentGreenShade(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)v160 : 0));
          else
            pRenderer->DrawTextureTransparent(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)v160 : 0));
        }
      }
      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->pTextures[pIcons_LOD->LoadTexture(v183, TEXTURE_16BIT_PALETTE)];
        dword_50C9A8 -= pEventTimer->uTimeElapsed;
        if ( dword_50C9A8 <= 0 )
        {
          dword_50C9A8 = 0;
          item_Shield->uAttributes &= 0xFu;
          ptr_50C9A4 = 0;
        }
        v158 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0), v157, (signed __int64)v158, 0, 255);
        if ( v245 )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[pBodyComplection][0],
                 pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1],
                 (Texture *)(papredoll_dlhs[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlhs[uPlayerID - 1]] : 0));
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0), pShieldNum);
    }
  }
  pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1],
             (Texture *)(papredoll_drhs[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_drhs[uPlayerID - 1]] : 0));
  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],
                 (Texture *)(papredoll_dlhus[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlhus[uPlayerID - 1]] : 0));
  }
  if ( !bRingsShownInCharScreen )// 
    pRenderer->DrawTextureTransparent(603, 299, (Texture *)(uTextureID_MAGNIF_B != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_MAGNIF_B] : 0));
  pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0));//
}

//----- (0043E825) --------------------------------------------------------
void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID)
{
  int v3; // ecx@1
  unsigned int pItemTextureNum; // ebx@3
  int v9; // edi@17
  char v13; // sf@24
  unsigned __int8 v14; // of@24
  unsigned int pItemNum; // eax@25
  int v20; // edi@40
  int v21; // eax@41
  int v33; // esi@61
  const char *spell_texture_name; // [sp-8h] [bp-38h]@8
  Texture *spell_texture; // [sp+10h] [bp-20h]@14
  int v41; // [sp+10h] [bp-20h]@26
  unsigned int pY_Ring; // [sp+14h] [bp-1Ch]@3
  unsigned int pX_Ring; // [sp+18h] [bp-18h]@3
  int v48; // [sp+24h] [bp-Ch]@1
  ItemGen *item;

  pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
  CharacterUI_DrawPaperdoll(uPlayerID);
  pRenderer->DrawTextureTransparent(0x1D9u, 0, (Texture *)(uTextureID_BACKHAND != -1 ? &pIcons_LOD->pTextures[uTextureID_BACKHAND] : 0));
  pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? &pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0));
  pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY,
     (Texture *)(uTextureID_detaliz_close_button != -1 ? &pIcons_LOD->pTextures[uTextureID_detaliz_close_button] : 0));
  v3 = 0;
  v48 = 0;
  do
  {
    pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
    if ( pPlayers[uPlayerID]->pEquipment.uRings[v3] )
    {
      item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
      pX_Ring = pPaperdollRingsX[v3];
      pY_Ring = pPaperdollRingsY[v3];
      pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
      if ( item->uAttributes & 0xF0 )
      {
        if ( (item->uAttributes & 0xF0) == 16 )
          spell_texture_name = "sptext01";
        if ( (item->uAttributes & 0xF0) == 32 )
          spell_texture_name = "sp28a";
        if ( (item->uAttributes & 0xF0) == 64 )
          spell_texture_name = "sp30a";
        if ( (item->uAttributes & 0xF0) == 128 )
          spell_texture_name = "sp91a";
        spell_texture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(spell_texture_name, TEXTURE_16BIT_PALETTE)];
        dword_50C9A8 -= pEventTimer->uTimeElapsed;
        if ( dword_50C9A8 <= 0 )
        {
          dword_50C9A8 = 0;
          item->uAttributes &= 0xFu;
          ptr_50C9A4 = 0;
        }
        pRenderer->_4A63E6(pX_Ring, pY_Ring, (Texture *)(pItemTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), spell_texture, GetTickCount() * 0.1, 0, 255);
      }
      else
      {
        v9 = pItemTextureNum + 1;
        if ( item->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
        else
        {
          if ( (item->uAttributes & 1) == 0 )
            pRenderer->DrawTransparentGreenShade(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
          else
            pRenderer->DrawTextureTransparent(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
        }
        pRenderer->_4A601E(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), pItemNum);
      }
    }
    v3++;
    pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
    v14 = (v48 + 1) > 5;
    v13 = v48 - 4 < 0;
    v48++;
  }
  while ( (unsigned __int8)(v13 ^ v14) | (v48 == 4) );
  pItemNum = pPlayers[uPlayerID]->pEquipment.uAmulet;
  if ( pItemNum )
  {
    v41 = pPlayers[uPlayerID]->pEquipment.uAmulet;
    item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
    pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
    if ( item->uAttributes & 0xF0 )
    {
      if ( (item->uAttributes & 0xF0) == 16 )
        spell_texture_name = "sptext01";
      if ( (item->uAttributes & 0xF0) == 32 )
        spell_texture_name = "sp28a";
      if ( (item->uAttributes & 0xF0) == 64 )
        spell_texture_name = "sp30a";
      if ( (item->uAttributes & 0xF0) == 128 )
        spell_texture_name = "sp91a";
      spell_texture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(spell_texture_name, TEXTURE_16BIT_PALETTE)];
      dword_50C9A8 -= pEventTimer->uTimeElapsed;
      if ( dword_50C9A8 <= 0 )
      {
        dword_50C9A8 = 0;
        item->uAttributes &= 0xFu;
        ptr_50C9A4 = 0;
      }
      pRenderer->_4A63E6(493, 91, (Texture *)(pItemTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), spell_texture, GetTickCount() * 0.1, 0, 255);
    }
    else
    {
      v20 = pItemTextureNum + 1;
      if ( item->uAttributes & 2 )
      {
        v21 = 9 * pItemTextureNum;
        pRenderer->DrawTransparentRedShade(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0));
      }
      else
      {
        v21 = 9 * pItemTextureNum;
        if ( !(item->uAttributes & 1) )
          pRenderer->DrawTransparentGreenShade(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0));
        else
          pRenderer->DrawTextureTransparent(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0));
      }
      pRenderer->_4A601E(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0), v41);
    }
  }
  pItemNum = pPlayers[uPlayerID]->pEquipment.uGlove;
  if ( !pItemNum )
    return;
  item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
  pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
  if ( !(item->uAttributes & 0xF0) )
  {
    v33 = pItemTextureNum + 1;
    if ( item->uAttributes & 2 )
      pRenderer->DrawTransparentRedShade(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
    else
    {
      if ( !(item->uAttributes & 1) )
        pRenderer->DrawTransparentGreenShade(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
      else
        pRenderer->DrawTextureTransparent(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
    }
    pRenderer->_4A601E(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), pItemNum);
  }
  else
  {
    if ( (item->uAttributes & 0xF0) == 16 )
      spell_texture_name = "sptext01";
    if ( (item->uAttributes & 0xF0) == 32 )
      spell_texture_name = "sp28a";
    if ( (item->uAttributes & 0xF0) == 64 )
      spell_texture_name = "sp30a";
    if ( (item->uAttributes & 0xF0) == 128 )
      spell_texture_name = "sp91a";
    spell_texture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(spell_texture_name, TEXTURE_16BIT_PALETTE)];
    dword_50C9A8 -= pEventTimer->uTimeElapsed;
    if ( dword_50C9A8 <= 0 )
    {
      dword_50C9A8 = 0;
      item->uAttributes &= 0xFu;
      ptr_50C9A4 = 0;
    }
    pRenderer->_4A63E6(586, 88, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
  }
}

//----- (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->uFace;
      if ( v5 == 12 || v5 == 13 )
        papredoll_dbrds[(char)v5] = 0;
      papredoll_flying_feet[pPlayer->uFace] = 0;
      IsPlayerWearingWatersuit[v30 + 1] = 1;
    }
    else
    {
      v6 = v30;
      papredoll_dbods[v30] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
      papredoll_dlads[v30] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
      papredoll_dlaus[v30] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
      papredoll_drhs[v30] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
      papredoll_dlhs[v30] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
      v7 = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
      pPlayer2 = pPlayers[v30 + 1];
      papredoll_dlhus[v30] = v7;
      v9 = (char *)&pPlayer2->uFace;
      v10 = *v9;
      if ( *v9 == 12 || v10 == 13 )
      {
        wsprintfA(pContainer, "pc%02dbrd", v10 + 1);
        v9 = (char *)&pPlayers[v6 + 1]->uFace;
        papredoll_dbrds[*v9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      }
      wsprintfA(pContainer, "item281pc%02d", *v9 + 1);
      papredoll_flying_feet[pPlayers[v6 + 1]->uFace] = 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 __cdecl CharacterUI_SkillScreen_Draw()
    {
    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 )
        sub_4196A0();
    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(a2, 1, 0, a5);
    }

    //----- (00418511) --------------------------------------------------------
    char __fastcall CharacterUI_StatsTab_Draw(unsigned int uPlayerID)
        {
        Player *pPlayer; // edi@1
        unsigned int v2; // eax@1
        unsigned int v3; // eax@1
        unsigned int v4; // eax@2
        int v5; // ST20_4@4
        int v6; // ST1C_4@4
        int v7; // ebp@4
        int v8; // eax@4
        unsigned int v9; // eax@4
        int v10; // ST34_4@4
        int v11; // ST20_4@4
        int v12; // ST1C_4@4
        int v13; // ebp@4
        int v14; // eax@4
        unsigned int v15; // eax@4
        int v16; // ST34_4@4
        int v17; // ST20_4@4
        int v18; // ST1C_4@4
        int v19; // ebp@4
        int v20; // eax@4
        unsigned int v21; // eax@4
        int v22; // ST34_4@4
        int v23; // ST20_4@4
        int v24; // ST1C_4@4
        int v25; // ebp@4
        int v26; // eax@4
        unsigned int v27; // eax@4
        int v28; // ST34_4@4
        int v29; // ST20_4@4
        int v30; // ST1C_4@4
        int v31; // ebp@4
        int v32; // eax@4
        unsigned int v33; // eax@4
        int v34; // ST34_4@4
        int v35; // ST20_4@4
        int v36; // ST1C_4@4
        int v37; // ebp@4
        int v38; // eax@4
        unsigned int v39; // eax@4
        int v40; // ST34_4@4
        int v41; // ST20_4@4
        int v42; // ST1C_4@4
        int v43; // ebp@4
        int v44; // eax@4
        unsigned int v45; // eax@4
        int v46; // ebp@4
        signed int v47; // ST20_4@6
        int v48; // ST1C_4@6
        signed int v49; // eax@6
        unsigned int v50; // eax@6
        int v51; // ST20_4@8
        int v52; // ST1C_4@8
        int v53; // eax@8
        unsigned int v54; // eax@8
        int v55; // ST34_4@8
        int v56; // ST20_4@8
        int v57; // ST1C_4@8
        int v58; // ebp@8
        int v59; // eax@8
        unsigned int v60; // eax@8
        unsigned int v61; // ebp@8
        unsigned int v62; // eax@8
        char *v63; // ST20_4@8
        signed int v64; // eax@8
        unsigned int v65; // ebp@8
        unsigned __int8 v66; // al@8
        char *v67; // eax@9
        unsigned int v68; // ST20_4@11
        unsigned int v69; // ST1C_4@11
        signed int v70; // ebp@11
        signed int v71; // eax@11
        unsigned int v72; // eax@11
        int v73; // ST20_4@13
        int v74; // ST1C_4@13
        int v75; // ebp@13
        int v76; // eax@13
        unsigned int v77; // eax@13
        char *v78; // ecx@14
        int v79; // ST20_4@16
        char *v80; // ST40_4@16
        unsigned int v81; // eax@16
        int v82; // ST34_4@16
        int v83; // eax@16
        int v84; // ST34_4@16
        char *v85; // eax@16
        int v86; // ST34_4@16
        int v87; // eax@16
        int v88; // ST34_4@16
        char *v89; // eax@16
        int v90; // eax@16
        int v91; // ST20_4@19
        unsigned int v92; // eax@19
        int v93; // eax@19
        int v94; // ST20_4@22
        unsigned int v95; // eax@22
        int v96; // eax@22
        int v97; // ST20_4@25
        unsigned int v98; // eax@25
        int v99; // eax@25
        int v100; // ST20_4@27
        unsigned int v101; // eax@27
        int v102; // eax@27
        int v103; // ST20_4@30
        unsigned int v104; // eax@30
        char *v105; // ST20_4@32
        unsigned int v106; // eax@32
        int v107; // eax@33
        int v108; // ST20_4@36
        unsigned int v109; // eax@36
        char *v110; // ST20_4@38
        unsigned int v111; // eax@38
        int uY; // [sp+10h] [bp-10h]@6
        int uYa; // [sp+10h] [bp-10h]@11
        int uYb; // [sp+10h] [bp-10h]@13
        int uYc; // [sp+10h] [bp-10h]@16
        int uYd; // [sp+10h] [bp-10h]@19
        int uYe; // [sp+10h] [bp-10h]@22
        int uYf; // [sp+10h] [bp-10h]@25
        int uYg; // [sp+10h] [bp-10h]@27
        int uYh; // [sp+10h] [bp-10h]@33
        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
        int v137; // [sp+1Ch] [bp-4h]@27
        int v138; // [sp+1Ch] [bp-4h]@33

        pPlayer = &pParty->pPlayers[uPlayerID-1];
        v2 = pIcons_LOD->LoadTexture("fr_stats", TEXTURE_16BIT_PALETTE);
        pRenderer->DrawTextureIndexed(8, 8, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
        v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
        sprintf(pTmpBuf, "\f%05d", v3);
        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);//^Pi[%s] %s
        strcat(pTmpBuf, pTmpBuf2);
        if ( pPlayer->uSkillPoints )
            v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
        else
            v4 = 0xFFFFu;
        sprintf(pTmpBuf2,  "\f00000\r180%s: \f%05d%d\f00000\n\n\n", pGlobalTXT_LocalizationStrings[207], v4, pPlayer->uSkillPoints);//Skill points
        strcat(pTmpBuf, pTmpBuf2);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf, 0, 0, 0);
        v5 = pPlayer->GetBaseStrength();
        v6 = pPlayer->GetActualMight();
        v7 = pPlayer->GetBaseStrength();
        v8 = pPlayer->GetActualMight();
        v9 = UI_GetHealthManaStringColor(v8, v7);
        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v6, v5);//Might
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 53, 0, pTmpBuf, 0, 0, 0);
        v10 = LOBYTE(pFontArrus->uFontHeight) + 51;
        v11 = pPlayer->GetBaseIntelligence();
        v12 = pPlayer->GetActualIntelligence();
        v13 = pPlayer->GetBaseIntelligence();
        v14 = pPlayer->GetActualIntelligence();
        v15 = UI_GetHealthManaStringColor(v14, v13);
        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v12, v11);//Intellect
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
        v16 = LOBYTE(pFontArrus->uFontHeight) + v10 - 2;
        v17 = pPlayer->GetBaseWillpower();
        v18 = pPlayer->GetActualWillpower();
        v19 = pPlayer->GetBaseWillpower();
        v20 = pPlayer->GetActualWillpower();
        v21 = UI_GetHealthManaStringColor(v20, v19);
        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v18, v17);//
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v16, 0, pTmpBuf, 0, 0, 0);
        v22 = LOBYTE(pFontArrus->uFontHeight) + v16 - 2;
        v23 = pPlayer->GetBaseEndurance();
        v24 = pPlayer->GetActualEndurance();
        v25 = pPlayer->GetBaseEndurance();
        v26 = pPlayer->GetActualEndurance();
        v27 = UI_GetHealthManaStringColor(v26, v25);
        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v24, v23);//
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v22, 0, pTmpBuf, 0, 0, 0);
        v28 = LOBYTE(pFontArrus->uFontHeight) + v22 - 2;
        v29 = pPlayer->GetBaseAccuracy();
        v30 = pPlayer->GetActualAccuracy();
        v31 = pPlayer->GetBaseAccuracy();
        v32 = pPlayer->GetActualAccuracy();
        v33 = UI_GetHealthManaStringColor(v32, v31);
        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v30, v29);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v28, 0, pTmpBuf, 0, 0, 0);
        v34 = LOBYTE(pFontArrus->uFontHeight) + v28 - 2;
        v35 = pPlayer->GetBaseSpeed();
        v36 = pPlayer->GetActualSpeed();
        v37 = pPlayer->GetBaseSpeed();
        v38 = pPlayer->GetActualSpeed();
        v39 = UI_GetHealthManaStringColor(v38, v37);
        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], v39, v36, v35);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v34, 0, pTmpBuf, 0, 0, 0);
        v40 = LOBYTE(pFontArrus->uFontHeight) + v34 - 2;
        v41 = pPlayer->GetBaseLuck();
        v42 = pPlayer->GetActualLuck();
        v43 = pPlayer->GetBaseLuck();
        v44 = pPlayer->GetActualLuck();
        v45 = UI_GetHealthManaStringColor(v44, v43);
        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], v45, v42, v41);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v40, 0, pTmpBuf, 0, 0, 0);
        a2 = "%s\f%05u\r424%d\f00000 /\t185%d\n";
        v46 = v40 + 2 * LOBYTE(pFontArrus->uFontHeight) + 5;
        if ( pPlayer->GetMaxHealth() >= 1000 )
            a2 = "%s\f%05u\r388%d\f00000 / %d\n";
        v47 = pPlayer->GetMaxHealth();
        v48 = pPlayer->sHealth;
        v49 = pPlayer->GetMaxHealth();
        v50 = UI_GetHealthManaStringColor(pPlayer->sHealth, v49);
        sprintf(pTmpBuf, a2, pGlobalTXT_LocalizationStrings[108], v50, v48, v47);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v46, 0, pTmpBuf, 0, 0, 0);
        a2a = "%s\f%05u\r424%d\f00000 /\t185%d\n";
        uY = LOBYTE(pFontArrus->uFontHeight) + v46 - 2;
        if ( pPlayer->GetMaxMana() >= 1000 )
            a2a = "%s\f%05u\r388%d\f00000 / %d\n";
        v51 = pPlayer->GetMaxMana();
        v52 = pPlayer->sMana;
        v53 = pPlayer->GetMaxMana();
        v54 = UI_GetHealthManaStringColor(pPlayer->sMana, v53);
        sprintf(pTmpBuf, a2a, pGlobalTXT_LocalizationStrings[212], v54, v52, v51);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, uY, 0, pTmpBuf, 0, 0, 0);
        v55 = LOBYTE(pFontArrus->uFontHeight) + uY - 2;
        v56 = pPlayer->GetBaseAC();
        v57 = pPlayer->GetActualAC();
        v58 = pPlayer->GetBaseAC();
        v59 = pPlayer->GetActualAC();
        v60 = UI_GetHealthManaStringColor(v59, v58);
        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], v60, v57, v56);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v55, 0, pTmpBuf, 0, 0, 0);
        v61 = v55 + 2 * LOBYTE(pFontArrus->uFontHeight) - 2;
        v62 = pPlayer->GetMajorConditionIdx();
        v63 = aCharacterConditionNames[v62];
        v64 = GetConditionDrawColor(v62);
        sprintf(pTmpBuf, "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], v64, v63);
        pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v61, 0, pTmpBuf, 226, 0);
        v65 = LOBYTE(pFontArrus->uFontHeight) + v61 - 1;
        v66 = pPlayer->uQuickSpell;
        if ( v66 )
            v67 = pSpellStats->pInfos[v66].pShortName;
        else
            v67 = pGlobalTXT_LocalizationStrings[153];
        sprintf(pTmpBuf, "%s: %s", pGlobalTXT_LocalizationStrings[172], v67);
        pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v65, 0, pTmpBuf, 226, 0);
        v68 = pPlayer->GetBaseAge();
        v69 = pPlayer->GetActualAge();
        v70 = pPlayer->GetBaseAge();
        v71 = pPlayer->GetActualAge();
        v72 = UI_GetHealthManaStringColor(v71, v70);
        sprintf(pTmpBuf, "%s\f%05u\t100%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[5], v72, v69, v68);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, 50, 0, pTmpBuf, 0, 0, 0);
        a2b = "%s\f%05u\t100%d\f00000 / %d\n";
        uYa = LOBYTE(pFontArrus->uFontHeight) + 48;
        if ( pPlayer->GetBaseLevel() > 99 )
            a2b = format_4E2E68;
        v73 = pPlayer->GetBaseLevel();
        v74 = pPlayer->GetActualLevel();
        v75 = pPlayer->GetBaseLevel();
        v76 = pPlayer->GetActualLevel();
        v77 = UI_GetHealthManaStringColor(v76, v75);
        sprintf(pTmpBuf, a2b, pGlobalTXT_LocalizationStrings[131], v77, v74, v73);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYa, 0, pTmpBuf, 0, 0, 0);
        uYb = uYa + LOBYTE(pFontArrus->uFontHeight) - 2;
        if ( (signed __int64)pPlayer->uExperience <= 9999999 )
            v78 = pGlobalTXT_LocalizationStrings[83];
        else
            v78 = pGlobalTXT_LocalizationStrings[17];
        v79 = LODWORD(pPlayer->uExperience);
        v80 = v78;
        v81 = pPlayer->GetExperienceDisplayColor();
        sprintf(pTmpBuf, "%s\r180\f%05d%lu\f00000\n\n", v80, v81, v79);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYb, 0, pTmpBuf, 0, 0, 0);
        v82 = uYb + 2 * LOBYTE(pFontArrus->uFontHeight);
        v83 = pPlayer->GetActualAttack(0);
        sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], v83);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v82, 0, pTmpBuf, 0, 0, 0);
        v84 = v82 + LOBYTE(pFontArrus->uFontHeight) - 2;
        v85 = pPlayer->GetMeleeDamageString();
        sprintf(pTmpBuf, "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], v85);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v84, 0, pTmpBuf, 0, 0, 0);
        v86 = v84 + LOBYTE(pFontArrus->uFontHeight) - 2;
        v87 = pPlayer->GetRangedAttack();
        sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], v87);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v86, 0, pTmpBuf, 0, 0, 0);
        v88 = v86 + LOBYTE(pFontArrus->uFontHeight) - 2;
        v89 = pPlayer->GetRangedDamageString();
        sprintf(pTmpBuf, "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], v89);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v88, 0, pTmpBuf, 0, 0, 0);
        a2c = format_4E2E10;
        uYc = v88 + 2 * LOBYTE(pFontArrus->uFontHeight) - 4;
        v131 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
        v90 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
        if ( v131 > 99 || v90 > 99 )
            a2c = format_4E2E68;
        v91 = v90;
        v92 = UI_GetHealthManaStringColor(v131, v90);
        sprintf(pTmpBuf, a2c, pGlobalTXT_LocalizationStrings[87], v92, v131, v91);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYc, 0, pTmpBuf, 0, 0, 0);
        a2d = format_4E2E10;
        uYd = uYc + LOBYTE(pFontArrus->uFontHeight) - 2;
        v132 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
        v93 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
        if ( v132 > 99 || v93 > 99 )
            a2d = format_4E2E68;
        v94 = v93;
        v95 = UI_GetHealthManaStringColor(v132, v93);
        sprintf(pTmpBuf, a2d, pGlobalTXT_LocalizationStrings[6], v95, v132, v94);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYd, 0, pTmpBuf, 0, 0, 0);
        a2e = format_4E2E10;
        uYe = uYd + LOBYTE(pFontArrus->uFontHeight) - 2;
        v133 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
        v96 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
        if ( v133 > 99 || v96 > 99 )
            a2e = format_4E2E68;
        v97 = v96;
        v98 = UI_GetHealthManaStringColor(v133, v96);
        sprintf(pTmpBuf, a2e, pGlobalTXT_LocalizationStrings[240], v98, v133, v97);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYe, 0, pTmpBuf, 0, 0, 0);
        a2f = format_4E2E10;
        uYf = uYe + LOBYTE(pFontArrus->uFontHeight) - 2;
        v134 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
        v99 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
        if ( v134 > 99 )
            a2f = format_4E2E68;
        v100 = v99;
        v101 = UI_GetHealthManaStringColor(v134, v99);
        sprintf(pTmpBuf, a2f, pGlobalTXT_LocalizationStrings[70], v101, v134, v100);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYf, 0, pTmpBuf, 0, 0, 0);
        a2g = format_4E2E10;
        uYg = uYf + LOBYTE(pFontArrus->uFontHeight) - 2;
        v135 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
        v102 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
        v137 = v102;
        if ( v135 > 99 || v102 > 99 )
            a2g = format_4E2E68;
        v103 = v102;
        v104 = UI_GetHealthManaStringColor(v135, v102);
        sprintf(pTmpBuf, a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v103);
        if ( pPlayer->classType == PLAYER_CLASS_LICH && v137 == 200 )
            {
            v105 = pGlobalTXT_LocalizationStrings[625];
            v106 = UI_GetHealthManaStringColor(v135, 200);
            sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, v105);
            }
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYg, 0, pTmpBuf, 0, 0, 0);
        a2h = format_4E2E10;
        uYh = uYg + LOBYTE(pFontArrus->uFontHeight) - 2;
        v136 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
        v107 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
        v138 = v107;
        if ( v136 > 99 || v107 > 99 )
            a2h = format_4E2E68;
        v108 = v107;
        v109 = UI_GetHealthManaStringColor(v136, v107);
        sprintf(pTmpBuf, a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v108);
        if ( pPlayer->classType == PLAYER_CLASS_LICH && v138 == 200 )
            {
            v110 = pGlobalTXT_LocalizationStrings[625];
            v111 = UI_GetHealthManaStringColor(v136, 200);
            sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, v110);
            }
        return pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYh, 0, pTmpBuf, 0, 0, 0);
        }

    //----- (00419100) --------------------------------------------------------
    void FillAwardsData()
        {
        Player *pPlayer; // esi@1

        pPlayer = pPlayers[uActiveCharacter];
        memset(&achievedAwardsIndex, 0, 4000);
        memset(pTmpBuf2, 0, 0x7D0u);
        dword_506544 = 0;
        dword_506548 = 0;
        awards_count = 0;
        dword_50651C = 0;
        dword_506528 = 0;
        for(int i=0; i<105; ++i)
            {
            if ( _449B57_test_bit((unsigned char*)&pPlayer->_guilds_member_bits, i) && pAwards[i].pText )
                achievedAwardsIndex[awards_count++] = i;
            }
        awards_count2 = awards_count;
        awards_count = 0;
        //sort awards index 
        if ( awards_count2>0 )
            {
            for(int i=0; i<awards_count2; ++i)
                achievedAwardsIndex[awards_count2 + i] = rand() % 16;

            for(int i=1; i<awards_count2-1; ++i)
                {
                for (int j = i; j < awards_count2-1; ++j )
                    {
                    int tmp=achievedAwardsIndex[j];
                    if(pAwards[j].uSort < pAwards[i].uSort)
                        {
                        achievedAwardsIndex[j] = achievedAwardsIndex[i];
                        achievedAwardsIndex[i] = tmp;
                        }
                    }
                }
            }
        }