diff UI/Books/UIMapBook.cpp @ 2069:259df09dfb50

32bits almost there
author Nomad
date Tue, 03 Dec 2013 20:18:17 +0200
parents 7a9477135943
children a869b0376b48
line wrap: on
line diff
--- a/UI/Books/UIMapBook.cpp	Mon Dec 02 15:13:49 2013 +0200
+++ b/UI/Books/UIMapBook.cpp	Tue Dec 03 20:18:17 2013 +0200
@@ -311,12 +311,12 @@
   unsigned __int16 v69; // cx@99
   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
+  //unsigned short map_texture_16[320 * 460 + 256]; // [sp+Ch] [bp-48058h]@23
   int v76; // [sp+4800Ch] [bp-58h]@23
-  unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27
+  //unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27
   unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23
   int map_tile_X; // [sp+48020h] [bp-44h]@23
-  unsigned __int16* render16_data;
+  //unsigned __int16* render16_data;
   unsigned char* texture8_data;
   unsigned char* curr_line;
   int scale_increment;
@@ -339,7 +339,7 @@
   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
+  //int a5a; // [sp+48070h] [bp+Ch]@86
 
   screenCenter_X = (signed int)(tl_x + br_x) / 2;
   screenCenterY = (signed int)(tl_y + br_y) / 2;
@@ -366,7 +366,7 @@
   {
     screenWidth = br_x - tl_x + 1;
     screenHeight = br_y - tl_y + 1;
-    render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
+    //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->uMapBookMapZoom;
@@ -390,24 +390,26 @@
         for( uint j = 0; j < screenWidth; ++j )
         {
           scaled_posX=stepX_r>>16;
-          map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)];
+          //map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)];
+          pRenderer->WritePixel16(tl_x + j, tl_y + i, pPalette_16[*(curr_line+scaled_posX)]);
           stepX_r+=scale_increment;      
         }
         stepY_r+=scale_increment;
         scaled_posY=stepY_r>>16;
       }
     }
-    //move visible square to render
+
+    /*//move visible square to render
     for( uint i = 0; i < screenHeight; ++i )
     {
       if ( screenWidth > 0 )
         memcpy((void*)&render16_data[pRenderer->uTargetSurfacePitch * i],(void*)&map_texture_16[i*screenWidth], screenWidth*2);
-    }
+    }*/
   }
   else
   {
-    black = TargetColor(0, 0, 0);
-    teal = TargetColor(0, 0xFFu, 0xFFu);
+    black = Color16(0, 0, 0);
+    teal = Color16(0, 0xFFu, 0xFFu);
     uNumBlueFacesInBLVMinimap = 0;
     if ( pIndoor->pMapOutlines->uNumOutlines )
     {
@@ -535,14 +537,14 @@
         {
           if ( viewparams->uMapBookMapZoom > 512 )
           {
-            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));
+            pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
+            pRenderer->RasterLine2D(v54,     v55 - 1, v54,     v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu));
+            pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, Color16(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));
+                   screenCenterY - (int)v97, Color16(0xFFu, 0xFFu, 0xFFu));
         }
       }
     }
@@ -551,7 +553,7 @@
   {
     screenCenterY = br_x - tl_x + 1;
     v95 = br_y - tl_y + 1;
-    v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
+    //v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
     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;
@@ -560,7 +562,37 @@
     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;
+
+
+    for (int y = 0; y < (signed int)v95; ++y)
+    {
+        map_tile_Y = (v63 - 80) / 4;
+        v64 = teal;
+        for (int x = 0; x < screenCenterY; ++x)
+        {
+          map_tile_X = (v64 - 80) / 4;
+          if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) )
+          {
+            if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) )
+            {
+              if ( !((x + screenCenter_X) % 2) )
+                //*a4a = Color16(12, 12, 12);
+                  pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(12, 12, 12));
+            }
+            else
+              //*a4a = 0;
+                  pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(0, 0, 0));
+          }
+          v97 = (char *)v97 + black;
+          v64 = (signed int)v97 >> 16;
+        }
+
+      v62 += black;
+      v97 = (const void *)v60;
+      v63 = v62 >> 16;
+      teal = (unsigned int)pPalette_16;
+    }
+    /*a4a = map_texture_16;
     for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X )
     {
       if ( screenCenterY > 0 )
@@ -575,7 +607,7 @@
             if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) )
             {
               if ( !((a5a + screenCenter_X) % 2) )
-                *a4a = TargetColor(0xCu, 0xCu, 0xCu);
+                *a4a = Color16(0xCu, 0xCu, 0xCu);
             }
             else
               *a4a = 0;
@@ -591,6 +623,7 @@
       v63 = v62 >> 16;
       teal = (unsigned int)pPalette_16;
     }
+
     v66 = map_texture_16;
     if ( (signed int)v95 > 0 )
     {
@@ -611,7 +644,7 @@
         }
         v67 = (unsigned __int16 *)((char *)v67 + result);
       }
-    }
+    }*/
   }
 }