diff mm7_4.cpp @ 1282:8a196c858180

Слияние
author Ritor1
date Sat, 15 Jun 2013 09:55:27 +0600
parents 21a46b38ca24 33e360a9b4bf
children 2767980b98bb
line wrap: on
line diff
--- a/mm7_4.cpp	Sat Jun 15 09:55:07 2013 +0600
+++ b/mm7_4.cpp	Sat Jun 15 09:55:27 2013 +0600
@@ -4,6 +4,8 @@
 
 #include <assert.h>
 
+#include "Texture.h"
+#include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "Sprites.h"
 #include "BSPModel.h"
@@ -43,7 +45,7 @@
 #include "texts.h"
 #include "Log.h"
 #include "UIHouses.h"
-#include "mm7_data.h"
+#include "Lights.h"
 
 //----- (0046CC4B) --------------------------------------------------------
 void __cdecl check_event_triggers()
@@ -473,30 +475,25 @@
   dword_721160[0] = -1;
   dword_721110[0] = -1;
   odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk);
-  if ( (signed int)pOutdoor->uNumBModels <= 0 )
-  {
-    *a6 = 0;
-    return odm_floor_level[0];
-  }
-  v38 = 0;
-  for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum )
-  {
-    pBModel = &pOutdoor->pBModels[v38];
-    if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY )
-    {
-      if ( (signed int)pBModel->uNumFaces > 0 )
+  
+  for ( pBModelNum = 0; pBModelNum < pOutdoor->uNumBModels; ++pBModelNum )
+  {
+    pBModel = &pOutdoor->pBModels[pBModelNum];
+    if ( X <= pBModel->sMaxX && X >= pBModel->sMinX &&
+         Y <= pBModel->sMaxY && Y >= pBModel->sMinY )
+    {
+      if ( pBModel->uNumFaces > 0 )
       {
         v39 = 0;
         for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum )
         {
-          pFace = &pBModel->pFaces[v39];
+          pFace = &pBModel->pFaces[pFaceNum];
           if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall)
             && !(pFace->uAttributes & 0x20000000)
             && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1
             && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 )
           {
-            if ( pFace->uNumVertices )
-            {
+            
               for ( uint i = 0; i < pFace->uNumVertices; ++i)
               {
                 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x;
@@ -504,7 +501,6 @@
                 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x;
                 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y;
               }
-            }
             word_721040[2 * pFace->uNumVertices] = word_721040[0];
             word_720F70[2 * pFace->uNumVertices] = word_720F70[0];
             v43 = word_720F70[0] >= Y;
@@ -553,11 +549,10 @@
               }
             }
           }
-          ++v39;
+
         }
       }
     }
-    ++v38;
   }
   if ( v46 == 1 )
   {
@@ -852,10 +847,10 @@
     side1_dy = (double)(x1z1_y - x1z2_y);
     side2_dy = (double)(x2z2_y - x1z2_y);
     side2_dx = (double)(grid_pos_x2 - grid_pos_x1);
-    side1_dx = (double)(grid_pos_x1 - grid_pos_x1);
-    side2_dz = (double)(grid_pos_z2 - grid_pos_z2);  // bug?  z2 - z2
-    side1_dz = (double)(grid_pos_z2 - grid_pos_z2);  //       z1 - z2
-    Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__);
+    side1_dx = (double)(grid_pos_x1 - grid_pos_x2);
+    side2_dz = 0.0;//(double)(grid_pos_z2 - grid_pos_z2);  // bug?  z2 - z2 
+    side1_dz = (double)(grid_pos_z1 - grid_pos_z2);  //       z1 - z2 yes
+    //Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__);
     /*       |\
        side1 |  \
              |____\
@@ -866,8 +861,8 @@
     side1_dy = (double)(x2z2_y - x2z1_y);
     side2_dy = (double)(x1z1_y - x2z1_y);
     side2_dx = (double)(grid_pos_x1 - grid_pos_x2);
-    side1_dx = (double)(grid_pos_x2 - grid_pos_x2);
-    side2_dz = (double)(grid_pos_z1 - grid_pos_z1);
+    side1_dx = (double)(grid_pos_x2 - grid_pos_x1);
+    side2_dz = 0.0;//(double)(grid_pos_z1 - grid_pos_z1); 
     side1_dz = (double)(grid_pos_z2 - grid_pos_z1);
 
     /*   side 2