changeset 1722:e1c451f4d5ba

m
author Ritor1
date Wed, 25 Sep 2013 11:12:49 +0600
parents 1c072d19e397
children 29924bbb2a4e
files UI/Books/UIMapBook.cpp UI/UiGame.cpp mm7_3.cpp
diffstat 3 files changed, 104 insertions(+), 139 deletions(-) [+]
line wrap: on
line diff
--- a/UI/Books/UIMapBook.cpp	Wed Sep 25 09:03:56 2013 +0600
+++ b/UI/Books/UIMapBook.cpp	Wed Sep 25 11:12:49 2013 +0600
@@ -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
@@ -445,49 +437,38 @@
             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->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->uMapBookMapZoom) >> 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->uMapBookMapZoom;
-        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;
+        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);
-        ++v21;
-        if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap )
-          break;
+          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->uMapBookMapZoom) >> 16) + screenCenter_X - 3;
-  v81 = pParty->vPosition.y - pCenterY;
+  //v81 = pParty->vPosition.y - pCenterY;
   v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - pCenterY) * (signed __int64)viewparams->uMapBookMapZoom) >> 16);
   v48 = 1;
   v49 = screenCenterY - (int)v97 - 3;
@@ -542,8 +523,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 )
@@ -555,27 +534,19 @@
         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->uMapBookMapZoom > 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->uMapBookMapZoom) >> 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 +556,34 @@
     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->uMapBookMapZoom;
-    v57 = (double)(1 << (16 - v56));
-    v58 = 22528 / (viewparams->uMapBookMapZoom / 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);
+    //v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2;
+    black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
+    v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
+    //v58 = 22528 / (viewparams->uMapBookMapZoom / 384);
+    //v59 = (signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57);
+    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);
+    //v61 = (signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57);
+    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 +622,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/UiGame.cpp	Wed Sep 25 09:03:56 2013 +0600
+++ b/UI/UiGame.cpp	Wed Sep 25 11:12:49 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/mm7_3.cpp	Wed Sep 25 09:03:56 2013 +0600
+++ b/mm7_3.cpp	Wed Sep 25 11:12:49 2013 +0600
@@ -6772,71 +6772,6 @@
     LoadLevel_InitializeLevelStr();
 }
 
-//----- (00444564) --------------------------------------------------------
-const char * GetMapBookHintText()
-{
-  double v0; // st7@3
-  int global_coord_X; // ebx@3
-  int map_tile_X; // edi@3
-  int map_tile_Y; // eax@3
-  unsigned __int8 v9; // zf@7
-  unsigned __int8 v10; // sf@7
-  const char *result; // eax@15
-  float v19; // [sp+Ch] [bp-14h]@1
-  int v20;
-  int v21; // [sp+14h] [bp-Ch]@1
-  unsigned int v22; // [sp+18h] [bp-8h]@8
-  unsigned int pX; // [sp+1Ch] [bp-4h]@3
-  unsigned int pY; // [sp+8h] [bp-18h]@3
-  int global_coord_Y;
-
-  v20 = viewparams->sViewCenterX;
-  v21 = viewparams->sViewCenterY;
-  v19 = (double)viewparams->uMapBookMapZoom * 0.000015258789;
-  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;
-}
-
 //----- (00444D80) --------------------------------------------------------
 int GetTravelTime()
 {