Mercurial > mm7
comparison Render.cpp @ 1073:d4a1a46192ba
some Render cleaning
author | zipi |
---|---|
date | Sat, 25 May 2013 12:24:35 +0100 |
parents | 48168499f52e |
children | 1e38e5c049f3 |
comparison
equal
deleted
inserted
replaced
1072:48168499f52e | 1073:d4a1a46192ba |
---|---|
4466 { | 4466 { |
4467 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | 4467 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
4468 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | 4468 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
4469 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | 4469 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
4470 } | 4470 } |
4471 if ( (signed int)uNumVertices > 0 ) | 4471 for (uint i = 0; i < uNumVertices; ++i) |
4472 { | 4472 { |
4473 v45 = (char *)&array_50AC10[0].vWorldViewPosition; | 4473 |
4474 v57 = (int)&d3d_vertex_buffer[0].pos.y; | 4474 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; |
4475 v55 = uNumVertices; | 4475 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; |
4476 do | 4476 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); |
4477 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
4478 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
4479 pGame->AlterGamma_ODM(a4, &d3d_vertex_buffer[i].diffuse); | |
4480 | |
4481 if ( this->bUsingSpecular ) | |
4477 { | 4482 { |
4478 a2 = ::GetActorTintColor(a3->dimming_level, 0, *(float *)v45, 0, 0); | 4483 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
4479 pGame->AlterGamma_ODM(a4, &a2); | |
4480 v46 = v57; | |
4481 v47 = *(float *)v45 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
4482 *(int *)(v57 - 4) = *((int *)v45 + 3); | |
4483 *(int *)v57 = *((int *)v45 + 4); | |
4484 *(int *)(v57 + 12) = a2; | |
4485 *(float *)(v57 + 4) = 1.0 - 1.0 / v47; | |
4486 *(float *)(v57 + 8) = 1.0 / (*(float *)v45 + 0.0000001); | |
4487 if ( v5->bUsingSpecular ) | |
4488 { | |
4489 v48 = sub_47C3D7_get_fog_related_stuff(0, 0, *(float *)v45); | |
4490 v46 = v57; | |
4491 } | |
4492 else | |
4493 { | |
4494 v48 = 0; | |
4495 } | |
4496 *(int *)(v46 + 16) = v48; | |
4497 *(int *)(v46 + 20) = *((int *)v45 + 6); | |
4498 *(int *)(v46 + 24) = *((int *)v45 + 7); | |
4499 v45 += 48; | |
4500 v18 = v55-- == 1; | |
4501 v57 = v46 + 32; | |
4502 } | 4484 } |
4503 while ( !v18 ); | 4485 else |
4504 } | 4486 { |
4487 d3d_vertex_buffer[i].specular = 0; | |
4488 } | |
4489 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
4490 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
4491 | |
4492 } | |
4505 | 4493 |
4506 if (a4->uAttributes & FACE_OUTLINED) | 4494 if (a4->uAttributes & FACE_OUTLINED) |
4507 { | 4495 { |
4508 int color; | 4496 int color; |
4509 if (GetTickCount() % 300 >= 150) | 4497 if (GetTickCount() % 300 >= 150) |
4521 uNumVertices, | 4509 uNumVertices, |
4522 D3DDP_DONOTLIGHT); | 4510 D3DDP_DONOTLIGHT); |
4523 } | 4511 } |
4524 else | 4512 else |
4525 { | 4513 { |
4526 if ( (signed int)uNumVertices > 0 ) | 4514 for (uint i = 0; i < uNumVertices; ++i) |
4527 { | 4515 { |
4528 v9 = (ODMFace *)&d3d_vertex_buffer[0].pos.y; | 4516 |
4529 v10 = (char *)&array_50AC10[0].vWorldViewPosition; | 4517 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; |
4530 a4 = (ODMFace *)&d3d_vertex_buffer[0].pos.y; | 4518 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; |
4531 v56 = uNumVertices; | 4519 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); |
4532 while ( 1 ) | 4520 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); |
4521 d3d_vertex_buffer[i].diffuse = GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
4522 if ( this->bUsingSpecular ) | |
4533 { | 4523 { |
4534 v11 = *(float *)v10 * 1000.0; | 4524 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
4535 *((int *)v9 - 1) = *((int *)v10 + 3); | |
4536 v12 = v11 / (double)pOutdoorCamera->shading_dist_mist; | |
4537 v9->pFacePlane.vNormal.x = *((int *)v10 + 4); | |
4538 *(float *)&v9->pFacePlane.vNormal.y = 1.0 - 1.0 / v12; | |
4539 *(float *)&v9->pFacePlane.vNormal.z = 1.0 / (*(float *)v10 + 0.0000001); | |
4540 v13 = GetActorTintColor(a3->dimming_level, 0, *(float *)v10, 0, 0); | |
4541 v14 = a4; | |
4542 v15 = *(float *)v10; | |
4543 a4->pFacePlane.dist = v13; | |
4544 if ( v5->bUsingSpecular ) | |
4545 { | |
4546 v16 = v15; | |
4547 v17 = sub_47C3D7_get_fog_related_stuff(0, 0, v16); | |
4548 v14 = a4; | |
4549 } | |
4550 else | |
4551 { | |
4552 v17 = 0; | |
4553 } | |
4554 v14->zCalc1 = v17; | |
4555 v14->zCalc2 = *((int *)v10 + 6); | |
4556 v14->zCalc3 = *((int *)v10 + 7); | |
4557 v10 += 48; | |
4558 v18 = v56-- == 1; | |
4559 a4 = (ODMFace *)((char *)v14 + 32); | |
4560 if ( v18 ) | |
4561 break; | |
4562 v9 = a4; | |
4563 } | 4525 } |
4564 } | 4526 else |
4527 { | |
4528 d3d_vertex_buffer[i].specular = 0; | |
4529 } | |
4530 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
4531 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
4532 | |
4533 } | |
4534 | |
4565 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | 4535 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
4566 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 4536 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
4567 if (bUsingSpecular) | 4537 if (bUsingSpecular) |
4568 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); | 4538 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
4569 | 4539 |
4575 D3DDP_DONOTLIGHT)); | 4545 D3DDP_DONOTLIGHT)); |
4576 //v50 = (const char *)v5->pRenderD3D->pDevice; | 4546 //v50 = (const char *)v5->pRenderD3D->pDevice; |
4577 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 4547 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
4578 //(*(void (**)(void))(*(int *)v50 + 88))(); | 4548 //(*(void (**)(void))(*(int *)v50 + 88))(); |
4579 v53->_45D74F_MessWithLight(-1, 0); | 4549 v53->_45D74F_MessWithLight(-1, 0); |
4580 v23 = uNumVertices; | 4550 for (uint i = 0; i < uNumVertices; ++i) |
4581 if ( (signed int)uNumVertices > 0 ) | 4551 { |
4582 { | 4552 d3d_vertex_buffer[i].diffuse = a2; |
4583 v24 = (char *)&d3d_vertex_buffer[0].diffuse; | 4553 } |
4584 do | |
4585 { | |
4586 *(int *)v24 = a2; | |
4587 v24 += 32; | |
4588 --v23; | |
4589 } | |
4590 while ( v23 ); | |
4591 } | |
4592 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); | 4554 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); |
4593 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 4555 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
4594 if ( !pRenderer->bUsingSpecular ) | 4556 if ( !pRenderer->bUsingSpecular ) |
4595 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | 4557 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
4596 | 4558 |
4604 D3DDP_DONOTLIGHT)); | 4566 D3DDP_DONOTLIGHT)); |
4605 if (bUsingSpecular) | 4567 if (bUsingSpecular) |
4606 { | 4568 { |
4607 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | 4569 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
4608 | 4570 |
4609 v33 = uNumVertices; | 4571 for (uint i = 0; i < uNumVertices; ++i) |
4610 if ( (signed int)uNumVertices > 0 ) | 4572 { |
4611 { | 4573 d3d_vertex_buffer[i].diffuse = pRenderer->uFogColor | d3d_vertex_buffer[i].specular & 0xFF000000; |
4612 v34 = (char *)&d3d_vertex_buffer[0].specular; | 4574 d3d_vertex_buffer[i].specular = 0; |
4613 do | 4575 } |
4614 { | 4576 |
4615 v35 = *(int *)v34; | |
4616 *(int *)v34 = 0; | |
4617 v34 += 32; | |
4618 --v33; | |
4619 *((int *)v34 - 9) = pRenderer->uFogColor | v35 & 0xFF000000; | |
4620 } | |
4621 while ( v33 ); | |
4622 } | |
4623 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 4577 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
4624 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); | 4578 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
4625 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); | 4579 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); |
4626 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 4580 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
4627 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | 4581 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, |
7434 { | 7388 { |
7435 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); | 7389 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); |
7436 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); | 7390 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); |
7437 } | 7391 } |
7438 } | 7392 } |
7439 if (uNumVertices > 0) | 7393 |
7440 { | 7394 for (uint i = 0; i < uNumVertices; ++i) |
7441 v51 = (int)&d3d_vertex_buffer[0].pos.y; | 7395 { |
7442 v52 = (char *)&array_50AC10[0].vWorldViewPosition; | 7396 |
7443 a7 = (int)&d3d_vertex_buffer[0].pos.y; | 7397 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; |
7444 v66 = uNumVertices; | 7398 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; |
7445 while ( 1 ) | 7399 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); |
7400 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | |
7401 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
7402 if ( this->bUsingSpecular ) | |
7446 { | 7403 { |
7447 v53 = *(float *)v52 * 1000.0; | 7404 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
7448 *(int *)(v51 - 4) = *((int *)v52 + 3); | |
7449 v54 = v53 / (double)pOutdoorCamera->shading_dist_mist; | |
7450 *(int *)v51 = *((int *)v52 + 4); | |
7451 *(float *)(v51 + 4) = 1.0 - 1.0 / v54; | |
7452 *(float *)(v51 + 8) = 1.0 / (*(float *)v52 + 0.0000001); | |
7453 v55 = ::GetActorTintColor(a4->dimming_level, 0, *(float *)v52, 0, 0); | |
7454 v56 = a7; | |
7455 v57 = *(float *)v52; | |
7456 *(int *)(a7 + 12) = v55; | |
7457 if ( this->bUsingSpecular ) | |
7458 { | |
7459 v58 = v57; | |
7460 v59 = sub_47C3D7_get_fog_related_stuff(0, 0, v58); | |
7461 v56 = a7; | |
7462 } | |
7463 else | |
7464 { | |
7465 v59 = 0; | |
7466 } | |
7467 *(int *)(v56 + 16) = v59; | |
7468 *(int *)(v56 + 20) = *((int *)v52 + 6); | |
7469 *(int *)(v56 + 24) = *((int *)v52 + 7); | |
7470 v52 += 48; | |
7471 v21 = v66-- == 1; | |
7472 a7 = v56 + 32; | |
7473 if ( v21 ) | |
7474 break; | |
7475 v51 = a7; | |
7476 } | 7405 } |
7477 } | 7406 else |
7478 this->pRenderD3D->pDevice->SetTexture(0, a5); | 7407 { |
7408 d3d_vertex_buffer[i].specular = 0; | |
7409 } | |
7410 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
7411 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
7412 } | |
7413 | |
7414 this->pRenderD3D->pDevice->SetTexture(0, a5); | |
7479 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer, uNumVertices, 16); | 7415 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer, uNumVertices, 16); |
7480 if (transparent) | 7416 if (transparent) |
7481 { | 7417 { |
7482 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | 7418 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
7483 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | 7419 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
7484 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | 7420 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
7485 } | 7421 } |
7486 } | 7422 } |
7487 else | 7423 else |
7488 { | 7424 { |
7489 if ( (signed int)uNumVertices > 0 ) | 7425 for (uint i = 0; i < uNumVertices; ++i) |
7490 { | 7426 { |
7491 v12 = (int)&d3d_vertex_buffer[0].pos.y; | 7427 |
7492 v13 = (char *)&array_50AC10[0].vWorldViewPosition; | 7428 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; |
7493 a7 = (int)&d3d_vertex_buffer[0].pos.y; | 7429 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; |
7494 a6a = uNumVertices; | 7430 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pOutdoorCamera->shading_dist_mist); |
7495 while ( 1 ) | 7431 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); |
7432 d3d_vertex_buffer[i].diffuse = GetActorTintColor(a4->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | |
7433 if ( this->bUsingSpecular ) | |
7496 { | 7434 { |
7497 v14 = *(float *)v13 * 1000.0; | 7435 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_related_stuff(0, 0, array_50AC10[i].vWorldViewPosition.x); |
7498 *(int *)(v12 - 4) = *((int *)v13 + 3); | |
7499 v15 = v14 / (double)pOutdoorCamera->shading_dist_mist; | |
7500 *(int *)v12 = *((int *)v13 + 4); | |
7501 *(float *)(v12 + 4) = 1.0 - 1.0 / v15; | |
7502 *(float *)(v12 + 8) = 1.0 / (*(float *)v13 + 0.0000001); | |
7503 v16 = GetActorTintColor(a4->dimming_level, 0, *(float *)v13, 0, 0); | |
7504 v17 = a7; | |
7505 v18 = *(float *)v13; | |
7506 *(int *)(a7 + 12) = v16; | |
7507 if ( this->bUsingSpecular ) | |
7508 { | |
7509 v19 = v18; | |
7510 v20 = sub_47C3D7_get_fog_related_stuff(0, 0, v19); | |
7511 v17 = a7; | |
7512 } | |
7513 else | |
7514 { | |
7515 v20 = 0; | |
7516 } | |
7517 *(int *)(v17 + 16) = v20; | |
7518 *(int *)(v17 + 20) = *((int *)v13 + 6); | |
7519 *(int *)(v17 + 24) = *((int *)v13 + 7); | |
7520 v13 += 48; | |
7521 v21 = a6a-- == 1; | |
7522 a7 = v17 + 32; | |
7523 if ( v21 ) | |
7524 break; | |
7525 v12 = a7; | |
7526 } | 7436 } |
7527 } | 7437 else |
7438 { | |
7439 d3d_vertex_buffer[i].specular = 0; | |
7440 } | |
7441 d3d_vertex_buffer[i].specular = v20; | |
7442 d3d_vertex_buffer[i].texcoord.x = array_50AC10[i].u; | |
7443 d3d_vertex_buffer[i].texcoord.y = array_50AC10[i].v; | |
7444 } | |
7528 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | 7445 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
7529 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 7446 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7530 if (pRenderer->bUsingSpecular) | 7447 if (pRenderer->bUsingSpecular) |
7531 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); | 7448 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
7532 | 7449 |
7538 16)); | 7455 16)); |
7539 //v63 = (const char *)v7->pRenderD3D->pDevice; | 7456 //v63 = (const char *)v7->pRenderD3D->pDevice; |
7540 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 7457 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
7541 //(*(void (**)(void))(*(int *)v63 + 88))(); | 7458 //(*(void (**)(void))(*(int *)v63 + 88))(); |
7542 pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); | 7459 pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); |
7543 v26 = uNumVertices; | 7460 for (uint i = 0; i < uNumVertices; ++i) |
7544 if ( (signed int)uNumVertices > 0 ) | 7461 { |
7545 { | 7462 d3d_vertex_buffer[i].diffuse = -1; |
7546 v27 = (char *)&d3d_vertex_buffer[0].diffuse; | 7463 } |
7547 do | |
7548 { | |
7549 *(int *)v27 = -1; | |
7550 v27 += 32; | |
7551 --v26; | |
7552 } | |
7553 while ( v26 ); | |
7554 } | |
7555 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); | 7464 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); |
7556 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 7465 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7557 if ( !pRenderer->bUsingSpecular ) | 7466 if ( !pRenderer->bUsingSpecular ) |
7558 { | 7467 { |
7559 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | 7468 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
7568 16)); | 7477 16)); |
7569 if ( pRenderer->bUsingSpecular ) | 7478 if ( pRenderer->bUsingSpecular ) |
7570 { | 7479 { |
7571 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | 7480 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
7572 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | 7481 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); |
7573 v37 = uNumVertices; | 7482 for (uint i = 0; i < uNumVertices; ++i) |
7574 if ( (signed int)uNumVertices > 0 ) | 7483 { |
7575 { | 7484 d3d_vertex_buffer[i].diffuse = pRenderer->uFogColor | d3d_vertex_buffer[i].specular & 0xFF000000; |
7576 v38 = (char *)&d3d_vertex_buffer[0].specular; | 7485 d3d_vertex_buffer[i].specular = 0; |
7577 do | 7486 } |
7578 { | 7487 |
7579 v39 = *(int *)v38; | |
7580 *(int *)v38 = 0; | |
7581 v38 += 32; | |
7582 --v37; | |
7583 *((int *)v38 - 9) = pRenderer->uFogColor | v39 & 0xFF000000; | |
7584 } | |
7585 while ( v37 ); | |
7586 } | |
7587 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem | 7488 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem |
7588 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); | 7489 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
7589 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); | 7490 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); |
7590 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 7491 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
7591 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7492 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |