Mercurial > mm7
changeset 1156:bca3f865990b
Render::DrawProjectile restoring cleanup
author | Grumpy7 |
---|---|
date | Mon, 03 Jun 2013 23:20:42 +0200 |
parents | 38662d9c8be8 |
children | fc2721c89fdb |
files | Render.cpp |
diffstat | 1 files changed, 23 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/Render.cpp Mon Jun 03 04:49:34 2013 +0200 +++ b/Render.cpp Mon Jun 03 23:20:42 2013 +0200 @@ -8437,88 +8437,51 @@ //----- (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; - *(float *)&v31 = v30; - *(float *)&v32 = dstY - srcY; - v30 = *(float *)&v32 + 6.7553994e15; - *(float *)&X = v30; - HIDWORD(v30) = abs(*(__int64 *)&v30); - 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; v29[0].pos.x = srcX + v17; - v18 = *(float *)&v31 * a4; + v18 = (double)xDifference * v16 * a4; v29[0].pos.y = srcY - v18; - v19 = a3; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) - v20 = v19 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; + v20 = a3 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; else - v20 = v19 * 0.061758894; + v20 = a3 * 0.061758894; 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; + v22 = (double)yDifference * v16 * a8; v29[1].pos.x = v22 + dstX; - v23 = *(float *)&v31 * a8; - a4a = v23; + v23 = (double)xDifference * v16 * a8; v29[1].pos.y = dstY - v23; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) v25 = a7 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; @@ -8530,7 +8493,6 @@ v29[1].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; @@ -8538,9 +8500,9 @@ v29[2].diffuse = -1; v29[2].specular = 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].texcoord.x = 0.0; v29[2].texcoord.y = 1.0;