view UI/UIPopup.cpp @ 1709:8251e59fd7c1

ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
author Grumpy7
date Tue, 24 Sep 2013 07:29:55 +0200
parents 33c7cc2d48d5
children 0f6cd60ca987
line wrap: on
line source

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#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


//----- (004179BC) --------------------------------------------------------
void CharacterUI_DrawTooltip(const char *Title, const char *content)
{
  GUIWindow popup_window; // [sp+Ch] [bp-5Ch]@1
  POINT v6; // [sp+60h] [bp-8h]@1

  memset(&popup_window, 0, 0x54u);
  popup_window.uFrameWidth = 384;
  popup_window.uFrameHeight = 256;
  popup_window.uFrameX = 128;
  popup_window.uFrameY = pMouse->GetCursorPos(&v6)->y + 30;
  popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(content, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24;
  popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1;
  popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1;
  popup_window.DrawMessageBox(0);

  popup_window.uFrameX += 12;
  popup_window.uFrameWidth -= 24;
  popup_window.uFrameY += 12;
  popup_window.uFrameHeight -= 12;
  popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1;
  popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1;
  sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", ui_character_tooltip_header_default_color, Title);
  popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3);
  popup_window.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, content, 0, 0, 0);
}

//----- (004151D9) --------------------------------------------------------
void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight)
{
  unsigned int uNumTiles; // [sp+2Ch] [bp-Ch]@6
  unsigned int coord_x; // [sp+2Ch] [bp-Ch]@3
  unsigned int coord_y; // [sp+34h] [bp-4h]@5

  pRenderer->SetTextureClipRect(uX, uY, uX + uWidth, uY + uHeight);
  if ( pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth && pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight)
  {
    uNumTiles = uWidth / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth;
    if ( uWidth % pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth )
      ++uNumTiles;
    coord_y = uY;
    for ( uint j = 0; j <= uHeight / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; j++ )
    {
      coord_x = uX - pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth;
      for ( uint i = uNumTiles + 1; i; --i )
      {
        coord_x += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth;
        pRenderer->DrawTextureIndexed(coord_x, coord_y, pIcons_LOD->GetTexture(uTextureID_Parchment));
      }
      coord_y += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight;
    }
    pRenderer->DrawTextureTransparent(uX,               uY,                pIcons_LOD->GetTexture(uTextureID_5076AC));
    pRenderer->DrawTextureTransparent(uX,               uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B4));
    pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY,                pIcons_LOD->GetTexture(uTextureID_5076A8));
    pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B0));
    if ( uWidth > 64 )
    {
      pRenderer->SetTextureClipRect(uX + 32, uY, uX + uWidth - 32, uY + uHeight);
      pRenderer->DrawTextureTransparent(uX + 32, uY,                pIcons_LOD->GetTexture(uTextureID_507698));
      pRenderer->DrawTextureTransparent(uX + 32, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4));
      if ( uWidth > 512 )
      {
        pRenderer->DrawTextureTransparent(uX + 544, uY,                pIcons_LOD->GetTexture(uTextureID_507698));
        pRenderer->DrawTextureTransparent(uX + 544, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4));
      }
    }
    if ( uHeight > 64 )
    {
      pRenderer->SetTextureClipRect(uX, uY + 32, uX + uWidth, uY + uHeight - 32);
      pRenderer->DrawTextureTransparent(uX,               uY + 32, pIcons_LOD->GetTexture(uTextureID_5076A0));
      pRenderer->DrawTextureTransparent(uX + uWidth - 10, uY + 32, pIcons_LOD->GetTexture(uTextureID_50769C));
    }
    pRenderer->ResetTextureClipRect();
  }
}

//----- (0041D895) --------------------------------------------------------
void GameUI_DrawItemInfo( struct ItemGen* inspect_item )
{
    unsigned int v2; // eax@3
    const char *v28; // edi@69
    int v34; // esi@81
    char *pText; // [sp-14h] [bp-28Ch]@110
    char out_text[300]; // [sp+8h] [bp-270h]@40
    char v65[120]; // [sp+134h] [bp-144h]@92
    stru351_summoned_item v67;
    int v77; // [sp+200h] [bp-78h]@12
    int v78; // [sp+204h] [bp-74h]@5
    GUIWindow iteminfo_window; // [sp+208h] [bp-70h]@2
    POINT a2; // [sp+25Ch] [bp-1Ch]@2
    int v81; // [sp+264h] [bp-14h]@5
    PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18
    char* v84;
    int v85;
    char *Str; // [sp+270h] [bp-8h]@65

  if (!inspect_item->uItemID)
    return;
  iteminfo_window.Hint = 0;
  iteminfo_window.uFrameWidth = 384;
  iteminfo_window.uFrameHeight = 180;
  iteminfo_window.uFrameY = 40;
  if ( pMouse->GetCursorPos(&a2)->x <= 320 )
    v2 = pMouse->GetCursorPos(&a2)->x + 30;
  else
    v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30;
  iteminfo_window.uFrameX = v2;
  v78 = 100 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureWidth;
  v81 = 144 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight;
  if ( v78 > 0 )
    v78 = v78 / 2;
  if ( v81 <= 0 )
    v81 = 0;
  else
    v81 = v81 / 2;
  if ( !pItemsTable->pItems[inspect_item->uItemID].uItemID_Rep_St )
    inspect_item->SetIdentified();
  v77 = 0;
  if (inspect_item->GetItemEquipType() == EQUIP_GOLD)
    v77 = inspect_item->uSpecEnchantmentType;
  if ( uActiveCharacter )
  {
  //try to identify
    if (!inspect_item->IsIdentified())
    {
      //v11 = inspect_item;
      if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 )
        inspect_item->SetIdentified();
      v83 = SPEECH_9;
      if ( !inspect_item->IsIdentified() )
        ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2);//"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->IsBroken())
    {
      if ( pPlayers[uActiveCharacter]->CanRepair(inspect_item) == 1 )
        inspect_item->uAttributes = inspect_item->uAttributes & 0xFFFFFFFD | 1;
      v83 = SPEECH_11;
      if ( !inspect_item->IsBroken() )
        v83 = SPEECH_10;
      else
        ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2);//"Repair Failed"
      if ( dword_4E455C )
      {
        pPlayers[uActiveCharacter]->PlaySound(v83, 0);
        dword_4E455C = 0;
      }
    }
  }
  if (inspect_item->IsBroken())
  {
    iteminfo_window.DrawMessageBox(0);
    pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12,
    iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, 
    iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
    iteminfo_window.uFrameWidth -= 24;
    iteminfo_window.uFrameHeight -= 12;
    iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
    iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
    pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
    if ( inspect_item->IsIdentified())
      pText = (char *)inspect_item->GetIdentifiedName();
    else
      pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName;
    iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pText, 3);
    iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2,
                   TargetColor(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item"
    pRenderer->ResetTextureClipRect();
    if ( !areWeLoadingTexture )
    {
      pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
      pIcons_LOD->SyncLoadedFilesCount();
    }
    return;
  }
  if (!inspect_item->IsIdentified())
  {
    iteminfo_window.DrawMessageBox(0);
    pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12,  iteminfo_window.uFrameY + 12,
          iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12,  iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
    iteminfo_window.uFrameWidth -= 24;
    iteminfo_window.uFrameHeight -= 12;
    iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
    iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
    pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
    iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3);
    iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2,
                        TargetColor(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified"
    pRenderer->ResetTextureClipRect();
    if ( !areWeLoadingTexture )
    {
      pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
      pIcons_LOD->SyncLoadedFilesCount();
    }
    return;
  }
  sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s"
  out_text[100] = 0;
  out_text[200] = 0;
  switch (inspect_item->GetItemEquipType())
  {
    case EQUIP_OFF_HAND:
    case EQUIP_MAIN_HAND:
      sprintfex(out_text + 100, "%s: +%d   %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK],
          (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53],
          (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage"
      if (inspect_item->GetDamageMod())
      {
        char mod[16];
        sprintf(mod, "+%d", (int)inspect_item->GetDamageMod());
        strcat(out_text + 100, mod);
      }
      break;

    case EQUIP_BOW:
      sprintfex(out_text + 100, "%s: +%d   %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot"
          (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], //"Damage"
          (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll());
      if (inspect_item->GetDamageMod())
      {
        char mod[16];
        sprintf(mod, "+%d", (int)inspect_item->GetDamageMod());
        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 (inspect_item->GetDamageDice()) //"Armor"	
          sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11],
                    inspect_item->GetDamageDice() + inspect_item->GetDamageMod());
      break;
  }

  if ( !v77 )
  {
    if (inspect_item->GetItemEquipType() ==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 (inspect_item->GetItemEquipType() == EQUIP_REAGENT)
      sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"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->m_enchantmentStrength); //"Special"
    else  if ( inspect_item->uSpecEnchantmentType )
      sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->m_enchantmentStrength);
    else if ( inspect_item->uNumCharges )
      sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges"
  }
  iteminfo_window.uFrameWidth -= 12;
  iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
  iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
  Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8));
  v84 = &out_text[0];
  for ( uint i = 1; i <= 3; i++ )
  {
    if ( *v84 )
      Str += pFontComic->CalcTextHeight(v84, &iteminfo_window, 100, 0) + 3;
    v84 += 100;
  }
  v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription;
  if ( *v28 )
    Str += pFontSmallnum->CalcTextHeight(pItemsTable->pItems[inspect_item->uItemID].pDescription, &iteminfo_window, 100, 0);
  iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(),
                                     TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54;
  if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight )
    iteminfo_window.uFrameHeight = (unsigned int)Str;
  if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
    iteminfo_window.uFrameHeight += LOBYTE(pFontComic->uFontHeight);
  v85 = 0;
  if ( pFontArrus->uFontHeight )
  {
    iteminfo_window.uFrameWidth -= 24;
    if ( pFontArrus->CalcTextHeight(inspect_item->GetIdentifiedName(), &iteminfo_window, 0, 0) / (signed int)pFontArrus->uFontHeight )
      v85 = pFontArrus->uFontHeight;
    iteminfo_window.uFrameWidth += 24;
  }
  iteminfo_window.uFrameWidth += 12;
  iteminfo_window.uFrameHeight += (unsigned int)v85;
  iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
  iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
  iteminfo_window.DrawMessageBox(0);
  pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12,
         iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
  iteminfo_window.uFrameWidth -= 12;
  //v32 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight;
  iteminfo_window.uFrameHeight -= 12;
  iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
  iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
  pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78,
      iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2,
      pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));

  v34 = (int)(v85 + 35);
  Str = out_text;
  for ( uint i = 1; i <= 3; i++ )
  {
    if ( *Str )
    {
      iteminfo_window.DrawText(pFontComic, 100, v34, 0, Str, 0, 0, 0);
      v34 += pFontComic->CalcTextHeight(Str, &iteminfo_window, 100, 0) + 3;
    }
    Str += 100;
  }
  v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription;
  if ( *v28 )
    iteminfo_window.DrawText(pFontSmallnum, 100, v34, 0, v28, 0, 0, 0);
  iteminfo_window.uFrameX += 12;
  iteminfo_window.uFrameWidth -= 24;
  iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), inspect_item->GetIdentifiedName(), 3);
  iteminfo_window.uFrameWidth += 24;
  iteminfo_window.uFrameX -= 12;
  if ( v77 )
  {
    sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value"
    iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
    pRenderer->ResetTextureClipRect();
  }
  else
  {
    if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
    {
      init_summoned_item(&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);
      }
      iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
    }
    sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], inspect_item->GetValue());
    iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
    if ( BYTE1(inspect_item->uAttributes) & 1 )
      pText = pGlobalTXT_LocalizationStrings[187]; //"Stolen"
    else
    {
      if ( !(BYTE1(inspect_item->uAttributes) & 2) )
      {
        pRenderer->ResetTextureClipRect();
        if ( !areWeLoadingTexture )
        {
          pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
          pIcons_LOD->SyncLoadedFilesCount();
        }
        return;
      }
      pText = pGlobalTXT_LocalizationStrings[651]; //"Hardened"
    }
    LOWORD(inspect_item->uAttributes) = LOWORD(pRenderer->uTargetRMask);
    iteminfo_window.DrawText(pFontComic, pFontComic->GetLineWidth(pTmpBuf.data()) + 132,
          iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0);
    pRenderer->ResetTextureClipRect();
  }
  if ( !areWeLoadingTexture )
  {
    pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->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 *window)
{
  int v8; // eax@4
  unsigned __int16 v9; // dx@4
  SpriteFrame *v10; // edi@17
  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 v25; // esi@32
  char *v26; // edx@34
  unsigned __int8 v27; // sf@36
  unsigned __int8 v28; // of@36
  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
  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
  int v65; // eax@155
  const char *v67; // [sp-10h] [bp-1FCh]@125
  const char *v68; // [sp-10h] [bp-1FCh]@142
  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 v75; // [sp-8h] [bp-1F4h]@125
  int v76; // [sp-8h] [bp-1F4h]@142
  size_t v77; // [sp-4h] [bp-1F0h]@54
  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
  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 v119; // [sp+1D0h] [bp-1Ch]@18
  SpellBuff *v120; // [sp+1D4h] [bp-18h]@18
  int v124; // [sp+1E4h] [bp-8h]@18
  int a4; // [sp+1E8h] [bp-4h]@18

  static Actor pMonsterInfoUI_Doll;
  /*if ( !(bMonsterInfoUI_bDollInitialized & 1) )
  {
    bMonsterInfoUI_bDollInitialized |= 1u;
    Actor::Actor(&pMonsterInfoUI_Doll);
    atexit(nullsub_3);
  }*/
  v106.uParentBillboardID = -1;
  v115 = monster_popup_y_offsets[((signed __int16)pActors[uActorID].pMonsterInfo.uID - 1) / 3] - 40;
  if ( pActors[uActorID].pMonsterInfo.uID == pMonsterInfoUI_Doll.pMonsterInfo.uID )
    v9 = pMonsterInfoUI_Doll.uCurrentActionLength;
  else
  {
    memcpy(&pMonsterInfoUI_Doll, &pActors[uActorID], sizeof(pMonsterInfoUI_Doll));
    pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored;
    pMonsterInfoUI_Doll.uCurrentActionTime = 0;
    v8 = rand();
    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[pActors[uActorID].pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength;
    }
  }
  v10 = pSpriteFrameTable->GetFrame( pActors[uActorID].pSpriteIDs[pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime);
  v106.pTarget = pRenderer->pTargetSurface;
  v106.pTargetZ = pRenderer->pActiveZBuffer;
  v106.uTargetPitch = pRenderer->uTargetSurfacePitch;
  v106.uViewportX = window->uFrameX + 13;
  v106.uViewportY = window->uFrameY + 52;
  v106.uViewportW = (window->uFrameY + 52) + 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 + (window->uFrameY + 52) + pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].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, TargetColor(0xE1u, 255, 0x9Bu));
  pRenderer->RasterLine2D( v106.uViewportX + 129,  v106.uViewportY - 1,  v106.uViewportX + 129,    v106.uViewportW + 1, TargetColor(0xE1u, 255, 0x9Bu));
  pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, TargetColor(0xE1u, 255, 0x9Bu));
  pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, TargetColor(0xE1u, 255, 0x9Bu));
  if ( pRenderer->pRenderD3D )
  {
    v106.uScreenSpaceY = v115 + v106.uViewportY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight;
    memset(&Dst, 0, 0x64u);
    Dst.dwSize = 100;
    Dst.dwFillColor = 0;
    memset(&pDesc, 0, 0x7Cu);
    pDesc.dwSize = 124;
    pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->GetSurfaceDesc(&pDesc);
    v107 = 0;
    i = 0;
    int dst_x = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2;
    int dst_y = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight;
    uint dst_z = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2 - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth;
    uint dst_w = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].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(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface, &pDesc, DDLOCK_WAIT))
      {
        v20 = (char *)dst_y;
        v110 = pDesc.lpSurface;
        //a2 = dst_y;
        if (dst_y < dst_w)
        {
          v21 = dst_x;
          v22 = &pRenderer->pTargetSurface[dst_y * pRenderer->uTargetSurfacePitch + dst_x];
          auto _v22_2 = v22;
          v23 = i - dst_y;
          v115 = i - dst_y;
          while ( 1 )
          {
            dst_y = v21;
            if ( v21 < dst_z )
            {
              v25 = v107 - v21;
              v109 = (int)&v20[v23];
              for ( i = v107 - v21; ; v25 = i )
              {
                v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight);
                v26 = (char *)v108 + pDesc.dwWidth * (v25 + dst_y++) / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].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 *)(dst_y + 1);
            v28 = __OFSUB__(dst_y + 1, dst_w);
            v27 = (signed int)(dst_y++ + 1 - dst_w) < 0;
            if ( !(v27 ^ v28) )
              break;
            v21 = dst_x;
          }
        }
        pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(0);
      }
    }
    else
    {
      memset(&pDesc, 0, 0x7Cu);
      pDesc.dwSize = 124;
      if ( pRenderer->LockSurface_DDraw4(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].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 / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight * (pDesc.lPitch / sizeof(short)) +
                       pDesc.dwWidth  * src_x / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth;
            uint b = src[idx] & 0x1F;
            *dst++ = b | 2 * (src[idx] & 0xFFE0);
          }
        }
        pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(0);
      }
    }
  }
  else
  {
    pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0);
    if ( v10->pHwSpriteIDs[0] >= 0 )
      pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].DrawSprite_sw(&v106, 0);
  }

  if ( pActors[uActorID].sNPC_ID )
  {
    if (GetNPCData(pActors[uActorID].sNPC_ID)->uProfession)
      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], GetNPCData(pActors[uActorID].sNPC_ID)->pName, aNPCProfessionNames[GetNPCData(pActors[uActorID].sNPC_ID)->uProfession]); // "%s the %s"   /   ^Pi[%s] %s
    else
    {
      v77 = 2000;
      v72 = GetNPCData(pActors[uActorID].sNPC_ID)->pName;
    }
  }
  else
  {
    v77 = 2000;
    if ( pActors[uActorID].dword_000334_unique_name )
      v72 = pMonsterStats->pPlaceStrings[pActors[uActorID].dword_000334_unique_name];
    else
      v72 = pMonsterStats->pInfos[pActors[uActorID].pMonsterInfo.uID].pName;
  }
  if(!pActors[uActorID].sNPC_ID || (pActors[uActorID].sNPC_ID && !GetNPCData(pActors[uActorID].sNPC_ID)->uProfession))
    strncpy(pTmpBuf.data(), v72, v77);
  window->DrawTitleText(pFontComic, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
  Actor::DrawHealthBar(&pActors[uActorID], window);
  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 >= pActors[uActorID].pMonsterInfo.uLevel )
        {
          v45 = 1;
          v119 = 1;
        }
        else
          v45 = 1;
      }
      else
      {
        v43 = v42 - 1;
        if ( !v43 )
        {
          if ( 2 * v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel )
          {
            v45 = 1;
            v119 = 1;
            v116 = 1;
          }
          else
            v45 = 1;
        }
        else
        {
          v44 = v43 - 1;
          if ( !v44 )
          {
            if ( 3 * v41 + 10 >= pActors[uActorID].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;
            }
          }
        }
      }
    }
    if ( pActors[uActorID].uAIState != Dead
      && pActors[uActorID].uAIState != Dying
      && !dword_507BF0_is_there_popup_onscreen && v120 )
    {
      if ( v119 | v116 | i | (unsigned int)v112 )
      {
        if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 )
          v73 = SPEECH_105;
        else
          v73 = SPEECH_104;
      }
      else
        v73 = SPEECH_106;
      pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)v73, 0);
    }
  }

  for (uint i = 0; i < 4; ++i)
  {
    v120 = (SpellBuff *)138;
    do
    {
      if ( (signed int)SkillToMastery(pParty->pPlayers[i].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 )
        v115 = v45;
      v120 = (SpellBuff *)((char *)v120 - 1);
    }
    while ( v120 );
  }

  window->DrawText(pFontSmallnum, 12, 196, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);
  if ( !v115 )
    window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);
  else
  {
	  a4 = 0;
	  v51 = &pActors[uActorID].pActorBuffs[1];
	  v222 = 0;
	  v120 = &pActors[uActorID].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);
			window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, v55, v54, 0, 0, 0);
			v50 = (LOBYTE(pFontSmallnum->uFontHeight) + 193) + *(char *)((int)pFontSmallnum + 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 )
		window->DrawText(pFontSmallnum, 28, v50, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[153], 0, 0, 0);
  }
  v56 = pFontSmallnum;
  a4 = v106.uViewportY;
  if ( v119 )
  {
    sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, pActors[uActorID].pMonsterInfo.uHP);
    window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
    a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
    v79 = pActors[uActorID].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]);
    window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), 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);
  window->DrawText(v56, 150, a4, TargetColor(0xE1u, 255, 0x9Bu), 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[pActors[uActorID].pMonsterInfo.uAttack1Type]);
    window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
    a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
    v57 = pActors[uActorID].pMonsterInfo.uAttack1DamageBonus;
    if ( v57 )
      sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53],
        0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides, v57);
    else
      sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53],
        0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides);
  }
  else
  {
    sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]);
    window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), 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]);
  }
  window->DrawText(v56, 150, a4, TargetColor(0xE1u, 255, 0x9Bu), 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);
    window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
    v58 = LOBYTE(v56->uFontHeight);
    a4 = a4 + v58 - 3;
  }
  else
  {
	  v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628];
	  v59 = &pActors[uActorID];
	  v114 = pActors[uActorID].pMonsterInfo.uSpell1ID;
	  if ( v114 && pActors[uActorID].pMonsterInfo.uSpell2ID )
		v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629];
	  if ( v114 )
	  {
		sprintf(pTmpBuf.data(), "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName);
		window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
		v58 = LOBYTE(v56->uFontHeight);
		a4 = a4 + v58 - 3;
		v59 = &pActors[uActorID];
	  }
	  v60 = v59->pMonsterInfo.uSpell2ID;
	  if ( v60 )
	  {
		sprintf(pTmpBuf.data(), "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName);
		window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
		v58 = LOBYTE(v56->uFontHeight);
		a4 = a4 + v58 - 3;
		v59 = &pActors[uActorID];
	  }
	  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);
		window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
		v58 = LOBYTE(v56->uFontHeight);
		a4 = a4 + v58 - 3;
	  }
  }
  a4 = a4 + v58 - 3;
  window->DrawText(v56, 150, a4, TargetColor(0xE1u, 255, 0x9Bu), 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 *)pActors[uActorID].pMonsterInfo.uResFire;
  v95[2] = (char *)pActors[uActorID].pMonsterInfo.uResAir;
  v95[3] = (char *)pActors[uActorID].pMonsterInfo.uResWater;
  v95[4] = (char *)pActors[uActorID].pMonsterInfo.uResEarth;
  v95[5] = (char *)pActors[uActorID].pMonsterInfo.uResMind;
  v95[6] = (char *)pActors[uActorID].pMonsterInfo.uResSpirit;
  v95[7] = (char *)pActors[uActorID].pMonsterInfo.uResBody;
  v95[8] = (char *)pActors[uActorID].pMonsterInfo.uResLight;
  v95[9] = (char *)pActors[uActorID].pMonsterInfo.uResPhysical;
  v95[10] = (char *)pActors[uActorID].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);
      window->DrawText(v56, 170, a4, TargetColor(0xE1u, 255, 0x9Bu), 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]); // "?"
      window->DrawText(v56, 170, a4, TargetColor(0xE1u, 255, 0x9Bu), 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], pActors[uActorID].sCurrentHP);
    pFontSmallnum->GetLineWidth(pTmpBuf.data());
    window->DrawTitleText(pFontSmallnum, 0, window->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);
                CharacterUI_DrawTooltip(pSkillNames[i->msg_param], v3);
                v1 = pY;
                v0 = pX;
                }
            }
        }
    else
        {
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
        }
    
    }

//----- (00418083) --------------------------------------------------------
void  CharacterUI_StatsTab_ShowHint()
{
  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

  pMouse->GetCursorPos(&a2);
  for ( pStringNum = 0; pStringNum < stat_string_coord.size(); ++pStringNum )
  {
    if (a2.x >= stat_string_coord[pStringNum].x && a2.x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width )
    {
      if (a2.y >= stat_string_coord[pStringNum].y && a2.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] )
        CharacterUI_DrawTooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]);
      break;
    case 7:// Health Points
      if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription);
      break;
    case 8:// Spell Points
      if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription);
      break;
    case 9:// Armor Class
      if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription )
        CharacterUI_DrawTooltip(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() )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data());
      break;
    case 11:// Fast Spell
      if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription);
      break;
    case 12:// Player Age
      if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription);
      break;
    case 13:// Player Level
      if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription);
      break;
    case 14://Experience
      v15 = pPlayers[uActiveCharacter]->uLevel;
      do
      {
        if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)GetExperienceRequiredForLevel(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 = GetExperienceRequiredForLevel(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() )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data());
      break;
    case 15:// Attack Bonus
      if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription);
      break;
    case 16:// Attack Damage
      if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription);
      break;
    case 17:// Missle Bonus
      if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription);
      break;
    case 18:// Missle Damage
      if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription);
      break;
    case 19:// Fire Resistance
      if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription);
      break;
    case 20:// Air Resistance
      if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription);
      break;
    case 21:// Water Resistance
      if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription);
      break;
    case 22:// Earth Resistance
      if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription);
      break;
    case 23:// Mind Resistance
      if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription);
      break;
    case 24:// Body Resistance
      if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription);
      break;
    case 25: // Skill Points
      if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription )
        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
      break;
    case 26: // Class description
    {
      if (pClassDescriptions[pPlayers[uActiveCharacter]->classType] && pClassNames[pPlayers[uActiveCharacter]->classType])
        CharacterUI_DrawTooltip(pClassNames[pPlayers[uActiveCharacter]->classType], pClassDescriptions[pPlayers[uActiveCharacter]->classType]);
    }
    break;

    default:
      break;
  }
}

    //----- (00410B28) --------------------------------------------------------
    void  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:
            {
            OnInventoryItemRightClick();
            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 )
                {
                OnInventoryItemRightClick();
                }
            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
                  OnInventoryItemRightClick();
              }
            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;
        }