changeset 1161:d8f0f1a70b91

Merge
author Gloval
date Tue, 04 Jun 2013 01:38:18 +0400
parents 502b8b2e36b4 (current diff) da80e03c677c (diff)
children 3d96daa7e069
files
diffstat 1 files changed, 47 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/Render.cpp	Tue Jun 04 01:37:23 2013 +0400
+++ b/Render.cpp	Tue Jun 04 01:38:18 2013 +0400
@@ -8437,116 +8437,83 @@
 //----- (004A49D0) --------------------------------------------------------
 void Render::DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9)
 {
-  int v10; // eax@1
-  unsigned int v11; // ebx@1
-  unsigned int v12; // ecx@1
-  int v13; // edx@2
-  int v14; // edx@4
-  unsigned int v15; // edx@6
+  int absXDifference; // eax@1
+  int absYDifference; // eax@1
+  unsigned int smallerabsdiff; // ebx@1
+  unsigned int largerabsdiff;
   double v16; // st7@7
   double v17; // st7@7
   double v18; // st6@7
-  double v19; // st4@7
   double v20; // st4@8
   double v21; // st4@10
   double v22; // st4@10
   double v23; // st4@10
-  double v24; // st4@10
   double v25; // st4@11
   double v26; // st4@13
-  double v27; // st5@13
   double v28; // st4@13
   RenderVertexD3D3 v29[4]; // [sp+0h] [bp-94h]@7
-  double v30; // [sp+80h] [bp-14h]@1
-  int v31; // [sp+88h] [bp-Ch]@1
+  int xDifference; // [sp+88h] [bp-Ch]@1
   signed int v32; // [sp+8Ch] [bp-8h]@1
-  int X; // [sp+90h] [bp-4h]@1
-  float a3a; // [sp+A4h] [bp+10h]@10
-  float a4a; // [sp+A8h] [bp+14h]@10
-
-  *(float *)&X = dstX - srcX;
-  v30 = *(float *)&X + 6.7553994e15;
-  v31 = LODWORD(v30);
-  *(float *)&v32 = dstY - srcY;
-  v30 = *(float *)&v32 + 6.7553994e15;
-  X = LODWORD(v30);
-  HIDWORD(v30) = abs(COERCE_UNSIGNED_INT64(*(float *)&v32 + 6.7553994e15));
-  v10 = abs(v31);
-  v32 = v10;
-  v11 = HIDWORD(v30);
-  v12 = 0;
-  if ( v10 < SHIDWORD(v30) )
-  {
-    v13 = v10;
-    v10 = HIDWORD(v30);
-    v11 = v13;
-  }
-  if ( v10 < 0 )
-  {
-    v14 = v10;
-    v10 = 0;
-    v12 = v14;
-  }
-  if ( (signed int)v11 < (signed int)v12 )
-  {
-    v15 = v12;
-    v12 = v11;
-    v11 = v15;
-  }
-  v32 = (11 * v11 >> 5) + (v12 >> 2) + v10;
+  int yDifference; // [sp+90h] [bp-4h]@1
+
+  xDifference = bankersRounding(dstX - srcX);
+  yDifference = bankersRounding(dstY - srcY);
+  absYDifference = abs(yDifference);
+  absXDifference = abs(xDifference);
+  smallerabsdiff = min(absXDifference, absYDifference);
+  largerabsdiff = max(absXDifference, absYDifference);
+  v32 = (11 * smallerabsdiff >> 5) + largerabsdiff;
   v16 = 1.0 / (double)v32;
-  *(float *)&v31 = (double)v31 * v16;
-  *(float *)&X = (double)X * v16;
-  v17 = *(float *)&X * a4;
+  v17 = (double)yDifference * v16 * a4;
+  v18 = (double)xDifference * v16 * a4;
+  if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
+  {
+    v20 = a3 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
+    v25 = a7 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
+  }
+  else
+  {
+    v20 = a3 * 0.061758894;
+    v25 = a7 * 0.061758894;
+  }
+  v21 = 1.0 / a3;
+  v22 = (double)yDifference * v16 * a8;
+  v23 = (double)xDifference * v16 * a8;
+  v26 = 1.0 - 1.0 / v25;
+  v28 = 1.0 / a7;
   v29[0].pos.x = srcX + v17;
-  v18 = *(float *)&v31 * a4;
   v29[0].pos.y = srcY - v18;
-  v19 = a3;
-  if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
-    v20 = v19 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
-  else
-    v20 = v19 * 0.061758894;
+  v29[0].pos.z = 1.0 - 1.0 / v20;
+  v29[0].rhw = v21;
   v29[0].diffuse = -1;
   v29[0].specular = 0;
-  v29[0].pos.z = 1.0 - 1.0 / v20;
-  v21 = 1.0 / a3;
-  *((float *)&v30 + 1) = v21;
-  v29[0].rhw = v21;
   v29[0].texcoord.x = 1.0;
   v29[0].texcoord.y = 0.0;
-  v22 = *(float *)&X * a8;
-  a3a = v22;
+
   v29[1].pos.x = v22 + dstX;
-  v23 = *(float *)&v31 * a8;
-  a4a = v23;
   v29[1].pos.y = dstY - v23;
-  v24 = a7;
-  if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
-    v25 = v24 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
-  else
-    v25 = v24 * 0.061758894;
-  v29[2].diffuse = -1;
-  v29[3].diffuse = -1;
-  *(_QWORD *)&v29[3].pos.z = __PAIR__(HIDWORD(v30), LODWORD(v29[0].pos.z));
+  v29[1].pos.z = v26;
+  v29[1].rhw = v28;
   v29[1].diffuse = -16711936;
   v29[1].specular = 0;
-  v29[2].specular = 0;
-  v29[3].specular = 0;
-  v26 = 1.0 - 1.0 / v25;
-  v29[1].pos.z = v26;
-  v27 = v26;
-  v28 = 1.0 / a7;
-  v29[1].rhw = v28;
   v29[1].texcoord.x = 1.0;
   v29[1].texcoord.y = 1.0;
-  v29[2].pos.x = dstX - a3a;
-  v29[2].pos.y = a4a + dstY;
-  v29[2].pos.z = v27;
+
+  v29[2].pos.x = dstX - v22;
+  v29[2].pos.y = v23 + dstY;
+  v29[2].pos.z = v26;
   v29[2].rhw = v28;
+  v29[2].diffuse = -1;
+  v29[2].specular = 0;
   v29[2].texcoord.x = 0.0;
   v29[2].texcoord.y = 1.0;
+
   v29[3].pos.x = srcX - v17;
   v29[3].pos.y = v18 + srcY;
+  v29[3].pos.z = v29[0].pos.z;
+  v29[3].rhw = v21;
+  v29[3].diffuse = -1;
+  v29[3].specular = 0;
   v29[3].texcoord.x = 0.0;
   v29[3].texcoord.y = 0.0;
   ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE));