view UI/UIPopup.cpp @ 1318:0ec2f944fccc

Слияние
author Ritor1
date Wed, 26 Jun 2013 14:22:02 +0600
parents 8c2f689b5f0b
children 28f87f5234a1
line wrap: on
line source

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <assert.h>

#include "..\MM7.h"

#include "..\Mouse.h"

#include "..\Sprites.h"
#include "..\Vis.h"
#include "..\Game.h"
#include "..\GUIWindow.h"
#include "..\GUIFont.h"
#include "..\Party.h"
#include "..\AudioPlayer.h"
#include "..\LOD.h"
#include "..\Actor.h"
#include "..\Viewport.h"
#include "..\SpriteObject.h"
#include "..\ObjectList.h"
#include "..\Chest.h"
#include "..\PaletteManager.h"
#include "..\Time.h"
#include "..\texts.h"

#include "..\mm7_data.h"

static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually

//----- (004151D9) --------------------------------------------------------
void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight)
    {
    unsigned int v4; // ebx@1
    Texture *v5; // edi@1
    signed int uTileWidth; // ecx@1
    int v7; // eax@5
    int v8; // ecx@10
    unsigned int v9; // ebx@14
    int v10; // [sp+10h] [bp-28h]@5
    signed int uTileHeight; // [sp+18h] [bp-20h]@1
    int v12; // [sp+1Ch] [bp-1Ch]@7
    int v13; // [sp+20h] [bp-18h]@1
    int a5; // [sp+24h] [bp-14h]@5
    unsigned int a5a; // [sp+24h] [bp-14h]@11
    unsigned int a4; // [sp+28h] [bp-10h]@1
    int uNumXTiles; // [sp+2Ch] [bp-Ch]@3
    unsigned int uNumXTilesa; // [sp+2Ch] [bp-Ch]@6
    unsigned int uNumXTilesb; // [sp+2Ch] [bp-Ch]@11
    unsigned int a2a; // [sp+30h] [bp-8h]@1
    unsigned int v21; // [sp+34h] [bp-4h]@5
    unsigned int v22; // [sp+34h] [bp-4h]@11

    v4 = uY;
    a2a = uX;
    a4 = uX + uWidth;
    pRenderer->SetTextureClipRect(uX, v4, uX + uWidth, v4 + uHeight);
    v5 = pIcons_LOD->GetTexture(uTextureID_Parchment);
    uTileWidth = v5->uTextureWidth;
    v13 = v5->uTextureWidth;
    uTileHeight = v5->uTextureHeight;
    if ( v5->uTextureWidth && v5->uTextureHeight)
    {
        uNumXTiles = (signed int)uWidth / uTileWidth;
        if ( (signed int)uWidth % uTileWidth )
            ++uNumXTiles;
        a5 = 0;
        v21 = v4;
        v7 = uNumXTiles + 1;
        v10 = uNumXTiles + 1;
        do
            {
            uNumXTilesa = a2a - v13;
            if ( v7 > 0 )
                {
                v12 = v7;
                do
                    {
                    uNumXTilesa += v13;
                    pRenderer->DrawTextureIndexed(uNumXTilesa, v21, v5);
                    --v12;
                    }
                    while ( v12 );
                    v7 = v10;
                }
            v21 += uTileHeight;
            v8 = a5++;
            }
            while ( v8 < (signed int)uHeight / uTileHeight );
            a5a = v4 + uHeight - 32;
            pRenderer->DrawTextureTransparent(a2a, v4, pIcons_LOD->GetTexture(uTextureID_5076AC));
            pRenderer->DrawTextureTransparent(a2a, a5a, pIcons_LOD->GetTexture(uTextureID_5076B4));
            pRenderer->DrawTextureTransparent(a4 - 32, v4, pIcons_LOD->GetTexture(uTextureID_5076A8));
            pRenderer->DrawTextureTransparent(a4 - 32, a5a, pIcons_LOD->GetTexture(uTextureID_5076B0));
            uNumXTilesb = a2a + 32;
            v22 = v4 + uHeight - 10;
            if ( (signed int)uWidth > 64 )
                {
                pRenderer->SetTextureClipRect(a2a + 32, v4, a4 - 32, v4 + uHeight);
                pRenderer->DrawTextureTransparent(uNumXTilesb, v4, pIcons_LOD->GetTexture(uTextureID_507698));
                pRenderer->DrawTextureTransparent(uNumXTilesb, v22, pIcons_LOD->GetTexture(uTextureID_5076A4));
                if ( (signed int)uWidth > 512 )
                    {
                    pRenderer->DrawTextureTransparent(a2a + 544, v4, pIcons_LOD->GetTexture(uTextureID_507698));
                    pRenderer->DrawTextureTransparent(a2a + 544, v22, pIcons_LOD->GetTexture(uTextureID_5076A4));
                    }
                }
            v9 = v4 + 32;
            if ( (signed int)uHeight > 64 )
                {
                pRenderer->SetTextureClipRect(a2a, v9, a4, a5a);
                pRenderer->DrawTextureTransparent(a2a, v9, pIcons_LOD->GetTexture(uTextureID_5076A0));
                pRenderer->DrawTextureTransparent(a4 - 10, v9, pIcons_LOD->GetTexture(uTextureID_50769C));
                }
            pRenderer->ResetTextureClipRect();
        }
    }



//----- (0041D895) --------------------------------------------------------
void GameUI_DrawItemInfo( struct ItemGen* inspect_item )
    {
    ItemGen *v1; // esi@1
    unsigned int v2; // eax@3
    //char *v3; // edi@5
    //unsigned int v4; // eax@5
    //unsigned int v5; // esi@5
    signed int v6; // eax@5
    int v7; // edx@5
    //unsigned int v9; // eax@12
    char v10; // zf@16
    ItemGen *v11; // eax@16
    ItemGen *v12; // eax@25
    //unsigned int v13; // ecx@32
    //unsigned int v14; // eax@32
    //Render *v15; // edi@33
    const char *v16; // eax@34
    int v17; // eax@36
    int v18; // esi@37
    unsigned __int16 v19; // ax@37
    //char v20; // al@40
    char v21; // al@44
    //char v22; // al@48
    //char v23; // al@51
    int v24; // eax@52
    int v25; // eax@57
    int v26; // eax@60
    int v27; // eax@67
    const char *v28; // edi@69
    int v29; // eax@70
    char v30; // edi@78
    const char *v31; // eax@78
    int v32; // ecx@81
    unsigned int v33; // eax@81
    int v34; // esi@81
    const char *v35; // eax@85
    const char *v36; // eax@87
    unsigned int v37; // eax@109
    unsigned int v38; // eax@109
    int v39; // eax@113
    GUIFont *v40; // edx@113
    signed int v41; // [sp-20h] [bp-298h]@113
    int v42; // [sp-1Ch] [bp-294h]@113
    //char *v43; // [sp-18h] [bp-290h]@46
    unsigned int v44; // [sp-18h] [bp-290h]@113
    //int v45; // [sp-14h] [bp-28Ch]@46
    const char *v46; // [sp-14h] [bp-28Ch]@58
    char *v47; // [sp-14h] [bp-28Ch]@110
    //char *v48; // [sp-10h] [bp-288h]@46
    const char *v49; // [sp-10h] [bp-288h]@56
    char *v50; // [sp-10h] [bp-288h]@58
    int v51; // [sp-10h] [bp-288h]@110
    const char *v52; // [sp-Ch] [bp-284h]@36
    //int v53; // [sp-Ch] [bp-284h]@46
    char *v54; // [sp-Ch] [bp-284h]@56
    int v55; // [sp-Ch] [bp-284h]@58
    int v56; // [sp-Ch] [bp-284h]@110
    unsigned int v57; // [sp-8h] [bp-280h]@36
    //int v58; // [sp-8h] [bp-280h]@46
    int v59; // [sp-8h] [bp-280h]@56
    int v60; // [sp-8h] [bp-280h]@58
    unsigned int v61; // [sp-8h] [bp-280h]@110
    char out_text[300]; // [sp+8h] [bp-270h]@40
    //char Dest[100]; // [sp+6Ch] [bp-20Ch]@40
    //char v64[100]; // [sp+D0h] [bp-1A8h]@40
    char v65[120]; // [sp+134h] [bp-144h]@92
    char Source[40]; // [sp+1ACh] [bp-CCh]@49
    stru351_summoned_item v67;
    //int v67; // [sp+1D4h] [bp-A4h]@91
    //int v68; // [sp+1D8h] [bp-A0h]@106
    //int v69; // [sp+1DCh] [bp-9Ch]@101
    //int v70; // [sp+1E0h] [bp-98h]@97
    //int v71; // [sp+1E8h] [bp-90h]@93
    //int v72; // [sp+1ECh] [bp-8Ch]@91
    int var88; // [sp+1F0h] [bp-88h]@1
    Texture *v73; // [sp+1F4h] [bp-84h]@5
    //unsigned int v75; // [sp+1F8h] [bp-80h]@5
    //char *v76; // [sp+1FCh] [bp-7Ch]@5
    int v77; // [sp+200h] [bp-78h]@12
    int v78; // [sp+204h] [bp-74h]@5
    GUIWindow wHintWindow; // [sp+208h] [bp-70h]@2
    POINT a2; // [sp+25Ch] [bp-1Ch]@2
    int v81; // [sp+264h] [bp-14h]@5
    // GUIFont *pFontComic; // [sp+268h] [bp-10h]@1
    PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18
    char* v84;
    int v85;
    char *Str; // [sp+270h] [bp-8h]@65

    v1 = inspect_item;
    var88 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
    if (!inspect_item->uItemID)
        return;

    wHintWindow.Hint = 0;
    wHintWindow.uFrameWidth = 384;
    wHintWindow.uFrameHeight = 180;
    wHintWindow.uFrameY = 40;
    if ( pMouse->GetCursorPos(&a2)->x <= 320 )
        v2 = pMouse->GetCursorPos(&a2)->x + 30;
    else
        v2 = pMouse->GetCursorPos(&a2)->x - wHintWindow.uFrameWidth - 30;
    wHintWindow.uFrameX = v2;
    auto item_desc = &pItemsTable->pItems[inspect_item->uItemID];
    //v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName;
    //v76 = v3;
    //v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[_this->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
    //v5 = v4;
    //v4 *= 72;
    //v75 = v4;
    //v73 = &pIcons_LOD->pTextures[v4];
    v73 = pIcons_LOD->LoadTexturePtr(item_desc->pIconName, TEXTURE_16BIT_PALETTE);
    v6 = 100 - v73->uTextureWidth;
    v7 = v73->uTextureHeight;
    v78 = v6;
    v81 = 144 - v7;
    if ( v6 > 0 )
        v78 = v6 >> 1;
    if ( v81 <= 0 )
        v81 = 0;
    else
        v81 >>= 1;
    if ( !item_desc->uItemID_Rep_St )
        inspect_item->SetIdentified();
    //v9 = v8->uAttributes;
    v77 = 0;
    //a2.y = v8->uAttributes & 2;
    if (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_GOLD)
        v77 = inspect_item->uSpecEnchantmentType;
    if ( uActiveCharacter )
        {
        //try to identify
        if (!inspect_item->Identified())
            {

            v11 = inspect_item;
            if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 )
                inspect_item->SetIdentified();
            v83 = SPEECH_9;
            if ( !inspect_item->Identified() )
                {
                ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2u);//"Identify Failed"
                }
            else
                {
                v83 = SPEECH_8;
                if ( inspect_item->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) )
                    v83 = SPEECH_7;
                }
            if ( dword_4E455C )
                {
                pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0);
                dword_4E455C = 0;
                }
            }
        inspect_item->UpdateTempBonus(pParty->uTimePlayed);
        if (inspect_item->Broken())
            {
            if ( pPlayers[uActiveCharacter]->CanRepair(inspect_item) == 1 )
                inspect_item->uAttributes = inspect_item->uAttributes & 0xFFFFFFFD | 1;
            v83 = SPEECH_11;
            if ( !inspect_item->Broken() )
                v83 = SPEECH_10;
            else
                ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2u);//"Repair Failed"
            if ( dword_4E455C )
                {
                pPlayers[uActiveCharacter]->PlaySound(v83, 0);
                dword_4E455C = 0;
                }
            }
        }
    //v13 = _this->uAttributes;
    //v14 = _this->Identified();
    //a2.y = inspect_item->Identified();
    if (inspect_item->Broken())
        {
        wHintWindow.DrawMessageBox(0);
        //v15 = &;
        pRenderer->SetTextureClipRect(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12,
            wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, 
            wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12);
        wHintWindow.uFrameWidth -= 24;
        wHintWindow.uFrameHeight -= 12;
        wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
        wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
        pRenderer->DrawTransparentRedShade(wHintWindow.uFrameX + v78, v81 + wHintWindow.uFrameY + 30, v73);
        if ( inspect_item->Identified())
            v16 = inspect_item->GetIdentifiedName();
        else
            v16 = item_desc->pUnidentifiedName;
        wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, v16, 3u);
        v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &wHintWindow, 0, 0); //"Broken Item"
        v18 = v17 >> 1;
        v19 = TargetColor(0xFFu, 0x19u, 0x19u);
        wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item"
        pRenderer->ResetTextureClipRect();
        if ( !areWeLoadingTexture )
            {
            v73->Release();
            pIcons_LOD->SyncLoadedFilesCount();
            }
        return;
        }
    if (!inspect_item->Identified())
        {
        wHintWindow.DrawMessageBox(0);
        pRenderer->SetTextureClipRect(wHintWindow.uFrameX + 12,  wHintWindow.uFrameY + 12,
            wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, 
            wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12);
        wHintWindow.uFrameWidth -= 24;
        wHintWindow.uFrameHeight -= 12;
        wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
        wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
        pRenderer->DrawTextureTransparent(wHintWindow.uFrameX + v78, v81 + wHintWindow.uFrameY + 30, v73);
        wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, item_desc->pUnidentifiedName, 3u);
        v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &wHintWindow, 0, 0); ///"Not Identified"
        v18 = v17 >> 1;
        v19 = TargetColor(0xFFu, 0x19u, 0x19u);
        wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[232], 3);
        pRenderer->ResetTextureClipRect();
        if ( !areWeLoadingTexture )
            {
            v73->Release();
            pIcons_LOD->SyncLoadedFilesCount();
            }
        return;
        }

    sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], item_desc->pUnidentifiedName); //"Type: %s"
    out_text[100] = 0;
    out_text[200] = 0;
    //v20 = item_desc->uEquipType;
    switch (item_desc->uEquipType)
        {
    case EQUIP_OFF_HAND:
    case EQUIP_MAIN_HAND:
        sprintfex(out_text + 100, "%s: +%d   %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK],
            (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll); //"Damage"
        if (item_desc->uDamageMod)
            {
            char mod[16];
            sprintf(mod, "+%d", (int)item_desc->uDamageMod);
            strcat(out_text + 100, mod);
            }
        break;

    case EQUIP_BOW:
        sprintfex(out_text + 100, "%s: +%d   %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot"
            (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], //"Damage"
            (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll);
        if (item_desc->uDamageMod)
            {
            char mod[16];
            sprintf(mod, "+%d", (int)item_desc->uDamageMod);
            strcat(out_text + 100, mod);
            }
        break;

    case EQUIP_ARMOUR:
    case EQUIP_SHIELD:
    case EQUIP_HELMET:
    case EQUIP_BELT:
    case EQUIP_CLOAK:
    case EQUIP_GAUNTLETS:
    case EQUIP_BOOTS:
    case EQUIP_RING:
    case EQUIP_AMULET:
        if (item_desc->uDamageDice) //"Armor"	
            sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod);
        break;

        }

    if ( !v77 )
        {
        if (item_desc->uEquipType ==EQUIP_POTION)  //this is CORRECT! do not move to switch!
            {
            if ( inspect_item->uEnchantmentType )
                sprintf(out_text + 200,  "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power"
            }
        else if (item_desc->uEquipType == EQUIP_REAGENT)
            {
            sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power"
            }

        else if ( inspect_item->uEnchantmentType )
            {
            sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210],
                pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special"
            }
        else  if ( inspect_item->uSpecEnchantmentType )
            {      
            sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], 
                pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->_bonus_strength);
            }

        else if ( inspect_item->uNumCharges )
            {
            sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges"

            }
        }
    wHintWindow.uFrameWidth -= 12;
    v85 = 3;
    wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
    wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
    Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8));
    v84 = &out_text[0];
    do
        {
        if ( *v84 )
            {
            v27 = pFontComic->CalcTextHeight(v84, &wHintWindow, 100, 0);
            Str += v27 + 3;
            }
        v84 += 100;
        --v85;
        }
        while ( v85 );
        v28 = item_desc->pDescription;
        if ( *v28 )
            {
            v29 = pFontSmallnum->CalcTextHeight(v28, &wHintWindow, 100, 0);
            Str += v29;
            }
        wHintWindow.uFrameHeight = v73->uTextureHeight + v81 + 54;
        if ( (signed int)Str > (signed int)wHintWindow.uFrameHeight )
            wHintWindow.uFrameHeight = (unsigned int)Str;
        if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
            wHintWindow.uFrameHeight += LOBYTE(pFontComic->uFontHeight);
        v85 = 0;
        if ( pFontArrus->uFontHeight )
            {
            wHintWindow.uFrameWidth -= 24;
            v30 = pFontArrus->uFontHeight;
            v31 = inspect_item->GetIdentifiedName();
            if ( pFontArrus->CalcTextHeight(v31, &wHintWindow, 0, 0) / (signed int)v30 )
                v85 = v30;
            wHintWindow.uFrameWidth += 24;
            }
        wHintWindow.uFrameWidth += 12;
        wHintWindow.uFrameHeight += (unsigned int)v85;
        wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
        wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
        wHintWindow.DrawMessageBox(0);
        //v15 = pRenderer;
        pRenderer->SetTextureClipRect(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12,
            wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12);
        wHintWindow.uFrameWidth -= 12;
        v32 = v73->uTextureHeight;
        v33 = wHintWindow.uFrameHeight;
        wHintWindow.uFrameHeight -= 12;
        wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
        wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
        pRenderer->DrawTextureTransparent(
            wHintWindow.uFrameX + v78,
            wHintWindow.uFrameY + (signed int)(v33 - v32) / 2,
            v73);

        v34 = (int)(v85 + 35);
        v85 = 3;
        Str = out_text;
        do
            {
            if ( *Str )
                {
                wHintWindow.DrawText(pFontComic, 100, v34, 0, Str, 0, 0, 0);
                v34 += pFontComic->CalcTextHeight(Str, &wHintWindow, 100, 0) + 3;
                }
            Str += 100;
            --v85;
            }
            while (v85 );
            v35 = item_desc->pDescription;
            if ( *v35 )
                wHintWindow.DrawText(pFontSmallnum, 100, v34, 0, v35, 0, 0, 0);
            wHintWindow.uFrameX += 12;
            wHintWindow.uFrameWidth -= 24;
            v36 = inspect_item->GetIdentifiedName();
            wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, v36, 3u);
            wHintWindow.uFrameWidth += 24;
            wHintWindow.uFrameX -= 12;
            if ( v77 )
                {
                sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value"
                v40 = pFontComic;
                v61 = 0;
                v56 = 0;
                v51 = 0;
                v47 = pTmpBuf.data();
                v44 = 0;
                v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight);
                v41 = 100;
                }
            else
                {
                if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
                    {
                    sub_493F79(&v67, inspect_item->uExpireTime - pParty->uTimePlayed);
                    strcpy(pTmpBuf.data(), "Duration:");
                    Str = (char *)(v67.field_18_expire_year - game_starting_year);
                    if (v67.field_18_expire_year != 1168 )
                        {
                        sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year);
                        strcat(pTmpBuf.data(), v65);
                        }
                    if ( (((v67.field_14_exprie_month || Str) && 
                        ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str) 
                        || v67.field_C_expire_day)
                        && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || 
                        v67.field_C_expire_day)
                        || v67.field_8_expire_hour)
                        && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || 
                        v67.field_C_expire_day || v67.field_8_expire_hour)
                        || v67.field_4_expire_minute )
                        {
                        sprintf(v65, " %d:mn", v67.field_4_expire_minute);
                        strcat(pTmpBuf.data(), v65);
                        }
                    wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
                    }
                v37 = inspect_item->GetValue();
                sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v37);
                wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
                v38 = inspect_item->uAttributes;
                if ( BYTE1(v38) & 1 )
                    {
                    v61 = 0;
                    v56 = 0;
                    v51 = 0;
                    v47 = pGlobalTXT_LocalizationStrings[187]; //"Stolen"
                    }
                else
                    {
                    if ( !(BYTE1(v38) & 2) )
                        {
                        pRenderer->ResetTextureClipRect();
                        if ( !areWeLoadingTexture )
                            {
                            v73->Release();
                            pIcons_LOD->SyncLoadedFilesCount();
                            }
                        return;
                        }
                    v61 = 0;
                    v56 = 0;
                    v51 = 0;
                    v47 = pGlobalTXT_LocalizationStrings[651]; //"Hardened"
                    }
                LOWORD(v38) = LOWORD(pRenderer->uTargetRMask);
                v44 = v38;
                v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight);
                v39 = pFontComic->GetLineWidth(pTmpBuf.data());
                v40 = pFontComic;
                v41 = v39 + 132;
                }
            wHintWindow.DrawText(v40, v41, v42, v44, v47, v51, v56, v61);
            pRenderer->ResetTextureClipRect();
            if ( !areWeLoadingTexture )
                {
                v73->Release();
                pIcons_LOD->SyncLoadedFilesCount();
                }
            return;
    }
// 4E455C: using guessed type int dword_4E455C;
// 506128: using guessed type int areWeLoadingTexture;



//----- (0041E360) --------------------------------------------------------
void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0)
{
  unsigned int v2; // esi@1
  Actor *v3; // esi@3
  int v4; // eax@3
  //unsigned int v5; // ecx@3
  NPCData *v6; // eax@3
  unsigned __int16 v7; // cx@3
  int v8; // eax@4
  unsigned __int16 v9; // dx@4
  SpriteFrame *v10; // edi@17
  LODSprite *v11; // esi@17
  unsigned int v12; // ecx@17
  Sprite *v13; // edi@18
  //int v14; // ecx@18
  //int v15; // edx@18
  //int v16; // edx@18
  //int v17; // eax@18
  unsigned int v18; // ecx@19
  unsigned int v19; // eax@21
  char *v20; // esi@28
  int v21; // edx@29
  unsigned __int16 *v22; // ecx@29
  int v23; // eax@29
  int v24; // eax@32
  int v25; // esi@32
  char *v26; // edx@34
  unsigned __int8 v27; // sf@36
  unsigned __int8 v28; // of@36
  //int v29; // esi@40
  //unsigned __int16 *v30; // ecx@40
  //int v31; // eax@40
  //int v32; // esi@43
  //unsigned __int16 v33; // ax@45
  //int v34; // edx@45
  //int v35; // eax@45
  int v36; // eax@49
  //char *v37; // eax@52
  int v38; // eax@55
  unsigned __int16 v39; // ax@59
  SpellBuff *v40; // eax@60
  int v41; // edi@61
  unsigned int v42; // eax@61
  int v43; // eax@62
  int v44; // eax@63
  signed int v45; // edi@65
  unsigned __int16 v46; // ax@73
  Player *v47; // ecx@77
  //unsigned int v48; // eax@85
  GUIFont *v49; // edi@90
  int v50; // edi@90
  SpellBuff *v51; // eax@91
  char *v52; // ecx@98
  char *v53; // ecx@101
  char *v54; // ST0C_4@118
  unsigned int v55; // eax@118
  GUIFont *v56; // edi@124
  unsigned __int8 v57; // al@128
  int v58; // eax@132
  Actor *v59; // ecx@133
  unsigned __int8 v60; // dl@138
  char *v62; // eax@147
  int v63; // eax@152
  //char *result; // eax@152
  int v65; // eax@155
  const char *v66; // [sp-10h] [bp-1FCh]@121
  const char *v67; // [sp-10h] [bp-1FCh]@125
  const char *v68; // [sp-10h] [bp-1FCh]@142
  int v69; // [sp-Ch] [bp-1F8h]@121
  char *v70; // [sp-Ch] [bp-1F8h]@125
  char *v71; // [sp-Ch] [bp-1F8h]@142
  char *v72; // [sp-8h] [bp-1F4h]@54
  int v73; // [sp-8h] [bp-1F4h]@79
  int v74; // [sp-8h] [bp-1F4h]@121
  int v75; // [sp-8h] [bp-1F4h]@125
  int v76; // [sp-8h] [bp-1F4h]@142
  size_t v77; // [sp-4h] [bp-1F0h]@54
  unsigned int v78; // [sp-4h] [bp-1F0h]@121
  unsigned int v79; // [sp-4h] [bp-1F0h]@125
  char *v80; // [sp-4h] [bp-1F0h]@142
  char *v81; // [sp-4h] [bp-1F0h]@148
  DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18
  DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18
  RECT v84; // [sp+ECh] [bp-100h]@26
  char *v85[10]; // [sp+FCh] [bp-F0h]@145
  char *v95[11]; // [sp+124h] [bp-C8h]@127
  RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3
  unsigned int v107; // [sp+1A0h] [bp-4Ch]@18
  unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34
  unsigned int v109; // [sp+1A8h] [bp-44h]@32
  LPVOID v110; // [sp+1ACh] [bp-40h]@28
  unsigned int v111; // [sp+1B0h] [bp-3Ch]@29
  int v112; // [sp+1B4h] [bp-38h]@3
  int v222; // [sp+1B8h] [bp-34h]@18
  unsigned __int8 v114; // [sp+1BFh] [bp-2Dh]@133
  int v115; // [sp+1C0h] [bp-2Ch]@3
  unsigned int v116; // [sp+1C4h] [bp-28h]@18
  int i; // [sp+1C8h] [bp-24h]@18
  int a2; // [sp+1CCh] [bp-20h]@28
  int v119; // [sp+1D0h] [bp-1Ch]@18
  SpellBuff *v120; // [sp+1D4h] [bp-18h]@18
  Actor *v121; // [sp+1D8h] [bp-14h]@3
  int a5; // [sp+1DCh] [bp-10h]@3
  GUIWindow *a1; // [sp+1E0h] [bp-Ch]@1
  int v124; // [sp+1E4h] [bp-8h]@18
  int a4; // [sp+1E8h] [bp-4h]@18

  a1 = edx0;
  v2 = uActorID;

  static Actor pMonsterInfoUI_Doll;
  /*if ( !(bMonsterInfoUI_bDollInitialized & 1) )
  {
    bMonsterInfoUI_bDollInitialized |= 1u;
    Actor::Actor(&pMonsterInfoUI_Doll);
    atexit(nullsub_3);
  }*/
  v106.uParentBillboardID = -1;
  v3 = &pActors[v2];
  v121 = v3;
  v4 = TargetColor(0xE1u, 255, 0x9Bu);
  //v5 = v3->sNPC_ID;
  a5 = v4;
  v6 = GetNPCData(v3->sNPC_ID);
  v7 = v3->pMonsterInfo.uID;
  //v112 = (char **)v6;
  v115 = monster_popup_y_offsets[((signed __int16)v7 - 1) / 3] - 40;
  if ( v7 == pMonsterInfoUI_Doll.pMonsterInfo.uID )
  {
    v9 = pMonsterInfoUI_Doll.uCurrentActionLength;
  }
  else
  {
    memcpy(&pMonsterInfoUI_Doll, v3, sizeof(pMonsterInfoUI_Doll));
    pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored;
    pMonsterInfoUI_Doll.uCurrentActionTime = 0;
    v8 = rand();
    v3 = v121;
    v9 = v8 % 256 + 128;
    pMonsterInfoUI_Doll.uCurrentActionLength = v8 % 256 + 128;
  }

  if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 )
  {
    pMonsterInfoUI_Doll.uCurrentActionTime = 0;
    if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_Bored || pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_AtkMelee)
    {
      pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Standing;
      pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128;
    }
    else
    {
      //rand();
      pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored;
      if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) &&
           (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 )
        pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee;
      pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength;
    }
  }
  v10 = pSpriteFrameTable->GetFrame( v3->pSpriteIDs[pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime);
  v11 = &pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]];//40 * v10->pHwSpriteIDs[0] + 7218180;
  v106.pTarget = pRenderer->pTargetSurface;
  v106.pTargetZ = pRenderer->pActiveZBuffer;
  v106.uTargetPitch = pRenderer->uTargetSurfacePitch;
  v12 = a1->uFrameY + 52;
  v106.uViewportX = a1->uFrameX + 13;
  v106.uViewportY = v12;
  v106.uViewportW = v12 + 128;
  v106.uViewportZ = v106.uViewportX + 128;
  v106.uScreenSpaceX = (signed int)(v106.uViewportX + 128 + v106.uViewportX) / 2;
  v106._screenspace_x_scaler_packedfloat = 65536;
  v106._screenspace_y_scaler_packedfloat = 65536;
  v106.uScreenSpaceY = v115 + v12 + v11->uHeight;
  v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1);
  v106.sZValue = 0;
  v106.uFlags = 0;
  pRenderer->SetRasterClipRect(0, 0, 0x27Fu, 0x1DFu);
  pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5);
  pRenderer->RasterLine2D( v106.uViewportX + 129,  v106.uViewportY - 1,  v106.uViewportX + 129,    v106.uViewportW + 1,    a5);
  pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5);
  pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5);
  if ( pRenderer->pRenderD3D )
  {
    v13 = &pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]];
    v106.uScreenSpaceY = v115 + v106.uViewportY + v13->uBufferHeight;
    //v222 = (IDirectDrawSurface *)v13->pTextureSurface;
    memset(&Dst, 0, 0x64u);
    Dst.dwSize = 100;
    Dst.dwFillColor = 0;
    memset(&pDesc, 0, 0x7Cu);
    pDesc.dwSize = 124;
    v13->pTextureSurface->GetSurfaceDesc(&pDesc);
    //v14 = v13->uBufferHeight;
    //v120 = (SpellBuff *)v13->uBufferWidth;
    v107 = 0;
    //v15 = v13->uAreaX;
    //v119 = v13->uBufferWidth / 2;
    i = 0;
    //a4 = v106.uScreenSpaceX + v15 - v13->uBufferWidth / 2;
    int dst_x = v106.uScreenSpaceX + v13->uAreaX - v13->uBufferWidth / 2;
    //v115 = v13->uAreaY;
    //v16 = v13->uAreaWidth + v13->uBufferWidth / 2 + v13->uAreaX - v13->uBufferWidth;
    //v124 = v106.uScreenSpaceY + v115 - v14;
    int dst_y = v106.uScreenSpaceY + v13->uAreaY - v13->uBufferHeight;
    //v17 = v13->uAreaHeight + v13->uAreaY - v14;
    //v116 = v106.uScreenSpaceX + v16;
    uint dst_z = v106.uScreenSpaceX + v13->uAreaX + v13->uAreaWidth + v13->uBufferWidth / 2 - v13->uBufferWidth;
    //v119 = v106.uScreenSpaceY + v17;
    uint dst_w = v106.uScreenSpaceY + v13->uAreaY + v13->uAreaHeight - v13->uBufferHeight;
    if (dst_x < v106.uViewportX)
    {
      v18 = v106.uViewportX - dst_x;
      dst_x = v106.uViewportX;
      v107 = v18;
    }
    if (dst_y < v106.uViewportY)
    {
      v19 = v106.uViewportY - dst_y;
      dst_y = v106.uViewportY;
      i = v19;
    }
    if (dst_z > v106.uViewportZ)
      dst_z = v106.uViewportZ;
    if (dst_w > v106.uViewportW)
      dst_w = v106.uViewportW;
    pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask);
    pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask);
    v84.left = v106.uViewportX;
    v84.top = v106.uViewportY;
    v84.right = v106.uViewportZ;
    v84.bottom = v106.uViewportW;
    ErrD3D(pRenderer->pBackBuffer4->Blt(&v84, 0, 0, 16778240u, &Dst));
    if ( pRenderer->uTargetGBits == 5 )
    {
      __debugbreak(); // no monster popup for r5g5b5 yet
      memset(&pDesc, 0, 0x7Cu);
      pDesc.dwSize = 124;
      if ( pRenderer->LockSurface_DDraw4(v13->pTextureSurface, &pDesc, DDLOCK_WAIT))
	  {
		  v20 = (char *)dst_y;
		  v110 = pDesc.lpSurface;
		  a2 = dst_y;
		  if (dst_y < dst_w)
		  {
			//v111 = 2 * pRenderer->uTargetSurfacePitch;
			v21 = dst_x;
			v22 = &pRenderer->pTargetSurface[dst_y * pRenderer->uTargetSurfacePitch + dst_x];
            auto _v22_2 = v22;
			v23 = i - dst_y;
			//v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]];
			v115 = i - dst_y;
			while ( 1 )
			{
			  dst_y = v21;
			  if ( v21 < dst_z )
			  {
				v24 = (int)&v20[v23];
				v25 = v107 - v21;
				v109 = v24;
				for ( i = v107 - v21; ; v25 = i )
				{
				  v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / v13->uAreaHeight);
				  v26 = (char *)v108 + pDesc.dwWidth * (v25 + dst_y++) / v13->uAreaWidth;
				  *v22 = *((short *)v110 + (int)v26);
				  ++v22;
				  if ( dst_y >= dst_z )
					break;
				}
				v23 = v115;
			  }
			  v22 = (unsigned __int16 *)((char *)_v22_2 + 2 * pRenderer->uTargetSurfacePitch);
              _v22_2 = v22;
			  v20 = (char *)(a2 + 1);
			  v28 = __OFSUB__(a2 + 1, dst_w);
			  v27 = (signed int)(a2++ + 1 - dst_w) < 0;
			  //a2 = (Player *)((char *)a2 + 1);
			  //v120 = (SpellBuff *)((char *)v120 + v111);
			  if ( !(v27 ^ v28) )
				break;
			  v21 = dst_x;
			}
		  }
		  v13->pTextureSurface->Unlock(0);
	  }
    }
	else
	{
		memset(&pDesc, 0, 0x7Cu);
		pDesc.dwSize = 124;
		if ( pRenderer->LockSurface_DDraw4(v13->pTextureSurface, &pDesc, DDLOCK_WAIT) )
		{
          auto src = (unsigned __int16 *)pDesc.lpSurface;

          uint num_top_scanlines_above_frame_y = i - dst_y;
          for (uint y = dst_y; y < dst_w; ++y)
		  {
            auto dst = &pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + dst_x];

            uint src_y = num_top_scanlines_above_frame_y + y;
            for (uint x = dst_x; x < dst_z; ++x)
            {
              uint src_x  = v107 - dst_x + x; // num scanlines left to frame_x  + current x

              uint idx = pDesc.dwHeight * src_y / v13->uAreaHeight * (pDesc.lPitch / sizeof(short)) +
                         pDesc.dwWidth  * src_x / v13->uAreaWidth;
              uint b = src[idx] & 0x1F;
              *dst++ = b | 2 * (src[idx] & 0xFFE0);
            }
		  }
		  v13->pTextureSurface->Unlock(0);
		}
	}
  }
  else
  {
    pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0);
    v36 = v10->pHwSpriteIDs[0];
    if ( v36 >= 0 )
      pSprites_LOD->pSpriteHeaders[v36].DrawSprite_sw(&v106, 0);
  }

  if ( v121->sNPC_ID )
  {
    //v37 = v6->uProfession;
    if (v6->uProfession)
    {
      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v6->uProfession]); // "%s the %s"   /   ^Pi[%s] %s
    }
	else
	{
	  v77 = 2000;
      v72 = v6->pName;
	}
  }
  else
  {
    v38 = v121->dword_000334_unique_name;
    v77 = 2000;
    if ( v38 )
      v72 = pMonsterStats->pPlaceStrings[v38];
    else
      v72 = pMonsterStats->pInfos[v121->pMonsterInfo.uID].pName;
  }
  if(!v121->sNPC_ID || (v121->sNPC_ID && !v6->uProfession))
    strncpy(pTmpBuf.data(), v72, v77);
  v39 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
  a1->DrawTitleText(pFontComic, 0, 0xCu, v39, pTmpBuf.data(), 3u);
  Actor::DrawHealthBar(v121, a1);
  v119 = 0;
  pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed;
  v115 = 0;
  v116 = 0;
  i = 0;
  v112 = 0;
  if ( !uActiveCharacter )
  {
    v45 = 1;
  }
  else
  {
	  LOBYTE(v40) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
	  v120 = v40;
	  if ( !v40 )
		v45 = 1;
	  else
	  {
		  v41 = (unsigned __int8)v40 & 0x3F;
		  v42 = SkillToMastery((unsigned __int16)v40) - 1;
		  if ( !v42 )
		  {
			if ( v41 + 10 >= v121->pMonsterInfo.uLevel )
			{
			  v45 = 1;
			  v119 = 1;
			}
			else
				v45 = 1;
		  }
		  else
		  {
			  v43 = v42 - 1;
			  if ( !v43 )
			  {
				if ( 2 * v41 + 10 >= v121->pMonsterInfo.uLevel )
				{
				  v45 = 1;
				  v119 = 1;
				  v116 = 1;
				}
				else
						v45 = 1;
			  }
			  else
			  {
				  v44 = v43 - 1;
				  if ( !v44 )
				  {
					if ( 3 * v41 + 10 >= v121->pMonsterInfo.uLevel )
					{
					  v45 = 1;
					  v119 = 1;
					  v116 = 1;
					  i = 1;
					}
					else
					{
						v45 = 1;
					}
				  }
				  else
				  {
					  if ( v44 != 1 )
						v45 = 1;
					  else
					  {
						  v45 = 1;
						  v119 = 1;
						  v116 = 1;
						  i = 1;
						  v112 = 1;
					  }
				  }
			  }
		  }
	  }
	  //	LABEL_73:
	  v46 = v121->uAIState;
	  if ( v46 != 5 && v46 != 4 && !dword_507BF0_is_there_popup_onscreen && v120 )
	  {
		v47 = pPlayers[uActiveCharacter];
		if ( v119 | v116 | i | (unsigned int)v112 )
		{
		  if ( v121->pMonsterInfo.uLevel >= v47->uLevel - 5 )
			v73 = SPEECH_105;
		  else
			v73 = SPEECH_104;
		}
		else
		{
		  v73 = SPEECH_106;
		}
		v47->PlaySound((PlayerSpeech)v73, 0);
	  }
  }

  for (uint _it = 0; _it < 4; ++_it)
  {
    auto player = pParty->pPlayers + _it;

    //LOBYTE(v48) = player->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
    //v111 = v48;
    v111 = player->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
    v120 = (SpellBuff *)138;
    do
    {
      if ( (signed int)SkillToMastery(v111) >= 3 )
        v115 = v45;
      v120 = (SpellBuff *)((char *)v120 - 1);
    }
    while ( v120 );
    //++a2;
  }
  //while ( (signed int)a2 < (signed int)pParty->pHirelings );

  v49 = pFontSmallnum;
  a2 = (int)pFontSmallnum;
  a1->DrawText(pFontSmallnum, 12, 196, a5, pGlobalTXT_LocalizationStrings[631], 0, 0, 0);
  v50 = LOBYTE(v49->uFontHeight) + 193;
  if ( !v115 )
  {
    v78 = 0;
    v74 = 0;
    v69 = 0;
    v66 = pGlobalTXT_LocalizationStrings[630];
    a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78);
  }
  else
  {
	  a4 = 0;
	  v51 = &v121->pActorBuffs[1];
	  v222 = 0;
	  v120 = &v121->pActorBuffs[1];
	  do
	  {
		if ( (signed __int64)v51->uExpireTime > 0 )
		{
		  switch ( (int)v51 )
		  {
			case 0u:
			  v124 = 60;
			  a4 = (int)pGlobalTXT_LocalizationStrings[591];
			  break;
			case 1u:
			  v124 = 82;
			  a4 = (int)pGlobalTXT_LocalizationStrings[649];
			  break;
			case 2u:
			  v124 = 92;
			  a4 = (int)pGlobalTXT_LocalizationStrings[592];
			  break;
			case 3u:
			  v124 = 63;
			  a4 = (int)pGlobalTXT_LocalizationStrings[4];
			  break;
			case 4u:
			  v52 = pGlobalTXT_LocalizationStrings[220];
			  a4 = (int)v52;
			  v124 = 81;
			  break;
			case 5u:
			  v52 = pGlobalTXT_LocalizationStrings[162];
			  a4 = (int)v52;
			  v124 = 81;
			  break;
			case 6u:
			  v53 = pGlobalTXT_LocalizationStrings[593];
			  v124 = 35;
			  a4 = (int)v53;
			  break;
			case 8u:
			  v53 = pGlobalTXT_LocalizationStrings[608];
			  v124 = 62;
			  a4 = (int)v53;
			  break;
			case 7u:
			case 9u:
			  a4 = 0;
			  v124 = 0;
			  ++v51;
			  v222 = v222 + 1;
			  v120 = v51;
			  __debugbreak(); // fix condition
			  continue;
			case 0xAu:
			  v124 = 47;
			  a4 = (int)pGlobalTXT_LocalizationStrings[221];
			  break;
			case 0xBu:
			  v124 = 66;
			  a4 = (int)pGlobalTXT_LocalizationStrings[607];
			  break;
			case 0xCu:
			  v124 = 85;
			  a4 = (int)pGlobalTXT_LocalizationStrings[610];
			  break;
			case 0xDu:
			  v124 = 86;
			  a4 = (int)pGlobalTXT_LocalizationStrings[609];
			  break;
			case 0xEu:
			  v124 = 17;
			  a4 = (int)pGlobalTXT_LocalizationStrings[279];
			  break;
			case 0xFu:
			  v124 = 38;
			  a4 = (int)pGlobalTXT_LocalizationStrings[442];
			  break;
			case 0x10u:
			  v124 = 46;
			  a4 = (int)pGlobalTXT_LocalizationStrings[443];
			  break;
			case 0x11u:
			  v124 = 51;
			  a4 = (int)pGlobalTXT_LocalizationStrings[440];
			  break;
			case 0x12u:
			  v124 = 5;
			  a4 = (int)pGlobalTXT_LocalizationStrings[441];
			  break;
			case 0x13u:
			  v124 = 95;
			  a4 = (int)pGlobalTXT_LocalizationStrings[229];
			  break;
			case 0x14u:
			  v124 = 73;
			  a4 = (int)pGlobalTXT_LocalizationStrings[228];
			  break;
			default:
			  a4 = 0;
			  break;
		  }
		  if ( a4 )
		  {
			v54 = (char *)a4;
			v55 = GetSpellColor(v124);
			a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0);
			v50 = v50 + *(char *)(a2 + 5) - 3;
			v51 = v120;
		  }
		}

		++v51;
		v222 = v222 + 1;
		v120 = v51;

		__debugbreak(); // fix condition
	  }
	  //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 );
	  while (true);

	  if ( !a4 )
	  {
		v78 = 0;
		v74 = 0;
		v69 = 0;
		v66 = pGlobalTXT_LocalizationStrings[153];
		a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78);
	  }
  }
  v56 = pFontSmallnum;
  a4 = v106.uViewportY;
  if ( v119 )
  {
    sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP);
    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
    a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
    v79 = v121->pMonsterInfo.uAC;
    v75 = 0;
    v70 = pGlobalTXT_LocalizationStrings[12];
    v67 = "%s\f%05u\t100%d\n";
  }
  else
  {
    sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);
    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
    v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630];
    v75 = 0;
    v70 = pGlobalTXT_LocalizationStrings[12];
    a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
    v67 = "%s\f%05u\t100%s\n";
  }
  sprintf(pTmpBuf.data(), v67, v70, v75, v79);
  a1->DrawText(v56, 150, a4, a5, pTmpBuf.data(), 0, 0, 0);
  a4 = a4 + LOBYTE(v56->uFontHeight) - 6 + LOBYTE(v56->uFontHeight);
  v95[0] = pGlobalTXT_LocalizationStrings[87];
  v95[1] = pGlobalTXT_LocalizationStrings[6];
  v95[2] = pGlobalTXT_LocalizationStrings[240];
  v95[3] = pGlobalTXT_LocalizationStrings[70];
  v95[4] = pGlobalTXT_LocalizationStrings[624];
  v95[5] = pGlobalTXT_LocalizationStrings[138];
  v95[6] = pGlobalTXT_LocalizationStrings[214];
  v95[7] = pGlobalTXT_LocalizationStrings[142];
  v95[8] = pGlobalTXT_LocalizationStrings[29];
  v95[9] = pGlobalTXT_LocalizationStrings[133];
  v95[10] = pGlobalTXT_LocalizationStrings[54];
  if ( v116 )
  {
    sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, v95[v121->pMonsterInfo.uAttack1Type]);
    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
    a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
    v57 = v121->pMonsterInfo.uAttack1DamageBonus;
    if ( v57 )
      sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53],
        0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides, v57);
    else
      sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53],
        0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides);
  }
  else
  {
    sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]);
    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
    a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
    sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]);
  }
  a1->DrawText(v56, 150, a4, a5, pTmpBuf.data(), 0, 0, 0);
  v58 = LOBYTE(v56->uFontHeight);
  a4 = a4 + v58 - 6 + v58;
  if ( !i )
  {
    v80 = pGlobalTXT_LocalizationStrings[630];
    v76 = 0;
    v71 = pGlobalTXT_LocalizationStrings[628];
    v68 = "%s\f%05u\t080%s\n";
    sprintf(pTmpBuf.data(), v68, v71, v76, v80);
    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
    v58 = LOBYTE(v56->uFontHeight);
    a4 = a4 + v58 - 3;
  }
  else
  {
	  v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628];
	  v59 = v121;
	  v114 = v121->pMonsterInfo.uSpell1ID;
	  if ( v114 && v121->pMonsterInfo.uSpell2ID )
		v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629];
	  if ( v114 )
	  {
		sprintf(pTmpBuf.data(), "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName);
		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
		v58 = LOBYTE(v56->uFontHeight);
		a4 = a4 + v58 - 3;
		v59 = v121;
	  }
	  v60 = v59->pMonsterInfo.uSpell2ID;
	  if ( v60 )
	  {
		sprintf(pTmpBuf.data(), "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName);
		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
		v58 = LOBYTE(v56->uFontHeight);
		a4 = a4 + v58 - 3;
		v59 = v121;
	  }
	  if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID )
	  {
		v80 = pGlobalTXT_LocalizationStrings[153];
		v76 = 0;
		v71 = pGlobalTXT_LocalizationStrings[628];
		v68 = "%s\f%05u\t060%s\n";
		sprintf(pTmpBuf.data(), v68, v71, v76, v80);
		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
		v58 = LOBYTE(v56->uFontHeight);
		a4 = a4 + v58 - 3;
	  }
  }
  a4 = a4 + v58 - 3;
  a1->DrawText(v56, 150, a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0);
  a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
  v85[0] = pGlobalTXT_LocalizationStrings[87];
  v85[1] = pGlobalTXT_LocalizationStrings[6];
  v85[2] = pGlobalTXT_LocalizationStrings[240];
  v85[3] = pGlobalTXT_LocalizationStrings[70];
  v85[4] = pGlobalTXT_LocalizationStrings[142];
  v85[5] = pGlobalTXT_LocalizationStrings[214];
  v85[6] = pGlobalTXT_LocalizationStrings[29];
  v85[7] = pGlobalTXT_LocalizationStrings[133];
  v85[8] = pGlobalTXT_LocalizationStrings[54];
  v85[9] = pGlobalTXT_LocalizationStrings[624];
  v95[1] = (char *)v121->pMonsterInfo.uResFire;
  v95[2] = (char *)v121->pMonsterInfo.uResAir;
  v95[3] = (char *)v121->pMonsterInfo.uResWater;
  v95[4] = (char *)v121->pMonsterInfo.uResEarth;
  v95[5] = (char *)v121->pMonsterInfo.uResMind;
  v95[6] = (char *)v121->pMonsterInfo.uResSpirit;
  v95[7] = (char *)v121->pMonsterInfo.uResBody;
  v95[8] = (char *)v121->pMonsterInfo.uResLight;
  v95[9] = (char *)v121->pMonsterInfo.uResPhysical;
  v95[10] = (char *)v121->pMonsterInfo.uResDark;
  if ( v112 )
  {
    v124 = 0;
    do
    {
      v62 = v95[v124+1];
      if ( v62 == (char *)200 )
      {
        v81 = pGlobalTXT_LocalizationStrings[625];
      }
      else
      {
        if ( v62 )
          v81 = pGlobalTXT_LocalizationStrings[627];
        else
          v81 = pGlobalTXT_LocalizationStrings[153];
      }
      sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", v85[v124], 0, v81);
      a1->DrawText(v56, 170, a4, a5, pTmpBuf.data(), 0, 0, 0);
      v63 = LOBYTE(v56->uFontHeight);
      v124 += 4;
      a4 = a4 + v63 - 3;
    }
    while ( v124 < 40 );
  }
  else
  {
    i = 0;
    do
    {
      sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", v85[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?"
      a1->DrawText(v56, 170, a4, a5, pTmpBuf.data(), 0, 0, 0);
      v65 = LOBYTE(v56->uFontHeight);
      ++i;
      a4 = a4 + v65 - 3;
    }
    while ( i < 10 );
  }
  if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 )
  {
    sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP);
    pFontSmallnum->GetLineWidth(pTmpBuf.data());
    a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf.data(), 3);
  }
}


//----- (00417BB5) --------------------------------------------------------
const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType)
{
    //enum PLAYER_SKILL_TYPE v2; // esi@1
    //unsigned int v3; // ebx@1
    int v4; // edi@1
    int v5; // eax@1
    Player *pPlayer; // ebx@7
    char v7; // al@7
    char v8; // cl@7
    unsigned int v9; // eax@8
    unsigned int v10; // eax@8
    unsigned int v11; // eax@8
    PLAYER_SKILL_TYPE v12; // edi@8
    unsigned int v13; // eax@8
    unsigned int v14; // eax@8
    PLAYER_SKILL_TYPE v15; // esi@8
    int v16; // edi@8
    char v17; // al@8
    int v18; // ST5C_4@8
    int v19; // ST4C_4@8
    int v20; // ST3C_4@8
    int v21; // ST2C_4@8
    int v22; // ST1C_4@8
    char *v23; // esi@8
    unsigned int v24; // eax@9
    unsigned int v25; // eax@9
    unsigned int v26; // eax@9
    unsigned int v27; // ecx@9
    PLAYER_SKILL_TYPE v28; // ebx@9
    unsigned int v29; // eax@9
    char a2[1200]; // [sp+Ch] [bp-538h]@7
    char Source[120]; // [sp+4BCh] [bp-88h]@7
    unsigned __int16 *v33; // [sp+534h] [bp-10h]@1
    int v34; // [sp+538h] [bp-Ch]@1
    unsigned __int16 *v35; // [sp+53Ch] [bp-8h]@1
    //enum PLAYER_SKILL_TYPE v36; // [sp+540h] [bp-4h]@1

    //v2 = uPlayerSkillType;
    //v3 = uPlayerID;
    //v36 = uPlayerSkillType;
    v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal
    v34 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert
    v33 = (unsigned __int16 *)pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master
    v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand
    v35 = (unsigned __int16 *)v4;
    if ( v34 > v4 )
        v35 = (unsigned __int16 *)v34;
    if ( (signed int)v33 > (signed int)v35 )
        v35 = v33;
    if ( v5 > (signed int)v35 )
        v35 = (unsigned __int16 *)v5;
    pPlayer = &pParty->pPlayers[uPlayerID];
    //v33 = &pPlayer->pActiveSkills[uPlayerSkillType];
    v7 = pPlayer->GetActualSkillLevel(uPlayerSkillType);
    v8 = pPlayer->pActiveSkills[uPlayerSkillType];
    a2[0] = 0;
    Source[0] = 0;
    if ( (v8 & 0x3F) == (v7 & 0x3F) )
        {
        strcpy(a2, "%s\n\n");
        v24 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
        sprintf(Source, "\f%05d", v24);
        strcat(a2, Source);
        strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
        v25 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
        sprintf(Source, "\f%05d", v25);
        strcat(a2, Source);
        strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
        v26 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
        sprintf(Source, "\f%05d", v26);
        strcat(a2, Source);
        strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
        v27 = pPlayer->classType;
        v28 = uPlayerSkillType;
        v29 = GetSkillColor(v27, uPlayerSkillType, 4);
        sprintf(Source, "\f%05d", v29);
        strcat(a2, Source);
        strcat(a2, "%s\t%03d:\t%03d%s\t000\n");

        v23 = static_sub_417BB5_out_string;
        sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[v28], pGlobalTXT_LocalizationStrings[431],      // Normal
            (char *)v35 + 3, v35 + 5, pNormalSkillDesc[v28], pGlobalTXT_LocalizationStrings[433],      // Expert
            (char *)v35 + 3, v35 + 5, pExpertSkillDesc[v28], pGlobalTXT_LocalizationStrings[432],      // Master
            (char *)v35 + 3, v35 + 5, pMasterSkillDesc[v28], pGlobalTXT_LocalizationStrings[96],       // Grand
            (char *)v35 + 3, v35 + 5, pGrandSkillDesc[v28]);
        }
    else
        {
        strcpy(a2, "%s\n\n");
        v9 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
        sprintf(Source, "\f%05d", v9);
        strcat(a2, Source);
        strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
        v10 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
        sprintf(Source, "\f%05d", v10);
        strcat(a2, Source);
        strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
        v11 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
        sprintf(Source, "\f%05d", v11);
        strcat(a2, Source);
        strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
        v12 = uPlayerSkillType;
        v13 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 4);
        sprintf(Source, "\f%05d", v13);
        strcat(a2, Source);
        strcat(a2, "%s\t%03d:\t%03d%s\t000\n\n");
        v14 = TargetColor(0xFFu, 0xFFu, 0xFFu);
        sprintf(Source, "\f%05d", v14);
        strcat(a2, Source);
        strcat(a2, "%s: +%d");
        v15 = v12;
        v16 = (int)(v35 + 5);
        v15 = (PLAYER_SKILL_TYPE)((int)v15 * 4);
        v34 = (int)((char *)v35 + 3);
        v17 = pPlayer->GetActualSkillLevel(uPlayerSkillType);
        v18 = *(int *)(pGrandSkillDesc[v15]);
        v19 = *(int *)(pMasterSkillDesc[v15]);
        v20 = *(int *)(pExpertSkillDesc[v15]);
        v21 = *(int *)(pNormalSkillDesc[v15]);
        v22 = *(int *)(pSkillDesc[v15]);
        v23 = static_sub_417BB5_out_string;
        sprintf(
            static_sub_417BB5_out_string,
            a2,
            v22,
            pGlobalTXT_LocalizationStrings[431],
            v34,
            v16,
            v21,
            pGlobalTXT_LocalizationStrings[433],
            v34,
            v16,
            v20,
            pGlobalTXT_LocalizationStrings[432],
            v34,
            v16,
            v19,
            pGlobalTXT_LocalizationStrings[96],
            v34,
            v16,
            v18,
            pGlobalTXT_LocalizationStrings[623],
            (v17 & 0x3F) - (*(char *)v33 & 0x3F));
        }
    return v23;
    }

//----- (00417FE5) --------------------------------------------------------
    void CharacterUI_SkillsTab_ShowHint()
        {
    unsigned int v0; // ecx@1
    unsigned int v1; // eax@1
    GUIButton *i; // esi@6
    const char *v3; // eax@12
    unsigned int pX; // [sp+4h] [bp-8h]@1
    unsigned int pY; // [sp+8h] [bp-4h]@1

    pMouse->GetClickPos(&pX, &pY);
    v0 = pX;
    v1 = pY;
    if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 )
        {
        for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
            {
            if ( i->msg == UIMSG_SkillUp
                && (signed int)v0 >= (signed int)i->uX
                && (signed int)v0 <= (signed int)i->uZ
                && (signed int)v1 >= (signed int)i->uY
                && (signed int)v1 <= (signed int)i->uW )
                {
                v3 = CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)i->msg_param);
                sub_4179BC_draw_tooltip(pSkillNames[i->msg_param], v3);
                v1 = pY;
                v0 = pX;
                }
            }
        }
    else
        {
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
        }
    
    }

//----- (00418083) --------------------------------------------------------
void __cdecl CharacterUI_StatsTab_ShowHint()
  {
  LONG _x; // esi@1
  LONG _y; // eax@1
  int pStringNum; // edi@1
  signed int pTextColor; // eax@15
  char *pHourWord; // ecx@17
  char *pDayWord; // eax@20
  int v15; // ebx@28
  int v16; // eax@33
  POINT a2; // [sp+Ch] [bp-24h]@1
  int pHour; // [sp+14h] [bp-1Ch]@15
  unsigned int pDay; // [sp+24h] [bp-Ch]@15

  _x = pMouse->GetCursorPos(&a2)->x;
  _y = pMouse->GetCursorPos(&a2)->y;
  for ( pStringNum = 0; pStringNum < (signed int)&off_4E2A12; ++pStringNum )
  {
    if ( _x >= stat_string_coord[pStringNum].x  && _x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width )
    {
      if ( _y >= stat_string_coord[pStringNum].y && _y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height )
        break;
    }
  }
  switch ( pStringNum )
  {
    case 0:// Attributes
    case 1:
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] )
        sub_4179BC_draw_tooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]);
      break;
    case 7:// Health Points
      if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription);
      break;
    case 8:// Spell Points
      if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription);
      break;
    case 9:// Armor Class
      if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription);
      break;
    case 10:// Player Condition
      strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription);
      strcat(pTmpBuf2.data(), "\n");
      extern std::array<unsigned int, 18> pConditionImportancyTable;
      for ( uint i = 0; i < 18; ++i )
      {
        if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] )
        {
          strcat(pTmpBuf2.data(), " \n");
          pHour = pParty->uTimePlayed - pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]];
          pHour = (unsigned int)((pHour * 0.234375) / 60 / 60);
          pDay = (unsigned int)pHour / 24;
          pHour %= 24i64;
          pTextColor = GetConditionDrawColor(pConditionImportancyTable[i]);
          sprintfex(pTmpBuf.data(), format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]);
          strcat(pTmpBuf2.data(), pTmpBuf.data());
          if ( pHour && pHour <= 1 )
            pHourWord = pGlobalTXT_LocalizationStrings[109];
          else
            pHourWord = pGlobalTXT_LocalizationStrings[110];
          if ( !pDay || (pDayWord = pGlobalTXT_LocalizationStrings[56], pDay > 1) )
            pDayWord = pGlobalTXT_LocalizationStrings[57];
          sprintfex(pTmpBuf.data(), "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord);
          strcat(pTmpBuf2.data(), pTmpBuf.data());
        }
      }
      if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data());
      break;
    case 11:// Fast Spell
      if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription);
      break;
    case 12:// Player Age
      if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription);
      break;
    case 13:// Player Level
      if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription);
      break;
    case 14://Experience
      v15 = pPlayers[uActiveCharacter]->uLevel;
      do
      {
        if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)sub_4B46F8(v15) )
          break;
        ++v15;
      }
      while ( v15 <= 10000 );
      pTmpBuf[0] = 0;
      pTmpBuf2[0] = 0;
      if ( v15 > pPlayers[uActiveCharacter]->uLevel )
        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15);
      v16 = sub_4B46F8(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience);
      sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1);
      strcat(pTmpBuf.data(), "\n");
      strcat(pTmpBuf.data(), pTmpBuf2.data());
      sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data());
      if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data());
      break;
    case 15:// Attack Bonus
      if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription);
      break;
    case 16:// Attack Damage
      if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription);
      break;
    case 17:// Missle Bonus
      if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription);
      break;
    case 18:// Missle Damage
      if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription);
      break;
    case 19:// Fire Resistance
      if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription);
      break;
    case 20:// Air Resistance
      if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription);
      break;
    case 21:// Water Resistance
      if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription);
      break;
    case 22:// Earth Resistance
      if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription);
      break;
    case 23:// Mind Resistance
      if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription);
      break;
    case 24:// Body Resistance
      if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription);
      break;
    case 25: // Skill Points
      if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription )
        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
      break;
    case 26:
      __debugbreak();
      //_y = (Player *)(4 * pPlayers[uActiveCharacter]->classType);
      //v24 = *(char **)((char *)_y->pConditions + (int)pClassNames);
      //v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions);
      //if ( v24 && v7 )
        //sub_4179BC_draw_tooltip(v24, v7);
      break;
    default:
      break;
  }
}

    //----- (00410B28) --------------------------------------------------------
    void __thiscall DrawSpellDescriptionPopup(int spell_index)
        {
        Player *v1; // edi@1
        SpellInfo *v2; // esi@1
        unsigned int v3; // eax@2
        int v4; // eax@4
        LONG v5; // ecx@4
        int v6; // eax@10
        char *v7; // ST44_4@12
        unsigned __int16 v8; // ax@12
        GUIWindow a1; // [sp+Ch] [bp-68h]@4
        int v10; // [sp+60h] [bp-14h]@1
        POINT a2; // [sp+64h] [bp-10h]@1
        int v12; // [sp+6Ch] [bp-8h]@4
        int v13; // [sp+70h] [bp-4h]@4

        v1 = pPlayers[uActiveCharacter];
        v10 = spell_index;
        v2 = &pSpellStats->pInfos[spell_index + 11 * v1->lastOpenedSpellbookPage + 1];
        if ( pMouse->GetCursorPos(&a2)->y <= 250 )
            v3 = pMouse->GetCursorPos(&a2)->y + 30;
        else
            v3 = 30;
        a1.uFrameY = v3;
        a1.uFrameWidth = 328;
        a1.uFrameHeight = 68;
        a1.uFrameX = 90;
        a1.uFrameZ = 417;
        a1.uFrameW = v3 + 67;
        a1.Hint = 0;
        a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]);
        v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]);
        v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]);
        v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]);
        v5 = a2.y;
        if ( v13 > a2.y )
            v5 = v13;
        if ( v12 > v5 )
            v5 = v12;
        if ( v4 > v5 )
            v5 = v4;
        sprintf(  pTmpBuf2.data(),
            "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
            v2->pDescription,
            pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL],
            v5 + 3, v5 + 10,
            v2->pBasicSkillDesc,
            pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT],
            v5 + 3,  v5 + 10,
            v2->pExpertSkillDesc,
            pGlobalTXT_LocalizationStrings[LOCSTR_MASTER],
            v5 + 3, v5 + 10,
            v2->pMasterSkillDesc,
            pGlobalTXT_LocalizationStrings[LOCSTR_GRAND],
            v5 + 3,  v5 + 10,
            v2->pGrandmasterSkillDesc);
        v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0);
        a1.uFrameHeight += v6;
        if ( (signed int)a1.uFrameHeight < 150 )
            a1.uFrameHeight = 150;
        a1.uFrameWidth = game_viewport_width;
        a1.DrawMessageBox(0);
        a1.uFrameWidth -= 12;
        a1.uFrameHeight -= 12;
        v7 = v2->pName;
        a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
        a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
        v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
        a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
        a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
        a1.uFrameWidth = 108;
        a1.uFrameZ = a1.uFrameX + 107;
        a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->lastOpenedSpellbookPage + 12], 3u);
        sprintf( pTmpBuf.data(),  "%s\n%d",    pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST],
            pSpellDatas[spell_index + 11 * v1->lastOpenedSpellbookPage + 1].mana_per_skill[v1->pActiveSkills[v1->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]);
        //  *(&[0].field_12 //temp_fix field_14
        // + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6)
        // + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage)));
        a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3u);
        dword_507B00_spell_info_to_draw_in_popup = 0;
        }
    // 507B00: using guessed type int dword_507B00_spell_info_to_draw_in_popup;





//----- (00416D62) --------------------------------------------------------
void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(Vec2_int_ *_this)
{
        signed int pPlayerNum; // eax@12
        char *v2; // eax@32
        void *v3; // ecx@52
        unsigned int v4; // eax@59
        int v5; // esi@62
        signed int v6; // esi@64
        signed int v7; // esi@69
        ItemGen *v8; // ecx@70
        unsigned int v9; // eax@72
        unsigned int v10; // eax@76
        //char v11; // zf@83
        GUIButton *pButton; // esi@84
        unsigned int v13; // ecx@85
        char *pStr; // edi@85
        //signed int pControlID; // eax@92
        int v16; // eax@95
        int v17; // eax@96
        PLAYER_SKILL_TYPE v18; // eax@98
        char *pStr2; // eax@99
        unsigned int v20; // eax@108
        unsigned int pSkillId; // eax@109
        const char *pSkillInfo; // eax@111
        //char *v23; // ebx@112
        char *pHint; // edx@113
        unsigned int pColor; // eax@113
        GUIWindow pWindow; // [sp+4h] [bp-74h]@32
        double v27; // [sp+58h] [bp-20h]@33
        struct tagPOINT Point; // [sp+60h] [bp-18h]@6
        char *v29; // [sp+68h] [bp-10h]@33
        float v30; // [sp+6Ch] [bp-Ch]@33
        unsigned int pX; // [sp+70h] [bp-8h]@3
        unsigned int pY; // [sp+74h] [bp-4h]@3

        if ( pCurrentScreen == SCREEN_VIDEO )
            return;
        if ( _this )
            {
            pX = _this->x;
            pY = _this->y;
            }
        else
            {
            pMouse->GetClickPos(&pX, &pY);
            }
        if ( pRenderer->bWindowMode )
            {
            GetCursorPos(&Point);
            ScreenToClient(hWnd, &Point);
            if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 )
                {
                back_to_game();
                return;
                }
            }

        if ( pParty->pPickedItem.uItemID )//        
            {
            //v1 = 0;
            //do
            for ( pPlayerNum = 0; pPlayerNum < 4; ++pPlayerNum)
                {
                if ( (signed int)pX > RightClickPortraitXmin[pPlayerNum] && (signed int)pX < RightClickPortraitXmax[pPlayerNum]
                && (signed int)pY > 375 && (signed int)pY < 466 )
                    {
                    pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(pPlayerNum + 1, 1);
                    return;
                    }
                //++v1;
                }
            //while ( v1 < 4 );
            }

        pEventTimer->Pause();

        switch(pCurrentScreen)
            {
        case SCREEN_CASTING:
            {
            identify_item();
            break;
            }

        case SCREEN_CHEST:
            {
            if ( !pPlayers[uActiveCharacter]->CanAct() )
                {
                sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427],//%s    %s
                    pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);// 
                pWindow.Hint = pTmpBuf.data();
                pWindow.uFrameWidth = 384;
                pWindow.uFrameHeight = 180;
                pWindow.uFrameY = 40;
                if ( (signed int)pX <= 320 )
                    v10 = pX + 30;
                else
                    v10 = pX - 414;
                pWindow.uFrameX = v10;
                pWindow.DrawMessageBox(0);
                }
            else
                {
                v9 = pX + pSRZBufferLineOffsets[pY];
                if ( pRenderer->pActiveZBuffer[v9] & 0xFFFF )
                    {

                    //  __debugbreak(); // invalid indexing will result in invalid object ptr
                    //	v8 = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18* *((short *)&pChests[0].igChestItems[139].uExpireTime
                    //					+ (pRenderer->pActiveZBuffer[v9] & 0xFFFF) + 2662 * (unsigned int)pChestWindow->ptr_1C + 3));
                    v10=pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[v9] & 0xFFFF)-1];
                    v8 =&pChests[pChestWindow->par1C].igChestItems[v10-1];
                    GameUI_DrawItemInfo(v8);
                    }
                }
            break;
            }
        case SCREEN_GAME:
            {
            if (GetCurrentMenuID() > 0)
                break;

            if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y )
                {
                pWindow.ptr_1C = (void *)((signed int)pX / 118);
                if ( (signed int)pX / 118 < 4 )
                    {
                    pWindow.Hint = 0;
                    pWindow.uFrameWidth = 400;
                    pWindow.uFrameHeight = 200;
                    pWindow.uFrameX = 38;
                    pWindow.uFrameY = 60;
                    pAudioPlayer->StopChannels(-1, -1);
                    GameUI_CharacterQuickRecord_Draw(&pWindow, pPlayers[(int)pWindow.ptr_1C + 1]);
                    }
                }
            else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X )
                {
                if ( (signed int)pY >= 130 )
                    {
                    if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 )
                        {
                        pWindow.Hint = 0;
                        pWindow.uFrameWidth = 400;
                        pWindow.uFrameHeight = 200;
                        pWindow.uFrameX = 38;
                        pWindow.uFrameY = 60;
                        pAudioPlayer->StopChannels(-1, -1);
                        pWindow._41D73D_draw_buff_tooltip();
                        }
                    else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 )
                        {
                        if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 ))
                            {
                            pAudioPlayer->StopChannels(-1, -1);
                            v3 = (void *)1;
                            GameUI_DrawNPCPopup(v3);
                            }
                        }
                    else
                        {
                        pAudioPlayer->StopChannels(-1, -1);
                        v3 = 0;
                        GameUI_DrawNPCPopup(v3);
                        }
                    }
                else
                    {
                    pWindow.Hint = (char *)GameUI_GetMinimapHintText();
                    pWindow.uFrameWidth = 256;
                    pWindow.uFrameX = 130;
                    pWindow.uFrameY = 140;
                    pWindow.uFrameHeight = 64;
                    pAudioPlayer->StopChannels(-1, -1);
                    pWindow.DrawMessageBox(0);
                    }
                }
            else
                {
                pWindow.Hint = 0;
                pWindow.uFrameWidth = 320;
                pWindow.uFrameHeight = 320;
                v4 = pX - 350;
                if ( (signed int)pX <= 320 )
                    v4 = pX + 30;
                pWindow.uFrameX = v4;
                pWindow.uFrameY = 40;
                if ( pRenderer->pRenderD3D )
                    LOWORD(v5) = pGame->pVisInstance->get_picked_object_zbuf_val();
                else
                    v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
                v6 = (unsigned __int16)v5;
                if (PID_TYPE(v6) != OBJECT_Item)
                    {
                    if (PID_TYPE(v6) == OBJECT_Actor)
                        {
                        if ( pRenderer->uNumSceneBegins )
                            {
                            pWindow.DrawMessageBox(1);
                            MonsterPopup_Draw(PID_ID(v6), &pWindow);
                            }
                        else
                            {
                            pRenderer->BeginScene();
                            pWindow.DrawMessageBox(1);
                            MonsterPopup_Draw(PID_ID(v6), &pWindow);
                            pRenderer->EndScene();
                            }
                        }
                    }
                else
                    {
                    v7 = PID_ID(v6);
                    if ( ! (pObjectList->pObjects[pSpriteObjects[v7].uObjectDescID].uFlags & 0x10 ) )
                        {
                        v8 = &pSpriteObjects[v7].stru_24;
                        GameUI_DrawItemInfo(v8);
                        }
                    }
                }
            break;
            }
        case SCREEN_BOOKS:
            {
            if ( !dword_506364
                || (signed int)pX < (signed int)pViewport->uViewportTL_X
                || (signed int)pX > (signed int)pViewport->uViewportBR_X
                || (signed int)pY < (signed int)pViewport->uViewportTL_Y
                || (signed int)pY > (signed int)pViewport->uViewportBR_Y
                || (v2 = (char *)sub_444564(), (pWindow.Hint = v2) == 0) )
                break;
            v30 = (double)(pFontArrus->GetLineWidth(v2) + 32);
            v27 = v30 + 6.7553994e15;
            v29 = (char *)LODWORD(v27);
            pWindow.uFrameWidth = LODWORD(v27);
            pWindow.uFrameX = pX + 5;
            pWindow.uFrameY = pY + 5;
            pWindow.uFrameHeight = 64;
            pAudioPlayer->StopChannels(-1, -1);
            pWindow.DrawMessageBox(0);
            break;
            }
        case SCREEN_CHARACTERS:
        case SCREEN_E:
        case SCREEN_CHEST_INVENTORY:
            {
            if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E )
                {
                identify_item();
                }
            else if ( (signed int)pY >= 345 )
                break;
            else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats
                {
                CharacterUI_StatsTab_ShowHint();
                }
            else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills
                {
                CharacterUI_SkillsTab_ShowHint();
                }
            else
              {
                if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory
                  identify_item();
              }
            break;
            }
        case SCREEN_SPELL_BOOK:
            {
            if ( dword_507B00_spell_info_to_draw_in_popup )
                DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1);
            break;
            }
        case SCREEN_HOUSE:
        {
          if ( (signed int)pY < 345 && (signed int)pX < 469 )
            ShowPopupShopItem();
          break;
        }
        case SCREEN_PARTY_CREATION:
            {
            pWindow.Hint = 0;
            pStr = 0;
            for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext)
                {
                if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ
                    && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW )
                    {
                    switch ( pButton->msg )
                    {
                    case UIMSG_0: //stats info
                        pWindow.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7];
                        pStr = aAttributeNames[(signed int)pButton->msg_param % 7];
                        break;
                    case UIMSG_PlayerCreationClickPlus: //Plus button info 
                        pStr = pGlobalTXT_LocalizationStrings[670];//
                        pWindow.Hint = pGlobalTXT_LocalizationStrings[671];//"    ,     "
                        break;
                    case UIMSG_PlayerCreationClickMinus: //Minus button info
                        pStr = pGlobalTXT_LocalizationStrings[668];//
                        pWindow.Hint = pGlobalTXT_LocalizationStrings[669];//"    ,     "
                        break;
                    case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info
                        v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4);
                        pStr = pSkillNames[v18];
                        pWindow.Hint = pSkillDesc[v18];
                        break;
                    case UIMSG_PlayerCreationSelectClass: //Available Class Info
                        pWindow.Hint = pClassDescriptions[pButton->msg_param];
                        pStr = pClassNames[pButton->msg_param];
                        break;
                    case UIMSG_PlayerCreationClickOK: //OK Info
                        pWindow.Hint = pGlobalTXT_LocalizationStrings[664];//        .
                        pStr = pGlobalTXT_LocalizationStrings[665];// 
                        break;
                    case UIMSG_PlayerCreationClickReset: //Clear info
                        pWindow.Hint = pGlobalTXT_LocalizationStrings[666];//     .
                        pStr = pGlobalTXT_LocalizationStrings[667];// 
                        break;
                    case UIMSG_PlayerCreation_SelectAttribute: // Character info
                        pStr = pParty->pPlayers[pButton->msg_param].pName;
                        pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType];
                        break;
                        }
                    if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info
                        {
                        pSkillId = pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48);
                        pY = 0;
                        if ( (signed int)pSkillId < 37 )
                            {
                            pSkillInfo = CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pSkillId);
                            strcpy(pTmpBuf2.data(), pSkillInfo);
                            pWindow.Hint = pTmpBuf2.data();
                            pStr = pSkillNames[pSkillId];
                            }
                        }
                    }
                }
            if ( pWindow.Hint )
                {
                pHint = (char*)pWindow.Hint;
                pWindow.Hint = 0;
                pWindow.uFrameWidth = 384;
                pWindow.uFrameHeight = 256;
                pWindow.uFrameX = 128;
                pWindow.uFrameY = 40;
                pWindow.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &pWindow, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24;
                pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1;
                pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1;
                pWindow.DrawMessageBox(0);
                pWindow.uFrameX += 12;
                pWindow.uFrameWidth -= 24;
                pWindow.uFrameY += 12;
                pWindow.uFrameHeight -= 12;
                pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1;
                pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1;
                pColor = TargetColor(0xFF, 0xFF, 0x9B);
                sprintf(pTmpBuf.data(), format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n"
                pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3);
                pWindow.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0);
                }
            break;
            }
        default:
            {
            break;
            }
            }
        dword_507BF0_is_there_popup_onscreen = 1;
        viewparams->bRedrawGameUI = 1;
        }