diff Render.cpp @ 1175:9e3bacdbec56

m
author Ritor1
date Mon, 03 Jun 2013 09:10:21 +0600
parents ad89d1905b48
children dac817fbf85a
line wrap: on
line diff
--- a/Render.cpp	Fri May 31 09:54:44 2013 +0600
+++ b/Render.cpp	Mon Jun 03 09:10:21 2013 +0600
@@ -904,7 +904,7 @@
   int v30; // ecx@64
   int v31; // ecx@68
   int v32; // eax@70
-  int v33; // ecx@71
+  //int v33; // ecx@71
   int v34; // eax@73
   int v35; // ecx@77
   int v36; // ecx@81
@@ -913,7 +913,7 @@
   int v39; // ecx@88
   int v40; // eax@90
   int v41; // edx@94
-  int v42; // ecx@95
+  //int v42; // ecx@95
   int v43; // ecx@98
   int v44; // ecx@102
   int v45; // eax@104
@@ -931,7 +931,7 @@
   int v57; // ecx@140
   int v58; // eax@142
   int v59; // ecx@146
-  int v60; // ecx@147
+  //int v60; // ecx@147
   int v61; // ecx@150
   int v62; // ecx@155
   int v63; // eax@157
@@ -946,7 +946,7 @@
   //int v72; // ecx@178
   //int x; // ebx@180
   //int v74; // eax@182
-  int v75; // eax@184
+  //int v75; // eax@184
   IndoorCameraD3D *pIndoorCameraD3D_3; // ecx@184
   int uStartZ; // ecx@184
   int v79; // ebx@185
@@ -992,11 +992,11 @@
   v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2
   pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY);//1536
   pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512
-  v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16;
-  v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16;
+  v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16;//88
+  v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16;// 66
   v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X
   v119 = pOutdoorCamera->outdoor_grid_band_3 + v123;
-  v2 = pOutdoorCamera->uCameraFovInDegrees + 15;
+  v2 = pOutdoorCamera->uCameraFovInDegrees + 15;//90
   i = v124 - pOutdoorCamera->outdoor_grid_band_3;
   v122 = v123 - pOutdoorCamera->outdoor_grid_band_3;
 
@@ -1005,42 +1005,50 @@
   v3 = (v2 << 11) / 720;
   v4 = stru_5C6E00->uDoublePiMask & (pDirectionIndicator1 - v3);
   v5 = stru_5C6E00->uDoublePiMask & (v3 + pDirectionIndicator1);
+
   v106 = stru_5C6E00->Cos(v4);
   uEndZ = stru_5C6E00->Sin(v4);
+
   v111 = stru_5C6E00->Cos(v5);
   v6 = stru_5C6E00->Sin(v5);
+
   v7 = v4 & stru_5C6E00->uPiMask;
-
   if ( (v4 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi )
     v8 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v7];
   else
     v8 = stru_5C6E00->pTanTable[v7];
   v112 = abs(v8);
+
   v9 = v5 & stru_5C6E00->uPiMask;
   if ( (v5 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi )
     v10 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v9];
   else
     v10 = stru_5C6E00->pTanTable[v9];
   v108 = abs(v10);
+
   //v11 = v124;
   //v12 = v123;
   v114 = 0;
   v115 = 0;
   pIndoorCameraD3D_4 = 0;
   v125 = 0;
-  v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1;
   v126 = v124;
   v118 = v123;
+
+  v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1;
   v109 = (uEndZ >= 0 ? 1: -1);//2 * (v107 >= 0) - 1;
   uEndZ = (v111 >= 0 ? 1: -1);//2 * (v111 >= 0) - 1;
-  terrain_76E1C8[0] = 65535;
+  v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1;
+
   uint _i = 1;
-  v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1;
   uint j = 1;
-  terrain_76E3C8[0] = 65535;
-  terrain_76DDC8[0] = 65535;
-  terrain_76DFC8[0] = 65535;
-  for( _i = 1; _i < 128; _i++)
+
+  terrain_76DDC8[0] = -1;
+  terrain_76DFC8[0] = -1;
+  terrain_76E1C8[0] = -1;
+  terrain_76E3C8[0] = -1;
+
+  for( uint _i = 1; _i < 128; _i++)
   {
     if ( v112 >= 0x10000 )
     {
@@ -1112,6 +1120,7 @@
   v126 = 0;
   v17 = j - 1;
   v18 = _i - 1;
+
   switch ( v105 )
   {
     case 0:
@@ -1223,13 +1232,8 @@
       {
         v106 = v122;
         memset32(terrain_76DBC8, v120 + 1, 4 * (terrain_76DDC8[v17] - v122 + 1));
-        v32 = v122;
-        do
-        {
-          v33 = v126++;
-          terrain_76D9C8[v33] = v32++;
-        }
-        while ( v32 <= terrain_76DDC8[v17] );
+        for ( v32 = v122; v32 <= terrain_76DDC8[v17]; v32++)
+          terrain_76D9C8[v126++] = v32;
         if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] )
         {
           do
@@ -1296,10 +1300,9 @@
       v41 = terrain_76E1C8[v18];
       while ( v41 <= v123 )
       {
-        v42 = terrain_76E3C8[v18];
         terrain_76D5C8[v16] = v41;
-        terrain_76D7C8[v16] = v42;
-        if ( v42 == 65535 )
+        terrain_76D7C8[v16] = terrain_76E3C8[v18];
+        if ( terrain_76E3C8[v18] == 65535 )
         {
           terrain_76D7C8[v16] = v124;
           break;
@@ -1326,10 +1329,8 @@
       {
         v106 = v119;
         memset32(terrain_76DBC8, i, 4 * (v119 - terrain_76DDC8[v17] + 1));
-        v45 = v119;
-        do
-          terrain_76D9C8[v126++] = v45--;
-        while ( v45 >= terrain_76DDC8[v17] );
+        for ( v45 = v119; v45 >= terrain_76DDC8[v17]; v45--)
+          terrain_76D9C8[v126++] = v45;
         if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] )
         {
           do
@@ -1450,9 +1451,9 @@
         if ( v59 > v124 )
           break;
         terrain_76DBC8[v16] = v59;
-        v60 = terrain_76DDC8[v17];
-        terrain_76D9C8[v16] = v60;
-        if ( v60 == 65535 )
+        //v60 = terrain_76DDC8[v17];
+        terrain_76D9C8[v16] = terrain_76DDC8[v17];
+        if ( terrain_76DDC8[v17] == 65535 )
         {
           terrain_76D9C8[v16] = v123;
           break;
@@ -1549,30 +1550,33 @@
       //v74 = terrain_76D7C8[i];
       if ( terrain_76D7C8[i] <= 0 )
         terrain_76D7C8[i] = -terrain_76D7C8[i];
-      v75 = terrain_76D7C8[i] + 2;
+      uEndZ = terrain_76D7C8[i] + 2;
       //pIndoorCameraD3D_3 = pGame->pIndoorCameraD3D;
-      uEndZ = v75;
+      //uEndZ = v75;
       //pIndoorCameraD3D_4 = pIndoorCameraD3D_3;
       uStartZ = terrain_76DBC8[i] - 2;
-      if ( terrain_76DBC8[i] - 2 < v75 )
+      if ( terrain_76DBC8[i] - 2 < uEndZ )
       {
         v127 = 0;
         //v79 = (v73 - 66) << 9;
         //v116 = v77;
         //pHeight = v79;
-        v111 = v75 - uStartZ;
+        v111 = uEndZ - uStartZ;
         for (int z = uStartZ; z < uEndZ; ++z)
         {
           ptr_801A08[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512;
           ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512;
           ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i]);
+
           ptr_801A04[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;
           ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512;
           ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i] + 1);
+
           if ( !byte_4D864C || !(pGame->uFlags & 0x80) )
           {
             pIndoorCameraD3D_4->ViewTransform(&ptr_801A08[v127], 1);
             pIndoorCameraD3D_4->ViewTransform(&ptr_801A04[v127], 1);
+
             pIndoorCameraD3D_4->Project(&ptr_801A08[v127], 1, 0);
             pIndoorCameraD3D_4->Project(&ptr_801A04[v127], 1, 0);
           }
@@ -1586,7 +1590,8 @@
       v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]);
       v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]);
       if ( pRenderer->pRenderD3D )//Ritor1: do comment to test
-        Render::DrawTerrainD3D(v111, 0, v103, v104);//Render::RenderTerrainD3D();
+        Render::DrawTerrainD3D(v111, 0, v103, v104);
+        //Render::RenderTerrainD3D();
       else
         Render::DrawTerrainSW(v111, 0, v103, v104);
     }
@@ -1622,18 +1627,12 @@
         //do
         for ( v116 = terrain_76D9C8[i] - 2; v116 < v107; ++v116 )
         {
-          //v93 = v116;
-          //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 64) << 9;
           ptr_801A08[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 64) << 9;
-          //*(float *)&pHeight = (double)pHeight;
           ptr_801A08[v86].vWorldPosition.y = v92;
-          //v106 = ;
-          //v97 = v116;
           ptr_801A08[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86], v116);
-          //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 63) << 9;
+
           ptr_801A04[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 63) << 9;
           ptr_801A04[v86].vWorldPosition.y = v92;
-          //pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97);
           ptr_801A04[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86] + 1, v116);
           if ( !byte_4D864C || !(pGame->uFlags & 0x80) )
           {
@@ -1982,7 +1981,7 @@
   v90 = (float)pOutdoor->vSunlight.x / 65536.0;
   v91 = (float)pOutdoor->vSunlight.y / 65536.0;
   v92 = (float)pOutdoor->vSunlight.z / 65536.0;
-  if ( a1 - 1 > 0 )
+/*  if ( a1 - 1 > 0 )
   {
     while ( 1 )
     {
@@ -2012,11 +2011,11 @@
                !byte_4D864C)
            || !(pGame->uFlags & 0x80))
           && !sub_481EFA(v8, v9, v101, pVertices, 1)) )*/
-      if ( !&stru_76E5C8[(v5 << 7) + v6] )
-        goto LABEL_162;
+      /*if ( !&stru_76E5C8[(v5 << 7) + v6] )
+        goto LABEL_162*/
       v8 = &pVerticesSR_806210[v4];
-      pVertices2 = &pVerticesSR_801A10[v4 + 1];
-      v102 = v8;
+      //pVertices2 = &pVerticesSR_801A10[v4 + 1];
+      //v102 = v8;
       if (!v82)
       {
         pVertices = &pVerticesSR_801A10[v4];
@@ -2031,12 +2030,12 @@
       sY = floorf(v8->vWorldPosition.z + 0.5f);
       v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f));
       v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f));
-      WorldPosToGridCellX(sX);
+      /*WorldPosToGridCellX(sX);
       WorldPosToGridCellZ(sY);
       if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !sub_481EFA(v8, pVertices, v101, pVertices2, 1))
         if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y 
              || pVertices2->vWorldPosition.y != v101->vWorldPosition.y )
-          break;
+          break;*/
         v16 = &array_77EC08[pOutdoorCamera->numStru148s];
         v16->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
         if ( v16->uTileBitmapID != -1 )
@@ -2174,7 +2173,7 @@
         if ( ++v88 >= v84 )
           return;
       }
-      v40 = &array_77EC08[pOutdoorCamera->numStru148s];
+    /*  v40 = &array_77EC08[pOutdoorCamera->numStru148s];
       v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY);
       if ( v40->uTileBitmapID == -1 )
         goto LABEL_162;
@@ -2211,7 +2210,7 @@
           --pOutdoorCamera->numStru148s;
           goto LABEL_112;
         }*/
-      memcpy(&array_50AC10[0], v102, 0x30u);
+      /*memcpy(&array_50AC10[0], v102, 0x30u);
       array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
       array_50AC10[0].u = 0.0;
       array_50AC10[0].v = 0.0;
@@ -2236,7 +2235,7 @@
         stru148(stru_76D590);
         atexit(loc_48118F);
       }*/
-      v96 = pGame->pLightmapBuilder;
+      /*v96 = pGame->pLightmapBuilder;
       pGame->pLightmapBuilder->StackLights_TerrainFace(v48, (float *)&a4, array_50AC10, 3, 0);
       pDecalBuilder->_49BE8A(v40, v48, &a4, array_50AC10, 3, 0);
       uNumVertices = 3;
@@ -2359,7 +2358,7 @@
         __init_flag1 = true;
         stru154::stru154(&static_sub_0048034E_stru_76D578);
       }*/
-      v96 = pGame->pLightmapBuilder;
+     /* v96 = pGame->pLightmapBuilder;
       pGame->pLightmapBuilder->StackLights_TerrainFace(v63, &v87, array_50AC10, 3, 1);
       pDecalBuilder->_49BE8A(v40, v63, &v87, array_50AC10, 3, 1);
       v100 = 3;
@@ -2439,7 +2438,7 @@
       OutdoorCamera::Project(v73);
       goto LABEL_154;
     }
-  }
+  }*/
 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int);
 // 4D864C: using guessed type char byte_4D864C;