diff UI/Books/UIMapBook.cpp @ 1446:8b4f4c723edd

Questbook_Draw
author Ritor1
date Mon, 05 Aug 2013 22:31:12 +0600
parents 6de9c1316852
children dfc9484ed94c
line wrap: on
line diff
--- a/UI/Books/UIMapBook.cpp	Sat Aug 03 00:00:31 2013 +0600
+++ b/UI/Books/UIMapBook.cpp	Mon Aug 05 22:31:12 2013 +0600
@@ -36,25 +36,20 @@
 //----- (00411150) --------------------------------------------------------
 void BookUI_DrawTownPortalMap()
 {
-  //signed int v0; // edi@1
-  //__int16 v1; // dx@8
-  //POINT *v2; // edi@17
   int v3; // edi@17
-  //__int16 v4; // dx@24
-  GUIWindow v6; // [sp+Ch] [bp-64h]@1
-  //POINT v7; // [sp+60h] [bp-10h]@17
+  GUIWindow TownPortalWindow; // [sp+Ch] [bp-64h]@1
   POINT a2; // [sp+68h] [bp-8h]@17
 
   pRenderer->ClearZBuffer(0, 479);
   pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook);
   pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
 
-  v6.uFrameX = game_viewport_x;
-  v6.uFrameY = game_viewport_y;
-  v6.uFrameWidth = game_viewport_width;
-  v6.uFrameHeight = game_viewport_height;
-  v6.uFrameZ = game_viewport_z;
-  v6.uFrameW = game_viewport_w;
+  TownPortalWindow.uFrameX = game_viewport_x;
+  TownPortalWindow.uFrameY = game_viewport_y;
+  TownPortalWindow.uFrameWidth = game_viewport_width;
+  TownPortalWindow.uFrameHeight = game_viewport_height;
+  TownPortalWindow.uFrameZ = game_viewport_z;
+  TownPortalWindow.uFrameW = game_viewport_w;
 
   const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE,
                                     PARTY_QUEST_FOUNTAIN_PIERPONT,
@@ -79,7 +74,7 @@
     if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1]))
       pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]);
   }
-  v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);
+  TownPortalWindow.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3);
 }
 
 //----- (00410DEC) --------------------------------------------------------
@@ -87,28 +82,15 @@
 {
   Player *pPlayer; // esi@1
   char *pText; // eax@1
-  //unsigned __int16 v2; // ax@6
-  //unsigned int result; // eax@11
-  //unsigned int v4; // esi@13
-  //unsigned int v5; // ecx@13
-  //char v6; // zf@13
-  //LloydBeacon *v7; // esi@14
   int pTextHeight; // eax@14
   int RemainingTime; // kr08_8@14
   unsigned int pHours; // esi@14
   unsigned int pDays; // eax@14
   char *pSelectionText; // eax@19
-  //char *v13; // ecx@22
-  //int v14; // eax@27
   Texture *v19; // [sp-4h] [bp-8Ch]@4
   GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1
-  //unsigned int v23; // [sp+64h] [bp-24h]@14
-  //__int64 v24; // [sp+68h] [bp-20h]@14
-  //unsigned int v25; // [sp+70h] [bp-18h]@13
   char *Str; // [sp+74h] [bp-14h]@14
   int BeaconID; // [sp+78h] [bp-10h]@11
-  //LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12
-  //RGBTexture *v29; // [sp+80h] [bp-8h]@12
   int uNumMaxBeacons; // [sp+84h] [bp-4h]@6
 
   pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid];
@@ -123,7 +105,7 @@
   if ( !bRecallingBeacon )
     pText = pGlobalTXT_LocalizationStrings[375];   // Set Beacon
   sprintf(pTmpBuf.data(), "%s", pText);
-  pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf.data(), 3);
+  pWindow.DrawTitleText(pBook2Font, 0, 22, 0, pTmpBuf.data(), 3);
   if ( bRecallingBeacon )
   {
     pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on);
@@ -335,10 +317,6 @@
 //----- (00442955) --------------------------------------------------------
 void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 )
 {
-  //unsigned int v11; // edx@11
-  //__int16 v12; // cx@12
-  //signed int v13; // eax@15
-  //int v14; // eax@16
   int v20; // eax@16
   signed int v21; // esi@18
   int v22; // ecx@21
@@ -372,7 +350,6 @@
   signed int v50; // edx@55
   unsigned int v51; // ecx@55
   int result; // eax@72
-  int v53; // eax@75
   int v54; // esi@75
   int v55; // eax@75
   __int16 v56; // si@85
@@ -415,7 +392,6 @@
   unsigned int v88; // [sp+4803Ch] [bp-28h]@16
   int black; // [sp+48040h] [bp-24h]@8
   int screenCenterY; // [sp+48044h] [bp-20h]@1
-  unsigned int i; // [sp+48048h] [bp-1Ch]@9
   unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16
   unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16
   signed int screenWidth; // [sp+48054h] [bp-10h]@8
@@ -620,134 +596,112 @@
     pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50]));
   }
   result = TargetColor(0xFFu, 0xFFu, 0xFFu);
-  v95 = 0;
   pCenterX = result;
   if ( (signed int)uNumLevelDecorations > 0 )
   {
-    screenWidth = (unsigned int)&pLevelDecorations[0].vPosition;
-    do
+    for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )
     {
-      if ( *(char *)(screenWidth - 2) & 8 )
+      if ( pLevelDecorations[i].field_2 & 8 )
       {
-        v53 = *(int *)(screenWidth + 4) - pCenterY;
-        v93 = (unsigned __int16 *)(*(int *)screenWidth - viewparams->sViewCenterX);
-              screenHeight = v53;
-              v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X;
-              v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)viewparams->field_2C) >> 16);
-              v55 = screenCenterY - (int)v97;
-              if ( v54 >= pRenderer->raster_clip_x )
-              {
-                if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
-                {
-                  if ( viewparams->field_2C > 512 )
-                  {
-                    v96 = v55 + 1;
-                    black = v55 - 1;
-                    pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, pCenterX);
-                    pRenderer->RasterLine2D(v54, black, v54, v96, pCenterX);
-                    ++v54;
-                    v72 = v96;
-                    v71 = v54;
-                    v70 = black;
-                  }
-                  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);
-                }
-              }
+        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);
+        v55 = screenCenterY - (int)v97;
+        if ( v54 >= pRenderer->raster_clip_x )
+        {
+          if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
+          {
+            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;
             }
-            ++v95;
-            result = v95;
-            screenWidth += 32;
-            }
-            while ( (signed int)v95 < (signed int)uNumLevelDecorations );
-        }
-    if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-        {
-        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);
-        pPalette_16 = (unsigned __int16 *)(v60 >> 16);
-        v62 = (int)v61 << 16;
-        teal = v60 >> 16;
-        v63 = (signed __int16)v61;
-        a4a = map_texture_16;
-        result = TargetColor(0xCu, 0xCu, 0xCu);
-        screenCenter_X = 0;
-        for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X )
+            else
             {
-            a5a = 0;
-            if ( screenCenterY > 0 )
-                {
-                v96 = (v63 - 80) / 4;
-                v64 = teal;
-                do
-                    {
-                    v81 = (v64 - 80) / 4;
-                    if ( !pOutdoor->_47F04C(v81, v96) )
-                        {
-                        if ( pOutdoor->_47F097(v81, v96) )
-                            {
-                            if ( !((a5a + screenCenter_X) % 2) )
-                                *a4a = i;
-                            }
-                        else
-                            {
-                            *a4a = 0;
-                            }
-                        }
-                    ++a4a;
-                    v97 = (char *)v97 + black;
-                    v64 = (signed int)v97 >> 16;
-                    ++a5a;
-                    }
-                    while ( a5a < screenCenterY );
-                }
-            v62 += black;
-            v97 = (const void *)v60;
-            a4a += screenCenterY - a5a;
-            v63 = v62 >> 16;
-            ++screenCenter_X;
-            teal = (unsigned int)pPalette_16;
+              v72 = screenCenterY - (int)v97;
+              v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X;
+              v70 = screenCenterY - (int)v97;
             }
-        v65 = v95;
-        v66 = map_texture_16;
-        if ( (signed int)v95 > 0 )
+            pRenderer->RasterLine2D(v54, v70, v71, v72, pCenterX);
+          }
+        }
+      }
+    }
+  }
+  if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+  {
+    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);
+    pPalette_16 = (unsigned __int16 *)(v60 >> 16);
+    v62 = (int)v61 << 16;
+    teal = v60 >> 16;
+    v63 = (signed __int16)v61;
+    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;
+        v64 = teal;
+        for ( a5a = 0; a5a < screenCenterY; ++a5a )
+        {
+          v81 = (v64 - 80) / 4;
+          if ( !pOutdoor->_47F04C(v81, v96) )
+          {
+            if ( pOutdoor->_47F097(v81, v96) )
             {
-            v67 = v77;
-            result = 2 * (pRenderer->uTargetSurfacePitch - screenCenterY);
-            do
-                {
-                if ( screenCenterY > 0 )
-                    {
-                    v68 = screenCenterY;
-                    do
-                        {
-                        v69 = *(short *)v66;
-                        if ( !*(short *)v66 || v69 == (short)i )
-                            *v67 = v69;
-                        ++v66;
-                        ++v67;
-                        --v68;
-                        }
-                        while ( v68 );
-                    }
-                v67 = (unsigned __int16 *)((char *)v67 + result);
-                --v65;
-                }
-                while ( v65 );
+              if ( !((a5a + screenCenter_X) % 2) )
+                *a4a = result;
             }
+            else
+              *a4a = 0;
+          }
+          ++a4a;
+          v97 = (char *)v97 + black;
+          v64 = (signed int)v97 >> 16;
         }
+      }
+      v62 += black;
+      v97 = (const void *)v60;
+      a4a += screenCenterY - a5a;
+      v63 = v62 >> 16;
+      teal = (unsigned int)pPalette_16;
     }
+    v66 = map_texture_16;
+    if ( (signed int)v95 > 0 )
+    {
+      v67 = v77;
+      result = 2 * (pRenderer->uTargetSurfacePitch - screenCenterY);
+      for ( v65 = v95; v65; --v65 )
+      {
+        if ( screenCenterY > 0 )
+        {
+          for ( v68 = screenCenterY; v68; --v68 )
+          {
+            v69 = *(short *)v66;
+            if ( !*(short *)v66 || v69 == (short)result )
+              *v67 = v69;
+            ++v66;
+            ++v67;
+          }
+        }
+        v67 = (unsigned __int16 *)((char *)v67 + result);
+      }
+    }
+  }
+}