comparison Render.cpp @ 1159:da80e03c677c

Render::DrawProjectile cleanup (correct)
author Grumpy7
date Mon, 03 Jun 2013 23:26:05 +0200
parents fc2721c89fdb
children 79fd2fb7a3ab
comparison
equal deleted inserted replaced
1158:0e8cff85fb00 1159:da80e03c677c
8435 } 8435 }
8436 8436
8437 //----- (004A49D0) -------------------------------------------------------- 8437 //----- (004A49D0) --------------------------------------------------------
8438 void Render::DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9) 8438 void Render::DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9)
8439 { 8439 {
8440 int v10; // eax@1 8440 int absXDifference; // eax@1
8441 unsigned int v11; // ebx@1 8441 int absYDifference; // eax@1
8442 unsigned int v12; // ecx@1 8442 unsigned int smallerabsdiff; // ebx@1
8443 int v13; // edx@2 8443 unsigned int largerabsdiff;
8444 int v14; // edx@4
8445 unsigned int v15; // edx@6
8446 double v16; // st7@7 8444 double v16; // st7@7
8447 double v17; // st7@7 8445 double v17; // st7@7
8448 double v18; // st6@7 8446 double v18; // st6@7
8449 double v19; // st4@7
8450 double v20; // st4@8 8447 double v20; // st4@8
8451 double v21; // st4@10 8448 double v21; // st4@10
8452 double v22; // st4@10 8449 double v22; // st4@10
8453 double v23; // st4@10 8450 double v23; // st4@10
8454 double v24; // st4@10
8455 double v25; // st4@11 8451 double v25; // st4@11
8456 double v26; // st4@13 8452 double v26; // st4@13
8457 double v27; // st5@13
8458 double v28; // st4@13 8453 double v28; // st4@13
8459 RenderVertexD3D3 v29[4]; // [sp+0h] [bp-94h]@7 8454 RenderVertexD3D3 v29[4]; // [sp+0h] [bp-94h]@7
8460 double v30; // [sp+80h] [bp-14h]@1 8455 int xDifference; // [sp+88h] [bp-Ch]@1
8461 int v31; // [sp+88h] [bp-Ch]@1
8462 signed int v32; // [sp+8Ch] [bp-8h]@1 8456 signed int v32; // [sp+8Ch] [bp-8h]@1
8463 int X; // [sp+90h] [bp-4h]@1 8457 int yDifference; // [sp+90h] [bp-4h]@1
8464 float a3a; // [sp+A4h] [bp+10h]@10 8458
8465 float a4a; // [sp+A8h] [bp+14h]@10 8459 xDifference = bankersRounding(dstX - srcX);
8466 8460 yDifference = bankersRounding(dstY - srcY);
8467 *(float *)&X = dstX - srcX; 8461 absYDifference = abs(yDifference);
8468 v30 = *(float *)&X + 6.7553994e15; 8462 absXDifference = abs(xDifference);
8469 v31 = LODWORD(v30); 8463 smallerabsdiff = min(absXDifference, absYDifference);
8470 *(float *)&v32 = dstY - srcY; 8464 largerabsdiff = max(absXDifference, absYDifference);
8471 v30 = *(float *)&v32 + 6.7553994e15; 8465 v32 = (11 * smallerabsdiff >> 5) + largerabsdiff;
8472 X = LODWORD(v30);
8473 HIDWORD(v30) = abs(COERCE_UNSIGNED_INT64(*(float *)&v32 + 6.7553994e15));
8474 v10 = abs(v31);
8475 v32 = v10;
8476 v11 = HIDWORD(v30);
8477 v12 = 0;
8478 if ( v10 < SHIDWORD(v30) )
8479 {
8480 v13 = v10;
8481 v10 = HIDWORD(v30);
8482 v11 = v13;
8483 }
8484 if ( v10 < 0 )
8485 {
8486 v14 = v10;
8487 v10 = 0;
8488 v12 = v14;
8489 }
8490 if ( (signed int)v11 < (signed int)v12 )
8491 {
8492 v15 = v12;
8493 v12 = v11;
8494 v11 = v15;
8495 }
8496 v32 = (11 * v11 >> 5) + (v12 >> 2) + v10;
8497 v16 = 1.0 / (double)v32; 8466 v16 = 1.0 / (double)v32;
8498 *(float *)&v31 = (double)v31 * v16; 8467 v17 = (double)yDifference * v16 * a4;
8499 *(float *)&X = (double)X * v16; 8468 v18 = (double)xDifference * v16 * a4;
8500 v17 = *(float *)&X * a4; 8469 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
8470 {
8471 v20 = a3 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
8472 v25 = a7 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
8473 }
8474 else
8475 {
8476 v20 = a3 * 0.061758894;
8477 v25 = a7 * 0.061758894;
8478 }
8479 v21 = 1.0 / a3;
8480 v22 = (double)yDifference * v16 * a8;
8481 v23 = (double)xDifference * v16 * a8;
8482 v26 = 1.0 - 1.0 / v25;
8483 v28 = 1.0 / a7;
8501 v29[0].pos.x = srcX + v17; 8484 v29[0].pos.x = srcX + v17;
8502 v18 = *(float *)&v31 * a4;
8503 v29[0].pos.y = srcY - v18; 8485 v29[0].pos.y = srcY - v18;
8504 v19 = a3; 8486 v29[0].pos.z = 1.0 - 1.0 / v20;
8505 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 8487 v29[0].rhw = v21;
8506 v20 = v19 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
8507 else
8508 v20 = v19 * 0.061758894;
8509 v29[0].diffuse = -1; 8488 v29[0].diffuse = -1;
8510 v29[0].specular = 0; 8489 v29[0].specular = 0;
8511 v29[0].pos.z = 1.0 - 1.0 / v20;
8512 v21 = 1.0 / a3;
8513 *((float *)&v30 + 1) = v21;
8514 v29[0].rhw = v21;
8515 v29[0].texcoord.x = 1.0; 8490 v29[0].texcoord.x = 1.0;
8516 v29[0].texcoord.y = 0.0; 8491 v29[0].texcoord.y = 0.0;
8517 v22 = *(float *)&X * a8; 8492
8518 a3a = v22;
8519 v29[1].pos.x = v22 + dstX; 8493 v29[1].pos.x = v22 + dstX;
8520 v23 = *(float *)&v31 * a8;
8521 a4a = v23;
8522 v29[1].pos.y = dstY - v23; 8494 v29[1].pos.y = dstY - v23;
8523 v24 = a7; 8495 v29[1].pos.z = v26;
8524 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 8496 v29[1].rhw = v28;
8525 v25 = v24 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
8526 else
8527 v25 = v24 * 0.061758894;
8528 v29[2].diffuse = -1;
8529 v29[3].diffuse = -1;
8530 *(_QWORD *)&v29[3].pos.z = __PAIR__(HIDWORD(v30), LODWORD(v29[0].pos.z));
8531 v29[1].diffuse = -16711936; 8497 v29[1].diffuse = -16711936;
8532 v29[1].specular = 0; 8498 v29[1].specular = 0;
8533 v29[2].specular = 0;
8534 v29[3].specular = 0;
8535 v26 = 1.0 - 1.0 / v25;
8536 v29[1].pos.z = v26;
8537 v27 = v26;
8538 v28 = 1.0 / a7;
8539 v29[1].rhw = v28;
8540 v29[1].texcoord.x = 1.0; 8499 v29[1].texcoord.x = 1.0;
8541 v29[1].texcoord.y = 1.0; 8500 v29[1].texcoord.y = 1.0;
8542 v29[2].pos.x = dstX - a3a; 8501
8543 v29[2].pos.y = a4a + dstY; 8502 v29[2].pos.x = dstX - v22;
8544 v29[2].pos.z = v27; 8503 v29[2].pos.y = v23 + dstY;
8504 v29[2].pos.z = v26;
8545 v29[2].rhw = v28; 8505 v29[2].rhw = v28;
8506 v29[2].diffuse = -1;
8507 v29[2].specular = 0;
8546 v29[2].texcoord.x = 0.0; 8508 v29[2].texcoord.x = 0.0;
8547 v29[2].texcoord.y = 1.0; 8509 v29[2].texcoord.y = 1.0;
8510
8548 v29[3].pos.x = srcX - v17; 8511 v29[3].pos.x = srcX - v17;
8549 v29[3].pos.y = v18 + srcY; 8512 v29[3].pos.y = v18 + srcY;
8513 v29[3].pos.z = v29[0].pos.z;
8514 v29[3].rhw = v21;
8515 v29[3].diffuse = -1;
8516 v29[3].specular = 0;
8550 v29[3].texcoord.x = 0.0; 8517 v29[3].texcoord.x = 0.0;
8551 v29[3].texcoord.y = 0.0; 8518 v29[3].texcoord.y = 0.0;
8552 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); 8519 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE));
8553 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); 8520 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
8554 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); 8521 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE));