changeset 1726:9e81a9147752

Слияние
author Ritor1
date Wed, 25 Sep 2013 12:22:38 +0600
parents 8de9b24ace86 (diff) bc0fa6153fe1 (current diff)
children 2c38e17e5a3f
files
diffstat 9 files changed, 515 insertions(+), 819 deletions(-) [+]
line wrap: on
line diff
--- a/Player.h	Wed Sep 25 08:13:09 2013 +0200
+++ b/Player.h	Wed Sep 25 12:22:38 2013 +0600
@@ -143,9 +143,9 @@
   SPEECH_101 = 101,
   SPEECH_PickMe = 102,
   SPEECH_103 = 103,
-  SPEECH_104 = 104,
-  SPEECH_105 = 105,
-  SPEECH_106 = 106,
+  SPEECH_IDENTIFY_MONSTER_WEAKER = 104,
+  SPEECH_IDENTIFY_MONSTER_STRONGER = 105,
+  SPEECH_IDENTIFY_MONSTER_106 = 106,
   SPEECH_107 = 107,
   SPEECH_108 = 108,
   SPEECH_109 = 109,
--- a/UI/Books/UIMapBook.cpp	Wed Sep 25 08:13:09 2013 +0200
+++ b/UI/Books/UIMapBook.cpp	Wed Sep 25 12:22:38 2013 +0600
@@ -193,12 +193,12 @@
   GUIWindow map_window; // [sp+84h] [bp-54h]@35
 
   pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12);
-  if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 )//Button 1
+  if ( BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12 )//Button 1
     pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
   else
     pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
 
-  if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 )//Button 2
+  if ( BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3 )//Button 2
     pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
   else
     pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
@@ -265,11 +265,6 @@
 void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 )
 {
   int v20; // eax@16
-  signed int v21; // esi@18
-  int v22; // ecx@21
-  BLVMapOutline *v23; // ecx@21
-  Vec3_short_ *v24; // edx@21
-  Vec3_short_ *v25; // eax@21
   int v26; // ecx@21
   unsigned __int16 *v27; // edi@21
   int v28; // edx@21
@@ -313,16 +308,13 @@
   unsigned __int16 *v67; // esi@96
   int v68; // edi@98
   unsigned __int16 v69; // cx@99
-  unsigned int v70; // [sp-10h] [bp-48074h]@80
-  unsigned int v71; // [sp-Ch] [bp-48070h]@80
-  unsigned int v72; // [sp-8h] [bp-4806Ch]@80
   signed int v73; // [sp-4h] [bp-48068h]@59
   unsigned __int16 v74; // [sp-4h] [bp-48068h]@79
   unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23
   int v76; // [sp+4800Ch] [bp-58h]@23
   unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27
   unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23
-  int v81; // [sp+48020h] [bp-44h]@23
+  int map_tile_X; // [sp+48020h] [bp-44h]@23
   unsigned __int16* render16_data;
   unsigned char* texture8_data;
   unsigned char* curr_line;
@@ -343,7 +335,7 @@
   unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16
   signed int screenWidth; // [sp+48054h] [bp-10h]@8
   unsigned int v95; // [sp+48058h] [bp-Ch]@16
-  int v96; // [sp+4805Ch] [bp-8h]@10
+  int map_tile_Y; // [sp+4805Ch] [bp-8h]@10
   const void *v97; // [sp+48060h] [bp-4h]@16
   unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85
   int a5a; // [sp+48070h] [bp+Ch]@86
@@ -353,12 +345,12 @@
   pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y);
   pCenterX = viewparams->sViewCenterX;
   pCenterY = viewparams->sViewCenterY;
-  if ( viewparams->field_2C != 384 )
+  if ( viewparams->uMapBookMapZoom != 384 )
   {
-    if ( viewparams->field_2C == 768 )
+    if ( viewparams->uMapBookMapZoom == 768 )
     {
       if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
-        viewparams->field_2C = 680;
+        viewparams->uMapBookMapZoom = 680;
     }
   }
   else
@@ -367,7 +359,7 @@
     pCenterX = viewparams->indoor_center_x;
     pCenterY = viewparams->indoor_center_y;
     if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
-      viewparams->field_2C = viewparams->field_2C - 34;
+      viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34;
   }
   if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
   {
@@ -376,20 +368,16 @@
     render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
     texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask;
     pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
-    scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->field_2C;
+    scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
 
     v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
 
-    teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->field_2C / 384) + 32768) / v30) << 16;
-    //  v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16);
+    teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16;
 
-    //   v32 = map_texture_16;
     textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
-    stepY_r =            (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->field_2C / 384)+ 32768) / v30) << 16;
-    //   v81 =   (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
-    black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->field_2C / 384) + 32768) / v30);
+    stepY_r =            (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384)+ 32768) / v30) << 16;
+    black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30);
 
-    //  v76 = textr_width;
     scaled_posY = stepY_r >> 16;
     //nearest neiborhood scaling
     if ( texture8_data)  
@@ -445,64 +433,52 @@
             screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY;
             v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY;
             v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX;
-            v97 = (const void *)v20;
-            v88 = (unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16;
-            v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)viewparams->field_2C) >> 16;
-            v93 = (unsigned __int16 *)((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16);
-            screenHeight = (unsigned __int64)(v20 * (signed __int64)viewparams->field_2C) >> 16;
+
+            v88 = (unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
+            v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
+            v93 = (unsigned __int16 *)((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16);
+            screenHeight = (unsigned __int64)(v20 * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
             pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87,
-            screenCenter_X + ((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16), screenCenterY - screenHeight, black);
+              screenCenter_X + ((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16), screenCenterY - screenHeight, black);
           }
         }
       }
     }
-    v21 = 0;
     if ( (signed int)uNumBlueFacesInBLVMinimap > 0 )
     {
-      while ( 1 )
+      for ( uint j = 0; j < (signed int)uNumBlueFacesInBLVMinimap; ++j )
       {
-        v22 = pBlueFacesInBLVMinimapIDs[v21];
-        v87 = viewparams->field_2C;
-        v23 = &pIndoor->pMapOutlines->pOutlines[v22];
-        v24 = &pIndoor->pVertices[v23->uVertex1ID];
-        v25 = &pIndoor->pVertices[v23->uVertex2ID];
-        v26 = v25->x;
-        v27 = (unsigned __int16 *)(v24->x - pCenterX);
-        v28 = v24->y - pCenterY;
-        v29 = v25->y - pCenterY;
-        v93 = v27;
-        screenHeight = v28;
-        v97 = (const void *)v29;
-        v87 = (unsigned __int64)((signed int)v27 * (signed __int64)viewparams->field_2C) >> 16;
-        v88 = (unsigned __int64)(v28 * (signed __int64)viewparams->field_2C) >> 16;
-        uint i = (unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->field_2C) >> 16;
-        v95 = (unsigned __int64)(v29 * (signed __int64)viewparams->field_2C) >> 16;
-        pRenderer->RasterLine2D(screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)viewparams->field_2C) >> 16),
-        screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->field_2C) >> 16), screenCenterY - v95, teal);
-        ++v21;
-        if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap )
-          break;
+        v26 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].x;
+        v27 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].x - pCenterX);
+        v28 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].y - pCenterY;
+        v29 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].y - pCenterY;
+
+        v87 = (unsigned __int64)((signed int)v27 * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
+        v88 = (unsigned __int64)(v28 * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
+        uint i = (unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
+        v95 = (unsigned __int64)(v29 * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
+        pRenderer->RasterLine2D(screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)viewparams->uMapBookMapZoom) >> 16),
+          screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16), screenCenterY - v95, teal);
       }
       viewparams->sViewCenterX = pCenterX;
     }
   }
-  v47 = ((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X - 3;
-  v81 = pParty->vPosition.y - pCenterY;
-  v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - pCenterY) * (signed __int64)viewparams->field_2C) >> 16);
+  v47 = ((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X - 3;
+  v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - pCenterY) * (signed __int64)viewparams->uMapBookMapZoom) >> 16);
   v48 = 1;
   v49 = screenCenterY - (int)v97 - 3;
   if ( v47 >= (signed int)tl_x )
   {
     if ( v47 > (signed int)br_x )
     {
-      if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X - 6) > (signed int)br_x )
+      if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X - 6) > (signed int)br_x )
         v48 = 0;
       v47 = br_x;
     }
   }
   else
   {
-    if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X) < (signed int)tl_x )
+    if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X) < (signed int)tl_x )
       v48 = 0;
     v47 = tl_x;
   }
@@ -542,8 +518,6 @@
       v50 = 7;
     pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50]));
   }
-  result = TargetColor(0xFFu, 0xFFu, 0xFFu);
-  pCenterX = result;
   if ( (signed int)uNumLevelDecorations > 0 )
   {
     for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )
@@ -552,30 +526,22 @@
       {
         screenHeight = pLevelDecorations[i].vPosition.y - pCenterY;
         v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX);
-        v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X;
-        v97 = (const void *)((unsigned __int64)(screenHeight * (signed __int64)viewparams->field_2C) >> 16);
+        v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X;
+        v97 = (const void *)((unsigned __int64)(screenHeight * (signed __int64)viewparams->uMapBookMapZoom) >> 16);
         v55 = screenCenterY - (int)v97;
-        if ( v54 >= pRenderer->raster_clip_x )
+        if ( v54 >= pRenderer->raster_clip_x && v54 <= pRenderer->raster_clip_z
+          && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
         {
-          if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
+          if ( viewparams->uMapBookMapZoom > 512 )
           {
-            if ( viewparams->field_2C > 512 )
-            {
-              pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, pCenterX);
-              pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, pCenterX);
-              ++v54;
-              v72 = v55 + 1;
-              v71 = v54;
-              v70 = v55 - 1;
-            }
-            else
-            {
-              v72 = screenCenterY - (int)v97;
-              v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X;
-              v70 = screenCenterY - (int)v97;
-            }
-            pRenderer->RasterLine2D(v54, v70, v71, v72, pCenterX);
+            pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, TargetColor(0xFFu, 0xFFu, 0xFFu));
+            pRenderer->RasterLine2D(v54,     v55 - 1, v54,     v55 + 1, TargetColor(0xFFu, 0xFFu, 0xFFu));
+            pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, TargetColor(0xFFu, 0xFFu, 0xFFu));
           }
+          else
+            pRenderer->RasterLine2D(v54, screenCenterY - (int)v97,
+                   ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X,
+                   screenCenterY - (int)v97, TargetColor(0xFFu, 0xFFu, 0xFFu));
         }
       }
     }
@@ -585,35 +551,30 @@
     screenCenterY = br_x - tl_x + 1;
     v95 = br_y - tl_y + 1;
     v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
-    v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2;
-    black = (1 << (v56 + 16)) / viewparams->field_2C;
-    v57 = (double)(1 << (16 - v56));
-    v58 = 22528 / (viewparams->field_2C / 384);
-    v59 = (signed __int64)((double)(viewparams->sViewCenterX - v58 + 32768) / v57);
-    v60 = (int)v59 << 16;
-    v97 = (const void *)((int)v59 << 16);
-    v61 = (signed __int64)((double)(32768 - v58 - pCenterY) / v57);
+    black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
+    v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
+    v60 = (int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16;
+    teal = v60 >> 16;
     pPalette_16 = (unsigned __int16 *)(v60 >> 16);
-    v62 = (int)v61 << 16;
-    teal = v60 >> 16;
-    v63 = (signed __int16)v61;
+    v97 = (const void *)((int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16);
+    v62 = (int)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)) << 16;
+    v63 = (signed __int16)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57));
     a4a = map_texture_16;
-    result = TargetColor(0xCu, 0xCu, 0xCu);
     for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X )
     {
       if ( screenCenterY > 0 )
       {
-        v96 = (v63 - 80) / 4;
+        map_tile_Y = (v63 - 80) / 4;
         v64 = teal;
         for ( a5a = 0; a5a < screenCenterY; ++a5a )
         {
-          v81 = (v64 - 80) / 4;
-          if ( !pOutdoor->_47F04C(v81, v96) )
+          map_tile_X = (v64 - 80) / 4;
+          if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) )
           {
-            if ( pOutdoor->_47F097(v81, v96) )
+            if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) )
             {
               if ( !((a5a + screenCenter_X) % 2) )
-                *a4a = result;
+                *a4a = TargetColor(0xCu, 0xCu, 0xCu);
             }
             else
               *a4a = 0;
@@ -652,3 +613,63 @@
     }
   }
 }
+
+//----- (00444564) --------------------------------------------------------
+const char * GetMapBookHintText()
+{
+  int v20;
+  int v21; // [sp+14h] [bp-Ch]@1
+  double v0; // st7@3
+  unsigned int pX; // [sp+1Ch] [bp-4h]@3
+  unsigned int pY; // [sp+8h] [bp-18h]@3
+  int global_coord_X; // ebx@3
+  int global_coord_Y;
+  int map_tile_X; // edi@3
+  int map_tile_Y; // eax@3
+  const char *result; // eax@15
+
+  v20 = viewparams->sViewCenterX;
+  v21 = viewparams->sViewCenterY;
+  if ( viewparams->uMapBookMapZoom == 384 )
+  {
+    v20 = viewparams->indoor_center_x;
+    v21 = viewparams->indoor_center_y;
+  }
+  pMouse->GetClickPos(&pX, &pY);
+  v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789);
+
+  global_coord_X = (signed __int64)((double)(pX - 229) * v0 + (double)v20);
+  global_coord_Y = (signed __int64)((double)v21 - (double)(pY - 181) * v0);
+
+  result = 0;
+  map_tile_X = abs(global_coord_X + 22528) / 512;
+  map_tile_Y = abs(global_coord_Y - 22528) / 512;
+  if ( pOutdoor->_47F04C(map_tile_X, map_tile_Y) && uCurrentlyLoadedLevelType == LEVEL_Outdoor && (signed int)pOutdoor->uNumBModels > 0 )
+  {
+    for(int i = 0; i < pOutdoor->uNumBModels && !result; i++)
+    {
+      if ( int_get_vector_length(abs((signed)pOutdoor->pBModels[i].vBoundingCenter.x - global_coord_X),
+                                 abs((signed)pOutdoor->pBModels[i].vBoundingCenter.y - global_coord_Y), 0) < pOutdoor->pBModels[i].sBoundingRadius )
+      {
+        if ( pOutdoor->pBModels[i].uNumFaces > 0 )
+        {
+          for( int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++ )
+          {
+            if ( pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID )
+            {
+              if ( !(pOutdoor->pBModels[i].pFaces[j].uAttributes & 0x100000) )
+              {
+                if ( GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID) )
+                {
+                  if ( _stricmp(GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID), "") )
+                    result = GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID);
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  return result;
+}
\ No newline at end of file
--- a/UI/UIPopup.cpp	Wed Sep 25 08:13:09 2013 +0200
+++ b/UI/UIPopup.cpp	Wed Sep 25 12:22:38 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
   {
@@ -937,19 +902,19 @@
       pText = pGlobalTXT_LocalizationStrings[629];//Spells
     if ( pActors[uActorID].pMonsterInfo.uSpell1ID )
     {
-      sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName);
+      sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName);//"%s\f%05u\t060%s\n"
       window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
       pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3;
     }
     if ( pActors[uActorID].pMonsterInfo.uSpell2ID )
     {
-      sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName);
+      sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName);//"%s\f%05u\t060%s\n"
       window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
       pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3;
     }
     if ( !pActors[uActorID].pMonsterInfo.uSpell1ID && !pActors[uActorID].pMonsterInfo.uSpell2ID )
     {
-      sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]);
+      sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]);//"%s\f%05u\t060%s\n"
       window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
       pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3;
     }
@@ -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,246 +1309,209 @@
         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:
-        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:
+            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:
+    {
+      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);
--- a/UI/UiGame.cpp	Wed Sep 25 08:13:09 2013 +0200
+++ b/UI/UiGame.cpp	Wed Sep 25 12:22:38 2013 +0600
@@ -687,16 +687,16 @@
   const char *v14; // eax@8
   char *result; // eax@12
   unsigned int pMapID; // eax@14
-  int v19; // [sp+10h] [bp-1Ch]@1
-  int v20; // [sp+14h] [bp-18h]@1
+  int global_coord_X; // [sp+10h] [bp-1Ch]@1
+  int global_coord_Y; // [sp+14h] [bp-18h]@1
   unsigned int pY; // [sp+1Ch] [bp-10h]@1
   unsigned int pX; // [sp+28h] [bp-4h]@1
 
   result = 0;
   pMouse->GetClickPos(&pX, &pY);
   v3 = 1.0 / (float)((signed int)viewparams->uMinimapZoom * 0.000015258789);
-  v19 = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x);
-  v20 = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3);
+  global_coord_X = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x);
+  global_coord_Y = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3);
   if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || pOutdoor->uNumBModels <= 0 )
   {
     pMapID = pMapStats->GetMapInfo(pCurrentMapName);
@@ -709,8 +709,8 @@
   {
     for ( uint j = 0; j < (uint)pOutdoor->uNumBModels; ++j )
     {
-      v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - v19),
-                                 abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - v20), 0);
+      v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - global_coord_X),
+                                 abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - global_coord_Y), 0);
       if ( v7 < 2 * pOutdoor->pBModels[j].sBoundingRadius )
       {
         if ( pOutdoor->pBModels[j].uNumFaces )
--- a/Viewport.cpp	Wed Sep 25 08:13:09 2013 +0200
+++ b/Viewport.cpp	Wed Sep 25 12:22:38 2013 +0600
@@ -128,9 +128,9 @@
 //----- (00443249) --------------------------------------------------------
 void ViewingParams::CenterOnParty()
 {
-  this->field_2C = (32768 * (__int64)this->field_2C) >> 16;
-  if (this->field_2C < 384)
-    this->field_2C = 384;
+  this->uMapBookMapZoom = (32768 * (__int64)this->uMapBookMapZoom) >> 16;
+  if (this->uMapBookMapZoom < 384)
+    this->uMapBookMapZoom = 384;
 
   this->sViewCenterX = pParty->vPosition.x;
   this->sViewCenterY = pParty->vPosition.y;
@@ -149,9 +149,9 @@
       v2 = 3072;
     else assert(false);
     
-    this->field_2C *= 2;
-    if (this->field_2C > v2 )
-        this->field_2C = v2;
+    this->uMapBookMapZoom *= 2;
+    if (this->uMapBookMapZoom > v2 )
+        this->uMapBookMapZoom = v2;
 
     this->sViewCenterX = pParty->vPosition.x;
     this->sViewCenterY = pParty->vPosition.y;
@@ -172,7 +172,7 @@
 
     v1 = this;
     v2 = this->indoor_center_y;
-    v3 = 88 >> (this->field_2C / 384);
+    v3 = 88 >> (this->uMapBookMapZoom / 384);
     v4 = (44 - v3) << 9;
     if ( v1->sViewCenterY > v2 + v4 )
         v1->sViewCenterY = v2 + v4;
@@ -253,7 +253,7 @@
     uMinimapZoom = _576E2C_current_minimap_zoom;
     field_28 = dword_576E28;
   }
-  field_2C = 384;
+  uMapBookMapZoom = 384;
 }
 //----- (0042213C) --------------------------------------------------------
 void OnGameViewportClick()
--- a/Viewport.h	Wed Sep 25 08:13:09 2013 +0200
+++ b/Viewport.h	Wed Sep 25 12:22:38 2013 +0600
@@ -65,7 +65,7 @@
   int field_20;
   unsigned int uMinimapZoom;
   int field_28;
-  int field_2C;
+  unsigned int uMapBookMapZoom;
   int sViewCenterX;
   int sViewCenterY;
   __int16 indoor_center_x;
--- a/mm7_3.cpp	Wed Sep 25 08:13:09 2013 +0200
+++ b/mm7_3.cpp	Wed Sep 25 12:22:38 2013 +0600
@@ -6772,90 +6772,6 @@
     LoadLevel_InitializeLevelStr();
 }
 
-//----- (00444564) --------------------------------------------------------
-const char * sub_444564()
-{
-  double v0; // st7@3
-  int v1; // ebx@3
-  int v2; // edi@3
-  int v3; // eax@3
-  int v5; // edi@6
-  int v6; // eax@6
-  int v7; // eax@6
-  unsigned __int8 v9; // zf@7
-  unsigned __int8 v10; // sf@7
-  ODMFace *v11; // eax@9
-  __int16 v12; // cx@9
-  const char *v13; // eax@11
-  const char *v14; // edi@11
-  const char *result; // eax@15
-  unsigned int v16; // [sp+0h] [bp-20h]@3
-  const char *v17; // [sp+4h] [bp-1Ch]@3
-  unsigned int pY; // [sp+8h] [bp-18h]@3
-  float v19; // [sp+Ch] [bp-14h]@1
-  int v20;
-  int v21; // [sp+14h] [bp-Ch]@1
-  unsigned int v22; // [sp+18h] [bp-8h]@8
-  int pX; // [sp+1Ch] [bp-4h]@3
-
-  v20 = viewparams->sViewCenterX;
-  v21 = viewparams->sViewCenterY;
-  v19 = (double)viewparams->field_2C * 0.000015258789;
-  if ( viewparams->field_2C == 384 )
-  {
-    v20 = viewparams->indoor_center_x;
-    v21 = viewparams->indoor_center_y;
-  }
-  v17 = 0;
-  v16 = pOutdoor->uNumBModels;
-  pMouse->GetClickPos((unsigned int *)&pX, &pY);
-  v0 = 1.0 / v19;
-  v1 = (signed __int64)((double)(pX - 229) * v0 + (double)v20);
-  LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0);
-  v2 = abs(v1 + 22528) / 512;
-  v3 = abs((signed)LODWORD(v19) - 22528);
-  result = 0;
-  if ( pOutdoor->_47F04C(v2, v3 / 512)
-    && uCurrentlyLoadedLevelType == LEVEL_Outdoor
-    && (signed int)v16 > 0 )
-  {
-	for(int i = 0; i < pOutdoor->uNumBModels && !v17; i++)
-    {
-      pX = pOutdoor->pBModels[i].vBoundingCenter.x - v1;
-      pY = pOutdoor->pBModels[i].vBoundingCenter.y - LODWORD(v19);
-      v5 = abs((signed)pY);
-      v6 = abs((signed)pX);
-      v7 = int_get_vector_length(v6, v5, 0);
-      if ( v7 < pOutdoor->pBModels[i].sBoundingRadius )
-      {
-        if ( pOutdoor->pBModels[i].uNumFaces > 0 )
-        {
-		  for(int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++)
-          {
-			v11 = &pOutdoor->pBModels[i].pFaces[j];//&v8[v4]->pFaces[v22 / 0x134];
-            v12 = v11->sCogTriggeredID;
-            if ( v12 )
-            {
-              if ( !(v11->uAttributes & 0x100000) )
-              {
-                v13 = GetEventHintString(v12);
-                v14 = v13;
-                if ( v13 )
-                {
-                  if ( _stricmp(v13, "") )
-                    v17 = v14;
-                }
-              }
-            }
-          }
-        }
-        result = v17;
-      }
-    }
-  }
-  return result;
-}
-
 //----- (00444D80) --------------------------------------------------------
 int GetTravelTime()
 {
--- a/mm7_5.cpp	Wed Sep 25 08:13:09 2013 +0200
+++ b/mm7_5.cpp	Wed Sep 25 12:22:38 2013 +0600
@@ -4909,20 +4909,8 @@
 //----- (00416196) --------------------------------------------------------
 void OnInventoryItemRightClick()
 {
-  //Player *v0; // esi@2
-  //POINT *v1; // edi@2
-  //signed int v2; // ecx@5
-  //signed int v3; // eax@5
-  //int v4; // eax@5
-  //char v5; // sf@5
-  //int v6; // eax@5
   int v7; // eax@7
-  //unsigned __int16 v8; // ax@10
   int v9; // edi@10
-  //int v10; // eax@10
-  //int v11; // edx@13
-  //LONG v12; // edx@23
-  //signed int v13; // edx@23
   int v14; // edx@25
   unsigned int v15; // edi@25
   signed int v16; // edx@27
@@ -4937,29 +4925,13 @@
   int v25; // eax@80
   int v26; // eax@84
   ItemGen *v27; // esi@98
-  //unsigned int v28; // eax@98
-  //ItemGen *v29; // edi@98
-  //unsigned int v30; // ecx@103
   double v31; // st7@112
-  //unsigned __int64 v32; // qax@113
-  //unsigned int v33; // ecx@117
-  //int v34; // eax@126
-  //unsigned int v35; // ecx@127
   double v36; // st7@132
   signed __int64 v37; // qax@135
-  //unsigned int v38; // eax@138
   Vec3_int_ v39; // [sp-18h] [bp-A8h]@83
-  //int *v40; // [sp-Ch] [bp-9Ch]@83
-  //int *v41; // [sp-8h] [bp-98h]@83
-  //int *v42; // [sp-4h] [bp-94h]@83
   GUIWindow v43; // [sp+Ch] [bp-84h]@137
-  //unsigned int pY; // [sp+60h] [bp-30h]@2
   int v45; // [sp+64h] [bp-2Ch]@10
-  //unsigned int pX; // [sp+68h] [bp-28h]@2
-  //int v47; // [sp+6Ch] [bp-24h]@25
-  //POINT y; // [sp+70h] [bp-20h]@2
   POINT a2; // [sp+78h] [bp-18h]@2
-  //Vec3_int_ pOut; // [sp+80h] [bp-10h]@2
   unsigned int v51; // [sp+8Ch] [bp-4h]@23
 
   if (no_rightlick_in_inventory)
--- a/mm7_data.h	Wed Sep 25 08:13:09 2013 +0200
+++ b/mm7_data.h	Wed Sep 25 12:22:38 2013 +0600
@@ -1150,7 +1150,7 @@
 void OnMapLeave();
 void OnMapLoad();
 void Level_LoadEvtAndStr(const char *pLevelName);
-const char *sub_444564();
+const char *GetMapBookHintText();//sub_444564
 char *GetEventHintString(unsigned int uEventID); // idb
 int GetTravelTime();
 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4);