diff DecalBuilder.cpp @ 2275:8193a64c7461

Слияние
author Ritor1
date Fri, 14 Mar 2014 09:32:42 +0600
parents 47b87aea14ba
children 8e9be4fa33a8
line wrap: on
line diff
--- a/DecalBuilder.cpp	Fri Mar 14 09:32:25 2014 +0600
+++ b/DecalBuilder.cpp	Fri Mar 14 09:32:42 2014 +0600
@@ -32,16 +32,10 @@
       result = 0.0;
   }
   else
-  {
     result = 1.0;
-  }
   return result;
 }
 
-
-
-
-
 //----- (0043B6EF) --------------------------------------------------------
 void BloodsplatContainer::AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b)
 {
@@ -53,7 +47,7 @@
   if ( this->uNumBloodsplats == 64 )
     v8 = 0;
   v9 = 5 * (v8 + 1);
-  v10 = &this->std__vector_pBloodsplats[8 * v9 / 0x28u];
+  v10 = &this->std__vector_pBloodsplats[8 * v9 / 40];
   v10->x = x;
   v10->y = y;
   v10->z = z;
@@ -469,12 +463,12 @@
 char DecalBuilder::ApplyDecals_OutdoorFace(ODMFace *pFace)
 {
 	double v8; // st7@12
-	unsigned int v10; // [sp+20h] [bp-1Ch]@1
+	//unsigned int v10; // [sp+20h] [bp-1Ch]@1
 
 	Bloodsplat *pBloodsplat;
 
 	this->uNumDecals = 0;
-	v10 = pBloodsplatContainer->std__vector_pBloodsplats_size;
+	//v10 = pBloodsplatContainer->std__vector_pBloodsplats_size;
 	if ( !pFace->Indoor_sky() && !pFace->Fluid() )
 	{
 		for(int i = 0; i < pBloodsplatContainer->std__vector_pBloodsplats_size; i++ )
@@ -506,28 +500,28 @@
 bool DecalBuilder::_49BE8A(struct Polygon *a2, Vec3_float_ *_a3, float *a4, RenderVertexSoft *a5, unsigned int uStripType, char a7)
 {
   bool result; // eax@1
-  RenderVertexSoft *v8; // edi@3
-  Vec3_float_ *v9; // ebx@3
-  Bloodsplat *v10; // esi@3
-  float v11; // eax@5
+  //RenderVertexSoft *v8; // edi@3
+  //Vec3_float_ *v9; // ebx@3
+  //Bloodsplat *v10; // esi@3
+  //float v11; // eax@5
   float v12; // eax@6
-  double v13; // st7@13
+  //double v13; // st7@13
   double v14; // st7@19
-  short v15; // eax@20
+  //short v15; // eax@20
   int v16; // eax@22
-  int v17; // edx@24
-  DecalBuilder *v18; // eax@24
+  //int v17; // edx@24
+  //DecalBuilder *v18; // eax@24
   std::string v19; // [sp-18h] [bp-54h]@12
   const char *v20; // [sp-8h] [bp-44h]@12
-  int v21; // [sp-4h] [bp-40h]@12
+  //int v21; // [sp-4h] [bp-40h]@12
   double v22; // [sp+Ch] [bp-30h]@19
   unsigned int v23; // [sp+14h] [bp-28h]@1
-  DecalBuilder *v24; // [sp+18h] [bp-24h]@1
-  int v25; // [sp+1Ch] [bp-20h]@19
+  //DecalBuilder *v24; // [sp+18h] [bp-24h]@1
+  //int v25; // [sp+1Ch] [bp-20h]@19
   float v26; // [sp+20h] [bp-1Ch]@12
   int v27; // [sp+24h] [bp-18h]@12
   float v28; // [sp+28h] [bp-14h]@13
-  float v29; // [sp+2Ch] [bp-10h]@7
+  //float v29; // [sp+2Ch] [bp-10h]@7
   float v30; // [sp+30h] [bp-Ch]@6
   float v31; // [sp+34h] [bp-8h]@6
   bool v32; // [sp+38h] [bp-4h]@2
@@ -535,92 +529,91 @@
 
   this->uNumDecals = 0;
   result = pBloodsplatContainer->std__vector_pBloodsplats_size != 0;
-  v24 = this;
+ // v24 = this;
   v23 = pBloodsplatContainer->std__vector_pBloodsplats_size;
   if ( pBloodsplatContainer->std__vector_pBloodsplats_size )
   {
-    v32 = 0;
+    
     if ( (signed int)pBloodsplatContainer->std__vector_pBloodsplats_size > 0 )
     {
-      v8 = a5;
-      v9 = _a3;
-	  v10 = pBloodsplatContainer->std__vector_pBloodsplats;
-      while ( v32 < (signed int)v23)
+      //v8 = a5;
+      //v9 = _a3;
+	  for ( v32 = 0; v32 < (signed int)v23; ++v32 )
       {
-		if ( uStripType == 4 )
-		{
-		  a3 = v8->vWorldPosition.x;
-		  v11 = v8[3].vWorldPosition.x;
-		  v31 = v11;
-		  v30 = v8[1].vWorldPosition.y;
-		  v12 = v8->vWorldPosition.y;
-		  v29 = v12;
-		}
-		else if ( uStripType == 3 )
+        if ( uStripType == 4 )
+        {
+          a3 = a5->vWorldPosition.x;
+          //v11 = v8[3].vWorldPosition.x;
+          v31 = a5[3].vWorldPosition.x;
+          v30 = a5[1].vWorldPosition.y;
+          v12 = a5->vWorldPosition.y;
+          //v29 = v12;
+        }
+        else if ( uStripType == 3 )
         {
           if ( a7 )
           {
-            a3 = v8->vWorldPosition.x;
-            v31 = v8[2].vWorldPosition.x;
-            v30 = v8[1].vWorldPosition.y;
-            v12 = v8[2].vWorldPosition.y;
-            v29 = v12;
+            a3 = a5->vWorldPosition.x;
+            v31 = a5[2].vWorldPosition.x;
+            v30 = a5[1].vWorldPosition.y;
+            v12 = a5[2].vWorldPosition.y;
+            //v29 = v12;
           }
 		  else
 		  {
-			  a3 = v8[1].vWorldPosition.x;
-			  v11 = v8[2].vWorldPosition.x;
-			  v31 = v11;
-			  v30 = v8[1].vWorldPosition.y;
-			  v12 = v8->vWorldPosition.y;
-			  v29 = v12;
+			  a3 = a5[1].vWorldPosition.x;
+			  //v11 = v8[2].vWorldPosition.x;
+			  v31 = a5[2].vWorldPosition.x;
+			  v30 = a5[1].vWorldPosition.y;
+			  v12 = a5->vWorldPosition.y;
+			  //v29 = v12;
 		  }
         }
 		else
 			MessageBoxW(nullptr, L"Uknown strip type detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:434", 0);
-        v21 = uStripType;
-        v13 = pGame->pIndoorCameraD3D->GetPolygonMinZ(v8, uStripType);
-        v21 = uStripType;
-        v28 = v13;
-        v26 = pGame->pIndoorCameraD3D->GetPolygonMaxZ(v8, uStripType);
-		if ( a3 - v10->radius < v10->x &&
-			v31 + v10->radius > v10->x &&
-			v30 - v10->radius < v10->y &&
-            v29 + v10->radius > v10->y &&
-            v28 - v10->radius < v10->z &&
-            v26 + v10->radius > v10->z )
+        //v21 = uStripType;
+        //v13 = pGame->pIndoorCameraD3D->GetPolygonMinZ(v8, uStripType);
+        //v21 = uStripType;
+        v28 = pGame->pIndoorCameraD3D->GetPolygonMinZ(a5, uStripType);
+        v26 = pGame->pIndoorCameraD3D->GetPolygonMaxZ(a5, uStripType);
+		if ( a3 - pBloodsplatContainer->std__vector_pBloodsplats[v32].radius < pBloodsplatContainer->std__vector_pBloodsplats[v32].x &&
+			v31 + pBloodsplatContainer->std__vector_pBloodsplats[v32].radius > pBloodsplatContainer->std__vector_pBloodsplats[v32].x &&
+			v30 - pBloodsplatContainer->std__vector_pBloodsplats[v32].radius < pBloodsplatContainer->std__vector_pBloodsplats[v32].y &&
+            v12 + pBloodsplatContainer->std__vector_pBloodsplats[v32].radius > pBloodsplatContainer->std__vector_pBloodsplats[v32].y &&
+            v28 - pBloodsplatContainer->std__vector_pBloodsplats[v32].radius < pBloodsplatContainer->std__vector_pBloodsplats[v32].z &&
+            v26 + pBloodsplatContainer->std__vector_pBloodsplats[v32].radius > pBloodsplatContainer->std__vector_pBloodsplats[v32].z )
         {
-			Vec3_float_::NegDot(&v8->vWorldPosition, v9, a4);
-			v26 = v9->y * v10->y
-				+ v9->z * v10->z
-				+ v9->x * v10->x
+			Vec3_float_::NegDot(&a5->vWorldPosition, _a3, a4);
+			v26 = _a3->y * pBloodsplatContainer->std__vector_pBloodsplats[v32].y
+				+ _a3->z * pBloodsplatContainer->std__vector_pBloodsplats[v32].z
+				+ _a3->x * pBloodsplatContainer->std__vector_pBloodsplats[v32].x
 				+ *a4;
 			v22 = v26 + 6.7553994e15;
-			v25 = LODWORD(v22);
+			//v25 = LODWORD(v22);
 			v14 = (double)SLODWORD(v22);
 			v28 = v14;
-			if ( v14 <= v10->radius )
+			if ( v14 <= pBloodsplatContainer->std__vector_pBloodsplats[v32].radius )
 			{
-				v15 = a2->flags;
+				//v15 = a2->flags;
 				if ( a2->flags & 2 || a2->flags & 0x100 )
 				{
-					v16 = v10->field_1C;
-					if ( !(v16 & 1) )
+					v16 = pBloodsplatContainer->std__vector_pBloodsplats[v32].field_1C;
+					if ( !(pBloodsplatContainer->std__vector_pBloodsplats[v32].field_1C & 1) )
 					{
 						LOBYTE(v16) = v16 | 1;
-						v10->field_1C = v16;
-						v10->field_20 = pEventTimer->Time();
+						pBloodsplatContainer->std__vector_pBloodsplats[v32].field_1C = v16;
+						pBloodsplatContainer->std__vector_pBloodsplats[v32].field_20 = pEventTimer->Time();
 					}
 				}
-				v17 = v32;
-				v10->dot_dist = LODWORD(v28);
-				v18 = v24;
-				v24->std__vector_30B00C[v24->uNumDecals] = v17;
-				++v18->uNumDecals;
+				//v17 = v32;
+				pBloodsplatContainer->std__vector_pBloodsplats[v32].dot_dist = LODWORD(v28);
+				//v18 = this;
+				this->std__vector_30B00C[this->uNumDecals] = v32;
+				++this->uNumDecals;
 			}
         }
-        ++v32;
-        ++v10;
+        //++v32;
+        //++v10;
         result = v32;
       }
     }