diff UI/UIPopup.cpp @ 1720:5f2583a4fa7d

m
author Ritor1
date Wed, 25 Sep 2013 08:59:01 +0600
parents 5863074ed9ba
children 1c072d19e397
line wrap: on
line diff
--- a/UI/UIPopup.cpp	Tue Sep 24 09:44:03 2013 +0600
+++ b/UI/UIPopup.cpp	Wed Sep 25 08:59:01 2013 +0600
@@ -440,13 +440,10 @@
   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 skill_points; // edi@61
+  unsigned int skill_level; // eax@61
   int pTextHeight; // edi@90
-  int v73; // [sp-8h] [bp-1F4h]@79
+  PlayerSpeech speech; // [sp-8h] [bp-1F4h]@79
   DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18
   DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18
   RECT v84; // [sp+ECh] [bp-100h]@26
@@ -457,7 +454,7 @@
   unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34
   unsigned int v109; // [sp+1A8h] [bp-44h]@32
   LPVOID v110; // [sp+1ACh] [bp-40h]@28
-  int v115; // [sp+1C0h] [bp-2Ch]@3
+  bool for_effects; // [sp+1C0h] [bp-2Ch]@3
   bool normal_level; // [sp+1D0h] [bp-1Ch]@18
   bool expert_level; // [sp+1C4h] [bp-28h]@18
   bool master_level; // [sp+1C8h] [bp-24h]@18
@@ -465,8 +462,9 @@
   char *pText; // [sp+1D4h] [bp-18h]@18
   int pTextColorID; // [sp+1E4h] [bp-8h]@18
   int a4; // [sp+1E8h] [bp-4h]@18
+  int v115;
 
-  bool monster_full_informations = true;
+  bool monster_full_informations = false;
   static Actor pMonsterInfoUI_Doll;
   /*if ( !(bMonsterInfoUI_bDollInitialized & 1) )
   {
@@ -667,93 +665,60 @@
   expert_level = 0;
   master_level = 0;
   grandmaster_level = 0;
+  for_effects = 0;
   pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed;
-  v115 = 0;
-  if ( !uActiveCharacter )
-    v45 = 1;
-  else
+  if ( pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) )
   {
-    int i = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
-    if ( !i )
-      v45 = 1;
-    else
+    skill_points = (unsigned __int8)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) & 0x3F;
+    skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) - 1;
+    if ( skill_level == 0 )//(normal)
     {
-      v41 = (unsigned __int8)i & 0x3F;
-      v42 = SkillToMastery(i) - 1;
-      if ( !v42 )//not master
-      {
-        if ( v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel )
-        {
-          v45 = 1;
-          normal_level = 1;
-        }
-        else
-          v45 = 1;
-      }
-      else//he is master
+      if ( skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel )
+        normal_level = 1;
+    }
+    else if ( skill_level == 1 )//(expert)
+    {
+      if ( 2 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel )
       {
-        v43 = v42 - 1;
-        if ( !v43 )
-        {
-          if ( 2 * v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel )
-          {
-            v45 = 1;
-            normal_level = 1;
-            expert_level = 1;
-          }
-          else
-            v45 = 1;
-        }
-        else
-        {
-          v44 = v43 - 1;
-          if ( !v44 )
-          {
-            if ( 3 * v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel )
-            {
-              v45 = 1;
-              normal_level = 1;
-              expert_level = 1;
-              master_level = 1;
-            }
-            else
-              v45 = 1;
-          }
-          else
-          {
-            if ( v44 != 1 )
-              v45 = 1;
-            else
-            {
-              v45 = 1;
-              normal_level = 1;
-              expert_level = 1;
-              master_level = 1;
-              grandmaster_level = 1;
-            }
-          }
-        }
+        normal_level = 1;
+        expert_level = 1;
       }
     }
-    if ( pActors[uActorID].uAIState != Dead
-      && pActors[uActorID].uAIState != Dying
-      && !dword_507BF0_is_there_popup_onscreen && i )
+    else if ( skill_level  == 2 )//(master)
     {
-      if ( normal_level | expert_level | master_level | grandmaster_level )
+      if ( 3 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel )
       {
-        if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 )
-          v73 = SPEECH_105;
-        else
-          v73 = SPEECH_104;
+        normal_level = 1;
+        expert_level = 1;
+        master_level = 1;
       }
-      else
-        v73 = SPEECH_106;
-      pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)v73, 0);
+    }
+    else if ( skill_level == 3 )//grandmaster
+    {
+      normal_level = 1;
+      expert_level = 1;
+      master_level = 1;
+      grandmaster_level = 1;
     }
   }
+  if ( pActors[uActorID].uAIState != Dead
+    && pActors[uActorID].uAIState != Dying
+    && !dword_507BF0_is_there_popup_onscreen && pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) )
+  {
+    if ( normal_level | expert_level | master_level | grandmaster_level )
+    {
+      if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 )
+        speech = SPEECH_IDENTIFY_MONSTER_STRONGER;
+      else
+        speech = SPEECH_IDENTIFY_MONSTER_WEAKER;
+    }
+    else
+      speech = SPEECH_IDENTIFY_MONSTER_106;
+    pPlayers[uActiveCharacter]->PlaySound(speech, 0);
+  }
 
-  if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 )
-    v115 = v45;
+  if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter - 1].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 )
+    for_effects = 1;
 
   if ( monster_full_informations == true )
   {
@@ -761,11 +726,11 @@
     expert_level = 1;//
     master_level = 1;//
     grandmaster_level = 1;//
-    v115 = 1;
+    for_effects = 1;
   }
 
   window->DrawText(pFontSmallnum, 12, 196, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects
-  if ( !v115 )
+  if ( !for_effects )
     window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//?
   else
   {
@@ -1009,6 +974,7 @@
       pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3;
     }
   }
+  //cast spell: Detect life
   if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 )
   {
     sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], pActors[uActorID].sCurrentHP);//Current Hit Points
@@ -1017,191 +983,85 @@
   }
 }
 
-
 //----- (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
+  char a2[1200]; // [sp+Ch] [bp-538h]@7
+  char Source[120]; // [sp+4BCh] [bp-88h]@7
+  int v35; // [sp+53Ch] [bp-8h]@1
+
+  v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal
+  if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]) > (signed int)v35 )
+    v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert
+  if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]) > (signed int)v35 )
+    v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master
+  if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]) > (signed int)v35 )
+    v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand
 
-    //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;
-    }
+  a2[0] = 0;
+  Source[0] = 0;
+  strcpy(a2, "%s\n\n");
+  sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 1));
+  strcat(a2, Source);
+  strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
+  sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 2));
+  strcat(a2, Source);
+  strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
+  sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 3));
+  strcat(a2, Source);
+  strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
+  sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 4));
+  strcat(a2, Source);
+  strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
+  if ( (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F) == (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) )
+  {
+    sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType],
+            pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType],     // Normal
+            pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType],     // Expert
+            pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType],     // Master
+            pGlobalTXT_LocalizationStrings[96],  v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType]);      // Grand
+  }
+  else
+  {
+    sprintf(Source, "\f%05d", TargetColor(0xFFu, 0xFFu, 0xFFu));
+    strcat(a2, Source);
+    strcat(a2, "%s: +%d");
+    sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType],
+            pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType],
+            pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType],
+            pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType],
+            pGlobalTXT_LocalizationStrings[96],  v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType],
+            pGlobalTXT_LocalizationStrings[623], //Bonus
+            (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) - (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F));
+  }
+  return static_sub_417BB5_out_string;
+}
 
 //----- (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
+void CharacterUI_SkillsTab_ShowHint()
+{
+  GUIButton *pButton; // esi@6
+  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);
-        }
-    
+  pMouse->GetClickPos(&pX, &pY);
+  if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 )
+  {
+    for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
+    {
+      if ( pButton->msg == UIMSG_SkillUp
+        && (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 )
+      {
+        CharacterUI_DrawTooltip(pSkillNames[pButton->msg_param], CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)pButton->msg_param));
+      }
     }
+  }
+  else
+    CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);//Очки навыков
+}
 
 //----- (00418083) --------------------------------------------------------
 void  CharacterUI_StatsTab_ShowHint()
@@ -1211,7 +1071,6 @@
   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
@@ -1304,8 +1163,7 @@
       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);
+      sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience), v15 + 1);
       strcat(pTmpBuf.data(), "\n");
       strcat(pTmpBuf.data(), pTmpBuf2.data());
       sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data());
@@ -1368,106 +1226,72 @@
   }
 }
 
-    //----- (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
+//----- (00410B28) --------------------------------------------------------
+void  DrawSpellDescriptionPopup(int spell_index)
+{
+  SpellInfo *spell; // esi@1
+  unsigned int v3; // eax@2
+  LONG v5; // ecx@4
+  GUIWindow spell_info_window; // [sp+Ch] [bp-68h]@4
+  POINT mouse; // [sp+64h] [bp-10h]@1
 
-        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(),
+  spell = &pSpellStats->pInfos[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1];
+  if ( pMouse->GetCursorPos(&mouse)->y <= 250 )
+    v3 = pMouse->GetCursorPos(&mouse)->y + 30;
+  else
+    v3 = 30;
+  spell_info_window.uFrameY = v3;
+  spell_info_window.uFrameWidth = 328;
+  spell_info_window.uFrameHeight = 68;
+  spell_info_window.uFrameX = 90;
+  spell_info_window.uFrameZ = 417;
+  spell_info_window.uFrameW = v3 + 67;
+  spell_info_window.Hint = 0;
+  v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]);
+  if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]) > v5 )
+    v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]);
+  if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]) > v5 )
+    v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]);
+  if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]) > v5 )
+    v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]);
+  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;
-        }
+            spell->pDescription,
+            pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], v5 + 3, v5 + 10, spell->pBasicSkillDesc,
+            pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], v5 + 3, v5 + 10, spell->pExpertSkillDesc,
+            pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], v5 + 3, v5 + 10, spell->pMasterSkillDesc,
+            pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], v5 + 3,  v5 + 10, spell->pGrandmasterSkillDesc);
+  spell_info_window.uFrameHeight += pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &spell_info_window, 0, 0);
+  if ( (signed int)spell_info_window.uFrameHeight < 150 )
+    spell_info_window.uFrameHeight = 150;
+  spell_info_window.uFrameWidth = game_viewport_width;
+  spell_info_window.DrawMessageBox(0);
+  spell_info_window.uFrameWidth -= 12;
+  spell_info_window.uFrameHeight -= 12;
+  spell_info_window.uFrameZ = spell_info_window.uFrameX + spell_info_window.uFrameWidth - 1;
+  spell_info_window.uFrameW = spell_info_window.uFrameHeight + spell_info_window.uFrameY - 1;
+  spell_info_window.DrawTitleText(pFontArrus, 0x78u, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), spell->pName, 3);
+  spell_info_window.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
+  spell_info_window.uFrameWidth = 108;
+  spell_info_window.uFrameZ = spell_info_window.uFrameX + 107;
+  spell_info_window.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12], 3);
+  sprintf( pTmpBuf.data(),  "%s\n%d",    pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST],
+       pSpellDatas[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1].mana_per_skill[pPlayers[uActiveCharacter]->pActiveSkills[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]);
+  spell_info_window.DrawTitleText(pFontComic, 0xCu, spell_info_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3);
+  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
+        //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
+        //signed int v6; // esi@64
+        //signed int v7; // esi@69
         unsigned int v10; // eax@76
         //char v11; // zf@83
         GUIButton *pButton; // esi@84
@@ -1485,221 +1309,193 @@
         char *pHint; // edx@113
         unsigned int pColor; // eax@113
         GUIWindow pWindow; // [sp+4h] [bp-74h]@32
-        double v27; // [sp+58h] [bp-20h]@33
+        //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
+        //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 ( 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 )//нажатие на портрет перса правой кнопкой мыши с раствором
+  {
+    for ( uint i = 0; i < 4; ++i )
+    {
+      if ( (signed int)pX > RightClickPortraitXmin[i] && (signed int)pX < RightClickPortraitXmax[i]
+        && (signed int)pY > 375 && (signed int)pY < 466 )
+      {
+        pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(i + 1, 1);
+        return;
+      }
+    }
+  }
 
-            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;
+  pEventTimer->Pause();
+  switch(pCurrentScreen)
+  {
+    case SCREEN_CASTING:
+    {
+      OnInventoryItemRightClick();
+      break;
+    }
+    case SCREEN_CHEST:
+    {
+      if ( !pPlayers[uActiveCharacter]->CanAct() )
+      {
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы
+        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
+      {
+        if ( pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF )
+        {
+          v10 = pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF)-1];
+          GameUI_DrawItemInfo(&pChests[pChestWindow->par1C].igChestItems[v10 - 1]);
+        }
+      }
+      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 )//portaits zone
+        {
+          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 )//buff_tooltip zone
+          {
+            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 )//NPC zone
+          {
+            if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 ))
+            {
+              pAudioPlayer->StopChannels(-1, -1);
+              GameUI_DrawNPCPopup((void *)1);//NPC 2
             }
-        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;
+          }
+          else
+          {
             pAudioPlayer->StopChannels(-1, -1);
-            pWindow.DrawMessageBox(0);
-            break;
-            }
-        case SCREEN_CHARACTERS:
+            GameUI_DrawNPCPopup(0);//NPC 1
+          }
+        }
+        else//minimap zone
+        {
+          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//game zone
+      {
+        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]];
+        if (PID_TYPE((unsigned __int16)v5) == OBJECT_Actor)
+        {
+          if ( pRenderer->uNumSceneBegins )
+          {
+            pWindow.DrawMessageBox(1);
+            MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &pWindow);
+          }
+          else
+          {
+            pRenderer->BeginScene();
+            pWindow.DrawMessageBox(1);
+            MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &pWindow);
+            pRenderer->EndScene();
+          }
+        }
+        if (PID_TYPE((unsigned __int16)v5) == OBJECT_Item)
+        {
+          if ( !(pObjectList->pObjects[pSpriteObjects[PID_ID((unsigned __int16)v5)].uObjectDescID].uFlags & 0x10 ) )
+          {
+            GameUI_DrawItemInfo(&pSpriteObjects[PID_ID((unsigned __int16)v5)].stru_24);
+          }
+        }
+      }
+      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
+        || ((pWindow.Hint = (char *)GetMapBookHintText()) == 0) )
+        break;
+      pWindow.uFrameWidth = (pFontArrus->GetLineWidth(pWindow.Hint) + 32) + 0.5f;
+      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:
             {